@plexus-ms/cli 0.119.0 → 0.121.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 +710 -150
  2. package/package.json +3 -3
package/dist/plx.js CHANGED
@@ -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] !== "---")
@@ -7558,8 +7818,8 @@ function setFrontmatterField(text, key, value, options = {}) {
7558
7818
  }
7559
7819
 
7560
7820
  // ../lib/dist/bookkeeping.js
7561
- var WORKFLOW_REF = "plexus-ms/primitives/.github/workflows/";
7562
- var bumpWorkflowRefs = (text, train) => text.replace(/(plexus-ms\/primitives\/\.github\/workflows\/[A-Za-z0-9._-]+)@v?[0-9.]+/g, `$1@${train}`);
7821
+ var WORKFLOW_REF = "plexus-ms/tooling/.github/workflows/";
7822
+ var bumpWorkflowRefs = (text, version2) => text.replace(/(plexus-ms\/tooling\/\.github\/workflows\/[A-Za-z0-9._-]+)@v?[0-9.]+/g, `$1@${version2}`);
7563
7823
  var hasConflictMarkers = (text) => /^<<<<<<< /m.test(text);
7564
7824
  var hasUnmergedEntries = (porcelain) => /^(UU|AA|DU|UD)/m.test(porcelain);
7565
7825
  function syncMarker(marker, commit) {
@@ -7645,6 +7905,15 @@ ${stderr.trimEnd()}` : ""}`);
7645
7905
  this.stderr = stderr;
7646
7906
  }
7647
7907
  };
7908
+ async function orAbsent(read, absent = () => true) {
7909
+ try {
7910
+ return await read;
7911
+ } catch (error) {
7912
+ if (error instanceof ExecError && absent(error))
7913
+ return void 0;
7914
+ throw error;
7915
+ }
7916
+ }
7648
7917
  var isInteractive = () => process.stdin.isTTY === true && process.stderr.isTTY === true;
7649
7918
  function realIo(prompt) {
7650
7919
  return {
@@ -7811,15 +8080,7 @@ async function readChangeset(ctx, dir, base, branch) {
7811
8080
  const git2 = (args) => ctx.read("git", args, { cwd: dir });
7812
8081
  const head = branch ?? (await git2(["rev-parse", "--abbrev-ref", "HEAD"])).trim();
7813
8082
  const mergeBase = (await git2(["merge-base", base, "HEAD"])).trim();
7814
- const show = async (path4) => {
7815
- try {
7816
- return await git2(["show", `${mergeBase}:${path4}`]);
7817
- } catch (error) {
7818
- if (error instanceof ExecError)
7819
- return void 0;
7820
- throw error;
7821
- }
7822
- };
8083
+ const show = (path4) => orAbsent(git2(["show", `${mergeBase}:${path4}`]));
7823
8084
  const current = async (path4) => {
7824
8085
  try {
7825
8086
  return await ctx.readFile(join2(dir, path4));
@@ -7866,16 +8127,16 @@ async function expand(ctx, root, glob) {
7866
8127
  // ../lib/dist/consumers.js
7867
8128
  import { relative } from "node:path";
7868
8129
 
7869
- // ../lib/dist/train.js
8130
+ // ../lib/dist/version.js
7870
8131
  var COMPENDIUM = "compendium";
7871
- var TRAIN_REPOS = [
7872
- "primitives",
7873
- "preset-repo-turbo",
7874
- "preset-app-nextjs",
7875
- "preset-repo-operations",
8132
+ var VERSIONED_REPOS = [
8133
+ "tooling",
8134
+ "template-repo-turbo",
8135
+ "template-app-nextjs",
8136
+ "template-repo-operations",
7876
8137
  COMPENDIUM
7877
8138
  ];
7878
- var isTrainVersion = (v) => /^\d+\.\d+\.\d+$/.test(v);
8139
+ var isPlexusVersion = (v) => /^\d+\.\d+\.\d+$/.test(v);
7879
8140
  async function preflightForge(ctx) {
7880
8141
  try {
7881
8142
  await ctx.read("gh", ["auth", "status"]);
@@ -7887,7 +8148,7 @@ var UsageError = class extends Error {
7887
8148
  };
7888
8149
 
7889
8150
  // ../lib/dist/consumers.js
7890
- var PRESETS = TRAIN_REPOS.filter((r) => r.startsWith("preset-"));
8151
+ var TEMPLATES = VERSIONED_REPOS.filter((r) => r.startsWith("template-"));
7891
8152
  function expectedBranch(declaration, answers = {}) {
7892
8153
  if (!declaration)
7893
8154
  return void 0;
@@ -7897,29 +8158,32 @@ function expectedBranch(declaration, answers = {}) {
7897
8158
  return answers.publishes_packages === true ? "main" : "develop";
7898
8159
  return void 0;
7899
8160
  }
7900
- var presetSource = (preset) => `gh:plexus-ms/${preset}`;
7901
- var RENAMED_PRESETS = {
7902
- "preset-repo-web": "preset-repo-turbo",
7903
- "preset-repo-platform": "preset-repo-operations"
8161
+ var templateSource = (template) => `gh:plexus-ms/${template}`;
8162
+ var RENAMED_TEMPLATES = {
8163
+ "preset-repo-web": "template-repo-turbo",
8164
+ "preset-repo-platform": "template-repo-operations",
8165
+ "preset-repo-turbo": "template-repo-turbo",
8166
+ "preset-app-nextjs": "template-app-nextjs",
8167
+ "preset-repo-operations": "template-repo-operations"
7904
8168
  };
7905
- function presetOf(src, presets) {
7906
- for (const p of presets)
7907
- if (presetSource(p) === src)
8169
+ function templateOf(src, templates) {
8170
+ for (const p of templates)
8171
+ if (templateSource(p) === src)
7908
8172
  return p;
7909
- for (const [old, current] of Object.entries(RENAMED_PRESETS))
7910
- if (presetSource(old) === src && presets.includes(current))
8173
+ for (const [old, current] of Object.entries(RENAMED_TEMPLATES))
8174
+ if (templateSource(old) === src && templates.includes(current))
7911
8175
  return current;
7912
8176
  return void 0;
7913
8177
  }
7914
- async function findConsumers(ctx, root, presets) {
8178
+ async function findConsumers(ctx, root, templates) {
7915
8179
  const consumers = /* @__PURE__ */ new Map();
7916
8180
  const orphans = [];
7917
8181
  const visit = (dir, repo, inTemplate) => {
7918
8182
  const here = dir.git ? dir : repo;
7919
- const template = inTemplate || Boolean(dir.template);
7920
- const preset = dir.copier?.src ? presetOf(dir.copier.src, presets) : void 0;
7921
- if (preset && !template) {
7922
- const site = { path: dir.path, rel: relative(root.path, dir.path) || ".", preset };
8183
+ const within = inTemplate || Boolean(dir.template);
8184
+ const template = dir.copier?.src ? templateOf(dir.copier.src, templates) : void 0;
8185
+ if (template && !within) {
8186
+ const site = { path: dir.path, rel: relative(root.path, dir.path) || ".", template };
7923
8187
  if (!here)
7924
8188
  orphans.push(site);
7925
8189
  else {
@@ -7939,7 +8203,7 @@ async function findConsumers(ctx, root, presets) {
7939
8203
  }
7940
8204
  }
7941
8205
  for (const child of dir.children)
7942
- visit(child, here, template);
8206
+ visit(child, here, within);
7943
8207
  };
7944
8208
  visit(root, void 0, false);
7945
8209
  for (const site of orphans)
@@ -8252,13 +8516,9 @@ var Remote = class {
8252
8516
  }
8253
8517
  /** A check on the host: whether the command succeeds, or undefined under --dry-run. */
8254
8518
  async test(command, show = false) {
8255
- try {
8256
- return await this.read(command, show) === void 0 ? void 0 : true;
8257
- } catch (error) {
8258
- if (error instanceof ExecError)
8259
- return false;
8260
- throw error;
8261
- }
8519
+ if (this.ctx.dryRun)
8520
+ return this.read(command, show).then(() => void 0);
8521
+ return await orAbsent(this.read(command, show)) !== void 0;
8262
8522
  }
8263
8523
  /** Close the shared connection; nothing to close when no call was made. */
8264
8524
  close() {
@@ -8409,7 +8669,7 @@ function diagnoseUnit(unit, units, catalog, root) {
8409
8669
  findings.push(`declares ${code}, which no module carries`);
8410
8670
  continue;
8411
8671
  }
8412
- if (module.changed && compareTrains(module.changed, plexus) > 0)
8672
+ if (module.changed && compareVersions(module.changed, plexus) > 0)
8413
8673
  findings.push(`${code} changed in ${module.changed}, declared at ${plexus}`);
8414
8674
  for (const dep of module.depends)
8415
8675
  if (!modules.includes(dep) && !context.has(dep))
@@ -8432,7 +8692,7 @@ function contextOf(unit, units) {
8432
8692
  function descendants(dir) {
8433
8693
  return dir.children.flatMap((c) => [...c.declaration ? [c] : [], ...descendants(c)]);
8434
8694
  }
8435
- function compareTrains(a, b) {
8695
+ function compareVersions(a, b) {
8436
8696
  const nums = (v) => v.split(".").slice(0, 3).map((p) => Number.parseInt(p, 10) || 0);
8437
8697
  const [x, y] = [nums(a), nums(b)];
8438
8698
  for (let i = 0; i < 3; i++)
@@ -8442,7 +8702,7 @@ function compareTrains(a, b) {
8442
8702
  }
8443
8703
 
8444
8704
  // ../lib/dist/manifest.js
8445
- var MANIFEST_FILE = "train.json";
8705
+ var MANIFEST_FILE = "modules.json";
8446
8706
  var MANIFEST_SCHEMA = 1;
8447
8707
  var catalogOf = (manifest2) => new Map(manifest2.modules.map((m) => [m.code, m]));
8448
8708
  var strings = (value) => Array.isArray(value) && value.every((v) => typeof v === "string");
@@ -8451,24 +8711,24 @@ function parseManifest(text) {
8451
8711
  try {
8452
8712
  data = JSON.parse(text);
8453
8713
  } catch {
8454
- throw new Error("the train manifest is not JSON");
8714
+ throw new Error("the module manifest is not JSON");
8455
8715
  }
8456
8716
  if (data === null || typeof data !== "object" || Array.isArray(data))
8457
- throw new Error("the train manifest is not an object");
8458
- const { schema, train, date, modules } = data;
8717
+ throw new Error("the module manifest is not an object");
8718
+ const { schema, version: version2, date, modules } = data;
8459
8719
  if (schema !== MANIFEST_SCHEMA)
8460
- throw new Error(`the train manifest has schema ${JSON.stringify(schema)}; this plx reads ${MANIFEST_SCHEMA}`);
8461
- if (typeof train !== "string" || !isTrainVersion(train))
8462
- throw new Error(`the train manifest names '${String(train)}', not a train`);
8720
+ throw new Error(`the module manifest has schema ${JSON.stringify(schema)}; this plx reads ${MANIFEST_SCHEMA}`);
8721
+ if (typeof version2 !== "string" || !isPlexusVersion(version2))
8722
+ throw new Error(`the module manifest names '${String(version2)}', not a version`);
8463
8723
  if (typeof date !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(date))
8464
- throw new Error(`the train manifest is dated '${String(date)}', not YYYY-MM-DD`);
8724
+ throw new Error(`the module manifest is dated '${String(date)}', not YYYY-MM-DD`);
8465
8725
  if (!Array.isArray(modules))
8466
- throw new Error("the train manifest lists no modules");
8467
- return { schema: MANIFEST_SCHEMA, train, date, modules: modules.map(parseEntry) };
8726
+ throw new Error("the module manifest lists no modules");
8727
+ return { schema: MANIFEST_SCHEMA, version: version2, date, modules: modules.map(parseEntry) };
8468
8728
  }
8469
8729
  function parseEntry(entry) {
8470
8730
  const m = entry ?? {};
8471
- const where = `the train manifest's module ${typeof m.code === "string" ? m.code : JSON.stringify(entry)}`;
8731
+ const where = `the module manifest's module ${typeof m.code === "string" ? m.code : JSON.stringify(entry)}`;
8472
8732
  if (typeof m.code !== "string" || m.code === "")
8473
8733
  throw new Error(`${where} has no code`);
8474
8734
  if (m.kind !== "contract" && m.kind !== "approach")
@@ -8478,7 +8738,7 @@ function parseEntry(entry) {
8478
8738
  if (!strings(m.depends) || !strings(m.consumes))
8479
8739
  throw new Error(`${where} lacks depends or consumes`);
8480
8740
  if (m.changed !== void 0 && typeof m.changed !== "string")
8481
- throw new Error(`${where} has a changed that is no train`);
8741
+ throw new Error(`${where} has a changed that is no version`);
8482
8742
  return {
8483
8743
  code: m.code,
8484
8744
  kind: m.kind,
@@ -8525,42 +8785,42 @@ function needOf({ recorded, releases, asked, stale = [], maxAge, now }) {
8525
8785
  trigger: "module",
8526
8786
  why: `${first.code} changed in ${first.changed}, declared at ${first.declared} in ${first.where}${more.length > 0 ? `, and ${more.length} more` : ""}`
8527
8787
  };
8528
- const odd = recorded.findIndex((r) => !r || !isTrainVersion(r));
8788
+ const odd = recorded.findIndex((r) => !r || !isPlexusVersion(r));
8529
8789
  if (recorded.length === 0 || odd >= 0)
8530
8790
  return {
8531
8791
  take: true,
8532
8792
  trigger: "backstop",
8533
- why: `a site records ${recorded[odd] ? `'${recorded[odd]}'` : "no version"}, not a train`
8793
+ why: `a site records ${recorded[odd] ? `'${recorded[odd]}'` : "no version"}, not a version`
8534
8794
  };
8535
- const trains2 = recorded;
8536
- const oldest = trains2.reduce((a, b) => compareTrains(a, b) <= 0 ? a : b);
8537
- const untaken = releases.filter((r) => isTrainVersion(r.train) && compareTrains(r.train, oldest) > 0).sort((a, b) => Date.parse(a.published) - Date.parse(b.published));
8795
+ const versions = recorded;
8796
+ const oldest = versions.reduce((a, b) => compareVersions(a, b) <= 0 ? a : b);
8797
+ const untaken = releases.filter((r) => isPlexusVersion(r.version) && compareVersions(r.version, oldest) > 0).sort((a, b) => Date.parse(a.published) - Date.parse(b.published));
8538
8798
  const oldestUntaken = untaken[0];
8539
8799
  if (!oldestUntaken)
8540
- return { take: false, why: `no train newer than ${oldest}` };
8800
+ return { take: false, why: `no version newer than ${oldest}` };
8541
8801
  const age = Math.max(0, Math.floor((now.getTime() - Date.parse(oldestUntaken.published)) / DAY));
8542
- const count = `${untaken.length} newer train${untaken.length === 1 ? "" : "s"}`;
8802
+ const count = `${untaken.length} newer version${untaken.length === 1 ? "" : "s"}`;
8543
8803
  if (maxAge === 0)
8544
- return { take: true, trigger: "backstop", why: `a backstop age of zero takes every train (${count})` };
8804
+ return { take: true, trigger: "backstop", why: `a backstop age of zero takes every version (${count})` };
8545
8805
  if (age >= maxAge)
8546
8806
  return {
8547
8807
  take: true,
8548
8808
  trigger: "backstop",
8549
- why: `${oldestUntaken.train}, the oldest train not taken, was cut ${days(age)} ago (backstop: ${days(maxAge)}; ${count})`
8809
+ why: `${oldestUntaken.version}, the oldest version not taken, was cut ${days(age)} ago (backstop: ${days(maxAge)}; ${count})`
8550
8810
  };
8551
8811
  return {
8552
8812
  take: false,
8553
- why: `${count}, the oldest (${oldestUntaken.train}) cut ${days(age)} ago; the backstop is ${days(maxAge)}`
8813
+ why: `${count}, the oldest (${oldestUntaken.version}) cut ${days(age)} ago; the backstop is ${days(maxAge)}`
8554
8814
  };
8555
8815
  }
8556
8816
  function staleModules(markers, catalog) {
8557
8817
  const stale = [];
8558
8818
  for (const { where, plexus, modules } of markers) {
8559
- if (!isTrainVersion(plexus))
8819
+ if (!isPlexusVersion(plexus))
8560
8820
  continue;
8561
8821
  for (const code of modules) {
8562
8822
  const changed = catalog.get(code)?.changed;
8563
- if (changed && isTrainVersion(changed) && compareTrains(changed, plexus) > 0)
8823
+ if (changed && isPlexusVersion(changed) && compareVersions(changed, plexus) > 0)
8564
8824
  stale.push({ code, changed, where, declared: plexus });
8565
8825
  }
8566
8826
  }
@@ -8718,8 +8978,8 @@ function mergeSummary(into, from) {
8718
8978
  into.pulls.push(...from.pulls);
8719
8979
  into.mergeable.push(...from.mergeable);
8720
8980
  }
8721
- var emptySummary = (train, preview) => ({
8722
- train,
8981
+ var emptySummary = (version2, preview) => ({
8982
+ version: version2,
8723
8983
  preview,
8724
8984
  clean: [],
8725
8985
  conflicted: [],
@@ -8731,17 +8991,17 @@ var emptySummary = (train, preview) => ({
8731
8991
  });
8732
8992
  var CLEAN_BODY = "Merged clean at every site.";
8733
8993
  var ofConsumer = (list2, consumer) => list2.filter((p) => p === consumer.rel || p.startsWith(`${consumer.rel}/`));
8734
- var trainBranch = (train) => `plexus/${train}`;
8994
+ var versionBranch = (version2) => `plexus/${version2}`;
8735
8995
  var copierIn = (dir, args) => [
8736
8996
  "env",
8737
8997
  [`MISE_IGNORED_CONFIG_PATHS=${dir}`, "mise", ...copierVia(args)]
8738
8998
  ];
8739
- async function takeTrain(ctx, consumer, dir, take, summary) {
8999
+ async function takeVersion(ctx, consumer, dir, take, summary) {
8740
9000
  const base = (await ctx.read("git", ["rev-parse", "HEAD"], { cwd: dir })).trim();
8741
9001
  for (const site of consumer.sites)
8742
9002
  await updateSite(ctx, consumer, site, dir, take, summary);
8743
9003
  await refreshLockfile(ctx, consumer, dir, base, summary);
8744
- await bumpConsumerRefs(ctx, consumer, dir, take.train);
9004
+ await bumpConsumerRefs(ctx, consumer, dir, take.version);
8745
9005
  await openPull(ctx, consumer, dir, take, summary);
8746
9006
  }
8747
9007
  var previewCommit = (ctx, dir, message) => ctx.stage(run("git", ["add", "-A"], { cwd: dir })).then(() => ctx.stage(run("git", [
@@ -8762,21 +9022,21 @@ async function updateSite(ctx, consumer, site, dir, take, summary) {
8762
9022
  const target = join6(dir, relative3(consumer.path, site.path));
8763
9023
  try {
8764
9024
  if (take.previewFrom) {
8765
- const localPreset = join6(take.previewFrom, site.preset);
8766
- ctx.say(`\u2192 ${site.rel}: copier update (preview from ${localPreset}@main)`);
9025
+ const localTemplate = join6(take.previewFrom, site.template);
9026
+ ctx.say(`\u2192 ${site.rel}: copier update (preview from ${localTemplate}@main)`);
8767
9027
  const answers = await ctx.readFile(join6(target, ANSWERS_FILE));
8768
- await ctx.stage(write(join6(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${localPreset}`)));
8769
- await previewCommit(ctx, dir, `plx preview: ${site.rel} reads ${localPreset} from the local checkout`);
9028
+ await ctx.stage(write(join6(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${localTemplate}`)));
9029
+ await previewCommit(ctx, dir, `plx preview: ${site.rel} reads ${localTemplate} from the local checkout`);
8770
9030
  await ctx.stage(run(...copierIn(dir, ["update", "--skip-answered", "--trust", "--defaults", "--skip-tasks", "--vcs-ref", "main"]), { cwd: target }));
8771
9031
  } else {
8772
9032
  ctx.say(`\u2192 ${site.rel}: copier update${take.ref ? ` to ${take.ref}` : ""}`);
8773
9033
  const answers = await ctx.readFile(join6(target, ANSWERS_FILE));
8774
- const current = presetSource(site.preset);
9034
+ const current = templateSource(site.template);
8775
9035
  const recorded = /^_src_path: (.*)$/m.exec(answers)?.[1];
8776
- if (recorded && recorded !== current && Object.keys(RENAMED_PRESETS).some((old) => presetSource(old) === recorded)) {
8777
- ctx.say(` ${site.rel}: the preset is ${current} now; the answers follow`);
9036
+ if (recorded && recorded !== current && Object.keys(RENAMED_TEMPLATES).some((old) => templateSource(old) === recorded)) {
9037
+ ctx.say(` ${site.rel}: the template is ${current} now; the answers follow`);
8778
9038
  await ctx.stage(write(join6(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${current}`)));
8779
- await previewCommit(ctx, dir, `plx: ${site.rel} reads ${current}, the preset's name since its rename`);
9039
+ await previewCommit(ctx, dir, `plx: ${site.rel} reads ${current}, the template's name since its rename`);
8780
9040
  }
8781
9041
  const args = [
8782
9042
  "update",
@@ -8842,13 +9102,15 @@ async function refreshLockfile(ctx, consumer, dir, base, summary) {
8842
9102
  return;
8843
9103
  ctx.say(`\u2192 ${consumer.rel}: pnpm install (manifests changed)`);
8844
9104
  try {
8845
- await ctx.apply([run("mise", ["exec", "--", "pnpm", "install", "--reporter=silent"], { cwd: dir })]);
9105
+ await ctx.apply([
9106
+ run("mise", ["exec", "--", "pnpm", "install", "--no-frozen-lockfile", "--reporter=silent"], { cwd: dir })
9107
+ ]);
8846
9108
  } catch (error) {
8847
9109
  ctx.say(` \u2717 pnpm install failed${detail(error)}`);
8848
9110
  summary.failed.push(`${consumer.rel}/pnpm-lock.yaml`);
8849
9111
  }
8850
9112
  }
8851
- async function bumpConsumerRefs(ctx, consumer, dir, train) {
9113
+ async function bumpConsumerRefs(ctx, consumer, dir, version2) {
8852
9114
  const workflows = join6(dir, ".github", "workflows");
8853
9115
  const entries = await ctx.readDir(workflows).catch(() => []);
8854
9116
  const files = entries.filter((e) => !e.directory && /\.ya?ml$/.test(e.name)).map((e) => e.name).sort();
@@ -8856,20 +9118,20 @@ async function bumpConsumerRefs(ctx, consumer, dir, train) {
8856
9118
  const text = await ctx.readFile(join6(workflows, f));
8857
9119
  if (!text.includes(WORKFLOW_REF))
8858
9120
  continue;
8859
- const bumped = bumpWorkflowRefs(text, train);
9121
+ const bumped = bumpWorkflowRefs(text, version2);
8860
9122
  if (bumped === text)
8861
9123
  continue;
8862
- ctx.say(`\u2192 ${consumer.rel}: ${f} workflow refs \u2192 @${train}`);
9124
+ ctx.say(`\u2192 ${consumer.rel}: ${f} workflow refs \u2192 @${version2}`);
8863
9125
  await ctx.stage(write(join6(workflows, f), bumped));
8864
9126
  }
8865
9127
  }
8866
- async function openPullUrl(ctx, consumer, dir, train) {
8867
- const args = ["pr", "list", "--head", trainBranch(train), "--base", consumer.branch, "--state", "open"];
9128
+ async function openPullUrl(ctx, consumer, dir, version2) {
9129
+ const args = ["pr", "list", "--head", versionBranch(version2), "--base", consumer.branch, "--state", "open"];
8868
9130
  return (await ctx.read("gh", [...args, "--json", "url", "--jq", ".[0].url"], { cwd: dir }).catch(() => "")).trim();
8869
9131
  }
8870
9132
  async function openPull(ctx, consumer, dir, take, summary) {
8871
- const { train } = take;
8872
- const branch = trainBranch(train);
9133
+ const { version: version2 } = take;
9134
+ const branch = versionBranch(version2);
8873
9135
  if (ctx.dryRun) {
8874
9136
  ctx.say(` (preview) ${consumer.rel}: would commit, push ${branch} and open a pull request against ${consumer.branch}`);
8875
9137
  return;
@@ -8882,7 +9144,7 @@ async function openPull(ctx, consumer, dir, take, summary) {
8882
9144
  try {
8883
9145
  await ctx.apply([
8884
9146
  run("git", ["add", "-A"], { cwd: dir }),
8885
- run("git", ["commit", "--quiet", "--no-verify", "-m", `chore: train ${train}`], { cwd: dir })
9147
+ run("git", ["commit", "--quiet", "--no-verify", "-m", `chore: Plexus ${version2}`], { cwd: dir })
8886
9148
  ]);
8887
9149
  await ctx.read("git", ["fetch", "--quiet", "origin", `+refs/heads/${branch}:refs/remotes/origin/${branch}`], {
8888
9150
  cwd: dir
@@ -8900,7 +9162,7 @@ async function openPull(ctx, consumer, dir, take, summary) {
8900
9162
  const conflicted = ofConsumer(summary.conflicted, consumer);
8901
9163
  const failed = ofConsumer(summary.failed, consumer);
8902
9164
  const clean = conflicted.length === 0 && failed.length === 0;
8903
- const existing = await openPullUrl(ctx, consumer, dir, train);
9165
+ const existing = await openPullUrl(ctx, consumer, dir, version2);
8904
9166
  if (existing) {
8905
9167
  ctx.say(`\u2022 ${consumer.rel}: pull request updated: ${existing}`);
8906
9168
  summary.pulls.push(existing);
@@ -8910,7 +9172,7 @@ async function openPull(ctx, consumer, dir, take, summary) {
8910
9172
  }
8911
9173
  const sites = consumer.sites.map((s) => s.rel);
8912
9174
  const body2 = [
8913
- `Train ${train} (\xA7 1.5 PLX): \`copier update\` at ${sites.join(", ")}, the marker, the lockfile where manifests moved, and the workflow refs.`,
9175
+ `Plexus ${version2} (\xA7 1.5 PLX): \`copier update\` at ${sites.join(", ")}, the marker, the lockfile where manifests moved, and the workflow refs.`,
8914
9176
  ...conflicted.length > 0 ? [`Conflicts to resolve, committed with their markers: ${conflicted.join(", ")}.`] : [],
8915
9177
  ...failed.length > 0 ? [`Failed, and left as it was: ${failed.join(", ")}.`] : [],
8916
9178
  ...clean ? [CLEAN_BODY] : [],
@@ -8926,7 +9188,7 @@ async function openPull(ctx, consumer, dir, take, summary) {
8926
9188
  "--head",
8927
9189
  branch,
8928
9190
  "--title",
8929
- `chore: train ${train}`,
9191
+ `chore: Plexus ${version2}`,
8930
9192
  "--body",
8931
9193
  body2
8932
9194
  ], { cwd: dir })
@@ -8936,7 +9198,7 @@ async function openPull(ctx, consumer, dir, take, summary) {
8936
9198
  summary.failed.push(consumer.rel);
8937
9199
  return;
8938
9200
  }
8939
- const url = await openPullUrl(ctx, consumer, dir, train);
9201
+ const url = await openPullUrl(ctx, consumer, dir, version2);
8940
9202
  ctx.say(`\u2022 ${consumer.rel}: pull request opened${url ? `: ${url}` : ""}`);
8941
9203
  summary.pulls.push(url || `${consumer.rel} ${branch}`);
8942
9204
  if (url && clean)
@@ -8953,12 +9215,12 @@ import { basename, join as join7, relative as relative4 } from "node:path";
8953
9215
  async function update(ctx, options) {
8954
9216
  const { repo } = options;
8955
9217
  const name = options.name ?? basename(repo);
8956
- if (options.train !== void 0 && !isTrainVersion(options.train))
8957
- throw new UsageError(`'${options.train}' is not plain semver (X.Y.Z, no v)`);
9218
+ if (options.to !== void 0 && !isPlexusVersion(options.to))
9219
+ throw new UsageError(`'${options.to}' is not plain semver (X.Y.Z, no v)`);
8958
9220
  const tree = await overview(ctx, repo);
8959
- const consumer = (await findConsumers(ctx, tree, PRESETS)).find((c) => c.path === tree.path);
9221
+ const consumer = (await findConsumers(ctx, tree, TEMPLATES)).find((c) => c.path === tree.path);
8960
9222
  if (!consumer)
8961
- throw new Error(`${repo} is not a repo generated from the presets: no ${ANSWERS_FILE} at its root naming one of ${PRESETS.map(presetSource).join(", ")}`);
9223
+ throw new Error(`${repo} is not a repo generated from the templates: no ${ANSWERS_FILE} at its root naming one of ${TEMPLATES.map(templateSource).join(", ")}`);
8962
9224
  if (consumer.skipped)
8963
9225
  throw new Error(`${name}: ${consumer.skipped}`);
8964
9226
  consumer.rel = name;
@@ -8966,11 +9228,11 @@ async function update(ctx, options) {
8966
9228
  s.rel = s.rel === "." ? name : join7(name, s.rel);
8967
9229
  const root = consumer.sites.find((s) => s.path === consumer.path);
8968
9230
  if (!root)
8969
- throw new Error(`${name}: its root is not a site of a repo preset`);
9231
+ throw new Error(`${name}: its root is not a site of a repo template`);
8970
9232
  await preflightForge(ctx);
8971
- const releases = options.train === void 0 ? await trains(ctx) : [];
8972
- const train = options.train ?? newestOf(releases);
8973
- const summary = emptySummary(train, ctx.dryRun);
9233
+ const releases = options.to === void 0 ? await releasesOf(ctx) : [];
9234
+ const version2 = options.to ?? newestOf(releases);
9235
+ const summary = emptySummary(version2, ctx.dryRun);
8974
9236
  await ctx.read("git", ["fetch", "--quiet", "origin", consumer.branch], { cwd: repo }).catch(() => "");
8975
9237
  const answers = await Promise.all(consumer.sites.map(async (s) => {
8976
9238
  const file = join7(relative4(consumer.path, s.path), ANSWERS_FILE);
@@ -8978,18 +9240,18 @@ async function update(ctx, options) {
8978
9240
  return parseAnswers(onOrigin2 ?? await ctx.readFile(join7(s.path, ANSWERS_FILE)));
8979
9241
  }));
8980
9242
  const recorded = answers.map((a) => a.commit);
8981
- if (recorded.every((c) => c === train)) {
8982
- ctx.say(`\u2022 ${name}: already at ${train}`);
9243
+ if (recorded.every((c) => c === version2)) {
9244
+ ctx.say(`\u2022 ${name}: already at ${version2}`);
8983
9245
  return summary;
8984
9246
  }
8985
- const past = recorded.find((c) => c && isTrainVersion(c) && compareTrains(c, train) > 0);
9247
+ const past = recorded.find((c) => c && isPlexusVersion(c) && compareVersions(c, version2) > 0);
8986
9248
  if (past)
8987
- throw new Error(`${name} is at ${past}, past ${train}; a repo is never taken back to an older train`);
8988
- const branch = trainBranch(train);
9249
+ throw new Error(`${name} is at ${past}, past ${version2}; a repo is never taken back to an older version`);
9250
+ const branch = versionBranch(version2);
8989
9251
  const onOrigin = await ctx.read("git", ["ls-remote", "--exit-code", "--heads", "origin", `refs/heads/${branch}`], { cwd: repo }).then(() => true).catch(() => false);
8990
9252
  if (onOrigin) {
8991
- const url = await openPullUrl(ctx, consumer, repo, train);
8992
- ctx.say(`\u2022 ${name}: ${branch} is already on origin${url ? ` (${url})` : ""} \u2014 nothing to do; delete the branch to pull the train again`);
9253
+ const url = await openPullUrl(ctx, consumer, repo, version2);
9254
+ ctx.say(`\u2022 ${name}: ${branch} is already on origin${url ? ` (${url})` : ""} \u2014 nothing to do; delete the branch to pull the version again`);
8993
9255
  if (url) {
8994
9256
  summary.pulls.push(url);
8995
9257
  const body2 = await ctx.read("gh", ["pr", "view", url, "--json", "body", "--jq", ".body"], { cwd: repo }).catch(() => "");
@@ -8998,21 +9260,21 @@ async function update(ctx, options) {
8998
9260
  }
8999
9261
  return summary;
9000
9262
  }
9001
- const asked = options.train !== void 0 ? `--train ${train}` : options.now ? "--now" : void 0;
9263
+ const asked = options.to !== void 0 ? `--to ${version2}` : options.now ? "--now" : void 0;
9002
9264
  const need = needOf({
9003
9265
  recorded,
9004
9266
  releases,
9005
9267
  asked,
9006
- stale: asked ? [] : await staleIn(ctx, consumer, repo, train),
9268
+ stale: asked ? [] : await staleIn(ctx, consumer, repo, version2),
9007
9269
  maxAge: options.maxAge ?? maxAgeOf(answers[consumer.sites.indexOf(root)]?.answers ?? {}),
9008
9270
  now: options.today === void 0 ? /* @__PURE__ */ new Date() : new Date(options.today)
9009
9271
  });
9010
9272
  if (!need.take) {
9011
- ctx.say(`\u2022 ${name}: rests \u2014 ${need.why} (plx update --now takes ${train})`);
9273
+ ctx.say(`\u2022 ${name}: rests \u2014 ${need.why} (plx update --now takes ${version2})`);
9012
9274
  summary.resting.push({ path: name, reason: need.why });
9013
9275
  return summary;
9014
9276
  }
9015
- ctx.say(`\u2022 ${name}: takes ${train} \u2014 ${need.why}`);
9277
+ ctx.say(`\u2022 ${name}: takes ${version2} \u2014 ${need.why}`);
9016
9278
  const scratch = (await ctx.stage(run("mktemp", ["-d"])))?.trim() ?? "";
9017
9279
  const dir = join7(scratch, name);
9018
9280
  try {
@@ -9025,7 +9287,7 @@ async function update(ctx, options) {
9025
9287
  summary.failed.push(name);
9026
9288
  return summary;
9027
9289
  }
9028
- await takeTrain(ctx, consumer, dir, { train, ref: train, opener: "`plx update`", why: need.why }, summary);
9290
+ await takeVersion(ctx, consumer, dir, { version: version2, ref: version2, opener: "`plx update`", why: need.why }, summary);
9029
9291
  } finally {
9030
9292
  await ctx.stage(run("git", ["worktree", "remove", "--force", dir], { cwd: repo })).catch(() => void 0);
9031
9293
  if (scratch)
@@ -9033,10 +9295,10 @@ async function update(ctx, options) {
9033
9295
  }
9034
9296
  return summary;
9035
9297
  }
9036
- async function staleIn(ctx, consumer, repo, train) {
9037
- const text = await ctx.read("gh", ["release", "download", train, "-R", TRAINS, "-p", MANIFEST_FILE, "-O", "-"]).catch(() => void 0);
9298
+ async function staleIn(ctx, consumer, repo, version2) {
9299
+ const text = await ctx.read("gh", ["release", "download", version2, "-R", RELEASES_REPO, "-p", MANIFEST_FILE, "-O", "-"]).catch(() => void 0);
9038
9300
  if (text === void 0) {
9039
- ctx.say(` ${consumer.rel}: train ${train} carries no ${MANIFEST_FILE} that can be read; its modules are not checked`);
9301
+ ctx.say(` ${consumer.rel}: Plexus ${version2} carries no ${MANIFEST_FILE} that can be read; its modules are not checked`);
9040
9302
  return [];
9041
9303
  }
9042
9304
  const catalog = catalogOf(parseManifest(text));
@@ -9054,28 +9316,28 @@ async function staleIn(ctx, consumer, repo, train) {
9054
9316
  }
9055
9317
  return staleModules(markers, catalog);
9056
9318
  }
9057
- var TRAINS = `plexus-ms/${COMPENDIUM}`;
9058
- async function trains(ctx) {
9319
+ var RELEASES_REPO = `plexus-ms/${COMPENDIUM}`;
9320
+ async function releasesOf(ctx) {
9059
9321
  const jq = '.[] | select(.draft | not) | "\\(.tag_name) \\(.published_at)"';
9060
- const lines = await ctx.read("gh", ["api", `repos/${TRAINS}/releases`, "--paginate", "--jq", jq]).catch(() => "");
9061
- return lines.split("\n").map((l) => l.trim().split(/\s+/)).filter((p) => p.length === 2 && isTrainVersion(p[0] ?? "")).map(([train, published]) => ({ train, published }));
9322
+ const lines = await ctx.read("gh", ["api", `repos/${RELEASES_REPO}/releases`, "--paginate", "--jq", jq]).catch(() => "");
9323
+ return lines.split("\n").map((l) => l.trim().split(/\s+/)).filter((p) => p.length === 2 && isPlexusVersion(p[0] ?? "")).map(([version2, published]) => ({ version: version2, published }));
9062
9324
  }
9063
9325
  function newestOf(releases) {
9064
- const newest = releases.map((r) => r.train).reduce((a, b) => a && compareTrains(a, b) >= 0 ? a : b, "");
9326
+ const newest = releases.map((r) => r.version).reduce((a, b) => a && compareVersions(a, b) >= 0 ? a : b, "");
9065
9327
  if (!newest)
9066
- throw new Error(`no release of ${TRAINS} found \u2014 pass the train explicitly (--train <version>)`);
9328
+ throw new Error(`no release of ${RELEASES_REPO} found \u2014 pass the version explicitly (--to <version>)`);
9067
9329
  return newest;
9068
9330
  }
9069
9331
 
9070
9332
  // ../lib/dist/propagate.js
9071
9333
  async function propagate(ctx, options) {
9072
9334
  const { dir, ...rest } = options;
9073
- if (options.train !== void 0 && !isTrainVersion(options.train))
9074
- throw new UsageError(`'${options.train}' is not plain semver (X.Y.Z, no v)`);
9075
- const summary = emptySummary(options.train ?? "", ctx.dryRun);
9076
- const consumers = await findConsumers(ctx, await overview(ctx, dir), PRESETS);
9335
+ if (options.to !== void 0 && !isPlexusVersion(options.to))
9336
+ throw new UsageError(`'${options.to}' is not plain semver (X.Y.Z, no v)`);
9337
+ const summary = emptySummary(options.to ?? "", ctx.dryRun);
9338
+ const consumers = await findConsumers(ctx, await overview(ctx, dir), TEMPLATES);
9077
9339
  if (consumers.length === 0)
9078
- ctx.say(`\u2022 no repo generated from ${PRESETS.map(presetSource).join(", ")} found under ${dir}`);
9340
+ ctx.say(`\u2022 no repo generated from ${TEMPLATES.map(templateSource).join(", ")} found under ${dir}`);
9079
9341
  for (const consumer of consumers) {
9080
9342
  if (consumer.skipped) {
9081
9343
  ctx.say(`\u26A0 ${consumer.rel}: ${consumer.skipped} \u2014 skipped (fix it, then re-run propagate)`);
@@ -9085,7 +9347,7 @@ async function propagate(ctx, options) {
9085
9347
  try {
9086
9348
  const one = await update(ctx, { repo: consumer.path, name: consumer.rel, ...rest });
9087
9349
  mergeSummary(summary, one);
9088
- summary.train ||= one.train;
9350
+ summary.version ||= one.version;
9089
9351
  } catch (error) {
9090
9352
  ctx.say(` \u2717 FAILED \u2014 ${consumer.rel}${detail(error)}`);
9091
9353
  summary.failed.push(consumer.rel);
@@ -9096,11 +9358,179 @@ async function propagate(ctx, options) {
9096
9358
 
9097
9359
  // ../lib/dist/requirements.js
9098
9360
  import { join as join8 } from "node:path";
9361
+
9362
+ // ../lib/dist/standard-index.json
9363
+ var standard_index_default = {
9364
+ version: "0.121.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
9099
9518
  var KEYWORD = /MUST|SHOULD|MAY/;
9100
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
+ }
9101
9531
  var list = (value) => value.replace(/^\s*\[/, "").replace(/\].*$/, "").split(",").map((s) => s.trim()).filter(Boolean);
9102
9532
  function scanPage(text, name, mode) {
9103
- const scan = { defects: [], requirements: [], depends: [], consumes: [] };
9533
+ const scan = { defects: [], requirements: [], sections: [], names: [], depends: [], consumes: [] };
9104
9534
  const lines = text.split("\n");
9105
9535
  const defect = (n, msg) => scan.defects.push(`\u2717 ${name}: line ${n + 1}: ${msg}`);
9106
9536
  let i = 0;
@@ -9146,6 +9576,7 @@ function scanPage(text, name, mode) {
9146
9576
  if (maintaining)
9147
9577
  defect(i, "numbered section after Maintaining");
9148
9578
  section = heading[1] ?? "";
9579
+ scan.sections.push(section);
9149
9580
  started = true;
9150
9581
  continue;
9151
9582
  }
@@ -9158,8 +9589,16 @@ function scanPage(text, name, mode) {
9158
9589
  defect(i, `requirement under Maintaining: ${line}`);
9159
9590
  else if (!started)
9160
9591
  defect(i, "requirement before the first \xA7 heading");
9161
- else
9592
+ else {
9162
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
+ }
9163
9602
  continue;
9164
9603
  }
9165
9604
  if (line.startsWith(">")) {
@@ -9211,17 +9650,28 @@ async function checkCompendium(ctx, compendium) {
9211
9650
  for (const [code, where] of byCode)
9212
9651
  if (where.length > 1)
9213
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
+ }
9214
9664
  for (const s of scans.values())
9215
9665
  for (const dep of s.depends)
9216
9666
  if (!byCode.has(dep))
9217
9667
  defects.push(`\u2717 unknown module in depends: ${dep}`);
9218
- const kindOf2 = (page) => page.startsWith("contracts/") ? "contract" : "approach";
9668
+ const kindOf3 = (page) => page.startsWith("contracts/") ? "contract" : "approach";
9219
9669
  const side = (binds2) => binds2 === "repo" || binds2 === "app" ? "dev" : "ops";
9220
- const kinds = new Map([...byCode].map(([code, [page = ""]]) => [code, kindOf2(page)]));
9670
+ const kinds = new Map([...byCode].map(([code, [page = ""]]) => [code, kindOf3(page)]));
9221
9671
  const binds = new Map([...byCode].map(([code, [page = ""]]) => [code, scans.get(page)?.binds ?? ""]));
9222
9672
  for (const [page, s] of scans) {
9223
9673
  const m = s.code ?? page.replace(/.*\//, "");
9224
- const kind = kindOf2(page);
9674
+ const kind = kindOf3(page);
9225
9675
  for (const c of s.consumes) {
9226
9676
  if (kind === "contract")
9227
9677
  defects.push(`\u2717 ${m} is a contract and consumes ${c}; a contract has no other side to consume`);
@@ -9245,6 +9695,101 @@ async function checkCompendium(ctx, compendium) {
9245
9695
  approaches: pages.filter((p) => p.startsWith("approaches/")).length
9246
9696
  };
9247
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
+ }
9248
9793
 
9249
9794
  // ../lib/dist/summary.js
9250
9795
  function mergeLine(urls) {
@@ -14320,18 +14865,18 @@ function annotate(dir, s, modules) {
14320
14865
  import { resolve as resolve6 } from "node:path";
14321
14866
  function register6(program2) {
14322
14867
  program2.command("propagate").description(
14323
- "run update in every repo generated from the presets under a directory: each takes the newest train when it needs it, as one pull request per repo"
14868
+ "run update in every repo generated from the templates under a directory: each takes the newest version when it needs it, as one pull request per repo"
14324
14869
  ).argument("[dir]", "a directory the repos sit under, at any depth", ".").option(
14325
- "--train <version>",
14326
- "the train every repo takes, whatever the triggers say (default: each preset's newest)"
14327
- ).option("--now", "take the newest train in every repo, whatever the triggers say").option(
14870
+ "--to <version>",
14871
+ "the version every repo takes, whatever the triggers say (default: each template's newest)"
14872
+ ).option("--now", "take the newest version in every repo, whatever the triggers say").option(
14328
14873
  "--max-age <days>",
14329
- "the backstop for every repo (default: each repo's answer update_max_age, else 30; 0 takes every train)",
14874
+ "the backstop for every repo (default: each repo's answer update_max_age, else 30; 0 takes every version)",
14330
14875
  (v) => parseMaxAge(v, "--max-age")
14331
14876
  ).action(async (dir, opts, command) => {
14332
14877
  const ctx = contextOf2(command);
14333
- const result = await propagate(ctx, { dir: resolve6(dir), train: opts.train, now: opts.now, maxAge: opts.maxAge });
14334
- const flags = [opts.train ? `--train ${opts.train}` : "", opts.now ? "--now" : ""].filter(Boolean).join(" ");
14878
+ const result = await propagate(ctx, { dir: resolve6(dir), to: opts.to, now: opts.now, maxAge: opts.maxAge });
14879
+ const flags = [opts.to ? `--to ${opts.to}` : "", opts.now ? "--now" : ""].filter(Boolean).join(" ");
14335
14880
  ctx.result(result, (r) => renderSummary(r, `plx -y propagate ${flags} ${dir}`.replace(/ +/g, " ")));
14336
14881
  if (!isClean(result)) process.exitCode = 1;
14337
14882
  });
@@ -14340,36 +14885,51 @@ function register6(program2) {
14340
14885
  // src/commands/requirements.ts
14341
14886
  import { join as join10, resolve as resolve7 } from "node:path";
14342
14887
  function register7(program2) {
14343
- 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) => {
14888
+ program2.command("requirements").description(
14889
+ "lint a repo: the standard's pages in the compendium, citations, dates, template headers and issue identifiers everywhere"
14890
+ ).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) => {
14344
14891
  const ctx = contextOf2(command);
14345
- const compendium = resolve7(dir);
14892
+ const repo = resolve7(dir);
14893
+ const options = { compendium: opts.compendium ? resolve7(opts.compendium) : void 0 };
14346
14894
  if (opts.extract) {
14347
- ctx.result(extractRequirements(await ctx.readFile(join10(compendium, opts.extract))));
14895
+ ctx.result(extractRequirements(await ctx.readFile(join10(repo, opts.extract))));
14896
+ return;
14897
+ }
14898
+ if (opts.commitMsg) {
14899
+ const violations = await checkCommitMessage(ctx, resolve7(opts.commitMsg), repo);
14900
+ ctx.result(violations, (vs) => vs.map(renderViolation).join("\n"));
14901
+ if (violations.length > 0) process.exitCode = 1;
14902
+ return;
14903
+ }
14904
+ if (opts.writeBaseline) {
14905
+ await ctx.apply(await planBaseline(ctx, repo, options));
14348
14906
  return;
14349
14907
  }
14350
- const check = await checkCompendium(ctx, compendium);
14908
+ const check = await checkRepo(ctx, repo, options);
14351
14909
  ctx.result(check, renderCheck);
14352
14910
  if (check.defects.length > 0) process.exitCode = 1;
14353
14911
  });
14354
14912
  }
14355
14913
  function renderCheck(c) {
14356
14914
  if (c.defects.length > 0) return c.defects.join("\n");
14357
- return `\u2713 the map, ${c.contracts} contracts and ${c.approaches} approaches are well-formed`;
14915
+ const what = c.kind === "compendium" ? `the map, ${c.contracts} contracts and ${c.approaches} approaches are well-formed; ` : "";
14916
+ const known = c.known > 0 ? `, ${c.known} known violations in ${BASELINE_FILE}` : "";
14917
+ return `\u2713 ${what}citations resolve against ${c.against}${known}`;
14358
14918
  }
14359
14919
 
14360
14920
  // src/commands/update.ts
14361
14921
  import { resolve as resolve8 } from "node:path";
14362
14922
  function register8(program2) {
14363
14923
  program2.command("update").description(
14364
- "bring this repo up to the newest train when it needs it (asked, or past the backstop age), as a pull request on plexus/<version>: copier update at every site, the marker, the lockfile, the workflow refs"
14365
- ).argument("[dir]", "a repo generated from the presets", ".").option("--train <version>", "the train to take, whatever the triggers say (default: the preset's newest release)").option("--now", "take the newest train whatever the triggers say").option(
14924
+ "bring this repo up to the newest version when it needs it (asked, or past the backstop age), as a pull request on plexus/<version>: copier update at every site, the marker, the lockfile, the workflow refs"
14925
+ ).argument("[dir]", "a repo generated from the templates", ".").option("--to <version>", "the version to take, whatever the triggers say (default: the template's newest release)").option("--now", "take the newest version whatever the triggers say").option(
14366
14926
  "--max-age <days>",
14367
- "the backstop: take the newest train once the oldest one not taken is this old (default: the repo's answer update_max_age, else 30; 0 takes every train)",
14927
+ "the backstop: take the newest version once the oldest one not taken is this old (default: the repo's answer update_max_age, else 30; 0 takes every version)",
14368
14928
  (v) => parseMaxAge(v, "--max-age")
14369
14929
  ).action(async (dir, opts, command) => {
14370
14930
  const ctx = contextOf2(command);
14371
- const result = await update(ctx, { repo: resolve8(dir), train: opts.train, now: opts.now, maxAge: opts.maxAge });
14372
- ctx.result(result, (r) => renderSummary(r, `plx -y update --train ${r.train} ${dir}`, "update"));
14931
+ const result = await update(ctx, { repo: resolve8(dir), to: opts.to, now: opts.now, maxAge: opts.maxAge });
14932
+ ctx.result(result, (r) => renderSummary(r, `plx -y update --to ${r.version} ${dir}`, "update"));
14373
14933
  if (!isClean(result)) process.exitCode = 1;
14374
14934
  });
14375
14935
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexus-ms/cli",
3
- "version": "0.119.0",
3
+ "version": "0.121.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",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/plexus-ms/primitives.git",
15
+ "url": "git+https://github.com/plexus-ms/tooling.git",
16
16
  "directory": "packages/cli"
17
17
  },
18
18
  "publishConfig": {
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@inquirer/prompts": "^8.7.5",
27
- "@plexus-ms/lib": "0.119.0",
27
+ "@plexus-ms/lib": "0.121.0",
28
28
  "commander": "^15.0.0"
29
29
  },
30
30
  "devDependencies": {