Skip to content

fix(opencode): generate valid tools object and MCP command array for OpenCode schema compliance#130

Open
salihdev0 wants to merge 1 commit intoeser:mainfrom
salihdev0:fix/opencode-adapter-schema-compliance
Open

fix(opencode): generate valid tools object and MCP command array for OpenCode schema compliance#130
salihdev0 wants to merge 1 commit intoeser:mainfrom
salihdev0:fix/opencode-adapter-schema-compliance

Conversation

@salihdev0
Copy link
Copy Markdown

Fixes issue

Fixes #128, Fixes #129

Changes proposed

Issue #129 — Agent tools field uses invalid string format

OpenCode schema expects tools as object | undefined in agent YAML frontmatter, but noskills init generated a comma-separated string.

Before:

tools: read, write, glob, grep, shell, delegate

After:

tools:
  read: true
  write: true
  glob: true
  grep: true
  shell: true
  delegate: true

Changed in buildExecutorAgentMd() and buildVerifierAgentMd() in opencode.ts.

Issue #128 — MCP config uses invalid command/args structure

OpenCode schema expects command as string[] and requires enabled: boolean, but noskills init generated command as string + args array without enabled.

Before:

{
  "mcp": {
    "noskills": {
      "type": "local",
      "command": "npx",
      "args": ["eser@latest", "noskills", "mcp-serve"]
    }
  }
}

After:

{
  "mcp": {
    "noskills": {
      "type": "local",
      "command": ["npx", "eser@latest", "noskills", "mcp-serve"],
      "enabled": true
    }
  }
}

Changed in OpenCodeMcpEntry type and syncMcp() in opencode.ts.

Tests

Updated 5 existing tests and re-structured 2 validation tests to cover the new schema format. Existing config preservation behavior is unchanged.

Affected files

  • pkg/@eserstack/noskills/sync/adapters/opencode.ts
  • pkg/@eserstack/noskills/sync/adapters/opencode.test.ts

Check List (Check all the applicable boxes)

  • The title of my pull request is a short description of the requested changes.
  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • This PR does not contain plagiarized content.
  • My submissions follows the Submission Rules
  • I have read and accepted the Terms and Conditions

Screenshots

Note to reviewers

  • All existing tests pass (31/31), lint and type check are clean.
  • Existing opencode.json configs with user-added MCP servers are preserved via deep merge — only the noskills entry is overwritten.
  • The change is backward-compatible with the noskills manifest format; no migration needed.
  • Other coding tool adapters (Claude Code, Codex CLI, Kiro, etc.) are not affected.

…OpenCode schema compliance

Fix two validation errors in generated OpenCode configuration:
- Agent frontmatter: change `tools` from comma-separated string to YAML object
  mapping (e.g., `tools: {read: true, write: true}`) per OpenCode schema
- MCP config (`opencode.json`): merge `command` + `args` into a single
  `command` array and add required `enabled: true` field
@salihdev0 salihdev0 requested a review from eser as a code owner May 4, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant