Skip to content

fix(hooks): normalize IDE-style tool names from CodeBuddy Craft Agent - #66

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:fix/codebuddy-ide-tool-names
Jun 29, 2026
Merged

fix(hooks): normalize IDE-style tool names from CodeBuddy Craft Agent#66
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:fix/codebuddy-ide-tool-names

Conversation

@m0Nst3r873

Copy link
Copy Markdown
Collaborator

Summary

CodeBuddy IDE (Craft Agent) passes IDE-style tool names via STDIN (e.g. execute_command, search_content) while teamai hooks only recognize CLI-style names (Bash, Grep). This caused auto-recall, skill tracking, and dashboard stats to silently no-op in CodeBuddy IDE.

Fix

Add normalizeToolName() mapping layer (per CodeBuddy docs Appendix E) applied at all hook entry points before existing dispatch logic:

IDE Style CLI Style
execute_command Bash
search_content Grep
write_to_file Write
replace_in_file Edit
list_dir Glob
web_search WebSearch
web_fetch WebFetch
read_file Read
task Task

Entry points patched

  • src/auto-recall.tsparseHookInput(): normalizes before RECALL_TOOLS whitelist check
  • src/hook-handlers.tstrackHandler + todowriteHintHandler: normalizes before Skill/Read/TodoWrite dispatch
  • src/usage-tracker.tstrack() + trackFromStdin(): normalizes before Skill gate
  • src/dashboard-collector.ts — tool_use event: normalizes before recording to stats

Secondary fix

Accept both file_path (CLI snake_case) and filePath (IDE camelCase) in Read tool handlers for SKILL.md detection.

Closes #63

Test plan

  • npx tsc --noEmit — zero errors
  • npx vitest run — 1523 passed (108 files)
  • Unit tests: all 9 IDE→CLI mappings + passthrough for CLI-style + unknown names
  • Integration test: parseHookInput({ tool_name: 'execute_command', ... }) returns toolName: 'Bash'

CodeBuddy IDE (Craft Agent) passes IDE-style tool names via STDIN
(e.g. execute_command, search_content) while teamai hooks only
recognize CLI-style names (Bash, Grep). This caused auto-recall,
skill tracking, and dashboard stats to silently no-op in CodeBuddy.

Add normalizeToolName() mapping (per CodeBuddy docs Appendix E):
  execute_command→Bash, search_content→Grep, write_to_file→Write,
  replace_in_file→Edit, list_dir→Glob, web_search→WebSearch,
  web_fetch→WebFetch, read_file→Read, task→Task

Applied at all hook entry points:
- auto-recall.ts: parseHookInput()
- hook-handlers.ts: trackHandler, todowriteHintHandler
- usage-tracker.ts: track(), trackFromStdin()
- dashboard-collector.ts: tool_use event recording

Also fix tool_input field name compatibility: accept both
file_path (CLI) and filePath (IDE camelCase) in Read tool handlers.

Closes Tencent#63
@jeff-r2026
jeff-r2026 merged commit 48eddda into Tencent:main Jun 29, 2026
7 checks passed
@m0Nst3r873
m0Nst3r873 deleted the fix/codebuddy-ide-tool-names branch June 29, 2026 08:17
@hsuchifeng hsuchifeng mentioned this pull request Jul 3, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] CodeBuddy IDE (Craft Agent) 工具名为 IDE 风格,导致 auto-recall 与 skill 追踪在 CodeBuddy 内静默失效

2 participants