### Install Setup Wizard Components Source: https://github.com/arindam200/termui/blob/main/skills/cli-creator/references/patterns.md Use this command to add the necessary components for building a setup wizard with TermUI. ```bash npx termui add setup-flow text-input select multi-select spinner ``` -------------------------------- ### TermUI First-time Setup Source: https://github.com/arindam200/termui/blob/main/README.md Steps for cloning the repository, installing dependencies, and building the core package. ```bash git clone https://github.com/Arindam200/termui.git cd termui pnpm install # Build core first — other packages depend on it pnpm --filter @termui/core build pnpm test ``` -------------------------------- ### Install Dependencies and Build Core Source: https://github.com/arindam200/termui/blob/main/CONTRIBUTING.md Steps to clone the repository, install dependencies using pnpm, build the core package, and run all tests to ensure a working setup. ```bash git clone https://github.com//termui.git cd termui pnpm install pnpm --filter @termui/core build pnpm test ``` -------------------------------- ### Install and Run TermUI AI Assistant Source: https://github.com/arindam200/termui/blob/main/templates/ai-assistant/README.md Installs project dependencies and starts the development server for the AI chat CLI. ```bash npm install npm run dev ``` -------------------------------- ### Install TermUI Components for Login Flow Source: https://github.com/arindam200/termui/blob/main/skills/cli-creator/references/patterns.md Installs necessary TermUI components for building login and setup flows, including input fields, spinners, and alerts. ```bash npx termui add login-flow text-input password-input setup-flow spinner alert ``` -------------------------------- ### Install Community Components Source: https://github.com/arindam200/termui/blob/main/CONTRIBUTING_COMPONENTS.md Command to install a published component from the community registry. ```bash npx termui add @your-handle/my-component ``` -------------------------------- ### Install termui Components Source: https://github.com/arindam200/termui/blob/main/skills/cli-creator/references/patterns.md Installs necessary components for building a data browser UI with termui. ```bash npx termui add app-shell search-input table alert spinner ``` -------------------------------- ### Install and Initialize TermUI Project Source: https://github.com/arindam200/termui/blob/main/skills/cli-creator/SKILL.md Commands to set up a new TermUI project, install dependencies, initialize configuration, add specific components, and run the development server. ```bash cd npm install npx termui init # sets up termui.config.json npx termui add # install exactly the components you're using npm run dev # run with tsx (hot-reloading) ``` -------------------------------- ### Start TermUI MCP Server Source: https://github.com/arindam200/termui/blob/main/README.md Provides commands to start the Model Context Protocol (MCP) server directly using stdio transport or to install the MCP configuration for AI tools. ```bash # Start the server directly (stdio transport) npx termui mcp # Or install the config for your AI tool npx termui add mcp ``` -------------------------------- ### Implement SetupFlow Source: https://github.com/arindam200/termui/blob/main/skills/termui/references/components.md Displays a sequential step-by-step setup process with status indicators. ```tsx v2.0 // status: 'done'|'active'|'pending'|'error' ``` -------------------------------- ### Install TermUI Components Source: https://github.com/arindam200/termui/blob/main/skills/cli-creator/references/patterns.md Use this command to install the necessary TermUI components for building a dashboard. ```bash npx termui add app-shell tabs bar-chart gauge sparkline spinner status-message ``` -------------------------------- ### SetupFlow Component Source: https://github.com/arindam200/termui/blob/main/docs/templates.md A step-by-step setup wizard component for CLI applications. ```APIDOC ## SetupFlow ### Description A step-by-step setup wizard with connectors between steps, animated spinners, status icons per step, and a multi-select checklist. ### Parameters #### Props - **children** (ReactNode) - Required - The content of the setup flow. - **title** (string) - Optional - The title of the setup flow. - **titleFont** (BigTextFont) - Optional - The font style for the title (default: 'block'). - **titleColor** (string) - Optional - The color of the title (default: '#888888'). - **connectorChar** (string) - Optional - The character used for connectors (default: '│'). - **connectorColor** (string) - Optional - The color of the connector (default: theme muted). ``` -------------------------------- ### Add WelcomeScreen Component Source: https://github.com/arindam200/termui/blob/main/docs/templates.md Install the WelcomeScreen component using the termui CLI. ```sh npx termui add welcome-screen ``` -------------------------------- ### Full Example: Counter Component Test Source: https://github.com/arindam200/termui/blob/main/docs/api/testing.md An example demonstrating how to use TermUI's testing utilities to test a 'Counter' component. It includes setup with Vitest, creating a renderer, and asserting the initial count. ```tsx import { describe, it, expect, afterEach } from 'vitest'; import React, { useState } from 'react'; import { Text } from 'ink'; import { createTestRenderer, screen, fireEvent, waitFor } from 'termui/testing'; describe('Counter', () => { const { render, cleanup } = createTestRenderer(); afterEach(cleanup); it('renders initial count', async () => { const result = render(); await new Promise((r) => setTimeout(r, 50)); expect(screen.hasText('Count: 0', result.output)).toBe(true); }); }); ``` -------------------------------- ### Install simple-git Source: https://github.com/arindam200/termui/blob/main/docs/adapters.md Install the simple-git package as a peer dependency for the termui/git library. ```sh npm install simple-git ``` -------------------------------- ### Install AI Adapter Hooks Source: https://github.com/arindam200/termui/blob/main/docs/ai.md Commands to install the core termui package and necessary provider SDKs. ```sh npm install termui # plus at least one provider SDK npm install @anthropic-ai/sdk # for Anthropic npm install openai # for OpenAI # Ollama needs no extra SDK — it uses fetch ``` -------------------------------- ### List Available Components Source: https://github.com/arindam200/termui/blob/main/docs/api/cli.md List all available components in the registry along with their installation status in your project. ```sh npx termui list ``` -------------------------------- ### Install termui CLI Source: https://github.com/arindam200/termui/blob/main/docs/templates.md Use this command to install the termui CLI tool, which may be required for certain functionalities or project setups. ```sh npx termui add help-screen ``` -------------------------------- ### Install TermUI Components for Log Viewer Source: https://github.com/arindam200/termui/blob/main/skills/cli-creator/references/patterns.md Install the necessary TermUI components for building a log viewer or event feed. ```bash npx termui add app-shell log status-message badge spinner ``` -------------------------------- ### Start Interactive Demo App Source: https://github.com/arindam200/termui/blob/main/README.md Run the interactive demo application using pnpm. ```bash pnpm --filter @termui/demo start ``` -------------------------------- ### Install Anthropic AI SDK Source: https://github.com/arindam200/termui/blob/main/templates/ai-assistant/README.md Installs the necessary SDK for integrating Anthropic's Claude models. ```bash npm install @anthropic-ai/sdk ``` -------------------------------- ### Keyboard Navigation Example Source: https://github.com/arindam200/termui/blob/main/docs/api/hooks.md Example of using the useKeyboardNavigation hook to manage active item selection in a list. ```tsx function MyMenu({ items }: { items: string[] }) { const { activeIndex } = useKeyboardNavigation({ itemCount: items.length, onSelect: (i) => console.log('selected:', items[i]), onDismiss: () => setOpen(false), }); return ( {items.map((item, i) => ( {item} ))} ); } ``` -------------------------------- ### Install termui Source: https://github.com/arindam200/termui/blob/main/docs/api/testing.md Install the termui package as a development dependency. ```sh pnpm add -D termui ``` -------------------------------- ### Install AI Components Source: https://github.com/arindam200/termui/blob/main/docs/ai.md Command to add individual AI components to your project. ```sh npx termui add chat-message chat-thread tool-call thinking-block \ token-usage context-meter tool-approval model-selector file-change ``` -------------------------------- ### Initialize TermUI Project via CLI Source: https://github.com/arindam200/termui/blob/main/README.md Launch the interactive TermUI CLI menu or use direct commands for initialization and component addition. This is part of the quick start process. ```bash # Launch the interactive menu npx termui # Or use commands directly npx termui init npx termui add spinner npx termui add table select alert npx termui list ``` -------------------------------- ### Install MCP Server Configuration Source: https://github.com/arindam200/termui/blob/main/docs/api/cli.md Install the MCP server configuration into an AI tool. This command prompts for the installation scope, which can be local project or global for specific AI tools. ```sh npx termui add mcp ``` -------------------------------- ### Install cfonts Engine for BigText Source: https://github.com/arindam200/termui/blob/main/docs/typography.md Instructions for installing the 'cfonts' engine and copying BigText component files in a shadcn-style project. ```bash npx termui add big-text # copies BigText.tsx + BigText.font.ts (basic engine) npm install cfonts # opt in to engine="cfonts" — only needed for richer fonts ``` -------------------------------- ### Install a component via CLI Source: https://github.com/arindam200/termui/blob/main/registry/index.html Use this command to add a specific component to your project. ```bash npx termui add ``` -------------------------------- ### React Setup Wizard Component Source: https://github.com/arindam200/termui/blob/main/skills/cli-creator/references/patterns.md This React component implements a multi-step setup wizard. It uses `useState` for managing the current step and configuration, and `useInput` for handling global key presses like Ctrl+C to exit. Each step conditionally renders different TermUI input components or displays the selected configuration. ```tsx // src/app.tsx import React, { useState } from 'react'; import { Text } from 'ink'; import { useInput, useTheme } from 'termui/core'; import { SetupFlow } from '../components/templates/SetupFlow.js'; import { TextInput } from '../components/input/TextInput.js'; import { Select } from '../components/selection/Select.js'; import { MultiSelect } from '../components/selection/MultiSelect.js'; type Step = 'name' | 'framework' | 'features' | 'installing' | 'done'; export function App() { const theme = useTheme(); const [step, setStep] = useState('name'); const [config, setConfig] = useState({ name: '', framework: '', features: [] as string[] }); useInput((input, key) => { if (key.ctrl && input === 'c') process.exit(0); }); const isComplete = (s: Step) => { const order: Step[] = ['name', 'framework', 'features', 'installing', 'done']; return order.indexOf(s) < order.indexOf(step); }; return ( {/* Step 1 */} {step === 'name' ? ( { setConfig((c) => ({ ...c, name })); setStep('framework'); }} /> ) : ( Project name: {config.name} )} {/* Step 2 */} {(step === 'framework' || isComplete('framework')) && ( {step === 'framework' ? ( console.log('Selected:', val)} /> ); } render(); ``` -------------------------------- ### Install Commander Peer Dependency Source: https://github.com/arindam200/termui/blob/main/docs/adapters.md Install the `commander` package as a peer dependency before using the TermUI commander adapter. ```sh npm install commander ``` -------------------------------- ### Add LoginFlow Component Source: https://github.com/arindam200/termui/blob/main/docs/templates.md Install the LoginFlow component using the termui CLI. ```sh npx termui add login-flow ``` -------------------------------- ### Conventional Commits Example Source: https://github.com/arindam200/termui/blob/main/CONTRIBUTING.md Examples illustrating the Conventional Commits format for commit messages, including types like 'feat', 'fix', 'docs', and 'chore'. ```text feat(components): add GanttChart component fix(testing): use debug mode to capture output in CI docs(readme): update component count to 101 ``` -------------------------------- ### Modal with ARIA Annotations Example Source: https://github.com/arindam200/termui/blob/main/docs/accessibility.md Example of using `aria-label` and `aria-description` props on a `Modal` component to provide context for screen readers. ```tsx ... ``` -------------------------------- ### TermUI CLI Component Installation Source: https://github.com/arindam200/termui/blob/main/docs/interview-guide.md Use this command to add TermUI components directly into your project. This approach avoids runtime lock-in and allows for full customization. ```bash npx termui add spinner ``` -------------------------------- ### Theme Provider Setup Source: https://github.com/arindam200/termui/blob/main/docs/interview-guide.md Wraps the application with a ThemeProvider to apply a specific theme. It automatically detects dark/light mode based on the COLORFGBG environment variable. ```tsx ``` -------------------------------- ### In-App Notification Provider Setup Source: https://github.com/arindam200/termui/blob/main/docs/api/hooks.md Set up the notification system by calling `useNotificationsProvider` in a parent component. This provides the necessary context for the notification queue. ```tsx // In root component: const { value } = useNotificationsProvider(); return ( ); ``` -------------------------------- ### Custom File List with Keyboard Navigation Source: https://github.com/arindam200/termui/blob/main/docs/accessibility.md Example of creating a custom file list component that utilizes the `useKeyboardNavigation` hook to manage active item selection and handle file opening or dismissal. ```tsx import { useKeyboardNavigation } from 'termui'; import { Box, Text } from 'ink'; function FileList({ files }: { files: string[] }) { const { activeIndex } = useKeyboardNavigation({ itemCount: files.length, onSelect: (i) => openFile(files[i]!), onDismiss: () => setOpen(false), }); return ( {files.map((file, i) => ( {i === activeIndex ? '> ' : ' '} {file} ))} ); } ``` -------------------------------- ### WelcomeScreen Template Source: https://github.com/arindam200/termui/blob/main/skills/termui/references/components.md The WelcomeScreen template creates a two-panel welcome dashboard, typically used for initial setup or overview. It separates content into left and right panels, allowing for greetings, logos, metadata, and sections with lists. ```tsx Welcome back, Arindam! MA ``` -------------------------------- ### Spawn a pseudo-terminal with termui/pty Source: https://github.com/arindam200/termui/blob/main/packages/adapters/pty/README.md Initializes a pseudo-terminal process and handles output data. Ensure node-pty is installed as a peer dependency. ```ts import { spawnPty, usePtyOutput } from 'termui/pty'; const p = await spawnPty('bash', ['-c', 'echo hi'], { cols: 80, rows: 24 }); if (p) { p.onData((d) => process.stdout.write(d)); p.onExit(() => {}); } ``` -------------------------------- ### Build an Interactive Chat UI with useChat Hook Source: https://github.com/arindam200/termui/blob/main/docs/ai.md Combine `ChatThread`, `TextInput`, and `useChat` to create a minimal interactive chat UI. This example demonstrates setting up a chat with a system prompt, handling user input, and displaying messages and token usage. The `isStreaming` flag controls the placeholder text in the input field. ```tsx import React, { useState } from 'react'; import { render } from 'ink'; import { useChat } from 'termui/ai'; import { ChatThread, ChatMessage, TokenUsage, TextInput } from 'termui/components'; function ChatApp() { const [input, setInput] = useState(''); const { messages, sendMessage, isStreaming, tokenUsage } = useChat({ provider: 'anthropic', model: 'claude-sonnet-4-6', systemPrompt: 'You are a helpful terminal assistant. Be concise.', }); const handleSubmit = async (value: string) => { if (!value.trim() || isStreaming) return; setInput(''); await sendMessage(value.trim()); }; return ( <> {messages.map((msg, i) => ( {msg.content} ))} {tokenUsage && ( )} ); } render(); ``` -------------------------------- ### Use TermUI Ora Spinner Source: https://github.com/arindam200/termui/blob/main/docs/adapters.md Instantiate and control an ora spinner. Start the spinner, perform an asynchronous operation, and then finalize with `succeed`, `fail`, `warn`, or `info`. ```typescript import { ora } from 'termui/ora'; const spinner = ora({ text: 'Loading data…', color: 'cyan' }).start(); await fetchData(); spinner.succeed('Data loaded'); // or spinner.fail('Request failed'); ``` -------------------------------- ### Use useTerminalSize in Vue Source: https://github.com/arindam200/termui/blob/main/docs/adapters.md Use the useTerminalSize composable in a Vue 3 script setup block to get reactive terminal dimensions. ```ts import type { SelectProps, TableProps } from 'termui/vue'; import { useTerminalSize } from 'termui/vue'; // In a Vue 3