@mark1russell7/conventions 0.28.1 → 0.29.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.
package/build/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as runCli } from "./run-mJmeZYyh.js";
2
+ import { c as runCli } from "./run-ByqpkrLT.js";
3
3
  // src/cli.ts
4
4
  try {
5
5
  process.exitCode = runCli(process.argv.slice(2), {
package/build/index.d.ts CHANGED
@@ -261,6 +261,7 @@ export declare const DEFAULT_ALLOWED: readonly string[];
261
261
  /** The forms of a home folder: Windows, macOS and Linux. The group `user` is the name of the user. */
262
262
  export declare const HOME_PATTERNS: readonly RegExp[];
263
263
  export declare const noLocalPaths: Rule;
264
+ export declare const apiReportScript: Rule;
264
265
  /** The Pages workflow of the template, as a call from another repository and as a call from the template itself. */
265
266
  export declare const PAGES_WORKFLOWS: readonly string[];
266
267
  /** A call of the Pages workflow: its line (from 1), and false when its job sets `deploy: false`. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/push-main-only.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/unreleased-change.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/workflow.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WA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yBA,WAAW;;wBAmGR,qBAAqB,SAAQ,iBAA6B;qBA4G7D,kBAAkB;qBCxQlB,mBAAmB;;qBCuBnB,gBAAgB;;qBC7BhB,cAAc,SAAS;WAA0B;WAA0B;;UC6EvE;WACN;WACA;WACA;;WAEA;WACA;;;UAIM;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;WACA,gBAAgB;;;UAIV;;WAEN;;WAEA;;WAEA;WACA,iBAAiB;WACjB,eAAe;;;wBAgGV,aAAa,cAAc,eAAe;;UCrMzC;WACN;WACA;WACA;;WAEA;WACA,iBAAiB;;WAEjB;;WAEA;;;UAIM;WACN,gBAAgB;;WAEhB;;;UAIM;;WAEN;;WAEA;;WAEA;WACA,MAAM,SAAS;;WAEf,iBAAiB;;;wBAaZ,WAAW,cAAc,iBAAgB,SAAiB;;wBAO1D,cAAc,cAAc,QAAQ,mBAAmB,UAAS,KAAK,gCAAqC;;wBAwB1G,UAAU,SAAS,eAAe;;UAmDjC;;WAEN;;WAEA;;WAEA,QAAQ;;;;;;;wBAWH,OAAO,SAAS,eAAe;;wBAyC/B,aAAa,QAAQ;;wBA0BrB,gBAAgB,QAAQ;;wBAsBxB,YAAY,QAAQ;;wBAYpB,UAAU,QAAQ,+BAA+B,iBAAgB;;UAkBhE;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBA6CG,OAAO,yBAAyB,IAAI;;;;;;wBClTpC,aAAa,eAAe;;;;;wBAsD5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/api-report-script.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/push-main-only.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/unreleased-change.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/workflow.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;;;;;WAKjC;EACT,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBAIpC;;wBAGG,aAAa,UAAU,UAAU;;wBAOjC,OAAO,cAAc,gBAAgB;;wBAOrC,QAAQ,cAAc,eAAe;;qBAMxC,WAAY,gBAAgB;;qBAG5B,YAAa;;wBAGV,WAAW,cAAc;;;;;;wBASzB,WAAW;;wBA2BX,UAAU;;wBAUV,OAAO,cAAc;;qBAOxB,UAAW,aAAa;;;;;wBAMrB,aAAa,SAAS,KAAK,oDAAoD;;UC1M9E;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YA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OAAO,yBAAyB,IAAI;;;;;;wBClTpC,aAAa,eAAe;;;;;wBAsD5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
package/build/index.js CHANGED
@@ -1 +1 @@
1
- export { St as ACTIONS_COMMIT, X as DEFAULT_ALLOWED, At as DEPENDENCY_FIELDS, mt as HOMES, xt as HOME_EXPORTS, Z as HOME_PATTERNS, M as HOME_TIMEOUT_MS, y as IGNORE_AFTER, rt as LICENSE_TEXTS, ht as MAP_RULE, p as NPM_REGISTRY, q as PAGES_WORKFLOWS, et as REAL_COMPARE, d as RULES, m as SHIPPED_FIELDS, Ot as STRICT_OPTIONS, b as TRAIN_SCOPES, h as UNSHIPPED_FILES, t as USAGE, n as annotations, it as authorOf, N as blockHash, jt as cleanPath, Mt as codePackages, C as configsOfScript, Ct as convertGate, r as createContext, kt as cuePreset, lt as declaredName, qt as defaultOptions, gt as findHomes, i as formatResult, wt as gateTrigger, P as githubFetch, Ut as globFolders, Wt as globToRegExp, Nt as hasFile, tt as hasImportMetaMain, D as hasTests, ut as homePackage, Pt as inFolder, W as isGitSpecifier, G as isPinned, k as isSourcePath, Ft as keyLine, at as licenseFile, ot as licenseFileOf, It as lineOf, a as listRules, nt as mainCheck, _t as mapMarkdown, vt as mapText, Lt as matchesAny, yt as mergeHomes, dt as messageOf, st as mitText, $ as noBuildOutput, Q as noLocalPaths, g as npmLookup, Gt as packageFolders, J as pagesCalls, Y as pagesSite, Jt as parseConfig, Rt as parseJsonc, A as pathsOf, K as pinnedGitDeps, Tt as prPathFilters, U as pushMainOnly, o as readConfig, zt as readJsonc, bt as readOverlay, Dt as readWorkflow, H as releaseFiles, Bt as replaceLine, ft as repoOf, ct as repositoryIsPublic, I as repositoryOfRemote, V as requiredScripts, z as roadmapOfLine, B as roadmapParses, s as runChecks, c as runCli, l as runFix, Vt as runGit, L as runnerBudget, R as scheduleMinute, w as scriptsOf, F as sharedDocsRule, pt as signaturesOf, j as sourceMain, Ht as specifiersOf, u as summaryMarkdown, Et as summaryName, E as testsRequired, x as trustPolicy, O as tsconfigTest, T as typedFiles, S as typedScripts, _ as unreleasedChange, v as unreleasedChangeRule, Kt as workspaceGlobs, f as workspaceProtocol } from "./run-mJmeZYyh.js";
1
+ export { Ct as ACTIONS_COMMIT, Z as DEFAULT_ALLOWED, jt as DEPENDENCY_FIELDS, ht as HOMES, St as HOME_EXPORTS, Q as HOME_PATTERNS, M as HOME_TIMEOUT_MS, y as IGNORE_AFTER, it as LICENSE_TEXTS, gt as MAP_RULE, p as NPM_REGISTRY, q as PAGES_WORKFLOWS, tt as REAL_COMPARE, d as RULES, m as SHIPPED_FIELDS, kt as STRICT_OPTIONS, b as TRAIN_SCOPES, h as UNSHIPPED_FILES, t as USAGE, n as annotations, X as apiReportScript, at as authorOf, N as blockHash, Mt as cleanPath, Nt as codePackages, C as configsOfScript, wt as convertGate, r as createContext, At as cuePreset, ut as declaredName, Jt as defaultOptions, _t as findHomes, i as formatResult, Tt as gateTrigger, P as githubFetch, Wt as globFolders, Gt as globToRegExp, Pt as hasFile, nt as hasImportMetaMain, D as hasTests, dt as homePackage, Ft as inFolder, W as isGitSpecifier, G as isPinned, k as isSourcePath, It as keyLine, ot as licenseFile, st as licenseFileOf, Lt as lineOf, a as listRules, rt as mainCheck, vt as mapMarkdown, yt as mapText, Rt as matchesAny, bt as mergeHomes, ft as messageOf, ct as mitText, et as noBuildOutput, $ as noLocalPaths, g as npmLookup, Kt as packageFolders, J as pagesCalls, Y as pagesSite, Yt as parseConfig, zt as parseJsonc, A as pathsOf, K as pinnedGitDeps, Et as prPathFilters, U as pushMainOnly, o as readConfig, Bt as readJsonc, xt as readOverlay, Ot as readWorkflow, H as releaseFiles, Vt as replaceLine, pt as repoOf, lt as repositoryIsPublic, I as repositoryOfRemote, V as requiredScripts, z as roadmapOfLine, B as roadmapParses, s as runChecks, c as runCli, l as runFix, Ht as runGit, L as runnerBudget, R as scheduleMinute, w as scriptsOf, F as sharedDocsRule, mt as signaturesOf, j as sourceMain, Ut as specifiersOf, u as summaryMarkdown, Dt as summaryName, E as testsRequired, x as trustPolicy, O as tsconfigTest, T as typedFiles, S as typedScripts, _ as unreleasedChange, v as unreleasedChangeRule, qt as workspaceGlobs, f as workspaceProtocol } from "./run-ByqpkrLT.js";
@@ -8743,6 +8743,105 @@ const noLocalPaths = {
8743
8743
  return breaks;
8744
8744
  }
8745
8745
  };
8746
+ // src/rules/api-report-script.ts
8747
+ /**
8748
+ * The rule `api-report-script`: a repository with a public package has the root script that checks its API reports.
8749
+ */
8750
+ /** The package of the reports. */
8751
+ const API_REPORT = "@mark1russell7/api-report";
8752
+ /** The range that the fix adds. The train moves it after that. */
8753
+ const API_REPORT_RANGE = "^0.3.1";
8754
+ /** The command of the script. */
8755
+ const COMMAND = "api-report check";
8756
+ /**
8757
+ * This function gives `text` with one more entry in the block `field` of a `package.json` file. The entry goes in the
8758
+ * order of the names when `sorted` is true, else at the end. It gives undefined when the block is not on separate lines.
8759
+ */
8760
+ function addEntry(text, field, name, value, sorted) {
8761
+ const eol = text.includes("\r\n") ? "\r\n" : "\n";
8762
+ const lines = text.split(/\r?\n/);
8763
+ const start = lines.findIndex((line) => line === ` "${field}": {`);
8764
+ if (start < 0) return void 0;
8765
+ const end = lines.findIndex((line, index) => index > start && /^ {2}\},?$/.test(line));
8766
+ if (end < 0) return void 0;
8767
+ const entry = ` ${JSON.stringify(name)}: ${JSON.stringify(value)}`;
8768
+ const nameOf = (line) => line.trim().slice(1).split("\"")[0] ?? "";
8769
+ const next = sorted ? lines.findIndex((line, index) => index > start && index < end && nameOf(line) > name) : -1;
8770
+ if (next >= 0) lines.splice(next, 0, `${entry},`);
8771
+ else {
8772
+ if (end - 1 > start) lines[end - 1] = `${lines[end - 1] ?? ""},`;
8773
+ lines.splice(end, 0, entry);
8774
+ }
8775
+ return lines.join(eol);
8776
+ }
8777
+ /** This function adds a block with one entry after the last block of the root object. */
8778
+ function addBlock(text, field, name, value) {
8779
+ const eol = text.includes("\r\n") ? "\r\n" : "\n";
8780
+ const lines = text.split(/\r?\n/);
8781
+ const end = lines.lastIndexOf("}");
8782
+ if (end < 1) return void 0;
8783
+ lines[end - 1] = `${lines[end - 1] ?? ""},`;
8784
+ lines.splice(end, 0, ` ${JSON.stringify(field)}: {`, ` ${JSON.stringify(name)}: ${JSON.stringify(value)}`, " }");
8785
+ return lines.join(eol);
8786
+ }
8787
+ /** This function gives the text of the root `package.json` with the script and the dependency, or undefined. */
8788
+ function withScript(root, script) {
8789
+ const add = (text, field, name, value, sorted) => root.manifest[field] === void 0 ? addBlock(text, field, name, value) : addEntry(text, field, name, value, sorted);
8790
+ const scripted = add(root.text, "scripts", script, COMMAND, false);
8791
+ if (scripted === void 0) return void 0;
8792
+ return DEPENDENCY_FIELDS.some((field) => specifiersOf(root.manifest, field).some(([name]) => name === API_REPORT)) ? scripted : add(scripted, "devDependencies", API_REPORT, API_REPORT_RANGE, true);
8793
+ }
8794
+ const apiReportScript = {
8795
+ id: "api-report-script",
8796
+ title: "A repository with a public package has the root script `check:api`.",
8797
+ reason: "The shared CI starts each script of its list that `package.json` has, and it skips the others. On 2026-11-04, 8 of the 12 repositories without the script had a public package, so a change of their API had no check.",
8798
+ fix: "Add the script `\"check:api\": \"api-report check\"` and a dev dependency on `@mark1russell7/api-report`. Then build and start `api-report update`. The release train writes the first report in its update.",
8799
+ sources: [
8800
+ {
8801
+ repo: "template",
8802
+ rule: "api-report",
8803
+ doc: "CLAUDE.md:27"
8804
+ },
8805
+ {
8806
+ repo: "packing",
8807
+ rule: "api-report",
8808
+ doc: "CLAUDE.md:20"
8809
+ },
8810
+ {
8811
+ repo: "layout-contract",
8812
+ rule: "api-report",
8813
+ doc: "CLAUDE.md:20"
8814
+ }
8815
+ ],
8816
+ options: { script: {
8817
+ type: "string",
8818
+ default: "check:api",
8819
+ description: "The root script that checks the API reports."
8820
+ } },
8821
+ check(context, options) {
8822
+ const script = typeof options["script"] === "string" ? options["script"] : "check:api";
8823
+ const published = codePackages(context).filter(isPublic);
8824
+ if (published.length === 0) return [];
8825
+ const root = context.rootPackage;
8826
+ const value = root.manifest["scripts"];
8827
+ const scripts = typeof value === "object" && value !== null ? value : {};
8828
+ if (typeof scripts[script] === "string" && scripts[script] !== "") return [];
8829
+ const names = published.map((pkg) => String(pkg.manifest["name"] ?? pkg.folder));
8830
+ const line = lineOf(root.text, "\"scripts\"");
8831
+ const after = withScript(root, script);
8832
+ const edits = after === void 0 ? [] : [{
8833
+ file: root.file,
8834
+ before: root.text,
8835
+ after
8836
+ }];
8837
+ return [{
8838
+ file: root.file,
8839
+ ...line === void 0 ? {} : { line },
8840
+ message: `The root package.json has no script "${script}", and the repository has a public package: ${names.join(", ")}.`,
8841
+ ...edits.length > 0 ? { edits } : {}
8842
+ }];
8843
+ }
8844
+ };
8746
8845
  // src/rules/pages-site.ts
8747
8846
  /**
8748
8847
  * The rule `pages-site`: a public repository has a site. A workflow uses the Pages workflow of the template, and the
@@ -11514,6 +11613,7 @@ const RULES = [
11514
11613
  requiredScripts,
11515
11614
  noBuildOutput,
11516
11615
  noLocalPaths,
11616
+ apiReportScript,
11517
11617
  releaseFiles,
11518
11618
  unreleasedChange,
11519
11619
  changelogVersion,
@@ -11961,6 +12061,6 @@ function runMap(args, io) {
11961
12061
  else io.stdout(mapText(found));
11962
12062
  return 0;
11963
12063
  }
11964
- export { noBuildOutput as $, pathsOf as A, DEPENDENCY_FIELDS as At, roadmapParses as B, replaceLine as Bt, configsOfScript as C, convertGate as Ct, hasTests as D, readWorkflow as Dt, testsRequired as E, summaryName as Et, sharedDocsRule as F, keyLine as Ft, isPinned as G, packageFolders as Gt, releaseFiles as H, specifiersOf as Ht, repositoryOfRemote as I, lineOf as It, pagesCalls as J, parseConfig as Jt, pinnedGitDeps as K, workspaceGlobs as Kt, runnerBudget as L, matchesAny as Lt, HOME_TIMEOUT_MS as M, codePackages as Mt, blockHash as N, hasFile as Nt, tsconfigTest as O, STRICT_OPTIONS as Ot, githubFetch as P, inFolder as Pt, noLocalPaths as Q, scheduleMinute as R, parseJsonc as Rt, typedScripts as S, ACTIONS_COMMIT as St, typedFiles as T, prPathFilters as Tt, pushMainOnly as U, globFolders as Ut, requiredScripts as V, runGit as Vt, isGitSpecifier as W, globToRegExp as Wt, DEFAULT_ALLOWED as X, pagesSite as Y, HOME_PATTERNS as Z, unreleasedChange as _, mapMarkdown as _t, listRules as a, licenseFile as at, TRAIN_SCOPES as b, readOverlay as bt, runCli as c, repositoryIsPublic as ct, RULES as d, messageOf as dt, REAL_COMPARE as et, workspaceProtocol as f, repoOf as ft, npmLookup as g, findHomes as gt, UNSHIPPED_FILES as h, MAP_RULE as ht, formatResult as i, authorOf as it, sourceMain as j, cleanPath as jt, isSourcePath as k, cuePreset as kt, runFix as l, declaredName as lt, SHIPPED_FIELDS as m, HOMES as mt, annotations as n, mainCheck as nt, readConfig as o, licenseFileOf as ot, NPM_REGISTRY as p, signaturesOf as pt, PAGES_WORKFLOWS as q, defaultOptions as qt, createContext as r, LICENSE_TEXTS as rt, runChecks as s, mitText as st, USAGE as t, hasImportMetaMain as tt, summaryMarkdown as u, homePackage as ut, unreleasedChangeRule as v, mapText as vt, scriptsOf as w, gateTrigger as wt, trustPolicy as x, HOME_EXPORTS as xt, IGNORE_AFTER as y, mergeHomes as yt, roadmapOfLine as z, readJsonc as zt };
12064
+ export { noLocalPaths as $, pathsOf as A, cuePreset as At, roadmapParses as B, readJsonc as Bt, configsOfScript as C, ACTIONS_COMMIT as Ct, hasTests as D, summaryName as Dt, testsRequired as E, prPathFilters as Et, sharedDocsRule as F, inFolder as Ft, isPinned as G, globToRegExp as Gt, releaseFiles as H, runGit as Ht, repositoryOfRemote as I, keyLine as It, pagesCalls as J, defaultOptions as Jt, pinnedGitDeps as K, packageFolders as Kt, runnerBudget as L, lineOf as Lt, HOME_TIMEOUT_MS as M, cleanPath as Mt, blockHash as N, codePackages as Nt, tsconfigTest as O, readWorkflow as Ot, githubFetch as P, hasFile as Pt, HOME_PATTERNS as Q, scheduleMinute as R, matchesAny as Rt, typedScripts as S, HOME_EXPORTS as St, typedFiles as T, gateTrigger as Tt, pushMainOnly as U, specifiersOf as Ut, requiredScripts as V, replaceLine as Vt, isGitSpecifier as W, globFolders as Wt, apiReportScript as X, pagesSite as Y, parseConfig as Yt, DEFAULT_ALLOWED as Z, unreleasedChange as _, findHomes as _t, listRules as a, authorOf as at, TRAIN_SCOPES as b, mergeHomes as bt, runCli as c, mitText as ct, RULES as d, homePackage as dt, noBuildOutput as et, workspaceProtocol as f, messageOf as ft, npmLookup as g, MAP_RULE as gt, UNSHIPPED_FILES as h, HOMES as ht, formatResult as i, LICENSE_TEXTS as it, sourceMain as j, DEPENDENCY_FIELDS as jt, isSourcePath as k, STRICT_OPTIONS as kt, runFix as l, repositoryIsPublic as lt, SHIPPED_FIELDS as m, signaturesOf as mt, annotations as n, hasImportMetaMain as nt, readConfig as o, licenseFile as ot, NPM_REGISTRY as p, repoOf as pt, PAGES_WORKFLOWS as q, workspaceGlobs as qt, createContext as r, mainCheck as rt, runChecks as s, licenseFileOf as st, USAGE as t, REAL_COMPARE as tt, summaryMarkdown as u, declaredName as ut, unreleasedChangeRule as v, mapMarkdown as vt, scriptsOf as w, convertGate as wt, trustPolicy as x, readOverlay as xt, IGNORE_AFTER as y, mapText as yt, roadmapOfLine as z, parseJsonc as zt };
11965
12065
 
11966
- //# sourceMappingURL=run-mJmeZYyh.js.map
12066
+ //# sourceMappingURL=run-ByqpkrLT.js.map