specdojo 0.7.0 → 0.8.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 +3 -2
- package/CHANGELOG.md +153 -0
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/init.js +5 -1
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +612 -259
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +8 -6
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +9 -4
- package/dist/devcontainer/scaffold.js +18 -0
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/yaml-pages.js +125 -3
- package/dist/exec/agent-config.js +22 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/commands.js +69 -21
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +159 -8
- package/dist/exec/evidence.js +64 -16
- 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 +153 -12
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +24 -17
- package/dist/exec/plans-generation.js +48 -25
- 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/register-resume.js +55 -56
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +8 -4
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +85 -24
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +109 -0
- package/dist/exec/run/agent-pipeline.js +75 -6
- package/dist/exec/run/agent.js +20 -7
- package/dist/exec/run/in-place.js +69 -32
- package/dist/exec/run/job.js +81 -24
- package/dist/exec/run/lifecycle-commands.js +188 -36
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +6 -10
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +12 -12
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +28 -18
- package/dist/exec/run/register-state.js +10 -7
- package/dist/exec/run/register-worktree.js +60 -30
- package/dist/exec/run/schedule-mode.js +4 -4
- package/dist/exec/run/schedule-prepare.js +201 -59
- package/dist/exec/run/schedule-task.js +129 -25
- package/dist/exec/run/shared.js +4 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/strategy.js +1 -0
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +3 -2
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/worktree-command.js +29 -16
- 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 +19 -2
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-inspect.js +2 -2
- package/dist/grade/command-run.js +2 -0
- 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 +23 -3
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/job.js +31 -17
- package/dist/job/noop.js +104 -0
- 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 +4 -1
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +43 -9
- 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 +4 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +56 -32
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +1 -0
- 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 +2 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/deprecation.js +8 -0
- 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.js +142 -15
- package/dist/shared/grade-result.js +17 -1
- 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 +39 -21
- package/dist/shared/text.js +65 -5
- package/dist/shared/timeline-index.js +2 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +9 -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 +47 -16
- package/docs/ja/specdojo/guides/exec-operation-guide.md +53 -17
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- 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 +70 -14
- package/docs/ja/specdojo/guides/register-operation-guide.md +25 -5
- 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 +14 -8
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +7 -4
- 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/recipes/bac-recipe.md +94 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +105 -0
- package/docs/ja/specdojo/recipes/br-recipe.md +84 -0
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +36 -24
- package/docs/ja/specdojo/recipes/cnd-recipe.md +125 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +126 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +134 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +135 -86
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +130 -0
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +29 -26
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +35 -26
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +38 -28
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +39 -31
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +26 -28
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +10 -8
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +18 -17
- package/docs/ja/specdojo/recipes/stsd-recipe.md +100 -62
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +106 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +137 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +122 -0
- package/docs/ja/specdojo/references/command-reference.md +79 -64
- package/docs/ja/specdojo/references/deliverables-reference.md +9 -4
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +17 -16
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +72 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +212 -79
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +138 -154
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +147 -59
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +100 -96
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +88 -108
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +126 -211
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +56 -35
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +102 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +152 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +187 -0
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +93 -247
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +104 -241
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +124 -257
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +87 -98
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +9 -7
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +193 -0
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +100 -54
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +69 -252
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +91 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +252 -226
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +118 -40
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +9 -9
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +4 -4
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +4 -3
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +34 -29
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +8 -8
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +2 -2
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +50 -56
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +46 -55
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +57 -54
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +50 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +2 -2
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +70 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +47 -56
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -135
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +116 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +118 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +152 -57
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +51 -39
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +101 -46
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +72 -329
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +74 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +78 -195
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +3 -4
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +3 -3
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +140 -143
- 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 +100 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +59 -20
- package/docs/ja/specdojo/samples/bes-sample.md +80 -21
- package/docs/ja/specdojo/samples/br-sample.md +68 -14
- package/docs/ja/specdojo/samples/ccd-sample.md +81 -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/cdsd-sample.md +89 -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 +132 -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/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-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/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +52 -20
- package/docs/ja/specdojo/samples/pm-plan-sample.md +84 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +55 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +69 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +50 -26
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +89 -62
- package/docs/ja/specdojo/samples/sf-index-sample.md +89 -20
- package/docs/ja/specdojo/samples/sf-sample.md +121 -21
- package/docs/ja/specdojo/samples/sld-sample.md +107 -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 +164 -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/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/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 +3 -0
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +53 -3
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +3 -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/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/package.json +2 -2
- package/templates/antigravity/orchestrator.md +3 -2
- package/templates/claude/agents/specdojo-orchestrator.md +3 -2
- package/templates/codex/agents/specdojo-orchestrator.toml +3 -2
- package/templates/codex/orchestrator.md +3 -2
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +3 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { gradeFindingDisplayMessage } from "../shared/grade-result.js";
|
|
2
|
+
import { findingCause } from "../shared/finding-cause.js";
|
|
2
3
|
// 引用した文書や finding 本文の Markdown を、plan 自身のリンクとして解釈させない。
|
|
3
|
-
function inlineCode(value) {
|
|
4
|
+
export function inlineCode(value) {
|
|
4
5
|
const text = value.replace(/\r\n?|\n/g, " ").trim();
|
|
5
6
|
const longestRun = Math.max(0, ...(text.match(/`+/g) ?? []).map((run) => run.length));
|
|
6
7
|
const delimiter = "`".repeat(longestRun + 1);
|
|
@@ -8,9 +9,13 @@ function inlineCode(value) {
|
|
|
8
9
|
const padding = /^`|`$/.test(text) ? " " : "";
|
|
9
10
|
return `${delimiter}${padding}${text}${padding}${delimiter}`;
|
|
10
11
|
}
|
|
11
|
-
export function planGradeFindingText(finding) {
|
|
12
|
+
export function planGradeFindingText(finding, includeCause = false) {
|
|
12
13
|
const anchor = inlineCode(JSON.stringify(finding.anchor));
|
|
13
14
|
const message = inlineCode(gradeFindingDisplayMessage(finding));
|
|
14
15
|
// register の箇条書き先頭でも [判定情報]: 本文 が参照リンク定義にならないようにする。
|
|
15
|
-
|
|
16
|
+
const cause = findingCause(finding);
|
|
17
|
+
const causeText = includeCause
|
|
18
|
+
? `; cause=${cause.type === "kata" ? `kata:${cause.kind}; location=${inlineCode(cause.location)}` : "document"}`
|
|
19
|
+
: "";
|
|
20
|
+
return `\\[${finding.severity}/${finding.rule}; line=${finding.line}; anchor=${anchor}${causeText}\\]: ${message}`;
|
|
16
21
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { resolveKataRefs } from "../kata/kata.js";
|
|
4
|
+
import { isGeneratedGradeTarget, isTrashedGradeTarget, resolveSafeMarkdownPath, } from "../grade/targets.js";
|
|
5
|
+
import { listFilesRecursive } from "../shared/fs.js";
|
|
6
|
+
import { gradeContentHash, gradeResultPathForDocument, readGradeResult, resolveGradeResultsDirectory, } from "../shared/grade-result.js";
|
|
7
|
+
import { readSpecdojoNamespace } from "../docs/frontmatter-namespace.js";
|
|
8
|
+
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
9
|
+
import { MISSING } from "../shared/plan-templates.js";
|
|
10
|
+
import { inlineCode, planGradeFindingText } from "./plans-grade-findings.js";
|
|
11
|
+
import { condenseKataFindingsText } from "./plans-condense-findings.js";
|
|
12
|
+
/** Pull current deliverable findings into maintenance of the declared Kata. */
|
|
13
|
+
export function kataCauseFindingsText(projectId, kind, kataPath) {
|
|
14
|
+
if (!kataPath || kataPath === MISSING)
|
|
15
|
+
return "- なし";
|
|
16
|
+
const root = specdojoRootDir();
|
|
17
|
+
const lines = condenseKataFindingsText(projectId, kind, kataPath);
|
|
18
|
+
let sidecars;
|
|
19
|
+
try {
|
|
20
|
+
sidecars = listFilesRecursive(resolveGradeResultsDirectory(projectId)).sort();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
sidecars = [];
|
|
24
|
+
}
|
|
25
|
+
for (const sidecar of sidecars) {
|
|
26
|
+
if (!/\.ya?ml$/.test(sidecar))
|
|
27
|
+
continue;
|
|
28
|
+
try {
|
|
29
|
+
const result = readGradeResult(sidecar);
|
|
30
|
+
if (!result || result.target !== "deliverable")
|
|
31
|
+
continue;
|
|
32
|
+
const path = resolveSafeMarkdownPath(result.path, root, projectId);
|
|
33
|
+
if (isGeneratedGradeTarget(path, root) || isTrashedGradeTarget(path, root))
|
|
34
|
+
continue;
|
|
35
|
+
const content = readFileSync(path, "utf8");
|
|
36
|
+
if (gradeContentHash(content) !== result.content_hash)
|
|
37
|
+
continue;
|
|
38
|
+
// Historical copies and moved documents must not resurrect superseded findings.
|
|
39
|
+
if (resolve(gradeResultPathForDocument({ documentPath: path, project: projectId })) !==
|
|
40
|
+
resolve(sidecar))
|
|
41
|
+
continue;
|
|
42
|
+
const metadata = readSpecdojoNamespace(content);
|
|
43
|
+
if (metadata.id !== result.document)
|
|
44
|
+
continue;
|
|
45
|
+
const rulebook = typeof metadata?.rulebook === "string" ? metadata.rulebook : undefined;
|
|
46
|
+
const refs = resolveKataRefs(rulebook);
|
|
47
|
+
if (refs[kind] === MISSING || resolve(root, refs[kind]) !== resolve(root, kataPath))
|
|
48
|
+
continue;
|
|
49
|
+
for (const finding of result.findings) {
|
|
50
|
+
if (finding.cause?.type !== "kata" || finding.cause.kind !== kind)
|
|
51
|
+
continue;
|
|
52
|
+
lines.push(`- source=grade; ${inlineCode(result.document)} (${inlineCode(result.path)}) ${inlineCode(finding.id)} ${planGradeFindingText(finding, true)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Missing, unreadable, or invalid source results are not evidence for a Kata edit.
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return lines.join("\n") || "- なし";
|
|
61
|
+
}
|
|
@@ -5,7 +5,7 @@ import { loadTemplatesForDomain, resolvePlanPath } from "../catalog/plan.js";
|
|
|
5
5
|
import { resolveSpecdojoPath } from "../docs/template-resolution.js";
|
|
6
6
|
import { resolveKataRefs } from "../kata/kata.js";
|
|
7
7
|
import { planningTarget } from "../register/planning.js";
|
|
8
|
-
import { getProjectSchedulePath,
|
|
8
|
+
import { getProjectSchedulePath, getProjectRegisterPath, } from "../shared/specdojo-config.js";
|
|
9
9
|
export function planningPlanFields(opts) {
|
|
10
10
|
const unit = planningTarget(opts.approach, opts.target);
|
|
11
11
|
const path = (file) => relative(opts.repoRoot, file).replaceAll("\\", "/");
|
|
@@ -33,11 +33,11 @@ export function planningPlanFields(opts) {
|
|
|
33
33
|
if (templates.length === 0)
|
|
34
34
|
throw new Error(`No catalog template found for domain '${unit}'`);
|
|
35
35
|
const plan = path(resolvePlanPath(opts.catalogPath, unit));
|
|
36
|
-
common.push("### 判定・生成手順と完了条件", "", ...templates.map((template) => `- domain の雛形: \`${template.template.id}\`(\`${template.relPath}\`)`), "", `1. \`specdojo catalog plan prompt ${projectArg} --domain ${unit}\` を実行し、その入力文書・判定規約に従う。データフローがない場合は、個票が指定する上流資料を \`--input <path>\` で明示する。入力不足なら停止して必要資料を申し送る。`, "2. agent の判定を YAML に出力する。インスタンス・根拠・除外・未確定事項を記録する。既存カタログと kata を優先して参照し、テンプレート由来の構造を独自に再作成しない。", `3. \`specdojo catalog plan scaffold ${projectArg} --domain ${unit} --from <agent-output>.yaml\` で \`${plan}\` に検証保存する。prompt に入力を追加した場合は同じ \`--input\` を渡す。`, `4. \`specdojo catalog plan validate ${projectArg} --domain ${unit}\` を通す。blocking な \`open_questions\` を解消する。`, `5. \`specdojo catalog scaffold ${projectArg} --domain ${unit} --plan\` で \`dct-${unit}.yaml\`(物理分割時は全 part)を生成する。\`dct-index.yaml\` の \`size\` がない場合は個票の範囲に合わせて \`--size <small|medium|large>\` を明示する。既存ファイルは差分を確認し、必要な場合だけ \`--force\` を使う。`, `6. \`specdojo catalog validate ${projectArg}\` を通す。先に \`dct-index.yaml\` の全 domain の索引を整備し、生成した domain を登録する(物理分割も同じ domain の一項目とする)。判定計画とカタログの保存、参照・依存・完了条件の整合を完了基準とする。`, "7. 個票の作業内容・対応結果と実行記録に判断・検証結果を記録する。todo の close は runner と人が行う。close 後の `
|
|
36
|
+
common.push("### 判定・生成手順と完了条件", "", ...templates.map((template) => `- domain の雛形: \`${template.template.id}\`(\`${template.relPath}\`)`), "", `1. \`specdojo catalog plan prompt ${projectArg} --domain ${unit}\` を実行し、その入力文書・判定規約に従う。データフローがない場合は、個票が指定する上流資料を \`--input <path>\` で明示する。入力不足なら停止して必要資料を申し送る。`, "2. agent の判定を YAML に出力する。インスタンス・根拠・除外・未確定事項を記録する。既存カタログと kata を優先して参照し、テンプレート由来の構造を独自に再作成しない。", `3. \`specdojo catalog plan scaffold ${projectArg} --domain ${unit} --from <agent-output>.yaml\` で \`${plan}\` に検証保存する。prompt に入力を追加した場合は同じ \`--input\` を渡す。`, `4. \`specdojo catalog plan validate ${projectArg} --domain ${unit}\` を通す。blocking な \`open_questions\` を解消する。`, `5. \`specdojo catalog scaffold ${projectArg} --domain ${unit} --plan\` で \`dct-${unit}.yaml\`(物理分割時は全 part)を生成する。\`dct-index.yaml\` の \`size\` がない場合は個票の範囲に合わせて \`--size <small|medium|large>\` を明示する。既存ファイルは差分を確認し、必要な場合だけ \`--force\` を使う。`, `6. \`specdojo catalog validate ${projectArg}\` を通す。先に \`dct-index.yaml\` の全 domain の索引を整備し、生成した domain を登録する(物理分割も同じ domain の一項目とする)。判定計画とカタログの保存、参照・依存・完了条件の整合を完了基準とする。`, "7. `evidence_refs` がある成果物は参照先を読み、状態遷移・判定・検証の本体を含むファイルが参照にあるか確認する。re-export だけのファイルを根拠にせず、転送先をたどって本体を特定する。不足する本体の参照を補い、`catalog validate` を再実行する。確認した本体のパス・判断根拠・未確認範囲を記録する。", "8. 個票の作業内容・対応結果と実行記録に判断・検証結果を記録する。todo の close は runner と人が行う。close 後の `dashboard build` がカタログの状態を導出する。`tml-index.yaml` は変更しない。");
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
39
|
const strategy = join(getProjectSchedulePath(opts.project), `sch-strategy-${unit}.yaml`).replaceAll("\\", "/");
|
|
40
|
-
common.push("### scope・intent の宣言と完了条件", "", `1. \`${
|
|
40
|
+
common.push("### scope・intent の宣言と完了条件", "", `1. \`${getProjectRegisterPath(opts.project) ?? "controls/project-register"}\` の対象 track を担う epic の domains と depends_on を確認する。範囲は既存 strategy の scope、epic の domains、互換用 tml-index.yaml の順で解決する。\`dashboard build\` のカタログ検出と既存カタログも確認する。`, `2. \`${strategy}\` に \`scope.catalogs\`(ID・リポジトリルートからのパス)、\`scope.include_kinds\` と \`approach_rules\` を宣言する。既存 scope の意図を保ち、各成果物の \`local_ids\` と \`intent\`(例: author-deliverable / bootstrap-kata-set / confirm-deliverable)、必要時の \`kata_target\` / \`bootstrap_scope\` を根拠付きで決める。`, "3. 主担当を `owner_rules` または生成時の `--owner` / `--default-owner` で明示する。`done_criteria.roles` を主担当と解釈しない。必要な kata の grade が不足なら先に評価し、不明な判断を推測で補わない。", " 人の文脈記入から始める場合は `intent: draft-with-context` を選ぶ。必要な kata がすべて利用可能なら `draft` profile(context → draft → refine → condense → review → finalize)になる。context と finalize は human、他は agent とし、refine は `fully-guided` で磨き込む。", ` context の担当者は \`specdojo exec claim ${projectArg} --task <context-task-id> --by <human>\` で着手し、\`specdojo deliverable scaffold ${projectArg} --target <doc-id>\` で雛形を作る。既存成果物は上書きしない。本文の \`_CONTEXT_:\` に固定前提・制約・調査や選定を任せる範囲を書く(例: \`_CONTEXT_: 既存 API を維持し、認証方式の候補を調べて提案してほしい。\`)。result に記入内容を残して \`specdojo exec complete ${projectArg} --task <context-task-id> --by <human>\` で draft へ渡す。human 用の plan は生成しない。`, `4. \`specdojo schedule strategy generate ${projectArg} --track ${unit}\` を実行し、scope・intent・担当・依存関係に関するエラーを解消する。既存 strategy の変更は差分を確認し、必要な場合だけ \`--force\` を指定する。`, `5. \`specdojo schedule build ${projectArg} --track ${unit}\` を通し、\`sch-track-${unit}.yaml\` が生成され、scope の成果物とタスクの対応・依存が一致することを確認する。`, "6. strategy と track の保存、scope 全件の intent と担当の解決、生成・検証の成功を完了基準とし、個票の作業内容・対応結果と実行記録へ判断と検証を記録する。カタログ本体と `tml-index.yaml` は変更しない。");
|
|
41
41
|
}
|
|
42
42
|
return { refs, conditions: common.join("\n") };
|
|
43
43
|
}
|
|
@@ -1,47 +1,35 @@
|
|
|
1
|
-
import { existsSync,
|
|
1
|
+
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
2
2
|
import { join, relative } from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import { nowUtcIsoSeconds, randomHex, tsForFilenameUtc } from "./shared.js";
|
|
3
|
+
import { lookupDocIndex } from "../docs/doc-index.js";
|
|
5
4
|
import { readSpecdojoNamespace } from "../docs/frontmatter-namespace.js";
|
|
6
5
|
import { gradeResultPathForDocument, readGradeResultForDocument } from "../shared/grade-result.js";
|
|
7
|
-
import {
|
|
6
|
+
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
7
|
+
import { readPlanFile } from "../shared/plan-conventions.js";
|
|
8
8
|
import { planGradeFindingText } from "./plans-grade-findings.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const from =
|
|
9
|
+
import { recordPathForRead } from "./run-records.js";
|
|
10
|
+
export function archivePlan(opts) {
|
|
11
|
+
const from = recordPathForRead(opts.executionPath, "plan", opts.slug);
|
|
12
12
|
if (!existsSync(from))
|
|
13
13
|
throw new Error(`plan not found: ${from}`);
|
|
14
14
|
if (opts.delete) {
|
|
15
15
|
rmSync(from, { force: true });
|
|
16
16
|
return { from, deleted: true };
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
mkdirSync(doneDir, { recursive: true });
|
|
20
|
-
const now = dependencies.now ?? nowUtcIsoSeconds;
|
|
21
|
-
const makeRandomHex = dependencies.randomHex ?? randomHex;
|
|
22
|
-
const stamp = tsForFilenameUtc(now());
|
|
23
|
-
const base = `${opts.slug}-${stamp}-${makeRandomHex(4)}`;
|
|
24
|
-
let sequence = 0;
|
|
25
|
-
let to = join(doneDir, `${base}-plan.md`);
|
|
26
|
-
while (existsSync(to)) {
|
|
27
|
-
sequence += 1;
|
|
28
|
-
to = join(doneDir, `${base}-${sequence}-plan.md`);
|
|
29
|
-
}
|
|
30
|
-
renameSync(from, to);
|
|
31
|
-
return { from, to, deleted: false };
|
|
18
|
+
return { from, to: from, deleted: false };
|
|
32
19
|
}
|
|
33
20
|
export function planPathForTask(executionPath, taskId) {
|
|
34
|
-
return
|
|
21
|
+
return recordPathForRead(executionPath, "plan", taskId);
|
|
35
22
|
}
|
|
36
23
|
export function loadPlan(executionPath, taskId) {
|
|
37
24
|
const planPath = planPathForTask(executionPath, taskId);
|
|
38
25
|
if (existsSync(planPath))
|
|
39
|
-
return
|
|
26
|
+
return readPlanFile(planPath);
|
|
40
27
|
return null;
|
|
41
28
|
}
|
|
42
29
|
const PLAN_APPROACHES = [
|
|
43
30
|
"draft",
|
|
44
31
|
"fully-guided",
|
|
32
|
+
"condense",
|
|
45
33
|
"recipe-guided",
|
|
46
34
|
"freeform",
|
|
47
35
|
"bootstrap",
|
|
@@ -79,7 +67,7 @@ export function parsePlanTaskIdentity(planContent) {
|
|
|
79
67
|
? parsed.targets.filter((entry) => typeof entry === "string")
|
|
80
68
|
: [];
|
|
81
69
|
// 未知の値は採用せず undefined(= schedule)として扱う。
|
|
82
|
-
const origin = parsed.origin === "register" || parsed.origin === "schedule"
|
|
70
|
+
const origin = parsed.origin === "register" || parsed.origin === "schedule" || parsed.origin === "job"
|
|
83
71
|
? parsed.origin
|
|
84
72
|
: undefined;
|
|
85
73
|
return {
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import { existsSync
|
|
2
|
-
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { loadPipelineResumeCheckpoint } from "./pipeline-state.js";
|
|
4
|
-
import {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { integratedRepoNames, loadPipelineResumeCheckpoint, } from "./pipeline-state.js";
|
|
4
|
+
import { recordStem, resumeStatePaths, runEvidencePath, taskRecordPaths } from "./run-records.js";
|
|
5
|
+
// 統合の段が止まった run を executor へ戻せない理由を返す。統合が成功済み、または一部の
|
|
6
|
+
// リポジトリを統合済みの run を戻すと、統合済みの成果と食い違うため止める。
|
|
7
|
+
function integratedRunBlocker(state) {
|
|
8
|
+
const integrate = state.stages.integrate;
|
|
9
|
+
if (integrate?.status === "succeeded") {
|
|
10
|
+
return `cannot resume the executor after the integration of run ${state.run_id} succeeded`;
|
|
11
|
+
}
|
|
12
|
+
const integrated = [...integratedRepoNames(state)].sort();
|
|
13
|
+
if (integrated.length > 0) {
|
|
14
|
+
return (`cannot resume the executor from the integrate stage of run ${state.run_id}: ` +
|
|
15
|
+
`already integrated repositories: ${integrated.join(", ")}`);
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
5
19
|
function executorResumeHandoff(evidence) {
|
|
6
20
|
if (!evidence)
|
|
7
21
|
return [];
|
|
@@ -23,22 +37,16 @@ function executorResumeHandoff(evidence) {
|
|
|
23
37
|
}
|
|
24
38
|
export function registerEvidenceDir(input) {
|
|
25
39
|
const executionRel = relative(input.repoRoot, input.executionPath);
|
|
26
|
-
return join(input.worktreePath, executionRel,
|
|
40
|
+
return dirname(taskRecordPaths(join(input.worktreePath, executionRel), input.taskId).directory);
|
|
27
41
|
}
|
|
28
42
|
// worktree に残っている run ディレクトリを読み、pipeline-state.json を持つものを候補にする。
|
|
29
43
|
// 壊れた state・別 task の state は loadPipelineResumeCheckpoint が弾くため、ここでは黙って
|
|
30
44
|
// 候補から外す(再開可否の判定は selectResumableRegisterRun が理由つきで行う)。
|
|
31
45
|
export function loadRegisterResumeCandidates(input) {
|
|
32
|
-
const
|
|
33
|
-
if (!existsSync(evidenceDir))
|
|
34
|
-
return [];
|
|
35
|
-
const runIds = readdirSync(evidenceDir, { withFileTypes: true })
|
|
36
|
-
.filter((entry) => entry.isDirectory())
|
|
37
|
-
.map((entry) => entry.name)
|
|
38
|
-
.sort();
|
|
46
|
+
const executionPath = join(input.worktreePath, relative(input.repoRoot, input.executionPath));
|
|
39
47
|
const candidates = [];
|
|
40
|
-
for (const
|
|
41
|
-
const
|
|
48
|
+
for (const statePath of resumeStatePaths(executionPath, input.taskId)) {
|
|
49
|
+
const runId = basename(dirname(statePath));
|
|
42
50
|
if (!existsSync(statePath))
|
|
43
51
|
continue;
|
|
44
52
|
const stateRef = relative(input.worktreePath, statePath).split(sep).join("/");
|
|
@@ -59,9 +67,7 @@ export function loadRegisterResumeCandidates(input) {
|
|
|
59
67
|
...(checkpoint.evidence
|
|
60
68
|
? {
|
|
61
69
|
evidenceRef: checkpoint.state.stages.executor.artifact_ref ??
|
|
62
|
-
relative(input.worktreePath,
|
|
63
|
-
.split(sep)
|
|
64
|
-
.join("/"),
|
|
70
|
+
relative(input.worktreePath, runEvidencePath(statePath)).split(sep).join("/"),
|
|
65
71
|
}
|
|
66
72
|
: {}),
|
|
67
73
|
});
|
|
@@ -170,9 +176,18 @@ export function selectResumableRegisterRun(candidates, options = {}) {
|
|
|
170
176
|
const inferredStage = latest.state.stages.reporter.status === "succeeded" ? "integrate" : "reporter";
|
|
171
177
|
if (options.resumeFrom === "executor") {
|
|
172
178
|
if (inferredStage !== "reporter") {
|
|
179
|
+
const blocker = options.allowFailedIntegration
|
|
180
|
+
? integratedRunBlocker(latest.state)
|
|
181
|
+
: `cannot resume the executor from the ${inferredStage} stage of run ${latest.runId}`;
|
|
182
|
+
if (!blocker) {
|
|
183
|
+
const forcedChanges = initialChanges.length > 0
|
|
184
|
+
? initialChanges
|
|
185
|
+
: (latest.evidence.attempt_changes ?? latest.evidence.changes).map((change) => change.path);
|
|
186
|
+
return { kind: "resumable", target: executorTarget(latest, forcedChanges) };
|
|
187
|
+
}
|
|
173
188
|
return {
|
|
174
189
|
kind: "not-resumable",
|
|
175
|
-
reason:
|
|
190
|
+
reason: blocker,
|
|
176
191
|
};
|
|
177
192
|
}
|
|
178
193
|
const forcedChanges = initialChanges.length > 0
|
|
@@ -197,48 +212,39 @@ export function selectResumableRegisterRun(candidates, options = {}) {
|
|
|
197
212
|
export function findResumableRegisterRun(input) {
|
|
198
213
|
return selectResumableRegisterRun(loadRegisterResumeCandidates(input), input.resumeFrom ? { resumeFrom: input.resumeFrom } : {});
|
|
199
214
|
}
|
|
200
|
-
// Schedule の明示的な executor 再開は、成功済み executor から reporter
|
|
201
|
-
//
|
|
215
|
+
// Schedule の明示的な executor 再開は、成功済み executor から reporter または統合の段へ進んだ run と、
|
|
216
|
+
// executor の報告が approach の必須項目を欠いて executor の段で止めた run(PJR-1GCD)に限る。
|
|
217
|
+
// 統合の段(commit・検査・merge)で止まった run も、どのリポジトリも統合していなければ
|
|
218
|
+
// worktree の成果を保ったまま executor へ戻す(PJR-ED0K)。run の選択・変更一覧・申し送りの
|
|
219
|
+
// 復元は register と同じ規則を使う。
|
|
202
220
|
export function selectScheduleExecutorResume(candidates) {
|
|
203
|
-
const lookup = selectResumableRegisterRun(candidates, {
|
|
221
|
+
const lookup = selectResumableRegisterRun(candidates, {
|
|
222
|
+
resumeFrom: "executor",
|
|
223
|
+
allowFailedIntegration: true,
|
|
224
|
+
});
|
|
204
225
|
if (lookup.kind !== "resumable")
|
|
205
226
|
return lookup;
|
|
206
227
|
const { state } = lookup.target;
|
|
207
|
-
|
|
228
|
+
const candidate = candidates.find((entry) => entry.runId === lookup.target.runId && entry.stateRef === lookup.target.stateRef);
|
|
229
|
+
const evidence = candidate?.executorEvidence ?? candidate?.evidence;
|
|
230
|
+
const rejectedReport = state.stages.executor.status === "blocked" && evidence?.completion_status === "incomplete";
|
|
231
|
+
if (state.stages.executor.status !== "succeeded" && !rejectedReport) {
|
|
208
232
|
return {
|
|
209
233
|
kind: "not-resumable",
|
|
210
234
|
reason: `--resume-from executor requires a succeeded executor stage for run ${state.run_id} (status: ${state.stages.executor.status})`,
|
|
211
235
|
};
|
|
212
236
|
}
|
|
213
|
-
|
|
214
|
-
if ((candidate?.executorEvidence ?? candidate?.evidence)?.stage.status !== "succeeded") {
|
|
237
|
+
if (evidence?.stage.status !== "succeeded") {
|
|
215
238
|
return {
|
|
216
239
|
kind: "not-resumable",
|
|
217
240
|
reason: `succeeded executor evidence is missing or invalid for run ${state.run_id}`,
|
|
218
241
|
};
|
|
219
242
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
reason: `cannot resume the executor from the integrate stage of run ${state.run_id}`,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
243
|
+
const blocker = integratedRunBlocker(state);
|
|
244
|
+
if (blocker)
|
|
245
|
+
return { kind: "not-resumable", reason: blocker };
|
|
226
246
|
return lookup;
|
|
227
247
|
}
|
|
228
|
-
// plan / result のファイル名は `<pjr-id>-<UTC>-<rand>-(plan|result).md`(buildInPlaceStem)。
|
|
229
|
-
// state に artifacts が無い旧 run のために、worktree の result 一覧から最新の stem を復元する。
|
|
230
|
-
export function selectLatestRegisterResultStem(fileNames, pjrId) {
|
|
231
|
-
const pattern = new RegExp(`^(${pjrId.toLowerCase()}-\\d{8}T\\d{6}Z-[0-9a-f]+)-result\\.md$`, "i");
|
|
232
|
-
const stems = [];
|
|
233
|
-
for (const name of fileNames) {
|
|
234
|
-
const match = name.match(pattern);
|
|
235
|
-
if (match)
|
|
236
|
-
stems.push(match[1]);
|
|
237
|
-
}
|
|
238
|
-
if (stems.length === 0)
|
|
239
|
-
return null;
|
|
240
|
-
return stems.sort()[stems.length - 1];
|
|
241
|
-
}
|
|
242
248
|
// state はエージェントが書き込める worktree 内のファイルのため、参照が root の外へ出ないことを
|
|
243
249
|
// 確認してから使う(絶対パスや `..` を含む参照は受け付けない)。
|
|
244
250
|
function isContainedRef(root, ref) {
|
|
@@ -248,7 +254,7 @@ function isContainedRef(root, ref) {
|
|
|
248
254
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
249
255
|
}
|
|
250
256
|
// reporter 段の入力(plan と result)を state から復元する。state に artifacts がある場合は
|
|
251
|
-
//
|
|
257
|
+
// それを正本とし、無い run では同じ run ディレクトリを参照する。
|
|
252
258
|
export function resolveRegisterResumeArtifacts(input) {
|
|
253
259
|
const executionRel = relative(input.repoRoot, input.executionPath).split(sep).join("/");
|
|
254
260
|
const artifacts = input.state.artifacts;
|
|
@@ -257,18 +263,11 @@ export function resolveRegisterResumeArtifacts(input) {
|
|
|
257
263
|
!isContainedRef(input.worktreePath, artifacts.result_ref)) {
|
|
258
264
|
return null;
|
|
259
265
|
}
|
|
260
|
-
const stem = artifacts.result_ref
|
|
266
|
+
const stem = recordStem(artifacts.result_ref);
|
|
261
267
|
return { planRef: artifacts.plan_ref, resultRef: artifacts.result_ref, stem };
|
|
262
268
|
}
|
|
263
|
-
const
|
|
264
|
-
if (!existsSync(
|
|
265
|
-
return null;
|
|
266
|
-
const stem = selectLatestRegisterResultStem(readdirSync(resultsDir), input.taskId);
|
|
267
|
-
if (!stem)
|
|
269
|
+
const records = taskRecordPaths(executionRel, input.taskId, input.state.run_id);
|
|
270
|
+
if (!existsSync(join(input.worktreePath, records.result)))
|
|
268
271
|
return null;
|
|
269
|
-
return {
|
|
270
|
-
planRef: `${executionRel}/exec/plans/${stem}-plan.md`,
|
|
271
|
-
resultRef: `${executionRel}/exec/results/${stem}-result.md`,
|
|
272
|
-
stem,
|
|
273
|
-
};
|
|
272
|
+
return { planRef: records.plan, resultRef: records.result, stem: input.state.run_id };
|
|
274
273
|
}
|
package/dist/exec/register.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { readRegisterInput, registerInputSection } from "../register/input.js";
|
|
2
|
-
import { resolveRegisterDeliverableTarget, } from "../register/deliverable-target.js";
|
|
3
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { basename, extname, join, relative, resolve } from "node:path";
|
|
5
|
-
import { findRegisterItem, loadRegisterItems, PJR_ID_RE, resolveRegisterPaths, TERMINAL_STATUSES_SET, VALID_PRIORITIES, VALID_STATUSES, VALID_TYPES, } from "../register/register.js";
|
|
6
|
-
import { execTemplatePath, injectCommonConventions, MISSING, registerGradeFindingsText, } from "./plans.js";
|
|
7
|
-
import { generateRegisterApproachPlan } from "./plans-generation.js";
|
|
8
|
-
import { findUniqueDeliverableForKataTarget, findDeliverableByPath, resolveDeliverableByDocId, } from "./plans-core.js";
|
|
2
|
+
import { basename, dirname, extname, join, relative, resolve } from "node:path";
|
|
9
3
|
import { collectDocIndexEntries } from "../docs/doc-index.js";
|
|
10
|
-
import {
|
|
4
|
+
import { buildSpecdojoFrontmatter } from "../docs/frontmatter-namespace.js";
|
|
11
5
|
import { authoredKataPath, authoringKind, authoringStandardId, authoringStandardPath, } from "../kata/authoring.js";
|
|
6
|
+
import { loadRulebookRefs, resolveKataRefs } from "../kata/kata.js";
|
|
12
7
|
import { validateRegisterApproachTargets } from "../register/approach.js";
|
|
13
|
-
import { buildSpecdojoFrontmatter } from "../docs/frontmatter-namespace.js";
|
|
14
|
-
import { escapeMarkdownInline, expandTemplate, inlineCodeAnglePlaceholders, stripTerminalControlSequences, } from "./shared.js";
|
|
15
|
-
import { formatMarkdownFile } from "./format.js";
|
|
16
|
-
import { loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
|
|
17
8
|
import { resolveAuthoringSources, } from "../register/authoring-sources.js";
|
|
18
|
-
import {
|
|
9
|
+
import { resolveRegisterDeliverableTarget, } from "../register/deliverable-target.js";
|
|
10
|
+
import { readRegisterInput, registerInputSection } from "../register/input.js";
|
|
19
11
|
import { isPlanningApproach } from "../register/planning.js";
|
|
12
|
+
import { findRegisterItem, loadRegisterItems, PJR_ID_RE, resolveRegisterPaths, TERMINAL_STATUSES_SET, VALID_PRIORITIES, VALID_STATUSES, VALID_TYPES, } from "../register/register.js";
|
|
13
|
+
import { loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
|
|
14
|
+
import { formatMarkdownFile } from "./format.js";
|
|
15
|
+
import { findDeliverableByPath, findUniqueDeliverableForKataTarget, resolveDeliverableByDocId, } from "./plans-core.js";
|
|
16
|
+
import { generateRegisterApproachPlan } from "./plans-generation.js";
|
|
20
17
|
import { planningPlanFields } from "./plans-planning.js";
|
|
18
|
+
import { execTemplatePath, injectCommonConventions, MISSING, registerGradeFindingsText, } from "./plans.js";
|
|
19
|
+
import { taskRecordPaths } from "./run-records.js";
|
|
20
|
+
import { escapeMarkdownInline, expandTemplate, inlineCodeAnglePlaceholders, stripTerminalControlSequences, } from "./shared.js";
|
|
21
|
+
import { repoEnvironmentVariableName } from "./task-repos.js";
|
|
21
22
|
const EDIT_TYPES = new Set(["todo", "issue", "change-request"]);
|
|
22
23
|
const INVESTIGATE_TYPES = new Set(["question", "risk"]);
|
|
23
24
|
export function registerItemCategory(itemType) {
|
|
@@ -99,6 +100,8 @@ export function formatRegisterRunSummary(summaries) {
|
|
|
99
100
|
`transition=${summary.transition}`,
|
|
100
101
|
`commit=${summary.commit}`,
|
|
101
102
|
];
|
|
103
|
+
if (summary.uncommittedFiles)
|
|
104
|
+
parts.push(`uncommitted=${summary.uncommittedFiles}`);
|
|
102
105
|
if (summary.reason)
|
|
103
106
|
parts.push(`reason=${summary.reason}`);
|
|
104
107
|
lines.push(parts.join(" "));
|
|
@@ -206,14 +209,12 @@ export function ticketPathFromItem(item, projectRegisterPath) {
|
|
|
206
209
|
// 制御文字を除去する(lefthook 等の色付き出力が結論列を破壊するのを防ぐ)。そのうえで
|
|
207
210
|
// セル内の `|` と改行は表を壊すため置換し、読みやすさのため長さも制限する。
|
|
208
211
|
const MAX_CONCLUSION_LENGTH = 200;
|
|
209
|
-
export function sanitizeRegisterConclusion(reason) {
|
|
212
|
+
export function sanitizeRegisterConclusion(reason, maxLength = MAX_CONCLUSION_LENGTH) {
|
|
210
213
|
const singleLine = stripTerminalControlSequences(reason)
|
|
211
214
|
.replace(/\r?\n/g, " ")
|
|
212
215
|
.replace(/\|/g, "/")
|
|
213
216
|
.trim();
|
|
214
|
-
const truncated = singleLine.length <=
|
|
215
|
-
? singleLine
|
|
216
|
-
: `${singleLine.slice(0, MAX_CONCLUSION_LENGTH)}…`;
|
|
217
|
+
const truncated = singleLine.length <= maxLength ? singleLine : `${singleLine.slice(0, maxLength)}…`;
|
|
217
218
|
return inlineCodeAnglePlaceholders(truncated);
|
|
218
219
|
}
|
|
219
220
|
// ---------------------------------------------------------------------------
|
|
@@ -530,10 +531,10 @@ export async function generateRegisterPlan(opts) {
|
|
|
530
531
|
throw new Error(`Template not found: ${templatePath}`);
|
|
531
532
|
}
|
|
532
533
|
const template = readFileSync(templatePath, "utf8");
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
const resultRef =
|
|
534
|
+
const records = taskRecordPaths(opts.executionPath, item.id, opts.stem, "register");
|
|
535
|
+
const planPath = opts.outPath ?? records.plan;
|
|
536
|
+
mkdirSync(dirname(planPath), { recursive: true });
|
|
537
|
+
const resultRef = repoRelativePath(records.result);
|
|
537
538
|
const values = {
|
|
538
539
|
_FRONTMATTER_: registerPlanFrontmatter(opts.projectId, opts.stem, item),
|
|
539
540
|
_PJR_ID_: item.id,
|
|
@@ -558,7 +559,10 @@ export async function generateRegisterPlan(opts) {
|
|
|
558
559
|
// expandTemplate がまとめる(PJR-283N)。
|
|
559
560
|
const body = expandTemplate(template, values);
|
|
560
561
|
// register 項目は対象成果物の schema を特定できないため、schema 検査の項目は落とす。
|
|
561
|
-
const content = injectCommonConventions(body, MISSING, new Map()
|
|
562
|
+
const content = injectCommonConventions(body, MISSING, new Map(), "edit", {
|
|
563
|
+
executionPath: opts.executionPath,
|
|
564
|
+
planPath,
|
|
565
|
+
});
|
|
562
566
|
writeFileSync(planPath, content, "utf8");
|
|
563
567
|
await formatMarkdownFile(planPath);
|
|
564
568
|
return { planPath, category };
|
|
@@ -95,7 +95,8 @@ function restoreOriginalWorktree(params) {
|
|
|
95
95
|
* Merge `target` into the branch checked out at `cwd` (an exec worktree) with a merge commit.
|
|
96
96
|
* Uncommitted changes (including untracked files) are stashed before the merge and restored
|
|
97
97
|
* without restoring the old index. Conflicts on `theirsPaths` (repository-relative) take the
|
|
98
|
-
* target side
|
|
98
|
+
* target side and conflicts on `oursPaths` keep the exec branch side. Any other committed conflict
|
|
99
|
+
* aborts the merge. If restoring the stash conflicts,
|
|
99
100
|
* the merge commit is rolled back and the executor changes are restored on the original HEAD.
|
|
100
101
|
*/
|
|
101
102
|
export function syncWorktreeWithIntegrationTarget(params) {
|
|
@@ -124,13 +125,15 @@ export function syncWorktreeWithIntegrationTarget(params) {
|
|
|
124
125
|
try {
|
|
125
126
|
const conflicted = zeroSeparated(cwd, ["diff", "--name-only", "--diff-filter=U", "-z"]);
|
|
126
127
|
const theirs = new Set(params.theirsPaths ?? []);
|
|
127
|
-
const
|
|
128
|
+
const ours = new Set(params.oursPaths ?? []);
|
|
129
|
+
const unexpected = conflicted.filter((path) => !theirs.has(path) && !ours.has(path));
|
|
128
130
|
if (unexpected.length > 0) {
|
|
129
131
|
throw new Error(`${repo}: merge conflicts with ${target}: ${unexpected.join(", ")}`);
|
|
130
132
|
}
|
|
131
133
|
for (const path of conflicted) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
const side = theirs.has(path) ? target : "HEAD";
|
|
135
|
+
if (hasPathAt(cwd, side, path)) {
|
|
136
|
+
gitOutput(cwd, ["checkout", side, "--", path]);
|
|
134
137
|
gitOutput(cwd, ["add", "--", path]);
|
|
135
138
|
}
|
|
136
139
|
else {
|
|
@@ -270,6 +273,7 @@ export function syncTaskWorktreesWithIntegrationTargets(params) {
|
|
|
270
273
|
target: params.projectTarget,
|
|
271
274
|
message: params.message,
|
|
272
275
|
theirsPaths: params.projectTheirsPaths,
|
|
276
|
+
oursPaths: params.projectOursPaths,
|
|
273
277
|
}));
|
|
274
278
|
return synced;
|
|
275
279
|
}
|
|
@@ -3,9 +3,10 @@ import { appendFileSync, existsSync, mkdirSync } from "node:fs";
|
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { acquireSchedulerLock, releaseSchedulerLock } from "./events.js";
|
|
5
5
|
import { productIntegrationTarget } from "./task-repos.js";
|
|
6
|
-
import { abortMerge, commitTargetPaths, isExecBranchMergedIntoCurrent, recordRootNewFilesHandoff, REGISTER_NEW_FILE_DIR_PREFIXES, repoRelative, stabilizeCommitTargets, stageCommitTargets, worktreeStatusPaths, } from "./worktree-ops.js";
|
|
6
|
+
import { abortMerge, assertCommitScope, UncommittedChangesError, commitTargetPaths, isExecBranchMergedIntoCurrent, recordRootNewFilesHandoff, REGISTER_NEW_FILE_DIR_PREFIXES, repoRelative, stabilizeCommitTargets, stageCommitTargets, worktreeStatusPaths, } from "./worktree-ops.js";
|
|
7
7
|
import { appendGitFailureLog, appendGitResultFailureLog, formatGitResultFailure, gitOutput, gitResult, listRegisteredWorktrees, summarizeGitHookFailure, } from "./worktree.js";
|
|
8
8
|
import { resolveRepoQualifiedRef } from "../shared/specdojo-config.js";
|
|
9
|
+
import { stagedMergeBlocker } from "../shared/git.js";
|
|
9
10
|
import { PROJECT_REPO_NAME, branchExists, dirtyPaths, gitText, mergeInProgress, zeroSeparated, } from "./repo-integration-git.js";
|
|
10
11
|
export { PROJECT_REPO_NAME } from "./repo-integration-git.js";
|
|
11
12
|
// PJR-0WAA: 1 つのタスクがプロジェクトリポジトリと宣言済みのプロダクトリポジトリ(`repos`)を
|
|
@@ -282,6 +283,9 @@ export function productMergeBlockers(product) {
|
|
|
282
283
|
}
|
|
283
284
|
const checkout = checkoutOfBranch(product.repoRoot, target);
|
|
284
285
|
if (checkout) {
|
|
286
|
+
const stagedBlocker = stagedMergeBlocker(checkout);
|
|
287
|
+
if (stagedBlocker)
|
|
288
|
+
blockers.push(block(stagedBlocker));
|
|
285
289
|
if (mergeInProgress(checkout)) {
|
|
286
290
|
blockers.push(block(`a merge is in progress in ${checkout}`));
|
|
287
291
|
}
|
|
@@ -304,6 +308,14 @@ export function projectMergeBlockers(params) {
|
|
|
304
308
|
const { context, worktree } = params;
|
|
305
309
|
const repoRoot = context.repoRoot;
|
|
306
310
|
const block = (message) => ({ repo: PROJECT_REPO_NAME, message });
|
|
311
|
+
try {
|
|
312
|
+
assertCommitScope(context, worktree, params.taskId);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
if (error instanceof UncommittedChangesError)
|
|
316
|
+
return [block(error.message)];
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
307
319
|
if (isExecBranchMergedIntoCurrent({ context, worktree }))
|
|
308
320
|
return [];
|
|
309
321
|
const target = gitText(gitResult(repoRoot, ["branch", "--show-current"]).stdout).trim();
|
|
@@ -315,6 +327,9 @@ export function projectMergeBlockers(params) {
|
|
|
315
327
|
if (mergeInProgress(repoRoot))
|
|
316
328
|
return [block(`a merge is in progress in ${repoRoot}`)];
|
|
317
329
|
const blockers = [];
|
|
330
|
+
const stagedBlocker = stagedMergeBlocker(repoRoot);
|
|
331
|
+
if (stagedBlocker)
|
|
332
|
+
blockers.push(block(stagedBlocker));
|
|
318
333
|
const uncommitted = commitTargetPaths(context, worktree, params.taskId);
|
|
319
334
|
if (uncommitted.length > 0) {
|
|
320
335
|
blockers.push(block(`uncommitted commit-target changes: ${uncommitted.join(", ")}`));
|
|
@@ -351,6 +366,11 @@ export function mergeProductIntoTarget(params) {
|
|
|
351
366
|
const { product, message } = params;
|
|
352
367
|
const target = productIntegrationTarget(product);
|
|
353
368
|
const checkout = checkoutOfBranch(product.repoRoot, target);
|
|
369
|
+
if (checkout) {
|
|
370
|
+
const stagedBlocker = stagedMergeBlocker(checkout);
|
|
371
|
+
if (stagedBlocker)
|
|
372
|
+
throw new Error(stagedBlocker);
|
|
373
|
+
}
|
|
354
374
|
const header = `=== ${new Date().toISOString()} ${product.name}: merge ${product.branch} into ${target} ===`;
|
|
355
375
|
if (product.integrationStrategy === "ff") {
|
|
356
376
|
const parent = gitOutput(product.repoRoot, ["rev-parse", `refs/heads/${target}`]).trim();
|