Skip to content

feat: add CodeBuddy Code support#1967

Open
studyzy wants to merge 1 commit into
rtk-ai:developfrom
studyzy:develop
Open

feat: add CodeBuddy Code support#1967
studyzy wants to merge 1 commit into
rtk-ai:developfrom
studyzy:develop

Conversation

@studyzy
Copy link
Copy Markdown

@studyzy studyzy commented May 19, 2026

Closes #1966

Summary

Adds first-class support for CodeBuddy Code, a Claude-powered AI coding assistant whose config lives in .codebuddy/.

CodeBuddy Code uses the same PreToolUse hook JSON protocol as Claude Code, so the hook implementation delegates directly to the existing process_claude_payload logic.

Changes

New commands

  • rtk hook codebuddy — PreToolUse hook processor (reads JSON from stdin, rewrites tool_input.command)
  • rtk init -g --agent codebuddy — installs hook into ~/.codebuddy/settings.json and writes ~/.codebuddy/CODEBUDDY.md
  • rtk init -g --agent codebuddy --uninstall — removes all RTK artifacts

Files changed

File Change
src/hooks/constants.rs Add CODEBUDDY_DIR (.codebuddy) and CODEBUDDY_HOOK_COMMAND constants
src/hooks/hook_cmd.rs Add run_codebuddy() — delegates to process_claude_payload
src/hooks/init.rs Add run_codebuddy_mode(), uninstall_codebuddy(), and patch_settings_json_at() helper
src/main.rs Add AgentTarget::Codebuddy, HookCommands::Codebuddy, dispatch logic
hooks/codebuddy/rtk-awareness.md RTK awareness instructions embedded into ~/.codebuddy/CODEBUDDY.md
hooks/codebuddy/README.md Integration documentation

Design notes

  • Zero new protocol code: CodeBuddy Code uses the identical PreToolUse + tool_input.command JSON format as Claude Code, so run_codebuddy() simply calls process_claude_payload().
  • patch_settings_json_at(): Extracted a new helper that patches settings.json in an arbitrary directory (instead of hardcoding the Claude config dir). This makes it easy to add future agents with similar config layouts.
  • Global-only: Like Gemini and Cursor, CodeBuddy hooks are installed globally (~/.codebuddy/).

Testing

# Hook rewrite works correctly
echo '{"tool_name":"Bash","tool_input":{"command":"git status"}}' | rtk hook codebuddy
# Output: {"hookSpecificOutput":{"hookEventName":"PreToolUse","updatedInput":{"command":"rtk git status"}}}

# Dry-run init
rtk init -g --agent codebuddy --dry-run -v

# All 1901 existing tests pass
cargo test

Implements rtk-ai#1966

- Add CODEBUDDY_DIR (.codebuddy) and CODEBUDDY_HOOK_COMMAND constants
- Add `rtk hook codebuddy` command that reuses Claude Code's PreToolUse
  JSON protocol (tool_input.command + PreToolUse event)
- Add `rtk init -g --agent codebuddy` to install the hook into
  ~/.codebuddy/settings.json and write ~/.codebuddy/CODEBUDDY.md
- Add `rtk init -g --agent codebuddy --uninstall` to remove artifacts
- Add AgentTarget::Codebuddy enum variant
- Extract patch_settings_json_at() helper for patching settings.json
  in an arbitrary agent config directory (used by CodeBuddy; avoids
  hardcoding the Claude config dir)
- Add hooks/codebuddy/rtk-awareness.md and hooks/codebuddy/README.md
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 19, 2026

CLA assistant check
All committers have signed the CLA.

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.

Feature Request: Add support for CodeBuddy (Tencent Cloud AI Code Editor)

2 participants