specdx 0.4.0-alpha.21 → 0.4.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +24 -6
- package/dist/{check-GGGHTDTH.js → check-PHXXA7VY.js} +58 -21
- package/dist/check-PHXXA7VY.js.map +1 -0
- package/dist/{chunk-IEW62WR2.js → chunk-CPOXPRS7.js} +12 -12
- package/dist/chunk-CPOXPRS7.js.map +1 -0
- package/dist/chunk-DMGABJ6T.js +41 -0
- package/dist/chunk-DMGABJ6T.js.map +1 -0
- package/dist/{chunk-6IVWJKMQ.js → chunk-ESXULBLW.js} +2 -2
- package/dist/{chunk-6IVWJKMQ.js.map → chunk-ESXULBLW.js.map} +1 -1
- package/dist/{chunk-PXQML7NE.js → chunk-NAWYG4VV.js} +1 -1
- package/dist/chunk-NAWYG4VV.js.map +1 -0
- package/dist/chunk-NHD44ZYN.js +20 -0
- package/dist/chunk-NHD44ZYN.js.map +1 -0
- package/dist/{chunk-QOP2KHW3.js → chunk-UFTEMDPU.js} +27 -5
- package/dist/chunk-UFTEMDPU.js.map +1 -0
- package/dist/{diff-VHVSXLKU.js → diff-6C5LJ7SH.js} +23 -11
- package/dist/diff-6C5LJ7SH.js.map +1 -0
- package/dist/{dist-QRCEQ5WI.js → dist-SOZ3I4RP.js} +3 -3
- package/dist/{generate-WMJ37LCN.js → generate-IXDZTWWA.js} +3 -3
- package/dist/{generate-story-ORJX24P7.js → generate-story-3O4T4CEV.js} +2 -2
- package/dist/{graph-TG2CONHV.js → graph-4RNURBNP.js} +45 -8
- package/dist/graph-4RNURBNP.js.map +1 -0
- package/dist/index.d.ts +111 -7
- package/dist/index.js +235 -51
- package/dist/index.js.map +1 -1
- package/dist/{lint-ZFG6ALIT.js → lint-PKWAK4CO.js} +28 -10
- package/dist/lint-PKWAK4CO.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/{mcp-WBHZANS5.js → mcp-ZOLM2ATO.js} +3 -3
- package/dist/{pack-VDEO7GRF.js → pack-DE4UBTCC.js} +6 -5
- package/dist/pack-DE4UBTCC.js.map +1 -0
- package/dist/{ready-VDOH3XCV.js → ready-IKVESKEB.js} +17 -8
- package/dist/ready-IKVESKEB.js.map +1 -0
- package/dist/skills/core/specdx-sprint-review/SKILL.md +1 -1
- package/dist/{status-JIQUF6MX.js → status-W557JGZB.js} +52 -26
- package/dist/status-W557JGZB.js.map +1 -0
- package/dist/{update-DNXF5Q64.js → update-UFOHZEAK.js} +13 -4
- package/dist/update-UFOHZEAK.js.map +1 -0
- package/dist/{validate-TSAMI65E.js → validate-EZHUB5TW.js} +32 -14
- package/dist/validate-EZHUB5TW.js.map +1 -0
- package/package.json +2 -2
- package/dist/check-GGGHTDTH.js.map +0 -1
- package/dist/chunk-GAM4MXPC.js +0 -15
- package/dist/chunk-GAM4MXPC.js.map +0 -1
- package/dist/chunk-IEW62WR2.js.map +0 -1
- package/dist/chunk-PXQML7NE.js.map +0 -1
- package/dist/chunk-QOP2KHW3.js.map +0 -1
- package/dist/diff-VHVSXLKU.js.map +0 -1
- package/dist/graph-TG2CONHV.js.map +0 -1
- package/dist/lint-ZFG6ALIT.js.map +0 -1
- package/dist/pack-VDEO7GRF.js.map +0 -1
- package/dist/ready-VDOH3XCV.js.map +0 -1
- package/dist/status-JIQUF6MX.js.map +0 -1
- package/dist/update-DNXF5Q64.js.map +0 -1
- package/dist/validate-TSAMI65E.js.map +0 -1
- /package/dist/{dist-QRCEQ5WI.js.map → dist-SOZ3I4RP.js.map} +0 -0
- /package/dist/{generate-WMJ37LCN.js.map → generate-IXDZTWWA.js.map} +0 -0
- /package/dist/{generate-story-ORJX24P7.js.map → generate-story-3O4T4CEV.js.map} +0 -0
- /package/dist/{mcp-WBHZANS5.js.map → mcp-ZOLM2ATO.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
|
|
3114
|
-
function
|
|
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 =
|
|
3124
|
-
return 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
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
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,
|
|
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 =
|
|
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
|
-
|
|
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:
|
|
4066
|
-
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
|
-
|
|
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 (
|
|
5662
|
+
if (format.format === "json") {
|
|
5583
5663
|
console.log(JSON.stringify(result, null, 2));
|
|
5584
5664
|
return;
|
|
5585
5665
|
}
|
|
5586
|
-
if (
|
|
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
|
-
|
|
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
|
-
|
|
5662
|
-
|
|
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)) {
|
|
@@ -5696,6 +5777,10 @@ async function runStatus(_options = {}) {
|
|
|
5696
5777
|
}
|
|
5697
5778
|
const errors = lintResults.diagnostics.filter((d) => d.severity === "error").length;
|
|
5698
5779
|
const warnings = lintResults.diagnostics.filter((d) => d.severity === "warn").length;
|
|
5780
|
+
const specsWithErrors = new Set(
|
|
5781
|
+
lintResults.diagnostics.filter((d) => d.severity === "error").map((d) => d.filePath)
|
|
5782
|
+
);
|
|
5783
|
+
const passing = specs.filter(({ spec }) => !specsWithErrors.has(spec.filePath)).length;
|
|
5699
5784
|
const thresholdDays = config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;
|
|
5700
5785
|
const now = Date.now();
|
|
5701
5786
|
const staleSpecs = [];
|
|
@@ -5730,9 +5815,9 @@ async function runStatus(_options = {}) {
|
|
|
5730
5815
|
else if (specs.length === 0) verdict = "unassessed";
|
|
5731
5816
|
return {
|
|
5732
5817
|
project: config.project?.name ?? "unknown",
|
|
5733
|
-
|
|
5818
|
+
specFiles: specs.length,
|
|
5734
5819
|
byStatus,
|
|
5735
|
-
lintHealth: { errors, warnings, passing
|
|
5820
|
+
lintHealth: { errors, warnings, passing },
|
|
5736
5821
|
staleSpecs,
|
|
5737
5822
|
integrityIssues,
|
|
5738
5823
|
verdict
|
|
@@ -5740,21 +5825,32 @@ async function runStatus(_options = {}) {
|
|
|
5740
5825
|
}
|
|
5741
5826
|
var status_default = defineCommand5({
|
|
5742
5827
|
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
|
-
},
|
|
5828
|
+
args: { ...sharedArgs(FORMATS3) },
|
|
5750
5829
|
async run({ args }) {
|
|
5830
|
+
const format = resolveFormat(args.format, FORMATS3);
|
|
5831
|
+
if (!format.ok) {
|
|
5832
|
+
console.error(`
|
|
5833
|
+
\u2717 ${format.message}
|
|
5834
|
+
`);
|
|
5835
|
+
process.exit(1);
|
|
5836
|
+
}
|
|
5837
|
+
const output = createOutput({ quiet: args.quiet });
|
|
5751
5838
|
try {
|
|
5752
|
-
const result = await runStatus(
|
|
5753
|
-
if (
|
|
5839
|
+
const result = await runStatus();
|
|
5840
|
+
if (format.format === "json") {
|
|
5754
5841
|
console.log(JSON.stringify(result, null, 2));
|
|
5755
5842
|
return;
|
|
5756
5843
|
}
|
|
5757
|
-
if (
|
|
5844
|
+
if (format.format === "github") {
|
|
5845
|
+
const level = result.verdict === "errors" ? "error" : result.verdict === "healthy" ? "notice" : "warning";
|
|
5846
|
+
console.log(
|
|
5847
|
+
`::${level}::specdx status \u2014 ${result.project} \u2014 ${result.verdict}: ${result.specFiles} spec file(s), ${result.lintHealth.errors} error(s), ${result.lintHealth.warnings} warning(s)`
|
|
5848
|
+
);
|
|
5849
|
+
if (result.verdict === "unassessed") {
|
|
5850
|
+
console.log(
|
|
5851
|
+
"::warning::No specs resolved \u2014 nothing was assessed. Check the spec paths in spec.config.yaml."
|
|
5852
|
+
);
|
|
5853
|
+
}
|
|
5758
5854
|
for (const s of result.staleSpecs) {
|
|
5759
5855
|
console.log(
|
|
5760
5856
|
`::warning::Spec "${s.specId}" is stale (${s.daysSinceUpdate} days since update)`
|
|
@@ -5766,28 +5862,31 @@ var status_default = defineCommand5({
|
|
|
5766
5862
|
return;
|
|
5767
5863
|
}
|
|
5768
5864
|
const icon = result.verdict === "healthy" ? "\u2713" : result.verdict === "warnings" || result.verdict === "unassessed" ? "\u26A0" : "\u2717";
|
|
5769
|
-
|
|
5770
|
-
|
|
5865
|
+
const healthy = result.verdict === "healthy";
|
|
5866
|
+
const headline = `
|
|
5867
|
+
${icon} ${result.project} \u2014 ${result.verdict}`;
|
|
5868
|
+
if (healthy) output.info(headline);
|
|
5869
|
+
else output.out(headline);
|
|
5771
5870
|
if (result.verdict === "unassessed") {
|
|
5772
|
-
|
|
5871
|
+
output.out(
|
|
5773
5872
|
" No specs resolved \u2014 nothing was assessed. Check the spec paths in spec.config.yaml."
|
|
5774
5873
|
);
|
|
5775
5874
|
}
|
|
5776
|
-
|
|
5777
|
-
` ${result.
|
|
5875
|
+
output.info(
|
|
5876
|
+
` ${result.specFiles} specs: ${Object.entries(result.byStatus).map(([k, v]) => `${v} ${k}`).join(", ")}`
|
|
5778
5877
|
);
|
|
5779
|
-
|
|
5878
|
+
output.info(
|
|
5780
5879
|
` Lint: ${result.lintHealth.errors} errors, ${result.lintHealth.warnings} warnings`
|
|
5781
5880
|
);
|
|
5782
5881
|
if (result.staleSpecs.length > 0) {
|
|
5783
|
-
|
|
5882
|
+
output.out(
|
|
5784
5883
|
` Stale: ${result.staleSpecs.map((s) => `${s.specId} (${s.daysSinceUpdate}d)`).join(", ")}`
|
|
5785
5884
|
);
|
|
5786
5885
|
}
|
|
5787
5886
|
if (result.integrityIssues.length > 0) {
|
|
5788
|
-
|
|
5887
|
+
output.out(` Issues: ${result.integrityIssues.join("; ")}`);
|
|
5789
5888
|
}
|
|
5790
|
-
|
|
5889
|
+
output.info();
|
|
5791
5890
|
} catch (err) {
|
|
5792
5891
|
console.error(`
|
|
5793
5892
|
\u2717 ${err.message}
|
|
@@ -5796,11 +5895,96 @@ var status_default = defineCommand5({
|
|
|
5796
5895
|
}
|
|
5797
5896
|
}
|
|
5798
5897
|
});
|
|
5898
|
+
|
|
5899
|
+
// src/commands/core/validate.ts
|
|
5900
|
+
import { defineCommand as defineCommand6 } from "citty";
|
|
5901
|
+
var FORMATS4 = ["pretty", "json"];
|
|
5902
|
+
async function runValidate(configDir) {
|
|
5903
|
+
const warnings = [];
|
|
5904
|
+
try {
|
|
5905
|
+
const config = await loadConfig(void 0, configDir);
|
|
5906
|
+
buildGraph(config);
|
|
5907
|
+
let specFiles = 0;
|
|
5908
|
+
const missingRequired = [];
|
|
5909
|
+
for (const [key, entry] of Object.entries(config.specs)) {
|
|
5910
|
+
const files = await resolveGlob(entry.path, configDir);
|
|
5911
|
+
specFiles += files.length;
|
|
5912
|
+
if (files.length > 0) continue;
|
|
5913
|
+
if (entry.required) {
|
|
5914
|
+
missingRequired.push(`"${key}" (${entry.path})`);
|
|
5915
|
+
} else {
|
|
5916
|
+
warnings.push(`spec entry "${key}" resolves to no files: ${entry.path}`);
|
|
5917
|
+
}
|
|
5918
|
+
}
|
|
5919
|
+
if (missingRequired.length > 0) {
|
|
5920
|
+
return {
|
|
5921
|
+
valid: false,
|
|
5922
|
+
specEntries: Object.keys(config.specs).length,
|
|
5923
|
+
specFiles,
|
|
5924
|
+
warnings,
|
|
5925
|
+
error: `required spec entry resolves to no files: ${missingRequired.join(", ")}`
|
|
5926
|
+
};
|
|
5927
|
+
}
|
|
5928
|
+
if (specFiles === 0) {
|
|
5929
|
+
warnings.push(
|
|
5930
|
+
"no spec files found \u2014 every downstream check (lint, status, ready) would pass vacuously"
|
|
5931
|
+
);
|
|
5932
|
+
}
|
|
5933
|
+
return {
|
|
5934
|
+
valid: true,
|
|
5935
|
+
specEntries: Object.keys(config.specs).length,
|
|
5936
|
+
specFiles,
|
|
5937
|
+
warnings
|
|
5938
|
+
};
|
|
5939
|
+
} catch (err) {
|
|
5940
|
+
if (err instanceof ConfigError) {
|
|
5941
|
+
return { valid: false, warnings, error: err.message, details: err.errors ?? void 0 };
|
|
5942
|
+
}
|
|
5943
|
+
if (err instanceof GraphError) {
|
|
5944
|
+
return { valid: false, warnings, error: err.message };
|
|
5945
|
+
}
|
|
5946
|
+
throw err;
|
|
5947
|
+
}
|
|
5948
|
+
}
|
|
5949
|
+
var validate_default = defineCommand6({
|
|
5950
|
+
meta: { name: "validate", description: "Validate spec.config.yaml" },
|
|
5951
|
+
args: { ...sharedArgs(FORMATS4) },
|
|
5952
|
+
async run({ args }) {
|
|
5953
|
+
const format = resolveFormat(args.format, FORMATS4);
|
|
5954
|
+
if (!format.ok) {
|
|
5955
|
+
console.error(`
|
|
5956
|
+
\u2717 ${format.message}
|
|
5957
|
+
`);
|
|
5958
|
+
process.exit(1);
|
|
5959
|
+
}
|
|
5960
|
+
const output = createOutput({ quiet: args.quiet });
|
|
5961
|
+
const result = await runValidate(process.cwd());
|
|
5962
|
+
if (format.format === "json") {
|
|
5963
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5964
|
+
if (!result.valid) process.exit(1);
|
|
5965
|
+
return;
|
|
5966
|
+
}
|
|
5967
|
+
if (result.valid) {
|
|
5968
|
+
output.info(
|
|
5969
|
+
` \u2713 Config valid. ${result.specEntries} spec entries, ${result.specFiles} spec files.`
|
|
5970
|
+
);
|
|
5971
|
+
for (const w of result.warnings) output.out(` \u26A0 ${w}`);
|
|
5972
|
+
return;
|
|
5973
|
+
}
|
|
5974
|
+
console.error(` \u2717 Config invalid: ${result.error}`);
|
|
5975
|
+
for (const w of result.warnings) console.error(` \u26A0 ${w}`);
|
|
5976
|
+
if (result.details) {
|
|
5977
|
+
for (const e of result.details) console.error(` - ${JSON.stringify(e)}`);
|
|
5978
|
+
}
|
|
5979
|
+
process.exit(1);
|
|
5980
|
+
}
|
|
5981
|
+
});
|
|
5799
5982
|
export {
|
|
5800
5983
|
runDiff,
|
|
5801
5984
|
runLint,
|
|
5802
5985
|
runPack,
|
|
5803
5986
|
runStatus,
|
|
5987
|
+
runValidate,
|
|
5804
5988
|
scaffoldProject
|
|
5805
5989
|
};
|
|
5806
5990
|
//# sourceMappingURL=index.js.map
|