opencastle 1.3.0 → 1.4.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.
- package/README.md +102 -131
- package/bin/cli.mjs +20 -10
- package/dist/cli/adapters/claude-code.d.ts +5 -3
- package/dist/cli/adapters/claude-code.d.ts.map +1 -1
- package/dist/cli/adapters/claude-code.js +7 -3
- package/dist/cli/adapters/claude-code.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts +18 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +29 -4
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/agent-plugin.test.js +12 -0
- package/dist/cli/agent-plugin.test.js.map +1 -1
- package/dist/cli/agent-roster.test.js +0 -48
- package/dist/cli/agent-roster.test.js.map +1 -1
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +20 -0
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/boundary.test.js +9 -7
- package/dist/cli/boundary.test.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +6 -4
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/command-namespace.test.js +33 -0
- package/dist/cli/command-namespace.test.js.map +1 -1
- package/dist/cli/convoy/artifacts.d.ts +9 -2
- package/dist/cli/convoy/artifacts.d.ts.map +1 -1
- package/dist/cli/convoy/artifacts.js +13 -10
- package/dist/cli/convoy/artifacts.js.map +1 -1
- package/dist/cli/convoy/artifacts.test.js +4 -2
- package/dist/cli/convoy/artifacts.test.js.map +1 -1
- package/dist/cli/convoy/engine.d.ts +53 -23
- package/dist/cli/convoy/engine.d.ts.map +1 -1
- package/dist/cli/convoy/engine.git.test.d.ts +2 -0
- package/dist/cli/convoy/engine.git.test.d.ts.map +1 -0
- package/dist/cli/convoy/engine.git.test.js +435 -0
- package/dist/cli/convoy/engine.git.test.js.map +1 -0
- package/dist/cli/convoy/engine.js +1746 -2305
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +698 -678
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/event-schemas.d.ts +2 -0
- package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
- package/dist/cli/convoy/event-schemas.js +59 -57
- package/dist/cli/convoy/event-schemas.js.map +1 -1
- package/dist/cli/convoy/events.d.ts +4 -1
- package/dist/cli/convoy/events.d.ts.map +1 -1
- package/dist/cli/convoy/events.js +69 -84
- package/dist/cli/convoy/events.js.map +1 -1
- package/dist/cli/convoy/events.test.js +50 -9
- package/dist/cli/convoy/events.test.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +9 -4
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +29 -14
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/convoy/isolation.d.ts +32 -6
- package/dist/cli/convoy/isolation.d.ts.map +1 -1
- package/dist/cli/convoy/isolation.js +72 -34
- package/dist/cli/convoy/isolation.js.map +1 -1
- package/dist/cli/convoy/isolation.test.js +66 -42
- package/dist/cli/convoy/isolation.test.js.map +1 -1
- package/dist/cli/convoy/lock.d.ts.map +1 -1
- package/dist/cli/convoy/lock.js +25 -10
- package/dist/cli/convoy/lock.js.map +1 -1
- package/dist/cli/convoy/lock.test.js +12 -0
- package/dist/cli/convoy/lock.test.js.map +1 -1
- package/dist/cli/convoy/merge.d.ts +21 -4
- package/dist/cli/convoy/merge.d.ts.map +1 -1
- package/dist/cli/convoy/merge.js +69 -53
- package/dist/cli/convoy/merge.js.map +1 -1
- package/dist/cli/convoy/merge.test.js +23 -1
- package/dist/cli/convoy/merge.test.js.map +1 -1
- package/dist/cli/convoy/progress.d.ts +35 -0
- package/dist/cli/convoy/progress.d.ts.map +1 -0
- package/dist/cli/convoy/progress.js +103 -0
- package/dist/cli/convoy/progress.js.map +1 -0
- package/dist/cli/convoy/progress.test.d.ts +2 -0
- package/dist/cli/convoy/progress.test.d.ts.map +1 -0
- package/dist/cli/convoy/progress.test.js +53 -0
- package/dist/cli/convoy/progress.test.js.map +1 -0
- package/dist/cli/convoy/read-model.d.ts +468 -0
- package/dist/cli/convoy/read-model.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.js +1132 -0
- package/dist/cli/convoy/read-model.js.map +1 -0
- package/dist/cli/convoy/read-model.test.d.ts +2 -0
- package/dist/cli/convoy/read-model.test.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.test.js +609 -0
- package/dist/cli/convoy/read-model.test.js.map +1 -0
- package/dist/cli/convoy/redact.d.ts +34 -0
- package/dist/cli/convoy/redact.d.ts.map +1 -0
- package/dist/cli/convoy/redact.js +66 -0
- package/dist/cli/convoy/redact.js.map +1 -0
- package/dist/cli/convoy/redact.test.d.ts +2 -0
- package/dist/cli/convoy/redact.test.d.ts.map +1 -0
- package/dist/cli/convoy/redact.test.js +43 -0
- package/dist/cli/convoy/redact.test.js.map +1 -0
- package/dist/cli/convoy/reviewer.d.ts +65 -0
- package/dist/cli/convoy/reviewer.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.js +141 -0
- package/dist/cli/convoy/reviewer.js.map +1 -0
- package/dist/cli/convoy/reviewer.test.d.ts +2 -0
- package/dist/cli/convoy/reviewer.test.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.test.js +96 -0
- package/dist/cli/convoy/reviewer.test.js.map +1 -0
- package/dist/cli/convoy/schedule.d.ts +30 -0
- package/dist/cli/convoy/schedule.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.js +111 -0
- package/dist/cli/convoy/schedule.js.map +1 -0
- package/dist/cli/convoy/schedule.test.d.ts +2 -0
- package/dist/cli/convoy/schedule.test.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.test.js +45 -0
- package/dist/cli/convoy/schedule.test.js.map +1 -0
- package/dist/cli/convoy/spec-builder.d.ts +120 -30
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +438 -114
- package/dist/cli/convoy/spec-builder.js.map +1 -1
- package/dist/cli/convoy/spec-builder.test.js +419 -435
- package/dist/cli/convoy/spec-builder.test.js.map +1 -1
- package/dist/cli/convoy/spec-types.d.ts +46 -92
- package/dist/cli/convoy/spec-types.d.ts.map +1 -1
- package/dist/cli/convoy/store.d.ts +6 -1
- package/dist/cli/convoy/store.d.ts.map +1 -1
- package/dist/cli/convoy/store.js +111 -15
- package/dist/cli/convoy/store.js.map +1 -1
- package/dist/cli/convoy/store.test.js +59 -13
- package/dist/cli/convoy/store.test.js.map +1 -1
- package/dist/cli/convoy/types.d.ts +76 -113
- package/dist/cli/convoy/types.d.ts.map +1 -1
- package/dist/cli/convoy/types.js +6 -13
- package/dist/cli/convoy/types.js.map +1 -1
- package/dist/cli/convoy/worktree.d.ts +88 -3
- package/dist/cli/convoy/worktree.d.ts.map +1 -1
- package/dist/cli/convoy/worktree.js +282 -56
- package/dist/cli/convoy/worktree.js.map +1 -1
- package/dist/cli/convoy/worktree.test.js +132 -1
- package/dist/cli/convoy/worktree.test.js.map +1 -1
- package/dist/cli/convoy-args.test.js +9 -27
- package/dist/cli/convoy-args.test.js.map +1 -1
- package/dist/cli/convoy-cmd.d.ts +31 -6
- package/dist/cli/convoy-cmd.d.ts.map +1 -1
- package/dist/cli/convoy-cmd.js +150 -200
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/convoy-cmd.test.d.ts +2 -0
- package/dist/cli/convoy-cmd.test.d.ts.map +1 -0
- package/dist/cli/convoy-cmd.test.js +144 -0
- package/dist/cli/convoy-cmd.test.js.map +1 -0
- package/dist/cli/dashboard.d.ts +24 -11
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js +241 -303
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/dashboard.test.d.ts +2 -0
- package/dist/cli/dashboard.test.d.ts.map +1 -0
- package/dist/cli/dashboard.test.js +340 -0
- package/dist/cli/dashboard.test.js.map +1 -0
- package/dist/cli/dispatcher.test.js +41 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +36 -11
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +9 -6
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init-own-files.test.d.ts +2 -0
- package/dist/cli/init-own-files.test.d.ts.map +1 -0
- package/dist/cli/init-own-files.test.js +133 -0
- package/dist/cli/init-own-files.test.js.map +1 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +106 -7
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/init.test.js +5 -4
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/layers.d.ts.map +1 -1
- package/dist/cli/layers.js +13 -4
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/lesson.d.ts.map +1 -1
- package/dist/cli/lesson.js +6 -5
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/log.d.ts +39 -0
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +267 -93
- package/dist/cli/log.js.map +1 -1
- package/dist/cli/log.test.d.ts +2 -0
- package/dist/cli/log.test.d.ts.map +1 -0
- package/dist/cli/log.test.js +208 -0
- package/dist/cli/log.test.js.map +1 -0
- package/dist/cli/nearest.d.ts +18 -0
- package/dist/cli/nearest.d.ts.map +1 -0
- package/dist/cli/nearest.js +38 -0
- package/dist/cli/nearest.js.map +1 -0
- package/dist/cli/nearest.test.d.ts +2 -0
- package/dist/cli/nearest.test.d.ts.map +1 -0
- package/dist/cli/nearest.test.js +24 -0
- package/dist/cli/nearest.test.js.map +1 -0
- package/dist/cli/pipeline.d.ts +61 -0
- package/dist/cli/pipeline.d.ts.map +1 -1
- package/dist/cli/pipeline.flow.test.d.ts +2 -0
- package/dist/cli/pipeline.flow.test.d.ts.map +1 -0
- package/dist/cli/pipeline.flow.test.js +524 -0
- package/dist/cli/pipeline.flow.test.js.map +1 -0
- package/dist/cli/pipeline.js +471 -690
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +82 -31
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +167 -507
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.d.ts +2 -0
- package/dist/cli/plan.test.d.ts.map +1 -0
- package/dist/cli/plan.test.js +158 -0
- package/dist/cli/plan.test.js.map +1 -0
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +9 -7
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/prompt.test.js +20 -2
- package/dist/cli/prompt.test.js.map +1 -1
- package/dist/cli/remove.d.ts.map +1 -1
- package/dist/cli/remove.js +3 -1
- package/dist/cli/remove.js.map +1 -1
- package/dist/cli/review.d.ts.map +1 -1
- package/dist/cli/review.js +7 -1
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/run/adapters/agent-process.d.ts +82 -0
- package/dist/cli/run/adapters/agent-process.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.js +224 -0
- package/dist/cli/run/adapters/agent-process.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts +2 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.js +159 -0
- package/dist/cli/run/adapters/agent-process.test.js.map +1 -0
- package/dist/cli/run/adapters/claude.d.ts +53 -2
- package/dist/cli/run/adapters/claude.d.ts.map +1 -1
- package/dist/cli/run/adapters/claude.js +147 -171
- package/dist/cli/run/adapters/claude.js.map +1 -1
- package/dist/cli/run/adapters/claude.test.js +197 -254
- package/dist/cli/run/adapters/claude.test.js.map +1 -1
- package/dist/cli/run/adapters/codex.d.ts +25 -2
- package/dist/cli/run/adapters/codex.d.ts.map +1 -1
- package/dist/cli/run/adapters/codex.js +113 -81
- package/dist/cli/run/adapters/codex.js.map +1 -1
- package/dist/cli/run/adapters/codex.test.js +116 -95
- package/dist/cli/run/adapters/codex.test.js.map +1 -1
- package/dist/cli/run/adapters/copilot.d.ts +35 -1
- package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
- package/dist/cli/run/adapters/copilot.js +104 -287
- package/dist/cli/run/adapters/copilot.js.map +1 -1
- package/dist/cli/run/adapters/copilot.test.js +122 -282
- package/dist/cli/run/adapters/copilot.test.js.map +1 -1
- package/dist/cli/run/adapters/cursor.d.ts +25 -7
- package/dist/cli/run/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/run/adapters/cursor.js +103 -156
- package/dist/cli/run/adapters/cursor.js.map +1 -1
- package/dist/cli/run/adapters/cursor.test.js +106 -218
- package/dist/cli/run/adapters/cursor.test.js.map +1 -1
- package/dist/cli/run/adapters/index.d.ts +34 -5
- package/dist/cli/run/adapters/index.d.ts.map +1 -1
- package/dist/cli/run/adapters/index.js +147 -21
- package/dist/cli/run/adapters/index.js.map +1 -1
- package/dist/cli/run/adapters/index.test.d.ts +2 -0
- package/dist/cli/run/adapters/index.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/index.test.js +129 -0
- package/dist/cli/run/adapters/index.test.js.map +1 -0
- package/dist/cli/run/adapters/opencode.d.ts +25 -9
- package/dist/cli/run/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/run/adapters/opencode.js +136 -152
- package/dist/cli/run/adapters/opencode.js.map +1 -1
- package/dist/cli/run/adapters/opencode.test.js +99 -218
- package/dist/cli/run/adapters/opencode.test.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.d.ts +47 -4
- package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -1
- package/dist/cli/run/adapters/permission-modes.js +113 -37
- package/dist/cli/run/adapters/permission-modes.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.test.js +55 -40
- package/dist/cli/run/adapters/permission-modes.test.js.map +1 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +22 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js +73 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -0
- package/dist/cli/run/platform.d.ts +52 -0
- package/dist/cli/run/platform.d.ts.map +1 -0
- package/dist/cli/run/platform.js +207 -0
- package/dist/cli/run/platform.js.map +1 -0
- package/dist/cli/run/platform.test.d.ts +2 -0
- package/dist/cli/run/platform.test.d.ts.map +1 -0
- package/dist/cli/run/platform.test.js +119 -0
- package/dist/cli/run/platform.test.js.map +1 -0
- package/dist/cli/run/schema.d.ts +6 -8
- package/dist/cli/run/schema.d.ts.map +1 -1
- package/dist/cli/run/schema.js +44 -68
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run/schema.test.js +59 -279
- package/dist/cli/run/schema.test.js.map +1 -1
- package/dist/cli/run.d.ts +34 -56
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +379 -1132
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/run.test.d.ts +2 -0
- package/dist/cli/run.test.d.ts.map +1 -0
- package/dist/cli/run.test.js +318 -0
- package/dist/cli/run.test.js.map +1 -0
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +12 -3
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +3 -2
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/team-config.d.ts.map +1 -1
- package/dist/cli/team-config.js +2 -21
- package/dist/cli/team-config.js.map +1 -1
- package/dist/cli/tiers.test.js +4 -13
- package/dist/cli/tiers.test.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +4 -3
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/website-plugins.test.js +51 -2
- package/dist/cli/website-plugins.test.js.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.js +13 -0
- package/dist/orchestrator/plugins/coolify/config.js.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.js +13 -0
- package/dist/orchestrator/plugins/sentry/config.js.map +1 -1
- package/package.json +3 -10
- package/src/cli/adapters/claude-code.ts +7 -3
- package/src/cli/adapters/single-file-base.ts +47 -4
- package/src/cli/agent-plugin.test.ts +14 -0
- package/src/cli/agent-roster.test.ts +0 -55
- package/src/cli/bootstrap.ts +23 -0
- package/src/cli/boundary.test.ts +9 -7
- package/src/cli/ci.ts +6 -4
- package/src/cli/command-namespace.test.ts +35 -0
- package/src/cli/convoy/TELEMETRY.md +138 -130
- package/src/cli/convoy/artifacts.test.ts +4 -2
- package/src/cli/convoy/artifacts.ts +13 -12
- package/src/cli/convoy/engine.git.test.ts +462 -0
- package/src/cli/convoy/engine.test.ts +817 -850
- package/src/cli/convoy/engine.ts +1864 -2596
- package/src/cli/convoy/event-schemas.ts +63 -59
- package/src/cli/convoy/events.test.ts +58 -9
- package/src/cli/convoy/events.ts +69 -91
- package/src/cli/convoy/gates.ts +31 -12
- package/src/cli/convoy/isolation.test.ts +76 -43
- package/src/cli/convoy/isolation.ts +100 -38
- package/src/cli/convoy/lock.test.ts +16 -0
- package/src/cli/convoy/lock.ts +25 -8
- package/src/cli/convoy/merge.test.ts +25 -1
- package/src/cli/convoy/merge.ts +74 -61
- package/src/cli/convoy/progress.test.ts +59 -0
- package/src/cli/convoy/progress.ts +121 -0
- package/src/cli/convoy/read-model.test.ts +685 -0
- package/src/cli/convoy/read-model.ts +1469 -0
- package/src/cli/convoy/redact.test.ts +49 -0
- package/src/cli/convoy/redact.ts +73 -0
- package/src/cli/convoy/reviewer.test.ts +112 -0
- package/src/cli/convoy/reviewer.ts +196 -0
- package/src/cli/convoy/schedule.test.ts +56 -0
- package/src/cli/convoy/schedule.ts +109 -0
- package/src/cli/convoy/spec-builder.test.ts +460 -464
- package/src/cli/convoy/spec-builder.ts +460 -129
- package/src/cli/convoy/spec-types.ts +46 -108
- package/src/cli/convoy/store.test.ts +64 -13
- package/src/cli/convoy/store.ts +143 -33
- package/src/cli/convoy/types.ts +59 -71
- package/src/cli/convoy/worktree.test.ts +140 -1
- package/src/cli/convoy/worktree.ts +311 -61
- package/src/cli/convoy-args.test.ts +10 -30
- package/src/cli/convoy-cmd.test.ts +163 -0
- package/src/cli/convoy-cmd.ts +173 -215
- package/src/cli/dashboard/dashboard.css +2086 -0
- package/src/cli/dashboard/dashboard.js +1687 -0
- package/src/cli/dashboard/index.html +307 -0
- package/src/cli/dashboard.test.ts +382 -0
- package/src/cli/dashboard.ts +243 -339
- package/src/cli/dispatcher.test.ts +43 -2
- package/src/cli/docs-accuracy.test.ts +37 -10
- package/src/cli/doctor.ts +9 -6
- package/src/cli/init-own-files.test.ts +156 -0
- package/src/cli/init.test.ts +5 -4
- package/src/cli/init.ts +104 -7
- package/src/cli/layers.ts +13 -4
- package/src/cli/lesson.ts +6 -5
- package/src/cli/log.test.ts +228 -0
- package/src/cli/log.ts +302 -83
- package/src/cli/nearest.test.ts +27 -0
- package/src/cli/nearest.ts +38 -0
- package/src/cli/pipeline.flow.test.ts +607 -0
- package/src/cli/pipeline.ts +544 -759
- package/src/cli/plan.test.ts +193 -0
- package/src/cli/plan.ts +209 -545
- package/src/cli/prompt.test.ts +21 -2
- package/src/cli/prompt.ts +11 -7
- package/src/cli/remove.ts +3 -0
- package/src/cli/review.ts +7 -1
- package/src/cli/run/adapters/agent-process.test.ts +175 -0
- package/src/cli/run/adapters/agent-process.ts +252 -0
- package/src/cli/run/adapters/claude.test.ts +205 -260
- package/src/cli/run/adapters/claude.ts +151 -162
- package/src/cli/run/adapters/codex.test.ts +120 -100
- package/src/cli/run/adapters/codex.ts +115 -91
- package/src/cli/run/adapters/copilot.test.ts +135 -306
- package/src/cli/run/adapters/copilot.ts +105 -274
- package/src/cli/run/adapters/cursor.test.ts +111 -220
- package/src/cli/run/adapters/cursor.ts +105 -156
- package/src/cli/run/adapters/index.test.ts +148 -0
- package/src/cli/run/adapters/index.ts +168 -20
- package/src/cli/run/adapters/opencode.test.ts +106 -227
- package/src/cli/run/adapters/opencode.ts +139 -151
- package/src/cli/run/adapters/permission-modes.test.ts +63 -41
- package/src/cli/run/adapters/permission-modes.ts +118 -37
- package/src/cli/run/adapters/stub-cli.test-helper.ts +88 -0
- package/src/cli/run/platform.test.ts +128 -0
- package/src/cli/run/platform.ts +213 -0
- package/src/cli/run/schema.test.ts +62 -344
- package/src/cli/run/schema.ts +48 -78
- package/src/cli/run.test.ts +351 -0
- package/src/cli/run.ts +366 -1151
- package/src/cli/sync-check.ts +12 -3
- package/src/cli/sync.ts +3 -2
- package/src/cli/team-config.ts +2 -21
- package/src/cli/tiers.test.ts +4 -17
- package/src/cli/update.ts +4 -3
- package/src/cli/website-plugins.test.ts +55 -5
- package/src/orchestrator/agents/team-lead.agent.md +2 -2
- package/src/orchestrator/customizations/README.md +58 -13
- package/src/orchestrator/customizations/logs/README.md +23 -18
- package/src/orchestrator/instructions/general.instructions.md +1 -1
- package/src/orchestrator/plugins/coolify/config.ts +13 -0
- package/src/orchestrator/plugins/sentry/config.ts +13 -0
- package/src/orchestrator/prompts/assess-complexity.prompt.md +43 -26
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +44 -49
- package/src/orchestrator/prompts/brainstorm.prompt.md +2 -2
- package/src/orchestrator/prompts/bug-fix.prompt.md +5 -4
- package/src/orchestrator/prompts/create-skill.prompt.md +29 -39
- package/src/orchestrator/prompts/fix-convoy.prompt.md +43 -29
- package/src/orchestrator/prompts/fix-prd.prompt.md +26 -22
- package/src/orchestrator/prompts/generate-convoy.prompt.md +139 -147
- package/src/orchestrator/prompts/generate-prd.prompt.md +75 -68
- package/src/orchestrator/prompts/implement-feature.prompt.md +7 -6
- package/src/orchestrator/prompts/validate-convoy.prompt.md +29 -28
- package/src/orchestrator/prompts/validate-prd.prompt.md +28 -21
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -3
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +3 -1
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +7 -8
- package/dist/cli/convoy/dag-analysis.d.ts +0 -39
- package/dist/cli/convoy/dag-analysis.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.js +0 -279
- package/dist/cli/convoy/dag-analysis.js.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.d.ts +0 -2
- package/dist/cli/convoy/dag-analysis.test.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.js +0 -289
- package/dist/cli/convoy/dag-analysis.test.js.map +0 -1
- package/dist/cli/convoy/formula.d.ts +0 -19
- package/dist/cli/convoy/formula.d.ts.map +0 -1
- package/dist/cli/convoy/formula.js +0 -142
- package/dist/cli/convoy/formula.js.map +0 -1
- package/dist/cli/convoy/formula.test.d.ts +0 -2
- package/dist/cli/convoy/formula.test.d.ts.map +0 -1
- package/dist/cli/convoy/formula.test.js +0 -342
- package/dist/cli/convoy/formula.test.js.map +0 -1
- package/dist/cli/convoy/health.d.ts +0 -34
- package/dist/cli/convoy/health.d.ts.map +0 -1
- package/dist/cli/convoy/health.js +0 -123
- package/dist/cli/convoy/health.js.map +0 -1
- package/dist/cli/convoy/health.test.d.ts +0 -2
- package/dist/cli/convoy/health.test.d.ts.map +0 -1
- package/dist/cli/convoy/health.test.js +0 -448
- package/dist/cli/convoy/health.test.js.map +0 -1
- package/dist/cli/convoy/last-run.d.ts +0 -53
- package/dist/cli/convoy/last-run.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.js +0 -54
- package/dist/cli/convoy/last-run.js.map +0 -1
- package/dist/cli/convoy/last-run.test.d.ts +0 -2
- package/dist/cli/convoy/last-run.test.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.test.js +0 -110
- package/dist/cli/convoy/last-run.test.js.map +0 -1
- package/dist/cli/convoy/pipeline.d.ts +0 -41
- package/dist/cli/convoy/pipeline.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.js +0 -414
- package/dist/cli/convoy/pipeline.js.map +0 -1
- package/dist/cli/convoy/pipeline.test.d.ts +0 -2
- package/dist/cli/convoy/pipeline.test.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.test.js +0 -837
- package/dist/cli/convoy/pipeline.test.js.map +0 -1
- package/dist/cli/convoy/review-stages.d.ts +0 -9
- package/dist/cli/convoy/review-stages.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.js +0 -134
- package/dist/cli/convoy/review-stages.js.map +0 -1
- package/dist/cli/convoy/review-stages.test.d.ts +0 -2
- package/dist/cli/convoy/review-stages.test.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.test.js +0 -197
- package/dist/cli/convoy/review-stages.test.js.map +0 -1
- package/dist/cli/run/executor.d.ts +0 -15
- package/dist/cli/run/executor.d.ts.map +0 -1
- package/dist/cli/run/executor.js +0 -249
- package/dist/cli/run/executor.js.map +0 -1
- package/dist/cli/run/executor.test.d.ts +0 -2
- package/dist/cli/run/executor.test.d.ts.map +0 -1
- package/dist/cli/run/executor.test.js +0 -297
- package/dist/cli/run/executor.test.js.map +0 -1
- package/dist/cli/run/reporter.d.ts +0 -10
- package/dist/cli/run/reporter.d.ts.map +0 -1
- package/dist/cli/run/reporter.js +0 -142
- package/dist/cli/run/reporter.js.map +0 -1
- package/dist/cli/run-dry-run.test.d.ts +0 -2
- package/dist/cli/run-dry-run.test.d.ts.map +0 -1
- package/dist/cli/run-dry-run.test.js +0 -83
- package/dist/cli/run-dry-run.test.js.map +0 -1
- package/dist/cli/run-executor-flags.test.d.ts +0 -2
- package/dist/cli/run-executor-flags.test.d.ts.map +0 -1
- package/dist/cli/run-executor-flags.test.js +0 -31
- package/dist/cli/run-executor-flags.test.js.map +0 -1
- package/dist/cli/run-finish.test.d.ts +0 -2
- package/dist/cli/run-finish.test.d.ts.map +0 -1
- package/dist/cli/run-finish.test.js +0 -77
- package/dist/cli/run-finish.test.js.map +0 -1
- package/dist/cli/watch.d.ts +0 -15
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js +0 -277
- package/dist/cli/watch.js.map +0 -1
- package/dist/dashboard/scripts/etl.d.ts +0 -10
- package/dist/dashboard/scripts/etl.d.ts.map +0 -1
- package/dist/dashboard/scripts/etl.js +0 -141
- package/dist/dashboard/scripts/etl.js.map +0 -1
- package/src/cli/convoy/dag-analysis.test.ts +0 -349
- package/src/cli/convoy/dag-analysis.ts +0 -367
- package/src/cli/convoy/formula.test.ts +0 -404
- package/src/cli/convoy/formula.ts +0 -174
- package/src/cli/convoy/health.test.ts +0 -519
- package/src/cli/convoy/health.ts +0 -189
- package/src/cli/convoy/last-run.test.ts +0 -130
- package/src/cli/convoy/last-run.ts +0 -87
- package/src/cli/convoy/pipeline.test.ts +0 -999
- package/src/cli/convoy/pipeline.ts +0 -492
- package/src/cli/convoy/review-stages.test.ts +0 -235
- package/src/cli/convoy/review-stages.ts +0 -166
- package/src/cli/run/executor.test.ts +0 -338
- package/src/cli/run/executor.ts +0 -292
- package/src/cli/run/reporter.ts +0 -160
- package/src/cli/run-dry-run.test.ts +0 -97
- package/src/cli/run-executor-flags.test.ts +0 -38
- package/src/cli/run-finish.test.ts +0 -91
- package/src/cli/watch.ts +0 -295
- package/src/dashboard/astro.config.mjs +0 -6
- package/src/dashboard/dist/_astro/index.CADNhRPS.css +0 -1
- package/src/dashboard/dist/data/.gitkeep +0 -0
- package/src/dashboard/dist/data/convoy-list.json +0 -1
- package/src/dashboard/dist/data/overall-stats.json +0 -29
- package/src/dashboard/dist/index.html +0 -1963
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +0 -31
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js +0 -6776
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js +0 -99
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/package.json +0 -3
- package/src/dashboard/package-lock.json +0 -6
- package/src/dashboard/public/data/.gitkeep +0 -0
- package/src/dashboard/public/data/convoy-list.json +0 -1
- package/src/dashboard/public/data/overall-stats.json +0 -29
- package/src/dashboard/public/icon-192.png +0 -0
- package/src/dashboard/scripts/etl.test.ts +0 -166
- package/src/dashboard/scripts/etl.ts +0 -170
- package/src/dashboard/scripts/generate-demo-db.test.ts +0 -30
- package/src/dashboard/scripts/generate-demo-db.ts +0 -529
- package/src/dashboard/scripts/integration-test.ts +0 -504
- package/src/dashboard/scripts/verify-demo-data.sh +0 -51
- package/src/dashboard/seed-data/delegations.ndjson +0 -35
- package/src/dashboard/seed-data/events.ndjson +0 -104
- package/src/dashboard/seed-data/panels.ndjson +0 -13
- package/src/dashboard/seed-data/reviews.ndjson +0 -6
- package/src/dashboard/seed-data/sessions.ndjson +0 -50
- package/src/dashboard/src/env.d.ts +0 -1
- package/src/dashboard/src/layouts/Layout.astro +0 -25
- package/src/dashboard/src/pages/index.astro +0 -2313
- package/src/dashboard/src/styles/dashboard.css +0 -2943
- package/src/dashboard/tsconfig.json +0 -6
- /package/src/{dashboard/dist → cli/dashboard}/icon-192.png +0 -0
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* commands explain themselves instead of saying "unknown", that agent-facing
|
|
7
7
|
* commands stay reachable but hidden, and that every advertised command resolves.
|
|
8
8
|
*/
|
|
9
|
-
import { readFileSync, existsSync } from 'node:fs'
|
|
10
|
-
import {
|
|
9
|
+
import { readFileSync, existsSync, mkdtempSync, rmSync } from 'node:fs'
|
|
10
|
+
import { execFileSync } from 'node:child_process'
|
|
11
|
+
import { tmpdir } from 'node:os'
|
|
12
|
+
import { join, resolve } from 'node:path'
|
|
11
13
|
import { describe, it, expect } from 'vitest'
|
|
12
14
|
|
|
13
15
|
const cliPath = resolve(import.meta.dirname, '..', '..', 'bin', 'cli.mjs')
|
|
@@ -132,4 +134,43 @@ describe('global behavior', () => {
|
|
|
132
134
|
// Everything else must still reach the user.
|
|
133
135
|
expect(source).toMatch(/console\.error\(`\$\{warning\.name\}: \$\{warning\.message\}`\)/)
|
|
134
136
|
})
|
|
137
|
+
|
|
138
|
+
it('stops quietly when the reader closes the pipe early', () => {
|
|
139
|
+
// `opencastle init | head` printed an EPIPE stack trace after the lines that
|
|
140
|
+
// were wanted. Whether a run reaches that write depends on timing, so the
|
|
141
|
+
// handler is asserted here rather than raced in a test.
|
|
142
|
+
expect(source).toMatch(/stream\.on\('error'[\s\S]{0,80}err\.code === 'EPIPE'\) process\.exit\(0\)/)
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
describe('--version', () => {
|
|
147
|
+
// Run from a scratch directory: if a command were ever run by mistake here,
|
|
148
|
+
// it must not touch this repository.
|
|
149
|
+
const run = (args: string[]): { code: number; stdout: string; stderr: string } => {
|
|
150
|
+
const cwd = mkdtempSync(join(tmpdir(), 'oc-version-'))
|
|
151
|
+
try {
|
|
152
|
+
const stdout = execFileSync('node', [cliPath, ...args], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
|
|
153
|
+
return { code: 0, stdout, stderr: '' }
|
|
154
|
+
} catch (err) {
|
|
155
|
+
const e = err as { status: number; stdout: string; stderr: string }
|
|
156
|
+
return { code: e.status, stdout: String(e.stdout), stderr: String(e.stderr) }
|
|
157
|
+
} finally {
|
|
158
|
+
rmSync(cwd, { recursive: true, force: true })
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
it('prints the version as the first argument', () => {
|
|
163
|
+
const { version } = JSON.parse(readFileSync(resolve(import.meta.dirname, '..', '..', 'package.json'), 'utf8'))
|
|
164
|
+
expect(run(['--version']).stdout.trim()).toBe(version)
|
|
165
|
+
expect(run(['-v']).stdout.trim()).toBe(version)
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
it('is not read after a command, where -v can be a value or a word', () => {
|
|
169
|
+
// `opencastle log --task -v` printed the version and recorded nothing.
|
|
170
|
+
// A command with a closed flag set refuses it instead of running without it.
|
|
171
|
+
const r = run(['init', '--version'])
|
|
172
|
+
expect(r.code).toBe(1)
|
|
173
|
+
expect(r.stderr).toContain('Unknown option for "init": --version')
|
|
174
|
+
expect(r.stderr).toContain('put it first: opencastle --version')
|
|
175
|
+
})
|
|
135
176
|
})
|
|
@@ -43,10 +43,12 @@ const actual = {
|
|
|
43
43
|
skills: countDirEntries(join(orchestrator, 'skills'), () => true),
|
|
44
44
|
plugins: countDirEntries(join(orchestrator, 'plugins'), (n) => !n.endsWith('.ts')),
|
|
45
45
|
// README.md documents the directory for contributors; it is not a template,
|
|
46
|
-
// and no adapter installs it.
|
|
46
|
+
// and no adapter installs it. shared-delivery-phase.md is installed, but it is
|
|
47
|
+
// the phase every template ends with, not a template of its own — counting it
|
|
48
|
+
// made the README say 9 while the template tables everywhere else list 8.
|
|
47
49
|
workflows: countDirEntries(
|
|
48
50
|
join(orchestrator, 'agent-workflows'),
|
|
49
|
-
(n) => n.endsWith('.md') && n !== 'README.md',
|
|
51
|
+
(n) => n.endsWith('.md') && n !== 'README.md' && n !== 'shared-delivery-phase.md',
|
|
50
52
|
),
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -76,8 +78,11 @@ function contentFilesFor(dir: string, exts: string[], out: string[] = []): strin
|
|
|
76
78
|
if (!existsSync(dir)) return out
|
|
77
79
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
78
80
|
const p = join(dir, entry.name)
|
|
79
|
-
if (entry.isDirectory())
|
|
80
|
-
|
|
81
|
+
if (entry.isDirectory()) {
|
|
82
|
+
// Installed dependencies are not our instructions, and a tool's own
|
|
83
|
+
// node_modules would make every scan here read thousands of files.
|
|
84
|
+
if (entry.name !== 'node_modules') contentFilesFor(p, exts, out)
|
|
85
|
+
} else if (exts.some((e) => entry.name.endsWith(e))) out.push(p)
|
|
81
86
|
}
|
|
82
87
|
return out
|
|
83
88
|
}
|
|
@@ -166,12 +171,34 @@ describe('shipped content instructs only commands that exist', () => {
|
|
|
166
171
|
expect(files.length).toBeGreaterThan(0)
|
|
167
172
|
})
|
|
168
173
|
|
|
174
|
+
// The demo video is built by scripts that call the entrypoint directly, and its
|
|
175
|
+
// narration is plain text. Neither shape was read: the build ran
|
|
176
|
+
// `node "$SCRIPT_DIR/../bin/cli.mjs" dashboard`, a removed command, and only
|
|
177
|
+
// `opencastle <cmd>` was ever matched. Scripts and narration are read for that
|
|
178
|
+
// check alone — the model and invention checks are written for prose.
|
|
179
|
+
const toolScripts = load(contentFilesFor(join(repoRoot, 'tools'), ['.mjs', '.cjs', '.js', '.ts', '.txt']))
|
|
180
|
+
|
|
181
|
+
/** Invocations of a removed command: by name, or through `bin/cli.mjs`. */
|
|
182
|
+
const removedUsages = (cmd: string): RegExp[] => [
|
|
183
|
+
new RegExp(`(?:npx )?opencastle ${cmd}(?![a-z-])`, 'g'),
|
|
184
|
+
new RegExp(`cli\\.mjs["']?[ \\t]+${cmd}(?![a-z-])`, 'g'),
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
it('recognises a removed command called through bin/cli.mjs', () => {
|
|
188
|
+
// The line that went unnoticed, so the pattern is held to it.
|
|
189
|
+
const line = 'node "$SCRIPT_DIR/../bin/cli.mjs" dashboard --seed --no-open &'
|
|
190
|
+
expect(removedUsages('dashboard').some((re) => new RegExp(re.source).test(line))).toBe(true)
|
|
191
|
+
// A subcommand of a real command is not the removed top-level one.
|
|
192
|
+
expect(removedUsages('dashboard').some((re) => new RegExp(re.source).test('node bin/cli.mjs convoy dashboard'))).toBe(false)
|
|
193
|
+
})
|
|
194
|
+
|
|
169
195
|
it('names no removed command', () => {
|
|
170
196
|
const offenders: string[] = []
|
|
171
197
|
for (const cmd of replacedCommands()) {
|
|
172
|
-
const usage
|
|
173
|
-
|
|
174
|
-
|
|
198
|
+
for (const usage of removedUsages(cmd)) {
|
|
199
|
+
for (const file of [...files, ...toolScripts]) {
|
|
200
|
+
for (const hit of file.text.matchAll(usage)) offenders.push(`${file.rel}: ${hit[0]}`)
|
|
201
|
+
}
|
|
175
202
|
}
|
|
176
203
|
}
|
|
177
204
|
expect(offenders).toEqual([])
|
|
@@ -184,8 +211,8 @@ describe('shipped content instructs only commands that exist', () => {
|
|
|
184
211
|
// catches an invention.
|
|
185
212
|
const real = new Set([...visibleCommands(), ...hiddenCommands()])
|
|
186
213
|
// Subcommands of `convoy`, which the dispatcher never sees directly.
|
|
187
|
-
// `run` belongs here after all: `convoy run
|
|
188
|
-
//
|
|
214
|
+
// `run` belongs here after all: `convoy run <spec>` is the form that reads
|
|
215
|
+
// a spec, and it is what the planner's own hint prints. Removing
|
|
189
216
|
// it from this list, on the reasoning that `convoy --help` did not name it,
|
|
190
217
|
// sent every mention to `convoy --file` — a form the parser never read, which
|
|
191
218
|
// answered a missing file with the status screen and exit 0.
|
|
@@ -465,7 +492,7 @@ describe('quickstart stays runnable', () => {
|
|
|
465
492
|
describe.skipIf(!cliBuilt)('documented flags are flags the command declares', () => {
|
|
466
493
|
const GLOBAL = new Set(['--help', '-h', '--debug', '--version', '-v'])
|
|
467
494
|
|
|
468
|
-
// The command *path*, not the first word. `convoy run --
|
|
495
|
+
// The command *path*, not the first word. `convoy run --dry-run` is read by `run`,
|
|
469
496
|
// and asking `convoy --help` about it says the flag does not exist — which is
|
|
470
497
|
// how a correct line came to be reported as an error, and how the wrong "fix"
|
|
471
498
|
// (rewriting every mention to `convoy --file`) got made.
|
package/src/cli/doctor.ts
CHANGED
|
@@ -30,14 +30,17 @@ import {
|
|
|
30
30
|
import { cliVersionOf, requiredEnvVars } from './layers.js';
|
|
31
31
|
import type { CliContext, DoctorCheck, IdeChoice, Manifest } from './types.js';
|
|
32
32
|
import { IDE_LABELS } from './types.js';
|
|
33
|
+
import { c } from './prompt.js';
|
|
33
34
|
|
|
34
35
|
// ── Styled output helpers ─────────────────────────────────────
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
37
|
+
// The shared helpers, so `NO_COLOR` holds here too; these were the one set of
|
|
38
|
+
// colours written by hand.
|
|
39
|
+
const PASS = c.green('✓');
|
|
40
|
+
const FAIL = c.red('✗');
|
|
41
|
+
const WARN = c.yellow('!');
|
|
42
|
+
const DIM = c.dim;
|
|
43
|
+
const BOLD = c.bold;
|
|
41
44
|
|
|
42
45
|
interface CheckResult {
|
|
43
46
|
ok: boolean;
|
|
@@ -529,7 +532,7 @@ const DOCTOR_HELP = `
|
|
|
529
532
|
|
|
530
533
|
Validate your OpenCastle setup — checks manifest, customizations, skills,
|
|
531
534
|
logs, MCP configuration, and IDE-specific rules. MCP servers are audited too:
|
|
532
|
-
a package run without an exact version, one
|
|
535
|
+
a package run without an exact version, one OpenCastle knows is not on npm, a
|
|
533
536
|
remote server Claude Code cannot load, a credential written into the file, or
|
|
534
537
|
a server the team's policy does not allow.
|
|
535
538
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `init` says about files that were there before it.
|
|
3
|
+
*
|
|
4
|
+
* A target is often detected because of a file of the user's in its own rules
|
|
5
|
+
* directory — `.cursor/rules/team.mdc` is what makes Cursor a target — and that
|
|
6
|
+
* directory is generated, so the next `sync` removes the file. `init` used to
|
|
7
|
+
* say nothing, and the first anyone heard of it was `sync` naming a file it had
|
|
8
|
+
* just deleted. The same accounting is what makes "Left N existing files
|
|
9
|
+
* untouched" mean files that were there: a fresh seven-target install said 205,
|
|
10
|
+
* every one of them written a moment earlier by the target before.
|
|
11
|
+
*/
|
|
12
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
13
|
+
import { execFileSync } from 'node:child_process'
|
|
14
|
+
import { mkdtempSync, mkdirSync, rmSync, writeFileSync, readFileSync, existsSync } from 'node:fs'
|
|
15
|
+
import { tmpdir } from 'node:os'
|
|
16
|
+
import { join, resolve } from 'node:path'
|
|
17
|
+
|
|
18
|
+
const repoRoot = resolve(import.meta.dirname, '..', '..')
|
|
19
|
+
const cli = join(repoRoot, 'bin', 'cli.mjs')
|
|
20
|
+
|
|
21
|
+
// `bin/cli.mjs` loads the command modules from `dist/`. CI builds before
|
|
22
|
+
// `npm test`, so nothing here is skipped there.
|
|
23
|
+
const cliBuilt = existsSync(join(repoRoot, 'dist', 'cli', 'init.js'))
|
|
24
|
+
|
|
25
|
+
describe.skipIf(!cliBuilt)('init and the files already there', () => {
|
|
26
|
+
let projectRoot: string
|
|
27
|
+
let home: string
|
|
28
|
+
|
|
29
|
+
const run = (...args: string[]): string =>
|
|
30
|
+
execFileSync('node', [cli, ...args], {
|
|
31
|
+
cwd: projectRoot,
|
|
32
|
+
encoding: 'utf8',
|
|
33
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
34
|
+
// A scratch home, so nothing of the person running the tests is read, and
|
|
35
|
+
// plain text to assert on.
|
|
36
|
+
env: { ...process.env, HOME: home, CLAUDE_CONFIG_DIR: join(home, '.claude'), CODEX_HOME: join(home, '.codex'), NO_COLOR: '1' },
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
projectRoot = mkdtempSync(join(tmpdir(), 'oc-own-files-'))
|
|
41
|
+
home = mkdtempSync(join(tmpdir(), 'oc-own-files-home-'))
|
|
42
|
+
execFileSync('git', ['init', '-q'], { cwd: projectRoot })
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
afterEach(() => {
|
|
46
|
+
rmSync(projectRoot, { recursive: true, force: true })
|
|
47
|
+
rmSync(home, { recursive: true, force: true })
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('names a rule of yours in a generated directory, and leaves it in place', () => {
|
|
51
|
+
mkdirSync(join(projectRoot, '.cursor', 'rules'), { recursive: true })
|
|
52
|
+
writeFileSync(join(projectRoot, '.cursor', 'rules', 'team.mdc'), '---\nalwaysApply: true\n---\nUse tabs.\n')
|
|
53
|
+
|
|
54
|
+
const out = run('init', '--yes')
|
|
55
|
+
|
|
56
|
+
expect(out).toContain('1 file of yours is in a directory OpenCastle generates')
|
|
57
|
+
expect(out).toContain('.cursor/rules/team.mdc')
|
|
58
|
+
expect(out).toContain('The next sync removes it')
|
|
59
|
+
expect(readFileSync(join(projectRoot, '.cursor', 'rules', 'team.mdc'), 'utf8')).toContain('Use tabs.')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('says nothing of the kind when there is nothing of yours there', () => {
|
|
63
|
+
writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
|
|
64
|
+
expect(run('init', '--yes')).not.toContain('of yours')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('counts nothing as left alone on a fresh install for several targets that share a directory', () => {
|
|
68
|
+
// Cursor, Windsurf and OpenCode all write `.agents/skills/`.
|
|
69
|
+
writeFileSync(join(projectRoot, '.cursorrules'), 'rules\n')
|
|
70
|
+
writeFileSync(join(projectRoot, '.windsurfrules'), 'rules\n')
|
|
71
|
+
writeFileSync(join(projectRoot, 'opencode.json'), '{}\n')
|
|
72
|
+
|
|
73
|
+
const out = run('init', '--yes')
|
|
74
|
+
|
|
75
|
+
expect(out).not.toMatch(/Left \d+ existing files? untouched/)
|
|
76
|
+
const manifest = JSON.parse(readFileSync(join(projectRoot, '.opencastle', 'manifest.json'), 'utf8'))
|
|
77
|
+
const customizable: string[] = manifest.managedPaths.customizable
|
|
78
|
+
expect(customizable.filter((p) => p === '.opencastle/')).toHaveLength(1)
|
|
79
|
+
expect(new Set(manifest.managedPaths.framework).size).toBe(manifest.managedPaths.framework.length)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('leaves out the notes for a database and a CMS the project does not use', () => {
|
|
83
|
+
writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
|
|
84
|
+
run('init', '--yes')
|
|
85
|
+
expect(existsSync(join(projectRoot, '.opencastle', 'stack', 'supabase-config.md'))).toBe(false)
|
|
86
|
+
expect(existsSync(join(projectRoot, '.opencastle', 'stack', 'sanity-config.md'))).toBe(false)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('writes the MCP config of an assistant a second init adds', () => {
|
|
90
|
+
// Recompiling the new target instead of installing it left it with no
|
|
91
|
+
// servers, and every check said all was well.
|
|
92
|
+
writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
|
|
93
|
+
run('init', '--yes')
|
|
94
|
+
writeFileSync(join(projectRoot, '.cursorrules'), 'rules\n')
|
|
95
|
+
run('init', '--yes')
|
|
96
|
+
expect(existsSync(join(projectRoot, '.cursor', 'mcp.json'))).toBe(true)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('does not put back, on a second init, the templates the first one pruned', () => {
|
|
100
|
+
writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
|
|
101
|
+
run('init', '--yes')
|
|
102
|
+
const stack = join(projectRoot, '.opencastle', 'stack')
|
|
103
|
+
for (const name of ['cms-config.md', 'database-config.md', 'sanity-config.md', 'supabase-config.md']) {
|
|
104
|
+
expect(existsSync(join(stack, name)), name).toBe(false)
|
|
105
|
+
}
|
|
106
|
+
run('init', '--yes')
|
|
107
|
+
for (const name of ['cms-config.md', 'database-config.md', 'sanity-config.md', 'supabase-config.md']) {
|
|
108
|
+
expect(existsSync(join(stack, name)), `${name} after a second init`).toBe(false)
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('keeps the notes for the one it does use', () => {
|
|
113
|
+
writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
|
|
114
|
+
writeFileSync(join(projectRoot, 'package.json'), JSON.stringify({ name: 'x', dependencies: { '@supabase/supabase-js': '2.0.0' } }))
|
|
115
|
+
run('init', '--yes')
|
|
116
|
+
expect(existsSync(join(projectRoot, '.opencastle', 'stack', 'supabase-config.md'))).toBe(true)
|
|
117
|
+
expect(existsSync(join(projectRoot, '.opencastle', 'stack', 'sanity-config.md'))).toBe(false)
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
describe.skipIf(!cliBuilt)('sync --check on a lessons index that is behind', () => {
|
|
122
|
+
let projectRoot: string
|
|
123
|
+
let home: string
|
|
124
|
+
|
|
125
|
+
beforeEach(() => {
|
|
126
|
+
projectRoot = mkdtempSync(join(tmpdir(), 'oc-lessons-check-'))
|
|
127
|
+
home = mkdtempSync(join(tmpdir(), 'oc-lessons-check-home-'))
|
|
128
|
+
execFileSync('git', ['init', '-q'], { cwd: projectRoot })
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
afterEach(() => {
|
|
132
|
+
rmSync(projectRoot, { recursive: true, force: true })
|
|
133
|
+
rmSync(home, { recursive: true, force: true })
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
it('files it under the sources that changed, not under MCP servers', () => {
|
|
137
|
+
const env = { ...process.env, HOME: home, CLAUDE_CONFIG_DIR: join(home, '.claude'), CODEX_HOME: join(home, '.codex'), NO_COLOR: '1' }
|
|
138
|
+
writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
|
|
139
|
+
execFileSync('node', [cli, 'init', '--yes'], { cwd: projectRoot, env, stdio: 'ignore' })
|
|
140
|
+
// A lesson that arrived in a merge, with the index not yet rebuilt.
|
|
141
|
+
mkdirSync(join(projectRoot, '.opencastle', 'lessons'), { recursive: true })
|
|
142
|
+
writeFileSync(
|
|
143
|
+
join(projectRoot, '.opencastle', 'lessons', '2026-10-03-quote-shell-variables.md'),
|
|
144
|
+
'---\nid: "2026-10-03-quote-shell-variables"\ntitle: "Quote shell variables"\ncategory: "terminal"\nseverity: "medium"\nadded: "2026-10-03"\n---\n\n**Problem:** Unquoted variables break on spaces.\n',
|
|
145
|
+
)
|
|
146
|
+
let out = ''
|
|
147
|
+
try {
|
|
148
|
+
execFileSync('node', [cli, 'sync', '--check'], { cwd: projectRoot, env, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
|
|
149
|
+
} catch (err) {
|
|
150
|
+
out = String((err as { stdout?: string }).stdout ?? '')
|
|
151
|
+
}
|
|
152
|
+
expect(out).toContain('.opencastle/LESSONS-LEARNED.md')
|
|
153
|
+
expect(out).toContain('Sources changed since the last sync')
|
|
154
|
+
expect(out).not.toContain('MCP servers sync would change')
|
|
155
|
+
})
|
|
156
|
+
})
|
package/src/cli/init.test.ts
CHANGED
|
@@ -801,7 +801,7 @@ describe('Claude Code adapter install', () => {
|
|
|
801
801
|
expect(content).not.toContain('**supabase-database**')
|
|
802
802
|
})
|
|
803
803
|
|
|
804
|
-
it('
|
|
804
|
+
it('writes agent files in .claude/agents/ with only the frontmatter Claude Code reads', async () => {
|
|
805
805
|
const adapter = await IDE_ADAPTERS['claude-code']()
|
|
806
806
|
await adapter.install(PKG_ROOT, tempDir, STACK_EMPTY, EMPTY_REPO_INFO)
|
|
807
807
|
|
|
@@ -812,9 +812,10 @@ describe('Claude Code adapter install', () => {
|
|
|
812
812
|
expect(agents).not.toContain('data-engineer.agent.md')
|
|
813
813
|
|
|
814
814
|
const devAgent = await readFile(join(agentsDir, 'developer.agent.md'), 'utf8')
|
|
815
|
-
//
|
|
816
|
-
|
|
817
|
-
|
|
815
|
+
// A name and a description make it a subagent; the source's VS Code fields
|
|
816
|
+
// (tools, tier, handoffs) are not carried over.
|
|
817
|
+
expect(devAgent).toMatch(/^---\nname: developer\ndescription: "[^"\n]+"\n---\n/)
|
|
818
|
+
expect(devAgent).not.toMatch(/^tier:/m)
|
|
818
819
|
expect(devAgent).toContain('Developer')
|
|
819
820
|
})
|
|
820
821
|
|
package/src/cli/init.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { getPluginsBySubCategory } from '../orchestrator/plugins/index.js'
|
|
|
11
11
|
import type { PluginConfig } from '../orchestrator/plugins/types.js'
|
|
12
12
|
import { detectRepoInfo, mergeStackIntoRepoInfo, formatRepoInfo, buildDetectedToolsSet, detectCurrentIde, detectAssistantConfigs } from './detect.js'
|
|
13
13
|
import { IDE_ADAPTERS } from './adapters/index.js'
|
|
14
|
+
import { filesUnderDir } from './adapters/single-file-base.js'
|
|
14
15
|
import { IDE_LABELS } from './types.js'
|
|
15
16
|
import type { CliContext, CopyResults, IdeAdapter, IdeChoice, TechTool, TeamTool, StackConfig } from './types.js'
|
|
16
17
|
import { bootstrapCustomizations } from './bootstrap.js'
|
|
@@ -423,6 +424,33 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
423
424
|
}
|
|
424
425
|
|
|
425
426
|
// ── Run adapters for each selected IDE ──────────────────────────
|
|
427
|
+
// Files already in the directories the chosen targets generate. A target is
|
|
428
|
+
// often detected *because* of one — `.cursor/rules/team.mdc` is what made
|
|
429
|
+
// Cursor a target — and the directory is the target's own, so the next `sync`
|
|
430
|
+
// removes it as output with no source. `init` said nothing about it; the
|
|
431
|
+
// first anyone heard was `sync` naming a file it had just deleted.
|
|
432
|
+
const inGeneratedDirs = new Set<string>()
|
|
433
|
+
for (const ide of ides) {
|
|
434
|
+
const adapter = await IDE_ADAPTERS[ide]()
|
|
435
|
+
for (const dir of adapter.getManagedPaths().framework) {
|
|
436
|
+
if (!dir.endsWith('/')) continue
|
|
437
|
+
for (const rel of filesUnderDir(resolve(projectRoot, dir))) {
|
|
438
|
+
// A prompt of yours beside ours in `.github/prompts/` stays; only what a
|
|
439
|
+
// target claims is at risk.
|
|
440
|
+
if (adapter.ownsFile && !adapter.ownsFile(`${dir}${rel}`, projectRoot)) continue
|
|
441
|
+
inGeneratedDirs.add(resolve(projectRoot, dir, rel))
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const produced = new Set<string>()
|
|
446
|
+
const removedByReinit: string[] = []
|
|
447
|
+
const previousIdes = new Set<string>(existing?.ides ?? (existing?.ide ? [existing.ide] : []))
|
|
448
|
+
// Skipped means "was already there", and with several targets sharing
|
|
449
|
+
// `.agents/skills/` the second one found the first one's output: a fresh
|
|
450
|
+
// seven-target install reported "Left 205 existing files untouched".
|
|
451
|
+
const createdThisRun = new Set<string>()
|
|
452
|
+
const leftAlone = new Set<string>()
|
|
453
|
+
|
|
426
454
|
let totalCreated = 0
|
|
427
455
|
let totalSkipped = 0
|
|
428
456
|
const skippedPaths: string[] = []
|
|
@@ -460,9 +488,14 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
460
488
|
// failed the same way, and `remove --all` refused to uninstall what it had
|
|
461
489
|
// just installed. Single-target installs write the root file first and so
|
|
462
490
|
// throw before anything lands, which is why this only showed up with two.
|
|
491
|
+
// An assistant added by `init --customize` is a first install for that
|
|
492
|
+
// target. Recompiling it instead never wrote its MCP config — `update`
|
|
493
|
+
// leaves that to `sync`, and `sync` found nothing to do — so the new
|
|
494
|
+
// assistant ran with no servers while every check reported all clear.
|
|
495
|
+
const compiledBefore = isReinit && previousIdes.has(ide)
|
|
463
496
|
let results: CopyResults
|
|
464
497
|
try {
|
|
465
|
-
results =
|
|
498
|
+
results = compiledBefore
|
|
466
499
|
? await adapter.update(pkgRoot, projectRoot, stack, combinedRepoInfo, source)
|
|
467
500
|
: await adapter.install(pkgRoot, projectRoot, stack, combinedRepoInfo, source)
|
|
468
501
|
} catch (err) {
|
|
@@ -470,8 +503,16 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
470
503
|
continue
|
|
471
504
|
}
|
|
472
505
|
totalCreated += results.created.length
|
|
473
|
-
|
|
474
|
-
|
|
506
|
+
for (const p of results.skipped) {
|
|
507
|
+
if (createdThisRun.has(resolve(projectRoot, p))) continue
|
|
508
|
+
leftAlone.add(resolve(projectRoot, p))
|
|
509
|
+
skippedPaths.push(p)
|
|
510
|
+
}
|
|
511
|
+
for (const p of results.created) createdThisRun.add(resolve(projectRoot, p))
|
|
512
|
+
for (const abs of [...results.created, ...results.copied, ...results.skipped, ...(results.visited ?? [])]) {
|
|
513
|
+
produced.add(resolve(projectRoot, abs))
|
|
514
|
+
}
|
|
515
|
+
removedByReinit.push(...(results.deleted ?? []))
|
|
475
516
|
for (const file of results.unreadable ?? []) {
|
|
476
517
|
noteUnreadable(unreadable, file)
|
|
477
518
|
}
|
|
@@ -484,8 +525,15 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
484
525
|
tornRoots.push(...(results.tornRoots ?? []))
|
|
485
526
|
|
|
486
527
|
const managed = adapter.getManagedPaths()
|
|
487
|
-
|
|
488
|
-
|
|
528
|
+
// Deduplicated like `merged` below: every target declares `.opencastle/`,
|
|
529
|
+
// so a four-target manifest listed it four times and the first `sync`
|
|
530
|
+
// rewrote the manifest to say it once.
|
|
531
|
+
for (const f of managed.framework) {
|
|
532
|
+
if (!allManagedPaths.framework.includes(f)) allManagedPaths.framework.push(f)
|
|
533
|
+
}
|
|
534
|
+
for (const f of managed.customizable) {
|
|
535
|
+
if (!allManagedPaths.customizable.includes(f)) allManagedPaths.customizable.push(f)
|
|
536
|
+
}
|
|
489
537
|
// Deduplicated: opencode and codex share AGENTS.md, so a per-adapter push
|
|
490
538
|
// listed it twice — "Merged into your existing …, AGENTS.md, AGENTS.md".
|
|
491
539
|
for (const m of managed.merged ?? []) {
|
|
@@ -493,6 +541,8 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
493
541
|
}
|
|
494
542
|
}
|
|
495
543
|
|
|
544
|
+
totalSkipped = leftAlone.size
|
|
545
|
+
|
|
496
546
|
// If all files were skipped (orphaned install — no manifest but files exist).
|
|
497
547
|
//
|
|
498
548
|
// Or if a release before the `oc:` namespace left its commands here. The
|
|
@@ -546,6 +596,10 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
546
596
|
// opposite of what happened, on the one path that exists to overwrite.
|
|
547
597
|
totalCreated += results.created.length + results.copied.length
|
|
548
598
|
totalSkipped += results.skipped.length
|
|
599
|
+
for (const abs of [...results.created, ...results.copied, ...results.skipped, ...(results.visited ?? [])]) {
|
|
600
|
+
produced.add(resolve(projectRoot, abs))
|
|
601
|
+
}
|
|
602
|
+
removedByReinit.push(...(results.deleted ?? []))
|
|
549
603
|
for (const file of results.unreadable ?? []) {
|
|
550
604
|
noteUnreadable(unreadable, file)
|
|
551
605
|
}
|
|
@@ -571,7 +625,15 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
571
625
|
if (existsSync(custSrcDir)) {
|
|
572
626
|
const custDestDir = resolve(projectRoot, '.opencastle')
|
|
573
627
|
const custTransform = getCustomizationsTransform(stack)
|
|
574
|
-
|
|
628
|
+
// Over an existing `.opencastle/`, the templates bootstrap prunes or renames
|
|
629
|
+
// on the first run — `stack/`, the tracker config — stay as that run left
|
|
630
|
+
// them. Copying them again put back every one it had removed: a project
|
|
631
|
+
// with no CMS got `cms-config.md` and `sanity-config.md` on its second init.
|
|
632
|
+
const prunedOnce = (rel: string) => rel === 'stack' || rel.startsWith('stack/') || rel === 'project/tracker-config.md'
|
|
633
|
+
const sub = await copyDir(custSrcDir, custDestDir, {
|
|
634
|
+
transform: custTransform,
|
|
635
|
+
filter: (_name, srcPath) => !(alreadyScaffolded && prunedOnce(relative(custSrcDir, srcPath).split('\\').join('/'))),
|
|
636
|
+
})
|
|
575
637
|
totalCreated += sub.created.length
|
|
576
638
|
totalSkipped += sub.skipped.length
|
|
577
639
|
}
|
|
@@ -696,6 +758,36 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
696
758
|
console.log(` ${c.dim('→')} Left ${totalSkipped} existing ${noun} untouched`)
|
|
697
759
|
}
|
|
698
760
|
|
|
761
|
+
// Re-running `init` recompiles with `sync`'s sweep, and said nothing of what
|
|
762
|
+
// the sweep removed; `sync` names every file.
|
|
763
|
+
const removed = [...new Set(removedByReinit)].filter((rel) => !existsSync(resolve(projectRoot, rel)))
|
|
764
|
+
if (removed.length > 0) {
|
|
765
|
+
console.log(`\n ${c.yellow('!')} Removed ${removed.length} file(s) no longer produced by any source:\n`)
|
|
766
|
+
for (const rel of removed.slice(0, 10)) console.log(` ${c.dim(rel)}`)
|
|
767
|
+
if (removed.length > 10) console.log(` ${c.dim(`… and ${removed.length - 10} more`)}`)
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// Files of the user's in a directory a target now owns. Left in place, so the
|
|
771
|
+
// assistant keeps reading them today — but `sync` removes them, and
|
|
772
|
+
// `sync --check` fails on them, so say so now rather than at the deletion.
|
|
773
|
+
const theirs = [...inGeneratedDirs]
|
|
774
|
+
.filter((abs) => !produced.has(abs) && existsSync(abs))
|
|
775
|
+
.map((abs) => relative(projectRoot, abs).split('\\').join('/'))
|
|
776
|
+
if (theirs.length > 0) {
|
|
777
|
+
const one = theirs.length === 1
|
|
778
|
+
const it = one ? 'it' : 'them'
|
|
779
|
+
console.log(
|
|
780
|
+
`\n ${c.yellow('⚠')} ${theirs.length} ${one ? 'file of yours is' : 'files of yours are'} in a directory OpenCastle generates:\n`,
|
|
781
|
+
)
|
|
782
|
+
for (const rel of theirs.slice(0, 10)) console.log(` ${c.bold(rel)}`)
|
|
783
|
+
if (theirs.length > 10) console.log(` ${c.dim(`… and ${theirs.length - 10} more`)}`)
|
|
784
|
+
console.log(`\n ${c.dim(`The next sync removes ${it}; until then sync --check reports ${it}.`)}`)
|
|
785
|
+
console.log(
|
|
786
|
+
` ${c.dim(`To keep ${it}, move ${it} into .opencastle/ (instructions/, skills/<name>/ or agents/),`)}`,
|
|
787
|
+
)
|
|
788
|
+
console.log(` ${c.dim('and the next sync compiles it for every assistant.')}`)
|
|
789
|
+
}
|
|
790
|
+
|
|
699
791
|
// Name the root files that already existed and were merged rather than replaced.
|
|
700
792
|
const mergedRoots: string[] = []
|
|
701
793
|
for (const p of allManagedPaths.merged) {
|
|
@@ -865,8 +957,13 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
865
957
|
`${c.cyan(`/${COMMAND_NAMESPACE}:bootstrap-customizations`)} first on an existing codebase`,
|
|
866
958
|
)
|
|
867
959
|
}
|
|
960
|
+
// Everything, not only `.opencastle/`: the generated config is committed on
|
|
961
|
+
// purpose (the `.gitignore` block says so, and `doctor` checks it), and this
|
|
962
|
+
// line was the one place that told people to commit the sources alone.
|
|
963
|
+
step++
|
|
964
|
+
console.log(` ${step}. Commit what this wrote, .opencastle/ included — teammates get the same setup on clone`)
|
|
868
965
|
step++
|
|
869
|
-
console.log(` ${step}.
|
|
966
|
+
console.log(` ${step}. ${c.cyan('opencastle ci')} — fail a pull request whose generated config no longer matches`)
|
|
870
967
|
|
|
871
968
|
// Name the assistants not yet being compiled for — the reason to come back.
|
|
872
969
|
const configured = new Set(ides)
|
package/src/cli/layers.ts
CHANGED
|
@@ -327,10 +327,19 @@ export function filesUnder(root: string, within?: string[], onSkip?: (abs: strin
|
|
|
327
327
|
return out
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
/**
|
|
331
|
-
|
|
330
|
+
/**
|
|
331
|
+
* A digest of what a layer contributes: its config and its content directories.
|
|
332
|
+
*
|
|
333
|
+
* An Agent Plugin keeps only its skills at the root; its servers are in
|
|
334
|
+
* `mcp.json` and everything else in `dev.opencastle/`. Hashing the root alone
|
|
335
|
+
* left all of that out, so an instruction edited without a version bump moved
|
|
336
|
+
* nothing in the lock and `review` had nothing to say about it.
|
|
337
|
+
*/
|
|
338
|
+
function layerIntegrity(root: string, extensionRoot?: string): string {
|
|
332
339
|
const hash = createHash('sha256')
|
|
333
|
-
const
|
|
340
|
+
const own = [LAYER_CONFIG_FILE, ...CONTENT_KINDS.map((k) => LAYER_DIR[k])]
|
|
341
|
+
const ext = extensionRoot ? relative(root, extensionRoot).split(sep).join('/') : null
|
|
342
|
+
const parts = ext ? [...own, 'plugin.json', 'mcp.json', ...own.map((p) => `${ext}/${p}`)] : own
|
|
334
343
|
for (const part of parts) {
|
|
335
344
|
const abs = join(root, part)
|
|
336
345
|
if (!existsSync(abs)) continue
|
|
@@ -525,7 +534,7 @@ function loadExtends(
|
|
|
525
534
|
for (const inner of plugin.config.extends ?? []) {
|
|
526
535
|
loadExtends(inner, plugin.extensionRoot, plugin.configFile, [...chain, real], ctx)
|
|
527
536
|
}
|
|
528
|
-
ctx.layers.push({ id, kind: 'baseline', root, version: version ?? plugin.version, integrity: layerIntegrity(root), ...plugin })
|
|
537
|
+
ctx.layers.push({ id, kind: 'baseline', root, version: version ?? plugin.version, integrity: layerIntegrity(root, plugin.extensionRoot), ...plugin })
|
|
529
538
|
return
|
|
530
539
|
}
|
|
531
540
|
|
package/src/cli/lesson.ts
CHANGED
|
@@ -60,12 +60,13 @@ const HELP = `
|
|
|
60
60
|
--category terminal \\
|
|
61
61
|
--severity medium \\
|
|
62
62
|
--problem "Unquoted variables break on paths with spaces" \\
|
|
63
|
-
--wrong 'rm -rf
|
|
64
|
-
--correct 'rm -rf "
|
|
63
|
+
--wrong 'rm -rf $DIR/old' \\
|
|
64
|
+
--correct 'rm -rf "$DIR/old"' \\
|
|
65
65
|
--cite scripts/clean.sh:12
|
|
66
66
|
|
|
67
67
|
opencastle lesson verify 2026-10-02-always-quote-shell-variables
|
|
68
|
-
opencastle lesson archive
|
|
68
|
+
opencastle lesson archive 2026-10-02-always-quote-shell-variables \\
|
|
69
|
+
--into .opencastle/skills/git-workflow/SKILL.md
|
|
69
70
|
`
|
|
70
71
|
|
|
71
72
|
/** The `.opencastle/` this lesson belongs to: the override, or the nearest one up from here. */
|
|
@@ -219,7 +220,7 @@ async function add(dir: string, projectRoot: string, p: Parsed): Promise<void> {
|
|
|
219
220
|
|
|
220
221
|
async function verify(dir: string, projectRoot: string, p: Parsed): Promise<void> {
|
|
221
222
|
const [ref] = p.positional
|
|
222
|
-
if (!ref) fail('verify needs the id of a lesson, e.g. opencastle lesson verify
|
|
223
|
+
if (!ref) fail('verify needs the id of a lesson, e.g. opencastle lesson verify 2026-10-02-always-quote-shell-variables')
|
|
223
224
|
checkCitations(projectRoot, p.cites)
|
|
224
225
|
if (!p.dryRun) reindex(dir)
|
|
225
226
|
const { lessons } = readLessons(dir)
|
|
@@ -240,7 +241,7 @@ async function verify(dir: string, projectRoot: string, p: Parsed): Promise<void
|
|
|
240
241
|
async function archive(dir: string, projectRoot: string, p: Parsed): Promise<void> {
|
|
241
242
|
const [ref] = p.positional
|
|
242
243
|
const into = p.values.get('--into')
|
|
243
|
-
if (!ref) fail('archive needs the id of a lesson, e.g. opencastle lesson archive
|
|
244
|
+
if (!ref) fail('archive needs the id of a lesson, e.g. opencastle lesson archive 2026-10-02-always-quote-shell-variables --into <file>')
|
|
244
245
|
if (!into) fail('archive needs --into <file>: the skill or instruction file the lesson was merged into')
|
|
245
246
|
const problem = citationProblem(projectRoot, into)
|
|
246
247
|
if (problem) fail(`--into: ${problem}`)
|