Skip to content

fix: handle agent frontmatter correctly in OpenCode conversion#981

Open
flongstaff wants to merge 1 commit intogsd-build:mainfrom
flongstaff:fix/opencode-agent-frontmatter-conversion
Open

fix: handle agent frontmatter correctly in OpenCode conversion#981
flongstaff wants to merge 1 commit intogsd-build:mainfrom
flongstaff:fix/opencode-agent-frontmatter-conversion

Conversation

@flongstaff
Copy link

@flongstaff flongstaff commented Mar 8, 2026

What

Fix convertClaudeToOpencodeFrontmatter() to handle agent frontmatter correctly by adding an isAgent option.

Why

The function was designed for commands but is also called for agents — it strips name: (needed by OpenCode agents), keeps color:/skills:/tools: (should strip), and doesn't add model: inherit / mode: subagent (required by OpenCode agents).

Details

Field Commands (correct) Agents (before) Agents (after)
name: stripped ✓ stripped ✗ kept
tools: converted to object ✓ converted to object ✗ stripped
skills: N/A kept ✗ stripped
color: converted to hex ✓ converted to hex ✗ stripped
model: inherit not added ✓ not added ✗ added
mode: subagent not added ✓ not added ✗ added
commented # hooks: kept kept ✗ stripped

Testing

  • Tested on macOS
  • Tested on Windows
  • Tested on Linux
  • 10 new tests for agent conversion (isAgent: true)
  • 3 new tests for command backwards compatibility (isAgent: false)
  • All 548 existing tests pass (3 pre-existing sandbox failures in config.test.cjs unrelated to this change)

Checklist

  • Follows GSD style (no enterprise patterns, no filler)
  • Updates CHANGELOG.md for user-facing changes
  • No unnecessary dependencies added
  • Works on Windows (backslash paths tested) — change is pure string/frontmatter manipulation, no filesystem paths involved

Breaking Changes

None — default isAgent: false preserves existing command conversion behavior exactly.

Generated with Claude Code

convertClaudeToOpencodeFrontmatter() was designed for commands but is
also called for agents. For agents it incorrectly strips name: (needed
by OpenCode agents), keeps color:/skills:/tools: (should strip), and
doesn't add model: inherit / mode: subagent (required by OpenCode).

Add isAgent option to convertClaudeToOpencodeFrontmatter() so agent
installs get correct frontmatter: name preserved, Claude-only fields
stripped, model/mode injected. Command conversion unchanged (default).

Includes 14 test cases covering agent and command conversion paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@flongstaff flongstaff force-pushed the fix/opencode-agent-frontmatter-conversion branch from e6a2787 to 2317ded Compare March 8, 2026 20:24
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