opencastle 1.6.2 → 1.6.4

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 (275) hide show
  1. package/README.md +9 -9
  2. package/bin/cli.mjs +19 -12
  3. package/dist/cli/adapters/adapter-contract.test.js +1 -1
  4. package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
  5. package/dist/cli/adapters/single-file-base.js +2 -12
  6. package/dist/cli/adapters/single-file-base.js.map +1 -1
  7. package/dist/cli/add.js +7 -7
  8. package/dist/cli/add.js.map +1 -1
  9. package/dist/cli/baseline.js +6 -6
  10. package/dist/cli/baseline.js.map +1 -1
  11. package/dist/cli/bootstrap.d.ts.map +1 -1
  12. package/dist/cli/bootstrap.js +15 -6
  13. package/dist/cli/bootstrap.js.map +1 -1
  14. package/dist/cli/bootstrap.test.js +8 -0
  15. package/dist/cli/bootstrap.test.js.map +1 -1
  16. package/dist/cli/ci.d.ts.map +1 -1
  17. package/dist/cli/ci.js +19 -9
  18. package/dist/cli/ci.js.map +1 -1
  19. package/dist/cli/command-namespace.test.js +4 -21
  20. package/dist/cli/command-namespace.test.js.map +1 -1
  21. package/dist/cli/convoy/engine.js +3 -3
  22. package/dist/cli/convoy/engine.js.map +1 -1
  23. package/dist/cli/convoy/engine.test.js +1 -1
  24. package/dist/cli/convoy/engine.test.js.map +1 -1
  25. package/dist/cli/convoy/read-model.d.ts +8 -15
  26. package/dist/cli/convoy/read-model.d.ts.map +1 -1
  27. package/dist/cli/convoy/read-model.js +9 -68
  28. package/dist/cli/convoy/read-model.js.map +1 -1
  29. package/dist/cli/convoy/read-model.test.js +6 -25
  30. package/dist/cli/convoy/read-model.test.js.map +1 -1
  31. package/dist/cli/convoy/spec-builder.d.ts +2 -2
  32. package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
  33. package/dist/cli/convoy/spec-builder.js +3 -3
  34. package/dist/cli/convoy/spec-builder.js.map +1 -1
  35. package/dist/cli/convoy/spec-builder.test.js +2 -2
  36. package/dist/cli/convoy/spec-builder.test.js.map +1 -1
  37. package/dist/cli/convoy-cmd.js +16 -16
  38. package/dist/cli/convoy-cmd.js.map +1 -1
  39. package/dist/cli/convoy-cmd.test.js +11 -11
  40. package/dist/cli/convoy-cmd.test.js.map +1 -1
  41. package/dist/cli/dashboard.js +3 -3
  42. package/dist/cli/dashboard.js.map +1 -1
  43. package/dist/cli/dashboard.test.js +10 -2
  44. package/dist/cli/dashboard.test.js.map +1 -1
  45. package/dist/cli/dispatcher.test.js +7 -4
  46. package/dist/cli/dispatcher.test.js.map +1 -1
  47. package/dist/cli/docs-accuracy.test.js +5 -1
  48. package/dist/cli/docs-accuracy.test.js.map +1 -1
  49. package/dist/cli/doctor.d.ts.map +1 -1
  50. package/dist/cli/doctor.js +17 -42
  51. package/dist/cli/doctor.js.map +1 -1
  52. package/dist/cli/explain.js +2 -2
  53. package/dist/cli/explain.js.map +1 -1
  54. package/dist/cli/fleet.js +1 -1
  55. package/dist/cli/github-report.js +5 -5
  56. package/dist/cli/github-report.js.map +1 -1
  57. package/dist/cli/gitignore.js +1 -1
  58. package/dist/cli/gitignore.js.map +1 -1
  59. package/dist/cli/init.d.ts.map +1 -1
  60. package/dist/cli/init.js +27 -10
  61. package/dist/cli/init.js.map +1 -1
  62. package/dist/cli/layers.js +4 -4
  63. package/dist/cli/layers.js.map +1 -1
  64. package/dist/cli/lesson.js +12 -12
  65. package/dist/cli/lesson.js.map +1 -1
  66. package/dist/cli/lessons.d.ts.map +1 -1
  67. package/dist/cli/lessons.js +11 -7
  68. package/dist/cli/lessons.js.map +1 -1
  69. package/dist/cli/managed-block.js +1 -1
  70. package/dist/cli/managed-block.js.map +1 -1
  71. package/dist/cli/mcp-audit.js +6 -6
  72. package/dist/cli/mcp-audit.js.map +1 -1
  73. package/dist/cli/mcp-audit.test.js +5 -5
  74. package/dist/cli/mcp-audit.test.js.map +1 -1
  75. package/dist/cli/pipeline.d.ts +1 -1
  76. package/dist/cli/pipeline.flow.test.js +77 -77
  77. package/dist/cli/pipeline.flow.test.js.map +1 -1
  78. package/dist/cli/pipeline.js +30 -30
  79. package/dist/cli/pipeline.js.map +1 -1
  80. package/dist/cli/plan.d.ts +8 -2
  81. package/dist/cli/plan.d.ts.map +1 -1
  82. package/dist/cli/plan.js +18 -12
  83. package/dist/cli/plan.js.map +1 -1
  84. package/dist/cli/plan.test.js +17 -19
  85. package/dist/cli/plan.test.js.map +1 -1
  86. package/dist/cli/plugin.js +8 -8
  87. package/dist/cli/plugin.js.map +1 -1
  88. package/dist/cli/promote.js +5 -5
  89. package/dist/cli/promote.js.map +1 -1
  90. package/dist/cli/prompt.d.ts.map +1 -1
  91. package/dist/cli/prompt.js +15 -2
  92. package/dist/cli/prompt.js.map +1 -1
  93. package/dist/cli/prompt.test.js +33 -8
  94. package/dist/cli/prompt.test.js.map +1 -1
  95. package/dist/cli/remove.js +1 -1
  96. package/dist/cli/review.js +3 -3
  97. package/dist/cli/review.js.map +1 -1
  98. package/dist/cli/run/adapters/index.js +3 -3
  99. package/dist/cli/run/adapters/index.js.map +1 -1
  100. package/dist/cli/run/adapters/index.test.js +3 -3
  101. package/dist/cli/run/adapters/index.test.js.map +1 -1
  102. package/dist/cli/run/schema.js +3 -3
  103. package/dist/cli/run/schema.js.map +1 -1
  104. package/dist/cli/run.js +21 -21
  105. package/dist/cli/run.js.map +1 -1
  106. package/dist/cli/run.test.js +3 -3
  107. package/dist/cli/run.test.js.map +1 -1
  108. package/dist/cli/stack-config-update.test.js +18 -1
  109. package/dist/cli/stack-config-update.test.js.map +1 -1
  110. package/dist/cli/stack-config.d.ts.map +1 -1
  111. package/dist/cli/stack-config.js +10 -1
  112. package/dist/cli/stack-config.js.map +1 -1
  113. package/dist/cli/status.js +9 -9
  114. package/dist/cli/status.js.map +1 -1
  115. package/dist/cli/status.test.js +3 -3
  116. package/dist/cli/status.test.js.map +1 -1
  117. package/dist/cli/sync-check.js +16 -16
  118. package/dist/cli/sync-check.js.map +1 -1
  119. package/dist/cli/sync.js +1 -1
  120. package/dist/cli/team-ci.test.js +3 -3
  121. package/dist/cli/team-ci.test.js.map +1 -1
  122. package/dist/cli/team-commands.test.js +30 -1
  123. package/dist/cli/team-commands.test.js.map +1 -1
  124. package/dist/cli/update.d.ts.map +1 -1
  125. package/dist/cli/update.js +34 -66
  126. package/dist/cli/update.js.map +1 -1
  127. package/package.json +1 -1
  128. package/src/cli/adapters/adapter-contract.test.ts +1 -1
  129. package/src/cli/adapters/single-file-base.ts +2 -11
  130. package/src/cli/add.ts +7 -7
  131. package/src/cli/baseline.ts +6 -6
  132. package/src/cli/bootstrap.test.ts +9 -0
  133. package/src/cli/bootstrap.ts +16 -6
  134. package/src/cli/ci.ts +17 -9
  135. package/src/cli/command-namespace.test.ts +5 -22
  136. package/src/cli/convoy/engine.test.ts +1 -1
  137. package/src/cli/convoy/engine.ts +3 -3
  138. package/src/{orchestrator/prompts/assess-complexity.prompt.md → cli/convoy/prompts/convoy-assess.prompt.md} +0 -3
  139. package/src/{orchestrator/prompts/fix-convoy.prompt.md → cli/convoy/prompts/convoy-plan-fix.prompt.md} +0 -3
  140. package/src/{orchestrator/prompts/validate-convoy.prompt.md → cli/convoy/prompts/convoy-plan-review.prompt.md} +0 -3
  141. package/src/{orchestrator/prompts/generate-convoy.prompt.md → cli/convoy/prompts/convoy-plan.prompt.md} +0 -2
  142. package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md} +0 -3
  143. package/src/{orchestrator/prompts/validate-prd.prompt.md → cli/convoy/prompts/convoy-prd-review.prompt.md} +0 -3
  144. package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md} +0 -3
  145. package/src/cli/convoy/read-model.test.ts +5 -29
  146. package/src/cli/convoy/read-model.ts +11 -71
  147. package/src/cli/convoy/spec-builder.test.ts +2 -2
  148. package/src/cli/convoy/spec-builder.ts +4 -4
  149. package/src/cli/convoy-cmd.test.ts +11 -11
  150. package/src/cli/convoy-cmd.ts +18 -18
  151. package/src/cli/dashboard/dashboard.js +2 -4
  152. package/src/cli/dashboard.test.ts +10 -2
  153. package/src/cli/dashboard.ts +3 -3
  154. package/src/cli/dispatcher.test.ts +8 -4
  155. package/src/cli/docs-accuracy.test.ts +5 -1
  156. package/src/cli/doctor.ts +17 -43
  157. package/src/cli/explain.ts +2 -2
  158. package/src/cli/fleet.ts +1 -1
  159. package/src/cli/github-report.ts +5 -5
  160. package/src/cli/gitignore.ts +1 -1
  161. package/src/cli/init.ts +26 -10
  162. package/src/cli/layers.ts +4 -4
  163. package/src/cli/lesson.ts +12 -12
  164. package/src/cli/lessons.ts +11 -7
  165. package/src/cli/managed-block.ts +1 -1
  166. package/src/cli/mcp-audit.test.ts +5 -5
  167. package/src/cli/mcp-audit.ts +6 -6
  168. package/src/cli/pipeline.flow.test.ts +78 -78
  169. package/src/cli/pipeline.ts +31 -31
  170. package/src/cli/plan.test.ts +18 -20
  171. package/src/cli/plan.ts +18 -12
  172. package/src/cli/plugin.ts +8 -8
  173. package/src/cli/promote.ts +5 -5
  174. package/src/cli/prompt.test.ts +41 -13
  175. package/src/cli/prompt.ts +14 -2
  176. package/src/cli/remove.ts +1 -1
  177. package/src/cli/review.ts +3 -3
  178. package/src/cli/run/adapters/index.test.ts +3 -3
  179. package/src/cli/run/adapters/index.ts +3 -3
  180. package/src/cli/run/schema.ts +3 -3
  181. package/src/cli/run.test.ts +3 -3
  182. package/src/cli/run.ts +21 -21
  183. package/src/cli/stack-config-update.test.ts +22 -1
  184. package/src/cli/stack-config.ts +9 -1
  185. package/src/cli/status.test.ts +3 -3
  186. package/src/cli/status.ts +9 -9
  187. package/src/cli/sync-check.ts +16 -16
  188. package/src/cli/sync.ts +1 -1
  189. package/src/cli/team-ci.test.ts +3 -3
  190. package/src/cli/team-commands.test.ts +32 -1
  191. package/src/cli/update.ts +32 -74
  192. package/src/orchestrator/agent-workflows/README.md +10 -18
  193. package/src/orchestrator/agent-workflows/data-pipeline.md +7 -140
  194. package/src/orchestrator/agent-workflows/database-migration.md +7 -153
  195. package/src/orchestrator/agent-workflows/performance-optimization.md +6 -119
  196. package/src/orchestrator/agent-workflows/refactoring.md +8 -137
  197. package/src/orchestrator/agent-workflows/schema-changes.md +8 -159
  198. package/src/orchestrator/agent-workflows/security-audit.md +7 -142
  199. package/src/orchestrator/agent-workflows/shared-delivery-phase.md +8 -25
  200. package/src/orchestrator/agents/architect.agent.md +2 -14
  201. package/src/orchestrator/agents/content-engineer.agent.md +8 -10
  202. package/src/orchestrator/agents/data-engineer.agent.md +8 -8
  203. package/src/orchestrator/agents/developer.agent.md +3 -10
  204. package/src/orchestrator/agents/devops-expert.agent.md +0 -3
  205. package/src/orchestrator/agents/performance-expert.agent.md +2 -3
  206. package/src/orchestrator/agents/security-expert.agent.md +10 -12
  207. package/src/orchestrator/agents/team-lead.agent.md +31 -75
  208. package/src/orchestrator/agents/testing-expert.agent.md +3 -6
  209. package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -4
  210. package/src/orchestrator/agents/writer.agent.md +0 -3
  211. package/src/orchestrator/customizations/LESSONS-LEARNED.md +5 -3
  212. package/src/orchestrator/customizations/README.md +3 -4
  213. package/src/orchestrator/customizations/agents/agent-registry.md +3 -3
  214. package/src/orchestrator/customizations/agents/skill-matrix.json +6 -42
  215. package/src/orchestrator/instructions/general.instructions.md +10 -37
  216. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -6
  217. package/src/orchestrator/prompts/brainstorm.prompt.md +7 -12
  218. package/src/orchestrator/prompts/bug-fix.prompt.md +19 -100
  219. package/src/orchestrator/prompts/convoy.prompt.md +20 -0
  220. package/src/orchestrator/prompts/create-skill.prompt.md +1 -5
  221. package/src/orchestrator/prompts/implement-feature.prompt.md +22 -93
  222. package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -5
  223. package/src/orchestrator/skills/api-patterns/SKILL.md +21 -18
  224. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
  225. package/src/orchestrator/skills/fast-review/SKILL.md +28 -65
  226. package/src/orchestrator/skills/frontend-design/REFERENCE.md +0 -1
  227. package/src/orchestrator/skills/frontend-design/SKILL.md +3 -1
  228. package/src/orchestrator/skills/git-workflow/SKILL.md +18 -34
  229. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +16 -46
  230. package/src/orchestrator/skills/security-hardening/SKILL.md +20 -19
  231. package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +2 -2
  232. package/src/orchestrator/skills/self-improvement/SKILL.md +21 -46
  233. package/src/orchestrator/skills/technical-writing/SKILL.md +3 -1
  234. package/src/orchestrator/skills/technical-writing/TEMPLATES.md +23 -0
  235. package/src/orchestrator/skills/testing-workflow/SKILL.md +21 -23
  236. package/src/orchestrator/skills/validation-gates/REFERENCE.md +2 -14
  237. package/src/orchestrator/skills/validation-gates/SKILL.md +10 -88
  238. package/dist/cli/log.d.ts +0 -44
  239. package/dist/cli/log.d.ts.map +0 -1
  240. package/dist/cli/log.js +0 -336
  241. package/dist/cli/log.js.map +0 -1
  242. package/dist/cli/log.test.d.ts +0 -2
  243. package/dist/cli/log.test.d.ts.map +0 -1
  244. package/dist/cli/log.test.js +0 -208
  245. package/dist/cli/log.test.js.map +0 -1
  246. package/src/cli/log.test.ts +0 -228
  247. package/src/cli/log.ts +0 -374
  248. package/src/orchestrator/agent-workflows/bug-fix.md +0 -130
  249. package/src/orchestrator/agent-workflows/feature-implementation.md +0 -232
  250. package/src/orchestrator/instructions/ai-optimization.instructions.md +0 -17
  251. package/src/orchestrator/prompts/quick-refinement.prompt.md +0 -110
  252. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +0 -44
  253. package/src/orchestrator/skills/agent-hooks/SKILL.md +0 -80
  254. package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +0 -49
  255. package/src/orchestrator/skills/agent-memory/SKILL.md +0 -50
  256. package/src/orchestrator/skills/code-commenting/SKILL.md +0 -18
  257. package/src/orchestrator/skills/context-map/REFERENCE.md +0 -67
  258. package/src/orchestrator/skills/context-map/SKILL.md +0 -71
  259. package/src/orchestrator/skills/decomposition/SKILL.md +0 -103
  260. package/src/orchestrator/skills/documentation-standards/SKILL.md +0 -33
  261. package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -28
  262. package/src/orchestrator/skills/memory-merger/SKILL.md +0 -77
  263. package/src/orchestrator/skills/observability-logging/LOG-SCHEMA.md +0 -238
  264. package/src/orchestrator/skills/observability-logging/SKILL.md +0 -73
  265. package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +0 -38
  266. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +0 -120
  267. package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +0 -49
  268. package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -38
  269. package/src/orchestrator/skills/performance-optimization/SKILL.md +0 -23
  270. package/src/orchestrator/skills/project-consistency/SKILL.md +0 -80
  271. package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -35
  272. package/src/orchestrator/skills/react-development/SKILL.md +0 -24
  273. package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -56
  274. package/src/orchestrator/skills/session-checkpoints/SKILL.md +0 -40
  275. package/src/orchestrator/skills/team-lead-reference/SKILL.md +0 -126
@@ -521,21 +521,21 @@ export function remedyFor(list: McpFinding[], rel: string): string {
521
521
  const edited = names((f) => f.sync === 'keeps' && Boolean(f.plugin) && !f.team)
522
522
  const teamSource = list.filter((f) => f.sync === 'keeps' && Boolean(f.team))
523
523
  const own = names((f) => f.sync === 'keeps' && !f.plugin && !f.team)
524
- if (replaced) parts.push(`opencastle sync fixes ${replaced} (still as OpenCastle wrote them)`)
525
- if (rewritten) parts.push(`opencastle sync rewrites ${rewritten} as the team config defines them`)
524
+ if (replaced) parts.push(`npx opencastle sync fixes ${replaced} (still as OpenCastle wrote them)`)
525
+ if (rewritten) parts.push(`npx opencastle sync rewrites ${rewritten} as the team config defines them`)
526
526
  if (removed.length > 0) {
527
527
  const servers = [...new Set(removed.map((f) => f.server))].join(', ')
528
528
  const packs = [...new Set(removed.map((f) => f.plugin))].join(' ')
529
- parts.push(`opencastle sync removes ${servers}, which this project's stack does not include — opencastle add ${packs} keeps it`)
529
+ parts.push(`npx opencastle sync removes ${servers}, which this project's stack does not include — npx opencastle add ${packs} keeps it`)
530
530
  }
531
- if (blocked) parts.push(`opencastle sync removes ${blocked}, which the team's config excludes or its MCP policy does not allow`)
532
- if (retired) parts.push(`opencastle sync removes ${retired}, which no team layer defines any more`)
531
+ if (blocked) parts.push(`npx opencastle sync removes ${blocked}, which the team's config excludes or its MCP policy does not allow`)
532
+ if (retired) parts.push(`npx opencastle sync removes ${retired}, which no team layer defines any more`)
533
533
  for (const where of new Set(teamSource.map((f) => f.team as string))) {
534
534
  parts.push(`fix ${names((f) => f.team === where && f.sync === 'keeps')} in ${where}, where it is defined`)
535
535
  }
536
536
  if (edited) {
537
537
  parts.push(
538
- `${edited} changed since OpenCastle wrote them — fix by hand, or delete the entry and run opencastle sync --force for the current default`,
538
+ `${edited} changed since OpenCastle wrote them — fix by hand, or delete the entry and run npx opencastle sync --force for the current default`,
539
539
  )
540
540
  }
541
541
  if (own) parts.push(`fix ${own} by hand in ${rel}`)
@@ -108,13 +108,13 @@ function stubAdapter(answers: Record<string, Answer> = {}): { adapter: AgentAdap
108
108
  const stoppers = new Map<string, Array<() => void>>()
109
109
  const seen = new Map<string, number>()
110
110
  const defaults: Record<string, Answer> = {
111
- 'generate-prd': PRD,
112
- 'fix-prd': PRD,
113
- 'validate-prd': fence({ valid: true }),
114
- 'assess-complexity': fence(SINGLE),
115
- 'generate-convoy': fence(PLAN),
116
- 'validate-convoy': fence({ valid: true }),
117
- 'fix-convoy': fence([]),
111
+ 'convoy-prd': PRD,
112
+ 'convoy-prd-fix': PRD,
113
+ 'convoy-prd-review': fence({ valid: true }),
114
+ 'convoy-assess': fence(SINGLE),
115
+ 'convoy-plan': fence(PLAN),
116
+ 'convoy-plan-review': fence({ valid: true }),
117
+ 'convoy-plan-fix': fence([]),
118
118
  }
119
119
  const adapter: AgentAdapter = {
120
120
  name: 'stub',
@@ -185,13 +185,13 @@ describe('planConvoy: sessions', () => {
185
185
  // The plan from the request is dropped once the size says a PRD is needed;
186
186
  // the plan from the PRD is the one kept.
187
187
  expect([...templates(calls)].sort()).toEqual([
188
- 'assess-complexity', 'generate-convoy', 'generate-convoy', 'generate-prd', 'validate-prd',
188
+ 'convoy-assess', 'convoy-plan', 'convoy-plan', 'convoy-prd', 'convoy-prd-review',
189
189
  ])
190
190
  expect(outcome.problems).toEqual([])
191
191
  })
192
192
 
193
193
  it('runs every planning session read-only, in the project', async () => {
194
- const { adapter, calls } = stubAdapter({ 'validate-prd': (_p, n) => fence(n === 1 ? { valid: false, issues: ['x'] } : { valid: true }) })
194
+ const { adapter, calls } = stubAdapter({ 'convoy-prd-review': (_p, n) => fence(n === 1 ? { valid: false, issues: ['x'] } : { valid: true }) })
195
195
  await plan(adapter, { critic: true })
196
196
  expect(calls.length).toBeGreaterThan(4)
197
197
  for (const call of calls) {
@@ -200,23 +200,23 @@ describe('planConvoy: sessions', () => {
200
200
  }
201
201
  })
202
202
 
203
- it('sends the PRD to generate-convoy once', async () => {
203
+ it('sends the PRD to convoy-plan once', async () => {
204
204
  const { adapter, calls } = stubAdapter()
205
205
  await plan(adapter)
206
- const fromPrd = calls.filter((c) => c.template === 'generate-convoy' && c.prompt.includes('PRD-MARKER'))
206
+ const fromPrd = calls.filter((c) => c.template === 'convoy-plan' && c.prompt.includes('PRD-MARKER'))
207
207
  expect(fromPrd).toHaveLength(1)
208
208
  expect(fromPrd[0].prompt.match(/PRD-MARKER/g)).toHaveLength(1)
209
209
  expect(fromPrd[0].prompt).not.toMatch(/\{\{(goal|context)\}\}/)
210
210
  })
211
211
 
212
212
  it('plans a small change straight from the request, with no PRD', async () => {
213
- const { adapter, calls } = stubAdapter({ 'assess-complexity': fence({ ...SINGLE, complexity: 'low' }) })
213
+ const { adapter, calls } = stubAdapter({ 'convoy-assess': fence({ ...SINGLE, complexity: 'low' }) })
214
214
  const outcome = await plan(adapter)
215
215
  // The PRD starts beside the size too; here it finished first, and is not kept.
216
- expect([...templates(calls)].sort()).toEqual(['assess-complexity', 'generate-convoy', 'generate-prd'])
216
+ expect([...templates(calls)].sort()).toEqual(['convoy-assess', 'convoy-plan', 'convoy-prd'])
217
217
  expect(outcome.prdPath).toBeNull()
218
218
  expect(existsSync(join(root, '.opencastle', 'prds'))).toBe(false)
219
- expect(calls.find((c) => c.template === 'generate-convoy')!.prompt).toContain('There is no PRD: this is a small change')
219
+ expect(calls.find((c) => c.template === 'convoy-plan')!.prompt).toContain('There is no PRD: this is a small change')
220
220
  expect(outcome.problems).toEqual([])
221
221
  })
222
222
 
@@ -231,8 +231,8 @@ describe('planConvoy: sessions', () => {
231
231
  return answer
232
232
  }
233
233
  const { adapter } = stubAdapter({
234
- 'assess-complexity': overlap(fence({ ...SINGLE, complexity: 'low' })),
235
- 'generate-convoy': overlap(fence(PLAN)),
234
+ 'convoy-assess': overlap(fence({ ...SINGLE, complexity: 'low' })),
235
+ 'convoy-plan': overlap(fence(PLAN)),
236
236
  })
237
237
  await plan(adapter)
238
238
  expect(most).toBe(2)
@@ -240,21 +240,21 @@ describe('planConvoy: sessions', () => {
240
240
 
241
241
  it('stops the PRD as soon as the size says the change is small', async () => {
242
242
  const { adapter, killed } = stubAdapter({
243
- 'assess-complexity': fence({ ...SINGLE, complexity: 'low' }),
244
- 'generate-prd': never,
243
+ 'convoy-assess': fence({ ...SINGLE, complexity: 'low' }),
244
+ 'convoy-prd': never,
245
245
  })
246
246
  const outcome = await plan(adapter)
247
- expect(killed).toEqual(['generate-prd'])
247
+ expect(killed).toEqual(['convoy-prd'])
248
248
  expect(outcome.prdPath).toBeNull()
249
249
  expect(outcome.plan.name).toBe('Dark mode')
250
250
  })
251
251
 
252
252
  it('stops the plan from the request as soon as the size says a PRD is needed', async () => {
253
253
  const { adapter, calls, killed } = stubAdapter({
254
- 'generate-convoy': (prompt) => (prompt.includes('PRD-MARKER') ? fence(PLAN) : never()),
254
+ 'convoy-plan': (prompt) => (prompt.includes('PRD-MARKER') ? fence(PLAN) : never()),
255
255
  })
256
256
  const outcome = await plan(adapter)
257
- expect(killed).toEqual(['generate-convoy'])
257
+ expect(killed).toEqual(['convoy-plan'])
258
258
  expect(outcome.prdPath).not.toBeNull()
259
259
  expect(outcome.plan.name).toBe('Dark mode')
260
260
  // A stopped session counts, and makes the cost a lower bound.
@@ -265,25 +265,25 @@ describe('planConvoy: sessions', () => {
265
265
  it('plans from the PRD beside its review, and again from the fixed PRD when the review fails', async () => {
266
266
  const fixedPrd = PRD.replace('PRD-MARKER', 'FIXED-MARKER')
267
267
  const { adapter, calls, killed } = stubAdapter({
268
- 'validate-prd': (_p, n) => fence({ valid: n > 1, issues: ['US-1: unclear'] }),
269
- 'fix-prd': fixedPrd,
268
+ 'convoy-prd-review': (_p, n) => fence({ valid: n > 1, issues: ['US-1: unclear'] }),
269
+ 'convoy-prd-fix': fixedPrd,
270
270
  // The plan from the request ends at once; the one from the draft PRD
271
271
  // runs until it is stopped.
272
- 'generate-convoy': (prompt) => (prompt.includes('PRD-MARKER') ? never() : fence(PLAN)),
272
+ 'convoy-plan': (prompt) => (prompt.includes('PRD-MARKER') ? never() : fence(PLAN)),
273
273
  })
274
274
  const outcome = await plan(adapter)
275
- expect(killed).toEqual(['generate-convoy'])
276
- const last = calls.filter((c) => c.template === 'generate-convoy').at(-1)!
275
+ expect(killed).toEqual(['convoy-plan'])
276
+ const last = calls.filter((c) => c.template === 'convoy-plan').at(-1)!
277
277
  expect(last.prompt).toContain('FIXED-MARKER')
278
278
  expect(outcome.problems).toEqual([])
279
279
  })
280
280
 
281
281
  it('asks for medium effort for the plan and low for every other step, all lean', async () => {
282
- const { adapter, calls } = stubAdapter({ 'validate-prd': (_p, n) => fence({ valid: n > 1, issues: ['x'] }) })
282
+ const { adapter, calls } = stubAdapter({ 'convoy-prd-review': (_p, n) => fence({ valid: n > 1, issues: ['x'] }) })
283
283
  await plan(adapter, { critic: true })
284
284
  expect(new Set(calls.map((c) => c.template)).size).toBeGreaterThanOrEqual(6)
285
285
  for (const call of calls) {
286
- expect(call.effort, call.template).toBe(call.template === 'generate-convoy' ? 'medium' : 'low')
286
+ expect(call.effort, call.template).toBe(call.template === 'convoy-plan' ? 'medium' : 'low')
287
287
  expect(call.lean, call.template).toBe(true)
288
288
  }
289
289
  })
@@ -291,38 +291,38 @@ describe('planConvoy: sessions', () => {
291
291
  it('sizes a larger request once, and does not size its PRD again', async () => {
292
292
  const { adapter, calls } = stubAdapter()
293
293
  await plan(adapter)
294
- expect(count(calls, 'assess-complexity')).toBe(1)
295
- expect(templates(calls).slice(0, 3).sort()).toEqual(['assess-complexity', 'generate-convoy', 'generate-prd'])
294
+ expect(count(calls, 'convoy-assess')).toBe(1)
295
+ expect(templates(calls).slice(0, 3).sort()).toEqual(['convoy-assess', 'convoy-plan', 'convoy-prd'])
296
296
  })
297
297
 
298
298
  it('fixes an invalid PRD at most twice, then plans from it anyway', async () => {
299
- const { adapter, calls } = stubAdapter({ 'validate-prd': fence({ valid: false, issues: ['Overview: thin'] }) })
299
+ const { adapter, calls } = stubAdapter({ 'convoy-prd-review': fence({ valid: false, issues: ['Overview: thin'] }) })
300
300
  const outcome = await plan(adapter)
301
- expect(count(calls, 'fix-prd')).toBe(2)
302
- expect(count(calls, 'validate-prd')).toBe(3)
301
+ expect(count(calls, 'convoy-prd-fix')).toBe(2)
302
+ expect(count(calls, 'convoy-prd-review')).toBe(3)
303
303
  // Planned from the request, from the draft beside its review, and from the PRD as fixed.
304
- expect(count(calls, 'generate-convoy')).toBe(3)
304
+ expect(count(calls, 'convoy-plan')).toBe(3)
305
305
  expect(calls).toHaveLength(10)
306
- expect(templates(calls).at(-1)).toBe('generate-convoy')
306
+ expect(templates(calls).at(-1)).toBe('convoy-plan')
307
307
  expect(outcome.problems).toEqual([])
308
308
  })
309
309
 
310
310
  it('stops fixing the PRD as soon as it passes', async () => {
311
- const { adapter, calls } = stubAdapter({ 'validate-prd': (_p, n) => fence({ valid: n > 1, issues: ['x'] }) })
311
+ const { adapter, calls } = stubAdapter({ 'convoy-prd-review': (_p, n) => fence({ valid: n > 1, issues: ['x'] }) })
312
312
  await plan(adapter)
313
- expect(count(calls, 'fix-prd')).toBe(1)
313
+ expect(count(calls, 'convoy-prd-fix')).toBe(1)
314
314
  expect(calls).toHaveLength(8)
315
315
  })
316
316
 
317
- it('asks fix-convoy only when the checks fail, and never validate-convoy', async () => {
317
+ it('asks convoy-plan-fix only when the checks fail, and never convoy-plan-review', async () => {
318
318
  const bad = { ...PLAN, tasks: [PLAN.tasks[0], { ...PLAN.tasks[1], timeout: 'soon' }] }
319
319
  const { adapter, calls } = stubAdapter({
320
- 'generate-convoy': fence(bad),
321
- 'fix-convoy': fence([{ task_id: 'toggle', field: 'timeout', value: '10m' }]),
320
+ 'convoy-plan': fence(bad),
321
+ 'convoy-plan-fix': fence([{ task_id: 'toggle', field: 'timeout', value: '10m' }]),
322
322
  })
323
323
  const outcome = await plan(adapter)
324
- expect(count(calls, 'fix-convoy')).toBe(1)
325
- expect(count(calls, 'validate-convoy')).toBe(0)
324
+ expect(count(calls, 'convoy-plan-fix')).toBe(1)
325
+ expect(count(calls, 'convoy-plan-review')).toBe(0)
326
326
  expect(calls).toHaveLength(6)
327
327
  expect(outcome.problems).toEqual([])
328
328
  })
@@ -332,16 +332,16 @@ describe('planConvoy: sessions', () => {
332
332
  // as soon as the size is known, whether or not it got to its own retry.
333
333
  let fromPrd = 0
334
334
  const { adapter, calls } = stubAdapter({
335
- 'generate-convoy': (prompt) =>
335
+ 'convoy-plan': (prompt) =>
336
336
  prompt.includes('PRD-MARKER') && fromPrd++ === 0 ? 'Sorry, here you go: {' : fence(PLAN),
337
337
  })
338
338
  const outcome = await plan(adapter)
339
- expect(calls.filter((c) => c.template === 'generate-convoy' && c.prompt.includes('PRD-MARKER'))).toHaveLength(2)
339
+ expect(calls.filter((c) => c.template === 'convoy-plan' && c.prompt.includes('PRD-MARKER'))).toHaveLength(2)
340
340
  expect(outcome.plan.name).toBe('Dark mode')
341
341
  })
342
342
 
343
343
  it('keeps the unreadable answer for inspection when the retry fails too', async () => {
344
- const { adapter } = stubAdapter({ 'generate-convoy': 'not a plan' })
344
+ const { adapter } = stubAdapter({ 'convoy-plan': 'not a plan' })
345
345
  await expect(plan(adapter)).rejects.toThrow(/could not be read after a retry/)
346
346
  expect(readdirSync(join(root, '.opencastle', 'convoys')).some((f) => f.endsWith('.task-plan.json'))).toBe(true)
347
347
  })
@@ -350,20 +350,20 @@ describe('planConvoy: sessions', () => {
350
350
  const bad = { ...PLAN, tasks: [PLAN.tasks[0], { ...PLAN.tasks[1], timeout: 'soon' }] }
351
351
  let fromFixed = 0
352
352
  const { adapter, calls } = stubAdapter({
353
- 'validate-prd': fence({ valid: false, issues: ['x'] }),
353
+ 'convoy-prd-review': fence({ valid: false, issues: ['x'] }),
354
354
  // Only the plan that is kept, from the PRD as fixed, is unreadable once.
355
- 'generate-convoy': (prompt) =>
356
- prompt.includes('PRD-MARKER') && calls.some((c) => c.template === 'fix-prd') && fromFixed++ === 0
355
+ 'convoy-plan': (prompt) =>
356
+ prompt.includes('PRD-MARKER') && calls.some((c) => c.template === 'convoy-prd-fix') && fromFixed++ === 0
357
357
  ? '```json\n{ "name": "x", "tasks": [\n```'
358
358
  : fence(bad),
359
- 'fix-convoy': fence([{ task_id: 'toggle', field: 'timeout', value: 'later' }]),
359
+ 'convoy-plan-fix': fence([{ task_id: 'toggle', field: 'timeout', value: 'later' }]),
360
360
  })
361
361
  const outcome = await plan(adapter, { critic: true })
362
- // assess ‖ the plan from the request, generate-prd, validate-prd ‖ the plan
363
- // from the draft, 2 × (fix-prd + validate-prd), 2 × generate-convoy (one
364
- // unreadable), 2 × fix-convoy.
362
+ // assess ‖ the plan from the request, convoy-prd, convoy-prd-review ‖ the plan
363
+ // from the draft, 2 × (convoy-prd-fix + convoy-prd-review), 2 × convoy-plan (one
364
+ // unreadable), 2 × convoy-plan-fix.
365
365
  expect(calls).toHaveLength(13)
366
- expect(count(calls, 'validate-convoy')).toBe(0) // no review of a plan that cannot run
366
+ expect(count(calls, 'convoy-plan-review')).toBe(0) // no review of a plan that cannot run
367
367
  expect(outcome.problems.join('\n')).toContain('timeout')
368
368
  })
369
369
 
@@ -375,26 +375,26 @@ describe('planConvoy: sessions', () => {
375
375
  { id: 'b', prompt: 'b', files: ['src/components/Hero.tsx'] },
376
376
  ],
377
377
  }
378
- const { adapter, calls } = stubAdapter({ 'generate-convoy': fence(clash) })
378
+ const { adapter, calls } = stubAdapter({ 'convoy-plan': fence(clash) })
379
379
  const outcome = await plan(adapter)
380
- expect(count(calls, 'fix-convoy')).toBe(2)
380
+ expect(count(calls, 'convoy-plan-fix')).toBe(2)
381
381
  expect(outcome.problems).toEqual([])
382
382
  expect(outcome.plan.tasks[1].depends_on).toEqual(['a'])
383
383
  })
384
384
 
385
385
  it('reviews the plan only for --yes, and keeps a revision only if it still passes', async () => {
386
386
  const { adapter, calls } = stubAdapter({
387
- 'validate-convoy': fence({ valid: false, issues: ['toggle: needs the theme docs'] }),
388
- 'fix-convoy': fence([{ task_id: 'toggle', field: 'prompt', value: 'Add the toggle; read docs first.' }]),
387
+ 'convoy-plan-review': fence({ valid: false, issues: ['toggle: needs the theme docs'] }),
388
+ 'convoy-plan-fix': fence([{ task_id: 'toggle', field: 'prompt', value: 'Add the toggle; read docs first.' }]),
389
389
  })
390
390
  const outcome = await plan(adapter, { critic: true })
391
- expect(templates(calls).slice(-2)).toEqual(['validate-convoy', 'fix-convoy'])
391
+ expect(templates(calls).slice(-2)).toEqual(['convoy-plan-review', 'convoy-plan-fix'])
392
392
  expect(calls).toHaveLength(7)
393
393
  expect(outcome.plan.tasks[1].prompt).toBe('Add the toggle; read docs first.')
394
394
 
395
395
  const broken = stubAdapter({
396
- 'validate-convoy': fence({ valid: false, issues: ['x'] }),
397
- 'fix-convoy': fence([{ task_id: 'toggle', field: 'depends_on', value: ['ghost'] }]),
396
+ 'convoy-plan-review': fence({ valid: false, issues: ['x'] }),
397
+ 'convoy-plan-fix': fence([{ task_id: 'toggle', field: 'depends_on', value: ['ghost'] }]),
398
398
  })
399
399
  const kept = await plan(broken.adapter, { critic: true })
400
400
  expect(kept.plan.tasks[1].depends_on).toEqual(['theme'])
@@ -405,7 +405,7 @@ describe('planConvoy: sessions', () => {
405
405
  // ── Chain groups ────────────────────────────────────────────────────────────
406
406
 
407
407
  describe('planConvoy: groups', () => {
408
- /** generate-convoy for a group waits until every group's session has started. */
408
+ /** convoy-plan for a group waits until every group's session has started. */
409
409
  function groupAnswers() {
410
410
  let started = 0
411
411
  let most = 0
@@ -442,9 +442,9 @@ describe('planConvoy: groups', () => {
442
442
  }
443
443
  const groups = groupAnswers()
444
444
  const { adapter } = stubAdapter({
445
- 'validate-prd': slow(fence({ valid: true })),
446
- 'assess-complexity': slow(fence(CHAIN)),
447
- 'generate-convoy': groups.answer,
445
+ 'convoy-prd-review': slow(fence({ valid: true })),
446
+ 'convoy-assess': slow(fence(CHAIN)),
447
+ 'convoy-plan': groups.answer,
448
448
  })
449
449
  await plan(adapter)
450
450
  expect(most).toBe(2)
@@ -452,20 +452,20 @@ describe('planConvoy: groups', () => {
452
452
 
453
453
  it('plans every group at the same time, from its own part of the PRD', async () => {
454
454
  const groups = groupAnswers()
455
- const { adapter, calls } = stubAdapter({ 'assess-complexity': fence(CHAIN), 'generate-convoy': groups.answer })
455
+ const { adapter, calls } = stubAdapter({ 'convoy-assess': fence(CHAIN), 'convoy-plan': groups.answer })
456
456
  await plan(adapter)
457
457
  expect(groups.most()).toBe(3)
458
- expect(calls.filter((c) => c.template === 'generate-convoy' && c.prompt.includes('**Group name:**'))).toHaveLength(3)
458
+ expect(calls.filter((c) => c.template === 'convoy-plan' && c.prompt.includes('**Group name:**'))).toHaveLength(3)
459
459
  // The request is sized (beside its dropped plan), then the PRD again:
460
460
  // groups name the PRD's phases.
461
461
  expect(calls).toHaveLength(8)
462
- const docs = calls.find((c) => c.template === 'generate-convoy' && c.prompt.includes('**Group name:** docs'))!
462
+ const docs = calls.find((c) => c.template === 'convoy-plan' && c.prompt.includes('**Group name:** docs'))!
463
463
  expect(docs.prompt).not.toContain('Phase 1 — Theme')
464
464
  })
465
465
 
466
466
  it('joins the groups into one spec that keeps their dependencies', async () => {
467
467
  const groups = groupAnswers()
468
- const { adapter } = stubAdapter({ 'assess-complexity': fence(CHAIN), 'generate-convoy': groups.answer })
468
+ const { adapter } = stubAdapter({ 'convoy-assess': fence(CHAIN), 'convoy-plan': groups.answer })
469
469
  const outcome = await plan(adapter)
470
470
  expect(readdirSync(join(root, '.opencastle', 'convoys')).filter((f) => f.endsWith('.convoy.yml'))).toHaveLength(1)
471
471
  const spec = yamlParse(readFileSync(outcome.specPath, 'utf8'))
@@ -497,7 +497,7 @@ describe('planConvoy: the spec', () => {
497
497
 
498
498
  it('reduces a glob the planner wrote to a directory', async () => {
499
499
  const globbed = { ...PLAN, tasks: [{ ...PLAN.tasks[0], files: ['src/theme/**/*.ts'] }, PLAN.tasks[1]] }
500
- const { adapter } = stubAdapter({ 'generate-convoy': fence(globbed) })
500
+ const { adapter } = stubAdapter({ 'convoy-plan': fence(globbed) })
501
501
  const outcome = await plan(adapter)
502
502
  expect(outcome.plan.tasks[0].files).toEqual(['src/theme/'])
503
503
  })
@@ -526,17 +526,17 @@ describe('planConvoy: the complexity cache', () => {
526
526
  const prdPath = writePrd(PRD)
527
527
  const first = stubAdapter()
528
528
  await plan(first.adapter, { task: undefined, prdPath })
529
- expect(count(first.calls, 'assess-complexity')).toBe(1)
530
- expect(count(first.calls, 'generate-prd')).toBe(0)
529
+ expect(count(first.calls, 'convoy-assess')).toBe(1)
530
+ expect(count(first.calls, 'convoy-prd')).toBe(0)
531
531
 
532
532
  const second = stubAdapter()
533
533
  await plan(second.adapter, { task: undefined, prdPath })
534
- expect(count(second.calls, 'assess-complexity')).toBe(0)
534
+ expect(count(second.calls, 'convoy-assess')).toBe(0)
535
535
 
536
536
  writePrd(PRD + '\nOne more line.\n')
537
537
  const third = stubAdapter()
538
538
  await plan(third.adapter, { task: undefined, prdPath })
539
- expect(count(third.calls, 'assess-complexity')).toBe(1)
539
+ expect(count(third.calls, 'convoy-assess')).toBe(1)
540
540
  })
541
541
 
542
542
  it('ignores an assessment of different text at the same path', async () => {
@@ -545,7 +545,7 @@ describe('planConvoy: the complexity cache', () => {
545
545
  writeFileSync(deriveComplexityPath(prdPath), JSON.stringify(stale))
546
546
  const { adapter, calls } = stubAdapter()
547
547
  await plan(adapter, { task: undefined, prdPath })
548
- expect(count(calls, 'assess-complexity')).toBe(1)
548
+ expect(count(calls, 'convoy-assess')).toBe(1)
549
549
  const cached = JSON.parse(readFileSync(deriveComplexityPath(prdPath), 'utf8'))
550
550
  expect(cached.prd_sha256).toBe(hashPrd(PRD))
551
551
  expect(cached.recommended_strategy).toBe('single')
@@ -605,7 +605,7 @@ describe('convoy "<task>": show the plan, ask once', () => {
605
605
  await planTask({ args: ['--yes'], pkgRoot }, 'add dark mode')
606
606
  expect(promptModule.confirm).not.toHaveBeenCalled()
607
607
  expect(runModule.runSpec).toHaveBeenCalledWith(runArgs(), { runtime: resolved(stub.adapter) })
608
- expect(count(stub.calls, 'validate-convoy')).toBe(1)
608
+ expect(count(stub.calls, 'convoy-plan-review')).toBe(1)
609
609
  })
610
610
 
611
611
  it('carries --concurrency through to the run', async () => {
@@ -633,7 +633,7 @@ describe('convoy "<task>": show the plan, ask once', () => {
633
633
  expect(text()).toMatch(/TASK\s+AGENT/)
634
634
  expect(promptModule.confirm).not.toHaveBeenCalled()
635
635
  expect(runModule.runSpec).not.toHaveBeenCalled()
636
- expect(count(stub.calls, 'validate-convoy')).toBe(0)
636
+ expect(count(stub.calls, 'convoy-plan-review')).toBe(0)
637
637
  expect(text()).toContain('opencastle convoy run .opencastle/convoys/dark-mode.convoy.yml')
638
638
  })
639
639
 
@@ -660,13 +660,13 @@ describe('convoy "<task>": show the plan, ask once', () => {
660
660
  writeFileSync(prd, PRD)
661
661
  vi.mocked(promptModule.confirm).mockResolvedValue(false)
662
662
  await pipeline({ args: ['--prd', 'my.prd.md'], pkgRoot })
663
- expect(count(stub.calls, 'generate-prd')).toBe(0)
663
+ expect(count(stub.calls, 'convoy-prd')).toBe(0)
664
664
  expect(existsSync(specFile())).toBe(true)
665
665
  })
666
666
 
667
667
  it('does not offer to run a plan that fails its checks', async () => {
668
668
  const bad = { ...PLAN, tasks: [PLAN.tasks[0], { ...PLAN.tasks[1], timeout: 'soon' }] }
669
- stub = stubAdapter({ 'generate-convoy': fence(bad) })
669
+ stub = stubAdapter({ 'convoy-plan': fence(bad) })
670
670
  vi.mocked(adapters.resolveAdapter).mockResolvedValue(resolved(stub.adapter))
671
671
  const exit = vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
672
672
  throw new Error(`exit ${code}`)
@@ -335,7 +335,7 @@ async function writeCachedComplexity(prdPath: string, prdContent: string, assess
335
335
 
336
336
  // ── Planning ────────────────────────────────────────────────────────────────
337
337
 
338
- /** Rounds of fix-prd, and of fix-convoy, before the planner stops asking. */
338
+ /** Rounds of convoy-prd-fix, and of convoy-plan-fix, before the planner stops asking. */
339
339
  const MAX_FIX_ROUNDS = 2
340
340
 
341
341
  export interface PlanRequest {
@@ -352,7 +352,7 @@ export interface PlanRequest {
352
352
  projectRoot?: string
353
353
  verbose?: boolean
354
354
  /**
355
- * Have validate-convoy review the plan. Only when nobody will read it before
355
+ * Have convoy-plan-review review the plan. Only when nobody will read it before
356
356
  * it runs (`--yes`): a person looking at the plan is the better reviewer,
357
357
  * and the session is skipped for them.
358
358
  */
@@ -415,7 +415,7 @@ async function settleAll<T>(work: Array<Promise<T>>): Promise<T[]> {
415
415
  return settled.map((s) => (s as PromiseFulfilledResult<T>).value)
416
416
  }
417
417
 
418
- /** generate-convoy, with the one retry an unreadable answer gets. */
418
+ /** convoy-plan, with the one retry an unreadable answer gets. */
419
419
  async function generatePlan(
420
420
  step: StepRunner,
421
421
  goal: string,
@@ -428,7 +428,7 @@ async function generatePlan(
428
428
  let raw = ''
429
429
  let reason = ''
430
430
  for (let attempt = 1; attempt <= 2; attempt++) {
431
- raw = (await step('generate-convoy', { goalText: goal, contextText: context, signal, onStart })).rawOutput
431
+ raw = (await step('convoy-plan', { goalText: goal, contextText: context, signal, onStart })).rawOutput
432
432
  const parsed = parseTaskPlanWithReason(raw)
433
433
  if (parsed.plan) return parsed.plan
434
434
  reason = parsed.reason ?? 'unreadable'
@@ -440,9 +440,9 @@ async function generatePlan(
440
440
  throw new Error(`The ${label} plan could not be read after a retry: ${reason}. The answer is in ${relPath(kept)}.`)
441
441
  }
442
442
 
443
- /** One fix-convoy round: patches applied to the plan, globs reduced again. */
443
+ /** One convoy-plan-fix round: patches applied to the plan, globs reduced again. */
444
444
  async function fixPlan(step: StepRunner, plan: TaskPlan, problems: string): Promise<TaskPlan> {
445
- const answer = await step('fix-convoy', { goalText: JSON.stringify(plan, null, 2), contextText: problems })
445
+ const answer = await step('convoy-plan-fix', { goalText: JSON.stringify(plan, null, 2), contextText: problems })
446
446
  const patches = parsePatches(answer.rawOutput)
447
447
  if (!patches?.length) {
448
448
  warn('No usable patches came back')
@@ -493,19 +493,19 @@ function speculate<T>(start: (signal: AbortSignal, onStart: () => void) => Promi
493
493
  * From a request (or an edited PRD) to a checked spec on disk.
494
494
  *
495
495
  * Sessions, all read-only, on the one adapter the caller resolved:
496
- * - assess-complexity on the request, beside a plan written straight from it,
496
+ * - convoy-assess on the request, beside a plan written straight from it,
497
497
  * which is kept when the change is small and stopped when it is not;
498
- * - generate-prd, unless a PRD was given;
499
- * - validate-prd beside the plan from the PRD when how to plan it is already
500
- * known, or beside assess-complexity on the PRD when it is not, which is
501
- * skipped when this exact PRD was assessed before; up to two fix-prd +
502
- * validate-prd rounds, and the plan is written again from the fixed PRD;
503
- * - generate-convoy, once, or once per group at the same time for a large
498
+ * - convoy-prd, unless a PRD was given;
499
+ * - convoy-prd-review beside the plan from the PRD when how to plan it is already
500
+ * known, or beside convoy-assess on the PRD when it is not, which is
501
+ * skipped when this exact PRD was assessed before; up to two convoy-prd-fix +
502
+ * convoy-prd-review rounds, and the plan is written again from the fixed PRD;
503
+ * - convoy-plan, once, or once per group at the same time for a large
504
504
  * feature; one retry when an answer cannot be read;
505
- * - fix-convoy only when the code's checks fail, at most twice;
506
- * - validate-convoy only as the reviewer for `--yes`.
505
+ * - convoy-plan-fix only when the code's checks fail, at most twice;
506
+ * - convoy-plan-review only as the reviewer for `--yes`.
507
507
  *
508
- * The semantic validate-convoy pass that followed every plan is gone: the
508
+ * The semantic convoy-plan-review pass that followed every plan is gone: the
509
509
  * checks it was there for are done in code, and a person reads the plan
510
510
  * before it runs.
511
511
  */
@@ -563,9 +563,9 @@ export async function planConvoy(req: PlanRequest): Promise<PlanOutcome> {
563
563
  if (!req.prdPath && req.task) {
564
564
  const task = req.task
565
565
  const direct = speculate((signal, onStart) => generatePlan(step, task, NO_PRD, 'task', convoyDir, signal, onStart))
566
- drafting = speculate((signal, onStart) => step('generate-prd', { goalText: task, signal, onStart }))
566
+ drafting = speculate((signal, onStart) => step('convoy-prd', { goalText: task, signal, onStart }))
567
567
  await Promise.all([direct.started, drafting.started])
568
- quick = await step('assess-complexity', { goalText: task, contextText: task })
568
+ quick = await step('convoy-assess', { goalText: task, contextText: task })
569
569
  .then((r) => parseComplexityAssessment(r.rawOutput))
570
570
  .catch(() => null)
571
571
  if (quick?.complexity === 'low' && quick.recommended_strategy !== 'chain') {
@@ -589,13 +589,13 @@ export async function planConvoy(req: PlanRequest): Promise<PlanOutcome> {
589
589
  prdPath = resolve(root, req.prdPath)
590
590
  done('PRD', relPath(prdPath))
591
591
  } else {
592
- const written = drafting ? await drafting.value : await step('generate-prd', { goalText: req.task ?? '' })
592
+ const written = drafting ? await drafting.value : await step('convoy-prd', { goalText: req.task ?? '' })
593
593
  prdPath = written.outputPath!
594
594
  done('PRD written', relPath(prdPath))
595
595
  }
596
596
  let prd = await readFile(prdPath!, 'utf8')
597
597
 
598
- // Both only read the PRD, so they run side by side. fix-prd is told to keep
598
+ // Both only read the PRD, so they run side by side. convoy-prd-fix is told to keep
599
599
  // the PRD's phases, so the assessment of this draft still fits a fixed one;
600
600
  // it is cached under this draft's text, which is the text it describes.
601
601
  const cached = await readCachedComplexity(prdPath, prd)
@@ -617,10 +617,10 @@ export async function planConvoy(req: PlanRequest): Promise<PlanOutcome> {
617
617
  let complexity: ComplexityAssessment | null
618
618
  try {
619
619
  ;[verdict, complexity] = await settleAll<PromptStepResult | ComplexityAssessment | null>([
620
- step('validate-prd', { goalText: `<!-- validation-pass: 1 -->\n${prd}` }),
620
+ step('convoy-prd-review', { goalText: `<!-- validation-pass: 1 -->\n${prd}` }),
621
621
  known
622
622
  ? Promise.resolve(known)
623
- : step('assess-complexity', { goalText: prd, contextText: req.task ?? '' })
623
+ : step('convoy-assess', { goalText: prd, contextText: req.task ?? '' })
624
624
  .then((r) => parseComplexityAssessment(r.rawOutput))
625
625
  .catch((err: unknown) => {
626
626
  warn(`Could not size the work (${message(err)}) — planning it as one`)
@@ -644,9 +644,9 @@ export async function planConvoy(req: PlanRequest): Promise<PlanOutcome> {
644
644
  for (let round = 1; round <= MAX_FIX_ROUNDS && !fixed; round++) {
645
645
  warn(`The PRD has issues — fixing (${round}/${MAX_FIX_ROUNDS})`)
646
646
  console.log(indented(issues))
647
- await step('fix-prd', { goalText: prd, contextText: issues, outputPath: prdPath })
647
+ await step('convoy-prd-fix', { goalText: prd, contextText: issues, outputPath: prdPath })
648
648
  prd = await readFile(prdPath, 'utf8')
649
- const again = await step('validate-prd', { goalText: `<!-- validation-pass: ${round + 1} -->\n${prd}` })
649
+ const again = await step('convoy-prd-review', { goalText: `<!-- validation-pass: ${round + 1} -->\n${prd}` })
650
650
  fixed = again.isValid === true
651
651
  if (!fixed) issues = again.errors || again.rawOutput
652
652
  }
@@ -743,7 +743,7 @@ export async function planConvoy(req: PlanRequest): Promise<PlanOutcome> {
743
743
  if (problems.length === 0) done('Plan checked')
744
744
 
745
745
  if (req.critic && problems.length === 0) {
746
- const review = await step('validate-convoy', { goalText: buildConvoyYaml(plan, settings) })
746
+ const review = await step('convoy-plan-review', { goalText: buildConvoyYaml(plan, settings) })
747
747
  if (review.isValid) {
748
748
  done('Plan reviewed')
749
749
  } else {
@@ -820,13 +820,13 @@ function describeSpend(s: PlanningSpend): string {
820
820
  // ── The command ─────────────────────────────────────────────────────────────
821
821
 
822
822
  const HELP = `
823
- opencastle convoy plan --prd <file> [options]
823
+ npx opencastle convoy plan --prd <file> [options]
824
824
 
825
825
  Plan again from a PRD you edited. The PRD is checked, broken into tasks and
826
826
  written as a spec; you see the plan and are asked before it runs.
827
827
 
828
828
  Options:
829
- --prd <file> The PRD to plan from (opencastle convoy "<task>" writes
829
+ --prd <file> The PRD to plan from (npx opencastle convoy "<task>" writes
830
830
  them to .opencastle/prds/)
831
831
  --yes, -y Run the plan without asking
832
832
  --dry-run Plan and write the spec, but do not run it
@@ -866,7 +866,7 @@ function parseArgs(args: string[], allowPrd: boolean): CliOptions {
866
866
  break
867
867
  case '--prd':
868
868
  if (!allowPrd) {
869
- console.error(` ✗ --prd belongs to \`opencastle convoy plan\`: plan from a task or from a PRD, not both.`)
869
+ console.error(` ✗ --prd belongs to \`npx opencastle convoy plan\`: plan from a task or from a PRD, not both.`)
870
870
  process.exit(1)
871
871
  }
872
872
  opts.prd = value(i++, arg)
@@ -928,7 +928,7 @@ async function chooseRuntime(projectRoot: string, explicit: string | null): Prom
928
928
  async function planThenRun(source: { task: string } | { prd: string }, opts: CliOptions, pkgRoot: string): Promise<void> {
929
929
  const projectRoot = process.cwd()
930
930
  const runtime = await chooseRuntime(findProjectRoot(projectRoot) ?? projectRoot, opts.adapter)
931
- console.log(`\n ${c.bold('opencastle convoy')} ${c.dim('— planning, read-only')}`)
931
+ console.log(`\n ${c.bold('npx opencastle convoy')} ${c.dim('— planning, read-only')}`)
932
932
  console.log(` ${c.dim('Runtime:')} ${runtime.detail}\n`)
933
933
 
934
934
  let outcome: PlanOutcome
@@ -949,7 +949,7 @@ async function planThenRun(source: { task: string } | { prd: string }, opts: Cli
949
949
  }
950
950
 
951
951
  for (const row of renderPlan(outcome, process.stdout.columns ?? 100)) console.log(row)
952
- const later = `opencastle convoy run ${relPath(outcome.specPath)}`
952
+ const later = `npx opencastle convoy run ${relPath(outcome.specPath)}`
953
953
 
954
954
  if (outcome.problems.length > 0) {
955
955
  console.error(` ${c.red('✗')} The plan still fails these checks, so it was not started:`)
@@ -1003,7 +1003,7 @@ export default async function pipeline({ args, pkgRoot }: CliContext): Promise<v
1003
1003
  return
1004
1004
  }
1005
1005
  if (opts.prd === null) {
1006
- console.error(' ✗ Name the PRD to plan from: opencastle convoy plan --prd <file>')
1006
+ console.error(' ✗ Name the PRD to plan from: npx opencastle convoy plan --prd <file>')
1007
1007
  console.log(HELP)
1008
1008
  process.exit(1)
1009
1009
  }