specdx 0.4.0-alpha.2 → 0.4.0-alpha.4

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 (61) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{changelog-G6XDIAZP.js → changelog-HL6HA7HG.js} +18 -11
  3. package/dist/{changelog-G6XDIAZP.js.map → changelog-HL6HA7HG.js.map} +1 -1
  4. package/dist/{check-PZFBVQIP.js → check-XTL2VATS.js} +8 -5
  5. package/dist/check-XTL2VATS.js.map +1 -0
  6. package/dist/{chunk-YRDOYUKF.js → chunk-HSUMIDA6.js} +2 -2
  7. package/dist/{chunk-PHWUK7TH.js → chunk-KAWB5K44.js} +9 -3
  8. package/dist/chunk-KAWB5K44.js.map +1 -0
  9. package/dist/{chunk-7C3BAVCP.js → chunk-OK5MT4Q6.js} +2 -2
  10. package/dist/{chunk-YDU26YTH.js → chunk-RVVQKLNL.js} +7 -3
  11. package/dist/chunk-RVVQKLNL.js.map +1 -0
  12. package/dist/{chunk-FZWT4HVX.js → chunk-W3BBJIRQ.js} +2 -2
  13. package/dist/diff-GJYKGIG6.js +107 -0
  14. package/dist/diff-GJYKGIG6.js.map +1 -0
  15. package/dist/{dist-2B2MR5AM.js → dist-7GA3NJ3Y.js} +7 -7
  16. package/dist/{dist-2B2MR5AM.js.map → dist-7GA3NJ3Y.js.map} +1 -1
  17. package/dist/{explain-PCZKDEM4.js → explain-2I3M7ICY.js} +35 -28
  18. package/dist/explain-2I3M7ICY.js.map +1 -0
  19. package/dist/{generate-OMEBJQFQ.js → generate-NRBZMTHL.js} +3 -3
  20. package/dist/{generate-story-AOALIKSD.js → generate-story-PIV6JDTF.js} +3 -3
  21. package/dist/{generate-test-plan-34L6RGOB.js → generate-test-plan-Q5C52KPL.js} +7 -4
  22. package/dist/{generate-test-plan-34L6RGOB.js.map → generate-test-plan-Q5C52KPL.js.map} +1 -1
  23. package/dist/{graph-RR5UTY3R.js → graph-TYAPGOZJ.js} +3 -3
  24. package/dist/index.js +158 -107
  25. package/dist/index.js.map +1 -1
  26. package/dist/{lint-XGVQ6LCP.js → lint-ZXZQTEU6.js} +4 -4
  27. package/dist/main.js +15 -15
  28. package/dist/{mcp-GUFW37BE.js → mcp-DKM3YAHJ.js} +2 -2
  29. package/dist/{migrate-KDJZQKP7.js → migrate-677E4C5U.js} +4 -4
  30. package/dist/migrate-677E4C5U.js.map +1 -0
  31. package/dist/{pack-OJ3CDZHD.js → pack-I53KTKHL.js} +4 -4
  32. package/dist/{ready-WTNO5W7C.js → ready-CYFUHCV3.js} +35 -28
  33. package/dist/{ready-WTNO5W7C.js.map → ready-CYFUHCV3.js.map} +1 -1
  34. package/dist/skills/specdx-check-drift.md +1 -1
  35. package/dist/skills/specdx-verify.md +1 -1
  36. package/dist/{status-JVIXK73H.js → status-ZWDR2EZN.js} +40 -33
  37. package/dist/status-ZWDR2EZN.js.map +1 -0
  38. package/dist/{update-HFLDULNJ.js → update-P52U4ROV.js} +4 -4
  39. package/dist/update-P52U4ROV.js.map +1 -0
  40. package/dist/{validate-O7W5YLR6.js → validate-4JSBHBW5.js} +3 -3
  41. package/hooks/session-start +0 -0
  42. package/package.json +49 -17
  43. package/dist/check-PZFBVQIP.js.map +0 -1
  44. package/dist/chunk-PHWUK7TH.js.map +0 -1
  45. package/dist/chunk-YDU26YTH.js.map +0 -1
  46. package/dist/diff-BEZARP53.js +0 -100
  47. package/dist/diff-BEZARP53.js.map +0 -1
  48. package/dist/explain-PCZKDEM4.js.map +0 -1
  49. package/dist/migrate-KDJZQKP7.js.map +0 -1
  50. package/dist/status-JVIXK73H.js.map +0 -1
  51. package/dist/update-HFLDULNJ.js.map +0 -1
  52. /package/dist/{chunk-YRDOYUKF.js.map → chunk-HSUMIDA6.js.map} +0 -0
  53. /package/dist/{chunk-7C3BAVCP.js.map → chunk-OK5MT4Q6.js.map} +0 -0
  54. /package/dist/{chunk-FZWT4HVX.js.map → chunk-W3BBJIRQ.js.map} +0 -0
  55. /package/dist/{generate-OMEBJQFQ.js.map → generate-NRBZMTHL.js.map} +0 -0
  56. /package/dist/{generate-story-AOALIKSD.js.map → generate-story-PIV6JDTF.js.map} +0 -0
  57. /package/dist/{graph-RR5UTY3R.js.map → graph-TYAPGOZJ.js.map} +0 -0
  58. /package/dist/{lint-XGVQ6LCP.js.map → lint-ZXZQTEU6.js.map} +0 -0
  59. /package/dist/{mcp-GUFW37BE.js.map → mcp-DKM3YAHJ.js.map} +0 -0
  60. /package/dist/{pack-OJ3CDZHD.js.map → pack-I53KTKHL.js.map} +0 -0
  61. /package/dist/{validate-O7W5YLR6.js.map → validate-4JSBHBW5.js.map} +0 -0
package/dist/index.js CHANGED
@@ -3,6 +3,19 @@ import { defineCommand } from "citty";
3
3
  import { mkdir, writeFile } from "fs/promises";
4
4
  import { join } from "path";
5
5
 
6
+ // ../schema/dist/types.js
7
+ var SPEC_TYPES = [
8
+ "prd",
9
+ "technical-design",
10
+ "user-story",
11
+ "test-plan",
12
+ "adr",
13
+ "api-contract",
14
+ "epic",
15
+ "quick-spec",
16
+ "project-context"
17
+ ];
18
+
6
19
  // ../schema/dist/sections.js
7
20
  var REQUIRED_SECTIONS = {
8
21
  prd: ["Problem Statement", "Goals", "Non-Goals", "Features", "Success Criteria"],
@@ -290,9 +303,13 @@ var project_context_default = {
290
303
  // ../schema/dist/validator.js
291
304
  import * as addFormatsNs from "ajv-formats";
292
305
  var addFormats = addFormatsNs.default ?? addFormatsNs;
306
+ var runtimeBaseSpecSchema = structuredClone(base_spec_default);
307
+ runtimeBaseSpecSchema.properties.type.enum = [...SPEC_TYPES];
308
+ var runtimeConfigSchema = structuredClone(config_default);
309
+ runtimeConfigSchema.properties.specs.additionalProperties.properties.type.enum = [...SPEC_TYPES];
293
310
  var ajv = new AjvClass({ allErrors: true, strict: true });
294
311
  addFormats(ajv, ["date"]);
295
- ajv.addSchema(base_spec_default);
312
+ ajv.addSchema(runtimeBaseSpecSchema);
296
313
  var specValidators = {
297
314
  prd: ajv.compile(prd_default),
298
315
  "technical-design": ajv.compile(technical_design_default),
@@ -304,7 +321,7 @@ var specValidators = {
304
321
  "quick-spec": ajv.compile(quick_spec_default),
305
322
  "project-context": ajv.compile(project_context_default)
306
323
  };
307
- var configValidator = ajv.compile(config_default);
324
+ var configValidator = ajv.compile(runtimeConfigSchema);
308
325
  function validateSpec(type, data) {
309
326
  const validate = specValidators[type];
310
327
  if (!validate) {
@@ -1017,7 +1034,13 @@ var EDGE_CASE_KEYWORDS = [
1017
1034
  "missing",
1018
1035
  "malformed",
1019
1036
  "overflow",
1020
- "duplicate"
1037
+ "duplicate",
1038
+ "graceful",
1039
+ "fall back",
1040
+ "fallback",
1041
+ "crash",
1042
+ "nonexistent",
1043
+ "corrupt"
1021
1044
  ];
1022
1045
  var edgeCaseCoverageRule = {
1023
1046
  id: "completeness/edge-case-coverage",
@@ -3191,58 +3214,65 @@ var diff_default = defineCommand4({
3191
3214
  },
3192
3215
  async run({ args }) {
3193
3216
  try {
3194
- const result = await runDiff({
3195
- base: args.base,
3196
- head: args.head,
3197
- spec: args.spec,
3198
- format: args.format
3199
- });
3200
- if (args.format === "json") {
3201
- console.log(JSON.stringify(result, null, 2));
3202
- return;
3203
- }
3204
- if (result.diffs.length === 0 && result.added.length === 0 && result.removed.length === 0) {
3205
- console.log(" \u2713 No spec changes detected.");
3206
- return;
3207
- }
3208
- console.log(result.summary);
3209
- console.log();
3210
- for (const diff2 of result.diffs) {
3211
- console.log(` ${diff2.specId}:`);
3212
- for (const fc of diff2.frontmatter) {
3213
- const detail = fc.before !== void 0 || fc.after !== void 0 ? ` (${String(fc.before)} \u2192 ${String(fc.after)})` : "";
3214
- console.log(` ${fc.type}: ${fc.field}${detail}`);
3217
+ try {
3218
+ const result = await runDiff({
3219
+ base: args.base,
3220
+ head: args.head,
3221
+ spec: args.spec,
3222
+ format: args.format
3223
+ });
3224
+ if (args.format === "json") {
3225
+ console.log(JSON.stringify(result, null, 2));
3226
+ return;
3215
3227
  }
3216
- for (const sc of diff2.sections) {
3217
- console.log(` ${sc.type}: ${sc.heading}`);
3228
+ if (result.diffs.length === 0 && result.added.length === 0 && result.removed.length === 0) {
3229
+ console.log(" \u2713 No spec changes detected.");
3230
+ return;
3218
3231
  }
3219
- }
3220
- if (result.added.length > 0) {
3221
- console.log(`
3232
+ console.log(result.summary);
3233
+ console.log();
3234
+ for (const diff2 of result.diffs) {
3235
+ console.log(` ${diff2.specId}:`);
3236
+ for (const fc of diff2.frontmatter) {
3237
+ const detail = fc.before !== void 0 || fc.after !== void 0 ? ` (${String(fc.before)} \u2192 ${String(fc.after)})` : "";
3238
+ console.log(` ${fc.type}: ${fc.field}${detail}`);
3239
+ }
3240
+ for (const sc of diff2.sections) {
3241
+ console.log(` ${sc.type}: ${sc.heading}`);
3242
+ }
3243
+ }
3244
+ if (result.added.length > 0) {
3245
+ console.log(`
3222
3246
  Added: ${result.added.join(", ")}`);
3223
- }
3224
- if (result.removed.length > 0) {
3225
- console.log(`
3247
+ }
3248
+ if (result.removed.length > 0) {
3249
+ console.log(`
3226
3250
  Removed: ${result.removed.join(", ")}`);
3227
- }
3228
- if (result.impact.length > 0) {
3229
- console.log("\n Downstream Impact:");
3230
- for (const impact of result.impact) {
3231
- for (const d of impact.downstream) {
3232
- console.log(
3233
- ` ${d.specId} \u2014 staleness: ${d.staleness.toFixed(2)} \u2014 ${d.reason}`
3234
- );
3251
+ }
3252
+ if (result.impact.length > 0) {
3253
+ console.log("\n Downstream Impact:");
3254
+ for (const impact of result.impact) {
3255
+ for (const d of impact.downstream) {
3256
+ console.log(
3257
+ ` ${d.specId} \u2014 staleness: ${d.staleness.toFixed(2)} \u2014 ${d.reason}`
3258
+ );
3259
+ }
3235
3260
  }
3236
3261
  }
3262
+ } catch (err) {
3263
+ if (err instanceof DiffError) {
3264
+ console.error(`
3265
+ \u2717 ${err.message}
3266
+ `);
3267
+ process.exit(1);
3268
+ }
3269
+ throw err;
3237
3270
  }
3238
3271
  } catch (err) {
3239
- if (err instanceof DiffError) {
3240
- console.error(`
3272
+ console.error(`
3241
3273
  \u2717 ${err.message}
3242
3274
  `);
3243
- process.exit(1);
3244
- }
3245
- throw err;
3275
+ process.exit(1);
3246
3276
  }
3247
3277
  }
3248
3278
  });
@@ -3338,40 +3368,47 @@ var status_default = defineCommand5({
3338
3368
  }
3339
3369
  },
3340
3370
  async run({ args }) {
3341
- const result = await runStatus({ format: args.format });
3342
- if (args.format === "json") {
3343
- console.log(JSON.stringify(result, null, 2));
3344
- return;
3345
- }
3346
- if (args.format === "github") {
3347
- for (const s of result.staleSpecs) {
3348
- console.log(
3349
- `::warning::Spec "${s.specId}" is stale (${s.daysSinceUpdate} days since update)`
3350
- );
3371
+ try {
3372
+ const result = await runStatus({ format: args.format });
3373
+ if (args.format === "json") {
3374
+ console.log(JSON.stringify(result, null, 2));
3375
+ return;
3351
3376
  }
3352
- for (const issue of result.integrityIssues) {
3353
- console.log(`::error::${issue}`);
3377
+ if (args.format === "github") {
3378
+ for (const s of result.staleSpecs) {
3379
+ console.log(
3380
+ `::warning::Spec "${s.specId}" is stale (${s.daysSinceUpdate} days since update)`
3381
+ );
3382
+ }
3383
+ for (const issue of result.integrityIssues) {
3384
+ console.log(`::error::${issue}`);
3385
+ }
3386
+ return;
3354
3387
  }
3355
- return;
3356
- }
3357
- const icon = result.verdict === "healthy" ? "\u2713" : result.verdict === "warnings" ? "\u26A0" : "\u2717";
3358
- console.log(`
3388
+ const icon = result.verdict === "healthy" ? "\u2713" : result.verdict === "warnings" ? "\u26A0" : "\u2717";
3389
+ console.log(`
3359
3390
  ${icon} ${result.project} \u2014 ${result.verdict}`);
3360
- console.log(
3361
- ` ${result.specCount} specs: ${Object.entries(result.byStatus).map(([k, v]) => `${v} ${k}`).join(", ")}`
3362
- );
3363
- console.log(
3364
- ` Lint: ${result.lintHealth.errors} errors, ${result.lintHealth.warnings} warnings`
3365
- );
3366
- if (result.staleSpecs.length > 0) {
3367
3391
  console.log(
3368
- ` Stale: ${result.staleSpecs.map((s) => `${s.specId} (${s.daysSinceUpdate}d)`).join(", ")}`
3392
+ ` ${result.specCount} specs: ${Object.entries(result.byStatus).map(([k, v]) => `${v} ${k}`).join(", ")}`
3369
3393
  );
3394
+ console.log(
3395
+ ` Lint: ${result.lintHealth.errors} errors, ${result.lintHealth.warnings} warnings`
3396
+ );
3397
+ if (result.staleSpecs.length > 0) {
3398
+ console.log(
3399
+ ` Stale: ${result.staleSpecs.map((s) => `${s.specId} (${s.daysSinceUpdate}d)`).join(", ")}`
3400
+ );
3401
+ }
3402
+ if (result.integrityIssues.length > 0) {
3403
+ console.log(` Issues: ${result.integrityIssues.join("; ")}`);
3404
+ }
3405
+ console.log();
3406
+ } catch (err) {
3407
+ console.error(`
3408
+ \u2717 ${err.message}
3409
+ `);
3410
+ process.exit(1);
3370
3411
  }
3371
- if (result.integrityIssues.length > 0) {
3372
- console.log(` Issues: ${result.integrityIssues.join("; ")}`);
3373
- }
3374
- console.log();
3375
3412
  }
3376
3413
  });
3377
3414
 
@@ -3433,16 +3470,23 @@ var changelog_default = defineCommand6({
3433
3470
  },
3434
3471
  async run({ args }) {
3435
3472
  try {
3436
- const output = await runChangelog(args);
3437
- console.log(output);
3438
- } catch (err) {
3439
- if (err instanceof DiffError) {
3440
- console.error(`
3473
+ try {
3474
+ const output = await runChangelog(args);
3475
+ console.log(output);
3476
+ } catch (err) {
3477
+ if (err instanceof DiffError) {
3478
+ console.error(`
3441
3479
  \u2717 ${err.message}
3442
3480
  `);
3443
- process.exit(1);
3481
+ process.exit(1);
3482
+ }
3483
+ throw err;
3444
3484
  }
3445
- throw err;
3485
+ } catch (err) {
3486
+ console.error(`
3487
+ \u2717 ${err.message}
3488
+ `);
3489
+ process.exit(1);
3446
3490
  }
3447
3491
  }
3448
3492
  });
@@ -3505,35 +3549,42 @@ var explain_default = defineCommand7({
3505
3549
  format: { type: "string", description: "Output format: pretty, json", default: "pretty" }
3506
3550
  },
3507
3551
  async run({ args }) {
3508
- const result = await runExplain({ format: args.format });
3509
- if (args.format === "json") {
3510
- console.log(JSON.stringify(result, null, 2));
3511
- return;
3512
- }
3513
- console.log(`
3552
+ try {
3553
+ const result = await runExplain({ format: args.format });
3554
+ if (args.format === "json") {
3555
+ console.log(JSON.stringify(result, null, 2));
3556
+ return;
3557
+ }
3558
+ console.log(`
3514
3559
  ${result.project}`);
3515
- if (result.description) {
3516
- console.log(` ${result.description}`);
3517
- }
3518
- console.log(
3519
- `
3560
+ if (result.description) {
3561
+ console.log(` ${result.description}`);
3562
+ }
3563
+ console.log(
3564
+ `
3520
3565
  ${result.specCount} specs: ${Object.entries(result.byType).map(([k, v]) => `${v} ${k}`).join(", ")}`
3521
- );
3522
- console.log(
3523
- ` Status: ${Object.entries(result.byStatus).map(([k, v]) => `${v} ${k}`).join(", ")}`
3524
- );
3525
- console.log("\n Specs:");
3526
- for (const spec of result.specs) {
3527
- console.log(` ${spec.id} (${spec.type}, ${spec.status}) \u2014 ${spec.title}`);
3528
- if (spec.firstLine) {
3529
- console.log(` ${spec.firstLine}`);
3530
- }
3531
- }
3532
- console.log("\n Dependencies:");
3533
- for (const line of result.graph) {
3534
- console.log(` ${line}`);
3535
- }
3536
- console.log();
3566
+ );
3567
+ console.log(
3568
+ ` Status: ${Object.entries(result.byStatus).map(([k, v]) => `${v} ${k}`).join(", ")}`
3569
+ );
3570
+ console.log("\n Specs:");
3571
+ for (const spec of result.specs) {
3572
+ console.log(` ${spec.id} (${spec.type}, ${spec.status}) \u2014 ${spec.title}`);
3573
+ if (spec.firstLine) {
3574
+ console.log(` ${spec.firstLine}`);
3575
+ }
3576
+ }
3577
+ console.log("\n Dependencies:");
3578
+ for (const line of result.graph) {
3579
+ console.log(` ${line}`);
3580
+ }
3581
+ console.log();
3582
+ } catch (err) {
3583
+ console.error(`
3584
+ \u2717 ${err.message}
3585
+ `);
3586
+ process.exit(1);
3587
+ }
3537
3588
  }
3538
3589
  });
3539
3590
  export {