@seanmars/tospec 0.19.0-beta.0 → 0.19.0-beta.13
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/CHANGELOG.md +578 -0
- package/README.md +71 -77
- package/assets/dashboard/app.js +14 -3
- package/assets/dashboard/style.css +7 -0
- package/assets/metrics/app.js +22 -0
- package/assets/metrics/style.css +8 -0
- package/assets/rules/tospec/decision.md +3 -0
- package/assets/rules/tospec/single-source-of-truth.md +19 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +266 -82
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/config.d.ts +9 -17
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +374 -95
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/dashboard.d.ts +64 -81
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +350 -218
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/decision.d.ts +41 -19
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +400 -70
- package/dist/commands/decision.js.map +1 -1
- package/dist/commands/metrics.d.ts +34 -48
- package/dist/commands/metrics.d.ts.map +1 -1
- package/dist/commands/metrics.js +74 -84
- package/dist/commands/metrics.js.map +1 -1
- package/dist/commands/shared-output.d.ts +24 -10
- package/dist/commands/shared-output.d.ts.map +1 -1
- package/dist/commands/shared-output.js +62 -11
- package/dist/commands/shared-output.js.map +1 -1
- package/dist/commands/show.d.ts +7 -0
- package/dist/commands/show.d.ts.map +1 -1
- package/dist/commands/show.js +39 -8
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/validate.d.ts +47 -30
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +282 -108
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/workflow/index.d.ts +6 -10
- package/dist/commands/workflow/index.d.ts.map +1 -1
- package/dist/commands/workflow/index.js +6 -10
- package/dist/commands/workflow/index.js.map +1 -1
- package/dist/commands/workflow/instructions.d.ts +21 -8
- package/dist/commands/workflow/instructions.d.ts.map +1 -1
- package/dist/commands/workflow/instructions.js +254 -95
- package/dist/commands/workflow/instructions.js.map +1 -1
- package/dist/commands/workflow/new-change.d.ts +4 -5
- package/dist/commands/workflow/new-change.d.ts.map +1 -1
- package/dist/commands/workflow/new-change.js +90 -25
- package/dist/commands/workflow/new-change.js.map +1 -1
- package/dist/commands/workflow/schemas.d.ts +3 -5
- package/dist/commands/workflow/schemas.d.ts.map +1 -1
- package/dist/commands/workflow/schemas.js +37 -11
- package/dist/commands/workflow/schemas.js.map +1 -1
- package/dist/commands/workflow/shared.d.ts +48 -21
- package/dist/commands/workflow/shared.d.ts.map +1 -1
- package/dist/commands/workflow/shared.js +36 -33
- package/dist/commands/workflow/shared.js.map +1 -1
- package/dist/commands/workflow/status.d.ts +10 -6
- package/dist/commands/workflow/status.d.ts.map +1 -1
- package/dist/commands/workflow/status.js +84 -42
- package/dist/commands/workflow/status.js.map +1 -1
- package/dist/commands/workflow/templates.d.ts +10 -3
- package/dist/commands/workflow/templates.d.ts.map +1 -1
- package/dist/commands/workflow/templates.js +39 -40
- package/dist/commands/workflow/templates.js.map +1 -1
- package/dist/core/archive.d.ts +26 -21
- package/dist/core/archive.d.ts.map +1 -1
- package/dist/core/archive.js +415 -201
- package/dist/core/archive.js.map +1 -1
- package/dist/core/artifact-graph/graph.d.ts +29 -36
- package/dist/core/artifact-graph/graph.d.ts.map +1 -1
- package/dist/core/artifact-graph/graph.js +50 -58
- package/dist/core/artifact-graph/graph.js.map +1 -1
- package/dist/core/artifact-graph/index.d.ts +2 -2
- package/dist/core/artifact-graph/index.d.ts.map +1 -1
- package/dist/core/artifact-graph/index.js +2 -2
- package/dist/core/artifact-graph/index.js.map +1 -1
- package/dist/core/artifact-graph/instruction-loader.d.ts +105 -100
- package/dist/core/artifact-graph/instruction-loader.d.ts.map +1 -1
- package/dist/core/artifact-graph/instruction-loader.js +176 -110
- package/dist/core/artifact-graph/instruction-loader.js.map +1 -1
- package/dist/core/artifact-graph/outputs.d.ts +13 -6
- package/dist/core/artifact-graph/outputs.d.ts.map +1 -1
- package/dist/core/artifact-graph/outputs.js +146 -8
- package/dist/core/artifact-graph/outputs.js.map +1 -1
- package/dist/core/artifact-graph/resolver.d.ts +44 -63
- package/dist/core/artifact-graph/resolver.d.ts.map +1 -1
- package/dist/core/artifact-graph/resolver.js +85 -86
- package/dist/core/artifact-graph/resolver.js.map +1 -1
- package/dist/core/artifact-graph/schema.d.ts +0 -6
- package/dist/core/artifact-graph/schema.d.ts.map +1 -1
- package/dist/core/artifact-graph/schema.js +7 -32
- package/dist/core/artifact-graph/schema.js.map +1 -1
- package/dist/core/artifact-graph/state.d.ts +1 -8
- package/dist/core/artifact-graph/state.d.ts.map +1 -1
- package/dist/core/artifact-graph/state.js +2 -17
- package/dist/core/artifact-graph/state.js.map +1 -1
- package/dist/core/artifact-graph/stub-detection.d.ts +12 -0
- package/dist/core/artifact-graph/stub-detection.d.ts.map +1 -0
- package/dist/core/artifact-graph/stub-detection.js +39 -0
- package/dist/core/artifact-graph/stub-detection.js.map +1 -0
- package/dist/core/artifact-graph/types.d.ts +4 -0
- package/dist/core/artifact-graph/types.d.ts.map +1 -1
- package/dist/core/artifact-graph/types.js +30 -10
- package/dist/core/artifact-graph/types.js.map +1 -1
- package/dist/core/available-tools.d.ts +3 -12
- package/dist/core/available-tools.d.ts.map +1 -1
- package/dist/core/available-tools.js +4 -13
- package/dist/core/available-tools.js.map +1 -1
- package/dist/core/change-metadata/schema.d.ts +1 -1
- package/dist/core/change-metadata/schema.d.ts.map +1 -1
- package/dist/core/change-metadata/schema.js +10 -7
- package/dist/core/change-metadata/schema.js.map +1 -1
- package/dist/core/change-presenter.d.ts +23 -18
- package/dist/core/change-presenter.d.ts.map +1 -1
- package/dist/core/change-presenter.js +102 -43
- package/dist/core/change-presenter.js.map +1 -1
- package/dist/core/change-status-policy.d.ts +8 -1
- package/dist/core/change-status-policy.d.ts.map +1 -1
- package/dist/core/change-status-policy.js +25 -1
- package/dist/core/change-status-policy.js.map +1 -1
- package/dist/core/codex-metrics.d.ts +25 -45
- package/dist/core/codex-metrics.d.ts.map +1 -1
- package/dist/core/codex-metrics.js +44 -88
- package/dist/core/codex-metrics.js.map +1 -1
- package/dist/core/codex-residue.d.ts +22 -0
- package/dist/core/codex-residue.d.ts.map +1 -0
- package/dist/core/codex-residue.js +61 -0
- package/dist/core/codex-residue.js.map +1 -0
- package/dist/core/command-generation/adapters/claude.d.ts +2 -9
- package/dist/core/command-generation/adapters/claude.d.ts.map +1 -1
- package/dist/core/command-generation/adapters/claude.js +2 -12
- package/dist/core/command-generation/adapters/claude.js.map +1 -1
- package/dist/core/command-generation/adapters/index.d.ts +1 -9
- package/dist/core/command-generation/adapters/index.d.ts.map +1 -1
- package/dist/core/command-generation/adapters/index.js +1 -9
- package/dist/core/command-generation/adapters/index.js.map +1 -1
- package/dist/core/command-generation/generator.d.ts +0 -17
- package/dist/core/command-generation/generator.d.ts.map +1 -1
- package/dist/core/command-generation/generator.js +0 -17
- package/dist/core/command-generation/generator.js.map +1 -1
- package/dist/core/command-generation/index.d.ts +2 -5
- package/dist/core/command-generation/index.d.ts.map +1 -1
- package/dist/core/command-generation/index.js +0 -9
- package/dist/core/command-generation/index.js.map +1 -1
- package/dist/core/command-generation/types.d.ts +10 -36
- package/dist/core/command-generation/types.d.ts.map +1 -1
- package/dist/core/command-generation/types.js +0 -6
- package/dist/core/command-generation/types.js.map +1 -1
- package/dist/core/command-generation/yaml.d.ts +3 -18
- package/dist/core/command-generation/yaml.d.ts.map +1 -1
- package/dist/core/command-generation/yaml.js +5 -23
- package/dist/core/command-generation/yaml.js.map +1 -1
- package/dist/core/config-prompts.d.ts +2 -4
- package/dist/core/config-prompts.d.ts.map +1 -1
- package/dist/core/config-prompts.js +2 -7
- package/dist/core/config-prompts.js.map +1 -1
- package/dist/core/config-schema.d.ts +8 -53
- package/dist/core/config-schema.d.ts.map +1 -1
- package/dist/core/config-schema.js +49 -62
- package/dist/core/config-schema.js.map +1 -1
- package/dist/core/config.d.ts +56 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +73 -2
- package/dist/core/config.js.map +1 -1
- package/dist/core/converters/json-converter.d.ts.map +1 -1
- package/dist/core/dashboard-activity.d.ts +7 -9
- package/dist/core/dashboard-activity.d.ts.map +1 -1
- package/dist/core/dashboard-activity.js +26 -24
- package/dist/core/dashboard-activity.js.map +1 -1
- package/dist/core/dashboard-data.d.ts +40 -22
- package/dist/core/dashboard-data.d.ts.map +1 -1
- package/dist/core/dashboard-data.js +84 -68
- package/dist/core/dashboard-data.js.map +1 -1
- package/dist/core/global-config.d.ts +24 -53
- package/dist/core/global-config.d.ts.map +1 -1
- package/dist/core/global-config.js +43 -62
- package/dist/core/global-config.js.map +1 -1
- package/dist/core/init.d.ts +29 -11
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +232 -164
- package/dist/core/init.js.map +1 -1
- package/dist/core/list.d.ts +1 -1
- package/dist/core/list.d.ts.map +1 -1
- package/dist/core/list.js +121 -28
- package/dist/core/list.js.map +1 -1
- package/dist/core/local-server.d.ts +63 -39
- package/dist/core/local-server.d.ts.map +1 -1
- package/dist/core/local-server.js +99 -53
- package/dist/core/local-server.js.map +1 -1
- package/dist/core/markdown-render.d.ts +25 -0
- package/dist/core/markdown-render.d.ts.map +1 -0
- package/dist/core/markdown-render.js +94 -0
- package/dist/core/markdown-render.js.map +1 -0
- package/dist/core/migrate.d.ts +32 -15
- package/dist/core/migrate.d.ts.map +1 -1
- package/dist/core/migrate.js +220 -108
- package/dist/core/migrate.js.map +1 -1
- package/dist/core/parsers/change-parser.d.ts +7 -10
- package/dist/core/parsers/change-parser.d.ts.map +1 -1
- package/dist/core/parsers/change-parser.js +48 -56
- package/dist/core/parsers/change-parser.js.map +1 -1
- package/dist/core/parsers/markdown-parser.d.ts +8 -9
- package/dist/core/parsers/markdown-parser.d.ts.map +1 -1
- package/dist/core/parsers/markdown-parser.js +31 -22
- package/dist/core/parsers/markdown-parser.js.map +1 -1
- package/dist/core/parsers/requirement-blocks.d.ts +53 -11
- package/dist/core/parsers/requirement-blocks.d.ts.map +1 -1
- package/dist/core/parsers/requirement-blocks.js +200 -60
- package/dist/core/parsers/requirement-blocks.js.map +1 -1
- package/dist/core/parsers/requirement-text.d.ts +73 -79
- package/dist/core/parsers/requirement-text.d.ts.map +1 -1
- package/dist/core/parsers/requirement-text.js +137 -79
- package/dist/core/parsers/requirement-text.js.map +1 -1
- package/dist/core/parsers/spec-structure.d.ts +1 -1
- package/dist/core/parsers/spec-structure.d.ts.map +1 -1
- package/dist/core/parsers/spec-structure.js +30 -3
- package/dist/core/parsers/spec-structure.js.map +1 -1
- package/dist/core/planning-home.js.map +1 -1
- package/dist/core/profiles.d.ts +3 -10
- package/dist/core/profiles.d.ts.map +1 -1
- package/dist/core/profiles.js +5 -12
- package/dist/core/profiles.js.map +1 -1
- package/dist/core/project-config.d.ts +43 -44
- package/dist/core/project-config.d.ts.map +1 -1
- package/dist/core/project-config.js +107 -82
- package/dist/core/project-config.js.map +1 -1
- package/dist/core/project-layout.d.ts +10 -18
- package/dist/core/project-layout.d.ts.map +1 -1
- package/dist/core/project-layout.js +16 -26
- package/dist/core/project-layout.js.map +1 -1
- package/dist/core/root-selection.d.ts +11 -7
- package/dist/core/root-selection.d.ts.map +1 -1
- package/dist/core/root-selection.js +7 -8
- package/dist/core/root-selection.js.map +1 -1
- package/dist/core/rules.d.ts +10 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +43 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/schema-names.d.ts +16 -0
- package/dist/core/schema-names.d.ts.map +1 -0
- package/dist/core/schema-names.js +16 -0
- package/dist/core/schema-names.js.map +1 -0
- package/dist/core/schemas/base.schema.d.ts +3 -0
- package/dist/core/schemas/base.schema.d.ts.map +1 -1
- package/dist/core/schemas/base.schema.js +22 -6
- package/dist/core/schemas/base.schema.js.map +1 -1
- package/dist/core/schemas/change.schema.d.ts +16 -0
- package/dist/core/schemas/change.schema.d.ts.map +1 -1
- package/dist/core/schemas/change.schema.js +41 -10
- package/dist/core/schemas/change.schema.js.map +1 -1
- package/dist/core/schemas/spec.schema.d.ts +2 -0
- package/dist/core/schemas/spec.schema.d.ts.map +1 -1
- package/dist/core/shared/index.d.ts +3 -8
- package/dist/core/shared/index.d.ts.map +1 -1
- package/dist/core/shared/index.js +3 -8
- package/dist/core/shared/index.js.map +1 -1
- package/dist/core/shared/rules-generation.d.ts +27 -8
- package/dist/core/shared/rules-generation.d.ts.map +1 -1
- package/dist/core/shared/rules-generation.js +151 -16
- package/dist/core/shared/rules-generation.js.map +1 -1
- package/dist/core/shared/skill-generation.d.ts +38 -53
- package/dist/core/shared/skill-generation.d.ts.map +1 -1
- package/dist/core/shared/skill-generation.js +82 -51
- package/dist/core/shared/skill-generation.js.map +1 -1
- package/dist/core/shared/tool-detection.d.ts +40 -62
- package/dist/core/shared/tool-detection.d.ts.map +1 -1
- package/dist/core/shared/tool-detection.js +88 -80
- package/dist/core/shared/tool-detection.js.map +1 -1
- package/dist/core/skill-metrics.d.ts +36 -63
- package/dist/core/skill-metrics.d.ts.map +1 -1
- package/dist/core/skill-metrics.js +34 -73
- package/dist/core/skill-metrics.js.map +1 -1
- package/dist/core/spec-presenter.d.ts.map +1 -1
- package/dist/core/spec-presenter.js +6 -6
- package/dist/core/spec-presenter.js.map +1 -1
- package/dist/core/specs-apply.d.ts +24 -23
- package/dist/core/specs-apply.d.ts.map +1 -1
- package/dist/core/specs-apply.js +188 -173
- package/dist/core/specs-apply.js.map +1 -1
- package/dist/core/templates/fragments/interview.d.ts +2 -6
- package/dist/core/templates/fragments/interview.d.ts.map +1 -1
- package/dist/core/templates/fragments/interview.js +2 -6
- package/dist/core/templates/fragments/interview.js.map +1 -1
- package/dist/core/templates/fragments/next-step.d.ts +4 -8
- package/dist/core/templates/fragments/next-step.d.ts.map +1 -1
- package/dist/core/templates/fragments/next-step.js +4 -8
- package/dist/core/templates/fragments/next-step.js.map +1 -1
- package/dist/core/templates/fragments/verify.d.ts +9 -12
- package/dist/core/templates/fragments/verify.d.ts.map +1 -1
- package/dist/core/templates/fragments/verify.js +9 -12
- package/dist/core/templates/fragments/verify.js.map +1 -1
- package/dist/core/templates/index.d.ts +0 -6
- package/dist/core/templates/index.d.ts.map +1 -1
- package/dist/core/templates/index.js +0 -7
- package/dist/core/templates/index.js.map +1 -1
- package/dist/core/templates/skill-templates.d.ts +1 -5
- package/dist/core/templates/skill-templates.d.ts.map +1 -1
- package/dist/core/templates/skill-templates.js +0 -5
- package/dist/core/templates/skill-templates.js.map +1 -1
- package/dist/core/templates/types.d.ts +3 -7
- package/dist/core/templates/types.d.ts.map +1 -1
- package/dist/core/templates/types.js +0 -3
- package/dist/core/templates/types.js.map +1 -1
- package/dist/core/templates/workflows/apply.d.ts +3 -9
- package/dist/core/templates/workflows/apply.d.ts.map +1 -1
- package/dist/core/templates/workflows/apply.js +9 -12
- package/dist/core/templates/workflows/apply.js.map +1 -1
- package/dist/core/templates/workflows/archive.d.ts +0 -6
- package/dist/core/templates/workflows/archive.d.ts.map +1 -1
- package/dist/core/templates/workflows/archive.js +7 -5
- package/dist/core/templates/workflows/archive.js.map +1 -1
- package/dist/core/templates/workflows/decision.js +4 -4
- package/dist/core/templates/workflows/decision.js.map +1 -1
- package/dist/core/templates/workflows/explore.js +1 -1
- package/dist/core/templates/workflows/grill.d.ts.map +1 -1
- package/dist/core/templates/workflows/grill.js +0 -2
- package/dist/core/templates/workflows/grill.js.map +1 -1
- package/dist/core/templates/workflows/issue.d.ts +0 -6
- package/dist/core/templates/workflows/issue.d.ts.map +1 -1
- package/dist/core/templates/workflows/issue.js +3 -0
- package/dist/core/templates/workflows/issue.js.map +1 -1
- package/dist/core/templates/workflows/propose.d.ts +0 -6
- package/dist/core/templates/workflows/propose.d.ts.map +1 -1
- package/dist/core/templates/workflows/propose.js +0 -1
- package/dist/core/templates/workflows/propose.js.map +1 -1
- package/dist/core/templates/workflows/sync.d.ts +2 -8
- package/dist/core/templates/workflows/sync.d.ts.map +1 -1
- package/dist/core/templates/workflows/sync.js +2 -2
- package/dist/core/templates/workflows/sync.js.map +1 -1
- package/dist/core/templates/workflows/update.d.ts +0 -6
- package/dist/core/templates/workflows/update.d.ts.map +1 -1
- package/dist/core/templates/workflows/update.js.map +1 -1
- package/dist/core/update.d.ts +26 -21
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +165 -116
- package/dist/core/update.js.map +1 -1
- package/dist/core/user-state-migration.d.ts +13 -15
- package/dist/core/user-state-migration.d.ts.map +1 -1
- package/dist/core/user-state-migration.js +16 -20
- package/dist/core/user-state-migration.js.map +1 -1
- package/dist/core/validation/constants.d.ts +19 -25
- package/dist/core/validation/constants.d.ts.map +1 -1
- package/dist/core/validation/constants.js +25 -20
- package/dist/core/validation/constants.js.map +1 -1
- package/dist/core/validation/prose-length.d.ts +15 -0
- package/dist/core/validation/prose-length.d.ts.map +1 -0
- package/dist/core/validation/prose-length.js +29 -0
- package/dist/core/validation/prose-length.js.map +1 -0
- package/dist/core/validation/purpose-placeholder.d.ts +9 -16
- package/dist/core/validation/purpose-placeholder.d.ts.map +1 -1
- package/dist/core/validation/purpose-placeholder.js +30 -44
- package/dist/core/validation/purpose-placeholder.js.map +1 -1
- package/dist/core/validation/section-validator.d.ts +4 -4
- package/dist/core/validation/section-validator.d.ts.map +1 -1
- package/dist/core/validation/section-validator.js +43 -7
- package/dist/core/validation/section-validator.js.map +1 -1
- package/dist/core/validation/task-numbering.d.ts +6 -3
- package/dist/core/validation/task-numbering.d.ts.map +1 -1
- package/dist/core/validation/task-numbering.js +23 -11
- package/dist/core/validation/task-numbering.js.map +1 -1
- package/dist/core/validation/types.d.ts +18 -0
- package/dist/core/validation/types.d.ts.map +1 -1
- package/dist/core/validation/types.js +12 -1
- package/dist/core/validation/types.js.map +1 -1
- package/dist/core/validation/validator.d.ts +50 -51
- package/dist/core/validation/validator.d.ts.map +1 -1
- package/dist/core/validation/validator.js +486 -263
- package/dist/core/validation/validator.js.map +1 -1
- package/dist/prompts/searchable-multi-select.d.ts +3 -8
- package/dist/prompts/searchable-multi-select.d.ts.map +1 -1
- package/dist/prompts/searchable-multi-select.js +16 -39
- package/dist/prompts/searchable-multi-select.js.map +1 -1
- package/dist/utils/change-metadata.d.ts +11 -50
- package/dist/utils/change-metadata.d.ts.map +1 -1
- package/dist/utils/change-metadata.js +48 -67
- package/dist/utils/change-metadata.js.map +1 -1
- package/dist/utils/change-utils.d.ts +31 -54
- package/dist/utils/change-utils.d.ts.map +1 -1
- package/dist/utils/change-utils.js +143 -100
- package/dist/utils/change-utils.js.map +1 -1
- package/dist/utils/file-lock.d.ts +39 -0
- package/dist/utils/file-lock.d.ts.map +1 -0
- package/dist/utils/file-lock.js +149 -0
- package/dist/utils/file-lock.js.map +1 -0
- package/dist/utils/file-system.d.ts +12 -32
- package/dist/utils/file-system.d.ts.map +1 -1
- package/dist/utils/file-system.js +16 -40
- package/dist/utils/file-system.js.map +1 -1
- package/dist/utils/frontmatter.d.ts +7 -11
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +11 -11
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/interactive.d.ts +4 -9
- package/dist/utils/interactive.d.ts.map +1 -1
- package/dist/utils/interactive.js +2 -4
- package/dist/utils/interactive.js.map +1 -1
- package/dist/utils/item-discovery.d.ts +15 -10
- package/dist/utils/item-discovery.d.ts.map +1 -1
- package/dist/utils/item-discovery.js +42 -47
- package/dist/utils/item-discovery.js.map +1 -1
- package/dist/utils/link.d.ts +13 -4
- package/dist/utils/link.d.ts.map +1 -1
- package/dist/utils/link.js +13 -4
- package/dist/utils/link.js.map +1 -1
- package/dist/utils/match.js.map +1 -1
- package/dist/utils/requirement-diff.d.ts +13 -23
- package/dist/utils/requirement-diff.d.ts.map +1 -1
- package/dist/utils/requirement-diff.js +13 -23
- package/dist/utils/requirement-diff.js.map +1 -1
- package/dist/utils/spec-files.d.ts +10 -11
- package/dist/utils/spec-files.d.ts.map +1 -1
- package/dist/utils/spec-files.js +31 -22
- package/dist/utils/spec-files.js.map +1 -1
- package/dist/utils/task-progress.d.ts +11 -9
- package/dist/utils/task-progress.d.ts.map +1 -1
- package/dist/utils/task-progress.js +53 -32
- package/dist/utils/task-progress.js.map +1 -1
- package/dist/utils/timestamp.d.ts +5 -8
- package/dist/utils/timestamp.d.ts.map +1 -1
- package/dist/utils/timestamp.js +5 -8
- package/dist/utils/timestamp.js.map +1 -1
- package/package.json +9 -10
- package/schemas/decision/templates/decision.md +3 -1
- package/schemas/decision/templates/index.md +2 -2
- package/schemas/issue/schema.yaml +11 -2
- package/schemas/issue/templates/spec.md +37 -3
- package/schemas/sdd/schema.yaml +24 -1
- package/schemas/sdd/templates/spec.md +37 -3
|
@@ -3,9 +3,6 @@ import * as path from 'node:path';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { getGlobalConfigDir, getLegacyDataDir } from '../global-config.js';
|
|
5
5
|
import { parseSchema, SchemaValidationError } from './schema.js';
|
|
6
|
-
/**
|
|
7
|
-
* Error thrown when loading a schema fails.
|
|
8
|
-
*/
|
|
9
6
|
export class SchemaLoadError extends Error {
|
|
10
7
|
schemaPath;
|
|
11
8
|
cause;
|
|
@@ -16,13 +13,9 @@ export class SchemaLoadError extends Error {
|
|
|
16
13
|
this.name = 'SchemaLoadError';
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Gets the package's built-in schemas directory path.
|
|
21
|
-
* Uses import.meta.url to resolve relative to the current module.
|
|
22
|
-
*/
|
|
16
|
+
/** Walks up from dist/core/artifact-graph/ to the package root's schemas/. */
|
|
23
17
|
export function getPackageSchemasDir() {
|
|
24
18
|
const currentFile = fileURLToPath(import.meta.url);
|
|
25
|
-
// Navigate from dist/core/artifact-graph/ to package root's schemas/
|
|
26
19
|
return path.join(path.dirname(currentFile), '..', '..', '..', 'schemas');
|
|
27
20
|
}
|
|
28
21
|
/**
|
|
@@ -38,27 +31,18 @@ export function getUserSchemasDir() {
|
|
|
38
31
|
}
|
|
39
32
|
/**
|
|
40
33
|
* Where overrides sit until an install migrates. Ranked below the current user
|
|
41
|
-
* directory, so a migrated copy wins and a not-yet-migrated one still applies
|
|
42
|
-
* per schema name, because every lookup walks this list name by name.
|
|
34
|
+
* directory, so a migrated copy wins and a not-yet-migrated one still applies.
|
|
43
35
|
*/
|
|
44
36
|
function getLegacySchemasDir() {
|
|
45
37
|
return path.join(getLegacyDataDir(), 'schemas');
|
|
46
38
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Gets the project-local schemas directory path.
|
|
49
|
-
* @param projectRoot - The project root directory
|
|
50
|
-
* @returns The path to the project's schemas directory
|
|
51
|
-
*/
|
|
52
39
|
export function getProjectSchemasDir(projectRoot) {
|
|
53
40
|
return path.join(projectRoot, 'tospec', 'schemas');
|
|
54
41
|
}
|
|
55
42
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* `
|
|
59
|
-
* directory has `isDirectory() === false`; such entries are dereferenced via
|
|
60
|
-
* `statSync` to admit symlinked schema dirs while still rejecting
|
|
61
|
-
* symlinks-to-files and broken/dangling links.
|
|
43
|
+
* True for real directories and for symlinks pointing at one. `Dirent`'s
|
|
44
|
+
* `isDirectory()` reports the raw entry type, so a symlinked schema dir needs
|
|
45
|
+
* the `statSync` dereference below.
|
|
62
46
|
*/
|
|
63
47
|
export function isSchemaDir(parentDir, entry) {
|
|
64
48
|
if (entry.isDirectory()) {
|
|
@@ -74,21 +58,6 @@ export function isSchemaDir(parentDir, entry) {
|
|
|
74
58
|
}
|
|
75
59
|
return false;
|
|
76
60
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Resolves a schema name to its directory path.
|
|
79
|
-
*
|
|
80
|
-
* Resolution order (when projectRoot is provided):
|
|
81
|
-
* 1. Project-local: <projectRoot>/tospec/schemas/<name>/schema.yaml
|
|
82
|
-
* 2. User override: ${XDG_DATA_HOME}/tospec/schemas/<name>/schema.yaml
|
|
83
|
-
* 3. Package built-in: <package>/schemas/<name>/schema.yaml
|
|
84
|
-
*
|
|
85
|
-
* When projectRoot is not provided, only user override and package built-in are checked
|
|
86
|
-
* (backward compatible behavior).
|
|
87
|
-
*
|
|
88
|
-
* @param name - Schema name (e.g., "sdd")
|
|
89
|
-
* @param projectRoot - Optional project root directory for project-local schema resolution
|
|
90
|
-
* @returns The path to the schema directory, or null if not found
|
|
91
|
-
*/
|
|
92
61
|
/**
|
|
93
62
|
* Identity of a file's current contents, for cache invalidation. Null when the
|
|
94
63
|
* file cannot be stat'd, which disables caching for that path rather than
|
|
@@ -105,6 +74,16 @@ export function fileStamp(filePath) {
|
|
|
105
74
|
}
|
|
106
75
|
/** Parsed schemas keyed by path, invalidated when the file's stamp changes. */
|
|
107
76
|
const schemaCache = new Map();
|
|
77
|
+
/**
|
|
78
|
+
* One wording for a schema that will not parse, so `tospec schemas` and
|
|
79
|
+
* `tospec templates --schema <name>` say the same thing about the same file.
|
|
80
|
+
*/
|
|
81
|
+
function schemaParseFailureMessage(schemaPath, error) {
|
|
82
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
83
|
+
return error instanceof SchemaValidationError
|
|
84
|
+
? `Invalid schema at '${schemaPath}': ${detail}`
|
|
85
|
+
: `Failed to parse schema at '${schemaPath}': ${detail}`;
|
|
86
|
+
}
|
|
108
87
|
/**
|
|
109
88
|
* The schema search path, **lowest precedence first** (package → user →
|
|
110
89
|
* project). Every lookup and listing walks this one list, so adding a source
|
|
@@ -113,9 +92,9 @@ const schemaCache = new Map();
|
|
|
113
92
|
function schemaSources(projectRoot) {
|
|
114
93
|
return [
|
|
115
94
|
{ dir: getPackageSchemasDir(), source: 'package' },
|
|
116
|
-
// Both report 'user'
|
|
117
|
-
// and a 'legacy' value would widen the agent-facing JSON contract
|
|
118
|
-
// something that stops existing once migration runs.
|
|
95
|
+
// Both report 'user': the legacy entry is another address for the same
|
|
96
|
+
// layer, and a 'legacy' value would widen the agent-facing JSON contract
|
|
97
|
+
// with something that stops existing once migration runs.
|
|
119
98
|
{ dir: getLegacySchemasDir(), source: 'user' },
|
|
120
99
|
{ dir: getUserSchemasDir(), source: 'user' },
|
|
121
100
|
...(projectRoot
|
|
@@ -132,51 +111,54 @@ function scanSchemaDir(dir) {
|
|
|
132
111
|
.filter((entry) => isSchemaDir(dir, entry) && fs.existsSync(path.join(dir, entry.name, 'schema.yaml')))
|
|
133
112
|
.map((entry) => entry.name);
|
|
134
113
|
}
|
|
135
|
-
|
|
114
|
+
/**
|
|
115
|
+
* The directory holding `<name>/schema.yaml` and the layer it came from, or
|
|
116
|
+
* null when no layer has one. Project-local wins over the user override, which
|
|
117
|
+
* wins over the package built-in; without `projectRoot` only the last two are
|
|
118
|
+
* searched.
|
|
119
|
+
*
|
|
120
|
+
* The layer is resolved here rather than re-derived from the path by each
|
|
121
|
+
* caller: a directory is the *whole* schema, templates included, so "which layer
|
|
122
|
+
* won" is what explains a file the winning layer does not have.
|
|
123
|
+
*/
|
|
124
|
+
export function getSchemaDirWithSource(name, projectRoot) {
|
|
136
125
|
// Highest precedence first: project overrides user overrides package.
|
|
137
|
-
for (const { dir } of schemaSources(projectRoot).reverse()) {
|
|
126
|
+
for (const { dir, source } of schemaSources(projectRoot).reverse()) {
|
|
138
127
|
const candidate = path.join(dir, name);
|
|
139
128
|
if (fs.existsSync(path.join(candidate, 'schema.yaml'))) {
|
|
140
|
-
return candidate;
|
|
129
|
+
return { dir: candidate, source };
|
|
141
130
|
}
|
|
142
131
|
}
|
|
143
132
|
return null;
|
|
144
133
|
}
|
|
134
|
+
/** As `getSchemaDirWithSource`, for callers that only need the path. */
|
|
135
|
+
export function getSchemaDir(name, projectRoot) {
|
|
136
|
+
return getSchemaDirWithSource(name, projectRoot)?.dir ?? null;
|
|
137
|
+
}
|
|
145
138
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* Resolution order (when projectRoot is provided):
|
|
149
|
-
* 1. Project-local: <projectRoot>/tospec/schemas/<name>/schema.yaml
|
|
150
|
-
* 2. User override: ${XDG_DATA_HOME}/tospec/schemas/<name>/schema.yaml
|
|
151
|
-
* 3. Package built-in: <package>/schemas/<name>/schema.yaml
|
|
139
|
+
* The parsed schema, resolved through `getSchemaDir`'s precedence order.
|
|
152
140
|
*
|
|
153
|
-
*
|
|
154
|
-
* (backward compatible behavior).
|
|
155
|
-
*
|
|
156
|
-
* @param name - Schema name (e.g., "sdd")
|
|
157
|
-
* @param projectRoot - Optional project root directory for project-local schema resolution
|
|
158
|
-
* @returns The resolved schema object
|
|
159
|
-
* @throws Error if schema is not found in any location
|
|
141
|
+
* @throws SchemaLoadError when the file cannot be read or does not parse.
|
|
160
142
|
*/
|
|
161
143
|
export function resolveSchema(name, projectRoot) {
|
|
162
|
-
// Normalize name (remove .yaml extension if provided)
|
|
163
144
|
const normalizedName = name.replace(/\.ya?ml$/, '');
|
|
164
145
|
const schemaDir = getSchemaDir(normalizedName, projectRoot);
|
|
165
146
|
if (!schemaDir) {
|
|
166
|
-
|
|
147
|
+
// Loadable, not merely present: a name whose schema.yaml does not parse is
|
|
148
|
+
// a choice that cannot work.
|
|
149
|
+
const availableSchemas = listLoadableSchemas(projectRoot);
|
|
167
150
|
throw new Error(`Schema '${normalizedName}' not found. Available schemas: ${availableSchemas.join(', ')}`);
|
|
168
151
|
}
|
|
169
152
|
const schemaPath = path.join(schemaDir, 'schema.yaml');
|
|
170
|
-
// A
|
|
171
|
-
//
|
|
172
|
-
// dominates
|
|
153
|
+
// A status/list run resolves the same schema once per change and the dashboard
|
|
154
|
+
// re-resolves on every refresh, where the yaml + Zod + cycle-check parse
|
|
155
|
+
// dominates. One statSync decides whether it can be skipped.
|
|
173
156
|
const stamp = fileStamp(schemaPath);
|
|
174
157
|
const cached = stamp === null ? undefined : schemaCache.get(schemaPath);
|
|
175
158
|
if (cached && cached.stamp === stamp) {
|
|
176
159
|
// Cloned so a caller mutating its schema cannot corrupt later resolutions.
|
|
177
160
|
return structuredClone(cached.schema);
|
|
178
161
|
}
|
|
179
|
-
// Load and parse the schema
|
|
180
162
|
let content;
|
|
181
163
|
try {
|
|
182
164
|
content = fs.readFileSync(schemaPath, 'utf-8');
|
|
@@ -193,19 +175,11 @@ export function resolveSchema(name, projectRoot) {
|
|
|
193
175
|
return schema;
|
|
194
176
|
}
|
|
195
177
|
catch (err) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
const parseError = err instanceof Error ? err : new Error(String(err));
|
|
200
|
-
throw new SchemaLoadError(`Failed to parse schema at '${schemaPath}': ${parseError.message}`, schemaPath, parseError);
|
|
178
|
+
const cause = err instanceof Error ? err : new Error(String(err));
|
|
179
|
+
throw new SchemaLoadError(schemaParseFailureMessage(schemaPath, err), schemaPath, cause);
|
|
201
180
|
}
|
|
202
181
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Lists all available schema names.
|
|
205
|
-
* Combines project-local, user override, and package built-in schemas.
|
|
206
|
-
*
|
|
207
|
-
* @param projectRoot - Optional project root directory for project-local schema resolution
|
|
208
|
-
*/
|
|
182
|
+
/** Every schema name on disk across all three layers. */
|
|
209
183
|
export function listSchemas(projectRoot) {
|
|
210
184
|
const schemas = new Set();
|
|
211
185
|
for (const { dir } of schemaSources(projectRoot)) {
|
|
@@ -216,17 +190,33 @@ export function listSchemas(projectRoot) {
|
|
|
216
190
|
return Array.from(schemas).sort();
|
|
217
191
|
}
|
|
218
192
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
193
|
+
* Names of the schemas that actually load — what an "Available schemas:" list
|
|
194
|
+
* has to mean. `listSchemas` reports directory names, so a schema.yaml with a
|
|
195
|
+
* typo in it would be offered as a choice. Anything phrased as advice to the
|
|
196
|
+
* user belongs here.
|
|
197
|
+
*/
|
|
198
|
+
export function listLoadableSchemas(projectRoot) {
|
|
199
|
+
return listSchemasWithInfo(projectRoot)
|
|
200
|
+
.filter((schema) => schema.error === undefined)
|
|
201
|
+
.map((schema) => schema.name);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Every schema with its description and artifact list, for agent skills that
|
|
205
|
+
* present a schema choice.
|
|
221
206
|
*
|
|
222
|
-
*
|
|
207
|
+
* A schema that fails to parse is reported with `error` set, but only when no
|
|
208
|
+
* lower-precedence layer supplies a working schema of that name — a broken
|
|
209
|
+
* project override must not hide the package schema it shadows.
|
|
223
210
|
*/
|
|
224
211
|
export function listSchemasWithInfo(projectRoot) {
|
|
225
212
|
const schemas = [];
|
|
226
213
|
const seenNames = new Set();
|
|
214
|
+
// Keyed by name so the highest-precedence failure is the one reported, and a
|
|
215
|
+
// later success removes it.
|
|
216
|
+
const broken = new Map();
|
|
227
217
|
// Highest precedence first, so an overridden schema is skipped rather than
|
|
228
|
-
// replaced. A schema that fails to parse is not marked seen — the next
|
|
229
|
-
//
|
|
218
|
+
// replaced. A schema that fails to parse is not marked seen — the next source
|
|
219
|
+
// down still gets a chance to supply it.
|
|
230
220
|
for (const { dir, source } of schemaSources(projectRoot).reverse()) {
|
|
231
221
|
for (const name of scanSchemaDir(dir)) {
|
|
232
222
|
if (seenNames.has(name))
|
|
@@ -241,24 +231,33 @@ export function listSchemasWithInfo(projectRoot) {
|
|
|
241
231
|
path: path.join(dir, name),
|
|
242
232
|
});
|
|
243
233
|
seenNames.add(name);
|
|
234
|
+
broken.delete(name);
|
|
244
235
|
}
|
|
245
|
-
catch {
|
|
246
|
-
|
|
236
|
+
catch (error) {
|
|
237
|
+
if (broken.has(name))
|
|
238
|
+
continue;
|
|
239
|
+
broken.set(name, {
|
|
240
|
+
name,
|
|
241
|
+
description: '',
|
|
242
|
+
artifacts: [],
|
|
243
|
+
source,
|
|
244
|
+
path: path.join(dir, name),
|
|
245
|
+
error: schemaParseFailureMessage(path.join(dir, name, 'schema.yaml'), error),
|
|
246
|
+
});
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
return schemas.sort((a, b) => a.name.localeCompare(b.name));
|
|
250
|
+
return [...schemas, ...broken.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
253
253
|
* Union of every artifact ID across every available schema.
|
|
254
254
|
*
|
|
255
|
-
* Config keys
|
|
256
|
-
* legitimately name an artifact from any schema, so they
|
|
257
|
-
*
|
|
255
|
+
* Config keys scoped per-artifact but stored globally (`rules:`) can
|
|
256
|
+
* legitimately name an artifact from any schema, so they are checked against the
|
|
257
|
+
* union rather than the current change's schema.
|
|
258
258
|
*
|
|
259
|
-
* Built on listSchemasWithInfo
|
|
260
|
-
*
|
|
261
|
-
* custom schema must not turn every rules key into an unknown ID.
|
|
259
|
+
* Built on listSchemasWithInfo to inherit its tolerance for a schema that fails
|
|
260
|
+
* to parse: one broken custom schema must not turn every rules key unknown.
|
|
262
261
|
*/
|
|
263
262
|
export function collectAllArtifactIds(projectRoot) {
|
|
264
263
|
return new Set(listSchemasWithInfo(projectRoot).flatMap((schema) => schema.artifacts));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../src/core/artifact-graph/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGjE
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../src/core/artifact-graph/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,K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message: string);
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* Loads and validates an artifact schema from a YAML file.
|
|
7
|
-
*/
|
|
8
5
|
export declare function loadSchema(filePath: string): SchemaYaml;
|
|
9
|
-
/**
|
|
10
|
-
* Parses and validates an artifact schema from YAML content.
|
|
11
|
-
*/
|
|
12
6
|
export declare function parseSchema(yamlContent: string): SchemaYaml;
|
|
13
7
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/core/artifact-graph/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,UAAU,EAAiB,MAAM,YAAY,CAAC;AAE9E,qBAAa,qBAAsB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/core/artifact-graph/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,UAAU,EAAiB,MAAM,YAAY,CAAC;AAE9E,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAEvD;AAED,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAmB3D"}
|
|
@@ -7,44 +7,29 @@ export class SchemaValidationError extends Error {
|
|
|
7
7
|
this.name = 'SchemaValidationError';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Loads and validates an artifact schema from a YAML file.
|
|
12
|
-
*/
|
|
13
10
|
export function loadSchema(filePath) {
|
|
14
|
-
|
|
15
|
-
return parseSchema(content);
|
|
11
|
+
return parseSchema(fs.readFileSync(filePath, 'utf-8'));
|
|
16
12
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Parses and validates an artifact schema from YAML content.
|
|
19
|
-
*/
|
|
20
13
|
export function parseSchema(yamlContent) {
|
|
21
14
|
const parsed = parseYaml(yamlContent);
|
|
22
|
-
// Validate with Zod
|
|
23
15
|
const result = SchemaYamlSchema.safeParse(parsed);
|
|
24
16
|
if (!result.success) {
|
|
25
17
|
const errors = result.error.issues.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');
|
|
26
18
|
throw new SchemaValidationError(`Invalid schema: ${errors}`);
|
|
27
19
|
}
|
|
28
20
|
const schema = result.data;
|
|
29
|
-
// Check for duplicate artifact IDs
|
|
30
21
|
validateNoDuplicateIds(schema.artifacts);
|
|
31
|
-
// Check that all requires references are valid
|
|
32
22
|
validateRequiresReferences(schema.artifacts);
|
|
33
|
-
// Check for cycles
|
|
34
23
|
validateNoCycles(schema.artifacts);
|
|
35
|
-
// apply.requires names artifacts too,
|
|
36
|
-
//
|
|
37
|
-
// applyRequires: ["ghost"], sending agents to look for an artifact the schema
|
|
38
|
-
// never defines.
|
|
24
|
+
// apply.requires names artifacts too: unchecked, an unknown id reaches
|
|
25
|
+
// `status --json` verbatim as applyRequires: ["ghost"].
|
|
39
26
|
validateApplyReferences(schema);
|
|
40
27
|
return schema;
|
|
41
28
|
}
|
|
42
29
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* directory, not an artifact id, and that file legitimately does not exist until
|
|
47
|
-
* the change is scaffolded.
|
|
30
|
+
* `tracks` is not checked alongside `requires`: it names a file inside the
|
|
31
|
+
* change directory, not an artifact id, and that file legitimately does not
|
|
32
|
+
* exist until the change is scaffolded.
|
|
48
33
|
*/
|
|
49
34
|
function validateApplyReferences(schema) {
|
|
50
35
|
if (!schema.apply)
|
|
@@ -56,9 +41,6 @@ function validateApplyReferences(schema) {
|
|
|
56
41
|
}
|
|
57
42
|
}
|
|
58
43
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Validates that there are no duplicate artifact IDs.
|
|
61
|
-
*/
|
|
62
44
|
function validateNoDuplicateIds(artifacts) {
|
|
63
45
|
const seen = new Set();
|
|
64
46
|
for (const artifact of artifacts) {
|
|
@@ -68,9 +50,6 @@ function validateNoDuplicateIds(artifacts) {
|
|
|
68
50
|
seen.add(artifact.id);
|
|
69
51
|
}
|
|
70
52
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Validates that all `requires` references point to valid artifact IDs.
|
|
73
|
-
*/
|
|
74
53
|
function validateRequiresReferences(artifacts) {
|
|
75
54
|
const validIds = new Set(artifacts.map(a => a.id));
|
|
76
55
|
for (const artifact of artifacts) {
|
|
@@ -81,10 +60,7 @@ function validateRequiresReferences(artifacts) {
|
|
|
81
60
|
}
|
|
82
61
|
}
|
|
83
62
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Validates that there are no cyclic dependencies.
|
|
86
|
-
* Uses DFS to detect cycles and reports the full cycle path.
|
|
87
|
-
*/
|
|
63
|
+
/** DFS cycle detection; the thrown message names the full cycle path. */
|
|
88
64
|
function validateNoCycles(artifacts) {
|
|
89
65
|
const artifactMap = new Map(artifacts.map(a => [a.id, a]));
|
|
90
66
|
const visited = new Set();
|
|
@@ -104,7 +80,6 @@ function validateNoCycles(artifacts) {
|
|
|
104
80
|
return cycle;
|
|
105
81
|
}
|
|
106
82
|
else if (inStack.has(dep)) {
|
|
107
|
-
// Found a cycle - reconstruct the path
|
|
108
83
|
const cyclePath = [dep];
|
|
109
84
|
let current = id;
|
|
110
85
|
while (current !== dep) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/core/artifact-graph/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAkC,MAAM,YAAY,CAAC;AAE9E,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,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AC;gBAC5B,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;gBACxB,IAAI,OAAO,GAAG,EAAE,CAAC;gBACjB,OAAO,OAAO,KAAK,GAAG,EAAE,CAAC;oBACvB,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;oBAC3B,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC;gBACjC,CAAC;gBACD,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACvB,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC/B,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,IAAI,qBAAqB,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import type { CompletedSet } from './types.js';
|
|
2
2
|
import type { ArtifactGraph } from './graph.js';
|
|
3
|
-
/**
|
|
4
|
-
* Detects which artifacts are completed by checking file existence in the change directory.
|
|
5
|
-
* Returns a Set of completed artifact IDs.
|
|
6
|
-
*
|
|
7
|
-
* @param graph - The artifact graph to check
|
|
8
|
-
* @param changeDir - The change directory to scan for files
|
|
9
|
-
* @returns Set of artifact IDs whose generated files exist
|
|
10
|
-
*/
|
|
3
|
+
/** Artifact IDs whose `generates` output (path or glob) exists on disk. */
|
|
11
4
|
export declare function detectCompleted(graph: ArtifactGraph, changeDir: string): CompletedSet;
|
|
12
5
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/artifact-graph/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/artifact-graph/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,CAarF"}
|
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import { artifactOutputExists } from './outputs.js';
|
|
3
|
-
/**
|
|
4
|
-
* Detects which artifacts are completed by checking file existence in the change directory.
|
|
5
|
-
* Returns a Set of completed artifact IDs.
|
|
6
|
-
*
|
|
7
|
-
* @param graph - The artifact graph to check
|
|
8
|
-
* @param changeDir - The change directory to scan for files
|
|
9
|
-
* @returns Set of artifact IDs whose generated files exist
|
|
10
|
-
*/
|
|
3
|
+
/** Artifact IDs whose `generates` output (path or glob) exists on disk. */
|
|
11
4
|
export function detectCompleted(graph, changeDir) {
|
|
12
5
|
const completed = new Set();
|
|
13
|
-
// Handle missing change directory gracefully
|
|
14
6
|
if (!fs.existsSync(changeDir)) {
|
|
15
7
|
return completed;
|
|
16
8
|
}
|
|
17
9
|
for (const artifact of graph.getAllArtifacts()) {
|
|
18
|
-
if (
|
|
10
|
+
if (artifactOutputExists(changeDir, artifact.generates)) {
|
|
19
11
|
completed.add(artifact.id);
|
|
20
12
|
}
|
|
21
13
|
}
|
|
22
14
|
return completed;
|
|
23
15
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Checks if an artifact is complete by checking if its generated file(s) exist.
|
|
26
|
-
* Supports both simple paths and glob patterns.
|
|
27
|
-
*/
|
|
28
|
-
function isArtifactComplete(generates, changeDir) {
|
|
29
|
-
return artifactOutputExists(changeDir, generates);
|
|
30
|
-
}
|
|
31
16
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/core/artifact-graph/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/core/artifact-graph/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,KAAoB,EAAE,SAAiB;IACrE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC;QAC/C,IAAI,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACxD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one definition of "this artifact file is still the template": empty,
|
|
3
|
+
* whitespace-only, or byte-identical to it.
|
|
4
|
+
*
|
|
5
|
+
* Shared by `status` and `validate`, which must agree: a change of verbatim
|
|
6
|
+
* templates would otherwise pass the last gate before archive.
|
|
7
|
+
*
|
|
8
|
+
* Cheap on purpose. A deeper "headings replaced, placeholders left" analysis
|
|
9
|
+
* belongs to the section rules in `validation/section-validator.ts`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isStubArtifactFile(file: string, schemaName: string, templatePath: string, projectRoot: string): boolean;
|
|
12
|
+
//# sourceMappingURL=stub-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-detection.d.ts","sourceRoot":"","sources":["../../../src/core/artifact-graph/stub-detection.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAClB,OAAO,CAqBT"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import { stripBom } from '../parsers/requirement-text.js';
|
|
3
|
+
import { loadTemplate } from './instruction-loader.js';
|
|
4
|
+
/**
|
|
5
|
+
* The one definition of "this artifact file is still the template": empty,
|
|
6
|
+
* whitespace-only, or byte-identical to it.
|
|
7
|
+
*
|
|
8
|
+
* Shared by `status` and `validate`, which must agree: a change of verbatim
|
|
9
|
+
* templates would otherwise pass the last gate before archive.
|
|
10
|
+
*
|
|
11
|
+
* Cheap on purpose. A deeper "headings replaced, placeholders left" analysis
|
|
12
|
+
* belongs to the section rules in `validation/section-validator.ts`.
|
|
13
|
+
*/
|
|
14
|
+
export function isStubArtifactFile(file, schemaName, templatePath, projectRoot) {
|
|
15
|
+
let content;
|
|
16
|
+
try {
|
|
17
|
+
content = fs.readFileSync(file, 'utf-8');
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Unreadable is not stub: callers report the read failure on its own terms.
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (content.trim().length === 0)
|
|
24
|
+
return true;
|
|
25
|
+
let template;
|
|
26
|
+
try {
|
|
27
|
+
template = loadTemplate(schemaName, templatePath, projectRoot);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// No template to compare against — say nothing rather than guess.
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// Compared BOM-free: this is a byte-identity test, so opening the untouched
|
|
34
|
+
// template in a Windows editor and saving it would otherwise make a verbatim
|
|
35
|
+
// stub look edited — inverting the gate, which exists to stop exactly that
|
|
36
|
+
// file reaching archive. The template ships from the package and never has one.
|
|
37
|
+
return stripBom(content) === template;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=stub-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-detection.js","sourceRoot":"","sources":["../../../src/core/artifact-graph/stub-detection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,UAAkB,EAClB,YAAoB,EACpB,WAAmB;IAEnB,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,4EAA4E;QAC5E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,YAAY,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,kEAAkE;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,4EAA4E;IAC5E,6EAA6E;IAC7E,2EAA2E;IAC3E,gFAAgF;IAChF,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;AACxC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const ArtifactValidationSchema: z.ZodObject<{
|
|
3
3
|
requiredSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
4
4
|
minSectionLength: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
5
|
+
maxSectionLength: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
5
6
|
}, z.core.$strip>;
|
|
6
7
|
export declare const ArtifactSchema: z.ZodObject<{
|
|
7
8
|
id: z.ZodString;
|
|
@@ -14,6 +15,7 @@ export declare const ArtifactSchema: z.ZodObject<{
|
|
|
14
15
|
validation: z.ZodOptional<z.ZodObject<{
|
|
15
16
|
requiredSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
16
17
|
minSectionLength: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
18
|
+
maxSectionLength: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
17
19
|
}, z.core.$strip>>;
|
|
18
20
|
}, z.core.$strip>;
|
|
19
21
|
export declare const ApplyPhaseSchema: z.ZodObject<{
|
|
@@ -36,6 +38,7 @@ export declare const SchemaYamlSchema: z.ZodObject<{
|
|
|
36
38
|
validation: z.ZodOptional<z.ZodObject<{
|
|
37
39
|
requiredSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
38
40
|
minSectionLength: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
41
|
+
maxSectionLength: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
39
42
|
}, z.core.$strip>>;
|
|
40
43
|
}, z.core.$strip>>;
|
|
41
44
|
apply: z.ZodOptional<z.ZodObject<{
|
|
@@ -48,6 +51,7 @@ export type Artifact = z.infer<typeof ArtifactSchema>;
|
|
|
48
51
|
export type ArtifactValidation = z.infer<typeof ArtifactValidationSchema>;
|
|
49
52
|
export type ApplyPhase = z.infer<typeof ApplyPhaseSchema>;
|
|
50
53
|
export type SchemaYaml = z.infer<typeof SchemaYamlSchema>;
|
|
54
|
+
/** Artifact ids whose output files exist. */
|
|
51
55
|
export type CompletedSet = Set<string>;
|
|
52
56
|
export interface BlockedArtifacts {
|
|
53
57
|
[artifactId: string]: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/artifact-graph/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/artifact-graph/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,wBAAwB;;;;iBAMnC,CAAC;AA4BH,eAAO,MAAM,cAAc;;;;;;;;;;;;;iBASzB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;iBAM3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;iBAM3B,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,6CAA6C;AAC7C,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAChC"}
|