feat(installer): add CoDev Code target (opencode fork)#1271
Closed
quickbeard wants to merge 1 commit into
Closed
Conversation
…nfig paths) CoDev Code (npm codev-code) is an opencode fork that keeps opencode's config shape byte-for-byte but renames the on-disk app identity, so an opencode install was invisible to it: the fork reads ~/.config/codev/codev.jsonc / ./codev.jsonc, never ~/.config/opencode/opencode.jsonc. The opencode target's mechanics (XDG resolution, .jsonc-preferred fallback, surgical jsonc-parser edits, AGENTS.md block) all apply verbatim, so they move to a shared opencode-family factory that both targets are thin specs over. The pre-colbymchenry#535 %APPDATA% sweep stays opencode-only — the fork never shipped through those versions. Verified end-to-end: --target=auto detects a ~/.config/codev dir, writes codev.jsonc, and the real codev binary connects to the codegraph MCP server from that config; uninstall reverses it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Superseded by #1272 — same change; the head branch was renamed to follow the repo's |
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.
What
Adds a
codevinstaller target for CoDev Code (codev-codeon npm, repo) — a fork of opencode that keeps opencode's config format but renames the on-disk app identity.Why
CodeGraph's opencode target writes to
~/.config/opencode/opencode.jsonc(or./opencode.jsonclocally). The CoDev fork reads only~/.config/codev/codev.jsonc/./codev.jsonc, so a CodeGraph install is invisible to it — anddetect()checks for~/.config/opencode, so on a machine with only CoDev installed,--target=autonever even offers it. We maintain the fork and hit this directly: CodeGraph simply doesn't work with CoDev today, and manual config editing is the only workaround.Everything except the paths is already compatible. We verified against the fork's source that it keeps opencode's config shape byte-for-byte: the same
mcp.<name>wrapper with{ "type": "local", "command": [...], "enabled": true }, the samehttps://opencode.ai/config.json$schema(the fork stamps that URL into fresh configs itself), the same XDG-only dir resolution viaxdg-basediron every platform,.jsoncpreferred over.json, and the same global + projectAGENTS.mdinstructions convention.How
The opencode target's mechanics apply to the fork verbatim, so rather than copy the file, this PR:
targets/opencode-family.ts(new) — the previousopencode.tsimplementation, unchanged in behavior, parameterized by a small spec:{ id, displayName, docsUrl, appName, sweepLegacyWindowsAppData }.appNamedrives both the config dir and the config file base name.targets/opencode.ts— now a thin spec over the factory (appName: 'opencode',sweepLegacyWindowsAppData: true). Behavior is identical, including the opencode config path on Windows uses %APPDATA% instead of ~/.config/opencode/ #535 legacy%APPDATA%sweep.targets/codev.ts(new) — the CoDev spec (appName: 'codev'), following the "one new file + one registry entry" architecture. The%APPDATA%sweep is off: the pre-opencode config path on Windows uses %APPDATA% instead of ~/.config/opencode/ #535 misplacement is opencode install history the fork never had, so the codev target must never touch%APPDATA%.TargetIdunion entries, the install/uninstall location-prompt hints, README/site-docs agent lists, and a CHANGELOG entry under[Unreleased].Tests
mcp-vs-mcpServersshape checks now cover both family members.~/.config/codev/codev.jsonc+AGENTS.md),.jsonc-over-.jsonpreference,.jsonfallback, local./codev.jsonc, fork independence (installing/uninstalling one never touches the other's files), and that detection and install ignore%APPDATA%/codeventirely.__tests__/installer-targets.test.ts: 172/172 pass. Fullnpm test: 2008 pass (three unrelated worker-exit flakes under parallel run; those files pass individually).End-to-end verification
Against a scratch
$HOMEwith the builtdist/:codegraph install --target=auto --yeswith only a~/.config/codevdir present → detects CoDev, writescodev.jsonc+AGENTS.md.codevbinary pointed at that config:codev mcp list→✓ codegraph connected.codegraph uninstall --target=codev --yes→ config back to the bare$schemafile, AGENTS.md block gone.Notes for review
codegraph install/uninstallcommand descriptions insrc/bin/codegraph.tsuntouched — they list only 5 of the 8 existing agents already, so updating them felt like separate cleanup.opencode-family.tsor restructure the spec if you'd prefer a different shape for downstream-fork targets.🤖 Generated with Claude Code