@antelopejs/tooling-configs 0.3.5 → 0.3.7

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/dist/bin/sync.mjs CHANGED
@@ -4,13 +4,13 @@ import { a as repositoryTools, i as parseManifest, n as managedPackage, o as tem
4
4
  import { i as presetConfig, n as SETUP_SCRIPT, r as lefthook, t as PRESET_CONFIGS } from "../templates-BKZv-BRw.mjs";
5
5
  import { a as VERIFY_KINDS, c as isVerifyKind, i as SYNCED_SKILL_FILES, l as skillFolder, o as claudeLink, s as claudeLinkTarget, u as planDocsSkills } from "../shared-igPpEDpS.mjs";
6
6
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
7
- import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
7
+ import { a as gitFiles, c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
8
8
  import { i as recordedRelease, t as measureBaseline } from "../ratchet-Q-JXuZIX.mjs";
9
- import { a as ciWorkflow, c as ciRenovateSyncCallers, f as renovateArtifacts, l as hasChecksWorkflow, o as MISSING_CHECKS_WORKFLOW, r as CI_PATH, s as ciNodeCallers } from "../ci-workflow-C4mQ8QSp.mjs";
9
+ import { a as ciWorkflow, c as ciNodeCallers, l as ciRenovateSyncCallers, o as placeholderTestScript, p as renovateArtifacts, r as CI_PATH, s as MISSING_CHECKS_WORKFLOW, u as hasChecksWorkflow } from "../ci-workflow-37qJa9LX.mjs";
10
10
  import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-C0SkPO5R.mjs";
11
- import { t as DEFAULT_SHARED } from "../map-s_jKqBQv.mjs";
11
+ import { t as DEFAULT_SHARED } from "../map-COx26Bu6.mjs";
12
12
  import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, rmdirSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
13
- import { dirname, join, resolve } from "node:path";
13
+ import { dirname, join, posix, resolve } from "node:path";
14
14
  import { execFileSync } from "node:child_process";
15
15
  import { isMap, isScalar, isSeq, parseDocument } from "yaml";
16
16
  import ts from "typescript";
@@ -95,6 +95,9 @@ const FULL_RULES = [
95
95
  ["A CI gate reads `needs.<id>` only of jobs in its `needs`", "`antelopejs-sync --check`"],
96
96
  ["Entry-only rules exempt no tracked outsider", "`antelopejs-sync --check`"],
97
97
  ["A DMS layer's `build/backend-boundary.ts` is the pack's plugin", "`antelopejs-sync --check`"],
98
+ ["No `skipLibCheck` in the root tsconfig or one `typecheck` or `build` uses", "Reported by `antelopejs-sync` (note only)"],
99
+ ["`build` skips the lib check only over what `typecheck` checks", "Reported by `antelopejs-sync` (note only)"],
100
+ ["`release` runs `typecheck`", "Reported by `antelopejs-sync` (note only)"],
98
101
  ["A test names the wrong implementation it catches", "review; no tool"]
99
102
  ];
100
103
  /** Pads each column the way oxfmt does, so formatting AGENTS.md never reports sync drift. */
@@ -713,6 +716,466 @@ function planWritingSkills(root, profile, kind) {
713
716
  };
714
717
  return planDocsSkills(root);
715
718
  }
719
+ //#endregion
720
+ //#region src/guardrails/coverage-files.ts
721
+ function coverageFiles(root) {
722
+ try {
723
+ const tracked = new Set(gitFiles(root));
724
+ return {
725
+ root,
726
+ isTracked: (file) => tracked.has(file),
727
+ unreadable: /* @__PURE__ */ new Map()
728
+ };
729
+ } catch {
730
+ return {
731
+ root,
732
+ isTracked: () => true,
733
+ unreadable: /* @__PURE__ */ new Map()
734
+ };
735
+ }
736
+ }
737
+ /** The text of `file`, or `undefined` when it does not exist or cannot be read; an unreadable file is recorded in `unreadable` and never thrown. */
738
+ function readText(files, file) {
739
+ try {
740
+ return readFileSync(join(files.root, file), "utf8");
741
+ } catch (error) {
742
+ const code = error instanceof Error && "code" in error ? String(error.code) : "unknown error";
743
+ if (code !== "ENOENT" && code !== "ENOTDIR") files.unreadable.set(file, code);
744
+ return;
745
+ }
746
+ }
747
+ function isFile(files, file) {
748
+ try {
749
+ return statSync(join(files.root, file)).isFile();
750
+ } catch {
751
+ return false;
752
+ }
753
+ }
754
+ function unreadableNotes(files) {
755
+ return [...files.unreadable].map(([file, code]) => `could not read ${file} (${code}), so what it sets is not reported.`);
756
+ }
757
+ /** The property `name` of a JSON object literal; when the key is repeated the last one wins, as when tsc reads it. */
758
+ function propertyNamed(object, name) {
759
+ if (object === void 0 || !ts.isObjectLiteralExpression(object)) return void 0;
760
+ return object.properties.findLast((item) => ts.isPropertyAssignment(item) && (ts.isIdentifier(item.name) || ts.isStringLiteral(item.name)) && item.name.text === name)?.initializer;
761
+ }
762
+ /** The root value of a JSON text, comments and trailing commas allowed. */
763
+ function jsonRoot(file, text) {
764
+ return ts.parseJsonText(file, text).statements[0]?.expression;
765
+ }
766
+ /** The strings of a JSON string or array of strings. */
767
+ function stringValues(value) {
768
+ if (value === void 0) return [];
769
+ return (ts.isArrayLiteralExpression(value) ? value.elements : [value]).filter(ts.isStringLiteral).map((item) => item.text);
770
+ }
771
+ //#endregion
772
+ //#region src/guardrails/release-hooks.ts
773
+ /** The release-it hooks that run before anything is published: the generic and plugin-scoped `init`, `bump` and `beforeRelease` stages, and `before` the `release` stage. */
774
+ const BEFORE_PUBLISH = /^(?:(?:before|after):(?:[^:]+:)?(?:init|bump|beforeRelease)|before:(?:[^:]+:)?release)$/u;
775
+ function hooksIn(files, file, path) {
776
+ const text = readText(files, file);
777
+ if (text === void 0) return [];
778
+ let node = jsonRoot(file, text);
779
+ for (const key of path) node = propertyNamed(node, key);
780
+ if (node === void 0 || !ts.isObjectLiteralExpression(node)) return [];
781
+ return node.properties.flatMap((property) => ts.isPropertyAssignment(property) && (ts.isStringLiteral(property.name) || ts.isIdentifier(property.name)) && BEFORE_PUBLISH.test(property.name.text) && propertyNamed(node, property.name.text) === property.initializer ? stringValues(property.initializer) : []);
782
+ }
783
+ /** The commands of the release-it hooks that run before publishing, from `.release-it.json` and from the `release-it` key of `package.json`. Other config formats are not read. */
784
+ function releaseHooks(files) {
785
+ return [...hooksIn(files, ".release-it.json", ["hooks"]), ...hooksIn(files, "package.json", ["release-it", "hooks"])];
786
+ }
787
+ //#endregion
788
+ //#region src/guardrails/script-steps.ts
789
+ const SEPARATORS = /&&|\|\||[;|\n]|(?<![>&])&(?!&)/u;
790
+ const ENV_ASSIGNMENT = /^[A-Za-z_]\w*=/u;
791
+ const TSC_COMMAND = /(?:^|[\\/])tsc(?:\.js)?$/u;
792
+ const MANAGERS = /* @__PURE__ */ new Set([
793
+ "pnpm",
794
+ "npm",
795
+ "yarn",
796
+ "bun"
797
+ ]);
798
+ const NPM_BUILTINS = /* @__PURE__ */ new Set([
799
+ "test",
800
+ "start",
801
+ "stop",
802
+ "restart"
803
+ ]);
804
+ const WRAPPERS = /* @__PURE__ */ new Set([
805
+ "cross-env",
806
+ "cross-env-shell",
807
+ "env",
808
+ "corepack"
809
+ ]);
810
+ const EXEC_RUNNERS = /* @__PURE__ */ new Set([
811
+ "npx",
812
+ "bunx",
813
+ "pnpx"
814
+ ]);
815
+ const EXEC_VERBS = /* @__PURE__ */ new Set([
816
+ "exec",
817
+ "x",
818
+ "dlx"
819
+ ]);
820
+ const RUN_ALL = /* @__PURE__ */ new Set([
821
+ "run-s",
822
+ "run-p",
823
+ "npm-run-all",
824
+ "npm-run-all2"
825
+ ]);
826
+ const RUN_ALL_VALUED = /* @__PURE__ */ new Set(["--max-parallel", "--npm-path"]);
827
+ const EXEC_VALUED = /* @__PURE__ */ new Set([
828
+ "-p",
829
+ "--package",
830
+ "-c",
831
+ "--call"
832
+ ]);
833
+ const TARGET_VALUED = /* @__PURE__ */ new Set([
834
+ "--filter",
835
+ "-F",
836
+ "--dir",
837
+ "-C",
838
+ "--prefix",
839
+ "--cwd",
840
+ "--workspace"
841
+ ]);
842
+ const TARGET_FLAGS = /* @__PURE__ */ new Set([
843
+ "-r",
844
+ "--recursive",
845
+ "--workspaces",
846
+ "-ws"
847
+ ]);
848
+ function words(segment) {
849
+ return segment.replace(/[()]/gu, " ").split(/\s+/u).map((word) => word.replace(/^["']|["']$/gu, "")).filter(Boolean);
850
+ }
851
+ /** The simple commands of a script: `&&`, `||`, `;`, `|`, `&`, newlines and parentheses all end one. */
852
+ function lines(script) {
853
+ return script.split(SEPARATORS).map(words).filter((list) => list.length > 0);
854
+ }
855
+ /** Skips the options from `from`, and the values of those that take one; `elsewhere` when one points at another package. */
856
+ function skipOptions(args, from, valued) {
857
+ let index = from;
858
+ let elsewhere = false;
859
+ while (index < args.length && args[index].startsWith("-")) {
860
+ const [name, ...value] = args[index].split("=");
861
+ elsewhere ||= TARGET_VALUED.has(name) || TARGET_FLAGS.has(name);
862
+ index += valued.has(name) && value.length === 0 ? 2 : 1;
863
+ }
864
+ return {
865
+ index,
866
+ elsewhere
867
+ };
868
+ }
869
+ function isTsc(word) {
870
+ return TSC_COMMAND.test(word);
871
+ }
872
+ /** `tsc`, a path to it, or `node` running one. */
873
+ function programSteps(line) {
874
+ const [head, ...rest] = line;
875
+ if (head === void 0) return [];
876
+ if (isTsc(head)) return [{
877
+ kind: "tsc",
878
+ args: rest
879
+ }];
880
+ if (head !== "node") return [];
881
+ if (rest[0] === "--run" && rest[1] !== void 0) return [{
882
+ kind: "script",
883
+ names: [rest[1]],
884
+ elsewhere: false
885
+ }];
886
+ const at = rest.findIndex((word) => !word.startsWith("-"));
887
+ return at !== -1 && isTsc(rest[at]) ? [{
888
+ kind: "tsc",
889
+ args: rest.slice(at + 1)
890
+ }] : [];
891
+ }
892
+ /** What `npx`, `pnpm exec` and `npm exec` run: the command after the options and the packages they name. */
893
+ function execSteps(args) {
894
+ return programSteps(args.slice(skipOptions(args, 0, EXEC_VALUED).index));
895
+ }
896
+ function managerSteps(manager, args) {
897
+ const valued = new Set(TARGET_VALUED);
898
+ if (manager === "npm") valued.add("-w");
899
+ const first = skipOptions(args, 0, valued);
900
+ const verb = args[first.index];
901
+ if (verb === void 0) return [];
902
+ if (EXEC_VERBS.has(verb)) return execSteps(args.slice(first.index + 1));
903
+ if (verb === "run" || verb === "run-script") {
904
+ const second = skipOptions(args, first.index + 1, valued);
905
+ const name = args[second.index];
906
+ return name === void 0 ? [] : [{
907
+ kind: "script",
908
+ names: [name],
909
+ elsewhere: first.elsewhere || second.elsewhere
910
+ }];
911
+ }
912
+ if (isTsc(verb)) return programSteps(args.slice(first.index));
913
+ if (manager === "npm" && !NPM_BUILTINS.has(verb)) return [];
914
+ return [{
915
+ kind: "script",
916
+ names: [verb],
917
+ elsewhere: first.elsewhere
918
+ }];
919
+ }
920
+ function runAllSteps(args) {
921
+ const names = [];
922
+ for (let index = 0; index < args.length && args[index] !== "--"; index++) if (!args[index].startsWith("-")) names.push(args[index]);
923
+ else if (RUN_ALL_VALUED.has(args[index])) index++;
924
+ return names.length === 0 ? [] : [{
925
+ kind: "script",
926
+ names,
927
+ elsewhere: false
928
+ }];
929
+ }
930
+ /** The line without its leading environment assignments and wrappers (`cross-env A=1`, `env`, `corepack`). */
931
+ function unwrapped(line) {
932
+ let index = 0;
933
+ let wrapped = false;
934
+ while (index < line.length) {
935
+ const word = line[index];
936
+ if (WRAPPERS.has(word)) wrapped = true;
937
+ else if (!ENV_ASSIGNMENT.test(word) && !(wrapped && word.startsWith("-"))) break;
938
+ index++;
939
+ }
940
+ return line.slice(index);
941
+ }
942
+ function lineSteps(line) {
943
+ const [head, ...args] = unwrapped(line);
944
+ if (head === void 0) return [];
945
+ if (RUN_ALL.has(head)) return runAllSteps(args);
946
+ if (MANAGERS.has(head)) return managerSteps(head, args);
947
+ if (EXEC_RUNNERS.has(head)) return execSteps(args);
948
+ return programSteps([head, ...args]);
949
+ }
950
+ /** The scripts and `tsc` runs a script's command lines start. */
951
+ function stepsOf(script) {
952
+ return lines(script).flatMap(lineSteps);
953
+ }
954
+ /** The script names a `run-s` pattern list selects among `available`. */
955
+ function matchingScripts(names, available) {
956
+ const all = [...available];
957
+ return names.flatMap((name) => {
958
+ if (!name.includes("*")) return [name];
959
+ const pattern = new RegExp(`^${name.split("**").map((part) => part.split("*").map((piece) => piece.replace(/[.+?^${}()|[\]\\]/gu, "\\$&")).join("[^:]*")).join(".*")}$`, "u");
960
+ return all.filter((script) => pattern.test(script));
961
+ });
962
+ }
963
+ //#endregion
964
+ //#region src/guardrails/tsc-invocation.ts
965
+ const ROOT_PROGRAM = "tsconfig.json";
966
+ function normalizeProgram(project) {
967
+ const path = posix.normalize(project.replaceAll("\\", "/"));
968
+ return path.endsWith(".json") || path.endsWith(".jsonc") ? path : posix.join(path, ROOT_PROGRAM);
969
+ }
970
+ /** tsc reads an option name in any letter case, `-b` and `--build` included. */
971
+ function optionName(word) {
972
+ return word.startsWith("-") ? word.replace(/^--?/u, "").toLowerCase() : void 0;
973
+ }
974
+ function tscRun(args) {
975
+ const build = ["b", "build"].includes(optionName(args[0] ?? "") ?? "");
976
+ const positional = [];
977
+ let project;
978
+ let skipsLibCheck = false;
979
+ for (let index = build ? 1 : 0; index < args.length; index++) {
980
+ const option = optionName(args[index]);
981
+ if (option === "p" || option === "project") project = args[++index];
982
+ else if (option === "skiplibcheck") skipsLibCheck = args[index + 1] !== "false";
983
+ else if (option === void 0) positional.push(args[index]);
984
+ }
985
+ const named = build ? positional : project === void 0 ? [] : [project];
986
+ return {
987
+ programs: (named.length === 0 ? ["."] : named).map(normalizeProgram),
988
+ build,
989
+ skipsLibCheck
990
+ };
991
+ }
992
+ //#endregion
993
+ //#region src/guardrails/tsconfig-chain.ts
994
+ const facts = /* @__PURE__ */ new WeakMap();
995
+ function insideRepository(path) {
996
+ return path !== ".." && !path.startsWith("../");
997
+ }
998
+ /** The local file an `extends` entry names: the path as written, else with `.json` added, as tsc looks for it. Backslashes read as slashes. */
999
+ function extendedFile(files, from, entry) {
1000
+ const written = entry.replaceAll("\\", "/");
1001
+ if (!written.startsWith("./") && !written.startsWith("../")) return void 0;
1002
+ const target = posix.join(posix.dirname(from), written);
1003
+ return [target, `${target}.json`].find((candidate) => insideRepository(candidate) && isFile(files, candidate));
1004
+ }
1005
+ /** The tsconfig a project reference names: the file, or `tsconfig.json` of the directory. */
1006
+ function referencedFile(files, from, path) {
1007
+ const target = posix.join(posix.dirname(from), path.replaceAll("\\", "/"));
1008
+ const file = isFile(files, target) ? target : posix.join(target, ROOT_PROGRAM);
1009
+ return insideRepository(file) ? file : void 0;
1010
+ }
1011
+ function referencePaths(object) {
1012
+ const references = propertyNamed(object, "references");
1013
+ if (references === void 0 || !ts.isArrayLiteralExpression(references)) return [];
1014
+ return references.elements.flatMap((element) => stringValues(propertyNamed(element, "path")));
1015
+ }
1016
+ function readFacts(files, file) {
1017
+ const text = readText(files, file);
1018
+ if (text === void 0) return void 0;
1019
+ const object = jsonRoot(file, text);
1020
+ const flag = propertyNamed(propertyNamed(object, "compilerOptions"), "skipLibCheck");
1021
+ const resolve = (found) => found ? [found] : [];
1022
+ return {
1023
+ skipLibCheck: flag === void 0 ? void 0 : flag.kind === ts.SyntaxKind.TrueKeyword,
1024
+ parents: stringValues(propertyNamed(object, "extends")).flatMap((entry) => resolve(extendedFile(files, file, entry))),
1025
+ references: referencePaths(object).flatMap((path) => resolve(referencedFile(files, file, path)))
1026
+ };
1027
+ }
1028
+ function factsOf(files, file) {
1029
+ let cache = facts.get(files);
1030
+ if (cache === void 0) facts.set(files, cache = /* @__PURE__ */ new Map());
1031
+ if (!cache.has(file)) cache.set(file, readFacts(files, file));
1032
+ return cache.get(file);
1033
+ }
1034
+ /** The value `compilerOptions.skipLibCheck` ends up with for `file` and the files down to the one that sets it. A file's own setting overrides what it extends, a later `extends` entry overrides an earlier one, and a package preset is not read: it counts only when it is this package's, and this package ships none. */
1035
+ function skipLibCheckSetting(files, file, ancestors = []) {
1036
+ if (ancestors.includes(file)) return void 0;
1037
+ const found = factsOf(files, file);
1038
+ if (found === void 0) return void 0;
1039
+ if (found.skipLibCheck !== void 0) return {
1040
+ value: found.skipLibCheck,
1041
+ chain: [file]
1042
+ };
1043
+ for (const parent of found.parents.toReversed()) {
1044
+ const inherited = skipLibCheckSetting(files, parent, [...ancestors, file]);
1045
+ if (inherited !== void 0) return {
1046
+ value: inherited.value,
1047
+ chain: [file, ...inherited.chain]
1048
+ };
1049
+ }
1050
+ }
1051
+ /** `programs` and, for `tsc -b`, the projects they reference, to any depth. */
1052
+ function withReferences(files, programs) {
1053
+ const seen = /* @__PURE__ */ new Set();
1054
+ const queue = [...programs];
1055
+ for (const file of queue) {
1056
+ if (seen.has(file)) continue;
1057
+ seen.add(file);
1058
+ queue.push(...factsOf(files, file)?.references ?? []);
1059
+ }
1060
+ return [...seen];
1061
+ }
1062
+ /** The file to report a `true` setting against: the file that sets it, or when git ignores that one (a generated file such as Nuxt's `.nuxt/tsconfig.json`) the first file of the chain git does not ignore, which overrides it. Nothing when every file of the chain is generated. */
1063
+ function reportedFile(files, setting) {
1064
+ const setter = setting.chain.at(-1);
1065
+ if (setter !== void 0 && files.isTracked(setter)) return {
1066
+ file: setter,
1067
+ sets: true
1068
+ };
1069
+ const file = setting.chain.find((candidate) => files.isTracked(candidate));
1070
+ return file === void 0 ? void 0 : {
1071
+ file,
1072
+ sets: false
1073
+ };
1074
+ }
1075
+ //#endregion
1076
+ //#region src/guardrails/typecheck-coverage.ts
1077
+ const MAX_DEPTH = 5;
1078
+ /** The scripts `name` runs and everything `extra` commands run, to a bounded depth: through package managers and `run-s`, with the `pre<script>` hook npm and pnpm run before each. */
1079
+ function reach(scripts, name, extra = []) {
1080
+ const reached = {
1081
+ local: /* @__PURE__ */ new Set(),
1082
+ elsewhere: /* @__PURE__ */ new Set()
1083
+ };
1084
+ const queue = [];
1085
+ const enter = (script, depth) => {
1086
+ const text = scripts.get(script);
1087
+ if (text === void 0 || depth > MAX_DEPTH || reached.local.has(script)) return;
1088
+ reached.local.add(script);
1089
+ enter(`pre${script}`, depth);
1090
+ queue.push({
1091
+ text,
1092
+ depth
1093
+ });
1094
+ };
1095
+ enter(name, 0);
1096
+ queue.push(...extra.map((text) => ({
1097
+ text,
1098
+ depth: 0
1099
+ })));
1100
+ for (const { text, depth } of queue) for (const step of stepsOf(text)) {
1101
+ if (step.kind !== "script") continue;
1102
+ for (const script of matchingScripts(step.names, scripts.keys())) if (step.elsewhere) reached.elsewhere.add(script);
1103
+ else enter(script, depth + 1);
1104
+ }
1105
+ return reached;
1106
+ }
1107
+ function ownRuns(script) {
1108
+ return stepsOf(script).flatMap((step) => step.kind === "tsc" ? [tscRun(step.args)] : []);
1109
+ }
1110
+ function runsOf(scripts, name) {
1111
+ return [...reach(scripts, name).local].flatMap((script) => ownRuns(scripts.get(script) ?? ""));
1112
+ }
1113
+ function skipCoverageErrors(scripts) {
1114
+ const skipped = [...new Set(runsOf(scripts, "build").filter((run) => run.skipsLibCheck).flatMap((run) => run.programs))];
1115
+ const typecheck = runsOf(scripts, "typecheck");
1116
+ const covered = typecheck.filter((run) => !run.skipsLibCheck).flatMap((run) => run.programs);
1117
+ return skipped.filter((program) => !covered.includes(program)).map((program) => {
1118
+ const lead = `package.json: script "build" passes --skipLibCheck to tsc for ${program}, but`;
1119
+ const fix = `Make "typecheck" run \`tsc --noEmit${program === "tsconfig.json" ? "" : ` -p ${program}`}\` without --skipLibCheck, or drop --skipLibCheck from "build".`;
1120
+ if (!scripts.has("typecheck")) return `${lead} there is no "typecheck" script. ${fix}`;
1121
+ if (typecheck.some((run) => run.programs.includes(program))) return `${lead} script "typecheck" also passes --skipLibCheck for it. ${fix}`;
1122
+ return `${lead} script "typecheck" runs no full tsc over it. ${fix}`;
1123
+ });
1124
+ }
1125
+ function releaseErrors(files, scripts) {
1126
+ if (!scripts.has("release")) return [];
1127
+ const reached = reach(scripts, "release", releaseHooks(files));
1128
+ if (reached.local.has("typecheck") || reached.elsewhere.has("typecheck")) return [];
1129
+ return [`package.json: script "release" does not run "typecheck", so a release can publish a build that skipped the lib check. Add \`pnpm run typecheck\` to "release" before it builds or publishes, or to a release-it \`before:init\` hook.`];
1130
+ }
1131
+ /** The tsconfig files each script reads through `tsc`, and the root one, with the scripts that read each. */
1132
+ function usedPrograms(files, scripts) {
1133
+ const used = /* @__PURE__ */ new Map([[ROOT_PROGRAM, []]]);
1134
+ for (const [name, script] of scripts) for (const run of ownRuns(script)) {
1135
+ const programs = run.build ? withReferences(files, run.programs) : run.programs;
1136
+ for (const program of programs) used.set(program, [...used.get(program) ?? [], name]);
1137
+ }
1138
+ return used;
1139
+ }
1140
+ function skipLibCheckErrors(files, scripts) {
1141
+ const readers = /* @__PURE__ */ new Map();
1142
+ for (const [program, users] of usedPrograms(files, scripts)) {
1143
+ const setting = skipLibCheckSetting(files, program);
1144
+ const target = setting?.value ? reportedFile(files, setting) : void 0;
1145
+ if (setting === void 0 || target === void 0) continue;
1146
+ const reader = users.length ? `${program} (script ${[...new Set(users)].map((name) => `"${name}"`).join(", ")})` : `${program} (the root program)`;
1147
+ const known = readers.get(target.file);
1148
+ if (known) known.by.push(reader);
1149
+ else readers.set(target.file, {
1150
+ sets: target.sets,
1151
+ by: [reader],
1152
+ from: setting.chain.at(-1) ?? target.file
1153
+ });
1154
+ }
1155
+ return [...readers].map(([file, { sets, by, from }]) => sets ? `${file}: sets compilerOptions.skipLibCheck: true, read by ${by.join(", ")}. Remove it so "typecheck" checks the declaration files; "build" may pass --skipLibCheck on the command line for the program "typecheck" covers.` : `${file}: inherits compilerOptions.skipLibCheck: true from ${from}, which git ignores, read by ${by.join(", ")}. Set \`skipLibCheck: false\` here so "typecheck" checks the declaration files; "build" may pass --skipLibCheck on the command line for the program "typecheck" covers.`);
1156
+ }
1157
+ function scriptsOf(files) {
1158
+ const text = readText(files, "package.json");
1159
+ if (text === void 0) return void 0;
1160
+ try {
1161
+ return new Map(Object.entries(parseManifest(text).scripts ?? {}));
1162
+ } catch {
1163
+ files.unreadable.set("package.json", "invalid JSON");
1164
+ return;
1165
+ }
1166
+ }
1167
+ /** The package.json and tsconfig facts that keep `typecheck` the lib check no other script skips: `build` skips the lib check only over a program `typecheck` checks in full, no tsconfig a script uses or the root one sets `skipLibCheck: true`, and `release` runs `typecheck`. A file that cannot be read yields a note and never an error. */
1168
+ function checkTypecheckCoverage(root) {
1169
+ const files = coverageFiles(root);
1170
+ const scripts = scriptsOf(files);
1171
+ if (scripts === void 0) return unreadableNotes(files);
1172
+ return [
1173
+ ...skipCoverageErrors(scripts),
1174
+ ...skipLibCheckErrors(files, scripts),
1175
+ ...releaseErrors(files, scripts),
1176
+ ...unreadableNotes(files)
1177
+ ];
1178
+ }
716
1179
  /** The kind-specific text of each shared skill. */
717
1180
  const KIND_TEXT = {
718
1181
  interface: {
@@ -764,7 +1227,7 @@ const KIND_TEXT = {
764
1227
  };
765
1228
  //#endregion
766
1229
  //#region src/verify/skills.ts
767
- const BIN = "pnpm exec antelopejs-verify";
1230
+ const BIN = "node_modules/.bin/antelopejs-verify";
768
1231
  function bullets(lines) {
769
1232
  return lines.map((line) => `- ${line}`).join("\n");
770
1233
  }
@@ -803,16 +1266,27 @@ Doctor checks that HEAD has not moved since \`new\`, \`ajs\` comes from the repo
803
1266
 
804
1267
  \`\`\`bash
805
1268
  ${BIN} plan --base origin/main
1269
+ ${BIN} journey <run> --plan --jobs 4
1270
+ \`\`\`
1271
+
1272
+ \`plan\` maps the diff to features and lists unmapped surfaces. \`journey <run> --plan\` runs every feature \`plan\` lists as \`run\` for the run's base, \`smoke\` first, in one call: it prints each feature's lines in turn, keeps going after a feature fails, and exits 1 when any journey did not pass. Run it once instead of one call per feature.
1273
+
1274
+ When verify.config.ts declares no \`services\`, pass \`--jobs 4\`: up to four features run at once, each in a process of its own, capped at half the machine's cores. The output, the evidence and the exit code are those of the call without \`--jobs\`, and a feature that lists a journey an earlier feature lists waits for it, so it still reuses that PASS. A feature whose process dies or leaves an uncaught error is named on stderr, and the others still run. \`--jobs\` above 1 is refused when verify.config.ts declares \`services\`, because each journey resets them as it starts, which would wipe the data of a journey running beside it. Without \`--jobs\`, a journey that leaves an uncaught error behind ends the call and the line \`not run: <features>\` names what to rerun.
1275
+
1276
+ To rerun after a fix, run one feature, or only the journeys you name, or several features by name, with \`--jobs\` too:
1277
+
1278
+ \`\`\`bash
806
1279
  ${BIN} journey <run> <feature> [journey...]
1280
+ ${BIN} journey <run> --features <feature>,<feature> [--jobs 4]
807
1281
  \`\`\`
808
1282
 
809
- \`plan\` maps the diff to features and lists unmapped surfaces. \`journey\` runs a feature's journeys, or the ones named. The pack ships these journeys for this kind; a feature file names them next to the repository's own:
1283
+ The pack ships these journeys for this kind; a feature file names them next to the repository's own:
810
1284
 
811
1285
  ${text.builtins}
812
1286
 
813
1287
  ## Evidence
814
1288
 
815
- Each step writes \`<run>/evidence/<feature>/<journey>/<NN-step>/\` with \`command.txt\`, \`stdout.txt\`, \`stderr.txt\`, \`exit-code.txt\`, \`pid.txt\` for background processes, \`tree.txt\`, \`http.json\` for every request, and \`checks.json\`. \`result.json\` holds a journey's result and \`feature.json\` the merged results of the feature. A journey id listed under two features runs once per run: when \`journey <run> <feature>\` names no ids and another feature of the run already passed that id at the same HEAD, the feature records a result with \`reusedFrom\` naming that evidence folder and runs nothing. Name the id to run it again. Read the evidence before you judge a PASS: a check proves only what it asserts.
1289
+ Each step writes \`<run>/evidence/<feature>/<journey>/<NN-step>/\` with \`command.txt\`, \`stdout.txt\`, \`stderr.txt\`, \`exit-code.txt\`, \`pid.txt\` for background processes, \`tree.txt\`, \`http.json\` for every request, and \`checks.json\`. \`result.json\` holds a journey's result and \`feature.json\` the merged results of the feature. A journey id listed under two features runs once per run: when a feature runs without named ids, from \`--plan\`, \`--features\` or \`journey <run> <feature>\`, and another feature of the run already passed that id at the same HEAD, the feature records a result with \`reusedFrom\` naming that evidence folder and runs nothing. Name the id to run it again. Read the evidence before you judge a PASS: a check proves only what it asserts.
816
1290
 
817
1291
  ## Cleanup
818
1292
 
@@ -828,7 +1302,7 @@ Each journey deletes its scratch folder and \`HOME\`, its install included, when
828
1302
  - \`doors\`: one entry per door kind (\`data\`, \`format\`, \`contract\`, \`outbound\`, \`exposure\`, \`publish\`), each \`null\` when it cannot apply or \`{ globs, funnels, why }\`.
829
1303
  - \`journeys\`: the repository's journeys by id, each \`{ title, entryPoint, run(context) }\`, using the check helpers the same import exports. A check states what the product must do; an environment that went away is never a failing check. When a journey fails, the harness reruns each service's readiness command, up to four times over about 3.5 s, and looks at every \`ajs project dev\` the journey started, its own readiness probe included. The journey ends NOT VERIFIED, not FAIL, when a service still fails every rerun, an app was killed by SIGKILL, SIGTERM, SIGHUP or SIGINT that the harness did not send, or the app the harness started failed to bind the port the harness gave it (\`EADDRINUSE\` naming that port). An app that exits on its own with an exit code, one that crashes by another signal such as SIGABRT or SIGSEGV, and one that logs \`EADDRINUSE\` for any other port are the product's failure. A change that takes its own service down still reads as an outage: the service stays down, so the journey is NOT VERIFIED. For anything else the journey depends on, such as a process it started with \`context.command\` or an outside endpoint, probe it when a check fails and call \`context.notVerified(reason)\` when it no longer answers.
830
1304
  - \`context.prepared(key, build)\` does the preparation many journeys repeat once per run, such as scaffolding and installing a project, and returns the journey's own copy at \`<work>/<key>\`. The first journey that asks for \`key\` runs \`build(folder)\` on the empty folder with its usual steps, after a step \`prepared <key>\` that marks them as the build and says whether it was kept. A build is kept until \`clean\` only when it returns, records at least one check, passes every check, and leaves only files, directories and symlinks in the folder. Every later journey of the run, also in a later \`journey\` command, gets a fresh copy and one step, \`prepared <key>\`, that names the journey that built it and holds that build's evidence under \`build/\`. A build that is not kept is built again by the next journey, and rerunning the journey that built builds again. An absolute symlink into the folder points into each copy; other symlinks keep their target. \`build\` writes only inside the folder it is given: a write elsewhere, such as a sibling under \`<work>\` or the repository, stays with the journey that built. Two concurrent \`journey\` commands that reach the same key at once both build, and the first to finish is kept. The commands \`build\` runs get a \`HOME\` of their own that is deleted when it ends: redo after \`prepared\` anything a later step needs in \`HOME\`, such as \`ajs config set git\`. Pass the same \`build\` for a key in every journey.
831
- - \`env\`, \`setup\` (commands replacing the build), \`userFacing\` and \`shared\` (globs replacing the kind's default; \`shared\` lists the files whose change runs every feature), and \`formal\` (formal checks: \`name\`, \`covers\`, \`command\`, \`violation\`, and optionally \`behaviour\` and \`baseCommand\`).
1305
+ - \`env\`, \`setup\` (commands replacing the build), \`userFacing\` and \`shared\` (globs replacing the kind's default; \`shared\` lists the files whose change runs every feature), and \`formal\` (formal checks: \`name\`, \`covers\`, \`command\`, \`violation\` with an optional \`states\` group for the counterexample length, and optionally \`behaviour\` and \`baseCommand\`).
832
1306
  ${text.layer}
833
1307
  - \`features/README.md\`: the index of the features; \`map\` does not read it as a feature.
834
1308
  - \`features/<feature>.md\`: frontmatter lists \`covers:\` (source globs), \`docs:\` (pages a verdict judges) and \`journeys:\`, then the sections Sub-features, How to get to it (user POV), Driving it with antelopejs-verify, and Gotchas. \`features/smoke.md\` covers nothing and runs on every verdict; here it runs ${text.smoke}.
@@ -847,10 +1321,11 @@ ${BIN} map
847
1321
  4. **Docs.** Judge every page \`plan\` lists as \`docs\` against what the journeys showed: the \`docs:\` pages of the touched features, or of every feature when the full set runs. A stale page fails the verdict.
848
1322
  5. **Formal checks.** \`${BIN} formal <run>\` runs every formal check of \`verify.config.ts\` that covers the diff, or whose own \`files\` the diff changes, and records it under \`evidence/formal/<name>/\`. For each one it decides, without judgement, whether the diff changed what the covered code does. \`emit\` (the default) compares the structure of the covered files' JavaScript on the base and on HEAD: node kinds, names and literal values, leaving out types, comments, formatting, parentheses and \`export\` keywords. Each use of an imported binding stands for its origin (the resolved module and the imported name), so an import retargeted to another module or alias counts as changed; a function declaration refers to the top-level variables and classes of its own file by file and name, so moving it next to a different variable of the same name counts as changed. Exports are keyed by the origin they export, so a re-export or an \`export { f as run }\` retargeted to another binding counts as changed. Each file must keep its top-level statements and its side-effect imports in order; function declarations, which are hoisted, may move between covered files with their imports. So a type-only edit, a reformat or a moved function declaration counts as unchanged, while reordering statements or moving any other statement counts as changed. \`emit\` judges behaviour, not the public surface: exports are the api-diff's job. \`probe\` runs the check's \`behaviour.command\` with a worktree of each commit and compares what it prints. Then:
849
1323
  - a covered check that did not run, or exits non-zero (a tool error, or a check that no longer matches its record), fails the verdict;
850
- - recorded findings fail the verdict only when the covered behaviour changed; when it did not, the verdict reports them as known findings;
851
- - when the covered behaviour changed, or the diff changed the check's own \`files\`, \`formal\` also runs the check on the base (\`baseCommand\` when set). A rule the base broke counts as fixed only when HEAD reports it passing (\`passing\`); a rule the base broke that HEAD does not report at all fails the verdict. A change that leaves no violated rule passes.
1324
+ - when the covered behaviour did not change, the verdict reports recorded findings as known findings, except a rule HEAD breaks that the base run did not, which fails the verdict whatever the diff touched, the check's own \`files\` included; when the base run itself exited non-zero, HEAD's findings cannot be compared and fail the verdict, and so does a result whose check's own \`files\` changed with no base run recorded. A check the diff adds is the exception: when the base could not run it, the base's \`verify.config.ts\` never names it, none of its files is a git rename of a base file, and the covered behaviour is unchanged, its recorded findings pass as the record it brings. List those findings in the PR body so a reviewer sees what the record accepts. A new check on a diff that also changes the covered code fails with \`new check with a covered-code change: land the check in its own PR first\`: land the check alone, then the code change. A moved or renamed check is a changed check;
1325
+ - when the covered behaviour changed, or the diff changed the check's own \`files\`, \`formal\` also runs the check on the base (\`baseCommand\` when set). A rule the base broke counts as fixed only when HEAD reports it passing (\`passing\`); a rule the base broke that HEAD does not report at all fails the verdict. A change that leaves no violated rule passes;
1326
+ - when the covered behaviour changed, recorded findings fail the verdict unless the base run exited 0 and broke each of them with the same counterexample length (the \`states\` named group of \`violation\`, after the rule's group, in decimal digits; a \`states\` group that is the first group or captures anything else gives no length), and HEAD fixed every other rule the base broke; then the verdict reports them as the same known findings as the base, with the fixed ones. A new rule, a changed length, or a length either run did not print fails.
852
1327
 
853
- The decision never reads the check's output, so a model whose rule names stay the same still fails on a changed behaviour. It is conservative: a local rename or an extracted helper counts as changed, and code outside \`covers\` is invisible to it. \`--all\` also runs the checks that do not cover the diff, without gating.
1328
+ Whether the behaviour changed never reads the check's output, so a model whose rule names stay the same still fails on a changed behaviour unless the rule above keeps its findings known. It is conservative: a local rename or an extracted helper counts as changed, and code outside \`covers\` is invisible to it. \`--all\` also runs the checks that do not cover the diff, without gating.
854
1329
  6. **One-way doors.** The section comes right after the result line and is mandatory. \`${BIN} doors\` prints the \`One-way-door:\` line of the diff. Every file the path rules flag needs a door row or a false positive with its reason.
855
1330
  7. **Result.** FAIL if any rule fails. NOT VERIFIED when any journey of a required feature is NOT VERIFIED, for example a SaaS module run without its sandbox keys, however many other journeys passed. PASS+NOTES when everything required ran and passed but the judgement lists something no journey reached or something the owner should look at. PASS otherwise.
856
1331
 
@@ -1126,7 +1601,7 @@ const MANAGED_ARTIFACTS = [
1126
1601
  path: CI_PATH,
1127
1602
  profiles: ["full", "template"],
1128
1603
  desired: (current, context) => ({
1129
- content: ciWorkflow(current, current === void 0 ? [] : ciNodeCallers(current), current === void 0 ? [] : ciRenovateSyncCallers(current), context.docs),
1604
+ content: ciWorkflow(current, current === void 0 ? [] : ciNodeCallers(current), current === void 0 ? [] : ciRenovateSyncCallers(current), context.docs, context.placeholderTests),
1130
1605
  notes: []
1131
1606
  })
1132
1607
  },
@@ -1287,7 +1762,8 @@ function repositoryContext(root, current, profile, verificationSkill) {
1287
1762
  managesCi: current.has(".github/workflows/ci.yml") || !hasChecksWorkflow(root),
1288
1763
  verificationSkill: profile === "template" && inScaffoldExcludedPath(verificationSkill) ? void 0 : verificationSkill,
1289
1764
  glossary: ["GLOSSARY.md", "docs/GLOSSARY.md"].find((file) => existsSync(join(root, file))),
1290
- docs: profile === "full" && current.has("package.json") ? planDocs(root, manager) : void 0
1765
+ docs: profile === "full" && current.has("package.json") ? planDocs(root, manager) : void 0,
1766
+ placeholderTests: current.has("package.json") && placeholderTestScript(manifest.scripts?.test)
1291
1767
  };
1292
1768
  }
1293
1769
  function writeArtifacts(root, artifacts) {
@@ -1356,7 +1832,7 @@ function syncRepository(root, options = {}) {
1356
1832
  errors,
1357
1833
  notes,
1358
1834
  verifyNotes: options.check || errors.length ? [] : verify.notes,
1359
- advisories: entryOnly.advisories,
1835
+ advisories: [...entryOnly.advisories, ...checkTypecheckCoverage(root).map((finding) => `Note: ${finding}`)],
1360
1836
  dependenciesAdded
1361
1837
  };
1362
1838
  }