Skip to content

feat(plugins): add OpenClaw target#887

Open
Elzlxx wants to merge 1 commit into
colbymchenry:mainfrom
Elzlxx:feat/openclaw-target
Open

feat(plugins): add OpenClaw target#887
Elzlxx wants to merge 1 commit into
colbymchenry:mainfrom
Elzlxx:feat/openclaw-target

Conversation

@Elzlxx

@Elzlxx Elzlxx commented Jun 14, 2026

Copy link
Copy Markdown

Summary

Adds an OpenClaw installer target so codegraph install (and the standalone installer) auto-wires the CodeGraph MCP server into OpenClaw. OpenClaw becomes the 9th supported agent — joining Claude, Cursor, Codex, opencode, Hermes, Gemini, Antigravity, and Kiro.

What's in this PR

  • src/installer/targets/openclaw.ts (new) — implements AgentTarget for OpenClaw:
    • Detects ~/.openclaw/openclaw.json (falls back to $XDG_CONFIG_HOME/openclaw/)
    • Writes mcp.servers.codegraph with absolute codegraph binary path, --serve --mcp --path <project>, CODEGRAPH_TELEMETRY=0, and the project cwd
    • Single global location (OpenClaw is a single gateway, no per-project config layer) — supportsLocation('local') returns false and install('local') returns a note and writes nothing
    • Surgical mcp.servers.codegraph write — preserves all sibling MCP servers (chrome-mcp, wordpress-deltabis, user-defined) and all other top-level config keys (channels, agents, gateway)
    • Idempotent: byte-identical re-runs return action: 'unchanged'
    • Uninstall drops only mcp.servers.codegraph; siblings and other keys intact
    • Project root auto-detected by walking up from cwd looking for .codegraph/, mirroring codegraph init behavior
  • src/installer/targets/registry.ts — registers openclawTarget
  • src/installer/targets/types.ts — extends TargetId union with 'openclaw'
  • __tests__/installer-targets.test.ts — 13 new openclaw-specific tests (sibling preservation, top-level config preservation, idempotency, uninstall, local-install refusal, detect transitions)
  • README.md — adds OpenClaw to supported-agents badges and prose

Test Results

Suite Result
installer-targets (157 tests) all pass
Full suite (1549 tests, 80 files) all pass
npm run build (tsc) clean

The 13 new openclaw tests cover: greenfield install, sibling MCP preservation, sibling top-level config preservation (channels/agents/gateway), idempotent re-run, uninstall with siblings intact, local install refusal with note, and the before/after detect transitions.

Why OpenClaw

OpenClaw is an open-source multi-agent gateway (github.com/openclaw/openclaw) with a Claude/Codex-style config format. It's a natural fit — single global config dir, MCP server entries in a mcp.servers namespace, same write pattern as the existing 8 targets.

The contributor (Elzlxx) runs OpenClaw as a 4-agent production setup and will use this target daily for code exploration on geoxylia-audit, SkillOpt, and kobe-capital.

Notes

  • Follows the same single-file-per-target + registry-entry + TargetId union pattern as the existing 8 targets. Mirrors the opencode test scaffolding (env-redirection via setHome(), XDG_CONFIG_HOME handling, etc.).
  • Resolves the codegraph binary via common install locations (~/.local/bin/codegraph, ~/.codegraph/bin/codegraph, /usr/local/bin/codegraph, /opt/homebrew/bin/codegraph) with a PATH-resolved fallback.
  • Reuses the existing jsonDeepEqual shared helper for idempotency detection.

License

MIT (consistent with the rest of the repo).

Adds a thin OpenClaw shell wrapping the CodeGraph installer. OpenClaw
becomes the 9th supported agent (joining Claude, Cursor, Codex, opencode,
Hermes, Gemini, Antigravity, and Kiro).

Writes the codegraph MCP server entry into $HOME/.openclaw/openclaw.json
under mcp.servers.codegraph. Sibling MCP servers (chrome-mcp, etc.) and
all other top-level config keys (channels, agents, gateway) are preserved
on install and uninstall.

Single global location — OpenClaw is a single gateway with no
per-project config layer, so local install returns a note and writes
nothing.

Project root is auto-detected by walking up from cwd looking for an
existing .codegraph/ directory, falling back to cwd. Mirrors the
behavior of `codegraph init`.

End-to-end tested:
- 13 new openclaw-specific tests (sibling preservation, idempotency,
  uninstall behavior, detect transitions, local-install refusal)
- All 157 installer-target tests pass
- Full test suite (1549 tests) passes
- npm run build (tsc) is clean

Files:
- src/installer/targets/openclaw.ts — new target implementation
- src/installer/targets/registry.ts — add openclawTarget to ALL_TARGETS
- src/installer/targets/types.ts — add 'openclaw' to TargetId union
- __tests__/installer-targets.test.ts — 13 new openclaw tests
- README.md — list OpenClaw in supported-agents badges and prose
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