@seanmars/tospec 0.19.0-beta.8 → 0.20.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/CHANGELOG.md +60 -310
- package/README.md +69 -82
- package/assets/dashboard/app.js +11 -0
- package/assets/dashboard/style.css +7 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +89 -106
- 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 +293 -145
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/dashboard.d.ts +57 -99
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +190 -313
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/decision.d.ts +38 -27
- package/dist/commands/decision.d.ts.map +1 -1
- package/dist/commands/decision.js +296 -128
- package/dist/commands/decision.js.map +1 -1
- package/dist/commands/metrics.d.ts +28 -51
- package/dist/commands/metrics.d.ts.map +1 -1
- package/dist/commands/metrics.js +62 -93
- package/dist/commands/metrics.js.map +1 -1
- package/dist/commands/shared-output.d.ts +12 -27
- package/dist/commands/shared-output.d.ts.map +1 -1
- package/dist/commands/shared-output.js +22 -45
- package/dist/commands/shared-output.js.map +1 -1
- package/dist/commands/show.d.ts +4 -7
- package/dist/commands/show.d.ts.map +1 -1
- package/dist/commands/show.js +23 -11
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/validate.d.ts +34 -58
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +225 -141
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/workflow/index.d.ts +1 -5
- package/dist/commands/workflow/index.d.ts.map +1 -1
- package/dist/commands/workflow/index.js +1 -5
- package/dist/commands/workflow/index.js.map +1 -1
- package/dist/commands/workflow/instructions.d.ts +14 -24
- package/dist/commands/workflow/instructions.d.ts.map +1 -1
- package/dist/commands/workflow/instructions.js +219 -128
- package/dist/commands/workflow/instructions.js.map +1 -1
- package/dist/commands/workflow/new-change.d.ts +2 -5
- package/dist/commands/workflow/new-change.d.ts.map +1 -1
- package/dist/commands/workflow/new-change.js +69 -32
- package/dist/commands/workflow/new-change.js.map +1 -1
- package/dist/commands/workflow/schemas.d.ts +1 -5
- package/dist/commands/workflow/schemas.d.ts.map +1 -1
- package/dist/commands/workflow/schemas.js +6 -17
- package/dist/commands/workflow/schemas.js.map +1 -1
- package/dist/commands/workflow/shared.d.ts +37 -42
- package/dist/commands/workflow/shared.d.ts.map +1 -1
- package/dist/commands/workflow/shared.js +23 -54
- package/dist/commands/workflow/shared.js.map +1 -1
- package/dist/commands/workflow/status.d.ts +7 -17
- package/dist/commands/workflow/status.d.ts.map +1 -1
- package/dist/commands/workflow/status.js +57 -72
- package/dist/commands/workflow/status.js.map +1 -1
- package/dist/commands/workflow/templates.d.ts +8 -8
- package/dist/commands/workflow/templates.d.ts.map +1 -1
- package/dist/commands/workflow/templates.js +32 -46
- package/dist/commands/workflow/templates.js.map +1 -1
- package/dist/core/archive.d.ts +22 -31
- package/dist/core/archive.d.ts.map +1 -1
- package/dist/core/archive.js +296 -283
- package/dist/core/archive.js.map +1 -1
- package/dist/core/artifact-graph/graph.d.ts +25 -42
- package/dist/core/artifact-graph/graph.d.ts.map +1 -1
- package/dist/core/artifact-graph/graph.js +45 -63
- package/dist/core/artifact-graph/graph.js.map +1 -1
- package/dist/core/artifact-graph/index.d.ts +1 -1
- package/dist/core/artifact-graph/index.d.ts.map +1 -1
- package/dist/core/artifact-graph/index.js +1 -1
- package/dist/core/artifact-graph/index.js.map +1 -1
- package/dist/core/artifact-graph/instruction-loader.d.ts +54 -120
- package/dist/core/artifact-graph/instruction-loader.d.ts.map +1 -1
- package/dist/core/artifact-graph/instruction-loader.js +129 -111
- package/dist/core/artifact-graph/instruction-loader.js.map +1 -1
- package/dist/core/artifact-graph/outputs.d.ts +9 -23
- package/dist/core/artifact-graph/outputs.d.ts.map +1 -1
- package/dist/core/artifact-graph/outputs.js +45 -38
- package/dist/core/artifact-graph/outputs.js.map +1 -1
- package/dist/core/artifact-graph/resolver.d.ts +36 -81
- package/dist/core/artifact-graph/resolver.d.ts.map +1 -1
- package/dist/core/artifact-graph/resolver.js +60 -101
- 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 +6 -14
- package/dist/core/artifact-graph/stub-detection.d.ts.map +1 -1
- package/dist/core/artifact-graph/stub-detection.js +13 -16
- package/dist/core/artifact-graph/stub-detection.js.map +1 -1
- 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 +16 -27
- package/dist/core/change-presenter.d.ts.map +1 -1
- package/dist/core/change-presenter.js +53 -53
- package/dist/core/change-presenter.js.map +1 -1
- package/dist/core/change-status-policy.d.ts +4 -8
- package/dist/core/change-status-policy.d.ts.map +1 -1
- package/dist/core/change-status-policy.js +9 -17
- 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 +14 -15
- package/dist/core/codex-residue.d.ts.map +1 -1
- package/dist/core/codex-residue.js +18 -22
- package/dist/core/codex-residue.js.map +1 -1
- 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 +7 -41
- package/dist/core/config-schema.d.ts.map +1 -1
- package/dist/core/config-schema.js +35 -74
- package/dist/core/config-schema.js.map +1 -1
- package/dist/core/config.d.ts +25 -49
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +22 -45
- package/dist/core/config.js.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 +35 -22
- package/dist/core/dashboard-data.d.ts.map +1 -1
- package/dist/core/dashboard-data.js +57 -72
- 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 +38 -67
- package/dist/core/global-config.js.map +1 -1
- package/dist/core/init.d.ts +12 -28
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +90 -168
- package/dist/core/init.js.map +1 -1
- package/dist/core/list.d.ts.map +1 -1
- package/dist/core/list.js +80 -38
- package/dist/core/list.js.map +1 -1
- package/dist/core/local-server.d.ts +41 -83
- package/dist/core/local-server.d.ts.map +1 -1
- package/dist/core/local-server.js +53 -98
- package/dist/core/local-server.js.map +1 -1
- package/dist/core/markdown-render.d.ts +15 -23
- package/dist/core/markdown-render.d.ts.map +1 -1
- package/dist/core/markdown-render.js +25 -34
- package/dist/core/markdown-render.js.map +1 -1
- package/dist/core/migrate.d.ts +19 -16
- package/dist/core/migrate.d.ts.map +1 -1
- package/dist/core/migrate.js +151 -135
- 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 +23 -30
- package/dist/core/parsers/markdown-parser.js.map +1 -1
- package/dist/core/parsers/requirement-blocks.d.ts +43 -15
- package/dist/core/parsers/requirement-blocks.d.ts.map +1 -1
- package/dist/core/parsers/requirement-blocks.js +142 -70
- 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.map +1 -1
- package/dist/core/parsers/spec-structure.js +10 -6
- package/dist/core/parsers/spec-structure.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 +9 -17
- 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 +8 -14
- package/dist/core/root-selection.d.ts.map +1 -1
- package/dist/core/root-selection.js +3 -6
- package/dist/core/root-selection.js.map +1 -1
- package/dist/core/rules.d.ts.map +1 -1
- package/dist/core/rules.js +2 -3
- package/dist/core/rules.js.map +1 -1
- 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.map +1 -1
- package/dist/core/schemas/base.schema.js +6 -12
- package/dist/core/schemas/base.schema.js.map +1 -1
- package/dist/core/schemas/change.schema.d.ts +8 -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/shared/index.d.ts +2 -7
- package/dist/core/shared/index.d.ts.map +1 -1
- package/dist/core/shared/index.js +2 -7
- package/dist/core/shared/index.js.map +1 -1
- package/dist/core/shared/rules-generation.d.ts +5 -15
- package/dist/core/shared/rules-generation.d.ts.map +1 -1
- package/dist/core/shared/rules-generation.js +33 -37
- package/dist/core/shared/rules-generation.js.map +1 -1
- package/dist/core/shared/skill-generation.d.ts +28 -43
- 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 +35 -76
- package/dist/core/shared/tool-detection.d.ts.map +1 -1
- package/dist/core/shared/tool-detection.js +73 -93
- 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 +5 -10
- package/dist/core/spec-presenter.js.map +1 -1
- package/dist/core/specs-apply.d.ts +16 -31
- package/dist/core/specs-apply.d.ts.map +1 -1
- package/dist/core/specs-apply.js +146 -195
- 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/validate.d.ts +13 -0
- package/dist/core/templates/fragments/validate.d.ts.map +1 -0
- package/dist/core/templates/fragments/validate.js +13 -0
- package/dist/core/templates/fragments/validate.js.map +1 -0
- 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 +11 -13
- 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 +16 -5
- package/dist/core/templates/workflows/archive.js.map +1 -1
- package/dist/core/templates/workflows/decision.js +3 -3
- 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 -2
- 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 +2 -2
- 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 +4 -3
- 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 +9 -2
- package/dist/core/templates/workflows/update.js.map +1 -1
- package/dist/core/update.d.ts +10 -36
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +59 -126
- 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 +4 -10
- package/dist/core/validation/constants.d.ts.map +1 -1
- package/dist/core/validation/constants.js +25 -25
- 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 +30 -12
- 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 +42 -68
- package/dist/core/validation/validator.d.ts.map +1 -1
- package/dist/core/validation/validator.js +468 -285
- 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 +24 -76
- package/dist/utils/change-utils.d.ts.map +1 -1
- package/dist/utils/change-utils.js +95 -142
- 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 +10 -20
- package/dist/utils/item-discovery.d.ts.map +1 -1
- package/dist/utils/item-discovery.js +31 -55
- package/dist/utils/item-discovery.js.map +1 -1
- package/dist/utils/link.d.ts +9 -18
- package/dist/utils/link.d.ts.map +1 -1
- package/dist/utils/link.js +9 -18
- package/dist/utils/link.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 +7 -20
- package/dist/utils/spec-files.d.ts.map +1 -1
- package/dist/utils/spec-files.js +26 -51
- 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 +2 -3
- package/schemas/issue/schema.yaml +8 -1
- package/schemas/issue/templates/spec.md +20 -3
- package/schemas/sdd/schema.yaml +20 -1
- package/schemas/sdd/templates/spec.md +20 -3
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Types and Utilities for Artifact Workflow Commands
|
|
3
|
-
*
|
|
4
|
-
* This module contains types, constants, and validation helpers used across
|
|
5
|
-
* multiple artifact workflow commands.
|
|
6
|
-
*/
|
|
1
|
+
/** Types, constants and validation helpers shared by the workflow commands. */
|
|
7
2
|
import path from 'path';
|
|
8
3
|
import * as fs from 'fs';
|
|
9
4
|
import { getSchemaDir, listLoadableSchemas, resolveSchema } from '../../core/artifact-graph/index.js';
|
|
10
5
|
import { validateChangeName } from '../../utils/change-utils.js';
|
|
11
|
-
import { DECISION_SCHEMA_NAME } from '
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
export const DEFAULT_SCHEMA = 'sdd';
|
|
16
|
-
// -----------------------------------------------------------------------------
|
|
17
|
-
// Utility Functions
|
|
18
|
-
// -----------------------------------------------------------------------------
|
|
19
|
-
/**
|
|
20
|
-
* Gets the status indicator for an artifact.
|
|
21
|
-
*/
|
|
6
|
+
import { DECISION_SCHEMA_NAME, DEFAULT_SCHEMA } from '../../core/schema-names.js';
|
|
7
|
+
// Defined in core/schema-names so this module and decision.ts share it without
|
|
8
|
+
// importing each other; re-exported because the workflow barrel publishes it.
|
|
9
|
+
export { DEFAULT_SCHEMA };
|
|
22
10
|
export function getStatusIndicator(status) {
|
|
23
11
|
switch (status) {
|
|
24
12
|
case 'done':
|
|
@@ -27,9 +15,8 @@ export function getStatusIndicator(status) {
|
|
|
27
15
|
return '[ ]';
|
|
28
16
|
case 'blocked':
|
|
29
17
|
return '[-]';
|
|
30
|
-
// Both mean "not written and not required"
|
|
31
|
-
//
|
|
32
|
-
// which (see status.ts).
|
|
18
|
+
// Both mean "not written and not required" and call for the same next move,
|
|
19
|
+
// so they share a marker; the label beside it says which.
|
|
33
20
|
case 'skipped':
|
|
34
21
|
case 'optional':
|
|
35
22
|
return '[~]';
|
|
@@ -37,14 +24,10 @@ export function getStatusIndicator(status) {
|
|
|
37
24
|
return '[!]';
|
|
38
25
|
}
|
|
39
26
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Returns the list of available change directory names under tospec/changes/.
|
|
42
|
-
* Excludes the archive directory and hidden directories.
|
|
43
|
-
*/
|
|
27
|
+
/** Change directory names under `tospec/changes/`, minus `archive` and dotdirs. */
|
|
44
28
|
export async function getAvailableChanges(projectRoot, changesDir = path.join(projectRoot, 'tospec', 'changes')) {
|
|
45
|
-
const changesPath = changesDir;
|
|
46
29
|
try {
|
|
47
|
-
const entries = await fs.promises.readdir(
|
|
30
|
+
const entries = await fs.promises.readdir(changesDir, { withFileTypes: true });
|
|
48
31
|
return entries
|
|
49
32
|
.filter((e) => e.isDirectory() && e.name !== 'archive' && !e.name.startsWith('.'))
|
|
50
33
|
.map((e) => e.name);
|
|
@@ -56,11 +39,12 @@ export async function getAvailableChanges(projectRoot, changesDir = path.join(pr
|
|
|
56
39
|
}
|
|
57
40
|
}
|
|
58
41
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
42
|
+
* Resolves a change name, listing what is available when it does not exist.
|
|
43
|
+
* Tests the directory rather than an artifact, so a scaffolded change (no
|
|
44
|
+
* proposal.md yet) still counts.
|
|
61
45
|
*/
|
|
62
46
|
export async function validateChangeExists(changeName, projectRoot, changesDir = path.join(projectRoot, 'tospec', 'changes'), hints = {}) {
|
|
63
|
-
// Hints must stay pasteable:
|
|
47
|
+
// Hints must stay pasteable: a caller with a selected store passes a
|
|
64
48
|
// store-carrying hint so following it lands in the same root.
|
|
65
49
|
const newChangeHint = hints.newChangeHint ?? 'tospec new change <name>';
|
|
66
50
|
if (!changeName) {
|
|
@@ -70,12 +54,11 @@ export async function validateChangeExists(changeName, projectRoot, changesDir =
|
|
|
70
54
|
}
|
|
71
55
|
throw new Error(`Missing required option --change. Available changes:\n ${available.join('\n ')}`);
|
|
72
56
|
}
|
|
73
|
-
//
|
|
57
|
+
// Name format first: this value is about to be joined onto a directory.
|
|
74
58
|
const nameValidation = validateChangeName(changeName);
|
|
75
59
|
if (!nameValidation.valid) {
|
|
76
60
|
throw new Error(`Invalid change name '${changeName}': ${nameValidation.error}`);
|
|
77
61
|
}
|
|
78
|
-
// Check directory existence directly
|
|
79
62
|
const changePath = path.join(changesDir, changeName);
|
|
80
63
|
const exists = fs.existsSync(changePath) && fs.statSync(changePath).isDirectory();
|
|
81
64
|
if (!exists) {
|
|
@@ -88,22 +71,14 @@ export async function validateChangeExists(changeName, projectRoot, changesDir =
|
|
|
88
71
|
return changeName;
|
|
89
72
|
}
|
|
90
73
|
/**
|
|
91
|
-
* Validates that a schema is usable, not merely present on disk.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* `new change --schema <name>` succeeded against a schema.yaml that does not
|
|
95
|
-
* parse and left behind a change nothing could read — no `type` in its
|
|
96
|
-
* metadata, no ticket, and every later command failing on it. Resolving the
|
|
97
|
-
* schema here turns that into the precise message `templates --schema <name>`
|
|
98
|
-
* was already giving, before anything is written.
|
|
99
|
-
*
|
|
100
|
-
* @param schemaName - The schema name to validate
|
|
101
|
-
* @param projectRoot - Optional project root for project-local schema resolution
|
|
74
|
+
* Validates that a schema is usable, not merely present on disk. A directory
|
|
75
|
+
* check alone lets `new change --schema <name>` succeed against a schema.yaml
|
|
76
|
+
* that does not parse, leaving a change nothing can read.
|
|
102
77
|
*/
|
|
103
78
|
export function validateSchemaExists(schemaName, projectRoot) {
|
|
104
79
|
const schemaDir = getSchemaDir(schemaName, projectRoot);
|
|
105
80
|
if (!schemaDir) {
|
|
106
|
-
// Loadable, not merely present, so the list is
|
|
81
|
+
// Loadable, not merely present, so the list is advice that works.
|
|
107
82
|
const availableSchemas = listLoadableSchemas(projectRoot);
|
|
108
83
|
throw new Error(`Schema '${schemaName}' not found. Available schemas:\n ${availableSchemas.join('\n ')}`);
|
|
109
84
|
}
|
|
@@ -111,18 +86,12 @@ export function validateSchemaExists(schemaName, projectRoot) {
|
|
|
111
86
|
return schemaName;
|
|
112
87
|
}
|
|
113
88
|
/**
|
|
114
|
-
* Refuses the decision schema for commands that operate on a change
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* `tospec/decisions/`. Pointed at a change it produces something no command can
|
|
118
|
-
* reach — `new change --schema decision` built a directory `decision list`
|
|
119
|
-
* never saw, and `instructions --schema decision --change <x>` sent an agent to
|
|
120
|
-
* write `tospec/changes/<x>/decision.md`, a file nothing reads and archive does
|
|
121
|
-
* not merge.
|
|
89
|
+
* Refuses the decision schema for commands that operate on a change: its
|
|
90
|
+
* artifact belongs in `tospec/decisions/`, so pointed at a change it produces a
|
|
91
|
+
* directory `decision list` never sees and a `decision.md` archive never merges.
|
|
122
92
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* schema's templates is what `decision new` itself needs.
|
|
93
|
+
* `templates --schema decision` does not call this — listing that schema's
|
|
94
|
+
* templates is what `decision new` itself needs.
|
|
126
95
|
*/
|
|
127
96
|
export function assertChangeSchema(schemaName) {
|
|
128
97
|
if (schemaName === DECISION_SCHEMA_NAME) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/commands/workflow/shared.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/commands/workflow/shared.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,IAA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AAE,UAAU,CAAC,CAAC;QACrE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,WAAW,UAAU,mDAAmD,aAAa,EAAE,CACxF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,KAAK,CACb,WAAW,UAAU,sCAAsC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CACpF,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB,EAAE,WAAoB;IAC3E,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACxD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,kEAAkE;QAClE,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAC1D,MAAM,IAAI,KAAK,CACb,WAAW,UAAU,sCAAsC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAC3F,CAAC;IACJ,CAAC;IACD,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACvC,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,IAAI,UAAU,KAAK,oBAAoB,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACb,WAAW,oBAAoB,oDAAoD;YACjF,kCAAkC,CACrC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Status Command
|
|
3
|
-
*
|
|
4
|
-
* Displays artifact completion status for a change.
|
|
5
|
-
*/
|
|
1
|
+
/** `tospec status` — artifact completion for one change, or for every change. */
|
|
6
2
|
import { type ChangeStatus } from '../../core/artifact-graph/index.js';
|
|
7
3
|
export interface StatusOptions {
|
|
8
4
|
change?: string;
|
|
@@ -13,21 +9,15 @@ export interface StatusOptions {
|
|
|
13
9
|
/**
|
|
14
10
|
* The `--all --json` failure null-shape. Root selection resolves inside this
|
|
15
11
|
* module while thrown errors are caught by the CLI wrapper, so both call sites
|
|
16
|
-
* reference this one constant
|
|
12
|
+
* reference this one constant.
|
|
17
13
|
*/
|
|
18
14
|
export declare const BATCH_STATUS_FAILURE_PAYLOAD: Record<string, unknown>;
|
|
19
15
|
/**
|
|
20
|
-
* The single-change `--json` failure null-shape.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* decisions/20260917_155623-flat-json-payloads-null-a-real-success-key.md, such
|
|
26
|
-
* a command nulls a key its success output really carries — `changeName` here,
|
|
27
|
-
* as `instruction` and `id` do there. It previously nulled nothing at all, which
|
|
28
|
-
* left this the one envelope a caller could not tell apart from an unrelated
|
|
29
|
-
* error document; the ADR's two tests both pass vacuously on an empty key set,
|
|
30
|
-
* so the rule had to be asserted directly (see json-failure.test.ts).
|
|
16
|
+
* The single-change `--json` failure null-shape. Flat payload, like
|
|
17
|
+
* `instructions` and `show`, so it nulls a key its success output really carries
|
|
18
|
+
* (`changeName`) — otherwise a caller cannot tell this envelope from an
|
|
19
|
+
* unrelated error document.
|
|
20
|
+
* decisions/20260917_155623-flat-json-payloads-null-a-real-success-key.md
|
|
31
21
|
*/
|
|
32
22
|
export declare const STATUS_FAILURE_PAYLOAD: Record<string, unknown>;
|
|
33
23
|
export declare function statusCommand(options: StatusOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/workflow/status.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/workflow/status.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAQjF,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,oCAAoC,CAAC;AAY5C,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AASD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAiC,CAAC;AAEnG;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAoC,CAAC;AAEhG,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA6IzE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAmD1D"}
|
|
@@ -1,49 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Status Command
|
|
3
|
-
*
|
|
4
|
-
* Displays artifact completion status for a change.
|
|
5
|
-
*/
|
|
1
|
+
/** `tospec status` — artifact completion for one change, or for every change. */
|
|
6
2
|
import { getChangeDir } from '../../core/planning-home.js';
|
|
7
3
|
import { resolveRootForCommand, toPlanningHome, toRootOutput, } from '../../core/root-selection.js';
|
|
8
4
|
import { loadChangeContext, formatChangeStatus, } from '../../core/artifact-graph/index.js';
|
|
9
5
|
import { validateChangeExists, validateSchemaExists, assertChangeSchema, getAvailableChanges, getStatusIndicator, } from './shared.js';
|
|
10
6
|
import { emitSuccess, asStatus } from '../shared-output.js';
|
|
11
7
|
import { findTicketPath } from '../../utils/item-discovery.js';
|
|
8
|
+
import { printProjectConfigDiagnostics } from '../../core/project-config.js';
|
|
12
9
|
/**
|
|
13
10
|
* The `--all --json` failure null-shape. Root selection resolves inside this
|
|
14
11
|
* module while thrown errors are caught by the CLI wrapper, so both call sites
|
|
15
|
-
* reference this one constant
|
|
12
|
+
* reference this one constant.
|
|
16
13
|
*/
|
|
17
14
|
export const BATCH_STATUS_FAILURE_PAYLOAD = { changes: null, root: null };
|
|
18
15
|
/**
|
|
19
|
-
* The single-change `--json` failure null-shape.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* decisions/20260917_155623-flat-json-payloads-null-a-real-success-key.md, such
|
|
25
|
-
* a command nulls a key its success output really carries — `changeName` here,
|
|
26
|
-
* as `instruction` and `id` do there. It previously nulled nothing at all, which
|
|
27
|
-
* left this the one envelope a caller could not tell apart from an unrelated
|
|
28
|
-
* error document; the ADR's two tests both pass vacuously on an empty key set,
|
|
29
|
-
* so the rule had to be asserted directly (see json-failure.test.ts).
|
|
16
|
+
* The single-change `--json` failure null-shape. Flat payload, like
|
|
17
|
+
* `instructions` and `show`, so it nulls a key its success output really carries
|
|
18
|
+
* (`changeName`) — otherwise a caller cannot tell this envelope from an
|
|
19
|
+
* unrelated error document.
|
|
20
|
+
* decisions/20260917_155623-flat-json-payloads-null-a-real-success-key.md
|
|
30
21
|
*/
|
|
31
22
|
export const STATUS_FAILURE_PAYLOAD = { changeName: null, root: null };
|
|
32
|
-
// -----------------------------------------------------------------------------
|
|
33
|
-
// Command Implementation
|
|
34
|
-
// -----------------------------------------------------------------------------
|
|
35
23
|
export async function statusCommand(options) {
|
|
36
24
|
if (options.all && options.change) {
|
|
37
25
|
throw new Error('The --all and --change options are mutually exclusive.');
|
|
38
26
|
}
|
|
39
|
-
// The batch null-shape rides along so a root-selection failure under
|
|
40
|
-
// --all --json still carries `changes: null` rather than an empty payload.
|
|
41
|
-
//
|
|
42
27
|
// No implicit root: it resolves only when no ancestor holds a `tospec/` dir,
|
|
43
28
|
// and status would then answer "No active changes." with exit 0 about a
|
|
44
|
-
// directory that is not a project
|
|
45
|
-
//
|
|
46
|
-
// four now report the one `no_tospec_root` diagnostic for the one condition.
|
|
29
|
+
// directory that is not a project — the vacuous pass `validate`, `list` and
|
|
30
|
+
// `archive` also refuse.
|
|
47
31
|
const root = await resolveRootForCommand(options, {
|
|
48
32
|
json: options.json,
|
|
49
33
|
allowImplicitRoot: false,
|
|
@@ -56,30 +40,33 @@ export async function statusCommand(options) {
|
|
|
56
40
|
const projectRoot = root.path;
|
|
57
41
|
const rootOutput = toRootOutput(root);
|
|
58
42
|
const newChangeHint = 'tospec new change <name>';
|
|
59
|
-
//
|
|
60
|
-
//
|
|
43
|
+
// One definition of "load a change's status", so the batch and single-change
|
|
44
|
+
// payloads cannot drift apart.
|
|
61
45
|
const loadStatus = (changeName) => formatChangeStatus(loadChangeContext(projectRoot, changeName, options.schema, {
|
|
62
46
|
changeDir: getChangeDir(planningHome, changeName),
|
|
63
47
|
planningHome,
|
|
64
48
|
}));
|
|
65
49
|
// The ticket lives outside the change dir under a CLI-generated timestamp, so
|
|
66
|
-
// it appears in no artifact path
|
|
67
|
-
//
|
|
68
|
-
// the shared loader, so the batch and single-change payloads keep reporting
|
|
69
|
-
// the same fields.
|
|
50
|
+
// it appears in no artifact path; without this an agent has to glob
|
|
51
|
+
// `tospec/tickets/` and match frontmatter by hand.
|
|
70
52
|
const loadStatusWithTicket = async (changeName) => ({
|
|
71
53
|
...loadStatus(changeName),
|
|
72
54
|
ticketPath: (await findTicketPath(projectRoot, changeName)) ?? null,
|
|
73
55
|
});
|
|
74
|
-
//
|
|
75
|
-
//
|
|
56
|
+
// `--schema` is judged on its own, before anything about changes is read: a
|
|
57
|
+
// wrong name is wrong whatever else was passed, and checking it later sends
|
|
58
|
+
// the caller to create a change first. `decision` is refused too, since it
|
|
59
|
+
// would plan an artifact at `tospec/changes/<change>/decision.md` — the orphan
|
|
60
|
+
// `instructions` and `new change` already refuse.
|
|
61
|
+
if (options.schema) {
|
|
62
|
+
validateSchemaExists(options.schema, projectRoot);
|
|
63
|
+
assertChangeSchema(options.schema);
|
|
64
|
+
}
|
|
65
|
+
// A change's schema falls back to the project config, so a config that no
|
|
66
|
+
// longer parses changes what this command reports — say so, once.
|
|
67
|
+
printProjectConfigDiagnostics(projectRoot);
|
|
68
|
+
// "No changes" is a valid state for an informational command, not an error.
|
|
76
69
|
if (!options.change) {
|
|
77
|
-
// Validated before the no-changes early return so a bogus --schema fails
|
|
78
|
-
// the same way whether or not any change exists yet.
|
|
79
|
-
if (options.all && options.schema) {
|
|
80
|
-
validateSchemaExists(options.schema, projectRoot);
|
|
81
|
-
assertChangeSchema(options.schema);
|
|
82
|
-
}
|
|
83
70
|
const available = await getAvailableChanges(projectRoot, root.changesDir);
|
|
84
71
|
if (available.length === 0) {
|
|
85
72
|
if (options.json) {
|
|
@@ -90,15 +77,27 @@ export async function statusCommand(options) {
|
|
|
90
77
|
return;
|
|
91
78
|
}
|
|
92
79
|
if (options.all) {
|
|
93
|
-
// readdir order is platform-dependent;
|
|
94
|
-
// `validate --all` uses so both batch commands order a change set alike.
|
|
80
|
+
// readdir order is platform-dependent; the comparator is the one
|
|
81
|
+
// `validate --all` uses, so both batch commands order a change set alike.
|
|
95
82
|
const entries = [];
|
|
83
|
+
// Top-level copies of the per-entry failures, for the `status` array the
|
|
84
|
+
// partial envelope carries: `list --json` and `validate --all --json`
|
|
85
|
+
// report an unreadable change there too, so a caller reads one place.
|
|
86
|
+
const diagnostics = [];
|
|
96
87
|
for (const changeName of available.sort((a, b) => a.localeCompare(b))) {
|
|
97
88
|
try {
|
|
98
89
|
entries.push(await loadStatusWithTicket(changeName));
|
|
99
90
|
}
|
|
100
91
|
catch (error) {
|
|
101
|
-
|
|
92
|
+
const diagnostic = asStatus(error, 'change_error');
|
|
93
|
+
entries.push({ changeName, status: [diagnostic] });
|
|
94
|
+
diagnostics.push({
|
|
95
|
+
...diagnostic,
|
|
96
|
+
code: 'change_unreadable',
|
|
97
|
+
message: `Change '${changeName}' could not be read: ${diagnostic.message}`,
|
|
98
|
+
target: getChangeDir(planningHome, changeName),
|
|
99
|
+
fix: `Fix ${changeName}'s .tospec.yaml, or move the directory out of tospec/changes/.`,
|
|
100
|
+
});
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
103
|
// `artifacts` is what a loaded status has and a diagnostic entry does not.
|
|
@@ -106,8 +105,7 @@ export async function statusCommand(options) {
|
|
|
106
105
|
if (options.json) {
|
|
107
106
|
// The full envelope is emitted even on partial failure: dropping the
|
|
108
107
|
// report to report the failure would lose every change that did load.
|
|
109
|
-
|
|
110
|
-
emitSuccess({ changes: entries }, rootOutput);
|
|
108
|
+
emitSuccess({ changes: entries, ...(diagnostics.length ? { status: diagnostics } : {}) }, rootOutput);
|
|
111
109
|
}
|
|
112
110
|
else {
|
|
113
111
|
entries.forEach((entry, index) => {
|
|
@@ -128,31 +126,12 @@ export async function statusCommand(options) {
|
|
|
128
126
|
}
|
|
129
127
|
return;
|
|
130
128
|
}
|
|
131
|
-
// Changes exist but neither --change nor --all was given
|
|
132
|
-
//
|
|
133
|
-
// every change should not have to find it in --help.
|
|
129
|
+
// Changes exist but neither --change nor --all was given, so name both ways
|
|
130
|
+
// to answer this prompt.
|
|
134
131
|
throw new Error(`Missing required option --change (or --all for every active change). Available changes:\n ${available.join('\n ')}`);
|
|
135
132
|
}
|
|
136
|
-
// Validate schema if explicitly provided.
|
|
137
|
-
//
|
|
138
|
-
// Guarded for the same reason as `instructions` and `new change`, and with
|
|
139
|
-
// more force: `status --schema decision` planned an artifact at
|
|
140
|
-
// tospec/changes/<change>/decision.md — the orphan file those two already
|
|
141
|
-
// refuse — and then handed back a nextSteps line telling the caller to run
|
|
142
|
-
// `tospec instructions decision`, which refuses. The two commands together
|
|
143
|
-
// formed a closed loop: the one that issues the instruction was the one
|
|
144
|
-
// without the check.
|
|
145
|
-
//
|
|
146
|
-
// Before change resolution, not after (round 4 report 15). Sitting after it,
|
|
147
|
-
// the guard never fired in an empty project: the caller got "Create one with:
|
|
148
|
-
// tospec new change <name>", did exactly that, and only then learned the
|
|
149
|
-
// schema was never usable — the misdirection this guard was added to remove.
|
|
150
|
-
if (options.schema) {
|
|
151
|
-
validateSchemaExists(options.schema, projectRoot);
|
|
152
|
-
assertChangeSchema(options.schema);
|
|
153
|
-
}
|
|
154
133
|
const changeName = await validateChangeExists(options.change, projectRoot, root.changesDir, { newChangeHint });
|
|
155
|
-
//
|
|
134
|
+
// The schema comes from the change's metadata when not given.
|
|
156
135
|
if (options.json) {
|
|
157
136
|
emitSuccess({ ...(await loadStatusWithTicket(changeName)) }, rootOutput);
|
|
158
137
|
return;
|
|
@@ -161,14 +140,20 @@ export async function statusCommand(options) {
|
|
|
161
140
|
printStatusText(status);
|
|
162
141
|
}
|
|
163
142
|
export function printStatusText(status) {
|
|
164
|
-
|
|
165
|
-
|
|
143
|
+
// Counted against the same definition `graph.isComplete` uses: an optional
|
|
144
|
+
// artifact nobody wrote and one the change declared away are not outstanding
|
|
145
|
+
// work, so counting them prints "Progress: 1/2" above "All artifacts
|
|
146
|
+
// complete!". One that *was* written reports `done` and counts.
|
|
147
|
+
const counted = status.artifacts.filter((a) => a.status !== 'optional' && a.status !== 'skipped');
|
|
148
|
+
const doneCount = counted.filter((a) => a.status === 'done').length;
|
|
149
|
+
const setAside = status.artifacts.length - counted.length;
|
|
166
150
|
console.log(`Change: ${status.changeName}`);
|
|
167
151
|
console.log(`Schema: ${status.schemaName}`);
|
|
168
152
|
if (status.changeRoot) {
|
|
169
153
|
console.log(`Change root: ${status.changeRoot}`);
|
|
170
154
|
}
|
|
171
|
-
|
|
155
|
+
const setAsideNote = setAside > 0 ? ` (${setAside} not required)` : '';
|
|
156
|
+
console.log(`Progress: ${doneCount}/${counted.length} artifacts complete${setAsideNote}`);
|
|
172
157
|
console.log();
|
|
173
158
|
for (const artifact of status.artifacts) {
|
|
174
159
|
const indicator = getStatusIndicator(artifact.status);
|
|
@@ -179,8 +164,8 @@ export function printStatusText(status) {
|
|
|
179
164
|
if (artifact.status === 'stub') {
|
|
180
165
|
line += ' (stub: file exists but is empty or template-identical — fill it in)';
|
|
181
166
|
}
|
|
182
|
-
//
|
|
183
|
-
//
|
|
167
|
+
// `optional` and `skipped` share a marker; the label says whether writing
|
|
168
|
+
// it is still on the table.
|
|
184
169
|
if (artifact.status === 'optional') {
|
|
185
170
|
line += ' (optional: not written — write it if this change needs it)';
|
|
186
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/workflow/status.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/workflow/status.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,YAAY,GACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAA0B,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAgB7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA4B,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEnG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAA4B,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEhG,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAsB;IACxD,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED,6EAA6E;IAC7E,wEAAwE;IACxE,4EAA4E;IAC5E,yBAAyB;IACzB,MAAM,IAAI,GAAG,MAAM,qBA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3C,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Templates Command
|
|
3
|
-
*
|
|
4
|
-
* Shows resolved template paths for all artifacts in a schema.
|
|
5
|
-
*/
|
|
1
|
+
/** `tospec templates` — resolved template paths for a schema's artifacts. */
|
|
6
2
|
/**
|
|
7
3
|
* The `--json` null-shape. Exported so the commander-level shape table and this
|
|
8
|
-
* command's own catch block read
|
|
9
|
-
* drifted — the catch block's copy was missing `root`, which every success
|
|
10
|
-
* payload carries.
|
|
4
|
+
* command's own catch block read one object rather than two literals that drift.
|
|
11
5
|
*/
|
|
12
6
|
export declare const TEMPLATES_FAILURE_PAYLOAD: Record<string, unknown>;
|
|
13
7
|
export interface TemplatesOptions {
|
|
@@ -18,6 +12,12 @@ export interface TemplateInfo {
|
|
|
18
12
|
artifactId: string;
|
|
19
13
|
templatePath: string;
|
|
20
14
|
source: 'project' | 'user' | 'package';
|
|
15
|
+
/**
|
|
16
|
+
* False when the schema names a template file that is not on disk. Composing
|
|
17
|
+
* the path without checking reports success for a path that ENOENTs, while
|
|
18
|
+
* `instructions` for the same schema fails outright.
|
|
19
|
+
*/
|
|
20
|
+
exists: boolean;
|
|
21
21
|
}
|
|
22
22
|
export declare function templatesCommand(options: TemplatesOptions): Promise<void>;
|
|
23
23
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/commands/workflow/templates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/commands/workflow/templates.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAc7E;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAG7D,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC;;;;OAIG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8D/E"}
|
|
@@ -1,36 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Templates Command
|
|
3
|
-
*
|
|
4
|
-
* Shows resolved template paths for all artifacts in a schema.
|
|
5
|
-
*/
|
|
1
|
+
/** `tospec templates` — resolved template paths for a schema's artifacts. */
|
|
6
2
|
import path from 'path';
|
|
7
|
-
import
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import { resolveSchema, getSchemaDirWithSource, ArtifactGraph, } from '../../core/artifact-graph/index.js';
|
|
8
5
|
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
9
6
|
import { validateSchemaExists, DEFAULT_SCHEMA } from './shared.js';
|
|
10
7
|
import { emitSuccess } from '../shared-output.js';
|
|
11
8
|
import { resolveRootForCommand, toRootOutput } from '../../core/root-selection.js';
|
|
12
|
-
// -----------------------------------------------------------------------------
|
|
13
|
-
// Types
|
|
14
|
-
// -----------------------------------------------------------------------------
|
|
15
9
|
/**
|
|
16
10
|
* The `--json` null-shape. Exported so the commander-level shape table and this
|
|
17
|
-
* command's own catch block read
|
|
18
|
-
* drifted — the catch block's copy was missing `root`, which every success
|
|
19
|
-
* payload carries.
|
|
11
|
+
* command's own catch block read one object rather than two literals that drift.
|
|
20
12
|
*/
|
|
21
13
|
export const TEMPLATES_FAILURE_PAYLOAD = {
|
|
22
14
|
templates: null,
|
|
23
15
|
root: null,
|
|
24
16
|
};
|
|
25
|
-
// -----------------------------------------------------------------------------
|
|
26
|
-
// Command Implementation
|
|
27
|
-
// -----------------------------------------------------------------------------
|
|
28
17
|
export async function templatesCommand(options) {
|
|
29
|
-
// Same root resolution as every other command
|
|
30
|
-
//
|
|
18
|
+
// Same root resolution as every other command: a subdirectory of a project
|
|
19
|
+
// resolves the project root, not the bare cwd.
|
|
31
20
|
const root = await resolveRootForCommand(options, {
|
|
32
21
|
json: options.json,
|
|
33
|
-
failurePayload:
|
|
22
|
+
failurePayload: TEMPLATES_FAILURE_PAYLOAD,
|
|
34
23
|
});
|
|
35
24
|
if (!root) {
|
|
36
25
|
return;
|
|
@@ -39,46 +28,43 @@ export async function templatesCommand(options) {
|
|
|
39
28
|
const schemaName = validateSchemaExists(options.schema ?? DEFAULT_SCHEMA, projectRoot);
|
|
40
29
|
const schema = resolveSchema(schemaName, projectRoot);
|
|
41
30
|
const graph = ArtifactGraph.fromSchema(schema);
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
const {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
source = 'package';
|
|
62
|
-
}
|
|
63
|
-
const templates = graph.getAllArtifacts().map((artifact) => ({
|
|
64
|
-
artifactId: artifact.id,
|
|
65
|
-
templatePath: FileSystemUtils.canonicalizeExistingPath(path.join(schemaDir, 'templates', artifact.template)),
|
|
66
|
-
source,
|
|
31
|
+
// The layer comes from the resolver that picked the directory rather than
|
|
32
|
+
// being re-derived here, so there is only one answer to "which layer won".
|
|
33
|
+
const { dir: schemaDir, source } = getSchemaDirWithSource(schemaName, projectRoot);
|
|
34
|
+
const templates = graph.getAllArtifacts().map((artifact) => {
|
|
35
|
+
const templatePath = path.join(schemaDir, 'templates', artifact.template);
|
|
36
|
+
return {
|
|
37
|
+
artifactId: artifact.id,
|
|
38
|
+
templatePath: FileSystemUtils.canonicalizeExistingPath(templatePath),
|
|
39
|
+
source,
|
|
40
|
+
exists: fs.existsSync(templatePath),
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const missing = templates.filter((t) => !t.exists);
|
|
44
|
+
// Reported, not thrown: the other artifacts' paths are still correct, and
|
|
45
|
+
// exit stays 0 because nothing the caller asked for failed.
|
|
46
|
+
const missingDiagnostics = missing.map((t) => ({
|
|
47
|
+
severity: 'warning',
|
|
48
|
+
code: 'template_file_missing',
|
|
49
|
+
message: `Schema '${schemaName}' declares template '${t.artifactId}' at ${t.templatePath}, but that file does not exist. tospec instructions ${t.artifactId} will fail until it is created.`,
|
|
67
50
|
}));
|
|
68
51
|
if (options.json) {
|
|
69
52
|
const output = {};
|
|
70
53
|
for (const t of templates) {
|
|
71
|
-
output[t.artifactId] = { path: t.templatePath, source: t.source };
|
|
54
|
+
output[t.artifactId] = { path: t.templatePath, source: t.source, exists: t.exists };
|
|
72
55
|
}
|
|
73
|
-
emitSuccess({ templates: output }, toRootOutput(root));
|
|
56
|
+
emitSuccess({ templates: output, ...(missingDiagnostics.length ? { status: missingDiagnostics } : {}) }, toRootOutput(root));
|
|
74
57
|
return;
|
|
75
58
|
}
|
|
59
|
+
for (const diagnostic of missingDiagnostics) {
|
|
60
|
+
console.error(`Warning: ${diagnostic.message}`);
|
|
61
|
+
}
|
|
76
62
|
console.log(`Schema: ${schemaName}`);
|
|
77
63
|
console.log(`Source: ${source}`);
|
|
78
64
|
console.log();
|
|
79
65
|
for (const t of templates) {
|
|
80
66
|
console.log(`${t.artifactId}:`);
|
|
81
|
-
console.log(` ${t.templatePath}`);
|
|
67
|
+
console.log(` ${t.templatePath}${t.exists ? '' : ' (missing)'}`);
|
|
82
68
|
}
|
|
83
69
|
}
|
|
84
70
|
//# sourceMappingURL=templates.js.map
|