opencastle 1.6.1 → 1.6.3

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 (148) hide show
  1. package/bin/cli.mjs +13 -8
  2. package/dist/cli/add.js +7 -7
  3. package/dist/cli/add.js.map +1 -1
  4. package/dist/cli/baseline.js +6 -6
  5. package/dist/cli/baseline.js.map +1 -1
  6. package/dist/cli/bootstrap.d.ts.map +1 -1
  7. package/dist/cli/bootstrap.js +14 -5
  8. package/dist/cli/bootstrap.js.map +1 -1
  9. package/dist/cli/bootstrap.test.js +8 -0
  10. package/dist/cli/bootstrap.test.js.map +1 -1
  11. package/dist/cli/ci.d.ts.map +1 -1
  12. package/dist/cli/ci.js +19 -9
  13. package/dist/cli/ci.js.map +1 -1
  14. package/dist/cli/convoy/engine.js +1 -1
  15. package/dist/cli/convoy/engine.js.map +1 -1
  16. package/dist/cli/convoy/engine.test.js +1 -1
  17. package/dist/cli/convoy/engine.test.js.map +1 -1
  18. package/dist/cli/convoy/spec-builder.js +2 -2
  19. package/dist/cli/convoy/spec-builder.js.map +1 -1
  20. package/dist/cli/convoy/spec-builder.test.js +2 -2
  21. package/dist/cli/convoy/spec-builder.test.js.map +1 -1
  22. package/dist/cli/convoy-cmd.js +16 -16
  23. package/dist/cli/convoy-cmd.js.map +1 -1
  24. package/dist/cli/convoy-cmd.test.js +11 -11
  25. package/dist/cli/convoy-cmd.test.js.map +1 -1
  26. package/dist/cli/dashboard.js +2 -2
  27. package/dist/cli/dashboard.js.map +1 -1
  28. package/dist/cli/dispatcher.test.js +2 -2
  29. package/dist/cli/dispatcher.test.js.map +1 -1
  30. package/dist/cli/doctor.js +17 -17
  31. package/dist/cli/doctor.js.map +1 -1
  32. package/dist/cli/explain.js +2 -2
  33. package/dist/cli/explain.js.map +1 -1
  34. package/dist/cli/fleet.js +1 -1
  35. package/dist/cli/github-report.js +5 -5
  36. package/dist/cli/github-report.js.map +1 -1
  37. package/dist/cli/gitignore.js +1 -1
  38. package/dist/cli/gitignore.js.map +1 -1
  39. package/dist/cli/init.d.ts.map +1 -1
  40. package/dist/cli/init.js +27 -10
  41. package/dist/cli/init.js.map +1 -1
  42. package/dist/cli/layers.js +4 -4
  43. package/dist/cli/layers.js.map +1 -1
  44. package/dist/cli/lesson.js +12 -12
  45. package/dist/cli/lesson.js.map +1 -1
  46. package/dist/cli/lessons.d.ts.map +1 -1
  47. package/dist/cli/lessons.js +11 -7
  48. package/dist/cli/lessons.js.map +1 -1
  49. package/dist/cli/managed-block.js +1 -1
  50. package/dist/cli/managed-block.js.map +1 -1
  51. package/dist/cli/mcp-audit.js +6 -6
  52. package/dist/cli/mcp-audit.js.map +1 -1
  53. package/dist/cli/mcp-audit.test.js +5 -5
  54. package/dist/cli/mcp-audit.test.js.map +1 -1
  55. package/dist/cli/pipeline.js +6 -6
  56. package/dist/cli/pipeline.js.map +1 -1
  57. package/dist/cli/plugin.js +8 -8
  58. package/dist/cli/plugin.js.map +1 -1
  59. package/dist/cli/promote.js +5 -5
  60. package/dist/cli/promote.js.map +1 -1
  61. package/dist/cli/prompt.d.ts.map +1 -1
  62. package/dist/cli/prompt.js +15 -2
  63. package/dist/cli/prompt.js.map +1 -1
  64. package/dist/cli/prompt.test.js +33 -8
  65. package/dist/cli/prompt.test.js.map +1 -1
  66. package/dist/cli/remove.js +1 -1
  67. package/dist/cli/review.js +3 -3
  68. package/dist/cli/review.js.map +1 -1
  69. package/dist/cli/run/adapters/index.js +3 -3
  70. package/dist/cli/run/adapters/index.js.map +1 -1
  71. package/dist/cli/run/adapters/index.test.js +3 -3
  72. package/dist/cli/run/adapters/index.test.js.map +1 -1
  73. package/dist/cli/run/schema.js +3 -3
  74. package/dist/cli/run/schema.js.map +1 -1
  75. package/dist/cli/run.js +21 -21
  76. package/dist/cli/run.js.map +1 -1
  77. package/dist/cli/run.test.js +3 -3
  78. package/dist/cli/run.test.js.map +1 -1
  79. package/dist/cli/stack-config-update.test.js +18 -1
  80. package/dist/cli/stack-config-update.test.js.map +1 -1
  81. package/dist/cli/stack-config.d.ts.map +1 -1
  82. package/dist/cli/stack-config.js +10 -1
  83. package/dist/cli/stack-config.js.map +1 -1
  84. package/dist/cli/status.js +9 -9
  85. package/dist/cli/status.js.map +1 -1
  86. package/dist/cli/status.test.js +3 -3
  87. package/dist/cli/status.test.js.map +1 -1
  88. package/dist/cli/sync-check.js +16 -16
  89. package/dist/cli/sync-check.js.map +1 -1
  90. package/dist/cli/sync.js +1 -1
  91. package/dist/cli/team-ci.test.js +3 -3
  92. package/dist/cli/team-ci.test.js.map +1 -1
  93. package/dist/cli/team-commands.test.js +30 -1
  94. package/dist/cli/team-commands.test.js.map +1 -1
  95. package/dist/cli/update.d.ts.map +1 -1
  96. package/dist/cli/update.js +33 -8
  97. package/dist/cli/update.js.map +1 -1
  98. package/package.json +1 -1
  99. package/src/cli/add.ts +7 -7
  100. package/src/cli/baseline.ts +6 -6
  101. package/src/cli/bootstrap.test.ts +9 -0
  102. package/src/cli/bootstrap.ts +15 -5
  103. package/src/cli/ci.ts +17 -9
  104. package/src/cli/convoy/engine.test.ts +1 -1
  105. package/src/cli/convoy/engine.ts +1 -1
  106. package/src/cli/convoy/spec-builder.test.ts +2 -2
  107. package/src/cli/convoy/spec-builder.ts +2 -2
  108. package/src/cli/convoy-cmd.test.ts +11 -11
  109. package/src/cli/convoy-cmd.ts +18 -18
  110. package/src/cli/dashboard.ts +2 -2
  111. package/src/cli/dispatcher.test.ts +2 -2
  112. package/src/cli/doctor.ts +17 -17
  113. package/src/cli/explain.ts +2 -2
  114. package/src/cli/fleet.ts +1 -1
  115. package/src/cli/github-report.ts +5 -5
  116. package/src/cli/gitignore.ts +1 -1
  117. package/src/cli/init.ts +26 -10
  118. package/src/cli/layers.ts +4 -4
  119. package/src/cli/lesson.ts +12 -12
  120. package/src/cli/lessons.ts +11 -7
  121. package/src/cli/managed-block.ts +1 -1
  122. package/src/cli/mcp-audit.test.ts +5 -5
  123. package/src/cli/mcp-audit.ts +6 -6
  124. package/src/cli/pipeline.ts +6 -6
  125. package/src/cli/plugin.ts +8 -8
  126. package/src/cli/promote.ts +5 -5
  127. package/src/cli/prompt.test.ts +41 -13
  128. package/src/cli/prompt.ts +14 -2
  129. package/src/cli/remove.ts +1 -1
  130. package/src/cli/review.ts +3 -3
  131. package/src/cli/run/adapters/index.test.ts +3 -3
  132. package/src/cli/run/adapters/index.ts +3 -3
  133. package/src/cli/run/schema.ts +3 -3
  134. package/src/cli/run.test.ts +3 -3
  135. package/src/cli/run.ts +21 -21
  136. package/src/cli/stack-config-update.test.ts +22 -1
  137. package/src/cli/stack-config.ts +9 -1
  138. package/src/cli/status.test.ts +3 -3
  139. package/src/cli/status.ts +9 -9
  140. package/src/cli/sync-check.ts +16 -16
  141. package/src/cli/sync.ts +1 -1
  142. package/src/cli/team-ci.test.ts +3 -3
  143. package/src/cli/team-commands.test.ts +32 -1
  144. package/src/cli/update.ts +31 -8
  145. package/src/orchestrator/customizations/LESSONS-LEARNED.md +5 -3
  146. package/src/orchestrator/customizations/README.md +5 -2
  147. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +6 -2
  148. package/src/orchestrator/skills/documentation-standards/SKILL.md +1 -1
@@ -139,8 +139,8 @@ describe('buildConvoyYaml', () => {
139
139
 
140
140
  it('starts with a comment saying how to run it', () => {
141
141
  const yaml = buildConvoyYaml(minimalPlan(), SETTINGS)
142
- expect(yaml.startsWith('# Written by `opencastle convoy`.')).toBe(true)
143
- expect(yaml).toContain('opencastle convoy run <this file>')
142
+ expect(yaml.startsWith('# Written by `npx opencastle convoy`.')).toBe(true)
143
+ expect(yaml).toContain('npx opencastle convoy run <this file>')
144
144
  })
145
145
 
146
146
  it('ensures prompt appears last in each task YAML block', () => {
@@ -210,8 +210,8 @@ export function buildConvoyYaml(plan: TaskPlan, settings: SpecSettings): string
210
210
  spec.tasks = tasks
211
211
 
212
212
  const header =
213
- '# Written by `opencastle convoy`. Edit it if you like, then run it with:\n' +
214
- '# opencastle convoy run <this file>\n'
213
+ '# Written by `npx opencastle convoy`. Edit it if you like, then run it with:\n' +
214
+ '# npx opencastle convoy run <this file>\n'
215
215
  return header + stringify(spec, { lineWidth: 120, defaultKeyType: 'PLAIN', defaultStringType: 'PLAIN' })
216
216
  }
217
217
 
@@ -70,23 +70,23 @@ describe('readLastRun', () => {
70
70
 
71
71
  it('counts every failed status as failed', () => {
72
72
  seed([{ id: 'a', status: 'failed', created: '2026-10-01T00:00:00Z', tasks: ['done', 'failed', 'gate-failed', 'timed-out', 'review-blocked', 'disputed', 'hook-failed'] }])
73
- expect(readLastRun(root)).toMatchObject({ total: 7, done: 1, failed: 6, next: 'opencastle convoy resume' })
73
+ expect(readLastRun(root)).toMatchObject({ total: 7, done: 1, failed: 6, next: 'npx opencastle convoy resume' })
74
74
  })
75
75
 
76
76
  it('does not call a run finished while a task was skipped, even when it says "done"', () => {
77
77
  seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done', 'skipped'] }])
78
- expect(readLastRun(root)).toMatchObject({ done: 1, skipped: 1, failed: 0, next: 'opencastle convoy resume' })
78
+ expect(readLastRun(root)).toMatchObject({ done: 1, skipped: 1, failed: 0, next: 'npx opencastle convoy resume' })
79
79
  })
80
80
 
81
81
  it('treats a running task in a dead run as not done', () => {
82
82
  seed([{ id: 'a', status: 'running', created: '2026-10-01T00:00:00Z', tasks: ['done', 'running'] }])
83
- expect(readLastRun(root)).toMatchObject({ running: 1, alive: false, next: 'opencastle convoy resume' })
83
+ expect(readLastRun(root)).toMatchObject({ running: 1, alive: false, next: 'npx opencastle convoy resume' })
84
84
  })
85
85
 
86
86
  it('points at the live view while a process is working on the run', () => {
87
87
  seed([{ id: 'a', status: 'running', created: new Date().toISOString(), tasks: ['running', 'pending'] }])
88
88
  holdLock()
89
- expect(readLastRun(root)).toMatchObject({ alive: true, next: 'opencastle convoy dashboard' })
89
+ expect(readLastRun(root)).toMatchObject({ alive: true, next: 'npx opencastle convoy dashboard' })
90
90
  })
91
91
 
92
92
  it('offers a new run when every task is done, and names an older run with work left', () => {
@@ -95,7 +95,7 @@ describe('readLastRun', () => {
95
95
  { id: 'new', status: 'done', created: '2026-10-02T00:00:00Z', tasks: ['done', 'done'] },
96
96
  ])
97
97
  expect(readLastRun(root)).toMatchObject({
98
- id: 'new', done: 2, total: 2, next: 'opencastle convoy "<task>"', older_unfinished: { id: 'old', name: 'Run old' },
98
+ id: 'new', done: 2, total: 2, next: 'npx opencastle convoy "<task>"', older_unfinished: { id: 'old', name: 'Run old' },
99
99
  })
100
100
  })
101
101
 
@@ -112,14 +112,14 @@ describe('opencastle convoy (status)', () => {
112
112
  seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done', 'skipped'] }])
113
113
  await convoy({ args: [], pkgRoot: root })
114
114
  expect(text()).toMatch(/1\/2 done, 1 skipped/)
115
- expect(text()).toContain('Next: opencastle convoy resume')
115
+ expect(text()).toContain('Next: npx opencastle convoy resume')
116
116
  expect(text()).not.toMatch(/every task is done|Nothing outstanding/)
117
117
  })
118
118
 
119
119
  it('prints JSON with --json', async () => {
120
120
  seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done'] }])
121
121
  await convoy({ args: ['--json'], pkgRoot: root })
122
- expect(JSON.parse(text())).toMatchObject({ id: 'a', done: 1, total: 1, next: 'opencastle convoy "<task>"' })
122
+ expect(JSON.parse(text())).toMatchObject({ id: 'a', done: 1, total: 1, next: 'npx opencastle convoy "<task>"' })
123
123
  })
124
124
 
125
125
  it('says how to start when there are no runs', async () => {
@@ -135,17 +135,17 @@ describe('opencastle convoy (what it refuses before planning anything)', () => {
135
135
  }
136
136
 
137
137
  it('reads a mistyped subcommand as a typo, not a task', async () => {
138
- expect(await refused(['resum'])).toContain('Did you mean opencastle convoy resume?')
138
+ expect(await refused(['resum'])).toContain('Did you mean npx opencastle convoy resume?')
139
139
  })
140
140
 
141
141
  it('does not plan a one-word task such as "status"', async () => {
142
142
  const said = await refused(['status'])
143
143
  expect(said).toContain('"status" is one word')
144
- expect(said).toContain('For the last run: opencastle convoy')
144
+ expect(said).toContain('For the last run: npx opencastle convoy')
145
145
  })
146
146
 
147
147
  it('names what replaced a removed flag', async () => {
148
- expect(await refused(['--retry-failed'])).toContain('--retry-failed was removed. Use: opencastle convoy resume')
148
+ expect(await refused(['--retry-failed'])).toContain('--retry-failed was removed. Use: npx opencastle convoy resume')
149
149
  expect(await refused(['add', 'rate', 'limiting', '--status'])).toContain('--status was removed')
150
150
  })
151
151
 
@@ -158,6 +158,6 @@ describe('opencastle convoy (what it refuses before planning anything)', () => {
158
158
  })
159
159
 
160
160
  it('sends a subcommand flag to its subcommand', async () => {
161
- expect(await refused(['-f', 'spec.yml'])).toContain('-f belongs to `opencastle convoy run`')
161
+ expect(await refused(['-f', 'spec.yml'])).toContain('-f belongs to `npx opencastle convoy run`')
162
162
  })
163
163
  })
@@ -14,17 +14,17 @@ import type { CliContext } from './types.js'
14
14
  */
15
15
 
16
16
  const CONVOY_HELP = `
17
- opencastle convoy [task] [options]
17
+ npx opencastle convoy [task] [options]
18
18
 
19
19
  Experimental: plan multi-step work and run it with agents in parallel.
20
20
 
21
21
  Usage:
22
- opencastle convoy The last run and the one next step
23
- opencastle convoy "<task>" Plan it, show the plan, ask, then run it
24
- opencastle convoy run <spec.yml> Run a spec you wrote
25
- opencastle convoy resume Continue whatever is not done
26
- opencastle convoy dashboard The Observability dashboard, live
27
- opencastle convoy plan --prd <file> Plan again from a PRD you edited
22
+ npx opencastle convoy The last run and the one next step
23
+ npx opencastle convoy "<task>" Plan it, show the plan, ask, then run it
24
+ npx opencastle convoy run <spec.yml> Run a spec you wrote
25
+ npx opencastle convoy resume Continue whatever is not done
26
+ npx opencastle convoy dashboard The Observability dashboard, live
27
+ npx opencastle convoy plan --prd <file> Plan again from a PRD you edited
28
28
 
29
29
  Options:
30
30
  --yes, -y With a task: run the plan without asking
@@ -163,7 +163,7 @@ export function readLastRun(projectRoot: string): LastRun | null {
163
163
  running: count((s) => s === 'running' || s === 'assigned'),
164
164
  skipped: count((s) => s === 'skipped'),
165
165
  pending: count((s) => s === 'pending'),
166
- next: last.alive ? 'opencastle convoy dashboard' : notDone ? 'opencastle convoy resume' : 'opencastle convoy "<task>"',
166
+ next: last.alive ? 'npx opencastle convoy dashboard' : notDone ? 'npx opencastle convoy resume' : 'npx opencastle convoy "<task>"',
167
167
  older_unfinished: older ? { id: older.id, name: older.name } : null,
168
168
  }
169
169
  }
@@ -178,11 +178,11 @@ function renderStatus(last: LastRun | null, json: boolean): void {
178
178
  console.log(`\n 🚚 ${c.bold('Convoy')} ${c.dim('(experimental)')}\n`)
179
179
  if (!last) {
180
180
  console.log(' No runs yet.\n')
181
- console.log(` ${c.bold('Start one:')} ${c.cyan('opencastle convoy "add rate limiting to the API"')}\n`)
181
+ console.log(` ${c.bold('Start one:')} ${c.cyan('npx opencastle convoy "add rate limiting to the API"')}\n`)
182
182
  return
183
183
  }
184
184
 
185
- const resumable = last.next === 'opencastle convoy resume'
185
+ const resumable = last.next === 'npx opencastle convoy resume'
186
186
  const mark = last.alive ? c.cyan('▶') : resumable ? c.yellow('!') : c.green('✓')
187
187
  const state = last.alive ? 'running now' : last.status
188
188
  console.log(` ${mark} ${c.bold(last.name)} ${c.dim(`— ${state}`)}`)
@@ -203,7 +203,7 @@ function renderStatus(last: LastRun | null, json: boolean): void {
203
203
  console.log(` ${c.bold('Next:')} ${c.cyan(last.next)}`)
204
204
  console.log(` ${c.dim(why)}`)
205
205
  if (last.older_unfinished) {
206
- console.log(` ${c.dim(`An earlier run, ${last.older_unfinished.name}, has work left; opencastle convoy resume continues it.`)}`)
206
+ console.log(` ${c.dim(`An earlier run, ${last.older_unfinished.name}, has work left; npx opencastle convoy resume continues it.`)}`)
207
207
  }
208
208
  console.log('')
209
209
  }
@@ -273,8 +273,8 @@ export default async function convoy(ctx: CliContext): Promise<void> {
273
273
  if (misplaced) {
274
274
  const owner = SUBCOMMAND_FLAGS.get(misplaced)!
275
275
  refuse(
276
- `${misplaced} belongs to \`opencastle convoy ${owner}\`.`,
277
- `Try: opencastle convoy ${owner} ${args.slice(args.indexOf(misplaced)).join(' ')}`,
276
+ `${misplaced} belongs to \`npx opencastle convoy ${owner}\`.`,
277
+ `Try: npx opencastle convoy ${owner} ${args.slice(args.indexOf(misplaced)).join(' ')}`,
278
278
  )
279
279
  }
280
280
 
@@ -284,8 +284,8 @@ export default async function convoy(ctx: CliContext): Promise<void> {
284
284
  const stray = args.find((a) => a.startsWith('-') && a !== '--json')
285
285
  if (stray) {
286
286
  refuse(
287
- TASK_FLAGS.has(stray) ? `${stray} goes with a task: opencastle convoy "<task>" ${stray}` : await unknownFlag(stray, ['--json', ...TASK_FLAGS]),
288
- 'Run "opencastle convoy --help" for usage.',
287
+ TASK_FLAGS.has(stray) ? `${stray} goes with a task: npx opencastle convoy "<task>" ${stray}` : await unknownFlag(stray, ['--json', ...TASK_FLAGS]),
288
+ 'Run "npx opencastle convoy --help" for usage.',
289
289
  )
290
290
  }
291
291
  renderStatus(readLastRun(findProjectRoot(process.cwd()) ?? process.cwd()), args.includes('--json'))
@@ -299,10 +299,10 @@ export default async function convoy(ctx: CliContext): Promise<void> {
299
299
  if (words.length === 1 && !words[0].includes(' ')) {
300
300
  const near = nearest(words[0], SUBCOMMANDS)
301
301
  refuse(
302
- near ? `Unknown subcommand "${words[0]}". Did you mean opencastle convoy ${near}?` : `"${words[0]}" is one word; describe the task in a few.`,
302
+ near ? `Unknown subcommand "${words[0]}". Did you mean npx opencastle convoy ${near}?` : `"${words[0]}" is one word; describe the task in a few.`,
303
303
  near
304
- ? 'To plan a task, describe it in a few words: opencastle convoy "add rate limiting to the API"'
305
- : 'For example: opencastle convoy "add rate limiting to the API". For the last run: opencastle convoy',
304
+ ? 'To plan a task, describe it in a few words: npx opencastle convoy "add rate limiting to the API"'
305
+ : 'For example: npx opencastle convoy "add rate limiting to the API". For the last run: npx opencastle convoy',
306
306
  )
307
307
  }
308
308
 
@@ -211,7 +211,7 @@ export async function startDashboard(opts: DashboardOptions): Promise<DashboardH
211
211
  // ── command ───────────────────────────────────────────────────────────────────
212
212
 
213
213
  const HELP = `
214
- opencastle convoy dashboard [options]
214
+ npx opencastle convoy dashboard [options]
215
215
 
216
216
  Open the Observability dashboard: a live, read-only view of this project's
217
217
  convoy runs. Totals across every run; and for each run its tasks and what
@@ -253,7 +253,7 @@ export default async function dashboard({ args }: CliContext): Promise<void> {
253
253
  const parsed = parseDashboardArgs(args)
254
254
  if ('error' in parsed) {
255
255
  console.error(` ✗ ${parsed.error}`)
256
- console.error(' Run "opencastle convoy dashboard --help" for usage.')
256
+ console.error(' Run "npx opencastle convoy dashboard --help" for usage.')
257
257
  process.exit(1)
258
258
  }
259
259
  if (parsed.help) {
@@ -99,8 +99,8 @@ describe('removed commands', () => {
99
99
  })
100
100
 
101
101
  it('maps the destructive commands to their replacement flags', () => {
102
- expect(source).toContain("eject: 'opencastle remove --keep-files'")
103
- expect(source).toContain("destroy: 'opencastle remove --all'")
102
+ expect(source).toContain("eject: 'npx opencastle remove --keep-files'")
103
+ expect(source).toContain("destroy: 'npx opencastle remove --all'")
104
104
  })
105
105
 
106
106
  it('routes convoy execution commands into the namespace', () => {
package/src/cli/doctor.ts CHANGED
@@ -85,7 +85,7 @@ async function checkGitignoreBlock(projectRoot: string): Promise<CheckResult> {
85
85
  label,
86
86
  ok: false,
87
87
  detail: '.gitignore is missing — .env and the run artefacts are not ignored',
88
- fix: 'opencastle sync',
88
+ fix: 'npx opencastle sync',
89
89
  };
90
90
  }
91
91
 
@@ -103,7 +103,7 @@ async function checkGitignoreBlock(projectRoot: string): Promise<CheckResult> {
103
103
 
104
104
  const { gitignoreNeedsRebuild } = await import('./gitignore.js');
105
105
  const why = gitignoreNeedsRebuild(content);
106
- if (why) return { label, ok: false, detail: why, fix: 'opencastle sync' };
106
+ if (why) return { label, ok: false, detail: why, fix: 'npx opencastle sync' };
107
107
  return { label, ok: true, warning: false };
108
108
  }
109
109
 
@@ -117,7 +117,7 @@ function checkManifest(manifest: Manifest | null): CheckResult {
117
117
  ok: false,
118
118
  label: 'OpenCastle manifest (.opencastle/manifest.json)',
119
119
  detail: 'Not found. Run "npx opencastle init" first.',
120
- fix: 'opencastle init',
120
+ fix: 'npx opencastle init',
121
121
  };
122
122
  }
123
123
  // A manifest that parses but names no recognised target is not a healthy
@@ -130,7 +130,7 @@ function checkManifest(manifest: Manifest | null): CheckResult {
130
130
  ok: false,
131
131
  label: 'OpenCastle manifest (.opencastle/manifest.json)',
132
132
  detail: `names no target this release recognises (valid: ${VALID_IDES.join(', ')})`,
133
- fix: 'fix the "ides" field, or re-run opencastle init; this one needs a person',
133
+ fix: 'fix the "ides" field, or re-run npx opencastle init; this one needs a person',
134
134
  };
135
135
  }
136
136
  return { ok: true, label: 'OpenCastle manifest (.opencastle/manifest.json)', detail: `v${manifest.version}, IDE: ${known.join(', ')}` };
@@ -153,7 +153,7 @@ async function checkCustomizations(projectRoot: string): Promise<CheckResult> {
153
153
  ok: false,
154
154
  label: 'Customizations directory',
155
155
  detail: `.opencastle/ cannot be read — ${(err as Error).message}`,
156
- fix: 'fix the permissions on .opencastle/, then run opencastle sync; this one needs a person',
156
+ fix: 'fix the permissions on .opencastle/, then run npx opencastle sync; this one needs a person',
157
157
  };
158
158
  }
159
159
  return { ok: true, label: 'Customizations directory', detail: `${files.length} entries` };
@@ -222,7 +222,7 @@ export async function checkSkillMatrix(projectRoot: string): Promise<CheckResult
222
222
  ok: false,
223
223
  label: 'Skill matrix',
224
224
  detail: `.opencastle/agents/ cannot be read — ${(err as Error).message}`,
225
- fix: 'fix the permissions on .opencastle/agents/, then run opencastle sync; this one needs a person',
225
+ fix: 'fix the permissions on .opencastle/agents/, then run npx opencastle sync; this one needs a person',
226
226
  };
227
227
  }
228
228
  }
@@ -242,7 +242,7 @@ export async function checkSkillMatrix(projectRoot: string): Promise<CheckResult
242
242
  ok: false,
243
243
  label: 'Skill matrix',
244
244
  detail: `Cannot read .opencastle/agents/skill-matrix.json — ${(err as Error).message}`,
245
- fix: 'fix or delete the file, then run opencastle sync; this one needs a person',
245
+ fix: 'fix or delete the file, then run npx opencastle sync; this one needs a person',
246
246
  };
247
247
  }
248
248
  try {
@@ -410,7 +410,7 @@ function verifySubtree(
410
410
  ok: false,
411
411
  label: check.label,
412
412
  detail: `${check.path}${shown} cannot be read — ${(err as Error).message}`,
413
- fix: `fix the permissions or replace ${check.path}${shown}, then run opencastle sync; this one needs a person`,
413
+ fix: `fix the permissions or replace ${check.path}${shown}, then run npx opencastle sync; this one needs a person`,
414
414
  });
415
415
 
416
416
  for (const entry of entries) {
@@ -441,7 +441,7 @@ function verifySubtree(
441
441
  ok: false,
442
442
  label: check.label,
443
443
  detail: `${check.path}${shown} is a file, not a directory of generated files`,
444
- fix: `remove ${check.path}${shown}, then run opencastle sync; this one needs a person`,
444
+ fix: `remove ${check.path}${shown}, then run npx opencastle sync; this one needs a person`,
445
445
  };
446
446
  }
447
447
  if (isDir) {
@@ -450,7 +450,7 @@ function verifySubtree(
450
450
  ok: false,
451
451
  label: check.label,
452
452
  detail: `${check.path}${shown} is a directory, not a generated file`,
453
- fix: `remove ${check.path}${shown}, then run opencastle sync; this one needs a person`,
453
+ fix: `remove ${check.path}${shown}, then run npx opencastle sync; this one needs a person`,
454
454
  };
455
455
  }
456
456
  let kids: string[];
@@ -501,7 +501,7 @@ export async function runDoctorCheck(projectRoot: string, check: DoctorCheck): P
501
501
  ok: false,
502
502
  label: check.label,
503
503
  detail: `${check.path} cannot be read — ${(err as Error).message}`,
504
- fix: `remove or fix ${check.path}, then run opencastle sync; this one needs a person`,
504
+ fix: `remove or fix ${check.path}, then run npx opencastle sync; this one needs a person`,
505
505
  };
506
506
  }
507
507
 
@@ -540,7 +540,7 @@ export function checkMcpFromPaths(projectRoot: string, mcpPaths: string[]): Chec
540
540
  ok: false,
541
541
  label: 'MCP configuration',
542
542
  detail: `${p} cannot be read — ${(err as Error).message}`,
543
- fix: `fix or delete ${p}, then run opencastle sync; this one needs a person`,
543
+ fix: `fix or delete ${p}, then run npx opencastle sync; this one needs a person`,
544
544
  };
545
545
  }
546
546
  }
@@ -593,7 +593,7 @@ function teamStateOrFailure(
593
593
  // ── Main doctor command ───────────────────────────────────────
594
594
 
595
595
  const DOCTOR_HELP = `
596
- opencastle doctor [options]
596
+ npx opencastle doctor [options]
597
597
 
598
598
  Validate your OpenCastle setup — checks manifest, customizations, skills,
599
599
  logs, MCP configuration, and IDE-specific rules. MCP servers are audited too:
@@ -656,7 +656,7 @@ async function checkGitignoredOutput(
656
656
  // and doctor fails again with the same advice. Asking about the offending
657
657
  // lines is the whole difference.
658
658
  fix: (await syncWouldClearThis(projectRoot, hidden))
659
- ? 'opencastle sync — those entries are in a block this tool maintains'
659
+ ? 'npx opencastle sync — those entries are in a block this tool maintains'
660
660
  : `remove those entries from ${await whereIgnored(projectRoot, hidden)}; OpenCastle only ignores .env and run artefacts`,
661
661
  };
662
662
  }
@@ -901,7 +901,7 @@ async function checkTornBlocks(
901
901
 
902
902
  const needsAPerson = found.filter(({ diagnosis }) => !diagnosis.fixable)
903
903
  if (needsAPerson.length === 0) {
904
- return { label, ok: false, warning: false, detail, fix: 'opencastle sync' }
904
+ return { label, ok: false, warning: false, detail, fix: 'npx opencastle sync' }
905
905
  }
906
906
  return {
907
907
  label,
@@ -933,7 +933,7 @@ function checkRootFileClassification(manifest: Manifest | null): CheckResult {
933
933
  label,
934
934
  ok: true,
935
935
  warning: true,
936
- detail: `${misfiled.join(', ')} recorded as generated — run "opencastle sync" to repair`,
936
+ detail: `${misfiled.join(', ')} recorded as generated — run "npx opencastle sync" to repair`,
937
937
  };
938
938
  }
939
939
 
@@ -1038,7 +1038,7 @@ export async function runSharedChecks(
1038
1038
  if (!manifest) {
1039
1039
  for (const r of results) {
1040
1040
  if (!r.ok && (r.fix === undefined || /opencastle sync/.test(r.fix))) {
1041
- r.fix = 'opencastle init — nothing is installed, so there is nothing to sync';
1041
+ r.fix = 'npx opencastle init — nothing is installed, so there is nothing to sync';
1042
1042
  }
1043
1043
  }
1044
1044
  }
@@ -26,7 +26,7 @@ import { isWorkflowTemplate } from './adapters/workflows.js'
26
26
  */
27
27
 
28
28
  const HELP = `
29
- opencastle explain [options]
29
+ npx opencastle explain [options]
30
30
 
31
31
  Show what every assistant in this repository is given, where each piece comes
32
32
  from (OpenCastle, a baseline, or this project), and what you still need to
@@ -53,7 +53,7 @@ function by(from: string): string {
53
53
 
54
54
  async function build(pkgRoot: string, projectRoot: string): Promise<ExplainReport> {
55
55
  const manifest = await readManifest(projectRoot)
56
- if (!manifest) throw new Error('OpenCastle is not set up here — run opencastle init')
56
+ if (!manifest) throw new Error('OpenCastle is not set up here — run npx opencastle init')
57
57
  refuseOlderCli(pkgRoot, manifest.version)
58
58
  const ides = (manifest.ides?.length ? manifest.ides : [manifest.ide]).filter((i): i is string => Boolean(i) && i in IDE_ADAPTERS)
59
59
  const stack = resolveStack({ ...manifest, ides })
package/src/cli/fleet.ts CHANGED
@@ -16,7 +16,7 @@ import type { CliContext } from './types.js'
16
16
  */
17
17
 
18
18
  const HELP = `
19
- opencastle fleet <dir...> [options]
19
+ npx opencastle fleet <dir...> [options]
20
20
 
21
21
  Read the committed .opencastle/lock.json of each repository given and show
22
22
  which OpenCastle and baseline versions they run, which lag behind the newest,
@@ -48,15 +48,15 @@ function explain(d: Drift): string {
48
48
  // after, and blaming an edit that never happened sends people looking for it.
49
49
  case 'changed':
50
50
  if (d.path === LOCK_REL) {
51
- return `${d.path}: the sources changed and nobody has run sync since. Run \`opencastle sync\` and commit the result; \`opencastle review\` explains the change.`
51
+ return `${d.path}: the sources changed and nobody has run sync since. Run \`npx opencastle sync\` and commit the result; \`npx opencastle review\` explains the change.`
52
52
  }
53
- return `${where} differs from a fresh compile of its source. Run \`opencastle sync\` and commit the result. If the difference is a hand edit you want to keep, move it into .opencastle/ first — sync overwrites generated files.`
53
+ return `${where} differs from a fresh compile of its source. Run \`npx opencastle sync\` and commit the result. If the difference is a hand edit you want to keep, move it into .opencastle/ first — sync overwrites generated files.`
54
54
  case 'missing':
55
- return `${where} should exist but does not. Run \`opencastle sync\` and commit the result; generated config is committed like a lockfile.`
55
+ return `${where} should exist but does not. Run \`npx opencastle sync\` and commit the result; generated config is committed like a lockfile.`
56
56
  case 'extra':
57
- return `${where} ${d.detail ? `was ${d.detail}` : 'sits in generated output but no source produces it'}, so the next \`opencastle sync\` deletes it.`
57
+ return `${where} ${d.detail ? `was ${d.detail}` : 'sits in generated output but no source produces it'}, so the next \`npx opencastle sync\` deletes it.`
58
58
  case 'outdated':
59
- return `${where}: ${d.detail ?? 'an MCP server entry sync would change'}. Run \`opencastle sync\` and commit — it touches only entries OpenCastle wrote and nobody edited.`
59
+ return `${where}: ${d.detail ?? 'an MCP server entry sync would change'}. Run \`npx opencastle sync\` and commit — it touches only entries OpenCastle wrote and nobody edited.`
60
60
  case 'unreducible':
61
61
  if (isComparisonFailure(d)) return `The comparison could not run: ${d.path}.${d.fix ? ` Fix: ${d.fix}` : ''}`
62
62
  return [`${where}: ${d.detail ?? 'needs a person'}`, d.fix && `Fix: ${d.fix}`].filter(Boolean).join('. ')
@@ -83,7 +83,7 @@ function buildBlock(): string {
83
83
  return [
84
84
  START_MARKER,
85
85
  '# Generated assistant config is committed on purpose, so teammates get',
86
- '# working rules on clone and `opencastle sync --check` can verify it in CI.',
86
+ '# working rules on clone and `npx opencastle sync --check` can verify it in CI.',
87
87
  '# Only local artefacts are ignored.',
88
88
  ...LOCAL_ONLY,
89
89
  END_MARKER,
package/src/cli/init.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { isAbsolute, resolve, relative } from 'node:path'
2
2
  import { readFile, unlink } from 'node:fs/promises'
3
3
  import { existsSync } from 'node:fs'
4
+ import { execFileSync } from 'node:child_process'
4
5
  import { multiselect, confirm, closePrompts, c } from './prompt.js'
5
6
  import { readManifest, writeManifest, createManifest } from './manifest.js'
6
7
  import { removeDirIfExists, copyDir, getOrchestratorRoot } from './copy.js'
@@ -24,7 +25,7 @@ import { parseVersion, compareVersions } from './version-range.js'
24
25
  import { COMMAND_NAMESPACE } from './command-namespace.js'
25
26
 
26
27
  const INIT_HELP = `
27
- opencastle init [options]
28
+ npx opencastle init [options]
28
29
 
29
30
  Set up this project: detects your stack and any assistant config you already
30
31
  have, shows what it will do, and asks once.
@@ -275,7 +276,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
275
276
  if (!assumeYes && !dryRun) {
276
277
  const ok = await confirm('Set this up?', true)
277
278
  if (!ok) {
278
- console.log(`\n Aborted. Run ${c.cyan('opencastle init --customize')} to choose manually.\n`)
279
+ console.log(`\n Aborted. Run ${c.cyan('npx opencastle init --customize')} to choose manually.\n`)
279
280
  closePrompts()
280
281
  return
281
282
  }
@@ -717,7 +718,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
717
718
  for (const { ide, message } of failedTargets) {
718
719
  console.log(` ${c.red('✗')} ${IDE_LABELS[ide as IdeChoice] ?? ide} could not be installed:`)
719
720
  console.log(` ${c.dim(message)}`)
720
- console.log(` ${c.dim('Fix that, then run opencastle sync.')}`)
721
+ console.log(` ${c.dim('Fix that, then run npx opencastle sync.')}`)
721
722
  }
722
723
  for (const file of unreadable) {
723
724
  const [abs, why] = file.split('\u0000')
@@ -742,8 +743,8 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
742
743
  console.log(
743
744
  ` ${c.dim(
744
745
  isMcp
745
- ? 'Fix the file, then run opencastle sync --force to add the MCP servers.'
746
- : 'Fix the file, then run opencastle sync --force to generate it.',
746
+ ? 'Fix the file, then run npx opencastle sync --force to add the MCP servers.'
747
+ : 'Fix the file, then run npx opencastle sync --force to generate it.',
747
748
  )}`,
748
749
  )
749
750
  }
@@ -861,7 +862,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
861
862
  for (const p of new Set(tornRoots)) {
862
863
  console.log(` ${c.bold(relative(projectRoot, p))}`)
863
864
  console.log(
864
- ` ${c.dim('└')} ${c.dim('text beside it may be stale generated output; only you can tell. Run')} ${c.cyan('opencastle doctor')}\n`,
865
+ ` ${c.dim('└')} ${c.dim('text beside it may be stale generated output; only you can tell. Run')} ${c.cyan('npx opencastle doctor')}\n`,
865
866
  )
866
867
  }
867
868
  }
@@ -879,6 +880,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
879
880
  }
880
881
 
881
882
  // ── Env var notice + .env file generation ────────────────────
883
+ const envCommitted = envVars.length > 0 && isTrackedByGit(projectRoot, '.env')
882
884
  if (envVars.length > 0) {
883
885
  console.log(`\n ${c.yellow('⚠')} Required environment variables for MCP servers:\n`)
884
886
  for (const { envVar, hint } of envVars) {
@@ -888,7 +890,11 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
888
890
 
889
891
  // Offer to create .env if it doesn't exist
890
892
  const envPath = resolve(projectRoot, '.env')
891
- if (!dryRun && !existsSync(envPath)) {
893
+ if (envCommitted) {
894
+ // Some projects commit a `.env` of shared defaults. A placeholder there,
895
+ // and the "commit what this wrote" below, is how a token gets pushed.
896
+ console.log(` ${c.yellow('⚠')} .env is committed in this repository, so nothing was added to it — set these in your shell`)
897
+ } else if (!dryRun && !existsSync(envPath)) {
892
898
  // `--yes` means every question, not most of them. This one blocked a TTY
893
899
  // run and any CI runner that keeps stdin open.
894
900
  const createEnv =
@@ -948,7 +954,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
948
954
  if (envVars.length > 0) {
949
955
  step++
950
956
  console.log(
951
- ` ${step}. Set the environment variable${envVars.length > 1 ? 's' : ''} listed above (in .env or your shell)`
957
+ ` ${step}. Set the environment variable${envVars.length > 1 ? 's' : ''} listed above (${envCommitted ? 'in your shell — .env is committed here' : 'in .env or your shell'})`
952
958
  )
953
959
  }
954
960
  // The commands are namespaced, and a name nobody tells you is a name nobody
@@ -968,13 +974,13 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
968
974
  step++
969
975
  console.log(` ${step}. Commit what this wrote, .opencastle/ included — teammates get the same setup on clone`)
970
976
  step++
971
- console.log(` ${step}. ${c.cyan('opencastle ci')} — fail a pull request whose generated config no longer matches`)
977
+ console.log(` ${step}. ${c.cyan('npx opencastle ci')} — fail a pull request whose generated config no longer matches`)
972
978
 
973
979
  // Name the assistants not yet being compiled for — the reason to come back.
974
980
  const configured = new Set(ides)
975
981
  const otherIdes = (Object.keys(IDE_ADAPTERS) as IdeChoice[]).filter((id) => !configured.has(id))
976
982
  if (otherIdes.length > 0) {
977
- console.log(`\n ${c.dim('Also used by your team?')} ${c.cyan('opencastle init --customize')}`)
983
+ console.log(`\n ${c.dim('Also used by your team?')} ${c.cyan('npx opencastle init --customize')}`)
978
984
  console.log(` ${c.dim(`compiles the same config for ${otherIdes.map((id) => IDE_LABELS[id]).join(', ')}`)}`)
979
985
  }
980
986
  console.log()
@@ -999,3 +1005,13 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
999
1005
  const couldNotRead = unreadable.filter((e) => e.split('\u0000')[1] === 'unreadable')
1000
1006
  if (couldNotRead.length > 0 || failedTargets.length > 0) process.exit(1)
1001
1007
  }
1008
+
1009
+ /** Whether git tracks `rel` here. False outside a repository or without git. */
1010
+ function isTrackedByGit(projectRoot: string, rel: string): boolean {
1011
+ try {
1012
+ execFileSync('git', ['-C', projectRoot, 'ls-files', '--error-unmatch', '--', rel], { stdio: 'ignore' })
1013
+ return true
1014
+ } catch {
1015
+ return false
1016
+ }
1017
+ }
package/src/cli/layers.ts CHANGED
@@ -545,7 +545,7 @@ function loadExtends(
545
545
  if (!declared && !isAgentPlugin(pkgDir)) {
546
546
  fail(
547
547
  `extends "${spec}", which is neither an OpenCastle baseline nor an Agent Plugin`,
548
- `a baseline declares itself in its package.json: "opencastle": { "baseline": "." } (opencastle baseline init creates one); an Agent Plugin has a plugin.json at its root`,
548
+ `a baseline declares itself in its package.json: "opencastle": { "baseline": "." } (npx opencastle baseline init creates one); an Agent Plugin has a plugin.json at its root`,
549
549
  )
550
550
  return
551
551
  }
@@ -617,7 +617,7 @@ function loadPluginLayer(
617
617
  level: 'error',
618
618
  where: declaredIn,
619
619
  message: `extends ${id}, which is not a valid Agent Plugin: ${report.errors[0] ?? 'its plugin.json cannot be read'}`,
620
- fix: `run opencastle plugin check on it`,
620
+ fix: `run npx opencastle plugin check on it`,
621
621
  })
622
622
  return null
623
623
  }
@@ -784,7 +784,7 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
784
784
  level: 'warning',
785
785
  where,
786
786
  message: `excludes ${ref}, which no layer below provides`,
787
- fix: 'check the spelling — opencastle explain lists everything that is compiled',
787
+ fix: 'check the spelling — npx opencastle explain lists everything that is compiled',
788
788
  })
789
789
  }
790
790
  }
@@ -914,7 +914,7 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
914
914
  level: 'warning',
915
915
  where,
916
916
  message: `excludes ${ref}, which no layer below defines and no integration brings`,
917
- fix: 'check the spelling — opencastle explain lists every MCP server',
917
+ fix: 'check the spelling — npx opencastle explain lists every MCP server',
918
918
  })
919
919
  }
920
920
  if (servers.has(k)) servers.delete(k)