fix(hooks): normalize IDE-style tool names from CodeBuddy Craft Agent - #66
Merged
Merged
Conversation
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
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:execute_commandBashsearch_contentGrepwrite_to_fileWritereplace_in_fileEditlist_dirGlobweb_searchWebSearchweb_fetchWebFetchread_fileReadtaskTaskEntry points patched
src/auto-recall.ts—parseHookInput(): normalizes before RECALL_TOOLS whitelist checksrc/hook-handlers.ts—trackHandler+todowriteHintHandler: normalizes before Skill/Read/TodoWrite dispatchsrc/usage-tracker.ts—track()+trackFromStdin(): normalizes before Skill gatesrc/dashboard-collector.ts— tool_use event: normalizes before recording to statsSecondary fix
Accept both
file_path(CLI snake_case) andfilePath(IDE camelCase) in Read tool handlers for SKILL.md detection.Closes #63
Test plan
npx tsc --noEmit— zero errorsnpx vitest run— 1523 passed (108 files)parseHookInput({ tool_name: 'execute_command', ... })returnstoolName: 'Bash'