Add CodeBuddy AI coding agent support with checkpoint preset and hook installation#1600
Add CodeBuddy AI coding agent support with checkpoint preset and hook installation#1600pengyq wants to merge 2 commits into
Conversation
|
|
| Agent::CodeBuddy => match tool_name { | ||
| "Write" | "write_to_file" | "Edit" | "replace_in_file" | "MultiEdit" | ||
| | "multi_edit" | "NotebookEdit" | "notebook_edit" => ToolClass::FileEdit, | ||
| "Bash" => ToolClass::Bash, | ||
| _ => ToolClass::Skip, | ||
| }, |
There was a problem hiding this comment.
🚩 Asymmetric casing for Bash tool classification vs file-edit tools
The CodeBuddy classify_tool arm at src/commands/checkpoint_agent/bash_tool.rs:365-370 includes both PascalCase and snake_case variants for file-edit tools ("Write" | "write_to_file" | "Edit" | "replace_in_file" | "MultiEdit" | "multi_edit" | "NotebookEdit" | "notebook_edit"), but only PascalCase "Bash" for the bash tool — no "bash" lowercase variant. If CodeBuddy can send tool names in snake_case (as suggested by write_to_file, replace_in_file, multi_edit, notebook_edit), then a lowercase "bash" would be classified as ToolClass::Skip instead of ToolClass::Bash, causing bash-based file changes to be missed by the stat-diff system. This depends on what tool names CodeBuddy actually emits, which I cannot verify from the codebase alone.
Was this helpful? React with 👍 or 👎 to provide feedback.
| let stream_source = Some(StreamSource { | ||
| path: transcript_path_buf, | ||
| format: StreamFormat::ClaudeJsonl, | ||
| session_id: generate_session_id(&session_id, "codebuddy"), | ||
| external_session_id: session_id.clone(), | ||
| external_parent_session_id: None, | ||
| }); |
There was a problem hiding this comment.
🚩 CodeBuddy not registered in ALL_AGENT_TYPES — no sweep/discovery support
CodeBuddy is not added to ALL_AGENT_TYPES in src/streams/agent.rs:179-192 or the get_agent function (src/streams/agent.rs:197-214), and there is no corresponding stream agent implementation in src/streams/agents/. This means the sweep coordinator will not independently discover CodeBuddy sessions for background transcript ingestion. Transcript streaming will only work when triggered inline via the stream_source field in checkpoint hook events. This is consistent with firebender (which also lacks sweep support), but differs from most other agents (Claude, Cursor, Codex, etc.) that have full sweep implementations. If background sweep is desired for CodeBuddy, a stream agent would need to be added.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
This PR adds first-class support for CodeBuddy as a new AI coding agent, enabling git-ai to track AI-authored code changes made through the CodeBuddy IDE.
Changes
1. Checkpoint Preset (
src/commands/checkpoint_agent/presets/codebuddy.rs)A new
CodeBuddyPresetthat parses CodeBuddy hook input (JSON) and produces checkpoint events:Write/Edittools — extractsfile_pathfrom tool input and associates edits with the correct session and tool useBashtools — captures shell command attributionPreToolUse/PostToolUsehook event names and thecamelCasefield aliases (toolName,hookEventName,toolUseId) that CodeBuddy emitssession_idis absent2. Bash Tool Classification (
src/commands/checkpoint_agent/bash_tool.rs)Extended
classify_tool()to recognize the CodeBuddy agent, mappingBash→ToolClass::Bashand everything else →ToolClass::Other.3. Hook Installer (
src/mdm/agents/codebuddy.rs)A full
HookInstallerimplementation for CodeBuddy that manages hooks in~/.codebuddy/settings.json:git-ai checkpoint codebuddy --hook-input stdinasPreToolUseandPostToolUsehooks into the"*"catch-all matcher block"Write|Edit") to the"*"catch-all block, removing empty legacy blocksmodel,permissions) insettings.jsonare left untouched4. Dependency Update (
Cargo.toml)Minor version bump for a transitive dependency (
Cargo.lockupdated).Files Changed
src/commands/checkpoint_agent/presets/codebuddy.rssrc/mdm/agents/codebuddy.rssrc/commands/checkpoint_agent/bash_tool.rssrc/commands/checkpoint_agent/presets/mod.rssrc/commands/checkpoint_agent/presets/parse.rssrc/mdm/agents/mod.rsCargo.tomlTesting