specdojo 0.4.6 → 0.5.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 +14 -9
- package/CHANGELOG.md +62 -0
- package/dist/catalog/document-target.js +75 -0
- package/dist/commands/agent.js +2 -80
- package/dist/commands/init.js +3 -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/docs/yaml-pages.js +17 -17
- package/dist/exec/agent-config.js +28 -16
- package/dist/exec/agent-plan.js +108 -0
- package/dist/exec/commands.js +3 -3
- package/dist/exec/core.js +2 -0
- package/dist/exec/grade-checkpoint.js +12 -0
- package/dist/exec/pipeline-state.js +5 -2
- package/dist/exec/plans-core.js +7 -67
- package/dist/exec/plans-generation.js +28 -7
- package/dist/exec/plans-grade-findings.js +16 -0
- package/dist/exec/plans-planning.js +43 -0
- package/dist/exec/plans-storage.js +5 -2
- package/dist/exec/project.js +4 -1
- package/dist/exec/register.js +82 -6
- package/dist/exec/repo-integration-sync.js +9 -0
- package/dist/exec/repo-integration.js +17 -2
- package/dist/exec/repo-trace.js +17 -4
- package/dist/exec/results.js +2 -0
- package/dist/exec/run/lifecycle-commands.js +2 -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 +23 -0
- package/dist/exec/run/register-state.js +4 -1
- package/dist/exec/run/register-worktree.js +28 -1
- package/dist/exec/run/schedule-prepare.js +7 -1
- package/dist/exec/strategy.js +2 -0
- package/dist/exec/task-repos.js +18 -4
- package/dist/exec/worktree-command.js +8 -1
- package/dist/exec/worktree-ops-commit.js +7 -1
- package/dist/exec/worktree-ops-merge.js +40 -1
- package/dist/grade/apply.js +13 -7
- package/dist/grade/command-inspect.js +2 -1
- package/dist/grade/command-run.js +39 -0
- package/dist/grade/grade.js +3 -1
- package/dist/grade/markdown.js +11 -6
- package/dist/grade/pipeline-state.js +8 -6
- package/dist/grade/plan.js +14 -10
- package/dist/grade/run.js +307 -0
- package/dist/grade/target-discovery.js +1 -1
- package/dist/grade/targets.js +44 -22
- package/dist/register/approach.js +35 -0
- package/dist/register/catalog-status.js +49 -0
- package/dist/register/core.js +5 -0
- package/dist/register/create-commands.js +83 -5
- package/dist/register/deliverable-target.js +215 -0
- 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 +5 -2
- package/dist/register/events.js +8 -0
- package/dist/register/external-project.js +4 -0
- package/dist/register/item.js +18 -0
- package/dist/register/maintenance-commands.js +7 -1
- package/dist/register/planning.js +37 -0
- package/dist/register/register.js +5 -1
- package/dist/register/renumber.js +12 -4
- package/dist/register/views.js +55 -4
- package/dist/review/grade.js +19 -17
- 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 +1 -1
- package/dist/shared/agent-plan.js +1 -0
- package/dist/shared/agent-types.js +3 -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/provider-scaffold.js +5 -3
- package/dist/shared/specdojo-config.js +10 -3
- package/dist/shared/specdojo-gitignore.js +4 -0
- package/dist/specdojo.js +5 -1
- package/docs/ja/specdojo/exec-templates/xep-catalog-planning-template.md +24 -0
- package/docs/ja/specdojo/exec-templates/xep-strategy-planning-template.md +24 -0
- package/docs/ja/specdojo/exec-templates/xrp-freeform-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-recipe-guided-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-recipe-maintenance-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-retrofit-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-rulebook-maintenance-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-sample-maintenance-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-template-maintenance-template.md +2 -2
- package/docs/ja/specdojo/exec-templates/xrp-template.md +2 -2
- 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 +44 -12
- package/docs/ja/specdojo/guides/exec-operation-guide.md +20 -15
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +19 -1
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +3 -1
- package/docs/ja/specdojo/guides/practice-system-composition-guide.md +2 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +59 -16
- package/docs/ja/specdojo/guides/register-operation-guide.md +44 -15
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +15 -1
- package/docs/ja/specdojo/guides/review-guide.md +2 -2
- package/docs/ja/specdojo/guides/ryu-guide.md +12 -0
- 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/tsd-recipe.md +198 -0
- package/docs/ja/specdojo/references/command-reference.md +92 -29
- package/docs/ja/specdojo/references/specdojo-config-reference.md +49 -16
- 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 +1 -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 +56 -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 +1 -0
- 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/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 +28 -3
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +2 -0
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +16 -11
- package/docs/ja/specdojo/standards/sample-authoring-standard.md +1 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +1 -1
- 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/specdojo/schemas/v1/bdd.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +24 -16
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +4 -1
- 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/grade-pipeline-state.schema.yaml +1 -1
- 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 +20 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +73 -4
- package/docs/specdojo/schemas/v1/rulebook-frontmatter.schema.yaml +5 -0
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +21 -3
- package/package.json +2 -2
- package/templates/antigravity/orchestrator.md +14 -9
- package/templates/claude/agents/specdojo-orchestrator.md +14 -9
- package/templates/codex/agents/specdojo-orchestrator.toml +14 -9
- package/templates/codex/orchestrator.md +14 -9
- package/templates/copilot/README.md +2 -1
- package/templates/devcontainer/devcontainer.json +1 -0
- package/templates/init-agent-members.yaml +46 -3
- package/templates/opencode/README.md +118 -14
- package/templates/opencode/agents/specdojo-orchestrator.md +15 -10
- package/templates/opencode/opencode.json +25 -0
package/dist/grade/targets.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import { extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
2
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
3
|
+
import { dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
4
|
import { load } from "../shared/yaml.js";
|
|
5
5
|
import { collectResolvedDeliverables, loadCatalogDocs } from "../catalog/build.js";
|
|
6
6
|
import { isTrashedPath, resolveBasePath } from "../catalog/paths.js";
|
|
7
7
|
import { listFilesRecursive } from "../shared/fs.js";
|
|
8
8
|
import { gradeContentHash } from "./result.js";
|
|
9
9
|
import { GRADE_TARGETS, KATA_DIRS, KATA_REFERENCE_EXTENSIONS, KATA_REFERENCE_FIELDS, gradedViewpoints, isRecord, parseMarkdown, } from "./core.js";
|
|
10
|
-
import { resolveViewpointsDoc } from "../review/plan.js";
|
|
11
|
-
import { assertValidActor, getProjectCatalogPath, getProjectMembersPath, getProjectRolesPath, getProjectSchedulePath, getProjectViewpointsPath, loadConfig, resolveAgentMember, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
10
|
+
import { commonViewpointsPath, resolveViewpointsDoc } from "../review/plan.js";
|
|
11
|
+
import { assertValidActor, getProjectCatalogPath, getProjectMembersPath, getProjectRolesPath, getProjectSchedulePath, getProjectViewpointsPath, loadConfig, resolveAgentMember, resolveRepoRoot, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
12
12
|
export function resolveProject(projectOption) {
|
|
13
13
|
const { config } = loadConfig();
|
|
14
14
|
if (!config)
|
|
@@ -22,14 +22,14 @@ export function resolveProject(projectOption) {
|
|
|
22
22
|
export function loadViewpoints(projectOption) {
|
|
23
23
|
const { project } = resolveProject(projectOption);
|
|
24
24
|
const path = getProjectViewpointsPath(project);
|
|
25
|
-
|
|
26
|
-
throw new Error("viewpoints_path is required for grade");
|
|
27
|
-
return resolveViewpointsDoc(resolve(specdojoRootDir(), path));
|
|
25
|
+
return resolveViewpointsDoc(path ? resolve(specdojoRootDir(), path) : commonViewpointsPath());
|
|
28
26
|
}
|
|
29
27
|
// 対象探索は観点定義が無いプロジェクトでも動かす。その場合は突き合わせ先を持たない扱いにする。
|
|
30
28
|
export function loadViewpointsIfConfigured(projectOption, rootDir) {
|
|
31
29
|
const path = getProjectViewpointsPath(resolveProject(projectOption).project);
|
|
32
|
-
if (!path
|
|
30
|
+
if (!path)
|
|
31
|
+
return resolveViewpointsDoc(commonViewpointsPath());
|
|
32
|
+
if (!existsSync(resolve(rootDir, path)))
|
|
33
33
|
return undefined;
|
|
34
34
|
return resolveViewpointsDoc(resolve(rootDir, path));
|
|
35
35
|
}
|
|
@@ -123,8 +123,8 @@ export function loadKataReferences() {
|
|
|
123
123
|
}
|
|
124
124
|
return [...references.values()];
|
|
125
125
|
}
|
|
126
|
-
export function resolveGradeReferencePathsFromCatalog(path, catalog) {
|
|
127
|
-
const target = resolveSafeMarkdownPath(path);
|
|
126
|
+
export function resolveGradeReferencePathsFromCatalog(path, catalog, project) {
|
|
127
|
+
const target = resolveSafeMarkdownPath(path, specdojoRootDir(), project);
|
|
128
128
|
const targetDocument = parseMarkdown(readFileSync(target, "utf8"), repoRelativePath(target));
|
|
129
129
|
const targetMetadata = targetDocument.data.specdojo;
|
|
130
130
|
const targetId = typeof targetMetadata.id === "string" ? targetMetadata.id.trim() : "";
|
|
@@ -169,9 +169,9 @@ function gradeReferenceExampleFamily(target, path, metadata) {
|
|
|
169
169
|
const type = typeof metadata.type === "string" ? metadata.type.trim() : "";
|
|
170
170
|
return type || null;
|
|
171
171
|
}
|
|
172
|
-
export function parseGradeReferenceExample(path, target) {
|
|
172
|
+
export function parseGradeReferenceExample(path, target, project) {
|
|
173
173
|
try {
|
|
174
|
-
const absolute = resolveSafeMarkdownPath(path);
|
|
174
|
+
const absolute = resolveSafeMarkdownPath(path, specdojoRootDir(), project);
|
|
175
175
|
const document = parseMarkdown(readFileSync(absolute, "utf8"), repoRelativePath(absolute));
|
|
176
176
|
const metadata = document.data.specdojo;
|
|
177
177
|
return {
|
|
@@ -185,7 +185,7 @@ export function parseGradeReferenceExample(path, target) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
export function selectGradeReferenceExampleFromCatalog(opts) {
|
|
188
|
-
const target = resolveSafeMarkdownPath(opts.path);
|
|
188
|
+
const target = resolveSafeMarkdownPath(opts.path, specdojoRootDir(), opts.project);
|
|
189
189
|
const targetDocument = parseMarkdown(readFileSync(target, "utf8"), repoRelativePath(target));
|
|
190
190
|
const targetMetadata = targetDocument.data.specdojo;
|
|
191
191
|
const family = gradeReferenceExampleFamily(opts.target, target, targetMetadata);
|
|
@@ -210,30 +210,51 @@ export function selectGradeReferenceExample(opts) {
|
|
|
210
210
|
return selectGradeReferenceExampleFromCatalog({
|
|
211
211
|
...opts,
|
|
212
212
|
candidates: opts.candidates.flatMap((candidate) => {
|
|
213
|
-
const parsed = parseGradeReferenceExample(candidate, opts.target);
|
|
213
|
+
const parsed = parseGradeReferenceExample(candidate, opts.target, opts.project);
|
|
214
214
|
return parsed ? [parsed] : [];
|
|
215
215
|
}),
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
|
-
export function resolveSafeMarkdownPath(input, root = specdojoRootDir()) {
|
|
218
|
+
export function resolveSafeMarkdownPath(input, root = specdojoRootDir(), projectOption) {
|
|
219
219
|
const absolute = resolve(root, input);
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
const inside = (base, path) => {
|
|
221
|
+
const rel = relative(base, path);
|
|
222
|
+
return (rel !== ".." &&
|
|
223
|
+
!rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) &&
|
|
224
|
+
!isAbsolute(rel));
|
|
225
|
+
};
|
|
226
|
+
const roots = [root];
|
|
227
|
+
if (!inside(root, absolute)) {
|
|
228
|
+
const { config } = loadConfig(root);
|
|
229
|
+
const projectId = projectOption ?? config?.current_project ?? Object.keys(config?.projects ?? {})[0];
|
|
230
|
+
const project = projectId ? config?.projects[projectId] : undefined;
|
|
231
|
+
for (const repo of project?.repos ?? [])
|
|
232
|
+
roots.push(resolveRepoRoot(root, repo));
|
|
233
|
+
}
|
|
234
|
+
if (!roots.some((base) => inside(base, absolute)))
|
|
235
|
+
throw new Error(`Path is outside repository or declared project.repos: ${input}`);
|
|
223
236
|
if (extname(absolute).toLowerCase() !== ".md") {
|
|
224
237
|
throw new Error(`${input}: grade currently writes inline findings only for Markdown`);
|
|
225
238
|
}
|
|
226
239
|
if (!existsSync(absolute))
|
|
227
240
|
throw new Error(`Document not found: ${input}`);
|
|
241
|
+
if (!roots.some((base) => existsSync(base) && inside(realpathSync(base), realpathSync(absolute))))
|
|
242
|
+
throw new Error(`Path is outside repository or declared project.repos: ${input}`);
|
|
228
243
|
return absolute;
|
|
229
244
|
}
|
|
230
245
|
export function resolveSafeRepositoryPath(input, option) {
|
|
231
246
|
const root = specdojoRootDir();
|
|
232
247
|
const absolute = resolve(root, input);
|
|
233
|
-
const rel =
|
|
234
|
-
if (rel.startsWith("../") || isAbsolute(rel)) {
|
|
248
|
+
const rel = relativePathFromRoot(absolute, root);
|
|
249
|
+
if (rel === ".." || rel.startsWith("../") || isAbsolute(rel)) {
|
|
235
250
|
throw new Error(`${option} must be inside the repository`);
|
|
236
251
|
}
|
|
252
|
+
let ancestor = absolute;
|
|
253
|
+
while (!existsSync(ancestor))
|
|
254
|
+
ancestor = dirname(ancestor);
|
|
255
|
+
const realRelative = relativePathFromRoot(realpathSync(ancestor), realpathSync(root));
|
|
256
|
+
if (realRelative === ".." || realRelative.startsWith("../") || isAbsolute(realRelative))
|
|
257
|
+
throw new Error(`${option} must be inside the repository`);
|
|
237
258
|
return absolute;
|
|
238
259
|
}
|
|
239
260
|
export function isGeneratedGradeTarget(path, rootDir = specdojoRootDir()) {
|
|
@@ -266,6 +287,7 @@ export function loadDeliverableCatalog(projectOption, root = specdojoRootDir())
|
|
|
266
287
|
const path = resolve(root, item.resolvedPath);
|
|
267
288
|
if (!existsSync(path) || entries.has(path))
|
|
268
289
|
continue;
|
|
290
|
+
resolveSafeMarkdownPath(path, root, projectOption);
|
|
269
291
|
entries.set(path, {
|
|
270
292
|
path,
|
|
271
293
|
localId: item.item.local_id,
|
|
@@ -289,7 +311,7 @@ export function resolveDeliverableDoneCriteria(paths, projectOption) {
|
|
|
289
311
|
const catalog = loadDeliverableCatalog(projectOption);
|
|
290
312
|
const result = new Map();
|
|
291
313
|
for (const path of paths) {
|
|
292
|
-
const entry = catalog.get(resolveSafeMarkdownPath(path));
|
|
314
|
+
const entry = catalog.get(resolveSafeMarkdownPath(path, specdojoRootDir(), projectOption));
|
|
293
315
|
if (entry && entry.doneCriteria.length > 0) {
|
|
294
316
|
result.set(repoRelativePath(entry.path), entry.doneCriteria);
|
|
295
317
|
}
|
|
@@ -424,7 +446,7 @@ export function gradeSourceHashes(documentPath, document, viewpoints, target, co
|
|
|
424
446
|
}
|
|
425
447
|
/** Current hashes of the comparison sources and dependencies that grade apply records for a document. */
|
|
426
448
|
export function resolveGradeSourceHashes(opts, rootDir = specdojoRootDir()) {
|
|
427
|
-
const absolute = resolveSafeMarkdownPath(opts.path, rootDir);
|
|
449
|
+
const absolute = resolveSafeMarkdownPath(opts.path, rootDir, opts.project);
|
|
428
450
|
const document = parseMarkdown(readFileSync(absolute, "utf8"), relativePathFromRoot(absolute, rootDir));
|
|
429
451
|
const viewpoints = opts.viewpoints ?? loadViewpointsIfConfigured(opts.project, rootDir);
|
|
430
452
|
return gradeSourceHashes(absolute, document, viewpoints, opts.target, createGradeSourceContext(opts.project, rootDir));
|
|
@@ -8,7 +8,9 @@ import { getProjectCatalogPath, loadConfig, specdojoRootDir, } from "../shared/s
|
|
|
8
8
|
import { APPROACHES } from "../shared/agent-types.js";
|
|
9
9
|
import { load } from "../shared/yaml.js";
|
|
10
10
|
import { assertAuthorableKataId, authoredKataExists, authoringKind } from "../kata/authoring.js";
|
|
11
|
+
import { CATALOG_LESS_APPROACHES, resolveRegisterDeliverableTarget } from "./deliverable-target.js";
|
|
11
12
|
import { resolveAuthoringSources } from "./authoring-sources.js";
|
|
13
|
+
import { isPlanningApproach, validatePlanningTarget } from "./planning.js";
|
|
12
14
|
const MAINTENANCE_TARGET_KIND = {
|
|
13
15
|
"rulebook-maintenance": "rulebook",
|
|
14
16
|
"recipe-maintenance": "recipe",
|
|
@@ -86,6 +88,10 @@ export function validateRegisterApproachTargets(opts) {
|
|
|
86
88
|
throw new Error(`Approach "${approach}" requires the new kata id as the first --target`);
|
|
87
89
|
}
|
|
88
90
|
}
|
|
91
|
+
if ((opts.targetPath !== undefined || opts.targetRulebook !== undefined) &&
|
|
92
|
+
(!approach || !CATALOG_LESS_APPROACHES.includes(approach))) {
|
|
93
|
+
throw new Error("--target-path and --target-rulebook require a supported deliverable approach");
|
|
94
|
+
}
|
|
89
95
|
if (sources.length > 0 && !authoringKind(approach)) {
|
|
90
96
|
throw new Error("--source is only valid with a *-authoring approach");
|
|
91
97
|
}
|
|
@@ -93,6 +99,17 @@ export function validateRegisterApproachTargets(opts) {
|
|
|
93
99
|
return;
|
|
94
100
|
if (targets.length === 0)
|
|
95
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
|
+
}
|
|
96
113
|
const entries = collectDocIndexEntries(resolve(opts.repoRoot, "docs"), opts.repoRoot);
|
|
97
114
|
if (!approach) {
|
|
98
115
|
for (const target of targets) {
|
|
@@ -126,12 +143,28 @@ export function validateRegisterApproachTargets(opts) {
|
|
|
126
143
|
if (!indexedPath) {
|
|
127
144
|
throw new Error(`Target document id is not resolvable via the document index: ${targetId}`);
|
|
128
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
|
+
}
|
|
129
153
|
const actualKind = targetDocumentType(resolvedIndexPath(opts.repoRoot, indexedPath));
|
|
130
154
|
if (actualKind !== expectedKind) {
|
|
131
155
|
throw new Error(`Approach "${approach}" requires a ${expectedKind} document target, but ${targetId} has type "${actualKind ?? "unknown"}"`);
|
|
132
156
|
}
|
|
133
157
|
return;
|
|
134
158
|
}
|
|
159
|
+
if (CATALOG_LESS_APPROACHES.includes(approach)) {
|
|
160
|
+
if (opts.catalogPath &&
|
|
161
|
+
!catalogDeliverableDocIds(opts.catalogPath, opts.repoRoot, opts.projectId).has(targetId) &&
|
|
162
|
+
!(opts.targetPath && opts.targetRulebook)) {
|
|
163
|
+
throw new Error(`Approach "${approach}" requires a deliverable document from the project catalog, but ${targetId} is not a catalog deliverable`);
|
|
164
|
+
}
|
|
165
|
+
resolveRegisterDeliverableTarget({ ...opts, approach, targetId });
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
135
168
|
if (!opts.catalogPath) {
|
|
136
169
|
throw new Error(`Approach "${approach}" requires a deliverable target, but catalog_path is not configured for project ${opts.projectId}`);
|
|
137
170
|
}
|
|
@@ -156,6 +189,8 @@ export function validateRegisterApproachTargetsForProject(opts) {
|
|
|
156
189
|
...(opts.targets !== undefined ? { targets: opts.targets } : {}),
|
|
157
190
|
...(opts.sources !== undefined ? { sources: opts.sources } : {}),
|
|
158
191
|
project,
|
|
192
|
+
...(opts.targetPath !== undefined ? { targetPath: opts.targetPath } : {}),
|
|
193
|
+
...(opts.targetRulebook !== undefined ? { targetRulebook: opts.targetRulebook } : {}),
|
|
159
194
|
...(opts.validateTargetsWithoutApproach !== undefined
|
|
160
195
|
? { validateTargetsWithoutApproach: opts.validateTargetsWithoutApproach }
|
|
161
196
|
: {}),
|
|
@@ -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
|
+
}
|
package/dist/register/core.js
CHANGED
|
@@ -257,6 +257,7 @@ export function formatTableRow(item) {
|
|
|
257
257
|
item.completed,
|
|
258
258
|
item.conclusion,
|
|
259
259
|
item.ticket,
|
|
260
|
+
item.dependsOn?.join(", ") || CELL_NONE,
|
|
260
261
|
]
|
|
261
262
|
.map(toCell)
|
|
262
263
|
.map(inlineCodeAnglePlaceholders);
|
|
@@ -367,6 +368,7 @@ export function buildRegisterItemContent(opts) {
|
|
|
367
368
|
title: opts.fields.title,
|
|
368
369
|
description: opts.fields.description,
|
|
369
370
|
type: opts.fields.type,
|
|
371
|
+
...(opts.fields.track ? { track: opts.fields.track } : {}),
|
|
370
372
|
priority: opts.fields.priority,
|
|
371
373
|
...(opts.fields.difficulty ? { difficulty: opts.fields.difficulty } : {}),
|
|
372
374
|
owner: opts.fields.owner,
|
|
@@ -377,7 +379,10 @@ export function buildRegisterItemContent(opts) {
|
|
|
377
379
|
ticket: "-",
|
|
378
380
|
...(opts.fields.approach ? { approach: opts.fields.approach } : {}),
|
|
379
381
|
...(opts.fields.targets ? { targets: opts.fields.targets } : {}),
|
|
382
|
+
...(opts.fields.targetPath ? { targetPath: opts.fields.targetPath } : {}),
|
|
383
|
+
...(opts.fields.targetRulebook ? { targetRulebook: opts.fields.targetRulebook } : {}),
|
|
380
384
|
...(opts.fields.sources ? { sources: opts.fields.sources } : {}),
|
|
381
385
|
...(opts.fields.derivedFrom ? { derivedFrom: opts.fields.derivedFrom } : {}),
|
|
386
|
+
...(opts.fields.dependsOn ? { dependsOn: opts.fields.dependsOn } : {}),
|
|
382
387
|
}));
|
|
383
388
|
}
|
|
@@ -4,11 +4,13 @@ import { inlineCodeAnglePlaceholders } from "../shared/text.js";
|
|
|
4
4
|
import { APPROACHES } from "../shared/agent-types.js";
|
|
5
5
|
import { appendRegisterEvent, buildRegisterEvent, registerEventFilePath } from "./events.js";
|
|
6
6
|
import { nowUtcTimestamp } from "./date.js";
|
|
7
|
-
import { CELL_NONE, CELL_TODO, REMOVE_REGISTER_ITEM_FIELD, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, } from "./item.js";
|
|
7
|
+
import { readRegisterItemContent, CELL_NONE, CELL_TODO, REMOVE_REGISTER_ITEM_FIELD, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, } from "./item.js";
|
|
8
8
|
import { resolveSpecdojoTemplatePath } from "../docs/template-resolution.js";
|
|
9
9
|
import { validateRegisterApproachTargetsForProject } from "./approach.js";
|
|
10
|
+
import { normalizeDependsOn, validateRegisterDependencies } from "./dependency.js";
|
|
10
11
|
import { normalizeDerivedFrom, validateDerivedFrom } from "./derivation.js";
|
|
11
12
|
import { delegateExternalRegisterAdd } from "./external-project.js";
|
|
13
|
+
import { validateRegisterTrack } from "./epic.js";
|
|
12
14
|
import { isAuthoringApproach } from "../kata/authoring.js";
|
|
13
15
|
function collectTarget(value, previous = []) {
|
|
14
16
|
return [...previous, value];
|
|
@@ -72,6 +74,7 @@ export function registerCreateCommands(reg, dependencies) {
|
|
|
72
74
|
const addCmd = reg.command("add").description("Add a new item to pjr-index.md");
|
|
73
75
|
addProjectOption(addCmd);
|
|
74
76
|
addCmd.requiredOption("--type <type>", `Item type: ${VALID_TYPES.join(" | ")}`);
|
|
77
|
+
addCmd.option("--track <track>", "Track governed by an epic (required for epic)");
|
|
75
78
|
addCmd.requiredOption("--title <title>", "Short title for the item");
|
|
76
79
|
addCmd.option("--description <text>", "Description shown in the list", "_TODO_");
|
|
77
80
|
addCmd.option("--priority <priority>", `Priority: ${VALID_PRIORITIES.join(" | ")}`, "medium");
|
|
@@ -82,10 +85,13 @@ export function registerCreateCommands(reg, dependencies) {
|
|
|
82
85
|
addCmd.option("--due <date>", "Due date (YYYY-MM-DD, -, or _TODO_)", "_TODO_");
|
|
83
86
|
addCmd.option("--completed <datetime>", "Completion date-time (RFC 3339 with time zone, or -)", "-");
|
|
84
87
|
addCmd.option("--conclusion <text>", "Conclusion or resolution summary", "-");
|
|
88
|
+
addCmd.option("--target-path <path>", "Repository-relative deliverable file path");
|
|
89
|
+
addCmd.option("--target-rulebook <doc-id>", "Deliverable rulebook id (new id for bootstrap)");
|
|
85
90
|
addCmd.option("--approach <approach>", `Execution approach: ${APPROACHES.join(" | ")}`);
|
|
86
|
-
addCmd.option("--target <
|
|
91
|
+
addCmd.option("--target <target>", "Document id, domain:<id> for catalog-planning, or track:<id> for strategy-planning (repeatable)", collectTarget);
|
|
87
92
|
addCmd.option("--source <ref>", "Read-only exemplar for *-authoring (repeatable: doc id, path, or <repo>:<path>)", collectTarget);
|
|
88
93
|
addCmd.option("--from <item-id>", "Register item this item derives from (repeatable)", collectTarget);
|
|
94
|
+
addCmd.option("--depends-on <item-id>", "Predecessor item ID (repeatable; use - to remove)", collectTarget);
|
|
89
95
|
addCmd.option("--id <id>", "Display ID (e.g., PJR-0061); auto-incremented if omitted");
|
|
90
96
|
addCmd.option("--topic <topic>", "Topic slug for ticket filename; derived from --title if omitted");
|
|
91
97
|
addCmd.option("--by <actor>", "Actor recorded in the append-only register event");
|
|
@@ -129,11 +135,18 @@ export function registerCreateCommands(reg, dependencies) {
|
|
|
129
135
|
validateRegisterApproachTargetsForProject({
|
|
130
136
|
projectId: paths.projectId,
|
|
131
137
|
...(opts.approach !== undefined ? { approach: opts.approach } : {}),
|
|
138
|
+
...(opts.targetPath !== undefined ? { targetPath: opts.targetPath.trim() } : {}),
|
|
139
|
+
...(opts.targetRulebook !== undefined
|
|
140
|
+
? { targetRulebook: opts.targetRulebook.trim() }
|
|
141
|
+
: {}),
|
|
132
142
|
...(rawTargets !== undefined ? { targets: rawTargets } : {}),
|
|
133
143
|
...(explicitSources !== undefined ? { sources: explicitSources } : {}),
|
|
134
144
|
validateTargetsWithoutApproach: opts.target !== undefined || opts.source !== undefined,
|
|
135
145
|
});
|
|
146
|
+
const track = opts.track?.trim();
|
|
147
|
+
validateRegisterTrack(paths.projectId, opts.type, track);
|
|
136
148
|
const fields = {
|
|
149
|
+
...(track !== undefined ? { track } : {}),
|
|
137
150
|
type: opts.type,
|
|
138
151
|
title: opts.title,
|
|
139
152
|
description: opts.description,
|
|
@@ -147,6 +160,10 @@ export function registerCreateCommands(reg, dependencies) {
|
|
|
147
160
|
conclusion: opts.conclusion,
|
|
148
161
|
...(opts.approach !== undefined ? { approach: opts.approach } : {}),
|
|
149
162
|
...(targets !== undefined ? { targets } : {}),
|
|
163
|
+
...(opts.targetPath !== undefined ? { targetPath: opts.targetPath.trim() } : {}),
|
|
164
|
+
...(opts.targetRulebook !== undefined
|
|
165
|
+
? { targetRulebook: opts.targetRulebook.trim() }
|
|
166
|
+
: {}),
|
|
150
167
|
...(sources !== undefined ? { sources } : {}),
|
|
151
168
|
};
|
|
152
169
|
const templatePath = resolveSpecdojoTemplatePath(`pjr-${opts.type}-template.md`);
|
|
@@ -164,6 +181,7 @@ export function registerCreateCommands(reg, dependencies) {
|
|
|
164
181
|
});
|
|
165
182
|
if (derivedFrom !== undefined)
|
|
166
183
|
fields.derivedFrom = derivedFrom;
|
|
184
|
+
fields.dependsOn = normalizeDependsOn(opts.dependsOn);
|
|
167
185
|
const ticketPath = join(paths.projectRegisterPath, ticketFilename);
|
|
168
186
|
const content = buildRegisterItemContent({
|
|
169
187
|
projectId: paths.projectId,
|
|
@@ -172,6 +190,10 @@ export function registerCreateCommands(reg, dependencies) {
|
|
|
172
190
|
fields,
|
|
173
191
|
templatePath,
|
|
174
192
|
});
|
|
193
|
+
const dependencyItem = readRegisterItemContent(content, ticketFilename)?.item;
|
|
194
|
+
if (!dependencyItem)
|
|
195
|
+
throw new Error(`Failed to read item ${displayId}`);
|
|
196
|
+
validateRegisterDependencies(paths, dependencyItem);
|
|
175
197
|
const addEvent = buildRegisterEvent({
|
|
176
198
|
afterContent: content,
|
|
177
199
|
filename: ticketFilename,
|
|
@@ -220,6 +242,7 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
220
242
|
const updateCmd = reg.command("update").description("Update fields of a register item");
|
|
221
243
|
addProjectOption(updateCmd);
|
|
222
244
|
updateCmd.requiredOption("--id <id>", "Item ID (PJR-XXXX)");
|
|
245
|
+
updateCmd.option("--track <track>", "Replace the track governed by an epic");
|
|
223
246
|
updateCmd.option("--title <title>", "Update title");
|
|
224
247
|
updateCmd.option("--description <text>", "Update description");
|
|
225
248
|
updateCmd.option("--priority <priority>", `Update priority: ${VALID_PRIORITIES.join(" | ")}`);
|
|
@@ -229,10 +252,13 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
229
252
|
updateCmd.option("--conclusion <text>", "Update conclusion or use - to remove it");
|
|
230
253
|
updateCmd.option("--block-reason <text>", "Update the waiting reason or use - to remove it");
|
|
231
254
|
updateCmd.option("--autopilot <approval>", "Night orchestrator approval: approved, or - to revoke");
|
|
255
|
+
updateCmd.option("--target-path <path>", "Replace deliverable path; use - to remove");
|
|
256
|
+
updateCmd.option("--target-rulebook <doc-id>", "Replace deliverable rulebook id; use - to remove");
|
|
232
257
|
updateCmd.option("--approach <approach>", `Update execution approach (${APPROACHES.join(" | ")}; use - to remove)`);
|
|
233
|
-
updateCmd.option("--target <
|
|
258
|
+
updateCmd.option("--target <target>", "Replace target document ids (repeatable; legacy authoring exemplars may follow; use - to remove)", collectTarget);
|
|
234
259
|
updateCmd.option("--source <ref>", "Replace read-only *-authoring exemplars (repeatable; use - to remove)", collectTarget);
|
|
235
260
|
updateCmd.option("--from <item-id>", "Replace source register item IDs (repeatable; use - to remove)", collectTarget);
|
|
261
|
+
updateCmd.option("--depends-on <item-id>", "Replace predecessor IDs (repeatable; use - to remove)", collectTarget);
|
|
236
262
|
updateCmd.option("--topic <topic>", "Update the topic slug in the ticket filename and document ID");
|
|
237
263
|
updateCmd.option("--by <actor>", "Actor recorded in the append-only register event");
|
|
238
264
|
updateCmd.option("--reason <text>", "Reason recorded in the append-only register event");
|
|
@@ -244,6 +270,7 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
244
270
|
const view = loadItemForUpdate(paths, opts.id);
|
|
245
271
|
const item = view.item;
|
|
246
272
|
const hasUpdates = [
|
|
273
|
+
"track",
|
|
247
274
|
"title",
|
|
248
275
|
"description",
|
|
249
276
|
"priority",
|
|
@@ -256,11 +283,14 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
256
283
|
"approach",
|
|
257
284
|
"target",
|
|
258
285
|
"source",
|
|
286
|
+
"targetPath",
|
|
287
|
+
"targetRulebook",
|
|
259
288
|
"from",
|
|
289
|
+
"dependsOn",
|
|
260
290
|
"topic",
|
|
261
291
|
].some((key) => opts[key] !== undefined);
|
|
262
292
|
if (!hasUpdates) {
|
|
263
|
-
throw new Error("At least one field option must be specified (--title, --description, --priority, --difficulty, --owner, --due, --conclusion, --block-reason, --autopilot, --approach, --target, --source, --from, --topic)");
|
|
293
|
+
throw new Error("At least one field option must be specified (--track, --title, --description, --priority, --difficulty, --owner, --due, --conclusion, --block-reason, --autopilot, --approach, --target, --source, --from, --depends-on, --topic)");
|
|
264
294
|
}
|
|
265
295
|
if (opts.priority !== undefined &&
|
|
266
296
|
!VALID_PRIORITIES.includes(opts.priority)) {
|
|
@@ -303,6 +333,16 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
303
333
|
: {
|
|
304
334
|
autopilot: opts.autopilot === "-" ? REMOVE_REGISTER_ITEM_FIELD : "approved",
|
|
305
335
|
};
|
|
336
|
+
const nextTargetPath = opts.targetPath === undefined
|
|
337
|
+
? item.targetPath
|
|
338
|
+
: opts.targetPath.trim() === "-"
|
|
339
|
+
? undefined
|
|
340
|
+
: opts.targetPath.trim();
|
|
341
|
+
const nextTargetRulebook = opts.targetRulebook === undefined
|
|
342
|
+
? item.targetRulebook
|
|
343
|
+
: opts.targetRulebook.trim() === "-"
|
|
344
|
+
? undefined
|
|
345
|
+
: opts.targetRulebook.trim();
|
|
306
346
|
const nextApproach = opts.approach === undefined
|
|
307
347
|
? item.approach
|
|
308
348
|
: opts.approach.trim() === "-"
|
|
@@ -333,6 +373,8 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
333
373
|
? explicitSources
|
|
334
374
|
: item.sources;
|
|
335
375
|
const normalizedNextSources = nextSources && nextSources.length > 0 ? nextSources : undefined;
|
|
376
|
+
const nextDependsOn = opts.dependsOn === undefined ? item.dependsOn : normalizeDependsOn(opts.dependsOn);
|
|
377
|
+
validateRegisterDependencies(paths, { ...item, dependsOn: nextDependsOn });
|
|
336
378
|
const nextDerivedFrom = opts.from === undefined
|
|
337
379
|
? item.derivedFrom
|
|
338
380
|
: normalizeDerivedFrom(opts.from, { allowRemove: true });
|
|
@@ -341,9 +383,15 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
341
383
|
itemId: item.id,
|
|
342
384
|
derivedFrom: nextDerivedFrom,
|
|
343
385
|
});
|
|
344
|
-
if (opts.approach !== undefined ||
|
|
386
|
+
if (opts.approach !== undefined ||
|
|
387
|
+
opts.target !== undefined ||
|
|
388
|
+
opts.source !== undefined ||
|
|
389
|
+
opts.targetPath !== undefined ||
|
|
390
|
+
opts.targetRulebook !== undefined) {
|
|
345
391
|
validateRegisterApproachTargetsForProject({
|
|
346
392
|
projectId: paths.projectId,
|
|
393
|
+
...(nextTargetPath !== undefined ? { targetPath: nextTargetPath } : {}),
|
|
394
|
+
...(nextTargetRulebook !== undefined ? { targetRulebook: nextTargetRulebook } : {}),
|
|
347
395
|
...(nextApproach !== undefined ? { approach: nextApproach } : {}),
|
|
348
396
|
...(nextTargets !== undefined ? { targets: nextTargets } : {}),
|
|
349
397
|
...(normalizedNextSources !== undefined ? { sources: normalizedNextSources } : {}),
|
|
@@ -354,6 +402,15 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
354
402
|
(authoring && opts.source !== undefined && (item.targets?.length ?? 0) > 1);
|
|
355
403
|
const shouldUpdateSources = opts.source !== undefined || (authoring && providedLegacySources.length > 0);
|
|
356
404
|
const approachTargetUpdates = {
|
|
405
|
+
...(opts.dependsOn !== undefined
|
|
406
|
+
? { depends_on: nextDependsOn ?? REMOVE_REGISTER_ITEM_FIELD }
|
|
407
|
+
: {}),
|
|
408
|
+
...(opts.targetPath !== undefined
|
|
409
|
+
? { target_path: nextTargetPath ?? REMOVE_REGISTER_ITEM_FIELD }
|
|
410
|
+
: {}),
|
|
411
|
+
...(opts.targetRulebook !== undefined
|
|
412
|
+
? { target_rulebook: nextTargetRulebook ?? REMOVE_REGISTER_ITEM_FIELD }
|
|
413
|
+
: {}),
|
|
357
414
|
...(opts.difficulty !== undefined
|
|
358
415
|
? {
|
|
359
416
|
difficulty: opts.difficulty === "-" ? REMOVE_REGISTER_ITEM_FIELD : opts.difficulty,
|
|
@@ -380,8 +437,11 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
380
437
|
}
|
|
381
438
|
: {}),
|
|
382
439
|
};
|
|
440
|
+
const track = opts.track === undefined ? item.track : opts.track.trim();
|
|
441
|
+
validateRegisterTrack(paths.projectId, item.type, track);
|
|
383
442
|
const updated = {
|
|
384
443
|
...item,
|
|
444
|
+
...(track !== undefined ? { track } : {}),
|
|
385
445
|
...(opts.title !== undefined ? { title: opts.title } : {}),
|
|
386
446
|
...(opts.description !== undefined ? { description: opts.description } : {}),
|
|
387
447
|
...(opts.priority !== undefined ? { priority: opts.priority } : {}),
|
|
@@ -400,6 +460,18 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
400
460
|
else
|
|
401
461
|
updated.autopilot = "approved";
|
|
402
462
|
}
|
|
463
|
+
if (opts.targetPath !== undefined) {
|
|
464
|
+
if (nextTargetPath === undefined)
|
|
465
|
+
delete updated.targetPath;
|
|
466
|
+
else
|
|
467
|
+
updated.targetPath = nextTargetPath;
|
|
468
|
+
}
|
|
469
|
+
if (opts.targetRulebook !== undefined) {
|
|
470
|
+
if (nextTargetRulebook === undefined)
|
|
471
|
+
delete updated.targetRulebook;
|
|
472
|
+
else
|
|
473
|
+
updated.targetRulebook = nextTargetRulebook;
|
|
474
|
+
}
|
|
403
475
|
if (opts.approach !== undefined) {
|
|
404
476
|
if (nextApproach === undefined)
|
|
405
477
|
delete updated.approach;
|
|
@@ -424,6 +496,12 @@ export function registerUpdateCommand(reg, dependencies) {
|
|
|
424
496
|
else
|
|
425
497
|
updated.derivedFrom = nextDerivedFrom;
|
|
426
498
|
}
|
|
499
|
+
if (opts.dependsOn !== undefined) {
|
|
500
|
+
if (nextDependsOn === undefined)
|
|
501
|
+
delete updated.dependsOn;
|
|
502
|
+
else
|
|
503
|
+
updated.dependsOn = nextDependsOn;
|
|
504
|
+
}
|
|
427
505
|
const currentTopic = view.ticketFilename
|
|
428
506
|
? ticketTopicFromFilename(opts.id, view.ticketFilename)
|
|
429
507
|
: undefined;
|