opencastle 0.36.1 → 0.37.0

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 (107) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/convoy/engine.d.ts.map +1 -1
  3. package/dist/cli/convoy/engine.js +0 -7
  4. package/dist/cli/convoy/engine.js.map +1 -1
  5. package/dist/cli/convoy/engine.test.js +0 -1
  6. package/dist/cli/convoy/engine.test.js.map +1 -1
  7. package/dist/cli/convoy/event-emission.test.d.ts +2 -0
  8. package/dist/cli/convoy/event-emission.test.d.ts.map +1 -0
  9. package/dist/cli/convoy/event-emission.test.js +73 -0
  10. package/dist/cli/convoy/event-emission.test.js.map +1 -0
  11. package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
  12. package/dist/cli/convoy/event-schemas.js +0 -25
  13. package/dist/cli/convoy/event-schemas.js.map +1 -1
  14. package/dist/cli/convoy/events.test.js +2 -2
  15. package/dist/cli/convoy/events.test.js.map +1 -1
  16. package/dist/cli/convoy/last-run.d.ts +53 -0
  17. package/dist/cli/convoy/last-run.d.ts.map +1 -0
  18. package/dist/cli/convoy/last-run.js +54 -0
  19. package/dist/cli/convoy/last-run.js.map +1 -0
  20. package/dist/cli/convoy/last-run.test.d.ts +2 -0
  21. package/dist/cli/convoy/last-run.test.d.ts.map +1 -0
  22. package/dist/cli/convoy/last-run.test.js +110 -0
  23. package/dist/cli/convoy/last-run.test.js.map +1 -0
  24. package/dist/cli/convoy/spec-types.d.ts +8 -2
  25. package/dist/cli/convoy/spec-types.d.ts.map +1 -1
  26. package/dist/cli/convoy/store.d.ts +3 -2
  27. package/dist/cli/convoy/store.d.ts.map +1 -1
  28. package/dist/cli/convoy/store.js +33 -8
  29. package/dist/cli/convoy/store.js.map +1 -1
  30. package/dist/cli/convoy/store.test.js +76 -13
  31. package/dist/cli/convoy/store.test.js.map +1 -1
  32. package/dist/cli/convoy/types.d.ts +0 -35
  33. package/dist/cli/convoy/types.d.ts.map +1 -1
  34. package/dist/cli/convoy/types.js +0 -4
  35. package/dist/cli/convoy/types.js.map +1 -1
  36. package/dist/cli/convoy-args.test.d.ts +2 -0
  37. package/dist/cli/convoy-args.test.d.ts.map +1 -0
  38. package/dist/cli/convoy-args.test.js +132 -0
  39. package/dist/cli/convoy-args.test.js.map +1 -0
  40. package/dist/cli/convoy-cmd.d.ts +25 -0
  41. package/dist/cli/convoy-cmd.d.ts.map +1 -1
  42. package/dist/cli/convoy-cmd.js +155 -19
  43. package/dist/cli/convoy-cmd.js.map +1 -1
  44. package/dist/cli/run/adapters/codex.d.ts.map +1 -1
  45. package/dist/cli/run/adapters/codex.js +8 -1
  46. package/dist/cli/run/adapters/codex.js.map +1 -1
  47. package/dist/cli/run/adapters/permission-modes.d.ts +20 -0
  48. package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -0
  49. package/dist/cli/run/adapters/permission-modes.js +82 -0
  50. package/dist/cli/run/adapters/permission-modes.js.map +1 -0
  51. package/dist/cli/run/adapters/permission-modes.test.d.ts +2 -0
  52. package/dist/cli/run/adapters/permission-modes.test.d.ts.map +1 -0
  53. package/dist/cli/run/adapters/permission-modes.test.js +95 -0
  54. package/dist/cli/run/adapters/permission-modes.test.js.map +1 -0
  55. package/dist/cli/run/schema.d.ts.map +1 -1
  56. package/dist/cli/run/schema.js +69 -0
  57. package/dist/cli/run/schema.js.map +1 -1
  58. package/dist/cli/run/schema.test.js +62 -0
  59. package/dist/cli/run/schema.test.js.map +1 -1
  60. package/dist/cli/run-dry-run.test.d.ts +2 -0
  61. package/dist/cli/run-dry-run.test.d.ts.map +1 -0
  62. package/dist/cli/run-dry-run.test.js +83 -0
  63. package/dist/cli/run-dry-run.test.js.map +1 -0
  64. package/dist/cli/run-executor-flags.test.d.ts +2 -0
  65. package/dist/cli/run-executor-flags.test.d.ts.map +1 -0
  66. package/dist/cli/run-executor-flags.test.js +31 -0
  67. package/dist/cli/run-executor-flags.test.js.map +1 -0
  68. package/dist/cli/run.d.ts +40 -0
  69. package/dist/cli/run.d.ts.map +1 -1
  70. package/dist/cli/run.js +198 -24
  71. package/dist/cli/run.js.map +1 -1
  72. package/dist/orchestrator/plugins/hetzner/config.d.ts +3 -0
  73. package/dist/orchestrator/plugins/hetzner/config.d.ts.map +1 -0
  74. package/dist/orchestrator/plugins/hetzner/config.js +20 -0
  75. package/dist/orchestrator/plugins/hetzner/config.js.map +1 -0
  76. package/dist/orchestrator/plugins/index.d.ts.map +1 -1
  77. package/dist/orchestrator/plugins/index.js +2 -0
  78. package/dist/orchestrator/plugins/index.js.map +1 -1
  79. package/package.json +1 -1
  80. package/src/cli/convoy/TELEMETRY.md +0 -2
  81. package/src/cli/convoy/engine.test.ts +0 -1
  82. package/src/cli/convoy/engine.ts +0 -7
  83. package/src/cli/convoy/event-emission.test.ts +79 -0
  84. package/src/cli/convoy/event-schemas.ts +0 -25
  85. package/src/cli/convoy/events.test.ts +2 -2
  86. package/src/cli/convoy/last-run.test.ts +130 -0
  87. package/src/cli/convoy/last-run.ts +87 -0
  88. package/src/cli/convoy/spec-types.ts +8 -2
  89. package/src/cli/convoy/store.test.ts +87 -13
  90. package/src/cli/convoy/store.ts +40 -12
  91. package/src/cli/convoy/types.ts +0 -10
  92. package/src/cli/convoy-args.test.ts +156 -0
  93. package/src/cli/convoy-cmd.ts +162 -19
  94. package/src/cli/run/adapters/codex.ts +9 -1
  95. package/src/cli/run/adapters/permission-modes.test.ts +114 -0
  96. package/src/cli/run/adapters/permission-modes.ts +89 -0
  97. package/src/cli/run/schema.test.ts +72 -0
  98. package/src/cli/run/schema.ts +71 -0
  99. package/src/cli/run-dry-run.test.ts +97 -0
  100. package/src/cli/run-executor-flags.test.ts +38 -0
  101. package/src/cli/run.ts +242 -29
  102. package/src/dashboard/dist/index.html +1 -1
  103. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  104. package/src/dashboard/src/pages/index.astro +1 -1
  105. package/src/orchestrator/plugins/hetzner/SKILL.md +96 -0
  106. package/src/orchestrator/plugins/hetzner/config.ts +21 -0
  107. package/src/orchestrator/plugins/index.ts +2 -0
package/src/cli/run.ts CHANGED
@@ -5,6 +5,7 @@ import { stringify as yamlStringify } from 'yaml'
5
5
  import { parseTaskSpecText, isConvoySpec, isPipelineSpec } from './run/schema.js'
6
6
  import { createExecutor, buildPhases } from './run/executor.js'
7
7
  import { getAdapter, detectAdapter } from './run/adapters/index.js'
8
+ import { permissionModeError } from './run/adapters/permission-modes.js'
8
9
  import { createReporter, printExecutionPlan } from './run/reporter.js'
9
10
  import { c } from './prompt.js'
10
11
  import type { CliContext } from './types.js'
@@ -30,10 +31,13 @@ const HELP = `
30
31
  --file, -f <path> Task spec file
31
32
  --formula <path> Use a formula template (alternative to --file)
32
33
  --set key=value Set a formula variable (repeatable)
33
- --dry-run Show execution plan without running
34
+ --dry-run Show execution plan without running; with --resume
35
+ or --retry-failed, list the tasks that would run
34
36
  --concurrency, -c <n> Override max parallel tasks
35
37
  --adapter, -a <name> Override agent runtime adapter
36
- --report-dir <path> Where to write run reports (default: .opencastle/runs)
38
+ --report-dir <path> Where to write run reports, for legacy specs only
39
+ (default: .opencastle/runs). Convoy specs record to
40
+ .opencastle/convoy.db and .opencastle/logs instead
37
41
  --permission-mode <m> How much a worker may do unattended: default,
38
42
  acceptEdits (the default), auto, dontAsk,
39
43
  bypassPermissions, plan
@@ -46,9 +50,11 @@ const HELP = `
46
50
  --dlq-retry <id> Reset a DLQ task to pending for retry
47
51
  --convoy <id> Filter by convoy ID (used with --dlq-list)
48
52
  --resolution <text> Resolution text (used with --dlq-resolve)
49
- --watch Keep running, re-triggering on file changes, cron, or git push
50
- --watch-config <p> Path to watch configuration file (overrides spec watch config)
51
- --clear-scratchpad Clear scratchpad data at watch start
53
+ --watch Keep running, re-triggering on file changes, cron,
54
+ or git push (convoy specs only)
55
+ --watch-config <p> Path to watch configuration file (overrides spec
56
+ watch config)
57
+ --clear-scratchpad Clear scratchpad data at watch start
52
58
  --help, -h Show this help
53
59
  `
54
60
 
@@ -116,6 +122,59 @@ export function finishRun(
116
122
  process.exit(exitCode)
117
123
  }
118
124
 
125
+ /**
126
+ * The statuses `engine.retryFailed` reopens, and the ones `engine.resume` picks
127
+ * up. Named here so the `--dry-run` preview and the engine cannot drift about
128
+ * which tasks a run would touch.
129
+ */
130
+ export const RETRYABLE_TASK_STATUSES = [
131
+ 'failed',
132
+ 'gate-failed',
133
+ 'timed-out',
134
+ 'review-blocked',
135
+ 'disputed',
136
+ ] as const
137
+ export const RESUMABLE_TASK_STATUSES = ['pending', 'assigned', 'running'] as const
138
+
139
+ /**
140
+ * What `--resume` or `--retry-failed` would do, without doing it.
141
+ *
142
+ * `--dry-run` was read only on the fresh-run path, so combining it with either
143
+ * of those flags spawned agents against the user's repository for real. The flag
144
+ * a person reaches for to find out what will happen was the one flag that did
145
+ * not change what happened.
146
+ */
147
+ export function printRunDryRun(
148
+ verb: 'resume' | 'retry',
149
+ runLabel: string,
150
+ runName: string,
151
+ tasks: Array<{ id: string; agent: string; status: string }>,
152
+ statuses: readonly string[],
153
+ ): void {
154
+ const selected = tasks.filter((t) => statuses.includes(t.status))
155
+
156
+ console.log(`\n 🏰 ${runLabel}: ${runName}`)
157
+ console.log(c.dim(` [dry-run] Nothing will be executed.\n`))
158
+
159
+ if (selected.length === 0) {
160
+ console.log(
161
+ verb === 'retry'
162
+ ? ' No failed tasks to retry.'
163
+ : ' No unfinished tasks — nothing to resume.',
164
+ )
165
+ console.log(c.dim(` (matching: ${statuses.join(', ')})\n`))
166
+ return
167
+ }
168
+
169
+ console.log(
170
+ ` Would ${verb === 'retry' ? 're-run' : 'run'} ${selected.length} of ${tasks.length} task(s):`,
171
+ )
172
+ for (const t of selected) {
173
+ console.log(` ${t.id} ${c.dim(`— ${t.agent} [${t.status}]`)}`)
174
+ }
175
+ console.log()
176
+ }
177
+
119
178
  /**
120
179
  * Parse CLI arguments for the run command.
121
180
  */
@@ -269,6 +328,106 @@ function parseArgs(args: string[]): RunOptions {
269
328
  return opts
270
329
  }
271
330
 
331
+ /**
332
+ * Which executor a spec will run on, and therefore which flags mean anything.
333
+ *
334
+ * Three exist — the pipeline orchestrator for `version: 2`, the convoy engine
335
+ * for `version: 1`, and the legacy executor for everything else — and several
336
+ * flags are wired into exactly one of them:
337
+ *
338
+ * `--report-dir` is read where `createReporter` is called, which is the legacy
339
+ * path alone. For a `version: 1` spec, which is what every generated spec is,
340
+ * it was parsed, resolved against cwd, and never passed to the engine; the
341
+ * engine writes to SQLite and NDJSON and has no report directory at all. The
342
+ * flag was accepted, documented as "where to write run reports", and did
343
+ * nothing on the path nearly every user is on.
344
+ *
345
+ * `--watch` and its two companions are the mirror image: they live inside the
346
+ * convoy-engine branch, so a legacy or pipeline spec accepted them and ran
347
+ * once.
348
+ */
349
+ export function specExecutor(spec: TaskSpec): 'pipeline' | 'engine' | 'legacy' {
350
+ if (isPipelineSpec(spec)) return 'pipeline'
351
+ if (isConvoySpec(spec)) return 'engine'
352
+ return 'legacy'
353
+ }
354
+
355
+ /** Flags that only one executor reads, and the one that reads each. */
356
+ const EXECUTOR_ONLY_FLAGS: Array<{
357
+ flag: string
358
+ executor: 'pipeline' | 'engine' | 'legacy'
359
+ set: (_o: RunOptions) => boolean
360
+ why: string
361
+ }> = [
362
+ {
363
+ flag: '--report-dir',
364
+ executor: 'legacy',
365
+ set: (o) => o.reportDir !== null,
366
+ why: 'the convoy engine records runs in .opencastle/convoy.db and .opencastle/logs, not as report files',
367
+ },
368
+ {
369
+ flag: '--watch',
370
+ executor: 'engine',
371
+ set: (o) => o.watch,
372
+ why: 'only the convoy engine has a watch loop',
373
+ },
374
+ {
375
+ flag: '--watch-config',
376
+ executor: 'engine',
377
+ set: (o) => o.watchConfig !== null,
378
+ why: 'only the convoy engine has a watch loop',
379
+ },
380
+ {
381
+ flag: '--clear-scratchpad',
382
+ executor: 'engine',
383
+ set: (o) => o.clearScratchpad,
384
+ why: 'only the convoy engine has a watch loop',
385
+ },
386
+ ]
387
+
388
+ /**
389
+ * Refuse a flag the spec's executor will never read.
390
+ *
391
+ * Same rule as everywhere else on this command: a flag is honoured or refused,
392
+ * never accepted and dropped. Silence here meant `--report-dir ./out` on an
393
+ * ordinary convoy spec exited 0 with `./out` empty.
394
+ */
395
+ function assertFlagsApplyToSpec(spec: TaskSpec, opts: RunOptions): void {
396
+ const executor = specExecutor(spec)
397
+ for (const entry of EXECUTOR_ONLY_FLAGS) {
398
+ if (!entry.set(opts) || entry.executor === executor) continue
399
+ const kind =
400
+ executor === 'pipeline'
401
+ ? 'a pipeline spec (version: 2)'
402
+ : executor === 'engine'
403
+ ? 'a convoy spec (version: 1)'
404
+ : 'a legacy spec (no version)'
405
+ console.error(` ✗ ${entry.flag} does nothing for ${kind}.`)
406
+ console.error(` ${entry.why}.`)
407
+ process.exit(1)
408
+ }
409
+ }
410
+
411
+ /**
412
+ * Refuse a permission mode the chosen adapter cannot honour, before it runs.
413
+ *
414
+ * Every entry point resolves its own adapter, so every one of them calls this.
415
+ * Until now the mode simply evaporated on four of the five adapters: a run told
416
+ * to hold its workers to `plan` went ahead and wrote files, and said nothing
417
+ * about it. Refusing is the only honest answer left once a mode cannot be
418
+ * carried out, and it has to happen here — before a worker starts, while the
419
+ * user can still change the flag.
420
+ */
421
+ function assertPermissionModeSupported(adapterName: string, spec: TaskSpec): void {
422
+ const mode = spec.defaults?.permission_mode
423
+ if (!mode) return
424
+ const problem = permissionModeError(adapterName, mode)
425
+ if (problem) {
426
+ console.error(` ✗ ${problem}`)
427
+ process.exit(1)
428
+ }
429
+ }
430
+
272
431
  /**
273
432
  * Print a user-friendly adapter unavailable error.
274
433
  */
@@ -567,12 +726,28 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
567
726
  const { createConvoyStore } = await import('./convoy/store.js')
568
727
  const store = createConvoyStore(dbPath)
569
728
  const convoy = store.getLatestConvoy()
729
+ const retryTasks = convoy ? store.getTasksByConvoy(convoy.id) : []
570
730
  store.close()
571
731
  if (!convoy) {
572
732
  console.error(' ✗ No convoy records found in .opencastle/convoy.db')
573
733
  process.exit(1)
574
734
  }
575
735
 
736
+ // Before adapter detection: a preview should not require an agent CLI to be
737
+ // installed, and it must return before anything is executed.
738
+ if (opts.dryRun) {
739
+ printRunDryRun(
740
+ 'retry',
741
+ 'OpenCastle Convoy (Retry Failed)',
742
+ convoy.name,
743
+ opts.retryFailedTaskIds?.length
744
+ ? retryTasks.filter((t) => opts.retryFailedTaskIds!.includes(t.id))
745
+ : retryTasks,
746
+ RETRYABLE_TASK_STATUSES,
747
+ )
748
+ return
749
+ }
750
+
576
751
  const retrySpec = parseTaskSpecText(convoy.spec_yaml)
577
752
  applyCliOverrides(retrySpec, opts)
578
753
 
@@ -594,6 +769,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
594
769
  printAdapterError(retryDetectionFailed, retrySpec.adapter)
595
770
  process.exit(1)
596
771
  }
772
+ assertPermissionModeSupported(retrySpec.adapter, retrySpec)
597
773
 
598
774
  console.log(`\n 🏰 OpenCastle Convoy (Retry Failed): ${convoy.name}`)
599
775
  console.log(` Convoy ID: ${convoy.id}`)
@@ -644,10 +820,60 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
644
820
  }
645
821
  const { createConvoyStore } = await import('./convoy/store.js')
646
822
  const store = createConvoyStore(dbPath)
647
- const latestPipeline = store.getLatestPipeline()
823
+ const { selectResumableRun } = await import('./convoy/last-run.js')
824
+ const selected = selectResumableRun(store)
825
+
826
+ if (!selected) {
827
+ store.close()
828
+ console.error(' ✗ No convoy records found in .opencastle/convoy.db')
829
+ process.exit(1)
830
+ }
831
+
832
+ // Whichever run was started most recently, and only if it can be continued.
833
+ // Preferring pipelines unconditionally meant a standalone convoy could never
834
+ // be resumed once the project had run one, and the status screen — which
835
+ // reads the same selector — named a different run than this command resumed.
836
+ if (!selected.resumable) {
837
+ store.close()
838
+ const { kind, record } = selected.run
839
+ console.error(
840
+ ` ✗ Last ${kind} "${record.name}" already finished with status: ${record.status}`,
841
+ )
842
+ console.error(
843
+ kind === 'pipeline'
844
+ ? ' Only interrupted (running/pending/failed) pipelines can be resumed.'
845
+ : ' Only interrupted (running/pending) convoys can be resumed.',
846
+ )
847
+ if (kind === 'convoy' && record.status === 'failed') {
848
+ console.error(`\n To re-run its failed tasks: opencastle convoy retry`)
849
+ }
850
+ process.exit(1)
851
+ }
852
+
853
+ // Before adapter detection, and before either orchestrator is constructed.
854
+ if (opts.dryRun) {
855
+ const previewIds =
856
+ selected.run.kind === 'pipeline'
857
+ ? store.getConvoysByPipeline(selected.run.record.id).map((c) => c.id)
858
+ : [selected.run.record.id]
859
+ const previewTasks = previewIds.flatMap((id) => store.getTasksByConvoy(id))
860
+ store.close()
861
+ printRunDryRun(
862
+ 'resume',
863
+ selected.run.kind === 'pipeline'
864
+ ? 'OpenCastle Pipeline (Resume)'
865
+ : 'OpenCastle Convoy (Resume)',
866
+ selected.run.record.name,
867
+ previewTasks,
868
+ RESUMABLE_TASK_STATUSES,
869
+ )
870
+ return
871
+ }
872
+
873
+ const latestPipeline = selected.run.kind === 'pipeline' ? selected.run.record : null
648
874
 
649
875
  // ── Pipeline resume (pending / running / failed) ────────────
650
- if (latestPipeline && latestPipeline.status !== 'done') {
876
+ if (latestPipeline) {
651
877
  store.close()
652
878
  const resumePipelineSpec = parseTaskSpecText(latestPipeline.spec_yaml)
653
879
  applyCliOverrides(resumePipelineSpec, opts)
@@ -670,6 +896,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
670
896
  printAdapterError(resumePipelineDetectionFailed, resumePipelineSpec.adapter)
671
897
  process.exit(1)
672
898
  }
899
+ assertPermissionModeSupported(resumePipelineSpec.adapter, resumePipelineSpec)
673
900
 
674
901
  console.log(`\n 🏰 OpenCastle Pipeline (Resume): ${latestPipeline.name}`)
675
902
  console.log(` Pipeline ID: ${latestPipeline.id}`)
@@ -701,30 +928,11 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
701
928
  return finishRun(resumePipelineDashResult, resumePipelineResult.status !== 'done')
702
929
  }
703
930
 
704
- // ── Pipeline done — don't fall through to convoy check ──────
705
- if (latestPipeline && latestPipeline.status === 'done') {
706
- store.close()
707
- console.error(
708
- ` ✗ Last pipeline "${latestPipeline.name}" already finished with status: done`
709
- )
710
- console.error(` Only interrupted (running/pending/failed) pipelines can be resumed.`)
711
- process.exit(1)
712
- }
713
-
714
931
  // ── Standalone convoy resume ────────────────────────────────
715
- const convoy = store.getLatestConvoy()
932
+ // Selection and the finished-run refusal both happened above, against the
933
+ // one selector. This branch only executes what was chosen.
934
+ const convoy = selected.run.record as import('./convoy/types.js').ConvoyRecord
716
935
  store.close()
717
- if (!convoy) {
718
- console.error(' ✗ No convoy records found in .opencastle/convoy.db')
719
- process.exit(1)
720
- }
721
- if (convoy.status === 'done' || convoy.status === 'failed') {
722
- console.error(
723
- ` ✗ Last convoy "${convoy.name}" already finished with status: ${convoy.status}`
724
- )
725
- console.error(` Only interrupted (running/pending) convoys can be resumed.`)
726
- process.exit(1)
727
- }
728
936
 
729
937
  const resumeSpec = parseTaskSpecText(convoy.spec_yaml)
730
938
  applyCliOverrides(resumeSpec, opts)
@@ -747,6 +955,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
747
955
  printAdapterError(resumeDetectionFailed, resumeSpec.adapter)
748
956
  process.exit(1)
749
957
  }
958
+ assertPermissionModeSupported(resumeSpec.adapter, resumeSpec)
750
959
 
751
960
  console.log(`\n \uD83C\uDFF0 OpenCastle Convoy (Resume): ${convoy.name}`)
752
961
  console.log(` Convoy ID: ${convoy.id}`)
@@ -860,6 +1069,9 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
860
1069
  // Apply CLI overrides
861
1070
  applyCliOverrides(spec, opts)
862
1071
 
1072
+ // Refuse the flags this spec's executor cannot act on, before anything runs.
1073
+ assertFlagsApplyToSpec(spec, opts)
1074
+
863
1075
  // ── Auto-detect adapter if not specified ─────────────────────
864
1076
  let detectionFailed = false
865
1077
  if (!spec.adapter) {
@@ -905,6 +1117,7 @@ export default async function run({ args, pkgRoot }: CliContext): Promise<void>
905
1117
  console.log(`\n ${c.dim('Resume:')} npx opencastle convoy run -f ${opts.file}`)
906
1118
  process.exit(1)
907
1119
  }
1120
+ assertPermissionModeSupported(spec.adapter, spec)
908
1121
 
909
1122
  // ── Pipeline orchestrator path (version: 2 specs with depends_on_convoy) ──
910
1123
  if (isPipelineSpec(spec)) {
@@ -1647,7 +1647,7 @@ Export
1647
1647
  lifecycle: ['convoy_started', 'convoy_finished', 'convoy_failed'],
1648
1648
  tasks: ['task_started', 'task_done', 'task_failed', 'task_assigned', 'task_skipped', 'task_retried', 'task_timed_out', 'task_gate_failed', 'task_hook_failed', 'task_wait_input'],
1649
1649
  reviews: ['review_started', 'review_verdict', 'panel_started', 'panel_verdict'],
1650
- system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', 'discovered_issue', 'secret_leak_prevented'],
1650
+ system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', 'secret_leak_prevented'],
1651
1651
  errors: []
1652
1652
  };
1653
1653
 
@@ -1,25 +1,25 @@
1
1
  {
2
- "hash": "d6ef7d6b",
2
+ "hash": "d8db97c1",
3
3
  "configHash": "30f8ea04",
4
- "lockfileHash": "ef645e93",
5
- "browserHash": "49cce8e5",
4
+ "lockfileHash": "39322730",
5
+ "browserHash": "a4d98116",
6
6
  "optimized": {
7
7
  "astro > cssesc": {
8
8
  "src": "../../../../../node_modules/cssesc/cssesc.js",
9
9
  "file": "astro___cssesc.js",
10
- "fileHash": "0a5674d3",
10
+ "fileHash": "ad93d060",
11
11
  "needsInterop": true
12
12
  },
13
13
  "astro > aria-query": {
14
14
  "src": "../../../../../node_modules/aria-query/lib/index.js",
15
15
  "file": "astro___aria-query.js",
16
- "fileHash": "bf14b818",
16
+ "fileHash": "85c73239",
17
17
  "needsInterop": true
18
18
  },
19
19
  "astro > axobject-query": {
20
20
  "src": "../../../../../node_modules/axobject-query/lib/index.js",
21
21
  "file": "astro___axobject-query.js",
22
- "fileHash": "b93937da",
22
+ "fileHash": "7417385a",
23
23
  "needsInterop": true
24
24
  }
25
25
  },
@@ -1997,7 +1997,7 @@ try {
1997
1997
  lifecycle: ['convoy_started', 'convoy_finished', 'convoy_failed'],
1998
1998
  tasks: ['task_started', 'task_done', 'task_failed', 'task_assigned', 'task_skipped', 'task_retried', 'task_timed_out', 'task_gate_failed', 'task_hook_failed', 'task_wait_input'],
1999
1999
  reviews: ['review_started', 'review_verdict', 'panel_started', 'panel_verdict'],
2000
- system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', 'discovered_issue', 'secret_leak_prevented'],
2000
+ system: ['circuit_breaker_open', 'circuit_breaker_close', 'circuit_breaker_half_open', 'merge_conflict_detected', 'merge_conflict_resolved', 'watch_started', 'watch_stopped', 'watch_cycle_start', 'watch_cycle_end', 'secret_leak_prevented'],
2001
2001
  errors: []
2002
2002
  };
2003
2003
 
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: hetzner-cloud
3
+ description: "Provisions Hetzner Cloud servers, volumes, private networks, and firewalls via the hcloud CLI and the Pulumi/Terraform hcloud provider; plans CAX/arm64 sizing; configures backups, snapshots, and DR rebuilds. Use when creating or resizing Hetzner servers, attaching volumes, configuring private networks or firewalls, choosing server types, scripting hcloud commands, or authoring hcloud IaC resources."
4
+ ---
5
+
6
+ # Hetzner Cloud
7
+
8
+ Facts that drift (prices, SKUs, locations, limits) go stale — **prefer retrieval over pre-training**: `hcloud server-type list -o json`, `hcloud location list`, docs.hetzner.com. Everything below is behavior, not price sheets. If the project documents a topology (e.g. `docs/architecture/`), read it before provisioning anything.
9
+
10
+ ## Provisioning Workflow
11
+
12
+ 1. **Pick type + location together** — CAX (Ampere arm64, best RAM/€) exists **only in EU DCs** (fsn1/nbg1/hel1); verify with `hcloud server-type list`. arm64 requires multi-arch container images end-to-end.
13
+ - Checkpoint: `hcloud server-type describe <type>` shows the target location.
14
+ 2. **Create network + firewall before servers** — attach at create time; firewall via label selector (`role=web`) scales better than per-server IDs.
15
+ - Checkpoint: firewall rules list SSH restricted to admin IPs, never `0.0.0.0/0`.
16
+ 3. **Create server with cloud-init user-data** — runs once at first boot only.
17
+ - Recovery: broken cloud-init → don't patch by hand; fix the template, `server rebuild` (keeps IPs) or replace via IaC.
18
+ 4. **Attach volumes, then mount explicitly** — see Volumes below.
19
+ - Checkpoint: mount survives reboot (`fstab` entry, not just `automount`).
20
+ 5. **Enable protection on stateful resources** — `hcloud server enable-protection <s> delete rebuild` + same for volumes.
21
+ - Gate: protection verified via `hcloud server describe` before real data lands.
22
+
23
+ ## Non-Obvious Behaviors
24
+
25
+ ### Networking
26
+ - **Cloud Firewalls filter ONLY the public interface.** Private-network traffic is never touched by them — segment the private net with host firewalls (`ufw`) or not at all. This is the most common Hetzner security misconception.
27
+ - Private network **MTU is 1450**, not 1500 — override in Docker (`daemon.json` `"mtu": 1450`) and any overlay/VPN on top, or suffer silent large-packet stalls.
28
+ - Private networks are **not encrypted** — treat as shared fabric, keep TLS for sensitive cross-node traffic.
29
+ - Network zones (e.g. `eu-central` = fsn1/nbg1/hel1) span DCs — cross-DC private traffic works and is free.
30
+ - **Floating IPs need manual OS config** (netplan alias); primary IPs configure themselves. Floating IP ≠ instant failover without host-side automation.
31
+ - IPv4 primary IPs bill separately and **survive server deletion** unless `auto_delete` is set — orphaned IPs keep billing.
32
+
33
+ ### Servers & billing
34
+ - Hourly billing capped at the monthly price. Deleting a server stops its billing but **volumes, snapshots, and primary IPs keep billing** — sweep for orphans after teardowns.
35
+ - `change-type` (resize) requires **ACPI shutdown first** (`hcloud server shutdown`, not `poweroff` — that's a hard cut risking fs damage). CPU/RAM can downgrade later only with `--keep-disk`; disk never shrinks.
36
+ - `server rebuild` wipes the disk but **keeps all IPs** — the fast DR path when the root cause is software.
37
+ - 20 TB egress included per cloud server; ingress + private-net traffic free.
38
+ - Metadata endpoint: `http://169.254.169.254/hetzner/v1/metadata` (useful in cloud-init to self-discover private IP).
39
+
40
+ ### Volumes
41
+ - **Location-bound** — attach only within the same DC; a "move to another region" is snapshot-less (rsync) by design.
42
+ - **Grow-only, online** — after `hcloud volume resize`, run `resize2fs`/`xfs_growfs` yourself; nothing automatic.
43
+ - `automount` mounts under `/mnt/<volume-name>` via udev — fine for experiments, wrong for services. Use an explicit `fstab` entry (`discard,nofail`) at a stable path; `nofail` so a detached volume doesn't hang boot.
44
+
45
+ ### Backups vs snapshots
46
+ | | Backups | Snapshots |
47
+ |---|---|---|
48
+ | Trigger | Automatic daily, 7 rolling | Manual |
49
+ | Cost | +20% of server price | Per GB stored |
50
+ | Survives server deletion | **No** | Yes |
51
+ | Can seed a new server | No (convert to snapshot first) | Yes (`--image <snapshot-id>`) |
52
+
53
+ Backup→snapshot conversion exists — do it before deleting a server whose history matters. Neither replaces app-level data exports — Hetzner backups are crash-consistent block copies, not application backups.
54
+
55
+ ### IaC (Pulumi / Terraform `hcloud` provider)
56
+ - **Changing `userData` replaces the server.** Deliberate for cattle; catastrophic for stateful nodes. Keep volatile config out of cloud-init (runtime config management owns it) and treat any cloud-init diff as a planned node replacement — or `ignoreChanges: ["userData"]` on pet servers.
57
+ - `serverType` change is a **replacement** in IaC even though the console/CLI resizes in place. To resize without replacement: `hcloud server change-type` manually, then refresh state + update code.
58
+ - Pulumi: `firewallIds` wants numbers — `firewall.id.apply(Number)`. Inline `networks` on the Server conflicts with a separate `ServerNetwork` resource — pick one.
59
+ - `backups: true` toggles in place (safe anytime). IaC-level `protect` only blocks the IaC tool — set **hcloud-side** delete/rebuild protection too; they guard different doors.
60
+ - Auth: `HCLOUD_TOKEN` env (CI/agents) — per-project tokens, read-write only where needed.
61
+
62
+ ## CLI Patterns
63
+
64
+ ```bash
65
+ export HCLOUD_TOKEN=... # stateless auth for CI/agents; `hcloud context` for humans
66
+ hcloud server list -o columns=name,status,ipv4,type -o noheader
67
+ hcloud server ssh my-server # no IP lookup, uses your agent keys
68
+ hcloud server create-image my-server --type snapshot --description "pre-change $(date +%F)"
69
+ hcloud volume list -o json | jq -r '.[] | select(.server==null) | .name' # orphaned volumes
70
+ hcloud primary-ip list -o json | jq -r '.[] | select(.assignee_id==null) | .ip' # orphaned IPs
71
+ hcloud server shutdown my-server \
72
+ && hcloud server change-type my-server --server-type cax31 --keep-disk \
73
+ && hcloud server poweron my-server # in-place upgrade, downgrade-capable
74
+ ```
75
+
76
+ ## Anti-Patterns
77
+
78
+ | Anti-pattern | Fix |
79
+ |-------------|-----|
80
+ | Trusting Cloud Firewall for private-net isolation | Host-level `ufw`; Cloud Firewall covers public interface only |
81
+ | SSH open to `0.0.0.0/0` | Admin-IP allowlist in firewall rules (or SSH over tunnel only) |
82
+ | `poweroff` before resize/maintenance | `shutdown` (ACPI graceful), then operate |
83
+ | Editing `userData` on a stateful server in IaC | Post-boot config mgmt; `ignoreChanges` or planned replacement |
84
+ | Relying on `automount` for service data | Explicit `fstab` (`discard,nofail`) at a stable mount point |
85
+ | Assuming CAX exists in every location | EU-only; check `server-type list` before designing |
86
+ | Deleting servers and assuming cleanup | Sweep volumes/snapshots/primary IPs — they persist and bill |
87
+ | Hetzner Backups as the only backup | App-level exports to object storage; backups die with the server |
88
+
89
+ ## References
90
+
91
+ | Resource | Purpose |
92
+ |----------|---------|
93
+ | <https://docs.hetzner.com/cloud/> | Authoritative, current limits/prices |
94
+ | <https://www.pulumi.com/registry/packages/hcloud/> | Pulumi provider resource reference |
95
+ | <https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs> | Terraform provider reference |
96
+ | **deployment** capability skill | Platform-level deploy/env-var/cron patterns |
@@ -0,0 +1,21 @@
1
+ import type { PluginConfig } from '../types.js';
2
+
3
+ export const config: PluginConfig = {
4
+ id: 'hetzner',
5
+ name: 'Hetzner Cloud',
6
+ category: 'tech',
7
+ subCategory: 'deployment',
8
+ label: 'Hetzner Cloud',
9
+ hint: 'IaaS — servers, volumes, private networks, firewalls via hcloud CLI / Pulumi',
10
+ skillName: 'hetzner-cloud',
11
+ authType: 'env-token',
12
+ envVars: [
13
+ {
14
+ name: 'HCLOUD_TOKEN',
15
+ hint: 'Hetzner Cloud Console → project → Security → API tokens (read-write)',
16
+ },
17
+ ],
18
+ agentToolMap: {},
19
+ docsUrl: null,
20
+ officialDocs: 'https://docs.hetzner.com/cloud/',
21
+ };
@@ -28,6 +28,7 @@ import { config as sentry } from './sentry/config.js';
28
28
  import { config as drizzle } from './drizzle/config.js';
29
29
  import { config as cloudflare } from './cloudflare/config.js';
30
30
  import { config as coolify } from './coolify/config.js';
31
+ import { config as hetzner } from './hetzner/config.js';
31
32
  import { config as expo } from './expo/config.js';
32
33
 
33
34
  export type { PluginConfig, McpServerConfig, McpInput, EnvVarRequirement } from './types.js';
@@ -57,6 +58,7 @@ export const PLUGINS: Record<string, PluginConfig> = {
57
58
  drizzle,
58
59
  cloudflare,
59
60
  coolify,
61
+ hetzner,
60
62
  expo,
61
63
  linear,
62
64
  jira,