@ultimat3/cli 31.27.0 → 31.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +4 -1
- package/README.md +14 -4
- package/package.json +29 -29
- package/src/app-manifest.ts +6 -1
- package/src/app-migrations-verdict.ts +84 -0
- package/src/cmd-doctor.ts +11 -3
- package/src/cmd-drill.ts +23 -9
- package/src/cmd-repro-spec.ts +13 -1
- package/src/cmd-repro.ts +37 -5
- package/src/cmd-upgrade-codemods.ts +71 -0
- package/src/cmd-upgrade-spec.ts +19 -5
- package/src/cmd-upgrade.ts +91 -34
- package/src/codemods/agents-dev-mcp.ts +50 -0
- package/src/codemods/authenticator-session-refusal.ts +214 -0
- package/src/codemods/biome-no-default-export.ts +58 -0
- package/src/codemods/bunfig-island-coverage.ts +33 -0
- package/src/codemods/chart-dashboard.ts +73 -0
- package/src/codemods/ci-e2e-browser-stock.ts +75 -0
- package/src/codemods/ci-e2e-browser.ts +63 -0
- package/src/codemods/codemod.ts +58 -0
- package/src/codemods/define-error-leaf.ts +73 -0
- package/src/codemods/docs-ci-parts.ts +65 -0
- package/src/codemods/docs-gate-prose.ts +53 -0
- package/src/codemods/docs-island-rows.ts +31 -0
- package/src/codemods/docs-shipped-guards.ts +100 -0
- package/src/codemods/docs-test-services.ts +62 -0
- package/src/codemods/engine-diff.ts +104 -0
- package/src/codemods/engine-edits.ts +111 -0
- package/src/codemods/engine-fs.ts +95 -0
- package/src/codemods/engine.ts +191 -0
- package/src/codemods/format-edited-hook-3122.ts +28 -0
- package/src/codemods/format-edited-hook.ts +152 -0
- package/src/codemods/helm-alerts-deploy.ts +85 -0
- package/src/codemods/helm-alerts-objective.ts +105 -0
- package/src/codemods/helm-alerts-stock.ts +108 -0
- package/src/codemods/index.ts +60 -0
- package/src/codemods/metrics-probe-healthz.ts +47 -0
- package/src/codemods/migrate-job-ordered.ts +81 -0
- package/src/codemods/migrate-job-stock.ts +41 -0
- package/src/codemods/pending.ts +36 -0
- package/src/codemods/repro-gitignore.ts +40 -0
- package/src/codemods/runtime-pin-lines.ts +109 -0
- package/src/codemods/runtime-pin.ts +116 -0
- package/src/codemods/solid-floor.ts +63 -0
- package/src/codemods/test-ports.ts +86 -0
- package/src/codemods/test-suites.ts +37 -0
- package/src/codemods/theme-toggle-mount-over.ts +70 -0
- package/src/codemods/vendored-guards.ts +186 -0
- package/src/codemods/verify-floor-skips.ts +88 -0
- package/src/codemods/verify-floor-steps.ts +90 -0
- package/src/doctor-advisory-floors.ts +113 -0
- package/src/doctor-guards.ts +39 -86
- package/src/doctor-superseded.ts +67 -0
- package/src/drill-schema-behind.ts +26 -0
- package/src/error-codes-doctor.ts +12 -4
- package/src/error-codes.ts +9 -0
- package/src/exercise-database.ts +7 -2
- package/src/framework-schema-apply.ts +7 -19
- package/src/framework-schema-stamp.ts +38 -3
- package/src/framework-schema-verify.ts +120 -0
- package/src/framework-schema-wait.ts +125 -0
- package/src/generate-files.ts +6 -5
- package/src/guards-built-in-codes.ts +36 -0
- package/src/guards-built-in-refusal.ts +25 -0
- package/src/guards-built-in.ts +134 -0
- package/src/guards-materialize.ts +42 -0
- package/src/guards-paths.ts +37 -0
- package/src/guards-shipped-names.ts +38 -0
- package/src/guards-vendored.ts +73 -0
- package/src/guards.ts +90 -34
- package/src/index.ts +10 -0
- package/src/lint-findings.ts +3 -3
- package/src/mcp-errors.ts +12 -1
- package/src/measure-scope.ts +23 -3
- package/src/messages-repro.ts +16 -2
- package/src/messages-upgrade.ts +15 -0
- package/src/messages.ts +1 -1
- package/src/repro-archive-collect.ts +161 -0
- package/src/repro-archive-write.ts +96 -0
- package/src/repro-archive.ts +161 -0
- package/src/repro-bundle.ts +8 -16
- package/src/repro-errors.ts +14 -2
- package/src/repro-framework.ts +53 -0
- package/src/repro-parse.ts +87 -0
- package/src/repro-redact.ts +218 -0
- package/src/repro-scrub.ts +257 -0
- package/src/role-pg-stats.ts +21 -0
- package/src/role-start.ts +4 -0
- package/src/runtime-queue.ts +27 -6
- package/src/serve-boot-probe.ts +97 -0
- package/src/serve-boot.ts +26 -1
- package/src/serve-retire.ts +16 -3
- package/src/superseded-match.ts +87 -0
- package/src/superseded.ts +84 -0
- package/src/templates/bun-image.ts +48 -0
- package/src/templates/chart-dashboard-panels.ts +178 -0
- package/src/templates/chart-dashboard.ts +9 -135
- package/src/templates/github/ci.yml.ts +1 -1
- package/src/templates/guard-released-forms.ts +112 -0
- package/src/templates/guard-runtime-pin-test.ts +54 -0
- package/src/templates/guard-runtime-pin.ts +189 -0
- package/src/templates/scaffold-claude-agents.ts +6 -6
- package/src/templates/scaffold-claude-commands.ts +1 -1
- package/src/templates/scaffold-claude-hook.ts +18 -8
- package/src/templates/scaffold-claude.ts +2 -2
- package/src/templates/scaffold-container.ts +2 -2
- package/src/templates/scaffold-docs.ts +26 -24
- package/src/templates/scaffold-guards.ts +73 -39
- package/src/templates/scaffold-helm-alert-deploy.ts +105 -0
- package/src/templates/scaffold-helm-alert-rules.ts +7 -1
- package/src/templates/scaffold-helm-alerts.ts +3 -0
- package/src/templates/scaffold-helm-migrate.ts +85 -0
- package/src/templates/scaffold-helm-templates.ts +2 -36
- package/src/templates/scaffold-helm.ts +1 -0
- package/src/templates/scaffold-repo.ts +2 -1
- package/src/unthrown-codes.ts +2 -0
- package/src/upgrade-bun-floor.ts +4 -0
- package/src/upgrade-clean-tree.ts +54 -0
- package/src/upgrade-gate-codemods-install.ts +40 -0
- package/src/upgrade-gate-codemods.ts +151 -0
- package/src/upgrade-gate.ts +38 -6
- package/src/upgrade-lock.ts +118 -0
- package/src/upgrade-plan.ts +2 -1
- package/src/upgrade-report-codemods.ts +54 -0
- package/src/upgrade-report.ts +52 -27
- package/src/upgrade-signals.ts +91 -0
- package/src/upgrade-unfinished.ts +61 -0
- package/wiki/CLI-Reference.md +70 -5
- package/wiki/Deployment.md +2 -1
- package/wiki/Interface-Rules.md +17 -8
- package/wiki/Known-Gaps.md +1 -1
- package/wiki/Observability.md +1 -0
- package/wiki/Project-Layout.md +4 -4
- package/wiki/Upgrading.md +6 -0
|
@@ -23,7 +23,7 @@ const CI_WORKFLOW_NAME = 'ci';
|
|
|
23
23
|
* instead: GitHub owns the runner and the tag together. Same rule the framework's own
|
|
24
24
|
* `.github/actions/setup/action.yml` states, and the same SHA.
|
|
25
25
|
*/
|
|
26
|
-
const SETUP_BUN = 'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0';
|
|
26
|
+
export const SETUP_BUN = 'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0';
|
|
27
27
|
|
|
28
28
|
/** The plan job's one command: the app's `verify` script, so the CLI it asks is the one installed. */
|
|
29
29
|
export const PLAN_COMMAND = `bun run verify plan --parts ${String(DEFAULT_PLAN_PARTS)} --json`;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// GENERATED by `bun run scripts/lib/guard-refresh-forms.ts --write` — never hand-edited. Every
|
|
2
|
+
// rule-file text each shipped guard was released as (`guardFormHash`), with how it reported, so the
|
|
3
|
+
// `vendored-guards` codemod deletes a stale but unedited copy instead of keeping it as an edit.
|
|
4
|
+
|
|
5
|
+
export const RELEASED_GUARD_FORMS: Readonly<
|
|
6
|
+
Record<string, readonly (readonly [string, 'error' | 'warning'])[]>
|
|
7
|
+
> = {
|
|
8
|
+
'animated-layout-property': [['2hqr04589t23q', 'error']],
|
|
9
|
+
'bare-error': [
|
|
10
|
+
['1m3eimglwzrdq', 'error'],
|
|
11
|
+
['1njzso3r6drnd', 'error'],
|
|
12
|
+
],
|
|
13
|
+
'error-declared': [
|
|
14
|
+
['1rlzex7nalpiw', 'error'],
|
|
15
|
+
['2tfw2hq80msju', 'error'],
|
|
16
|
+
['3kqd7d8pzpcnn', 'error'],
|
|
17
|
+
],
|
|
18
|
+
'focus-visible': [['4c2nf0mpzn0z', 'error']],
|
|
19
|
+
'image-dimensions': [
|
|
20
|
+
['1cfzth883qzt5', 'error'],
|
|
21
|
+
['33uv2ua4a9zcf', 'error'],
|
|
22
|
+
],
|
|
23
|
+
'island-mount-clears': [['1v09h5ptzqvs2', 'error']],
|
|
24
|
+
'island-without-states': [['2os1f5fb6aass', 'error']],
|
|
25
|
+
'native-confirm': [
|
|
26
|
+
['1f7eh34hj085a', 'error'],
|
|
27
|
+
['2b134wpkoaqso', 'error'],
|
|
28
|
+
['2eb7ld3hg0tpb', 'error'],
|
|
29
|
+
],
|
|
30
|
+
'raw-breakpoint': [['wdo3lsqmvsya', 'error']],
|
|
31
|
+
'raw-colour': [['3onnbx54g9zmd', 'error']],
|
|
32
|
+
'raw-fetch': [
|
|
33
|
+
['17xdeprvzx5v2', 'error'],
|
|
34
|
+
['1hgdwthi7j353', 'error'],
|
|
35
|
+
['mazudnz7t6iy', 'error'],
|
|
36
|
+
],
|
|
37
|
+
'raw-interval': [
|
|
38
|
+
['1o6p0fmjhzdhw', 'error'],
|
|
39
|
+
['2xrqszz066coc', 'error'],
|
|
40
|
+
['3qipy7ijjnz7r', 'error'],
|
|
41
|
+
['ll7h7zpr075u', 'error'],
|
|
42
|
+
],
|
|
43
|
+
'raw-length': [['2vfl0ssvkqvua', 'error']],
|
|
44
|
+
'raw-motion': [
|
|
45
|
+
['14c1bs20ysc1u', 'error'],
|
|
46
|
+
['w8aw0q20tfsz', 'error'],
|
|
47
|
+
],
|
|
48
|
+
'raw-shadow': [['1vhy6xulc5cs5', 'error']],
|
|
49
|
+
'raw-z-index': [['2nnuj62o3qvvr', 'error']],
|
|
50
|
+
'repo-await-in-loop': [['3a3v6vvmbf8q2', 'warning']],
|
|
51
|
+
'repo-raw-sql': [
|
|
52
|
+
['12qj02j416sib', 'error'],
|
|
53
|
+
['2kr7gbv7j2m0v', 'error'],
|
|
54
|
+
['3nmlelym16o78', 'error'],
|
|
55
|
+
],
|
|
56
|
+
'repo-unbounded': [
|
|
57
|
+
['2yjuyaj4n8dqq', 'error'],
|
|
58
|
+
['ae4czielms3c', 'warning'],
|
|
59
|
+
],
|
|
60
|
+
'runtime-pin': [['28ffbpwy4q2ji', 'error']],
|
|
61
|
+
'semantic-interactive': [
|
|
62
|
+
['29pfa4ea628cv', 'error'],
|
|
63
|
+
['d4ncwu39wtrk', 'error'],
|
|
64
|
+
],
|
|
65
|
+
'unbounded-fanout': [['xk4dv9vsq8gg', 'error']],
|
|
66
|
+
'undeclared-custom-property': [
|
|
67
|
+
['2xnl4zuy9xv6f', 'error'],
|
|
68
|
+
['3b0u9i8hze00x', 'error'],
|
|
69
|
+
],
|
|
70
|
+
'undefined-style-class': [
|
|
71
|
+
['3food9t4vrzv8', 'error'],
|
|
72
|
+
['w7as1ib1ido8', 'error'],
|
|
73
|
+
],
|
|
74
|
+
'untranslated-string': [
|
|
75
|
+
['2x85ib5eqdxzi', 'error'],
|
|
76
|
+
['h57qtdwn7inz', 'error'],
|
|
77
|
+
],
|
|
78
|
+
'unzoned-date': [
|
|
79
|
+
['8apjndc5ybvm', 'error'],
|
|
80
|
+
['haaxmgzsgjns', 'error'],
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/** Every hash each shipped guard's TEST file was released as: an unedited test goes without a note. */
|
|
85
|
+
export const RELEASED_GUARD_TEST_FORMS: Readonly<Record<string, readonly string[]>> = {
|
|
86
|
+
'animated-layout-property': ['191zjn08f13h4'],
|
|
87
|
+
'bare-error': ['1w7vwbtypxdwe'],
|
|
88
|
+
'error-declared': ['2hj2bs2czhxnw', 'qe8afpq7pzf1'],
|
|
89
|
+
'focus-visible': ['12c0rk3ljkx6q'],
|
|
90
|
+
'image-dimensions': ['3p4hkambgpb4j'],
|
|
91
|
+
'island-mount-clears': ['2jkeu60fnvtdg'],
|
|
92
|
+
'island-without-states': ['vls0ujdd16gw'],
|
|
93
|
+
'native-confirm': ['1c7vps5wn37uv', 'qwyn1mzn9ace'],
|
|
94
|
+
'raw-breakpoint': ['w356i8dreh7j'],
|
|
95
|
+
'raw-colour': ['1tc7cambk8byr'],
|
|
96
|
+
'raw-fetch': ['2lips924uo00f'],
|
|
97
|
+
'raw-interval': ['1z55givy4sst0'],
|
|
98
|
+
'raw-length': ['1hpgz9jowk5qu'],
|
|
99
|
+
'raw-motion': ['6420344uhv97', 'g6cs0de9jmr7'],
|
|
100
|
+
'raw-shadow': ['3kg8ft6y3ia0y'],
|
|
101
|
+
'raw-z-index': ['3fb40f6bwp8kq'],
|
|
102
|
+
'repo-await-in-loop': ['2axgbb82wldt4'],
|
|
103
|
+
'repo-raw-sql': ['c5pfl8w3qj94', 'f19j7irkta44'],
|
|
104
|
+
'repo-unbounded': ['98ncw525gpmo'],
|
|
105
|
+
'runtime-pin': ['dy20fh65qziz'],
|
|
106
|
+
'semantic-interactive': ['2uh0p6xoh996t', '393msxyy1bz36'],
|
|
107
|
+
'unbounded-fanout': ['key86lol3wnh'],
|
|
108
|
+
'undeclared-custom-property': ['30bi2v92swukf', 'svuf8sm14fm8'],
|
|
109
|
+
'undefined-style-class': ['1uy88gpk5k8p8', '2sy8me3i3bmzw'],
|
|
110
|
+
'untranslated-string': ['30q3u45cey2eq'],
|
|
111
|
+
'unzoned-date': ['1siep3fqscks4', '20x6l238r09jk'],
|
|
112
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// The test `x new` writes beside the `runtime-pin` guard: the rule's own cases, run in the app.
|
|
2
|
+
// Split from `guard-runtime-pin.ts` at the file target; the code and the image are handed in.
|
|
3
|
+
|
|
4
|
+
import { SCAFFOLD_BUN_IMAGE } from './bun-image';
|
|
5
|
+
|
|
6
|
+
export const runtimePinTest = (code: string): string => {
|
|
7
|
+
const { patch, ref, series, variant } = SCAFFOLD_BUN_IMAGE;
|
|
8
|
+
return `// The rule, driven directly. Failure case first: a guard whose rule silently stopped matching is
|
|
9
|
+
// a green gate over the convention it was written to enforce.
|
|
10
|
+
|
|
11
|
+
import { expect, unitTest } from '@ultimat3/testing';
|
|
12
|
+
import { runtimePins } from './runtime-pin';
|
|
13
|
+
|
|
14
|
+
/** The image \`x new\` wrote: the digest every FROM builds on. */
|
|
15
|
+
const IMAGE =
|
|
16
|
+
'${ref}';
|
|
17
|
+
|
|
18
|
+
const ENGINES = { path: 'package.json', source: '{ "engines": { "bun": ">=${patch}" } }' };
|
|
19
|
+
const workflow = (pin: string) => ({
|
|
20
|
+
path: '.github/workflows/ci.yml',
|
|
21
|
+
source: ['jobs:', ' a:', ' steps:', \` bun-version: \${pin}\`].join('\\n'),
|
|
22
|
+
});
|
|
23
|
+
const dockerfile = (from: string) => ({
|
|
24
|
+
path: 'docker/Dockerfile',
|
|
25
|
+
source: \`FROM \${from} AS deps\`,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
unitTest('a CI pin off engines.bun is refused at its line, with the line to write', () => {
|
|
29
|
+
const findings = runtimePins([ENGINES, workflow("'1.0.0'")]);
|
|
30
|
+
expect(findings).toHaveLength(1);
|
|
31
|
+
expect(findings[0]?.code).toBe('${code}');
|
|
32
|
+
expect(findings[0]?.at).toBe('.github/workflows/ci.yml:4');
|
|
33
|
+
expect(findings[0]?.fix).toStartWith("edit .github/workflows/ci.yml:4 — bun-version: '${patch}'");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
unitTest('an image tag with no digest is refused, and the fix pastes one', () => {
|
|
37
|
+
const findings = runtimePins([ENGINES, dockerfile('oven/bun:${series}-${variant}')]);
|
|
38
|
+
expect(findings.map((finding) => finding.at)).toEqual(['docker/Dockerfile:1']);
|
|
39
|
+
expect(findings[0]?.fix).toContain(\`FROM \${IMAGE} AS deps\`);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
unitTest('no engines.bun is refused: nothing else can be checked against it', () => {
|
|
43
|
+
const findings = runtimePins([{ path: 'package.json', source: '{}' }]);
|
|
44
|
+
expect(findings.map((finding) => finding.at)).toEqual(['package.json:1']);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
unitTest('the same patch, its series, an expression and a digest-pinned image are silent', () => {
|
|
48
|
+
expect(runtimePins([ENGINES, workflow("'${patch}'"), dockerfile(IMAGE)])).toEqual([]);
|
|
49
|
+
expect(runtimePins([ENGINES, workflow('${series}.x')])).toEqual([]);
|
|
50
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: a GitHub expression, written as text.
|
|
51
|
+
expect(runtimePins([ENGINES, workflow('\${{ matrix.bun }}')])).toEqual([]);
|
|
52
|
+
});
|
|
53
|
+
`;
|
|
54
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// The `runtime-pin` guard `x new` ships: every Bun pin in the app — `packageManager`,
|
|
2
|
+
// `.bun-version`, a workflow's `bun-version:`, a Dockerfile's `FROM oven/bun:` and the patch its
|
|
3
|
+
// digest note records — names the one version `engines.bun` declares, and every image builds on a
|
|
4
|
+
// digest. Four apps each wrote this check for themselves before it shipped.
|
|
5
|
+
|
|
6
|
+
import { SCAFFOLD_BUN_IMAGE } from './bun-image';
|
|
7
|
+
import { guardCode } from './guard';
|
|
8
|
+
import { runtimePinTest } from './guard-runtime-pin-test';
|
|
9
|
+
import type { GeneratedFile } from './naming';
|
|
10
|
+
|
|
11
|
+
/** Derived from the guard's name, never a literal: an `X_*` literal here is a FRAMEWORK code. */
|
|
12
|
+
const NAME = 'runtime-pin';
|
|
13
|
+
const CODE = guardCode(NAME);
|
|
14
|
+
|
|
15
|
+
const source =
|
|
16
|
+
(): string => `// runtime-pin: every Bun pin in this app names the one version engines.bun declares.
|
|
17
|
+
// \`x verify\` runs it on the \`boundaries\` step; \`{ "severity": { "runtime-pin": "off" } }\` in
|
|
18
|
+
// \`guards/shipped.json\` turns it off, \`"warning"\` makes it report only.
|
|
19
|
+
//
|
|
20
|
+
// Why: the dev box, CI and the image each install their own Bun. When the pins disagree, a green
|
|
21
|
+
// gate is evidence about a runtime production never runs, and a lockfile one Bun wrote is installed
|
|
22
|
+
// \`--frozen-lockfile\` by another. A tag is a pointer its publisher can move: an image builds on a
|
|
23
|
+
// digest. Read: \`package.json\` (\`engines.bun\`, THE version, and \`packageManager\`), \`.bun-version\`,
|
|
24
|
+
// every \`bun-version:\` under \`.github/\`, every \`FROM oven/bun:\` in a Dockerfile and the "digest is
|
|
25
|
+
// \`oven/bun:<patch>\`" note above it. Not read: an expression, a build arg, any other comment.
|
|
26
|
+
|
|
27
|
+
import type { Finding, Guard } from '@ultimat3/cli';
|
|
28
|
+
|
|
29
|
+
/** The app owns the codes its own conventions raise — this one is named for the guard. */
|
|
30
|
+
const CODE = '${CODE}';
|
|
31
|
+
|
|
32
|
+
/** The image \`x new\` wrote, so a fix can paste it when \`engines.bun\` is the patch it was read from. */
|
|
33
|
+
const SCAFFOLD = {
|
|
34
|
+
patch: '${SCAFFOLD_BUN_IMAGE.patch}',
|
|
35
|
+
variant: '-${SCAFFOLD_BUN_IMAGE.variant}',
|
|
36
|
+
ref: '${SCAFFOLD_BUN_IMAGE.ref}',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface PinFile {
|
|
40
|
+
/** App-root-relative POSIX path, so the finding names the file an author opens. */
|
|
41
|
+
readonly path: string;
|
|
42
|
+
readonly source: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const EXACT = /^\\d+\\.\\d+\\.\\d+$/;
|
|
46
|
+
const SERIES = /^(\\d+\\.\\d+)(?:\\.x)?$/;
|
|
47
|
+
const ENGINES = /"engines"\\s*:\\s*\\{[^}]*?"bun"\\s*:\\s*"([^"]*)"/;
|
|
48
|
+
const PACKAGE_MANAGER = /"packageManager"\\s*:\\s*"bun@([^"]*)"/;
|
|
49
|
+
const BUN_VERSION = /^\\s*(?:-\\s*)?bun-version:\\s*['"]?([^'"#\\s]+)/;
|
|
50
|
+
const FROM = /^\\s*FROM\\s+(?:--\\S+\\s+)*oven\\/bun:([^\\s@]+)(@sha256:[0-9a-f]{64})?(.*)$/i;
|
|
51
|
+
const TAG = /^(\\d+\\.\\d+(?:\\.\\d+)?)(-[\\w.-]+)?$/;
|
|
52
|
+
const RECORDED = /digest is \`?oven\\/bun:(\\d+\\.\\d+\\.\\d+)(-[\\w.-]+)?/;
|
|
53
|
+
|
|
54
|
+
/** Whether a pin names the version: the same patch, or the version's own series. */
|
|
55
|
+
const agrees = (pin: string, version: string): boolean => {
|
|
56
|
+
if (EXACT.test(pin)) return pin === version;
|
|
57
|
+
const series = SERIES.exec(pin)?.[1];
|
|
58
|
+
return series !== undefined && version.startsWith(\`\${series}.\`);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const lineAt = (text: string, offset: number): number => text.slice(0, offset).split('\\n').length;
|
|
62
|
+
|
|
63
|
+
/** The FROM line naming the version by digest: the scaffold's own when it is that patch. */
|
|
64
|
+
const imageFor = (version: string, variant: string, rest: string): string =>
|
|
65
|
+
version === SCAFFOLD.patch && variant === SCAFFOLD.variant
|
|
66
|
+
? \`FROM \${SCAFFOLD.ref}\${rest}\`
|
|
67
|
+
: \`FROM oven/bun:\${version.split('.').slice(0, 2).join('.')}\${variant}@<digest>\${rest}, the digest from: docker buildx imagetools inspect oven/bun:\${version}\${variant}\`;
|
|
68
|
+
|
|
69
|
+
const finding = (at: string, cause: string, write: string): Finding => ({
|
|
70
|
+
code: CODE,
|
|
71
|
+
cause,
|
|
72
|
+
fix: \`edit \${at} — \${write} — then: x verify\`,
|
|
73
|
+
at,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/** \`path:line\` ordering, so two machines list the same findings in the same order. */
|
|
77
|
+
const byPlace = (a: Finding, b: Finding): number => {
|
|
78
|
+
const [pathA = '', lineA = '0'] = (a.at ?? '').split(/:(?=\\d+$)/);
|
|
79
|
+
const [pathB = '', lineB = '0'] = (b.at ?? '').split(/:(?=\\d+$)/);
|
|
80
|
+
return pathA === pathB ? Number(lineA) - Number(lineB) : pathA < pathB ? -1 : 1;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** One Dockerfile, workflow or action, line by line: what each pin there says against \`version\`. */
|
|
84
|
+
function linePins(file: PinFile, version: string, findings: Finding[]): void {
|
|
85
|
+
const disagrees = (at: string, pin: string, write: string): void => {
|
|
86
|
+
if (agrees(pin, version)) return;
|
|
87
|
+
const cause = \`\${at} pins Bun \${pin} and engines.bun in package.json declares \${version}: the dev box, CI and the image run different runtimes, so a green gate is evidence about none of them\`;
|
|
88
|
+
findings.push(finding(at, cause, write));
|
|
89
|
+
};
|
|
90
|
+
file.source.split('\\n').forEach((text, index) => {
|
|
91
|
+
const at = \`\${file.path}:\${index + 1}\`;
|
|
92
|
+
if (text.trimStart().startsWith('#')) {
|
|
93
|
+
const recorded = RECORDED.exec(text);
|
|
94
|
+
if (recorded === null) return;
|
|
95
|
+
const variant = recorded[2] ?? '';
|
|
96
|
+
const write = \`# The digest is \\\`oven/bun:\${version}\${variant}\\\`'s, with every FROM below it on that digest\`;
|
|
97
|
+
disagrees(at, recorded[1] ?? '', write);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const key = BUN_VERSION.exec(text);
|
|
101
|
+
if (key !== null) {
|
|
102
|
+
const pin = key[1] ?? '';
|
|
103
|
+
if (!pin.includes('$')) disagrees(at, pin, \`bun-version: '\${version}'\`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const from = FROM.exec(text);
|
|
107
|
+
if (from === null) return;
|
|
108
|
+
const [, tag = '', digest, rest = ''] = from;
|
|
109
|
+
if (tag.includes('$')) return;
|
|
110
|
+
const parts = TAG.exec(tag);
|
|
111
|
+
const write = imageFor(version, parts?.[2] ?? '', rest.trimEnd());
|
|
112
|
+
if (parts === null || !agrees(parts[1] ?? '', version)) {
|
|
113
|
+
disagrees(at, \`oven/bun:\${tag}\`, write);
|
|
114
|
+
} else if (digest === undefined) {
|
|
115
|
+
const cause = \`\${at} builds on the tag oven/bun:\${tag} alone, a pointer its publisher can move: the same commit can build on two runtimes\`;
|
|
116
|
+
findings.push(finding(at, cause, write));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Pure — the caller does the I/O — so the rule is testable without a filesystem. */
|
|
122
|
+
export function runtimePins(files: readonly PinFile[]): readonly Finding[] {
|
|
123
|
+
const manifest = files.find((file) => file.path === 'package.json')?.source ?? '';
|
|
124
|
+
const declared = ENGINES.exec(manifest)?.[1]?.match(/\\d+\\.\\d+(?:\\.\\d+)?/)?.[0];
|
|
125
|
+
if (declared === undefined) {
|
|
126
|
+
const cause =
|
|
127
|
+
'package.json declares no engines.bun, so no Bun pin in this app names a version anything can check';
|
|
128
|
+
return [finding('package.json:1', cause, \`"engines": { "bun": ">=\${SCAFFOLD.patch}" }\`)];
|
|
129
|
+
}
|
|
130
|
+
// \`>=1.4\` admits 1.4.0: a range's version is its lower bound.
|
|
131
|
+
const version = [...declared.split('.'), '0', '0'].slice(0, 3).join('.');
|
|
132
|
+
const findings: Finding[] = [];
|
|
133
|
+
for (const file of files) {
|
|
134
|
+
if (file.path === 'package.json') {
|
|
135
|
+
const manager = PACKAGE_MANAGER.exec(file.source);
|
|
136
|
+
const pin = manager?.[1];
|
|
137
|
+
if (manager !== null && pin !== undefined && !agrees(pin, version)) {
|
|
138
|
+
const at = \`package.json:\${lineAt(file.source, manager.index)}\`;
|
|
139
|
+
const cause = \`\${at} pins Bun \${pin} and engines.bun declares \${version}: the toolchain and the gate run different runtimes\`;
|
|
140
|
+
findings.push(finding(at, cause, \`"packageManager": "bun@\${version}"\`));
|
|
141
|
+
}
|
|
142
|
+
} else if (file.path === '.bun-version') {
|
|
143
|
+
const pin = file.source.trim();
|
|
144
|
+
if (!agrees(pin, version)) {
|
|
145
|
+
const cause = \`.bun-version pins Bun \${pin} and engines.bun in package.json declares \${version}: the dev box runs a Bun CI does not\`;
|
|
146
|
+
findings.push(finding('.bun-version:1', cause, version));
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
linePins(file, version, findings);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return findings.sort(byPlace);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Every file a Bun pin lives in, one glob each: a wildcard never matches a dot directory. */
|
|
156
|
+
const PIN_GLOBS = [
|
|
157
|
+
'package.json',
|
|
158
|
+
'.bun-version',
|
|
159
|
+
'.github/workflows/*.yml',
|
|
160
|
+
'.github/workflows/*.yaml',
|
|
161
|
+
'.github/actions/**/action.yml',
|
|
162
|
+
'.github/actions/**/action.yaml',
|
|
163
|
+
'Dockerfile*',
|
|
164
|
+
'*.Dockerfile',
|
|
165
|
+
'docker/**/Dockerfile*',
|
|
166
|
+
'docker/**/*.Dockerfile',
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
export const guard: Guard = {
|
|
170
|
+
summary: 'every Bun pin names the one version engines.bun declares; every image is by digest',
|
|
171
|
+
async check(_root, sources) {
|
|
172
|
+
// Each glob is the run's ONE walk of it, shared with any other guard that asks.
|
|
173
|
+
const found = await Promise.all(PIN_GLOBS.map((glob) => sources.files(glob)));
|
|
174
|
+
const files = new Map<string, PinFile>();
|
|
175
|
+
for (const file of found.flat()) {
|
|
176
|
+
if (!file.path.endsWith('.dockerignore')) {
|
|
177
|
+
files.set(file.path, { path: file.path, source: file.text });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return runtimePins([...files.values()]);
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
`;
|
|
184
|
+
|
|
185
|
+
/** `guards/runtime-pin.ts` and its test. No index, no registry — the directory registers it. */
|
|
186
|
+
export const runtimePinGuardFiles = (): readonly GeneratedFile[] => [
|
|
187
|
+
{ path: `guards/${NAME}.ts`, contents: source() },
|
|
188
|
+
{ path: `guards/${NAME}.test.ts`, contents: runtimePinTest(CODE) },
|
|
189
|
+
];
|
|
@@ -81,7 +81,7 @@ feature slice. Nothing else. A change outside that set is a collision — report
|
|
|
81
81
|
|
|
82
82
|
Inspect before you change: \`bunx x entities list\`, \`bunx x entities show <name>\`, both with \`--json\`.
|
|
83
83
|
|
|
84
|
-
Checks: \`bun test <path>/entity.test.ts\`, \`bunx biome check --write <paths>\`, and \`bun run typecheck\`
|
|
84
|
+
Checks: \`bun test <path>/entity.test.ts\`, \`bunx @biomejs/biome check --write <paths>\`, and \`bun run typecheck\`
|
|
85
85
|
once when you are otherwise done. Never \`bunx x verify\` — that belongs to whoever coordinates you.
|
|
86
86
|
`;
|
|
87
87
|
|
|
@@ -100,7 +100,7 @@ renders. A change outside that set is a collision — report it, do not make it.
|
|
|
100
100
|
| Generate, then edit | \`bunx x g <kind> <name> --feature <slice>\` for every one of them — a hand-written primitive is missing from every registry that projects it |
|
|
101
101
|
| One authz object | the policy decides; a route or a UI that re-checks is a second answer that will drift |
|
|
102
102
|
| Data through the repo | an action calls \`repo.ts\`, never the database |
|
|
103
|
-
| Errors are instructions | never \`throw new Error\` — declare each code once with \`defineError({ code, title, status, cause, fix })\` from \`@ultimat3/core/page\`: a stable \`X_SCREAMING_SNAKE\` code, a cause and a \`fix:\` a caller can actually run. \`
|
|
103
|
+
| Errors are instructions | never \`throw new Error\` — declare each code once with \`defineError({ code, title, status, cause, fix })\` from \`@ultimat3/core/page\`: a stable \`X_SCREAMING_SNAKE\` code, a cause and a \`fix:\` a caller can actually run. the \`error-declared\` guard refuses a handwritten \`UltimateError\` subclass |
|
|
104
104
|
| Jobs run at least once | a handler must be idempotent — an upsert or a statement whose second run changes nothing, never \`count + 1\` |
|
|
105
105
|
| Tasks name a time zone | a cron schedule with an ambient zone is a different time twice a year |
|
|
106
106
|
| No \`any\` | \`unknown\` plus a schema parse |
|
|
@@ -108,7 +108,7 @@ renders. A change outside that set is a collision — report it, do not make it.
|
|
|
108
108
|
Inspect before you change: \`bunx x actions show <name>\`, \`bunx x queries show <name>\`, \`bunx x jobs list\`,
|
|
109
109
|
\`bunx x tasks list\`, \`bunx x policy explain <subject>\` — every one takes \`--json\`.
|
|
110
110
|
|
|
111
|
-
Checks: \`bun test <path>/<file>.test.ts\`, \`bunx biome check --write <paths>\`, and \`bun run typecheck\`
|
|
111
|
+
Checks: \`bun test <path>/<file>.test.ts\`, \`bunx @biomejs/biome check --write <paths>\`, and \`bun run typecheck\`
|
|
112
112
|
once when you are otherwise done. Never \`bunx x verify\` — that belongs to whoever coordinates you.
|
|
113
113
|
`;
|
|
114
114
|
|
|
@@ -137,13 +137,13 @@ calls. A change outside that set is a collision — report it, do not make it.
|
|
|
137
137
|
| Animate transform and opacity | nothing else composites: a \`top\`, a \`width\` or a \`box-shadow\` costs a layout pass every frame, and \`transition: all\` animates properties nobody chose. \`tokens.duration()\` / \`tokens.easing()\` are the values |
|
|
138
138
|
| An island declares its states | a sibling \`<name>.island.states.ts\`, so \`bunx x shot --island <name> --json\` can photograph the failures nobody can click to |
|
|
139
139
|
|
|
140
|
-
Every one of the last five is a build error, not a preference —
|
|
141
|
-
\`boundaries\` step
|
|
140
|
+
Every one of the last five is a build error, not a preference — a guard the framework ships, run by
|
|
141
|
+
\`bunx x verify\`'s \`boundaries\` step. Read the guard's finding rather than guessing at the rule.
|
|
142
142
|
|
|
143
143
|
Inspect before you change: \`bunx x routes --json\`, \`bunx x i18n check\` for catalog gaps, and
|
|
144
144
|
\`bunx x shot <route> --json\` when you need to see what you built.
|
|
145
145
|
|
|
146
|
-
Checks: \`bun test <path>/page.test.ts\`, \`bunx biome check --write <paths>\`, and \`bun run typecheck\`
|
|
146
|
+
Checks: \`bun test <path>/page.test.ts\`, \`bunx @biomejs/biome check --write <paths>\`, and \`bun run typecheck\`
|
|
147
147
|
once when you are otherwise done. Never \`bunx x verify\` — that belongs to whoever coordinates you.
|
|
148
148
|
`;
|
|
149
149
|
|
|
@@ -100,7 +100,7 @@ While you iterate, narrow the *feedback*, not the gate:
|
|
|
100
100
|
| one test by name | \`bun test -t '<name>'\` |
|
|
101
101
|
| a whole type | \`bunx x test unit\` · \`bunx x test contract\` · \`bunx x test e2e\` |
|
|
102
102
|
| one gate step | \`bunx x verify --only <step> --json\` — \`NOT A GATE RUN\` |
|
|
103
|
-
| lint the files you touched | \`bunx biome check --write <paths>\` |
|
|
103
|
+
| lint the files you touched | \`bunx @biomejs/biome check --write <paths>\` |
|
|
104
104
|
| types, once, when otherwise done | \`bun run typecheck\` |
|
|
105
105
|
| a broken environment | \`bunx x doctor\` |
|
|
106
106
|
|
|
@@ -11,24 +11,34 @@ export const HOOK_PATH = '.claude/hooks/format-edited.ts';
|
|
|
11
11
|
export const HOOK_COMMAND = `bun "$CLAUDE_PROJECT_DIR"/${HOOK_PATH}`;
|
|
12
12
|
|
|
13
13
|
const script = `#!/usr/bin/env bun
|
|
14
|
-
// PostToolUse(Edit|Write):
|
|
15
|
-
// and reports what it cannot fix. The path arrives on stdin as
|
|
16
|
-
// shows the agent the finding (the edit already landed)
|
|
14
|
+
// PostToolUse(Edit|Write): the app's own biome, \`check --write\` on the one file just edited — it
|
|
15
|
+
// formats in place and reports what it cannot fix. The path arrives on stdin as
|
|
16
|
+
// \`tool_input.file_path\`. Exit 2 shows the agent the finding (the edit already landed). Only the
|
|
17
|
+
// installed binary: \`bunx biome\` with no install fetches an unrelated npm package named \`biome\`.
|
|
17
18
|
|
|
19
|
+
const root = process.env['CLAUDE_PROJECT_DIR'] || process.cwd();
|
|
20
|
+
const biome = Bun.which('biome', { PATH: \`\${root}/node_modules/.bin\` });
|
|
18
21
|
const input: unknown = JSON.parse((await Bun.stdin.text()) || '{}');
|
|
19
22
|
const record = (typeof input === 'object' && input !== null ? input : {}) as {
|
|
20
23
|
tool_input?: { file_path?: unknown };
|
|
21
24
|
};
|
|
22
25
|
const file = record.tool_input?.file_path;
|
|
23
26
|
if (typeof file === 'string' && file !== '') {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (biome === null) {
|
|
28
|
+
process.stderr.write(
|
|
29
|
+
'format-edited: no node_modules/.bin/biome in this app, nothing formatted — bun install\\n',
|
|
30
|
+
);
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
const proc = Bun.spawnSync([biome, 'check', '--write', '--no-errors-on-unmatched', file], {
|
|
34
|
+
stdout: 'pipe',
|
|
35
|
+
stderr: 'pipe',
|
|
36
|
+
timeout: 15_000,
|
|
37
|
+
});
|
|
28
38
|
if (proc.exitCode !== 0) {
|
|
29
39
|
const out = \`\${proc.stdout.toString()}\${proc.stderr.toString()}\`.trim();
|
|
30
40
|
process.stderr.write(
|
|
31
|
-
\`\${out.split('\\n').slice(-30).join('\\n')}\\nfix what it names, then: bunx biome check --write \${file}\\n\`,
|
|
41
|
+
\`\${out.split('\\n').slice(-30).join('\\n')}\\nfix what it names, then: bunx @biomejs/biome check --write \${file}\\n\`,
|
|
32
42
|
);
|
|
33
43
|
process.exit(2);
|
|
34
44
|
}
|
|
@@ -29,7 +29,7 @@ const settings = (): string => `{
|
|
|
29
29
|
"Bash(bun run typecheck)",
|
|
30
30
|
"Bash(bun run lint)",
|
|
31
31
|
"Bash(bun run verify:*)",
|
|
32
|
-
"Bash(bunx biome check:*)",
|
|
32
|
+
"Bash(bunx @biomejs/biome check:*)",
|
|
33
33
|
"Bash(bunx x verify:*)",
|
|
34
34
|
"Bash(bunx x test:*)",
|
|
35
35
|
"Bash(bunx x doctor:*)",
|
|
@@ -124,7 +124,7 @@ framework's.
|
|
|
124
124
|
|
|
125
125
|
## The hook
|
|
126
126
|
|
|
127
|
-
One \`PostToolUse\` hook, \`${HOOK_PATH}\`: \`
|
|
127
|
+
One \`PostToolUse\` hook, \`${HOOK_PATH}\`: the installed \`biome check --write\` on the file that was just
|
|
128
128
|
edited, named by the JSON the harness sends on stdin. **\`--write\` means it rewrites that file in
|
|
129
129
|
place** — the same safe fixes \`biome check --write .\` would make repo-wide, but your working tree
|
|
130
130
|
does change after every agent edit. Scoped to one file, so it costs milliseconds, and it settles
|
|
@@ -243,7 +243,7 @@ that no longer matches an applied migration stops the release instead of corrupt
|
|
|
243
243
|
| Render | \`preDeployCommand: ROLE=migrate bun apps/web/server.ts\` |
|
|
244
244
|
| Fly.io | \`[deploy] release_command = "bun apps/web/server.ts"\` with \`ROLE=migrate\` |
|
|
245
245
|
| Railway | a pre-deploy command running the same |
|
|
246
|
-
| Kubernetes |
|
|
246
|
+
| Kubernetes | the chart's one \`migrate\` Job on the same image (\`docker/helm\`), ordered before every role — never a per-pod \`initContainer\` |
|
|
247
247
|
| Compose | the \`migrate\` service; every other role waits on \`service_completed_successfully\` |
|
|
248
248
|
|
|
249
249
|
There is no \`x db migrate\` in that list on purpose: it is the developer's command and it needs the
|
|
@@ -288,7 +288,7 @@ somebody else's repository is a command that cannot run. \`--image\` sets \`imag
|
|
|
288
288
|
| Object | Per | Note |
|
|
289
289
|
|---|---|---|
|
|
290
290
|
| Deployment + Service | enabled role | one image, \`ROLE\` and the port are the only difference |
|
|
291
|
-
| Job | release | \`ROLE=migrate\`, a \`pre-install,pre-upgrade\` hook
|
|
291
|
+
| Job | release | \`ROLE=migrate\`, run to completion first: a \`pre-install,pre-upgrade,pre-rollback\` hook, an Argo CD \`Sync\` hook in wave -1, and named by its image so any other applier gets a new Job per image |
|
|
292
292
|
| Ingress | release | off by default; routes \`/_x/sync\` to sync and \`/\` to web |
|
|
293
293
|
| HorizontalPodAutoscaler | role, opt-in | rps, websocket connections, queue depth — never CPU |
|
|
294
294
|
| ServiceMonitor | release | scrapes \`/metrics\` on \`metricsPort\`, every serving role |
|
|
@@ -42,33 +42,35 @@ queries, jobs, MCP tools, published operations and tests it touches, each with p
|
|
|
42
42
|
| One way | generators, not hand-rolled files: \`bunx x g resource\`, \`bunx x g action\`, \`bunx x g route\` | review |
|
|
43
43
|
| Surfaces | \`site/\` is 0kb JS and may not import \`app/\`; \`shared/\` is a leaf | \`X_BOUNDARY_SITE_TO_APP\` |
|
|
44
44
|
| Data | routes call actions and queries; only \`repo.ts\` touches the database | \`X_BOUNDARY_ROUTE_TO_DB\` |
|
|
45
|
-
| Repos | a \`repo.ts\` reads through the typed handle, never a \`sql\` literal it can express; reported, not refused: an \`await\` per loop turn outside \`expectedQueryLoop('<why>', fn)\`, a bare \`.all()\` (it stops at 50 rows: say \`.limit(n)\`) | \`
|
|
46
|
-
| Fan-out | a database call per element of a list runs through \`mapBounded(rows, fn, { width })\` from \`@ultimat3/core\` — never \`Promise.all(rows.map(async …))\`, one statement per row at once; a \`// why:\` on the line admits a list bounded where it is built | \`
|
|
47
|
-
| Vendors | a server \`fetch(\` carries a \`signal\` in its own options — better, it is \`outbound()\` from \`@ultimat3/core/outbound\`: a deadline, the caller's signal, safe-only retry | \`
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
45
|
+
| Repos | a \`repo.ts\` reads through the typed handle, never a \`sql\` literal it can express; reported, not refused: an \`await\` per loop turn outside \`expectedQueryLoop('<why>', fn)\`, a bare \`.all()\` (it stops at 50 rows: say \`.limit(n)\`) | \`repo-raw-sql\`, \`repo-await-in-loop\`, \`repo-unbounded\` |
|
|
46
|
+
| Fan-out | a database call per element of a list runs through \`mapBounded(rows, fn, { width })\` from \`@ultimat3/core\` — never \`Promise.all(rows.map(async …))\`, one statement per row at once; a \`// why:\` on the line admits a list bounded where it is built | \`unbounded-fanout\` |
|
|
47
|
+
| Vendors | a server \`fetch(\` carries a \`signal\` in its own options — better, it is \`outbound()\` from \`@ultimat3/core/outbound\`: a deadline, the caller's signal, safe-only retry | \`raw-fetch\` |
|
|
48
|
+
| Runtime | every Bun pin — \`packageManager\`, \`.bun-version\`, CI's \`bun-version:\`, the image's \`FROM oven/bun:\` — names the version \`engines.bun\` declares, and an image builds on a digest | \`runtime-pin\` |
|
|
49
|
+
| Polling | an island re-reads a query on a timer with \`useQuery(ref, input, { poll: pollEvery(ms) })\` (\`@ultimat3/realtime\`), anything else with \`visibleInterval(run, ms)\` from \`@ultimat3/core/page\` — no call while the tab is hidden, none after a lost session — never a bare \`setInterval(\`; a \`// why:\` on the line admits a tick that is not a read | \`raw-interval\` |
|
|
50
|
+
| Confirmation | a destructive act asks through \`ConfirmDialog\` from \`@ultimat3/ui\` — Cancel focused, a native post, stays open on a refusal — never \`confirm(\`; a \`// why:\` on the line admits a call that is not that question | \`native-confirm\` |
|
|
51
|
+
| Errors | never \`throw new Error\` — declare each code once, \`defineError({ code, title, status, cause, fix })\` from \`@ultimat3/core/page\`, and throw its class; never a handwritten \`UltimateError\` subclass | \`bare-error\`, \`error-declared\` |
|
|
51
52
|
| Money | \`{ minor, currency }\`, never a float — \`money()\` on the column | the type: \`price: 19.99\` is TS2322, \`number\` is not \`MoneyInput\` |
|
|
52
|
-
| Time | store UTC, format with an explicit IANA time zone | \`
|
|
53
|
-
| Strings | every user-facing string goes through \`t()\` | \`
|
|
54
|
-
| Colour | semantic tokens only, never a raw hex | \`
|
|
55
|
-
| Lengths | a length is a token or \`rem()\`, never a raw \`px\` | \`
|
|
56
|
-
| Breakpoints | a viewport query names a breakpoint rung (\`respond-up\`, \`respond-down\`, \`respond-between\`), never a width | \`
|
|
57
|
-
| Layers | a \`z-index\` is a named layer, never a number | \`
|
|
58
|
-
| Shadows | a shadow comes off the shadow scale, never a hand-written offset and blur | \`
|
|
59
|
-
| Timing | a duration and an easing curve come off the motion scale, never a literal | \`
|
|
60
|
-
| Classes | a class a component reads off its stylesheet is one that sheet compiles | \`
|
|
61
|
-
| Properties | a custom property a stylesheet reads is one the app declares | \`
|
|
62
|
-
| Interaction | a click is answered by a control — never a \`<div onClick>\`, and never a \`role=\` where the native tag exists | \`
|
|
63
|
-
| Focus | \`outline: none\` replaces the ring in the same rule or the one beside it, or it does not remove it | \`
|
|
64
|
-
| Images | every image carries width + height or an aspect-ratio, and the priority one is never \`loading="lazy"\` | \`
|
|
65
|
-
| Motion | animate \`transform\` and \`opacity\` — never a layout property, never \`transition: all\` | \`
|
|
66
|
-
| Islands | every \`*.island.tsx\` has a sibling \`*.island.states.ts\`, so \`bunx x shot --island\` can photograph its failures | \`
|
|
67
|
-
| Island mounts | a \`mount\` replaces its server markup through \`mountOver\`, so a render that throws shows the server's HTML, not a blank box | \`
|
|
53
|
+
| Time | store UTC, format with an explicit IANA time zone | \`unzoned-date\` |
|
|
54
|
+
| Strings | every user-facing string goes through \`t()\` | \`untranslated-string\` |
|
|
55
|
+
| Colour | semantic tokens only, never a raw hex | \`raw-colour\` |
|
|
56
|
+
| Lengths | a length is a token or \`rem()\`, never a raw \`px\` | \`raw-length\` |
|
|
57
|
+
| Breakpoints | a viewport query names a breakpoint rung (\`respond-up\`, \`respond-down\`, \`respond-between\`), never a width | \`raw-breakpoint\` |
|
|
58
|
+
| Layers | a \`z-index\` is a named layer, never a number | \`raw-z-index\` |
|
|
59
|
+
| Shadows | a shadow comes off the shadow scale, never a hand-written offset and blur | \`raw-shadow\` |
|
|
60
|
+
| Timing | a duration and an easing curve come off the motion scale, never a literal | \`raw-motion\` |
|
|
61
|
+
| Classes | a class a component reads off its stylesheet is one that sheet compiles | \`undefined-style-class\` |
|
|
62
|
+
| Properties | a custom property a stylesheet reads is one the app declares | \`undeclared-custom-property\` |
|
|
63
|
+
| Interaction | a click is answered by a control — never a \`<div onClick>\`, and never a \`role=\` where the native tag exists | \`semantic-interactive\` |
|
|
64
|
+
| Focus | \`outline: none\` replaces the ring in the same rule or the one beside it, or it does not remove it | \`focus-visible\` |
|
|
65
|
+
| Images | every image carries width + height or an aspect-ratio, and the priority one is never \`loading="lazy"\` | \`image-dimensions\` |
|
|
66
|
+
| Motion | animate \`transform\` and \`opacity\` — never a layout property, never \`transition: all\` | \`animated-layout-property\` |
|
|
67
|
+
| Islands | every \`*.island.tsx\` has a sibling \`*.island.states.ts\`, so \`bunx x shot --island\` can photograph its failures | \`island-without-states\` |
|
|
68
|
+
| Island mounts | a \`mount\` replaces its server markup through \`mountOver\`, so a render that throws shows the server's HTML, not a blank box | \`island-mount-clears\` |
|
|
68
69
|
| Size | one file, one job — ${LINE_CEILING} lines of reviewable logic, and split past it | \`X_FILE_TOO_LONG\` |
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
Each lowercase name is a guard the framework ships, run on \`bunx x verify\`'s \`boundaries\` step
|
|
72
|
+
from the installed version. \`guards/shipped.json\` sets one's severity (\`"warning"\`, \`"off"\`);
|
|
73
|
+
\`bunx x g guard <name>\` writes this app's own into \`guards/\`.
|
|
72
74
|
|
|
73
75
|
The last five rows are about what this app is like to USE, and each is decidable from the file
|
|
74
76
|
alone — which is why they are those five and not the many that are not. A role is a promise:
|