[Feature request] Support importing agents and commands from `opencode.json`
Opencode allow defining commands and agents both in markdown files (.opencode/agents/<agent>.md, .opencode/commands/<command>.md) and in opencode.json.
https://opencode.ai/docs/agents/#json https://opencode.ai/docs/commands/#json
Currently, rulesync will not import these configurations from opencode.json
Feature request
Read opencode.json for agent and command configurations and import them.
@r1bilski Thank you. This bothers me a little. I don't think many people will suffer from this. However, well, I think it can be supported.
The projects I work in often have most things in the opencode.jsonc file directly, just because that makes it easier to share / copy.
@r1bilski I am positive to your suggestion.
Confirmed this is still a real gap (June 2026): rulesync imports OpenCode agents/commands only from Markdown files — OpenCodeCommand.fromFile reads .opencode/command/*.md and OpenCodeSubagent.fromFile reads .opencode/agent/*.md. The JSON-embedded forms documented at https://opencode.ai/docs/commands/#json (top-level command key) and https://opencode.ai/docs/agents/#json (top-level agent key) are not imported. Only MCP, permissions, and rules instructions currently read opencode.json/opencode.jsonc.
Implementation outline for whoever picks this up:
- Read
opencode.jsoncthenopencode.json(mirroringOpencodeMcp.fromInstructionsinsrc/features/mcp/opencode-mcp.ts), and synthesize aRulesyncCommand/RulesyncSubagentper entry under thecommand/agentkeys. - Field mapping: command
template→ rulesync body;description/agent/model/subtask→ frontmatter (already inOpenCodeCommandFrontmatterSchema). Agent JSON fields (mode/model/prompt/permission/...) already align withOpenCodeSubagentFrontmatterSchema. - Open design point worth deciding before implementation: the generic commands/subagents
loadToolFilesdiscovers one file → one entry by globbing a directory (src/features/commands/commands-processor.ts), so importing many entries embedded in a singleopencode.jsonneeds a discovery hook (or an opencode-specific load path). Also decide how to handle aprompt: { file: ... }reference (inline vs. keep).
Leaving open for a maintainer call on the discovery-hook approach, since it touches the shared import flow rather than being a self-contained adapter.