Commit Graph

67 Commits

  • fix(tui): use consistent accent color for entire selected line in file selector
    Previously, the selected line in @ fuzzy search and Tab completion used
    accent color for prefix/label but muted color for description. Now the
    entire selected line uses the accent color for better visual consistency.
  • fix: file @ autocomplete performance using fd
    - Replace slow synchronous directory walking with fd for fuzzy file search
    - Auto-download fd to ~/.pi/agent/tools/ if not found in PATH
    - Performance improved from ~900ms to ~10ms per keystroke on large repos
    - Remove minimatch dependency from tui package
    - Graceful degradation if fd unavailable (empty results)
    
    Fixes #69
  • Fix editor cursor navigation for wrapped lines, add word navigation
    - Up/down arrows now navigate visual (wrapped) lines instead of logical lines
    - Fixed double cursor display at wrap boundaries
    - Added word by word navigation via Option+Left/Right or Ctrl+Left/Right
    - Updated README keyboard shortcuts documentation
    
    Closes #61
  • Fix edit diff line number alignment and whitespace preservation
    - Fix line numbers showing incorrect values for edits far from file start
      (e.g., 1,2,3 instead of 336,337,338). Skip count was added after displaying
      lines instead of before.
    
    - Rewrite splitIntoTokensWithAnsi in pi-tui to preserve whitespace as separate
      tokens instead of discarding it. Wrapped lines now maintain proper alignment
      and code indentation.
    
    - Update mom README: rename title, remove em-dashes for cleaner prose
  • feat: fuzzy file search with @ prefix
    - Type @ to fuzzy-search files/folders across project
    - Respects .gitignore and skips hidden files
    - Pure Node.js implementation using readdir with withFileTypes
    - No external dependencies (fd/find) required
    - Also optimized Tab completion to use withFileTypes instead of statSync
    
    Based on PR #60 by @fightbulc, reimplemented for performance.
  • fix: suppress stderr in execSync calls to prevent TUI corruption
    Added stdio: 'pipe' to all execSync calls in fuzzy file search to prevent
    stderr output from fd/fdfind command checks from corrupting TUI rendering.
  • fix: emoji text wrapping crash in pi-tui
    Fixed crash when rendering text containing emojis followed by long content.
    The breakLongWord function was iterating over UTF-16 code units instead of
    grapheme clusters, causing emojis (surrogate pairs) to be miscounted during
    line wrapping. Now uses Intl.Segmenter to properly handle multi-codepoint
    characters.
  • Fix slash command autocomplete Enter behavior
    When pressing Enter on a highlighted slash command suggestion (e.g., typing
    `/mod` with `/model` highlighted), the completion is now applied before
    submitting. Previously, the partial text was submitted instead of the
    selected command.
    
    Fixes #49
  • Fix path completion hanging and autocomplete arrow key behavior
    - Fixed catastrophic regex backtracking in extractPathPrefix that caused
      terminal to hang when text contained many / characters (e.g., URLs).
      Replaced complex regex with simple lastIndexOf approach. (#18)
    - Fixed arrow keys moving both autocomplete selection and editor cursor
      by adding missing return statement after handling arrow keys in
      autocomplete mode.
    
    Closes #18
  • WIP: Add theming system with /theme command
    - Consolidated theme system into single src/theme/ directory
    - Created Theme class with fg(), bg(), bold(), italic(), underline()
    - Added dark and light built-in themes with 36 color tokens
    - Support for custom themes in ~/.pi/agent/themes/*.json
    - JSON schema for theme validation
    - Theme selector UI with /theme command
    - Save theme preference to settings
    - Uses chalk for text formatting to preserve colors
    
    TODO:
    - Replace hardcoded colors throughout TUI components
    - Apply markdown theming to Markdown components
    - Add theme support to all TUI elements
  • Release v0.7.28
    - Add message queuing with configurable modes (one-at-a-time/all) (#15)
    - Add /queue command to select queue mode
    - Add TruncatedText component for proper viewport-aware text truncation
    - Queue mode setting persists in ~/.pi/agent/settings.json
    - Visual feedback for queued messages with proper ANSI handling
    - Press Escape to abort and restore queued messages to editor
  • Release v0.7.27
    - Fix slash command submission requiring two Enter presses (#30)
    - Fix slash command autocomplete not re-triggering after typos (#29)
  • feat: add visual thinking level indicator via border colors
    The horizontal borders around the input editor now change color based on
    the current thinking level, providing immediate visual feedback:
    
    - off: gray (default)
    - minimal: dim blue
    - low: blue
    - medium: cyan
    - high: magenta
    
    The more thinking, the brighter/more vibrant the color.
    
    Changes:
    - Add public borderColor property to Editor component (packages/tui)
    - Use borderColor instead of hardcoded chalk.gray for borders
    - Add getThinkingBorderColor() helper in TuiRenderer
    - Add updateEditorBorderColor() to apply color changes
    - Update border color when:
      - Cycling with Tab key
      - Selecting via /thinking command
      - Restoring session with thinking level set
  • Add ANSI-aware word wrapping to TUI components
    - Created shared wrapTextWithAnsi() function in utils.ts
    - Handles word-based wrapping while preserving ANSI escape codes
    - Properly tracks active ANSI codes across wrapped lines
    - Supports multi-byte characters (emoji, surrogate pairs)
    - Updated Markdown and Text components to use shared wrapping
    - Removed duplicate wrapping logic (158 lines total)
  • feat(coding-agent): add OAuth authentication for Claude Pro/Max
    - Add /login and /logout commands for OAuth flow
    - OAuth tokens stored in ~/.pi/agent/oauth.json with 0600 permissions
    - Auto-refresh tokens when expired (5min buffer)
    - Priority: OAuth > ANTHROPIC_OAUTH_TOKEN env > ANTHROPIC_API_KEY env
    - Fix model selector async loading and re-render
    - Add bracketed paste support to Input component for long codes
    - Update README.md with OAuth documentation
    - Add implementation docs and testing checklist
  • refactor(tui): Use explicit charCode check for unicode filtering
    - Use 'charCodeAt(0) >= 32' instead of open 'else' in handleInput()
    - Use same filter in handlePaste() for consistency
    - Prevents control characters while allowing all unicode
    - More explicit and safer than accepting everything
  • feat(tui): improve editor Ctrl/Alt word and line deletion shortcuts
    - Add Ctrl+W for word deletion (stops at whitespace/punctuation)
    - Add Ctrl+U for delete to start of line (merges with previous line at col 0)
    - Change Ctrl+K from delete entire line to delete to end of line (merges with next line at EOL)
    - Add Option+Backspace support in Ghostty (maps to Ctrl+W via ESC+DEL sequence)
    - Cmd+Backspace in Ghostty works as Ctrl+U (terminal sends same control code)
    - Update README and CHANGELOG with new keyboard shortcuts
    
    Fixes #2, Fixes #3
  • docs: simplify MCP section with clear stance and minimal example
    - State upfront: pi does not support MCP
    - Provide minimal working example (README + bash script)
    - Show simple usage pattern
    - Remove verbose explanations
    
    fix(tui): don't show duplicate URL when link text equals href
  • Improve edit tool diff display with context-aware rendering
    - Add generateDiffString() function in edit tool to create unified diffs with line numbers and 4 lines of context
    - Store only the formatted diff string in tool result details instead of full file contents
    - Update tool-execution renderer to parse and colorize the diff string
    - Filter out message_update events from session saving to prevent verbose session files
    - Add markdown nested list and table rendering tests
  • Redesign session selector with multi-line layout
    - Custom SessionList component with 2 lines per item
    - First line: message text (bold when selected)
    - Second line: metadata (time · message count) in dim
    - Blue › cursor for selected item
    - Added "Resume Session" header
    - Handle Ctrl+C (‹x03›) in SelectList for consistency
    - Improved date formatting (38 minutes ago, 8 hours ago, etc.)
  • Fix viewport width issues in thinking selector and text rendering
    Thinking selector fix:
    - Replace hardcoded 50-character borders with DynamicBorder component
      that adjusts to viewport width
    - Prevents crash when terminal is resized narrow
    
    Text/Markdown rendering fixes:
    - Fix Markdown wrapSingleLine to check if adding next character would
      exceed width BEFORE adding it (was checking AFTER, causing lines to
      be 1 character too long)
    - Add word truncation in Text component for words longer than
      contentWidth (prevents long unbreakable words from exceeding width)
    
    These fixes prevent "Rendered line exceeds terminal width" errors.
  • Fix SelectList crash on narrow terminal and thinking level restoration
    SelectList fixes:
    - Use hardcoded visual width for arrow prefix instead of string length
      which includes ANSI codes
    - Truncate scroll indicator text to prevent exceeding terminal width
    - Fixes crash when terminal is resized narrow and arrow keys are pressed
    
    Thinking level fix:
    - Restore thinking level even if it's "off" (removed !== "off" check)
    - This ensures the thinking level selector shows the correct state on continue
  • Fix tab rendering in TUI components
    Replace tabs with 3 spaces for consistent rendering and width calculation:
    - Updated visibleWidth() to normalize tabs before measuring
    - Updated Text and Markdown components to replace tabs when rendering
    - Updated tool-execution display for read/write tools to replace tabs
    
    This fixes background color rendering issues when displaying files with tab indentation.
  • Improve tool execution rendering and error handling
    - Show tool execution components immediately when tool calls appear in streaming
    - Update components with streaming arguments as they come in
    - Handle incomplete/partial arguments gracefully with optional chaining
    - Fix error handling: tools now throw exceptions instead of returning error messages
    - Fix bash abort handling to properly reject on abort/timeout
    - Clean up error display
  • Refactor TUI into proper components
    - Create UserMessageComponent - handles user messages with spacing
    - Create AssistantMessageComponent - handles complete assistant messages
    - Create ThinkingSelectorComponent - wraps selector with borders
    - Add setSelectedIndex to SelectList for preselecting current level
    - Simplify tui-renderer by using dedicated components
    - Much cleaner architecture - each message type is now a component
  • Replace Markdown with Text component for tool execution
    - Add background color support to Text component
    - Replace Markdown component with Text in ToolExecutionComponent
    - Use chalk.bold for formatting instead of markdown syntax
    - Remove unnecessary markdown parsing overhead
  • Add /thinking command and improve TUI UX
    - Add /thinking slash command with autocomplete for setting reasoning levels (off, minimal, low, medium, high)
    - Fix Ctrl+C behavior: remove hardcoded exit in TUI, let focused component handle it
    - Add empty lines before and after tool execution components for better visual separation
    - Fix stats rendering: display stats AFTER tool executions complete (matches web-ui behavior)
    - Remove "Press Ctrl+C again to exit" message, show "(esc to interrupt)" in loader instead
    - Add bash tool abort signal support with immediate SIGKILL on interrupt
    - Make Text and Markdown components return empty arrays when no actual text content
    - Add setCustomBgRgb() method to Markdown for dynamic background colors
  • Fix markdown streaming duplication by splitting newlines first
    - Added string-width library for proper terminal column width calculation
    - Fixed wrapLine() to split by newlines before wrapping (like Text component)
    - Fixed Loader interval leak by stopping before container removal
    - Changed loader message from 'Loading...' to 'Working...'
  • Clean up TUI package and refactor component structure
    - Remove old TUI implementation and components (LoadingAnimation, MarkdownComponent, TextComponent, TextEditor, WhitespaceComponent)
    - Rename components-new to components with new API (Loader, Markdown, Text, Editor, Spacer)
    - Move Text and Input components to separate files in src/components/
    - Add render caching to Text component (similar to Markdown)
    - Add proper ANSI code handling in Text component using stripVTControlCharacters
    - Update coding-agent to use new TUI API (requires ProcessTerminal, uses custom Editor subclass for key handling)
    - Remove old test files, keep only chat-simple.ts and virtual-terminal.ts
    - Update README.md with new minimal API documentation
    - Switch from tsc to tsgo for type checking
    - Update package dependencies across monorepo