@oisincoveney/pipeline 3.24.2 → 3.24.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/README.md +2 -2
  2. package/defaults/pipeline.yaml +23 -5
  3. package/defaults/profiles.yaml +104 -21
  4. package/dist/argo-graph.js +88 -88
  5. package/dist/argo-submit.d.ts +109 -137
  6. package/dist/argo-submit.js +337 -360
  7. package/dist/argo-workflow.d.ts +156 -176
  8. package/dist/argo-workflow.js +96 -138
  9. package/dist/backlog.js +5 -4
  10. package/dist/bench/eval-report.js +21 -12
  11. package/dist/claude-settings-config.js +23 -31
  12. package/dist/claude-user-config.js +6 -16
  13. package/dist/cli/bootstrap-commands.js +3 -3
  14. package/dist/cli/doctor.d.ts +1 -1
  15. package/dist/cli/doctor.js +172 -169
  16. package/dist/cli/factory-commands.js +12 -11
  17. package/dist/cli/format.js +92 -86
  18. package/dist/cli/loop-commands.js +21 -21
  19. package/dist/cli/mcp-gateway-commands.js +12 -12
  20. package/dist/cli/plan-commands.js +85 -116
  21. package/dist/cli/program.d.ts +2 -2
  22. package/dist/cli/program.js +35 -43
  23. package/dist/cli/run-command.js +25 -25
  24. package/dist/cli/run-commands.js +25 -25
  25. package/dist/cli/run-resolver.d.ts +1 -1
  26. package/dist/cli/run-resolver.js +30 -32
  27. package/dist/cli/run-service.d.ts +2 -2
  28. package/dist/cli/run-service.js +226 -239
  29. package/dist/cli/submit-options.js +78 -82
  30. package/dist/cluster-doctor.js +147 -175
  31. package/dist/codex-config.js +24 -30
  32. package/dist/commands/bench-command.js +9 -7
  33. package/dist/commands/pipeline-command.js +9 -5
  34. package/dist/commands/runner-command-command.js +28 -18
  35. package/dist/commands/ticket/complete.js +29 -33
  36. package/dist/commands/ticket/create.js +82 -82
  37. package/dist/commands/ticket/graph-check.js +11 -11
  38. package/dist/commands/ticket/next.js +36 -36
  39. package/dist/commands/ticket/sequence.js +10 -12
  40. package/dist/commands/ticket/shared.d.ts +1 -1
  41. package/dist/commands/ticket/shared.js +63 -66
  42. package/dist/commands/ticket/start.js +58 -67
  43. package/dist/commands/ticket-command.js +2 -2
  44. package/dist/config/defaults.d.ts +139 -139
  45. package/dist/config/defaults.js +81 -80
  46. package/dist/config/lint.js +52 -64
  47. package/dist/config/load.d.ts +4 -4
  48. package/dist/config/load.js +62 -74
  49. package/dist/config/schema/catalog.js +1 -1
  50. package/dist/config/schema/mcp.js +46 -52
  51. package/dist/config/schemas.d.ts +375 -525
  52. package/dist/config/schemas.js +397 -397
  53. package/dist/config/validate.d.ts +1 -1
  54. package/dist/config/validate.js +236 -201
  55. package/dist/context/repo-map.js +102 -119
  56. package/dist/credentials/broker.d.ts +6 -8
  57. package/dist/credentials/broker.js +17 -16
  58. package/dist/credentials/codex-config.js +15 -19
  59. package/dist/credentials/file-targets.js +9 -15
  60. package/dist/credentials/local-codex-auth-sync.js +55 -58
  61. package/dist/credentials/opencode-config.js +28 -32
  62. package/dist/credentials/runner.js +13 -13
  63. package/dist/effect-sync-errors.js +28 -0
  64. package/dist/factory/create-experiment.js +38 -42
  65. package/dist/factory/exec.js +10 -12
  66. package/dist/factory/git-credentials.js +4 -4
  67. package/dist/factory/stamp-answers.js +10 -11
  68. package/dist/factory/template-update.js +65 -44
  69. package/dist/factory-lane.d.ts +26 -40
  70. package/dist/factory-lane.js +26 -25
  71. package/dist/gates.js +3 -3
  72. package/dist/git-remote-url.js +17 -19
  73. package/dist/hooks.d.ts +26 -25
  74. package/dist/hooks.js +20 -22
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +21 -35
  77. package/dist/install-commands/claude-code.js +96 -92
  78. package/dist/install-commands/host-selection.js +3 -6
  79. package/dist/install-commands/opencode.js +263 -259
  80. package/dist/install-commands/planner.js +159 -180
  81. package/dist/install-commands/result-format.js +1 -3
  82. package/dist/install-commands/shared.js +25 -42
  83. package/dist/install-commands/writer.js +22 -25
  84. package/dist/install-commands.js +8 -8
  85. package/dist/jscpd-output.js +29 -0
  86. package/dist/json-config-merge.js +14 -20
  87. package/dist/json-line-values.js +17 -6
  88. package/dist/loop/argo-poll.js +52 -71
  89. package/dist/loop/backlog-records.js +1 -3
  90. package/dist/loop/controller-deps.js +146 -159
  91. package/dist/loop/controller.js +162 -186
  92. package/dist/loop/gh-checks.js +62 -61
  93. package/dist/loop/gh-runner.js +22 -25
  94. package/dist/loop/loop-command.js +66 -58
  95. package/dist/loop/loop-controller-entrypoint.js +28 -30
  96. package/dist/loop/merge.js +36 -40
  97. package/dist/mcp/gateway-config.js +25 -29
  98. package/dist/mcp/gateway-doctor.js +104 -116
  99. package/dist/mcp/gateway-reconcile.js +17 -22
  100. package/dist/mcp/gateway-runtime.js +1 -3
  101. package/dist/mcp/host-config.js +37 -40
  102. package/dist/mcp/host-renderers.js +10 -18
  103. package/dist/mcp/repo-local-backends.js +50 -54
  104. package/dist/mcp/toolhive-vmcp.js +39 -39
  105. package/dist/model-resolver.js +29 -33
  106. package/dist/moka-global-config.d.ts +78 -54
  107. package/dist/moka-global-config.js +90 -92
  108. package/dist/moka-submit.d.ts +2163 -864
  109. package/dist/moka-submit.js +97 -99
  110. package/dist/opencode-project-config.js +34 -40
  111. package/dist/package-assets.js +1 -3
  112. package/dist/path-refs.js +2 -2
  113. package/dist/pipeline-init.js +25 -25
  114. package/dist/pipeline-runtime.d.ts +11 -11
  115. package/dist/pipeline-runtime.js +49 -50
  116. package/dist/planned-node.js +6 -3
  117. package/dist/planning/compile.d.ts +3 -3
  118. package/dist/planning/compile.js +140 -139
  119. package/dist/planning/dependency-refs.js +5 -5
  120. package/dist/planning/generate.d.ts +1293 -1293
  121. package/dist/planning/generate.js +305 -314
  122. package/dist/planning/graph.js +131 -149
  123. package/dist/remote/argo/model.d.ts +103 -121
  124. package/dist/remote/argo/model.js +205 -197
  125. package/dist/remote/argo/policy.js +39 -47
  126. package/dist/remote/argo/storage.js +81 -85
  127. package/dist/remote/submit/argo-submission.js +53 -58
  128. package/dist/remote/submit/compilation.js +46 -49
  129. package/dist/remote/submit/event-boundary.js +62 -76
  130. package/dist/remote/submit/hook-events.d.ts +5 -0
  131. package/dist/remote/submit/io.js +40 -43
  132. package/dist/remote/submit/options.d.ts +50 -0
  133. package/dist/remote/submit/options.js +27 -0
  134. package/dist/remote/submit/service.js +45 -49
  135. package/dist/run-control/command-context.js +6 -8
  136. package/dist/run-control/commands.js +10 -10
  137. package/dist/run-control/contracts.d.ts +40 -100
  138. package/dist/run-control/contracts.js +56 -69
  139. package/dist/run-control/detach.js +66 -72
  140. package/dist/run-control/file-errors.js +1 -3
  141. package/dist/run-control/logical-segment.js +3 -3
  142. package/dist/run-control/next-node.js +66 -78
  143. package/dist/run-control/postgres/postgres-run-control-store.js +195 -224
  144. package/dist/run-control/resume-command.js +33 -41
  145. package/dist/run-control/run-artifacts-command.js +83 -105
  146. package/dist/run-control/run-command-domain.js +7 -11
  147. package/dist/run-control/run-control-store.js +9 -9
  148. package/dist/run-control/run-query-command.js +73 -100
  149. package/dist/run-control/run-record.js +2 -2
  150. package/dist/run-control/run-state-lock.js +5 -5
  151. package/dist/run-control/runtime-event-projection.js +38 -50
  152. package/dist/run-control/runtime-reporter.js +84 -102
  153. package/dist/run-control/stop-command.js +42 -53
  154. package/dist/run-control/store-fs-effects.js +3 -1
  155. package/dist/run-control/store-manifest.js +38 -13
  156. package/dist/run-control/store-paths.js +3 -3
  157. package/dist/run-control/store.js +1 -1
  158. package/dist/run-control/submit-result.js +21 -21
  159. package/dist/run-control/supervisor.js +77 -68
  160. package/dist/run-control/workspace.js +2 -2
  161. package/dist/run-state/git-refs.js +257 -307
  162. package/dist/runner/opencode-excludes.js +4 -4
  163. package/dist/runner/subprocess-result.js +28 -37
  164. package/dist/runner/subprocess.js +41 -41
  165. package/dist/runner/timeouts.js +14 -13
  166. package/dist/runner-command/dynamic-command.js +46 -39
  167. package/dist/runner-command/finalize.js +174 -153
  168. package/dist/runner-command/lifecycle-context.js +112 -130
  169. package/dist/runner-command/lifecycle.js +77 -71
  170. package/dist/runner-command/pre-schedule.js +201 -222
  171. package/dist/runner-command/run.js +432 -447
  172. package/dist/runner-command/schedule-source-options.js +8 -10
  173. package/dist/runner-command/select-ready-wave.js +38 -29
  174. package/dist/runner-command/task-descriptor.js +11 -17
  175. package/dist/runner-command-contract.d.ts +147 -156
  176. package/dist/runner-command-contract.js +401 -410
  177. package/dist/runner-event-schema.d.ts +364 -504
  178. package/dist/runner-event-schema.js +187 -175
  179. package/dist/runner-event-sink.js +37 -43
  180. package/dist/runner-output.js +6 -6
  181. package/dist/runner.d.ts +56 -36
  182. package/dist/runner.js +175 -127
  183. package/dist/runtime/actor-ids.js +2 -2
  184. package/dist/runtime/agent-node/agent-node.js +99 -111
  185. package/dist/runtime/agent-node/handoff-finalization.js +23 -24
  186. package/dist/runtime/agent-node/model-selection.js +19 -22
  187. package/dist/runtime/agent-node/output-finalization.js +174 -205
  188. package/dist/runtime/agent-node/prompt-rendering.js +207 -251
  189. package/dist/runtime/agent-node/session-execution.js +34 -38
  190. package/dist/runtime/builtins/builtins.js +212 -284
  191. package/dist/runtime/changed-files/changed-files.js +26 -34
  192. package/dist/runtime/command-executor/command-executor.js +31 -23
  193. package/dist/runtime/config-error.js +1 -3
  194. package/dist/runtime/context/context.js +35 -37
  195. package/dist/runtime/contracts/index.d.ts +1 -1
  196. package/dist/runtime/detached-race.js +11 -14
  197. package/dist/runtime/drain-merge/drain-merge.js +137 -163
  198. package/dist/runtime/durable-store/acquisition.js +5 -3
  199. package/dist/runtime/durable-store/durable-store.d.ts +1 -1
  200. package/dist/runtime/durable-store/postgres/migrate-substrate.js +36 -33
  201. package/dist/runtime/durable-store/postgres/postgres-store.js +17 -18
  202. package/dist/runtime/events/events.js +255 -323
  203. package/dist/runtime/gates/adjudication/llm-judge.js +21 -24
  204. package/dist/runtime/gates/adjudication/structured-claim.js +15 -16
  205. package/dist/runtime/gates/adjudicator/adjudicator.js +27 -27
  206. package/dist/runtime/gates/adjudicator/index.js +2 -2
  207. package/dist/runtime/gates/contract.js +5 -9
  208. package/dist/runtime/gates/gates.js +9 -8
  209. package/dist/runtime/gates/kinds/acceptance/acceptance.js +66 -70
  210. package/dist/runtime/gates/kinds/acceptance/index.js +2 -2
  211. package/dist/runtime/gates/kinds/artifact/artifact.js +4 -4
  212. package/dist/runtime/gates/kinds/artifact/index.js +2 -2
  213. package/dist/runtime/gates/kinds/builtin/builtin.js +4 -4
  214. package/dist/runtime/gates/kinds/builtin/index.js +2 -2
  215. package/dist/runtime/gates/kinds/changed-files/changed-files.js +31 -35
  216. package/dist/runtime/gates/kinds/changed-files/index.js +2 -2
  217. package/dist/runtime/gates/kinds/command/command.js +3 -3
  218. package/dist/runtime/gates/kinds/command/index.js +2 -2
  219. package/dist/runtime/gates/kinds/json-schema/index.js +2 -2
  220. package/dist/runtime/gates/kinds/json-schema/json-schema.js +7 -6
  221. package/dist/runtime/gates/kinds/verdict/index.js +2 -2
  222. package/dist/runtime/gates/kinds/verdict/verdict.js +3 -3
  223. package/dist/runtime/gates/orchestrator.js +72 -86
  224. package/dist/runtime/gates/registry.js +1 -3
  225. package/dist/runtime/handoff.d.ts +1 -1
  226. package/dist/runtime/handoff.js +43 -46
  227. package/dist/runtime/hooks/command-hook.js +57 -71
  228. package/dist/runtime/hooks/context.js +21 -25
  229. package/dist/runtime/hooks/events.js +84 -100
  230. package/dist/runtime/hooks/execution.js +6 -12
  231. package/dist/runtime/hooks/hooks.js +34 -23
  232. package/dist/runtime/hooks/invocation.js +23 -29
  233. package/dist/runtime/hooks/module-hook.js +35 -35
  234. package/dist/runtime/hooks/policy.js +32 -29
  235. package/dist/runtime/hooks/results.js +56 -66
  236. package/dist/runtime/journal-acquisition.d.ts +1 -1
  237. package/dist/runtime/journal-acquisition.js +14 -14
  238. package/dist/runtime/json-validation/json-validation.js +50 -72
  239. package/dist/runtime/local-scheduler.js +46 -48
  240. package/dist/runtime/node-execution.js +375 -446
  241. package/dist/runtime/node-protocol/node-protocol.js +36 -79
  242. package/dist/runtime/node-state-store.d.ts +1 -1
  243. package/dist/runtime/node-state-store.js +13 -57
  244. package/dist/runtime/node-state-tracker.js +46 -54
  245. package/dist/runtime/open-pull-request/open-pull-request.js +143 -187
  246. package/dist/runtime/opencode-adapter.js +23 -24
  247. package/dist/runtime/opencode-agent-name.js +6 -6
  248. package/dist/runtime/opencode-runtime.js +92 -92
  249. package/dist/runtime/opencode-server.js +39 -53
  250. package/dist/runtime/opencode-session-executor.js +315 -334
  251. package/dist/runtime/parallel-node/parallel-node.js +122 -134
  252. package/dist/runtime/parallel-worktrees/parallel-worktrees.js +90 -73
  253. package/dist/runtime/protected-paths/protected-paths.js +70 -71
  254. package/dist/runtime/remediation/remediation.js +202 -231
  255. package/dist/runtime/retry.js +8 -10
  256. package/dist/runtime/run-journal.js +7 -7
  257. package/dist/runtime/runtime-results.js +54 -69
  258. package/dist/runtime/scheduled-dependencies.d.ts +1 -1
  259. package/dist/runtime/scheduled-dependencies.js +59 -74
  260. package/dist/runtime/scheduler.js +177 -202
  261. package/dist/runtime/services/agent-node-runtime-service.js +3 -3
  262. package/dist/runtime/services/backlog-service.js +8 -14
  263. package/dist/runtime/services/command-executor-service.js +1 -1
  264. package/dist/runtime/services/config-io-service.js +24 -21
  265. package/dist/runtime/services/drain-merge-git-service.js +1 -1
  266. package/dist/runtime/services/file-system-service.js +9 -7
  267. package/dist/runtime/services/git-porcelain-service.js +6 -6
  268. package/dist/runtime/services/kubernetes-argo-service.d.ts +10 -2
  269. package/dist/runtime/services/kubernetes-argo-service.js +90 -84
  270. package/dist/runtime/services/mcp-gateway-service.js +82 -81
  271. package/dist/runtime/services/open-pull-request-git-service.js +1 -3
  272. package/dist/runtime/services/opencode-runtime-server-service.js +10 -12
  273. package/dist/runtime/services/opencode-sdk-service.js +7 -7
  274. package/dist/runtime/services/repo-io-service.js +10 -12
  275. package/dist/runtime/services/run-journal-file-service.js +2 -2
  276. package/dist/runtime/services/runner-command-io-service.js +48 -52
  277. package/dist/runtime/services/runner-event-sink-http-service.js +31 -39
  278. package/dist/runtime/step/step-node.js +15 -15
  279. package/dist/runtime/workflow-execution.js +55 -57
  280. package/dist/runtime/workflow-lifecycle.js +81 -101
  281. package/dist/safe-json.js +16 -16
  282. package/dist/schedule/backlog-context.js +120 -116
  283. package/dist/schedule/baseline.js +249 -255
  284. package/dist/schedule/passes/coverage.js +63 -68
  285. package/dist/schedule/passes/drain-merge.js +34 -40
  286. package/dist/schedule/passes/ids.js +15 -17
  287. package/dist/schedule/passes/models.js +40 -37
  288. package/dist/schedule/passes/open-pull-request.js +12 -18
  289. package/dist/schedule/passes/references.js +18 -22
  290. package/dist/schedule/prompts.js +134 -141
  291. package/dist/schedule/scheduling-roles.js +8 -14
  292. package/dist/schema-boundary.d.ts +1 -0
  293. package/dist/schema-boundary.js +145 -0
  294. package/dist/serialized-write-queue.js +2 -2
  295. package/dist/standard-output-schemas.js +61 -59
  296. package/dist/strings.js +12 -12
  297. package/dist/task-ref.js +5 -5
  298. package/dist/tickets/apply-ticket-plan.js +51 -61
  299. package/dist/tickets/backlog-task-store.d.ts +13 -22
  300. package/dist/tickets/backlog-task-store.js +80 -94
  301. package/dist/tickets/completion/complete-ticket.js +53 -59
  302. package/dist/tickets/ticket-graph-dto.d.ts +24 -47
  303. package/dist/tickets/ticket-graph-dto.js +40 -40
  304. package/dist/tickets/ticket-graph.d.ts +7 -1
  305. package/dist/tickets/ticket-graph.js +36 -50
  306. package/dist/tickets/ticket-plan-command-args.js +6 -10
  307. package/dist/tickets/ticket-plan-render.js +10 -16
  308. package/dist/tickets/ticket-plan.d.ts +31 -40
  309. package/dist/tickets/ticket-plan.js +97 -77
  310. package/dist/tickets/ticket-selection.d.ts +1 -1
  311. package/dist/tickets/ticket-selection.js +37 -52
  312. package/dist/tickets/ticket-task-index.js +13 -17
  313. package/dist/tickets/validation-error-format.js +3 -10
  314. package/dist/token-estimator.js +12 -7
  315. package/dist/unknown-fields.js +21 -0
  316. package/dist/workflow-submit-contract.d.ts +9 -9
  317. package/dist/workflow-submit-contract.js +10 -9
  318. package/docs/adr-opencode-first-goal-loop-runtime.md +11 -11
  319. package/docs/config-architecture.md +13 -13
  320. package/docs/mcp-host-isolation.md +1 -0
  321. package/docs/moka-orchestrator-design.md +3 -3
  322. package/docs/operator-guide.md +1 -1
  323. package/docs/runtime-actor-model.md +18 -18
  324. package/docs/slash-command-adapter-contract.md +3 -3
  325. package/package.json +73 -76
  326. package/dist/config/schema/reference-validation.js +0 -83
@@ -1,6 +1,253 @@
1
1
  //#region src/schedule/baseline.ts
2
2
  const SCHEDULE_KIND = "pipeline-schedule";
3
- function baselineScheduleArtifact(input) {
3
+ const quickBaselineWorkflow = () => ({ root: {
4
+ description: "Compact generated quick schedule seed.",
5
+ nodes: [
6
+ {
7
+ id: "backlog-intake",
8
+ kind: "agent",
9
+ profile: "moka-researcher"
10
+ },
11
+ {
12
+ id: "red-tests",
13
+ kind: "agent",
14
+ needs: ["backlog-intake"],
15
+ profile: "moka-test-writer"
16
+ },
17
+ {
18
+ id: "implement",
19
+ kind: "agent",
20
+ needs: ["red-tests"],
21
+ profile: "moka-code-writer"
22
+ },
23
+ {
24
+ builtin: "test",
25
+ id: "mechanical-tests",
26
+ kind: "builtin",
27
+ needs: ["implement"]
28
+ },
29
+ {
30
+ builtin: "typecheck",
31
+ id: "mechanical-typecheck",
32
+ kind: "builtin",
33
+ needs: ["implement"]
34
+ },
35
+ {
36
+ gates: [
37
+ {
38
+ builtin: "typecheck",
39
+ id: "verify-typecheck",
40
+ kind: "builtin"
41
+ },
42
+ {
43
+ builtin: "test",
44
+ id: "verify-tests",
45
+ kind: "builtin"
46
+ },
47
+ {
48
+ builtin: "lint",
49
+ id: "verify-lint",
50
+ kind: "builtin"
51
+ },
52
+ {
53
+ builtin: "fallow",
54
+ id: "verify-fallow",
55
+ kind: "builtin"
56
+ },
57
+ {
58
+ id: "verify-verdict",
59
+ kind: "verdict",
60
+ target: "stdout"
61
+ }
62
+ ],
63
+ id: "verify",
64
+ kind: "agent",
65
+ needs: ["mechanical-tests", "mechanical-typecheck"],
66
+ profile: "moka-verifier"
67
+ }
68
+ ]
69
+ } });
70
+ const executeBaselineWorkflow = () => ({ root: {
71
+ description: "Full generated execute schedule seed.",
72
+ nodes: [
73
+ {
74
+ id: "backlog-intake",
75
+ kind: "agent",
76
+ profile: "moka-researcher"
77
+ },
78
+ {
79
+ id: "research",
80
+ kind: "agent",
81
+ needs: ["backlog-intake"],
82
+ profile: "moka-researcher"
83
+ },
84
+ {
85
+ gates: [{
86
+ changed_files: {
87
+ allow: [
88
+ "**/*.test.*",
89
+ "**/*.spec.*",
90
+ "**/*_test.*",
91
+ "**/__tests__/**",
92
+ "test/**",
93
+ "tests/**",
94
+ "**/test/**",
95
+ "**/tests/**",
96
+ "**/*.snap"
97
+ ],
98
+ require_any: [
99
+ "**/*.test.*",
100
+ "**/*.spec.*",
101
+ "**/*_test.*",
102
+ "**/__tests__/**",
103
+ "test/**",
104
+ "tests/**",
105
+ "**/test/**",
106
+ "**/tests/**"
107
+ ]
108
+ },
109
+ id: "red-test-file-policy",
110
+ kind: "changed_files"
111
+ }],
112
+ id: "red-tests",
113
+ kind: "agent",
114
+ needs: ["research"],
115
+ profile: "moka-test-writer"
116
+ },
117
+ {
118
+ id: "green-implementation",
119
+ kind: "agent",
120
+ needs: ["red-tests"],
121
+ profile: "moka-code-writer"
122
+ },
123
+ {
124
+ builtin: "test",
125
+ id: "mechanical-green-tests",
126
+ kind: "builtin",
127
+ needs: ["green-implementation"]
128
+ },
129
+ {
130
+ builtin: "typecheck",
131
+ id: "mechanical-green-typecheck",
132
+ kind: "builtin",
133
+ needs: ["green-implementation"]
134
+ },
135
+ {
136
+ builtin: "lint",
137
+ id: "mechanical-green-lint",
138
+ kind: "builtin",
139
+ needs: ["green-implementation"]
140
+ },
141
+ {
142
+ builtin: "fallow",
143
+ id: "mechanical-green-fallow",
144
+ kind: "builtin",
145
+ needs: ["green-implementation"]
146
+ },
147
+ {
148
+ gates: [{
149
+ id: "acceptance-coverage",
150
+ kind: "acceptance",
151
+ required: false,
152
+ target: "stdout"
153
+ }, {
154
+ id: "acceptance-verdict",
155
+ kind: "verdict",
156
+ target: "stdout"
157
+ }],
158
+ id: "acceptance-review",
159
+ kind: "agent",
160
+ needs: [
161
+ "mechanical-green-tests",
162
+ "mechanical-green-typecheck",
163
+ "mechanical-green-lint",
164
+ "mechanical-green-fallow"
165
+ ],
166
+ profile: "moka-acceptance-reviewer"
167
+ },
168
+ {
169
+ gates: [
170
+ {
171
+ builtin: "typecheck",
172
+ id: "verify-typecheck",
173
+ kind: "builtin"
174
+ },
175
+ {
176
+ builtin: "test",
177
+ id: "verify-tests",
178
+ kind: "builtin"
179
+ },
180
+ {
181
+ builtin: "lint",
182
+ id: "verify-lint",
183
+ kind: "builtin"
184
+ },
185
+ {
186
+ builtin: "fallow",
187
+ id: "verify-fallow",
188
+ kind: "builtin"
189
+ },
190
+ {
191
+ builtin: "semgrep",
192
+ id: "verify-semgrep",
193
+ kind: "builtin"
194
+ },
195
+ {
196
+ builtin: "duplication",
197
+ id: "verify-duplication",
198
+ kind: "builtin"
199
+ },
200
+ {
201
+ id: "verify-verdict",
202
+ kind: "verdict",
203
+ target: "stdout"
204
+ }
205
+ ],
206
+ id: "verification",
207
+ kind: "agent",
208
+ needs: [
209
+ "mechanical-green-tests",
210
+ "mechanical-green-typecheck",
211
+ "mechanical-green-lint",
212
+ "mechanical-green-fallow"
213
+ ],
214
+ profile: "moka-verifier"
215
+ },
216
+ {
217
+ id: "code-quality-review",
218
+ kind: "agent",
219
+ needs: [
220
+ "mechanical-green-tests",
221
+ "mechanical-green-typecheck",
222
+ "mechanical-green-lint",
223
+ "mechanical-green-fallow"
224
+ ],
225
+ profile: "moka-thermo-nuclear-reviewer"
226
+ },
227
+ {
228
+ id: "learn",
229
+ kind: "agent",
230
+ needs: [
231
+ "acceptance-review",
232
+ "verification",
233
+ "code-quality-review"
234
+ ],
235
+ profile: "moka-learner"
236
+ }
237
+ ]
238
+ } });
239
+ const baselineWorkflows = (baseline, _config) => {
240
+ if (baseline === "quick") return {
241
+ rootWorkflow: "root",
242
+ workflows: quickBaselineWorkflow()
243
+ };
244
+ return {
245
+ rootWorkflow: "root",
246
+ workflows: executeBaselineWorkflow()
247
+ };
248
+ };
249
+ const defaultScheduleId = (date) => `run-${date.toISOString().replaceAll(/[-:.TZ]/gu, "").slice(0, 14)}`;
250
+ const baselineScheduleArtifact = (input) => {
4
251
  const scheduleId = input.runId ?? defaultScheduleId(input.generatedAt);
5
252
  const baseline = baselineWorkflows(input.baseline, input.config);
6
253
  return {
@@ -13,259 +260,6 @@ function baselineScheduleArtifact(input) {
13
260
  version: 1,
14
261
  workflows: baseline.workflows
15
262
  };
16
- }
17
- function baselineWorkflows(baseline, _config) {
18
- if (baseline === "quick") return {
19
- rootWorkflow: "root",
20
- workflows: quickBaselineWorkflow()
21
- };
22
- return {
23
- rootWorkflow: "root",
24
- workflows: executeBaselineWorkflow()
25
- };
26
- }
27
- function quickBaselineWorkflow() {
28
- return { root: {
29
- description: "Compact generated quick schedule seed.",
30
- nodes: [
31
- {
32
- id: "backlog-intake",
33
- kind: "agent",
34
- profile: "moka-researcher"
35
- },
36
- {
37
- id: "red-tests",
38
- kind: "agent",
39
- needs: ["backlog-intake"],
40
- profile: "moka-test-writer"
41
- },
42
- {
43
- id: "implement",
44
- kind: "agent",
45
- needs: ["red-tests"],
46
- profile: "moka-code-writer"
47
- },
48
- {
49
- builtin: "test",
50
- id: "mechanical-tests",
51
- kind: "builtin",
52
- needs: ["implement"]
53
- },
54
- {
55
- builtin: "typecheck",
56
- id: "mechanical-typecheck",
57
- kind: "builtin",
58
- needs: ["implement"]
59
- },
60
- {
61
- gates: [
62
- {
63
- builtin: "typecheck",
64
- id: "verify-typecheck",
65
- kind: "builtin"
66
- },
67
- {
68
- builtin: "test",
69
- id: "verify-tests",
70
- kind: "builtin"
71
- },
72
- {
73
- builtin: "lint",
74
- id: "verify-lint",
75
- kind: "builtin"
76
- },
77
- {
78
- builtin: "fallow",
79
- id: "verify-fallow",
80
- kind: "builtin"
81
- },
82
- {
83
- kind: "verdict",
84
- id: "verify-verdict",
85
- target: "stdout"
86
- }
87
- ],
88
- id: "verify",
89
- kind: "agent",
90
- needs: ["mechanical-tests", "mechanical-typecheck"],
91
- profile: "moka-verifier"
92
- }
93
- ]
94
- } };
95
- }
96
- function executeBaselineWorkflow() {
97
- return { root: {
98
- description: "Full generated execute schedule seed.",
99
- nodes: [
100
- {
101
- id: "backlog-intake",
102
- kind: "agent",
103
- profile: "moka-researcher"
104
- },
105
- {
106
- id: "research",
107
- kind: "agent",
108
- needs: ["backlog-intake"],
109
- profile: "moka-researcher"
110
- },
111
- {
112
- gates: [{
113
- changed_files: {
114
- allow: [
115
- "**/*.test.*",
116
- "**/*.spec.*",
117
- "**/*_test.*",
118
- "**/__tests__/**",
119
- "test/**",
120
- "tests/**",
121
- "**/test/**",
122
- "**/tests/**",
123
- "**/*.snap"
124
- ],
125
- require_any: [
126
- "**/*.test.*",
127
- "**/*.spec.*",
128
- "**/*_test.*",
129
- "**/__tests__/**",
130
- "test/**",
131
- "tests/**",
132
- "**/test/**",
133
- "**/tests/**"
134
- ]
135
- },
136
- id: "red-test-file-policy",
137
- kind: "changed_files"
138
- }],
139
- id: "red-tests",
140
- kind: "agent",
141
- needs: ["research"],
142
- profile: "moka-test-writer"
143
- },
144
- {
145
- id: "green-implementation",
146
- kind: "agent",
147
- needs: ["red-tests"],
148
- profile: "moka-code-writer"
149
- },
150
- {
151
- builtin: "test",
152
- id: "mechanical-green-tests",
153
- kind: "builtin",
154
- needs: ["green-implementation"]
155
- },
156
- {
157
- builtin: "typecheck",
158
- id: "mechanical-green-typecheck",
159
- kind: "builtin",
160
- needs: ["green-implementation"]
161
- },
162
- {
163
- builtin: "lint",
164
- id: "mechanical-green-lint",
165
- kind: "builtin",
166
- needs: ["green-implementation"]
167
- },
168
- {
169
- builtin: "fallow",
170
- id: "mechanical-green-fallow",
171
- kind: "builtin",
172
- needs: ["green-implementation"]
173
- },
174
- {
175
- gates: [{
176
- id: "acceptance-coverage",
177
- kind: "acceptance",
178
- required: false,
179
- target: "stdout"
180
- }, {
181
- id: "acceptance-verdict",
182
- kind: "verdict",
183
- target: "stdout"
184
- }],
185
- id: "acceptance-review",
186
- kind: "agent",
187
- needs: [
188
- "mechanical-green-tests",
189
- "mechanical-green-typecheck",
190
- "mechanical-green-lint",
191
- "mechanical-green-fallow"
192
- ],
193
- profile: "moka-acceptance-reviewer"
194
- },
195
- {
196
- gates: [
197
- {
198
- builtin: "typecheck",
199
- id: "verify-typecheck",
200
- kind: "builtin"
201
- },
202
- {
203
- builtin: "test",
204
- id: "verify-tests",
205
- kind: "builtin"
206
- },
207
- {
208
- builtin: "lint",
209
- id: "verify-lint",
210
- kind: "builtin"
211
- },
212
- {
213
- builtin: "fallow",
214
- id: "verify-fallow",
215
- kind: "builtin"
216
- },
217
- {
218
- builtin: "semgrep",
219
- id: "verify-semgrep",
220
- kind: "builtin"
221
- },
222
- {
223
- builtin: "duplication",
224
- id: "verify-duplication",
225
- kind: "builtin"
226
- },
227
- {
228
- id: "verify-verdict",
229
- kind: "verdict",
230
- target: "stdout"
231
- }
232
- ],
233
- id: "verification",
234
- kind: "agent",
235
- needs: [
236
- "mechanical-green-tests",
237
- "mechanical-green-typecheck",
238
- "mechanical-green-lint",
239
- "mechanical-green-fallow"
240
- ],
241
- profile: "moka-verifier"
242
- },
243
- {
244
- id: "code-quality-review",
245
- kind: "agent",
246
- needs: [
247
- "mechanical-green-tests",
248
- "mechanical-green-typecheck",
249
- "mechanical-green-lint",
250
- "mechanical-green-fallow"
251
- ],
252
- profile: "moka-thermo-nuclear-reviewer"
253
- },
254
- {
255
- id: "learn",
256
- kind: "agent",
257
- needs: [
258
- "acceptance-review",
259
- "verification",
260
- "code-quality-review"
261
- ],
262
- profile: "moka-learner"
263
- }
264
- ]
265
- } };
266
- }
267
- function defaultScheduleId(date) {
268
- return `run-${date.toISOString().replaceAll(/[-:.TZ]/g, "").slice(0, 14)}`;
269
- }
263
+ };
270
264
  //#endregion
271
265
  export { baselineScheduleArtifact };
@@ -1,27 +1,61 @@
1
1
  import { uniqueGeneratedId } from "../../strings.js";
2
2
  import { dependentsByNeed, hasReachableDependent } from "../../planning/graph.js";
3
3
  import { isCoverageNode, isImplementationNode } from "../scheduling-roles.js";
4
+ import { Option } from "effect";
4
5
  //#region src/schedule/passes/coverage.ts
5
6
  const DEFAULT_GENERATED_COVERAGE_PROFILE_PREFERENCE = [
6
7
  "moka-verifier",
7
8
  "moka-acceptance-reviewer",
8
9
  "moka-thermo-nuclear-reviewer"
9
10
  ];
10
- function addGeneratedImplementationCoverage(config, artifact) {
11
- const coverageProfileId = generatedCoverageProfileId(config);
12
- if (!coverageProfileId) return artifact;
13
- return {
14
- ...artifact,
15
- workflows: Object.fromEntries(Object.entries(artifact.workflows).map(([id, workflow]) => [id, addWorkflowImplementationCoverage(config, workflow, coverageProfileId)]))
16
- };
17
- }
18
- function addWorkflowImplementationCoverage(config, workflow, coverageProfileId) {
19
- return {
20
- ...workflow,
21
- nodes: addNodeScopeImplementationCoverage(config, workflow.nodes, coverageProfileId)
22
- };
23
- }
24
- function addNodeScopeImplementationCoverage(config, nodes, coverageProfileId) {
11
+ const nodeNeedsImplementationCoverage = (config, node) => {
12
+ if (isImplementationNode(config, node)) return true;
13
+ return node.kind === "parallel" && node.nodes.some((child) => nodeNeedsImplementationCoverage(config, child));
14
+ };
15
+ const generatedCoverageProfileId = (config) => {
16
+ const coverageProfiles = Object.entries(config.profiles).filter(([, profile]) => (profile.scheduling_roles ?? []).includes("coverage")).map(([id]) => id);
17
+ if (coverageProfiles.length === 0) return Option.none();
18
+ return Option.fromUndefinedOr(DEFAULT_GENERATED_COVERAGE_PROFILE_PREFERENCE.find((id) => coverageProfiles.includes(id)) ?? coverageProfiles.toSorted()[0]);
19
+ };
20
+ const generatedCoverageGates = (nodeId) => [
21
+ {
22
+ builtin: "typecheck",
23
+ id: `${nodeId}-typecheck`,
24
+ kind: "builtin"
25
+ },
26
+ {
27
+ builtin: "test",
28
+ id: `${nodeId}-tests`,
29
+ kind: "builtin"
30
+ },
31
+ {
32
+ builtin: "lint",
33
+ id: `${nodeId}-lint`,
34
+ kind: "builtin"
35
+ },
36
+ {
37
+ builtin: "fallow",
38
+ id: `${nodeId}-fallow`,
39
+ kind: "builtin"
40
+ },
41
+ {
42
+ builtin: "semgrep",
43
+ id: `${nodeId}-semgrep`,
44
+ kind: "builtin"
45
+ },
46
+ {
47
+ builtin: "duplication",
48
+ id: `${nodeId}-duplication`,
49
+ kind: "builtin"
50
+ },
51
+ {
52
+ id: `${nodeId}-verdict`,
53
+ kind: "verdict",
54
+ target: "stdout"
55
+ }
56
+ ];
57
+ const hasDownstreamCoverage = (config, nodeId, index) => hasReachableDependent(nodeId, index, (node) => isCoverageNode(config, node));
58
+ const addNodeScopeImplementationCoverage = (config, nodes, coverageProfileId) => {
25
59
  const index = dependentsByNeed(nodes);
26
60
  const uncovered = nodes.filter((node) => nodeNeedsImplementationCoverage(config, node)).filter((node) => !hasDownstreamCoverage(config, node.id, index));
27
61
  if (uncovered.length === 0) return nodes;
@@ -33,57 +67,18 @@ function addNodeScopeImplementationCoverage(config, nodes, coverageProfileId) {
33
67
  needs: uncovered.map((node) => node.id),
34
68
  profile: coverageProfileId
35
69
  }];
36
- }
37
- function nodeNeedsImplementationCoverage(config, node) {
38
- if (isImplementationNode(config, node)) return true;
39
- return node.kind === "parallel" && node.nodes.some((child) => nodeNeedsImplementationCoverage(config, child));
40
- }
41
- function generatedCoverageProfileId(config) {
42
- const coverageProfiles = Object.entries(config.profiles).filter(([, profile]) => profile.scheduling_roles?.includes("coverage")).map(([id]) => id);
43
- if (coverageProfiles.length === 0) return null;
44
- return DEFAULT_GENERATED_COVERAGE_PROFILE_PREFERENCE.find((id) => coverageProfiles.includes(id)) ?? coverageProfiles.sort()[0] ?? null;
45
- }
46
- function generatedCoverageGates(nodeId) {
47
- return [
48
- {
49
- builtin: "typecheck",
50
- id: `${nodeId}-typecheck`,
51
- kind: "builtin"
52
- },
53
- {
54
- builtin: "test",
55
- id: `${nodeId}-tests`,
56
- kind: "builtin"
57
- },
58
- {
59
- builtin: "lint",
60
- id: `${nodeId}-lint`,
61
- kind: "builtin"
62
- },
63
- {
64
- builtin: "fallow",
65
- id: `${nodeId}-fallow`,
66
- kind: "builtin"
67
- },
68
- {
69
- builtin: "semgrep",
70
- id: `${nodeId}-semgrep`,
71
- kind: "builtin"
72
- },
73
- {
74
- builtin: "duplication",
75
- id: `${nodeId}-duplication`,
76
- kind: "builtin"
77
- },
78
- {
79
- id: `${nodeId}-verdict`,
80
- kind: "verdict",
81
- target: "stdout"
82
- }
83
- ];
84
- }
85
- function hasDownstreamCoverage(config, nodeId, index) {
86
- return hasReachableDependent(nodeId, index, (node) => isCoverageNode(config, node));
87
- }
70
+ };
71
+ const addWorkflowImplementationCoverage = (config, workflow, coverageProfileId) => ({
72
+ ...workflow,
73
+ nodes: addNodeScopeImplementationCoverage(config, workflow.nodes, coverageProfileId)
74
+ });
75
+ const addGeneratedImplementationCoverage = (config, artifact) => {
76
+ const coverageProfileId = generatedCoverageProfileId(config);
77
+ if (Option.isNone(coverageProfileId)) return artifact;
78
+ return {
79
+ ...artifact,
80
+ workflows: Object.fromEntries(Object.entries(artifact.workflows).map(([id, workflow]) => [id, addWorkflowImplementationCoverage(config, workflow, coverageProfileId.value)]))
81
+ };
82
+ };
88
83
  //#endregion
89
- export { addGeneratedImplementationCoverage };
84
+ export { addGeneratedImplementationCoverage, hasDownstreamCoverage };