@compilr-dev/tooling 0.1.0 → 0.2.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/CHANGELOG.md +29 -0
- package/dist/cli-toolchain.d.ts +2 -0
- package/dist/cli-toolchain.js +30 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/toolchain.d.ts +91 -0
- package/dist/toolchain.js +117 -0
- package/package.json +16 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 — 2026-12-06
|
|
4
|
+
|
|
5
|
+
**`./toolchain`** — `BASELINE` and `checkToolchain({ root, accept })`, plus a
|
|
6
|
+
`compilr-check-toolchain` bin.
|
|
7
|
+
|
|
8
|
+
Four app repos were measured and **14 of the 21 dev tools they share spanned more than one MAJOR**
|
|
9
|
+
— a build tool three majors apart, a test runner three, a CSS framework whose configuration model
|
|
10
|
+
had changed in between. None of it was decided by anyone: whoever last touched a repo set its
|
|
11
|
+
versions, nothing told the other three, and only one of the four had any dependency automation. The
|
|
12
|
+
oldest came from a scaffold template that pinned them seventeen months earlier. The skew reads like
|
|
13
|
+
neglect and is not — it is the absence of a shared statement of intent.
|
|
14
|
+
|
|
15
|
+
- **`BASELINE` is data, not `peerDependencies`.** That shape would force a version (destroying the
|
|
16
|
+
independent upgrade schedules this package exists to protect), need peer ranges spanning two
|
|
17
|
+
majors, and leave a repo that cannot upgrade yet unable to install. Starting values were DERIVED
|
|
18
|
+
— newest-in-use per package across the four manifests — so no number was invented.
|
|
19
|
+
- **It reports; it never fails on being behind.** A check that goes red because of a decision
|
|
20
|
+
somebody made gets switched off along with the checks that worked.
|
|
21
|
+
- **An acceptance requires a reason AND an expiry**, both enforced at runtime. The expiry is the
|
|
22
|
+
load-bearing field: a reason alone becomes permanent in silence.
|
|
23
|
+
- **`ahead` is reported too**, pointing the fix at the baseline rather than the repo — otherwise
|
|
24
|
+
the most-recently-upgraded repo silently becomes the standard and the baseline decays into a
|
|
25
|
+
floor.
|
|
26
|
+
- **An acceptance that has expired, or that names a package no longer behind, DOES fail** the bin.
|
|
27
|
+
Those are not decisions, they are decisions nobody re-made, and a dead acceptance hides the next
|
|
28
|
+
real one.
|
|
29
|
+
|
|
30
|
+
Whoever upgrades first bumps the baseline here, so one upgrade informs four repos.
|
|
31
|
+
|
|
3
32
|
## 0.1.0 — 2026-12-06
|
|
4
33
|
|
|
5
34
|
First release. Two entry points, no runtime dependencies.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { checkToolchain } from './toolchain.js';
|
|
4
|
+
const root = process.argv[2] ?? process.cwd();
|
|
5
|
+
const manifest = JSON.parse(readFileSync(`${root.replace(/\/$/, '')}/package.json`, 'utf8'));
|
|
6
|
+
const findings = checkToolchain({ root, accept: manifest.compilrToolchain?.accept });
|
|
7
|
+
const order = ['stale-acceptance', 'unused-acceptance', 'ahead', 'behind', 'accepted'];
|
|
8
|
+
const mark = {
|
|
9
|
+
'stale-acceptance': '✗',
|
|
10
|
+
'unused-acceptance': '✗',
|
|
11
|
+
ahead: '↑',
|
|
12
|
+
behind: '·',
|
|
13
|
+
accepted: '✓',
|
|
14
|
+
};
|
|
15
|
+
for (const kind of order) {
|
|
16
|
+
for (const f of findings.filter((x) => x.kind === kind))
|
|
17
|
+
console.log(` ${mark[kind]} ${f.message}`);
|
|
18
|
+
}
|
|
19
|
+
const lapsed = findings.filter((f) => f.kind === 'stale-acceptance' || f.kind === 'unused-acceptance');
|
|
20
|
+
const behind = findings.filter((f) => f.kind === 'behind');
|
|
21
|
+
const ahead = findings.filter((f) => f.kind === 'ahead');
|
|
22
|
+
console.log(`\n${behind.length} behind · ${findings.filter((f) => f.kind === 'accepted').length} accepted · ` +
|
|
23
|
+
`${ahead.length} ahead of the baseline · ${lapsed.length} lapsed`);
|
|
24
|
+
if (ahead.length) {
|
|
25
|
+
console.log('↑ means the BASELINE is stale: bump it in @compilr-dev/tooling so the other repos learn.');
|
|
26
|
+
}
|
|
27
|
+
if (lapsed.length) {
|
|
28
|
+
console.error('\nAn acceptance has expired or no longer applies. Decide again, or delete it.');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export { RUNTIMES, runtimeBlock } from './eslint.js';
|
|
|
2
2
|
export type { RuntimeName, RuntimeFacts, RuntimeBlockOptions, GlobalsPackage } from './eslint.js';
|
|
3
3
|
export { auditGates } from './audit.js';
|
|
4
4
|
export type { AuditOptions, AuditFinding } from './audit.js';
|
|
5
|
+
export { BASELINE, checkToolchain } from './toolchain.js';
|
|
6
|
+
export type { ToolchainBaseline, ToolchainOptions, ToolchainFinding, Acceptance } from './toolchain.js';
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toolchain baseline: what version of each shared tool the apps intend to be on, and a check
|
|
3
|
+
* that reports where each repo stands against it.
|
|
4
|
+
*
|
|
5
|
+
* ⚠️ **WHY A BASELINE AT ALL.** Four app repos were measured in December 2026 and **14 of the 21
|
|
6
|
+
* dev tools they share spanned more than one MAJOR** — a build tool three majors apart, a test
|
|
7
|
+
* runner three, a CSS framework whose configuration model had changed in between. None of it was
|
|
8
|
+
* decided by anyone: whoever last touched a repo set its versions, nothing told the other three,
|
|
9
|
+
* and only ONE of the four had any dependency automation at all. The oldest versions came from a
|
|
10
|
+
* scaffold template that had pinned them seventeen months earlier.
|
|
11
|
+
*
|
|
12
|
+
* The skew reads like neglect and is not. It is the absence of a shared statement of intent.
|
|
13
|
+
*
|
|
14
|
+
* ⚠️ **AND WHY IT IS DATA RATHER THAN `peerDependencies`.** That was the obvious shape and it is
|
|
15
|
+
* wrong three ways: it would FORCE a version, which destroys the independent upgrade schedules
|
|
16
|
+
* this package exists to protect; it needs peer ranges spanning two majors; and a repo that cannot
|
|
17
|
+
* upgrade yet could not install. So this is a published *statement of intent* each repo is
|
|
18
|
+
* measured against — the same division as the runtime facts: the package states, the repo decides.
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ **It REPORTS. It must never fail a build.** A gate that goes red because of a decision
|
|
21
|
+
* somebody deliberately made gets switched off, and takes the checks that worked with it. One of
|
|
22
|
+
* these repos is a major behind on twenty-one packages by a decision already recorded; a blocking
|
|
23
|
+
* check there would be disabled on day one. "Two majors behind on the test runner, since
|
|
24
|
+
* 2025-07, owned, expires 2027-06" is a fact with a name on it, and that is the whole improvement.
|
|
25
|
+
*
|
|
26
|
+
* ## Who moves the baseline
|
|
27
|
+
*
|
|
28
|
+
* **Whoever upgrades first.** Bump the value here in the same change, and every other repo's next
|
|
29
|
+
* run says it is behind. That inverts the failure above: instead of the most-recently-touched repo
|
|
30
|
+
* silently becoming the standard, an upgrade PUBLISHES the standard. One upgrade, four informed
|
|
31
|
+
* repos.
|
|
32
|
+
*
|
|
33
|
+
* The starting values were DERIVED, not invented — newest-in-use per package across the four
|
|
34
|
+
* manifests, for every package three or more of them share. Nobody had to argue about a number.
|
|
35
|
+
* Consequence, accepted when it was chosen: every repo is immediately behind on something.
|
|
36
|
+
*/
|
|
37
|
+
/** Package name → the range the apps intend to be on. */
|
|
38
|
+
export type ToolchainBaseline = Readonly<Record<string, string>>;
|
|
39
|
+
/**
|
|
40
|
+
* Newest-in-use per package across the four app manifests, for packages shared by three or more.
|
|
41
|
+
*
|
|
42
|
+
* ⚠️ Our own `@compilr-dev/*` packages are deliberately absent: they move on their own release
|
|
43
|
+
* cadence, so a baseline would do nothing but lag them.
|
|
44
|
+
*/
|
|
45
|
+
export declare const BASELINE: ToolchainBaseline;
|
|
46
|
+
/**
|
|
47
|
+
* Why a repo is deliberately behind, and until when.
|
|
48
|
+
*
|
|
49
|
+
* ⚠️ **Both fields are required, and the expiry is the load-bearing one.** A reason alone becomes
|
|
50
|
+
* permanent in silence — which is exactly how three comments in these repos came to justify
|
|
51
|
+
* guards with claims that had stopped being true. Past `until`, the acceptance itself is reported,
|
|
52
|
+
* so the decision gets re-made rather than inherited.
|
|
53
|
+
*/
|
|
54
|
+
export interface Acceptance {
|
|
55
|
+
/** Why — in a sentence someone who did not make the decision can evaluate. */
|
|
56
|
+
reason: string;
|
|
57
|
+
/** ISO `YYYY-MM-DD`. After this date the acceptance is itself a finding. */
|
|
58
|
+
until: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ToolchainOptions {
|
|
61
|
+
root: string;
|
|
62
|
+
baseline?: ToolchainBaseline;
|
|
63
|
+
accept?: Readonly<Record<string, Acceptance>>;
|
|
64
|
+
/** For tests. Defaults to now. */
|
|
65
|
+
today?: Date;
|
|
66
|
+
}
|
|
67
|
+
export interface ToolchainFinding {
|
|
68
|
+
kind:
|
|
69
|
+
/** A major behind the baseline, and not accepted. */
|
|
70
|
+
'behind'
|
|
71
|
+
/** PAST the baseline — so the baseline is stale and wants bumping here, not in the repo. */
|
|
72
|
+
| 'ahead'
|
|
73
|
+
/** Behind, with a live acceptance. Informational: it is a decision, not a defect. */
|
|
74
|
+
| 'accepted'
|
|
75
|
+
/** Accepted, but the expiry has passed. The decision is due again. */
|
|
76
|
+
| 'stale-acceptance'
|
|
77
|
+
/** An acceptance for something that is NOT behind — dead, and it hides the next real one. */
|
|
78
|
+
| 'unused-acceptance';
|
|
79
|
+
pkg: string;
|
|
80
|
+
declared?: string;
|
|
81
|
+
baseline: string;
|
|
82
|
+
message: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Compare a repo's manifest against the baseline.
|
|
86
|
+
*
|
|
87
|
+
* Only packages the repo actually declares are compared: a repo that does not use a tool is not
|
|
88
|
+
* behind on it. Returns findings; the caller decides what to do, and the answer should not be
|
|
89
|
+
* "fail the build" (see the note at the top of this file).
|
|
90
|
+
*/
|
|
91
|
+
export declare function checkToolchain(options: ToolchainOptions): ToolchainFinding[];
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
export const BASELINE = {
|
|
3
|
+
'@electric-sql/pglite': '^0.6.1',
|
|
4
|
+
'@electric-sql/pglite-socket': '^0.3.1',
|
|
5
|
+
'@eslint/js': '^10.0.1',
|
|
6
|
+
'@radix-ui/react-dialog': '^1.1.15',
|
|
7
|
+
'@radix-ui/react-dropdown-menu': '^2.2.1',
|
|
8
|
+
'@radix-ui/react-label': '^2.1.17',
|
|
9
|
+
'@radix-ui/react-popover': '^1.3.1',
|
|
10
|
+
'@radix-ui/react-slot': '^1.2.3',
|
|
11
|
+
'@radix-ui/react-tooltip': '^1.4.1',
|
|
12
|
+
'@supabase/supabase-js': '^2.112.3',
|
|
13
|
+
'@tanstack/react-query': '^5.105.3',
|
|
14
|
+
'@testing-library/jest-dom': '^7.0.1',
|
|
15
|
+
'@testing-library/react': '^16.3.3',
|
|
16
|
+
'@testing-library/user-event': '^14.6.8',
|
|
17
|
+
'@types/node': '^26.6.11',
|
|
18
|
+
'@types/react': '^19.3.0',
|
|
19
|
+
'@types/react-dom': '^19.3.0',
|
|
20
|
+
'@vitest/coverage-v8': '^4.1.12',
|
|
21
|
+
'class-variance-authority': '^0.7.1',
|
|
22
|
+
clsx: '^2.1.1',
|
|
23
|
+
eslint: '^10.16.0',
|
|
24
|
+
'eslint-plugin-react-hooks': '^7.1.1',
|
|
25
|
+
'eslint-plugin-react-refresh': '^0.5.8',
|
|
26
|
+
globals: '^17.15.0',
|
|
27
|
+
jsdom: '^30.1.3',
|
|
28
|
+
'lucide-react': '^1.67.0',
|
|
29
|
+
react: '^19.3.1',
|
|
30
|
+
'react-dom': '^19.3.1',
|
|
31
|
+
'react-router-dom': '^7.18.5',
|
|
32
|
+
recharts: '^3.10.1',
|
|
33
|
+
sonner: '^2.0.8',
|
|
34
|
+
'tailwind-merge': '^3.7.0',
|
|
35
|
+
tailwindcss: '^4.3.3',
|
|
36
|
+
typescript: '^6.0.3',
|
|
37
|
+
'typescript-eslint': '^8.74.0',
|
|
38
|
+
vite: '^8.3.5',
|
|
39
|
+
vitest: '^5.1.0',
|
|
40
|
+
};
|
|
41
|
+
const majorOf = (range) => {
|
|
42
|
+
const m = /(\d+)/.exec(String(range).replace(/^[^0-9]*/, ''));
|
|
43
|
+
return m ? Number(m[1]) : NaN;
|
|
44
|
+
};
|
|
45
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
46
|
+
export function checkToolchain(options) {
|
|
47
|
+
const baseline = options.baseline ?? BASELINE;
|
|
48
|
+
const accept = options.accept ?? {};
|
|
49
|
+
const today = options.today ?? new Date();
|
|
50
|
+
const pkgPath = `${options.root.replace(/\/$/, '')}/package.json`;
|
|
51
|
+
const manifest = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
52
|
+
const declared = { ...manifest.dependencies, ...manifest.devDependencies };
|
|
53
|
+
for (const [pkg, a] of Object.entries(accept)) {
|
|
54
|
+
if (!a || typeof a.reason !== 'string' || !a.reason.trim()) {
|
|
55
|
+
throw new Error(`checkToolchain: the acceptance for "${pkg}" has no reason. Both fields are required.`);
|
|
56
|
+
}
|
|
57
|
+
if (!ISO_DATE.test(a.until ?? '')) {
|
|
58
|
+
throw new Error(`checkToolchain: the acceptance for "${pkg}" needs an expiry as YYYY-MM-DD, not ${JSON.stringify(a.until)}. ` +
|
|
59
|
+
'An acceptance without one becomes permanent in silence.');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const out = [];
|
|
63
|
+
for (const [pkg, want] of Object.entries(baseline)) {
|
|
64
|
+
const have = declared[pkg];
|
|
65
|
+
if (!have)
|
|
66
|
+
continue;
|
|
67
|
+
const hv = majorOf(have);
|
|
68
|
+
const wv = majorOf(want);
|
|
69
|
+
if (Number.isNaN(hv) || Number.isNaN(wv))
|
|
70
|
+
continue;
|
|
71
|
+
const a = accept[pkg];
|
|
72
|
+
if (hv > wv) {
|
|
73
|
+
out.push({
|
|
74
|
+
kind: 'ahead',
|
|
75
|
+
pkg,
|
|
76
|
+
declared: have,
|
|
77
|
+
baseline: want,
|
|
78
|
+
message: `${pkg} is at ${have}, PAST the baseline ${want} — bump the baseline in @compilr-dev/tooling ` +
|
|
79
|
+
'so the other repos learn they are behind. An upgrade nobody publishes is an upgrade nobody else gets.',
|
|
80
|
+
});
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (hv === wv) {
|
|
84
|
+
if (a) {
|
|
85
|
+
out.push({
|
|
86
|
+
kind: 'unused-acceptance',
|
|
87
|
+
pkg,
|
|
88
|
+
declared: have,
|
|
89
|
+
baseline: want,
|
|
90
|
+
message: `${pkg} is not behind, but an acceptance still names it — delete it, or it hides the next real one.`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (!a) {
|
|
96
|
+
out.push({
|
|
97
|
+
kind: 'behind',
|
|
98
|
+
pkg,
|
|
99
|
+
declared: have,
|
|
100
|
+
baseline: want,
|
|
101
|
+
message: `${pkg} is at ${have}, a major behind the baseline ${want}.`,
|
|
102
|
+
});
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const expired = a.until < today.toISOString().slice(0, 10);
|
|
106
|
+
out.push({
|
|
107
|
+
kind: expired ? 'stale-acceptance' : 'accepted',
|
|
108
|
+
pkg,
|
|
109
|
+
declared: have,
|
|
110
|
+
baseline: want,
|
|
111
|
+
message: expired
|
|
112
|
+
? `${pkg} is behind (${have} vs ${want}) and its acceptance EXPIRED on ${a.until}: "${a.reason}". Decide again.`
|
|
113
|
+
: `${pkg} is behind (${have} vs ${want}), accepted until ${a.until}: "${a.reason}".`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/tooling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared quality gates for app repos: which runtime each class of source file belongs to, and an audit that reports the files no gate covers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,10 +20,16 @@
|
|
|
20
20
|
"types": "./dist/audit.d.ts",
|
|
21
21
|
"import": "./dist/audit.js",
|
|
22
22
|
"default": "./dist/audit.js"
|
|
23
|
+
},
|
|
24
|
+
"./toolchain": {
|
|
25
|
+
"types": "./dist/toolchain.d.ts",
|
|
26
|
+
"import": "./dist/toolchain.js",
|
|
27
|
+
"default": "./dist/toolchain.js"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"bin": {
|
|
26
|
-
"compilr-audit-gates": "dist/cli.js"
|
|
31
|
+
"compilr-audit-gates": "dist/cli.js",
|
|
32
|
+
"compilr-check-toolchain": "dist/cli-toolchain.js"
|
|
27
33
|
},
|
|
28
34
|
"files": [
|
|
29
35
|
"dist",
|
|
@@ -39,17 +45,18 @@
|
|
|
39
45
|
"test:package": "node scripts/no-internal-refs.mjs",
|
|
40
46
|
"prepublishOnly": "npm run build",
|
|
41
47
|
"typecheck": "tsc --noEmit -p tsconfig.test.json",
|
|
42
|
-
"audit:self": "node dist/cli.js ."
|
|
48
|
+
"audit:self": "node dist/cli.js .",
|
|
49
|
+
"toolchain:self": "node dist/cli-toolchain.js ."
|
|
43
50
|
},
|
|
44
51
|
"devDependencies": {
|
|
45
|
-
"@eslint/js": "^
|
|
46
|
-
"@types/node": "^
|
|
47
|
-
"eslint": "^
|
|
52
|
+
"@eslint/js": "^10.0.1",
|
|
53
|
+
"@types/node": "^26.6.11",
|
|
54
|
+
"eslint": "^10.16.0",
|
|
48
55
|
"prettier": "^3.4.0",
|
|
49
|
-
"typescript": "^
|
|
56
|
+
"typescript": "^6.0.3",
|
|
50
57
|
"typescript-eslint": "^8.59.0",
|
|
51
|
-
"vitest": "^
|
|
52
|
-
"globals": "^
|
|
58
|
+
"vitest": "^5.1.0",
|
|
59
|
+
"globals": "^17.15.0"
|
|
53
60
|
},
|
|
54
61
|
"sideEffects": false,
|
|
55
62
|
"engines": {
|