Commit Graph

50 Commits

Author SHA1 Message Date
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
83ed5aa7ba 0.2.1 2026-01-31 22:35:35 -05:00
1491840a60 Adding mcp searcher 2026-01-31 22:35:24 -05:00
f3b39ec8a1 Bumping the version 2026-01-31 22:22:55 -05:00
b35980ad0b 0.2.0 2026-01-31 22:22:44 -05:00
a3c407d89a feat: implement hooks, plugins, session forks, and vim motions
Add 4 major features to codetyper-cli:

- Hooks System: Lifecycle hooks (PreToolUse, PostToolUse, SessionStart,
  SessionEnd, UserPromptSubmit, Stop) with exit code control flow
- Plugin System: Custom tools, commands, and hooks via plugin manifest
- Session Forking: Snapshots, rewind, fork, and switch between branches
- Vim Motions: Normal/Insert/Command/Visual modes with keyboard navigation

New files:
- src/types/{hooks,plugin,session-fork,vim}.ts
- src/constants/{hooks,plugin,session-fork,vim}.ts
- src/services/{hooks-service,plugin-loader,plugin-service,session-fork-service}.ts
- src/stores/vim-store.ts (vanilla)
- src/tui/hooks/{useVimMode,useVimStore,useTodoStore,useThemeStore}.ts
- src/tui/components/VimStatusLine.tsx

Modified:
- src/services/agent.ts (hook integration)
- src/tools/index.ts (plugin tool registration)
- src/stores/{todo-store,theme-store}.ts (converted to vanilla)
- TUI components (updated hook imports)
2026-01-31 22:22:04 -05:00
37d4a43154 Bumping the version 2026-01-31 19:21:40 -05:00
87a6d7ed42 0.1.80 2026-01-31 19:21:19 -05:00
8691b926fb Fixing the prompts 2026-01-31 19:20:36 -05:00
0cd557a3fe Bunmping version 2026-01-29 07:40:34 -05:00
83904cbfcc 0.1.79 2026-01-29 07:39:34 -05:00
5c531d0105 Bunmping version 2026-01-29 07:34:09 -05:00
36f7afbf01 0.1.78 2026-01-29 07:33:57 -05:00
187cc68304 Improve agent autonomy and diff view readability
Agent behavior improvements:
  - Add project context detection (tsconfig.json, pom.xml, etc.)
  - Enforce validation after changes (tsc --noEmit, mvn compile, etc.)
  - Run tests automatically - never ask "do you want me to run tests"
  - Complete full loop: create → type-check → test → confirm
  - Add command detection for direct execution (run tree, run ls)

  Diff view improvements:
  - Use darker backgrounds for added/removed lines
  - Add diffLineBgAdded, diffLineBgRemoved, diffLineText theme colors
  - Improve text visibility with white text on dark backgrounds
  - Update both React/Ink and SolidJS diff components

  Streaming fixes:
  - Fix tool call argument accumulation using OpenAI index field
  - Fix streaming content display after tool calls
  - Add consecutive error tracking to prevent token waste

  Other changes:
  - ESC to abort operations, Ctrl+C to exit
  - Fix model selection when provider changes in cascade mode
  - Add debug logging for troubleshooting
  - Move tests to root tests/ folder
  - Fix banner test GRADIENT_COLORS reference
2026-01-29 07:33:30 -05:00
ad02852489 Bunmping version 2026-01-29 04:54:16 -05:00
57c5555a58 0.1.77 2026-01-29 04:53:59 -05:00
adfebda501 Add debug log panel, centered modals, and fix multiple UX issues
Features:
  - Add /logs command to toggle debug log panel (20% width on right)
  - Debug panel shows API calls, streaming events, tool calls, state changes
  - Add /help submenus with detailed command explanations
  - Center all modal dialogs in the terminal window

  Bug Fixes:
  - Fix streaming content not displaying (add fallback when streaming fails)
  - Fix permission modal shortcut key mismatch ('a' → 'l' for local scope)
  - Fix agent prompt accumulation when switching agents multiple times
  - Fix permission modal using brittle index for "No" option

  Improvements:
  - Restrict git commands (add, commit, push, etc.) unless user explicitly requests
  - Unify permission options across all UI components
  - Add Ollama model selection when switching to Ollama provider
  - Store base system prompt to prevent agent prompt stacking

  New files:
  - src/tui-solid/components/debug-log-panel.tsx
  - src/tui-solid/components/centered-modal.tsx
  - src/tui-solid/components/help-menu.tsx
  - src/tui-solid/components/help-detail.tsx
  - src/constants/help-content.ts
2026-01-29 04:53:39 -05:00
dfbbab2ecb 0.1.76 2026-01-27 23:50:12 -05:00
44b78aefae fixing the installation issue 2026-01-27 23:49:48 -05:00
7f4a23a4db bumping the version 2026-01-27 23:39:54 -05:00
caa910a3b8 0.1.75 2026-01-27 23:39:04 -05:00
2856c7785b Fixing the repository URL in package.json 2026-01-27 23:38:47 -05:00
0062e5d9d9 Terminal-based AI coding agent with interactive TUI for autonomous code generation.
Features:
  - Interactive TUI with React/Ink
  - Autonomous agent with tool calls (bash, read, write, edit, glob, grep)
  - Permission system with pattern-based rules
  - Session management with auto-compaction
  - Dual providers: GitHub Copilot and Ollama
  - MCP server integration
  - Todo panel and theme system
  - Streaming responses
  - GitHub-compatible project context
2026-01-27 23:33:06 -05:00