Skip to content

Add ZCode tool support (#1242)#1243

Open
zhangsan582 wants to merge 1 commit into
Fission-AI:mainfrom
zhangsan582:feature_0623
Open

Add ZCode tool support (#1242)#1243
zhangsan582 wants to merge 1 commit into
Fission-AI:mainfrom
zhangsan582:feature_0623

Conversation

@zhangsan582

@zhangsan582 zhangsan582 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Issue Summary

#1242 reports that OpenSpec does not recognize or handle zcode. The actual behavior is that zcode cannot be used as a tool ID. The expected behavior is to support ZCode or clearly document that it is
unsupported. The affected areas are openspec init --tools zcode, tool auto-detection, and command/skill generation.

Selected Fix

I chose to implement ZCode support. The issue is clear and narrowly scoped: add tool registration, a command adapter, a registry entry, and test coverage. I avoided #1222 and #1226 because you noted they
were already fixed.

Root Cause

zcode was missing from AI_TOOLS, and there was no ZCode adapter in the command adapter registry, so the CLI could not recognize it or generate .zcode skills/commands.

Implementation

  1. OpenSpec: No OpenSpec process files were created or modified. No OpenSpec files were included in the commit.
  2. Code: Added zcode tool registration with skillsDir: '.zcode'; added zcodeAdapter, which generates .zcode/commands/opsx/.md; registered and exported the adapter.
  3. Tests: Added/updated adapter, registry, available tools, and init tests covering --tools zcode skill and command generation.
  4. Verification: Ran focused tests, pnpm run lint, pnpm test, and pnpm run build; all passed.

Commit

Commit: e4fc0cb

Message: Add ZCode tool support (#1242)

The commit does not include any OpenSpec-related files; it only includes source and test files.

Summary

This switched the local repo to the feature_0623 branch and added ZCode support for #1242.

Previously, zcode was not a valid tool ID, and OpenSpec did not detect .zcode or generate ZCode skills or commands.

This adds ZCode registration and command generation so openspec init --tools zcode can create .zcode/skills/.../SKILL.md and .zcode/commands/opsx/.md.

Changes

  • Added zcode to AI_TOOLS.
  • Added src/core/command-generation/adapters/zcode.ts.
  • Registered and exported the ZCode command adapter.
  • Added adapter, registry, auto-detection, and init generation tests.

Verification

  • pnpm exec vitest run test/core/command-generation/adapters.test.ts test/core/command-generation/registry.test.ts test/core/available-tools.test.ts test/core/init.test.ts
  • pnpm run lint
  • pnpm test
  • pnpm run build

Summary by CodeRabbit

Bug Fixes

  • ZCode is now recognized as a supported OpenSpec tool and can receive generated skills and commands.

Documentation

  • No documentation files were changed in this commit.

Tests

  • Added coverage for ZCode adapter formatting, registry lookup, .zcode detection, and init --tools zcode generation.

Summary by CodeRabbit

Release Notes

  • New Features
    • ZCode is now available as a new tool option for command generation and initialization, enabling structured command file creation with metadata support.

@zhangsan582 zhangsan582 requested a review from TabishB as a code owner June 23, 2026 15:08
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2a8ee871-1b1f-4078-a55a-9ef8f5f67f8c

📥 Commits

Reviewing files that changed from the base of the PR and between 1b06fdd and e4fc0cb.

📒 Files selected for processing (8)
  • src/core/command-generation/adapters/index.ts
  • src/core/command-generation/adapters/zcode.ts
  • src/core/command-generation/registry.ts
  • src/core/config.ts
  • test/core/available-tools.test.ts
  • test/core/command-generation/adapters.test.ts
  • test/core/command-generation/registry.test.ts
  • test/core/init.test.ts

📝 Walkthrough

Walkthrough

Adds ZCode as a new supported AI tool. A zcodeAdapter implementing ToolCommandAdapter is created, generating markdown files at .zcode/commands/opsx/<commandId>.md with YAML frontmatter. The adapter is re-exported from the adapters index, registered in CommandAdapterRegistry, and a ZCode entry is added to the AI_TOOLS config. Tests cover all new behaviors.

Changes

ZCode Tool Integration

Layer / File(s) Summary
ZCode adapter implementation and export
src/core/command-generation/adapters/zcode.ts, src/core/command-generation/adapters/index.ts
New zcodeAdapter with toolId: 'zcode', getFilePath returning .zcode/commands/opsx/<id>.md, and formatFile producing YAML frontmatter markdown; re-exported from the adapters index.
Config entry and registry registration
src/core/config.ts, src/core/command-generation/registry.ts
Adds zcode entry to AI_TOOLS (skillsDir: '.zcode') and registers zcodeAdapter in CommandAdapterRegistry's static initializer.
Tests: adapter, registry, tool detection, and init
test/core/command-generation/adapters.test.ts, test/core/command-generation/registry.test.ts, test/core/available-tools.test.ts, test/core/init.test.ts
Validates adapter toolId, nested getFilePath output, formatFile YAML frontmatter, registry get/getAll/has assertions, .zcode directory detection by getAvailableTools, and InitCommand ZCode artifact generation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • Add support for AtomCode (atomcode) #1210: This PR implements ZCode tool support following the same architectural pattern described in the issue — new adapter, registry registration, adapters index export, and config entry.

Possibly related PRs

  • Fission-AI/OpenSpec#556: Established the multi-provider command-generation adapter infrastructure (CommandAdapterRegistry, skillsDir, adapter contract) that zcodeAdapter directly plugs into.
  • Fission-AI/OpenSpec#941: Also extends AI_TOOLS in src/core/config.ts to register an additional tool (forgecode), using the same array-entry pattern as this PR's zcode addition.

Suggested reviewers

  • TabishB

Poem

🐇 Hop hop, a new tool arrives today,
ZCode joins the adapter fray!
YAML frontmatter, neat and bright,
.zcode/commands/opsx — just right.
The registry grows, tests all pass,
Another tool added to the class! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add ZCode tool support (#1242)' accurately describes the main change: adding support for the ZCode tool as a new recognized tool in the system.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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