specdojo 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/specdojo-orchestrator.md +7 -3
- package/CHANGELOG.md +217 -0
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/catalog.js +16 -14
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/agent.js +5 -3
- package/dist/commands/build.js +69 -10
- package/dist/commands/git.js +206 -0
- package/dist/commands/init.js +9 -3
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/commands/where.js +25 -0
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +616 -261
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +11 -12
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +23 -18
- package/dist/devcontainer/scaffold.js +18 -0
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/index-command.js +2 -2
- package/dist/docs/yaml-business-tables.js +243 -0
- package/dist/docs/yaml-interface-tables.js +106 -0
- package/dist/docs/yaml-pages-command.js +5 -3
- package/dist/docs/yaml-pages.js +268 -3
- package/dist/docs/yaml-table-shared.js +70 -0
- package/dist/docs/yaml-tables.js +39 -0
- package/dist/exec/agent-config.js +31 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/agent-protected-config.js +2 -0
- package/dist/exec/commands.js +100 -39
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +179 -8
- package/dist/exec/evidence.js +77 -19
- package/dist/exec/handoff.js +9 -13
- package/dist/exec/limit.js +1 -1
- package/dist/exec/mechanical-result.js +45 -0
- package/dist/exec/migrate-records.js +249 -0
- package/dist/exec/parent-validation.js +209 -15
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +45 -19
- package/dist/exec/plans-generation.js +52 -30
- package/dist/exec/plans-grade-findings.js +8 -3
- package/dist/exec/plans-kata-findings.js +61 -0
- package/dist/exec/plans-planning.js +3 -3
- package/dist/exec/plans-storage.js +12 -24
- package/dist/exec/post-integration.js +162 -0
- package/dist/exec/queue-command.js +166 -0
- package/dist/exec/queue.js +285 -0
- package/dist/exec/register-foreign-wait.js +84 -0
- package/dist/exec/register-resume.js +55 -56
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +21 -5
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +106 -25
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +112 -0
- package/dist/exec/run/agent-pipeline.js +78 -8
- package/dist/exec/run/agent.js +32 -13
- package/dist/exec/run/change-scope.js +365 -0
- package/dist/exec/run/deferred-cleanup.js +31 -0
- package/dist/exec/run/in-place.js +73 -33
- package/dist/exec/run/job-lock.js +66 -0
- package/dist/exec/run/job-sequence.js +137 -0
- package/dist/exec/run/job.js +135 -41
- package/dist/exec/run/lifecycle-commands.js +189 -37
- package/dist/exec/run/lock.js +22 -1
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +14 -15
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +77 -17
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +95 -31
- package/dist/exec/run/register-state.js +23 -15
- package/dist/exec/run/register-worktree.js +184 -139
- package/dist/exec/run/schedule-mode.js +79 -18
- package/dist/exec/run/schedule-prepare.js +204 -59
- package/dist/exec/run/schedule-task.js +203 -49
- package/dist/exec/run/shared.js +9 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/schedule/schedule.js +116 -4
- package/dist/exec/shared.js +1 -1
- package/dist/exec/smoke.js +190 -0
- package/dist/exec/strategy.js +14 -3
- package/dist/exec/task-view.js +6 -4
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +8 -4
- package/dist/exec/trial-core.js +6 -1
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/validation-metrics.js +181 -0
- package/dist/exec/worktree-cleanup-lock.js +26 -0
- package/dist/exec/worktree-command.js +38 -17
- package/dist/exec/worktree-ops-commit.js +119 -48
- package/dist/exec/worktree-ops-lifecycle.js +77 -48
- package/dist/exec/worktree-ops-merge.js +13 -2
- package/dist/exec/worktree-ops.js +2 -2
- package/dist/exec/worktree.js +32 -4
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-apply.js +3 -3
- package/dist/grade/command-inspect.js +7 -5
- package/dist/grade/command-plan.js +1 -1
- package/dist/grade/command-run.js +7 -1
- package/dist/grade/command-shared.js +1 -1
- package/dist/grade/core.js +18 -5
- package/dist/grade/markdown.js +3 -3
- package/dist/grade/pipeline-state.js +15 -11
- package/dist/grade/plan.js +37 -17
- package/dist/grade/result.js +3 -3
- package/dist/grade/run.js +87 -11
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/definition.js +84 -8
- package/dist/job/job.js +109 -39
- package/dist/job/noop.js +104 -0
- package/dist/register/authoring-sources.js +22 -16
- package/dist/register/core.js +2 -0
- package/dist/register/create-commands.js +28 -3
- package/dist/register/deliverable-target.js +9 -1
- package/dist/register/epic.js +104 -26
- package/dist/register/event-merge.js +3 -0
- package/dist/register/events.js +4 -0
- package/dist/register/external-project.js +3 -0
- package/dist/register/item.js +6 -0
- package/dist/register/maintenance-commands.js +6 -3
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +74 -16
- package/dist/register/track-domains.js +34 -0
- package/dist/register/track-plan.js +78 -0
- package/dist/register/transition-commands.js +8 -0
- package/dist/register/work-table.js +64 -0
- package/dist/review/grade.js +35 -13
- package/dist/routine/definition.js +13 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +189 -71
- package/dist/routine/status.js +62 -0
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +39 -39
- package/dist/schedule/strategy-generate-document.js +26 -14
- package/dist/schedule/strategy-generate-scope.js +17 -45
- package/dist/schedule/strategy-generate.js +33 -3
- package/dist/schedule/strategy-profiles.js +86 -12
- package/dist/shared/agent-types.js +7 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/cross-process-lock.js +9 -1
- package/dist/shared/deprecation.js +8 -0
- package/dist/shared/dist-freshness.js +8 -2
- package/dist/shared/document-metadata.js +20 -0
- package/dist/shared/finding-cause.js +20 -0
- package/dist/shared/frontmatter-namespace.js +48 -0
- package/dist/shared/git-environment.js +2 -1
- package/dist/shared/git.js +186 -16
- package/dist/shared/grade-result.js +17 -1
- package/dist/shared/lefthook-scaffold.js +3 -0
- package/dist/shared/local-config.js +244 -0
- package/dist/shared/local-state.js +20 -0
- package/dist/shared/markdownlint-config.js +8 -3
- package/dist/shared/plan-conventions.js +129 -0
- package/dist/shared/plan-templates.js +57 -41
- package/dist/shared/run-records.js +224 -0
- package/dist/shared/specdojo-config.js +73 -41
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +74 -6
- package/dist/shared/timeline-index.js +2 -0
- package/dist/shared/where-alias.js +13 -0
- package/dist/specdojo.js +4 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +11 -2
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +4 -74
- package/docs/ja/specdojo/exec-templates/xep-condense-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xep-draft-template.md +17 -5
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +16 -3
- package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +15 -5
- package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -1
- package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xer-condense-template.md +25 -0
- package/docs/ja/specdojo/exec-templates/xp-common-conventions-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xrp-common-conventions-template.md +30 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +1 -1
- package/docs/ja/specdojo/guides/docs-editing-guide.md +12 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
- package/docs/ja/specdojo/guides/exec-config-guide.md +69 -19
- package/docs/ja/specdojo/guides/exec-operation-guide.md +97 -18
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- package/docs/ja/specdojo/guides/job-sequence-guide.md +77 -0
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +92 -55
- package/docs/ja/specdojo/guides/project-move-guide.md +381 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +73 -17
- package/docs/ja/specdojo/guides/register-operation-guide.md +26 -6
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +2 -0
- package/docs/ja/specdojo/guides/review-guide.md +22 -19
- package/docs/ja/specdojo/guides/routine-operation-guide.md +23 -12
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +27 -21
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +27 -3
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +5 -4
- package/docs/ja/specdojo/guides/timeline-design-guide.md +27 -144
- package/docs/ja/specdojo/guides/use-case-guide.md +92 -155
- package/docs/ja/specdojo/guides/waza-guide.md +12 -8
- package/docs/ja/specdojo/recipes/bac-recipe.md +111 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/bps-recipe.md +88 -139
- package/docs/ja/specdojo/recipes/br-recipe.md +77 -0
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +97 -109
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +85 -146
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +92 -99
- package/docs/ja/specdojo/recipes/cnd-recipe.md +135 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +140 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +162 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +112 -90
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +164 -0
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +60 -49
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +50 -51
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +59 -48
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +72 -50
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +40 -49
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +42 -48
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +52 -81
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +64 -91
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +71 -106
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +78 -156
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +62 -111
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +67 -123
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +60 -96
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +61 -105
- package/docs/ja/specdojo/recipes/stsd-recipe.md +88 -80
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +129 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +146 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/tsd-recipe.md +149 -129
- package/docs/ja/specdojo/references/command-reference.md +303 -148
- package/docs/ja/specdojo/references/deliverables-reference.md +30 -16
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +54 -18
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +101 -257
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +102 -228
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +63 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +162 -80
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +118 -155
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +128 -60
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +70 -94
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +24 -56
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +58 -103
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +103 -223
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +18 -93
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +18 -52
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +109 -147
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +80 -108
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +51 -55
- package/docs/ja/specdojo/rulebooks/cdr-rulebook.md +144 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +81 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +139 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +170 -0
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +33 -86
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +45 -131
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +69 -275
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +20 -112
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +12 -145
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +115 -256
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +79 -109
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +119 -174
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +6 -14
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +22 -66
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +36 -94
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +171 -0
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +31 -131
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +50 -104
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +93 -57
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +63 -253
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +14 -20
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +79 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +182 -237
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +111 -40
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +14 -22
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +23 -46
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +41 -64
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +16 -40
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +34 -61
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +27 -50
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +70 -199
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +65 -153
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +74 -150
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +12 -23
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +99 -176
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +35 -61
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +75 -117
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +31 -60
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +26 -81
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +32 -70
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +45 -87
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +48 -101
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +44 -80
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +59 -127
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +31 -50
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +42 -109
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +29 -42
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +29 -87
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +62 -84
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +11 -61
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +92 -102
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +25 -34
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +30 -53
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +23 -35
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +27 -45
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +45 -59
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +56 -66
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +54 -62
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +46 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +28 -35
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +65 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +6 -18
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +48 -78
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +23 -97
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -153
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +43 -116
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +16 -51
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +47 -92
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +25 -84
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +44 -107
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +106 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +111 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +129 -59
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +90 -189
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +45 -105
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +46 -40
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +104 -68
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +64 -330
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +70 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +58 -200
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +47 -60
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +69 -71
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +65 -72
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +35 -46
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +49 -66
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +64 -139
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +91 -161
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +49 -144
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +67 -155
- package/docs/ja/specdojo/samples/bac-sample.md +106 -21
- package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
- package/docs/ja/specdojo/samples/bds-sample.md +87 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +42 -20
- package/docs/ja/specdojo/samples/bes-sample.md +70 -21
- package/docs/ja/specdojo/samples/bps-sample.md +42 -54
- package/docs/ja/specdojo/samples/br-sample.md +57 -15
- package/docs/ja/specdojo/samples/ccd-sample.md +80 -19
- package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +9 -7
- package/docs/ja/specdojo/samples/cdr-sample.md +78 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +73 -20
- package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
- package/docs/ja/specdojo/samples/cld-sample.md +3 -30
- package/docs/ja/specdojo/samples/clis-sample.md +125 -0
- package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
- package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
- package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
- package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
- package/docs/ja/specdojo/samples/dec-sample.md +2 -3
- package/docs/ja/specdojo/samples/dss-sample.md +175 -0
- package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
- package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
- package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/job-sequence.yaml +67 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +98 -20
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +26 -19
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +42 -21
- package/docs/ja/specdojo/samples/pm-plan-sample.md +78 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +41 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +63 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +33 -25
- package/docs/ja/specdojo/samples/prj-charter-sample.md +42 -59
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +83 -62
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +30 -33
- package/docs/ja/specdojo/samples/sf-index-sample.md +47 -20
- package/docs/ja/specdojo/samples/sf-sample.md +109 -21
- package/docs/ja/specdojo/samples/sld-sample.md +88 -21
- package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
- package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
- package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
- package/docs/ja/specdojo/samples/uis-sample.md +141 -20
- package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
- package/docs/ja/specdojo/standards/job-definition-standard.md +24 -9
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
- package/docs/ja/specdojo/templates/bac-template.md +76 -0
- package/docs/ja/specdojo/templates/bes-template.md +56 -0
- package/docs/ja/specdojo/templates/br-template.md +64 -0
- package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +9 -5
- package/docs/ja/specdojo/templates/cdr-template.md +58 -0
- package/docs/ja/specdojo/templates/cnd-template.md +137 -0
- package/docs/ja/specdojo/templates/cpd-template.md +129 -0
- package/docs/ja/specdojo/templates/cxd-template.md +105 -0
- package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
- package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
- package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
- package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
- package/docs/ja/specdojo/templates/ifd-template.md +86 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
- package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
- package/docs/ja/specdojo/templates/opr-template.md +2 -4
- package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
- package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
- package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
- package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
- package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
- package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
- package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
- package/docs/ja/specdojo/templates/stsd-template.md +46 -21
- package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
- package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
- package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
- package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
- package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
- package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +5 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +95 -8
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +38 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
- package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
- package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
- package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +63 -2
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +2 -2
- package/package.json +10 -7
- package/templates/antigravity/orchestrator.md +7 -3
- package/templates/claude/agents/specdojo-orchestrator.md +7 -3
- package/templates/codex/agents/specdojo-orchestrator.toml +7 -3
- package/templates/codex/orchestrator.md +7 -3
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/init-exec-defaults.yaml +13 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +8 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +8 -4
package/dist/exec/events.js
CHANGED
|
@@ -53,6 +53,153 @@ export function validateEventShape(obj, source) {
|
|
|
53
53
|
export function isExecEventV1(value, source) {
|
|
54
54
|
return validateEventShape(value, source).length === 0;
|
|
55
55
|
}
|
|
56
|
+
function advanceTaskState(state, event) {
|
|
57
|
+
if (event.type === "claim")
|
|
58
|
+
return "doing";
|
|
59
|
+
if (event.type === "block")
|
|
60
|
+
return "blocked";
|
|
61
|
+
if (event.type === "unblock")
|
|
62
|
+
return "doing";
|
|
63
|
+
if (event.type === "complete")
|
|
64
|
+
return "done";
|
|
65
|
+
if (event.type === "reopen")
|
|
66
|
+
return state === "done" ? "todo" : state;
|
|
67
|
+
if (event.type === "release") {
|
|
68
|
+
return state === "doing" || state === "blocked" ? "todo" : state;
|
|
69
|
+
}
|
|
70
|
+
if (event.type === "cancel") {
|
|
71
|
+
if (state === "todo")
|
|
72
|
+
return "cancelled";
|
|
73
|
+
if (state === "doing" || state === "blocked")
|
|
74
|
+
return "todo";
|
|
75
|
+
return "cancelled";
|
|
76
|
+
}
|
|
77
|
+
return state;
|
|
78
|
+
}
|
|
79
|
+
function resumesPipelineBlock(block, unblock) {
|
|
80
|
+
return (block.type === "block" &&
|
|
81
|
+
unblock.type === "unblock" &&
|
|
82
|
+
typeof block.meta?.pipeline_stage === "string" &&
|
|
83
|
+
typeof block.meta?.pipeline_state_ref === "string" &&
|
|
84
|
+
block.meta.pipeline_stage === unblock.meta?.pipeline_stage &&
|
|
85
|
+
block.meta.pipeline_state_ref === unblock.meta?.pipeline_state_ref);
|
|
86
|
+
}
|
|
87
|
+
function advanceEventOrderState(cur, event) {
|
|
88
|
+
return {
|
|
89
|
+
state: advanceTaskState(cur.state, event),
|
|
90
|
+
lastBy: event.by,
|
|
91
|
+
lastBlock: event.type === "block" ? event : cur.lastBlock,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function isTransitionValidForState(state, lastBy, lastBlock, candidate, remaining) {
|
|
95
|
+
const { type } = candidate;
|
|
96
|
+
if (type === "note" || type === "estimate" || type === "link")
|
|
97
|
+
return true;
|
|
98
|
+
if (state === "todo") {
|
|
99
|
+
if (type === "cancel")
|
|
100
|
+
return true;
|
|
101
|
+
if (type !== "claim")
|
|
102
|
+
return false;
|
|
103
|
+
const otherClaims = remaining.filter((item) => item.event !== candidate && item.event.type === "claim");
|
|
104
|
+
if (otherClaims.length === 0)
|
|
105
|
+
return true;
|
|
106
|
+
const isResumeClaim = candidate.meta?.pipeline_resume_claimed === "true";
|
|
107
|
+
if (isResumeClaim &&
|
|
108
|
+
otherClaims.some((item) => item.event.meta?.pipeline_resume_claimed !== "true")) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
const actorReleasedOrBlocked = (actor) => remaining.some((item) => (item.event.type === "release" || item.event.type === "block") && item.event.by === actor);
|
|
112
|
+
if (!actorReleasedOrBlocked(candidate.by) &&
|
|
113
|
+
otherClaims.some((item) => actorReleasedOrBlocked(item.event.by))) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
if (state === "doing") {
|
|
119
|
+
if (type !== "block" && type !== "complete" && type !== "release" && type !== "cancel") {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
// A resume identifies the block it follows. Prefer that block over a later failure in
|
|
123
|
+
// the same second, regardless of the random suffix in either block's filename.
|
|
124
|
+
if (type === "block") {
|
|
125
|
+
const resumedBlocks = remaining.filter((item) => remaining.some((other) => resumesPipelineBlock(item.event, other.event)));
|
|
126
|
+
if (resumedBlocks.length > 0 && !resumedBlocks.some((item) => item.event === candidate)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (lastBy &&
|
|
131
|
+
candidate.by !== lastBy &&
|
|
132
|
+
remaining.some((item) => (item.event.type === "block" ||
|
|
133
|
+
item.event.type === "complete" ||
|
|
134
|
+
item.event.type === "release" ||
|
|
135
|
+
item.event.type === "cancel") &&
|
|
136
|
+
item.event.by === lastBy)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
if (type === "complete" &&
|
|
140
|
+
remaining.some((item) => item.event.type === "unblock") &&
|
|
141
|
+
!remaining.some((item) => item.event.type === "reopen") &&
|
|
142
|
+
remaining.some((item) => item.event.type === "block" && (!lastBy || item.event.by === lastBy))) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
if (state === "blocked") {
|
|
148
|
+
if (type === "unblock" &&
|
|
149
|
+
lastBlock &&
|
|
150
|
+
!resumesPipelineBlock(lastBlock, candidate) &&
|
|
151
|
+
remaining.some((item) => resumesPipelineBlock(lastBlock, item.event))) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
return type === "unblock" || type === "release" || type === "cancel";
|
|
155
|
+
}
|
|
156
|
+
if (state === "done") {
|
|
157
|
+
return type === "reopen";
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
function orderSameTimestampEventsByState(items) {
|
|
162
|
+
const taskStates = new Map();
|
|
163
|
+
for (let start = 0; start < items.length;) {
|
|
164
|
+
const ts = items[start].event.ts;
|
|
165
|
+
let end = start + 1;
|
|
166
|
+
while (end < items.length && items[end].event.ts === ts)
|
|
167
|
+
end += 1;
|
|
168
|
+
if (end - start === 1) {
|
|
169
|
+
const { event } = items[start];
|
|
170
|
+
const cur = taskStates.get(event.task_id) ?? { state: "todo" };
|
|
171
|
+
taskStates.set(event.task_id, advanceEventOrderState(cur, event));
|
|
172
|
+
start = end;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const byTask = new Map();
|
|
176
|
+
for (let i = start; i < end; i += 1) {
|
|
177
|
+
const taskId = items[i].event.task_id;
|
|
178
|
+
const indices = byTask.get(taskId);
|
|
179
|
+
if (indices)
|
|
180
|
+
indices.push(i);
|
|
181
|
+
else
|
|
182
|
+
byTask.set(taskId, [i]);
|
|
183
|
+
}
|
|
184
|
+
for (const [taskId, indices] of byTask.entries()) {
|
|
185
|
+
let cur = taskStates.get(taskId) ?? { state: "todo" };
|
|
186
|
+
if (indices.length === 1) {
|
|
187
|
+
const { event } = items[indices[0]];
|
|
188
|
+
taskStates.set(taskId, advanceEventOrderState(cur, event));
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const remaining = indices.map((idx) => items[idx]);
|
|
192
|
+
for (const targetIdx of indices) {
|
|
193
|
+
const validIdx = remaining.findIndex((candidate) => isTransitionValidForState(cur.state, cur.lastBy, cur.lastBlock, candidate.event, remaining));
|
|
194
|
+
const [chosen] = remaining.splice(validIdx >= 0 ? validIdx : 0, 1);
|
|
195
|
+
items[targetIdx] = chosen;
|
|
196
|
+
cur = advanceEventOrderState(cur, chosen.event);
|
|
197
|
+
}
|
|
198
|
+
taskStates.set(taskId, cur);
|
|
199
|
+
}
|
|
200
|
+
start = end;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
56
203
|
export function readAllEventFiles(projectPath) {
|
|
57
204
|
const dir = eventsDirForProject(projectPath);
|
|
58
205
|
const files = listFilesRecursive(dir).filter((p) => extname(p).toLowerCase() === ".json");
|
|
@@ -92,6 +239,7 @@ export function readAllEventFiles(projectPath) {
|
|
|
92
239
|
return orderA - orderB;
|
|
93
240
|
return a.path.localeCompare(b.path);
|
|
94
241
|
});
|
|
242
|
+
orderSameTimestampEventsByState(items);
|
|
95
243
|
return items;
|
|
96
244
|
}
|
|
97
245
|
export function buildEvent(type, o) {
|
|
@@ -135,6 +283,17 @@ export function writeEventFile(projectPath, event, dependencies = {}) {
|
|
|
135
283
|
}
|
|
136
284
|
}
|
|
137
285
|
}
|
|
286
|
+
// The actor that owns the claim of a doing/blocked task. Snapshots built before claimed_by existed
|
|
287
|
+
// (or hand-built ones) fall back to last_by.
|
|
288
|
+
export function claimOwnerOf(state) {
|
|
289
|
+
return state?.claimed_by ?? state?.last_by;
|
|
290
|
+
}
|
|
291
|
+
// `exec unblock --take-over` records take_over=true so the unblocking (human) actor becomes the claim
|
|
292
|
+
// owner. A plain unblock keeps the existing owner so the agent run can resume and complete.
|
|
293
|
+
export function isTakeOverEvent(event) {
|
|
294
|
+
const value = event.meta?.take_over;
|
|
295
|
+
return value === true || value === "true";
|
|
296
|
+
}
|
|
138
297
|
export function foldEventsToState(events, schedule, projectPath, initialTasks) {
|
|
139
298
|
const tasks = initialTasks ? { ...initialTasks } : {};
|
|
140
299
|
function ensure(id) {
|
|
@@ -146,6 +305,7 @@ export function foldEventsToState(events, schedule, projectPath, initialTasks) {
|
|
|
146
305
|
if (!schedule.nodes.has(event.task_id))
|
|
147
306
|
continue;
|
|
148
307
|
const cur = ensure(event.task_id);
|
|
308
|
+
const previousOwner = claimOwnerOf(cur);
|
|
149
309
|
cur.last_ts = event.ts;
|
|
150
310
|
cur.last_by = event.by;
|
|
151
311
|
cur.last_type = event.type;
|
|
@@ -190,6 +350,13 @@ export function foldEventsToState(events, schedule, projectPath, initialTasks) {
|
|
|
190
350
|
else
|
|
191
351
|
cur.state = "cancelled";
|
|
192
352
|
}
|
|
353
|
+
if (cur.state === "doing" || cur.state === "blocked") {
|
|
354
|
+
const movesClaim = event.type === "claim" || (event.type === "unblock" && isTakeOverEvent(event));
|
|
355
|
+
cur.claimed_by = movesClaim ? event.by : (previousOwner ?? event.by);
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
delete cur.claimed_by;
|
|
359
|
+
}
|
|
193
360
|
}
|
|
194
361
|
for (const id of schedule.nodes.keys())
|
|
195
362
|
ensure(id);
|
|
@@ -231,7 +398,7 @@ export function computeReadyIds(schedule, snapshot) {
|
|
|
231
398
|
}
|
|
232
399
|
export function findDoingTasksForActor(snapshot, actor) {
|
|
233
400
|
return Object.entries(snapshot.tasks)
|
|
234
|
-
.filter(([, st]) => st.state === "doing" && st
|
|
401
|
+
.filter(([, st]) => st.state === "doing" && claimOwnerOf(st) === actor)
|
|
235
402
|
.map(([taskId]) => taskId)
|
|
236
403
|
.sort();
|
|
237
404
|
}
|
|
@@ -290,8 +457,8 @@ export function canCompleteTask(schedule, snapshot, taskId, actor, override) {
|
|
|
290
457
|
return { ok: false, reason: `task cancelled: ${taskId}` };
|
|
291
458
|
if (state !== "doing")
|
|
292
459
|
return { ok: false, reason: `task is not doing: ${taskId}` };
|
|
293
|
-
if (cur
|
|
294
|
-
return { ok: false, reason: crossActorReason(cur
|
|
460
|
+
if (claimOwnerOf(cur) !== actor && !canOverrideCrossActor(override)) {
|
|
461
|
+
return { ok: false, reason: crossActorReason(claimOwnerOf(cur)) };
|
|
295
462
|
}
|
|
296
463
|
return { ok: true };
|
|
297
464
|
}
|
|
@@ -363,12 +530,12 @@ export function canBlockTask(schedule, snapshot, taskId, actor, override) {
|
|
|
363
530
|
return { ok: false, reason: `task cancelled: ${taskId}` };
|
|
364
531
|
if (state !== "doing")
|
|
365
532
|
return { ok: false, reason: `task is not doing: ${taskId}` };
|
|
366
|
-
if (cur
|
|
367
|
-
return { ok: false, reason: crossActorReason(cur
|
|
533
|
+
if (claimOwnerOf(cur) !== actor && !canOverrideCrossActor(override)) {
|
|
534
|
+
return { ok: false, reason: crossActorReason(claimOwnerOf(cur)) };
|
|
368
535
|
}
|
|
369
536
|
return { ok: true };
|
|
370
537
|
}
|
|
371
|
-
export function canUnblockTask(schedule, snapshot, taskId) {
|
|
538
|
+
export function canUnblockTask(schedule, snapshot, taskId, takeOver) {
|
|
372
539
|
const node = schedule.nodes.get(taskId);
|
|
373
540
|
if (!node)
|
|
374
541
|
return { ok: false, reason: `task not found in schedule: ${taskId}` };
|
|
@@ -386,6 +553,10 @@ export function canUnblockTask(schedule, snapshot, taskId) {
|
|
|
386
553
|
return { ok: false, reason: `task cancelled: ${taskId}` };
|
|
387
554
|
if (state !== "blocked")
|
|
388
555
|
return { ok: false, reason: `task is not blocked: ${taskId}` };
|
|
556
|
+
// Taking over moves the claim away from its owner, so it is limited to humans like --force.
|
|
557
|
+
if (takeOver?.requested && !takeOver.isHuman) {
|
|
558
|
+
return { ok: false, reason: `--take-over requires a human actor: ${taskId}` };
|
|
559
|
+
}
|
|
389
560
|
return { ok: true };
|
|
390
561
|
}
|
|
391
562
|
// release returns a doing/blocked task to todo for re-execution. Only the claiming actor may
|
|
@@ -408,8 +579,8 @@ export function canReleaseTask(schedule, snapshot, taskId, actor, override) {
|
|
|
408
579
|
if (state !== "doing" && state !== "blocked") {
|
|
409
580
|
return { ok: false, reason: `task is not doing or blocked: ${taskId}` };
|
|
410
581
|
}
|
|
411
|
-
if (cur
|
|
412
|
-
return { ok: false, reason: crossActorReason(cur
|
|
582
|
+
if (claimOwnerOf(cur) !== actor && !canOverrideCrossActor(override)) {
|
|
583
|
+
return { ok: false, reason: crossActorReason(claimOwnerOf(cur)) };
|
|
413
584
|
}
|
|
414
585
|
return { ok: true };
|
|
415
586
|
}
|
package/dist/exec/evidence.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join, relative, sep } from "node:path";
|
|
3
|
+
import { runLogPath, runnerRecordPrefixes, taskEvidencePaths, taskRecordPaths, } from "./run-records.js";
|
|
3
4
|
import { ensureDir, redactSensitiveText, safeSlug } from "./shared.js";
|
|
4
|
-
import { gitOutput } from "./worktree.js";
|
|
5
|
+
import { gitOutput, gitResult } from "./worktree.js";
|
|
6
|
+
import { isCondenseRecords } from "../shared/condense-records.js";
|
|
7
|
+
import { loadConfig } from "../shared/specdojo-config.js";
|
|
5
8
|
const MAX_LOG_BYTES = 64 * 1024;
|
|
6
|
-
const MAX_CHANGE_FILES = 1_000;
|
|
9
|
+
export const MAX_CHANGE_FILES = 1_000;
|
|
7
10
|
const MAX_FINAL_MESSAGE_LENGTH = 4_000;
|
|
8
11
|
const MAX_HANDOFF_ITEMS = 100;
|
|
9
12
|
const MAX_HANDOFF_LENGTH = 4_000;
|
|
@@ -108,6 +111,22 @@ export function parseExecutorReport(stdout) {
|
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
}
|
|
114
|
+
const invalidCondense = report.condense_records !== undefined && !isCondenseRecords(report.condense_records);
|
|
115
|
+
if (invalidCondense) {
|
|
116
|
+
report.completion_status = "incomplete";
|
|
117
|
+
report.final_message =
|
|
118
|
+
"Invalid condense_records; supply records matching condense-records.schema.yaml";
|
|
119
|
+
}
|
|
120
|
+
const condenseRecords = isCondenseRecords(report.condense_records)
|
|
121
|
+
? report.condense_records.map((record) => ({
|
|
122
|
+
...record,
|
|
123
|
+
location: boundedText(record.location, 4000),
|
|
124
|
+
reason: boundedText(record.reason, 4000),
|
|
125
|
+
cause: record.cause.type === "kata"
|
|
126
|
+
? { ...record.cause, location: boundedText(record.cause.location, 4000) }
|
|
127
|
+
: record.cause,
|
|
128
|
+
}))
|
|
129
|
+
: undefined;
|
|
111
130
|
const fallback = stdout.replace(REPORT_PATTERN, "").trim();
|
|
112
131
|
const handoff = Array.isArray(report.handoff)
|
|
113
132
|
? report.handoff
|
|
@@ -127,6 +146,7 @@ export function parseExecutorReport(stdout) {
|
|
|
127
146
|
handoff,
|
|
128
147
|
validations,
|
|
129
148
|
targetCoverage,
|
|
149
|
+
...(condenseRecords ? { condenseRecords } : {}),
|
|
130
150
|
};
|
|
131
151
|
}
|
|
132
152
|
/** A successful process or validation batch cannot override an explicit incomplete report. */
|
|
@@ -136,6 +156,39 @@ export function executorCompletionFailure(evidence) {
|
|
|
136
156
|
const detail = boundedText(evidence.final_message, MAX_VALIDATION_SUMMARY_LENGTH);
|
|
137
157
|
return boundedText(detail ? `executor reported incomplete: ${detail}` : "executor reported incomplete", MAX_VALIDATION_SUMMARY_LENGTH);
|
|
138
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns why the executor envelope lacks a field the approach requires, or undefined when the
|
|
161
|
+
* contract holds. Only `condense` currently requires an extra field (`condense_records`).
|
|
162
|
+
*/
|
|
163
|
+
export function executorReportContractFailure(evidence, contract) {
|
|
164
|
+
if (contract.approach !== "condense" || (contract.mode ?? "edit") !== "edit")
|
|
165
|
+
return undefined;
|
|
166
|
+
if (isCondenseRecords(evidence.condense_records))
|
|
167
|
+
return undefined;
|
|
168
|
+
return "executor evidence lacks valid condense_records required by approach condense (report [] when there are no candidates)";
|
|
169
|
+
}
|
|
170
|
+
/** Recovery command for a task whose executor stage must be redone in the kept worktree. */
|
|
171
|
+
export function executorStageResumeHint(target) {
|
|
172
|
+
const command = target.kind === "schedule"
|
|
173
|
+
? `specdojo exec resume --task ${target.taskId} --resume-from executor`
|
|
174
|
+
: `specdojo exec run --register ${target.itemId} --worktree --resume --resume-from executor`;
|
|
175
|
+
return `${command} (add --executor-by <nickname> to switch the executor agent)`;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Checks the approach contract before the reporter stage. On failure the evidence is marked as an
|
|
179
|
+
* incomplete executor report and persisted, so resume selects the executor stage instead of
|
|
180
|
+
* re-running only the reporter on the same evidence.
|
|
181
|
+
*/
|
|
182
|
+
export function enforceExecutorReportContract(input) {
|
|
183
|
+
const failure = executorReportContractFailure(input.evidence, input.contract);
|
|
184
|
+
if (!failure)
|
|
185
|
+
return undefined;
|
|
186
|
+
const reason = boundedText(`${failure}; next: ${input.resumeHint}`, MAX_VALIDATION_SUMMARY_LENGTH);
|
|
187
|
+
input.evidence.completion_status = "incomplete";
|
|
188
|
+
input.evidence.block_reason = reason;
|
|
189
|
+
writeExecutorEvidence(input.evidencePath, input.evidence);
|
|
190
|
+
return reason;
|
|
191
|
+
}
|
|
139
192
|
function normalizedEvidencePath(value) {
|
|
140
193
|
const normalized = value.replaceAll("\\", "/").replace(/^\.\//u, "");
|
|
141
194
|
if (!normalized ||
|
|
@@ -333,6 +386,10 @@ export function buildExecutorEvidence(input) {
|
|
|
333
386
|
summary: truncate(redactSensitiveText(input.diffStat.trim()), MAX_DIFF_SUMMARY_LENGTH),
|
|
334
387
|
},
|
|
335
388
|
validations,
|
|
389
|
+
...(report.condenseRecords ? { condense_records: report.condenseRecords } : {}),
|
|
390
|
+
...(input.localConfigOverrides?.length
|
|
391
|
+
? { local_config_overrides: input.localConfigOverrides.map((item) => ({ ...item })) }
|
|
392
|
+
: {}),
|
|
336
393
|
...(report.targetCoverage.length > 0 ? { target_coverage: report.targetCoverage } : {}),
|
|
337
394
|
...(input.rateLimitEvents?.length ? { rate_limit_events: input.rateLimitEvents } : {}),
|
|
338
395
|
final_message: report.finalMessage,
|
|
@@ -362,10 +419,8 @@ export function buildExecutorEvidence(input) {
|
|
|
362
419
|
export function recordExecutorEvidence(input) {
|
|
363
420
|
const executionRel = repoRelative(input.repoRoot, input.executionPath);
|
|
364
421
|
const runnerManagedPrefixes = [
|
|
365
|
-
|
|
366
|
-
`${executionRel}/exec/results/`,
|
|
422
|
+
...runnerRecordPrefixes(executionRel),
|
|
367
423
|
`${executionRel}/exec/events/`,
|
|
368
|
-
`${executionRel}/exec/evidence/`,
|
|
369
424
|
`${executionRel}/generated/`,
|
|
370
425
|
];
|
|
371
426
|
const productWorktrees = input.productWorktrees ?? [];
|
|
@@ -387,10 +442,9 @@ export function recordExecutorEvidence(input) {
|
|
|
387
442
|
.filter(Boolean)
|
|
388
443
|
.join("\n");
|
|
389
444
|
const executionInWorktree = join(input.worktreePath, executionRel);
|
|
390
|
-
const evidenceDir =
|
|
445
|
+
const { directory: evidenceDir, evidence: evidencePath } = taskEvidencePaths(executionInWorktree, input.taskId, input.runId);
|
|
391
446
|
ensureDir(evidenceDir);
|
|
392
|
-
const logPath =
|
|
393
|
-
const evidencePath = join(evidenceDir, "evidence.json");
|
|
447
|
+
const logPath = runLogPath(evidencePath, "executor.log");
|
|
394
448
|
const { evidence, logExcerpt } = buildExecutorEvidence({
|
|
395
449
|
taskId: input.taskId,
|
|
396
450
|
runId: input.runId,
|
|
@@ -408,6 +462,8 @@ export function recordExecutorEvidence(input) {
|
|
|
408
462
|
logRefPath: repoRelative(input.worktreePath, logPath),
|
|
409
463
|
parentValidations: input.parentValidations,
|
|
410
464
|
rateLimitEvents: input.rateLimitEvents,
|
|
465
|
+
// The runner's own config load (the main working tree) decides what the run used.
|
|
466
|
+
localConfigOverrides: loadConfig(input.repoRoot).localOverrides,
|
|
411
467
|
});
|
|
412
468
|
writeFileSync(logPath, logExcerpt, "utf8");
|
|
413
469
|
writeFileSync(evidencePath, `${JSON.stringify(evidence, null, 2)}\n`, "utf8");
|
|
@@ -417,25 +473,27 @@ export function recordExecutorEvidence(input) {
|
|
|
417
473
|
export function recordCommandEvidence(input) {
|
|
418
474
|
const executionRel = repoRelative(input.repoRoot, input.executionPath);
|
|
419
475
|
const runnerManagedPrefixes = [
|
|
420
|
-
|
|
421
|
-
`${executionRel}/exec/results/`,
|
|
476
|
+
...runnerRecordPrefixes(executionRel),
|
|
422
477
|
`${executionRel}/exec/events/`,
|
|
423
|
-
`${executionRel}/exec/evidence/`,
|
|
424
478
|
`${executionRel}/generated/`,
|
|
425
479
|
];
|
|
426
|
-
const
|
|
480
|
+
const inGit = gitResult(input.worktreePath, ["rev-parse", "--is-inside-work-tree"]).status === 0;
|
|
481
|
+
const changes = (inGit ? parseStatusPaths(input.worktreePath) : [])
|
|
427
482
|
.filter((change) => runnerManagedPrefixes.every((prefix) => !change.path.startsWith(prefix)))
|
|
428
483
|
.slice(0, MAX_CHANGE_FILES)
|
|
429
484
|
.map((change) => ({
|
|
430
485
|
path: boundedText(change.path, 1_000),
|
|
431
486
|
status: boundedText(change.status, 40),
|
|
432
487
|
}));
|
|
433
|
-
const
|
|
434
|
-
const
|
|
488
|
+
const hasHead = inGit && gitResult(input.worktreePath, ["rev-parse", "--verify", "HEAD"]).status === 0;
|
|
489
|
+
const diffStat = inGit
|
|
490
|
+
? gitOutput(input.worktreePath, ["diff", "--stat", ...(hasHead ? ["HEAD"] : []), "--"])
|
|
491
|
+
: "";
|
|
492
|
+
const evidenceDir = taskRecordPaths(join(input.worktreePath, executionRel), input.taskId, input.runId).directory;
|
|
435
493
|
ensureDir(evidenceDir);
|
|
436
|
-
const
|
|
437
|
-
const
|
|
438
|
-
const
|
|
494
|
+
const evidencePath = taskRecordPaths(join(input.worktreePath, executionRel), input.taskId, input.runId).evidence;
|
|
495
|
+
const stdoutPath = runLogPath(evidencePath, "command.stdout.log");
|
|
496
|
+
const stderrPath = runLogPath(evidencePath, "command.stderr.log");
|
|
439
497
|
const boundedStdout = boundedLog(input.stdout);
|
|
440
498
|
const boundedStderr = boundedLog(input.stderr);
|
|
441
499
|
writeFileSync(stdoutPath, boundedStdout.content, "utf8");
|
|
@@ -537,7 +595,7 @@ export function recordParentValidationFailureOutput(input) {
|
|
|
537
595
|
const attempt = Math.max(0, ...priorAttempts) + 1;
|
|
538
596
|
const refs = [];
|
|
539
597
|
for (const output of input.failureOutputs) {
|
|
540
|
-
const logPath =
|
|
598
|
+
const logPath = runLogPath(input.evidencePath, `parent-validation-attempt-${attempt}-${safeSlug(output.label)}.log`);
|
|
541
599
|
const content = redactSensitiveText([
|
|
542
600
|
`parent validation: ${output.label}`,
|
|
543
601
|
`exit code: ${output.exitCode ?? "unknown"}`,
|
|
@@ -577,7 +635,7 @@ export function recordReporterFailureOutput(input) {
|
|
|
577
635
|
input.invocationOutputs.forEach((output, index) => {
|
|
578
636
|
const attempt = index + 1;
|
|
579
637
|
for (const stream of ["stdout", "stderr"]) {
|
|
580
|
-
const logPath =
|
|
638
|
+
const logPath = runLogPath(input.evidencePath, `reporter-attempt-${attempt}.${stream}.log`);
|
|
581
639
|
const boundedOutput = boundedLog(output[stream]);
|
|
582
640
|
writeFileSync(logPath, boundedOutput.content, "utf8");
|
|
583
641
|
reporterRefs.push({
|
package/dist/exec/handoff.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
import {
|
|
2
|
+
import { lstatSync, mkdtempSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
|
-
import { createInterface } from "node:readline/promises";
|
|
5
4
|
import { join, posix, resolve } from "node:path";
|
|
5
|
+
import { createInterface } from "node:readline/promises";
|
|
6
|
+
import { parseSpecdojoDocument } from "../docs/frontmatter-namespace.js";
|
|
7
|
+
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
6
8
|
import { isAgentProtectedConfigPath } from "./agent-protected-config.js";
|
|
7
9
|
import { PROTECTION_HANDOFF_MARKER } from "./protection-handoff.js";
|
|
8
10
|
import { normalizePjrId, resolveRegisterRunTarget } from "./register.js";
|
|
9
11
|
import { refsTrailer, withCommitTrailers } from "./repo-trace.js";
|
|
10
|
-
import {
|
|
11
|
-
import { parseSpecdojoDocument } from "../docs/frontmatter-namespace.js";
|
|
12
|
+
import { listRunRecords } from "./run-records.js";
|
|
12
13
|
import { qualifyTaskId } from "./shared.js";
|
|
13
|
-
import {
|
|
14
|
+
import { configuredProductReposForProject } from "./task-repos.js";
|
|
15
|
+
import { stabilizeCommitTargets, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, } from "./worktree-ops.js";
|
|
14
16
|
import { findExecWorktree, formatGitResultFailure, gitEnvironment, gitOutput, gitResult, } from "./worktree.js";
|
|
15
|
-
import { stageCommitTargets, stabilizeCommitTargets, unstageCommitTargets, worktreeStatusPaths, } from "./worktree-ops.js";
|
|
16
17
|
const HANDOFF_MECHANISM = "agent-config-write";
|
|
17
18
|
const TRUNCATED_EVIDENCE_RE = /^\.\.\. \((?:\d+ 行を省略|文字数上限で切り詰め)\)$/m;
|
|
18
19
|
function sectionAfterMarker(content) {
|
|
@@ -56,13 +57,8 @@ export function extractProtectedConfigHandoff(content) {
|
|
|
56
57
|
return { subjects, patch: `${patch}\n` };
|
|
57
58
|
}
|
|
58
59
|
function latestResultForTask(executionPath, taskId) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
throw new Error(`Result directory not found: ${resultsDir}`);
|
|
62
|
-
const candidates = readdirSync(resultsDir)
|
|
63
|
-
.filter((name) => name.endsWith("-result.md"))
|
|
64
|
-
.flatMap((name) => {
|
|
65
|
-
const path = join(resultsDir, name);
|
|
60
|
+
const candidates = listRunRecords(executionPath, "result")
|
|
61
|
+
.flatMap((path) => {
|
|
66
62
|
const data = parseSpecdojoDocument(readFileSync(path, "utf8")).data;
|
|
67
63
|
if (data.task_id !== taskId)
|
|
68
64
|
return [];
|
package/dist/exec/limit.js
CHANGED
|
@@ -247,7 +247,7 @@ function deferredTask(taskId, state, now) {
|
|
|
247
247
|
const attempts = attemptsText && /^\d+$/.test(attemptsText) ? Number.parseInt(attemptsText, 10) : 0;
|
|
248
248
|
return {
|
|
249
249
|
taskId,
|
|
250
|
-
actor: state.last_by ?? "",
|
|
250
|
+
actor: state.claimed_by ?? state.last_by ?? "",
|
|
251
251
|
kind,
|
|
252
252
|
resumeAt: resumeAt.toISOString(),
|
|
253
253
|
attempts,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MAX_TEXT_LENGTH } from "./reporter-output.js";
|
|
2
|
+
import { deriveReporterFacts } from "./reporter.js";
|
|
3
|
+
const MAX_SUMMARY_ITEMS = 100;
|
|
4
|
+
export const MECHANICAL_RESULT_APPROACH = "reporter を使わず、runner が executor の報告(`final_message`・`handoff`)と証跡から機械的に作成した(`pipeline.mechanical_result`)。";
|
|
5
|
+
function bounded(text) {
|
|
6
|
+
return text.length <= MAX_TEXT_LENGTH ? text : `${text.slice(0, MAX_TEXT_LENGTH - 1)}…`;
|
|
7
|
+
}
|
|
8
|
+
// executor の `final_message` は箇条書きや複数行の要約になることがある。行頭の箇条書きの記号を
|
|
9
|
+
// 外し、1 行を実施内容の 1 項目にする。
|
|
10
|
+
function summaryItems(finalMessage) {
|
|
11
|
+
return finalMessage
|
|
12
|
+
.split(/\r?\n/)
|
|
13
|
+
.map((line) => line.replace(/^\s*(?:[-*+]|\d+\.)\s+/, "").trim())
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.slice(0, MAX_SUMMARY_ITEMS)
|
|
16
|
+
.map(bounded);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* PJR-T01P: the edit result fields the runner can fill without the reporter agent. Returns
|
|
20
|
+
* `undefined` when a field needs summarising or judgement, so the caller runs the reporter:
|
|
21
|
+
* review mode (verdict), a blocked outcome (the reporter explains partial work), or an executor
|
|
22
|
+
* report without `final_message`.
|
|
23
|
+
*
|
|
24
|
+
* - `summary`: the lines of the executor's `final_message`.
|
|
25
|
+
* - `changed_files`: empty; the renderer lists the evidence changes with git line counts.
|
|
26
|
+
* - `handoff`: empty; the renderer keeps the executor `handoff` and the runner-derived notes.
|
|
27
|
+
* - `approach`: a fixed sentence stating that the runner wrote the result.
|
|
28
|
+
*/
|
|
29
|
+
export function mechanicalEditReporterOutput(evidence, mode = "edit") {
|
|
30
|
+
if (mode !== "edit")
|
|
31
|
+
return undefined;
|
|
32
|
+
const summary = summaryItems(evidence.final_message ?? "");
|
|
33
|
+
if (summary.length === 0)
|
|
34
|
+
return undefined;
|
|
35
|
+
if (deriveReporterFacts(evidence, { mode }).outcome !== "complete")
|
|
36
|
+
return undefined;
|
|
37
|
+
return {
|
|
38
|
+
schema_version: 1,
|
|
39
|
+
mode: "edit",
|
|
40
|
+
summary,
|
|
41
|
+
changed_files: [],
|
|
42
|
+
handoff: [],
|
|
43
|
+
approach: MECHANICAL_RESULT_APPROACH,
|
|
44
|
+
};
|
|
45
|
+
}
|