@antelopejs/tooling-configs 0.5.8 → 0.7.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/README.md +39 -49
- package/dist/{api-CCOiLN3w.mjs → api-BQLrI_S1.mjs} +19 -2
- package/dist/bin/api-diff.mjs +155 -37
- package/dist/bin/body-check.mjs +6 -3
- package/dist/bin/check-size.mjs +1 -1
- package/dist/bin/checks.mjs +1 -1
- package/dist/bin/comment-proof.mjs +3 -5
- package/dist/bin/garden.mjs +86 -34
- package/dist/bin/lease.mjs +314 -26
- package/dist/bin/ratchet.mjs +4 -4
- package/dist/bin/readme-strip.mjs +1 -1
- package/dist/bin/suppressions.mjs +10 -6
- package/dist/bin/sync.mjs +23 -98
- package/dist/bin/triage.mjs +1 -1
- package/dist/bin/verify.mjs +1 -1
- package/dist/{checks-BC-F8bsv.mjs → checks-BefrkjiT.mjs} +729 -25
- package/dist/{docs-compat-Ft1r2sf0.mjs → docs-compat-CSljVi3O.mjs} +13 -8
- package/dist/eslint.d.mts +13 -4
- package/dist/eslint.mjs +48 -6
- package/dist/guardrails-BfGwehVj.mjs +2414 -0
- package/dist/installed-typescript-6MtIWlE4.mjs +84 -0
- package/dist/oxc/anti-slop/index.mjs +541 -34
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +2 -1854
- package/dist/oxc/lint.d.mts +10 -1
- package/dist/oxc/lint.mjs +13 -5
- package/dist/{oxlint-CCOJqj3d.mjs → oxlint-CkHhK5K_.mjs} +33 -11
- package/dist/{package-DnxZ2CXZ.mjs → package-DDG3YH7W.mjs} +10 -5
- package/dist/{ports-DGP6bPJy.mjs → ports-DAeEJsYh.mjs} +22 -0
- package/dist/{proof-stamp-lyD84zmj.mjs → proof-stamp-BFV7JTZT.mjs} +5 -4
- package/dist/{ratchet-SQ7vTR0i.mjs → ratchet-2FeMs1kh.mjs} +4 -3
- package/dist/{suppression-base-whhvw-IJ.mjs → suppression-base-CYaLZAq7.mjs} +2 -2
- package/dist/{suppression-budget-CtIYSoDO.mjs → suppression-budget-CPDSFg4X.mjs} +1 -1
- package/dist/{suppressions-C79kRvYI.mjs → suppressions-CxPnh4sC.mjs} +2 -2
- package/dist/{templates-Dg188oRC.mjs → templates-HG0fel2S.mjs} +1 -1
- package/dist/{type-aware-rules-DMuN6sHb.mjs → type-aware-rules-Da3769fI.mjs} +9 -1
- package/dist/{typescript--_8og8AM.mjs → typescript-CxfNxyr2.mjs} +59 -98
- package/dist/{workflow-CPcNc8KL.mjs → workflow-C-oBwL2H.mjs} +25 -1
- package/package.json +9 -5
- package/dist/bin/check-interface-ranges.d.mts +0 -1
- package/dist/bin/check-interface-ranges.mjs +0 -44
- package/dist/interface-ranges-CcVSr59f.mjs +0 -116
package/dist/bin/sync.mjs
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as formatCeilings, l as readCeilings, s as isRetired, t as CEILINGS_FILE } from "../ceilings-B7KayYIG.mjs";
|
|
3
|
-
import { a as managedPackage, c as repositoryTools, f as toolingVersions, l as serializeManifest, m as usesNuxt, n as bootstrapDependencies, o as packageManager, p as usesCaptures, r as bootstrappedManifest, s as parseManifest, t as addedDevDependencies, u as templatePackage } from "../package-
|
|
3
|
+
import { a as managedPackage, c as repositoryTools, f as toolingVersions, l as serializeManifest, m as usesNuxt, n as bootstrapDependencies, o as packageManager, p as usesCaptures, r as bootstrappedManifest, s as parseManifest, t as addedDevDependencies, u as templatePackage } from "../package-DDG3YH7W.mjs";
|
|
4
4
|
import { t as admits } from "../semver-BDxeEcP_.mjs";
|
|
5
|
-
import { i as presetConfig, n as SETUP_SCRIPT, r as lefthook, t as PRESET_CONFIGS } from "../templates-
|
|
5
|
+
import { i as presetConfig, n as SETUP_SCRIPT, r as lefthook, t as PRESET_CONFIGS } from "../templates-HG0fel2S.mjs";
|
|
6
6
|
import { a as VERIFY_KINDS, c as isVerifyKind, d as linkPointsAt, i as SYNCED_SKILL_FILES, l as skillFolder, o as claudeLink, s as claudeLinkTarget, u as planDocsSkills } from "../shared-BCFFyp3l.mjs";
|
|
7
|
-
import { r as localVersions, t as checkInterfaceRanges } from "../interface-ranges-CcVSr59f.mjs";
|
|
8
7
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import { a as gitFiles, c as repositoryRoot
|
|
11
|
-
import { n as workspaceDirectories, r as workspacePatterns, t as planDocs } from "../docs-compat-
|
|
8
|
+
import { _ as placeholderTestScript, f as CI_CONTEXT, g as ciWorkflow, i as hasChecksWorkflow, l as GITATTRIBUTES_ARTIFACT, m as CI_PATH, n as ciNodeCallers, r as ciRenovateSyncCallers, s as renovateArtifacts, t as MISSING_CHECKS_WORKFLOW } from "../workflow-C-oBwL2H.mjs";
|
|
9
|
+
import { a as gitFiles, c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
10
|
+
import { n as workspaceDirectories, r as workspacePatterns, t as planDocs } from "../docs-compat-CSljVi3O.mjs";
|
|
12
11
|
import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
|
|
13
|
-
import { i as
|
|
14
|
-
import {
|
|
15
|
-
import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-
|
|
16
|
-
import { u as typescript } from "../suppressions-
|
|
12
|
+
import { a as stepsOf, i as matchingScripts, n as droppedChecksSteps, o as moveDependencyRanges, s as runPnpm } from "../checks-BefrkjiT.mjs";
|
|
13
|
+
import { i as recordedRelease, t as measureBaseline } from "../ratchet-2FeMs1kh.mjs";
|
|
14
|
+
import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-CPDSFg4X.mjs";
|
|
15
|
+
import { u as typescript } from "../suppressions-CxPnh4sC.mjs";
|
|
17
16
|
import { t as DEFAULT_SHARED } from "../map-BYkmnvNw.mjs";
|
|
18
17
|
import { createRequire } from "node:module";
|
|
19
18
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, rmdirSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
20
19
|
import { basename, dirname, join, posix, resolve } from "node:path";
|
|
21
20
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
22
21
|
import { isAlias, isMap, isNode, isScalar, isSeq, parseDocument, stringify } from "yaml";
|
|
23
|
-
import ts from "typescript";
|
|
22
|
+
import ts from "@typescript/typescript6";
|
|
24
23
|
import { parseArgs } from "node:util";
|
|
25
24
|
//#region src/guardrails/docs-typescript.ts
|
|
26
25
|
const MARKDOWN = /\.(?:md|mdc)$/i;
|
|
@@ -90,21 +89,6 @@ function untypedDocsFiles(root) {
|
|
|
90
89
|
return [...found];
|
|
91
90
|
}
|
|
92
91
|
//#endregion
|
|
93
|
-
//#region src/guardrails/run-pnpm.ts
|
|
94
|
-
/** Runs pnpm, the only manager the pack's CI installs with, with `args` quietly; returns its output only when it failed. */
|
|
95
|
-
function runPnpm(root, args) {
|
|
96
|
-
const command = ["pnpm", ...args].join(" ");
|
|
97
|
-
const pnpm = shimInvocation("pnpm", args);
|
|
98
|
-
const result = spawnSync(pnpm.command, pnpm.args, {
|
|
99
|
-
cwd: root,
|
|
100
|
-
encoding: "utf8",
|
|
101
|
-
shell: pnpm.shell
|
|
102
|
-
});
|
|
103
|
-
if (result.error) return `${command} failed: ${result.error.message}`;
|
|
104
|
-
if (result.status === 0) return void 0;
|
|
105
|
-
return `${command} failed (exit ${result.status}).\n${result.stdout}${result.stderr}`.trimEnd();
|
|
106
|
-
}
|
|
107
|
-
//#endregion
|
|
108
92
|
//#region src/guardrails/agents-block.ts
|
|
109
93
|
const AGENTS_BLOCK_START = "<!-- antelopejs-guardrails:start -->";
|
|
110
94
|
const AGENTS_BLOCK_END = "<!-- antelopejs-guardrails:end -->";
|
|
@@ -158,8 +142,9 @@ const SHARED_RULES = [
|
|
|
158
142
|
["A type guard checks each member it narrows to; keys with `Object.hasOwn`", "`antelopejs/no-presence-only-type-guard`"],
|
|
159
143
|
["A type guard checks the nested elements and values it claims", "review; no tool"],
|
|
160
144
|
["A startup read does not decide an insert another replica can race", "`antelopejs/no-read-then-insert`"],
|
|
145
|
+
["An awaited function or a promise resolves to no unrun database query", "`antelopejs/no-unrun-query`"],
|
|
161
146
|
["`Object.assign` writes no `unknown`, `any` or mistyped value over a field", "`antelopejs/no-unsafe-object-assign`"],
|
|
162
|
-
["Every file type-aware lint reads is listed by a tsconfig", "`antelopejs/require-tsconfig-include`"],
|
|
147
|
+
["Every file type-aware lint reads is listed by a tsconfig that resolves its imports", "`antelopejs/require-tsconfig-include`"],
|
|
163
148
|
["Params ≤ 5, function ≤ 120 lines, file ≤ 500 lines, depth ≤ 4, complexity ≤ 20", "`eslint/max-*`, `eslint/complexity`"],
|
|
164
149
|
["Cleanup preserves declarations, runtime exports and DMS auto-imports", "`antelopejs-api-diff <base-ref>`"],
|
|
165
150
|
["Comment-only changes preserve JavaScript emit", "`antelopejs-comment-proof <base-ref>`"],
|
|
@@ -483,6 +468,11 @@ function backendSourceFile(id: string): string | undefined {
|
|
|
483
468
|
: undefined
|
|
484
469
|
}
|
|
485
470
|
|
|
471
|
+
/** \`path\` with \`/\` separators, the form Vite gives an importer, so a boundary error names both paths alike on every OS. */
|
|
472
|
+
function forwardSlashes(path: string): string {
|
|
473
|
+
return path.split(sep).join('/')
|
|
474
|
+
}
|
|
475
|
+
|
|
486
476
|
/**
|
|
487
477
|
* Fails the build and the dev server when a module of the frontend resolves to
|
|
488
478
|
* a file under the \`src\` of the backend package: the browser reaches the
|
|
@@ -522,9 +512,9 @@ function boundaryCheck(): VitePlugin {
|
|
|
522
512
|
const from =
|
|
523
513
|
importer === undefined
|
|
524
514
|
? 'an entry point'
|
|
525
|
-
: importer.replace(QUERY_OR_HASH, '')
|
|
515
|
+
: forwardSlashes(importer.replace(QUERY_OR_HASH, ''))
|
|
526
516
|
return this.error(
|
|
527
|
-
\`Backend boundary: \${from} imports \${file}, which is under the src of \${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.\`,
|
|
517
|
+
\`Backend boundary: \${from} imports \${forwardSlashes(file)}, which is under the src of \${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.\`,
|
|
528
518
|
)
|
|
529
519
|
},
|
|
530
520
|
}
|
|
@@ -1416,6 +1406,7 @@ const MANAGED_ARTIFACTS = [
|
|
|
1416
1406
|
};
|
|
1417
1407
|
}
|
|
1418
1408
|
},
|
|
1409
|
+
GITATTRIBUTES_ARTIFACT,
|
|
1419
1410
|
{
|
|
1420
1411
|
path: ".nvmrc",
|
|
1421
1412
|
profiles: ["full"],
|
|
@@ -2046,12 +2037,13 @@ function formatRepository(root) {
|
|
|
2046
2037
|
failure: `oxfmt failed (exit ${result.status}).\n${result.stdout}${result.stderr}`.trimEnd()
|
|
2047
2038
|
};
|
|
2048
2039
|
}
|
|
2049
|
-
/** The tsconfig `--init` writes for a Node repository with none, so the synced `typecheck` checks its JavaScript and TypeScript under Node's module rules. */
|
|
2040
|
+
/** The tsconfig `--init` writes for a Node repository with none, so the synced `typecheck` checks its JavaScript and TypeScript under Node's module rules; `strict` is off, which TypeScript 6 and later no longer default to, so untyped JavaScript passes. */
|
|
2050
2041
|
const NODE_TSCONFIG = `{
|
|
2051
2042
|
"compilerOptions": {
|
|
2052
2043
|
"target": "ES2024",
|
|
2053
2044
|
"module": "NodeNext",
|
|
2054
2045
|
"moduleResolution": "NodeNext",
|
|
2046
|
+
"strict": false,
|
|
2055
2047
|
"allowJs": true,
|
|
2056
2048
|
"checkJs": true,
|
|
2057
2049
|
"noEmit": true,
|
|
@@ -2211,73 +2203,6 @@ function initRepository(root, options = {}) {
|
|
|
2211
2203
|
};
|
|
2212
2204
|
}
|
|
2213
2205
|
//#endregion
|
|
2214
|
-
//#region src/guardrails/interface-ranges-sync.ts
|
|
2215
|
-
/** Each tracked manifest that parses; a fixture that is not JSON is not a package this repository releases. */
|
|
2216
|
-
function tracked(root) {
|
|
2217
|
-
return trackedManifests(root).flatMap((path) => {
|
|
2218
|
-
try {
|
|
2219
|
-
const text = readFileSync(join(root, path), "utf8");
|
|
2220
|
-
return [{
|
|
2221
|
-
path,
|
|
2222
|
-
text,
|
|
2223
|
-
manifest: parseManifest(text)
|
|
2224
|
-
}];
|
|
2225
|
-
} catch {
|
|
2226
|
-
return [];
|
|
2227
|
-
}
|
|
2228
|
-
});
|
|
2229
|
-
}
|
|
2230
|
-
function movedNote(path, violation) {
|
|
2231
|
-
return `${path}: moved ${violation.field}["${violation.name}"] from "${violation.spec}" to "${violation.expected}", the range of the interface version this repository holds.`;
|
|
2232
|
-
}
|
|
2233
|
-
/** The relock failure, after which the moved manifests are back as they were so the next sync moves them again. */
|
|
2234
|
-
function writeAndRelock(root, manifests, moved) {
|
|
2235
|
-
const rootManifest = manifests.find(({ path }) => path === "package.json");
|
|
2236
|
-
const manager = packageManager(rootManifest?.manifest ?? {});
|
|
2237
|
-
if (manager !== "pnpm") return `${manager} is not pnpm, so sync cannot relock them.`;
|
|
2238
|
-
for (const [path, { after }] of moved) writeFileSync(join(root, path), after);
|
|
2239
|
-
const failure = runPnpm(root, ["install", "--lockfile-only"]);
|
|
2240
|
-
if (failure !== void 0) for (const [path, { before }] of moved) writeFileSync(join(root, path), before);
|
|
2241
|
-
return failure;
|
|
2242
|
-
}
|
|
2243
|
-
/**
|
|
2244
|
-
* Moves each tracked manifest's range for an interface it implements from
|
|
2245
|
-
* this repository to the range `antelopejs-check-interface-ranges` expects,
|
|
2246
|
-
* then relocks, or leaves every manifest as it was when the relock fails. A
|
|
2247
|
-
* minor release of that interface otherwise leaves its module's range below
|
|
2248
|
-
* the new version and fails the check on the release commit. It runs before
|
|
2249
|
-
* the rest of sync, which then plans the docs-compat READMEs from the moved
|
|
2250
|
-
* ranges and the new lockfile. `check` reports the moves without writing.
|
|
2251
|
-
*/
|
|
2252
|
-
function moveInterfaceRanges(root, check) {
|
|
2253
|
-
const manifests = tracked(root);
|
|
2254
|
-
const versions = localVersions(manifests.map(({ manifest }) => manifest));
|
|
2255
|
-
const moves = {
|
|
2256
|
-
paths: [],
|
|
2257
|
-
notes: [],
|
|
2258
|
-
errors: []
|
|
2259
|
-
};
|
|
2260
|
-
const moved = /* @__PURE__ */ new Map();
|
|
2261
|
-
for (const { path, text, manifest } of manifests) {
|
|
2262
|
-
const fixes = checkInterfaceRanges(manifest, versions).filter((violation) => violation.role === "implementer" && violation.expected !== void 0 && versions.has(violation.name));
|
|
2263
|
-
if (!fixes.length) continue;
|
|
2264
|
-
for (const { field, name, expected } of fixes) {
|
|
2265
|
-
const dependencies = manifest[field];
|
|
2266
|
-
if (dependencies && expected) dependencies[name] = expected;
|
|
2267
|
-
}
|
|
2268
|
-
moved.set(path, {
|
|
2269
|
-
before: text,
|
|
2270
|
-
after: serializeManifest(manifest, text)
|
|
2271
|
-
});
|
|
2272
|
-
moves.paths.push(path);
|
|
2273
|
-
moves.notes.push(...fixes.map((fix) => movedNote(path, fix)));
|
|
2274
|
-
}
|
|
2275
|
-
if (check || !moved.size) return moves;
|
|
2276
|
-
const failure = writeAndRelock(root, manifests, moved);
|
|
2277
|
-
if (failure !== void 0) moves.errors.push(`Left the interface ranges in ${moves.paths.join(", ")} unmoved: the lockfile could not follow them. ${failure}`);
|
|
2278
|
-
return moves;
|
|
2279
|
-
}
|
|
2280
|
-
//#endregion
|
|
2281
2206
|
//#region src/bin/sync.ts
|
|
2282
2207
|
/** The sync result with the interface range moves that ran before it, or the moves alone when relocking them failed. */
|
|
2283
2208
|
function withRangeMoves(ranges, result) {
|
|
@@ -2343,7 +2268,7 @@ runCli(() => {
|
|
|
2343
2268
|
if (values.init) return init(values.verify);
|
|
2344
2269
|
const root = repositoryRoot();
|
|
2345
2270
|
const check = Boolean(values.check);
|
|
2346
|
-
const ranges =
|
|
2271
|
+
const ranges = moveDependencyRanges(root, check);
|
|
2347
2272
|
return printSync(withRangeMoves(ranges, ranges.errors.length ? void 0 : syncRepository(root, {
|
|
2348
2273
|
check,
|
|
2349
2274
|
profile: values.profile,
|
package/dist/bin/triage.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { c as object, h as time, n as children, p as str, r as flag, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
|
|
3
3
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
4
|
-
import { i as ghToken, r as createGraphql } from "../api-
|
|
4
|
+
import { i as ghToken, r as createGraphql } from "../api-BQLrI_S1.mjs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/triage/triage.ts
|
|
7
7
|
/** Open, unassigned issues labelled `needs-triage` in the organization's public, non-archived repositories. */
|
package/dist/bin/verify.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSy
|
|
|
11
11
|
import { basename, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
12
12
|
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
13
13
|
import { pathToFileURL } from "node:url";
|
|
14
|
-
import ts from "typescript";
|
|
14
|
+
import ts from "@typescript/typescript6";
|
|
15
15
|
import { createHash, randomBytes } from "node:crypto";
|
|
16
16
|
import { availableParallelism, constants as constants$1 } from "node:os";
|
|
17
17
|
import { parseArgs, stripVTControlCharacters } from "node:util";
|