Skip to content

feat(opencode): add codev codegraph enable/disable for standalone installs - #128

Merged
quickbeard merged 1 commit into
mainfrom
codegraph-command
Jul 28, 2026
Merged

quickbeard merged 1 commit into
mainfrom
codegraph-command

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Summary

Standalone CoDev Code installs (not managed by CoDev Hub) had no way to get CodeGraph wired up — CoDev Hub does that wiring only for its own managed installs (codev-hub#210). This adds a fork-only codev codegraph command group that closes the gap.

codev codegraph enable

  1. Makes the codegraph binary resolvable — probes PATH; when missing, installs @colbymchenry/codegraph globally via npm, then bun; when neither package manager exists (platform-binary installs), prints the manual install command and exits 1. A zero-exit install that still leaves the binary unresolvable warns ("restart your shell") instead of failing — the wiring works once PATH is fixed.
  2. Writes the MCP server entry into the global codev.json(c) with a comment-preserving jsonc edit. The write targets whichever file already carries an mcp.codegraph key (CoDev Hub prefers codev.jsonc, so an entry there is updated in place rather than shadowed), falling back to codev mcp add's resolution for fresh files. Idempotent — a second run reports "already configured" and leaves the file byte-identical. Malformed files are refused, never edited.
  3. Offers to index the current project (codegraph init) — --yes auto-accepts, non-interactive runs skip the prompt; either way it prints how to index any project later.

codev codegraph disable

Removes the entry from every config file that has it, drops an emptied mcp wrapper, preserves sibling MCP servers, and no-ops when nothing is wired.

Writer convergence

The entry is byte-identical to what CoDev Hub's shim and CodeGraph's own installer (pending custom-target support, codegraph#1459) write for CoDev Code — all three writers treat each other's work as already done, so mixing standalone and Hub-managed setups never fights.

Fork housekeeping

  • index.ts registration joined the existing DIVERGENCES.md row (the command file and test are fork-only new files, untracked per policy); CHANGELOG entry under Unreleased.
  • codegraph added to the help-snapshot TOP_LEVEL list; snapshots regenerated.

Testing

  • 8 subprocess tests via the cliIt harness (fake codegraph/npm binaries seeded on PATH; posix-gated where shell scripts are involved; the missing-binary suite self-skips on hosts that have a real codegraph on PATH): wiring + indexing with --yes, byte-identical idempotency, jsonc comment/sibling preservation, non-interactive prompt skip, the npm-install branch, and all three disable behaviors.
  • tsgo --noEmit clean; full test/cli directory: 375 pass, 0 fail.
  • Manual end-to-end in an isolated HOME: enable wrote the entry and indexed the project; disable returned the config to its pre-enable shape.

🤖 Generated with Claude Code

…talls

CoDev Hub wires the CodeGraph MCP server for its managed installs, but a
standalone codev install has nothing to do that wiring. `codev codegraph
enable` closes the gap: it makes the `codegraph` binary resolvable
(installing @colbymchenry/codegraph globally via npm, then bun, when it's
missing — printing the manual command when neither package manager
exists), writes the MCP server entry into the global codev.json(c) with a
comment-preserving jsonc edit, and offers to index the current project
via `codegraph init` (--yes auto-accepts; non-interactive runs print how
to do it later). `codev codegraph disable` removes the entry, dropping an
emptied mcp wrapper and leaving sibling servers untouched.

The entry is byte-identical to what CoDev Hub's shim and codegraph's own
installer write for CoDev Code, so the writers are interchangeable —
whichever runs later sees an already-correct entry and changes nothing.
The write targets whichever config file already carries the entry
(CoDev Hub prefers codev.jsonc), falling back to `codev mcp add`'s
resolution for fresh files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard
quickbeard merged commit 682911c into main Jul 28, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the codegraph-command branch July 28, 2026 07:09
quickbeard added a commit that referenced this pull request Aug 7, 2026
… PR (#169)

The CodeGraph entry (#128) describes codev codegraph enable — the fork-side
workaround for CodeGraph's installer not recognizing CoDev Code. That native
support is now proposed upstream as colbymchenry/codegraph#1459 (custom
installer targets), so codegraph install --target codev wires the same entry
from the CodeGraph side. Note it on the existing entry, matching the
upstream-link convention #167 used for the MiniMax prompt entry.
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.

1 participant