{"owner":"sirmalloc","repo":"ccstatusline","hasSkills":true,"totalSkillsCount":1,"totalTokensCount":1846,"categories":["root-instruction"],"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md"],"skills":{"AGENTS.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nccstatusline is a customizable status line formatter for Claude Code CLI that displays model info, git branch, token usage, and other metrics. It functions as both:\n1. A piped command processor for Claude Code status lines\n2. An interactive TUI configuration tool when run without input\n\n## Development Commands\n\n```bash\n# Install dependencies\nbun install\n\n# Run in interactive TUI mode\nbun run start\n\n# Test with piped input (use [1m] suffix for 1M context models)\necho '{\"model\":{\"id\":\"claude-sonnet-4-5-20250929[1m]\"},\"transcript_path\":\"test.jsonl\"}' | bun run src/ccstatusline.ts\n\n# Or use example payload\nbun run example\n\n# Build for npm distribution\nbun run build   # Creates dist/ccstatusline.js with Node.js 14+ compatibility\n\n# Run tests\nbun test\n\n# Run tests in watch mode\nbun test --watch\n\n# Lint and type check\nbun run lint      # Runs TypeScript type checking and ESLint without modifying files\n\n# Apply ESLint auto-fixes intentionally\nbun run lint:fix\n```\n\n## Architecture\n\nThe project has dual runtime compatibility - works with both Bun and Node.js:\n\n### Core Structure\n- **src/ccstatusline.ts**: Main entry point that detects piped vs interactive mode\n  - Piped mode: Parses JSON from stdin and renders formatted status line\n  - Interactive mode: Launches React/Ink TUI for configuration\n\n### TUI Components (src/tui/)\n- **index.tsx**: Main TUI entry point that handles React/Ink initialization\n- **App.tsx**: Root component managing navigation and state\n- **components/**: Modular UI components for different configuration screens\n  - MainMenu, LineSelector, ItemsEditor, ColorMenu, GlobalOverridesMenu\n  - PowerlineSetup, TerminalOptionsMenu, StatusLinePreview\n\n### Utilities (src/utils/)\n- **config.ts**: Settings management\n  - Loads from `~/.config/ccstatusline/settings.json`\n  - Handles migration from old settings format\n  - Default configuration if no settings exist\n- **renderer.ts**: Core rendering logic for status lines\n  - Handles terminal width detection and truncation\n  - Applies colors, padding, and separators\n  - Manages flex separator expansion\n- **powerline.ts**: Powerline font detection and installation\n- **claude-settings.ts**: Integration with Claude Code settings.json\n  - Respects `CLAUDE_CONFIG_DIR` environment variable with fallback to `~/.claude`\n  - Provides installation command constants (NPM, BUNX, self-managed)\n  - Detects installation status and manages settings.json updates\n  - Validates config directory paths with proper error handling\n- **colors.ts**: Color definitions and ANSI code mapping\n- **model-context.ts**: Model-to-context-window mapping\n  - Maps model IDs to their context window sizes based on [1m] suffix\n  - Sonnet 4.5 WITH [1m] suffix: 1M tokens (800k usable at 80%) - requires long context beta access\n  - Sonnet 4.5 WITHOUT [1m] suffix: 200k tokens (160k usable at 80%)\n  - Legacy models: 200k tokens (160k usable at 80%)\n\n### Widgets (src/widgets/)\nCustom widgets implementing the Widget interface defined in src/types/Widget.ts:\n\n**Widget Interface:**\nAll widgets must implement:\n- `getDefaultColor()`: Default color for the widget\n- `getDescription()`: Description shown in TUI\n- `getDisplayName()`: Display name shown in TUI\n- `getEditorDisplay()`: How the widget appears in the editor\n- `render()`: Core rendering logic that produces the widget output\n- `supportsRawValue()`: Whether widget supports raw value mode\n- `supportsColors()`: Whether widget supports color customization\n- Optional: `renderEditor()`, `getCustomKeybinds()`, `getHideableStates()`, `supportsNumberFormat()`, `handleEditorAction()`\n\n**Widget Registry Pattern:**\n- Located in src/utils/widgets.ts\n- Uses a Map-based registry (`widgetRegistry`) that maps widget type strings to widget instances\n- `getWidget(type)`: Retrieves widget instance by type\n- `getAllWidgetTypes()`: Returns all available widget types\n- `isKnownWidgetType()`: Validates if a type is registered\n\n**Available Widgets** (highlights — the full, current list lives in `src/utils/widget-manifest.ts`):\n- Model, Version, OutputStyle, VoiceStatus, ClaudeStatus - Claude Code metadata and service-health display\n- GitBranch, GitChanges, GitInsertions, GitDeletions, GitWorktree - Git repository status\n- TokensInput, TokensOutput, TokensCached, TokensTotal - Token usage metrics\n- ContextLength, ContextPercentage, ContextPercentageUsable - Context window metrics (uses dynamic model-based context windows: 1M for Sonnet 4.5 with [1m] suffix, 200k for all other models)\n- BlockTimer, SessionClock, SessionCost - Time and cost tracking\n- CurrentWorkingDir, TerminalWidth - Environment info\n- CustomText, CustomCommand - User-defined widgets\n\n## Key Implementation Details\n\n- **Cross-platform stdin reading**: Detects Bun vs Node.js environment and uses appropriate stdin API\n- **Token metrics**: Parses Claude Code transcript files (JSONL format) to calculate token usage\n- **Git integration**: Uses child_process.execSync to get current branch and changes\n- **Terminal width management**: Three modes for handling width (full, full-minus-40, full-until-compact)\n- **Flex separators**: Special separator type that expands to fill available space\n- **Powerline mode**: Optional Powerline-style rendering with arrow separators\n- **Custom commands**: Execute shell commands and display output in status line\n- **Mergeable items**: Items can be merged together with or without padding\n\n## Bun Usage Preferences\n\nDefault to using Bun instead of Node.js:\n- Use `bun <file>` instead of `node <file>` or `ts-node <file>`\n- Use `bun install` instead of `npm install`\n- Use `bun run <script>` instead of `npm run <script>`\n- Use `bun build` with appropriate options for building\n- Bun automatically loads .env, so don't use dotenv\n\n## Important Notes\n\n- **ink@6.2.0 patch**: The project uses a patch for ink@6.2.0 to fix backspace key handling on macOS\n  - Issue: ink treats `\\x7f` (backspace on macOS) as delete key instead of backspace\n  - Fix: Patches `build/parse-keypress.js` to correctly map `\\x7f` to backspace\n  - Applied automatically during `bun install` via `patchedDependencies` in package.json\n  - Patch file: `patches/ink@6.2.0.patch`\n- **Build process**: Two-step build using `bun run build`\n  1. `bun build`: Bundles src/ccstatusline.ts into dist/ccstatusline.js targeting Node.js 14+\n  2. `postbuild`: Runs scripts/replace-version.ts to replace `__PACKAGE_VERSION__` placeholder with actual version from package.json\n- **ESLint configuration**: Uses flat config format (eslint.config.js) with TypeScript and React plugins\n- **Dependencies**: All runtime dependencies are bundled using `--packages=external` for npm package\n- **Type checking and linting**: Run checks via `bun run lint` and use `bun run lint:fix` only when you intentionally want ESLint auto-fixes. Never use `npx eslint`, `eslint`, `tsx`, `bun tsc`, or any other variation directly\n- **Lint rules**: Never disable a lint rule via a comment, no matter how benign the lint warning or error may seem\n- **Testing**: Uses Vitest (via Bun); tests live in `__tests__/` directories alongside the code they cover, including:\n  - Model context detection and token calculation (src/utils/__tests__/model-context.test.ts)\n  - Context percentage calculations (src/utils/__tests__/context-percentage.test.ts)\n  - JSONL transcript parsing (src/utils/__tests__/jsonl.test.ts)\n  - Widget rendering (src/widgets/__tests__/*.test.ts)\n  - Run tests with `bun test` or `bun test --watch` for watch mode\n  - Test configuration: vitest.config.ts\n  - Manual testing also available via piped input and TUI interaction\n"},"files":{"AGENTS.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nccstatusline is a customizable status line formatter for Claude Code CLI that displays model info, git branch, token usage, and other metrics. It functions as both:\n1. A piped command processor for Claude Code status lines\n2. An interactive TUI configuration tool when run without input\n\n## Development Commands\n\n```bash\n# Install dependencies\nbun install\n\n# Run in interactive TUI mode\nbun run start\n\n# Test with piped input (use [1m] suffix for 1M context models)\necho '{\"model\":{\"id\":\"claude-sonnet-4-5-20250929[1m]\"},\"transcript_path\":\"test.jsonl\"}' | bun run src/ccstatusline.ts\n\n# Or use example payload\nbun run example\n\n# Build for npm distribution\nbun run build   # Creates dist/ccstatusline.js with Node.js 14+ compatibility\n\n# Run tests\nbun test\n\n# Run tests in watch mode\nbun test --watch\n\n# Lint and type check\nbun run lint      # Runs TypeScript type checking and ESLint without modifying files\n\n# Apply ESLint auto-fixes intentionally\nbun run lint:fix\n```\n\n## Architecture\n\nThe project has dual runtime compatibility - works with both Bun and Node.js:\n\n### Core Structure\n- **src/ccstatusline.ts**: Main entry point that detects piped vs interactive mode\n  - Piped mode: Parses JSON from stdin and renders formatted status line\n  - Interactive mode: Launches React/Ink TUI for configuration\n\n### TUI Components (src/tui/)\n- **index.tsx**: Main TUI entry point that handles React/Ink initialization\n- **App.tsx**: Root component managing navigation and state\n- **components/**: Modular UI components for different configuration screens\n  - MainMenu, LineSelector, ItemsEditor, ColorMenu, GlobalOverridesMenu\n  - PowerlineSetup, TerminalOptionsMenu, StatusLinePreview\n\n### Utilities (src/utils/)\n- **config.ts**: Settings management\n  - Loads from `~/.config/ccstatusline/settings.json`\n  - Handles migration from old settings format\n  - Default configuration if no settings exist\n- **renderer.ts**: Core rendering logic for status lines\n  - Handles terminal width detection and truncation\n  - Applies colors, padding, and separators\n  - Manages flex separator expansion\n- **powerline.ts**: Powerline font detection and installation\n- **claude-settings.ts**: Integration with Claude Code settings.json\n  - Respects `CLAUDE_CONFIG_DIR` environment variable with fallback to `~/.claude`\n  - Provides installation command constants (NPM, BUNX, self-managed)\n  - Detects installation status and manages settings.json updates\n  - Validates config directory paths with proper error handling\n- **colors.ts**: Color definitions and ANSI code mapping\n- **model-context.ts**: Model-to-context-window mapping\n  - Maps model IDs to their context window sizes based on [1m] suffix\n  - Sonnet 4.5 WITH [1m] suffix: 1M tokens (800k usable at 80%) - requires long context beta access\n  - Sonnet 4.5 WITHOUT [1m] suffix: 200k tokens (160k usable at 80%)\n  - Legacy models: 200k tokens (160k usable at 80%)\n\n### Widgets (src/widgets/)\nCustom widgets implementing the Widget interface defined in src/types/Widget.ts:\n\n**Widget Interface:**\nAll widgets must implement:\n- `getDefaultColor()`: Default color for the widget\n- `getDescription()`: Description shown in TUI\n- `getDisplayName()`: Display name shown in TUI\n- `getEditorDisplay()`: How the widget appears in the editor\n- `render()`: Core rendering logic that produces the widget output\n- `supportsRawValue()`: Whether widget supports raw value mode\n- `supportsColors()`: Whether widget supports color customization\n- Optional: `renderEditor()`, `getCustomKeybinds()`, `getHideableStates()`, `supportsNumberFormat()`, `handleEditorAction()`\n\n**Widget Registry Pattern:**\n- Located in src/utils/widgets.ts\n- Uses a Map-based registry (`widgetRegistry`) that maps widget type strings to widget instances\n- `getWidget(type)`: Retrieves widget instance by type\n- `getAllWidgetTypes()`: Returns all available widget types\n- `isKnownWidgetType()`: Validates if a type is registered\n\n**Available Widgets** (highlights — the full, current list lives in `src/utils/widget-manifest.ts`):\n- Model, Version, OutputStyle, VoiceStatus, ClaudeStatus - Claude Code metadata and service-health display\n- GitBranch, GitChanges, GitInsertions, GitDeletions, GitWorktree - Git repository status\n- TokensInput, TokensOutput, TokensCached, TokensTotal - Token usage metrics\n- ContextLength, ContextPercentage, ContextPercentageUsable - Context window metrics (uses dynamic model-based context windows: 1M for Sonnet 4.5 with [1m] suffix, 200k for all other models)\n- BlockTimer, SessionClock, SessionCost - Time and cost tracking\n- CurrentWorkingDir, TerminalWidth - Environment info\n- CustomText, CustomCommand - User-defined widgets\n\n## Key Implementation Details\n\n- **Cross-platform stdin reading**: Detects Bun vs Node.js environment and uses appropriate stdin API\n- **Token metrics**: Parses Claude Code transcript files (JSONL format) to calculate token usage\n- **Git integration**: Uses child_process.execSync to get current branch and changes\n- **Terminal width management**: Three modes for handling width (full, full-minus-40, full-until-compact)\n- **Flex separators**: Special separator type that expands to fill available space\n- **Powerline mode**: Optional Powerline-style rendering with arrow separators\n- **Custom commands**: Execute shell commands and display output in status line\n- **Mergeable items**: Items can be merged together with or without padding\n\n## Bun Usage Preferences\n\nDefault to using Bun instead of Node.js:\n- Use `bun <file>` instead of `node <file>` or `ts-node <file>`\n- Use `bun install` instead of `npm install`\n- Use `bun run <script>` instead of `npm run <script>`\n- Use `bun build` with appropriate options for building\n- Bun automatically loads .env, so don't use dotenv\n\n## Important Notes\n\n- **ink@6.2.0 patch**: The project uses a patch for ink@6.2.0 to fix backspace key handling on macOS\n  - Issue: ink treats `\\x7f` (backspace on macOS) as delete key instead of backspace\n  - Fix: Patches `build/parse-keypress.js` to correctly map `\\x7f` to backspace\n  - Applied automatically during `bun install` via `patchedDependencies` in package.json\n  - Patch file: `patches/ink@6.2.0.patch`\n- **Build process**: Two-step build using `bun run build`\n  1. `bun build`: Bundles src/ccstatusline.ts into dist/ccstatusline.js targeting Node.js 14+\n  2. `postbuild`: Runs scripts/replace-version.ts to replace `__PACKAGE_VERSION__` placeholder with actual version from package.json\n- **ESLint configuration**: Uses flat config format (eslint.config.js) with TypeScript and React plugins\n- **Dependencies**: All runtime dependencies are bundled using `--packages=external` for npm package\n- **Type checking and linting**: Run checks via `bun run lint` and use `bun run lint:fix` only when you intentionally want ESLint auto-fixes. Never use `npx eslint`, `eslint`, `tsx`, `bun tsc`, or any other variation directly\n- **Lint rules**: Never disable a lint rule via a comment, no matter how benign the lint warning or error may seem\n- **Testing**: Uses Vitest (via Bun); tests live in `__tests__/` directories alongside the code they cover, including:\n  - Model context detection and token calculation (src/utils/__tests__/model-context.test.ts)\n  - Context percentage calculations (src/utils/__tests__/context-percentage.test.ts)\n  - JSONL transcript parsing (src/utils/__tests__/jsonl.test.ts)\n  - Widget rendering (src/widgets/__tests__/*.test.ts)\n  - Run tests with `bun test` or `bun test --watch` for watch mode\n  - Test configuration: vitest.config.ts\n  - Manual testing also available via piped input and TUI interaction\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/sirmalloc/ccstatusline/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nccstatusline is a customizable status line formatter for Claude Code CLI that displays model info, git branch, token usage, and other metrics. It functions as both:\n1. A piped command processor for Claude Code status lines\n2. An interactive TUI configuration tool when run without input\n\n## Development Commands\n\n```bash\n# Install dependencies\nbun install\n\n# Run in interactive TUI mode\nbun run start\n\n# Test with piped input (use [1m] suffix for 1M context models)\necho '{\"model\":{\"id\":\"claude-sonnet-4-5-20250929[1m]\"},\"transcript_path\":\"test.jsonl\"}' | bun run src/ccstatusline.ts\n\n# Or use example payload\nbun run example\n\n# Build for npm distribution\nbun run build   # Creates dist/ccstatusline.js with Node.js 14+ compatibility\n\n# Run tests\nbun test\n\n# Run tests in watch mode\nbun test --watch\n\n# Lint and type check\nbun run lint      # Runs TypeScript type checking and ESLint without modifying files\n\n# Apply ESLint auto-fixes intentionally\nbun run lint:fix\n```\n\n## Architecture\n\nThe project has dual runtime compatibility - works with both Bun and Node.js:\n\n### Core Structure\n- **src/ccstatusline.ts**: Main entry point that detects piped vs interactive mode\n  - Piped mode: Parses JSON from stdin and renders formatted status line\n  - Interactive mode: Launches React/Ink TUI for configuration\n\n### TUI Components (src/tui/)\n- **index.tsx**: Main TUI entry point that handles React/Ink initialization\n- **App.tsx**: Root component managing navigation and state\n- **components/**: Modular UI components for different configuration screens\n  - MainMenu, LineSelector, ItemsEditor, ColorMenu, GlobalOverridesMenu\n  - PowerlineSetup, TerminalOptionsMenu, StatusLinePreview\n\n### Utilities (src/utils/)\n- **config.ts**: Settings management\n  - Loads from `~/.config/ccstatusline/settings.json`\n  - Handles migration from old settings format\n  - Default configuration if no settings exist\n- **renderer.ts**: Core rendering logic for status lines\n  - Handles terminal width detection and truncation\n  - Applies colors, padding, and separators\n  - Manages flex separator expansion\n- **powerline.ts**: Powerline font detection and installation\n- **claude-settings.ts**: Integration with Claude Code settings.json\n  - Respects `CLAUDE_CONFIG_DIR` environment variable with fallback to `~/.claude`\n  - Provides installation command constants (NPM, BUNX, self-managed)\n  - Detects installation status and manages settings.json updates\n  - Validates config directory paths with proper error handling\n- **colors.ts**: Color definitions and ANSI code mapping\n- **model-context.ts**: Model-to-context-window mapping\n  - Maps model IDs to their context window sizes based on [1m] suffix\n  - Sonnet 4.5 WITH [1m] suffix: 1M tokens (800k usable at 80%) - requires long context beta access\n  - Sonnet 4.5 WITHOUT [1m] suffix: 200k tokens (160k usable at 80%)\n  - Legacy models: 200k tokens (160k usable at 80%)\n\n### Widgets (src/widgets/)\nCustom widgets implementing the Widget interface defined in src/types/Widget.ts:\n\n**Widget Interface:**\nAll widgets must implement:\n- `getDefaultColor()`: Default color for the widget\n- `getDescription()`: Description shown in TUI\n- `getDisplayName()`: Display name shown in TUI\n- `getEditorDisplay()`: How the widget appears in the editor\n- `render()`: Core rendering logic that produces the widget output\n- `supportsRawValue()`: Whether widget supports raw value mode\n- `supportsColors()`: Whether widget supports color customization\n- Optional: `renderEditor()`, `getCustomKeybinds()`, `getHideableStates()`, `supportsNumberFormat()`, `handleEditorAction()`\n\n**Widget Registry Pattern:**\n- Located in src/utils/widgets.ts\n- Uses a Map-based registry (`widgetRegistry`) that maps widget type strings to widget instances\n- `getWidget(type)`: Retrieves widget instance by type\n- `getAllWidgetTypes()`: Returns all available widget types\n- `isKnownWidgetType()`: Validates if a type is registered\n\n**Available Widgets** (highlights — the full, current list lives in `src/utils/widget-manifest.ts`):\n- Model, Version, OutputStyle, VoiceStatus, ClaudeStatus - Claude Code metadata and service-health display\n- GitBranch, GitChanges, GitInsertions, GitDeletions, GitWorktree - Git repository status\n- TokensInput, TokensOutput, TokensCached, TokensTotal - Token usage metrics\n- ContextLength, ContextPercentage, ContextPercentageUsable - Context window metrics (uses dynamic model-based context windows: 1M for Sonnet 4.5 with [1m] suffix, 200k for all other models)\n- BlockTimer, SessionClock, SessionCost - Time and cost tracking\n- CurrentWorkingDir, TerminalWidth - Environment info\n- CustomText, CustomCommand - User-defined widgets\n\n## Key Implementation Details\n\n- **Cross-platform stdin reading**: Detects Bun vs Node.js environment and uses appropriate stdin API\n- **Token metrics**: Parses Claude Code transcript files (JSONL format) to calculate token usage\n- **Git integration**: Uses child_process.execSync to get current branch and changes\n- **Terminal width management**: Three modes for handling width (full, full-minus-40, full-until-compact)\n- **Flex separators**: Special separator type that expands to fill available space\n- **Powerline mode**: Optional Powerline-style rendering with arrow separators\n- **Custom commands**: Execute shell commands and display output in status line\n- **Mergeable items**: Items can be merged together with or without padding\n\n## Bun Usage Preferences\n\nDefault to using Bun instead of Node.js:\n- Use `bun <file>` instead of `node <file>` or `ts-node <file>`\n- Use `bun install` instead of `npm install`\n- Use `bun run <script>` instead of `npm run <script>`\n- Use `bun build` with appropriate options for building\n- Bun automatically loads .env, so don't use dotenv\n\n## Important Notes\n\n- **ink@6.2.0 patch**: The project uses a patch for ink@6.2.0 to fix backspace key handling on macOS\n  - Issue: ink treats `\\x7f` (backspace on macOS) as delete key instead of backspace\n  - Fix: Patches `build/parse-keypress.js` to correctly map `\\x7f` to backspace\n  - Applied automatically during `bun install` via `patchedDependencies` in package.json\n  - Patch file: `patches/ink@6.2.0.patch`\n- **Build process**: Two-step build using `bun run build`\n  1. `bun build`: Bundles src/ccstatusline.ts into dist/ccstatusline.js targeting Node.js 14+\n  2. `postbuild`: Runs scripts/replace-version.ts to replace `__PACKAGE_VERSION__` placeholder with actual version from package.json\n- **ESLint configuration**: Uses flat config format (eslint.config.js) with TypeScript and React plugins\n- **Dependencies**: All runtime dependencies are bundled using `--packages=external` for npm package\n- **Type checking and linting**: Run checks via `bun run lint` and use `bun run lint:fix` only when you intentionally want ESLint auto-fixes. Never use `npx eslint`, `eslint`, `tsx`, `bun tsc`, or any other variation directly\n- **Lint rules**: Never disable a lint rule via a comment, no matter how benign the lint warning or error may seem\n- **Testing**: Uses Vitest (via Bun); tests live in `__tests__/` directories alongside the code they cover, including:\n  - Model context detection and token calculation (src/utils/__tests__/model-context.test.ts)\n  - Context percentage calculations (src/utils/__tests__/context-percentage.test.ts)\n  - JSONL transcript parsing (src/utils/__tests__/jsonl.test.ts)\n  - Widget rendering (src/widgets/__tests__/*.test.ts)\n  - Run tests with `bun test` or `bun test --watch` for watch mode\n  - Test configuration: vitest.config.ts\n  - Manual testing also available via piped input and TUI interaction\n","isInternal":false,"tokens":1846,"sizeBytes":7728}],"systemPromptSnippet":"<yakaai_skills repo=\"sirmalloc/ccstatusline\">\n<!-- File: AGENTS.md (Tokens: ~1846 | Category: root-instruction) -->\n# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nccstatusline is a customizable status line formatter for Claude Code CLI that displays model info, git branch, token usage, and other metrics. It functions as both:\n1. A piped command processor for Claude Code status lines\n2. An interactive TUI configuration tool when run without input\n\n## Development Commands\n\n```bash\n# Install dependencies\nbun install\n\n# Run in interactive TUI mode\nbun run start\n\n# Test with piped input (use [1m] suffix for 1M context models)\necho '{\"model\":{\"id\":\"claude-sonnet-4-5-20250929[1m]\"},\"transcript_path\":\"test.jsonl\"}' | bun run src/ccstatusline.ts\n\n# Or use example payload\nbun run example\n\n# Build for npm distribution\nbun run build   # Creates dist/ccstatusline.js with Node.js 14+ compatibility\n\n# Run tests\nbun test\n\n# Run tests in watch mode\nbun test --watch\n\n# Lint and type check\nbun run lint      # Runs TypeScript type checking and ESLint without modifying files\n\n# Apply ESLint auto-fixes intentionally\nbun run lint:fix\n```\n\n## Architecture\n\nThe project has dual runtime compatibility - works with both Bun and Node.js:\n\n### Core Structure\n- **src/ccstatusline.ts**: Main entry point that detects piped vs interactive mode\n  - Piped mode: Parses JSON from stdin and renders formatted status line\n  - Interactive mode: Launches React/Ink TUI for configuration\n\n### TUI Components (src/tui/)\n- **index.tsx**: Main TUI entry point that handles React/Ink initialization\n- **App.tsx**: Root component managing navigation and state\n- **components/**: Modular UI components for different configuration screens\n  - MainMenu, LineSelector, ItemsEditor, ColorMenu, GlobalOverridesMenu\n  - PowerlineSetup, TerminalOptionsMenu, StatusLinePreview\n\n### Utilities (src/utils/)\n- **config.ts**: Settings management\n  - Loads from `~/.config/ccstatusline/settings.json`\n  - Handles migration from old settings format\n  - Default configuration if no settings exist\n- **renderer.ts**: Core rendering logic for status lines\n  - Handles terminal width detection and truncation\n  - Applies colors, padding, and separators\n  - Manages flex separator expansion\n- **powerline.ts**: Powerline font detection and installation\n- **claude-settings.ts**: Integration with Claude Code settings.json\n  - Respects `CLAUDE_CONFIG_DIR` environment variable with fallback to `~/.claude`\n  - Provides installation command constants (NPM, BUNX, self-managed)\n  - Detects installation status and manages settings.json updates\n  - Validates config directory paths with proper error handling\n- **colors.ts**: Color definitions and ANSI code mapping\n- **model-context.ts**: Model-to-context-window mapping\n  - Maps model IDs to their context window sizes based on [1m] suffix\n  - Sonnet 4.5 WITH [1m] suffix: 1M tokens (800k usable at 80%) - requires long context beta access\n  - Sonnet 4.5 WITHOUT [1m] suffix: 200k tokens (160k usable at 80%)\n  - Legacy models: 200k tokens (160k usable at 80%)\n\n### Widgets (src/widgets/)\nCustom widgets implementing the Widget interface defined in src/types/Widget.ts:\n\n**Widget Interface:**\nAll widgets must implement:\n- `getDefaultColor()`: Default color for the widget\n- `getDescription()`: Description shown in TUI\n- `getDisplayName()`: Display name shown in TUI\n- `getEditorDisplay()`: How the widget appears in the editor\n- `render()`: Core rendering logic that produces the widget output\n- `supportsRawValue()`: Whether widget supports raw value mode\n- `supportsColors()`: Whether widget supports color customization\n- Optional: `renderEditor()`, `getCustomKeybinds()`, `getHideableStates()`, `supportsNumberFormat()`, `handleEditorAction()`\n\n**Widget Registry Pattern:**\n- Located in src/utils/widgets.ts\n- Uses a Map-based registry (`widgetRegistry`) that maps widget type strings to widget instances\n- `getWidget(type)`: Retrieves widget instance by type\n- `getAllWidgetTypes()`: Returns all available widget types\n- `isKnownWidgetType()`: Validates if a type is registered\n\n**Available Widgets** (highlights — the full, current list lives in `src/utils/widget-manifest.ts`):\n- Model, Version, OutputStyle, VoiceStatus, ClaudeStatus - Claude Code metadata and service-health display\n- GitBranch, GitChanges, GitInsertions, GitDeletions, GitWorktree - Git repository status\n- TokensInput, TokensOutput, TokensCached, TokensTotal - Token usage metrics\n- ContextLength, ContextPercentage, ContextPercentageUsable - Context window metrics (uses dynamic model-based context windows: 1M for Sonnet 4.5 with [1m] suffix, 200k for all other models)\n- BlockTimer, SessionClock, SessionCost - Time and cost tracking\n- CurrentWorkingDir, TerminalWidth - Environment info\n- CustomText, CustomCommand - User-defined widgets\n\n## Key Implementation Details\n\n- **Cross-platform stdin reading**: Detects Bun vs Node.js environment and uses appropriate stdin API\n- **Token metrics**: Parses Claude Code transcript files (JSONL format) to calculate token usage\n- **Git integration**: Uses child_process.execSync to get current branch and changes\n- **Terminal width management**: Three modes for handling width (full, full-minus-40, full-until-compact)\n- **Flex separators**: Special separator type that expands to fill available space\n- **Powerline mode**: Optional Powerline-style rendering with arrow separators\n- **Custom commands**: Execute shell commands and display output in status line\n- **Mergeable items**: Items can be merged together with or without padding\n\n## Bun Usage Preferences\n\nDefault to using Bun instead of Node.js:\n- Use `bun <file>` instead of `node <file>` or `ts-node <file>`\n- Use `bun install` instead of `npm install`\n- Use `bun run <script>` instead of `npm run <script>`\n- Use `bun build` with appropriate options for building\n- Bun automatically loads .env, so don't use dotenv\n\n## Important Notes\n\n- **ink@6.2.0 patch**: The project uses a patch for ink@6.2.0 to fix backspace key handling on macOS\n  - Issue: ink treats `\\x7f` (backspace on macOS) as delete key instead of backspace\n  - Fix: Patches `build/parse-keypress.js` to correctly map `\\x7f` to backspace\n  - Applied automatically during `bun install` via `patchedDependencies` in package.json\n  - Patch file: `patches/ink@6.2.0.patch`\n- **Build process**: Two-step build using `bun run build`\n  1. `bun build`: Bundles src/ccstatusline.ts into dist/ccstatusline.js targeting Node.js 14+\n  2. `postbuild`: Runs scripts/replace-version.ts to replace `__PACKAGE_VERSION__` placeholder with actual version from package.json\n- **ESLint configuration**: Uses flat config format (eslint.config.js) with TypeScript and React plugins\n- **Dependencies**: All runtime dependencies are bundled using `--packages=external` for npm package\n- **Type checking and linting**: Run checks via `bun run lint` and use `bun run lint:fix` only when you intentionally want ESLint auto-fixes. Never use `npx eslint`, `eslint`, `tsx`, `bun tsc`, or any other variation directly\n- **Lint rules**: Never disable a lint rule via a comment, no matter how benign the lint warning or error may seem\n- **Testing**: Uses Vitest (via Bun); tests live in `__tests__/` directories alongside the code they cover, including:\n  - Model context detection and token calculation (src/utils/__tests__/model-context.test.ts)\n  - Context percentage calculations (src/utils/__tests__/context-percentage.test.ts)\n  - JSONL transcript parsing (src/utils/__tests__/jsonl.test.ts)\n  - Widget rendering (src/widgets/__tests__/*.test.ts)\n  - Run tests with `bun test` or `bun test --watch` for watch mode\n  - Test configuration: vitest.config.ts\n  - Manual testing also available via piped input and TUI interaction\n</yakaai_skills>"}