specdx 0.4.0-alpha.4 → 0.4.0-alpha.5

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.
@@ -3,11 +3,11 @@ import { defineCommand } from "citty";
3
3
  var generate_default = defineCommand({
4
4
  meta: { name: "generate", description: "Generate spec stubs from existing specs" },
5
5
  subCommands: {
6
- story: () => import("./generate-story-PIV6JDTF.js").then((m) => m.default),
6
+ story: () => import("./generate-story-YRMLUF2A.js").then((m) => m.default),
7
7
  "test-plan": () => import("./generate-test-plan-Q5C52KPL.js").then((m) => m.default)
8
8
  }
9
9
  });
10
10
  export {
11
11
  generate_default as default
12
12
  };
13
- //# sourceMappingURL=generate-NRBZMTHL.js.map
13
+ //# sourceMappingURL=generate-O6FWRGND.js.map
@@ -13,7 +13,11 @@ import { defineCommand } from "citty";
13
13
  import { writeFile, mkdir } from "fs/promises";
14
14
  import { join } from "path";
15
15
  function slugify(text) {
16
- return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
16
+ const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
17
+ if (slug.length <= 40) return slug;
18
+ const cut = slug.slice(0, 40);
19
+ const lastHyphen = cut.lastIndexOf("-");
20
+ return lastHyphen > 0 ? cut.slice(0, lastHyphen) : cut;
17
21
  }
18
22
  function detectStoriesDir(configDir, config) {
19
23
  for (const entry of Object.values(config.specs)) {
@@ -189,4 +193,4 @@ export {
189
193
  defineCommandExport,
190
194
  generateStories
191
195
  };
192
- //# sourceMappingURL=generate-story-PIV6JDTF.js.map
196
+ //# sourceMappingURL=generate-story-YRMLUF2A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/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 { REQUIRED_SECTIONS } from \"@specdx/schema\";\n\nexport interface GenerateStoriesOptions {\n configDir: string;\n from: string;\n outDir?: string;\n}\n\nexport interface GenerateStoriesResult {\n generated: 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 // Find the Features section content\n const featuresSection = prd.parsedSections.find((s) => s.heading === \"Features\");\n if (!featuresSection) {\n return { generated: [] };\n }\n\n // Parse features using the required regex pattern\n const featureRegex = /\\*\\*F(\\d+)\\*\\*:\\s*(.+)/g;\n const features: Array<{ num: string; text: string }> = [];\n let match: RegExpExecArray | null;\n while ((match = featureRegex.exec(featuresSection.content)) !== null) {\n features.push({ num: match[1]!, text: match[2]! });\n }\n\n if (features.length === 0) {\n return { generated: [] };\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 const generated: string[] = [];\n\n for (const feature of features) {\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 };\n}\n\nexport const defineCommandExport = defineCommand({\n meta: {\n name: \"generate 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) {\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 }\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;AAcrB,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,YA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7B;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;AAED,IAAO,yBAAQ;","names":[]}
package/dist/main.js CHANGED
@@ -144,7 +144,7 @@ var main = defineCommand2({
144
144
  check: () => import("./check-XTL2VATS.js").then((m) => m.default),
145
145
  ready: () => import("./ready-CYFUHCV3.js").then((m) => m.default),
146
146
  update: () => import("./update-P52U4ROV.js").then((m) => m.default),
147
- generate: () => import("./generate-NRBZMTHL.js").then((m) => m.default),
147
+ generate: () => import("./generate-O6FWRGND.js").then((m) => m.default),
148
148
  migrate: () => import("./migrate-677E4C5U.js").then((m) => m.default),
149
149
  mcp: () => import("./mcp-DKM3YAHJ.js").then((m) => m.default)
150
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdx",
3
- "version": "0.4.0-alpha.4",
3
+ "version": "0.4.0-alpha.5",
4
4
  "description": "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -61,11 +61,11 @@
61
61
  "devDependencies": {
62
62
  "tsup": "^8.5.1",
63
63
  "typescript": "^5.7.0",
64
- "@specdx/check": "0.0.0",
65
- "@specdx/core": "0.0.0",
66
64
  "@specdx/diff": "0.0.0",
65
+ "@specdx/core": "0.0.0",
67
66
  "@specdx/lint": "0.0.0",
68
67
  "@specdx/mcp": "0.0.0",
68
+ "@specdx/check": "0.0.0",
69
69
  "@specdx/pack": "0.0.0",
70
70
  "@specdx/schema": "0.0.0",
71
71
  "@specdx/skills": "0.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/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 { REQUIRED_SECTIONS } from \"@specdx/schema\";\n\nexport interface GenerateStoriesOptions {\n configDir: string;\n from: string;\n outDir?: string;\n}\n\nexport interface GenerateStoriesResult {\n generated: string[];\n}\n\nfunction slugify(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 40);\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 // Find the Features section content\n const featuresSection = prd.parsedSections.find((s) => s.heading === \"Features\");\n if (!featuresSection) {\n return { generated: [] };\n }\n\n // Parse features using the required regex pattern\n const featureRegex = /\\*\\*F(\\d+)\\*\\*:\\s*(.+)/g;\n const features: Array<{ num: string; text: string }> = [];\n let match: RegExpExecArray | null;\n while ((match = featureRegex.exec(featuresSection.content)) !== null) {\n features.push({ num: match[1]!, text: match[2]! });\n }\n\n if (features.length === 0) {\n return { generated: [] };\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 const generated: string[] = [];\n\n for (const feature of features) {\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 };\n}\n\nexport const defineCommandExport = defineCommand({\n meta: {\n name: \"generate 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) {\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 }\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;AAcrB,SAAS,QAAQ,MAAsB;AACrC,SAAO,KACJ,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE,EACtB,MAAM,GAAG,EAAE;AAChB;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;AACx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