feat(zcode): add ZCode as supported tool#1209
Conversation
Register ZCode in the AI tools registry and provide a command adapter so `openspec init --tools zcode` generates per-project artifacts under a single .zcode/ root (no split across .agents + .zcode): - Skills: .zcode/skills/openspec-*/SKILL.md (ZCode-native discovery path, highest priority among project-level skill roots) - Commands: .zcode/commands/opsx/<id>.md (Claude-compatible frontmatter) Both .zcode/skills and .agents/skills are valid ZCode discovery roots (verified from ZCode source: skillRootsForBase registers them in pairs); we use .zcode to keep all artifacts under one directory. ZCode auto-detection triggers on .zcode or .agents at the project root. Verification: - pnpm build passes (TypeScript compiles clean) - pnpm lint passes (no new warnings) - pnpm test: 1661 tests pass (no regressions) - E2E: `openspec init --tools zcode --profile core` produces 5 skills + 5 commands, all under .zcode/ (no .agents created)
📝 WalkthroughWalkthroughAdds ZCode as a supported AI tool with YAML-frontmatter command generation, registry and configuration wiring, documentation, tool-detection coverage, and initialization/update workflow tests. ChangesZCode Tool Integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant CLI
participant InitCommand
participant CommandAdapterRegistry
participant zcodeAdapter
participant FileSystem
CLI->>InitCommand: select zcode
InitCommand->>CommandAdapterRegistry: resolve zcode adapter
CommandAdapterRegistry-->>InitCommand: return zcodeAdapter
InitCommand->>zcodeAdapter: format command frontmatter
zcodeAdapter->>FileSystem: write .zcode/commands/opsx/<id>.md
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
alfred-openspec
left a comment
There was a problem hiding this comment.
Thanks for the scoped ZCode support. The adapter/config shape looks plausible and a local smoke generated the expected .zcode/skills/... plus .zcode/commands/opsx/*.md files, but this adds a new supported tool without focused regression coverage.
Please add tests that lock down the ZCode contract before merge: adapter path/frontmatter escaping, registry presence, .zcode + .agents auto-detection semantics, and init/update generation staying under .zcode without creating .agents. The existing broad tests pass, but they do not protect the new adapter path/detection behavior.
ZCode's detectionPaths included '.agents', a generic directory used by many agent frameworks. A bare '.agents' at the project root caused false-positive ZCode detection (mirroring the Copilot bare-.github problem the codebase already guards against). Drop the detectionPaths override so ZCode is detected solely via its strongly-identifying skillsDir '.zcode'. Add tests locking the new contract: a bare '.agents' must not trigger detection, and '.agents' co-located with '.zcode' must not suppress real detection.
Add focused coverage for the ZCode command adapter that the existing broad tests did not protect: - getFilePath lands under .zcode/commands/opsx/<id>.md and never references .agents - formatFile emits name/description/category/tags frontmatter - YAML escaping across all branches: colons/quotes/newlines (quoted values), special chars in name/category, per-tag quoting, plus the previously uncovered backslash-doubling and leading/trailing whitespace branches
Verify the ZCode adapter is registered in CommandAdapterRegistry so openspec init/update can resolve it via get/getAll/has. The existing registry tests only sampled a few tools, so a future refactor that drops the zcode registration would have passed silently.
End-to-end coverage that init and update generate ZCode skills and commands under .zcode/ and never create a .agents directory. The adapter path/detection unit tests alone cannot catch a generation-time regression that writes outside .zcode, so this asserts the contract on disk for both entry points.
|
Unit tests have been added and all passed. The configuration of the zcode directory has also been fixed. @alfred-openspec |
alfred-openspec
left a comment
There was a problem hiding this comment.
Thanks for the quick cleanup. I rechecked the updated head: detection is now scoped to .zcode, the new adapter/registry/init/update coverage is in place, and the focused local tests passed. The remaining YAML helper dedupe is already tracked separately in #1204/#1205, so I do not think it should block this adapter.
# Conflicts: # docs/supported-tools.md # test/core/available-tools.test.ts # test/core/command-generation/adapters.test.ts
alfred-openspec
left a comment
There was a problem hiding this comment.
The adapter now has focused path and frontmatter, registry, detection, init, and update coverage, and the .zcode/commands/opsx namespace matches current ZCode ecosystem conventions. The rebase and full CI are green.
Union the tool-ID list (hermes from main + zcode) and keep both the new ZCode init test and the renamed Kimi Code test from Fission-AI#1208. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merged |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/core/update.test.ts (1)
216-218: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse
path.joinfor filesystem paths in output expectations.Hard-coding Unix path separators (
/) in CLI output expectations can cause tests to fail on Windows, where native paths use backslashes (\). As per coding guidelines, usepath.jointo build expected path values to ensure cross-platform consistency.💻 Proposed fix
- expect(logCalls.some((entry) => entry.includes('.kimi/skills') && entry.includes('.kimi-code/skills'))).toBe(true); + expect(logCalls.some((entry) => entry.includes(path.join('.kimi', 'skills')) && entry.includes(path.join('.kimi-code', 'skills')))).toBe(true);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/core/update.test.ts` around lines 216 - 218, Update the output assertion in the logCalls expectation to construct both filesystem path fragments with path.join rather than hard-coding “/” separators, while preserving the existing requirement that the entry contains both .kimi/skills and .kimi-code/skills paths.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@test/core/update.test.ts`:
- Around line 216-218: Update the output assertion in the logCalls expectation
to construct both filesystem path fragments with path.join rather than
hard-coding “/” separators, while preserving the existing requirement that the
entry contains both .kimi/skills and .kimi-code/skills paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 36b0f6e4-0c9e-4dc9-9169-0e035e118e4e
📒 Files selected for processing (6)
docs/supported-tools.mdsrc/core/config.tstest/core/available-tools.test.tstest/core/command-generation/registry.test.tstest/core/init.test.tstest/core/update.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/supported-tools.md
- src/core/config.ts
- test/core/command-generation/registry.test.ts
alfred-openspec
left a comment
There was a problem hiding this comment.
Verified the latest rebase preserves Hermes in the supported-tool list, the renamed Kimi Code test from main, and the full ZCode contract: scoped .zcode detection, adapter path/frontmatter, registry wiring, and init/update generation without .agents leakage. The final diff is clean, mergeable, and fully green across Windows, macOS, and Linux.
Union resolutions with the hermes (Fission-AI#1292), zcode (Fission-AI#1209), and kimi-code (Fission-AI#1208) merges: combined tool-ID list, both detection test groups, the CodeArts assertion folded into the shared skills-only registry test, and all adapterless init tests kept. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Register ZCode in the AI tools registry and provide a command adapter so
openspec init --tools zcodegenerates per-project artifacts under a single .zcode/ root (no split across .agents + .zcode):Both .zcode/skills and .agents/skills are valid ZCode discovery roots (verified from ZCode source: skillRootsForBase registers them in pairs); we use .zcode to keep all artifacts under one directory.
ZCode auto-detection triggers on .zcode or .agents at the project root.
Verification:
openspec init --tools zcode --profile coreproduces 5 skills + 5 commands, all under .zcode/ (no .agents created)Closes #1242. Supersedes #1243.
Summary by CodeRabbit
.zcodedirectory is present (without being affected by.agentsalone)..zcode/commands/opsx/with YAML frontmatter, including robust escaping/quoting for special characters.