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
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { unified } from "unified";
|
|
2
|
+
import remarkParse from "remark-parse";
|
|
3
|
+
import { escapeMarkdownInline } from "../shared/text.js";
|
|
4
|
+
function isHeadingNode(node) {
|
|
5
|
+
return (node.type === "heading" &&
|
|
6
|
+
node.position?.start.offset !== undefined &&
|
|
7
|
+
node.position?.end.offset !== undefined);
|
|
8
|
+
}
|
|
9
|
+
function headingTitle(body, node) {
|
|
10
|
+
return body
|
|
11
|
+
.slice(node.position.start.offset, node.position.end.offset)
|
|
12
|
+
.replace(/^#+\s+/, "")
|
|
13
|
+
.replace(/\s+#+\s*$/, "")
|
|
14
|
+
.trim();
|
|
15
|
+
}
|
|
16
|
+
// 本文の見出しだけを探す。コード例・引用内の「入力」は節として扱わない。
|
|
17
|
+
function findInputSection(content) {
|
|
18
|
+
const prefix = content.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/)?.[0] ?? "";
|
|
19
|
+
const body = content.slice(prefix.length);
|
|
20
|
+
if (!/^##\s+(?:\d+\.\s*)?入力(?:\s|$)/m.test(body))
|
|
21
|
+
return undefined;
|
|
22
|
+
const nodes = unified().use(remarkParse).parse(body).children;
|
|
23
|
+
const index = nodes.findIndex((node) => isHeadingNode(node) &&
|
|
24
|
+
node.depth === 2 &&
|
|
25
|
+
/^(?:\d+\.\s*)?入力$/.test(headingTitle(body, node)));
|
|
26
|
+
if (index < 0)
|
|
27
|
+
return undefined;
|
|
28
|
+
const heading = nodes[index];
|
|
29
|
+
if (!isHeadingNode(heading))
|
|
30
|
+
return undefined;
|
|
31
|
+
const title = headingTitle(body, heading);
|
|
32
|
+
const isNumbered = /^\d+\.\s*入力$/.test(title);
|
|
33
|
+
const next = nodes.slice(index + 1).findIndex((node) => isHeadingNode(node) && node.depth <= 2);
|
|
34
|
+
const endIndex = next < 0 ? nodes.length : index + 1 + next;
|
|
35
|
+
return {
|
|
36
|
+
body,
|
|
37
|
+
nodes: nodes.slice(index + 1, endIndex),
|
|
38
|
+
isNumbered,
|
|
39
|
+
sectionStart: prefix.length + heading.position.start.offset,
|
|
40
|
+
start: prefix.length + heading.position.end.offset,
|
|
41
|
+
end: prefix.length + (nodes[endIndex]?.position?.start.offset ?? body.length),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function readRegisterInput(content) {
|
|
45
|
+
const section = findInputSection(content);
|
|
46
|
+
if (!section)
|
|
47
|
+
return undefined;
|
|
48
|
+
const inputs = section.nodes
|
|
49
|
+
.flatMap((node) => node.type === "list"
|
|
50
|
+
? node.children.map((item) => section.body
|
|
51
|
+
.slice(item.position.start.offset, item.position.end.offset)
|
|
52
|
+
.replace(/^(?:[-*+]|\d+[.)])\s+/, "")
|
|
53
|
+
.replace(/\r?\n {2}/g, "\n")
|
|
54
|
+
.trim())
|
|
55
|
+
: [])
|
|
56
|
+
.filter((value) => value !== "" && value !== "-");
|
|
57
|
+
return inputs.length > 0 ? inputs : undefined;
|
|
58
|
+
}
|
|
59
|
+
export function normalizeRegisterInput(values, allowRemove = false) {
|
|
60
|
+
if (values === undefined)
|
|
61
|
+
return undefined;
|
|
62
|
+
const inputs = values.map((value) => value.replace(/\r\n/g, "\n").trim());
|
|
63
|
+
if (inputs.includes("-")) {
|
|
64
|
+
if (!allowRemove)
|
|
65
|
+
throw new Error("--input - is only valid with register update");
|
|
66
|
+
if (inputs.length !== 1)
|
|
67
|
+
throw new Error("--input - cannot be combined with other inputs");
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
if (inputs.some((value) => value === ""))
|
|
71
|
+
throw new Error("--input must contain non-empty text");
|
|
72
|
+
return inputs;
|
|
73
|
+
}
|
|
74
|
+
export function registerInputMarkdown(inputs) {
|
|
75
|
+
return inputs
|
|
76
|
+
.map((input) => `- ${escapeMarkdownInline(input).replace(/\n/g, "\n ")}`)
|
|
77
|
+
.join("\n");
|
|
78
|
+
}
|
|
79
|
+
export function setRegisterInput(content, inputs) {
|
|
80
|
+
const existingSection = findInputSection(content);
|
|
81
|
+
const text = inputs.length > 0 ? registerInputMarkdown(inputs) : "-";
|
|
82
|
+
// すでに番号付きの入力章がある場合は、既存の位置・番号のまま中身を置換する
|
|
83
|
+
if (existingSection && existingSection.isNumbered) {
|
|
84
|
+
const tail = content.slice(existingSection.end);
|
|
85
|
+
return `${content.slice(0, existingSection.start)}\n\n${text}\n${tail ? `\n${tail}` : ""}`;
|
|
86
|
+
}
|
|
87
|
+
// 番号なしの「## 入力」がある場合は一旦除去する
|
|
88
|
+
let cleanContent = content;
|
|
89
|
+
if (existingSection && !existingSection.isNumbered) {
|
|
90
|
+
if (existingSection.end >= content.length) {
|
|
91
|
+
cleanContent = `${content.slice(0, existingSection.sectionStart).trimEnd()}\n`;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const before = content.slice(0, existingSection.sectionStart).trimEnd();
|
|
95
|
+
const after = content.slice(existingSection.end).trimStart();
|
|
96
|
+
cleanContent = `${before}\n\n${after}`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const prefix = cleanContent.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/)?.[0] ?? "";
|
|
100
|
+
const body = cleanContent.slice(prefix.length);
|
|
101
|
+
const nodes = unified().use(remarkParse).parse(body).children;
|
|
102
|
+
const h2Nodes = nodes.filter((node) => isHeadingNode(node) && node.depth === 2);
|
|
103
|
+
// H2 見出しが 1 つもない場合
|
|
104
|
+
if (h2Nodes.length === 0) {
|
|
105
|
+
return `${cleanContent.trimEnd()}\n\n## 1. 入力\n\n${text}\n`;
|
|
106
|
+
}
|
|
107
|
+
const firstH2 = h2Nodes[0];
|
|
108
|
+
const firstTitle = headingTitle(body, firstH2);
|
|
109
|
+
const firstMatch = firstTitle.match(/^(\d+)\./);
|
|
110
|
+
const inputNum = firstMatch ? parseInt(firstMatch[1], 10) + 1 : 2;
|
|
111
|
+
const inputSectionText = `## ${inputNum}. 入力\n\n${text}\n\n`;
|
|
112
|
+
// 第1章のみで、第2章以降がない場合
|
|
113
|
+
if (h2Nodes.length === 1) {
|
|
114
|
+
return `${prefix}${body.trimEnd()}\n\n## ${inputNum}. 入力\n\n${text}\n`;
|
|
115
|
+
}
|
|
116
|
+
// 第2章以降がある場合: 第2章の直前に挿入し、以降の見出し番号を繰り下げる
|
|
117
|
+
const splitOffset = h2Nodes[1].position.start.offset;
|
|
118
|
+
const head = `${body.slice(0, splitOffset).trimEnd()}\n\n`;
|
|
119
|
+
const tail = body.slice(splitOffset);
|
|
120
|
+
const edits = [];
|
|
121
|
+
let currentOldH2Num;
|
|
122
|
+
for (const node of nodes) {
|
|
123
|
+
if (!isHeadingNode(node) || node.position.start.offset < splitOffset)
|
|
124
|
+
continue;
|
|
125
|
+
const startInTail = node.position.start.offset - splitOffset;
|
|
126
|
+
const endInTail = node.position.end.offset - splitOffset;
|
|
127
|
+
const raw = tail.slice(startInTail, endInTail);
|
|
128
|
+
if (node.depth === 2) {
|
|
129
|
+
const match = raw.match(/^(##\s+)(\d+)(\..*)$/);
|
|
130
|
+
if (match) {
|
|
131
|
+
const oldNum = parseInt(match[2], 10);
|
|
132
|
+
const newNum = oldNum + 1;
|
|
133
|
+
currentOldH2Num = oldNum;
|
|
134
|
+
edits.push({
|
|
135
|
+
start: startInTail,
|
|
136
|
+
end: endInTail,
|
|
137
|
+
replacement: `${match[1]}${newNum}${match[3]}`,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
currentOldH2Num = undefined;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (node.depth > 2 && currentOldH2Num !== undefined) {
|
|
145
|
+
const subMatch = raw.match(/^(#{3,6}\s+)(\d+)(\..*)$/);
|
|
146
|
+
if (subMatch && parseInt(subMatch[2], 10) === currentOldH2Num) {
|
|
147
|
+
const newNum = currentOldH2Num + 1;
|
|
148
|
+
edits.push({
|
|
149
|
+
start: startInTail,
|
|
150
|
+
end: endInTail,
|
|
151
|
+
replacement: `${subMatch[1]}${newNum}${subMatch[3]}`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// 後ろから適用してオフセットのズレを防ぐ
|
|
157
|
+
edits.sort((a, b) => b.start - a.start);
|
|
158
|
+
let updatedTail = tail;
|
|
159
|
+
for (const edit of edits) {
|
|
160
|
+
updatedTail = updatedTail.slice(0, edit.start) + edit.replacement + updatedTail.slice(edit.end);
|
|
161
|
+
}
|
|
162
|
+
return `${prefix}${head}${inputSectionText}${updatedTail}`;
|
|
163
|
+
}
|
|
164
|
+
export function registerInputSection(inputs) {
|
|
165
|
+
return inputs?.length
|
|
166
|
+
? `## 個票の入力(前提)\n\n次の入力を作業の前提として参照する。完了条件は別節に従う。\n\n${registerInputMarkdown(inputs)}\n`
|
|
167
|
+
: "";
|
|
168
|
+
}
|
package/dist/register/item.js
CHANGED
|
@@ -7,6 +7,7 @@ import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { dump, load } from "../shared/yaml.js";
|
|
9
9
|
import { inlineCodeAnglePlaceholders } from "../shared/text.js";
|
|
10
|
+
import { readRegisterInput } from "./input.js";
|
|
10
11
|
import { registerDateFromTimestamp } from "./date.js";
|
|
11
12
|
export const VALID_STATUSES = [
|
|
12
13
|
"open",
|
|
@@ -20,6 +21,7 @@ export const VALID_STATUSES = [
|
|
|
20
21
|
];
|
|
21
22
|
export const VALID_TYPES = [
|
|
22
23
|
"todo",
|
|
24
|
+
"epic",
|
|
23
25
|
"question",
|
|
24
26
|
"risk",
|
|
25
27
|
"issue",
|
|
@@ -29,6 +31,17 @@ export const VALID_TYPES = [
|
|
|
29
31
|
];
|
|
30
32
|
export const VALID_PRIORITIES = ["high", "medium", "low"];
|
|
31
33
|
export const VALID_DIFFICULTIES = ["hard", "medium", "easy"];
|
|
34
|
+
export { VALID_COMMIT_TYPES, COMMIT_SCOPE_RE } from "../shared/commit-types.js";
|
|
35
|
+
export const DEFAULT_ITEM_TYPE_COMMIT_TYPE_MAP = {
|
|
36
|
+
issue: "fix",
|
|
37
|
+
todo: "feat",
|
|
38
|
+
"change-request": "feat",
|
|
39
|
+
decision: "docs",
|
|
40
|
+
note: "docs",
|
|
41
|
+
question: "docs",
|
|
42
|
+
risk: "docs",
|
|
43
|
+
epic: "feat",
|
|
44
|
+
};
|
|
32
45
|
export const TERMINAL_STATUSES_SET = new Set(["done", "decided", "rejected", "deferred"]);
|
|
33
46
|
// PJR-ID の乱数部分に使う 32 文字セット。曖昧文字(`I` / `L` / `O` / `U`)を除いた
|
|
34
47
|
// 英大文字(単一ケース)と数字で構成し、目視・手入力時の誤読を避ける。
|
|
@@ -57,6 +70,7 @@ const SPECDOJO_KEY_ORDER = [
|
|
|
57
70
|
"part_of",
|
|
58
71
|
"based_on",
|
|
59
72
|
"item_type",
|
|
73
|
+
"track",
|
|
60
74
|
"item_status",
|
|
61
75
|
"priority",
|
|
62
76
|
"difficulty",
|
|
@@ -67,7 +81,10 @@ const SPECDOJO_KEY_ORDER = [
|
|
|
67
81
|
"block_reason",
|
|
68
82
|
"conclusion",
|
|
69
83
|
"derived_from",
|
|
84
|
+
"depends_on",
|
|
70
85
|
"autopilot",
|
|
86
|
+
"commit_type",
|
|
87
|
+
"commit_scope",
|
|
71
88
|
"approach",
|
|
72
89
|
"targets",
|
|
73
90
|
"sources",
|
|
@@ -228,14 +245,22 @@ export function readRegisterItemContent(content, filename) {
|
|
|
228
245
|
const derivedFrom = Array.isArray(fields.derived_from)
|
|
229
246
|
? fields.derived_from.filter((entry) => typeof entry === "string" && entry.trim() !== "")
|
|
230
247
|
: undefined;
|
|
248
|
+
const dependsOn = Array.isArray(fields.depends_on)
|
|
249
|
+
? fields.depends_on.filter((value) => typeof value === "string" && value.trim() !== "")
|
|
250
|
+
: undefined;
|
|
231
251
|
const autopilot = fields.autopilot === "approved" ? "approved" : undefined;
|
|
252
|
+
const commitType = asString(fields.commit_type);
|
|
253
|
+
const commitScope = asString(fields.commit_scope);
|
|
232
254
|
const difficulty = asString(fields.difficulty);
|
|
255
|
+
const inputs = readRegisterInput(content);
|
|
233
256
|
const item = {
|
|
234
257
|
id,
|
|
235
258
|
status: asString(fields.item_status) ?? "open",
|
|
236
259
|
title: titleFromBody(body, id),
|
|
237
260
|
description: descriptionFromBody(body),
|
|
261
|
+
...(inputs ? { inputs } : {}),
|
|
238
262
|
type: asString(fields.item_type) ?? CELL_TODO,
|
|
263
|
+
...(asString(fields.track) ? { track: asString(fields.track) } : {}),
|
|
239
264
|
priority: asString(fields.priority) ?? "medium",
|
|
240
265
|
...(difficulty ? { difficulty } : {}),
|
|
241
266
|
owner: asString(fields.owner) ?? CELL_TODO,
|
|
@@ -255,7 +280,10 @@ export function readRegisterItemContent(content, filename) {
|
|
|
255
280
|
...(targets && targets.length > 0 ? { targets } : {}),
|
|
256
281
|
...(sources && sources.length > 0 ? { sources } : {}),
|
|
257
282
|
...(derivedFrom && derivedFrom.length > 0 ? { derivedFrom } : {}),
|
|
283
|
+
...(dependsOn && dependsOn.length > 0 ? { dependsOn } : {}),
|
|
258
284
|
...(autopilot ? { autopilot } : {}),
|
|
285
|
+
...(commitType ? { commitType } : {}),
|
|
286
|
+
...(commitScope ? { commitScope } : {}),
|
|
259
287
|
};
|
|
260
288
|
return {
|
|
261
289
|
id,
|
|
@@ -376,13 +404,17 @@ export function registerItemFieldsFromItem(item) {
|
|
|
376
404
|
conclusion: isPlaceholderCell(item.conclusion)
|
|
377
405
|
? null
|
|
378
406
|
: inlineCodeAnglePlaceholders(item.conclusion.trim()),
|
|
407
|
+
...(item.track ? { track: item.track } : {}),
|
|
379
408
|
...(item.approach ? { approach: item.approach } : {}),
|
|
380
409
|
...(item.targetPath ? { target_path: item.targetPath } : {}),
|
|
381
410
|
...(item.targetRulebook ? { target_rulebook: item.targetRulebook } : {}),
|
|
382
411
|
...(item.targets && item.targets.length > 0 ? { targets: item.targets } : {}),
|
|
383
412
|
...(item.sources && item.sources.length > 0 ? { sources: item.sources } : {}),
|
|
384
413
|
...(item.derivedFrom && item.derivedFrom.length > 0 ? { derived_from: item.derivedFrom } : {}),
|
|
414
|
+
...(item.dependsOn && item.dependsOn.length > 0 ? { depends_on: item.dependsOn } : {}),
|
|
385
415
|
...(item.autopilot ? { autopilot: item.autopilot } : {}),
|
|
416
|
+
...(item.commitType ? { commit_type: item.commitType } : {}),
|
|
417
|
+
...(item.commitScope ? { commit_scope: item.commitScope } : {}),
|
|
386
418
|
};
|
|
387
419
|
}
|
|
388
420
|
function orderSpecdojoKeys(fields) {
|
|
@@ -547,3 +579,42 @@ export function formatRegisterItemFields(updates) {
|
|
|
547
579
|
})
|
|
548
580
|
.join("\n");
|
|
549
581
|
}
|
|
582
|
+
/**
|
|
583
|
+
* 登録項目の commit の type と scope を解決する。
|
|
584
|
+
* 後続の項目(PJR-Z7GX・PJR-M1DH)から 1 つの関数で引ける共通関数。
|
|
585
|
+
*
|
|
586
|
+
* 解決優先順序:
|
|
587
|
+
* 1. 個票の `commit_type` / `commit_scope`(指定があれば最優先)
|
|
588
|
+
* 2. プロダクトリポジトリ設定(`repoConfig.commit_types`)
|
|
589
|
+
* 3. プロジェクト設定(`projectConfig.commit_types`)
|
|
590
|
+
* 4. 既定の対応マッピング(issue -> fix, todo -> feat, change-request -> feat 等)
|
|
591
|
+
* 5. 上記に該当しない未知の type は "chore"
|
|
592
|
+
*/
|
|
593
|
+
export function resolveItemCommitTypeAndScope(item, options) {
|
|
594
|
+
const scope = item.commitScope?.trim() ? item.commitScope.trim() : undefined;
|
|
595
|
+
// 1. 個票の明示指定
|
|
596
|
+
if (item.commitType && item.commitType.trim() !== "") {
|
|
597
|
+
return { type: item.commitType.trim(), ...(scope ? { scope } : {}) };
|
|
598
|
+
}
|
|
599
|
+
// 2. repoConfig の指定
|
|
600
|
+
const repoTypes = options?.repoConfig?.commit_types;
|
|
601
|
+
const repoType = repoTypes && Object.hasOwn(repoTypes, item.type) ? repoTypes[item.type] : undefined;
|
|
602
|
+
if (repoType && repoType.trim() !== "") {
|
|
603
|
+
return { type: repoType.trim(), ...(scope ? { scope } : {}) };
|
|
604
|
+
}
|
|
605
|
+
// 3. projectConfig の指定
|
|
606
|
+
const projectTypes = options?.projectConfig?.commit_types;
|
|
607
|
+
const projectType = projectTypes && Object.hasOwn(projectTypes, item.type) ? projectTypes[item.type] : undefined;
|
|
608
|
+
if (projectType && projectType.trim() !== "") {
|
|
609
|
+
return { type: projectType.trim(), ...(scope ? { scope } : {}) };
|
|
610
|
+
}
|
|
611
|
+
// 4. 既定マッピング
|
|
612
|
+
const defaultType = Object.hasOwn(DEFAULT_ITEM_TYPE_COMMIT_TYPE_MAP, item.type)
|
|
613
|
+
? DEFAULT_ITEM_TYPE_COMMIT_TYPE_MAP[item.type]
|
|
614
|
+
: undefined;
|
|
615
|
+
if (defaultType) {
|
|
616
|
+
return { type: defaultType, ...(scope ? { scope } : {}) };
|
|
617
|
+
}
|
|
618
|
+
// 5. フォールバック
|
|
619
|
+
return { type: "chore", ...(scope ? { scope } : {}) };
|
|
620
|
+
}
|
|
@@ -4,6 +4,8 @@ import { createGitTimestampResolver, planRegisterTimestampMigration, summarizeTi
|
|
|
4
4
|
import { registerEventFilePath, validateRegisterEventDocs } from "./events.js";
|
|
5
5
|
import { validateRegisterItemDocs } from "./item.js";
|
|
6
6
|
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
7
|
+
import { validateRegisterDependencyDocs } from "./dependency.js";
|
|
8
|
+
import { validateRegisterEpicDocs } from "./epic.js";
|
|
7
9
|
import { validateDerivedFromDocs } from "./derivation.js";
|
|
8
10
|
export function registerMaintenanceCommands(reg, dependencies) {
|
|
9
11
|
const { addProjectOption, addRegisterCommitOptions, applyRegisterMigrationPlan, generateDerivedViewFiles, loadItemForUpdate, migrateEmbeddedRegisterEvents, migrateRegisterEventsFromGit, parseHistoryIds, planRegisterMigration, planRenumber, printCommandError, registerEventActor, renumberPjrItem, repoRelativePathspec, resolveRegisterPaths, runRegisterMutation, validBuildScopes, writeDerivedViews, } = dependencies;
|
|
@@ -87,7 +89,11 @@ export function registerMaintenanceCommands(reg, dependencies) {
|
|
|
87
89
|
throw new Error(`Invalid scope: "${opts.scope}". Must be one of: ${validBuildScopes.join(", ")}`);
|
|
88
90
|
}
|
|
89
91
|
const validation = validateRegisterItemDocs(paths.projectRegisterPath);
|
|
90
|
-
const derivationErrors =
|
|
92
|
+
const derivationErrors = [
|
|
93
|
+
...validateDerivedFromDocs(paths),
|
|
94
|
+
...validateRegisterEpicDocs(paths),
|
|
95
|
+
...validateRegisterDependencyDocs(paths),
|
|
96
|
+
];
|
|
91
97
|
const eventErrors = validateRegisterEventDocs(paths.projectRegisterPath, paths.registerDateTimeZone);
|
|
92
98
|
if (validation.errors.length > 0 || derivationErrors.length > 0 || eventErrors.length > 0) {
|
|
93
99
|
throw new Error(`Invalid register item files:\n${[
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { getProjectCatalogPath, getProjectTimelinePath, } from "../shared/specdojo-config.js";
|
|
4
|
+
import { loadTimelineIndex } from "../shared/timeline-index.js";
|
|
5
|
+
export function isPlanningApproach(approach) {
|
|
6
|
+
return approach === "catalog-planning" || approach === "strategy-planning";
|
|
7
|
+
}
|
|
8
|
+
// These targets identify work units, including units whose documents do not exist yet.
|
|
9
|
+
export function planningTarget(approach, target) {
|
|
10
|
+
const prefix = approach === "catalog-planning" ? "domain" : "track";
|
|
11
|
+
const match = target.match(new RegExp(`^${prefix}:([a-z0-9][a-z0-9-]{0,62})$`));
|
|
12
|
+
if (!match)
|
|
13
|
+
throw new Error(`Approach "${approach}" requires --target ${prefix}:<id>`);
|
|
14
|
+
return match[1];
|
|
15
|
+
}
|
|
16
|
+
export function validatePlanningTarget(opts) {
|
|
17
|
+
const unit = planningTarget(opts.approach, opts.target);
|
|
18
|
+
if (!getProjectCatalogPath(opts.project)) {
|
|
19
|
+
throw new Error(`Approach "${opts.approach}" requires catalog_path`);
|
|
20
|
+
}
|
|
21
|
+
if (opts.approach !== "strategy-planning")
|
|
22
|
+
return;
|
|
23
|
+
if (!opts.project.schedule_path?.trim()) {
|
|
24
|
+
throw new Error('Approach "strategy-planning" requires schedule_path');
|
|
25
|
+
}
|
|
26
|
+
const file = resolve(opts.repoRoot, getProjectTimelinePath(opts.project), "tml-index.yaml");
|
|
27
|
+
if (!existsSync(file)) {
|
|
28
|
+
// A declared strategy scope also supports projects without a timeline.
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const { index, errors } = loadTimelineIndex(file);
|
|
32
|
+
if (errors.length > 0)
|
|
33
|
+
throw new Error(`${file}: ${errors.join("; ")}`);
|
|
34
|
+
if (!index.tracks.some((track) => track.track === unit)) {
|
|
35
|
+
throw new Error(`Undefined strategy track "${unit}" in ${join(getProjectTimelinePath(opts.project), "tml-index.yaml")}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -6,10 +6,11 @@ import { inlineCodeAnglePlaceholders } from "../shared/text.js";
|
|
|
6
6
|
import { atomicWriteFile, buildRegisterItemContent, derivedTopicNeedsWarning, generatePjrId, printDerivedTopicWarning, registerEventActor, REGISTER_TOPIC_RE, resolveRegisterPaths, slugify, validateFields, } from "./core.js";
|
|
7
7
|
import { registerCreateCommands, registerUpdateCommand } from "./create-commands.js";
|
|
8
8
|
import { normalizeRegisterTimestamp } from "./date.js";
|
|
9
|
+
import { validateRegisterDependencyDocs } from "./dependency.js";
|
|
9
10
|
import { validateDerivedFromDocs } from "./derivation.js";
|
|
10
11
|
import { appendRegisterEvent, deterministicRegisterEventId, readEmbeddedRegisterEvents, readRegisterEventsFromContent, registerEventFilePath, removeEmbeddedRegisterEvents, serializeRegisterEvents, validateRegisterEventDocs, } from "./events.js";
|
|
11
12
|
import { collectRegisterHistoryEvents } from "./history.js";
|
|
12
|
-
import { loadRegisterItemDocs, PJR_ID_ALPHABET, PJR_ID_RE, TERMINAL_STATUSES_SET, toCell, validateRegisterItemDocs, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, } from "./item.js";
|
|
13
|
+
import { loadRegisterItemDocs, PJR_ID_ALPHABET, PJR_ID_RE, TERMINAL_STATUSES_SET, toCell, validateRegisterItemDocs, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, VALID_COMMIT_TYPES, COMMIT_SCOPE_RE, DEFAULT_ITEM_TYPE_COMMIT_TYPE_MAP, resolveItemCommitTypeAndScope, } from "./item.js";
|
|
13
14
|
import { registerMaintenanceCommands } from "./maintenance-commands.js";
|
|
14
15
|
import { applyRegisterMigrationPlan, planRegisterMigration } from "./migration.js";
|
|
15
16
|
import { planRenumber, planRetopic, renumberPjrItem, retopicPjrItem, ticketTopicFromFilename, } from "./renumber.js";
|
|
@@ -19,7 +20,7 @@ import { generateDerivedViewFiles, loadRegisterItems, VALID_BUILD_SCOPES, writeD
|
|
|
19
20
|
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
20
21
|
import { registerLifecyclePoolPath } from "./lifecycle-lock.js";
|
|
21
22
|
import { inCrossProjectWorktree, resolveCrossProjectMutationTarget } from "./cross-project.js";
|
|
22
|
-
export { PJR_ID_ALPHABET, PJR_ID_RE, TERMINAL_STATUSES_SET, toCell, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, };
|
|
23
|
+
export { PJR_ID_ALPHABET, PJR_ID_RE, TERMINAL_STATUSES_SET, toCell, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, VALID_COMMIT_TYPES, COMMIT_SCOPE_RE, DEFAULT_ITEM_TYPE_COMMIT_TYPE_MAP, resolveItemCommitTypeAndScope, };
|
|
23
24
|
export { REGISTER_TOPIC_RE, VALID_TICKET_STATUSES, buildRegisterItemContent, extractTableHeading, findMarkdownReferenceFiles, generatePjrId, injectRegisterRows, parsePjrIndex, resolveRegisterPaths, } from "./core.js";
|
|
24
25
|
export { applyRegisterMigrationPlan, planRegisterMigration, } from "./migration.js";
|
|
25
26
|
export { findItemById, findRegisterItem, generateDerivedViewFiles, injectViewSlots, loadRegisterItems, sortByRegisteredDesc, } from "./views.js";
|
|
@@ -82,7 +83,10 @@ function defaultRegisterCommitMessage(command, result) {
|
|
|
82
83
|
}
|
|
83
84
|
function rebuildRegisterViews(paths) {
|
|
84
85
|
const validation = validateRegisterItemDocs(paths.projectRegisterPath);
|
|
85
|
-
const derivationErrors =
|
|
86
|
+
const derivationErrors = [
|
|
87
|
+
...validateDerivedFromDocs(paths),
|
|
88
|
+
...validateRegisterDependencyDocs(paths),
|
|
89
|
+
];
|
|
86
90
|
const eventErrors = validateRegisterEventDocs(paths.projectRegisterPath, paths.registerDateTimeZone);
|
|
87
91
|
if (validation.errors.length > 0 || derivationErrors.length > 0 || eventErrors.length > 0) {
|
|
88
92
|
throw new Error(`Invalid register item files:\n${[
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRegisterInput } from "./input.js";
|
|
1
2
|
import { existsSync, readFileSync, unlinkSync } from "node:fs";
|
|
2
3
|
import { basename, join } from "node:path";
|
|
3
4
|
import { atomicWriteFile, findMarkdownReferenceFiles, formatTableRow, isTableSeparator, parsePjrIndex, parseTableCells, prepareRegisterEventFile, REGISTER_SECTION_RE, REGISTER_TOPIC_RE, } from "./core.js";
|
|
@@ -71,12 +72,12 @@ export function renumberReferences(content, fromDocId, toDocId) {
|
|
|
71
72
|
// から参照する project 修飾形の両方を対象にする。
|
|
72
73
|
function renumberDerivedFromReferences(content, filename, sourceProjectId, fromId, toId) {
|
|
73
74
|
const parsed = readRegisterItemContent(content, filename);
|
|
74
|
-
if (!parsed
|
|
75
|
+
if (!parsed)
|
|
75
76
|
return { content, changed: false };
|
|
76
77
|
const docId = readSpecdojoFields(content).id;
|
|
77
78
|
const referencingProjectId = typeof docId === "string" && docId.includes(":") ? docId.split(":", 1)[0] : undefined;
|
|
78
79
|
let changed = false;
|
|
79
|
-
const
|
|
80
|
+
const rewrite = (ref) => {
|
|
80
81
|
if (referencingProjectId === sourceProjectId && ref === fromId) {
|
|
81
82
|
changed = true;
|
|
82
83
|
return toId;
|
|
@@ -86,9 +87,17 @@ function renumberDerivedFromReferences(content, filename, sourceProjectId, fromI
|
|
|
86
87
|
return `${sourceProjectId}:${toId}`;
|
|
87
88
|
}
|
|
88
89
|
return ref;
|
|
89
|
-
}
|
|
90
|
+
};
|
|
91
|
+
const derivedFrom = parsed.item.derivedFrom?.map(rewrite);
|
|
92
|
+
const dependsOn = parsed.item.dependsOn?.map(rewrite);
|
|
90
93
|
return changed
|
|
91
|
-
? {
|
|
94
|
+
? {
|
|
95
|
+
content: applyRegisterItemFields(content, {
|
|
96
|
+
...(derivedFrom ? { derived_from: derivedFrom } : {}),
|
|
97
|
+
...(dependsOn ? { depends_on: dependsOn } : {}),
|
|
98
|
+
}),
|
|
99
|
+
changed,
|
|
100
|
+
}
|
|
92
101
|
: { content, changed };
|
|
93
102
|
}
|
|
94
103
|
// topic 変更で書き換える全ファイルを事前に算出する。参照の更新範囲は renumber と
|
|
@@ -162,6 +171,9 @@ export function retopicPjrItem(opts) {
|
|
|
162
171
|
if (opts.description !== undefined) {
|
|
163
172
|
ticketWrite.content = setRegisterItemDescription(ticketWrite.content, opts.description);
|
|
164
173
|
}
|
|
174
|
+
if (opts.inputs !== undefined) {
|
|
175
|
+
ticketWrite.content = setRegisterInput(ticketWrite.content, opts.inputs);
|
|
176
|
+
}
|
|
165
177
|
ticketWrite.content = applyRegisterItemFields(ticketWrite.content, {
|
|
166
178
|
...registerItemFieldsFromItem(opts.updated),
|
|
167
179
|
...(opts.updated.status === "waiting" ? {} : { block_reason: REMOVE_REGISTER_ITEM_FIELD }),
|
package/dist/register/update.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRegisterInput } from "./input.js";
|
|
1
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
3
|
import { basename, join } from "node:path";
|
|
3
4
|
import { atomicWriteFile, prepareRegisterEventFile } from "./core.js";
|
|
@@ -59,6 +60,9 @@ export function applyItemUpdate(opts) {
|
|
|
59
60
|
lines.push(` title: ${opts.title}`);
|
|
60
61
|
if (opts.description !== undefined)
|
|
61
62
|
lines.push(` description: ${opts.description}`);
|
|
63
|
+
if (opts.inputs !== undefined) {
|
|
64
|
+
lines.push(` input: ${opts.inputs.length ? JSON.stringify(opts.inputs) : "-"}`);
|
|
65
|
+
}
|
|
62
66
|
lines.push(formatRegisterItemFields(updates));
|
|
63
67
|
process.stdout.write(`${lines.join("\n")}\n`);
|
|
64
68
|
return;
|
|
@@ -70,6 +74,8 @@ export function applyItemUpdate(opts) {
|
|
|
70
74
|
if (opts.description !== undefined) {
|
|
71
75
|
content = setRegisterItemDescription(content, opts.description);
|
|
72
76
|
}
|
|
77
|
+
if (opts.inputs !== undefined)
|
|
78
|
+
content = setRegisterInput(content, opts.inputs);
|
|
73
79
|
content = applyRegisterItemFields(content, updates);
|
|
74
80
|
const event = buildRegisterEvent({
|
|
75
81
|
beforeContent,
|
package/dist/register/views.js
CHANGED
|
@@ -149,9 +149,9 @@ function markdownLink(label, fromDirectory, targetPath) {
|
|
|
149
149
|
const href = path.startsWith(".") ? path : `./${path}`;
|
|
150
150
|
return `[${toCell(label)}](${href})`;
|
|
151
151
|
}
|
|
152
|
-
function generateDerivedItemsFile(paths, items) {
|
|
152
|
+
function generateDerivedItemsFile(paths, items, relationField = "derivedFrom") {
|
|
153
153
|
const sourceDocs = new Map(items.flatMap((view) => (view.ticketPath ? [[view.id, view.ticketPath]] : [])));
|
|
154
|
-
const rows = collectDerivedRegisterRelations(paths, items).map((relation) => {
|
|
154
|
+
const rows = collectDerivedRegisterRelations(paths, items, relationField).map((relation) => {
|
|
155
155
|
const sourcePath = sourceDocs.get(relation.sourceId);
|
|
156
156
|
const sourceCell = sourcePath
|
|
157
157
|
? markdownLink(relation.sourceId, paths.generatedPath, sourcePath)
|
|
@@ -172,11 +172,15 @@ function generateDerivedItemsFile(paths, items) {
|
|
|
172
172
|
});
|
|
173
173
|
const table = [
|
|
174
174
|
"<!-- prettier-ignore -->",
|
|
175
|
-
|
|
175
|
+
relationField === "dependsOn"
|
|
176
|
+
? "| 先行項目 | 後続項目 | 分類 | ステータス | タイトル |"
|
|
177
|
+
: "| 元の項目 | 派生先 | 分類 | ステータス | タイトル |",
|
|
176
178
|
"| --- | --- | --- | --- | --- |",
|
|
177
179
|
...rows,
|
|
178
180
|
].join("\n");
|
|
179
|
-
const template = loadViewTemplate("
|
|
181
|
+
const template = loadViewTemplate(relationField === "dependsOn"
|
|
182
|
+
? "pjr-dependent-items-template.md"
|
|
183
|
+
: "pjr-derived-items-template.md", paths.projectId);
|
|
180
184
|
return injectViewSlots(template, { "derived-items": table });
|
|
181
185
|
}
|
|
182
186
|
function generateTypeFilterView(items, type, templateFileName, projectId, heading) {
|
|
@@ -186,6 +190,47 @@ function generateTypeFilterView(items, type, templateFileName, projectId, headin
|
|
|
186
190
|
table: ["<!-- prettier-ignore -->", makeTable(filtered, heading)].join("\n"),
|
|
187
191
|
});
|
|
188
192
|
}
|
|
193
|
+
function generateEpicItemsFile(paths, items) {
|
|
194
|
+
const relations = collectDerivedRegisterRelations(paths, items);
|
|
195
|
+
const groups = items
|
|
196
|
+
.filter((view) => view.item.type === "epic")
|
|
197
|
+
.map((epic, index) => {
|
|
198
|
+
const label = epic.ticketPath
|
|
199
|
+
? markdownLink(epic.id, paths.generatedPath, epic.ticketPath)
|
|
200
|
+
: epic.id;
|
|
201
|
+
const children = relations.filter((relation) => relation.sourceId === epic.id);
|
|
202
|
+
const rows = children.map((child) => {
|
|
203
|
+
const id = child.derivedProjectId === paths.projectId
|
|
204
|
+
? child.derivedItem.id
|
|
205
|
+
: `${child.derivedProjectId}:${child.derivedItem.id}`;
|
|
206
|
+
return `| ${[
|
|
207
|
+
markdownLink(id, paths.generatedPath, child.derivedTicketPath),
|
|
208
|
+
child.derivedItem.type,
|
|
209
|
+
child.derivedItem.status,
|
|
210
|
+
child.derivedItem.title,
|
|
211
|
+
]
|
|
212
|
+
.map(toCell)
|
|
213
|
+
.join(" | ")} |`;
|
|
214
|
+
});
|
|
215
|
+
return [
|
|
216
|
+
`### 1.${index + 1}. ${label} ${toCell(epic.item.title)}`,
|
|
217
|
+
"",
|
|
218
|
+
`track: ${toCell(epic.item.track ?? "-")} / ステータス: ${toCell(epic.item.status)}`,
|
|
219
|
+
"",
|
|
220
|
+
...(rows.length === 0
|
|
221
|
+
? ["子項目なし"]
|
|
222
|
+
: [
|
|
223
|
+
"<!-- prettier-ignore -->",
|
|
224
|
+
"| 子項目 | 分類 | ステータス | タイトル |",
|
|
225
|
+
"| --- | --- | --- | --- |",
|
|
226
|
+
...rows,
|
|
227
|
+
]),
|
|
228
|
+
].join("\n");
|
|
229
|
+
});
|
|
230
|
+
return injectViewSlots(loadViewTemplate("pjr-epic-items-template.md", paths.projectId), {
|
|
231
|
+
"epic-items": groups.join("\n\n") || "該当なし",
|
|
232
|
+
});
|
|
233
|
+
}
|
|
189
234
|
export const VALID_BUILD_SCOPES = ["register", "controls", "all"];
|
|
190
235
|
export function generateDerivedViewFiles(paths, scope) {
|
|
191
236
|
// 項目の値は個票 frontmatter(正本)から集める。列見出しは template から採用するため、
|
|
@@ -220,6 +265,12 @@ export function generateDerivedViewFiles(paths, scope) {
|
|
|
220
265
|
}, {
|
|
221
266
|
path: join(paths.generatedPath, "pjr-derived-items.md"),
|
|
222
267
|
content: generateDerivedItemsFile(paths, itemViews),
|
|
268
|
+
}, {
|
|
269
|
+
path: join(paths.generatedPath, "pjr-dependent-items.md"),
|
|
270
|
+
content: generateDerivedItemsFile(paths, itemViews, "dependsOn"),
|
|
271
|
+
}, {
|
|
272
|
+
path: join(paths.generatedPath, "pjr-epic-items.md"),
|
|
273
|
+
content: generateEpicItemsFile(paths, itemViews),
|
|
223
274
|
});
|
|
224
275
|
}
|
|
225
276
|
if (scope === "controls" || scope === "all") {
|
|
@@ -182,11 +182,20 @@ export function resolveRecommendedApproach(input) {
|
|
|
182
182
|
reasons: [`Kata 一式を初期整備する(成果物実在: ${input.deliverableExists})`],
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
|
+
case "draft-with-context":
|
|
185
186
|
case "author-deliverable": {
|
|
186
187
|
const required = KATA_KINDS.filter((kind) => input.usability[kind] !== "not-needed");
|
|
187
188
|
const unknown = required.filter((kind) => input.usability[kind] === "unknown");
|
|
188
189
|
if (unknown.length)
|
|
189
190
|
return { approach: "undecided", reasons: [`grade がない Kata: ${unknown.join(", ")}`] };
|
|
191
|
+
if (input.intent === "draft-with-context") {
|
|
192
|
+
return required.every((kind) => input.usability[kind] === "usable")
|
|
193
|
+
? { approach: "draft", reasons: ["人が雛形へ文脈を記入してから下書きする"] }
|
|
194
|
+
: {
|
|
195
|
+
approach: "undecided",
|
|
196
|
+
reasons: ["draft-with-context には必要な Kata がすべて利用可能であることが必要"],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
190
199
|
if (required.every((kind) => input.usability[kind] === "usable"))
|
|
191
200
|
return { approach: "fully-guided", reasons: ["必要な Kata がすべて利用可能"] };
|
|
192
201
|
if (input.usability.recipe === "usable")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
2
2
|
import { existsSync, readdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dump } from "../shared/yaml.js";
|
|
4
|
-
import { getProjectCatalogPath, getProjectRolesPath, getProjectSchedulePath, getProjectTimelinePath, loadConfig, loadEnv, loadMemberRoster, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
4
|
+
import { getProjectCatalogPath, getProjectRolesPath, getProjectSchedulePath, getProjectTimelinePath, getProjectRegisterPath, loadConfig, loadEnv, loadMemberRoster, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
5
5
|
import { buildScheduleTrack, } from "./build.js";
|
|
6
6
|
import { readYaml } from "../shared/fs.js";
|
|
7
7
|
import { resolveSpecdojoPath } from "../docs/template-resolution.js";
|
|
@@ -255,11 +255,13 @@ function registerScheduleStrategyCommands(sch) {
|
|
|
255
255
|
if (!context.catalogPath) {
|
|
256
256
|
throw new Error(`catalog_path not set for project '${context.projectId}'.`);
|
|
257
257
|
}
|
|
258
|
+
const registerPath = getProjectRegisterPath(context.project);
|
|
258
259
|
const result = generateStrategy({
|
|
259
260
|
repoRoot: context.baseDir,
|
|
260
261
|
schedulePath: context.schedulePath,
|
|
261
262
|
catalogPath: context.catalogPath,
|
|
262
263
|
timelinePath: context.timelinePath,
|
|
264
|
+
...(registerPath ? { registerPath: resolve(context.baseDir, registerPath) } : {}),
|
|
263
265
|
...(context.rolesPath ? { rolesPath: context.rolesPath } : {}),
|
|
264
266
|
projectId: context.projectId,
|
|
265
267
|
track,
|
|
@@ -5,6 +5,7 @@ import { resolveBasePath } from "../catalog/paths.js";
|
|
|
5
5
|
import { collectCatalogFilesByDomain } from "../shared/catalog-files.js";
|
|
6
6
|
import { readYaml } from "../shared/fs.js";
|
|
7
7
|
import { loadTimelineIndex } from "../shared/timeline-index.js";
|
|
8
|
+
import { resolveTimelineCatalogStatus } from "../register/catalog-status.js";
|
|
8
9
|
export function isRecord(value) {
|
|
9
10
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
11
|
}
|
|
@@ -44,6 +45,9 @@ export function resolveTrackScopeCatalogs(opts) {
|
|
|
44
45
|
const indexFile = join(timelinePath, "tml-index.yaml");
|
|
45
46
|
if (existsSync(indexFile)) {
|
|
46
47
|
const { index, errors: loadErrors } = loadTimelineIndex(indexFile);
|
|
48
|
+
const derived = resolveTimelineCatalogStatus(index.tracks, opts.registerPath);
|
|
49
|
+
index.tracks = derived.tracks;
|
|
50
|
+
warnings.push(...derived.warnings);
|
|
47
51
|
if (loadErrors.length > 0) {
|
|
48
52
|
warnings.push(`${basename(indexFile)}: ${loadErrors.join(" / ")}`);
|
|
49
53
|
}
|
|
@@ -63,7 +67,7 @@ export function resolveTrackScopeCatalogs(opts) {
|
|
|
63
67
|
}
|
|
64
68
|
if (plan.catalog_status !== "primary") {
|
|
65
69
|
warnings.push(`timeline: track '${track}' の catalog_status は '${plan.catalog_status}'。` +
|
|
66
|
-
|
|
70
|
+
`カタログ作成 todo の完了を確認して timeline build を実行する。todo がない domain は手書きの計画値を使う。`);
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
else {
|