@seanmars/tospec 0.19.0-beta.7 → 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 -231
- package/README.md +69 -82
- package/assets/dashboard/app.js +14 -3
- package/assets/dashboard/style.css +7 -0
- package/assets/rules/tospec/decision.md +3 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +227 -86
- 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 +366 -107
- 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 +224 -282
- 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 +385 -79
- 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 +18 -21
- package/dist/commands/shared-output.d.ts.map +1 -1
- package/dist/commands/shared-output.js +49 -23
- 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 +29 -7
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/validate.d.ts +43 -45
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +262 -129
- 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 +81 -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 +378 -235
- 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 +97 -103
- package/dist/core/artifact-graph/instruction-loader.d.ts.map +1 -1
- package/dist/core/artifact-graph/instruction-loader.js +146 -119
- 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 +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 +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 +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 +39 -26
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +36 -22
- 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 +40 -22
- package/dist/core/dashboard-data.d.ts.map +1 -1
- package/dist/core/dashboard-data.js +62 -70
- 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 +25 -19
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +168 -181
- 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 +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 +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 +29 -14
- package/dist/core/migrate.d.ts.map +1 -1
- package/dist/core/migrate.js +184 -122
- 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 +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 +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 +6 -1
- package/dist/core/rules.d.ts.map +1 -1
- package/dist/core/rules.js +23 -2
- 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 +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 +19 -8
- package/dist/core/shared/rules-generation.d.ts.map +1 -1
- package/dist/core/shared/rules-generation.js +117 -50
- 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 +39 -61
- 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.js +6 -6
- package/dist/core/spec-presenter.js.map +1 -1
- package/dist/core/specs-apply.d.ts +22 -23
- package/dist/core/specs-apply.d.ts.map +1 -1
- package/dist/core/specs-apply.js +166 -193
- 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 +19 -6
- 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 -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 +23 -23
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +139 -118
- 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 -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 +43 -63
- package/dist/core/validation/validator.d.ts.map +1 -1
- package/dist/core/validation/validator.js +500 -267
- 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 +30 -54
- package/dist/utils/change-utils.d.ts.map +1 -1
- package/dist/utils/change-utils.js +133 -91
- 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 +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/decision/templates/decision.md +3 -1
- package/schemas/decision/templates/index.md +2 -2
- package/schemas/issue/schema.yaml +8 -1
- package/schemas/issue/templates/spec.md +27 -2
- package/schemas/sdd/schema.yaml +20 -1
- package/schemas/sdd/templates/spec.md +27 -2
- /package/assets/rules/tospec/{single-sourc-of-truth.md → single-source-of-truth.md} +0 -0
|
@@ -1,95 +1,162 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Every rule document tospec writes is managed the same way: a shipped Markdown
|
|
3
|
+
* template, wrapped in a hash-stamped marker, planned read-only before any
|
|
4
|
+
* project write, and refused rather than overwritten once somebody has edited
|
|
5
|
+
* it. Without the marker there is no way to tell a generated file from an
|
|
6
|
+
* edited one, and `tospec init` silently loses the edit.
|
|
6
7
|
*/
|
|
7
8
|
import path from 'node:path';
|
|
8
9
|
import { promises as fs } from 'node:fs';
|
|
9
10
|
import { createHash } from 'node:crypto';
|
|
10
|
-
import { AI_TOOLS, CODEX_TARGET_ID } from '../config.js';
|
|
11
|
+
import { AI_TOOLS, CODEX_TARGET_ID, DECISION_RULE_FILENAME, LEGACY_WORKFLOW_RULE_FILENAME, TOOL_RULES_SUBDIR, WORKFLOW_RULE_FILENAME, } from '../config.js';
|
|
11
12
|
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The exact text the init-only writer produced. Kept verbatim rather than
|
|
15
|
+
* regenerated from the template: its only job is to recognise files already on
|
|
16
|
+
* disk, so it must not follow a change to the shipped body.
|
|
17
|
+
*/
|
|
18
|
+
const UNMARKED_DECISION_RULE = `# Decision
|
|
14
19
|
|
|
15
20
|
Any material decision reached during discussion must be recorded with /tospec-decision, which creates a decision file and captures the relevant decision details.
|
|
16
21
|
`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
const MANAGED_RULES = [
|
|
23
|
+
{
|
|
24
|
+
filename: WORKFLOW_RULE_FILENAME,
|
|
25
|
+
slug: 'single-source-of-truth',
|
|
26
|
+
templateUrl: new URL('../../../assets/rules/tospec/single-source-of-truth.md', import.meta.url),
|
|
27
|
+
// Carries the same `sourc` typo as the filename it was written beside.
|
|
28
|
+
legacySlugs: ['single-sourc-of-truth'],
|
|
29
|
+
legacyFilename: LEGACY_WORKFLOW_RULE_FILENAME,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
filename: DECISION_RULE_FILENAME,
|
|
33
|
+
slug: 'decision',
|
|
34
|
+
templateUrl: new URL('../../../assets/rules/tospec/decision.md', import.meta.url),
|
|
35
|
+
unmarkedLegacyBodies: [UNMARKED_DECISION_RULE],
|
|
36
|
+
},
|
|
20
37
|
];
|
|
21
|
-
/** Write tospec rule files into `<projectPath>/<agentBaseDir>/rules/` for one tool. */
|
|
22
|
-
export async function writeToolRules(projectPath, agentBaseDir) {
|
|
23
|
-
for (const rule of RULE_FILES) {
|
|
24
|
-
const dest = path.join(projectPath, agentBaseDir, 'rules', rule.relPath);
|
|
25
|
-
await FileSystemUtils.writeFile(dest, rule.content); // auto-creates parent dirs
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const TEMPLATE_URL = new URL('../../../assets/rules/tospec/single-sourc-of-truth.md', import.meta.url);
|
|
29
|
-
const RULE_NAME = 'single-sourc-of-truth.md';
|
|
30
|
-
const END_MARKER = '<!-- /tospec:single-sourc-of-truth -->';
|
|
31
|
-
const MANAGED_DOCUMENT = /^<!-- tospec:single-sourc-of-truth:v1 sha256=([a-f0-9]{64}) -->\n([\s\S]*\n)<!-- \/tospec:single-sourc-of-truth -->\n$/;
|
|
32
38
|
function normalizeNewlines(content) {
|
|
33
39
|
return content.replace(/\r\n/g, '\n');
|
|
34
40
|
}
|
|
35
41
|
function bodyHash(body) {
|
|
36
42
|
return createHash('sha256').update(body, 'utf8').digest('hex');
|
|
37
43
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
const managedDocumentPattern = (slug) => new RegExp(`^<!-- tospec:${slug}:v1 sha256=([a-f0-9]{64}) -->\\n([\\s\\S]*\\n)<!-- \\/tospec:${slug} -->\\n$`);
|
|
45
|
+
/**
|
|
46
|
+
* Whether the file is an untouched tospec-generated rule document. Every slug
|
|
47
|
+
* this rule has ever used is accepted, as is any unmarked body a previous tospec
|
|
48
|
+
* wrote: refusing either turns a routine `tospec update` into a rule conflict
|
|
49
|
+
* for every project predating the change.
|
|
50
|
+
*/
|
|
51
|
+
function isIntactDocument(rule, content) {
|
|
52
|
+
if (rule.unmarkedLegacyBodies?.some((body) => content === body))
|
|
53
|
+
return true;
|
|
54
|
+
return [rule.slug, ...(rule.legacySlugs ?? [])].some((slug) => {
|
|
55
|
+
const match = managedDocumentPattern(slug).exec(content);
|
|
56
|
+
// A dedicated file has exactly one frame; text outside it is somebody's.
|
|
57
|
+
return match !== null && match[0] === content
|
|
58
|
+
&& !match[2].includes(`<!-- tospec:${slug}:`)
|
|
59
|
+
&& !match[2].includes(`<!-- /tospec:${slug} -->`)
|
|
60
|
+
&& bodyHash(match[2]) === match[1];
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function planAction(previous, content) {
|
|
64
|
+
if (previous === undefined)
|
|
65
|
+
return 'created';
|
|
66
|
+
if (previous === content)
|
|
67
|
+
return 'unchanged';
|
|
68
|
+
return 'updated';
|
|
45
69
|
}
|
|
46
70
|
/** Read every target before allowing any project mutation. */
|
|
47
71
|
export async function planWorkflowRules(projectPath, toolIds) {
|
|
48
72
|
if (toolIds.length === 0)
|
|
49
73
|
return [];
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
74
|
+
const contents = new Map();
|
|
75
|
+
for (const rule of MANAGED_RULES) {
|
|
76
|
+
const body = normalizeNewlines(await fs.readFile(rule.templateUrl, 'utf8')).replace(/\n*$/, '\n');
|
|
77
|
+
contents.set(rule.filename, `<!-- tospec:${rule.slug}:v1 sha256=${bodyHash(body)} -->\n${body}<!-- /tospec:${rule.slug} -->\n`);
|
|
78
|
+
}
|
|
53
79
|
const plan = [];
|
|
54
80
|
const conflicts = [];
|
|
55
|
-
|
|
56
|
-
const tool = AI_TOOLS.find((tool) => tool.value === toolId);
|
|
57
|
-
if (!tool?.skillsDir)
|
|
58
|
-
throw new Error(`Unknown rule target: ${toolId}`);
|
|
59
|
-
const destination = path.join(projectPath, tool.skillsDir, 'rules', 'tospec', RULE_NAME);
|
|
60
|
-
let previous;
|
|
81
|
+
const readIfPresent = async (file) => {
|
|
61
82
|
try {
|
|
62
|
-
|
|
83
|
+
return normalizeNewlines(await fs.readFile(file, 'utf8'));
|
|
63
84
|
}
|
|
64
85
|
catch (error) {
|
|
65
86
|
if (error.code !== 'ENOENT')
|
|
66
87
|
throw error;
|
|
88
|
+
return undefined;
|
|
67
89
|
}
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
};
|
|
91
|
+
for (const toolId of toolIds) {
|
|
92
|
+
const tool = AI_TOOLS.find((tool) => tool.value === toolId);
|
|
93
|
+
if (!tool?.skillsDir)
|
|
94
|
+
throw new Error(`Unknown rule target: ${toolId}`);
|
|
95
|
+
const rulesDir = path.join(projectPath, tool.skillsDir, ...TOOL_RULES_SUBDIR);
|
|
96
|
+
for (const rule of MANAGED_RULES) {
|
|
97
|
+
const content = contents.get(rule.filename);
|
|
98
|
+
const destination = path.join(rulesDir, rule.filename);
|
|
99
|
+
const previous = await readIfPresent(destination);
|
|
100
|
+
if (previous !== undefined && !isIntactDocument(rule, previous)) {
|
|
101
|
+
conflicts.push(destination);
|
|
102
|
+
}
|
|
103
|
+
let retire;
|
|
104
|
+
if (rule.legacyFilename) {
|
|
105
|
+
const legacy = path.join(rulesDir, rule.legacyFilename);
|
|
106
|
+
const legacyPrevious = await readIfPresent(legacy);
|
|
107
|
+
if (legacyPrevious !== undefined) {
|
|
108
|
+
// An edited copy under the old name is reported, not deleted: the
|
|
109
|
+
// rename is tospec's housekeeping, not a reason to drop notes. Named
|
|
110
|
+
// as the old spelling, because a user who never typed that filename
|
|
111
|
+
// cannot otherwise tell why an "old" file blocks the run.
|
|
112
|
+
if (isIntactDocument(rule, legacyPrevious))
|
|
113
|
+
retire = legacy;
|
|
114
|
+
else {
|
|
115
|
+
conflicts.push(`${legacy} (previous filename of ${rule.filename}; tospec would have renamed it had it not been edited)`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
plan.push({
|
|
120
|
+
toolId,
|
|
121
|
+
rule: rule.filename,
|
|
122
|
+
destination,
|
|
123
|
+
content,
|
|
124
|
+
action: planAction(previous, content),
|
|
125
|
+
...(retire ? { retire } : {}),
|
|
126
|
+
});
|
|
70
127
|
}
|
|
71
|
-
plan.push({ toolId, destination, content,
|
|
72
|
-
action: previous === undefined ? 'created' : previous === content ? 'unchanged' : 'updated' });
|
|
73
128
|
}
|
|
74
129
|
if (conflicts.length > 0) {
|
|
75
130
|
throw new Error(`Workflow rule conflict:\n${conflicts.join('\n')}\nPreserve your edits, remove the conflicting generated files, then rerun. Force does not bypass rule conflicts.`);
|
|
76
131
|
}
|
|
77
132
|
return plan;
|
|
78
133
|
}
|
|
79
|
-
/**
|
|
80
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Call only after the complete plan passed preflight. `silent` suppresses the
|
|
136
|
+
* progress prose for a `--json` caller, whose stdout must stay one document.
|
|
137
|
+
*/
|
|
138
|
+
export async function writeWorkflowRules(plan, options = {}) {
|
|
139
|
+
const say = (line) => {
|
|
140
|
+
if (!options.silent)
|
|
141
|
+
console.log(line);
|
|
142
|
+
};
|
|
81
143
|
for (const entry of plan) {
|
|
82
144
|
if (entry.action !== 'unchanged') {
|
|
83
145
|
await FileSystemUtils.writeFile(entry.destination, entry.content);
|
|
84
146
|
}
|
|
85
|
-
|
|
147
|
+
say(`Rules ${entry.action}: ${entry.destination}`);
|
|
148
|
+
// After the write, never before: a failure between the two would leave the
|
|
149
|
+
// project with no rule document at all.
|
|
150
|
+
if (entry.retire) {
|
|
151
|
+
await fs.rm(entry.retire, { force: true });
|
|
152
|
+
say(`Rules removed (renamed): ${entry.retire}`);
|
|
153
|
+
}
|
|
86
154
|
}
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
// notice would turn a known limitation into a silent failure.
|
|
155
|
+
// Codex reads AGENTS.md and skill files, never project Markdown under rules/,
|
|
156
|
+
// so the relocated file has no loading path there. Said out loud, or the
|
|
157
|
+
// limitation is silent.
|
|
91
158
|
if (plan.some((entry) => entry.toolId === CODEX_TARGET_ID)) {
|
|
92
|
-
|
|
159
|
+
say('Codex: rule documents are reference material; configure loading yourself. Markdown files in .agents/rules/ are not automatically loaded as instructions — Codex takes its text guidance from AGENTS.md and skill files.');
|
|
93
160
|
}
|
|
94
161
|
}
|
|
95
162
|
//# sourceMappingURL=rules-generation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules-generation.js","sourceRoot":"","sources":["../../../src/core/shared/rules-generation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rules-generation.js","sourceRoot":"","sources":["../../../src/core/shared/rules-generation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,IAAI,EAAE,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IACtL,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAAwB,EACxB,OAAO,GAAyB,EAAE;IAElC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAQ,EAAE;QACjC,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,IAAI,KAAK,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACjC,MAAM,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACpE,CAAC;QACD,GAAG,CAAC,SAAS,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QACnD,2EAA2E;QAC3E,wCAAwC;QACxC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3C,GAAG,CAAC,4BAA4B,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IACD,8EAA8E;IAC9E,yEAAyE;IACzE,wBAAwB;IACxB,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,eAAe,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,yNAAyN,CAAC,CAAC;IACjO,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill Generation Utilities
|
|
3
|
-
*
|
|
4
|
-
* Shared utilities for generating skill and command files.
|
|
5
|
-
*/
|
|
6
1
|
import { getExploreSkillTemplate, getGrillSkillTemplate, getTospecProposeSkillTemplate, getTospecIssueSkillTemplate, getTospecDecisionSkillTemplate, getTospecUpdateSkillTemplate, getTospecApplySkillTemplate, getTospecApplyWithTDDSkillTemplate, getTospecSyncSkillTemplate, getTospecArchiveSkillTemplate, getTospecExploreCommandTemplate, getTospecGrillCommandTemplate, getTospecProposeCommandTemplate, getTospecIssueCommandTemplate, getTospecDecisionCommandTemplate, getTospecUpdateCommandTemplate, getTospecApplyCommandTemplate, getTospecApplyWithTDDCommandTemplate, getTospecSyncCommandTemplate, getTospecArchiveCommandTemplate, type SkillTemplate } from '../templates/skill-templates.js';
|
|
7
2
|
import { type CommandContent } from '../command-generation/index.js';
|
|
8
3
|
declare const WORKFLOW_DEFS: readonly [{
|
|
@@ -50,66 +45,56 @@ export type WorkflowId = (typeof WORKFLOW_DEFS)[number]['id'];
|
|
|
50
45
|
export declare const ALL_WORKFLOWS: readonly WorkflowId[];
|
|
51
46
|
/** Skill directory name convention: `tospec-<workflow>`. */
|
|
52
47
|
export declare function workflowSkillDirName(id: string): string;
|
|
48
|
+
/** A `tospec-<id>` mention in the prose of a skill that is being installed. */
|
|
49
|
+
export interface WorkflowReferenceGap {
|
|
50
|
+
/** The workflow whose skill/command text carries the reference. */
|
|
51
|
+
from: WorkflowId;
|
|
52
|
+
/** The workflow it points at, which this selection does not install. */
|
|
53
|
+
missing: WorkflowId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Skills a selection installs whose instructions send the agent to a workflow that
|
|
57
|
+
* selection leaves out.
|
|
58
|
+
*
|
|
59
|
+
* A custom profile is a subset and the prose is not: templates name sibling
|
|
60
|
+
* workflows unconditionally, so `propose,apply,archive` installs an archive
|
|
61
|
+
* skill saying "Run the `tospec-sync` workflow now" of a skill that is not
|
|
62
|
+
* there, and the agent improvises the step.
|
|
63
|
+
*
|
|
64
|
+
* Reported rather than corrected: the selection is the user's, and rewriting
|
|
65
|
+
* prose per profile would fork the installed text from the canonical template.
|
|
66
|
+
*/
|
|
67
|
+
export declare function findWorkflowReferenceGaps(selected: readonly string[]): WorkflowReferenceGap[];
|
|
53
68
|
/**
|
|
54
|
-
*
|
|
69
|
+
* One line per skill that points somewhere the selection does not install,
|
|
70
|
+
* e.g. `tospec-archive refers to tospec-sync`.
|
|
55
71
|
*/
|
|
72
|
+
export declare function describeWorkflowReferenceGaps(gaps: readonly WorkflowReferenceGap[]): string;
|
|
56
73
|
export interface SkillTemplateEntry {
|
|
57
74
|
template: SkillTemplate;
|
|
58
75
|
dirName: string;
|
|
59
76
|
workflowId: string;
|
|
60
77
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Command template with ID mapping.
|
|
63
|
-
*/
|
|
64
78
|
export interface CommandTemplateEntry {
|
|
65
79
|
template: ReturnType<typeof getTospecExploreCommandTemplate>;
|
|
66
80
|
id: string;
|
|
67
81
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Gets skill templates with their directory names, optionally filtered by workflow IDs.
|
|
70
|
-
*
|
|
71
|
-
* @param workflowFilter - If provided, only return templates whose workflowId is in this array
|
|
72
|
-
*/
|
|
73
82
|
export declare function getSkillTemplates(workflowFilter?: readonly string[]): SkillTemplateEntry[];
|
|
74
|
-
/**
|
|
75
|
-
* Gets command templates with their IDs, optionally filtered by workflow IDs.
|
|
76
|
-
*
|
|
77
|
-
* @param workflowFilter - If provided, only return templates whose id is in this array
|
|
78
|
-
*/
|
|
79
83
|
export declare function getCommandTemplates(workflowFilter?: readonly string[]): CommandTemplateEntry[];
|
|
80
|
-
/**
|
|
81
|
-
* Converts command templates to CommandContent array, optionally filtered by workflow IDs.
|
|
82
|
-
*
|
|
83
|
-
* @param workflowFilter - If provided, only return contents whose id is in this array
|
|
84
|
-
*/
|
|
85
84
|
export declare function getCommandContents(workflowFilter?: readonly string[]): CommandContent[];
|
|
86
|
-
/**
|
|
87
|
-
* Generates skill file content with YAML frontmatter.
|
|
88
|
-
*
|
|
89
|
-
* @param template - The skill template
|
|
90
|
-
* @param generatedByVersion - The Tospec version to embed in the file
|
|
91
|
-
* @param transformInstructions - Optional callback to transform the instructions content
|
|
92
|
-
*/
|
|
85
|
+
/** Renders a skill's YAML frontmatter plus its instructions. */
|
|
93
86
|
export declare function generateSkillContent(template: SkillTemplate, generatedByVersion: string, transformInstructions?: (instructions: string) => string): string;
|
|
94
87
|
/**
|
|
95
88
|
* Writes one skill directory: `SKILL.md` plus any `extraFiles` the template
|
|
96
89
|
* discloses beside it. The single writer for `.agents/skills/<dir>/`, shared by
|
|
97
|
-
* `init`, `update
|
|
90
|
+
* `init`, `update` and the `pnpm skills` dump, so a new sibling file cannot
|
|
98
91
|
* reach one path and miss another.
|
|
99
92
|
*/
|
|
100
93
|
export declare function writeSkillDir(skillsDir: string, dirName: string, template: SkillTemplate, generatedByVersion: string): Promise<void>;
|
|
101
94
|
/**
|
|
102
|
-
* Writes slash-command files for a tool that has a
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* Refreshes the tospec command directory first so deselected or renamed
|
|
107
|
-
* commands don't linger. Only removes a tospec-specific command dir, never a
|
|
108
|
-
* shared `commands/` directory.
|
|
109
|
-
*
|
|
110
|
-
* @param projectPath - Project root
|
|
111
|
-
* @param toolValue - Tool id (e.g. 'claude')
|
|
112
|
-
* @param workflowFilter - If provided, only these workflow ids get commands
|
|
95
|
+
* Writes slash-command files for a tool that has a command adapter (Claude Code
|
|
96
|
+
* writes `.claude/commands/tosx/<id>.md`, invocable as `/tosx:<id>`). A no-op
|
|
97
|
+
* for tools without one.
|
|
113
98
|
*/
|
|
114
99
|
export declare function writeToolCommands(projectPath: string, toolValue: string, workflowFilter?: readonly string[]): Promise<void>;
|
|
115
100
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-generation.d.ts","sourceRoot":"","sources":["../../../src/core/shared/skill-generation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"skill-generation.d.ts","sourceRoot":"","sources":["../../../src/core/shared/skill-generation.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EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill Generation Utilities
|
|
3
|
-
*
|
|
4
|
-
* Shared utilities for generating skill and command files.
|
|
5
|
-
*/
|
|
6
1
|
import { getExploreSkillTemplate, getGrillSkillTemplate, getTospecProposeSkillTemplate, getTospecIssueSkillTemplate, getTospecDecisionSkillTemplate, getTospecUpdateSkillTemplate, getTospecApplySkillTemplate, getTospecApplyWithTDDSkillTemplate, getTospecSyncSkillTemplate, getTospecArchiveSkillTemplate, getTospecExploreCommandTemplate, getTospecGrillCommandTemplate, getTospecProposeCommandTemplate, getTospecIssueCommandTemplate, getTospecDecisionCommandTemplate, getTospecUpdateCommandTemplate, getTospecApplyCommandTemplate, getTospecApplyWithTDDCommandTemplate, getTospecSyncCommandTemplate, getTospecArchiveCommandTemplate, } from '../templates/skill-templates.js';
|
|
7
2
|
import path from 'path';
|
|
8
3
|
import { promises as fs } from 'fs';
|
|
9
4
|
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
10
5
|
import { findCommandAdapter, generateCommands, } from '../command-generation/index.js';
|
|
11
6
|
import { escapeYamlValue } from '../command-generation/yaml.js';
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// template functions. ALL_WORKFLOWS, skill dir names, and both template lists
|
|
15
|
-
// derive from this array — adding a workflow means adding exactly one row.
|
|
16
|
-
// -----------------------------------------------------------------------------
|
|
7
|
+
// The one workflow registry. ALL_WORKFLOWS, skill dir names and both template
|
|
8
|
+
// lists derive from it, so adding a workflow is one row.
|
|
17
9
|
const WORKFLOW_DEFS = [
|
|
18
10
|
{ id: 'explore', skill: getExploreSkillTemplate, command: getTospecExploreCommandTemplate },
|
|
19
11
|
{ id: 'grill', skill: getGrillSkillTemplate, command: getTospecGrillCommandTemplate },
|
|
@@ -32,38 +24,92 @@ export function workflowSkillDirName(id) {
|
|
|
32
24
|
return `tospec-${id}`;
|
|
33
25
|
}
|
|
34
26
|
/**
|
|
35
|
-
*
|
|
27
|
+
* Every `tospec-<workflow>` the given selection's own prose names.
|
|
28
|
+
*
|
|
29
|
+
* `[a-z0-9-]+` is greedy on purpose, so `tospec-apply-with-tdd` reads as
|
|
30
|
+
* `apply-with-tdd` rather than `apply`; anything that is not a known workflow
|
|
31
|
+
* id (`tospec-cli`, a stray hyphenated word) is dropped by the caller.
|
|
32
|
+
*/
|
|
33
|
+
const WORKFLOW_REFERENCE = /tospec-([a-z0-9-]+)/g;
|
|
34
|
+
/**
|
|
35
|
+
* Skills a selection installs whose instructions send the agent to a workflow that
|
|
36
|
+
* selection leaves out.
|
|
37
|
+
*
|
|
38
|
+
* A custom profile is a subset and the prose is not: templates name sibling
|
|
39
|
+
* workflows unconditionally, so `propose,apply,archive` installs an archive
|
|
40
|
+
* skill saying "Run the `tospec-sync` workflow now" of a skill that is not
|
|
41
|
+
* there, and the agent improvises the step.
|
|
36
42
|
*
|
|
37
|
-
*
|
|
43
|
+
* Reported rather than corrected: the selection is the user's, and rewriting
|
|
44
|
+
* prose per profile would fork the installed text from the canonical template.
|
|
38
45
|
*/
|
|
46
|
+
export function findWorkflowReferenceGaps(selected) {
|
|
47
|
+
const selectedSet = new Set(selected);
|
|
48
|
+
const known = new Set(ALL_WORKFLOWS);
|
|
49
|
+
const gaps = [];
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
for (const workflow of WORKFLOW_DEFS) {
|
|
52
|
+
if (!selectedSet.has(workflow.id))
|
|
53
|
+
continue;
|
|
54
|
+
// Skill and command carry the same guidance in two renderings, and a
|
|
55
|
+
// reference in either reaches an agent.
|
|
56
|
+
const skill = workflow.skill();
|
|
57
|
+
const prose = [
|
|
58
|
+
skill.instructions,
|
|
59
|
+
...Object.values(skill.extraFiles ?? {}),
|
|
60
|
+
workflow.command().content,
|
|
61
|
+
].join('\n');
|
|
62
|
+
for (const [, referenced] of prose.matchAll(WORKFLOW_REFERENCE)) {
|
|
63
|
+
if (referenced === workflow.id)
|
|
64
|
+
continue;
|
|
65
|
+
if (!known.has(referenced) || selectedSet.has(referenced))
|
|
66
|
+
continue;
|
|
67
|
+
const key = `${workflow.id}->${referenced}`;
|
|
68
|
+
if (seen.has(key))
|
|
69
|
+
continue;
|
|
70
|
+
seen.add(key);
|
|
71
|
+
gaps.push({ from: workflow.id, missing: referenced });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return gaps;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One line per skill that points somewhere the selection does not install,
|
|
78
|
+
* e.g. `tospec-archive refers to tospec-sync`.
|
|
79
|
+
*/
|
|
80
|
+
export function describeWorkflowReferenceGaps(gaps) {
|
|
81
|
+
const byFrom = new Map();
|
|
82
|
+
for (const gap of gaps) {
|
|
83
|
+
const list = byFrom.get(gap.from) ?? [];
|
|
84
|
+
list.push(workflowSkillDirName(gap.missing));
|
|
85
|
+
byFrom.set(gap.from, list);
|
|
86
|
+
}
|
|
87
|
+
return [...byFrom.entries()]
|
|
88
|
+
.map(([from, missing]) => `${workflowSkillDirName(from)} refers to ${missing.join(', ')}`)
|
|
89
|
+
.join('; ');
|
|
90
|
+
}
|
|
91
|
+
/** An absent filter selects every workflow. */
|
|
92
|
+
function selectWorkflows(workflowFilter) {
|
|
93
|
+
if (!workflowFilter)
|
|
94
|
+
return WORKFLOW_DEFS;
|
|
95
|
+
const filterSet = new Set(workflowFilter);
|
|
96
|
+
return WORKFLOW_DEFS.filter((w) => filterSet.has(w.id));
|
|
97
|
+
}
|
|
39
98
|
export function getSkillTemplates(workflowFilter) {
|
|
40
|
-
|
|
41
|
-
return WORKFLOW_DEFS.filter((w) => !filterSet || filterSet.has(w.id)).map((w) => ({
|
|
99
|
+
return selectWorkflows(workflowFilter).map((w) => ({
|
|
42
100
|
template: w.skill(),
|
|
43
101
|
dirName: workflowSkillDirName(w.id),
|
|
44
102
|
workflowId: w.id,
|
|
45
103
|
}));
|
|
46
104
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Gets command templates with their IDs, optionally filtered by workflow IDs.
|
|
49
|
-
*
|
|
50
|
-
* @param workflowFilter - If provided, only return templates whose id is in this array
|
|
51
|
-
*/
|
|
52
105
|
export function getCommandTemplates(workflowFilter) {
|
|
53
|
-
|
|
54
|
-
return WORKFLOW_DEFS.filter((w) => !filterSet || filterSet.has(w.id)).map((w) => ({
|
|
106
|
+
return selectWorkflows(workflowFilter).map((w) => ({
|
|
55
107
|
template: w.command(),
|
|
56
108
|
id: w.id,
|
|
57
109
|
}));
|
|
58
110
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Converts command templates to CommandContent array, optionally filtered by workflow IDs.
|
|
61
|
-
*
|
|
62
|
-
* @param workflowFilter - If provided, only return contents whose id is in this array
|
|
63
|
-
*/
|
|
64
111
|
export function getCommandContents(workflowFilter) {
|
|
65
|
-
|
|
66
|
-
return commandTemplates.map(({ template, id }) => ({
|
|
112
|
+
return getCommandTemplates(workflowFilter).map(({ template, id }) => ({
|
|
67
113
|
id,
|
|
68
114
|
name: template.name,
|
|
69
115
|
description: template.description,
|
|
@@ -72,13 +118,7 @@ export function getCommandContents(workflowFilter) {
|
|
|
72
118
|
body: template.content,
|
|
73
119
|
}));
|
|
74
120
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Generates skill file content with YAML frontmatter.
|
|
77
|
-
*
|
|
78
|
-
* @param template - The skill template
|
|
79
|
-
* @param generatedByVersion - The Tospec version to embed in the file
|
|
80
|
-
* @param transformInstructions - Optional callback to transform the instructions content
|
|
81
|
-
*/
|
|
121
|
+
/** Renders a skill's YAML frontmatter plus its instructions. */
|
|
82
122
|
export function generateSkillContent(template, generatedByVersion, transformInstructions) {
|
|
83
123
|
const instructions = transformInstructions
|
|
84
124
|
? transformInstructions(template.instructions)
|
|
@@ -105,7 +145,7 @@ ${instructions}
|
|
|
105
145
|
/**
|
|
106
146
|
* Writes one skill directory: `SKILL.md` plus any `extraFiles` the template
|
|
107
147
|
* discloses beside it. The single writer for `.agents/skills/<dir>/`, shared by
|
|
108
|
-
* `init`, `update
|
|
148
|
+
* `init`, `update` and the `pnpm skills` dump, so a new sibling file cannot
|
|
109
149
|
* reach one path and miss another.
|
|
110
150
|
*/
|
|
111
151
|
export async function writeSkillDir(skillsDir, dirName, template, generatedByVersion) {
|
|
@@ -116,26 +156,17 @@ export async function writeSkillDir(skillsDir, dirName, template, generatedByVer
|
|
|
116
156
|
}
|
|
117
157
|
}
|
|
118
158
|
/**
|
|
119
|
-
* Writes slash-command files for a tool that has a
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* Refreshes the tospec command directory first so deselected or renamed
|
|
124
|
-
* commands don't linger. Only removes a tospec-specific command dir, never a
|
|
125
|
-
* shared `commands/` directory.
|
|
126
|
-
*
|
|
127
|
-
* @param projectPath - Project root
|
|
128
|
-
* @param toolValue - Tool id (e.g. 'claude')
|
|
129
|
-
* @param workflowFilter - If provided, only these workflow ids get commands
|
|
159
|
+
* Writes slash-command files for a tool that has a command adapter (Claude Code
|
|
160
|
+
* writes `.claude/commands/tosx/<id>.md`, invocable as `/tosx:<id>`). A no-op
|
|
161
|
+
* for tools without one.
|
|
130
162
|
*/
|
|
131
163
|
export async function writeToolCommands(projectPath, toolValue, workflowFilter) {
|
|
132
|
-
// Tools without a command adapter (Codex today) simply get no commands.
|
|
133
164
|
const adapter = findCommandAdapter(toolValue);
|
|
134
165
|
if (!adapter)
|
|
135
166
|
return;
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
167
|
+
// Wipe first so deselected or renamed commands do not linger, but only a
|
|
168
|
+
// tospec-owned namespace sub-dir: a flat adapter writes straight into a
|
|
169
|
+
// shared `commands/` dir alongside unrelated commands.
|
|
139
170
|
const commandBaseDir = path.dirname(adapter.getFilePath('_probe'));
|
|
140
171
|
if (path.basename(commandBaseDir) !== 'commands') {
|
|
141
172
|
await fs.rm(path.join(projectPath, commandBaseDir), { recursive: true, force: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-generation.js","sourceRoot":"","sources":["../../../src/core/shared/skill-generation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"skill-generation.js","sourceRoot":"","sources":["../../../src/core/shared/skill-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,kCAAkC,EAClC,0BAA0B,EAC1B,6BAA6B,EAC7B,+BAA+B,EAC/B,6BAA6B,EAC7B,+BAA+B,EAC/B,6BAA6B,EAC7B,gCAAgC,EAChC,8BAA8B,EAC9B,6BAA6B,EAC7B,oCAAoC,EACpC,4BAA4B,EAC5B,+BAA+B,GAEhC,MAAM,iCAAiC,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAEL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,8EAA8E;AAC9E,yDAAyD;AACzD,MAAM,aAAa,GAAG;IACpB,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,+BAA+B,EAAE;IAC3F,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,6BAA6B,EAAE;IACrF,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,6BAA6B,EAAE,OAAO,EAAE,+BAA+B,EAAE;IACjG,EAAE,EAAE,EAAE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