specdx 0.4.0-alpha.21 → 0.4.0-alpha.22

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 (60) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +24 -6
  3. package/dist/{check-GGGHTDTH.js → check-PHXXA7VY.js} +58 -21
  4. package/dist/check-PHXXA7VY.js.map +1 -0
  5. package/dist/{chunk-IEW62WR2.js → chunk-AQZQIURH.js} +12 -12
  6. package/dist/chunk-AQZQIURH.js.map +1 -0
  7. package/dist/chunk-DMGABJ6T.js +41 -0
  8. package/dist/chunk-DMGABJ6T.js.map +1 -0
  9. package/dist/{chunk-6IVWJKMQ.js → chunk-KVLFW5MI.js} +2 -2
  10. package/dist/{chunk-6IVWJKMQ.js.map → chunk-KVLFW5MI.js.map} +1 -1
  11. package/dist/{chunk-PXQML7NE.js → chunk-NAWYG4VV.js} +1 -1
  12. package/dist/chunk-NAWYG4VV.js.map +1 -0
  13. package/dist/chunk-NHD44ZYN.js +20 -0
  14. package/dist/chunk-NHD44ZYN.js.map +1 -0
  15. package/dist/{chunk-QOP2KHW3.js → chunk-UFTEMDPU.js} +27 -5
  16. package/dist/chunk-UFTEMDPU.js.map +1 -0
  17. package/dist/{diff-VHVSXLKU.js → diff-6C5LJ7SH.js} +23 -11
  18. package/dist/diff-6C5LJ7SH.js.map +1 -0
  19. package/dist/{dist-QRCEQ5WI.js → dist-SOZ3I4RP.js} +3 -3
  20. package/dist/{generate-WMJ37LCN.js → generate-AVXZHH76.js} +3 -3
  21. package/dist/{generate-story-ORJX24P7.js → generate-story-3O4T4CEV.js} +2 -2
  22. package/dist/{graph-TG2CONHV.js → graph-4RNURBNP.js} +45 -8
  23. package/dist/graph-4RNURBNP.js.map +1 -0
  24. package/dist/index.d.ts +111 -7
  25. package/dist/index.js +221 -50
  26. package/dist/index.js.map +1 -1
  27. package/dist/{lint-ZFG6ALIT.js → lint-PKWAK4CO.js} +28 -10
  28. package/dist/lint-PKWAK4CO.js.map +1 -0
  29. package/dist/main.js +2 -2
  30. package/dist/{mcp-WBHZANS5.js → mcp-VMHFWM3O.js} +3 -3
  31. package/dist/{pack-VDEO7GRF.js → pack-DE4UBTCC.js} +6 -5
  32. package/dist/pack-DE4UBTCC.js.map +1 -0
  33. package/dist/{ready-VDOH3XCV.js → ready-IKVESKEB.js} +17 -8
  34. package/dist/ready-IKVESKEB.js.map +1 -0
  35. package/dist/skills/core/specdx-sprint-review/SKILL.md +1 -1
  36. package/dist/{status-JIQUF6MX.js → status-NWMX2KJZ.js} +38 -25
  37. package/dist/status-NWMX2KJZ.js.map +1 -0
  38. package/dist/{update-DNXF5Q64.js → update-UFOHZEAK.js} +13 -4
  39. package/dist/update-UFOHZEAK.js.map +1 -0
  40. package/dist/{validate-TSAMI65E.js → validate-EZHUB5TW.js} +32 -14
  41. package/dist/validate-EZHUB5TW.js.map +1 -0
  42. package/package.json +5 -5
  43. package/dist/check-GGGHTDTH.js.map +0 -1
  44. package/dist/chunk-GAM4MXPC.js +0 -15
  45. package/dist/chunk-GAM4MXPC.js.map +0 -1
  46. package/dist/chunk-IEW62WR2.js.map +0 -1
  47. package/dist/chunk-PXQML7NE.js.map +0 -1
  48. package/dist/chunk-QOP2KHW3.js.map +0 -1
  49. package/dist/diff-VHVSXLKU.js.map +0 -1
  50. package/dist/graph-TG2CONHV.js.map +0 -1
  51. package/dist/lint-ZFG6ALIT.js.map +0 -1
  52. package/dist/pack-VDEO7GRF.js.map +0 -1
  53. package/dist/ready-VDOH3XCV.js.map +0 -1
  54. package/dist/status-JIQUF6MX.js.map +0 -1
  55. package/dist/update-DNXF5Q64.js.map +0 -1
  56. package/dist/validate-TSAMI65E.js.map +0 -1
  57. /package/dist/{dist-QRCEQ5WI.js.map → dist-SOZ3I4RP.js.map} +0 -0
  58. /package/dist/{generate-WMJ37LCN.js.map → generate-AVXZHH76.js.map} +0 -0
  59. /package/dist/{generate-story-ORJX24P7.js.map → generate-story-3O4T4CEV.js.map} +0 -0
  60. /package/dist/{mcp-WBHZANS5.js.map → mcp-VMHFWM3O.js.map} +0 -0
package/dist/index.js CHANGED
@@ -2962,6 +2962,12 @@ var EDGE_CASE_KEYWORDS = [
2962
2962
  "unprocessable"
2963
2963
  ];
2964
2964
  var ERROR_STATUS_CODE = /\b[45]\d{2}\b/;
2965
+ var EDGE_CASE_SECTION = "edge cases";
2966
+ var PLACEHOLDER_BODIES = /^(todo|tbd|fixme|n\/a|na|none|xxx|\.{2,}|-|\*)$/i;
2967
+ var DISCLAIMED_BODIES = /^(none|no|nothing|n\/a)\b[\s\S]{0,40}$/i;
2968
+ function meaningfulContent(content) {
2969
+ return content.replace(/<!--[\s\S]*?-->/g, "").split("\n").map((line) => line.replace(/^\s*[-*+]\s+/, "").trim()).filter((line) => line.length > 0 && !/^-{3,}$/.test(line)).join("\n").trim();
2970
+ }
2965
2971
  var edgeCaseCoverageRule = {
2966
2972
  id: "completeness/edge-case-coverage",
2967
2973
  description: "Flag user stories or test plans that don't mention error states or edge cases",
@@ -2970,6 +2976,22 @@ var edgeCaseCoverageRule = {
2970
2976
  const type = context.spec.frontmatter.type;
2971
2977
  if (type !== "user-story" && type !== "test-plan")
2972
2978
  return [];
2979
+ const section = context.spec.parsedSections.find((s) => s.heading.trim().toLowerCase() === EDGE_CASE_SECTION);
2980
+ if (type === "test-plan" && section) {
2981
+ const body = meaningfulContent(section.content);
2982
+ const written = body !== "" && !PLACEHOLDER_BODIES.test(body) && !DISCLAIMED_BODIES.test(body);
2983
+ if (written)
2984
+ return [];
2985
+ return [
2986
+ {
2987
+ ruleId: "completeness/edge-case-coverage",
2988
+ severity: "warn",
2989
+ message: `The "${section.heading}" section lists no cases \u2014 describe the boundary conditions and failure modes this plan covers, or the plan asserts only the happy path.`,
2990
+ filePath: context.spec.filePath,
2991
+ section: section.heading
2992
+ }
2993
+ ];
2994
+ }
2973
2995
  const content = context.spec.content.toLowerCase();
2974
2996
  const hasEdgeCases = EDGE_CASE_KEYWORDS.some((kw) => content.includes(kw)) || ERROR_STATUS_CODE.test(content);
2975
2997
  if (hasEdgeCases)
@@ -3110,8 +3132,8 @@ var ambiguityScoreAiRule = {
3110
3132
  };
3111
3133
 
3112
3134
  // ../lint/dist/rules/no-placeholder-sections.js
3113
- var PLACEHOLDER_BODIES = /^(todo|tbd|fixme|n\/a|na|none|xxx|\.{2,}|-|\*)$/i;
3114
- function meaningfulContent(content) {
3135
+ var PLACEHOLDER_BODIES2 = /^(todo|tbd|fixme|n\/a|na|none|xxx|\.{2,}|-|\*)$/i;
3136
+ function meaningfulContent2(content) {
3115
3137
  return content.replace(/<!--[\s\S]*?-->/g, "").split("\n").map((line) => line.replace(/^\s*[-*+]\s+/, "").trim()).filter((line) => line.length > 0 && !/^-{3,}$/.test(line)).join("\n").trim();
3116
3138
  }
3117
3139
  var noPlaceholderSectionsRule = {
@@ -3120,8 +3142,8 @@ var noPlaceholderSectionsRule = {
3120
3142
  severity: "warn",
3121
3143
  run(context) {
3122
3144
  return context.spec.parsedSections.filter((section) => section.heading !== "").filter((section) => {
3123
- const body = meaningfulContent(section.content);
3124
- return body === "" || PLACEHOLDER_BODIES.test(body);
3145
+ const body = meaningfulContent2(section.content);
3146
+ return body === "" || PLACEHOLDER_BODIES2.test(body);
3125
3147
  }).map((section) => ({
3126
3148
  ruleId: "completeness/no-placeholder-sections",
3127
3149
  severity: "warn",
@@ -3206,15 +3228,54 @@ function getPreset(name) {
3206
3228
  import { pathToFileURL } from "url";
3207
3229
 
3208
3230
  // src/shared-args.ts
3209
- var sharedArgs = {
3210
- quiet: { type: "boolean", description: "Suppress info output", alias: ["q"] },
3211
- verbose: { type: "boolean", description: "Enable debug output", alias: ["V"] },
3212
- format: {
3213
- type: "string",
3214
- description: "Output format (pretty, json, github)",
3215
- default: "pretty"
3216
- }
3231
+ var quietArg = {
3232
+ type: "boolean",
3233
+ description: "Suppress success and summary output; problems still print",
3234
+ alias: ["q"]
3235
+ };
3236
+ var verboseArg = {
3237
+ type: "boolean",
3238
+ description: "Enable debug output",
3239
+ alias: ["V"]
3217
3240
  };
3241
+ function formatArg(formats) {
3242
+ const [fallback] = formats;
3243
+ if (!fallback) throw new Error("formatArg requires at least one format");
3244
+ return {
3245
+ type: "string",
3246
+ description: `Output format (${formats.join(", ")})`,
3247
+ default: fallback
3248
+ };
3249
+ }
3250
+ function sharedArgs(formats) {
3251
+ return { quiet: quietArg, verbose: verboseArg, format: formatArg(formats) };
3252
+ }
3253
+ function resolveFormat(value, formats) {
3254
+ const [fallback] = formats;
3255
+ if (!fallback) throw new Error("resolveFormat requires at least one format");
3256
+ if (value === void 0) return { ok: true, format: fallback };
3257
+ if (formats.includes(value)) return { ok: true, format: value };
3258
+ return {
3259
+ ok: false,
3260
+ message: `unknown --format "${value}". This command renders: ${formats.join(", ")}.`
3261
+ };
3262
+ }
3263
+
3264
+ // src/output.ts
3265
+ function createOutput(options = {}) {
3266
+ const quiet = options.quiet === true;
3267
+ return {
3268
+ info(line = "") {
3269
+ if (!quiet) console.log(line);
3270
+ },
3271
+ out(line = "") {
3272
+ console.log(line);
3273
+ },
3274
+ error(line = "") {
3275
+ console.error(line);
3276
+ }
3277
+ };
3278
+ }
3218
3279
 
3219
3280
  // src/formatters/pretty.ts
3220
3281
  function formatPretty(diagnostics) {
@@ -3234,13 +3295,14 @@ function formatJson(diagnostics) {
3234
3295
  // src/formatters/github.ts
3235
3296
  function formatGithub(diagnostics) {
3236
3297
  return diagnostics.map((d) => {
3237
- const level = d.severity === "error" ? "error" : "warning";
3298
+ const level = d.severity === "error" ? "error" : d.severity === "warn" ? "warning" : "notice";
3238
3299
  const line = d.line ? `,line=${d.line}` : "";
3239
3300
  return `::${level} file=${d.filePath}${line}::${d.message} (${d.ruleId})`;
3240
3301
  }).join("\n");
3241
3302
  }
3242
3303
 
3243
3304
  // src/commands/core/lint.ts
3305
+ var FORMATS = ["pretty", "json", "github"];
3244
3306
  async function runLint(options) {
3245
3307
  if (!options.configDir) {
3246
3308
  throw new TypeError("runLint requires `configDir` \u2014 the directory holding spec.config.yaml.");
@@ -3279,18 +3341,26 @@ async function runLint(options) {
3279
3341
  });
3280
3342
  results.hasErrors = true;
3281
3343
  }
3282
- return { ...results, specCount: specs.length, assessed: specs.length > 0 };
3344
+ return { ...results, specFiles: specs.length, assessed: specs.length > 0 };
3283
3345
  }
3284
3346
  var lint_default = defineCommand2({
3285
3347
  meta: { name: "lint", description: "Lint all specs in the suite" },
3286
3348
  args: {
3287
- ...sharedArgs,
3349
+ ...sharedArgs(FORMATS),
3288
3350
  fix: { type: "boolean", description: "Auto-fix issues where possible" },
3289
3351
  path: { type: "positional", description: "Lint a specific spec file", required: false },
3290
3352
  preset: { type: "string", description: "Lint preset (minimal, recommended, strict)" }
3291
3353
  },
3292
3354
  async run({ args }) {
3293
3355
  const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
3356
+ const output = createOutput({ quiet: args.quiet });
3357
+ const format = resolveFormat(args.format, FORMATS);
3358
+ if (!format.ok) {
3359
+ console.error(`
3360
+ \u2717 ${format.message}
3361
+ `);
3362
+ process.exit(1);
3363
+ }
3294
3364
  if (args.fix) {
3295
3365
  logger.info("No auto-fixable issues supported yet.");
3296
3366
  }
@@ -3300,14 +3370,19 @@ var lint_default = defineCommand2({
3300
3370
  specPath: args.path,
3301
3371
  preset: args.preset
3302
3372
  });
3303
- const formatter = args.format === "json" ? formatJson : args.format === "github" ? formatGithub : formatPretty;
3373
+ const formatter = format.format === "json" ? formatJson : format.format === "github" ? formatGithub : formatPretty;
3304
3374
  if (!results.assessed) {
3305
3375
  console.error(
3306
3376
  "\n \u26A0 No specs found \u2014 nothing was linted. Check the spec paths in spec.config.yaml.\n"
3307
3377
  );
3308
3378
  process.exit(3);
3309
3379
  }
3310
- console.log(formatter(results.diagnostics));
3380
+ const rendered = formatter(results.diagnostics);
3381
+ if (format.format === "pretty" && results.diagnostics.length === 0) {
3382
+ output.info(rendered);
3383
+ } else {
3384
+ output.out(rendered);
3385
+ }
3311
3386
  if (results.hasErrors) process.exit(1);
3312
3387
  } catch (err) {
3313
3388
  console.error(`
@@ -4062,8 +4137,8 @@ async function runPack(options) {
4062
4137
  var pack_default = defineCommand3({
4063
4138
  meta: { name: "pack", description: "Pack specs into AI-ready context" },
4064
4139
  args: {
4065
- quiet: sharedArgs.quiet,
4066
- verbose: sharedArgs.verbose,
4140
+ quiet: quietArg,
4141
+ verbose: verboseArg,
4067
4142
  task: { type: "string", description: "Task or context to optimise relevance for" },
4068
4143
  specs: { type: "string", description: "Comma-separated spec IDs or glob patterns to include" },
4069
4144
  budget: { type: "string", description: "Maximum token budget for the output" },
@@ -5537,8 +5612,9 @@ function formatChangelog(result, baseRef, headRef) {
5537
5612
  }
5538
5613
 
5539
5614
  // src/commands/core/diff.ts
5615
+ var FORMATS2 = ["pretty", "json", "changelog"];
5540
5616
  async function runDiff(options) {
5541
- const configDir = process.cwd();
5617
+ const configDir = options.configDir ?? process.cwd();
5542
5618
  const config = await loadConfig(void 0, configDir);
5543
5619
  const baseRef = options.base ?? config.diff?.baseline_ref ?? DEFAULT_DIFF_CONFIG.baseline_ref;
5544
5620
  const headRef = options.head ?? "HEAD";
@@ -5563,13 +5639,17 @@ var diff_default = defineCommand4({
5563
5639
  default: false
5564
5640
  },
5565
5641
  spec: { type: "string", description: "Scope to a single spec ID" },
5566
- format: {
5567
- type: "string",
5568
- description: "Output format: pretty, json, changelog",
5569
- default: "pretty"
5570
- }
5642
+ ...sharedArgs(FORMATS2)
5571
5643
  },
5572
5644
  async run({ args }) {
5645
+ const format = resolveFormat(args.format, FORMATS2);
5646
+ if (!format.ok) {
5647
+ console.error(`
5648
+ \u2717 ${format.message}
5649
+ `);
5650
+ process.exit(1);
5651
+ }
5652
+ const output = createOutput({ quiet: args.quiet });
5573
5653
  try {
5574
5654
  try {
5575
5655
  const result = await runDiff({
@@ -5579,11 +5659,11 @@ var diff_default = defineCommand4({
5579
5659
  format: args.format,
5580
5660
  working: args.working
5581
5661
  });
5582
- if (args.format === "json") {
5662
+ if (format.format === "json") {
5583
5663
  console.log(JSON.stringify(result, null, 2));
5584
5664
  return;
5585
5665
  }
5586
- if (args.format === "changelog") {
5666
+ if (format.format === "changelog") {
5587
5667
  const baseRef = args.base ?? (await loadConfig(void 0, process.cwd())).diff?.baseline_ref ?? "main";
5588
5668
  console.log(
5589
5669
  formatChangelog(result, baseRef, args.working ? "working tree" : args.head ?? "HEAD")
@@ -5603,7 +5683,7 @@ var diff_default = defineCommand4({
5603
5683
  console.log(" Run with --working to include them.");
5604
5684
  };
5605
5685
  if (result.diffs.length === 0 && result.added.length === 0 && result.removed.length === 0) {
5606
- console.log(" \u2713 No spec changes detected.");
5686
+ output.info(" \u2713 No spec changes detected.");
5607
5687
  printUncommittedWarning();
5608
5688
  return;
5609
5689
  }
@@ -5658,8 +5738,9 @@ var diff_default = defineCommand4({
5658
5738
 
5659
5739
  // src/commands/core/status.ts
5660
5740
  import { defineCommand as defineCommand5 } from "citty";
5661
- async function runStatus(_options = {}) {
5662
- const configDir = process.cwd();
5741
+ var FORMATS3 = ["pretty", "json", "github"];
5742
+ async function runStatus(options = {}) {
5743
+ const configDir = options.configDir ?? process.cwd();
5663
5744
  const config = await loadConfig(void 0, configDir);
5664
5745
  const specs = [];
5665
5746
  for (const [, entry] of Object.entries(config.specs)) {
@@ -5730,7 +5811,7 @@ async function runStatus(_options = {}) {
5730
5811
  else if (specs.length === 0) verdict = "unassessed";
5731
5812
  return {
5732
5813
  project: config.project?.name ?? "unknown",
5733
- specCount: specs.length,
5814
+ specFiles: specs.length,
5734
5815
  byStatus,
5735
5816
  lintHealth: { errors, warnings, passing: specs.length - errors },
5736
5817
  staleSpecs,
@@ -5740,21 +5821,23 @@ async function runStatus(_options = {}) {
5740
5821
  }
5741
5822
  var status_default = defineCommand5({
5742
5823
  meta: { name: "status", description: "Show spec suite health overview" },
5743
- args: {
5744
- format: {
5745
- type: "string",
5746
- description: "Output format: pretty, json, github",
5747
- default: "pretty"
5748
- }
5749
- },
5824
+ args: { ...sharedArgs(FORMATS3) },
5750
5825
  async run({ args }) {
5826
+ const format = resolveFormat(args.format, FORMATS3);
5827
+ if (!format.ok) {
5828
+ console.error(`
5829
+ \u2717 ${format.message}
5830
+ `);
5831
+ process.exit(1);
5832
+ }
5833
+ const output = createOutput({ quiet: args.quiet });
5751
5834
  try {
5752
- const result = await runStatus({ format: args.format });
5753
- if (args.format === "json") {
5835
+ const result = await runStatus();
5836
+ if (format.format === "json") {
5754
5837
  console.log(JSON.stringify(result, null, 2));
5755
5838
  return;
5756
5839
  }
5757
- if (args.format === "github") {
5840
+ if (format.format === "github") {
5758
5841
  for (const s of result.staleSpecs) {
5759
5842
  console.log(
5760
5843
  `::warning::Spec "${s.specId}" is stale (${s.daysSinceUpdate} days since update)`
@@ -5766,28 +5849,31 @@ var status_default = defineCommand5({
5766
5849
  return;
5767
5850
  }
5768
5851
  const icon = result.verdict === "healthy" ? "\u2713" : result.verdict === "warnings" || result.verdict === "unassessed" ? "\u26A0" : "\u2717";
5769
- console.log(`
5770
- ${icon} ${result.project} \u2014 ${result.verdict}`);
5852
+ const healthy = result.verdict === "healthy";
5853
+ const headline = `
5854
+ ${icon} ${result.project} \u2014 ${result.verdict}`;
5855
+ if (healthy) output.info(headline);
5856
+ else output.out(headline);
5771
5857
  if (result.verdict === "unassessed") {
5772
- console.log(
5858
+ output.out(
5773
5859
  " No specs resolved \u2014 nothing was assessed. Check the spec paths in spec.config.yaml."
5774
5860
  );
5775
5861
  }
5776
- console.log(
5777
- ` ${result.specCount} specs: ${Object.entries(result.byStatus).map(([k, v]) => `${v} ${k}`).join(", ")}`
5862
+ output.info(
5863
+ ` ${result.specFiles} specs: ${Object.entries(result.byStatus).map(([k, v]) => `${v} ${k}`).join(", ")}`
5778
5864
  );
5779
- console.log(
5865
+ output.info(
5780
5866
  ` Lint: ${result.lintHealth.errors} errors, ${result.lintHealth.warnings} warnings`
5781
5867
  );
5782
5868
  if (result.staleSpecs.length > 0) {
5783
- console.log(
5869
+ output.out(
5784
5870
  ` Stale: ${result.staleSpecs.map((s) => `${s.specId} (${s.daysSinceUpdate}d)`).join(", ")}`
5785
5871
  );
5786
5872
  }
5787
5873
  if (result.integrityIssues.length > 0) {
5788
- console.log(` Issues: ${result.integrityIssues.join("; ")}`);
5874
+ output.out(` Issues: ${result.integrityIssues.join("; ")}`);
5789
5875
  }
5790
- console.log();
5876
+ output.info();
5791
5877
  } catch (err) {
5792
5878
  console.error(`
5793
5879
  \u2717 ${err.message}
@@ -5796,11 +5882,96 @@ var status_default = defineCommand5({
5796
5882
  }
5797
5883
  }
5798
5884
  });
5885
+
5886
+ // src/commands/core/validate.ts
5887
+ import { defineCommand as defineCommand6 } from "citty";
5888
+ var FORMATS4 = ["pretty", "json"];
5889
+ async function runValidate(configDir) {
5890
+ const warnings = [];
5891
+ try {
5892
+ const config = await loadConfig(void 0, configDir);
5893
+ buildGraph(config);
5894
+ let specFiles = 0;
5895
+ const missingRequired = [];
5896
+ for (const [key, entry] of Object.entries(config.specs)) {
5897
+ const files = await resolveGlob(entry.path, configDir);
5898
+ specFiles += files.length;
5899
+ if (files.length > 0) continue;
5900
+ if (entry.required) {
5901
+ missingRequired.push(`"${key}" (${entry.path})`);
5902
+ } else {
5903
+ warnings.push(`spec entry "${key}" resolves to no files: ${entry.path}`);
5904
+ }
5905
+ }
5906
+ if (missingRequired.length > 0) {
5907
+ return {
5908
+ valid: false,
5909
+ specEntries: Object.keys(config.specs).length,
5910
+ specFiles,
5911
+ warnings,
5912
+ error: `required spec entry resolves to no files: ${missingRequired.join(", ")}`
5913
+ };
5914
+ }
5915
+ if (specFiles === 0) {
5916
+ warnings.push(
5917
+ "no spec files found \u2014 every downstream check (lint, status, ready) would pass vacuously"
5918
+ );
5919
+ }
5920
+ return {
5921
+ valid: true,
5922
+ specEntries: Object.keys(config.specs).length,
5923
+ specFiles,
5924
+ warnings
5925
+ };
5926
+ } catch (err) {
5927
+ if (err instanceof ConfigError) {
5928
+ return { valid: false, warnings, error: err.message, details: err.errors ?? void 0 };
5929
+ }
5930
+ if (err instanceof GraphError) {
5931
+ return { valid: false, warnings, error: err.message };
5932
+ }
5933
+ throw err;
5934
+ }
5935
+ }
5936
+ var validate_default = defineCommand6({
5937
+ meta: { name: "validate", description: "Validate spec.config.yaml" },
5938
+ args: { ...sharedArgs(FORMATS4) },
5939
+ async run({ args }) {
5940
+ const format = resolveFormat(args.format, FORMATS4);
5941
+ if (!format.ok) {
5942
+ console.error(`
5943
+ \u2717 ${format.message}
5944
+ `);
5945
+ process.exit(1);
5946
+ }
5947
+ const output = createOutput({ quiet: args.quiet });
5948
+ const result = await runValidate(process.cwd());
5949
+ if (format.format === "json") {
5950
+ console.log(JSON.stringify(result, null, 2));
5951
+ if (!result.valid) process.exit(1);
5952
+ return;
5953
+ }
5954
+ if (result.valid) {
5955
+ output.info(
5956
+ ` \u2713 Config valid. ${result.specEntries} spec entries, ${result.specFiles} spec files.`
5957
+ );
5958
+ for (const w of result.warnings) output.out(` \u26A0 ${w}`);
5959
+ return;
5960
+ }
5961
+ console.error(` \u2717 Config invalid: ${result.error}`);
5962
+ for (const w of result.warnings) console.error(` \u26A0 ${w}`);
5963
+ if (result.details) {
5964
+ for (const e of result.details) console.error(` - ${JSON.stringify(e)}`);
5965
+ }
5966
+ process.exit(1);
5967
+ }
5968
+ });
5799
5969
  export {
5800
5970
  runDiff,
5801
5971
  runLint,
5802
5972
  runPack,
5803
5973
  runStatus,
5974
+ runValidate,
5804
5975
  scaffoldProject
5805
5976
  };
5806
5977
  //# sourceMappingURL=index.js.map