opencode-onboard 0.4.5 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +58 -19
  2. package/content/.agents/agents/basic-engineer.md +5 -5
  3. package/content/.agents/agents/devops-manager.md +14 -10
  4. package/content/.agents/skills/ob-global/SKILL.md +9 -7
  5. package/content/.opencode/commands/ob-create-architecture.md +76 -0
  6. package/content/.opencode/commands/ob-create-design.md +53 -0
  7. package/content/.opencode/commands/{create-engineer.md → ob-create-engineer.md} +9 -8
  8. package/content/.opencode/commands/ob-init.md +8 -0
  9. package/content/.opencode/commands/{main.md → ob-main.md} +2 -2
  10. package/content/.opencode/commands/{plan.md → ob-plan.md} +2 -2
  11. package/content/.opencode/commands/opsx-apply.md +212 -193
  12. package/content/.opencode/skills/openspec-apply-change/SKILL.md +234 -176
  13. package/content/AGENTS.md +152 -49
  14. package/content/ARCHITECTURE.md +16 -327
  15. package/content/DESIGN.md +16 -26
  16. package/package.json +1 -1
  17. package/src/commands/join.js +6 -1
  18. package/src/commands/single.js +1 -1
  19. package/src/presets/models.json +2 -2
  20. package/src/presets/platforms.json +4 -0
  21. package/src/steps/copy/agents.js +200 -3
  22. package/src/steps/copy/agents.test.js +45 -0
  23. package/src/steps/copy/copy.test.js +15 -2
  24. package/src/steps/copy/index.js +2 -1
  25. package/src/steps/copy/skills.js +16 -0
  26. package/src/steps/metadata/index.js +6 -5
  27. package/src/steps/metadata/metadata.test.js +16 -8
  28. package/src/steps/models/write.js +17 -4
  29. package/src/steps/models/write.test.js +57 -56
  30. package/src/steps/openspec/ensemble.js +81 -54
  31. package/src/steps/openspec/ensemble.test.js +40 -8
  32. package/src/steps/optimization/caveman.js +2 -2
  33. package/src/steps/optimization/global.js +21 -1
  34. package/src/steps/optimization/global.test.js +3 -0
  35. package/src/steps/platform/index.js +8 -1
  36. package/src/steps/platform/platform.test.js +19 -0
  37. package/content/.opencode/commands/init.md +0 -8
@@ -59,59 +59,60 @@ custom_field: custom_value
59
59
  })
60
60
  })
61
61
 
62
- describe('writeModelsToConfigs()', () => {
63
- let tmpDir, agentsDir, opencodeJsonPath, originalCwd
64
-
65
- beforeEach(() => {
66
- vi.clearAllMocks()
67
- originalCwd = process.cwd()
68
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'models-config-test-'))
69
- agentsDir = path.join(tmpDir, '.agents', 'agents')
70
- fs.mkdirSync(agentsDir, { recursive: true })
71
- opencodeJsonPath = path.join(tmpDir, '.opencode', 'opencode.json')
72
- path.join(tmpDir, '.opencode', 'ensemble.json')
73
- fs.mkdirSync(path.dirname(opencodeJsonPath), { recursive: true })
74
- process.chdir(tmpDir)
75
- })
76
-
77
- afterEach(() => {
78
- process.chdir(originalCwd)
79
- fs.rmSync(tmpDir, { recursive: true, force: true })
80
- })
81
-
82
- it('writes build model to agent files', async () => {
83
- fs.writeFileSync(path.join(agentsDir, 'back-engineer.md'), '---\nname: Back\n---', 'utf-8')
84
- fs.writeFileSync(path.join(agentsDir, 'front-engineer.md'), '---\nname: Front\n---', 'utf-8')
85
-
86
- await writeModelsToConfigs({
87
- planModel: 'plan-model',
88
- buildModel: 'build-model',
89
- fastModel: 'fast-model',
90
- agentsDir,
91
- preset: {
92
- roles: {
93
- build: { agents: ['back-engineer'] },
94
- fast: { agents: ['front-engineer'] },
95
- },
96
- },
97
- })
98
-
99
- expect(success).toHaveBeenCalledWith('back-engineer → build-model')
100
- expect(success).toHaveBeenCalledWith('front-engineer → fast-model')
101
- })
102
-
103
- it('reports success when writing configs', async () => {
104
- const agentFile = path.join(agentsDir, 'back-engineer.md')
105
- fs.writeFileSync(agentFile, '---\nname: Back\n---', 'utf-8')
106
-
107
- await writeModelsToConfigs({
108
- planModel: 'plan-model',
109
- buildModel: 'build-model',
110
- fastModel: 'fast-model',
111
- agentsDir,
112
- preset: { roles: { build: { agents: ['back-engineer'] }, fast: { agents: [] } } },
113
- })
114
-
115
- expect(success).toHaveBeenCalled()
116
- })
117
- })
62
+ describe('writeModelsToConfigs()', () => {
63
+ let tmpDir, agentsDir, opencodeJsonPath
64
+
65
+ beforeEach(() => {
66
+ vi.clearAllMocks()
67
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'models-config-test-'))
68
+ agentsDir = path.join(tmpDir, '.agents', 'agents')
69
+ fs.mkdirSync(agentsDir, { recursive: true })
70
+ opencodeJsonPath = path.join(tmpDir, '.opencode', 'opencode.json')
71
+ path.join(tmpDir, '.opencode', 'ensemble.json')
72
+ fs.mkdirSync(path.dirname(opencodeJsonPath), { recursive: true })
73
+ })
74
+
75
+ afterEach(() => {
76
+ fs.rmSync(tmpDir, { recursive: true, force: true })
77
+ })
78
+
79
+ it('writes build model to agent files', async () => {
80
+ fs.writeFileSync(path.join(agentsDir, 'basic-engineer.md'), '---\nname: Basic\n---', 'utf-8')
81
+ fs.writeFileSync(path.join(agentsDir, 'frontend-engineer.md'), '---\nname: Front\n---', 'utf-8')
82
+ fs.writeFileSync(path.join(agentsDir, 'devops-manager.md'), '---\nname: Devops\n---', 'utf-8')
83
+
84
+ await writeModelsToConfigs({
85
+ planModel: 'plan-model',
86
+ buildModel: 'build-model',
87
+ fastModel: 'fast-model',
88
+ agentsDir,
89
+ cwd: tmpDir,
90
+ preset: {
91
+ roles: {
92
+ build: { agents: ['basic-engineer'] },
93
+ fast: { agents: ['devops-manager'] },
94
+ },
95
+ },
96
+ })
97
+
98
+ expect(success).toHaveBeenCalledWith('basic-engineer → build-model')
99
+ expect(success).toHaveBeenCalledWith('frontend-engineer → build-model')
100
+ expect(success).toHaveBeenCalledWith('devops-manager → fast-model')
101
+ })
102
+
103
+ it('reports success when writing configs', async () => {
104
+ const agentFile = path.join(agentsDir, 'basic-engineer.md')
105
+ fs.writeFileSync(agentFile, '---\nname: Basic\n---', 'utf-8')
106
+
107
+ await writeModelsToConfigs({
108
+ planModel: 'plan-model',
109
+ buildModel: 'build-model',
110
+ fastModel: 'fast-model',
111
+ agentsDir,
112
+ cwd: tmpDir,
113
+ preset: { roles: { build: { agents: ['basic-engineer'] }, fast: { agents: [] } } },
114
+ })
115
+
116
+ expect(success).toHaveBeenCalled()
117
+ })
118
+ })
@@ -21,22 +21,27 @@ export const ENSEMBLE_SECTION = `6. **Implement via ensemble team**
21
21
  \`\`\`
22
22
  Announce: "Team running. Monitor at http://localhost:4747/"
23
23
 
24
- **Step 6c.** Add ALL tasks to the shared board BEFORE spawning anyone.
24
+ **Step 6c.** Add ALL tasks to the shared board BEFORE spawning anyone, using as many \`team_tasks_add\` calls as needed to wire dependencies correctly.
25
25
  Schema: { content: string, priority: "high"|"medium"|"low", depends_on?: string[] }
26
- Use depends_on to block tasks that require other tasks first, pass the IDs returned by team_tasks_add.
26
+ You cannot reference returned task IDs until an earlier \`team_tasks_add\` call finishes, so add tasks in dependency order.
27
27
  \`\`\`
28
28
  team_tasks_add tasks:[
29
29
  { content: "1.1 <exact task text from tasks.md>", priority: "high" },
30
- { content: "1.2 <exact task text>", priority: "high" },
31
- { content: "3.1 <task that needs 1.x done first>", priority: "medium", depends_on: ["<id-of-1.1>"] },
32
- ...every task, one entry each...
30
+ { content: "1.2 <exact task text>", priority: "high" }
33
31
  ]
34
32
  \`\`\`
35
- Save the task IDs returned. Pass them to agents in step 6d.
33
+ Save the returned IDs for root tasks.
34
+ \`\`\`
35
+ team_tasks_add tasks:[
36
+ { content: "2.1 <task that depends on 1.1>", priority: "high", depends_on: ["<real-id-of-1.1>"] },
37
+ { content: "3.1 <task that depends on 1.2>", priority: "medium", depends_on: ["<real-id-of-1.2>"] }
38
+ ]
39
+ \`\`\`
40
+ Repeat until every OpenSpec task is on the board, then pass the literal IDs returned by those calls to agents in step 6d.
36
41
  DO NOT call team_claim yourself, only agents claim tasks.
37
42
  DO NOT proceed to 6d until team_tasks_add succeeds.
38
43
 
39
- **Step 6d.** Discover relevant skills, then spawn specialists with an INITIAL BATCH of tasks.
44
+ **Step 6d.** Discover available engineers, then spawn specialists with an INITIAL BATCH of tasks.
40
45
 
41
46
  **ROLLING BATCH MODEL:**
42
47
  Agents do NOT receive all their tasks upfront. Instead:
@@ -45,44 +50,60 @@ export const ENSEMBLE_SECTION = `6. **Implement via ensemble team**
45
50
  - Repeat until no pending tasks remain on the board.
46
51
  - Only shut down an agent when the board has no more tasks for its domain.
47
52
 
48
- Before spawning, scan \`.agents/skills/\` and read each \`SKILL.md\` description line.
49
- Match skills to agents by domain:
50
- - front-engineer: UI, components, framework skills (e.g. next-best-practices, browser-automation)
51
- - back-engineer: API, data, service skills
52
- - infra-engineer: cloud, pipeline, deployment skills
53
- - quality-engineer: testing, coverage skills
54
-
55
- Each team_spawn MUST include the agent field (required, causes NOT NULL error if omitted).
56
-
57
- The spawn prompt must contain exactly:
58
- 1. Their name and role on this team
59
- 2. Their initial batch of tasks (up to 3): include the LITERAL task IDs (e.g. "task-abc123") AND the task content. Copy them verbatim from the IDs returned by team_tasks_add. Do NOT paraphrase or omit IDs.
60
- 3. Key context they need (summarized from context files, do NOT tell them to read files themselves)
61
- 4. The 6 OpenCode tools they have available (these are OpenCode tools, NOT shell commands, call them directly as tools, never via bash):
62
- team_claim, team_tasks_complete, team_tasks_list, team_tasks_add, team_message, team_broadcast
63
- 5. How to proceed: for EACH task ID listed, call team_claim tool with that exact task_id before starting it, call team_tasks_complete tool with that task_id after finishing it, then move to the next task. When all listed tasks are done, message lead with results. Lead may assign more tasks, do NOT shut down until lead confirms no more tasks.
64
- 6. Which skills to load: list the skill names and paths they MUST read before implementing. Example: "Before starting, read \`.agents/skills/next-best-practices/SKILL.md\` and follow its rules for all Next.js code."
65
-
66
- Keep spawn prompts under 600 tokens. Do not describe team internals or how ensemble works.
53
+ Before spawning:
54
+ - scan \`.agents/agents/\` and list the engineers that actually exist in this project
55
+ - exclude \`devops-manager\` from implementation selection
56
+ - read each engineer's description and abilities
57
+ - prefer the most specialized custom engineer whose description and abilities match the task
58
+ - use \`basic-engineer\` only when no custom engineer is a clear fit or as a recovery fallback
59
+ - never spawn an engineer name that is not present in \`.agents/agents/\`
60
+
61
+ Each \`team_spawn\` MUST include the agent field (required, causes NOT NULL error if omitted).
62
+
63
+ The spawn prompt must be short and operational. It must contain:
64
+ 1. Their name and engineer file on this team
65
+ 2. Their initial batch of tasks (up to 3): include the LITERAL task IDs AND the task content. Copy them verbatim from the IDs returned by \`team_tasks_add\`. Do NOT paraphrase or omit IDs.
66
+ 3. Key context they need, summarized from context files
67
+ 4. Exact verification commands or acceptance checks
68
+ 5. Only the mandatory skill names or repo-specific rules they still need after claim
69
+
70
+ Keep spawn prompts short and concrete. Prefer 120-220 tokens. Do NOT paste a generic tool list or long workflow boilerplate the plugin and agent file already provide.
71
+ ALWAYS set \`claim_task\` to the first unblocked task in that agent's initial batch.
67
72
  Only spawn agents whose tasks are actually needed by this change. Skip agents with no tasks.
68
73
 
69
- First spawn all agents (wait for each team_spawn to confirm before the next):
74
+ Prompt shape:
70
75
  \`\`\`
71
- team_spawn name:"back" agent:"back-engineer" prompt:"..."
72
- (wait for result)
73
- team_spawn name:"front" agent:"front-engineer" prompt:"..."
76
+ You are <worker-name>, <engineer-file>.
77
+ Claim this task immediately as your first action:
78
+ - [task-<id1>] <task text>
79
+ <optional more tasks in the batch>
80
+
81
+ Key context:
82
+ - <short bullets>
83
+
84
+ After claiming:
85
+ 1. Load @ob-global
86
+ 2. Load only the relevant abilities/skills for this task
87
+ 3. Implement the task
88
+ 4. Call team_tasks_complete for the same task ID
89
+ 5. Send a short team_message with files changed and checks run
90
+ \`\`\`
91
+
92
+ Spawn sequentially, waiting for each result:
93
+ \`\`\`
94
+ team_spawn name:"ui1" agent:"frontend-engineer" prompt:"..."
74
95
  (wait for result)
75
- team_spawn name:"infra" agent:"infra-engineer" prompt:"..."
96
+ team_spawn name:"api1" agent:"backend-engineer" prompt:"..."
76
97
  (wait for result)
77
98
  \`\`\`
99
+ Replace example agent names with REAL engineers that exist in this project.
78
100
 
79
- Then immediately send each spawned agent a start message that repeats their task IDs:
101
+ Then send each spawned agent a short start message that repeats their exact task IDs if needed:
80
102
  \`\`\`
81
- team_message to:"back" text:"Start now. Load skills first. Your tasks: [task-<id1>] <task1 text>, [task-<id2>] <task2 text>. Call team_claim task_id:<id> for each before starting it."
82
- team_message to:"front" text:"Start now. Load skills first. Your tasks: [task-<id3>] <task3 text>. Call team_claim task_id:<id> before starting it."
83
- team_message to:"infra" text:"Start now. Load skills first. Your tasks: [task-<id4>] <task4 text>. Call team_claim task_id:<id> before starting it."
103
+ team_message to:"ui1" text:"Claim now: [task-<id1>] <task text>."
84
104
  \`\`\`
85
- Replace placeholders with REAL task IDs and content. Never send a generic "claim your first task" message without the actual IDs.
105
+ Never send a generic "claim your first task" message without the actual IDs.
106
+ If \`claim_task\` already covers the first task, keep the start message minimal. Use follow-up messages mainly for additional tasks in the batch or recovery.
86
107
 
87
108
  **Step 6e.** After sending start messages, tell the user what is running, then STOP and wait.
88
109
  Do NOT call team_results, team_status, or team_broadcast in a loop.
@@ -96,26 +117,31 @@ export const ENSEMBLE_SECTION = `6. **Implement via ensemble team**
96
117
  **Step 6f.** When a teammate messages back (rolling re-assignment loop):
97
118
  1. Call \`team_results from:"<name>"\` to read full message.
98
119
  2. Call \`team_tasks_list\` to check remaining pending/unassigned tasks on the board.
99
- 3. **If there are more unassigned tasks matching this agent's domain:**
100
- - Pick up to 3 unassigned, unblocked tasks for this agent's domain.
101
- - Send them via \`team_message to:"<name>" text:"Next tasks: [task-<id1>] <desc>, [task-<id2>] <desc>. Claim each with team_claim before starting."\`
102
- - Do NOT shut down the agent. Go back to waiting (step 6e).
103
- 4. **If no more tasks for this agent:**
104
- - \`team_shutdown member:"<name>"\`
105
- - \`team_merge member:"<name>"\`
106
- - If team_merge blocks on local changes: \`git stash\`, retry merge, \`git stash pop\`.
107
- 5. **If ALL agents are shut down and tasks remain unassigned** (new domain, dependencies unblocked):
108
- - Spawn new agents for the remaining tasks (back to step 6d).
109
- 6. **If ALL tasks are done:** proceed to step 7.
120
+ 3. If the teammate is idle and has not claimed any assigned task:
121
+ - resend one short claim-only message with the same literal task IDs
122
+ - if they still do not claim, \`team_shutdown member:"<name>" force:true\`
123
+ - respawn once with a shorter prompt and the same first \`claim_task\`
124
+ - if the second spawn also stays idle, stop forcing ensemble for this change and continue in the main session or ask the user whether to retry later
125
+ 4. **If there are more unassigned tasks matching this agent's domain:**
126
+ - Pick up to 3 unassigned, unblocked tasks for this agent's domain.
127
+ - Send them via \`team_message to:"<name>" text:"Claim next: [task-<id1>] <desc>, [task-<id2>] <desc>."\`
128
+ - Do NOT shut down the agent. Go back to waiting (step 6e).
129
+ 5. **If no more tasks for this agent:**
130
+ - \`team_shutdown member:"<name>"\`
131
+ - \`team_merge member:"<name>"\`
132
+ - If team_merge blocks on local changes: \`git stash\`, retry merge, \`git stash pop\`.
133
+ 6. **If ALL agents are shut down and tasks remain unassigned** (new domain, dependencies unblocked):
134
+ - Discover the remaining matching engineers from \`.agents/agents/\` and spawn a new wave (back to step 6d).
135
+ 7. **If ALL tasks are done:** proceed to step 7.
110
136
  If a teammate reports rate-limit/quota/token exhaustion, immediately shutdown that teammate and respawn with an available model.
111
137
 
112
138
  **ZERO PENDING TASKS GUARANTEE:** Before proceeding to step 7, call \`team_tasks_list\` and verify EVERY task is either \`done\` or \`blocked\`. If any task is \`pending\` and unassigned, assign it to an agent or spawn a new one. Never leave pending tasks orphaned.
113
139
 
114
140
  7. **Quality check**
115
141
 
116
- Spawn quality engineer with worktree:false (read-only, no file edits):
142
+ Spawn the best available verification-capable engineer with \`worktree:false\` (for example, a testing-focused custom engineer or \`basic-engineer\` if no better verifier exists):
117
143
  \`\`\`
118
- team_spawn name:"quality" agent:"quality-engineer" worktree:false prompt:"<verification scope, context summary, run tests + build + lint + verify acceptance criteria, no task claiming required in this phase, send results to lead when done>"
144
+ team_spawn name:"verify" agent:"<real-verifier-engineer>" worktree:false prompt:"<verification scope, context summary, run tests + build + lint + verify acceptance criteria, no task claiming required in this phase, send results to lead when done>"
119
145
  \`\`\`
120
146
  Wait for message -> team_results -> fix blockers -> team_shutdown (no team_merge needed, worktree:false)
121
147
 
@@ -139,21 +165,22 @@ export const ENSEMBLE_SECTION = `6. **Implement via ensemble team**
139
165
  - NEVER implement tasks directly. Always use team_create + team_spawn, no exceptions
140
166
  - NEVER touch source files before team_create is called, not even one edit
141
167
  - NEVER call team_spawn without the agent field, it is required and will fail without it
142
- - NEVER call team_spawn before team_tasks_add, tasks must exist before agents are spawned
168
+ - NEVER call team_spawn before all tasks are on the board; use multiple \`team_tasks_add\` calls when dependencies require real IDs from earlier calls
143
169
  - NEVER poll team_results or team_status in a loop, wait for teammates to message you
144
170
  - NEVER call team_claim or team_tasks_complete as lead, only agents call these tools
145
171
  - NEVER leave pending tasks orphaned, always verify board is empty before proceeding to step 7
146
172
  - ALWAYS pass the LITERAL task IDs returned by team_tasks_add into each agent's spawn prompt, copy the exact IDs, never paraphrase
147
173
  - ALWAYS assign initial batch of up to 3 tasks per agent; re-assign next batch (up to 3) via team_message when agent reports done
148
174
  - ALWAYS call team_tasks_list after each agent reports done to check for remaining unassigned tasks
149
- - ALWAYS repeat the same literal task IDs in the team_message start trigger, never send a generic "claim your first task" without the actual IDs
175
+ - ALWAYS repeat the same literal task IDs in any task assignment message, never send a generic "claim your first task" without the actual IDs
150
176
  - NEVER send a start message that omits task IDs; if a task ID is missing from the start message, the agent cannot claim
151
177
  - NEVER edit files between team_spawn and team_merge, team_merge blocks on overlapping local changes
152
- - ALWAYS add every task to the board with team_tasks_add before spawning
178
+ - ALWAYS add every task to the board before spawning, using multiple \`team_tasks_add\` calls when dependency wiring requires it
179
+ - ALWAYS discover engineers from \`.agents/agents/\` and prefer matching custom engineers over \`basic-engineer\`
153
180
  - ALWAYS spawn agents sequentially (wait for each team_spawn result before the next), then send start messages to all of them together
154
- - ALWAYS instruct agents to call team_claim before each task and team_tasks_complete after
181
+ - ALWAYS set \`claim_task\` for the first unblocked task in each initial batch and instruct agents to claim before any other work
155
182
  - ALWAYS shut down + merge agents only when no more tasks remain for their domain
156
- - If teammates are stuck, use team_message to resend tasks, then wait, never implement directly
183
+ - If teammates are stuck, use one short claim-only message, then one respawn with a shorter prompt. If repeated idle/stall continues, stop forcing ensemble and continue outside it.
157
184
  - Mark tasks complete in openspec AFTER specialists finish, not before
158
185
  - Pause on errors, blockers, or unclear requirements. Do not guess
159
186
  - Use contextFiles from CLI output, do not assume specific file paths
@@ -2,7 +2,7 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
2
2
  import fs from 'node:fs'
3
3
  import path from 'node:path'
4
4
  import os from 'node:os'
5
- import { patchApplyFile, APPLY_TARGETS } from './ensemble.js'
5
+ import { patchApplyFile, APPLY_TARGETS, ENSEMBLE_SECTION } from './ensemble.js'
6
6
 
7
7
  describe('patchApplyFile()', () => {
8
8
  let tmpDir
@@ -70,10 +70,42 @@ describe('patchApplyFile()', () => {
70
70
  })
71
71
  })
72
72
 
73
- describe('APPLY_TARGETS', () => {
74
- it('contains expected OpenSpec apply file paths', () => {
75
- expect(APPLY_TARGETS).toHaveLength(2)
76
- expect(APPLY_TARGETS).toContain(path.join('.opencode', 'commands', 'opsx-apply.md'))
77
- expect(APPLY_TARGETS).toContain(path.join('.opencode', 'skills', 'openspec-apply-change', 'SKILL.md'))
78
- })
79
- })
73
+ describe('APPLY_TARGETS', () => {
74
+ it('contains expected OpenSpec apply file paths', () => {
75
+ expect(APPLY_TARGETS).toHaveLength(2)
76
+ expect(APPLY_TARGETS).toContain(path.join('.opencode', 'commands', 'opsx-apply.md'))
77
+ expect(APPLY_TARGETS).toContain(path.join('.opencode', 'skills', 'openspec-apply-change', 'SKILL.md'))
78
+ })
79
+ })
80
+
81
+ describe('ENSEMBLE_SECTION dependency guidance', () => {
82
+ it('instructs multi-call task creation for dependent tasks', () => {
83
+ expect(ENSEMBLE_SECTION).toContain('using as many `team_tasks_add` calls as needed')
84
+ expect(ENSEMBLE_SECTION).toContain('Save the returned IDs for root tasks.')
85
+ expect(ENSEMBLE_SECTION).toContain('Repeat until every OpenSpec task is on the board')
86
+ })
87
+
88
+ it('requires claim_task and idle-teammate recovery guidance', () => {
89
+ expect(ENSEMBLE_SECTION).toContain('ALWAYS set \`claim_task\` to the first unblocked task')
90
+ expect(ENSEMBLE_SECTION).toContain('If the teammate is idle and has not claimed any assigned task')
91
+ expect(ENSEMBLE_SECTION).toContain('stop forcing ensemble for this change and continue in the main session')
92
+ })
93
+
94
+ it('prefers discovered custom engineers over hardcoded role inventory', () => {
95
+ expect(ENSEMBLE_SECTION).toContain('scan `.agents/agents/` and list the engineers that actually exist in this project')
96
+ expect(ENSEMBLE_SECTION).toContain('prefer the most specialized custom engineer')
97
+ expect(ENSEMBLE_SECTION).not.toContain('front-engineer: UI, components, framework skills')
98
+ expect(ENSEMBLE_SECTION).not.toContain('team_spawn name:"front" agent:"front-engineer"')
99
+ })
100
+
101
+ it('keeps the prompt claim-first and minimal', () => {
102
+ expect(ENSEMBLE_SECTION).toContain('Claim this task immediately as your first action:')
103
+ expect(ENSEMBLE_SECTION).toContain('After claiming:')
104
+ expect(ENSEMBLE_SECTION).not.toContain('Available OpenCode tools:')
105
+ })
106
+
107
+ it('does not include the impossible same-call dependency example', () => {
108
+ expect(ENSEMBLE_SECTION).not.toContain('{ content: "3.1 <task that needs 1.x done first>", priority: "medium", depends_on: ["<id-of-1.1>"] }')
109
+ expect(ENSEMBLE_SECTION).not.toContain('Use depends_on to block tasks that require other tasks first, pass the IDs returned by team_tasks_add.')
110
+ })
111
+ })
@@ -8,8 +8,8 @@ export async function installCaveman(options = {}) {
8
8
 
9
9
  const isGlobal = options.installScope === 'global'
10
10
  const skillsArgs = isGlobal
11
- ? ['skills', 'add', 'JuliusBrussee/caveman/caveman', '-a', 'opencode', '--yes', '-g']
12
- : ['skills', 'add', 'JuliusBrussee/caveman/caveman', '-a', 'opencode', '--yes']
11
+ ? ['skills', 'add', 'https://github.com/juliusbrussee/caveman', '--skill', 'caveman', '-a', 'opencode', '--yes', '-g']
12
+ : ['skills', 'add', 'https://github.com/juliusbrussee/caveman', '--skill', 'caveman', '-a', 'opencode', '--yes']
13
13
 
14
14
  try {
15
15
  info('Installing caveman via npx skills')
@@ -29,7 +29,27 @@ function buildSourceRootsSection(sourceRoots, cwd) {
29
29
 
30
30
  function buildRtkSection(rtkEnabled) {
31
31
  if (!rtkEnabled) return 'RTK was not selected during onboarding. Do not assume `rtk` exists.'
32
- return `## RTK, MANDATORY\n\nUse \`rtk\` for ALL CLI commands. Never run commands directly.\n\n- \`rtk git\` NOT \`git\`\n- \`rtk gh\` NOT \`gh\`\n- \`rtk az\` NOT \`az\`\n- \`rtk openspec\` NOT \`openspec\`\n\nIf \`rtk\` is not available, report blocker and stop CLI execution.`
32
+ return [
33
+ '## RTK, MANDATORY',
34
+ '',
35
+ 'RTK has NO automatic hook in OpenCode. You MUST explicitly prefix every CLI command with `rtk`. It does not happen automatically.',
36
+ '',
37
+ 'Prefix ALL shell commands with `rtk`:',
38
+ '- `rtk git diff` NOT `git diff`',
39
+ '- `rtk git log` NOT `git log`',
40
+ '- `rtk gh` NOT `gh`',
41
+ '- `rtk az` NOT `az`',
42
+ '- `rtk openspec` NOT `openspec`',
43
+ '- `rtk npx tsc --noEmit` NOT `npx tsc --noEmit`',
44
+ '- `rtk pnpm build` NOT `pnpm build`',
45
+ '- `rtk pnpm test` NOT `pnpm test`',
46
+ '- `rtk pnpm lint` NOT `pnpm lint`',
47
+ '- `rtk dotnet build` NOT `dotnet build`',
48
+ '',
49
+ 'Light read-only commands that produce minimal output (e.g. `cat`, `ls`, `Get-Content`, `Select-String`) do not need `rtk`.',
50
+ '',
51
+ 'If `rtk` is not available, report blocker and stop CLI execution.',
52
+ ].join('\n')
33
53
  }
34
54
 
35
55
  function buildCavemanSection(cavemanEnabled) {
@@ -64,6 +64,9 @@ describe('configureObGlobal()', () => {
64
64
  await configureObGlobal({}, { rtk: { optedIn: true } })
65
65
  const content = fs.readFileSync(skillPath, 'utf-8')
66
66
  expect(content).toContain('RTK, MANDATORY')
67
+ expect(content).toContain('NO automatic hook in OpenCode')
68
+ expect(content).toContain('rtk pnpm build')
69
+ expect(content).toContain('rtk npx tsc')
67
70
  })
68
71
 
69
72
  it('injects RTK not-selected note when rtk is not opted in', async () => {
@@ -12,6 +12,12 @@ const platformsPreset = await fse.readJson(PLATFORMS_PRESET_PATH)
12
12
 
13
13
  export async function checkPlatform(platform) {
14
14
  const preset = platformsPreset.find(p => p.value === platform) || platformsPreset[0]
15
+ if (!preset.cli) {
16
+ header(`Step 4, Checking ${preset.name} CLI`)
17
+ info('No platform integration selected, skipping CLI checks.')
18
+ success(`Platform: ${preset.name}`)
19
+ return
20
+ }
15
21
  await checkPlatformCli(preset)
16
22
  }
17
23
 
@@ -23,7 +29,8 @@ export async function choosePlatform() {
23
29
  choices: platformsPreset.map(p => ({ name: p.name, value: p.value })),
24
30
  })
25
31
 
26
- success(`Platform: ${platform === 'github' ? 'GitHub' : 'Azure DevOps'}`)
32
+ const preset = platformsPreset.find(p => p.value === platform)
33
+ success(`Platform: ${preset?.name || platform}`)
27
34
  await checkPlatform(platform)
28
35
  return platform
29
36
  }
@@ -45,6 +45,15 @@ describe('choosePlatform()', () => {
45
45
  expect(success).toHaveBeenCalledWith('Platform: Azure DevOps')
46
46
  })
47
47
 
48
+ it('returns "none" when user selects None', async () => {
49
+ select.mockResolvedValue('none')
50
+
51
+ const result = await choosePlatform()
52
+
53
+ expect(result).toBe('none')
54
+ expect(success).toHaveBeenCalledWith('Platform: None')
55
+ })
56
+
48
57
  describe('checkPlatform()', () => {
49
58
  describe('github path', () => {
50
59
  it('prints success when gh is installed and authenticated', async () => {
@@ -125,5 +134,15 @@ describe('choosePlatform()', () => {
125
134
  expect(warn).toHaveBeenCalledWith('Could not check azure-devops extension. Run:')
126
135
  })
127
136
  })
137
+
138
+ describe('none path', () => {
139
+ it('skips CLI checks when no platform integration is selected', async () => {
140
+ await checkPlatform('none')
141
+
142
+ expect(commandExists).not.toHaveBeenCalled()
143
+ expect(execa).not.toHaveBeenCalled()
144
+ expect(success).toHaveBeenCalledWith('Platform: None')
145
+ })
146
+ })
128
147
  })
129
148
  })
@@ -1,8 +0,0 @@
1
- ---
2
- description: Initialize the project, runs the bootstrap sequence defined in AGENTS.md if not yet initialized.
3
- ---
4
-
5
- Check if `AGENTS.md` is in bootstrap mode (contains `<!-- AGENTS-TEMPLATE-START -->`).
6
-
7
- - If yes: run the full initialization sequence defined in `AGENTS.md` now.
8
- - If no: tell the user the project is already initialized.