[PR #1564] [MERGED] feat(clients): register ZCode during setup #2974

Closed
opened 2026-10-17 21:12:25 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1564
Author: @IvenKooLab
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @morluto

Base: main ← Head: feat/zcode-client


📝 Commits (4)

  • c1b9b23 feat(clients): register ZCode during setup
  • 8657bf2 fix(clients): preserve ZCode fallback servers and honor enable flag
  • a443d33 fix(clients): reject non-regular ZCode fallback files before reading
  • 4462432 fix(clients): integrate ZCode setup and preserve fallback settings

📊 Changes

10 files changed (+638 additions, -14 deletions)

View changed files

📝 .agents/skills/reverse-engineer-anything/references/connection-and-recovery.md (+1 -1)
📝 docs/client-configuration.md (+20 -0)
📝 docs/installation.md (+1 -0)
📝 src/application/ClientConfigurationDocument.ts (+45 -2)
📝 src/application/ClientRegistrationStatus.ts (+3 -1)
📝 src/application/SetupClientConfiguration.ts (+89 -10)
📝 src/application/SupportedClients.ts (+17 -0)
📝 tests/boundary/filesystem/clientLifecycle.test.ts (+1 -0)
📝 tests/boundary/filesystem/setupClientConfigCleanupOwnership.test.ts (+60 -0)
➕ tests/boundary/filesystem/zcodeClientConfiguration.test.ts (+401 -0)

📄 Description

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 the rea MCP server into the user-level ~/.zcode/cli/config.json and 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.rea exists in ~/.zcode/cli/config.json and the REA skill is installed under ~/.zcode/skills; uninstall removes exactly the rea entry and the installed skill directory.

ZCode's configuration dialect (verified against a live install):

  • MCP servers live in the nested mcp.servers table of the user-level config; entries carry command, args, and env (stdio, no transport discriminator).
  • Personal skills are discovered from ~/.zcode/skills, not the shared skills root.

Change and scope

  • SupportedClients: zcode definition — config path ~/.zcode/cli/config.json, marker ~/.zcode/cli, skill path ~/.zcode/skills, format zcode.
  • ClientConfigurationDocument:
    • mcp servers key for zcode (shared with opencode).
    • A zcode branch in parseClientConfiguration that returns the nested table with serversPath: ["mcp", "servers"].
    • withClientServers now treats a missing outer table as empty. This also fixes the same latent crash for a fresh opencode document (the other format using the mcp key), where a missing outer table previously threw during write.
  • docs/installation.md: ZCode row in the supported-clients table plus a short configuration note.
  • Skill install/uninstall plans are already data-driven from the definition's skillPath, so no SetupPlan/Uninstall changes are needed.
  • Intentionally out of scope: non-stdio transports and ZCode-specific skill variants.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application-layer setup client registration (SupportedClients, ClientConfigurationDocument).
  • CLI and MCP/tool-catalog contract: none (no tools added or changed).
  • Provider, bridge, target-format, or platform compatibility: adds the zcode client configuration format (nested mcp.servers JSON).
  • Evidence, artifact, provenance, or reconstruction contract: not applicable.
  • Process execution, authorization, cleanup, or containment impact: uninstall removes only the rea entry and the installed skill directory.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none authored; generated catalogs stay CI-owned.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/filesystem/zcodeClientConfiguration.test.ts (6 cases) — config path resolution, upsert preserving unrelated settings, fresh/empty documents (missing outer mcp table), and uninstall removing only the rea entry. clientLifecycle.test.ts expected-client list now includes zcode.
  • Base reproduction or other evidence: not applicable (feature).
  • User-visible CLI/MCP output (if applicable): setup and uninstall now list "ZCode" as a client label.
  • Remaining proof gaps: the full boundary suite was not run on a Unix host locally; two pre-existing symlink tests in clientLifecycle.test.ts fail on this Windows machine because Node cannot create symlinks without Developer Mode, reproduced identically on stock main.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm ci — clean install (Node v22.23.2, npm 10.9.8; .nvmrc pins 24.18.0, so CI covers the pinned toolchain)
  • npx vitest run tests/boundary/filesystem/zcodeClientConfiguration.test.ts — 6/6 passed
  • npx tsc -p tsconfig.json --noEmit — clean
  • npm run check:fast — typecheck + lint green (also passed as the pre-push hook)
  • npm run verify:test-discovery — all 733 test files discovered exactly once
  • npx vitest run tests/boundary/filesystem/clientLifecycle.test.ts — 41/43 passed; the 2 failures are the pre-existing Windows symlink cases described above (identical on main)

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; config I/O is covered by filesystem boundary tests.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: setup writes only the rea entry 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

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above. (No open issue for ZCode support found; same-pattern precedent discussion in #1415.)
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output. (New client label in the setup client list only.)
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1564 **Author:** [@IvenKooLab](https://github.com/IvenKooLab) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `feat/zcode-client` --- ### 📝 Commits (4) - [`c1b9b23`](https://github.com/morluto/rea/commit/c1b9b23156a05ed9272a9cf25cd22dedcc9e3438) feat(clients): register ZCode during setup - [`8657bf2`](https://github.com/morluto/rea/commit/8657bf2d270307725d9cf6a87ac2882bd152391d) fix(clients): preserve ZCode fallback servers and honor enable flag - [`a443d33`](https://github.com/morluto/rea/commit/a443d33fdd9c88beca11524a4d34cc6e05027203) fix(clients): reject non-regular ZCode fallback files before reading - [`4462432`](https://github.com/morluto/rea/commit/44624327da2e4767a6b410ecc5154d3493cac154) fix(clients): integrate ZCode setup and preserve fallback settings ### 📊 Changes **10 files changed** (+638 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `.agents/skills/reverse-engineer-anything/references/connection-and-recovery.md` (+1 -1) 📝 `docs/client-configuration.md` (+20 -0) 📝 `docs/installation.md` (+1 -0) 📝 `src/application/ClientConfigurationDocument.ts` (+45 -2) 📝 `src/application/ClientRegistrationStatus.ts` (+3 -1) 📝 `src/application/SetupClientConfiguration.ts` (+89 -10) 📝 `src/application/SupportedClients.ts` (+17 -0) 📝 `tests/boundary/filesystem/clientLifecycle.test.ts` (+1 -0) 📝 `tests/boundary/filesystem/setupClientConfigCleanupOwnership.test.ts` (+60 -0) ➕ `tests/boundary/filesystem/zcodeClientConfiguration.test.ts` (+401 -0) </details> ### 📄 Description ## 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 the `rea` MCP server into the user-level `~/.zcode/cli/config.json` and 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.rea` exists in `~/.zcode/cli/config.json` and the REA skill is installed under `~/.zcode/skills`; uninstall removes exactly the `rea` entry and the installed skill directory. ZCode's configuration dialect (verified against a live install): - MCP servers live in the **nested `mcp.servers` table** of the user-level config; entries carry `command`, `args`, and `env` (stdio, no transport discriminator). - Personal skills are discovered from `~/.zcode/skills`, not the shared skills root. ## Change and scope - `SupportedClients`: `zcode` definition — config path `~/.zcode/cli/config.json`, marker `~/.zcode/cli`, skill path `~/.zcode/skills`, format `zcode`. - `ClientConfigurationDocument`: - `mcp` servers key for `zcode` (shared with `opencode`). - A `zcode` branch in `parseClientConfiguration` that returns the nested table with `serversPath: ["mcp", "servers"]`. - `withClientServers` now treats a missing outer table as empty. This also fixes the same latent crash for a fresh `opencode` document (the other format using the `mcp` key), where a missing outer table previously threw during write. - `docs/installation.md`: ZCode row in the supported-clients table plus a short configuration note. - Skill install/uninstall plans are already data-driven from the definition's `skillPath`, so no `SetupPlan`/`Uninstall` changes are needed. - Intentionally out of scope: non-stdio transports and ZCode-specific skill variants. ## Contract and boundary impact - Semantic owner and earliest changed stage: application-layer setup client registration (`SupportedClients`, `ClientConfigurationDocument`). - CLI and MCP/tool-catalog contract: none (no tools added or changed). - Provider, bridge, target-format, or platform compatibility: adds the `zcode` client configuration format (nested `mcp.servers` JSON). - Evidence, artifact, provenance, or reconstruction contract: not applicable. - Process execution, authorization, cleanup, or containment impact: uninstall removes only the `rea` entry and the installed skill directory. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none authored; generated catalogs stay CI-owned. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/filesystem/zcodeClientConfiguration.test.ts` (6 cases) — config path resolution, upsert preserving unrelated settings, fresh/empty documents (missing outer `mcp` table), and uninstall removing only the `rea` entry. `clientLifecycle.test.ts` expected-client list now includes `zcode`. - Base reproduction or other evidence: not applicable (feature). - User-visible CLI/MCP output (if applicable): setup and uninstall now list "ZCode" as a client label. - Remaining proof gaps: the full boundary suite was not run on a Unix host locally; two pre-existing symlink tests in `clientLifecycle.test.ts` fail on this Windows machine because Node cannot create symlinks without Developer Mode, reproduced identically on stock `main`. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm ci` — clean install (Node v22.23.2, npm 10.9.8; `.nvmrc` pins 24.18.0, so CI covers the pinned toolchain) - `npx vitest run tests/boundary/filesystem/zcodeClientConfiguration.test.ts` — 6/6 passed - `npx tsc -p tsconfig.json --noEmit` — clean - `npm run check:fast` — typecheck + lint green (also passed as the pre-push hook) - `npm run verify:test-discovery` — all 733 test files discovered exactly once - `npx vitest run tests/boundary/filesystem/clientLifecycle.test.ts` — 41/43 passed; the 2 failures are the pre-existing Windows symlink cases described above (identical on `main`) ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; config I/O is covered by filesystem boundary tests. - Package or release metadata impact: none. - Security, privacy, process, or containment review: setup writes only the `rea` entry 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 - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. (No open issue for ZCode support found; same-pattern precedent discussion in #1415.) - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. (New client label in the setup client list only.) - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:12:25 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2974
No description provided.