Skip to content

Conversation

@harshav167
Copy link

Summary

Adds .passthrough() to the Command Zod schema to allow external tools like SpecKit to include additional frontmatter fields without causing validation errors.

Problem

When using SpecKit with OpenCode (specify init --ai opencode), commands fail to load because SpecKit templates include additional frontmatter fields that OpenCode's schema rejects:

  • handoffs - SpecKit's workflow transition feature
  • scripts - Shell script definitions
  • agent_scripts - Agent-specific scripts

Solution

Add .passthrough() to the Command schema (line 422-428 in config/config.ts), which allows unknown fields to pass through validation without stripping them.

Before

export const Command = z.object({
  template: z.string(),
  description: z.string().optional(),
  agent: z.string().optional(),
  model: z.string().optional(),
  subtask: z.boolean().optional(),
})

After

export const Command = z
  .object({
    template: z.string(),
    description: z.string().optional(),
    agent: z.string().optional(),
    model: z.string().optional(),
    subtask: z.boolean().optional(),
  })
  .passthrough()

Benefits

  • Future-proof: New fields from SpecKit or other tools won't break OpenCode
  • Minimal change: No breaking changes to existing functionality
  • Extensibility: Enables third-party tool integration

Related

Testing

  1. Run specify init test-project --ai opencode
  2. Navigate to test-project/.opencode/command/
  3. Run opencode in the project
  4. SpecKit commands should load without errors

By default, Session.list() now returns only sessions created in the
current working directory. This provides better isolation when working
in different directories within the same git repository.

- Add ListOptions interface with 'all' boolean option
- Filter sessions by Instance.directory unless all=true
- Add --all/-a flag to 'oc session list' CLI command
- Add ?all=true query parameter to /session API endpoint

This behavior mirrors Codex and Claude Code, which scope session
visibility to the current working directory rather than showing all
sessions across the entire project/machine.
…bility

Add .passthrough() to Command Zod schema to allow external tools like
SpecKit to include additional frontmatter fields (handoffs, scripts,
agent_scripts) without causing validation errors.

This enables OpenCode to work with SpecKit templates that include
workflow-specific metadata beyond the core command fields.
@harshav167 harshav167 closed this Jan 3, 2026
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