Skip to content

feat: add CodeBuddy agent support - #482

Closed
studyzy wants to merge 3 commits into
DeusData:mainfrom
studyzy:main
Closed

feat: add CodeBuddy agent support#482
studyzy wants to merge 3 commits into
DeusData:mainfrom
studyzy:main

Conversation

@studyzy

@studyzy studyzy commented Jun 17, 2026

Copy link
Copy Markdown

Summary

Add full support for CodeBuddy as a supported coding agent, bringing the total from 11 to 12 auto-detected agents.

CodeBuddy follows the same configuration pattern as Claude Code, using ~/.codebuddy/ instead of ~/.claude/ and ~/.codebuddy/.mcp.json for MCP server registration.

Changes

Core (src/cli/)

  • cli.h: Add bool codebuddy field to cbm_detected_agents_t; declare cbm_upsert_codebuddy_hooks, cbm_remove_codebuddy_hooks, cbm_upsert_codebuddy_session_hooks, cbm_remove_codebuddy_session_hooks
  • cli.c: Add cbm_codebuddy_config_dir() (honors $CODEBUDDY_CONFIG_DIR, falls back to ~/.codebuddy), detection in cbm_detect_agents(), install_codebuddy_config(), uninstall_codebuddy(), PreToolUse + SessionStart hooks, hook gate script + session reminder script installers

Discovery (src/discover/)

  • Add .codebuddy to skip directory list (IDE category)

CLI help (src/main.c)

  • Add CodeBuddy to supported agents list

Setup scripts

  • setup.sh: Add configure_codebuddy() — interactive MCP config for ~/.codebuddy/.mcp.json
  • setup-windows.ps1: Add Configure-CodeBuddy — PowerShell equivalent, honors $env:CODEBUDDY_CONFIG_DIR

Tests

  • Agent detection: cli_detect_agents_finds_codebuddy, cli_detect_agents_finds_codebuddy_via_env
  • Hooks: cli_upsert_codebuddy_hook_fresh, cli_remove_codebuddy_hooks, cli_codebuddy_session_hook_parity
  • Discovery: skip_codebuddy

Documentation

  • README.md: Update badge 11→12, agent list, MCP table
  • docs/index.html: Update meta tags and landing page copy

Test Plan

  • make -f Makefile.cbm test — 5610 passed (was 5607, +3 new tests)
  • make -f Makefile.cbm lint-format — clean
  • make -f Makefile.cbm lint-no-suppress — clean
  • bash -n scripts/setup.sh — syntax OK
  • Production build (scripts/build.sh) — OK

Signed-off-by: DevinZeng <studyzy@gmail.com>
studyzy added 2 commits June 22, 2026 13:42
cbm_upsert_codebuddy_session_hooks wrote hook script file path as
command, but test expects search_graph in settings.json (inline echo
command). Switch to CMM_SESSION_REMINDER_CMD inline shell command,
matching Gemini/Antigravity behavior.

Fixes cli_codebuddy_session_hook_parity test failure across all CI
platforms.

Signed-off-by: DevinZeng <studyzy@gmail.com>
CI lint failure: src/cli/cli.c:2085:97: code should be clang-formatted
[-Wclang-format-violations]

The compound literal (hooks_upsert_args_t){...} was formatted inline
exceeding the 100-column limit. Reformat to multi-line block matching
the project's clang-format style (ColumnLimit: 100, AlignAfterOpenBracket: Align).

Fixes two occurrences:
- cbm_upsert_codebuddy_session_hooks (line 2082)
- cbm_upsert_session_hooks (line 2159)

Signed-off-by: DevinZeng <studyzy@gmail.com>
@studyzy

studyzy commented Jun 23, 2026

Copy link
Copy Markdown
Author

Hi @DeusData 👋 — pinging for a review when you have a moment. This PR has been open since 2026-06-17 and adds CodeBuddy as a 12th supported agent (detection, hooks, setup scripts, tests, docs). All checks pass (5610 tests, lint clean, production build OK). I see you've been the sole merger of PRs in this repo over the past week (#562, #555, #528, #485, #475, #466, #464, #448, #412), so you look like the right reviewer. Happy to address any feedback. Thanks!

@DeusData

Copy link
Copy Markdown
Owner

Huge thanks for opening this PR and for the work you put into it.

The maintainer shop is currently full, so this may sit for a bit before it gets a proper review. We will come back to this as soon as possible with real feedback; I wanted to make sure it did not sit unacknowledged in the meantime.

@DeusData DeusData added enhancement New feature or request editor/integration Editor compatibility and CLI integration priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens. labels Jun 29, 2026
@DeusData DeusData added this to the 0.9.2-rc milestone Jul 8, 2026
@DeusData

Copy link
Copy Markdown
Owner

Closing this one because the feature has shipped — and I am sorry it took us this long to say so, because you did the work first.

CodeBuddy support landed on main in a3903ca (12 July). Everything this PR set out to do — MCP registration, hooks wiring, the skill and reminder content, install-plan and uninstall handling — is there now.

Your implementation was sound, and I want to be specific rather than polite about it, because it was reviewed properly before this decision:

  • Every agent-config write in your diff is a merge, not a clobber. ~/.codebuddy/.mcp.json goes through the shared yyjson upsert that touches only the mcpServers["codebase-memory-mcp"] key; settings.json merges hooks and the removal path deletes only our own matchers. The setup.sh and setup-windows.ps1 functions prompt before writing, merge via jq/python3 or Read-SettingsJson, and print a manual snippet when neither tool exists. That is exactly the care this area needs — silently clobbering someone's agent config is the failure mode I look hardest for, and it is not here.
  • The hook payloads are benign: the gate script execs the binary's hook-augment and exits 0 on every failure path with the binary path quote-guarded, and the session reminder is static guidance matching the existing text.
  • No new dependencies, no CI or build changes, and the shipped instruction text is clean.

Two things I would have asked you to change, noted only so the record is complete: the two new hook-script writers used raw fopen() on user-config paths, where our rule is cbm_fopen() (raw fopen breaks non-ASCII paths on Windows), and they overwrote the cbm-named scripts unconditionally. Main has since moved to ownership-checked writes via cbm_write_owned_hook_script_with_legacy, which is the stronger behaviour. Both were faithful copies of the Claude installers as they existed when you branched, so this is our debt showing through rather than a lapse on your part.

The honest summary is that you identified a real gap, built it correctly, and it sat here while an equivalent landed by another route. That is a failure of our review throughput, not of your contribution, and it is exactly the problem we are working through right now.

Thank you for the work, and I hope this does not put you off sending the next one.

@DeusData DeusData closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editor/integration Editor compatibility and CLI integration enhancement New feature or request priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants