Skip to content

Commit af33a70

Browse files
authored
test: add OpenCode eval suite + register opencode in x-x init (#14)
* test: add OpenCode eval suite + register opencode in x-x init Adds a third agentTarget (opencode -> .opencode/commands) so `x-x init --agents opencode` writes the bundled SKILL.md tree alongside the existing Claude/Codex paths. The Go install code is generic over agentTargets; only constants.go and the e2e/PS1 mirrors needed updates. Adds skills-evals coverage for OpenCode: - opencode_driver.py drives `opencode run --format json --model deepseek/...` one turn per subprocess (`--continue` for follow-ups, per anomalyco/opencode#7345 there is no stdin-multi-turn protocol). The auto-yes loop becomes "spawn a fresh process whose prompt is 'yes'". - compose_skill_prompt inlines a SKILL.md template + task into the prompt because `opencode run` does not currently resolve slash commands (#7345, with feature requests #2330 and #5073 tracking a --command flag / `opencode run "/cmd"` resolver). Sidesteps the resolver gap until those land; still exercises the agent's behavior against the skill prompt. - resolve_skill_template walks .opencode/commands/<name>/SKILL.md at project then user scope, matching the project-then-user rule in the bundled SKILL.md docs. - conftest selects backend by X_X_AGENT_KEY (default claude) and filters collection so a session runs exactly one agent's files. - Four opencode tests mirror the claude scenarios (smoke + todo + extends + supersedes-todo). - Two workflows (manual-opencode-judge.yml + user-scope variant) wire the new env (X_X_AGENT_KEY=opencode, DEEPSEEK_API_KEY direct — no ANTHROPIC_* mirror needed since OpenCode reads the deepseek provider key directly). E2E parity: bash and PowerShell e2e gain OPENCODE_SKILLS_REL mirrors, an opencode-only install case, an all-three install case, and the shared-docs / resolution-anchor invariants now scan the OpenCode root alongside Claude and Codex. constants_e2e_test.go mirrors OPENCODE_SKILLS_REL. Doc updates: docs/public/reference.md lists opencode as a recognized --agents key with the headless-resolution caveat; docs/internal/adding-agent-eval-backend.md documents the per-agent file-naming convention and the X_X_AGENT_KEY filter. Renames test_stream_json_smoke.py -> test_claude_stream_json_smoke.py so every test file matches the test_<agent>_<scenario>.py pattern the conftest filter keys on. Signed-off-by: Tanzim Saqib <[email protected]> * fix(opencode-eval): drop the [1m] suffix from the default model ID `opencode run --model deepseek/deepseek-v4-pro[1m]` fails fast with: Model not found: deepseek/deepseek-v4-pro[1m]. Did you mean: deepseek-v4-pro, deepseek-v4-flash, deepseek-chat? The `[1m]` suffix is an Anthropic-compat-shim convention for picking Claude's 1M-context variant; OpenCode reads provider/model IDs from Models.dev's deepseek registry, which only exposes the plain IDs. Switch the driver's DEFAULT_MODEL to `deepseek/deepseek-v4-pro` and leave a comment naming the failure mode so a future contributor doesn't paste the `[1m]` suffix back in by reflex. Surfaced by the first dispatch of manual-opencode-judge.yml against ref=opencode-evals — every scenario test failed with the model-not-found error before reaching any skill work. Signed-off-by: Tanzim Saqib <[email protected]> * fix(opencode-eval): extract `part` text; force non-interactive planner Two changes on the back of the first green smoke + three red scenarios: 1. Text extraction was returning empty for every text event. OpenCode wraps event payloads in a `part` envelope; the actual string lives at `event["part"]["text"]`, not at `event["text"]` (which is what the driver was checking). Empty extraction made `_asks_for_confirmation("")` always False, so the run would report completed=True regardless of what the planner emitted — the auto-yes loop never had a chance to fire on a real prompt. `_extract_text` now checks the `part` envelope first; the summary for text-typed events falls through to a raw JSON dump when extraction comes back empty so wire-format drift is visible in CI logs instead of being silently swallowed. 2. `deepseek/deepseek-v4-pro` driven through `opencode run` is over-triggering the clarification path in `x-plan/SKILL.md` step 2 (which the skill itself instructs to skip by default). When the planner asks a question there is no operator to answer it; the turn ends without a plan being written. Evidence: the plan_extends transcript wrote plan B at prefix 0001 with `extends:` pointing at a plan A that never existed on disk — plan A's call exited mid- clarification with no file. `compose_skill_prompt` now leads with an explicit non-interactive directive that tells the agent it is in CI, no operator is available, and the "skip by default" path through every clarification branch is mandatory. The SKILL.md itself is followed verbatim otherwise. Smoke test was already green at bf7f766, so the model-id fix stands. Signed-off-by: Tanzim Saqib <[email protected]> * fix(opencode-eval): drive via --command and drop inline-SKILL.md prompt The first opencode eval attempt inlined SKILL.md content into the user message via a `compose_skill_prompt(skill_md_path, task)` helper because `opencode run` was thought not to resolve slash commands. That premise is outdated: anomalyco/opencode#2348 (Sep 2025) added `opencode run --command <name>`, and the resolver walks `.opencode/{command,commands}/**/*.md`, keying off each file's frontmatter `name:` field. The bundled `.opencode/commands/x-plan/SKILL.md` carries `name: x-plan`, so `opencode run --command x-plan "<task>"` already finds it; the inline workaround was redundant. The driver and tests now exercise the same slash-command surface the Claude tests exercise (`/x-plan TASK` → `--command x-plan TASK`). Mechanically: - `drive_command(workspace, command, arguments)` invokes `opencode run --command <command> --format json --model deepseek/... --dangerously-skip-permissions <arguments>` for the first turn, then `opencode run --continue ... "yes"` for each auto-yes reply. The auto-yes loop, JSON event reader, transcript writer, and turn-cap logic carry over from the prior driver unchanged. - `drive_prompt(workspace, prompt)` keeps a no-`--command` entry point for the smoke test (a bare prompt, no skill invocation). - `compose_skill_prompt` and `resolve_skill_template` are gone — the resolver now lives inside opencode itself. - `_extract_text` filters to `type: "text"` events only; `reasoning` events are summarized for log surface but excluded from auto-yes detection so the model's chain-of-thought can't false-trigger on a "yes" mentioned mid-thought. - The smoke test asserts at least one `type: "text"` event landed in the transcript, mirroring the claude smoke's assistant-text shape check. The stale comment in `constants.go` and the matching note in `docs/public/reference.md` are updated to describe the actual resolver behavior (frontmatter `name:` keyed, sst/opencode PR #2348), replacing the prior "automated callers must inline" guidance. Signed-off-by: Tanzim Saqib <[email protected]> * fix(opencode-eval): pin PWD env so opencode resolves the workspace opencode v1.15.11 resolves the worktree root from `Filesystem.resolve(process.env.PWD ?? process.cwd())` (sst/opencode `packages/opencode/src/cli/cmd/run.ts`) — `PWD` takes precedence over the process's actual cwd. `subprocess.Popen(..., cwd=...)` sets the child's cwd but inherits the parent's `PWD` env var unchanged, so opencode spawned from pytest was walking up from `<repo>/skills-evals/` (pytest's working-directory in the workflow) instead of `<tmp>/.../eval-workspace/`. With the wrong root, the project-config walk never visited the workspace's `.opencode/commands/` tree and `ConfigCommand.load` returned no commands. The CI symptom was Command not found: "x-plan". Available commands: init, review, customize-opencode — the three built-in entries (two stock commands plus the `customize-opencode` built-in skill), with zero project commands merged. The smoke test passed because it sends a trivial prompt and doesn't depend on resolved commands. The scenario tests all hit this on turn 1. Fix: pass `env={**os.environ, "PWD": str(workspace)}` alongside `cwd=str(workspace)` so opencode's PWD-first lookup lands on the test workspace. Verified locally that the resolved config now contains `command["x-plan"]`, `command["x-x"]`, and the `_x-x_shared/*` entries. claude_driver isn't affected — `claude` doesn't consult `PWD` for its worktree root. Signed-off-by: Tanzim Saqib <[email protected]> * fix(opencode-eval): append CI directive to args so model clears gates Run 26550686233 surfaced two model-behavior failures even though `--command x-plan` / `--command x-x` resolved correctly: - test_opencode_plan_extends: planner read the empty systems registry, said "I need to propose a new system before I can write the plan", and went idle. Appendix C step 4 of x-plan SKILL.md is explicit: "STOP. Propose a new system to the user. On approval, add to _data_systems.yaml. Then continue." With no operator and a propose-and-wait wording that doesn't match the `reply yes` auto-yes regex, the session stranded. - test_opencode_reminders_supersedes_todo: planner wrote both plans correctly (todo + reminders w/ supersedes link), but the executor read the existing todo `index.html`, said "FYI: I'll review the whole plan with you at once. If you'd rather approve one task at a time, say 'review per task.'", and went idle — same wording-mismatch problem at the review gate. opencode's `permission: question, action: deny` rule (baked into non-interactive sessions by cli/cmd/run.ts) only auto-denies the agent's structured `AskUserQuestion` tool calls; it does not stop the model from emitting text-only checkpoint prompts. The model under deepseek-v4-pro is more cautious through `opencode run --command` than through `claude /x-plan` (slash-command framing differs; Claude tests with the same SKILL.md pass). This appends a CI directive at the END of the prompt opencode sends. opencode places `--command` arguments after the SKILL.md template body when the template has no `$ARGUMENTS` placeholder (see sst/opencode session/prompt.ts) — last-instruction-wins in the model's attention, so the directive overrides hesitancy on each named gate the SKILL.md mentions ('propose to user and wait for approval', 'STOP and ask', 'Reply yes to proceed', 'review per task', 'clarify only when underspecified'). `compose_skill_prompt` from the original iteration of this PR inlined the SKILL.md body INTO the user message with a similar preamble; this is the lighter-weight version of the same idea that keeps opencode's native `--command` resolution intact. Lives in the driver, not the SKILL.md — the SKILL has to stay agent-agnostic (claude works fine without this). Signed-off-by: Tanzim Saqib <[email protected]> * fix(opencode-eval): keep CI directive non-flag; loosen smoke assertion Two regressions surfaced in run 26551557355: 1. test_opencode_todo + test_opencode_reminders_supersedes_todo both died at the `/x-x` step with opencode's `opencode run [message..]` help banner on stderr. `drive_command(workspace, "x-x", "")` calls with empty arguments, so the augmented input collapses to `CI_DIRECTIVE.lstrip()` — which started with `--- OPERATING MODE`. yargs in opencode parses any argv element starting with `--` as a flag (or as the `--` separator). The directive alone was rejected before the message ever reached the prompt. Fix: drop the leading `---` / trailing `---` decoration; the directive now starts with `OPERATING MODE: …` (a word character), so it's a plain message no matter where it lands in argv. 2. test_opencode_smoke failed with `no `type: text` events captured` even though the run had `exit_code=0, completed=True, events_received=1`. opencode emitted a single `step_start` and then DeepSeek dropped the API call with no error — a transient LLM hiccup, not a wire-format regression. The smoke is meant to catch wire-format / version / API-key / install issues, not LLM flakiness, so the assertion now requires `events_received > 0` (any parseable event is enough proof that the stream shape is what the driver expects). Both bugs are byproducts of the previous CI-directive commit; fixing them in a separate commit so the directive's intent and its argv-shape constraint live in distinct, reviewable diffs. Empirical anchor from the failed run: test_opencode_plan_extends PASSED for the first time after the directive landed, confirming that the directive itself works to clear the "propose new system, wait for approval" gate in `x-plan` SKILL.md Appendix C step 4. Signed-off-by: Tanzim Saqib <[email protected]> --------- Signed-off-by: Tanzim Saqib <[email protected]>
1 parent 661306e commit af33a70

13 files changed

Lines changed: 1141 additions & 45 deletions

‎constants.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ var agentTargets = []agentTarget{
120120
// config.toml, etc.) still lives under .codex/ — see Codex docs:
121121
// https://developers.openai.com/codex/hooks for the lookup order.
122122
{"codex", "Codex CLI", ".agents/skills", "codex", ".codex"},
123+
// OpenCode resolves slash commands from `.opencode/{command,commands}/**/*.md`
124+
// at project scope and `~/.config/opencode/commands/` at user scope.
125+
// The lookup keys off the file's frontmatter `name:` (the path-derived
126+
// fallback is used only when frontmatter omits `name:`), so an x-x
127+
// install at `.opencode/commands/x-plan/SKILL.md` with `name: x-plan`
128+
// registers a command callable as both `/x-plan` in the TUI and
129+
// `opencode run --command x-plan ...` from the CLI (sst/opencode
130+
// PR #2348). The bundled tree shape (`<command>/SKILL.md` rather than
131+
// flat `<command>.md`) matches Claude/Codex for parity across agents.
132+
// No per-agent config is bundled for OpenCode yet (auth + provider
133+
// routing live outside the install scope, in `~/.local/share/opencode/`).
134+
{"opencode", "OpenCode", ".opencode/commands", "", ""},
123135
}
124136

125137
// skillsSubdir is the directory inside ~/.x-x/agents/ that holds the

‎constants_e2e_test.go‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ func TestE2EShellConstantsMatchGo(t *testing.T) {
4444
"SKILL_X_X_DIR": skillXXDir,
4545
"SKILL_MANIFEST_FILE": skillManifestFile,
4646

47-
"CLAUDE_SKILLS_REL": agentTargets[0].skillsRel,
48-
"CLAUDE_CONFIG_REL": agentTargets[0].configRel,
49-
"CODEX_SKILLS_REL": agentTargets[1].skillsRel,
50-
"CODEX_CONFIG_REL": agentTargets[1].configRel,
47+
"CLAUDE_SKILLS_REL": agentTargets[0].skillsRel,
48+
"CLAUDE_CONFIG_REL": agentTargets[0].configRel,
49+
"CODEX_SKILLS_REL": agentTargets[1].skillsRel,
50+
"CODEX_CONFIG_REL": agentTargets[1].configRel,
51+
"OPENCODE_SKILLS_REL": agentTargets[2].skillsRel,
52+
// OpenCode has no per-agent config bundled — agentTargets[2].configRel
53+
// is "" and is intentionally not mirrored on the shell side.
5154
}
5255

5356
for name, expected := range want {

‎docs/internal/adding-agent-eval-backend.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ section below maps to something already shipped there.
1717
`manual-claude-judge-user-scope.yml` (user scope). They share the
1818
same pytest scenarios and differ only in the `X_X_INSTALL_SCOPE`
1919
env var.
20-
- Four pytest scenarios under `skills-evals/tests/`:
21-
- `test_stream_json_smoke.py` — format-check on the protocol (runs first)
20+
- Four pytest scenarios under `skills-evals/tests/` per agent. The
21+
filename pattern is `test_<agent>_<scenario>.py`; the conftest's
22+
`pytest_collection_modifyitems` reads `X_X_AGENT_KEY` (default
23+
`claude`) and deselects every file that doesn't match the active
24+
agent, so a session runs exactly one backend's collection without
25+
cross-contamination. Claude's set today:
26+
- `test_claude_stream_json_smoke.py` — shape-check on the wire (runs first)
2227
- `test_claude_plan_extends.py` — bidirectional `extends:` /
2328
`extended_by:` link mechanic, planner only
2429
- `test_claude_reminders_supersedes_todo.py` — full e2e with
2530
supersedes mechanic + artifact verification
2631
- `test_claude_todo.py` — original single-plan baseline
32+
OpenCode ships the same four scenarios under `test_opencode_*.py`.
2733
- Two DeepEval `GEval` judges backed by DeepSeek-flash:
2834
`PlanJudge` (plan-file validity) and `ArtifactJudge` (produced
2935
artifact correctness).

‎docs/public/reference.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ Running `x-x` with no arguments prints the about banner and command list. Use on
2424

2525
Installs every bundled skill into the locations each agent looks for, then seeds the project's `.x-plans/` scaffold. Five questions run in order; when stdin is a terminal with arrow-key select / multiselect and Shift+Tab back-navigation, so you can revise an earlier answer before submitting the final group. When stdin is piped or redirected, the same questions fall back to line-by-line prompts (which the CI test harness exercises).
2626

27-
1. **Which agents?** Multi-select over every registered agent (Claude Code, Codex CLI today). Blank line / no toggle accepts the default (all agents).
27+
1. **Which agents?** Multi-select over every registered agent (Claude Code, Codex CLI, OpenCode today). Blank line / no toggle accepts the default (all agents).
2828
2. **Which scope?** Decides where the bundled SKILLS land. Either way, `.x-plans/` is seeded in the current working directory — that's how the project marker check (`./.x-plans/_config.lock`) recognizes the directory as an x-x project.
29-
- **This project only** — skills under the current working directory (`.claude/skills/`, `.agents/skills/`).
30-
- **All my projects (user scope)** — skills under `$HOME` (`~/.claude/skills/`, `~/.agents/skills/`).
29+
- **This project only** — skills under the current working directory (`.claude/skills/`, `.agents/skills/`, `.opencode/commands/`).
30+
- **All my projects (user scope)** — skills under `$HOME` (`~/.claude/skills/`, `~/.agents/skills/`, `~/.opencode/commands/`).
3131
3. **Prefix width for plan files** — zero-padded width for plan filenames (e.g. width `4` → `0001-foo.md`). Default: `4`.
3232
4. **Maximum lines per plan** — cap enforced by `x-x plans lint`. Keeps AI agents on a short leash: forces them to split sprawling work into smaller, reviewable plans. Default: `30`.
3333
5. **Pause for review after every…** — `task` reviews each EARS criterion as the planner finishes it (tight loop, more interruptions); `plan` reviews only at plan boundaries (looser loop, larger diffs). Default: `task`.
3434

3535
Every prompt has a non-interactive flag twin — pass any subset to skip the matching prompt, or pass all five to drive `init` end-to-end without reading stdin at all (CI / scripted installs):
3636

37-
- `--agents claude,codex` — comma-separated agent keys (repeatable). Skips the agent picker.
37+
- `--agents claude,codex,opencode` — comma-separated agent keys (repeatable). Skips the agent picker. Recognized keys: `claude` (Claude Code), `codex` (Codex CLI), `opencode` (OpenCode). OpenCode resolves slash commands from `.opencode/{command,commands}/**/*.md` (project) and `~/.config/opencode/commands/` (user), keyed off the file's frontmatter `name:`; `x-x init` writes the bundled SKILL.md tree to `.opencode/commands/<skill>/SKILL.md` / `~/.opencode/commands/<skill>/SKILL.md` so each skill registers as both a TUI slash command and an `opencode run --command <skill>` headless invocation (sst/opencode PR #2348).
3838
- `--scope project|user` — skips the scope prompt.
3939
- `--prefix-width N` — positive integer; seeds `prefix_width` in `_config.lock`.
4040
- `--max-plan-lines N` — positive integer; seeds `max_plan_lines` in `_config.lock`.

‎scripts/e2e_test.ps1‎

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ Set-Variable -Option Constant -Name SKILL_MANIFEST_FILE -Value 'SKILL.md'
6464

6565
Set-Variable -Option Constant -Name OWNED_SKILLS -Value @($SKILL_X_PLAN_DIR, $SKILL_X_X_DIR)
6666

67-
# agentTargets in constants.go — index 0 = Claude Code, 1 = Codex CLI.
68-
Set-Variable -Option Constant -Name CLAUDE_SKILLS_REL -Value '.claude\skills'
69-
Set-Variable -Option Constant -Name CLAUDE_CONFIG_REL -Value '.claude'
70-
Set-Variable -Option Constant -Name CODEX_SKILLS_REL -Value '.agents\skills'
71-
Set-Variable -Option Constant -Name CODEX_CONFIG_REL -Value '.codex'
67+
# agentTargets in constants.go — index 0 = Claude Code, 1 = Codex CLI,
68+
# 2 = OpenCode. OpenCode ships no per-agent config today (configRel is "")
69+
# so there is no OPENCODE_CONFIG_REL mirror.
70+
Set-Variable -Option Constant -Name CLAUDE_SKILLS_REL -Value '.claude\skills'
71+
Set-Variable -Option Constant -Name CLAUDE_CONFIG_REL -Value '.claude'
72+
Set-Variable -Option Constant -Name CODEX_SKILLS_REL -Value '.agents\skills'
73+
Set-Variable -Option Constant -Name CODEX_CONFIG_REL -Value '.codex'
74+
Set-Variable -Option Constant -Name OPENCODE_SKILLS_REL -Value '.opencode\commands'
7275

7376
# Bundled config filenames (not constants in Go; pinned here for assertions).
7477
Set-Variable -Option Constant -Name CLAUDE_SETTINGS_FILE -Value 'settings.json'
@@ -991,6 +994,19 @@ try {
991994
Assert-IsDir 'codex skills tree' (Join-Path $projInitBoth (Join-Path $CODEX_SKILLS_REL $SKILL_X_X_DIR))
992995
} finally { Pop-Location }
993996

997+
Start-Case 'init --agents claude,codex,opencode installs all three skill trees'
998+
Reset-UserHome
999+
$projInitAll = New-FreshProject
1000+
Push-Location $projInitAll
1001+
try {
1002+
Invoke-XX init --scope project --agents 'claude,codex,opencode' `
1003+
--prefix-width 4 --max-plan-lines 30 --review-per task
1004+
Assert-Eq 'exit 0' $RunRC 0
1005+
Assert-IsDir 'claude skills tree' (Join-Path $projInitAll (Join-Path $CLAUDE_SKILLS_REL $SKILL_X_X_DIR))
1006+
Assert-IsDir 'codex skills tree' (Join-Path $projInitAll (Join-Path $CODEX_SKILLS_REL $SKILL_X_X_DIR))
1007+
Assert-IsDir 'opencode skills tree' (Join-Path $projInitAll (Join-Path $OPENCODE_SKILLS_REL $SKILL_X_X_DIR))
1008+
} finally { Pop-Location }
1009+
9941010
Start-Case 'init refuses re-run on an already-initialized project'
9951011
Reset-UserHome
9961012
$projInitRe = New-FreshProject
@@ -2345,6 +2361,19 @@ try {
23452361
Assert-NotExists 'claude skills NOT present' (Join-Path $projF2 (Join-Path $CLAUDE_SKILLS_REL $SKILL_X_X_DIR))
23462362
} finally { Pop-Location }
23472363

2364+
Start-Case 'init --agents=opencode single-agent install'
2365+
Reset-UserHome
2366+
$projF2o = New-FreshProject
2367+
Push-Location $projF2o
2368+
try {
2369+
Invoke-XX init --scope project --agents=opencode `
2370+
--prefix-width 4 --max-plan-lines 30 --review-per task
2371+
Assert-Eq 'exit 0' $RunRC 0
2372+
Assert-IsDir 'opencode skills present' (Join-Path $projF2o (Join-Path $OPENCODE_SKILLS_REL $SKILL_X_X_DIR))
2373+
Assert-NotExists 'claude skills NOT present' (Join-Path $projF2o (Join-Path $CLAUDE_SKILLS_REL $SKILL_X_X_DIR))
2374+
Assert-NotExists 'codex skills NOT present' (Join-Path $projF2o (Join-Path $CODEX_SKILLS_REL $SKILL_X_X_DIR))
2375+
} finally { Pop-Location }
2376+
23482377
Start-Case 'init --prefix-width=6 seeds the lock with 6'
23492378
Reset-UserHome
23502379
$projF3 = New-FreshProject

‎scripts/e2e_test.sh‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ readonly CLAUDE_SKILLS_REL=".claude/skills" # agentTargets[0].skillsRel
4848
readonly CLAUDE_CONFIG_REL=".claude" # agentTargets[0].configRel
4949
readonly CODEX_SKILLS_REL=".agents/skills" # agentTargets[1].skillsRel
5050
readonly CODEX_CONFIG_REL=".codex" # agentTargets[1].configRel
51+
readonly OPENCODE_SKILLS_REL=".opencode/commands" # agentTargets[2].skillsRel
52+
# OpenCode currently ships no per-agent config (configSrc / configRel are
53+
# empty), so no OPENCODE_CONFIG_REL mirror is needed.
5154
# Parent of CODEX_SKILLS_REL — used by isolation cases that seed sibling
5255
# files alongside the Codex skills dir. Derived (not a Go constant) to
5356
# avoid drift if agentTargets[1].skillsRel ever moves.
5457
readonly CODEX_SKILLS_PARENT="${CODEX_SKILLS_REL%/*}"
58+
# Parent of OPENCODE_SKILLS_REL — used by reset_user_home to wipe the
59+
# whole .opencode/ tree between cases. Derived for the same drift reason.
60+
readonly OPENCODE_SKILLS_PARENT="${OPENCODE_SKILLS_REL%/*}"
5561

5662
# Bundle-provided config filenames (agents/<configSrc>/* in the embed). Not
5763
# named in constants.go (the embed tree is the source) but pinned here
@@ -165,6 +171,7 @@ reset_user_home() {
165171
rm -rf "$HOME/${CLAUDE_CONFIG_REL}" \
166172
"$HOME/${CODEX_CONFIG_REL}" \
167173
"$HOME/${CODEX_SKILLS_PARENT}" \
174+
"$HOME/${OPENCODE_SKILLS_PARENT}" \
168175
"$HOME/${XX_HOME_DIR}"
169176
}
170177

@@ -580,6 +587,26 @@ assert_eq "exit 0" "$RUN_RC" "0"
580587
assert_is_dir "claude installed" "$PROJ_AB/${CLAUDE_SKILLS_REL}/${SKILL_X_X_DIR}"
581588
assert_is_dir "codex installed" "$PROJ_AB/${CODEX_SKILLS_REL}/${SKILL_X_X_DIR}"
582589

590+
case_start "x-x init --agents=opencode installs only OpenCode"
591+
reset_user_home
592+
PROJ_AO="$(fresh_project)"
593+
cd "$PROJ_AO"
594+
run_capture "" init --agents=opencode --scope=project
595+
assert_eq "exit 0" "$RUN_RC" "0"
596+
assert_is_dir "opencode installed" "$PROJ_AO/${OPENCODE_SKILLS_REL}/${SKILL_X_X_DIR}"
597+
assert_absent "claude NOT installed" "$PROJ_AO/${CLAUDE_SKILLS_REL}"
598+
assert_absent "codex NOT installed" "$PROJ_AO/${CODEX_SKILLS_REL}"
599+
600+
case_start "x-x init --agents=claude,codex,opencode (all three)"
601+
reset_user_home
602+
PROJ_AT="$(fresh_project)"
603+
cd "$PROJ_AT"
604+
run_capture "" init --agents=claude,codex,opencode --scope=project
605+
assert_eq "exit 0" "$RUN_RC" "0"
606+
assert_is_dir "claude installed" "$PROJ_AT/${CLAUDE_SKILLS_REL}/${SKILL_X_X_DIR}"
607+
assert_is_dir "codex installed" "$PROJ_AT/${CODEX_SKILLS_REL}/${SKILL_X_X_DIR}"
608+
assert_is_dir "opencode installed" "$PROJ_AT/${OPENCODE_SKILLS_REL}/${SKILL_X_X_DIR}"
609+
583610
case_start "x-x init --agents=invalid rejects unknown agent"
584611
reset_user_home
585612
cd "$(fresh_project)"
@@ -1203,7 +1230,7 @@ reset_user_home
12031230
# Trigger the lazy first-run write of ~/${XX_HOME_DIR}/agents/ via bare
12041231
# x-x, then wipe the install dirs so skill remove has nothing to do.
12051232
run_capture "" >/dev/null
1206-
rm -rf "$HOME/${CLAUDE_CONFIG_REL}" "$HOME/${CODEX_SKILLS_PARENT}" "$HOME/${CODEX_CONFIG_REL}"
1233+
rm -rf "$HOME/${CLAUDE_CONFIG_REL}" "$HOME/${CODEX_SKILLS_PARENT}" "$HOME/${CODEX_CONFIG_REL}" "$HOME/${OPENCODE_SKILLS_PARENT}"
12071234
run_capture "" skills remove --user
12081235
assert_eq "exit 0 on empty state" "$RUN_RC" "0"
12091236
assert_contains "summary line" "$RUN_OUT" "Removed 0"

0 commit comments

Comments
 (0)