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
package/orkeon-code.ps1 CHANGED
@@ -16,7 +16,7 @@
16
16
  .NOTES
17
17
  Modes: tool (orkeon-repl on PATH, from the full Orkeon release .zip (the .msi has no orkeon-repl), the
18
18
  Debian package or the dotnet tool, or $env:ORKEON_REPL) and docker
19
- (ghcr.io/orkeon/orkeon-runners:latest, the last release, not the pin). The source mode is only in the
19
+ (ghcr.io/orkeon/orkeon:latest, the last release, not the pin). The source mode is only in the
20
20
  bash launcher. Folder trust, per-project state, sessions, settings, API key, model and $env:ORKEON_CODE_AUDIO_DIR (speech-to-text,
21
21
  tool mode): see the header of ./orkeon-code.
22
22
  #>
@@ -375,11 +375,11 @@ function Invoke-Setup([string] $target) {
375
375
  $savedEnv = @{}
376
376
  foreach ($name in @('ORKEON_Llm__Model', 'Orkeon__Security__PermissionGate__Enabled', 'Orkeon__Cli__Session__StartScript',
377
377
  'Orkeon__Cli__Session__Persist', 'ORKEON_Orkeon__Cli__Session__SessionsDirectory',
378
- 'ORKEON_Orkeon__Cli__Memory__RootDirectory',
378
+ 'ORKEON_Orkeon__Cli__Memory__RootDirectory', 'Orkeon__Embeddings__FingerprintPath',
379
379
  'ORKEON_ESBUILD_PATH',
380
380
  'ORKEON_ALLOW_EXTERNAL_MOUNTS', 'WHISPER_AUDIO_DIR', 'WHISPER_OUT_DIR',
381
381
  'ORKEON_MCP__Servers__whisper__Transport', 'ORKEON_MCP__Servers__whisper__Command',
382
- 'ORKEON_MCP__Servers__whisper__TrustAnnotations',
382
+ 'ORKEON_MCP__Servers__whisper__TrustAnnotations', 'ORKEON_MCP__Servers__whisper__CallTimeout',
383
383
  'ORKEON_MCP__Servers__whisper__Args__0', 'ORKEON_MCP__Servers__whisper__Args__1',
384
384
  'ORKEON_MCP__Servers__whisper__Args__2', 'ORKEON_MCP__Servers__whisper__Args__3',
385
385
  'ORKEON_MCP__Servers__whisper__Args__4', 'ORKEON_MCP__Servers__whisper__Args__5',
@@ -395,7 +395,7 @@ try {
395
395
  # The pin is a commit of Orkeon's main (.orkeon-version, ADR 0013): the tool and docker modes run a release.
396
396
  $OrkeonRef = (Get-Content (Join-Path $Root '.orkeon-version') -Raw).Trim()
397
397
  $OrkeonPin = $OrkeonRef.Substring(0, 7)
398
- $Image = if ($env:ORKEON_CODE_IMAGE) { $env:ORKEON_CODE_IMAGE } else { 'ghcr.io/orkeon/orkeon-runners:latest' }
398
+ $Image = if ($env:ORKEON_CODE_IMAGE) { $env:ORKEON_CODE_IMAGE } else { 'ghcr.io/orkeon/orkeon:latest' }
399
399
  $codeVersion = (Get-Content (Join-Path $Root 'package.json') -Raw | ConvertFrom-Json).version
400
400
  # A clone (a .git, or the tests of an unpacked source archive) or an install, whose folder is never written to:
401
401
  # an install's state goes under ORKEON_CODE_HOME (%USERPROFILE%\.orkeon-code).
@@ -647,6 +647,8 @@ try {
647
647
  if (-not $env:Orkeon__Cli__Session__Persist) { $env:Orkeon__Cli__Session__Persist = 'true' }
648
648
  $env:ORKEON_Orkeon__Cli__Session__SessionsDirectory = '/sessions'
649
649
  $env:ORKEON_Orkeon__Cli__Memory__RootDirectory = '/memory'
650
+ # The embedding model's fingerprint beside the RAG's manifests, in /output, not in the project (see ./orkeon-code).
651
+ if (-not $env:Orkeon__Embeddings__FingerprintPath) { $env:Orkeon__Embeddings__FingerprintPath = '/output/rag/embedding-fingerprint.json' }
650
652
 
651
653
  # Speech-to-text (optional): $env:ORKEON_CODE_AUDIO_DIR names the folder of audio and video files. The
652
654
  # Whisper MCP server (mcp/whisper), started by the REPL over stdio, reads it and writes into
@@ -678,6 +680,9 @@ try {
678
680
  $env:ORKEON_MCP__Servers__whisper__Command = $uv.Source
679
681
  # The gate reads the server's annotations (readOnlyHint) only when the server is trusted (Orkeon #223).
680
682
  $env:ORKEON_MCP__Servers__whisper__TrustAnnotations = 'true'
683
+ # The runtime ends a server call after CallTimeout, 60 s by default (Orkeon #299): a dictation records up to
684
+ # /voice --max (600 s) then transcribes.
685
+ $env:ORKEON_MCP__Servers__whisper__CallTimeout = '00:15:00'
681
686
  $whisperArgs = @('run', '--project', (Join-Path $Root 'mcp/whisper'))
682
687
  # An install's folder is never written to: uv keeps the server's environment under ORKEON_CODE_HOME and
683
688
  # reads uv.lock as shipped.
@@ -750,6 +755,89 @@ try {
750
755
  '--mount', "${projectState}/memory:/memory:rw")
751
756
  }
752
757
 
758
+ # The physical folders of tool mode's mounts, in Get-ReplArgs order from <workspace>.
759
+ $hostMounts = @($Workspace, (Join-Path $State 'output'), (Join-Path $State 'tmp'), $userConfigDir, $projectState)
760
+
761
+ # A mount's base as Windows spells it: absolute, backslashes, no trailing separator but a drive root's (C:\); a UNC
762
+ # path resolved by its provider.
763
+ function Get-WindowsBase([string] $path) {
764
+ if ($path.StartsWith('\\') -or $path.StartsWith('//')) {
765
+ $resolved = Resolve-Path -LiteralPath $path -ErrorAction SilentlyContinue
766
+ if ($resolved) { $path = $resolved.ProviderPath }
767
+ }
768
+ $full = [IO.Path]::GetFullPath(($path -replace '/', '\'))
769
+ if ($full -match '^[A-Za-z]:\\$') { $full } else { $full.TrimEnd('\', '/') }
770
+ }
771
+
772
+ # launch.json, beside config.json on /user-config, as ./orkeon-code writes it: the host the REPL runs on (windows
773
+ # here, posix or wsl under pwsh elsewhere) and the physical base of each mount, the very string given to --mount,
774
+ # with its Windows spelling. Docker mode hides the host on purpose: posix, no mount. Rewritten at every start. What
775
+ # it reads beyond the rest of the launcher: WSL_DISTRO_NAME, and ORKEON_CODE_PROC_VERSION (the tests' /proc/version).
776
+ function Write-LaunchFile {
777
+ $ErrorActionPreference = 'Continue'
778
+ $file = Join-Path $userConfigDir 'launch.json'
779
+ $procVersion = if ($env:ORKEON_CODE_PROC_VERSION) { $env:ORKEON_CODE_PROC_VERSION } else { '/proc/version' }
780
+ $flavour = if ($Mode -eq 'docker') { 'posix' }
781
+ elseif ($IsWindows -or $PSVersionTable.PSEdition -eq 'Desktop') { 'windows' }
782
+ elseif ($env:WSL_DISTRO_NAME -or ((Test-Path -LiteralPath $procVersion) -and
783
+ "$(Get-Content -LiteralPath $procVersion -Raw -ErrorAction SilentlyContinue)" -match 'microsoft')) { 'wsl' }
784
+ else { 'posix' }
785
+ $wslpath = $null
786
+ if ($flavour -eq 'wsl') {
787
+ $wslpath = Get-Command wslpath -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
788
+ if (-not $wslpath) { Write-Warning "wslpath is not on PATH: $file gives no Windows spelling of the mounts." }
789
+ }
790
+ $launch = [ordered]@{ version = 1; flavour = $flavour; mode = $Mode }
791
+ if ($flavour -eq 'wsl') {
792
+ # The distribution: WSL_DISTRO_NAME, else the share of `wslpath -w /` (\\wsl.localhost\<distro>\ or \\wsl$\<distro>\).
793
+ $distro = $env:WSL_DISTRO_NAME
794
+ if (-not $distro -and $wslpath -and "$(& $wslpath.Source -w / 2>$null)" -match '^\\\\wsl(\.localhost|\$)\\([^\\]+)') {
795
+ $distro = $Matches[2]
796
+ }
797
+ # Where the Windows drives are mounted: `wslpath -u 'C:\'` less its /c, else [automount] root= of /etc/wsl.conf,
798
+ # else /mnt.
799
+ $automount = $null
800
+ $drive = if ($wslpath) { "$(& $wslpath.Source -u 'C:\' 2>$null)" } else { '' }
801
+ if ($drive) { $automount = $drive.TrimEnd('/') -replace '/c$', ''; if (-not $automount) { $automount = '/' } }
802
+ else {
803
+ $section = ''
804
+ foreach ($line in @(Get-Content -LiteralPath '/etc/wsl.conf' -ErrorAction SilentlyContinue)) {
805
+ if ($line -match '^\s*\[([^\]]*)\]') { $section = $Matches[1].Trim().ToLowerInvariant() }
806
+ elseif ($section -eq 'automount' -and $line -match '^\s*root\s*=\s*"?([^"]*?)"?\s*$' -and $Matches[1]) {
807
+ $automount = $Matches[1].TrimEnd('/'); if (-not $automount) { $automount = '/' }
808
+ break
809
+ }
810
+ }
811
+ if (-not $automount) { $automount = '/mnt' }
812
+ }
813
+ $launch['wsl'] = [ordered]@{ distro = $(if ($distro) { $distro } else { $null }); automountRoot = $automount }
814
+ }
815
+ $mounts = [ordered]@{}
816
+ if ($Mode -ne 'docker') {
817
+ $pairs = @(Get-ReplArgs '' '' '' @hostMounts) + @($audioArgs)
818
+ for ($i = 1; $i -lt $pairs.Count; $i++) {
819
+ if ($pairs[$i - 1] -cne '--mount' -or $pairs[$i] -notmatch '^(.*):([^:]+):([^:]+)$') { continue }
820
+ $base = $Matches[1]; $root = $Matches[2]
821
+ $mount = [ordered]@{}
822
+ if ($flavour -eq 'windows') { $mount['windows'] = Get-WindowsBase $base }
823
+ else {
824
+ $mount['posix'] = $base
825
+ if ($flavour -eq 'wsl') {
826
+ $spelled = if ($wslpath) { "$(& $wslpath.Source -w $base 2>$null)" } else { '' }
827
+ $mount['windows'] = $(if ($spelled) { $spelled } else { $null })
828
+ }
829
+ }
830
+ $mounts[$root] = $mount
831
+ }
832
+ }
833
+ $launch['mounts'] = $mounts
834
+ try {
835
+ # UTF-8 without a BOM on Windows PowerShell 5.1 too (Set-Content would write a BOM, or UTF-16).
836
+ [System.IO.File]::WriteAllText($file, ($launch | ConvertTo-Json -Depth 5 -Compress) + "`n", (New-Object System.Text.UTF8Encoding $false))
837
+ } catch { Write-Warning "Could not write $file." }
838
+ }
839
+ Write-LaunchFile
840
+
753
841
  # The exchange log (--llm-log) would land in ./llm-logs, the project: a bare --llm-log among the REPL's arguments
754
842
  # is sent to <projectState>/llm-logs instead; an explicit --llm-log-path is passed as given.
755
843
  function Get-LlmLogArgs($projectState) {
@@ -758,14 +846,28 @@ try {
758
846
  foreach ($a in $Extra) { if ($a -ceq '--llm-log') { if (-not $named) { '--llm-log-path'; "$projectState/llm-logs" } } else { $a } }
759
847
  }
760
848
 
849
+ # Whether the Docker engine answers. Its own function, so the launcher's 'Stop' does not turn a warning on stderr
850
+ # into a failure.
851
+ function Test-DockerEngine {
852
+ $ErrorActionPreference = 'Continue'
853
+ & docker version --format '{{.Server.Version}}' 2>$null | Out-Null
854
+ $LASTEXITCODE -eq 0
855
+ }
856
+
761
857
  if ($Mode -eq 'docker') {
858
+ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) { throw 'docker not found.' }
859
+ # `docker run` alone would answer with the pipe or the socket it could not open, and nothing about what to do.
860
+ if (-not (Test-DockerEngine)) {
861
+ throw 'The Docker engine does not answer: start Docker Desktop or the Docker service, then run orkeon-code again. Without Docker, install the orkeon-repl tool (docs/getting-started.md).'
862
+ }
762
863
  # Everything under the working directory /work. The image is multi-arch (linux/amd64, linux/arm64).
763
- $envArgs = @('-e', 'ORKEON_RUNNER=repl', '-e', 'HOME=/tmp', '-e', 'DOTNET_CLI_HOME=/tmp',
864
+ $envArgs = @('-e', 'ORKEON_ENTRYPOINT=repl', '-e', 'HOME=/tmp', '-e', 'DOTNET_CLI_HOME=/tmp',
764
865
  '-e', "Orkeon__Security__PermissionGate__Enabled=$env:Orkeon__Security__PermissionGate__Enabled",
765
866
  '-e', "Orkeon__Cli__Session__StartScript=$env:Orkeon__Cli__Session__StartScript",
766
867
  '-e', "Orkeon__Cli__Session__Persist=$env:Orkeon__Cli__Session__Persist",
767
868
  '-e', 'ORKEON_Orkeon__Cli__Session__SessionsDirectory=/sessions',
768
- '-e', 'ORKEON_Orkeon__Cli__Memory__RootDirectory=/memory')
869
+ '-e', 'ORKEON_Orkeon__Cli__Memory__RootDirectory=/memory',
870
+ '-e', "Orkeon__Embeddings__FingerprintPath=$env:Orkeon__Embeddings__FingerprintPath")
769
871
  # The github tool's token (Orkeon #222): GITHUB_TOKEN, GH_TOKEN, or the variable Orkeon__Tools__GitHub__TokenVariable
770
872
  # names, each handed over only when set, with the setting itself so the runtime reads the same variable.
771
873
  $tokenVar = [Environment]::GetEnvironmentVariable('Orkeon__Tools__GitHub__TokenVariable')
@@ -813,7 +915,7 @@ try {
813
915
  $env:ORKEON_ESBUILD_PATH = $found.FullName
814
916
  }
815
917
  $replArgs = Get-ReplArgs (Join-Path $Root 'src/commands') (Join-Path $Root 'src/crews') $(if ($runtimeOwn) { '' } else { $Settings }) `
816
- $Workspace (Join-Path $State 'output') (Join-Path $State 'tmp') $userConfigDir $projectState
918
+ @hostMounts
817
919
  $Extra = @(Get-LlmLogArgs $projectState)
818
920
  # The REPL runs from the project. It reads its --commands-dir and --crews-dir wherever they are, and
819
921
  # a --mount outside its working directory (/output, /tmp, /user-config, /sessions, /session-history and /memory, in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orkeon-code",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.2",
4
4
  "description": "Agentic coding assistant in TypeScript on the Orkeon runtime. Pair with it in the terminal under permission modes, run it fully autonomous in a pipeline, or call its crews from your own application. Every command, crew and prompt is a source file you can change or add to.",
5
5
  "license": "MIT",
6
6
  "author": "Orkeon Contributors",
@@ -32,6 +32,7 @@
32
32
  "mcp/whisper/uv.lock",
33
33
  "mcp/whisper/README.md",
34
34
  ".orkeon-version",
35
+ ".orkeon-runtime",
35
36
  "NOTICE.md"
36
37
  ],
37
38
  "engines": {
@@ -212,9 +212,6 @@ export interface CommandRuntimeContext {
212
212
  * (CLR convention preserved through reflection):
213
213
  * if (ctx.signal.IsCancellationRequested) return ctx.continue("cancelled");
214
214
  * ctx.signal.ThrowIfCancellationRequested();
215
- *
216
- * The `aborted` / `throwIfAborted` aliases on `CommandSignal` are a TypeScript-only
217
- * documentation convenience; at runtime, use the PascalCase members.
218
215
  */
219
216
  readonly signal: CommandSignal;
220
217
 
@@ -448,7 +445,7 @@ export interface PendingApproval {
448
445
  * the channel are the ones `orkeon doctor` prints; `version + "+" + commit` is the full build version.
449
446
  */
450
447
  export interface RuntimeInfo {
451
- /** The release, build metadata removed (`1.0.0-rc.6`); `"unknown"` when the host carries none. */
448
+ /** The release, build metadata removed (`1.0.0`); `"unknown"` when the host carries none. */
452
449
  readonly version: string;
453
450
  /** The commit sha the build was made from (the metadata after `+`); null when the version carries none. */
454
451
  readonly commit: string | null;
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { MEMORY_CATEGORIES } from "../../shared/domain/agent-policy/memory-categories.ts";
6
6
  import { SNIP_COMMAND_TURNS } from "../../shared/domain/compaction-thresholds.ts";
7
+ import { argumentsNotJson, argumentsNotObject, DEBUG_TOOL_CALL_USAGE, notAToolName } from "./messages.ts";
7
8
 
8
9
  export type ParsedMemory =
9
10
  | { sub: "add"; category: string; content: string }
@@ -171,10 +172,10 @@ export type ParsedToolCall =
171
172
  export function parseToolCallArgs(tokens: string[]): ParsedToolCall {
172
173
  const tool = String(tokens?.[0] ?? "").trim();
173
174
  if (tool.length === 0) {
174
- return { ok: false, reason: "usage: /debug-tool-call <tool_name> [{\"arg\": \"value\"}]" };
175
+ return { ok: false, reason: DEBUG_TOOL_CALL_USAGE };
175
176
  }
176
177
  if (!/^[a-z][a-z0-9_]*$/i.test(tool)) {
177
- return { ok: false, reason: `'${tool}' is not a tool name (expected snake_case, e.g. file_read)` };
178
+ return { ok: false, reason: notAToolName(tool) };
178
179
  }
179
180
 
180
181
  const payload = tokens.slice(1).join(" ").trim();
@@ -184,10 +185,10 @@ export function parseToolCallArgs(tokens: string[]): ParsedToolCall {
184
185
  try {
185
186
  parsed = JSON.parse(payload);
186
187
  } catch (e: any) {
187
- return { ok: false, reason: `arguments are not valid JSON (${String(e?.message ?? e)}): ${payload}` };
188
+ return { ok: false, reason: argumentsNotJson(String(e?.message ?? e), payload) };
188
189
  }
189
190
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
190
- return { ok: false, reason: `arguments must be a JSON OBJECT, got ${Array.isArray(parsed) ? "an array" : typeof parsed}` };
191
+ return { ok: false, reason: argumentsNotObject(Array.isArray(parsed) ? "an array" : typeof parsed) };
191
192
  }
192
193
  return { ok: true, tool, args: parsed as Record<string, unknown> };
193
194
  }
@@ -28,15 +28,14 @@ import { workspaceRelative } from "../../../shared/domain/vfs.ts";
28
28
  import type { ConfigStore } from "../../../shared/application/config-store.ts";
29
29
  import { launchCrew, withLlmProfile } from "../dispatch.ts";
30
30
  import type { CommandLog, CrewCompletion, LaunchDeps } from "../dispatch.ts";
31
- import { chainStep, freshContext, launchChained, nextLaunch, withContext, CONTEXT_NOT_READ_LINE } from "./dev-implement.ts";
31
+ import { chainStep, freshContext, launchChained, nextLaunch, withContext } from "./dev-implement.ts";
32
32
  import type { ChainHopDeps, ChainLaunch, DevImplementArgs, DevImplementDispatchDeps } from "./dev-implement.ts";
33
33
  import { devVerifyStep, markActiveWorkflow, startDevStep, writeModeRefusal } from "../dev-step.ts";
34
34
  import { storedEffort } from "../effort.ts";
35
+ import { AUDIT_OR_CORRECTION, A_CREW, CHAIN_FAILED_THEN, CONCURRENCY_NEEDS_NUMBER, CONTEXT_NOT_READ_LINE, CORRECTION_OR_CLOSE, DEV_BATCHES_USAGE, WRITES_COMMITS_PUSHES, auditFailed, auditUnknownOption, batchUnknownOption, batchesChainFailed, batchesChainStopped, chainNotKept, concurrencyNotWithBatch, correctionNamesBatch, correctionNamesFinding, devBatchesRefusal, goesWithAudit, namesItsBatch, namesItsBatchFirst, notAWorkCodeExplained, oneAuditMode, oneBatchAtMost, oneCodeAtMost, onePlanAtMost, prGoesWithClose, runUnknownOption, thenType } from "./messages.ts";
36
+ import { neitherCodeNorPlan as notACodeNorPlan } from "../../../shared/application/dev/messages.ts";
37
+ import { failedLine } from "../messages.ts";
35
38
 
36
- export const DEV_BATCHES_USAGE =
37
- "usage: /dev-batches [<code>] [--pr] [--concurrency n] | <code> F<n> [--close [--pr]] [— correction: <finding>]" +
38
- " | <code> F<n> --audit [fast | full | resume] [--gate-only]" +
39
- " (no code: the run in progress goes on; n from 1 to 4, above 1 in bypassPermissions; with F<n>, <code> may be a <path>/<CODE>-PLAN.md)";
40
39
  /** `concurrency` only when the option is typed: without it the run goes on as the plan's run in progress was (one at a
41
40
  * time when none is); `--concurrency 1` goes back to one at a time. */
42
41
  export interface DevBatchesArgs { code: string | null; pr: boolean; concurrency?: number }
@@ -61,7 +60,7 @@ const CORRECTION_WORD = /^correction:?(.*)$/i;
61
60
  const BATCH_OPTIONS: readonly string[] = ["--close", "--audit", "--gate-only"];
62
61
  const isConcurrency = (tok: string): boolean => tok === "--concurrency" || tok.startsWith("--concurrency=");
63
62
  type Refusal = { ok: false; text: string };
64
- const refuse = (text: string): Refusal => ({ ok: false, text: `dev-batches: ${text}` });
63
+ const refuse = (text: string): Refusal => ({ ok: false, text: devBatchesRefusal(text) });
65
64
 
66
65
  /** Splits `… — correction: <finding>` off the tokens: the ones before, and the finding (null without one). */
67
66
  function splitCorrection(tokens: readonly string[]): { before: string[]; finding: string | null } {
@@ -97,17 +96,17 @@ function parseRun(tokens: readonly string[]): DevBatchesParse {
97
96
  const tok = tokens[i];
98
97
  if (isConcurrency(tok)) {
99
98
  const value = tok === "--concurrency" ? tokens[++i] : tok.slice("--concurrency=".length);
100
- if (value === undefined) return refuse("--concurrency needs a number");
99
+ if (value === undefined) return refuse(CONCURRENCY_NEEDS_NUMBER);
101
100
  const c = checkConcurrency(value);
102
101
  if (!c.ok) return refuse(c.line);
103
102
  concurrency = c.value;
104
103
  continue;
105
104
  }
106
105
  if (tok === "--pr") pr = true;
107
- else if (BATCH_OPTIONS.includes(tok)) return refuse(`${tok} names its batch: /dev-batches <code> F<n> ${tok}`);
108
- else if (tok.startsWith("-")) return refuse(`unknown option '${tok}' (--pr, --concurrency; with F<n>: --close, --audit)`);
109
- else if (!isCode(tok)) return refuse(`'${tok}' is not a work code (a folder name of the work folder)`);
110
- else if (code !== null) return refuse(`one code at most, not '${code}' and '${tok}'`);
106
+ else if (BATCH_OPTIONS.includes(tok)) return refuse(namesItsBatch(tok));
107
+ else if (tok.startsWith("-")) return refuse(runUnknownOption(tok));
108
+ else if (!isCode(tok)) return refuse(notAWorkCodeExplained(tok));
109
+ else if (code !== null) return refuse(oneCodeAtMost(code, tok));
111
110
  else code = tok;
112
111
  }
113
112
  const args = concurrency !== undefined ? { code, pr, concurrency } : { code, pr };
@@ -117,7 +116,7 @@ function parseRun(tokens: readonly string[]): DevBatchesParse {
117
116
  /** One batch: its plan, the close (`--pr` only with it), or a correction (never with the close). */
118
117
  function parseBatch(batch: string, rest: readonly string[], finding: string | null): DevBatchesParse {
119
118
  if (finding !== null && finding === "") {
120
- return refuse(`a correction names its finding: ${correctionCommand("<code>", batch, "<the audit's gap>")}`);
119
+ return refuse(correctionNamesFinding(correctionCommand("<code>", batch, "<the audit's gap>")));
121
120
  }
122
121
  let plan: string | null = null;
123
122
  let close = false;
@@ -125,15 +124,15 @@ function parseBatch(batch: string, rest: readonly string[], finding: string | nu
125
124
  for (const tok of rest) {
126
125
  if (tok === "--close") close = true;
127
126
  else if (tok === "--pr") pr = true;
128
- else if (AUDIT_MODES.includes(tok) || tok === "--gate-only") return refuse(`'${tok}' goes with --audit: /dev-batches <code> ${batch} --audit ${tok}`);
129
- else if (tok.startsWith("-")) return refuse(`unknown option '${tok}' with ${batch} (--close, --pr, --audit)`);
127
+ else if (AUDIT_MODES.includes(tok) || tok === "--gate-only") return refuse(goesWithAudit(tok, batch));
128
+ else if (tok.startsWith("-")) return refuse(batchUnknownOption(tok, batch));
130
129
  else if (isCode(tok) || isPlanPath(tok, false)) {
131
- if (plan !== null) return refuse(`one plan at most, not '${plan}' and '${tok}'`);
130
+ if (plan !== null) return refuse(onePlanAtMost(plan, tok));
132
131
  plan = tok;
133
- } else return refuse(`'${tok}' is neither a code nor a <CODE>-PLAN.md path`);
132
+ } else return refuse(notACodeNorPlan(tok));
134
133
  }
135
- if (pr && !close) return refuse(`with ${batch}, --pr goes with --close (the pull request is opened at the close)`);
136
- if (close && finding !== null) return refuse("a correction runs the batch, --close commits it: one at a time");
134
+ if (pr && !close) return refuse(prGoesWithClose(batch));
135
+ if (close && finding !== null) return refuse(CORRECTION_OR_CLOSE);
137
136
  return { ok: true, route: "batch", args: { batch, plan, close, pr, correction: finding } };
138
137
  }
139
138
 
@@ -145,17 +144,17 @@ function parseAudit(batch: string, rest: readonly string[]): DevBatchesParse {
145
144
  let gateOnly = false;
146
145
  for (const tok of rest) {
147
146
  if (AUDIT_MODES.includes(tok)) {
148
- if (mode !== null) return refuse(`one audit mode at most (fast, full or resume), not '${mode}' and '${tok}'`);
147
+ if (mode !== null) return refuse(oneAuditMode(mode, tok));
149
148
  mode = tok as DevVerifyMode;
150
149
  } else if (tok === "--gate-only") {
151
150
  gateOnly = true;
152
151
  } else if (tok.startsWith("-")) {
153
- return refuse(`unknown option '${tok}' with --audit (only --gate-only)`);
152
+ return refuse(auditUnknownOption(tok));
154
153
  } else if (isCode(tok) || isPlanPath(tok, true)) {
155
- if (plan !== null) return refuse(`one plan at most, not '${plan}' and '${tok}'`);
154
+ if (plan !== null) return refuse(onePlanAtMost(plan, tok));
156
155
  plan = tok;
157
156
  } else {
158
- return refuse(`'${tok}' is neither a code nor a <CODE>-PLAN.md path`);
157
+ return refuse(notACodeNorPlan(tok));
159
158
  }
160
159
  }
161
160
  return { ok: true, route: "audit", args: { batch, plan, mode: mode ?? "fast", gateOnly } };
@@ -172,18 +171,18 @@ export function parseDevBatchesArgs(tokens: readonly string[], typed = "dev-batc
172
171
  const audit = typed === DEV_VERIFY_ALIAS || before.includes("--audit");
173
172
  if (at < 0) {
174
173
  if (typed === DEV_IMPLEMENT_ALIAS || typed === DEV_VERIFY_ALIAS) {
175
- return tokens.length === 0 ? { ok: false, text: DEV_BATCHES_USAGE } : refuse(`/${typed} names its batch first: F<n>, e.g. F2`);
174
+ return tokens.length === 0 ? { ok: false, text: DEV_BATCHES_USAGE } : refuse(namesItsBatchFirst(typed));
176
175
  }
177
- if (finding !== null) return refuse(`a correction names its batch: ${correctionCommand("<code>", "F<n>", "<finding>")}`);
176
+ if (finding !== null) return refuse(correctionNamesBatch(correctionCommand("<code>", "F<n>", "<finding>")));
178
177
  return parseRun(before);
179
178
  }
180
179
  const batch = before[at];
181
180
  const rest = [...before.slice(0, at), ...before.slice(at + 1)];
182
181
  const other = rest.find((t) => BATCH.test(t));
183
- if (other !== undefined) return refuse(`one batch at most, not ${batch} and ${other}`);
184
- if (rest.some(isConcurrency)) return refuse(`--concurrency runs a plan's batches: it does not go with ${batch}`);
182
+ if (other !== undefined) return refuse(oneBatchAtMost(batch, other));
183
+ if (rest.some(isConcurrency)) return refuse(concurrencyNotWithBatch(batch));
185
184
  if (!audit) return parseBatch(batch, rest, finding);
186
- if (finding !== null) return refuse("--audit judges the batch, a correction runs it: one at a time");
185
+ if (finding !== null) return refuse(AUDIT_OR_CORRECTION);
187
186
  return parseAudit(batch, rest.filter((t) => t !== "--audit"));
188
187
  }
189
188
 
@@ -198,7 +197,7 @@ export function batchesLaunchInput(args: DevBatchesArgs, read: Record<string, un
198
197
  /** Above 1, the refusal of a session mode that asks before shell commands, before anything is launched. */
199
198
  export function batchesModeRefusal(args: DevBatchesArgs, mode: string): string | null {
200
199
  const line = concurrencyModeRefusal(args.concurrency ?? 1, mode);
201
- return line === null ? null : `dev-batches: ${line}`;
200
+ return line === null ? null : devBatchesRefusal(line);
202
201
  }
203
202
 
204
203
  /** The lines of an answer handed back to the dev-batches crew. */
@@ -247,8 +246,7 @@ export function batchesChainStep(intent: string, payload: string): BatchesChainS
247
246
  /** Every hop of the run keeps the depth of the instance whose `completed` launches it (Orkeon #221). */
248
247
  export const BATCHES_CHAIN: CrewLaunchOptions = { chain: "continue" };
249
248
 
250
- const BATCHES_WRITES = { step: "dev-batches", what: "writes files, commits and pushes" };
251
- const CHAIN_FAILED_THEN = "then type /dev-batches: the run goes on from the first batch not done";
249
+ const BATCHES_WRITES = { step: "dev-batches", what: WRITES_COMMITS_PUSHES };
252
250
 
253
251
  /**
254
252
  * What `completed` prints and launches for one answer of the run, the gate put back and, before a hop that writes
@@ -258,19 +256,19 @@ const CHAIN_FAILED_THEN = "then type /dev-batches: the run goes on from the firs
258
256
  */
259
257
  export async function batchesNextLaunch(result: CrewCompletion, deps: ChainHopDeps): Promise<BatchesChainStep> {
260
258
  if (!result.success) {
261
- return { lines: [`✗ the dev-batches chain failed (${result.intent || "a crew"}): ${result.error ?? "unknown"}`, CHAIN_FAILED_THEN] };
259
+ return { lines: [batchesChainFailed(result.intent || A_CREW, result.error ?? "unknown"), CHAIN_FAILED_THEN] };
262
260
  }
263
261
  const step = batchesChainStep(String(result.intent ?? ""), String(result.payload ?? ""));
264
262
  if (step.launch === undefined) return step;
265
263
  const refusal = deps.reapply(step.launch.crew === "dev-verify" ? "dev-verify" : "dev-implement");
266
- if (refusal !== null) return { lines: [...step.lines, `✗ ${refusal}`, `then type ${step.launch.instead}`] };
264
+ if (refusal !== null) return { lines: [...step.lines, failedLine(refusal), thenType(step.launch.instead)] };
267
265
  if (step.launch.crew === "dev-verify") return step;
268
266
  const context = await freshContext(deps.context);
269
267
  if (context === null) return { lines: [...step.lines, CONTEXT_NOT_READ_LINE], launch: step.launch };
270
268
  const concurrency = step.launch.crew === "dev-batches" && typeof step.launch.input.concurrency === "number" ? step.launch.input.concurrency : 1;
271
269
  const line = writeModeRefusal(context.permissionMode, BATCHES_WRITES.step, BATCHES_WRITES.what)
272
270
  ?? batchesModeRefusal({ code: null, pr: false, concurrency }, context.permissionMode);
273
- if (line !== null) return { lines: [...step.lines, line.startsWith("✗") ? line : `✗ ${line}`, `then type ${step.launch.instead}`] };
271
+ if (line !== null) return { lines: [...step.lines, line.startsWith("✗") ? line : failedLine(line), thenType(step.launch.instead)] };
274
272
  return { lines: step.lines, launch: { ...step.launch, input: withContext(step.launch.input, context) } };
275
273
  }
276
274
 
@@ -281,7 +279,7 @@ export function launchBatchesHop(launch: ChainLaunch, deps: LaunchDeps): string[
281
279
 
282
280
  /** The line `completed` prints when a hop's own reading fails (the context read threw past the handler). */
283
281
  export function batchesHopFailedLine(error: unknown): string {
284
- return `✗ the dev-batches chain stopped (${String((error as Error)?.message ?? error).split("\n")[0]}): ${CHAIN_FAILED_THEN}`;
282
+ return batchesChainStopped(String((error as Error)?.message ?? error).split("\n")[0]);
285
283
  }
286
284
 
287
285
  /** The chain a dispatch launched, kept in the session for `completed`: the run of a plan, one batch, one audit. */
@@ -299,7 +297,7 @@ export async function recordChain(session: Pick<SessionStore, "writeState">, cha
299
297
  } catch (error) {
300
298
  if (chain === "run") return null;
301
299
  const reason = String((error as Error)?.message ?? error).split("\n")[0];
302
- return `dev-batches: the session could not keep which chain runs (${reason}): nothing was launched`;
300
+ return chainNotKept(reason);
303
301
  }
304
302
  }
305
303
 
@@ -326,7 +324,7 @@ export async function devBatchesCompleted(result: CrewCompletion, deps: BatchesC
326
324
  const chain = await readChain(deps.session, String(result.intent ?? ""));
327
325
  if (chain === "audit") {
328
326
  if (result.success && result.streamed === true) return { chain, lines: [] };
329
- return { chain, lines: [result.success ? String(result.payload ?? "") : `✗ the audit failed: ${result.error ?? "unknown"}`] };
327
+ return { chain, lines: [result.success ? String(result.payload ?? "") : auditFailed(result.error ?? "unknown")] };
330
328
  }
331
329
  const step = chain === "batch" ? await nextLaunch(result, deps) : await batchesNextLaunch(result, deps);
332
330
  return { chain, ...step };
@@ -20,6 +20,9 @@ import type { CrewCompletion, LaunchResult } from "../dispatch.ts";
20
20
  import { storedEffort } from "../effort.ts";
21
21
  import { readPullRequestContext } from "../pr-context.ts";
22
22
  import type { PullRequestContext } from "../pr-context.ts";
23
+ import { VALID_LINE, WRITTEN_LINE } from "./markers.ts";
24
+ import { CLOSE_COMMITS, CONTEXT_NOT_READ_LINE, WRITES_COMMITS_PUSHES, batchChainFailed, closeFollows, couldNotBeLaunched, thenType } from "./messages.ts";
25
+ import { failedLine } from "../messages.ts";
23
26
 
24
27
  /** One batch of a plan, as `/dev-batches <code> F<n> [--close [--pr]] [— correction: <finding>]` reads it
25
28
  * (dev-batches.ts parseDevBatchesArgs): the batch, its plan (a code or a `<path>/<CODE>-PLAN.md`, null to find it). */
@@ -28,9 +31,6 @@ export interface DevImplementArgs { batch: string; plan: string | null; close: b
28
31
  export interface ChainLaunch { crew: string; input: Record<string, unknown>; instead: string }
29
32
  export interface ChainStep { lines: string[]; launch?: ChainLaunch }
30
33
 
31
- const VALID_LINE = /^→ Batch (F\d+) VALID\./m;
32
- const WRITTEN_LINE = /^written: (\S+)\/([A-Za-z0-9][A-Za-z0-9._-]*)-VERIFY-(F\d+)\.md\b/m;
33
-
34
34
  /** What `completed` prints and launches for one answer of the chain. */
35
35
  export function chainStep(payload: string): ChainStep {
36
36
  let parsed: unknown = null;
@@ -59,7 +59,7 @@ export function chainStep(payload: string): ChainStep {
59
59
  if (valid === null || written === null || valid[1] !== written[3]) return { lines };
60
60
  const plan = `${written[1]}/${written[2]}-PLAN.md`;
61
61
  return {
62
- lines: [...lines, `→ the close follows: ${closeCommand(plan, valid[1])}`],
62
+ lines: [...lines, closeFollows(closeCommand(plan, valid[1]))],
63
63
  launch: { crew: "dev-implement", input: { batch: valid[1], plan, close: true }, instead: closeCommand(plan, valid[1]) },
64
64
  };
65
65
  }
@@ -82,7 +82,7 @@ export type DevImplementDispatch =
82
82
  /** One batch's dispatch, from its parsed arguments: the refusal, written, or the crew's input and the launch's details. */
83
83
  export async function runDevImplementDispatch(args: DevImplementArgs, deps: DevImplementDispatchDeps): Promise<DevImplementDispatch> {
84
84
  const prContext = await readPullRequestContext({ catalogue: deps.catalogue, rules: deps.gate, session: deps.session });
85
- const line = writeModeRefusal(String(prContext.permissionMode ?? ""), "dev-batches", "writes files, commits and pushes");
85
+ const line = writeModeRefusal(String(prContext.permissionMode ?? ""), "dev-batches", WRITES_COMMITS_PUSHES);
86
86
  if (line !== null) {
87
87
  deps.write(line);
88
88
  return { refused: line };
@@ -117,11 +117,8 @@ export interface ChainHopDeps {
117
117
  context: () => Promise<PullRequestContext>;
118
118
  }
119
119
 
120
- /** The line a hop prints when the session's context could not be read again: the crew reads its record. */
121
- export const CONTEXT_NOT_READ_LINE = "⚠ the session's mode could not be read again: the context read at the launch applies";
122
-
123
120
  /** What the close writes, for the refusal of a read-only mode. */
124
- const CLOSE_WRITES = { step: "dev-batches", what: "commits (the close of the batch)" };
121
+ const CLOSE_WRITES = { step: "dev-batches", what: CLOSE_COMMITS };
125
122
 
126
123
  /** The session's context now, or null when it cannot be read (a throw, an empty mode). */
127
124
  export async function freshContext(read: () => Promise<PullRequestContext>): Promise<PullRequestContext | null> {
@@ -152,7 +149,7 @@ export async function writingHop(
152
149
  const context = await freshContext(read);
153
150
  if (context === null) return { lines: [CONTEXT_NOT_READ_LINE], launch };
154
151
  const refusal = writeModeRefusal(context.permissionMode, writes.step, writes.what);
155
- if (refusal !== null) return { lines: [refusal, `then type ${launch.instead}`] };
152
+ if (refusal !== null) return { lines: [refusal, thenType(launch.instead)] };
156
153
  return { lines: [], launch: { ...launch, input: withContext(launch.input, context) } };
157
154
  }
158
155
 
@@ -162,11 +159,11 @@ export async function writingHop(
162
159
  * the close then reads the session's context again (writingHop); the audit is launched as the crew named it.
163
160
  */
164
161
  export async function nextLaunch(result: CrewCompletion, deps: ChainHopDeps): Promise<ChainStep> {
165
- if (!result.success) return { lines: [`✗ the batch's chain failed: ${result.error ?? "unknown"}`] };
162
+ if (!result.success) return { lines: [batchChainFailed(result.error ?? "unknown")] };
166
163
  const step = chainStep(String(result.payload ?? ""));
167
164
  if (step.launch === undefined) return step;
168
165
  const refusal = deps.reapply(step.launch.crew === "dev-verify" ? "dev-verify" : "dev-implement");
169
- if (refusal !== null) return { lines: [...step.lines, `✗ ${refusal}`, `then type ${step.launch.instead}`] };
166
+ if (refusal !== null) return { lines: [...step.lines, failedLine(refusal), thenType(step.launch.instead)] };
170
167
  if (step.launch.crew !== "dev-implement") return step;
171
168
  const hop = await writingHop(step.launch, deps.context, CLOSE_WRITES);
172
169
  return hop.launch === undefined ? { lines: [...step.lines, ...hop.lines] } : { lines: [...step.lines, ...hop.lines], launch: hop.launch };
@@ -181,8 +178,8 @@ export function launchChained(
181
178
  ): string[] {
182
179
  try {
183
180
  const launched = run(launch.crew, launch.input, options);
184
- return "refused" in launched ? [`✗ ${launched.refused}`, `then type ${launch.instead}`] : [];
181
+ return "refused" in launched ? [failedLine(launched.refused), thenType(launch.instead)] : [];
185
182
  } catch (e) {
186
- return [`✗ ${launch.crew} could not be launched (${String((e as Error)?.message ?? e).split("\n")[0]}): type ${launch.instead}`];
183
+ return [couldNotBeLaunched(launch.crew, String((e as Error)?.message ?? e).split("\n")[0], launch.instead)];
187
184
  }
188
185
  }
@@ -6,9 +6,9 @@
6
6
  // revision of a brief (the crew checks it).
7
7
  import { commandLine, isOption, splitWords } from "../args.ts";
8
8
  import { isCode } from "../../../shared/domain/dev/artefacts.ts";
9
+ import { DEV_SPEC_USAGE, RUN_BEFORE_TEXT, RUN_NEEDS_COMMAND, RUN_NEEDS_KIND, notASpecCode, withUsage } from "./messages.ts";
10
+ import { unknownOption } from "../messages.ts";
9
11
 
10
- export const DEV_SPEC_USAGE =
11
- 'usage: /dev-spec <code> [bug | refactor | perf] [--run "<command>"] [<brief text> | <path>.md | <#issue> | <revision request>]';
12
12
  export interface DevSpecArgs { code: string; request: string }
13
13
  export interface DevChangeArgs { code: string; kind: string; run: string; text: string }
14
14
  /** The crew the line runs, with its input: a spec without a kind, a change brief with one. */
@@ -22,13 +22,9 @@ const KINDS = new Set(["bug", "refactor", "perf"]);
22
22
  /** The alias that keeps /dev-change's own shape. */
23
23
  export const DEV_CHANGE_ALIAS = "dev-change";
24
24
 
25
- /** Why --run needs a kind, said where it is refused. */
26
- export const RUN_NEEDS_KIND =
27
- "--run goes with a kind: bug (the command that reproduces it) or perf (the command that measures it); a feature is a spec and runs nothing";
28
-
29
25
  function codeOf(word: string | undefined): { ok: true; code: string } | { ok: false; text: string } {
30
26
  if (word === undefined || word.trim() === "") return { ok: false, text: DEV_SPEC_USAGE };
31
- if (word.length > MAX_CODE || !isCode(word)) return { ok: false, text: `'${word}' is not a code (letters, digits, '.', '_', '-')\n${DEV_SPEC_USAGE}` };
27
+ if (word.length > MAX_CODE || !isCode(word)) return { ok: false, text: withUsage(notASpecCode(word), DEV_SPEC_USAGE) };
32
28
  return { ok: true, code: word };
33
29
  }
34
30
 
@@ -47,18 +43,18 @@ export function parseDevSpecArgs(tokens: readonly string[], typed = "dev-spec"):
47
43
  if (words[at] !== undefined && !words[at].quoted && KINDS.has(words[at].text)) { kind = words[at].text; at++; }
48
44
  let run = "";
49
45
  if (isOption(words[at])) {
50
- if (words[at].text !== "--run") return { ok: false, text: `unknown option ${words[at].text}\n${DEV_SPEC_USAGE}` };
46
+ if (words[at].text !== "--run") return { ok: false, text: withUsage(unknownOption(words[at].text), DEV_SPEC_USAGE) };
51
47
  const value = words[at + 1];
52
- if (value === undefined || isOption(value) || value.text.trim() === "") return { ok: false, text: `--run needs the command, quoted\n${DEV_SPEC_USAGE}` };
48
+ if (value === undefined || isOption(value) || value.text.trim() === "") return { ok: false, text: withUsage(RUN_NEEDS_COMMAND, DEV_SPEC_USAGE) };
53
49
  run = value.text.trim();
54
50
  at += 2;
55
51
  }
56
52
  if (words.slice(at).some((w) => !w.quoted && w.text === "--run")) {
57
- return { ok: false, text: `--run comes before the text\n${DEV_SPEC_USAGE}` };
53
+ return { ok: false, text: withUsage(RUN_BEFORE_TEXT, DEV_SPEC_USAGE) };
58
54
  }
59
55
  const text = words.length === at + 1 && words[at].quoted ? words[at].text : restOf(line, words, at);
60
56
  if (kind === "" && typed !== DEV_CHANGE_ALIAS) {
61
- if (run !== "") return { ok: false, text: `${RUN_NEEDS_KIND}\n${DEV_SPEC_USAGE}` };
57
+ if (run !== "") return { ok: false, text: withUsage(RUN_NEEDS_KIND, DEV_SPEC_USAGE) };
62
58
  return { ok: true, crew: "dev-spec", args: { code: code.code, request: text } };
63
59
  }
64
60
  return { ok: true, crew: "dev-change", args: { code: code.code, kind, run, text } };