[PR #72] [MERGED] fix: opencode adapter emitted JSON instead of OpenCode's real Markdown format #73

Closed
opened 2026-08-12 19:09:22 +02:00 by zaph0d · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/niels-emmer/myace/pull/72
Author: @niels-emmer
Created: 8/12/2026
Status: Merged
Merged: 8/12/2026
Merged by: @niels-emmer

Base: mainHead: fix/opencode-adapter-markdown-format


📝 Commits (1)

  • dc0d3c0 fix: opencode adapter emitted JSON instead of OpenCode's real Markdown format

📊 Changes

7 files changed (+409 additions, -86 deletions)

View changed files

📝 README.md (+3 -2)
📝 backend/app/adapters/opencode.py (+105 -57)
📝 backend/app/services/scanner.py (+8 -3)
📝 backend/tests/test_adapters.py (+123 -8)
📝 cli/myace_cli/adapters/opencode.py (+72 -13)
📝 cli/myace_cli/scanner.py (+8 -3)
cli/tests/test_opencode_adapter.py (+90 -0)

📄 Description

Summary

User-reported: compiling a profile to the opencode target only produced JSON files (.opencode/skills/*.json, .opencode/agents/*.json), but real OpenCode installations use Markdown for everything except opencode.json. Verified directly against https://opencode.ai/docs (agents/skills/commands/config/rules pages) before touching any code.

Real OpenCode format, confirmed:

Artifact Path Frontmatter
skill .opencode/skills/<name>/SKILL.md name, description (+ optional license, compatibility, metadata)
agent .opencode/agents/<name>.md description (+ optional mode, model, temperature, permission)
command .opencode/commands/<name>.md description (+ optional agent, model, subtask)
rule AGENTS.md (root) none
model_config opencode.json (root, one merged file) N/A — JSON

Fixed both copies (backend/app/adapters/opencode.py and its CLI mirror cli/myace_cli/adapters/opencode.py, kept in sync per repo convention) to emit exactly this shape instead of JSON everywhere. Notable design choice: skill frontmatter only uses OpenCode's actually-recognized fields at the top level (name/description/compatibility) — version/priority/tags (MyACE's own canonical bookkeeping, not part of OpenCode's schema) go under the explicitly free-form metadata field instead of being invented as top-level keys that a stricter parser might reject.

Bonus fix: also updated scanner.py's _parse_skill_file (backend + CLI) to read that metadata fallback, so a profile compiled to OpenCode now round-trips cleanly back through the scanner — verified with a new test that compiles a skill and re-scans the output, confirming version/priority/tags survive the round trip.

Also fixed two README mentions of the old (wrong) format description.

Test plan

  • Rewrote TestOpenCodeAdapter in backend/tests/test_adapters.py — skill/agent/command markdown+frontmatter shape, model_config merging into one opencode.json, and a scanner round-trip test.
  • Added cli/tests/test_opencode_adapter.py (previously zero coverage on the CLI-side adapter) mirroring the same cases.
  • Manually verified output byte-for-byte against the docs' own example files (skill and agent frontmatter match the doc examples' field sets exactly).
  • ruff check clean on all changed files.
  • Full backend suite: 159 passed (excludes 3 files with pre-existing, unrelated Postgres-connection contention documented in prior PRs).
  • Full CLI suite: 20 passed (15 existing + 5 new).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/niels-emmer/myace/pull/72 **Author:** [@niels-emmer](https://github.com/niels-emmer) **Created:** 8/12/2026 **Status:** ✅ Merged **Merged:** 8/12/2026 **Merged by:** [@niels-emmer](https://github.com/niels-emmer) **Base:** `main` ← **Head:** `fix/opencode-adapter-markdown-format` --- ### 📝 Commits (1) - [`dc0d3c0`](https://github.com/niels-emmer/myace/commit/dc0d3c048b43506ff39a22124ea7d2a51e1bfa9a) fix: opencode adapter emitted JSON instead of OpenCode's real Markdown format ### 📊 Changes **7 files changed** (+409 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -2) 📝 `backend/app/adapters/opencode.py` (+105 -57) 📝 `backend/app/services/scanner.py` (+8 -3) 📝 `backend/tests/test_adapters.py` (+123 -8) 📝 `cli/myace_cli/adapters/opencode.py` (+72 -13) 📝 `cli/myace_cli/scanner.py` (+8 -3) ➕ `cli/tests/test_opencode_adapter.py` (+90 -0) </details> ### 📄 Description ## Summary User-reported: compiling a profile to the `opencode` target only produced JSON files (`.opencode/skills/*.json`, `.opencode/agents/*.json`), but real OpenCode installations use Markdown for everything except `opencode.json`. Verified directly against https://opencode.ai/docs (agents/skills/commands/config/rules pages) before touching any code. **Real OpenCode format, confirmed:** | Artifact | Path | Frontmatter | |---|---|---| | skill | `.opencode/skills/<name>/SKILL.md` | `name`, `description` (+ optional `license`, `compatibility`, `metadata`) | | agent | `.opencode/agents/<name>.md` | `description` (+ optional `mode`, `model`, `temperature`, `permission`) | | command | `.opencode/commands/<name>.md` | `description` (+ optional `agent`, `model`, `subtask`) | | rule | `AGENTS.md` (root) | none | | model_config | `opencode.json` (root, **one merged file**) | N/A — JSON | **Fixed both copies** (`backend/app/adapters/opencode.py` and its CLI mirror `cli/myace_cli/adapters/opencode.py`, kept in sync per repo convention) to emit exactly this shape instead of JSON everywhere. Notable design choice: skill frontmatter only uses OpenCode's actually-recognized fields at the top level (`name`/`description`/`compatibility`) — `version`/`priority`/`tags` (MyACE's own canonical bookkeeping, not part of OpenCode's schema) go under the explicitly free-form `metadata` field instead of being invented as top-level keys that a stricter parser might reject. **Bonus fix**: also updated `scanner.py`'s `_parse_skill_file` (backend + CLI) to read that `metadata` fallback, so a profile compiled to OpenCode now round-trips cleanly back through the scanner — verified with a new test that compiles a skill and re-scans the output, confirming version/priority/tags survive the round trip. Also fixed two README mentions of the old (wrong) format description. ## Test plan - [x] Rewrote `TestOpenCodeAdapter` in `backend/tests/test_adapters.py` — skill/agent/command markdown+frontmatter shape, model_config merging into one `opencode.json`, and a scanner round-trip test. - [x] Added `cli/tests/test_opencode_adapter.py` (previously zero coverage on the CLI-side adapter) mirroring the same cases. - [x] Manually verified output byte-for-byte against the docs' own example files (skill and agent frontmatter match the doc examples' field sets exactly). - [x] `ruff check` clean on all changed files. - [x] Full backend suite: 159 passed (excludes 3 files with pre-existing, unrelated Postgres-connection contention documented in prior PRs). - [x] Full CLI suite: 20 passed (15 existing + 5 new). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zaph0d 2026-08-12 19:09:22 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
github-mirrors/myace#73
No description provided.