specdx 0.4.0-alpha.17 → 0.4.0-alpha.19

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.
Files changed (74) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +477 -0
  3. package/dist/{check-Q3QKTN2D.js → check-PRQNMBOE.js} +5 -5
  4. package/dist/{chunk-PEC5LAVE.js → chunk-5MYELBKF.js} +56 -21
  5. package/dist/chunk-5MYELBKF.js.map +1 -0
  6. package/dist/{chunk-V7JOVK6D.js → chunk-BD6UDHYW.js} +194 -39
  7. package/dist/chunk-BD6UDHYW.js.map +1 -0
  8. package/dist/{chunk-TJPPBM24.js → chunk-ERRUYMZO.js} +21 -18
  9. package/dist/chunk-ERRUYMZO.js.map +1 -0
  10. package/dist/{chunk-Z77VQUZ3.js → chunk-MM325DR6.js} +2 -2
  11. package/dist/chunk-RDNEANZB.js +103 -0
  12. package/dist/chunk-RDNEANZB.js.map +1 -0
  13. package/dist/{chunk-4HPWTWBL.js → chunk-RY5CDUNN.js} +12 -7
  14. package/dist/chunk-RY5CDUNN.js.map +1 -0
  15. package/dist/{chunk-TF7WSPFV.js → chunk-T232GZ2L.js} +2 -2
  16. package/dist/{chunk-SJCIM4TC.js → chunk-ZIPGRLYE.js} +3 -1
  17. package/dist/chunk-ZIPGRLYE.js.map +1 -0
  18. package/dist/{diff-IEN6W4OG.js → diff-PHEX3HUT.js} +4 -4
  19. package/dist/{dist-DVROIZAO.js → dist-M7X5RJB3.js} +19 -11
  20. package/dist/dist-M7X5RJB3.js.map +1 -0
  21. package/dist/{dist-SWJSMLIP.js → dist-X4CSVKKR.js} +2 -2
  22. package/dist/{generate-GQPOLFP7.js → generate-FIMBI2NW.js} +5 -5
  23. package/dist/{generate-story-UJS37FHA.js → generate-story-5TPTJA7B.js} +41 -18
  24. package/dist/generate-story-5TPTJA7B.js.map +1 -0
  25. package/dist/{generate-test-plan-RQTSGQLR.js → generate-test-plan-XBAFJKJI.js} +58 -9
  26. package/dist/generate-test-plan-XBAFJKJI.js.map +1 -0
  27. package/dist/{graph-OKUMHR3Q.js → graph-UZJMLX4J.js} +3 -3
  28. package/dist/index.d.ts +171 -0
  29. package/dist/index.js +201 -41
  30. package/dist/index.js.map +1 -1
  31. package/dist/{lint-VB5PV32N.js → lint-PUAQ2UL6.js} +4 -4
  32. package/dist/main.js +5 -90
  33. package/dist/main.js.map +1 -1
  34. package/dist/{mcp-DADOVCEV.js → mcp-WTO5PDIS.js} +6 -3
  35. package/dist/mcp-WTO5PDIS.js.map +1 -0
  36. package/dist/{migrate-LAMRDT3V.js → migrate-DEFCNOAH.js} +18 -7
  37. package/dist/migrate-DEFCNOAH.js.map +1 -0
  38. package/dist/{pack-B3KYRKUR.js → pack-PNLD5AYW.js} +4 -4
  39. package/dist/{ready-C6YXJ47W.js → ready-XIO2IPRE.js} +15 -6
  40. package/dist/ready-XIO2IPRE.js.map +1 -0
  41. package/dist/skills/core/specdx-author-spec/SKILL.md +1 -1
  42. package/dist/skills/core/specdx-author-spec/references/step-02-sections.md +41 -0
  43. package/dist/skills/core/specdx-router/SKILL.md +2 -2
  44. package/dist/skills/experimental/specdx-check-drift/SKILL.md +1 -1
  45. package/dist/skills/experimental/specdx-verify/SKILL.md +1 -1
  46. package/dist/{status-BRLCD7NY.js → status-BXOYBOH6.js} +5 -5
  47. package/dist/{update-P6TQUI6H.js → update-ELXABLVS.js} +4 -4
  48. package/dist/{validate-WIB246IE.js → validate-FXD5WS4C.js} +3 -3
  49. package/hooks/hooks.json +1 -1
  50. package/hooks/session-start +35 -3
  51. package/package.json +19 -6
  52. package/dist/chunk-4HPWTWBL.js.map +0 -1
  53. package/dist/chunk-PEC5LAVE.js.map +0 -1
  54. package/dist/chunk-SJCIM4TC.js.map +0 -1
  55. package/dist/chunk-TJPPBM24.js.map +0 -1
  56. package/dist/chunk-V7JOVK6D.js.map +0 -1
  57. package/dist/dist-DVROIZAO.js.map +0 -1
  58. package/dist/generate-story-UJS37FHA.js.map +0 -1
  59. package/dist/generate-test-plan-RQTSGQLR.js.map +0 -1
  60. package/dist/mcp-DADOVCEV.js.map +0 -1
  61. package/dist/migrate-LAMRDT3V.js.map +0 -1
  62. package/dist/ready-C6YXJ47W.js.map +0 -1
  63. /package/dist/{check-Q3QKTN2D.js.map → check-PRQNMBOE.js.map} +0 -0
  64. /package/dist/{chunk-Z77VQUZ3.js.map → chunk-MM325DR6.js.map} +0 -0
  65. /package/dist/{chunk-TF7WSPFV.js.map → chunk-T232GZ2L.js.map} +0 -0
  66. /package/dist/{diff-IEN6W4OG.js.map → diff-PHEX3HUT.js.map} +0 -0
  67. /package/dist/{dist-SWJSMLIP.js.map → dist-X4CSVKKR.js.map} +0 -0
  68. /package/dist/{generate-GQPOLFP7.js.map → generate-FIMBI2NW.js.map} +0 -0
  69. /package/dist/{graph-OKUMHR3Q.js.map → graph-UZJMLX4J.js.map} +0 -0
  70. /package/dist/{lint-VB5PV32N.js.map → lint-PUAQ2UL6.js.map} +0 -0
  71. /package/dist/{pack-B3KYRKUR.js.map → pack-PNLD5AYW.js.map} +0 -0
  72. /package/dist/{status-BRLCD7NY.js.map → status-BXOYBOH6.js.map} +0 -0
  73. /package/dist/{update-P6TQUI6H.js.map → update-ELXABLVS.js.map} +0 -0
  74. /package/dist/{validate-WIB246IE.js.map → validate-FXD5WS4C.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../schema/src/types.ts","../../schema/src/sections.ts","../../schema/src/validator.ts","../../schema/dist/schemas/base-spec.json","../../schema/dist/schemas/config.json","../../schema/dist/schemas/prd.json","../../schema/dist/schemas/technical-design.json","../../schema/dist/schemas/user-story.json","../../schema/dist/schemas/test-plan.json","../../schema/dist/schemas/adr.json","../../schema/dist/schemas/api-contract.json","../../schema/dist/schemas/epic.json","../../schema/dist/schemas/quick-spec.json","../../schema/dist/schemas/project-context.json"],"sourcesContent":["/**\n * The `version` a `spec.config.yaml` is expected to declare.\n *\n * The field was accepted with any value at all, so `migrate` printed whatever\n * it read and then said \"no migration needed\" regardless -- a config claiming\n * `0.9` passed as readily as a current one. A version field nothing checks is\n * a field that cannot do its job when a real migration arrives.\n */\nexport const SUPPORTED_CONFIG_VERSION = \"1.0\";\n\nexport const SPEC_TYPES = [\n \"prd\",\n \"technical-design\",\n \"user-story\",\n \"test-plan\",\n \"adr\",\n \"api-contract\",\n \"epic\",\n \"quick-spec\",\n \"project-context\",\n] as const;\nexport type SpecType = (typeof SPEC_TYPES)[number];\n\nexport const SPEC_STATUSES = [\"draft\", \"review\", \"approved\", \"superseded\"] as const;\nexport type SpecStatus = (typeof SPEC_STATUSES)[number];\n\n/**\n * Every relationship kind a spec may declare in frontmatter `references`.\n * Single source of truth — `base-spec.json`'s enum is drift-tested against it.\n */\nexport const SPEC_RELATIONSHIPS = [\n \"implemented-by\",\n \"decomposed-into\",\n \"depends-on\",\n \"supersedes\",\n \"related-to\",\n] as const;\nexport type SpecRelationship = (typeof SPEC_RELATIONSHIPS)[number];\n\n/**\n * Which relationship kinds imply a build dependency, and in which direction.\n *\n * Structural kinds are deliberately absent: `decomposed-into` describes a\n * parent/child split and `supersedes` describes lineage — neither means the\n * target depends on the source (issue #13). Declared here rather than in\n * `@specdx/core` so the taxonomy is versioned with the schema it belongs to\n * (ADR: references/requires unification).\n */\nexport const DEPENDENCY_RELATIONSHIPS: Partial<\n Record<SpecRelationship, \"self-requires-target\" | \"target-requires-self\">\n> = {\n \"depends-on\": \"self-requires-target\",\n \"implemented-by\": \"target-requires-self\",\n};\n\nexport interface SpecReference {\n id: string;\n relationship: SpecRelationship;\n}\n\n/** A checkable implementation artifact declared by a spec (issue #15). */\nexport interface SpecArtifact {\n /** Project-root-relative file path that must exist. */\n path: string;\n /** Names that must be exported from the file. */\n exports?: string[];\n}\n\nexport interface BaseSpec {\n id: string;\n type: SpecType;\n title: string;\n status: SpecStatus;\n version: string;\n created: string;\n updated?: string;\n authors: string[];\n tags?: string[];\n references?: SpecReference[];\n artifacts?: SpecArtifact[];\n}\n\nexport interface PrdSpec extends BaseSpec {\n type: \"prd\";\n}\nexport interface TechnicalDesignSpec extends BaseSpec {\n type: \"technical-design\";\n}\nexport interface UserStorySpec extends BaseSpec {\n type: \"user-story\";\n story_id: string;\n priority: \"critical\" | \"high\" | \"medium\" | \"low\";\n estimate: string;\n}\nexport interface TestPlanSpec extends BaseSpec {\n type: \"test-plan\";\n}\nexport interface AdrSpec extends BaseSpec {\n type: \"adr\";\n}\nexport interface ApiContractSpec extends BaseSpec {\n type: \"api-contract\";\n}\n\nexport interface EpicSpec extends BaseSpec {\n type: \"epic\";\n epic_id: string;\n priority: \"critical\" | \"high\" | \"medium\" | \"low\";\n}\n\nexport interface QuickSpecSpec extends BaseSpec {\n type: \"quick-spec\";\n}\n\nexport interface ProjectContextSpec extends BaseSpec {\n type: \"project-context\";\n}\n\nexport type Spec =\n | PrdSpec\n | TechnicalDesignSpec\n | UserStorySpec\n | TestPlanSpec\n | AdrSpec\n | ApiContractSpec\n | EpicSpec\n | QuickSpecSpec\n | ProjectContextSpec;\n\nexport interface SpecEntry {\n path: string;\n type: SpecType;\n required?: boolean;\n requires?: string[];\n owner?: string;\n}\n\nexport interface PackCompressionConfig {\n strip_boilerplate?: boolean;\n stable_days?: number;\n collapse_resolved_adrs?: boolean;\n}\n\nexport interface PackConfig {\n max_tokens?: number;\n format?: \"xml\" | \"markdown\" | \"json\";\n compression?: PackCompressionConfig;\n boilerplate_sections?: string[];\n}\n\nexport interface SdxConfig {\n version: string;\n project?: { name?: string; description?: string };\n specs: Record<string, SpecEntry>;\n lint?: {\n extends?: string;\n rules?: Record<string, unknown>;\n ignore?: string[];\n };\n pack?: PackConfig;\n diff?: {\n baseline_ref?: string;\n staleness_threshold_days?: number;\n ignore_paths?: string[];\n };\n ci?: {\n block_on?: (\"error\" | \"warn\" | \"info\")[];\n post_comment?: boolean;\n update_badge?: boolean;\n trigger_paths?: string[];\n };\n check?: {\n framework?: \"auto\" | \"express\" | \"hono\" | \"nextjs\";\n routes_dir?: string;\n app_dir?: string;\n types_dir?: string;\n tests_dir?: string;\n ignore?: string[];\n };\n}\n","import type { SpecType } from \"./types.js\";\n\nexport const REQUIRED_SECTIONS: Record<SpecType, string[]> = {\n prd: [\"Problem Statement\", \"Goals\", \"Non-Goals\", \"Features\", \"Success Criteria\"],\n \"technical-design\": [\n \"Overview\",\n \"Architecture\",\n \"Data Model\",\n \"API Design\",\n \"Dependencies\",\n \"Risks\",\n \"Open Questions\",\n ],\n \"user-story\": [\"Description\", \"Acceptance Criteria\", \"Dependencies\", \"Notes\"],\n \"test-plan\": [\"Scope\", \"Test Cases\", \"Coverage Matrix\", \"Edge Cases\"],\n adr: [\"Context\", \"Decision\", \"Status\", \"Consequences\"],\n \"api-contract\": [\"Endpoints\", \"Request/Response Schemas\", \"Auth\", \"Error Codes\"],\n epic: [\"Overview\", \"Stories\", \"Acceptance Criteria\", \"Dependencies\"],\n \"quick-spec\": [\"Intent\", \"Boundaries\", \"Tasks\"],\n \"project-context\": [\"Technology Stack\", \"Critical Implementation Rules\", \"Coding Patterns\"],\n};\n","import { Ajv as AjvClass, type ErrorObject } from \"ajv\";\nimport { SPEC_TYPES, type SpecType } from \"./types.js\";\n\nimport baseSpecSchema from \"./schemas/base-spec.json\" with { type: \"json\" };\nimport configSchema from \"./schemas/config.json\" with { type: \"json\" };\nimport prdSchema from \"./schemas/prd.json\" with { type: \"json\" };\nimport technicalDesignSchema from \"./schemas/technical-design.json\" with { type: \"json\" };\nimport userStorySchema from \"./schemas/user-story.json\" with { type: \"json\" };\nimport testPlanSchema from \"./schemas/test-plan.json\" with { type: \"json\" };\nimport adrSchema from \"./schemas/adr.json\" with { type: \"json\" };\nimport apiContractSchema from \"./schemas/api-contract.json\" with { type: \"json\" };\nimport epicSchema from \"./schemas/epic.json\" with { type: \"json\" };\nimport quickSpecSchema from \"./schemas/quick-spec.json\" with { type: \"json\" };\nimport projectContextSchema from \"./schemas/project-context.json\" with { type: \"json\" };\n\n// addFormats is CJS-only; access via the namespace default at runtime\n// The type cast is needed because TypeScript's NodeNext resolution exposes\n// the CJS module as a namespace without a callable default signature.\nimport * as addFormatsNs from \"ajv-formats\";\ntype AddFormatsPlugin = (ajv: AjvClass, formats?: unknown) => AjvClass;\nconst addFormats = ((addFormatsNs as unknown as { default?: AddFormatsPlugin }).default ??\n (addFormatsNs as unknown as AddFormatsPlugin)) as AddFormatsPlugin;\n\nexport interface ValidationResult {\n valid: boolean;\n errors: ErrorObject[] | null;\n}\n\n// The JSON schemas duplicate the spec-type enum for editor and schema-store\n// consumers. At runtime SPEC_TYPES is the single source of truth: the enums are\n// overwritten before compilation so the JSON copies can never drift from the\n// TypeScript types (see issue #2 — a stale enum shipped in 0.4.0-alpha.2).\nconst runtimeBaseSpecSchema = structuredClone(baseSpecSchema);\nruntimeBaseSpecSchema.properties.type.enum = [...SPEC_TYPES];\nconst runtimeConfigSchema = structuredClone(configSchema);\nruntimeConfigSchema.properties.specs.additionalProperties.properties.type.enum = [...SPEC_TYPES];\n\nconst ajv = new AjvClass({ allErrors: true, strict: true });\naddFormats(ajv, [\"date\"]);\najv.addSchema(runtimeBaseSpecSchema);\n\nconst specValidators: Record<string, ReturnType<typeof ajv.compile>> = {\n prd: ajv.compile(prdSchema),\n \"technical-design\": ajv.compile(technicalDesignSchema),\n \"user-story\": ajv.compile(userStorySchema),\n \"test-plan\": ajv.compile(testPlanSchema),\n adr: ajv.compile(adrSchema),\n \"api-contract\": ajv.compile(apiContractSchema),\n epic: ajv.compile(epicSchema),\n \"quick-spec\": ajv.compile(quickSpecSchema),\n \"project-context\": ajv.compile(projectContextSchema),\n};\n\nconst configValidator = ajv.compile(runtimeConfigSchema);\n\nexport function validateSpec(type: SpecType, data: Record<string, unknown>): ValidationResult {\n const validate = specValidators[type];\n if (!validate) {\n return { valid: false, errors: [{ message: `Unknown spec type: \"${type}\"` } as ErrorObject] };\n }\n const valid = validate(data);\n return { valid: !!valid, errors: valid ? null : (validate.errors ?? null) };\n}\n\nexport function validateConfig(data: Record<string, unknown>): ValidationResult {\n const valid = configValidator(data);\n return { valid: !!valid, errors: valid ? null : (configValidator.errors ?? null) };\n}\n","{\n \"$id\": \"base-spec\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"prd\",\n \"technical-design\",\n \"user-story\",\n \"test-plan\",\n \"adr\",\n \"api-contract\",\n \"epic\",\n \"quick-spec\",\n \"project-context\"\n ]\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"draft\",\n \"review\",\n \"approved\",\n \"superseded\"\n ]\n },\n \"version\": {\n \"type\": \"string\"\n },\n \"created\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"updated\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"authors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"minItems\": 1\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"default\": []\n },\n \"references\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"relationship\": {\n \"type\": \"string\",\n \"enum\": [\n \"implemented-by\",\n \"decomposed-into\",\n \"depends-on\",\n \"supersedes\",\n \"related-to\"\n ]\n }\n },\n \"required\": [\n \"id\",\n \"relationship\"\n ],\n \"additionalProperties\": false\n },\n \"default\": []\n },\n \"artifacts\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"path\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"exports\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n }\n },\n \"required\": [\n \"path\"\n ],\n \"additionalProperties\": false\n },\n \"default\": []\n }\n },\n \"required\": [\n \"id\",\n \"type\",\n \"title\",\n \"status\",\n \"version\",\n \"created\",\n \"authors\"\n ],\n \"additionalProperties\": true\n}\n","{\n \"$id\": \"sdx-config\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"version\": { \"type\": \"string\" },\n \"project\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" }\n },\n \"additionalProperties\": false\n },\n \"specs\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"properties\": {\n \"path\": { \"type\": \"string\" },\n \"type\": { \"type\": \"string\", \"enum\": [\"prd\", \"technical-design\", \"user-story\", \"test-plan\", \"adr\", \"api-contract\", \"epic\", \"quick-spec\", \"project-context\"] },\n \"required\": { \"type\": \"boolean\", \"default\": false },\n \"requires\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"owner\": { \"type\": \"string\" }\n },\n \"required\": [\"path\", \"type\"],\n \"additionalProperties\": false\n }\n },\n \"lint\": {\n \"type\": \"object\",\n \"properties\": {\n \"extends\": { \"type\": \"string\" },\n \"rules\": { \"type\": \"object\" },\n \"ignore\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n },\n \"additionalProperties\": false\n },\n \"pack\": {\n \"type\": \"object\",\n \"properties\": {\n \"max_tokens\": { \"type\": \"integer\", \"minimum\": 1 },\n \"format\": { \"type\": \"string\", \"enum\": [\"xml\", \"markdown\", \"json\"] },\n \"compression\": {\n \"type\": \"object\",\n \"properties\": {\n \"strip_boilerplate\": { \"type\": \"boolean\" },\n \"stable_days\": { \"type\": \"integer\", \"minimum\": 0 },\n \"collapse_resolved_adrs\": { \"type\": \"boolean\" }\n },\n \"additionalProperties\": false\n },\n \"boilerplate_sections\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n },\n \"diff\": {\n \"type\": \"object\",\n \"properties\": {\n \"baseline_ref\": { \"type\": \"string\", \"default\": \"main\" },\n \"staleness_threshold_days\": { \"type\": \"integer\", \"minimum\": 1, \"default\": 14 },\n \"ignore_paths\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n },\n \"additionalProperties\": false\n },\n \"ci\": {\n \"type\": \"object\",\n \"properties\": {\n \"block_on\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\", \"enum\": [\"error\", \"warn\", \"info\"] }\n },\n \"post_comment\": { \"type\": \"boolean\", \"default\": true },\n \"update_badge\": { \"type\": \"boolean\", \"default\": true },\n \"trigger_paths\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n },\n \"check\": {\n \"type\": \"object\",\n \"properties\": {\n \"framework\": {\n \"type\": \"string\",\n \"enum\": [\"auto\", \"express\", \"hono\", \"nextjs\"]\n },\n \"routes_dir\": { \"type\": \"string\" },\n \"app_dir\": { \"type\": \"string\" },\n \"types_dir\": { \"type\": \"string\" },\n \"tests_dir\": { \"type\": \"string\" },\n \"ignore\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n }\n },\n \"required\": [\"version\", \"specs\"],\n \"additionalProperties\": false\n}\n","{\n \"$id\": \"prd\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"prd\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"technical-design\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"technical-design\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"user-story\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"user-story\" },\n \"story_id\": { \"type\": \"string\", \"minLength\": 1 },\n \"priority\": { \"type\": \"string\", \"enum\": [\"critical\", \"high\", \"medium\", \"low\"] },\n \"estimate\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"story_id\", \"priority\", \"estimate\"]\n }\n ]\n}\n","{\n \"$id\": \"test-plan\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"test-plan\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"adr\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"adr\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"api-contract\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"api-contract\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"epic\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"epic\" },\n \"epic_id\": { \"type\": \"string\", \"minLength\": 1 },\n \"priority\": { \"type\": \"string\", \"enum\": [\"critical\", \"high\", \"medium\", \"low\"] }\n },\n \"required\": [\"type\", \"epic_id\", \"priority\"]\n }\n ]\n}\n","{\n \"$id\": \"quick-spec\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"quick-spec\" }\n },\n \"required\": [\"type\"]\n }\n ]\n}\n","{\n \"$id\": \"project-context\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"project-context\" }\n },\n \"required\": [\"type\"]\n }\n ]\n}\n"],"mappings":";AAQO,IAAM,2BAA2B;AAEjC,IAAM,aAAa;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AA6BK,IAAM,2BAET;EACF,cAAc;EACd,kBAAkB;;;;AClDb,IAAM,oBAAgD;EAC3D,KAAK,CAAC,qBAAqB,SAAS,aAAa,YAAY,kBAAkB;EAC/E,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF,cAAc,CAAC,eAAe,uBAAuB,gBAAgB,OAAO;EAC5E,aAAa,CAAC,SAAS,cAAc,mBAAmB,YAAY;EACpE,KAAK,CAAC,WAAW,YAAY,UAAU,cAAc;EACrD,gBAAgB,CAAC,aAAa,4BAA4B,QAAQ,aAAa;EAC/E,MAAM,CAAC,YAAY,WAAW,uBAAuB,cAAc;EACnE,cAAc,CAAC,UAAU,cAAc,OAAO;EAC9C,mBAAmB,CAAC,oBAAoB,iCAAiC,iBAAiB;;;;ACnB5F,SAAS,OAAO,gBAAkC;;;ACAlD;AAAA,EACE,KAAO;AAAA,EACP,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,YAAc;AAAA,IACZ,IAAM;AAAA,MACJ,MAAQ;AAAA,MACR,WAAa;AAAA,IACf;AAAA,IACA,MAAQ;AAAA,MACN,MAAQ;AAAA,MACR,MAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,OAAS;AAAA,MACP,MAAQ;AAAA,MACR,WAAa;AAAA,IACf;AAAA,IACA,QAAU;AAAA,MACR,MAAQ;AAAA,MACR,MAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA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AC;EAC7F;AACA,QAAM,QAAQ,SAAS,IAAI;AAC3B,SAAO,EAAE,OAAO,CAAC,CAAC,OAAO,QAAQ,QAAQ,OAAQ,SAAS,UAAU,KAAK;AAC3E;AAEM,SAAU,eAAe,MAA6B;AAC1D,QAAM,QAAQ,gBAAgB,IAAI;AAClC,SAAO,EAAE,OAAO,CAAC,CAAC,OAAO,QAAQ,QAAQ,OAAQ,gBAAgB,UAAU,KAAK;AAClF;","names":[]}
@@ -2,11 +2,11 @@ import {
2
2
  DEFAULT_DIFF_CONFIG,
3
3
  DiffError,
4
4
  diffBetweenRefs
5
- } from "./chunk-4HPWTWBL.js";
5
+ } from "./chunk-RY5CDUNN.js";
6
6
  import {
7
7
  loadConfig
8
- } from "./chunk-Z77VQUZ3.js";
9
- import "./chunk-SJCIM4TC.js";
8
+ } from "./chunk-MM325DR6.js";
9
+ import "./chunk-ZIPGRLYE.js";
10
10
  import "./chunk-5WRI5ZAA.js";
11
11
 
12
12
  // src/commands/core/diff.ts
@@ -185,4 +185,4 @@ export {
185
185
  diff_default as default,
186
186
  runDiff
187
187
  };
188
- //# sourceMappingURL=diff-IEN6W4OG.js.map
188
+ //# sourceMappingURL=diff-PHEX3HUT.js.map
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  runCheck
3
- } from "./chunk-PEC5LAVE.js";
3
+ } from "./chunk-5MYELBKF.js";
4
4
  import {
5
5
  pack
6
- } from "./chunk-TF7WSPFV.js";
6
+ } from "./chunk-T232GZ2L.js";
7
7
  import {
8
8
  createLintEngine,
9
9
  getPreset
10
- } from "./chunk-V7JOVK6D.js";
10
+ } from "./chunk-BD6UDHYW.js";
11
11
  import {
12
12
  DEFAULT_DIFF_CONFIG,
13
13
  DiffError,
14
14
  diffBetweenRefs
15
- } from "./chunk-4HPWTWBL.js";
15
+ } from "./chunk-RY5CDUNN.js";
16
16
  import {
17
17
  ConfigError,
18
18
  GraphError,
@@ -22,8 +22,8 @@ import {
22
22
  loadConfig,
23
23
  parseSpec,
24
24
  resolveGlob
25
- } from "./chunk-Z77VQUZ3.js";
26
- import "./chunk-SJCIM4TC.js";
25
+ } from "./chunk-MM325DR6.js";
26
+ import "./chunk-ZIPGRLYE.js";
27
27
  import "./chunk-5WRI5ZAA.js";
28
28
 
29
29
  // ../mcp/dist/server.js
@@ -36,9 +36,14 @@ async function handleValidate(params) {
36
36
  const configDir = params.configPath ?? process.cwd();
37
37
  const config = await loadConfig(void 0, configDir);
38
38
  buildGraph(config);
39
+ let specFiles = 0;
40
+ for (const entry of Object.values(config.specs)) {
41
+ specFiles += (await resolveGlob(entry.path, configDir)).length;
42
+ }
39
43
  return JSON.stringify({
40
44
  valid: true,
41
- specCount: Object.keys(config.specs).length,
45
+ specEntries: Object.keys(config.specs).length,
46
+ specFiles,
42
47
  project: config.project?.name ?? "unknown"
43
48
  });
44
49
  } catch (err) {
@@ -161,7 +166,10 @@ async function handleStatus() {
161
166
  verdict = "unassessed";
162
167
  return JSON.stringify({
163
168
  project: config.project?.name ?? "unknown",
164
- specCount: specs.length,
169
+ // `specFiles` only. A second field named `specCount` gives a consumer no
170
+ // way to know whether it counts config entries or resolved files -- the
171
+ // ambiguity `sdx_validate` was already cleaned up to avoid.
172
+ specFiles: specs.length,
165
173
  byStatus,
166
174
  lintHealth: { errors, warnings, passing: specs.length - errors },
167
175
  staleSpecs,
@@ -260,10 +268,10 @@ async function handleGraph(params) {
260
268
  }
261
269
 
262
270
  // ../mcp/dist/server.js
263
- function createMcpServer() {
271
+ function createMcpServer(version = "0.0.0-unknown") {
264
272
  const server = new McpServer({
265
273
  name: "specdx",
266
- version: "0.4.0"
274
+ version
267
275
  });
268
276
  server.tool("sdx_validate", "Validate the spec.config.yaml configuration file", { configPath: z.string().optional().describe("Path to config directory") }, async (params) => ({
269
277
  content: [{ type: "text", text: await handleValidate(params) }]
@@ -307,4 +315,4 @@ function createMcpServer() {
307
315
  export {
308
316
  createMcpServer
309
317
  };
310
- //# sourceMappingURL=dist-DVROIZAO.js.map
318
+ //# sourceMappingURL=dist-M7X5RJB3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../mcp/src/server.ts","../../mcp/src/tools/validate.ts","../../mcp/src/tools/lint.ts","../../mcp/src/tools/pack.ts","../../mcp/src/tools/status.ts","../../mcp/src/tools/check.ts","../../mcp/src/tools/diff.ts","../../mcp/src/tools/graph.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { handleValidate } from \"./tools/validate.js\";\nimport { handleLint } from \"./tools/lint.js\";\nimport { handlePack } from \"./tools/pack.js\";\nimport { handleStatus } from \"./tools/status.js\";\nimport { handleCheck } from \"./tools/check.js\";\nimport { handleDiff } from \"./tools/diff.js\";\nimport { handleGraph } from \"./tools/graph.js\";\n\n/**\n * Build the MCP server.\n *\n * `version` is passed in rather than hardcoded: a literal here advertised\n * `0.4.0` from every prerelease build, so every MCP client logged a version\n * that was never published. The CLI owns the real number and hands it over.\n */\nexport function createMcpServer(version = \"0.0.0-unknown\"): McpServer {\n const server = new McpServer({\n name: \"specdx\",\n version,\n });\n\n server.tool(\n \"sdx_validate\",\n \"Validate the spec.config.yaml configuration file\",\n { configPath: z.string().optional().describe(\"Path to config directory\") },\n async (params) => ({\n content: [{ type: \"text\" as const, text: await handleValidate(params) }],\n }),\n );\n\n server.tool(\n \"sdx_lint\",\n \"Run lint rules against the spec suite\",\n {\n preset: z.string().optional().describe(\"Lint preset: minimal, recommended, strict\"),\n specPath: z.string().optional().describe(\"Lint a specific spec file\"),\n },\n async (params) => ({\n content: [{ type: \"text\" as const, text: await handleLint(params) }],\n }),\n );\n\n server.tool(\n \"sdx_pack\",\n \"Pack spec context for LLM consumption within a token budget\",\n {\n task: z.string().optional().describe(\"Task description for relevance scoring\"),\n format: z.string().optional().describe(\"Output format: xml, markdown, json\"),\n budget: z.number().optional().describe(\"Token budget (default: 12000)\"),\n },\n async (params) => ({\n content: [{ type: \"text\" as const, text: await handlePack(params) }],\n }),\n );\n\n server.tool(\n \"sdx_status\",\n \"Get spec suite health overview (lint health, staleness, integrity)\",\n {},\n async () => ({\n content: [{ type: \"text\" as const, text: await handleStatus() }],\n }),\n );\n\n server.tool(\n \"sdx_check\",\n \"Run spec-to-implementation drift analysis\",\n {\n framework: z.string().optional().describe(\"Framework: express, hono, nextjs\"),\n specId: z.string().optional().describe(\"Check a specific spec by ID\"),\n },\n async (params) => ({\n content: [{ type: \"text\" as const, text: await handleCheck(params) }],\n }),\n );\n\n server.tool(\n \"sdx_diff\",\n \"Show spec changes and downstream impact between git refs\",\n {\n base: z.string().optional().describe(\"Base git ref (default: main)\"),\n head: z.string().optional().describe(\"Head git ref (default: HEAD)\"),\n working: z\n .boolean()\n .optional()\n .describe(\n \"Compare the base ref against the working tree, including uncommitted and untracked specs (default: false)\",\n ),\n },\n async (params) => ({\n content: [{ type: \"text\" as const, text: await handleDiff(params) }],\n }),\n );\n\n server.tool(\n \"sdx_graph\",\n \"Get the spec dependency graph\",\n {\n format: z.string().optional().describe(\"Output format: json (default) or dot\"),\n },\n async (params) => ({\n content: [{ type: \"text\" as const, text: await handleGraph(params) }],\n }),\n );\n\n return server;\n}\n","import { loadConfig, buildGraph, resolveGlob, ConfigError, GraphError } from \"@specdx/core\";\n\nexport async function handleValidate(params: { configPath?: string }): Promise<string> {\n try {\n const configDir = params.configPath ?? process.cwd();\n const config = await loadConfig(undefined, configDir);\n // A cyclic or dangling requires chain is an invalid config (issue #13).\n buildGraph(config);\n // `specEntries` and `specFiles` are distinct: one glob entry can resolve to\n // many files. Reporting either as a bare `specCount` put this tool and\n // sdx_status in direct contradiction for the same project.\n let specFiles = 0;\n for (const entry of Object.values(config.specs)) {\n specFiles += (await resolveGlob(entry.path, configDir)).length;\n }\n\n return JSON.stringify({\n valid: true,\n specEntries: Object.keys(config.specs).length,\n specFiles,\n project: config.project?.name ?? \"unknown\",\n });\n } catch (err) {\n if (err instanceof ConfigError) {\n return JSON.stringify({ valid: false, error: err.message, details: err.errors });\n }\n if (err instanceof GraphError) {\n return JSON.stringify({ valid: false, error: err.message });\n }\n throw err;\n }\n}\n","import { loadConfig, parseSpec, resolveGlob, buildGraph } from \"@specdx/core\";\nimport { createLintEngine, getPreset } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\n\nexport async function handleLint(params: { preset?: string; specPath?: string }): Promise<string> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n const preset = params.preset ?? config.lint?.extends ?? \"recommended\";\n const rules = getPreset(preset);\n\n const specs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const files = await resolveGlob(entry.path, configDir);\n for (const file of files) {\n if (params.specPath && !file.includes(params.specPath)) continue;\n specs.push(await parseSpec(file));\n }\n }\n\n let graph;\n try {\n graph = buildGraph(config);\n } catch {\n // non-fatal\n }\n\n const engine = createLintEngine({ rules, config, graph });\n const results = engine.lint(specs);\n\n return JSON.stringify({\n diagnostics: results.diagnostics,\n hasErrors: results.hasErrors,\n hasWarnings: results.hasWarnings,\n specsChecked: specs.length,\n });\n}\n","import { loadConfig, parseSpec, resolveGlob, buildGraph } from \"@specdx/core\";\nimport { pack } from \"@specdx/pack\";\nimport type { ParsedSpec } from \"@specdx/core\";\n\nexport async function handlePack(params: {\n task?: string;\n format?: string;\n budget?: number;\n}): Promise<string> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const allSpecs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const files = await resolveGlob(entry.path, configDir);\n for (const file of files) {\n allSpecs.push(await parseSpec(file));\n }\n }\n\n let graph;\n try {\n graph = buildGraph(config);\n } catch {\n // non-fatal\n }\n\n const result = pack(\n allSpecs,\n {\n task: params.task,\n budget: params.budget,\n format: (params.format as \"xml\" | \"markdown\" | \"json\") ?? undefined,\n },\n config.pack,\n graph,\n );\n\n return result.output;\n}\n","import { loadConfig, parseSpec, resolveGlob, buildGraph } from \"@specdx/core\";\nimport { createLintEngine, getPreset } from \"@specdx/lint\";\nimport { DEFAULT_DIFF_CONFIG } from \"@specdx/diff\";\nimport type { ParsedSpec } from \"@specdx/core\";\n\nexport async function handleStatus(): Promise<string> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const specs: { spec: ParsedSpec; entry: { path: string; owner?: string } }[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n specs.push({ spec, entry: entry as { path: string; owner?: string } });\n }\n }\n\n const byStatus: Record<string, number> = {};\n for (const { spec } of specs) {\n const status = (spec.frontmatter.status as string) || \"unknown\";\n byStatus[status] = (byStatus[status] ?? 0) + 1;\n }\n\n const presetName = config.lint?.extends ?? \"recommended\";\n const rules = getPreset(presetName);\n\n let graph;\n let graphError: string | undefined;\n try {\n graph = buildGraph(config);\n } catch (err) {\n graphError = (err as Error).message;\n }\n\n const engine = createLintEngine({ rules, config, graph });\n const lintResults = engine.lint(specs.map((s) => s.spec));\n\n const errors = lintResults.diagnostics.filter((d) => d.severity === \"error\").length;\n const warnings = lintResults.diagnostics.filter((d) => d.severity === \"warn\").length;\n\n const thresholdDays =\n config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;\n const now = Date.now();\n const staleSpecs: { specId: string; daysSinceUpdate: number; owner?: string }[] = [];\n for (const { spec, entry } of specs) {\n const dateStr =\n (spec.frontmatter.updated as string | undefined) ||\n (spec.frontmatter.created as string | undefined);\n if (dateStr) {\n const days = Math.floor((now - new Date(dateStr).getTime()) / (1000 * 60 * 60 * 24));\n if (days > thresholdDays) {\n staleSpecs.push({\n specId: spec.frontmatter.id as string,\n daysSinceUpdate: days,\n owner: entry.owner,\n });\n }\n }\n }\n\n // An empty suite is unassessed, never a vacuous \"healthy\" (vacuous-pass audit)\n let verdict: \"healthy\" | \"warnings\" | \"errors\" | \"unassessed\" = \"healthy\";\n if (errors > 0 || graphError) verdict = \"errors\";\n else if (warnings > 0 || staleSpecs.length > 0) verdict = \"warnings\";\n else if (specs.length === 0) verdict = \"unassessed\";\n\n return JSON.stringify({\n project: config.project?.name ?? \"unknown\",\n // `specFiles` only. A second field named `specCount` gives a consumer no\n // way to know whether it counts config entries or resolved files -- the\n // ambiguity `sdx_validate` was already cleaned up to avoid.\n specFiles: specs.length,\n byStatus,\n lintHealth: { errors, warnings, passing: specs.length - errors },\n staleSpecs,\n integrityIssues: graphError ? [graphError] : [],\n verdict,\n });\n}\n","import { loadConfig, parseSpec, resolveGlob } from \"@specdx/core\";\nimport { runCheck } from \"@specdx/check\";\nimport type { ParsedSpec } from \"@specdx/core\";\n\nexport async function handleCheck(params: {\n framework?: string;\n specId?: string;\n}): Promise<string> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const specs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n if (params.specId && spec.frontmatter.id !== params.specId) continue;\n specs.push(spec);\n }\n }\n\n const checkConfig = {\n ...config.check,\n ...(params.framework ? { framework: params.framework as \"express\" | \"hono\" | \"nextjs\" } : {}),\n };\n\n const result = await runCheck(specs, configDir, checkConfig);\n return JSON.stringify(result);\n}\n","import { join } from \"node:path\";\nimport { loadConfig } from \"@specdx/core\";\nimport { diffBetweenRefs, DEFAULT_DIFF_CONFIG, DiffError } from \"@specdx/diff\";\n\nexport async function handleDiff(params: {\n base?: string;\n head?: string;\n working?: boolean;\n}): Promise<string> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n const baseRef = params.base ?? config.diff?.baseline_ref ?? DEFAULT_DIFF_CONFIG.baseline_ref;\n const headRef = params.head ?? \"HEAD\";\n const configPath = join(configDir, \"spec.config.yaml\");\n\n try {\n const result = await diffBetweenRefs(configPath, baseRef, headRef, {\n working: params.working ?? false,\n });\n return JSON.stringify(result);\n } catch (err) {\n if (err instanceof DiffError) {\n return JSON.stringify({ error: err.message });\n }\n throw err;\n }\n}\n","import {\n loadConfig,\n buildGraph,\n GraphError,\n parseSpec,\n resolveGlob,\n collectReferenceEdges,\n findUnreflectedReferences,\n} from \"@specdx/core\";\nimport type { ParsedSpec } from \"@specdx/core\";\n\nexport async function handleGraph(params: { format?: string }): Promise<string> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n try {\n const graph = buildGraph(config);\n const sorted = graph.topologicalSort();\n\n const idToEntry = new Map<string, string>();\n const specs: ParsedSpec[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n specs.push(spec);\n if (typeof spec.frontmatter.id === \"string\") {\n idToEntry.set(spec.frontmatter.id, key);\n }\n }\n }\n const referenceEdges = collectReferenceEdges(specs);\n const unreflectedReferences = findUnreflectedReferences(referenceEdges, idToEntry, graph);\n\n if (params.format === \"dot\") {\n const lines = [\"digraph specs {\"];\n for (const edge of graph.edges) lines.push(` \"${edge.from}\" -> \"${edge.to}\";`);\n for (const ref of referenceEdges) {\n lines.push(\n ` \"${ref.fromId}\" -> \"${ref.toId}\" [style=dashed, label=\"${ref.relationship}\"];`,\n );\n }\n lines.push(\"}\");\n return lines.join(\"\\n\");\n }\n\n return JSON.stringify({\n nodes: sorted,\n edges: graph.edges,\n downstream: Object.fromEntries(sorted.map((n) => [n, graph.getDownstream(n)])),\n referenceEdges,\n unreflectedReferences,\n });\n } catch (err) {\n if (err instanceof GraphError) {\n return JSON.stringify({ error: err.message });\n }\n throw err;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,SAAS;;;ACClB,eAAsB,eAAe,QAA+B;AAClE,MAAI;AACF,UAAM,YAAY,OAAO,cAAc,QAAQ,IAAG;AAClD,UAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AAEpD,eAAW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C;KAE/E,OAAO,YAAY;IACjB,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,MAAM,YAAY,MAAM,EAAC,CAAE;IACpE;AAGJ,SAAO;AACT;","names":[]}
@@ -4,7 +4,7 @@ import {
4
4
  detectFramework,
5
5
  parseArtifacts,
6
6
  runCheck
7
- } from "./chunk-PEC5LAVE.js";
7
+ } from "./chunk-5MYELBKF.js";
8
8
  import "./chunk-5WRI5ZAA.js";
9
9
  export {
10
10
  analyzeWithAi,
@@ -13,4 +13,4 @@ export {
13
13
  parseArtifacts,
14
14
  runCheck
15
15
  };
16
- //# sourceMappingURL=dist-SWJSMLIP.js.map
16
+ //# sourceMappingURL=dist-X4CSVKKR.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  labelled
3
- } from "./chunk-TJPPBM24.js";
4
- import "./chunk-SJCIM4TC.js";
3
+ } from "./chunk-ERRUYMZO.js";
4
+ import "./chunk-ZIPGRLYE.js";
5
5
  import "./chunk-5WRI5ZAA.js";
6
6
 
7
7
  // src/commands/core/generate.ts
@@ -9,8 +9,8 @@ import { defineCommand } from "citty";
9
9
  var generate_default = defineCommand({
10
10
  meta: { name: "generate", description: "Generate spec stubs from existing specs" },
11
11
  subCommands: {
12
- story: () => import("./generate-story-UJS37FHA.js").then((m) => labelled("generate story", m.default)),
13
- "test-plan": () => import("./generate-test-plan-RQTSGQLR.js").then(
12
+ story: () => import("./generate-story-5TPTJA7B.js").then((m) => labelled("generate story", m.default)),
13
+ "test-plan": () => import("./generate-test-plan-XBAFJKJI.js").then(
14
14
  (m) => labelled("generate test-plan", m.default)
15
15
  )
16
16
  }
@@ -18,4 +18,4 @@ var generate_default = defineCommand({
18
18
  export {
19
19
  generate_default as default
20
20
  };
21
- //# sourceMappingURL=generate-GQPOLFP7.js.map
21
+ //# sourceMappingURL=generate-FIMBI2NW.js.map
@@ -1,12 +1,16 @@
1
+ import {
2
+ parseFeatureEntries,
3
+ uncoveredFeatures
4
+ } from "./chunk-BD6UDHYW.js";
1
5
  import {
2
6
  createLogger,
3
7
  loadConfig,
4
8
  parseSpec,
5
9
  resolveGlob
6
- } from "./chunk-Z77VQUZ3.js";
10
+ } from "./chunk-MM325DR6.js";
7
11
  import {
8
12
  REQUIRED_SECTIONS
9
- } from "./chunk-SJCIM4TC.js";
13
+ } from "./chunk-ZIPGRLYE.js";
10
14
  import "./chunk-5WRI5ZAA.js";
11
15
 
12
16
  // src/commands/core/generate-story.ts
@@ -102,26 +106,38 @@ async function generateStories(options) {
102
106
  throw new Error(`No spec with id "${from}" found in config.`);
103
107
  }
104
108
  const prd = await parseSpec(prdFilePath);
105
- const featuresSection = prd.parsedSections.find((s) => s.heading === "Features");
106
- if (!featuresSection) {
107
- return { generated: [] };
108
- }
109
- const featureRegex = /\*\*F(\d+)\*\*:\s*(.+)/g;
110
- const features = [];
111
- let match;
112
- while ((match = featureRegex.exec(featuresSection.content)) !== null) {
113
- features.push({ num: match[1], text: match[2] });
114
- }
109
+ const entries = parseFeatureEntries(prd.content);
110
+ const features = entries.map((entry, i) => ({
111
+ // Un-numbered features still need a stable filename, so fall back to
112
+ // position. Authors who do use `**F<N>**:` keep their numbering.
113
+ num: entry.num ?? String(i + 1),
114
+ text: entry.text
115
+ }));
115
116
  if (features.length === 0) {
116
- return { generated: [] };
117
+ return { generated: [], skipped: [] };
117
118
  }
118
119
  const storiesDir = outDir ?? detectStoriesDir(configDir, config);
119
120
  await mkdir(storiesDir, { recursive: true });
120
121
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
121
122
  const prdAuthors = prd.frontmatter.authors ?? [];
122
123
  const sections = REQUIRED_SECTIONS["user-story"];
124
+ const existingStories = [];
125
+ for (const entry of Object.values(config.specs)) {
126
+ if (entry.type !== "user-story") continue;
127
+ for (const p of await resolveGlob(entry.path, configDir)) {
128
+ existingStories.push(await parseSpec(p));
129
+ }
130
+ }
131
+ const uncovered = new Set(
132
+ uncoveredFeatures(
133
+ features.map((f) => f.text),
134
+ existingStories,
135
+ from
136
+ )
137
+ );
138
+ const skipped = features.filter((f) => !uncovered.has(f.text)).map((f) => f.text);
123
139
  const generated = [];
124
- for (const feature of features) {
140
+ for (const feature of features.filter((f) => uncovered.has(f.text))) {
125
141
  const slug = slugify(feature.text);
126
142
  const filename = `story-f${feature.num}-${slug}.md`;
127
143
  const filePath = join(storiesDir, filename);
@@ -136,11 +152,11 @@ async function generateStories(options) {
136
152
  await writeFile(filePath, content, "utf-8");
137
153
  generated.push(filePath);
138
154
  }
139
- return { generated };
155
+ return { generated, skipped };
140
156
  }
141
157
  var defineCommandExport = defineCommand({
142
158
  meta: {
143
- name: "generate story",
159
+ name: "story",
144
160
  description: "Generate user story stub files from a PRD's Features section"
145
161
  },
146
162
  args: {
@@ -172,13 +188,20 @@ var defineCommandExport = defineCommand({
172
188
  from: args.from,
173
189
  outDir: args.out
174
190
  });
175
- if (result.generated.length === 0) {
191
+ if (result.generated.length === 0 && result.skipped.length > 0) {
192
+ logger.info(
193
+ `Every feature already has a story \u2014 ${result.skipped.length} feature(s) skipped, nothing generated.`
194
+ );
195
+ } else if (result.generated.length === 0) {
176
196
  logger.info("No features found in PRD \u2014 no story stubs generated.");
177
197
  } else {
178
198
  logger.info(`Generated ${result.generated.length} story stub(s):`);
179
199
  for (const filePath of result.generated) {
180
200
  logger.info(` ${filePath}`);
181
201
  }
202
+ if (result.skipped.length > 0) {
203
+ logger.info(`Skipped ${result.skipped.length} feature(s) an existing story covers.`);
204
+ }
182
205
  }
183
206
  } catch (err) {
184
207
  console.error(`
@@ -194,4 +217,4 @@ export {
194
217
  defineCommandExport,
195
218
  generateStories
196
219
  };
197
- //# sourceMappingURL=generate-story-UJS37FHA.js.map
220
+ //# sourceMappingURL=generate-story-5TPTJA7B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/core/generate-story.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { writeFile, mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\nimport { uncoveredFeatures, parseFeatureEntries } from \"@specdx/lint\";\n\nexport interface GenerateStoriesOptions {\n configDir: string;\n from: string;\n outDir?: string;\n}\n\nexport interface GenerateStoriesResult {\n generated: string[];\n /** Features left alone because an existing story already covers them. */\n skipped: string[];\n}\n\nfunction slugify(text: string): string {\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n if (slug.length <= 40) return slug;\n // Truncate on a word boundary so filenames don't end mid-word\n const cut = slug.slice(0, 40);\n const lastHyphen = cut.lastIndexOf(\"-\");\n return lastHyphen > 0 ? cut.slice(0, lastHyphen) : cut;\n}\n\nfunction detectStoriesDir(\n configDir: string,\n config: Awaited<ReturnType<typeof loadConfig>>,\n): string {\n for (const entry of Object.values(config.specs)) {\n if (entry.type === \"user-story\") {\n // Use the directory portion of the glob path\n const dirPart = entry.path.replace(/\\/[^/]*\\*.*$/, \"\").replace(/\\/[^/]*$/, \"\");\n // If path ends with *.md at a directory level, take that dir\n const match = entry.path.match(/^(.+?)\\/\\*/);\n if (match) {\n return join(configDir, match[1]!);\n }\n return join(configDir, dirPart);\n }\n }\n return join(configDir, \"specs/stories\");\n}\n\nfunction buildStoryFile(options: {\n featureNum: string;\n featureText: string;\n prdId: string;\n prdAuthors: string[];\n today: string;\n sections: string[];\n}): string {\n const { featureNum, featureText, prdId, prdAuthors, today, sections } = options;\n const storyId = `story-f${featureNum}`;\n const title = featureText.trim();\n const authorsYaml = JSON.stringify(prdAuthors);\n\n const frontmatter = [\n \"---\",\n `id: \"${storyId}\"`,\n `type: \"user-story\"`,\n `title: \"${title}\"`,\n `status: \"draft\"`,\n `version: \"0.1\"`,\n `created: \"${today}\"`,\n `authors: ${authorsYaml}`,\n `story_id: \"${storyId}\"`,\n `priority: \"medium\"`,\n `estimate: \"TBD\"`,\n `references:`,\n ` - id: \"${prdId}\"`,\n ` relationship: \"decomposed-into\"`,\n \"---\",\n ].join(\"\\n\");\n\n const bodyParts = sections.map((section) => {\n if (section === \"Description\") {\n return `\\n## ${section}\\n\\n${featureText.trim()}`;\n }\n if (section === \"Acceptance Criteria\") {\n return `\\n## ${section}\\n\\n- [ ] <!-- acceptance criterion -->`;\n }\n if (section === \"Dependencies\") {\n return `\\n## ${section}\\n\\nF${featureNum} from ${prdId}`;\n }\n return `\\n## ${section}\\n\\n<!-- placeholder -->`;\n });\n\n return `${frontmatter}\\n${bodyParts.join(\"\\n\")}\\n`;\n}\n\nexport async function generateStories(\n options: GenerateStoriesOptions,\n): Promise<GenerateStoriesResult> {\n const { configDir, from, outDir } = options;\n const config = await loadConfig(undefined, configDir);\n\n // Find the PRD spec file by ID\n let prdFilePath: string | undefined;\n for (const entry of Object.values(config.specs)) {\n const files = await resolveGlob(entry.path, configDir);\n for (const file of files) {\n const parsed = await parseSpec(file);\n if (parsed.frontmatter.id === from) {\n prdFilePath = file;\n break;\n }\n }\n if (prdFilePath) break;\n }\n\n if (!prdFilePath) {\n throw new Error(`No spec with id \"${from}\" found in config.`);\n }\n\n const prd = await parseSpec(prdFilePath);\n\n // The same parser the lint rule and `ready` use. Carrying a second one here\n // meant this command reported \"no features found\" for a PRD that lint was\n // simultaneously reporting three features in.\n const entries = parseFeatureEntries(prd.content);\n const features = entries.map((entry, i) => ({\n // Un-numbered features still need a stable filename, so fall back to\n // position. Authors who do use `**F<N>**:` keep their numbering.\n num: entry.num ?? String(i + 1),\n text: entry.text,\n }));\n\n if (features.length === 0) {\n return { generated: [], skipped: [] };\n }\n\n const storiesDir = outDir ?? detectStoriesDir(configDir, config);\n await mkdir(storiesDir, { recursive: true });\n\n const today = new Date().toISOString().slice(0, 10);\n const prdAuthors = (prd.frontmatter.authors as string[] | undefined) ?? [];\n const sections = REQUIRED_SECTIONS[\"user-story\"];\n\n // Features an existing story already covers are left alone -- regenerating\n // them produces a second stub for the same feature to reconcile by hand.\n const existingStories: ParsedSpec[] = [];\n for (const entry of Object.values(config.specs)) {\n if (entry.type !== \"user-story\") continue;\n for (const p of await resolveGlob(entry.path, configDir)) {\n existingStories.push(await parseSpec(p));\n }\n }\n const uncovered = new Set(\n uncoveredFeatures(\n features.map((f) => f.text),\n existingStories,\n from,\n ),\n );\n const skipped = features.filter((f) => !uncovered.has(f.text)).map((f) => f.text);\n\n const generated: string[] = [];\n\n for (const feature of features.filter((f) => uncovered.has(f.text))) {\n const slug = slugify(feature.text);\n const filename = `story-f${feature.num}-${slug}.md`;\n const filePath = join(storiesDir, filename);\n\n const content = buildStoryFile({\n featureNum: feature.num,\n featureText: feature.text,\n prdId: from,\n prdAuthors,\n today,\n sections,\n });\n\n await writeFile(filePath, content, \"utf-8\");\n generated.push(filePath);\n }\n\n return { generated, skipped };\n}\n\nexport const defineCommandExport = defineCommand({\n meta: {\n name: \"story\",\n description: \"Generate user story stub files from a PRD's Features section\",\n },\n args: {\n from: {\n type: \"string\",\n description: \"Spec ID of the PRD to generate stories from\",\n required: true,\n },\n out: {\n type: \"string\",\n description: \"Output directory for story files (default: auto-detected from config)\",\n },\n quiet: {\n type: \"boolean\",\n description: \"Suppress output\",\n default: false,\n },\n verbose: {\n type: \"boolean\",\n description: \"Verbose output\",\n default: false,\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n\n try {\n const result = await generateStories({\n configDir: process.cwd(),\n from: args.from,\n outDir: args.out,\n });\n\n if (result.generated.length === 0 && result.skipped.length > 0) {\n logger.info(\n `Every feature already has a story — ${result.skipped.length} feature(s) skipped, nothing generated.`,\n );\n } else if (result.generated.length === 0) {\n logger.info(\"No features found in PRD — no story stubs generated.\");\n } else {\n logger.info(`Generated ${result.generated.length} story stub(s):`);\n for (const filePath of result.generated) {\n logger.info(` ${filePath}`);\n }\n if (result.skipped.length > 0) {\n logger.info(`Skipped ${result.skipped.length} feature(s) an existing story covers.`);\n }\n }\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n\nexport default defineCommandExport;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,WAAW,aAAa;AACjC,SAAS,YAAY;AAkBrB,SAAS,QAAQ,MAAsB;AACrC,QAAM,OAAO,KACV,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AACzB,MAAI,KAAK,UAAU,GAAI,QAAO;AAE9B,QAAM,MAAM,KAAK,MAAM,GAAG,EAAE;AAC5B,QAAM,aAAa,IAAI,YAAY,GAAG;AACtC,SAAO,aAAa,IAAI,IAAI,MAAM,GAAG,UAAU,IAAI;AACrD;AAEA,SAAS,iBACP,WACA,QACQ;AACR,aAAW,SAAS,OAAO,OAAO,OAAO,KAAK,GAAG;AAC/C,QAAI,MAAM,SAAS,cAAc;AAE/B,YAAM,UAAU,MAAM,KAAK,QAAQ,gBAAgB,EAAE,EAAE,QAAQ,YAAY,EAAE;AAE7E,YAAM,QAAQ,MAAM,KAAK,MAAM,YAAY;AAC3C,UAAI,OAAO;AACT,eAAO,KAAK,WAAW,MAAM,CAAC,CAAE;AAAA,MAClC;AACA,aAAO,KAAK,WAAW,OAAO;AAAA,IAChC;AAAA,EACF;AACA,SAAO,KAAK,WAAW,eAAe;AACxC;AAEA,SAAS,eAAe,SAOb;AACT,QAAM,EAAE,YAAY,aAAa,OAAO,YAAY,OAAO,SAAS,IAAI;AACxE,QAAM,UAAU,UAAU,UAAU;AACpC,QAAM,QAAQ,YAAY,KAAK;AAC/B,QAAM,cAAc,KAAK,UAAU,UAAU;AAE7C,QAAM,cAAc;AAAA,IAClB;AAAA,IACA,QAAQ,OAAO;AAAA,IACf;AAAA,IACA,WAAW,KAAK;AAAA,IAChB;AAAA,IACA;AAAA,IACA,aAAa,KAAK;AAAA,IAClB,YAAY,WAAW;AAAA,IACvB,cAAc,OAA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,MACF;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;AAED,IAAO,yBAAQ;","names":[]}
@@ -3,14 +3,15 @@ import {
3
3
  loadConfig,
4
4
  parseSpec,
5
5
  resolveGlob
6
- } from "./chunk-Z77VQUZ3.js";
7
- import "./chunk-SJCIM4TC.js";
6
+ } from "./chunk-MM325DR6.js";
7
+ import "./chunk-ZIPGRLYE.js";
8
8
  import "./chunk-5WRI5ZAA.js";
9
9
 
10
10
  // src/commands/experimental/generate-test-plan.ts
11
11
  import { defineCommand } from "citty";
12
12
  import { writeFile } from "fs/promises";
13
- import { join } from "path";
13
+ import { existsSync } from "fs";
14
+ import { join, relative, resolve } from "path";
14
15
  function extractSection(content, heading) {
15
16
  const escapedHeading = heading.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16
17
  const headingPattern = new RegExp(`^##\\s+${escapedHeading}\\s*$`, "im");
@@ -36,7 +37,7 @@ function parseAcceptanceCriteria(section) {
36
37
  return cases;
37
38
  }
38
39
  async function generateTestPlan(options) {
39
- const { configDir, outPath } = options;
40
+ const { configDir, outPath, force = false } = options;
40
41
  const config = await loadConfig(void 0, configDir);
41
42
  const storiesBySpec = [];
42
43
  for (const [, entry] of Object.entries(config.specs)) {
@@ -111,13 +112,28 @@ ${caseBullets}`;
111
112
  const fileContent = `${frontmatter}
112
113
 
113
114
  ${body}`;
115
+ if (storiesBySpec.length === 0) {
116
+ return { testCases: 0 };
117
+ }
114
118
  const targetPath = outPath ?? join(configDir, "specs", "test-plan.md");
119
+ if (!force && existsSync(targetPath)) {
120
+ return { testCases: totalTestCases, blockedBy: targetPath };
121
+ }
115
122
  await writeFile(targetPath, fileContent, "utf-8");
116
123
  return { filePath: targetPath, testCases: totalTestCases };
117
124
  }
125
+ async function registeredKeyFor(configDir, filePath) {
126
+ const config = await loadConfig(void 0, configDir);
127
+ for (const [key, entry] of Object.entries(config.specs)) {
128
+ for (const resolved of await resolveGlob(entry.path, configDir)) {
129
+ if (resolve(resolved) === resolve(filePath)) return key;
130
+ }
131
+ }
132
+ return void 0;
133
+ }
118
134
  var generate_test_plan_default = defineCommand({
119
135
  meta: {
120
- name: "generate-test-plan",
136
+ name: "test-plan",
121
137
  description: "Generate a test plan stub from user stories"
122
138
  },
123
139
  args: {
@@ -129,6 +145,11 @@ var generate_test_plan_default = defineCommand({
129
145
  out: {
130
146
  type: "string",
131
147
  description: "Output file path (default: specs/test-plan.md)"
148
+ },
149
+ force: {
150
+ type: "boolean",
151
+ description: "Overwrite the file if it already exists",
152
+ default: false
132
153
  }
133
154
  },
134
155
  async run({ args }) {
@@ -140,11 +161,38 @@ var generate_test_plan_default = defineCommand({
140
161
  process.exit(1);
141
162
  }
142
163
  try {
164
+ const configDir = process.cwd();
143
165
  const result = await generateTestPlan({
144
- configDir: process.cwd(),
145
- outPath: args.out
166
+ configDir,
167
+ outPath: args.out,
168
+ force: args.force
146
169
  });
170
+ if (result.blockedBy) {
171
+ console.error(
172
+ `
173
+ \u2717 ${result.blockedBy} already exists \u2014 not overwriting it.
174
+ Pass --force to replace it, or --out <path> to write elsewhere.
175
+ `
176
+ );
177
+ process.exit(1);
178
+ }
179
+ if (!result.filePath) {
180
+ logger.info("No user stories found \u2014 no test plan generated.");
181
+ return;
182
+ }
147
183
  logger.info(`Generated test plan with ${result.testCases} test cases \u2192 ${result.filePath}`);
184
+ const existingKey = await registeredKeyFor(configDir, result.filePath);
185
+ if (existingKey) {
186
+ logger.info(`Already registered in spec.config.yaml as "${existingKey}".`);
187
+ } else {
188
+ const rel = relative(configDir, result.filePath) || result.filePath;
189
+ logger.info(
190
+ `Add it to spec.config.yaml so lint, status and pack can see it:
191
+ test-plan:
192
+ path: ${rel}
193
+ type: test-plan`
194
+ );
195
+ }
148
196
  } catch (err) {
149
197
  console.error(`
150
198
  \u2717 ${err.message}
@@ -155,6 +203,7 @@ var generate_test_plan_default = defineCommand({
155
203
  });
156
204
  export {
157
205
  generate_test_plan_default as default,
158
- generateTestPlan
206
+ generateTestPlan,
207
+ registeredKeyFor
159
208
  };
160
- //# sourceMappingURL=generate-test-plan-RQTSGQLR.js.map
209
+ //# sourceMappingURL=generate-test-plan-XBAFJKJI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/experimental/generate-test-plan.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport { writeFile } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { join, relative, resolve } from \"node:path\";\n\nexport interface GenerateTestPlanOptions {\n configDir: string;\n outPath?: string;\n /** Overwrite an existing file. Off by default -- the file may be hand-written. */\n force?: boolean;\n}\n\nexport interface GenerateTestPlanResult {\n /** Undefined when there was nothing to generate, so no file was written. */\n filePath?: string;\n testCases: number;\n /** Set when a file exists at the target path and `force` was not given. */\n blockedBy?: string;\n}\n\ninterface StoryTestCases {\n storyId: string;\n title: string;\n authors: string[];\n cases: string[];\n}\n\n/**\n * Extracts the content of a `## Heading` section from a markdown string.\n * Returns the text between that heading and the next `## ` heading (or end of string).\n */\nfunction extractSection(content: string, heading: string): string | null {\n const escapedHeading = heading.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const headingPattern = new RegExp(`^##\\\\s+${escapedHeading}\\\\s*$`, \"im\");\n const match = headingPattern.exec(content);\n if (!match) return null;\n\n const start = match.index + match[0].length;\n const rest = content.slice(start);\n\n const nextSection = /^##\\s+/m.exec(rest);\n return nextSection ? rest.slice(0, nextSection.index) : rest;\n}\n\n/**\n * Parses acceptance criteria bullet points from a section string.\n * Handles `- [ ] text`, `- [x] text`, and plain `- text` formats.\n */\nfunction parseAcceptanceCriteria(section: string): string[] {\n const cases: string[] = [];\n for (const rawLine of section.split(\"\\n\")) {\n const line = rawLine.trim();\n // Match bullet lines: `- [ ] text`, `- [x] text`, `- text`\n const bulletMatch = /^-\\s+(?:\\[[ xX]\\]\\s+)?(.+)/.exec(line);\n if (bulletMatch) {\n const text = bulletMatch[1]!.trim();\n if (text) {\n cases.push(text);\n }\n }\n }\n return cases;\n}\n\nexport async function generateTestPlan(\n options: GenerateTestPlanOptions,\n): Promise<GenerateTestPlanResult> {\n const { configDir, outPath, force = false } = options;\n const config = await loadConfig(undefined, configDir);\n\n const storiesBySpec: StoryTestCases[] = [];\n\n for (const [, entry] of Object.entries(config.specs)) {\n if (entry.type !== \"user-story\") continue;\n\n const files = await resolveGlob(entry.path, configDir);\n for (const file of files) {\n const parsed = await parseSpec(file);\n const frontmatter = parsed.frontmatter;\n const storyId = (frontmatter[\"id\"] as string | undefined) ?? file;\n const title = (frontmatter[\"title\"] as string | undefined) ?? storyId;\n const authors = (frontmatter[\"authors\"] as string[] | undefined) ?? [];\n\n const acSection = extractSection(parsed.content, \"Acceptance Criteria\");\n const cases = acSection ? parseAcceptanceCriteria(acSection) : [];\n\n storiesBySpec.push({ storyId, title, authors, cases });\n }\n }\n\n // Sort stories by ID for deterministic output\n storiesBySpec.sort((a, b) => a.storyId.localeCompare(b.storyId));\n\n const today = new Date().toISOString().slice(0, 10);\n\n // Aggregate authors from all stories (deduplicated)\n const allAuthors = Array.from(new Set(storiesBySpec.flatMap((s) => s.authors)));\n\n // Build references to all stories\n const storyRefs = storiesBySpec.map(\n (s) => ` - id: \"${s.storyId}\"\\n relationship: \"related-to\"`,\n );\n\n const totalTestCases = storiesBySpec.reduce((sum, s) => sum + s.cases.length, 0);\n\n // Build frontmatter\n const authorsYaml =\n allAuthors.length > 0 ? `[${allAuthors.map((a) => `\"${a}\"`).join(\", \")}]` : '[\"generated\"]';\n\n const refsYaml = storyRefs.length > 0 ? `\\nreferences:\\n${storyRefs.join(\"\\n\")}` : \"\";\n\n const frontmatter = [\n \"---\",\n 'id: \"generated-test-plan\"',\n 'type: \"test-plan\"',\n 'title: \"Generated Test Plan\"',\n 'status: \"draft\"',\n 'version: \"0.1\"',\n `created: \"${today}\"`,\n `authors: ${authorsYaml}`,\n refsYaml.length > 0 ? refsYaml.trimStart() : null,\n \"---\",\n ]\n .filter((line) => line !== null)\n .join(\"\\n\");\n\n // ## Scope\n const scopeLines =\n storiesBySpec.length > 0\n ? storiesBySpec.map((s) => `- ${s.storyId}: ${s.title}`).join(\"\\n\")\n : \"_No user stories found._\";\n\n // ## Test Cases — grouped by story\n const testCaseBlocks = storiesBySpec\n .map((s) => {\n const caseBullets =\n s.cases.length > 0\n ? s.cases.map((c) => `- [ ] ${c}`).join(\"\\n\")\n : \"_No acceptance criteria found._\";\n return `### ${s.storyId}\\n\\n${caseBullets}`;\n })\n .join(\"\\n\\n\");\n\n const testCasesBody = storiesBySpec.length > 0 ? testCaseBlocks : \"_No user stories found._\";\n\n // ## Coverage Matrix\n const matrixHeader = \"| Story | Test Cases |\";\n const matrixSep = \"| ----- | ---------- |\";\n const matrixRows = storiesBySpec.map((s) => `| ${s.storyId} | ${s.cases.length} |`);\n const coverageMatrix = [matrixHeader, matrixSep, ...matrixRows].join(\"\\n\");\n\n // ## Edge Cases\n const edgeCasesPlaceholder = \"<!-- Add edge cases and boundary conditions here -->\";\n\n const body = [\n `## Scope`,\n \"\",\n scopeLines,\n \"\",\n `## Test Cases`,\n \"\",\n testCasesBody,\n \"\",\n `## Coverage Matrix`,\n \"\",\n coverageMatrix,\n \"\",\n `## Edge Cases`,\n \"\",\n edgeCasesPlaceholder,\n \"\",\n ].join(\"\\n\");\n\n const fileContent = `${frontmatter}\\n\\n${body}`;\n\n // Nothing to build a plan from. Writing a spec whose every section reads\n // \"_No user stories found._\" would add a file the linter then flags and the\n // suite has to carry -- `generate story` already declines in this case.\n if (storiesBySpec.length === 0) {\n return { testCases: 0 };\n }\n\n const targetPath = outPath ?? join(configDir, \"specs\", \"test-plan.md\");\n\n // A generator must not destroy hand-written work. This overwrote an approved\n // spec -- registered in the config, with a filled-in coverage matrix -- and\n // replaced it with a draft stub, silently and with exit 0. The only reason it\n // was recoverable was that the project happened to use git.\n if (!force && existsSync(targetPath)) {\n return { testCases: totalTestCases, blockedBy: targetPath };\n }\n\n await writeFile(targetPath, fileContent, \"utf-8\");\n\n return { filePath: targetPath, testCases: totalTestCases };\n}\n\n/**\n * The config key, if any, already pointing at `filePath`.\n *\n * Telling an author to register a file the config already knows about invites a\n * duplicate entry for one path -- which is how a frontmatter id and its key\n * come to disagree.\n */\nexport async function registeredKeyFor(\n configDir: string,\n filePath: string,\n): Promise<string | undefined> {\n const config = await loadConfig(undefined, configDir);\n for (const [key, entry] of Object.entries(config.specs)) {\n for (const resolved of await resolveGlob(entry.path, configDir)) {\n if (resolve(resolved) === resolve(filePath)) return key;\n }\n }\n return undefined;\n}\n\nexport default defineCommand({\n meta: {\n name: \"test-plan\",\n description: \"Generate a test plan stub from user stories\",\n },\n args: {\n from: {\n type: \"string\",\n description: \"Source to generate from (currently only 'stories' is supported)\",\n default: \"stories\",\n },\n out: {\n type: \"string\",\n description: \"Output file path (default: specs/test-plan.md)\",\n },\n force: {\n type: \"boolean\",\n description: \"Overwrite the file if it already exists\",\n default: false,\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: false, verbose: false });\n\n if (args.from !== \"stories\") {\n console.error(`\\n ✗ --from must be 'stories' (got: ${args.from})\\n`);\n process.exit(1);\n }\n\n try {\n const configDir = process.cwd();\n const result = await generateTestPlan({\n configDir,\n outPath: args.out,\n force: args.force,\n });\n\n if (result.blockedBy) {\n console.error(\n `\\n ✗ ${result.blockedBy} already exists — not overwriting it.\\n` +\n \" Pass --force to replace it, or --out <path> to write elsewhere.\\n\",\n );\n process.exit(1);\n }\n\n if (!result.filePath) {\n logger.info(\"No user stories found — no test plan generated.\");\n return;\n }\n\n logger.info(`Generated test plan with ${result.testCases} test cases → ${result.filePath}`);\n\n // Only worth saying when it is actually unregistered. Advising a key for\n // a path the config already maps produces two entries for one file.\n const existingKey = await registeredKeyFor(configDir, result.filePath);\n if (existingKey) {\n logger.info(`Already registered in spec.config.yaml as \"${existingKey}\".`);\n } else {\n const rel = relative(configDir, result.filePath) || result.filePath;\n logger.info(\n \"Add it to spec.config.yaml so lint, status and pack can see it:\\n\" +\n ` test-plan:\\n path: ${rel}\\n type: test-plan`,\n );\n }\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;AAAA,SAAS,qBAAqB;AAE9B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,MAAM,UAAU,eAAe;AA4BxC,SAAS,eAAe,SAAiB,SAAgC;AACvE,QAAM,iBAAiB,QAAQ,QAAQ,uBAAuB,MAAM;AACpE,QAAM,iBAAiB,IAAI,OAAO,UAAU,cAAc,SAAS,IAAI;AACvE,QAAM,QAAQ,eAAe,KAAK,OAAO;AACzC,MAAI,CAAC,MAAO,QAAO;AAEnB,QAAM,QAAQ,MAAM,QAAQ,MAAM,CAAC,EAAE;AACrC,QAAM,OAAO,QAAQ,MAAM,KAAK;AAEhC,QAAM,cAAc,UAAU,KAAK,IAAI;AACvC,SAAO,cAAc,KAAK,MAAM,GAAG,YAAY,KAAK,IAAI;AAC1D;AAMA,SAAS,wBAAwB,SAA2B;AAC1D,QAAM,QAAkB,CAAC;AACzB,aAAW,WAAW,QAAQ,MAAM,IAAI,GAAG;AACzC,UAAM,OAAO,QAAQ,KAAK;AAE1B,UAAM,cAAc,6BAA6B,KAAK,IAAI;AAC1D,QAAI,aAAa;AACf,YAAM,OAAO,YAAY,CAAC,EAAG,KAAK;AAClC,UAAI,MAAM;AACR,cAAM,KAAK,IAAI;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,eAAsB,iBACpB,SACiC;AACjC,QAAM,EAAE,WAAW,SAAS,QAAQ,MAAM,IAAI;AAC9C,QAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AAEpD,QAAM,gBAAkC,CAAC;A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AS,OAAO,SAAS;AAAA;AAAA;AAAA,QAE3B;AACA,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,UAAI,CAAC,OAAO,UAAU;AACpB,eAAO,KAAK,sDAAiD;AAC7D;AAAA,MACF;AAEA,aAAO,KAAK,4BAA4B,OAAO,SAAS,sBAAiB,OAAO,QAAQ,EAAE;AAI1F,YAAM,cAAc,MAAM,iBAAiB,WAAW,OAAO,QAAQ;AACrE,UAAI,aAAa;AACf,eAAO,KAAK,8CAA8C,WAAW,IAAI;AAAA,MAC3E,OAAO;AACL,cAAM,MAAM,SAAS,WAAW,OAAO,QAAQ,KAAK,OAAO;AAC3D,eAAO;AAAA,UACL;AAAA;AAAA,YAC6B,GAAG;AAAA;AAAA,QAClC;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":["frontmatter"]}
@@ -9,8 +9,8 @@ import {
9
9
  loadConfig,
10
10
  parseSpec,
11
11
  resolveGlob
12
- } from "./chunk-Z77VQUZ3.js";
13
- import "./chunk-SJCIM4TC.js";
12
+ } from "./chunk-MM325DR6.js";
13
+ import "./chunk-ZIPGRLYE.js";
14
14
  import "./chunk-5WRI5ZAA.js";
15
15
 
16
16
  // src/commands/core/graph.ts
@@ -100,4 +100,4 @@ var graph_default = defineCommand({
100
100
  export {
101
101
  graph_default as default
102
102
  };
103
- //# sourceMappingURL=graph-OKUMHR3Q.js.map
103
+ //# sourceMappingURL=graph-UZJMLX4J.js.map