@plexus-ms/cli 0.120.0 → 0.122.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 (2) hide show
  1. package/dist/plx.js +617 -53
  2. package/package.json +4 -4
package/dist/plx.js CHANGED
@@ -7411,9 +7411,9 @@ var require_cli_width = __commonJS({
7411
7411
  }
7412
7412
  });
7413
7413
 
7414
- // ../../node_modules/.pnpm/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
7414
+ // ../../node_modules/.pnpm/mute-stream@4.0.0/node_modules/mute-stream/lib/index.js
7415
7415
  var require_lib = __commonJS({
7416
- "../../node_modules/.pnpm/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js"(exports, module) {
7416
+ "../../node_modules/.pnpm/mute-stream@4.0.0/node_modules/mute-stream/lib/index.js"(exports, module) {
7417
7417
  var Stream = __require("stream");
7418
7418
  var MuteStream2 = class extends Stream {
7419
7419
  #isTTY = null;
@@ -7533,6 +7533,266 @@ var require_lib = __commonJS({
7533
7533
  }
7534
7534
  });
7535
7535
 
7536
+ // ../lib/dist/lints.js
7537
+ var keyOf = (v) => `${v.lint} ${v.file}: ${v.excerpt}`;
7538
+ var renderViolation = (v) => `\u2717 ${v.file}: line ${v.line}: ${v.message}`;
7539
+ var lineAt = (text, index) => {
7540
+ let line = 1;
7541
+ for (let i = 0; i < index; i++)
7542
+ if (text.charCodeAt(i) === 10)
7543
+ line++;
7544
+ return line;
7545
+ };
7546
+ function* matches(text, pattern) {
7547
+ for (const match of text.matchAll(pattern))
7548
+ yield { match, line: lineAt(text, match.index) };
7549
+ }
7550
+ var MONTH = "Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?";
7551
+ var YEAR = "(?:19|20)\\d{2}";
7552
+ var DATE_OR_VERSION = new RegExp([
7553
+ // 2026-11-04, 2026-07, 2026-11-04T10:00Z
7554
+ `(?<![\\w-])${YEAR}-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12]\\d|3[01])(?:T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:?\\d{2})?)?)?(?![\\w-])`,
7555
+ // November 2026, Nov. 4, 2026
7556
+ `\\b(?:${MONTH})\\.?\\s+(?:\\d{1,2}(?:st|nd|rd|th)?,?\\s+)?${YEAR}\\b`,
7557
+ // in 2026, since 2025, Q3 2026
7558
+ `\\b(?:[Ii]n|[Ss]ince|[Uu]ntil|[Tt]ill|[Aa]s of|[Bb]efore|[Aa]fter|[Dd]uring|[Ee]arly|[Mm]id|[Ll]ate|Q[1-4])\\s+${YEAR}\\b(?![.,]?\\d)`,
7559
+ // 0.111.0, 1.2.3-rc.1; not the dotted parts of an IP address, not a section number
7560
+ "(?<![\\w.\xA7]|\xA7\\s*)(?!1\\.0\\.0(?![\\w-]|\\.\\d))\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.]+)?(?!\\.?\\d)",
7561
+ // v24, v1.48
7562
+ "(?<![\\w./-])v\\d+(?:\\.\\d+)*\\b",
7563
+ // pnpm@12, hk@1.48 (three parts are caught above)
7564
+ "(?<=@)\\d+(?:\\.\\d+)?\\b(?!\\.\\d)"
7565
+ ].join("|"), "g");
7566
+ function proseOf(text) {
7567
+ const lines = text.split("\n");
7568
+ let i = 0;
7569
+ if (lines[0] === "---") {
7570
+ const end = lines.findIndex((l, n) => n > 0 && l === "---");
7571
+ if (end !== -1)
7572
+ for (; i <= end; i++)
7573
+ lines[i] = "";
7574
+ }
7575
+ let fence;
7576
+ for (; i < lines.length; i++) {
7577
+ const line = lines[i] ?? "";
7578
+ const opener = /^\s*(`{3,}|~{3,})/.exec(line)?.[1];
7579
+ if (fence === void 0 && opener) {
7580
+ fence = opener;
7581
+ lines[i] = "";
7582
+ } else if (fence !== void 0) {
7583
+ if (opener?.startsWith(fence[0] ?? "") && opener.length >= fence.length && line.trim() === opener)
7584
+ fence = void 0;
7585
+ lines[i] = "";
7586
+ } else
7587
+ lines[i] = line.replace(/(`+)[^\n]*?\1/g, (span) => " ".repeat(span.length));
7588
+ }
7589
+ return lines.join("\n");
7590
+ }
7591
+ function lintDateOrVersion(text, file) {
7592
+ return [...matches(proseOf(text), DATE_OR_VERSION)].map(({ match, line }) => ({
7593
+ lint: "date-or-version",
7594
+ file,
7595
+ line,
7596
+ excerpt: match[0],
7597
+ message: `a date or version number in prose goes stale; say it once where it is maintained: ${match[0]}`
7598
+ }));
7599
+ }
7600
+ var CODE = "PLX(?:-[A-Z][A-Za-z]+)?(?![A-Za-z])";
7601
+ var NUMBER = "\\d+(?:\\.\\d+)*";
7602
+ var NUMBERS = `${NUMBER}(?:[ \\t\\u00a0]*(?:,|and|or|&|\u2013|-|to)[ \\t\\u00a0]*${NUMBER})*`;
7603
+ var GAP = "(?:[ \\t\\u00a0]+|[ \\t]*\\r?\\n[ \\t]*(?:#+|//+|\\*|>)?[ \\t]*)";
7604
+ var SIGN = `(?<!\xA7)\xA7\xA7?[ \\t\\u00a0]*`;
7605
+ var REQUIREMENT_NAME = "PLX-[A-Z][A-Za-z]+(?:/[A-Z][A-Za-z0-9]*){1,2}";
7606
+ var NAME_LIKE = "PLX-[A-Z][A-Za-z]+(?:/[\\w-]+)+";
7607
+ var FORWARD = new RegExp(`${SIGN}(${NUMBERS})${GAP}(${CODE})`, "g");
7608
+ var REVERSE = new RegExp(`(?<![\\w-])(${CODE})[ \\t\\u00a0]*,?[ \\t\\u00a0]*${SIGN}(${NUMBERS})`, "g");
7609
+ var BARE = new RegExp(`${SIGN}(${NUMBERS})`, "g");
7610
+ var NAME_CITATION = new RegExp(`(?<![\\w/-])${NAME_LIKE}(?![\\w/])`, "g");
7611
+ var sectionKey = (n, code) => `\xA7 ${n} ${code}`;
7612
+ var numbersOf = (list2) => list2.match(new RegExp(NUMBER, "g")) ?? [];
7613
+ function lintCitations(text, file, citable, own) {
7614
+ const codes2 = new Set([...citable].filter((c) => c.startsWith("\xA7 ")).map((c) => c.replace(/^§ \S+ /, "")));
7615
+ const out = [];
7616
+ const sections = (list2, code, line) => {
7617
+ for (const n of numbersOf(list2)) {
7618
+ const excerpt = sectionKey(n, code);
7619
+ if (citable.has(excerpt))
7620
+ continue;
7621
+ const message = codes2.has(code) ? `${excerpt} cites a section that does not exist` : `${excerpt} cites ${code}, which is no module`;
7622
+ out.push({ lint: "citations", file, line, excerpt, message });
7623
+ }
7624
+ };
7625
+ const taken = /* @__PURE__ */ new Set();
7626
+ const signAt = (m) => m.index + m[0].indexOf("\xA7");
7627
+ for (const { match, line } of matches(text, FORWARD)) {
7628
+ taken.add(signAt(match));
7629
+ sections(match[1] ?? "", match[2] ?? "", line);
7630
+ }
7631
+ for (const { match, line } of matches(text, REVERSE)) {
7632
+ if (taken.has(signAt(match)))
7633
+ continue;
7634
+ taken.add(signAt(match));
7635
+ sections(match[2] ?? "", match[1] ?? "", line);
7636
+ }
7637
+ if (own)
7638
+ for (const { match, line } of matches(text, BARE)) {
7639
+ const at = signAt(match);
7640
+ const lineStart = text.lastIndexOf("\n", at) + 1;
7641
+ if (taken.has(at) || /^#+[ \t]*$/.test(text.slice(lineStart, at)))
7642
+ continue;
7643
+ sections(match[1] ?? "", own, line);
7644
+ }
7645
+ const wellFormed = new RegExp(`^${REQUIREMENT_NAME}$`);
7646
+ for (const { match, line } of matches(text, NAME_CITATION)) {
7647
+ const name = match[0];
7648
+ if (!wellFormed.test(name))
7649
+ out.push({
7650
+ lint: "citations",
7651
+ file,
7652
+ line,
7653
+ excerpt: name,
7654
+ message: `${name} is no requirement name: PLX-<Module>[/<Profile>]/<Name>, each segment capitalised`
7655
+ });
7656
+ else if (!citable.has(name))
7657
+ out.push({ lint: "citations", file, line, excerpt: name, message: `${name} names no requirement line` });
7658
+ }
7659
+ return out.sort((a, b) => a.line - b.line);
7660
+ }
7661
+ var MAX_HEADER_LINES = 2;
7662
+ function commentSyntax(file) {
7663
+ const jinja = file.endsWith(".jinja") ? [["{#", "#}"]] : [];
7664
+ const name = file.replace(/\.jinja$/, "");
7665
+ if (/\.(md|mdx|html)$/.test(name))
7666
+ return { blocks: [["<!--", "-->"], ...jinja] };
7667
+ if (/\.(ts|tsx|js|jsx|mjs|cjs|css|json|jsonc|pkl)$/.test(name))
7668
+ return { line: /^\/\//, blocks: [["/*", "*/"], ...jinja] };
7669
+ return { line: /^#(?!!)/, blocks: jinja };
7670
+ }
7671
+ var JINJA_TAG = /\{%-?[\s\S]*?-?%\}/g;
7672
+ var isPreamble = (line) => /^#!/.test(line) || /^#\s*(syntax|escape|check)\s*=/.test(line) || line === "---";
7673
+ function headerLines(text, file) {
7674
+ const syntax = commentSyntax(file);
7675
+ const raw = text.split("\n").map((l) => l.trim());
7676
+ const lines = raw.map((l) => l.replace(JINJA_TAG, "").trim());
7677
+ const jinjaOnly = (n) => (lines[n] ?? "") === "" && (raw[n] ?? "") !== "";
7678
+ const blockEnd = (i2) => {
7679
+ let j = i2;
7680
+ for (; ; ) {
7681
+ const line = lines[j] ?? "";
7682
+ const block = line === "" ? void 0 : syntax.blocks.find(([open]) => line.startsWith(open));
7683
+ if (block) {
7684
+ const [open, close] = block;
7685
+ let k = j;
7686
+ while (k < lines.length - 1 && !(lines[k] ?? "").includes(close, k === j ? open.length : 0))
7687
+ k++;
7688
+ j = k + 1;
7689
+ } else if (line !== "" && syntax.line?.test(line))
7690
+ j++;
7691
+ else
7692
+ return j;
7693
+ }
7694
+ };
7695
+ let i = 0;
7696
+ let content = 0;
7697
+ for (; i < lines.length; i++) {
7698
+ const line = lines[i] ?? "";
7699
+ if (line === "" || isPreamble(line))
7700
+ continue;
7701
+ if (blockEnd(i) > i)
7702
+ break;
7703
+ if (++content > 1)
7704
+ return 0;
7705
+ }
7706
+ if (i >= lines.length)
7707
+ return 0;
7708
+ let end = blockEnd(i);
7709
+ let count = end - i;
7710
+ for (i = end; i < lines.length; ) {
7711
+ if ((lines[i] ?? "") === "" && !jinjaOnly(i)) {
7712
+ i++;
7713
+ continue;
7714
+ }
7715
+ end = blockEnd(i);
7716
+ if (end === i || (lines[end] ?? "") !== "" || jinjaOnly(end))
7717
+ break;
7718
+ count += end - i;
7719
+ i = end;
7720
+ }
7721
+ return count;
7722
+ }
7723
+ function lintTemplateHeader(text, file) {
7724
+ const n = headerLines(text, file);
7725
+ if (n <= MAX_HEADER_LINES)
7726
+ return [];
7727
+ return [
7728
+ {
7729
+ lint: "template-header",
7730
+ file,
7731
+ line: 1,
7732
+ excerpt: `${n} header comment lines`,
7733
+ message: `${n} header comment lines; a template file opens with at most ${MAX_HEADER_LINES}, and the rest lives in the compendium`
7734
+ }
7735
+ ];
7736
+ }
7737
+ var ISSUE_ID = /(?<![\w])([A-Z]{3})-\d+(?![\w])/g;
7738
+ var STANDARD_PREFIXES = /* @__PURE__ */ new Set([
7739
+ "SHA",
7740
+ // hash functions: SHA-256
7741
+ "UTF",
7742
+ // character encodings: UTF-8
7743
+ "GPL",
7744
+ // licence identifiers: GPL-3.0-or-later
7745
+ "PDF",
7746
+ // format versions: PDF-1.4
7747
+ "ADR"
7748
+ // architecture decision records: ADR-0009
7749
+ ]);
7750
+ function lintIssueIds(text, file) {
7751
+ return [...matches(text, ISSUE_ID)].filter(({ match }) => !STANDARD_PREFIXES.has(match[1] ?? "")).map(({ match, line }) => ({
7752
+ lint: "issue-id",
7753
+ file,
7754
+ line,
7755
+ excerpt: match[0],
7756
+ message: `${match[0]} reads as an issue identifier; say what it means instead`
7757
+ }));
7758
+ }
7759
+ var AUTO_COMMENT_CHARS = "#;@!$%^&|:";
7760
+ function lintCommitMessage(text, comment = "#") {
7761
+ const chars = comment === "auto" ? [...AUTO_COMMENT_CHARS] : [comment];
7762
+ const ends = chars.flatMap((c) => {
7763
+ const q2 = c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7764
+ return [new RegExp(`^${q2} -+ >8 -+$`, "m"), new RegExp(`^${q2} Please enter the commit message`, "m")];
7765
+ }).map((p) => text.search(p)).filter((n) => n !== -1);
7766
+ return lintIssueIds(ends.length > 0 ? text.slice(0, Math.min(...ends)) : text, "commit message");
7767
+ }
7768
+
7769
+ // ../lib/dist/baseline.js
7770
+ var BASELINE_FILE = "plx-baseline.txt";
7771
+ var HEADER = [
7772
+ "# Known violations of `plx requirements`: burn them down, never add to them.",
7773
+ "# One per line, as often as each occurs; `plx requirements --write-baseline` rewrites the file."
7774
+ ];
7775
+ var parseBaseline = (text) => text.split("\n").map((l) => l.trimEnd()).filter((l) => l !== "" && !l.startsWith("#"));
7776
+ var renderBaseline = (violations) => `${[...HEADER, ...violations.map(keyOf).sort()].join("\n")}
7777
+ `;
7778
+ function compareBaseline(violations, baseline) {
7779
+ const left = /* @__PURE__ */ new Map();
7780
+ for (const key of baseline)
7781
+ left.set(key, (left.get(key) ?? 0) + 1);
7782
+ const fresh = [];
7783
+ let known = 0;
7784
+ for (const v of violations) {
7785
+ const n = left.get(keyOf(v)) ?? 0;
7786
+ if (n > 0) {
7787
+ left.set(keyOf(v), n - 1);
7788
+ known++;
7789
+ } else
7790
+ fresh.push(v);
7791
+ }
7792
+ const stale = [...left].flatMap(([key, n]) => Array(n).fill(key));
7793
+ return { fresh, stale: stale.sort(), known };
7794
+ }
7795
+
7536
7796
  // ../lib/dist/frontmatter.js
7537
7797
  function frontmatterLines(lines) {
7538
7798
  if (lines[0] !== "---")
@@ -9098,11 +9358,179 @@ async function propagate(ctx, options) {
9098
9358
 
9099
9359
  // ../lib/dist/requirements.js
9100
9360
  import { join as join8 } from "node:path";
9361
+
9362
+ // ../lib/dist/standard-index.json
9363
+ var standard_index_default = {
9364
+ version: "0.122.0",
9365
+ citable: [
9366
+ "\xA7 1 PLX",
9367
+ "\xA7 1.1 PLX",
9368
+ "\xA7 1.2 PLX",
9369
+ "\xA7 1.3 PLX",
9370
+ "\xA7 1.4 PLX",
9371
+ "\xA7 1.5 PLX",
9372
+ "\xA7 1.6 PLX",
9373
+ "\xA7 1.7 PLX",
9374
+ "\xA7 1.8 PLX",
9375
+ "\xA7 2 PLX",
9376
+ "\xA7 2.1 PLX",
9377
+ "\xA7 2.2 PLX",
9378
+ "\xA7 2.3 PLX",
9379
+ "\xA7 2.4 PLX",
9380
+ "\xA7 2.5 PLX",
9381
+ "\xA7 2.6 PLX",
9382
+ "\xA7 2.7 PLX",
9383
+ "\xA7 3 PLX",
9384
+ "\xA7 3.1 PLX",
9385
+ "\xA7 3.2 PLX",
9386
+ "\xA7 3.3 PLX",
9387
+ "\xA7 3.4 PLX",
9388
+ "\xA7 4 PLX",
9389
+ "\xA7 4.1 PLX",
9390
+ "\xA7 4.2 PLX",
9391
+ "\xA7 4.3 PLX",
9392
+ "\xA7 4.4 PLX",
9393
+ "\xA7 4.5 PLX",
9394
+ "\xA7 4.6 PLX",
9395
+ "\xA7 4.7 PLX",
9396
+ "\xA7 5 PLX",
9397
+ "\xA7 5.1 PLX",
9398
+ "\xA7 5.2 PLX",
9399
+ "\xA7 5.3 PLX",
9400
+ "\xA7 6 PLX",
9401
+ "\xA7 6.1 PLX",
9402
+ "\xA7 6.2 PLX",
9403
+ "\xA7 6.3 PLX",
9404
+ "\xA7 6.4 PLX",
9405
+ "\xA7 6.5 PLX",
9406
+ "\xA7 6.6 PLX",
9407
+ "\xA7 6.7 PLX",
9408
+ "\xA7 6.8 PLX",
9409
+ "\xA7 6.9 PLX",
9410
+ "\xA7 7 PLX",
9411
+ "\xA7 7.1 PLX",
9412
+ "\xA7 7.2 PLX",
9413
+ "\xA7 7.3 PLX",
9414
+ "\xA7 7.4 PLX",
9415
+ "\xA7 7.5 PLX",
9416
+ "\xA7 7.6 PLX",
9417
+ "\xA7 7.7 PLX",
9418
+ "\xA7 8 PLX",
9419
+ "\xA7 8.1 PLX",
9420
+ "\xA7 8.2 PLX",
9421
+ "\xA7 8.3 PLX",
9422
+ "\xA7 8.4 PLX",
9423
+ "\xA7 8.5 PLX",
9424
+ "\xA7 8.6 PLX",
9425
+ "\xA7 8.7 PLX",
9426
+ "\xA7 9 PLX",
9427
+ "\xA7 10 PLX",
9428
+ "\xA7 10.1 PLX",
9429
+ "\xA7 10.2 PLX",
9430
+ "\xA7 10.3 PLX",
9431
+ "\xA7 10.4 PLX",
9432
+ "\xA7 10.5 PLX",
9433
+ "\xA7 11 PLX",
9434
+ "\xA7 11.1 PLX",
9435
+ "\xA7 11.2 PLX",
9436
+ "\xA7 11.3 PLX",
9437
+ "\xA7 11.4 PLX",
9438
+ "\xA7 11.5 PLX",
9439
+ "\xA7 11.6 PLX",
9440
+ "\xA7 12 PLX",
9441
+ "\xA7 12.1 PLX",
9442
+ "\xA7 12.2 PLX",
9443
+ "\xA7 12.3 PLX",
9444
+ "\xA7 12.4 PLX",
9445
+ "\xA7 12.5 PLX",
9446
+ "\xA7 12.6 PLX",
9447
+ "\xA7 13 PLX",
9448
+ "\xA7 13.1 PLX",
9449
+ "\xA7 13.2 PLX",
9450
+ "\xA7 13.3 PLX",
9451
+ "\xA7 13.4 PLX",
9452
+ "\xA7 13.5 PLX",
9453
+ "\xA7 1 PLX-AppStateful",
9454
+ "\xA7 2 PLX-AppStateful",
9455
+ "\xA7 3 PLX-AppStateful",
9456
+ "\xA7 1 PLX-AppStateless",
9457
+ "\xA7 1 PLX-App",
9458
+ "\xA7 2 PLX-App",
9459
+ "\xA7 3 PLX-App",
9460
+ "\xA7 4 PLX-App",
9461
+ "\xA7 5 PLX-App",
9462
+ "\xA7 6 PLX-App",
9463
+ "\xA7 7 PLX-App",
9464
+ "\xA7 1 PLX-Environment",
9465
+ "\xA7 2 PLX-Environment",
9466
+ "\xA7 1 PLX-Host",
9467
+ "\xA7 2 PLX-Host",
9468
+ "\xA7 1 PLX-Repo",
9469
+ "\xA7 2 PLX-Repo",
9470
+ "\xA7 3 PLX-Repo",
9471
+ "\xA7 1 PLX-Tenancy",
9472
+ "\xA7 2 PLX-Tenancy",
9473
+ "\xA7 3 PLX-Tenancy",
9474
+ "\xA7 4 PLX-Tenancy",
9475
+ "\xA7 1 PLX-CLI",
9476
+ "\xA7 2 PLX-CLI",
9477
+ "\xA7 3 PLX-CLI",
9478
+ "\xA7 4 PLX-CLI",
9479
+ "\xA7 5 PLX-CLI",
9480
+ "\xA7 6 PLX-CLI",
9481
+ "\xA7 1 PLX-Delivery",
9482
+ "\xA7 2 PLX-Delivery",
9483
+ "\xA7 3 PLX-Delivery",
9484
+ "\xA7 4 PLX-Delivery",
9485
+ "\xA7 5 PLX-Delivery",
9486
+ "\xA7 6 PLX-Delivery",
9487
+ "\xA7 7 PLX-Delivery",
9488
+ "\xA7 8 PLX-Delivery",
9489
+ "\xA7 1 PLX-Infrastructure",
9490
+ "\xA7 2 PLX-Infrastructure",
9491
+ "\xA7 3 PLX-Infrastructure",
9492
+ "\xA7 1 PLX-Ingress",
9493
+ "\xA7 2 PLX-Ingress",
9494
+ "\xA7 1 PLX-JS",
9495
+ "\xA7 1 PLX-Platform",
9496
+ "\xA7 2 PLX-Platform",
9497
+ "\xA7 3 PLX-Platform",
9498
+ "\xA7 1 PLX-Secrets",
9499
+ "\xA7 2 PLX-Secrets",
9500
+ "\xA7 3 PLX-Secrets",
9501
+ "\xA7 1 PLX-Updates",
9502
+ "\xA7 2 PLX-Updates",
9503
+ "\xA7 3 PLX-Updates"
9504
+ ]
9505
+ };
9506
+
9507
+ // ../lib/dist/standardIndex.js
9508
+ var STANDARD_INDEX_FILE = "packages/lib/src/standard-index.json";
9509
+ var bundledIndex = () => checked(standard_index_default);
9510
+ function checked(value) {
9511
+ const { version: version2, citable } = value ?? {};
9512
+ if (typeof version2 !== "string" || !Array.isArray(citable) || !citable.every((c) => typeof c === "string"))
9513
+ throw new Error(`${STANDARD_INDEX_FILE} is not a citable index`);
9514
+ return { version: version2, citable };
9515
+ }
9516
+
9517
+ // ../lib/dist/requirements.js
9101
9518
  var KEYWORD = /MUST|SHOULD|MAY/;
9102
9519
  var hasKeyword = (line) => KEYWORD.test(line.replace(/MUSTs|SHOULDs|MAYs/g, ""));
9520
+ function requirementName(bullet) {
9521
+ const span = /^`(PLX-[^`\s]*\/[^`\s]*)`(:\s)?/.exec(bullet);
9522
+ if (!span)
9523
+ return void 0;
9524
+ const name = span[1] ?? "";
9525
+ if (!new RegExp(`^${REQUIREMENT_NAME}$`).test(name))
9526
+ return { name, malformed: "the format is PLX-<Module>[/<Profile>]/<Name>, each segment capitalised" };
9527
+ if (!span[2])
9528
+ return { name, malformed: "a name is followed by a colon and a blank" };
9529
+ return { name };
9530
+ }
9103
9531
  var list = (value) => value.replace(/^\s*\[/, "").replace(/\].*$/, "").split(",").map((s) => s.trim()).filter(Boolean);
9104
9532
  function scanPage(text, name, mode) {
9105
- const scan = { defects: [], requirements: [], depends: [], consumes: [] };
9533
+ const scan = { defects: [], requirements: [], sections: [], names: [], depends: [], consumes: [] };
9106
9534
  const lines = text.split("\n");
9107
9535
  const defect = (n, msg) => scan.defects.push(`\u2717 ${name}: line ${n + 1}: ${msg}`);
9108
9536
  let i = 0;
@@ -9148,6 +9576,7 @@ function scanPage(text, name, mode) {
9148
9576
  if (maintaining)
9149
9577
  defect(i, "numbered section after Maintaining");
9150
9578
  section = heading[1] ?? "";
9579
+ scan.sections.push(section);
9151
9580
  started = true;
9152
9581
  continue;
9153
9582
  }
@@ -9160,8 +9589,16 @@ function scanPage(text, name, mode) {
9160
9589
  defect(i, `requirement under Maintaining: ${line}`);
9161
9590
  else if (!started)
9162
9591
  defect(i, "requirement before the first \xA7 heading");
9163
- else
9592
+ else {
9164
9593
  scan.requirements.push(`\xA7 ${section} ${line.slice(4)}`);
9594
+ const named = requirementName(line.slice(4));
9595
+ if (named?.malformed)
9596
+ defect(i, `malformed requirement name ${named.name}: ${named.malformed}`);
9597
+ else if (named && named.name.split("/")[0] !== scan.code)
9598
+ defect(i, `requirement name ${named.name} does not start with the page's code, ${scan.code}`);
9599
+ else if (named)
9600
+ scan.names.push(named.name);
9601
+ }
9165
9602
  continue;
9166
9603
  }
9167
9604
  if (line.startsWith(">")) {
@@ -9213,17 +9650,28 @@ async function checkCompendium(ctx, compendium) {
9213
9650
  for (const [code, where] of byCode)
9214
9651
  if (where.length > 1)
9215
9652
  defects.push(`\u2717 duplicate module code: ${code}`);
9653
+ const named = /* @__PURE__ */ new Set();
9654
+ for (const s of scans.values())
9655
+ for (const name of s.names) {
9656
+ if (named.has(name))
9657
+ defects.push(`\u2717 duplicate requirement name: ${name}`);
9658
+ named.add(name);
9659
+ const module = name.split("/")[0] ?? "";
9660
+ const base = [...byCode.keys()].find((c) => c !== module && new RegExp(`^${c}[A-Z][a-z]+$`).test(module));
9661
+ if (base)
9662
+ defects.push(`\u2717 requirement name ${name} spells a profile of ${base} as a module; a profile's lines are named ${base}/<Profile>/<Name> on the page of ${base}`);
9663
+ }
9216
9664
  for (const s of scans.values())
9217
9665
  for (const dep of s.depends)
9218
9666
  if (!byCode.has(dep))
9219
9667
  defects.push(`\u2717 unknown module in depends: ${dep}`);
9220
- const kindOf2 = (page) => page.startsWith("contracts/") ? "contract" : "approach";
9668
+ const kindOf3 = (page) => page.startsWith("contracts/") ? "contract" : "approach";
9221
9669
  const side = (binds2) => binds2 === "repo" || binds2 === "app" ? "dev" : "ops";
9222
- const kinds = new Map([...byCode].map(([code, [page = ""]]) => [code, kindOf2(page)]));
9670
+ const kinds = new Map([...byCode].map(([code, [page = ""]]) => [code, kindOf3(page)]));
9223
9671
  const binds = new Map([...byCode].map(([code, [page = ""]]) => [code, scans.get(page)?.binds ?? ""]));
9224
9672
  for (const [page, s] of scans) {
9225
9673
  const m = s.code ?? page.replace(/.*\//, "");
9226
- const kind = kindOf2(page);
9674
+ const kind = kindOf3(page);
9227
9675
  for (const c of s.consumes) {
9228
9676
  if (kind === "contract")
9229
9677
  defects.push(`\u2717 ${m} is a contract and consumes ${c}; a contract has no other side to consume`);
@@ -9247,6 +9695,101 @@ async function checkCompendium(ctx, compendium) {
9247
9695
  approaches: pages.filter((p) => p.startsWith("approaches/")).length
9248
9696
  };
9249
9697
  }
9698
+ async function readCitable(ctx, compendium) {
9699
+ return (await readPages(ctx, compendium)).citable;
9700
+ }
9701
+ async function readPages(ctx, compendium) {
9702
+ const own = /* @__PURE__ */ new Map([[MAP_PAGE, "PLX"]]);
9703
+ const citable = scanPage(await ctx.readFile(join8(compendium, MAP_PAGE)), MAP_PAGE, "map").sections.map((n) => `\xA7 ${n} PLX`);
9704
+ for (const page of await modulePages(ctx, compendium)) {
9705
+ const scan = scanPage(await ctx.readFile(join8(compendium, page)), page, "module");
9706
+ if (!scan.code)
9707
+ continue;
9708
+ own.set(page, scan.code);
9709
+ citable.push(...scan.sections.map((n) => `\xA7 ${n} ${scan.code}`), ...scan.names);
9710
+ }
9711
+ return { citable, own };
9712
+ }
9713
+ var COPIER_FILES = ["copier.yml", "copier.yaml"];
9714
+ async function kindOf2(ctx, dir) {
9715
+ if (await ctx.readFile(join8(dir, MAP_PAGE)).then(() => true, () => false))
9716
+ return { kind: "compendium" };
9717
+ for (const file of COPIER_FILES) {
9718
+ const text = await ctx.readFile(join8(dir, file)).catch(() => void 0);
9719
+ const sub = text === void 0 ? void 0 : /^_subdirectory:\s*["']?([^"'\s#]+)/m.exec(text)?.[1];
9720
+ if (sub)
9721
+ return { kind: "template", templateDir: sub.replace(/\/+$/, "") };
9722
+ }
9723
+ return { kind: "repo" };
9724
+ }
9725
+ async function trackedFiles(ctx, dir) {
9726
+ const out = await ctx.read("git", ["ls-files", "-z"], { cwd: dir }).catch(() => {
9727
+ throw new Error(`${dir} is not a git checkout; the lints read its tracked files`);
9728
+ });
9729
+ return out.split("\0").filter(Boolean).sort();
9730
+ }
9731
+ async function lintRepo(ctx, dir, options = {}) {
9732
+ const { kind, templateDir } = await kindOf2(ctx, dir);
9733
+ const result = { kind, against: "", defects: [], violations: [] };
9734
+ let index;
9735
+ let own = /* @__PURE__ */ new Map();
9736
+ if (kind === "compendium") {
9737
+ const check = await checkCompendium(ctx, dir);
9738
+ Object.assign(result, { defects: check.defects, contracts: check.contracts, approaches: check.approaches });
9739
+ const pages = await readPages(ctx, dir);
9740
+ index = { version: "this checkout", citable: pages.citable };
9741
+ own = pages.own;
9742
+ result.against = "this compendium";
9743
+ } else if (options.compendium) {
9744
+ index = { version: options.compendium, citable: await readCitable(ctx, options.compendium) };
9745
+ result.against = `the compendium at ${options.compendium}`;
9746
+ } else {
9747
+ index = bundledIndex();
9748
+ result.against = `Plexus ${index.version}, the index this plx carries`;
9749
+ }
9750
+ const citable = new Set(index.citable);
9751
+ for (const file of await trackedFiles(ctx, dir)) {
9752
+ if (file === BASELINE_FILE)
9753
+ continue;
9754
+ const text = await ctx.readFile(join8(dir, file)).catch(() => void 0);
9755
+ if (text === void 0 || text.includes("\0"))
9756
+ continue;
9757
+ if (kind === "compendium" && /\.mdx?$/.test(file))
9758
+ result.violations.push(...lintDateOrVersion(text, file));
9759
+ result.violations.push(...lintCitations(text, file, citable, own.get(file)));
9760
+ if (templateDir && file.startsWith(`${templateDir}/`))
9761
+ result.violations.push(...lintTemplateHeader(text, file));
9762
+ result.violations.push(...lintIssueIds(text, file));
9763
+ }
9764
+ return result;
9765
+ }
9766
+ async function checkRepo(ctx, dir, options = {}) {
9767
+ const lint = await lintRepo(ctx, dir, options);
9768
+ const baseline = parseBaseline(await ctx.readFile(join8(dir, BASELINE_FILE)).catch(() => ""));
9769
+ const { fresh, stale, known } = compareBaseline(lint.violations, baseline);
9770
+ return {
9771
+ kind: lint.kind,
9772
+ against: lint.against,
9773
+ defects: [
9774
+ ...lint.defects,
9775
+ ...fresh.map(renderViolation),
9776
+ ...stale.map((key) => `\u2717 ${BASELINE_FILE}: no longer occurs, remove it: ${key}`)
9777
+ ],
9778
+ known,
9779
+ contracts: lint.contracts,
9780
+ approaches: lint.approaches
9781
+ };
9782
+ }
9783
+ async function planBaseline(ctx, dir, options = {}) {
9784
+ const lint = await lintRepo(ctx, dir, options);
9785
+ ctx.say(`\u2022 ${lint.violations.length} known violations \u2192 ${BASELINE_FILE}`);
9786
+ return [write(join8(dir, BASELINE_FILE), renderBaseline(lint.violations))];
9787
+ }
9788
+ async function checkCommitMessage(ctx, file, dir) {
9789
+ const config = async (key) => (await ctx.read("git", ["config", "--get", key], { cwd: dir }).catch(() => "")).trim();
9790
+ const comment = await config("core.commentString") || await config("core.commentChar") || "#";
9791
+ return lintCommitMessage(await ctx.readFile(file), comment);
9792
+ }
9250
9793
 
9251
9794
  // ../lib/dist/summary.js
9252
9795
  function mergeLine(urls) {
@@ -9286,7 +9829,7 @@ function renderSummary(s, realCommand, verb = "propagate") {
9286
9829
  // src/program.ts
9287
9830
  import { createRequire } from "node:module";
9288
9831
 
9289
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/key.js
9832
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/key.js
9290
9833
  var keybindings = ["emacs", "vim"];
9291
9834
  var keybindingLookup = new Set(keybindings);
9292
9835
  function isKeybinding(value) {
@@ -9301,7 +9844,7 @@ function getDefaultKeybindings() {
9301
9844
  var isTabKey = (key) => key.name === "tab";
9302
9845
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
9303
9846
 
9304
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/errors.js
9847
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/errors.js
9305
9848
  var AbortPromptError = class extends Error {
9306
9849
  name = "AbortPromptError";
9307
9850
  message = "Prompt was aborted";
@@ -9324,10 +9867,10 @@ var ValidationError = class extends Error {
9324
9867
  name = "ValidationError";
9325
9868
  };
9326
9869
 
9327
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-state.js
9870
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-state.js
9328
9871
  import { AsyncResource as AsyncResource2 } from "node:async_hooks";
9329
9872
 
9330
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/hook-engine.js
9873
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/hook-engine.js
9331
9874
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
9332
9875
  var hookStorage = new AsyncLocalStorage();
9333
9876
  function createStore(rl) {
@@ -9431,7 +9974,7 @@ var effectScheduler = {
9431
9974
  }
9432
9975
  };
9433
9976
 
9434
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-state.js
9977
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-state.js
9435
9978
  function isFactory(value) {
9436
9979
  return typeof value === "function";
9437
9980
  }
@@ -9457,7 +10000,7 @@ function useState(defaultValue) {
9457
10000
  });
9458
10001
  }
9459
10002
 
9460
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-effect.js
10003
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-effect.js
9461
10004
  function useEffect(cb, depArray) {
9462
10005
  withPointer((pointer) => {
9463
10006
  const oldDeps = pointer.get();
@@ -9469,10 +10012,10 @@ function useEffect(cb, depArray) {
9469
10012
  });
9470
10013
  }
9471
10014
 
9472
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/theme.js
10015
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/theme.js
9473
10016
  import { styleText } from "node:util";
9474
10017
 
9475
- // ../../node_modules/.pnpm/@inquirer+figures@2.0.10/node_modules/@inquirer/figures/dist/index.js
10018
+ // ../../node_modules/.pnpm/@inquirer+figures@2.1.0/node_modules/@inquirer/figures/dist/index.js
9476
10019
  import process2 from "node:process";
9477
10020
  function isUnicodeSupported() {
9478
10021
  if (!process2.platform.startsWith("win")) {
@@ -9765,7 +10308,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
9765
10308
  var dist_default = figures;
9766
10309
  var replacements = Object.entries(specialMainSymbols);
9767
10310
 
9768
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/theme.js
10311
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/theme.js
9769
10312
  var defaultTheme = {
9770
10313
  prefix: {
9771
10314
  idle: styleText("blue", "?"),
@@ -9793,7 +10336,7 @@ function getDefaultTheme() {
9793
10336
  };
9794
10337
  }
9795
10338
 
9796
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/make-theme.js
10339
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/make-theme.js
9797
10340
  function isPlainObject(value) {
9798
10341
  if (typeof value !== "object" || value === null)
9799
10342
  return false;
@@ -9807,6 +10350,8 @@ function deepMerge(...objects) {
9807
10350
  const output = {};
9808
10351
  for (const obj of objects) {
9809
10352
  for (const [key, value] of Object.entries(obj)) {
10353
+ if (value === void 0)
10354
+ continue;
9810
10355
  const prevValue = output[key];
9811
10356
  output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
9812
10357
  }
@@ -9821,7 +10366,7 @@ function makeTheme(...themes) {
9821
10366
  return deepMerge(...themesToMerge);
9822
10367
  }
9823
10368
 
9824
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-prefix.js
10369
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-prefix.js
9825
10370
  function usePrefix({ status = "idle", theme }) {
9826
10371
  const [showLoader, setShowLoader] = useState(false);
9827
10372
  const [tick, setTick] = useState(0);
@@ -9852,12 +10397,12 @@ function usePrefix({ status = "idle", theme }) {
9852
10397
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
9853
10398
  }
9854
10399
 
9855
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-ref.js
10400
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-ref.js
9856
10401
  function useRef(val) {
9857
10402
  return useState({ current: val })[0];
9858
10403
  }
9859
10404
 
9860
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-keypress.js
10405
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/use-keypress.js
9861
10406
  function useKeypress(userHandler) {
9862
10407
  const signal = useRef(userHandler);
9863
10408
  signal.current = userHandler;
@@ -9876,7 +10421,7 @@ function useKeypress(userHandler) {
9876
10421
  }, []);
9877
10422
  }
9878
10423
 
9879
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/utils.js
10424
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/utils.js
9880
10425
  var import_cli_width = __toESM(require_cli_width(), 1);
9881
10426
 
9882
10427
  // ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
@@ -10215,7 +10760,7 @@ function wrapAnsi(string, columns, options) {
10215
10760
  return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
10216
10761
  }
10217
10762
 
10218
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/utils.js
10763
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/utils.js
10219
10764
  function breakLines(content, width) {
10220
10765
  return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split("\n").map((str) => str.trimEnd())).join("\n");
10221
10766
  }
@@ -10223,11 +10768,11 @@ function readlineWidth() {
10223
10768
  return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
10224
10769
  }
10225
10770
 
10226
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
10771
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
10227
10772
  import * as readline2 from "node:readline";
10228
10773
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
10229
10774
 
10230
- // ../../node_modules/.pnpm/@inquirer+type@4.2.1_@types+node@24.19.2/node_modules/@inquirer/type/dist/utils.js
10775
+ // ../../node_modules/.pnpm/@inquirer+type@4.3.0_@types+node@24.19.2/node_modules/@inquirer/type/dist/utils.js
10231
10776
  function withResolver() {
10232
10777
  let resolve9;
10233
10778
  let reject;
@@ -10238,7 +10783,7 @@ function withResolver() {
10238
10783
  return { promise, resolve: resolve9, reject };
10239
10784
  }
10240
10785
 
10241
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
10786
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
10242
10787
  var import_mute_stream = __toESM(require_lib(), 1);
10243
10788
 
10244
10789
  // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
@@ -10492,10 +11037,10 @@ var {
10492
11037
  unload
10493
11038
  } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback());
10494
11039
 
10495
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/screen-manager.js
11040
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/screen-manager.js
10496
11041
  import { stripVTControlCharacters } from "node:util";
10497
11042
 
10498
- // ../../node_modules/.pnpm/@inquirer+ansi@2.0.10/node_modules/@inquirer/ansi/dist/index.js
11043
+ // ../../node_modules/.pnpm/@inquirer+ansi@2.1.0/node_modules/@inquirer/ansi/dist/index.js
10499
11044
  var ESC2 = "\x1B[";
10500
11045
  var cursorLeft = ESC2 + "G";
10501
11046
  var cursorHide = ESC2 + "?25l";
@@ -10511,7 +11056,7 @@ var cursorTo = (x, y) => {
10511
11056
  var eraseLine = ESC2 + "2K";
10512
11057
  var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
10513
11058
 
10514
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/screen-manager.js
11059
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/screen-manager.js
10515
11060
  var height = (content) => content.split("\n").length;
10516
11061
  var lastLine = (content) => content.split("\n").pop() ?? "";
10517
11062
  var ScreenManager = class {
@@ -10572,7 +11117,7 @@ var ScreenManager = class {
10572
11117
  }
10573
11118
  };
10574
11119
 
10575
- // ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
11120
+ // ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
10576
11121
  import path from "node:path";
10577
11122
  var nativeSetImmediate = globalThis.setImmediate;
10578
11123
  var nativeClearImmediate = globalThis.clearImmediate;
@@ -10692,7 +11237,7 @@ function createPrompt(view) {
10692
11237
  return prompt;
10693
11238
  }
10694
11239
 
10695
- // ../../node_modules/.pnpm/@inquirer+confirm@6.3.5_@types+node@24.19.2/node_modules/@inquirer/confirm/dist/index.js
11240
+ // ../../node_modules/.pnpm/@inquirer+confirm@6.4.0_@types+node@24.19.2/node_modules/@inquirer/confirm/dist/index.js
10696
11241
  import { styleText as styleText2 } from "node:util";
10697
11242
  var confirmTheme = {
10698
11243
  keywords: {
@@ -10776,7 +11321,7 @@ var dist_default4 = createPrompt((config, done) => {
10776
11321
  return [`${prefix} ${message}${defaultValue} ${formattedValue}`, error];
10777
11322
  });
10778
11323
 
10779
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
11324
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/error.js
10780
11325
  var CommanderError = class extends Error {
10781
11326
  /**
10782
11327
  * Constructs the CommanderError class
@@ -10805,7 +11350,7 @@ var InvalidArgumentError = class extends CommanderError {
10805
11350
  }
10806
11351
  };
10807
11352
 
10808
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/argument.js
11353
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/argument.js
10809
11354
  var Argument = class {
10810
11355
  /**
10811
11356
  * Initialize a new command argument with the given name and description.
@@ -10926,7 +11471,7 @@ function humanReadableArgName(arg) {
10926
11471
  return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
10927
11472
  }
10928
11473
 
10929
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/command.js
11474
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/command.js
10930
11475
  import { EventEmitter } from "node:events";
10931
11476
  import childProcess from "node:child_process";
10932
11477
  import path2 from "node:path";
@@ -10934,7 +11479,7 @@ import fs from "node:fs";
10934
11479
  import process4 from "node:process";
10935
11480
  import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
10936
11481
 
10937
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/help.js
11482
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/help.js
10938
11483
  import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
10939
11484
  var Help = class {
10940
11485
  constructor() {
@@ -11003,11 +11548,11 @@ var Help = class {
11003
11548
  visibleOptions.push(helpOption);
11004
11549
  } else if (helpOption.long && !removeLong) {
11005
11550
  visibleOptions.push(
11006
- cmd.createOption(helpOption.long, helpOption.description)
11551
+ cmd.createOption(helpOption.long, helpOption.description).helpGroup(helpOption.helpGroupHeading)
11007
11552
  );
11008
11553
  } else if (helpOption.short && !removeShort) {
11009
11554
  visibleOptions.push(
11010
- cmd.createOption(helpOption.short, helpOption.description)
11555
+ cmd.createOption(helpOption.short, helpOption.description).helpGroup(helpOption.helpGroupHeading)
11011
11556
  );
11012
11557
  }
11013
11558
  }
@@ -11526,7 +12071,7 @@ ${itemIndentStr}`);
11526
12071
  }
11527
12072
  };
11528
12073
 
11529
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/option.js
12074
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/option.js
11530
12075
  var Option = class {
11531
12076
  /**
11532
12077
  * Initialize a new `Option` with the given `flags` and `description`.
@@ -11539,7 +12084,7 @@ var Option = class {
11539
12084
  this.description = description2 || "";
11540
12085
  this.required = flags.includes("<");
11541
12086
  this.optional = flags.includes("[");
11542
- this.variadic = /\w\.\.\.[>\]]$/.test(flags);
12087
+ this.variadic = new RegExp("\\p{ID_Continue}\\.\\.\\.[>\\]]$", "u").test(flags);
11543
12088
  this.mandatory = false;
11544
12089
  const optionFlags = splitOptionFlags(flags);
11545
12090
  this.short = optionFlags.shortFlag;
@@ -11832,7 +12377,7 @@ function splitOptionFlags(flags) {
11832
12377
  return { shortFlag, longFlag };
11833
12378
  }
11834
12379
 
11835
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/suggestSimilar.js
12380
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/suggestSimilar.js
11836
12381
  var maxDistance = 3;
11837
12382
  function editDistance(a, b) {
11838
12383
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -11907,7 +12452,7 @@ function suggestSimilar(word, candidates) {
11907
12452
  return "";
11908
12453
  }
11909
12454
 
11910
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/command.js
12455
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/lib/command.js
11911
12456
  var Command = class _Command extends EventEmitter {
11912
12457
  /**
11913
12458
  * Initialize a new `Command`.
@@ -12722,7 +13267,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
12722
13267
  getOptionValueSourceWithGlobals(key) {
12723
13268
  let source;
12724
13269
  this._getCommandAndAncestors().forEach((cmd) => {
12725
- if (cmd.getOptionValueSource(key) !== void 0) {
13270
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
12726
13271
  source = cmd.getOptionValueSource(key);
12727
13272
  }
12728
13273
  });
@@ -13365,7 +13910,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
13365
13910
  return arg.length > 1 && arg[0] === "-";
13366
13911
  }
13367
13912
  const negativeNumberArg = (arg) => {
13368
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
13913
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
13369
13914
  return !this._getCommandAndAncestors().some(
13370
13915
  (cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short))
13371
13916
  );
@@ -13813,7 +14358,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
13813
14358
  * (This does not override a group set directly on the subcommand using .helpGroup().)
13814
14359
  *
13815
14360
  * @example
13816
- * program.commandsGroup('Development Commands:);
14361
+ * program.commandsGroup('Development Commands:');
13817
14362
  * program.command('watch')...
13818
14363
  * program.command('lint')...
13819
14364
  * ...
@@ -13984,7 +14529,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
13984
14529
  * Pass in false to disable the built-in help option.
13985
14530
  *
13986
14531
  * @example
13987
- * program.helpOption('-?, --help' 'show help'); // customise
14532
+ * program.helpOption('-?, --help', 'show help'); // customise
13988
14533
  * program.helpOption(false); // disable
13989
14534
  *
13990
14535
  * @param {(string | boolean)} flags
@@ -14113,16 +14658,20 @@ function incrementNodeInspectorPort(args) {
14113
14658
  let debugHost = "127.0.0.1";
14114
14659
  let debugPort = "9229";
14115
14660
  let match;
14116
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
14661
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
14117
14662
  debugOption = match[1];
14118
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
14663
+ } else if ((match = arg.match(
14664
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/
14665
+ )) !== null) {
14119
14666
  debugOption = match[1];
14120
14667
  if (/^\d+$/.test(match[3])) {
14121
14668
  debugPort = match[3];
14122
14669
  } else {
14123
14670
  debugHost = match[3];
14124
14671
  }
14125
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
14672
+ } else if ((match = arg.match(
14673
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/
14674
+ )) !== null) {
14126
14675
  debugOption = match[1];
14127
14676
  debugHost = match[3];
14128
14677
  debugPort = match[4];
@@ -14141,7 +14690,7 @@ function useColor() {
14141
14690
  return void 0;
14142
14691
  }
14143
14692
 
14144
- // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
14693
+ // ../../node_modules/.pnpm/commander@15.1.0/node_modules/commander/index.js
14145
14694
  var program = new Command();
14146
14695
 
14147
14696
  // src/commands/changeset.ts
@@ -14342,21 +14891,36 @@ function register6(program2) {
14342
14891
  // src/commands/requirements.ts
14343
14892
  import { join as join10, resolve as resolve7 } from "node:path";
14344
14893
  function register7(program2) {
14345
- program2.command("requirements").description("lint the standard's map and module pages, or extract one module's requirement lines").argument("[dir]", "a checkout of the compendium", ".").option("--extract <page>", "print a module page's requirement lines instead of linting (path relative to dir)").action(async (dir, opts, command) => {
14894
+ program2.command("requirements").description(
14895
+ "lint a repo: the standard's pages in the compendium, citations, dates, template headers and issue identifiers everywhere"
14896
+ ).argument("[dir]", "a repo checkout: the compendium, a template or any other repo", ".").option("--extract <page>", "print a module page's requirement lines instead of linting (path relative to dir)").option("--write-baseline", `record every current violation in ${BASELINE_FILE} as known, instead of checking`).option("--commit-msg <file>", "check a commit message for issue identifiers instead (the commit-msg hook)").option("--compendium <dir>", "resolve citations against this compendium checkout, not this plx's own index").action(async (dir, opts, command) => {
14346
14897
  const ctx = contextOf2(command);
14347
- const compendium = resolve7(dir);
14898
+ const repo = resolve7(dir);
14899
+ const options = { compendium: opts.compendium ? resolve7(opts.compendium) : void 0 };
14348
14900
  if (opts.extract) {
14349
- ctx.result(extractRequirements(await ctx.readFile(join10(compendium, opts.extract))));
14901
+ ctx.result(extractRequirements(await ctx.readFile(join10(repo, opts.extract))));
14902
+ return;
14903
+ }
14904
+ if (opts.commitMsg) {
14905
+ const violations = await checkCommitMessage(ctx, resolve7(opts.commitMsg), repo);
14906
+ ctx.result(violations, (vs) => vs.map(renderViolation).join("\n"));
14907
+ if (violations.length > 0) process.exitCode = 1;
14908
+ return;
14909
+ }
14910
+ if (opts.writeBaseline) {
14911
+ await ctx.apply(await planBaseline(ctx, repo, options));
14350
14912
  return;
14351
14913
  }
14352
- const check = await checkCompendium(ctx, compendium);
14914
+ const check = await checkRepo(ctx, repo, options);
14353
14915
  ctx.result(check, renderCheck);
14354
14916
  if (check.defects.length > 0) process.exitCode = 1;
14355
14917
  });
14356
14918
  }
14357
14919
  function renderCheck(c) {
14358
14920
  if (c.defects.length > 0) return c.defects.join("\n");
14359
- return `\u2713 the map, ${c.contracts} contracts and ${c.approaches} approaches are well-formed`;
14921
+ const what = c.kind === "compendium" ? `the map, ${c.contracts} contracts and ${c.approaches} approaches are well-formed; ` : "";
14922
+ const known = c.known > 0 ? `, ${c.known} known violations in ${BASELINE_FILE}` : "";
14923
+ return `\u2713 ${what}citations resolve against ${c.against}${known}`;
14360
14924
  }
14361
14925
 
14362
14926
  // src/commands/update.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexus-ms/cli",
3
- "version": "0.120.0",
3
+ "version": "0.122.0",
4
4
  "description": "plx, the Plexus command-line tool: a single-script adapter over @plexus-ms/lib",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "type": "module",
@@ -23,9 +23,9 @@
23
23
  "node": ">=24.22.1"
24
24
  },
25
25
  "dependencies": {
26
- "@inquirer/prompts": "^8.7.5",
27
- "@plexus-ms/lib": "0.120.0",
28
- "commander": "^15.0.0"
26
+ "@inquirer/prompts": "^8.8.0",
27
+ "@plexus-ms/lib": "0.122.0",
28
+ "commander": "^15.1.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^24.19.2",