Repository navigation
feat(clients): register ZCode during setup - #1564
Conversation
- SupportedClients: zcode definition (~/.zcode/cli/config.json, format zcode, personal skills at ~/.zcode/skills) - ClientConfigurationDocument: zcode dialect reads/writes the nested mcp.servers table; withClientServers now tolerates a missing outer table for fresh documents - docs: add ZCode to the supported-clients table with configuration notes - tests: zcodeClientConfiguration.test.ts (path resolution, nested upsert, fresh/empty configs, uninstall) Verified: tsc --noEmit clean; vitest run tests/boundary/filesystem/zcodeClientConfiguration.test.ts 6/6.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: ZCode (Apache-2.0) setup works. Setup, doctor and uninstall passed in a fake home, and the changed tests passed on Node 22, 24 and 26. The paths match the ZCode docs, with one heads-up about ResultsTested on Linux. The PR is
Heads-up from the ZCode docs: if any server comes from a Also, this PR does not update the client list in the bundled skill or the website FAQ. Not run
Thanks, IvenKooLab, for the nested Cases I ran and what they showed
Uninstall leaves Commandsgit --git-dir=$HOME/code/rea-mirror/rea.git fetch -q origin
git archive <sha> | tar -x -C <dir>
npm run build && npm run docs:check
node scripts/run-development-tests.mjs focused \
tests/boundary/filesystem/zcodeClientConfiguration.test.ts \
tests/boundary/filesystem/clientLifecycle.test.ts
env -i PATH="$NODE24/bin:/usr/bin:/bin" HOME="$FAKE" TMPDIR="$FAKE/tmp" \
XDG_CONFIG_HOME="$FAKE/.config" XDG_DATA_HOME="$FAKE/.local/share" \
XDG_CACHE_HOME="$FAKE/.cache" XDG_STATE_HOME="$FAKE/.local/state" \
npm_config_cache="$FAKE/.npm" timeout 60 \
node scripts/rea.mjs setup --client zcode --yes --format jsonI ran a dry run first. Test setup
🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Reviewed this change and found two integration gaps:
Validation: all six new filesystem tests and 43 shared client-lifecycle tests pass on macOS with Node 24.18.0 and npm 11.16.0. An additional disabled-state reproduction fails as described. The native path and nested dialect match official documentation; ZCode itself was not executed. |
Review follow-up (morluto#1564), two integration gaps: - ZCode reads the user-scope ~/.agents/mcp.json fallback only while the native .zcode config defines no servers at all, with no merging. Setup now copies the fallback's mcpServers entries into the native table when writing the first native server, so registrations that only live in the fallback keep loading; the fallback file is left untouched. A malformed fallback fails setup closed (configure and preflight) instead of being silently suppressed. - ZCode disables a server with "enable": false on its entry, which the generic status parsing (disabled/enabled) did not recognize: doctor reported such a registration as aligned although ZCode never starts it. The ZCode dialect now treats enable: false as disabled (state stale) and setup rewrites the entry on rerun. Docs describe both behaviors; the bundled REA skill's supported client list includes zcode. Verified: tsc --noEmit clean; vitest run tests/boundary/filesystem/zcodeClientConfiguration.test.ts 10/10; npm run check:fast green; npm run verify:test-discovery 733 files.
|
Thanks for the careful review — both gaps are real and confirmed against the ZCode docs, and both are fixed in 8657bf2. 1. Fallback suppression. Setup now preserves the effective fallback registrations: when it writes REA into an empty native table ( 2. Docs describe both behaviors in Validation: |
dandgabr
left a comment
There was a problem hiding this comment.
Consolidated review
- P2 — Reject non-regular ZCode fallback files before reading.
readZcodeFallbackServersreads~/.agents/mcp.jsondirectly withreadFile(src/application/SetupClientConfiguration.ts:335-349). During setup or preflight for the first native registration, a FIFO at that path can block the operation indefinitely; this read also bypasses the regular-file/path admission used for client configuration files. Please use the existing safe regular-file admission and transaction-path checks for the fallback before parsing or copying its entries. The previously reported fallback-preservation andenable: falsefindings are resolved at this head; no other actionable findings were confirmed.
Resolve the fallback through the client-config transaction path and the regular-file admission before parsing it, so a FIFO or other non-regular file at ~/.agents/mcp.json fails setup closed instead of blocking the read indefinitely. Directory and FIFO fallback cases are covered in tests, and the preflight remediation names unreadable fallbacks too.
|
Thanks — fixed in a443d33.
Tests: a directory at the fallback path (cross-platform) and a |
|
Thanks @IvenKooLab for adding ZCode support! The nested MCP configuration and personal skill registration make setup much easier for ZCode users. I also appreciate your work on the follow-up fixes and regression coverage. Great work! |
Summary
Registers ZCode (Z.ai's coding-agent CLI) as a supported client during
npx rea-agents setup, following the same pattern as the merged Qwen Code registration (#1415). After this change, ZCode users can install REA with one command: setup writes thereaMCP server into the user-level~/.zcode/cli/config.jsonand installs the REA skill into~/.zcode/skills.Problem and expected behavior
ZCode is not among the clients setup recognizes, so its users must hand-edit a nested JSON structure that no other client uses. Expected behavior: after setup,
mcp.servers.reaexists in~/.zcode/cli/config.jsonand the REA skill is installed under~/.zcode/skills; uninstall removes exactly thereaentry and the installed skill directory.ZCode's configuration dialect (verified against a live install):
mcp.serverstable of the user-level config; entries carrycommand,args, andenv(stdio, no transport discriminator).~/.zcode/skills, not the shared skills root.Change and scope
SupportedClients:zcodedefinition — config path~/.zcode/cli/config.json, marker~/.zcode/cli, skill path~/.zcode/skills, formatzcode.ClientConfigurationDocument:mcpservers key forzcode(shared withopencode).zcodebranch inparseClientConfigurationthat returns the nested table withserversPath: ["mcp", "servers"].withClientServersnow treats a missing outer table as empty. This also fixes the same latent crash for a freshopencodedocument (the other format using themcpkey), where a missing outer table previously threw during write.docs/installation.md: ZCode row in the supported-clients table plus a short configuration note.skillPath, so noSetupPlan/Uninstallchanges are needed.Contract and boundary impact
SupportedClients,ClientConfigurationDocument).zcodeclient configuration format (nestedmcp.serversJSON).reaentry and the installed skill directory.docs/public/product-catalog.json), package, or installation impact: none authored; generated catalogs stay CI-owned.Evidence and regression coverage
tests/boundary/filesystem/zcodeClientConfiguration.test.ts(6 cases) — config path resolution, upsert preserving unrelated settings, fresh/empty documents (missing outermcptable), and uninstall removing only thereaentry.clientLifecycle.test.tsexpected-client list now includeszcode.clientLifecycle.test.tsfail on this Windows machine because Node cannot create symlinks without Developer Mode, reproduced identically on stockmain.For evidence-bearing changes:
Validation performed
npm ci— clean install (Node v22.23.2, npm 10.9.8;.nvmrcpins 24.18.0, so CI covers the pinned toolchain)npx vitest run tests/boundary/filesystem/zcodeClientConfiguration.test.ts— 6/6 passednpx tsc -p tsconfig.json --noEmit— cleannpm run check:fast— typecheck + lint green (also passed as the pre-push hook)npm run verify:test-discovery— all 733 test files discovered exactly oncenpx vitest run tests/boundary/filesystem/clientLifecycle.test.ts— 41/43 passed; the 2 failures are the pre-existing Windows symlink cases described above (identical onmain)Compatibility, safety, and release
reaentry into~/.zcode/cli/config.json(preserving all unrelated settings) and installs the skill under~/.zcode/skills; no network access or process execution added.Review checklist
type(scope): outcome.