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.
- package/.orkeon-runtime +10 -0
- package/.orkeon-version +1 -1
- package/NOTICE.md +1 -1
- package/README.fr.md +16 -22
- package/README.md +16 -22
- package/config/appsettings.jev.example.json +4 -1
- package/config/appsettings.kev.example.json +4 -1
- package/config/appsettings.liquid.example.json +4 -1
- package/config/appsettings.ollama-whisper.example.json +1 -0
- package/config/appsettings.whisper.example.json +1 -0
- package/mcp/whisper/README.md +2 -1
- package/orkeon-code +206 -11
- package/orkeon-code.ps1 +109 -7
- package/package.json +2 -1
- package/src/commands/.orkeon/orkeon-cli.d.ts +1 -4
- package/src/commands/_lib/args.ts +5 -4
- package/src/commands/_lib/dev/dev-batches.ts +34 -36
- package/src/commands/_lib/dev/dev-implement.ts +11 -14
- package/src/commands/_lib/dev/dev-source.ts +7 -11
- package/src/commands/_lib/dev/dev.ts +34 -37
- package/src/commands/_lib/dev/markers.ts +7 -0
- package/src/commands/_lib/dev/messages.ts +112 -0
- package/src/commands/_lib/dev-step.ts +16 -13
- package/src/commands/_lib/dispatch.ts +62 -39
- package/src/commands/_lib/git/branch.ts +9 -10
- package/src/commands/_lib/git/commit.ts +9 -13
- package/src/commands/_lib/git/diff.ts +22 -12
- package/src/commands/_lib/git/messages.ts +54 -0
- package/src/commands/_lib/git/review.ts +9 -10
- package/src/commands/_lib/memory/memory-admit.ts +19 -21
- package/src/commands/_lib/memory/memory.ts +3 -2
- package/src/commands/_lib/memory/messages.ts +32 -0
- package/src/commands/_lib/messages.ts +48 -0
- package/src/commands/_lib/project/messages.ts +8 -0
- package/src/commands/_lib/session/export.ts +3 -2
- package/src/commands/_lib/session/messages.ts +87 -0
- package/src/commands/_lib/session/prompts.ts +4 -0
- package/src/commands/_lib/session/resume.ts +15 -24
- package/src/commands/_lib/session/tasks.ts +20 -23
- package/src/commands/_lib/settings/advisor.ts +11 -16
- package/src/commands/_lib/settings/agents.ts +18 -28
- package/src/commands/_lib/settings/choices.ts +8 -0
- package/src/commands/_lib/settings/config.ts +43 -43
- package/src/commands/_lib/settings/effort.ts +147 -0
- package/src/commands/_lib/settings/hooks.ts +12 -20
- package/src/commands/_lib/settings/messages.ts +408 -0
- package/src/commands/_lib/settings/mode.ts +33 -24
- package/src/commands/_lib/settings/model.ts +71 -36
- package/src/commands/_lib/settings/output-style.ts +39 -0
- package/src/commands/_lib/settings/permissions.ts +71 -93
- package/src/commands/_lib/settings/route.ts +63 -0
- package/src/commands/_lib/settings/skills.ts +53 -11
- package/src/commands/_lib/settings/theme.ts +42 -0
- package/src/commands/_lib/speech/messages.ts +58 -0
- package/src/commands/_lib/speech/prompts.ts +4 -0
- package/src/commands/_lib/speech/say.ts +9 -10
- package/src/commands/_lib/speech/transcribe.ts +14 -23
- package/src/commands/_lib/speech/voice.ts +14 -18
- package/src/commands/_lib/status/doctor.ts +47 -28
- package/src/commands/_lib/status/messages.ts +100 -0
- package/src/commands/_lib/status/meta.ts +3 -24
- package/src/commands/_lib/status/status.ts +10 -11
- package/src/commands/_lib/status/usage-tools.ts +2 -3
- package/src/commands/_lib/status/usage.ts +7 -18
- package/src/commands/_lib/view.ts +6 -1
- package/src/commands/dev/dev-batches.cmd.ts +4 -3
- package/src/commands/dev/dev-learn.cmd.ts +3 -3
- package/src/commands/dev/dev-plan.cmd.ts +6 -7
- package/src/commands/dev/dev-spec.cmd.ts +6 -7
- package/src/commands/git/commit.cmd.ts +3 -3
- package/src/commands/git/review.cmd.ts +3 -3
- package/src/commands/memory/memory.cmd.ts +2 -2
- package/src/commands/project/analyze.cmd.ts +3 -3
- package/src/commands/project/debug-tool-call.cmd.ts +4 -9
- package/src/commands/project/init-verifiers.cmd.ts +3 -3
- package/src/commands/project/init.cmd.ts +3 -3
- package/src/commands/project/verify.cmd.ts +2 -2
- package/src/commands/session/assistant.cmd.ts +2 -2
- package/src/commands/session/compact.cmd.ts +1 -1
- package/src/commands/session/copy.cmd.ts +8 -7
- package/src/commands/session/rename.cmd.ts +3 -2
- package/src/commands/session/rewind.cmd.ts +3 -4
- package/src/commands/session/summary.cmd.ts +3 -3
- package/src/commands/session/tasks.cmd.ts +4 -2
- package/src/commands/settings/config.cmd.ts +4 -2
- package/src/commands/settings/effort.cmd.ts +10 -31
- package/src/commands/settings/fast.cmd.ts +2 -1
- package/src/commands/settings/mode.cmd.ts +3 -3
- package/src/commands/settings/model.cmd.ts +3 -2
- package/src/commands/settings/output-style.cmd.ts +9 -38
- package/src/commands/settings/permissions.cmd.ts +2 -2
- package/src/commands/settings/proactive.cmd.ts +2 -1
- package/src/commands/settings/route.cmd.ts +16 -0
- package/src/commands/settings/skills.cmd.ts +3 -3
- package/src/commands/settings/theme.cmd.ts +14 -0
- package/src/commands/speech/say.cmd.ts +2 -2
- package/src/commands/speech/transcribe.cmd.ts +2 -2
- package/src/commands/status/release-notes.cmd.ts +1 -1
- package/src/crews/.orkeon/orkeon.d.ts +538 -93
- package/src/crews/_probe-shared-memory/domain/messages.ts +54 -0
- package/src/crews/_probe-shared-memory/domain/probe-verdict.ts +17 -12
- package/src/crews/_probe-shared-memory/domain/prompts.ts +5 -0
- package/src/crews/_probe-shared-memory/probe.ork.ts +5 -3
- package/src/crews/advisor/application/messages.ts +4 -0
- package/src/crews/advisor/application/prompts.ts +4 -0
- package/src/crews/advisor/application/run-advisor.ts +2 -1
- package/src/crews/advisor/crew.ork.ts +5 -4
- package/src/crews/advisor/domain/advice.ts +7 -23
- package/src/crews/advisor/domain/messages.ts +8 -0
- package/src/crews/advisor/domain/prompts.ts +26 -0
- package/src/crews/agent-run/application/messages.ts +18 -0
- package/src/crews/agent-run/application/run-agent-run.ts +5 -4
- package/src/crews/agent-run/crew.ork.ts +3 -3
- package/src/crews/analyze/application/messages.ts +27 -0
- package/src/crews/analyze/application/prompts.ts +4 -0
- package/src/crews/analyze/application/run-analyze.ts +16 -14
- package/src/crews/analyze/crew.ork.ts +5 -4
- package/src/crews/analyze/domain/harvest.ts +33 -65
- package/src/crews/analyze/domain/prompts.ts +86 -0
- package/src/crews/code-review/application/lens-material.ts +24 -0
- package/src/crews/code-review/application/messages.ts +17 -0
- package/src/crews/code-review/application/prompts.ts +10 -17
- package/src/crews/code-review/application/review.ts +4 -1
- package/src/crews/code-review/application/run-code-review.ts +13 -15
- package/src/crews/code-review/crew.ork.ts +5 -4
- package/src/crews/code-review/domain/lenses.ts +6 -45
- package/src/crews/code-review/domain/messages.ts +25 -0
- package/src/crews/code-review/domain/prompts.ts +58 -0
- package/src/crews/code-review/domain/report.ts +5 -6
- package/src/crews/code-review/domain/scope.ts +6 -12
- package/src/crews/dev-batches/application/messages.ts +127 -0
- package/src/crews/dev-batches/application/plan-close.ts +12 -12
- package/src/crews/dev-batches/application/prompts.ts +10 -0
- package/src/crews/dev-batches/application/run-dev-batches.ts +57 -50
- package/src/crews/dev-batches/application/run-wave.ts +24 -22
- package/src/crews/dev-batches/application/seed-harvest.ts +8 -7
- package/src/crews/dev-batches/crew.ork.ts +12 -9
- package/src/crews/dev-batches/domain/batches-log.ts +1 -3
- package/src/crews/dev-batches/domain/markers.ts +5 -0
- package/src/crews/dev-batches/domain/messages.ts +6 -0
- package/src/crews/dev-batches/domain/wave-order.ts +3 -2
- package/src/crews/dev-change/application/change-material.ts +44 -0
- package/src/crews/dev-change/application/evidence.ts +25 -22
- package/src/crews/dev-change/application/messages.ts +81 -0
- package/src/crews/dev-change/application/{change-prompt.ts → prompts.ts} +40 -43
- package/src/crews/dev-change/application/run-dev-change.ts +43 -34
- package/src/crews/dev-change/crew.ork.ts +11 -9
- package/src/crews/dev-change/domain/change-answer.ts +24 -20
- package/src/crews/dev-change/domain/change-render.ts +13 -15
- package/src/crews/dev-change/domain/markers.ts +28 -0
- package/src/crews/dev-change/domain/messages.ts +16 -0
- package/src/crews/dev-implement/application/close.ts +21 -18
- package/src/crews/dev-implement/application/locate-sheet.ts +7 -5
- package/src/crews/dev-implement/application/messages.ts +161 -0
- package/src/crews/dev-implement/application/observe.ts +4 -2
- package/src/crews/dev-implement/application/prompts.ts +9 -0
- package/src/crews/dev-implement/application/report-writes.ts +14 -9
- package/src/crews/dev-implement/application/run-dev-implement.ts +84 -73
- package/src/crews/dev-implement/application/suite-job.ts +15 -11
- package/src/crews/dev-implement/crew.ork.ts +2 -1
- package/src/crews/dev-implement/domain/contracts.ts +59 -60
- package/src/crews/dev-implement/domain/correction.ts +16 -15
- package/src/crews/dev-implement/domain/cycles.ts +2 -1
- package/src/crews/dev-implement/domain/markers.ts +23 -0
- package/src/crews/dev-implement/domain/messages.ts +58 -0
- package/src/crews/dev-implement/domain/prompts.ts +93 -0
- package/src/crews/dev-implement/domain/roles.ts +3 -7
- package/src/crews/dev-implement/domain/sheet-edits.ts +6 -5
- package/src/crews/dev-implement/domain/sheet-ticks.ts +5 -4
- package/src/crews/dev-implement/domain/step-checks.ts +17 -16
- package/src/crews/dev-implement/domain/step-section.ts +6 -4
- package/src/crews/dev-learn/application/learn-prompt-fit.ts +63 -0
- package/src/crews/dev-learn/application/messages.ts +51 -0
- package/src/crews/dev-learn/application/{learn-prompt.ts → prompts.ts} +24 -65
- package/src/crews/dev-learn/application/run-dev-learn.ts +37 -32
- package/src/crews/dev-learn/crew.ork.ts +4 -3
- package/src/crews/dev-learn/domain/learn-answer.ts +25 -27
- package/src/crews/dev-learn/domain/messages.ts +65 -0
- package/src/crews/dev-learn/domain/owner-lines.ts +12 -9
- package/src/crews/dev-learn/domain/proposals-render.ts +8 -9
- package/src/crews/dev-plan/application/anchor-paths.ts +57 -20
- package/src/crews/dev-plan/application/inventory.ts +17 -13
- package/src/crews/dev-plan/application/messages.ts +88 -0
- package/src/crews/dev-plan/application/plan-prompt-fit.ts +44 -0
- package/src/crews/dev-plan/application/{plan-prompt.ts → prompts.ts} +37 -55
- package/src/crews/dev-plan/application/run-dev-plan.ts +103 -75
- package/src/crews/dev-plan/crew.ork.ts +11 -8
- package/src/crews/dev-plan/domain/inventory-model.ts +3 -3
- package/src/crews/dev-plan/domain/markers.ts +18 -0
- package/src/crews/dev-plan/domain/messages.ts +118 -0
- package/src/crews/dev-plan/domain/plan-answer.ts +118 -103
- package/src/crews/dev-plan/domain/plan-render.ts +30 -31
- package/src/crews/dev-plan/domain/prompts.ts +44 -0
- package/src/crews/dev-spec/application/messages.ts +30 -0
- package/src/crews/dev-spec/application/{spec-prompt.ts → prompts.ts} +42 -47
- package/src/crews/dev-spec/application/run-dev-spec.ts +67 -36
- package/src/crews/dev-spec/application/spec-material.ts +42 -0
- package/src/crews/dev-spec/crew.ork.ts +11 -9
- package/src/crews/dev-spec/domain/markers.ts +30 -0
- package/src/crews/dev-spec/domain/messages.ts +39 -0
- package/src/crews/dev-spec/domain/spec-answer.ts +46 -47
- package/src/crews/dev-spec/domain/spec-render.ts +18 -18
- package/src/crews/dev-verify/application/audit-brief.ts +187 -0
- package/src/crews/dev-verify/application/audit.ts +38 -30
- package/src/crews/dev-verify/application/capture.ts +34 -26
- package/src/crews/dev-verify/application/messages.ts +119 -0
- package/src/crews/dev-verify/application/prompts.ts +209 -0
- package/src/crews/dev-verify/application/run-dev-verify.ts +60 -46
- package/src/crews/dev-verify/application/run-gate.ts +11 -9
- package/src/crews/dev-verify/crew.ork.ts +6 -6
- package/src/crews/dev-verify/domain/audit-answer.ts +16 -12
- package/src/crews/dev-verify/domain/capture-sections.ts +5 -4
- package/src/crews/dev-verify/domain/commands.ts +3 -3
- package/src/crews/dev-verify/domain/gate.ts +21 -16
- package/src/crews/dev-verify/domain/markers.ts +16 -0
- package/src/crews/dev-verify/domain/mechanical-table.ts +37 -44
- package/src/crews/dev-verify/domain/messages.ts +92 -0
- package/src/crews/dev-verify/domain/verdict.ts +4 -4
- package/src/crews/git-commit/application/draft.ts +16 -37
- package/src/crews/git-commit/application/messages.ts +15 -0
- package/src/crews/git-commit/application/prompts.ts +47 -0
- package/src/crews/git-commit/application/run-git-commit.ts +13 -12
- package/src/crews/git-commit/crew.ork.ts +5 -4
- package/src/crews/git-commit/domain/commit.ts +15 -35
- package/src/crews/git-commit/domain/markers.ts +4 -0
- package/src/crews/git-commit/domain/messages.ts +48 -0
- package/src/crews/init-verifiers/application/authoring.ts +2 -1
- package/src/crews/init-verifiers/application/messages.ts +13 -0
- package/src/crews/init-verifiers/application/prompts.ts +5 -1
- package/src/crews/init-verifiers/application/run-init-verifiers.ts +3 -2
- package/src/crews/init-verifiers/crew.ork.ts +5 -4
- package/src/crews/main-loop/application/auto-compact.ts +2 -1
- package/src/crews/main-loop/application/messages.ts +81 -0
- package/src/crews/main-loop/application/prompts.ts +12 -0
- package/src/crews/main-loop/application/run-main-loop.ts +63 -30
- package/src/crews/main-loop/application/{turn-prompt.ts → turn-context.ts} +7 -8
- package/src/crews/main-loop/crew.ork.ts +12 -7
- package/src/crews/main-loop/domain/prompt-assembly.ts +45 -228
- package/src/crews/main-loop/domain/prompts.ts +336 -0
- package/src/crews/main-loop/domain/turn-chains.ts +10 -9
- package/src/crews/project-init/application/detect.ts +5 -4
- package/src/crews/project-init/application/messages.ts +15 -0
- package/src/crews/project-init/application/prompts.ts +11 -7
- package/src/crews/project-init/crew.ork.ts +5 -4
- package/src/crews/project-init/domain/existing-files.ts +6 -4
- package/src/crews/project-init/domain/messages.ts +13 -0
- package/src/crews/project-init/domain/package-map.ts +3 -3
- package/src/crews/project-init/domain/prompts.ts +10 -0
- package/src/crews/session-compact/application/prompts.ts +5 -0
- package/src/crews/session-compact/crew.ork.ts +5 -4
- package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
- package/src/crews/shared-memory-admit/crew.ork.ts +3 -2
- package/src/crews/speech/application/messages.ts +3 -0
- package/src/crews/speech/application/prompts.ts +3 -0
- package/src/crews/speech/application/run-speech.ts +2 -1
- package/src/crews/speech/crew.ork.ts +2 -1
- package/src/shared/application/agents/child-agent.ts +11 -7
- package/src/shared/application/agents/messages.ts +35 -0
- package/src/shared/application/agents/route-agent.ts +115 -0
- package/src/shared/application/agents/run-sub-agent.ts +31 -8
- package/src/shared/application/compaction/compact-session.ts +19 -14
- package/src/shared/application/compaction/messages.ts +20 -0
- package/src/shared/application/compaction/prune-context.ts +94 -0
- package/src/shared/application/compaction/pruned-llm.ts +35 -0
- package/src/shared/application/dev/brief-inventory.ts +6 -4
- package/src/shared/application/dev/close-batch.ts +9 -7
- package/src/shared/application/dev/find-repo-pack.ts +4 -3
- package/src/shared/application/dev/learn-decision.ts +20 -18
- package/src/shared/application/dev/load-dev-context.ts +7 -8
- package/src/shared/application/dev/measure-access-cost.ts +5 -4
- package/src/shared/application/dev/messages.ts +132 -0
- package/src/shared/application/dev/phase-timer.ts +54 -0
- package/src/shared/application/dev/plan-source.ts +12 -8
- package/src/shared/application/dev/preflight.ts +8 -8
- package/src/shared/application/dev/prompts.ts +34 -0
- package/src/shared/application/dev/question-round.ts +25 -17
- package/src/shared/application/dev/resolve-work-folder.ts +4 -3
- package/src/shared/application/dev/settle-questions.ts +4 -2
- package/src/shared/application/dev/source-review.ts +12 -8
- package/src/shared/application/dev/source-step.ts +12 -10
- package/src/shared/application/dev/spend.ts +17 -4
- package/src/shared/application/dev/step-precedents.ts +2 -1
- package/src/shared/application/dev/tool-call-policy.ts +9 -11
- package/src/shared/application/dev/tool-callbacks.ts +52 -5
- package/src/shared/application/dev/tool-trace-recorder.ts +2 -1
- package/src/shared/application/dev/verdict-sources.ts +5 -3
- package/src/shared/application/dev/wrapped-tools.ts +4 -2
- package/src/shared/application/extra-tools.ts +2 -1
- package/src/shared/application/git/batch-worktree.ts +22 -17
- package/src/shared/application/git/commit-files.ts +24 -19
- package/src/shared/application/git/merge-batch.ts +11 -7
- package/src/shared/application/git/messages.ts +75 -0
- package/src/shared/application/git/open-pull-request.ts +4 -3
- package/src/shared/application/host-context.ts +59 -0
- package/src/shared/application/host-layout-store.ts +45 -0
- package/src/shared/application/llm-profile.ts +4 -3
- package/src/shared/application/messages.ts +14 -0
- package/src/shared/application/permission-rules.ts +10 -0
- package/src/shared/application/ports/decision.ts +14 -0
- package/src/shared/application/ports/human.ts +25 -0
- package/src/shared/application/ports/llm.ts +32 -3
- package/src/shared/application/ports/memory.ts +1 -1
- package/src/shared/application/ports/theme.ts +11 -0
- package/src/shared/application/ports.ts +4 -2
- package/src/shared/application/session-io.ts +2 -1
- package/src/shared/application/shared-memory/admit-entries.ts +16 -14
- package/src/shared/application/shared-memory/harvest-after-gaps.ts +5 -8
- package/src/shared/application/shared-memory/harvest-mistakes.ts +3 -2
- package/src/shared/application/shared-memory/import-agent-memory.ts +9 -7
- package/src/shared/application/shared-memory/memory-files.ts +2 -1
- package/src/shared/application/shared-memory/memory-settings.ts +2 -1
- package/src/shared/application/shared-memory/messages.ts +63 -0
- package/src/shared/application/shared-memory/push-candidate.ts +14 -11
- package/src/shared/application/shared-memory/recall-precedents.ts +2 -1
- package/src/shared/application/skills/messages.ts +4 -0
- package/src/shared/application/skills/suggest-skills.ts +102 -0
- package/src/shared/application/workflow/messages.ts +8 -0
- package/src/shared/application/workflow/workflow-state.ts +7 -6
- package/src/shared/domain/agent-policy/behavior-flags.ts +4 -10
- package/src/shared/domain/agent-policy/extra-tools.ts +2 -4
- package/src/shared/domain/agent-policy/messages.ts +66 -0
- package/src/shared/domain/agent-policy/path-rules.ts +299 -0
- package/src/shared/domain/agent-policy/permission.ts +20 -18
- package/src/shared/domain/agent-policy/prompts.ts +17 -0
- package/src/shared/domain/agent-policy/reasoning.ts +59 -0
- package/src/shared/domain/agent-policy/rule-sets.ts +18 -14
- package/src/shared/domain/agent-policy/tool-access.ts +17 -3
- package/src/shared/domain/agent-registry.ts +6 -5
- package/src/shared/domain/agents/chain.ts +2 -2
- package/src/shared/domain/agents/charter.ts +8 -5
- package/src/shared/domain/agents/exclusive.ts +2 -1
- package/src/shared/domain/agents/instances.ts +18 -15
- package/src/shared/domain/agents/messages.ts +39 -0
- package/src/shared/domain/agents/model-route.ts +199 -0
- package/src/shared/domain/agents/prompts.ts +20 -0
- package/src/shared/domain/code-intel-contract.ts +5 -4
- package/src/shared/domain/code-intel-routing.ts +8 -61
- package/src/shared/domain/compact-outcome.ts +5 -3
- package/src/shared/domain/compaction-thresholds.ts +2 -1
- package/src/shared/domain/compaction.ts +22 -113
- package/src/shared/domain/config-schema.ts +94 -81
- package/src/shared/domain/context-prune.ts +176 -0
- package/src/shared/domain/decision/questions.ts +102 -0
- package/src/shared/domain/dev/access-cost.ts +19 -15
- package/src/shared/domain/dev/batches-concurrency.ts +5 -6
- package/src/shared/domain/dev/build-commands.ts +5 -4
- package/src/shared/domain/dev/call-guard.ts +29 -28
- package/src/shared/domain/dev/carried-text.ts +3 -5
- package/src/shared/domain/dev/learn-proposals.ts +5 -4
- package/src/shared/domain/dev/learn-state.ts +3 -2
- package/src/shared/domain/dev/markers.ts +107 -0
- package/src/shared/domain/dev/messages.ts +259 -0
- package/src/shared/domain/dev/phase-timing.ts +50 -0
- package/src/shared/domain/dev/plan-checks.ts +24 -23
- package/src/shared/domain/dev/plan-format.ts +14 -24
- package/src/shared/domain/dev/project-files.ts +1 -15
- package/src/shared/domain/dev/prompts/brief-blocks.ts +20 -0
- package/src/shared/domain/dev/{review-prompt.ts → prompts.ts} +91 -61
- package/src/shared/domain/dev/questions.ts +33 -15
- package/src/shared/domain/dev/repo-pack.ts +12 -9
- package/src/shared/domain/dev/review-answer.ts +40 -17
- package/src/shared/domain/dev/review-brief.ts +54 -0
- package/src/shared/domain/dev/reviewer-charter.ts +4 -0
- package/src/shared/domain/dev/sheet-facts.ts +2 -4
- package/src/shared/domain/dev/spec-format.ts +13 -14
- package/src/shared/domain/dev/step-budget.ts +4 -2
- package/src/shared/domain/dev/step-rules.ts +3 -4
- package/src/shared/domain/dev/test-commands.ts +14 -10
- package/src/shared/domain/dev/tool-guards.ts +4 -3
- package/src/shared/domain/dev/trait-pattern.ts +14 -10
- package/src/shared/domain/dev/verdict-format.ts +14 -21
- package/src/shared/domain/dev/whitespace.ts +3 -2
- package/src/shared/domain/dev/work-folder.ts +4 -3
- package/src/shared/domain/dev/yaml-subset.ts +8 -26
- package/src/shared/domain/error-text.ts +13 -0
- package/src/shared/domain/git/close.ts +5 -4
- package/src/shared/domain/git/messages.ts +20 -0
- package/src/shared/domain/git/pull-request.ts +5 -5
- package/src/shared/domain/host-layout.ts +147 -0
- package/src/shared/domain/host-paths.ts +399 -0
- package/src/shared/domain/llm-failure.ts +35 -7
- package/src/shared/domain/llm-profile.ts +22 -3
- package/src/shared/domain/marked-message.ts +1 -5
- package/src/shared/domain/markers.ts +30 -0
- package/src/shared/domain/messages.ts +291 -0
- package/src/shared/domain/model-catalog.ts +2 -9
- package/src/shared/domain/permission-modes.ts +4 -8
- package/src/shared/domain/prelude.ts +2 -2
- package/src/shared/domain/project-manifests.ts +3 -2
- package/src/shared/domain/prompts.ts +233 -0
- package/src/shared/domain/search-routing.ts +3 -11
- package/src/shared/domain/secret-patterns.ts +3 -2
- package/src/shared/domain/session-keys.ts +7 -0
- package/src/shared/domain/session-start.ts +3 -2
- package/src/shared/domain/shared-memory/agent-memory-import.ts +4 -2
- package/src/shared/domain/shared-memory/candidates.ts +3 -4
- package/src/shared/domain/shared-memory/entry.ts +26 -20
- package/src/shared/domain/shared-memory/front-matter.ts +17 -13
- package/src/shared/domain/shared-memory/gate.ts +4 -3
- package/src/shared/domain/shared-memory/harvest.ts +9 -6
- package/src/shared/domain/shared-memory/layout.ts +11 -8
- package/src/shared/domain/shared-memory/markers.ts +9 -0
- package/src/shared/domain/shared-memory/messages.ts +66 -0
- package/src/shared/domain/shared-memory/precedents-block.ts +4 -15
- package/src/shared/domain/shared-memory/prompts.ts +28 -0
- package/src/shared/domain/shared-memory/refused.ts +3 -3
- package/src/shared/domain/skills/prompts.ts +4 -0
- package/src/shared/domain/skills/shortlist.ts +149 -0
- package/src/shared/domain/snip-turns.ts +2 -14
- package/src/shared/domain/speech.ts +2 -1
- package/src/shared/domain/tool-trace.ts +5 -7
- package/src/shared/domain/verifiers.ts +7 -11
- package/src/shared/domain/vfs.ts +8 -1
- package/src/shared/domain/workflow/prompts.ts +15 -0
- package/src/shared/domain/workflow/state-file.ts +14 -12
- package/src/shared/infrastructure/globals.ts +7 -2
- package/src/shared/infrastructure/orkeon/child-agents.ts +11 -16
- package/src/shared/infrastructure/orkeon/chooser.ts +32 -0
- package/src/shared/infrastructure/orkeon/decision-model.ts +31 -0
- package/src/shared/infrastructure/orkeon/dev-deps.ts +21 -14
- package/src/shared/infrastructure/orkeon/files.ts +24 -6
- package/src/shared/infrastructure/orkeon/github-pull-requests.ts +3 -2
- package/src/shared/infrastructure/orkeon/host-context.ts +36 -0
- package/src/shared/infrastructure/orkeon/human-input.ts +1 -5
- package/src/shared/infrastructure/orkeon/llm-profile.ts +36 -16
- package/src/shared/infrastructure/orkeon/llm.ts +85 -30
- package/src/shared/infrastructure/orkeon/markers.ts +6 -0
- package/src/shared/infrastructure/orkeon/memory-store.ts +1 -1
- package/src/shared/infrastructure/orkeon/memory-tools.ts +18 -20
- package/src/shared/infrastructure/orkeon/messages.ts +15 -0
- package/src/shared/infrastructure/orkeon/prompts.ts +47 -0
- package/src/shared/infrastructure/orkeon/reasoning.ts +40 -0
- package/src/shared/infrastructure/orkeon/script-tools.ts +14 -19
- package/src/shared/infrastructure/orkeon/session-store.ts +7 -51
- package/src/shared/infrastructure/orkeon/shell-jobs.ts +13 -7
- package/src/shared/infrastructure/orkeon/shell.ts +13 -5
- package/src/shared/infrastructure/orkeon/tool-catalogue.ts +3 -2
- package/src/shared/infrastructure/orkeon/wiring.ts +68 -12
- package/src/crews/dev-verify/application/auditor-prompt.ts +0 -323
- 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(
|
|
107
|
-
layers: texts(
|
|
108
|
-
reuse: texts(
|
|
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(
|
|
119
|
+
assumptions: texts(PLAN_FIELDS.assumptions),
|
|
111
120
|
nonApplicable: listOf(objectOf({
|
|
112
121
|
id: { type: "string", enum: [...DESIGN_RULE_IDS] },
|
|
113
|
-
reason: text(
|
|
114
|
-
}),
|
|
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(
|
|
118
|
-
}),
|
|
126
|
+
owners: texts(PLAN_FIELDS.owners),
|
|
127
|
+
}), PLAN_FIELDS.traceability),
|
|
119
128
|
design: listOf(objectOf({
|
|
120
|
-
ids: texts(
|
|
129
|
+
ids: texts(PLAN_FIELDS.designIds),
|
|
121
130
|
aggregate: STRING,
|
|
122
131
|
invariant: STRING,
|
|
123
132
|
consistency: STRING,
|
|
124
|
-
batch: said({ type: "integer" },
|
|
133
|
+
batch: said({ type: "integer" }, PLAN_FIELDS.designBatch),
|
|
125
134
|
})),
|
|
126
135
|
batches: listOf(objectOf({
|
|
127
136
|
name: STRING,
|
|
128
|
-
intent: text(
|
|
129
|
-
reason: text(
|
|
130
|
-
documentation: said({ type: "boolean" },
|
|
131
|
-
dependsOn: texts(
|
|
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(
|
|
139
|
-
},
|
|
140
|
-
decisions: texts(
|
|
141
|
-
declarative: texts(
|
|
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(
|
|
152
|
+
title: text(PLAN_FIELDS.stepTitle(MAX_TITLE)),
|
|
144
153
|
tests: listOf(objectOf({
|
|
145
|
-
name: text(
|
|
146
|
-
level: said({ type: "string", enum: [...LEVELS] },
|
|
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(
|
|
149
|
-
covers: texts(
|
|
157
|
+
ids: texts(PLAN_FIELDS.testIds),
|
|
158
|
+
covers: texts(PLAN_FIELDS.covers),
|
|
150
159
|
})),
|
|
151
|
-
note: text(
|
|
160
|
+
note: text(PLAN_FIELDS.note),
|
|
152
161
|
anchors: objectOf({
|
|
153
162
|
tests: ANCHORS,
|
|
154
163
|
doubles: ANCHORS,
|
|
155
164
|
production: ANCHORS,
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
|
|
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(
|
|
164
|
-
},
|
|
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(
|
|
168
|
-
rule: text(
|
|
175
|
+
signature: text(PLAN_FIELDS.signature(MAX_SIGNATURE)),
|
|
176
|
+
rule: text(PLAN_FIELDS.rule),
|
|
169
177
|
})),
|
|
170
|
-
}),
|
|
171
|
-
},
|
|
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(
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
/**
|
|
439
|
-
|
|
440
|
-
|
|
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(
|
|
499
|
-
if (c.kind === "prose" && /[|\r\n]/.test(c.value)) out.push(
|
|
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(
|
|
514
|
+
out.push(holdsBreak(head));
|
|
502
515
|
}
|
|
503
|
-
if (LABELS.test(c.value)) out.push(
|
|
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(
|
|
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 [
|
|
526
|
-
return ctx.shownRefs.has(a.ref) ? [] : [
|
|
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 [
|
|
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
|
-
|
|
532
|
-
|
|
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 (
|
|
537
|
-
if (
|
|
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(
|
|
548
|
-
else if (s.title.length > MAX_TITLE) out.push(
|
|
549
|
-
else if (s.title === BUILD_STEP) out.push(
|
|
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(
|
|
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(
|
|
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(
|
|
558
|
-
else if (t.name.length > MAX_TEST_NAME) out.push(
|
|
559
|
-
if (t.project === "") out.push(
|
|
560
|
-
for (const id of t.ids) if (!ctx.sourceIds.includes(id)) out.push(
|
|
561
|
-
for (const u of t.covers) if (!ctx.unpinned.includes(u)) out.push(
|
|
562
|
-
|
|
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(
|
|
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(
|
|
576
|
-
if (s.anchors.production.length === 0) out.push(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
615
|
-
|
|
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(
|
|
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(
|
|
630
|
-
if (!ctx.sourceIds.includes(t.id)) { out.push(
|
|
631
|
-
if (rows.has(t.id)) { out.push(
|
|
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(
|
|
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(
|
|
644
|
-
else if (!applied.has(id) && na.length === 0) out.push(
|
|
645
|
-
else if (na.length > 1) out.push(
|
|
646
|
-
else if (na.length === 1 && na[0].reason.length < MIN_NA_REASON) out.push(
|
|
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(
|
|
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(
|
|
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(
|
|
689
|
-
else if (!covering.some(({ first }) => first)) out.push(
|
|
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),
|
|
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: [
|
|
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(
|
|
708
|
-
else if (a.feature.length > MAX_FEATURE) problems.push(
|
|
709
|
-
if (a.layers.filter((l) => l !== "").length === 0) problems.push(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
733
|
-
for (const id of d.ids) if (!ctx.sourceIds.includes(id)) problems.push(
|
|
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) };
|