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)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds ZCode as a supported AI tool by creating a new command adapter with YAML frontmatter generation and escaping helpers, registering it in ChangesZCode Tool Integration
Sequence Diagram(s)sequenceDiagram
participant Client as CLI
participant InitCmd as InitCommand
participant ZCodeAdapter as zcodeAdapter
participant YAML as YAML Formatter
participant FS as File System
Client->>InitCmd: --tools zcode
InitCmd->>ZCodeAdapter: formatFile(command)
ZCodeAdapter->>YAML: escapeYamlValue(description)
YAML-->>ZCodeAdapter: quoted/escaped string
ZCodeAdapter->>YAML: formatTagsArray(tags)
YAML-->>ZCodeAdapter: YAML array string
ZCodeAdapter-->>InitCmd: frontmatter + body
InitCmd->>FS: write to .zcode/commands/opsx/<id>.md
FS-->>Client: ✓ ZCode generation complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
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)Summary by CodeRabbit
.zcodedirectory..zcode/commands/opsx/.