specdx 0.4.0 → 0.5.0

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 (55) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +25 -1
  3. package/dist/{check-PHXXA7VY.js → check-RH5SCXWW.js} +3 -3
  4. package/dist/{chunk-2BZIG7OE.js → chunk-6EQIDZ4D.js} +14 -14
  5. package/dist/{chunk-NAWYG4VV.js → chunk-6WFNZH7F.js} +2 -2
  6. package/dist/{chunk-YRQPY5NF.js → chunk-BMOOLUPG.js} +2 -2
  7. package/dist/{chunk-SNQNQ2MP.js → chunk-BP3SB35W.js} +2 -2
  8. package/dist/{chunk-OVIKIIR4.js → chunk-CQETLJTZ.js} +2 -2
  9. package/dist/{chunk-OVIKIIR4.js.map → chunk-CQETLJTZ.js.map} +1 -1
  10. package/dist/{chunk-HCJDCS26.js → chunk-XRWLPU24.js} +10 -1
  11. package/dist/chunk-XRWLPU24.js.map +1 -0
  12. package/dist/{chunk-LJTLNXGV.js → chunk-ZIODMXST.js} +315 -4
  13. package/dist/chunk-ZIODMXST.js.map +1 -0
  14. package/dist/{diff-6C5LJ7SH.js → diff-QO7HMAK3.js} +4 -4
  15. package/dist/{dist-PK52GA7M.js → dist-JPWHWMV2.js} +51 -12
  16. package/dist/dist-JPWHWMV2.js.map +1 -0
  17. package/dist/{generate-K72WD455.js → generate-MS4BM7RU.js} +5 -5
  18. package/dist/{generate-story-NUCNYL3I.js → generate-story-OMM322L7.js} +4 -4
  19. package/dist/{generate-test-plan-Z46W3N3B.js → generate-test-plan-75W7SZIO.js} +3 -3
  20. package/dist/{graph-4RNURBNP.js → graph-QOTMXENE.js} +3 -3
  21. package/dist/index.d.ts +27 -0
  22. package/dist/index.js +369 -19
  23. package/dist/index.js.map +1 -1
  24. package/dist/{lint-2VZPNLE3.js → lint-LPFLHVO4.js} +45 -11
  25. package/dist/lint-LPFLHVO4.js.map +1 -0
  26. package/dist/main.js +3 -3
  27. package/dist/{mcp-E6PJWBDQ.js → mcp-OEC43SPF.js} +3 -3
  28. package/dist/{migrate-FKFC7UAO.js → migrate-CBP2AVLH.js} +3 -3
  29. package/dist/{pack-DE4UBTCC.js → pack-X6FSWORJ.js} +4 -4
  30. package/dist/{ready-K74SLQ24.js → ready-7MJWRGLT.js} +5 -5
  31. package/dist/{status-IAE3BB77.js → status-UUPZYX3J.js} +5 -5
  32. package/dist/{update-UFOHZEAK.js → update-EI7IJRHG.js} +3 -3
  33. package/dist/{validate-EZHUB5TW.js → validate-HTTZLQWI.js} +3 -3
  34. package/package.json +2 -2
  35. package/dist/chunk-HCJDCS26.js.map +0 -1
  36. package/dist/chunk-LJTLNXGV.js.map +0 -1
  37. package/dist/dist-PK52GA7M.js.map +0 -1
  38. package/dist/lint-2VZPNLE3.js.map +0 -1
  39. /package/dist/{check-PHXXA7VY.js.map → check-RH5SCXWW.js.map} +0 -0
  40. /package/dist/{chunk-2BZIG7OE.js.map → chunk-6EQIDZ4D.js.map} +0 -0
  41. /package/dist/{chunk-NAWYG4VV.js.map → chunk-6WFNZH7F.js.map} +0 -0
  42. /package/dist/{chunk-YRQPY5NF.js.map → chunk-BMOOLUPG.js.map} +0 -0
  43. /package/dist/{chunk-SNQNQ2MP.js.map → chunk-BP3SB35W.js.map} +0 -0
  44. /package/dist/{diff-6C5LJ7SH.js.map → diff-QO7HMAK3.js.map} +0 -0
  45. /package/dist/{generate-K72WD455.js.map → generate-MS4BM7RU.js.map} +0 -0
  46. /package/dist/{generate-story-NUCNYL3I.js.map → generate-story-OMM322L7.js.map} +0 -0
  47. /package/dist/{generate-test-plan-Z46W3N3B.js.map → generate-test-plan-75W7SZIO.js.map} +0 -0
  48. /package/dist/{graph-4RNURBNP.js.map → graph-QOTMXENE.js.map} +0 -0
  49. /package/dist/{mcp-E6PJWBDQ.js.map → mcp-OEC43SPF.js.map} +0 -0
  50. /package/dist/{migrate-FKFC7UAO.js.map → migrate-CBP2AVLH.js.map} +0 -0
  51. /package/dist/{pack-DE4UBTCC.js.map → pack-X6FSWORJ.js.map} +0 -0
  52. /package/dist/{ready-K74SLQ24.js.map → ready-7MJWRGLT.js.map} +0 -0
  53. /package/dist/{status-IAE3BB77.js.map → status-UUPZYX3J.js.map} +0 -0
  54. /package/dist/{update-UFOHZEAK.js.map → update-EI7IJRHG.js.map} +0 -0
  55. /package/dist/{validate-EZHUB5TW.js.map → validate-HTTZLQWI.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1816,6 +1816,15 @@ var config_default = {
1816
1816
  }
1817
1817
  },
1818
1818
  additionalProperties: false
1819
+ },
1820
+ agents: {
1821
+ type: "object",
1822
+ properties: {
1823
+ paths: { type: "array", items: { type: "string" } },
1824
+ max_tokens: { type: "integer", minimum: 1 },
1825
+ rules: { type: "object" }
1826
+ },
1827
+ additionalProperties: false
1819
1828
  }
1820
1829
  },
1821
1830
  required: ["version", "specs"],
@@ -3311,6 +3320,315 @@ async function resolveLintConfig({ config, preset, configDir }) {
3311
3320
  return { rules: [...byId.values()], ignore };
3312
3321
  }
3313
3322
 
3323
+ // ../lint/dist/agents/discover.js
3324
+ import { readFile as readFile4 } from "fs/promises";
3325
+ import { relative } from "path";
3326
+ var DEFAULT_AGENT_PATHS = ["AGENTS.md", "CLAUDE.md"];
3327
+ var DEFAULT_MAX_TOKENS = 8e3;
3328
+ async function discoverAgentFiles(patterns, configDir) {
3329
+ const seen = /* @__PURE__ */ new Set();
3330
+ const files = [];
3331
+ for (const pattern of patterns) {
3332
+ for (const filePath of await resolveGlob(pattern, configDir)) {
3333
+ if (seen.has(filePath))
3334
+ continue;
3335
+ seen.add(filePath);
3336
+ const content = await readFile4(filePath, "utf8");
3337
+ files.push({
3338
+ filePath,
3339
+ relativePath: relative(configDir, filePath),
3340
+ content,
3341
+ lines: content.split("\n"),
3342
+ tokens: countTokens(content)
3343
+ });
3344
+ }
3345
+ }
3346
+ return files.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
3347
+ }
3348
+
3349
+ // ../lint/dist/agents/rules/structure.js
3350
+ var structureRule = {
3351
+ id: "agents/structure",
3352
+ description: "Agent instruction files should have content and be organised under headings",
3353
+ severity: "warn",
3354
+ run(context) {
3355
+ const { file } = context;
3356
+ const diagnostics = [];
3357
+ if (file.content.trim() === "") {
3358
+ diagnostics.push({
3359
+ ruleId: "agents/structure",
3360
+ severity: "warn",
3361
+ message: `${file.relativePath} is empty. An empty instruction file steers nothing \u2014 delete it or write it.`,
3362
+ filePath: file.filePath
3363
+ });
3364
+ return { diagnostics };
3365
+ }
3366
+ const headings = file.lines.filter((line) => /^#{1,6}\s+\S/.test(line));
3367
+ if (headings.length === 0) {
3368
+ diagnostics.push({
3369
+ ruleId: "agents/structure",
3370
+ severity: "warn",
3371
+ message: `${file.relativePath} has no headings, so it is one undifferentiated block. Nothing can be referenced, revised, or removed in isolation.`,
3372
+ filePath: file.filePath
3373
+ });
3374
+ }
3375
+ return { diagnostics };
3376
+ }
3377
+ };
3378
+
3379
+ // ../lint/dist/agents/rules/stale-references.js
3380
+ var PATH_SHAPED = /^(?:[\w.@-]+\/)+[\w.-]+$|^[\w.-]+\.(?:ts|tsx|js|jsx|mjs|cjs|json|md|ya?ml|toml|sh|py|rb|rs|go|java|css|html)$/;
3381
+ function isNotAFileClaim(candidate) {
3382
+ return candidate.includes("*") || // a glob describes a set, not a file
3383
+ candidate.includes("://") || // a URL
3384
+ candidate.startsWith("http") || candidate.startsWith("@") || // an npm scope: @specdx/core
3385
+ candidate.startsWith("~") || // a home-relative path outside the repo
3386
+ candidate.startsWith("/") || // an absolute path outside the repo
3387
+ /^[A-Z_]+=/.test(candidate);
3388
+ }
3389
+ function normalise(candidate) {
3390
+ return candidate.replace(/^\.\//, "").replace(/[.,;:)]+$/, "");
3391
+ }
3392
+ function fencedLines(lines) {
3393
+ const fenced = /* @__PURE__ */ new Set();
3394
+ let fence;
3395
+ lines.forEach((line, index) => {
3396
+ const match = /^\s*(`{3,}|~{3,})/.exec(line);
3397
+ if (match) {
3398
+ if (fence === void 0) {
3399
+ fence = match[1];
3400
+ fenced.add(index);
3401
+ return;
3402
+ }
3403
+ if (match[1][0] === fence[0])
3404
+ fence = void 0;
3405
+ fenced.add(index);
3406
+ return;
3407
+ }
3408
+ if (fence !== void 0)
3409
+ fenced.add(index);
3410
+ });
3411
+ return fenced;
3412
+ }
3413
+ function extractReferences(lines) {
3414
+ const skip = fencedLines(lines);
3415
+ const found = [];
3416
+ const seen = /* @__PURE__ */ new Set();
3417
+ lines.forEach((line, index) => {
3418
+ if (skip.has(index))
3419
+ return;
3420
+ const candidates = [];
3421
+ for (const match of line.matchAll(/`([^`\n]+)`/g))
3422
+ candidates.push(match[1]);
3423
+ for (const match of line.matchAll(/\]\((?!https?:|#)([^)\s]+)\)/g))
3424
+ candidates.push(match[1]);
3425
+ for (const raw of candidates) {
3426
+ const candidate = normalise(raw.trim());
3427
+ if (!candidate || isNotAFileClaim(candidate))
3428
+ continue;
3429
+ if (!PATH_SHAPED.test(candidate))
3430
+ continue;
3431
+ if (seen.has(candidate))
3432
+ continue;
3433
+ seen.add(candidate);
3434
+ found.push({ path: candidate, line: index + 1 });
3435
+ }
3436
+ });
3437
+ return found;
3438
+ }
3439
+ var staleReferencesRule = {
3440
+ id: "agents/stale-references",
3441
+ description: "Paths named by an agent instruction file must exist",
3442
+ severity: "warn",
3443
+ run(context) {
3444
+ const { file, exists } = context;
3445
+ const references = extractReferences(file.lines);
3446
+ if (references.length === 0) {
3447
+ return {
3448
+ diagnostics: [],
3449
+ assessed: false,
3450
+ notAssessedReason: `${file.relativePath} names no file paths, so none were checked for staleness.`
3451
+ };
3452
+ }
3453
+ return {
3454
+ diagnostics: references.filter((reference) => !exists(reference.path)).map((reference) => ({
3455
+ ruleId: "agents/stale-references",
3456
+ severity: this.severity,
3457
+ message: `${file.relativePath} refers to "${reference.path}", which does not exist. An agent told to look there will not find it.`,
3458
+ filePath: file.filePath,
3459
+ line: reference.line
3460
+ }))
3461
+ };
3462
+ }
3463
+ };
3464
+
3465
+ // ../lint/dist/agents/rules/size-budget.js
3466
+ var sizeBudgetRule = {
3467
+ id: "agents/size-budget",
3468
+ description: "Agent instruction files should fit a token budget",
3469
+ severity: "warn",
3470
+ run(context) {
3471
+ const { file, maxTokens } = context;
3472
+ if (file.tokens <= maxTokens)
3473
+ return { diagnostics: [] };
3474
+ const over = file.tokens - maxTokens;
3475
+ const percent = Math.round(over / maxTokens * 100);
3476
+ return {
3477
+ diagnostics: [
3478
+ {
3479
+ ruleId: "agents/size-budget",
3480
+ severity: this.severity,
3481
+ message: `${file.relativePath} is ${file.tokens} tokens, ${over} over the ${maxTokens} budget (${percent}% over). It is spending the context window it exists to protect.`,
3482
+ filePath: file.filePath
3483
+ }
3484
+ ]
3485
+ };
3486
+ }
3487
+ };
3488
+
3489
+ // ../lint/dist/agents/resolve-reference.js
3490
+ import { readdirSync } from "fs";
3491
+ import { join as join4, sep } from "path";
3492
+ var SKIP_DIRECTORIES = /* @__PURE__ */ new Set([
3493
+ "node_modules",
3494
+ ".git",
3495
+ "dist",
3496
+ "build",
3497
+ "coverage",
3498
+ ".next",
3499
+ ".turbo",
3500
+ ".cache",
3501
+ "out"
3502
+ ]);
3503
+ var MAX_INDEXED_FILES = 2e4;
3504
+ function indexProjectFiles(configDir) {
3505
+ const found = [];
3506
+ const walk2 = (dir, prefix) => {
3507
+ if (found.length >= MAX_INDEXED_FILES)
3508
+ return;
3509
+ let entries;
3510
+ try {
3511
+ entries = readdirSync(dir, { withFileTypes: true });
3512
+ } catch {
3513
+ return;
3514
+ }
3515
+ for (const entry of entries) {
3516
+ if (found.length >= MAX_INDEXED_FILES)
3517
+ return;
3518
+ const relative3 = prefix ? `${prefix}/${entry.name}` : entry.name;
3519
+ if (entry.isDirectory()) {
3520
+ if (SKIP_DIRECTORIES.has(entry.name))
3521
+ continue;
3522
+ found.push(relative3);
3523
+ walk2(join4(dir, entry.name), relative3);
3524
+ } else {
3525
+ found.push(relative3);
3526
+ }
3527
+ }
3528
+ };
3529
+ walk2(configDir, "");
3530
+ return found;
3531
+ }
3532
+ var PLACEHOLDER_STEMS = /* @__PURE__ */ new Set([
3533
+ "foo",
3534
+ "bar",
3535
+ "baz",
3536
+ "qux",
3537
+ "example",
3538
+ "your-app",
3539
+ "my-app",
3540
+ "some-file",
3541
+ "path"
3542
+ ]);
3543
+ function isPlaceholder(reference) {
3544
+ const base = reference.split("/").pop() ?? reference;
3545
+ const stem = base.split(".")[0] ?? base;
3546
+ return PLACEHOLDER_STEMS.has(stem.toLowerCase());
3547
+ }
3548
+ function createReferenceResolver(files) {
3549
+ const exact = new Set(files);
3550
+ const byLastSegment = /* @__PURE__ */ new Map();
3551
+ for (const file of files) {
3552
+ const last = file.split("/").pop();
3553
+ const bucket = byLastSegment.get(last);
3554
+ if (bucket)
3555
+ bucket.push(file);
3556
+ else
3557
+ byLastSegment.set(last, [file]);
3558
+ }
3559
+ return (reference) => {
3560
+ const normalised = reference.split(sep).join("/");
3561
+ if (exact.has(normalised))
3562
+ return true;
3563
+ if (isPlaceholder(normalised))
3564
+ return true;
3565
+ const last = normalised.split("/").pop();
3566
+ if (!last)
3567
+ return false;
3568
+ const candidates = byLastSegment.get(last);
3569
+ if (!candidates)
3570
+ return false;
3571
+ return candidates.some((candidate) => candidate === normalised || candidate.endsWith(`/${normalised}`));
3572
+ };
3573
+ }
3574
+
3575
+ // ../lint/dist/agents/index.js
3576
+ var AGENT_RULES = [structureRule, staleReferencesRule, sizeBudgetRule];
3577
+ var VALID_SEVERITIES = /* @__PURE__ */ new Set(["error", "warn", "info"]);
3578
+ var AgentConfigError = class extends Error {
3579
+ };
3580
+ function resolveAgentRules(overrides = {}) {
3581
+ const known = new Map(AGENT_RULES.map((rule) => [rule.id, rule]));
3582
+ for (const id of Object.keys(overrides)) {
3583
+ if (!known.has(id)) {
3584
+ throw new AgentConfigError(`Unknown agent rule "${id}" in agents.rules. Known rules: ${[...known.keys()].join(", ")}.`);
3585
+ }
3586
+ }
3587
+ const resolved = [];
3588
+ for (const rule of AGENT_RULES) {
3589
+ const override = overrides[rule.id];
3590
+ if (override === void 0) {
3591
+ resolved.push(rule);
3592
+ continue;
3593
+ }
3594
+ if (override === false || override === "off")
3595
+ continue;
3596
+ if (typeof override === "string" && VALID_SEVERITIES.has(override)) {
3597
+ resolved.push({ ...rule, severity: override });
3598
+ continue;
3599
+ }
3600
+ throw new AgentConfigError(`Invalid severity ${JSON.stringify(override)} for "${rule.id}". Use "error", "warn", "info", "off", or false.`);
3601
+ }
3602
+ return resolved;
3603
+ }
3604
+ async function lintAgentFiles(options) {
3605
+ const { config, configDir } = options;
3606
+ const agents = config.agents ?? {};
3607
+ const patterns = agents.paths ?? DEFAULT_AGENT_PATHS;
3608
+ const maxTokens = agents.max_tokens ?? DEFAULT_MAX_TOKENS;
3609
+ const rules = resolveAgentRules(agents.rules);
3610
+ const files = await discoverAgentFiles(patterns, configDir);
3611
+ const exists = options.exists ?? (files.length > 0 ? createReferenceResolver(indexProjectFiles(configDir)) : () => true);
3612
+ const diagnostics = [];
3613
+ for (const file of files) {
3614
+ for (const rule of rules) {
3615
+ const result = rule.run({ file, configDir, exists, maxTokens });
3616
+ for (const diagnostic of result.diagnostics) {
3617
+ diagnostics.push({ ...diagnostic, severity: rule.severity });
3618
+ }
3619
+ if (result.assessed === false) {
3620
+ diagnostics.push({
3621
+ ruleId: rule.id,
3622
+ severity: "info",
3623
+ message: result.notAssessedReason ?? `${rule.id} assessed nothing in ${file.relativePath}.`,
3624
+ filePath: file.filePath
3625
+ });
3626
+ }
3627
+ }
3628
+ }
3629
+ return { diagnostics, filesLinted: files.length, assessed: files.length > 0 };
3630
+ }
3631
+
3314
3632
  // src/shared-args.ts
3315
3633
  var quietArg = {
3316
3634
  type: "boolean",
@@ -3414,9 +3732,10 @@ async function runLint(options) {
3414
3732
  }
3415
3733
  const engine = createLintEngine({ rules, config, graph, ignore });
3416
3734
  const results = engine.lint(specs);
3417
- if (options.specPath) {
3418
- const specPath = options.specPath;
3419
- results.diagnostics = results.diagnostics.filter((d) => d.filePath.includes(specPath));
3735
+ const { specPath } = options;
3736
+ const selects = (filePath) => specPath === void 0 || filePath.includes(specPath);
3737
+ if (specPath !== void 0) {
3738
+ results.diagnostics = results.diagnostics.filter((d) => selects(d.filePath));
3420
3739
  results.hasErrors = results.diagnostics.some((d) => d.severity === "error");
3421
3740
  results.hasWarnings = results.diagnostics.some((d) => d.severity === "warn");
3422
3741
  }
@@ -3429,9 +3748,38 @@ async function runLint(options) {
3429
3748
  });
3430
3749
  results.hasErrors = true;
3431
3750
  }
3751
+ let agentFiles = 0;
3752
+ if (config.agents) {
3753
+ const agentResults = await lintAgentFiles({ config, configDir: options.configDir });
3754
+ agentFiles = agentResults.filesLinted;
3755
+ if (!agentResults.assessed) {
3756
+ const patterns = config.agents.paths ?? ["AGENTS.md", "CLAUDE.md"];
3757
+ results.diagnostics.push({
3758
+ ruleId: "agents/paths-match-nothing",
3759
+ severity: "error",
3760
+ message: `agents.paths matched no files (${patterns.join(", ")}), so no agent instruction file was linted. Remove the \`agents\` key or fix the paths.`,
3761
+ filePath: "spec.config.yaml"
3762
+ });
3763
+ results.hasErrors = true;
3764
+ }
3765
+ for (const diagnostic of agentResults.diagnostics) {
3766
+ if (!selects(diagnostic.filePath)) continue;
3767
+ results.diagnostics.push(diagnostic);
3768
+ if (diagnostic.severity === "error") results.hasErrors = true;
3769
+ if (diagnostic.severity === "warn") results.hasWarnings = true;
3770
+ }
3771
+ }
3432
3772
  const ignored = new Set(ignore);
3433
- const linted = specs.filter((spec) => !ignored.has(spec.filePath));
3434
- return { ...results, specFiles: linted.length, assessed: linted.length > 0 };
3773
+ const linted = specs.filter((spec) => !ignored.has(spec.filePath) && selects(spec.filePath));
3774
+ return { ...results, specFiles: linted.length, assessed: linted.length > 0, agentFiles };
3775
+ }
3776
+ function cleanRunMessage(results) {
3777
+ const parts = [`${results.specFiles} ${results.specFiles === 1 ? "spec" : "specs"}`];
3778
+ if (results.agentFiles > 0) {
3779
+ parts.push(`${results.agentFiles} agent ${results.agentFiles === 1 ? "file" : "files"}`);
3780
+ }
3781
+ return ` \u2713 ${parts.join(" and ")} checked, no problems found.
3782
+ `;
3435
3783
  }
3436
3784
  var lint_default = defineCommand2({
3437
3785
  meta: { name: "lint", description: "Lint all specs in the suite" },
@@ -3463,13 +3811,15 @@ var lint_default = defineCommand2({
3463
3811
  const formatter = format.format === "json" ? formatJson : format.format === "github" ? formatGithub : formatPretty;
3464
3812
  if (!results.assessed) {
3465
3813
  console.error(
3466
- "\n \u26A0 No specs were linted. Check the spec paths in spec.config.yaml, and whether `lint.ignore` excludes them all.\n"
3814
+ args.path ? `
3815
+ \u26A0 No specs matched path "${args.path}", so nothing was linted. Check it against the specs declared in spec.config.yaml.
3816
+ ` : "\n \u26A0 No specs were linted. Check the spec paths in spec.config.yaml, and whether `lint.ignore` excludes them all.\n"
3467
3817
  );
3468
3818
  process.exit(3);
3469
3819
  }
3470
3820
  const rendered = formatter(results.diagnostics);
3471
3821
  if (format.format === "pretty" && results.diagnostics.length === 0) {
3472
- output.info(rendered);
3822
+ output.info(cleanRunMessage(results));
3473
3823
  } else {
3474
3824
  output.out(rendered);
3475
3825
  }
@@ -4340,7 +4690,7 @@ var pack_default = defineCommand3({
4340
4690
 
4341
4691
  // src/commands/core/diff.ts
4342
4692
  import { defineCommand as defineCommand4 } from "citty";
4343
- import { join as join5 } from "path";
4693
+ import { join as join6 } from "path";
4344
4694
 
4345
4695
  // ../diff/dist/types.js
4346
4696
  var DEFAULT_DIFF_CONFIG = {
@@ -4528,7 +4878,7 @@ Diff.prototype = {
4528
4878
  tokenize: function tokenize2(value) {
4529
4879
  return Array.from(value);
4530
4880
  },
4531
- join: function join4(chars) {
4881
+ join: function join5(chars) {
4532
4882
  return chars.join("");
4533
4883
  },
4534
4884
  postProcess: function postProcess(changeObjects) {
@@ -5346,7 +5696,7 @@ function checkCrossReferences(allSpecs, removedIds) {
5346
5696
  var import_picomatch = __toESM(require_picomatch2(), 1);
5347
5697
  import { execSync as execSync2 } from "child_process";
5348
5698
  import { readFileSync, realpathSync } from "fs";
5349
- import { dirname as dirname2, relative, resolve as resolve4, sep } from "path";
5699
+ import { dirname as dirname2, relative as relative2, resolve as resolve4, sep as sep2 } from "path";
5350
5700
  function getRepoRoot(cwd) {
5351
5701
  let root;
5352
5702
  try {
@@ -5368,7 +5718,7 @@ function validateRef(ref, cwd) {
5368
5718
  }
5369
5719
  }
5370
5720
  function gitShow(ref, filePath, projectRoot, repoRoot) {
5371
- const relPath = relative(repoRoot, resolve4(projectRoot, filePath));
5721
+ const relPath = relative2(repoRoot, resolve4(projectRoot, filePath));
5372
5722
  try {
5373
5723
  return execSync2(`git show ${ref}:${relPath}`, {
5374
5724
  cwd: repoRoot,
@@ -5380,12 +5730,12 @@ function gitShow(ref, filePath, projectRoot, repoRoot) {
5380
5730
  }
5381
5731
  }
5382
5732
  function toPosix(p) {
5383
- return sep === "/" ? p : p.split(sep).join("/");
5733
+ return sep2 === "/" ? p : p.split(sep2).join("/");
5384
5734
  }
5385
5735
  function buildEntryMatchers(specPathsByKey, projectRoot, repoRoot) {
5386
5736
  return [...specPathsByKey].map(([key, specPath]) => ({
5387
5737
  key,
5388
- isMatch: (0, import_picomatch.default)(toPosix(relative(repoRoot, resolve4(projectRoot, specPath))))
5738
+ isMatch: (0, import_picomatch.default)(toPosix(relative2(repoRoot, resolve4(projectRoot, specPath))))
5389
5739
  }));
5390
5740
  }
5391
5741
  function getChangedSpecFiles(baseRef, headRef, matchers, projectRoot, repoRoot) {
@@ -5412,7 +5762,7 @@ function getChangedSpecFiles(baseRef, headRef, matchers, projectRoot, repoRoot)
5412
5762
  if (!entry)
5413
5763
  continue;
5414
5764
  const changed = {
5415
- path: relative(projectRoot, resolve4(repoRoot, filePath)),
5765
+ path: relative2(projectRoot, resolve4(repoRoot, filePath)),
5416
5766
  entryKey: entry.key
5417
5767
  };
5418
5768
  if (status === "M") {
@@ -5443,7 +5793,7 @@ function listSpecFilesAtRef(ref, matchers, projectRoot, repoRoot) {
5443
5793
  const entry = matchers.find((m) => m.isMatch(filePath));
5444
5794
  if (!entry)
5445
5795
  continue;
5446
- byEntry.get(entry.key)?.push(relative(projectRoot, resolve4(repoRoot, filePath)));
5796
+ byEntry.get(entry.key)?.push(relative2(projectRoot, resolve4(repoRoot, filePath)));
5447
5797
  }
5448
5798
  return byEntry;
5449
5799
  }
@@ -5465,7 +5815,7 @@ function listSpecFilesInWorktree(matchers, projectRoot, repoRoot) {
5465
5815
  const entry = matchers.find((m) => m.isMatch(filePath));
5466
5816
  if (!entry)
5467
5817
  continue;
5468
- byEntry.get(entry.key)?.push(relative(projectRoot, resolve4(repoRoot, filePath)));
5818
+ byEntry.get(entry.key)?.push(relative2(projectRoot, resolve4(repoRoot, filePath)));
5469
5819
  }
5470
5820
  return byEntry;
5471
5821
  }
@@ -5508,7 +5858,7 @@ function getChangedSpecFilesInWorktree(baseRef, matchers, projectRoot, repoRoot)
5508
5858
  return;
5509
5859
  seen.add(filePath);
5510
5860
  const changed = {
5511
- path: relative(projectRoot, resolve4(repoRoot, filePath)),
5861
+ path: relative2(projectRoot, resolve4(repoRoot, filePath)),
5512
5862
  entryKey: entry.key
5513
5863
  };
5514
5864
  if (status === "M")
@@ -5565,7 +5915,7 @@ function listUncommittedSpecFiles(matchers, projectRoot, repoRoot) {
5565
5915
  const filePath = (renamed ?? rawPath).replace(/^"|"$/g, "");
5566
5916
  if (!matchers.some((m) => m.isMatch(filePath)))
5567
5917
  continue;
5568
- files.push(relative(projectRoot, resolve4(repoRoot, filePath)));
5918
+ files.push(relative2(projectRoot, resolve4(repoRoot, filePath)));
5569
5919
  }
5570
5920
  return files;
5571
5921
  }
@@ -5708,7 +6058,7 @@ async function runDiff(options) {
5708
6058
  const config = await loadConfig(void 0, configDir);
5709
6059
  const baseRef = options.base ?? config.diff?.baseline_ref ?? DEFAULT_DIFF_CONFIG.baseline_ref;
5710
6060
  const headRef = options.head ?? "HEAD";
5711
- const configPath = join5(configDir, "spec.config.yaml");
6061
+ const configPath = join6(configDir, "spec.config.yaml");
5712
6062
  const result = await diffBetweenRefs(configPath, baseRef, headRef, {
5713
6063
  working: options.working ?? false
5714
6064
  });