specdojo 0.4.7 → 0.6.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 +16 -9
- package/CHANGELOG.md +106 -0
- package/dist/catalog/generate.js +144 -13
- package/dist/commands/init.js +4 -0
- package/dist/commands/night-orchestrator.js +33 -4
- package/dist/dashboard/dashboard.js +5 -6
- package/dist/dashboard/timeline-build.js +5 -1
- package/dist/dashboard/timeline.js +6 -3
- package/dist/deliverable/deliverable.js +77 -4
- package/dist/docs/yaml-pages.js +17 -17
- package/dist/exec/core.js +3 -0
- package/dist/exec/parent-validation.js +7 -0
- package/dist/exec/pipeline-state.js +5 -2
- package/dist/exec/plans-core.js +49 -3
- package/dist/exec/plans-generation.js +48 -8
- package/dist/exec/plans-grade-findings.js +16 -0
- package/dist/exec/plans-planning.js +43 -0
- package/dist/exec/plans-storage.js +6 -2
- package/dist/exec/product-branch-records.js +105 -0
- package/dist/exec/product-branches.js +52 -0
- package/dist/exec/register-product-message.js +50 -0
- package/dist/exec/register.js +22 -1
- package/dist/exec/repo-integration-sync.js +11 -0
- package/dist/exec/repo-integration.js +58 -6
- package/dist/exec/repo-trace.js +19 -4
- package/dist/exec/results.js +11 -5
- package/dist/exec/run/register-command.js +16 -0
- package/dist/exec/run/register-core.js +11 -0
- package/dist/exec/run/register-mode.js +19 -1
- package/dist/exec/run/register-resume.js +33 -1
- package/dist/exec/run/register-worktree.js +52 -8
- package/dist/exec/run/schedule-prepare.js +7 -3
- package/dist/exec/strategy.js +4 -1
- package/dist/exec/task-repos.js +92 -16
- package/dist/exec/worktree-command.js +2 -2
- package/dist/exec/worktree-ops-commit.js +7 -1
- package/dist/exec/worktree.js +3 -3
- package/dist/grade/apply.js +6 -2
- package/dist/grade/markdown.js +7 -2
- package/dist/grade/plan.js +6 -4
- package/dist/register/approach.js +19 -0
- package/dist/register/catalog-status.js +49 -0
- package/dist/register/core.js +8 -0
- package/dist/register/create-commands.js +86 -4
- package/dist/register/deliverable-target.js +24 -17
- package/dist/register/dependency.js +123 -0
- package/dist/register/derivation.js +2 -2
- package/dist/register/epic.js +42 -0
- package/dist/register/event-merge.js +9 -2
- package/dist/register/events.js +10 -0
- package/dist/register/external-project.js +6 -0
- package/dist/register/input.js +168 -0
- package/dist/register/item.js +71 -0
- package/dist/register/maintenance-commands.js +7 -1
- package/dist/register/planning.js +37 -0
- package/dist/register/register.js +7 -3
- package/dist/register/renumber.js +16 -4
- package/dist/register/update.js +6 -0
- package/dist/register/views.js +55 -4
- package/dist/schedule/approach.js +9 -0
- package/dist/schedule/schedule.js +3 -1
- package/dist/schedule/strategy-generate-scope.js +5 -1
- package/dist/schedule/strategy-generate.js +1 -0
- package/dist/schedule/strategy-profiles.js +22 -2
- package/dist/shared/agent-types.js +7 -1
- package/dist/shared/branch-template.js +26 -0
- package/dist/shared/commit-message-template.js +38 -0
- package/dist/shared/commit-types.js +15 -0
- package/dist/shared/grade-result.js +23 -5
- package/dist/shared/markdownlint-config.js +38 -0
- package/dist/shared/markdownlint-scaffold.js +2 -9
- package/dist/shared/specdojo-config.js +42 -4
- package/dist/shared/specdojo-gitignore.js +4 -0
- package/docs/ja/specdojo/exec-templates/xep-catalog-planning-template.md +24 -0
- package/docs/ja/specdojo/exec-templates/xep-draft-template.md +93 -0
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +9 -2
- package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xep-strategy-planning-template.md +24 -0
- package/docs/ja/specdojo/exec-templates/xer-human-bootstrap-finalize-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xer-human-draft-template.md +23 -0
- package/docs/ja/specdojo/exec-templates/xer-human-finalize-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +7 -4
- package/docs/ja/specdojo/guides/docs-editing-guide.md +14 -1
- package/docs/ja/specdojo/guides/docs-structure-guide.md +10 -8
- package/docs/ja/specdojo/guides/exec-config-guide.md +3 -1
- package/docs/ja/specdojo/guides/exec-operation-guide.md +111 -16
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +19 -1
- package/docs/ja/specdojo/guides/practice-system-composition-guide.md +2 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +37 -14
- package/docs/ja/specdojo/guides/register-operation-guide.md +58 -16
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +1 -1
- package/docs/ja/specdojo/guides/ryu-guide.md +114 -23
- package/docs/ja/specdojo/guides/schedule-design-guide.md +31 -4
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +16 -16
- package/docs/ja/specdojo/guides/timeline-design-guide.md +37 -33
- package/docs/ja/specdojo/recipes/exec-human-finalize-recipe.md +1 -0
- package/docs/ja/specdojo/recipes/tsd-recipe.md +206 -0
- package/docs/ja/specdojo/references/command-reference.md +86 -15
- package/docs/ja/specdojo/references/specdojo-config-reference.md +81 -8
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +5 -4
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +3 -2
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +4 -3
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +8 -7
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +4 -3
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +3 -2
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +3 -2
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cstd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +9 -0
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +9 -6
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +3 -1
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +2 -0
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +4 -2
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +4 -3
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +10 -9
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +10 -9
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/ntp-rulebook.md +7 -6
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +54 -36
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-overview-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +3 -2
- package/docs/ja/specdojo/rulebooks/sch-rulebook.md +4 -1
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +7 -6
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +4 -3
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +9 -8
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +80 -61
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +111 -63
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +3 -2
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +1 -0
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +1 -0
- package/docs/ja/specdojo/samples/atc-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/atc-sample.md +1 -1
- package/docs/ja/specdojo/samples/bac-sample.md +1 -1
- package/docs/ja/specdojo/samples/bdd-sample.yaml +1 -1
- package/docs/ja/specdojo/samples/bds-sample.md +1 -1
- package/docs/ja/specdojo/samples/bes-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/bes-sample.md +1 -1
- package/docs/ja/specdojo/samples/ccd-sample.md +1 -1
- package/docs/ja/specdojo/samples/cdfd-sample.md +1 -1
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +1 -1
- package/docs/ja/specdojo/samples/cdsd-sample.md +1 -1
- package/docs/ja/specdojo/samples/cld-sample.md +1 -1
- package/docs/ja/specdojo/samples/cnd-sample.md +1 -1
- package/docs/ja/specdojo/samples/cop-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/cop-sample.md +1 -1
- package/docs/ja/specdojo/samples/cpd-sample.md +1 -1
- package/docs/ja/specdojo/samples/cstd-sample.md +1 -1
- package/docs/ja/specdojo/samples/cxd-sample.md +1 -1
- package/docs/ja/specdojo/samples/dct-sample.yaml +5 -1
- package/docs/ja/specdojo/samples/dmd-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/dmd-sample.md +1 -1
- package/docs/ja/specdojo/samples/etc-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/etc-sample.md +1 -1
- package/docs/ja/specdojo/samples/gl-sample.yaml +2 -0
- package/docs/ja/specdojo/samples/ifd-sample.md +1 -1
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +1 -0
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +1 -1
- package/docs/ja/specdojo/samples/ifx-file-sample.md +1 -1
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +1 -0
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +2 -1
- package/docs/ja/specdojo/samples/itc-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/itc-sample.md +1 -1
- package/docs/ja/specdojo/samples/mtp-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-availability-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-integrity-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-maintainability-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-operations-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-performance-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-reliability-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-security-safety-sample.md +1 -1
- package/docs/ja/specdojo/samples/nfr-usability-sample.md +1 -1
- package/docs/ja/specdojo/samples/ntp-sample.md +1 -1
- package/docs/ja/specdojo/samples/opd-sample.md +1 -1
- package/docs/ja/specdojo/samples/opr-sample.md +1 -1
- package/docs/ja/specdojo/samples/otp-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/otp-sample.md +1 -1
- package/docs/ja/specdojo/samples/prj-stakeholder-register-sample.md +1 -1
- package/docs/ja/specdojo/samples/sac-sample.md +1 -1
- package/docs/ja/specdojo/samples/sf-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/sf-sample.md +1 -1
- package/docs/ja/specdojo/samples/sld-sample.md +1 -1
- package/docs/ja/specdojo/samples/stc-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/stc-sample.md +1 -1
- package/docs/ja/specdojo/samples/stsd-sample.md +1 -1
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +1 -1
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +1 -1
- package/docs/ja/specdojo/samples/sysd-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/tsd-index-sample.md +22 -16
- package/docs/ja/specdojo/samples/tsd-sample.md +241 -21
- package/docs/ja/specdojo/samples/tsp-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/uis-sample.md +1 -1
- package/docs/ja/specdojo/samples/utc-index-sample.md +1 -1
- package/docs/ja/specdojo/samples/utc-sample.md +1 -1
- package/docs/ja/specdojo/standards/document-metadata-standard.md +44 -3
- package/docs/ja/specdojo/standards/exec-human-finalize-standard.md +1 -0
- package/docs/ja/specdojo/standards/guide-authoring-standard.md +2 -1
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +2 -0
- package/docs/ja/specdojo/standards/philosophy-authoring-standard.md +1 -0
- package/docs/ja/specdojo/standards/recipe-authoring-standard.md +2 -1
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +18 -12
- package/docs/ja/specdojo/standards/sample-authoring-standard.md +1 -0
- package/docs/ja/specdojo/standards/standard-authoring-standard.md +2 -1
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +1 -1
- package/docs/ja/specdojo/templates/pjr-change-request-template.md +10 -4
- package/docs/ja/specdojo/templates/pjr-dependent-items-template.md +22 -0
- package/docs/ja/specdojo/templates/pjr-epic-items-template.md +22 -0
- package/docs/ja/specdojo/templates/pjr-epic-template.md +44 -0
- package/docs/ja/specdojo/templates/pjr-index-template.md +4 -2
- package/docs/ja/specdojo/templates/pjr-issue-template.md +10 -4
- package/docs/ja/specdojo/templates/pjr-question-template.md +11 -5
- package/docs/ja/specdojo/templates/pjr-risk-template.md +10 -4
- package/docs/ja/specdojo/templates/pjr-todo-template.md +10 -4
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/dct.schema.yaml +9 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +24 -16
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +5 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +1 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/gl.schema.yaml +8 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +5 -1
- package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +2 -1
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +21 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +75 -3
- package/docs/specdojo/schemas/v1/rulebook-frontmatter.schema.yaml +5 -0
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +1 -0
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +43 -0
- package/package.json +4 -3
- package/templates/antigravity/orchestrator.md +16 -9
- package/templates/claude/agents/specdojo-orchestrator.md +16 -9
- package/templates/codex/agents/specdojo-orchestrator.toml +16 -9
- package/templates/codex/orchestrator.md +16 -9
- package/templates/copilot/README.md +2 -1
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +14 -8
- package/templates/opencode/agents/specdojo-orchestrator.md +16 -9
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { registerDependencyBlockReason } from "../../register/dependency.js";
|
|
1
2
|
import { gradeCheckpointPaths } from "../grade-checkpoint.js";
|
|
2
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
4
|
import { resolve } from "node:path";
|
|
4
5
|
import { qualifyTaskId, randomHex } from "../shared.js";
|
|
5
|
-
import { resolveAgentMember } from "../../shared/specdojo-config.js";
|
|
6
|
+
import { loadConfig, resolveAgentMember, } from "../../shared/specdojo-config.js";
|
|
7
|
+
import { resolveProductBranches } from "../product-branches.js";
|
|
8
|
+
import { registerProductMessage } from "../register-product-message.js";
|
|
6
9
|
import { buildInPlaceStem } from "../plans.js";
|
|
7
10
|
import { generateRegisterPlan, requireRunnableRegisterItem, resolveRegisterRunTarget, sanitizeRegisterConclusion, ticketPathFromItem, } from "../register.js";
|
|
8
11
|
import { readResultFrontmatterSnapshot, scaffoldResult, updateResultStatus } from "../results.js";
|
|
9
|
-
import { findExecWorktree, gitOutput } from "../worktree.js";
|
|
10
|
-
import { configuredProductRepos, integrationBranchOverrideRecord, withProductRepoPrompt, } from "../task-repos.js";
|
|
12
|
+
import { findExecWorktree, gitOutput, } from "../worktree.js";
|
|
13
|
+
import { configuredProductRepos, integrationBranchOverrideRecord, reserveProductBranches, withProductRepoPrompt, } from "../task-repos.js";
|
|
11
14
|
import { checkpointAndEnsureWorktree, commitTargetPaths, commitWorktreeChanges, discardStaleExecWorktree, isExecBranchMergedIntoCurrent, mergeWorktreeIntoCurrent, removeWorktree, taskTargetsAtHead, WorktreeRemovedBranchDeletionError, worktreeStatusPaths, } from "../worktree-ops.js";
|
|
12
15
|
import { commitProductWorktrees, integrateTaskRepositories, projectMergeBlockers, PROJECT_REPO_NAME, RepoIntegrationError, } from "../repo-integration.js";
|
|
13
|
-
import { productIntegrationTrace, recordResultTrace,
|
|
16
|
+
import { productIntegrationTrace, recordResultTrace, registerProjectMergeMessage, traceKey, } from "../repo-trace.js";
|
|
14
17
|
import { pipelineStateLocation, readPipelineState } from "../pipeline-state.js";
|
|
15
18
|
import { findResumableRegisterRun } from "../register-resume.js";
|
|
16
19
|
import { isAuthoringApproach } from "../../kata/authoring.js";
|
|
@@ -198,7 +201,18 @@ export async function finalizeRegisterWorktreeRun(params) {
|
|
|
198
201
|
// PJR-30SW: プロダクト側の commit と merge commit、プロジェクト側の merge commit に
|
|
199
202
|
// `Refs: <project-id>:<item-id>` を付ける(PJR-1SXK)。
|
|
200
203
|
const itemTraceKey = traceKey(projectId, item.id);
|
|
201
|
-
const
|
|
204
|
+
const projectConfig = (worktree.repos?.length ?? 0) > 0
|
|
205
|
+
? loadConfig(repoRoot).config?.projects[projectId]
|
|
206
|
+
: undefined;
|
|
207
|
+
const productMessage = (product, kind) => registerProductMessage({
|
|
208
|
+
projectId,
|
|
209
|
+
item,
|
|
210
|
+
ticketPath,
|
|
211
|
+
projectConfig,
|
|
212
|
+
product,
|
|
213
|
+
kind,
|
|
214
|
+
repoConfig: projectConfig?.repos?.find((repo) => repo.name === product.name),
|
|
215
|
+
});
|
|
202
216
|
const integrateStartedAt = new Date().toISOString();
|
|
203
217
|
recordIntegrateStage(params.pipelineStatePath, integrateStartedAt, (current) => ({
|
|
204
218
|
status: "running",
|
|
@@ -212,7 +226,7 @@ export async function finalizeRegisterWorktreeRun(params) {
|
|
|
212
226
|
try {
|
|
213
227
|
const productOutcomes = commitProductWorktrees({
|
|
214
228
|
worktree,
|
|
215
|
-
message: productMessage,
|
|
229
|
+
message: (product) => productMessage(product, "commit"),
|
|
216
230
|
targets: taskTargetsAtHead(wtContext, worktree, stem),
|
|
217
231
|
scopeLogPath: integrateLogPath(params.pipelineStatePath),
|
|
218
232
|
failureLogPath: integrateLogPath(params.pipelineStatePath),
|
|
@@ -261,7 +275,7 @@ export async function finalizeRegisterWorktreeRun(params) {
|
|
|
261
275
|
integrateTaskRepositories({
|
|
262
276
|
worktree,
|
|
263
277
|
mergeMessage,
|
|
264
|
-
productMergeMessage: productMessage,
|
|
278
|
+
productMergeMessage: (product) => productMessage(product, "merge"),
|
|
265
279
|
checkProject: () => projectMergeBlockers({
|
|
266
280
|
context: wtContext,
|
|
267
281
|
worktree,
|
|
@@ -394,6 +408,16 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
394
408
|
const { projectId, schedulePath, executionPath, repoRoot, worktreeBase } = context;
|
|
395
409
|
const wtContext = { repoRoot, schedulePath, executionPath };
|
|
396
410
|
const { registerPaths, item } = resolveRegisterRunTarget(projectId, pjrId);
|
|
411
|
+
const dependencyReason = registerDependencyBlockReason(registerPaths, item);
|
|
412
|
+
if (dependencyReason)
|
|
413
|
+
return {
|
|
414
|
+
id: item.id,
|
|
415
|
+
title: item.title,
|
|
416
|
+
outcome: "skipped",
|
|
417
|
+
transition: "none",
|
|
418
|
+
commit: "skipped",
|
|
419
|
+
reason: dependencyReason,
|
|
420
|
+
};
|
|
397
421
|
// 状態遷移の書き込み先(登録項目の正本)。commit 対象に必ず含める。
|
|
398
422
|
const ticketPath = ticketPathFromItem(item, registerPaths.projectRegisterPath);
|
|
399
423
|
requireRunnableRegisterItem(item);
|
|
@@ -421,10 +445,29 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
421
445
|
: undefined;
|
|
422
446
|
// PJR-98G4: repos を宣言した project では、プロダクトの worktree も同じタスクの下に作る。
|
|
423
447
|
// PJR-XRAB: --integration-branch は設定の integration_branch より優先する。
|
|
424
|
-
const products = configuredProductRepos(schedulePath, opts.integrationBranch)
|
|
448
|
+
const products = resolveProductBranches(configuredProductRepos(schedulePath, opts.integrationBranch), {
|
|
449
|
+
projectId,
|
|
450
|
+
taskId: worktreeTaskId,
|
|
451
|
+
item,
|
|
452
|
+
ticketPath,
|
|
453
|
+
projectConfig: loadConfig().config?.projects[projectId],
|
|
454
|
+
overrides: opts.branch,
|
|
455
|
+
});
|
|
425
456
|
const integrationBranchOverrides = integrationBranchOverrideRecord(opts.integrationBranch);
|
|
426
457
|
// Phase 1: plan/result 生成 → register start → checkpoint → worktree 作成(root で直列化)。
|
|
427
458
|
const setup = async () => {
|
|
459
|
+
// Recheck after acquiring the lifecycle lock: dependencies may change while waiting.
|
|
460
|
+
const current = resolveRegisterRunTarget(projectId, pjrId);
|
|
461
|
+
const reason = registerDependencyBlockReason(current.registerPaths, current.item);
|
|
462
|
+
if (reason)
|
|
463
|
+
return {
|
|
464
|
+
id: item.id,
|
|
465
|
+
title: item.title,
|
|
466
|
+
outcome: "skipped",
|
|
467
|
+
transition: "none",
|
|
468
|
+
commit: "skipped",
|
|
469
|
+
reason,
|
|
470
|
+
};
|
|
428
471
|
// executor が成功した run の worktree を、全体再実行が破棄しないよう保護する。
|
|
429
472
|
// discardStaleExecWorktree は worktree と exec ブランチを強制削除するため、未コミットの
|
|
430
473
|
// executor 成果が失われる。この場合は何も壊さずに中断し、再開か明示的な破棄を促す。
|
|
@@ -443,6 +486,7 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
|
|
|
443
486
|
const discarded = discardStaleExecWorktree({ context: wtContext, worktreeTaskId, products });
|
|
444
487
|
if (discarded)
|
|
445
488
|
process.stdout.write(` [run] discarded stale worktree/branch: ${discarded}\n`);
|
|
489
|
+
reserveProductBranches(products, worktreeTaskId);
|
|
446
490
|
const { planPath } = await generateRegisterPlan({
|
|
447
491
|
executionPath,
|
|
448
492
|
projectId,
|
|
@@ -9,7 +9,7 @@ import { ensureReviewGrade } from "../../review/grade.js";
|
|
|
9
9
|
import { gradeCheckpointPaths } from "../grade-checkpoint.js";
|
|
10
10
|
import { isResultUnfilled, readResultFrontmatterSnapshot, scaffoldResult } from "../results.js";
|
|
11
11
|
import { worktreeNameFromTaskId } from "../worktree.js";
|
|
12
|
-
import { configuredProductRepos, plannedProjectWorktreePath } from "../task-repos.js";
|
|
12
|
+
import { configuredProductRepos, plannedProjectWorktreePath, preflightProductBranches, productBranchForTask, } from "../task-repos.js";
|
|
13
13
|
import { checkpointAndEnsureWorktree, discardStaleExecWorktree } from "../worktree-ops.js";
|
|
14
14
|
import { pipelineStateLocation } from "../pipeline-state.js";
|
|
15
15
|
import { collectBusyActors, pinnedExecutor, pinnedReporter, resolveAgentOverride, resolveExecDefaultsPath, resolvePinnedRateLimitRunOptions, resolveTaskPhaseContext, selectCandidates, } from "./shared.js";
|
|
@@ -196,7 +196,11 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
|
|
|
196
196
|
const worktreeTaskId = qualifyTaskId(projectId, task.id);
|
|
197
197
|
const worktreeName = worktreeNameFromTaskId(worktreeTaskId);
|
|
198
198
|
// PJR-98G4: repos を宣言した project では <base>/<task>/project/ と <base>/<task>/<repo>/ を作る。
|
|
199
|
-
const products = configuredProductRepos(schedulePath)
|
|
199
|
+
const products = configuredProductRepos(schedulePath).map((product) => ({
|
|
200
|
+
...product,
|
|
201
|
+
branch: productBranchForTask(product, worktreeTaskId, skipClaim),
|
|
202
|
+
}));
|
|
203
|
+
preflightProductBranches(products, worktreeTaskId);
|
|
200
204
|
if (dryRun) {
|
|
201
205
|
const worktree = {
|
|
202
206
|
path: plannedProjectWorktreePath(worktreeBase, worktreeTaskId, products),
|
|
@@ -207,7 +211,7 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
|
|
|
207
211
|
process.stdout.write(` [run] would setup: worktree ${worktree.path} (${worktree.branch})\n`);
|
|
208
212
|
for (const product of products) {
|
|
209
213
|
process.stdout.write(` [run] would setup: worktree ${join(worktreeBase, worktreeName, product.name)} ` +
|
|
210
|
-
`(${
|
|
214
|
+
`(${productBranchForTask(product, worktreeTaskId)} in ${product.repoRoot})\n`);
|
|
211
215
|
}
|
|
212
216
|
const claimMsg = skipClaim
|
|
213
217
|
? ` [dry-run] already claimed: ${task.id} as ${actor} (skip claim)`
|
package/dist/exec/strategy.js
CHANGED
|
@@ -4,10 +4,13 @@ function isTaskMode(value) {
|
|
|
4
4
|
return value === "edit" || value === "review";
|
|
5
5
|
}
|
|
6
6
|
function isApproach(value) {
|
|
7
|
-
return (value === "
|
|
7
|
+
return (value === "draft" ||
|
|
8
|
+
value === "fully-guided" ||
|
|
8
9
|
value === "recipe-guided" ||
|
|
9
10
|
value === "freeform" ||
|
|
10
11
|
value === "bootstrap" ||
|
|
12
|
+
value === "catalog-planning" ||
|
|
13
|
+
value === "strategy-planning" ||
|
|
11
14
|
value === "rulebook-authoring" ||
|
|
12
15
|
value === "recipe-authoring" ||
|
|
13
16
|
value === "sample-authoring" ||
|
package/dist/exec/task-repos.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { expandBranchTemplate } from "../shared/branch-template.js";
|
|
1
2
|
import { existsSync, readdirSync, rmdirSync } from "node:fs";
|
|
2
3
|
import { dirname, resolve } from "node:path";
|
|
3
4
|
import { getProjectRepos, getProjectSchedulePath, loadConfig, PROJECT_REPO_WORKTREE_DIRNAME, resolveRepoRoot, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
4
|
-
import { ensureExecWorktree,
|
|
5
|
+
import { ensureExecWorktree, execWorktreePath, findExecWorktree, generateWorktreeArtifacts, gitOutput, gitResult, installWorktreeDependencies, listRegisteredWorktrees, worktreeNameFromTaskId, } from "./worktree.js";
|
|
6
|
+
import { assertProductBranchAvailable, existingProductTaskBranch, forgetProductBranch, productBranchExists, productBranchRecords, recordedProductBranch, reserveProductBranch, } from "./product-branch-records.js";
|
|
5
7
|
// PJR-98G4: 1 つのタスクがプロジェクトリポジトリと宣言済みのプロダクトリポジトリ(`repos`)を
|
|
6
8
|
// 変更する場合の worktree を扱う。`repos` を持たない project では、ここの関数はどれも空の結果を
|
|
7
9
|
// 返し、既存の 1 リポジトリ・`<worktree_base>/<task-id>/` 直下の配置を変えない。
|
|
@@ -69,6 +71,8 @@ export function resolveProductRepos(rootDir, project, integrationBranches) {
|
|
|
69
71
|
name: repo.name,
|
|
70
72
|
repoRoot: resolveRepoRoot(rootDir, repo),
|
|
71
73
|
...(integrationBranch ? { integrationBranch } : {}),
|
|
74
|
+
...(repo.branch_template ? { branchTemplate: repo.branch_template } : {}),
|
|
75
|
+
...(repo.integration_strategy ? { integrationStrategy: repo.integration_strategy } : {}),
|
|
72
76
|
install: repo.setup?.install ?? true,
|
|
73
77
|
build: repo.setup?.build ?? true,
|
|
74
78
|
};
|
|
@@ -101,6 +105,7 @@ export function configuredProductCheckouts(schedulePath) {
|
|
|
101
105
|
branch: productIntegrationTarget(product),
|
|
102
106
|
created: false,
|
|
103
107
|
...(product.integrationBranch ? { integrationBranch: product.integrationBranch } : {}),
|
|
108
|
+
...(product.integrationStrategy ? { integrationStrategy: product.integrationStrategy } : {}),
|
|
104
109
|
}));
|
|
105
110
|
}
|
|
106
111
|
/**
|
|
@@ -154,18 +159,35 @@ export function productIntegrationTarget(product) {
|
|
|
154
159
|
return product.integrationBranch ?? currentBranchOrNull(product.repoRoot) ?? "HEAD";
|
|
155
160
|
}
|
|
156
161
|
const skip = () => undefined;
|
|
162
|
+
export function preflightProductBranches(products, taskId) {
|
|
163
|
+
for (const product of products) {
|
|
164
|
+
if (!existsSync(product.repoRoot)) {
|
|
165
|
+
throw new Error(`Product repository "${product.name}" does not exist: ${product.repoRoot} (check repos[].path)`);
|
|
166
|
+
}
|
|
167
|
+
assertProductBranchAvailable(product.repoRoot, taskId, productBranchForTask(product, taskId));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Reserve every name before recording register start or creating any product worktree. */
|
|
171
|
+
export function reserveProductBranches(products, taskId) {
|
|
172
|
+
preflightProductBranches(products, taskId);
|
|
173
|
+
for (const product of products) {
|
|
174
|
+
reserveProductBranch(product.repoRoot, taskId, productBranchForTask(product, taskId), productIntegrationTarget(product));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
157
177
|
/**
|
|
158
178
|
* Create (or reuse) `<worktree_base>/<task-name>/<repo>/` for every product repository. A new
|
|
159
179
|
* exec branch starts from the declared `integration_branch` (or the repository's current branch)
|
|
160
180
|
* because the checkpoint commit belongs to the project repository only.
|
|
161
181
|
*/
|
|
162
182
|
export function ensureProductWorktrees(opts) {
|
|
183
|
+
reserveProductBranches(opts.products, opts.taskId);
|
|
163
184
|
return opts.products.map((product) => {
|
|
164
185
|
if (!existsSync(product.repoRoot)) {
|
|
165
186
|
throw new Error(`Product repository "${product.name}" does not exist: ${product.repoRoot} (check repos[].path)`);
|
|
166
187
|
}
|
|
188
|
+
const branch = productBranchForTask(product, opts.taskId);
|
|
167
189
|
const generate = product.build ? (opts.generateArtifacts ?? generateWorktreeArtifacts) : skip;
|
|
168
|
-
const existing = findExecWorktree(product.repoRoot, opts.taskId);
|
|
190
|
+
const existing = findExecWorktree(product.repoRoot, opts.taskId, branch);
|
|
169
191
|
if (existing) {
|
|
170
192
|
// Same as the project worktree on reuse: dependencies stay, generated files are rebuilt.
|
|
171
193
|
generate(existing.path);
|
|
@@ -176,6 +198,7 @@ export function ensureProductWorktrees(opts) {
|
|
|
176
198
|
worktreeBase: opts.worktreeBase,
|
|
177
199
|
taskId: opts.taskId,
|
|
178
200
|
repoDirName: product.name,
|
|
201
|
+
branch,
|
|
179
202
|
startPoint: productIntegrationTarget(product),
|
|
180
203
|
installDependencies: product.install
|
|
181
204
|
? (opts.installDependencies ?? installWorktreeDependencies)
|
|
@@ -193,14 +216,36 @@ function toProductWorktree(product, worktree) {
|
|
|
193
216
|
branch: worktree.branch,
|
|
194
217
|
created: worktree.created,
|
|
195
218
|
...(product.integrationBranch ? { integrationBranch: product.integrationBranch } : {}),
|
|
219
|
+
...(product.integrationStrategy ? { integrationStrategy: product.integrationStrategy } : {}),
|
|
196
220
|
};
|
|
197
221
|
}
|
|
222
|
+
/** Recorded names survive template/topic changes and do not depend on a branch prefix. */
|
|
223
|
+
export function productBranchForTask(product, taskId, reuseRecorded = true) {
|
|
224
|
+
const separator = taskId.indexOf(":");
|
|
225
|
+
const project = separator >= 0 ? taskId.slice(0, separator) : "";
|
|
226
|
+
const id = separator >= 0 ? taskId.slice(separator + 1) : taskId;
|
|
227
|
+
return (product.branch ??
|
|
228
|
+
(reuseRecorded ? recordedProductBranch(product.repoRoot, taskId) : undefined) ??
|
|
229
|
+
(product.branchTemplate
|
|
230
|
+
? expandBranchTemplate(product.branchTemplate, {
|
|
231
|
+
project,
|
|
232
|
+
id,
|
|
233
|
+
topic: id.toLowerCase(),
|
|
234
|
+
type: "feat",
|
|
235
|
+
scope: "",
|
|
236
|
+
title: id,
|
|
237
|
+
})
|
|
238
|
+
: `exec/${worktreeNameFromTaskId(taskId)}`));
|
|
239
|
+
}
|
|
198
240
|
/** Registered product worktrees of a task (repositories without one are omitted). */
|
|
199
241
|
export function findProductWorktrees(products, taskId) {
|
|
200
242
|
return products.flatMap((product) => {
|
|
201
243
|
if (!existsSync(product.repoRoot))
|
|
202
244
|
return [];
|
|
203
|
-
const
|
|
245
|
+
const branch = existingProductTaskBranch(product.repoRoot, taskId);
|
|
246
|
+
if (!branch)
|
|
247
|
+
return [];
|
|
248
|
+
const found = findExecWorktree(product.repoRoot, taskId, branch);
|
|
204
249
|
return found ? [toProductWorktree(product, found)] : [];
|
|
205
250
|
});
|
|
206
251
|
}
|
|
@@ -282,7 +327,7 @@ export function productWorktreeRemovalBlockers(worktree) {
|
|
|
282
327
|
if (dirty.length > 0) {
|
|
283
328
|
blockers.push(`${product.name} has uncommitted changes: ${dirty.map((path) => `${product.name}:${path}`).join(", ")}`);
|
|
284
329
|
}
|
|
285
|
-
if (!isMergedIntoTarget(product)) {
|
|
330
|
+
if (product.integrationStrategy !== "branch-only" && !isMergedIntoTarget(product)) {
|
|
286
331
|
blockers.push(`${product.name}: exec branch ${product.branch} is not merged into ${productIntegrationTarget(product)}`);
|
|
287
332
|
}
|
|
288
333
|
}
|
|
@@ -291,26 +336,28 @@ export function productWorktreeRemovalBlockers(worktree) {
|
|
|
291
336
|
/** Remove product worktrees (and optionally their branches). Callers check blockers first. */
|
|
292
337
|
export function removeProductWorktrees(params) {
|
|
293
338
|
for (const product of params.worktree.repos ?? []) {
|
|
339
|
+
const deleteBranch = params.deleteBranch && product.integrationStrategy !== "branch-only";
|
|
294
340
|
if (params.dryRun) {
|
|
295
341
|
process.stdout.write(`[dry-run] git -C ${product.repoRoot} worktree remove --force ${product.path}\n`);
|
|
296
|
-
if (
|
|
342
|
+
if (deleteBranch) {
|
|
297
343
|
process.stdout.write(`[dry-run] git -C ${product.repoRoot} branch -d ${product.branch}\n`);
|
|
298
344
|
}
|
|
299
345
|
continue;
|
|
300
346
|
}
|
|
301
347
|
if (existsSync(product.path)) {
|
|
302
|
-
// Guards (clean
|
|
348
|
+
// Guards (clean, and merged unless branch-only) already ran.
|
|
303
349
|
gitOutput(product.repoRoot, ["worktree", "remove", "--force", product.path]);
|
|
304
350
|
}
|
|
305
351
|
else {
|
|
306
352
|
gitResult(product.repoRoot, ["worktree", "prune"]);
|
|
307
353
|
}
|
|
308
|
-
if (
|
|
354
|
+
if (deleteBranch) {
|
|
309
355
|
// `-d` compares with the main checkout's HEAD, which may differ from integration_branch.
|
|
310
356
|
// Use `-D` only for a branch verified to be merged into its integration target; otherwise
|
|
311
357
|
// keep Git's safe `-d` so unintegrated product work is never deleted.
|
|
312
358
|
const flag = isMergedIntoTarget(product) ? "-D" : "-d";
|
|
313
359
|
gitOutput(product.repoRoot, ["branch", flag, product.branch]);
|
|
360
|
+
forgetProductBranch(product.repoRoot, product.branch);
|
|
314
361
|
}
|
|
315
362
|
}
|
|
316
363
|
}
|
|
@@ -334,23 +381,36 @@ export function removeEmptyTaskDirectory(worktree) {
|
|
|
334
381
|
* or cancelled lifecycle). Mirrors discardStaleExecWorktree for each product repository.
|
|
335
382
|
*/
|
|
336
383
|
export function discardStaleProductWorktrees(products, taskId) {
|
|
384
|
+
// A retained branch is product-side review work, not abandoned scheduler residue.
|
|
385
|
+
for (const product of products) {
|
|
386
|
+
if (!existsSync(product.repoRoot))
|
|
387
|
+
continue;
|
|
388
|
+
const branch = existingProductTaskBranch(product.repoRoot, taskId);
|
|
389
|
+
if (product.integrationStrategy === "branch-only" &&
|
|
390
|
+
branch &&
|
|
391
|
+
productBranchExists(product.repoRoot, branch)) {
|
|
392
|
+
throw new Error(`${product.name}: retained exec branch ${branch} already exists; ` +
|
|
393
|
+
`resume the existing run or finish product-side review and rename/remove the branch before a fresh run`);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
337
396
|
const discarded = [];
|
|
338
397
|
for (const product of products) {
|
|
339
398
|
if (!existsSync(product.repoRoot))
|
|
340
399
|
continue;
|
|
341
|
-
const
|
|
342
|
-
if (!
|
|
400
|
+
const branch = existingProductTaskBranch(product.repoRoot, taskId);
|
|
401
|
+
if (!branch)
|
|
343
402
|
continue;
|
|
403
|
+
const existing = findExecWorktree(product.repoRoot, taskId, branch);
|
|
344
404
|
if (existing) {
|
|
345
405
|
if (resolve(product.repoRoot) === resolve(existing.path)) {
|
|
346
|
-
throw new Error(`Refusing to discard the main checkout of ${product.name} as stale residue: ${
|
|
406
|
+
throw new Error(`Refusing to discard the main checkout of ${product.name} as stale residue: ${branch}`);
|
|
347
407
|
}
|
|
348
408
|
gitOutput(product.repoRoot, ["worktree", "remove", "--force", existing.path]);
|
|
349
409
|
}
|
|
350
|
-
|
|
351
|
-
if (execBranchExists(product.repoRoot, taskId)) {
|
|
410
|
+
if (productBranchExists(product.repoRoot, branch)) {
|
|
352
411
|
gitOutput(product.repoRoot, ["branch", "-D", branch]);
|
|
353
412
|
}
|
|
413
|
+
forgetProductBranch(product.repoRoot, branch);
|
|
354
414
|
discarded.push(`${product.name}:${branch}`);
|
|
355
415
|
}
|
|
356
416
|
return discarded;
|
|
@@ -365,14 +425,25 @@ export function listOrphanedProductExecBranches(products, projectId) {
|
|
|
365
425
|
.map((worktree) => worktree.branch)
|
|
366
426
|
.filter((branch) => !!branch));
|
|
367
427
|
const target = productIntegrationTarget(product);
|
|
368
|
-
|
|
428
|
+
const legacyBranches = gitOutput(product.repoRoot, [
|
|
369
429
|
"for-each-ref",
|
|
370
430
|
"--format=%(refname:short)",
|
|
371
431
|
"refs/heads/exec/",
|
|
372
432
|
])
|
|
373
433
|
.split(/\r?\n/)
|
|
374
434
|
.map((branch) => branch.trim())
|
|
375
|
-
.filter((branch) => branch.startsWith(prefix)
|
|
435
|
+
.filter((branch) => branch.startsWith(prefix));
|
|
436
|
+
const records = productBranchRecords(product.repoRoot);
|
|
437
|
+
const owned = records
|
|
438
|
+
.filter((record) => record.taskId.startsWith(`${projectId}:`))
|
|
439
|
+
.map((record) => record.branch);
|
|
440
|
+
return [
|
|
441
|
+
...new Set([
|
|
442
|
+
...owned,
|
|
443
|
+
...legacyBranches.filter((branch) => !records.some((record) => record.branch === branch)),
|
|
444
|
+
]),
|
|
445
|
+
]
|
|
446
|
+
.filter((branch) => !checkedOut.has(branch) && productBranchExists(product.repoRoot, branch))
|
|
376
447
|
.sort()
|
|
377
448
|
.map((branch) => ({
|
|
378
449
|
repo: product.name,
|
|
@@ -381,7 +452,7 @@ export function listOrphanedProductExecBranches(products, projectId) {
|
|
|
381
452
|
}));
|
|
382
453
|
});
|
|
383
454
|
}
|
|
384
|
-
/** Delete
|
|
455
|
+
/** Delete only orphan branches verified as merged into the product's integration target. */
|
|
385
456
|
export function pruneOrphanedProductExecBranches(params) {
|
|
386
457
|
const orphaned = listOrphanedProductExecBranches(params.products, params.projectId);
|
|
387
458
|
for (const item of orphaned) {
|
|
@@ -391,7 +462,12 @@ export function pruneOrphanedProductExecBranches(params) {
|
|
|
391
462
|
if (!product)
|
|
392
463
|
continue;
|
|
393
464
|
try {
|
|
394
|
-
|
|
465
|
+
// The main checkout's HEAD need not be the integration target. Recheck that target
|
|
466
|
+
// before using -D, just as removeProductWorktrees does for a non-orphan branch.
|
|
467
|
+
if (!isMergedIntoTarget({ ...product, branch: item.branch }))
|
|
468
|
+
continue;
|
|
469
|
+
gitOutput(product.repoRoot, ["branch", "-D", item.branch]);
|
|
470
|
+
forgetProductBranch(product.repoRoot, item.branch);
|
|
395
471
|
}
|
|
396
472
|
catch (error) {
|
|
397
473
|
throw new Error(`Failed to delete merged orphaned exec branch ${item.repo}:${item.branch}; ` +
|
|
@@ -8,7 +8,7 @@ import { activateResolvedProjectPaths, resolveProjectPaths } from "./project.js"
|
|
|
8
8
|
import { agentGitStateViolation, captureAgentGitStateAcrossRepos, changedAgentGitStateAcrossRepos, qualifiedGitStateFields, } from "./agent-git-state.js";
|
|
9
9
|
import { agentProtectedConfigViolation, captureAgentProtectedConfigAcrossRepos, changedAgentProtectedConfigAcrossRepos, qualifiedRepoPaths, } from "./agent-protected-config.js";
|
|
10
10
|
import { recordGitStateBlockAcrossRepos, recordProtectedConfigBlockAcrossRepos, } from "./protection-handoff.js";
|
|
11
|
-
import { configuredProductRepos, missingProductWorktrees, plannedProjectWorktreePath, pruneOrphanedProductExecBranches, productRepoEnvironment, withAgentExtraRoots, withoutInheritedRepoEnvironment, withProductRepoPrompt, withProductWorktrees, } from "./task-repos.js";
|
|
11
|
+
import { configuredProductRepos, missingProductWorktrees, plannedProjectWorktreePath, productBranchForTask, pruneOrphanedProductExecBranches, productRepoEnvironment, withAgentExtraRoots, withoutInheritedRepoEnvironment, withProductRepoPrompt, withProductWorktrees, } from "./task-repos.js";
|
|
12
12
|
import { resolveAgentMember } from "../shared/specdojo-config.js";
|
|
13
13
|
import { buildTaskPhaseMap, loadPrompt, loadRosterForExecutionPath, resolveTaskPhaseContext, selectCandidates, } from "./run/run.js";
|
|
14
14
|
import { buildScheduleIndex } from "./schedule/schedule.js";
|
|
@@ -147,7 +147,7 @@ async function prepare(opts) {
|
|
|
147
147
|
name: product.name,
|
|
148
148
|
repoRoot: product.repoRoot,
|
|
149
149
|
path: resolve(base, name, product.name),
|
|
150
|
-
branch,
|
|
150
|
+
branch: productBranchForTask(product, worktreeTaskId),
|
|
151
151
|
created: false,
|
|
152
152
|
})),
|
|
153
153
|
}
|
|
@@ -9,6 +9,7 @@ import { agentProtectedConfigPaths, agentProtectedConfigViolation, qualifiedRepo
|
|
|
9
9
|
import { recordProtectedConfigBlockAcrossRepos } from "./protection-handoff.js";
|
|
10
10
|
import { assertNoPendingProductChanges, productIntegrationTarget } from "./task-repos.js";
|
|
11
11
|
import { specdojoPackageRootDir } from "../shared/package-paths.js";
|
|
12
|
+
import { DEFAULT_MARKDOWNLINT_CONFIG, hasMarkdownlintConfig, } from "../shared/markdownlint-config.js";
|
|
12
13
|
import { repoRelative, stageCommitTargets, worktreeStatusPaths as statusPaths, } from "../shared/git.js";
|
|
13
14
|
export { repoRelative, selectStageablePaths, stageCommitTargets, worktreeStatusPaths, } from "../shared/git.js";
|
|
14
15
|
import { appendGitFailureLog, appendGitResultFailureLog, formatGitResultFailure, gitEnvironment, gitOutput, gitResult, summarizeGitHookFailure, worktreeNameFromTaskId, } from "./worktree.js";
|
|
@@ -442,7 +443,12 @@ export function assertResultMarkdownlint(context, worktree, taskId) {
|
|
|
442
443
|
process.stdout.write(`result-markdownlint: markdownlint-cli not found; skipped pre-commit lint of ${resultRel}\n`);
|
|
443
444
|
return;
|
|
444
445
|
}
|
|
445
|
-
|
|
446
|
+
// Only supply defaults when markdownlint-cli has no repository configuration.
|
|
447
|
+
// --disable is followed by -- so the result path is not consumed as a rule name.
|
|
448
|
+
const args = hasMarkdownlintConfig(worktree.path)
|
|
449
|
+
? [resultRel]
|
|
450
|
+
: ["--disable", ...Object.keys(DEFAULT_MARKDOWNLINT_CONFIG), "--", resultRel];
|
|
451
|
+
const result = spawnSync(executable, args, {
|
|
446
452
|
cwd: worktree.path,
|
|
447
453
|
encoding: "utf8",
|
|
448
454
|
env: gitEnvironment(),
|
package/dist/exec/worktree.js
CHANGED
|
@@ -43,9 +43,9 @@ export function listRegisteredWorktrees(repoRoot) {
|
|
|
43
43
|
pushCurrent();
|
|
44
44
|
return result;
|
|
45
45
|
}
|
|
46
|
-
export function findExecWorktree(repoRoot, taskId) {
|
|
46
|
+
export function findExecWorktree(repoRoot, taskId, branchOverride) {
|
|
47
47
|
const name = worktreeNameFromTaskId(taskId);
|
|
48
|
-
const branch = `exec/${name}`;
|
|
48
|
+
const branch = branchOverride ?? `exec/${name}`;
|
|
49
49
|
const registered = listRegisteredWorktrees(repoRoot).find((item) => item.branch === branch);
|
|
50
50
|
if (!registered)
|
|
51
51
|
return null;
|
|
@@ -251,7 +251,7 @@ export function ensureExecWorktree(opts) {
|
|
|
251
251
|
throw new Error(`Worktree base must be outside the repository: ${opts.worktreeBase}`);
|
|
252
252
|
}
|
|
253
253
|
const name = worktreeNameFromTaskId(opts.taskId);
|
|
254
|
-
const branch = `exec/${name}`;
|
|
254
|
+
const branch = opts.branch ?? `exec/${name}`;
|
|
255
255
|
const worktreePath = execWorktreePath(opts.worktreeBase, opts.taskId, opts.repoDirName);
|
|
256
256
|
const registered = listRegisteredWorktrees(repoRoot);
|
|
257
257
|
const registeredAtPath = registered.find((item) => item.path === worktreePath);
|
package/dist/grade/apply.js
CHANGED
|
@@ -5,7 +5,7 @@ import { dump } from "../shared/yaml.js";
|
|
|
5
5
|
import { extractJsonText } from "../shared/agent-response.js";
|
|
6
6
|
import { CRITERION_ID_RE, CRITERION_STATUSES, DONE_CRITERIA_SCHEMA, SEVERITY_LEVEL_CAP, agentViewpoints, correctViewpointLevels, isRecord, levelCapForFindings, parseMarkdown, preserveStoredFindingSeverities, sanitizeCommentText, } from "./core.js";
|
|
7
7
|
import { applicableDoneCriteria, deterministicResults, gradePlanFilename } from "./plan.js";
|
|
8
|
-
import { gradeContentHash,
|
|
8
|
+
import { gradeContentHash, gradeResultPathForDocument, markdownDocumentId, readGradeResult, writeGradeResult, } from "./result.js";
|
|
9
9
|
import { gradeMarkdownDocument, resolveGradeReferenceId, scoreDocument, summarizeDoneCriteria, } from "./markdown.js";
|
|
10
10
|
import { assertRubric, createGradeSourceContext, gradeSourceHashes, repoRelativePath, resolveSafeMarkdownPath, resolveSafeRepositoryPath, } from "./targets.js";
|
|
11
11
|
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
@@ -575,7 +575,11 @@ export function applyGradeSubmission(opts) {
|
|
|
575
575
|
}
|
|
576
576
|
if (opts.resultsDirectory) {
|
|
577
577
|
const documentId = markdownDocumentId(current, rel);
|
|
578
|
-
const resultPath =
|
|
578
|
+
const resultPath = gradeResultPathForDocument({
|
|
579
|
+
documentPath: absolute,
|
|
580
|
+
project: opts.project,
|
|
581
|
+
resultsDirectory: opts.resultsDirectory,
|
|
582
|
+
});
|
|
579
583
|
const previous = readGradeResult(resultPath);
|
|
580
584
|
const document = parseMarkdown(current, rel);
|
|
581
585
|
const agentResults = preserveStoredFindingSeverities(previous, input.viewpoints);
|
package/dist/grade/markdown.js
CHANGED
|
@@ -2,7 +2,7 @@ import { readFileSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { FINDING_RE, insertFindings, isRecord, legacyInlineContentHash, parseMarkdown, preservePreviousFindingSeverities, serializeMarkdown, withoutFindingComments, } from "./core.js";
|
|
3
3
|
import { discoverGradeTargets } from "./target-discovery.js";
|
|
4
4
|
import { applicableDoneCriteria, deterministicResults } from "./plan.js";
|
|
5
|
-
import { gradeContentHash,
|
|
5
|
+
import { gradeContentHash, gradeResultPathForDocument, markdownDocumentId, readGradeResultForDocument, resolveGradeResultsDirectory, validateGradeResult, writeGradeResult, } from "./result.js";
|
|
6
6
|
import { assertRubric, relativePathFromRoot, repoRelativePath, resolveSafeMarkdownPath, } from "./targets.js";
|
|
7
7
|
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
8
8
|
export function scoreDocument(input, rubric, doc, target) {
|
|
@@ -265,7 +265,12 @@ export function migrateInlineGrades(opts) {
|
|
|
265
265
|
findings,
|
|
266
266
|
...(isRecord(legacyGrade.done_criteria) ? { done_criteria: legacyGrade.done_criteria } : {}),
|
|
267
267
|
};
|
|
268
|
-
const resultPath =
|
|
268
|
+
const resultPath = gradeResultPathForDocument({
|
|
269
|
+
documentPath: absolute,
|
|
270
|
+
project: opts.project,
|
|
271
|
+
rootDir,
|
|
272
|
+
resultsDirectory,
|
|
273
|
+
});
|
|
269
274
|
if (writeGradeResult(resultPath, result, opts.dryRun)) {
|
|
270
275
|
changed.push(repoRelativePath(resultPath));
|
|
271
276
|
}
|
package/dist/grade/plan.js
CHANGED
|
@@ -4,7 +4,7 @@ import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
|
4
4
|
import { basename, extname, join } from "node:path";
|
|
5
5
|
import { dump } from "../shared/yaml.js";
|
|
6
6
|
import { GRADE_PLAN_EMBEDDED_DOCUMENT_CHARACTER_LIMIT, agentViewpoints, gradedViewpoints, levelCapForFindings, parseMarkdown, } from "./core.js";
|
|
7
|
-
import {
|
|
7
|
+
import { gradeResultPathForDocument, readGradeResult } from "./result.js";
|
|
8
8
|
import { assertRubric, loadKataReferences, parseGradeReferenceExample, repoRelativePath, resolveGradeReferencePathsFromCatalog, resolveSafeMarkdownPath, resolveSafeRepositoryPath, selectGradeReferenceExampleFromCatalog, } from "./targets.js";
|
|
9
9
|
import { viewpointAppliesToDocument } from "../review/plan.js";
|
|
10
10
|
export function deterministicResults(document, definitions, target) {
|
|
@@ -145,9 +145,11 @@ function renderGradePlanWithEmbedding(opts) {
|
|
|
145
145
|
const metadata = document.data.specdojo;
|
|
146
146
|
const viewpoints = agentViewpoints(opts.viewpoints, opts.target, metadata);
|
|
147
147
|
const documentId = typeof metadata.id === "string" ? metadata.id : rel;
|
|
148
|
-
const priorFindings = (
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
const priorFindings = readGradeResult(gradeResultPathForDocument({
|
|
149
|
+
documentPath: absolute,
|
|
150
|
+
project: opts.projectId,
|
|
151
|
+
resultsDirectory: opts.resultsDirectory,
|
|
152
|
+
}))?.findings ?? [];
|
|
151
153
|
const taskHash = createHash("sha256").update(rel).digest("hex").slice(0, 12).toUpperCase();
|
|
152
154
|
const taskId = `GRADE-${opts.target.toUpperCase()}-${taskHash}`;
|
|
153
155
|
const references = (opts.references ?? []).map((reference) => repoRelativePath(resolveSafeRepositoryPath(reference, "reference")));
|
|
@@ -10,6 +10,7 @@ import { load } from "../shared/yaml.js";
|
|
|
10
10
|
import { assertAuthorableKataId, authoredKataExists, authoringKind } from "../kata/authoring.js";
|
|
11
11
|
import { CATALOG_LESS_APPROACHES, resolveRegisterDeliverableTarget } from "./deliverable-target.js";
|
|
12
12
|
import { resolveAuthoringSources } from "./authoring-sources.js";
|
|
13
|
+
import { isPlanningApproach, validatePlanningTarget } from "./planning.js";
|
|
13
14
|
const MAINTENANCE_TARGET_KIND = {
|
|
14
15
|
"rulebook-maintenance": "rulebook",
|
|
15
16
|
"recipe-maintenance": "recipe",
|
|
@@ -98,6 +99,17 @@ export function validateRegisterApproachTargets(opts) {
|
|
|
98
99
|
return;
|
|
99
100
|
if (targets.length === 0)
|
|
100
101
|
return;
|
|
102
|
+
if (isPlanningApproach(approach)) {
|
|
103
|
+
validatePlanningTarget({
|
|
104
|
+
repoRoot: opts.repoRoot,
|
|
105
|
+
approach,
|
|
106
|
+
target: targets[0],
|
|
107
|
+
project: opts.project ??
|
|
108
|
+
loadConfig(opts.repoRoot).config?.projects[opts.projectId] ??
|
|
109
|
+
(opts.catalogPath ? { catalog_path: opts.catalogPath } : {}),
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
101
113
|
const entries = collectDocIndexEntries(resolve(opts.repoRoot, "docs"), opts.repoRoot);
|
|
102
114
|
if (!approach) {
|
|
103
115
|
for (const target of targets) {
|
|
@@ -131,6 +143,13 @@ export function validateRegisterApproachTargets(opts) {
|
|
|
131
143
|
if (!indexedPath) {
|
|
132
144
|
throw new Error(`Target document id is not resolvable via the document index: ${targetId}`);
|
|
133
145
|
}
|
|
146
|
+
// sample は見本にする成果物の type を持つため、種類は ID の命名で判定する。
|
|
147
|
+
if (expectedKind === "sample") {
|
|
148
|
+
if (!targetId.endsWith("-sample")) {
|
|
149
|
+
throw new Error(`Approach "${approach}" requires a sample document target with an id ending in -sample: ${targetId}`);
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
134
153
|
const actualKind = targetDocumentType(resolvedIndexPath(opts.repoRoot, indexedPath));
|
|
135
154
|
if (actualKind !== expectedKind) {
|
|
136
155
|
throw new Error(`Approach "${approach}" requires a ${expectedKind} document target, but ${targetId} has type "${actualKind ?? "unknown"}"`);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { loadRegisterItemDocs } from "./item.js";
|
|
2
|
+
import { planningTarget } from "./planning.js";
|
|
3
|
+
// No state is persisted: reopened tickets are reflected on the next build as well.
|
|
4
|
+
export function deriveTimelineCatalogStatus(tracks, items) {
|
|
5
|
+
const byDomain = new Map();
|
|
6
|
+
for (const item of items) {
|
|
7
|
+
if (item.type !== "todo" || item.approach !== "catalog-planning")
|
|
8
|
+
continue;
|
|
9
|
+
if (item.status === "rejected" || item.status === "deferred")
|
|
10
|
+
continue;
|
|
11
|
+
if (item.targets?.length !== 1)
|
|
12
|
+
continue;
|
|
13
|
+
const domain = planningTarget(item.approach, item.targets[0]);
|
|
14
|
+
const status = item.status === "done" ? "primary" : item.status === "open" ? "not_started" : "draft";
|
|
15
|
+
const values = byDomain.get(domain) ?? [];
|
|
16
|
+
values.push(status);
|
|
17
|
+
byDomain.set(domain, values);
|
|
18
|
+
}
|
|
19
|
+
const warnings = [];
|
|
20
|
+
return {
|
|
21
|
+
tracks: tracks.map((track) => {
|
|
22
|
+
if (!track.domains.some((domain) => byDomain.has(domain)))
|
|
23
|
+
return { ...track };
|
|
24
|
+
const statuses = track.domains.map((domain) => {
|
|
25
|
+
const values = byDomain.get(domain);
|
|
26
|
+
if (!values)
|
|
27
|
+
return track.catalog_status;
|
|
28
|
+
return values.includes("primary")
|
|
29
|
+
? "primary"
|
|
30
|
+
: values.includes("draft")
|
|
31
|
+
? "draft"
|
|
32
|
+
: "not_started";
|
|
33
|
+
});
|
|
34
|
+
const status = statuses.every((value) => value === "primary")
|
|
35
|
+
? "primary"
|
|
36
|
+
: statuses.some((value) => value !== "not_started")
|
|
37
|
+
? "draft"
|
|
38
|
+
: "not_started";
|
|
39
|
+
if (status !== track.catalog_status) {
|
|
40
|
+
warnings.push(`${track.track}: register-derived catalog_status is ${status}, but tml-index.yaml declares ${track.catalog_status}; using register-derived status (tml-index.yaml is unchanged)`);
|
|
41
|
+
}
|
|
42
|
+
return { ...track, catalog_status: status };
|
|
43
|
+
}),
|
|
44
|
+
warnings,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function resolveTimelineCatalogStatus(tracks, registerPath) {
|
|
48
|
+
return deriveTimelineCatalogStatus(tracks, registerPath ? loadRegisterItemDocs(registerPath).map((doc) => doc.item) : []);
|
|
49
|
+
}
|