orkeon-code 1.0.0-rc.1 → 1.0.0-rc.2

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 (440) hide show
  1. package/.orkeon-runtime +10 -0
  2. package/.orkeon-version +1 -1
  3. package/NOTICE.md +1 -1
  4. package/README.fr.md +16 -22
  5. package/README.md +16 -22
  6. package/config/appsettings.jev.example.json +4 -1
  7. package/config/appsettings.kev.example.json +4 -1
  8. package/config/appsettings.liquid.example.json +4 -1
  9. package/config/appsettings.ollama-whisper.example.json +1 -0
  10. package/config/appsettings.whisper.example.json +1 -0
  11. package/mcp/whisper/README.md +2 -1
  12. package/orkeon-code +206 -11
  13. package/orkeon-code.ps1 +109 -7
  14. package/package.json +2 -1
  15. package/src/commands/.orkeon/orkeon-cli.d.ts +1 -4
  16. package/src/commands/_lib/args.ts +5 -4
  17. package/src/commands/_lib/dev/dev-batches.ts +34 -36
  18. package/src/commands/_lib/dev/dev-implement.ts +11 -14
  19. package/src/commands/_lib/dev/dev-source.ts +7 -11
  20. package/src/commands/_lib/dev/dev.ts +34 -37
  21. package/src/commands/_lib/dev/markers.ts +7 -0
  22. package/src/commands/_lib/dev/messages.ts +112 -0
  23. package/src/commands/_lib/dev-step.ts +16 -13
  24. package/src/commands/_lib/dispatch.ts +62 -39
  25. package/src/commands/_lib/git/branch.ts +9 -10
  26. package/src/commands/_lib/git/commit.ts +9 -13
  27. package/src/commands/_lib/git/diff.ts +22 -12
  28. package/src/commands/_lib/git/messages.ts +54 -0
  29. package/src/commands/_lib/git/review.ts +9 -10
  30. package/src/commands/_lib/memory/memory-admit.ts +19 -21
  31. package/src/commands/_lib/memory/memory.ts +3 -2
  32. package/src/commands/_lib/memory/messages.ts +32 -0
  33. package/src/commands/_lib/messages.ts +48 -0
  34. package/src/commands/_lib/project/messages.ts +8 -0
  35. package/src/commands/_lib/session/export.ts +3 -2
  36. package/src/commands/_lib/session/messages.ts +87 -0
  37. package/src/commands/_lib/session/prompts.ts +4 -0
  38. package/src/commands/_lib/session/resume.ts +15 -24
  39. package/src/commands/_lib/session/tasks.ts +20 -23
  40. package/src/commands/_lib/settings/advisor.ts +11 -16
  41. package/src/commands/_lib/settings/agents.ts +18 -28
  42. package/src/commands/_lib/settings/choices.ts +8 -0
  43. package/src/commands/_lib/settings/config.ts +43 -43
  44. package/src/commands/_lib/settings/effort.ts +147 -0
  45. package/src/commands/_lib/settings/hooks.ts +12 -20
  46. package/src/commands/_lib/settings/messages.ts +408 -0
  47. package/src/commands/_lib/settings/mode.ts +33 -24
  48. package/src/commands/_lib/settings/model.ts +71 -36
  49. package/src/commands/_lib/settings/output-style.ts +39 -0
  50. package/src/commands/_lib/settings/permissions.ts +71 -93
  51. package/src/commands/_lib/settings/route.ts +63 -0
  52. package/src/commands/_lib/settings/skills.ts +53 -11
  53. package/src/commands/_lib/settings/theme.ts +42 -0
  54. package/src/commands/_lib/speech/messages.ts +58 -0
  55. package/src/commands/_lib/speech/prompts.ts +4 -0
  56. package/src/commands/_lib/speech/say.ts +9 -10
  57. package/src/commands/_lib/speech/transcribe.ts +14 -23
  58. package/src/commands/_lib/speech/voice.ts +14 -18
  59. package/src/commands/_lib/status/doctor.ts +47 -28
  60. package/src/commands/_lib/status/messages.ts +100 -0
  61. package/src/commands/_lib/status/meta.ts +3 -24
  62. package/src/commands/_lib/status/status.ts +10 -11
  63. package/src/commands/_lib/status/usage-tools.ts +2 -3
  64. package/src/commands/_lib/status/usage.ts +7 -18
  65. package/src/commands/_lib/view.ts +6 -1
  66. package/src/commands/dev/dev-batches.cmd.ts +4 -3
  67. package/src/commands/dev/dev-learn.cmd.ts +3 -3
  68. package/src/commands/dev/dev-plan.cmd.ts +6 -7
  69. package/src/commands/dev/dev-spec.cmd.ts +6 -7
  70. package/src/commands/git/commit.cmd.ts +3 -3
  71. package/src/commands/git/review.cmd.ts +3 -3
  72. package/src/commands/memory/memory.cmd.ts +2 -2
  73. package/src/commands/project/analyze.cmd.ts +3 -3
  74. package/src/commands/project/debug-tool-call.cmd.ts +4 -9
  75. package/src/commands/project/init-verifiers.cmd.ts +3 -3
  76. package/src/commands/project/init.cmd.ts +3 -3
  77. package/src/commands/project/verify.cmd.ts +2 -2
  78. package/src/commands/session/assistant.cmd.ts +2 -2
  79. package/src/commands/session/compact.cmd.ts +1 -1
  80. package/src/commands/session/copy.cmd.ts +8 -7
  81. package/src/commands/session/rename.cmd.ts +3 -2
  82. package/src/commands/session/rewind.cmd.ts +3 -4
  83. package/src/commands/session/summary.cmd.ts +3 -3
  84. package/src/commands/session/tasks.cmd.ts +4 -2
  85. package/src/commands/settings/config.cmd.ts +4 -2
  86. package/src/commands/settings/effort.cmd.ts +10 -31
  87. package/src/commands/settings/fast.cmd.ts +2 -1
  88. package/src/commands/settings/mode.cmd.ts +3 -3
  89. package/src/commands/settings/model.cmd.ts +3 -2
  90. package/src/commands/settings/output-style.cmd.ts +9 -38
  91. package/src/commands/settings/permissions.cmd.ts +2 -2
  92. package/src/commands/settings/proactive.cmd.ts +2 -1
  93. package/src/commands/settings/route.cmd.ts +16 -0
  94. package/src/commands/settings/skills.cmd.ts +3 -3
  95. package/src/commands/settings/theme.cmd.ts +14 -0
  96. package/src/commands/speech/say.cmd.ts +2 -2
  97. package/src/commands/speech/transcribe.cmd.ts +2 -2
  98. package/src/commands/status/release-notes.cmd.ts +1 -1
  99. package/src/crews/.orkeon/orkeon.d.ts +538 -93
  100. package/src/crews/_probe-shared-memory/domain/messages.ts +54 -0
  101. package/src/crews/_probe-shared-memory/domain/probe-verdict.ts +17 -12
  102. package/src/crews/_probe-shared-memory/domain/prompts.ts +5 -0
  103. package/src/crews/_probe-shared-memory/probe.ork.ts +5 -3
  104. package/src/crews/advisor/application/messages.ts +4 -0
  105. package/src/crews/advisor/application/prompts.ts +4 -0
  106. package/src/crews/advisor/application/run-advisor.ts +2 -1
  107. package/src/crews/advisor/crew.ork.ts +5 -4
  108. package/src/crews/advisor/domain/advice.ts +7 -23
  109. package/src/crews/advisor/domain/messages.ts +8 -0
  110. package/src/crews/advisor/domain/prompts.ts +26 -0
  111. package/src/crews/agent-run/application/messages.ts +18 -0
  112. package/src/crews/agent-run/application/run-agent-run.ts +5 -4
  113. package/src/crews/agent-run/crew.ork.ts +3 -3
  114. package/src/crews/analyze/application/messages.ts +27 -0
  115. package/src/crews/analyze/application/prompts.ts +4 -0
  116. package/src/crews/analyze/application/run-analyze.ts +16 -14
  117. package/src/crews/analyze/crew.ork.ts +5 -4
  118. package/src/crews/analyze/domain/harvest.ts +33 -65
  119. package/src/crews/analyze/domain/prompts.ts +86 -0
  120. package/src/crews/code-review/application/lens-material.ts +24 -0
  121. package/src/crews/code-review/application/messages.ts +17 -0
  122. package/src/crews/code-review/application/prompts.ts +10 -17
  123. package/src/crews/code-review/application/review.ts +4 -1
  124. package/src/crews/code-review/application/run-code-review.ts +13 -15
  125. package/src/crews/code-review/crew.ork.ts +5 -4
  126. package/src/crews/code-review/domain/lenses.ts +6 -45
  127. package/src/crews/code-review/domain/messages.ts +25 -0
  128. package/src/crews/code-review/domain/prompts.ts +58 -0
  129. package/src/crews/code-review/domain/report.ts +5 -6
  130. package/src/crews/code-review/domain/scope.ts +6 -12
  131. package/src/crews/dev-batches/application/messages.ts +127 -0
  132. package/src/crews/dev-batches/application/plan-close.ts +12 -12
  133. package/src/crews/dev-batches/application/prompts.ts +10 -0
  134. package/src/crews/dev-batches/application/run-dev-batches.ts +57 -50
  135. package/src/crews/dev-batches/application/run-wave.ts +24 -22
  136. package/src/crews/dev-batches/application/seed-harvest.ts +8 -7
  137. package/src/crews/dev-batches/crew.ork.ts +12 -9
  138. package/src/crews/dev-batches/domain/batches-log.ts +1 -3
  139. package/src/crews/dev-batches/domain/markers.ts +5 -0
  140. package/src/crews/dev-batches/domain/messages.ts +6 -0
  141. package/src/crews/dev-batches/domain/wave-order.ts +3 -2
  142. package/src/crews/dev-change/application/change-material.ts +44 -0
  143. package/src/crews/dev-change/application/evidence.ts +25 -22
  144. package/src/crews/dev-change/application/messages.ts +81 -0
  145. package/src/crews/dev-change/application/{change-prompt.ts → prompts.ts} +40 -43
  146. package/src/crews/dev-change/application/run-dev-change.ts +43 -34
  147. package/src/crews/dev-change/crew.ork.ts +11 -9
  148. package/src/crews/dev-change/domain/change-answer.ts +24 -20
  149. package/src/crews/dev-change/domain/change-render.ts +13 -15
  150. package/src/crews/dev-change/domain/markers.ts +28 -0
  151. package/src/crews/dev-change/domain/messages.ts +16 -0
  152. package/src/crews/dev-implement/application/close.ts +21 -18
  153. package/src/crews/dev-implement/application/locate-sheet.ts +7 -5
  154. package/src/crews/dev-implement/application/messages.ts +161 -0
  155. package/src/crews/dev-implement/application/observe.ts +4 -2
  156. package/src/crews/dev-implement/application/prompts.ts +9 -0
  157. package/src/crews/dev-implement/application/report-writes.ts +14 -9
  158. package/src/crews/dev-implement/application/run-dev-implement.ts +84 -73
  159. package/src/crews/dev-implement/application/suite-job.ts +15 -11
  160. package/src/crews/dev-implement/crew.ork.ts +2 -1
  161. package/src/crews/dev-implement/domain/contracts.ts +59 -60
  162. package/src/crews/dev-implement/domain/correction.ts +16 -15
  163. package/src/crews/dev-implement/domain/cycles.ts +2 -1
  164. package/src/crews/dev-implement/domain/markers.ts +23 -0
  165. package/src/crews/dev-implement/domain/messages.ts +58 -0
  166. package/src/crews/dev-implement/domain/prompts.ts +93 -0
  167. package/src/crews/dev-implement/domain/roles.ts +3 -7
  168. package/src/crews/dev-implement/domain/sheet-edits.ts +6 -5
  169. package/src/crews/dev-implement/domain/sheet-ticks.ts +5 -4
  170. package/src/crews/dev-implement/domain/step-checks.ts +17 -16
  171. package/src/crews/dev-implement/domain/step-section.ts +6 -4
  172. package/src/crews/dev-learn/application/learn-prompt-fit.ts +63 -0
  173. package/src/crews/dev-learn/application/messages.ts +51 -0
  174. package/src/crews/dev-learn/application/{learn-prompt.ts → prompts.ts} +24 -65
  175. package/src/crews/dev-learn/application/run-dev-learn.ts +37 -32
  176. package/src/crews/dev-learn/crew.ork.ts +4 -3
  177. package/src/crews/dev-learn/domain/learn-answer.ts +25 -27
  178. package/src/crews/dev-learn/domain/messages.ts +65 -0
  179. package/src/crews/dev-learn/domain/owner-lines.ts +12 -9
  180. package/src/crews/dev-learn/domain/proposals-render.ts +8 -9
  181. package/src/crews/dev-plan/application/anchor-paths.ts +57 -20
  182. package/src/crews/dev-plan/application/inventory.ts +17 -13
  183. package/src/crews/dev-plan/application/messages.ts +88 -0
  184. package/src/crews/dev-plan/application/plan-prompt-fit.ts +44 -0
  185. package/src/crews/dev-plan/application/{plan-prompt.ts → prompts.ts} +37 -55
  186. package/src/crews/dev-plan/application/run-dev-plan.ts +103 -75
  187. package/src/crews/dev-plan/crew.ork.ts +11 -8
  188. package/src/crews/dev-plan/domain/inventory-model.ts +3 -3
  189. package/src/crews/dev-plan/domain/markers.ts +18 -0
  190. package/src/crews/dev-plan/domain/messages.ts +118 -0
  191. package/src/crews/dev-plan/domain/plan-answer.ts +118 -103
  192. package/src/crews/dev-plan/domain/plan-render.ts +30 -31
  193. package/src/crews/dev-plan/domain/prompts.ts +44 -0
  194. package/src/crews/dev-spec/application/messages.ts +30 -0
  195. package/src/crews/dev-spec/application/{spec-prompt.ts → prompts.ts} +42 -47
  196. package/src/crews/dev-spec/application/run-dev-spec.ts +67 -36
  197. package/src/crews/dev-spec/application/spec-material.ts +42 -0
  198. package/src/crews/dev-spec/crew.ork.ts +11 -9
  199. package/src/crews/dev-spec/domain/markers.ts +30 -0
  200. package/src/crews/dev-spec/domain/messages.ts +39 -0
  201. package/src/crews/dev-spec/domain/spec-answer.ts +46 -47
  202. package/src/crews/dev-spec/domain/spec-render.ts +18 -18
  203. package/src/crews/dev-verify/application/audit-brief.ts +187 -0
  204. package/src/crews/dev-verify/application/audit.ts +38 -30
  205. package/src/crews/dev-verify/application/capture.ts +34 -26
  206. package/src/crews/dev-verify/application/messages.ts +119 -0
  207. package/src/crews/dev-verify/application/prompts.ts +209 -0
  208. package/src/crews/dev-verify/application/run-dev-verify.ts +60 -46
  209. package/src/crews/dev-verify/application/run-gate.ts +11 -9
  210. package/src/crews/dev-verify/crew.ork.ts +6 -6
  211. package/src/crews/dev-verify/domain/audit-answer.ts +16 -12
  212. package/src/crews/dev-verify/domain/capture-sections.ts +5 -4
  213. package/src/crews/dev-verify/domain/commands.ts +3 -3
  214. package/src/crews/dev-verify/domain/gate.ts +21 -16
  215. package/src/crews/dev-verify/domain/markers.ts +16 -0
  216. package/src/crews/dev-verify/domain/mechanical-table.ts +37 -44
  217. package/src/crews/dev-verify/domain/messages.ts +92 -0
  218. package/src/crews/dev-verify/domain/verdict.ts +4 -4
  219. package/src/crews/git-commit/application/draft.ts +16 -37
  220. package/src/crews/git-commit/application/messages.ts +15 -0
  221. package/src/crews/git-commit/application/prompts.ts +47 -0
  222. package/src/crews/git-commit/application/run-git-commit.ts +13 -12
  223. package/src/crews/git-commit/crew.ork.ts +5 -4
  224. package/src/crews/git-commit/domain/commit.ts +15 -35
  225. package/src/crews/git-commit/domain/markers.ts +4 -0
  226. package/src/crews/git-commit/domain/messages.ts +48 -0
  227. package/src/crews/init-verifiers/application/authoring.ts +2 -1
  228. package/src/crews/init-verifiers/application/messages.ts +13 -0
  229. package/src/crews/init-verifiers/application/prompts.ts +5 -1
  230. package/src/crews/init-verifiers/application/run-init-verifiers.ts +3 -2
  231. package/src/crews/init-verifiers/crew.ork.ts +5 -4
  232. package/src/crews/main-loop/application/auto-compact.ts +2 -1
  233. package/src/crews/main-loop/application/messages.ts +81 -0
  234. package/src/crews/main-loop/application/prompts.ts +12 -0
  235. package/src/crews/main-loop/application/run-main-loop.ts +63 -30
  236. package/src/crews/main-loop/application/{turn-prompt.ts → turn-context.ts} +7 -8
  237. package/src/crews/main-loop/crew.ork.ts +12 -7
  238. package/src/crews/main-loop/domain/prompt-assembly.ts +45 -228
  239. package/src/crews/main-loop/domain/prompts.ts +336 -0
  240. package/src/crews/main-loop/domain/turn-chains.ts +10 -9
  241. package/src/crews/project-init/application/detect.ts +5 -4
  242. package/src/crews/project-init/application/messages.ts +15 -0
  243. package/src/crews/project-init/application/prompts.ts +11 -7
  244. package/src/crews/project-init/crew.ork.ts +5 -4
  245. package/src/crews/project-init/domain/existing-files.ts +6 -4
  246. package/src/crews/project-init/domain/messages.ts +13 -0
  247. package/src/crews/project-init/domain/package-map.ts +3 -3
  248. package/src/crews/project-init/domain/prompts.ts +10 -0
  249. package/src/crews/session-compact/application/prompts.ts +5 -0
  250. package/src/crews/session-compact/crew.ork.ts +5 -4
  251. package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
  252. package/src/crews/shared-memory-admit/crew.ork.ts +3 -2
  253. package/src/crews/speech/application/messages.ts +3 -0
  254. package/src/crews/speech/application/prompts.ts +3 -0
  255. package/src/crews/speech/application/run-speech.ts +2 -1
  256. package/src/crews/speech/crew.ork.ts +2 -1
  257. package/src/shared/application/agents/child-agent.ts +11 -7
  258. package/src/shared/application/agents/messages.ts +35 -0
  259. package/src/shared/application/agents/route-agent.ts +115 -0
  260. package/src/shared/application/agents/run-sub-agent.ts +31 -8
  261. package/src/shared/application/compaction/compact-session.ts +19 -14
  262. package/src/shared/application/compaction/messages.ts +20 -0
  263. package/src/shared/application/compaction/prune-context.ts +94 -0
  264. package/src/shared/application/compaction/pruned-llm.ts +35 -0
  265. package/src/shared/application/dev/brief-inventory.ts +6 -4
  266. package/src/shared/application/dev/close-batch.ts +9 -7
  267. package/src/shared/application/dev/find-repo-pack.ts +4 -3
  268. package/src/shared/application/dev/learn-decision.ts +20 -18
  269. package/src/shared/application/dev/load-dev-context.ts +7 -8
  270. package/src/shared/application/dev/measure-access-cost.ts +5 -4
  271. package/src/shared/application/dev/messages.ts +132 -0
  272. package/src/shared/application/dev/phase-timer.ts +54 -0
  273. package/src/shared/application/dev/plan-source.ts +12 -8
  274. package/src/shared/application/dev/preflight.ts +8 -8
  275. package/src/shared/application/dev/prompts.ts +34 -0
  276. package/src/shared/application/dev/question-round.ts +25 -17
  277. package/src/shared/application/dev/resolve-work-folder.ts +4 -3
  278. package/src/shared/application/dev/settle-questions.ts +4 -2
  279. package/src/shared/application/dev/source-review.ts +12 -8
  280. package/src/shared/application/dev/source-step.ts +12 -10
  281. package/src/shared/application/dev/spend.ts +17 -4
  282. package/src/shared/application/dev/step-precedents.ts +2 -1
  283. package/src/shared/application/dev/tool-call-policy.ts +9 -11
  284. package/src/shared/application/dev/tool-callbacks.ts +52 -5
  285. package/src/shared/application/dev/tool-trace-recorder.ts +2 -1
  286. package/src/shared/application/dev/verdict-sources.ts +5 -3
  287. package/src/shared/application/dev/wrapped-tools.ts +4 -2
  288. package/src/shared/application/extra-tools.ts +2 -1
  289. package/src/shared/application/git/batch-worktree.ts +22 -17
  290. package/src/shared/application/git/commit-files.ts +24 -19
  291. package/src/shared/application/git/merge-batch.ts +11 -7
  292. package/src/shared/application/git/messages.ts +75 -0
  293. package/src/shared/application/git/open-pull-request.ts +4 -3
  294. package/src/shared/application/host-context.ts +59 -0
  295. package/src/shared/application/host-layout-store.ts +45 -0
  296. package/src/shared/application/llm-profile.ts +4 -3
  297. package/src/shared/application/messages.ts +14 -0
  298. package/src/shared/application/permission-rules.ts +10 -0
  299. package/src/shared/application/ports/decision.ts +14 -0
  300. package/src/shared/application/ports/human.ts +25 -0
  301. package/src/shared/application/ports/llm.ts +32 -3
  302. package/src/shared/application/ports/memory.ts +1 -1
  303. package/src/shared/application/ports/theme.ts +11 -0
  304. package/src/shared/application/ports.ts +4 -2
  305. package/src/shared/application/session-io.ts +2 -1
  306. package/src/shared/application/shared-memory/admit-entries.ts +16 -14
  307. package/src/shared/application/shared-memory/harvest-after-gaps.ts +5 -8
  308. package/src/shared/application/shared-memory/harvest-mistakes.ts +3 -2
  309. package/src/shared/application/shared-memory/import-agent-memory.ts +9 -7
  310. package/src/shared/application/shared-memory/memory-files.ts +2 -1
  311. package/src/shared/application/shared-memory/memory-settings.ts +2 -1
  312. package/src/shared/application/shared-memory/messages.ts +63 -0
  313. package/src/shared/application/shared-memory/push-candidate.ts +14 -11
  314. package/src/shared/application/shared-memory/recall-precedents.ts +2 -1
  315. package/src/shared/application/skills/messages.ts +4 -0
  316. package/src/shared/application/skills/suggest-skills.ts +102 -0
  317. package/src/shared/application/workflow/messages.ts +8 -0
  318. package/src/shared/application/workflow/workflow-state.ts +7 -6
  319. package/src/shared/domain/agent-policy/behavior-flags.ts +4 -10
  320. package/src/shared/domain/agent-policy/extra-tools.ts +2 -4
  321. package/src/shared/domain/agent-policy/messages.ts +66 -0
  322. package/src/shared/domain/agent-policy/path-rules.ts +299 -0
  323. package/src/shared/domain/agent-policy/permission.ts +20 -18
  324. package/src/shared/domain/agent-policy/prompts.ts +17 -0
  325. package/src/shared/domain/agent-policy/reasoning.ts +59 -0
  326. package/src/shared/domain/agent-policy/rule-sets.ts +18 -14
  327. package/src/shared/domain/agent-policy/tool-access.ts +17 -3
  328. package/src/shared/domain/agent-registry.ts +6 -5
  329. package/src/shared/domain/agents/chain.ts +2 -2
  330. package/src/shared/domain/agents/charter.ts +8 -5
  331. package/src/shared/domain/agents/exclusive.ts +2 -1
  332. package/src/shared/domain/agents/instances.ts +18 -15
  333. package/src/shared/domain/agents/messages.ts +39 -0
  334. package/src/shared/domain/agents/model-route.ts +199 -0
  335. package/src/shared/domain/agents/prompts.ts +20 -0
  336. package/src/shared/domain/code-intel-contract.ts +5 -4
  337. package/src/shared/domain/code-intel-routing.ts +8 -61
  338. package/src/shared/domain/compact-outcome.ts +5 -3
  339. package/src/shared/domain/compaction-thresholds.ts +2 -1
  340. package/src/shared/domain/compaction.ts +22 -113
  341. package/src/shared/domain/config-schema.ts +94 -81
  342. package/src/shared/domain/context-prune.ts +176 -0
  343. package/src/shared/domain/decision/questions.ts +102 -0
  344. package/src/shared/domain/dev/access-cost.ts +19 -15
  345. package/src/shared/domain/dev/batches-concurrency.ts +5 -6
  346. package/src/shared/domain/dev/build-commands.ts +5 -4
  347. package/src/shared/domain/dev/call-guard.ts +29 -28
  348. package/src/shared/domain/dev/carried-text.ts +3 -5
  349. package/src/shared/domain/dev/learn-proposals.ts +5 -4
  350. package/src/shared/domain/dev/learn-state.ts +3 -2
  351. package/src/shared/domain/dev/markers.ts +107 -0
  352. package/src/shared/domain/dev/messages.ts +259 -0
  353. package/src/shared/domain/dev/phase-timing.ts +50 -0
  354. package/src/shared/domain/dev/plan-checks.ts +24 -23
  355. package/src/shared/domain/dev/plan-format.ts +14 -24
  356. package/src/shared/domain/dev/project-files.ts +1 -15
  357. package/src/shared/domain/dev/prompts/brief-blocks.ts +20 -0
  358. package/src/shared/domain/dev/{review-prompt.ts → prompts.ts} +91 -61
  359. package/src/shared/domain/dev/questions.ts +33 -15
  360. package/src/shared/domain/dev/repo-pack.ts +12 -9
  361. package/src/shared/domain/dev/review-answer.ts +40 -17
  362. package/src/shared/domain/dev/review-brief.ts +54 -0
  363. package/src/shared/domain/dev/reviewer-charter.ts +4 -0
  364. package/src/shared/domain/dev/sheet-facts.ts +2 -4
  365. package/src/shared/domain/dev/spec-format.ts +13 -14
  366. package/src/shared/domain/dev/step-budget.ts +4 -2
  367. package/src/shared/domain/dev/step-rules.ts +3 -4
  368. package/src/shared/domain/dev/test-commands.ts +14 -10
  369. package/src/shared/domain/dev/tool-guards.ts +4 -3
  370. package/src/shared/domain/dev/trait-pattern.ts +14 -10
  371. package/src/shared/domain/dev/verdict-format.ts +14 -21
  372. package/src/shared/domain/dev/whitespace.ts +3 -2
  373. package/src/shared/domain/dev/work-folder.ts +4 -3
  374. package/src/shared/domain/dev/yaml-subset.ts +8 -26
  375. package/src/shared/domain/error-text.ts +13 -0
  376. package/src/shared/domain/git/close.ts +5 -4
  377. package/src/shared/domain/git/messages.ts +20 -0
  378. package/src/shared/domain/git/pull-request.ts +5 -5
  379. package/src/shared/domain/host-layout.ts +147 -0
  380. package/src/shared/domain/host-paths.ts +399 -0
  381. package/src/shared/domain/llm-failure.ts +35 -7
  382. package/src/shared/domain/llm-profile.ts +22 -3
  383. package/src/shared/domain/marked-message.ts +1 -5
  384. package/src/shared/domain/markers.ts +30 -0
  385. package/src/shared/domain/messages.ts +291 -0
  386. package/src/shared/domain/model-catalog.ts +2 -9
  387. package/src/shared/domain/permission-modes.ts +4 -8
  388. package/src/shared/domain/prelude.ts +2 -2
  389. package/src/shared/domain/project-manifests.ts +3 -2
  390. package/src/shared/domain/prompts.ts +233 -0
  391. package/src/shared/domain/search-routing.ts +3 -11
  392. package/src/shared/domain/secret-patterns.ts +3 -2
  393. package/src/shared/domain/session-keys.ts +7 -0
  394. package/src/shared/domain/session-start.ts +3 -2
  395. package/src/shared/domain/shared-memory/agent-memory-import.ts +4 -2
  396. package/src/shared/domain/shared-memory/candidates.ts +3 -4
  397. package/src/shared/domain/shared-memory/entry.ts +26 -20
  398. package/src/shared/domain/shared-memory/front-matter.ts +17 -13
  399. package/src/shared/domain/shared-memory/gate.ts +4 -3
  400. package/src/shared/domain/shared-memory/harvest.ts +9 -6
  401. package/src/shared/domain/shared-memory/layout.ts +11 -8
  402. package/src/shared/domain/shared-memory/markers.ts +9 -0
  403. package/src/shared/domain/shared-memory/messages.ts +66 -0
  404. package/src/shared/domain/shared-memory/precedents-block.ts +4 -15
  405. package/src/shared/domain/shared-memory/prompts.ts +28 -0
  406. package/src/shared/domain/shared-memory/refused.ts +3 -3
  407. package/src/shared/domain/skills/prompts.ts +4 -0
  408. package/src/shared/domain/skills/shortlist.ts +149 -0
  409. package/src/shared/domain/snip-turns.ts +2 -14
  410. package/src/shared/domain/speech.ts +2 -1
  411. package/src/shared/domain/tool-trace.ts +5 -7
  412. package/src/shared/domain/verifiers.ts +7 -11
  413. package/src/shared/domain/vfs.ts +8 -1
  414. package/src/shared/domain/workflow/prompts.ts +15 -0
  415. package/src/shared/domain/workflow/state-file.ts +14 -12
  416. package/src/shared/infrastructure/globals.ts +7 -2
  417. package/src/shared/infrastructure/orkeon/child-agents.ts +11 -16
  418. package/src/shared/infrastructure/orkeon/chooser.ts +32 -0
  419. package/src/shared/infrastructure/orkeon/decision-model.ts +31 -0
  420. package/src/shared/infrastructure/orkeon/dev-deps.ts +21 -14
  421. package/src/shared/infrastructure/orkeon/files.ts +24 -6
  422. package/src/shared/infrastructure/orkeon/github-pull-requests.ts +3 -2
  423. package/src/shared/infrastructure/orkeon/host-context.ts +36 -0
  424. package/src/shared/infrastructure/orkeon/human-input.ts +1 -5
  425. package/src/shared/infrastructure/orkeon/llm-profile.ts +36 -16
  426. package/src/shared/infrastructure/orkeon/llm.ts +85 -30
  427. package/src/shared/infrastructure/orkeon/markers.ts +6 -0
  428. package/src/shared/infrastructure/orkeon/memory-store.ts +1 -1
  429. package/src/shared/infrastructure/orkeon/memory-tools.ts +18 -20
  430. package/src/shared/infrastructure/orkeon/messages.ts +15 -0
  431. package/src/shared/infrastructure/orkeon/prompts.ts +47 -0
  432. package/src/shared/infrastructure/orkeon/reasoning.ts +40 -0
  433. package/src/shared/infrastructure/orkeon/script-tools.ts +14 -19
  434. package/src/shared/infrastructure/orkeon/session-store.ts +7 -51
  435. package/src/shared/infrastructure/orkeon/shell-jobs.ts +13 -7
  436. package/src/shared/infrastructure/orkeon/shell.ts +13 -5
  437. package/src/shared/infrastructure/orkeon/tool-catalogue.ts +3 -2
  438. package/src/shared/infrastructure/orkeon/wiring.ts +68 -12
  439. package/src/crews/dev-verify/application/auditor-prompt.ts +0 -323
  440. package/src/shared/domain/session-summary.ts +0 -13
@@ -8,6 +8,12 @@
8
8
  import type { Checked } from "../../../shared/domain/agents/charter.ts";
9
9
  import { DESIGN_RULE_IDS } from "../../../shared/domain/dev/design-rules.ts";
10
10
  import type { ChangeKind, SourceKind } from "../../../shared/domain/dev/spec-format.ts";
11
+ import { BUILD_STEP } from "../../../shared/domain/dev/markers.ts";
12
+ import { ANCHOR_KINDS, DESIGN_RULE_ID, ELEMENT_LAYERS, FEATURE_EMPTY, LAYERS_EMPTY, NOT_RELATIVE, TEST_LEVELS, TOOLS_FOLDER, WORK_FOLDER, anchorNeedsPath, anchorNotShown, anchorPathColon, appliedAndNa, batchCount, cannotBeAnchored, docsAndCode, elementHoldsBody, elementTooLong, featureTooLong, holdsBreak, holdsCodeBreak, holdsLabel, inInventory, memberIsNot, missingOrNot, moreProblems, naTwice, naWithoutReason, nameEmpty, nameRepeats, nameTooLong, namesNoId, neitherAppliedNorNa, noCharacterisation, noCodeElement, noCodeOwner, noProductionAnchor, noTest, noTestAnchor, noTestCarries, notBatchOfPlan, notDesignRuleId, notEarlierBatch, notInFirstStep, notUnpinnedRow, ownerIsPath, pinnedNotInPlan, projectEmpty, refAnchorNeedsRef, reuseNotShown, shareUnordered, startsWithMarker, stepCount, titleEmpty, titleIsBuildStep, titleRepeats, titleTooLong, traceNotSourceId, traceTwice } from "./messages.ts";
13
+ import {
14
+ ANSWER_NOT_AN_OBJECT as NOT_AN_OBJECT, fieldEmpty, notASourceId as notSourceId,
15
+ } from "../../../shared/domain/dev/messages.ts";
16
+ import { PLAN_FIELDS } from "./prompts.ts";
11
17
 
12
18
  export type TestLevel = "unit" | "integration" | "pinned";
13
19
  export type ElementLayer = "domain" | "application" | "adapter" | "test";
@@ -64,10 +70,13 @@ export const MAX_TEST_NAME = 120;
64
70
  export const MAX_SIGNATURE = 200;
65
71
  export const MAX_FEATURE = 80;
66
72
  export const MIN_NA_REASON = 10;
67
- const BUILD_STEP = "Build and tests";
68
73
  const LEVELS: readonly TestLevel[] = ["unit", "integration", "pinned"];
69
74
  const LAYERS: readonly ElementLayer[] = ["domain", "application", "adapter", "test"];
70
75
  const KINDS: readonly AnchorKind[] = ["ref", "create", "existing"];
76
+ /** The folders that hold the tools' own settings: a plan never anchors there. */
77
+ const TOOLS_FOLDERS = [".claude", ".orkeon"];
78
+ /** Whether `path` is `folder` or lies under it. */
79
+ const within = (path: string, folder: string): boolean => path === folder || path.startsWith(`${folder}/`);
71
80
  const DOC_PATH = /\.(md|mdx|rst|adoc|txt)$/i;
72
81
  const LABELS = /Applied rules|Non-applicable rules/;
73
82
  const LINE_BREAK = /\r\n|\r|\n/;
@@ -103,73 +112,71 @@ const ANCHOR = {
103
112
  const ANCHORS = listOf(ANCHOR);
104
113
 
105
114
  export const PLAN_ANSWER_SCHEMA: object = objectOf({
106
- feature: text(`Max ${MAX_FEATURE} chars`),
107
- layers: texts("Folders touched"),
108
- reuse: texts("I<n> refs alone"),
115
+ feature: text(PLAN_FIELDS.feature(MAX_FEATURE)),
116
+ layers: texts(PLAN_FIELDS.layers),
117
+ reuse: texts(PLAN_FIELDS.reuse),
109
118
  outOfScope: STRINGS,
110
- assumptions: texts("Assumed, never an open question answered"),
119
+ assumptions: texts(PLAN_FIELDS.assumptions),
111
120
  nonApplicable: listOf(objectOf({
112
121
  id: { type: "string", enum: [...DESIGN_RULE_IDS] },
113
- reason: text(`Stands alone, min ${MIN_NA_REASON} chars`),
114
- }), "Rules no batch applies"),
122
+ reason: text(PLAN_FIELDS.naReason(MIN_NA_REASON)),
123
+ }), PLAN_FIELDS.nonApplicable),
115
124
  traceability: listOf(objectOf({
116
125
  id: STRING,
117
- owners: texts("Type or member names, never a path"),
118
- }), "One row per source id"),
126
+ owners: texts(PLAN_FIELDS.owners),
127
+ }), PLAN_FIELDS.traceability),
119
128
  design: listOf(objectOf({
120
- ids: texts("Source UC/BR/CH ids"),
129
+ ids: texts(PLAN_FIELDS.designIds),
121
130
  aggregate: STRING,
122
131
  invariant: STRING,
123
132
  consistency: STRING,
124
- batch: said({ type: "integer" }, "1-based batch"),
133
+ batch: said({ type: "integer" }, PLAN_FIELDS.designBatch),
125
134
  })),
126
135
  batches: listOf(objectOf({
127
136
  name: STRING,
128
- intent: text("What it delivers"),
129
- reason: text("Why it is cut here"),
130
- documentation: said({ type: "boolean" }, "Docs alone, no code"),
131
- dependsOn: texts("F<n> of earlier batches, n its place from 1"),
137
+ intent: text(PLAN_FIELDS.intent),
138
+ reason: text(PLAN_FIELDS.reason),
139
+ documentation: said({ type: "boolean" }, PLAN_FIELDS.documentation),
140
+ dependsOn: texts(PLAN_FIELDS.dependsOn),
132
141
  design: objectOf({
133
142
  appliedRules: STRINGS,
134
143
  aggregate: STRING,
135
144
  invariants: STRING,
136
145
  consistency: STRING,
137
146
  events: STRING,
138
- accessCost: text("Storage or network reached"),
139
- }, "All written; a sentence if none applies"),
140
- decisions: texts("Choices made, why"),
141
- declarative: texts("Pure declarations, no test of their own"),
147
+ accessCost: text(PLAN_FIELDS.accessCost),
148
+ }, PLAN_FIELDS.batchDesign),
149
+ decisions: texts(PLAN_FIELDS.decisions),
150
+ declarative: texts(PLAN_FIELDS.declarative),
142
151
  steps: listOf(objectOf({
143
- title: text(`Behaviour, max ${MAX_TITLE} chars`),
152
+ title: text(PLAN_FIELDS.stepTitle(MAX_TITLE)),
144
153
  tests: listOf(objectOf({
145
- name: text(`As the repository names tests, unique, max ${MAX_TEST_NAME} chars`),
146
- level: said({ type: "string", enum: [...LEVELS] }, "pinned: one the brief pins"),
154
+ name: text(PLAN_FIELDS.testName(MAX_TEST_NAME)),
155
+ level: said({ type: "string", enum: [...LEVELS] }, PLAN_FIELDS.level),
147
156
  project: STRING,
148
- ids: texts("UC/BR/CH ids it proves"),
149
- covers: texts("U<n> rows characterised"),
157
+ ids: texts(PLAN_FIELDS.testIds),
158
+ covers: texts(PLAN_FIELDS.covers),
150
159
  })),
151
- note: text("Empty or 2 lines: merged cycle, container"),
160
+ note: text(PLAN_FIELDS.note),
152
161
  anchors: objectOf({
153
162
  tests: ANCHORS,
154
163
  doubles: ANCHORS,
155
164
  production: ANCHORS,
156
- }, "Files filled or created. kind ref: a shown entry, I<n> in ref; create: a new file, existing: an unindexed one, " +
157
- "both by relative path; member: the one filled, omitted if new"),
158
- }), "Behaviour steps; code adds the build"),
159
- buildScope: text("Scope of the build step code adds"),
165
+ }, PLAN_FIELDS.anchors),
166
+ }), PLAN_FIELDS.steps),
167
+ buildScope: text(PLAN_FIELDS.buildScope),
160
168
  testPolicy: objectOf({
161
169
  fast: STRING,
162
170
  integration: STRING,
163
- notRun: text("Not run, why"),
164
- }, "Sheet test policy, a sentence each"),
171
+ notRun: text(PLAN_FIELDS.notRun),
172
+ }, PLAN_FIELDS.testPolicy),
165
173
  elements: listOf(objectOf({
166
174
  layer: { type: "string", enum: [...LAYERS] },
167
- signature: text(`Max ${MAX_SIGNATURE} chars, never a body`),
168
- rule: text("What it does or gains"),
175
+ signature: text(PLAN_FIELDS.signature(MAX_SIGNATURE)),
176
+ rule: text(PLAN_FIELDS.rule),
169
177
  })),
170
- }), `At most ${MAX_BATCHES}, cut by behaviour`),
171
- }, "Text fields: one line (a note two), no |; no backtick in a test name, project, path, member or owner; " +
172
- "no line opens with #, TDD:, |, - [ or >");
178
+ }), PLAN_FIELDS.batches(MAX_BATCHES)),
179
+ }, PLAN_FIELDS.answer);
173
180
 
174
181
  // ---- rule 1: the shape --------------------------------------------------------------
175
182
 
@@ -182,7 +189,7 @@ class Reader {
182
189
 
183
190
  private miss(field: string, type: string): void {
184
191
  const what = type.startsWith("one of") ? type : `${/^[aeiou]/.test(type) ? "an" : "a"} ${type}`;
185
- this.problems.push(`${field} is missing or not ${what}`);
192
+ this.problems.push(missingOrNot(field, what));
186
193
  }
187
194
 
188
195
  str(o: Obj, key: string, at: string): string {
@@ -250,7 +257,7 @@ class Reader {
250
257
 
251
258
  function readAnswer(value: Obj, r: Reader): PlanAnswer {
252
259
  const anchor = (a: Obj, at: string): AnchorRef => {
253
- const out: AnchorRef = { kind: r.oneOf(a, "kind", at, KINDS, "one of ref, create, existing") };
260
+ const out: AnchorRef = { kind: r.oneOf(a, "kind", at, KINDS, ANCHOR_KINDS) };
254
261
  const ref = r.optStr(a, "ref", at);
255
262
  const path = r.optStr(a, "path", at);
256
263
  const member = r.optStr(a, "member", at);
@@ -261,7 +268,7 @@ function readAnswer(value: Obj, r: Reader): PlanAnswer {
261
268
  };
262
269
  const test = (t: Obj, at: string): PlanTest => ({
263
270
  name: r.str(t, "name", at),
264
- level: r.oneOf(t, "level", at, LEVELS, "one of unit, integration, pinned"),
271
+ level: r.oneOf(t, "level", at, LEVELS, TEST_LEVELS),
265
272
  project: r.str(t, "project", at),
266
273
  ids: r.strings(t, "ids", at),
267
274
  covers: r.strings(t, "covers", at),
@@ -305,7 +312,7 @@ function readAnswer(value: Obj, r: Reader): PlanAnswer {
305
312
  buildScope: r.str(b, "buildScope", at),
306
313
  testPolicy: { fast: r.str(policy, "fast", p), integration: r.str(policy, "integration", p), notRun: r.str(policy, "notRun", p) },
307
314
  elements: r.objects(b, "elements", at, (e, here) => ({
308
- layer: r.oneOf(e, "layer", here, LAYERS, "one of domain, application, adapter, test"),
315
+ layer: r.oneOf(e, "layer", here, LAYERS, ELEMENT_LAYERS),
309
316
  signature: r.str(e, "signature", here),
310
317
  rule: r.str(e, "rule", here),
311
318
  })),
@@ -318,7 +325,7 @@ function readAnswer(value: Obj, r: Reader): PlanAnswer {
318
325
  outOfScope: r.strings(value, "outOfScope", ""),
319
326
  assumptions: r.strings(value, "assumptions", ""),
320
327
  nonApplicable: r.objects(value, "nonApplicable", "", (n, at) => ({
321
- id: r.oneOf(n, "id", at, DESIGN_RULE_IDS, "design rule id"),
328
+ id: r.oneOf(n, "id", at, DESIGN_RULE_IDS, DESIGN_RULE_ID),
322
329
  reason: r.str(n, "reason", at),
323
330
  })),
324
331
  traceability: r.objects(value, "traceability", "", (t, at) => ({ id: r.str(t, "id", at), owners: r.strings(t, "owners", at) })),
@@ -435,9 +442,15 @@ const quoted = (text: string): string => {
435
442
  const chars = Array.from(one);
436
443
  return ` "${chars.length > LABEL_QUOTE ? `${chars.slice(0, LABEL_QUOTE).join("")}…` : one}"`;
437
444
  };
438
- /** `B1 "<name>"`, the name left out when empty. */
439
- const batchLabel = (b: PlanBatch, k: number): string => `B${k + 1}${quoted(b.name)}`;
440
- /** `B1 "<name>" S2 "<title>"`; the anchor path check labels its problems the same way. */
445
+ /** Where a signature's body opens: its first "{" that does not open a shell expansion "${…}", else -1. A variable
446
+ * of a script (`${QUIET:-0}`) is not a body. */
447
+ const bodyOpening = (signature: string): number => {
448
+ for (let i = 0; i < signature.length; i++) if (signature[i] === "{" && signature[i - 1] !== "$") return i;
449
+ return -1;
450
+ };
451
+ /** `F1 "<name>"`, the name left out when empty: a batch is named as dependsOn and the rendered plan name it. */
452
+ const batchLabel = (b: PlanBatch, k: number): string => `F${k + 1}${quoted(b.name)}`;
453
+ /** `F1 "<name>" S2 "<title>"`; the anchor path check labels its problems the same way. */
441
454
  export const stepLabel = (b: PlanBatch, k: number, j: number): string => `${batchLabel(b, k)} S${j + 1}${quoted(b.steps[j]?.title ?? "")}`;
442
455
  const testLabel = (b: PlanBatch, k: number, j: number, m: number): string => `${stepLabel(b, k, j)} T${m + 1}`;
443
456
  /** `design row 2 (<first id>)`, the id left out when the row has none. */
@@ -495,14 +508,14 @@ function cellProblems(cells: readonly Cell[]): string[] {
495
508
  const out: string[] = [];
496
509
  for (const c of cells) {
497
510
  const head = `${c.where}: ${c.field}`;
498
- if (c.kind === "code" && /[|`\r\n]/.test(c.value)) out.push(`${head} holds a |, a backtick or a line break`);
499
- if (c.kind === "prose" && /[|\r\n]/.test(c.value)) out.push(`${head} holds a | or a line break`);
511
+ if (c.kind === "code" && /[|`\r\n]/.test(c.value)) out.push(holdsCodeBreak(head));
512
+ if (c.kind === "prose" && /[|\r\n]/.test(c.value)) out.push(holdsBreak(head));
500
513
  if (c.kind === "note" && (c.value.includes("|") || c.value.split(LINE_BREAK).length > 2)) {
501
- out.push(`${head} holds a | or a line break`);
514
+ out.push(holdsBreak(head));
502
515
  }
503
- if (LABELS.test(c.value)) out.push(`${head} holds the label Applied rules or Non-applicable rules`);
516
+ if (LABELS.test(c.value)) out.push(holdsLabel(head));
504
517
  if (c.value.split(LINE_BREAK).some((l) => LINE_MARKER.test(l.trimStart()))) {
505
- out.push(`${head} starts a line with one of #, TDD:, |, - [, >`);
518
+ out.push(startsWithMarker(head));
506
519
  }
507
520
  }
508
521
  return out;
@@ -522,19 +535,19 @@ function pathOf(a: AnchorRef, ctx: PlanCheckContext): string | undefined {
522
535
 
523
536
  function anchorProblems(a: AnchorRef, at: string, ctx: PlanCheckContext, inventoryPaths: ReadonlySet<string>): string[] {
524
537
  if (a.kind === "ref") {
525
- if (a.ref === undefined || a.path !== undefined) return [`${at}: a ref anchor needs a ref only`];
526
- return ctx.shownRefs.has(a.ref) ? [] : [`${at}: anchor ${a.ref} is not an inventory entry shown`];
538
+ if (a.ref === undefined || a.path !== undefined) return [refAnchorNeedsRef(at)];
539
+ return ctx.shownRefs.has(a.ref) ? [] : [anchorNotShown(at, a.ref)];
527
540
  }
528
- if (a.path === undefined || a.ref !== undefined) return [`${at}: ${a.kind === "existing" ? "an" : "a"} ${a.kind} anchor needs a path only`];
541
+ if (a.path === undefined || a.ref !== undefined) return [anchorNeedsPath(at, a.kind)];
529
542
  const path = a.path;
530
543
  const work = ctx.workFolder?.replace(/^\/+|\/+$/g, "");
531
- const banned = [".claude/", ".orkeon/", ...(work ? [`${work}/`] : [])];
532
- if (path === "" || path.startsWith("/") || /^[A-Za-z]:/.test(path) || path.includes("\\") || path.split("/").includes("..") ||
533
- banned.some((p) => path.startsWith(p))) {
534
- return [`${at}: ${path} cannot be anchored there`];
544
+ if (path === "" || path.startsWith("/") || /^[A-Za-z]:/.test(path) || path.includes("\\") || path.split("/").includes("..")) {
545
+ return [cannotBeAnchored(at, path, NOT_RELATIVE)];
535
546
  }
536
- if (path.includes(":")) return [`${at}: anchor path "${path}" holds ":"`];
537
- if (a.kind === "existing" && inventoryPaths.has(path)) return [`${at}: ${path} is in the inventory: use its ref`];
547
+ if (TOOLS_FOLDERS.some((f) => within(path, f))) return [cannotBeAnchored(at, path, TOOLS_FOLDER)];
548
+ if (work && within(path, work)) return [cannotBeAnchored(at, path, WORK_FOLDER)];
549
+ if (path.includes(":")) return [anchorPathColon(at, path)];
550
+ if (a.kind === "existing" && inventoryPaths.has(path)) return [inInventory(at, path)];
538
551
  return [];
539
552
  }
540
553
 
@@ -544,22 +557,23 @@ function stepProblems(b: PlanBatch, k: number, ctx: PlanCheckContext, inventoryP
544
557
  b.steps.forEach((s, j) => {
545
558
  const at = stepLabel(b, k, j);
546
559
  // 5: the title.
547
- if (s.title === "") out.push(`${at}: the title is empty`);
548
- else if (s.title.length > MAX_TITLE) out.push(`${at}: the title is longer than ${MAX_TITLE} characters`);
549
- else if (s.title === BUILD_STEP) out.push(`${at}: the title is ${BUILD_STEP}, the step code adds`);
560
+ if (s.title === "") out.push(titleEmpty(at));
561
+ else if (s.title.length > MAX_TITLE) out.push(titleTooLong(at, s.title.length, MAX_TITLE));
562
+ else if (s.title === BUILD_STEP) out.push(titleIsBuildStep(at, BUILD_STEP));
550
563
  const first = titles.get(s.title);
551
- if (s.title !== "" && first !== undefined) out.push(`${at}: the title repeats step ${first + 1}`);
564
+ if (s.title !== "" && first !== undefined) out.push(titleRepeats(at, first + 1));
552
565
  else titles.set(s.title, j);
553
566
  // 6, 7: the tests.
554
- if (s.tests.length === 0) out.push(`${at}: no test`);
567
+ if (s.tests.length === 0) out.push(noTest(at));
555
568
  s.tests.forEach((t, m) => {
556
569
  const here = testLabel(b, k, j, m);
557
- if (t.name === "") out.push(`${here}: the name is empty`);
558
- else if (t.name.length > MAX_TEST_NAME) out.push(`${here}: the name is longer than ${MAX_TEST_NAME} characters`);
559
- if (t.project === "") out.push(`${here}: the project is empty`);
560
- for (const id of t.ids) if (!ctx.sourceIds.includes(id)) out.push(`${here}: ${id} is not an id of the source`);
561
- for (const u of t.covers) if (!ctx.unpinned.includes(u)) out.push(`${here}: ${u} is not an unpinned row`);
562
- if (t.ids.length === 0 && t.covers.length === 0) out.push(`${here}: names no id`);
570
+ if (t.name === "") out.push(nameEmpty(here));
571
+ else if (t.name.length > MAX_TEST_NAME) out.push(nameTooLong(here, t.name.length, MAX_TEST_NAME));
572
+ if (t.project === "") out.push(projectEmpty(here));
573
+ for (const id of t.ids) if (!ctx.sourceIds.includes(id)) out.push(notSourceId(here, id));
574
+ for (const u of t.covers) if (!ctx.unpinned.includes(u)) out.push(notUnpinnedRow(here, u));
575
+ // A documentation step's test is the repository's documentation command: it proves no id of the source.
576
+ if (!b.documentation && t.ids.length === 0 && t.covers.length === 0) out.push(namesNoId(here));
563
577
  });
564
578
  // 13, 14, 26: each anchor.
565
579
  for (const a of allAnchors(s)) out.push(...anchorProblems(a, at, ctx, inventoryPaths));
@@ -568,12 +582,12 @@ function stepProblems(b: PlanBatch, k: number, ctx: PlanCheckContext, inventoryP
568
582
  const name = a.kind === "ref" && a.ref !== undefined ? ctx.refNames.get(a.ref) : undefined;
569
583
  if (name === undefined || a.member === undefined || a.member === "") continue;
570
584
  if (a.member !== name && a.member !== name.slice(name.lastIndexOf(".") + 1)) {
571
- out.push(`${at}: anchor ${a.ref}: member "${a.member}" is not ${name}; leave member out to add a member to it`);
585
+ out.push(memberIsNot(at, a.ref, a.member, name));
572
586
  }
573
587
  }
574
588
  // 15: the columns a step needs.
575
- if (!b.documentation && s.anchors.tests.length === 0) out.push(`${at}: no test anchor`);
576
- if (s.anchors.production.length === 0) out.push(`${at}: no production anchor`);
589
+ if (!b.documentation && s.anchors.tests.length === 0) out.push(noTestAnchor(at));
590
+ if (s.anchors.production.length === 0) out.push(noProductionAnchor(at));
577
591
  });
578
592
  return out;
579
593
  }
@@ -588,31 +602,32 @@ function batchProblems(b: PlanBatch, k: number, ctx: PlanCheckContext, inventory
588
602
  ["design.aggregate", b.design.aggregate], ["design.invariants", b.design.invariants], ["design.consistency", b.design.consistency],
589
603
  ["design.events", b.design.events], ["design.accessCost", b.design.accessCost],
590
604
  ];
591
- for (const [field, value] of fields) if (value === "") out.push(`${at}: ${field} is empty`);
605
+ for (const [field, value] of fields) if (value === "") out.push(fieldEmpty(at, field));
592
606
  // 4: the step count.
593
607
  const min = b.documentation ? 1 : 2;
594
608
  if (b.steps.length < min || b.steps.length > 5) {
595
- out.push(`${at}: ${b.steps.length} behaviour steps; 2 to 5 (1 to 5 for documentation)`);
609
+ out.push(stepCount(at, b.steps.length));
596
610
  }
597
611
  out.push(...stepProblems(b, k, ctx, inventoryPaths));
598
612
  // 11: applied rules are design rule ids.
599
- for (const id of b.design.appliedRules) if (!DESIGN_RULE_IDS.includes(id)) out.push(`${at}: ${id} is not a design rule id`);
613
+ for (const id of b.design.appliedRules) if (!DESIGN_RULE_IDS.includes(id)) out.push(notDesignRuleId(at, id));
600
614
  // 12: earlier batches only.
601
615
  for (const dep of b.dependsOn) {
602
616
  const m = /^F(\d+)$/.exec(dep);
603
- if (m === null || Number(m[1]) < 1 || Number(m[1]) > k) out.push(`${at}: depends on ${dep}, which is not an earlier batch`);
617
+ if (m === null || Number(m[1]) < 1 || Number(m[1]) > k) out.push(notEarlierBatch(at, dep));
604
618
  }
605
619
  // 16: documentation stands alone (production paths).
606
620
  const production = b.steps.flatMap((s) => s.anchors.production).map((a) => pathOf(a, ctx)).filter((p): p is string => p !== undefined);
607
621
  const docs = production.filter(isDocPath);
608
622
  if ((docs.length > 0 && !b.documentation) || (b.documentation && docs.length < production.length)) {
609
- out.push(`${at}: documentation and code in one batch`);
623
+ out.push(docsAndCode(at, [...new Set(docs)].join(", "), [...new Set(production.filter((p) => !isDocPath(p)))].join(", ")));
610
624
  }
611
625
  // 20, 21: the code elements.
612
- if (!b.documentation && b.elements.length === 0) out.push(`${at}: no code element`);
626
+ if (!b.documentation && b.elements.length === 0) out.push(noCodeElement(at));
613
627
  b.elements.forEach((e, i) => {
614
- if (e.signature.length > MAX_SIGNATURE) out.push(`${at}: element ${i + 1} is longer than ${MAX_SIGNATURE} characters`);
615
- if (e.signature.includes("{")) out.push(`${at}: element ${i + 1} holds a body`);
628
+ if (e.signature.length > MAX_SIGNATURE) out.push(elementTooLong(at, i + 1, e.signature.length, MAX_SIGNATURE));
629
+ const body = bodyOpening(e.signature);
630
+ if (body >= 0) out.push(elementHoldsBody(at, i + 1, quoted(e.signature.slice(body))));
616
631
  });
617
632
  return out;
618
633
  }
@@ -621,17 +636,17 @@ function traceProblems(a: PlanAnswer, ctx: PlanCheckContext): string[] {
621
636
  const out: string[] = [];
622
637
  // 8: every source id carried by a test.
623
638
  const carried = new Set(a.batches.flatMap((b) => b.steps.flatMap((s) => s.tests.flatMap((t) => t.ids))));
624
- for (const id of ctx.sourceIds) if (!carried.has(id)) out.push(`${id}: no test carries it`);
639
+ for (const id of ctx.sourceIds) if (!carried.has(id)) out.push(noTestCarries(id));
625
640
  // 9: every source id owned by code.
626
641
  const rows = new Map<string, number>();
627
642
  for (const t of a.traceability) {
628
643
  // 28: an owner names a type or a member, never a path.
629
- for (const o of t.owners) if (OWNER_PATH.test(o)) out.push(`traceability: owner "${o}" is a path, name the type or member`);
630
- if (!ctx.sourceIds.includes(t.id)) { out.push(`traceability: ${t.id} is not an id of the source`); continue; }
631
- if (rows.has(t.id)) { out.push(`traceability: ${t.id} appears twice`); continue; }
644
+ for (const o of t.owners) if (OWNER_PATH.test(o)) out.push(ownerIsPath(o));
645
+ if (!ctx.sourceIds.includes(t.id)) { out.push(traceNotSourceId(t.id)); continue; }
646
+ if (rows.has(t.id)) { out.push(traceTwice(t.id)); continue; }
632
647
  rows.set(t.id, t.owners.filter((o) => o !== "").length);
633
648
  }
634
- for (const id of ctx.sourceIds) if ((rows.get(id) ?? 0) === 0) out.push(`${id}: no code owner`);
649
+ for (const id of ctx.sourceIds) if ((rows.get(id) ?? 0) === 0) out.push(noCodeOwner(id));
635
650
  return out;
636
651
  }
637
652
 
@@ -640,10 +655,10 @@ function designRuleProblems(a: PlanAnswer): string[] {
640
655
  const applied = new Set(a.batches.flatMap((b) => b.design.appliedRules));
641
656
  for (const id of DESIGN_RULE_IDS) {
642
657
  const na = a.nonApplicable.filter((n) => n.id === id);
643
- if (applied.has(id) && na.length > 0) out.push(`${id}: applied and non-applicable`);
644
- else if (!applied.has(id) && na.length === 0) out.push(`${id}: neither applied nor non-applicable`);
645
- else if (na.length > 1) out.push(`${id}: non-applicable twice`);
646
- else if (na.length === 1 && na[0].reason.length < MIN_NA_REASON) out.push(`${id}: N/A without a reason`);
658
+ if (applied.has(id) && na.length > 0) out.push(appliedAndNa(id));
659
+ else if (!applied.has(id) && na.length === 0) out.push(neitherAppliedNorNa(id));
660
+ else if (na.length > 1) out.push(naTwice(id));
661
+ else if (na.length === 1 && na[0].reason.length < MIN_NA_REASON) out.push(naWithoutReason(id));
647
662
  }
648
663
  return out;
649
664
  }
@@ -667,7 +682,7 @@ function sharedAnchorProblems(a: PlanAnswer, ctx: PlanCheckContext): string[] {
667
682
  for (let k = 0; k < paths.length; k++) {
668
683
  for (let m = k + 1; m < paths.length; m++) {
669
684
  const shared = [...paths[k]].filter((p) => paths[m].has(p)).sort();
670
- if (shared.length > 0 && !before[m].has(k)) out.push(`${batchLabel(a.batches[k], k)} and ${batchLabel(a.batches[m], m)} share ${shared[0]} and neither depends on the other`);
685
+ if (shared.length > 0 && !before[m].has(k)) out.push(shareUnordered(batchLabel(a.batches[k], k), batchLabel(a.batches[m], m), shared[0]));
671
686
  }
672
687
  }
673
688
  return out;
@@ -680,44 +695,44 @@ function changeProblems(a: PlanAnswer, ctx: PlanCheckContext): string[] {
680
695
  // 22: every pinned behaviour keeps its pinned test.
681
696
  for (const name of ctx.pinned) {
682
697
  const n = name.trim();
683
- if (!tests.some(({ t }) => t.level === "pinned" && t.name === n)) out.push(`pinned test ${n} is not in the plan`);
698
+ if (!tests.some(({ t }) => t.level === "pinned" && t.name === n)) out.push(pinnedNotInPlan(n));
684
699
  }
685
700
  // 23: every unpinned row gets a characterisation test, first in its batch.
686
701
  for (const u of ctx.unpinned) {
687
702
  const covering = tests.filter(({ t }) => t.covers.includes(u));
688
- if (covering.length === 0) out.push(`${u}: no characterisation test`);
689
- else if (!covering.some(({ first }) => first)) out.push(`${u}: its test is not in the first step`);
703
+ if (covering.length === 0) out.push(noCharacterisation(u));
704
+ else if (!covering.some(({ first }) => first)) out.push(notInFirstStep(u));
690
705
  }
691
706
  return out;
692
707
  }
693
708
 
694
709
  function capped(problems: readonly string[]): string[] {
695
710
  if (problems.length <= MAX_PROBLEMS) return [...problems];
696
- return [...problems.slice(0, MAX_PROBLEMS), `… ${problems.length - MAX_PROBLEMS} more problems`];
711
+ return [...problems.slice(0, MAX_PROBLEMS), moreProblems(problems.length - MAX_PROBLEMS)];
697
712
  }
698
713
 
699
714
  export function checkPlanAnswer(value: unknown, ctx: PlanCheckContext): Checked<PlanAnswer> {
700
- if (!isObj(value)) return { ok: false, problems: ["the answer is not an object"] };
715
+ if (!isObj(value)) return { ok: false, problems: [NOT_AN_OBJECT] };
701
716
  const reader = new Reader();
702
717
  const read = readAnswer(value, reader);
703
718
  if (reader.problems.length > 0) return { ok: false, problems: capped(reader.problems) };
704
719
  const a = mended(trimmed(read), ctx);
705
720
  const problems: string[] = [];
706
721
  // 24: the plan's own fields.
707
- if (a.feature === "") problems.push("feature is empty");
708
- else if (a.feature.length > MAX_FEATURE) problems.push(`feature is longer than ${MAX_FEATURE} characters`);
709
- if (a.layers.filter((l) => l !== "").length === 0) problems.push("layers is empty");
722
+ if (a.feature === "") problems.push(FEATURE_EMPTY);
723
+ else if (a.feature.length > MAX_FEATURE) problems.push(featureTooLong(a.feature.length, MAX_FEATURE));
724
+ if (a.layers.filter((l) => l !== "").length === 0) problems.push(LAYERS_EMPTY);
710
725
  problems.push(...cellProblems(cellsOf(a)));
711
726
  // 2: the batch count.
712
727
  if (a.batches.length < 1 || a.batches.length > MAX_BATCHES) {
713
- problems.push(`between 1 and ${MAX_BATCHES} batches, not ${a.batches.length}`);
728
+ problems.push(batchCount(MAX_BATCHES, a.batches.length));
714
729
  }
715
730
  // 6: test names unique across the plan.
716
731
  const names = new Map<string, string>();
717
732
  a.batches.forEach((b, k) => b.steps.forEach((s, j) => s.tests.forEach((t, m) => {
718
733
  if (t.name === "") return;
719
734
  const first = names.get(t.name);
720
- if (first !== undefined) problems.push(`${testLabel(b, k, j, m)}: the name repeats ${first}`);
735
+ if (first !== undefined) problems.push(nameRepeats(testLabel(b, k, j, m), first));
721
736
  else names.set(t.name, testLabel(b, k, j, m));
722
737
  })));
723
738
  const inventoryPaths = new Set(ctx.refPaths.values());
@@ -726,11 +741,11 @@ export function checkPlanAnswer(value: unknown, ctx: PlanCheckContext): Checked<
726
741
  problems.push(...designRuleProblems(a));
727
742
  problems.push(...sharedAnchorProblems(a, ctx));
728
743
  // 18: reuse names shown entries.
729
- for (const ref of a.reuse) if (!ctx.shownRefs.has(ref)) problems.push(`reuse: ${ref} is not an inventory entry shown`);
744
+ for (const ref of a.reuse) if (!ctx.shownRefs.has(ref)) problems.push(reuseNotShown(ref));
730
745
  // 19: design rows.
731
746
  a.design.forEach((d, i) => {
732
- if (d.batch < 1 || d.batch > a.batches.length) problems.push(`${designRow(d, i)}: batch ${d.batch} is not a batch of the plan`);
733
- for (const id of d.ids) if (!ctx.sourceIds.includes(id)) problems.push(`${designRow(d, i)}: ${id} is not an id of the source`);
747
+ if (d.batch < 1 || d.batch > a.batches.length) problems.push(notBatchOfPlan(designRow(d, i), d.batch));
748
+ for (const id of d.ids) if (!ctx.sourceIds.includes(id)) problems.push(notSourceId(designRow(d, i), id));
734
749
  });
735
750
  problems.push(...changeProblems(a, ctx));
736
751
  if (problems.length > 0) return { ok: false, problems: capped(problems) };