Commit Graph

72 Commits

Author SHA1 Message Date
a518a0bd11 feat: add Copilot usage display to Activity Panel with auto-refresh
- Add Copilot Usage section to right sidebar Activity Panel
- Display Premium Requests, Chat, and Completions quotas with color-coded progress bars
- Colors: Green (>40% remaining), Yellow (5-40%), Red (≤5%)
- Auto-refresh every 60 seconds when provider is GitHub Copilot
- Fetch immediately on session start (not after 60 seconds)
- Refresh after task completion (debounced to 2 seconds)
- Add usage refresh manager singleton for lifecycle management
- Update /usage command to use same color system
- Fix: Use COPILOT_DISPLAY_NAME for provider comparisons
- Fix: Resume link shows actual session ID instead of 'unknown'

Files added:
- src/constants/quota-colors.ts - Color thresholds and status helpers
- src/services/copilot/usage-refresh-manager.ts - Auto-refresh manager
- src/tui-solid/components/panels/copilot-usage.tsx - UI components

Files modified:
- src/services/chat-tui/usage.ts - Add colored progress bars
- src/tui-solid/app.tsx - Lifecycle hooks, fix resume link
- src/tui-solid/components/panels/activity-panel.tsx - Integrate usage section
- src/tui-solid/context/app.tsx - Add usage state and fetch logic
2026-02-16 01:14:06 -05:00
24f6083d61 0.4.5 2026-02-15 14:04:26 -05:00
3a78c4e021 feat: add CODETYPER ASCII art to exit summary
Add prominent CODETYPER logo using ASCII box-drawing characters at the
top of the exit summary for enhanced branding. This provides a polished,
professional appearance when exiting the CLI.
Key improvements:
- Add ASCII logo to session summary output
- Simplify exit flow to use global message storage in terminal.ts
- Remove duplicate exit message handling from ExitProvider
- Fix signal handlers to prevent duplicate exit messages
- Clean up debug logging from app.tsx
- Ensure exit message persists on terminal after process exit
The exit summary now displays comprehensive session statistics with:
- CODETYPER ASCII logo
- Total usage and Premium requests
- API time and total session time
- Code changes breakdown (+additions/-deletions)
- Per-model token usage
- Resume command with session ID
Works correctly on all exit paths (normal exit, SIGINT, SIGTERM, errors).
2026-02-15 14:03:50 -05:00
87d53f7035 feat: add CODETYPER ASCII art to exit summary
Add prominent CODETYPER logo using ASCII box-drawing characters at the
top of the exit summary for enhanced branding. This provides a polished,
professional appearance when exiting the CLI.

Key improvements:
- Add ASCII logo to session summary output
- Simplify exit flow to use global message storage in terminal.ts
- Remove duplicate exit message handling from ExitProvider
- Fix signal handlers to prevent duplicate exit messages
- Clean up debug logging from app.tsx
- Ensure exit message persists on terminal after process exit

The exit summary now displays comprehensive session statistics with:
- CODETYPER ASCII logo
- Total usage and Premium requests
- API time and total session time
- Code changes breakdown (+additions/-deletions)
- Per-model token usage
- Resume command with session ID

Works correctly on all exit paths (normal exit, SIGINT, SIGTERM, errors).
2026-02-15 14:02:40 -05:00
6c72ff0212 fix: ensure exit message persists by setting it reactively (OpenCode pattern)
The exit message was appearing briefly then disappearing because:
1. The message wasn't pre-computed before exit
2. The timing of when the message was written wasn't synchronized

Changes (matching OpenCode's pattern):
- ExitProvider now has setExitMessage/getExitMessage functions
- ExitProvider.exit() is now async and awaits onExit callback
- Message is written AFTER renderer.destroy() and onExit, before process.exit()
- AppContent uses createEffect to set exit message reactively
- Message is pre-computed and ready when exit is called

This ensures the message is written synchronously after cleanup,
preventing it from being cleared by async operations or shell prompt.
2026-02-15 13:37:15 -05:00
1854c38dfb fix: move exit summary to ExitProvider and destroy renderer before display
The session summary wasn't appearing and 997;1n garbage was showing because:
1. The renderer was still running when we wrote the summary, overwriting it
2. The renderer continued sending DECRQM queries after exit

Changes:
- Move summary generation and display into ExitProvider
- Call renderer.destroy() BEFORE writing the summary
- ExitProvider now handles process.exit() after displaying summary
- Simplify tui() handleExit to just resolve the promise
- ExitProvider receives sessionId prop for summary generation
2026-02-15 13:34:57 -05:00
b6b89996f3 fix: prevent session summary from being cleared on exit
The session stats summary was being displayed momentarily then cleared.
This was caused by drainStdin() re-enabling raw mode AFTER we had already
exited the alternate screen and written the summary.

Changes:
- Remove drainStdin() from normal exit flow - it was interfering with terminal
- Drain pending DECRQM responses BEFORE exiting alternate screen, while still in raw mode
- Add newline after summary to ensure shell prompt appears correctly
- Keep drainStdin() available for signal handlers but don't use it in normal exit
2026-02-15 13:34:53 -05:00
18a5eca3ae feat: display detailed session stats on exit with resume command
When quitting the CLI, users now see a comprehensive session summary:
- Total API time spent and session duration
- Total code changes (+additions/-deletions)
- Per-model token usage breakdown (input/output/cached)
- Resume command with session ID

Implementation details:
- Extended SessionStats type with apiTimeSpent, apiCallStartTime, and modelUsage
- Added startApiCall(), stopApiCall(), and addTokensWithModel() tracking functions
- Created session-stats.ts utility with formatters and generateSessionSummary()
- Updated TUI exit handler to display formatted stats
- Added mouse tracking disable to drainStdin() for cleaner exit
- Added modifiedFiles to getState() for exit summary access
2026-02-15 13:34:44 -05:00
b51e3d49a6 feat: add Ctrl+O activity panel toggle, fix terminal 997;1n garbage on exit
Wire up the activity_toggle keybind (Ctrl+O) to show/hide the activity
panel via new activityVisible store state. Fix terminal garbage text on
exit by draining stdin after renderer teardown to consume pending
DECRQM mode 997 responses before they echo in the shell.
2026-02-15 13:34:38 -05:00
51b5fe1aa1 0.4.4 2026-02-15 13:34:32 -05:00
9e5065dab8 0.4.3 2026-02-14 06:41:48 -05:00
6111530c08 feat: add pink-purple theme, fix image paste race condition, allow @/commands anywhere in input
- Add Pink Purple theme (hot pink/purple/magenta on dark plum background)
- Fix race condition where clearPastedImages() in input-area ran before
  the async message handler could read the images, silently dropping them
- Allow @ file picker and / command menu to trigger at any cursor position,
  not just when the input is empty
- Update CHANGELOG and README with new changes
2026-02-14 06:39:08 -05:00
ddbdb5eb3e Bumping the version 2026-02-06 11:50:46 -05:00
4152e0a4a9 0.4.2 2026-02-06 11:50:28 -05:00
f767987a42 fix: fixing the exit message service to use constants
- Avoiding mouse events for exit messages on terminal on stop process
2026-02-06 11:49:23 -05:00
d1b00a2115 Bumping the version 2026-02-06 11:30:22 -05:00
b1eacdc2a3 0.4.1 2026-02-06 11:30:08 -05:00
3d837aef3d 0.4.0 2026-02-06 11:25:56 -05:00
83b7c7581d docs: update changelog and version for v0.4.0 2026-02-06 11:25:44 -05:00
5830b1da42 Fixing the permissions 2026-02-06 11:16:12 -05:00
101300b103 feat: add text clipboard copy/read with mouse selection support
Add cross-platform text clipboard operations (macOS, Linux, Windows)
with OSC 52 support for SSH/tmux environments. Wire up onMouseUp and
Ctrl+Y in the TUI to copy selected text to the system clipboard via
OpenTUI's renderer selection API.
2026-02-06 11:16:07 -05:00
8adf48abd3 feat: inline permission prompt and improve TUI layout
- Render permission modal inline below log panel instead of floating CenteredModal overlay
- Hide input area when permission prompt is active
- Add dev:debug and dev:debug-brk scripts for Bun inspector debugging
- Add background color to header to prevent content bleeding through
- Add margin spacing between header and log panel
- Change permission modal border to top-only for cleaner inline appearance
2026-02-06 09:09:43 -05:00
f2641d6ab0 feat: protect sensitive files and auto-backup before modifications
Implements GitHub issues #104 and #102:

**#104: Sensitive File Protection**
- Block writes to .env, credentials, SSH keys, cloud configs
- Categories: environment, credentials, ssh_keys, api_tokens, certificates, cloud_config
- Warn on reads of .env files (may contain secrets)
- Block writes to id_rsa, *.pem, *.key, credentials.json, etc.

**#102: Auto-Backup System**
- Automatic backup before every write/edit operation
- Backups stored in .codetyper-backup/ (preserves directory structure)
- Max 10 backups per file
- 7-day retention with auto-cleanup
- listBackups, getLatestBackup, restoreFromBackup functions

Closes #104
Closes #102
2026-02-05 19:13:24 -05:00
a30b3bb60f feat: block dangerous bash commands (rm -rf, sudo, etc.)
Implements GitHub issue #103 - automatic blocking of dangerous commands:

Blocked categories:
- Destructive delete: rm -rf /, rm -rf ~, rm -rf .git
- Privilege escalation: sudo, su -, doas
- System damage: dd disk wipe, chmod 777 /, mkfs, fork bomb
- Network attacks: curl | bash, wget | bash, reverse shells
- Git destructive: force push to main, reset --hard, clean -fd
- Credential exposure: cat .env, echo $SECRET

Features:
- Cannot be bypassed even with auto-approve or -y flag
- Clear error messages explaining why command was blocked
- Severity levels: critical, high, medium
- Tested with 12 test cases (all pass)

Closes #103
2026-02-05 19:09:51 -05:00
8ae1218627 feat: enforce plan approval for multi-file modifications
The plan approval system now has enforcement at the tool execution level:
- After modifying more than 2 files, the agent MUST use plan_approval
- File-modifying tools (write, edit, delete, etc.) are blocked until
  an approved plan exists
- Clear error message guides agent to create and submit a plan

This ensures agents can't bypass plan approval instructions.
2026-02-05 19:04:25 -05:00
80fd7b2de3 fix: rollback now correctly extracts file path from tool arguments
The rollback system was failing because it looked for `file_path`
(snake_case) but the write/edit tools use `filePath` (camelCase).

Now checks both formats when extracting the file path for rollback tracking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 18:56:55 -05:00
f8cde24d87 feat: implement plan approval gate before execution
Adds plan approval workflow per GitHub issue #111:
- Register plan_approval tool in tools index
- Add plan approval handling in message handler
  - Check for pending plans on each message
  - Detect approval/rejection messages
  - Handle plan approval flow
- Create plan approval modal TUI component
- Update system prompts to instruct agents to use plan_approval tool
  - Balanced tier: Updated to require plan_approval for complex tasks
  - Thorough tier: Updated with plan_approval workflow

Workflow:
1. Agent analyzes task complexity with plan_approval
2. Agent creates plan with steps, context, risks
3. Agent submits plan for user approval
4. User approves/rejects/provides feedback
5. Only after approval, agent proceeds with execution

Closes #111
2026-02-05 18:53:51 -05:00
3d2195f074 feat: implement execution control (pause/resume/abort) for agent mode
Adds execution control system per GitHub issue #113:
- Ctrl+P: Toggle pause/resume during agent execution
- Ctrl+Z: Abort with rollback (undo file changes)
- Ctrl+Shift+S: Toggle step-by-step mode
- Enter: Advance one step when in step mode

New files:
- src/types/execution-control.ts: Type definitions
- src/services/execution-control.ts: Control implementation with rollback
- src/constants/execution-control.ts: Keyboard shortcuts and messages

Modified:
- agent-stream.ts: Integrated execution control into agent loop
- message-handler.ts: Added control functions and callbacks
- app.tsx: Added keyboard shortcut handlers
- help-content.ts: Added help topics for new shortcuts

Closes #113
2026-02-05 18:47:29 -05:00
e2cb41f8d3 feat: implement parallel agent execution and unified agent registry
- Fix streaming JSON parsing issues (buffer processing on stream end)
- Increase max_tokens for tool-enabled requests (16384)
- Add parallel tool execution for task_agent, read, glob, grep (up to 3 concurrent)
- Register task_agent tool with queue system and concurrency control
- Add session-based isolation with parentSessionId tracking
- Create unified agent registry mapping agents from:
  - OpenCode (7 agents: build, plan, explore, general, etc.)
  - Claude Code (12 agents: code-explorer, code-architect, etc.)
  - Cursor (3 agents: pair-programmer, cli, chat)
  - CodeTyper native (6 agents)
- Add agent/skill creation system with LLM-based generation
- Store custom agents in .codetyper/agents/*.md
- Store custom skills in .codetyper/skills/*/SKILL.md
2026-02-05 18:36:04 -05:00
ad514a920c docs: update documentation for v0.3.0
- CHANGELOG.md: Add version sections for 0.2.x and 0.3.0, add known
  issues and planned features linking to GitHub issues #111-#115
- CONTRIBUTING.md: Update prerequisites to Bun, fix file structure
  to reflect tui-solid migration, update commands to use bun
- README.md: Add version badges, roadmap section with v0.4.0 plans,
  known issues section, and recent changes summary
2026-02-04 23:14:57 -05:00
d78fed7da9 Bunmping version 2026-02-04 23:04:57 -05:00
954725ad9b 0.3.0 2026-02-04 23:02:11 -05:00
b519f2e8a7 feat: implement system prompt builder with modes, tiers, and providers
- Added a system prompt builder to create dynamic prompts based on different modes (ask, code review, composer, debug, implement, plan, refactor).
- Introduced prompt tiers (balanced, fast, thorough) to tailor responses based on user needs
- Integrated multiple AI providers (Anthropic, Copilot, Google, Ollama, OpenAI) for flexible backend support.
- Updated agent and multi-agent services to utilize the new prompt system.
2026-02-04 23:01:34 -05:00
db79856b08 fixing imports 2026-02-04 21:32:30 -05:00
74b0a0dbab deleting index.ts files 2026-02-04 21:02:01 -05:00
f0609e423e Restructure src/ modules with consistent internal organization
Reorganize major src/ directories to follow a consistent pattern with
core/, menu/, submenu/, inputs/, logs/, layout/, feedback/ subdirectories.

Changes by module:

- stores/: Move 5 store files to stores/core/
- utils/: Create core/ (terminal, tools, etc.) and menu/ (progress-bar)
- api/: Create copilot/core/, copilot/auth/, ollama/core/
- providers/: Create core/, copilot/core/, copilot/auth/, ollama/core/, login/core/
- ui/: Create core/, banner/core/, banner/menu/, spinner/core/,
       input-editor/core/, components/core/, components/menu/
- tools/: Create core/ for registry.ts and types.ts
- tui-solid/: Reorganize components/ into menu/, submenu/, inputs/,
              logs/, modals/, panels/, layout/, feedback/
- commands/: Create core/ for runner.ts and handlers.ts
- services/: Create core/ for agent.ts, permissions.ts, session.ts,
             executor.ts, config.ts

All imports updated to use new paths. TypeScript compilation verified.
2026-02-04 18:47:52 -05:00
c1b4384890 Remove legacy React/Ink TUI and fix TypeScript errors
- Delete old tui/ React/Ink implementation (App.tsx, components/, hooks/, store.ts)
  - Migrate to tui-solid/ as the sole TUI implementation
  - Update tui/index.ts to re-export from tui-solid and @/types/tui

  TypeScript fixes:
  - Add missing PreCompact to hook event constants
  - Fix path aliases (@src/ -> @/, @constants/)
  - Remove unused imports across service files
  - Add explicit type annotations to callback parameters
  - Replace Bun.file/write with Node.js fs/promises in mcp/registry
  - Fix Map.some() -> Array.from().some() in registry
  - Fix addServer() call signature
  - Add missing description to brain-mcp schema items
  - Fix typo in progress-bar import (@interfactes -> @interfaces)
2026-02-04 01:21:43 -05:00
5c2d79c802 Fix: fixing imports on the utils folder 2026-02-04 00:35:00 -05:00
21e08d20f1 Fixing the mcp 2026-02-02 14:18:56 -05:00
68884a5d58 0.2.4 2026-02-02 14:18:45 -05:00
f3d3f52f47 Fixing the mcp 2026-02-02 14:18:35 -05:00
2fcaa81559 Bunmping version 2026-02-02 14:11:25 -05:00
cc4aaffdf5 0.2.3 2026-02-02 14:11:11 -05:00
fbd9afa177 Fix MCP form input and add reactive MCP server state
- Fix space key not working in MCP add form by handling evt.name === "space"
  - Add support for multi-character paste sequences via evt.sequence
  - Add MCPServerDisplay type to types/tui.ts for UI display
  - Add mcpServers reactive state to app store with setMcpServers,
    addMcpServer, and updateMcpServerStatus actions
  - Update session.tsx to use store's mcpServers instead of static props
  - Update execute.tsx to update store when server is added/connected
  - Remove duplicate MCPServer interfaces from app.tsx, session.tsx,
    and mcp-select.tsx in favor of shared MCPServerDisplay type
2026-02-02 14:10:19 -05:00
3b277c3925 fixing the issues on mcp 2026-02-02 13:40:55 -05:00
c839fc4d68 Add BRAIN_DISABLED flag and fix Ollama tool call formatting
Features:
  - Add BRAIN_DISABLED feature flag to hide all Brain functionality
  - When enabled, hides Brain banner, status indicator, menu, and commands
  - Flag location: src/constants/brain.ts

  Fixes:
  - Fix Ollama 400 error by properly formatting tool_calls in messages
  - Update OllamaMessage type to include tool_calls field
  - Fix Brain menu keyboard not working (add missing modes to isMenuOpen)

  UI Changes:
  - Remove "^Tab toggle mode" hint from status bar
  - Remove "ctrl+t to hide todos" hint from status bar

  Files modified:
  - src/constants/brain.ts (add BRAIN_DISABLED flag)
  - src/types/ollama.ts (add tool_calls to OllamaMessage)
  - src/providers/ollama/chat.ts (format tool_calls in messages)
  - src/tui-solid/components/header.tsx (hide Brain UI when disabled)
  - src/tui-solid/components/status-bar.tsx (remove hints)
  - src/tui-solid/components/command-menu.tsx (filter brain command)
  - src/tui-solid/components/input-area.tsx (fix isMenuOpen modes)
  - src/tui-solid/routes/session.tsx (skip brain menu when disabled)
  - src/services/brain.ts (early return when disabled)
  - src/services/chat-tui/initialize.ts (skip brain init when disabled)
2026-02-02 13:25:38 -05:00
2eadda584a Bunmping version 2026-01-31 23:19:58 -05:00
4c414573c4 0.2.2 2026-01-31 23:19:42 -05:00
73f164de41 Fixing the appstore issue 2026-01-31 23:19:32 -05:00
aaa630ef52 Bunmping version 2026-01-31 22:35:50 -05:00