Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
128c73d
fix(scripts): guard check-skill-id-lint against running on import
claude Aug 21, 2026
7694311
fix(scripts): guard check-skill-line-ratchet against running on import
claude Aug 21, 2026
e4c8795
fix(scripts): guard check-label-desc-cap against running on import
claude Aug 21, 2026
87bda0f
fix(scripts): guard ablation-dist-preflight against running on import
claude Aug 21, 2026
8374e87
fix(scripts): guard check-driver-memory-census against running on import
claude Aug 21, 2026
3ba3d35
fix(scripts): guard check-examples-live-imports against running on im…
claude Aug 21, 2026
bffe0b2
fix(scripts): guard check-nul-bytes against running on import
claude Aug 21, 2026
f3441d3
fix(scripts): guard check-ratchet-remedy-authority against running on…
claude Aug 21, 2026
6d2c931
fix(scripts): guard check-required-contexts against running on import
claude Aug 21, 2026
94b8037
fix(scripts): guard check-route-envelope against running on import
claude Aug 21, 2026
0374bb3
fix(scripts): guard check-runtime-services-index against running on i…
claude Aug 21, 2026
2d31e35
fix(scripts): guard check-shard-attestation against running on import
claude Aug 21, 2026
0c9ad54
fix(scripts): guard check-spec-parsed-alias against running on import
claude Aug 21, 2026
536fcff
fix(scripts): guard check-startup-registry-verdict against running on…
claude Aug 21, 2026
f213093
fix(scripts): guard check-workflow-status-functions against running o…
claude Aug 21, 2026
b76daf6
fix(scripts): guard check-error-code-casing against running on import
claude Aug 21, 2026
41e57b9
fix(scripts): guard check-dispatcher-error-vocabulary against running…
claude Aug 21, 2026
544f7bd
fix(scripts): guard check-engine-split-ratio against running on import
claude Aug 21, 2026
196cb3f
fix(scripts): guard check-filter-alias-parity against running on import
claude Aug 21, 2026
63f5016
fix(scripts): guard check-org-identifier against running on import
claude Aug 21, 2026
0668e66
fix(scripts): guard check-quick-reference-counts against running on i…
claude Aug 21, 2026
e6b1b6b
fix(scripts): guard check-test-completeness against running on import
claude Aug 21, 2026
2a47d7e
fix(scripts): guard measure-test-shard-timings against running on import
claude Aug 21, 2026
46f58be
fix(scripts): guard check-tenant-chokepoint against running on import
claude Aug 21, 2026
e1153da
fix(scripts): guard check-audit-scope against running on import
claude Aug 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/ablation-dist-preflight.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,6 +144,7 @@ import { join, relative, resolve, extname } from 'node:path';
import { tmpdir } from 'node:os';
import { fileURLToPath } from 'node:url';
import process from 'node:process';
import { isEntrypoint } from './invoked-as.mjs';

const REPO_ROOT = resolve(fileURLToPath(import.meta.url), '..', '..');

Expand DownExpand Up@@ -394,5 +395,10 @@ function selfTest() {
}

const argv = process.argv.slice(2);
if (argv.includes('--self-test')) selfTest();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (argv.includes('--self-test')) selfTest();
else run(argv);
6 changes: 5 additions & 1 deletion scripts/check-dispatcher-error-vocabulary.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -152,6 +152,7 @@
import { readFileSync, readdirSync, statSync, existsSync } from 'node:fs';
import { maskComments } from './js-comment-mask.mjs';
import { join, relative, dirname, resolve } from 'node:path';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = resolve(new URL('..', import.meta.url).pathname);
const SCAN_ROOT = 'packages';
Expand DownExpand Up@@ -1826,4 +1827,7 @@ function main() {
console.log(bounds);
}

main();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
if (isEntrypoint(import.meta.url)) {
main();
}
8 changes: 7 additions & 1 deletion scripts/check-driver-memory-census.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -109,6 +109,7 @@ import { fileURLToPath } from 'node:url';
import { execFileSync } from 'node:child_process';
import ts from 'typescript';
import { parseSourceFile } from './ts-parse.mjs';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
const LEDGER_PATH = join(ROOT, 'scripts', 'driver-memory-census.ledger.json');
Expand DownExpand Up@@ -683,5 +684,10 @@ function selfTest() {
}

const argv = process.argv.slice(2);
if (argv.includes('--self-test')) selfTest();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (argv.includes('--self-test')) selfTest();
else report({ list: argv.includes('--list') });
6 changes: 5 additions & 1 deletion scripts/check-engine-split-ratio.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,6 +74,7 @@ import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

import { historyHorizon } from './pm/git-history.mjs';
import { isEntrypoint } from './invoked-as.mjs';

const __dirname = dirname(fileURLToPath(import.meta.url));

Expand DownExpand Up@@ -334,4 +335,7 @@ function selfTest() {
return failures === 0 ? 0 : 1;
}

process.exit(process.argv.includes('--self-test') ? selfTest() : main(process.argv.slice(2)));
// Exports bindings, so an import for those exports alone must run nothing (#10667).
if (isEntrypoint(import.meta.url)) {
process.exit(process.argv.includes('--self-test') ? selfTest() : main(process.argv.slice(2)));
}
25 changes: 0 additions & 25 deletions scripts/check-entry-guard.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,39 +435,14 @@ export function importUnsafeStatements(source) {
* names itself, which is what stops this from rotting into an allowlist.
*/
const KNOWN_IMPORT_UNSAFE = new Set([
'scripts/ablation-dist-preflight.mjs',
'scripts/check-changeset-no-major.mjs',
'scripts/check-dispatcher-error-vocabulary.mjs',
'scripts/check-driver-memory-census.mjs',
'scripts/check-empty-changeset.mjs',
'scripts/check-engine-split-ratio.mjs',
'scripts/check-error-code-casing.mjs',
'scripts/check-error-status-conformance.mjs',
'scripts/check-examples-live-imports.mjs',
'scripts/check-filter-alias-parity.mjs',
'scripts/check-nul-bytes.mjs',
'scripts/check-org-identifier.mjs',
'scripts/check-query-options-erasure-ratchet.mjs',
'scripts/check-quick-reference-counts.mjs',
'scripts/check-ratchet-remedy-authority.mjs',
'scripts/check-release-page-status.mjs',
'scripts/check-required-contexts.mjs',
'scripts/check-route-envelope.mjs',
'scripts/check-runtime-services-index.mjs',
'scripts/check-shard-attestation.mjs',
'scripts/check-spec-parsed-alias.mjs',
'scripts/check-startup-registry-verdict.mjs',
'scripts/check-tenant-chokepoint.mjs',
'scripts/check-test-completeness.mjs',
'scripts/check-workflow-status-functions.mjs',
'scripts/checklist-select.mjs',
'scripts/docs-audit/check-audit-scope.mjs',
'scripts/measure-test-shard-timings.mjs',
'scripts/objectui-range.mjs',
'scripts/pm/check-governed-prose.mjs',
'scripts/pm/check-label-desc-cap.mjs',
'scripts/pm/check-skill-id-lint.mjs',
'scripts/pm/check-skill-line-ratchet.mjs',
'scripts/qa/qa-rollup.mjs',
'scripts/ts-parse.mjs',
]);
Expand Down
6 changes: 5 additions & 1 deletion scripts/check-error-code-casing.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@
import { readFileSync, readdirSync, statSync } from 'node:fs';
import { maskComments } from './js-comment-mask.mjs';
import { join, relative, sep } from 'node:path';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = new URL('..', import.meta.url).pathname.replace(/\/$/, '');
const SCAN_ROOTS = ['packages'];
Expand DownExpand Up@@ -241,4 +242,7 @@ If this literal is NOT an error.code — a field/param-addressed validator code
process.exit(1);
}

main();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
if (isEntrypoint(import.meta.url)) {
main();
}
8 changes: 7 additions & 1 deletion scripts/check-examples-live-imports.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,6 +122,7 @@ import { globToRegExp } from './check-cross-package-test-inputs.mjs';
import { join, resolve, relative, dirname, sep, posix } from 'node:path';
import { fileURLToPath } from 'node:url';
import process from 'node:process';
import { isEntrypoint } from './invoked-as.mjs';

const HERE = dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = resolve(HERE, '..');
Expand DownExpand Up@@ -759,7 +760,12 @@ function selfTest() {
}

const argv = process.argv.slice(2);
if (argv.includes('--self-test')) selfTest();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (argv.includes('--self-test')) selfTest();
else if (argv.includes('--list')) list();
else if (argv.includes('--json')) {
const { rows, unresolved } = collect();
Expand Down
6 changes: 5 additions & 1 deletion scripts/check-filter-alias-parity.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import ts from 'typescript';
import { parseSourceFile } from './ts-parse.mjs';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = join(fileURLToPath(new URL('.', import.meta.url)), '..');

Expand DownExpand Up@@ -648,4 +649,7 @@ function main() {
process.exit(1);
}

main();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
if (isEntrypoint(import.meta.url)) {
main();
}
8 changes: 7 additions & 1 deletion scripts/check-nul-bytes.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,6 +269,7 @@ import { lstatSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, w
import { tmpdir } from 'node:os';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { isEntrypoint } from './invoked-as.mjs';

/**
* The scanned set as a 256-entry lookup: every ASCII control character except
Expand DownExpand Up@@ -1155,7 +1156,12 @@ function selfTest() {
console.log(`✓ check-nul-bytes --self-test: ${checked} assertions over a temp git repo (real scan() path)`);
}

if (process.argv.includes('--self-test')) {
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) {
selfTest();
} else if (process.argv.includes('--list')) {
const result = scan(repoRoot());
Expand Down
6 changes: 5 additions & 1 deletion scripts/check-org-identifier.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -271,6 +271,7 @@ import { join } from 'node:path';
import ts from 'typescript';
import { parseSourceFile } from './ts-parse.mjs';
import { maskComments } from './js-comment-mask.mjs';
import { isEntrypoint } from './invoked-as.mjs';

const ROOTS = ['examples', 'apps', 'packages'];
const EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.cts', '.mts'];
Expand DownExpand Up@@ -785,4 +786,7 @@ cheapest way to silence it while leaving the dead read in place.`);
process.exit(1);
}

main();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
if (isEntrypoint(import.meta.url)) {
main();
}
6 changes: 5 additions & 1 deletion scripts/check-quick-reference-counts.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -101,6 +101,7 @@

import { readFileSync, readdirSync, existsSync } from 'node:fs';
import { join } from 'node:path';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = new URL('..', import.meta.url).pathname.replace(/\/$/, '');
const TARGET = 'content/docs/getting-started/quick-reference.mdx';
Expand DownExpand Up@@ -855,4 +856,7 @@ quietly stops recognising its page reports success forever.
process.exit(1);
}

main();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
if (isEntrypoint(import.meta.url)) {
main();
}
8 changes: 7 additions & 1 deletion scripts/check-ratchet-remedy-authority.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -107,6 +107,7 @@ import { readFileSync, readdirSync } from 'node:fs';
import { join, dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import process from 'node:process';
import { isEntrypoint } from './invoked-as.mjs';

const HERE = dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = resolve(HERE, '..');
Expand DownExpand Up@@ -982,6 +983,11 @@ function selfTest() {
process.exit(0);
}

if (process.argv.includes('--self-test')) selfTest();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) selfTest();
else if (process.argv.includes('--list')) list();
else main();
8 changes: 7 additions & 1 deletion scripts/check-required-contexts.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -181,6 +181,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync,
import { tmpdir } from 'node:os';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { isEntrypoint } from './invoked-as.mjs';

/**
* The branch-protection-required check contexts, as this repository declares
Expand DownExpand Up@@ -2266,7 +2267,12 @@ async function selfTest() {
);
}

if (process.argv.includes('--self-test')) {
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) {
await selfTest();
} else if (process.argv.includes('--verify-required-set')) {
// Report-only, off the required path (#9642). Exit 0 = swept (0 or N
Expand Down
8 changes: 7 additions & 1 deletion scripts/check-route-envelope.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,6 +144,7 @@ import { join, relative, sep } from 'node:path';
import { fileURLToPath } from 'node:url';
import ts from 'typescript';
import { parseSourceFile } from './ts-parse.mjs';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = join(fileURLToPath(new URL('.', import.meta.url)), '..');

Expand DownExpand Up@@ -2582,5 +2583,10 @@ function selfTest() {
console.log('✓ check-route-envelope self-test passed');
}

if (process.argv.includes('--self-test')) selfTest();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) selfTest();
else audit();
8 changes: 7 additions & 1 deletion scripts/check-runtime-services-index.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,6 +229,7 @@ import { readFileSync, readdirSync, statSync, existsSync, mkdtempSync, mkdirSync
import { join, dirname, relative, sep } from 'node:path';
import { tmpdir } from 'node:os';
import { fileURLToPath } from 'node:url';
import { isEntrypoint } from './invoked-as.mjs';

const HERE = dirname(fileURLToPath(import.meta.url));
const repoRoot = () => join(HERE, '..');
Expand DownExpand Up@@ -1064,5 +1065,10 @@ function selfTest() {
console.log(`✓ check-runtime-services-index --self-test: ${checked} assertions over a temp fixture (real run() path); every limb -- chapter list, kernel table, meta.json, order, href, title premise, registry slot (incl. the split-line registration), stability matrix (missing row, stale row, order) and stability LABEL on both tables, canonical-source rows (page-less row, page with no row, prose label, duplicate, missing path, and never read as a stability claim), label VOCABULARY (undefined label named with its allowed set and reported only against the page, every defined label accepted, the two legends drifting apart from EACH OTHER while every label they name is still in the enum, a legend widening it alone, legend order, section scoping past a decoy in each file, and a missing legend refused), empty tree, missing versioning.mdx, empty Source-of-Truth list -- observed FAILING and observed silent.`);
}

if (process.argv.includes('--self-test')) selfTest();
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) selfTest();
else main();
8 changes: 7 additions & 1 deletion scripts/check-shard-attestation.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,6 +122,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync,
import { tmpdir } from 'node:os';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { isEntrypoint } from './invoked-as.mjs';

/** Artifact-name prefix shared by every shard credential. */
const ARTIFACT_PREFIX = 'shard-attest-';
Expand DownExpand Up@@ -948,7 +949,12 @@ async function selfTest() {
);
}

if (process.argv.includes('--self-test')) {
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) {
await selfTest();
} else if (process.argv.includes('--emit')) {
emit();
Expand Down
8 changes: 7 additions & 1 deletion scripts/check-spec-parsed-alias.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -94,6 +94,7 @@

import { readFileSync, readdirSync, statSync } from 'node:fs';
import { join, relative } from 'node:path';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = new URL('..', import.meta.url).pathname.replace(/\/$/, '');
const SPEC_SRC = join(ROOT, 'packages/spec/src');
Expand DownExpand Up@@ -461,7 +462,12 @@ export type Iso0 = Assert<Eq< z.input< typeof M0.ColourSchema >, z.infer< typeof
console.log('check-spec-parsed-alias --self-test: 18 assertions passed');
}

if (process.argv.includes('--self-test')) {
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) {
selfTest();
} else {
const pins = readIsomorphicPins(readFileSync(PIN_FILE, 'utf8'));
Expand Down
8 changes: 7 additions & 1 deletion scripts/check-startup-registry-verdict.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -150,6 +150,7 @@ import { join, relative, sep, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import ts from 'typescript';
import { parseSourceFile } from './ts-parse.mjs';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = fileURLToPath(new URL('..', import.meta.url));
const BASELINE_PATH = join(ROOT, 'scripts', 'startup-registry-verdict.baseline.json');
Expand DownExpand Up@@ -1436,7 +1437,12 @@ function selfTest() {
}

const args = process.argv.slice(2);
if (args.includes('--self-test')) {
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (args.includes('--self-test')) {
process.exit(selfTest());
} else {
const dirFlag = args.indexOf('--packages-dir');
Expand Down
10 changes: 8 additions & 2 deletions scripts/check-tenant-chokepoint.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,6 +112,7 @@ import { join, relative } from 'node:path';
import { fileURLToPath } from 'node:url';
import ts from 'typescript';
import { parseSourceFile } from './ts-parse.mjs';
import { isEntrypoint } from './invoked-as.mjs';

const ROOT = join(fileURLToPath(new URL('.', import.meta.url)), '..');

Expand DownExpand Up@@ -554,9 +555,14 @@ above catches it" is not one: this asserts the chokepoint's own contract.`);
);
}

if (process.argv.includes('--self-test')) {
// Exports bindings, so an import for those exports alone must run nothing (#10667).
const invokedDirectly = isEntrypoint(import.meta.url);

if (!invokedDirectly) {
// imported as a module — expose the exports and do nothing else
} else if (process.argv.includes('--self-test')) {
selfTest();
process.exit(0);
}

main();
if (invokedDirectly) main();
Loading
Loading