@ultimat3/cli 31.26.0 → 31.28.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 +47 -37
- package/README.md +19 -8
- package/package.json +29 -29
- package/src/app-manifest.ts +6 -1
- package/src/app-mcp.ts +17 -3
- package/src/cmd-cache-spec.ts +5 -2
- package/src/cmd-db-spec.ts +2 -3
- package/src/cmd-db.ts +0 -2
- package/src/cmd-deploy-verify-sample.ts +93 -0
- package/src/cmd-deploy-verify.ts +2 -41
- package/src/cmd-dev-spec.ts +15 -1
- package/src/cmd-dev.ts +31 -4
- package/src/cmd-doctor.ts +15 -4
- package/src/cmd-exercise-spec.ts +7 -1
- package/src/cmd-exercise.ts +22 -10
- package/src/cmd-generate.ts +2 -0
- package/src/cmd-jobs-spec.ts +3 -6
- package/src/cmd-jobs.ts +1 -7
- package/src/cmd-logs-spec.ts +2 -1
- package/src/cmd-logs.ts +9 -28
- package/src/cmd-planned.ts +11 -45
- package/src/cmd-profile-frames.ts +99 -0
- package/src/cmd-profile-spec.ts +24 -0
- package/src/cmd-profile.ts +164 -0
- package/src/cmd-repro-spec.ts +13 -1
- package/src/cmd-repro.ts +37 -5
- package/src/cmd-status-sample.ts +57 -0
- package/src/cmd-status-spec.ts +30 -0
- package/src/cmd-status.ts +108 -0
- package/src/cmd-token-spec.ts +5 -2
- package/src/cmd-token.ts +7 -3
- 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-objective.ts +105 -0
- package/src/codemods/helm-alerts-stock.ts +108 -0
- package/src/codemods/index.ts +56 -0
- package/src/codemods/metrics-probe-healthz.ts +47 -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/coverage-island.ts +121 -0
- package/src/coverage-lcov.ts +49 -5
- package/src/coverage-remap.ts +146 -0
- package/src/db-replay-engine-prepared.ts +66 -0
- package/src/db-replay-engine-template.ts +156 -0
- package/src/db-replay-engine.ts +4 -0
- package/src/db-replay-scratch-reap.ts +54 -0
- package/src/deploy-verify-flags.ts +9 -2
- package/src/deploy-verify-grade.ts +10 -3
- package/src/dev-boot.ts +14 -1
- package/src/dev-dashboard-guard.ts +57 -10
- package/src/dev-host.ts +46 -0
- package/src/dev-tls-cache.ts +103 -0
- package/src/dev-tls-der.ts +69 -0
- package/src/dev-tls.ts +120 -0
- package/src/doctor-advisory-floors.ts +113 -0
- package/src/doctor-browser.ts +60 -0
- package/src/doctor-guards.ts +39 -86
- package/src/doctor-superseded.ts +67 -0
- package/src/error-codes-doctor.ts +12 -4
- package/src/error-codes-verify.ts +47 -0
- package/src/error-codes.ts +20 -23
- package/src/exercise-database.ts +47 -9
- package/src/exercise-push-device.ts +51 -0
- package/src/exercise-route-api.ts +74 -0
- package/src/exercise-routes.ts +14 -5
- package/src/exercise-services.ts +3 -1
- package/src/exercise-shard-flag.ts +47 -0
- package/src/fix-command.ts +2 -2
- package/src/generate-factories.ts +5 -11
- package/src/generate-feature-required.ts +9 -4
- package/src/generate-files.ts +26 -7
- package/src/generate-kinds.ts +5 -1
- 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 +105 -34
- package/src/index.ts +10 -0
- package/src/island-bundle-options.ts +48 -0
- package/src/island-bundle.ts +18 -46
- package/src/island-link.ts +5 -0
- package/src/island-outputs.ts +5 -0
- package/src/lint-findings.ts +3 -3
- package/src/mcp-errors-verify.ts +35 -0
- package/src/mcp-errors.ts +21 -20
- package/src/mcp-host-logs.ts +121 -0
- package/src/mcp-host.ts +12 -73
- package/src/measure-scope.ts +23 -3
- package/src/messages-floor.ts +19 -0
- package/src/messages-repro.ts +16 -2
- package/src/messages-status.ts +10 -0
- package/src/messages-upgrade.ts +15 -0
- package/src/messages.ts +22 -1
- package/src/registry.ts +4 -0
- 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-start-types.ts +7 -0
- package/src/role-start.ts +4 -0
- package/src/serve-boot.ts +7 -1
- package/src/serve-env-tls.ts +57 -0
- package/src/solid-loader.ts +27 -10
- package/src/superseded-match.ts +87 -0
- package/src/superseded.ts +84 -0
- package/src/templates/bun-image.ts +48 -0
- package/src/templates/generate-export-rows.ts +136 -0
- package/src/templates/generate-import-rows.ts +186 -0
- package/src/templates/generate-rows-slice.ts +95 -0
- package/src/templates/github/ci.yml.ts +5 -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-db-package.ts +3 -0
- package/src/templates/scaffold-docs.ts +34 -30
- package/src/templates/scaffold-guards.ts +73 -39
- package/src/templates/scaffold-repo.ts +4 -8
- package/src/templates/scaffold-site.ts +4 -1
- package/src/templates/scaffold-suites.ts +72 -0
- package/src/templates/scaffold-test-services.ts +35 -10
- package/src/templates/scaffold-verify-floor.ts +53 -31
- package/src/templates/shapes/api.ts +4 -0
- package/src/templates/slice-foundation.ts +3 -3
- package/src/unthrown-codes.ts +3 -1
- 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 +44 -7
- package/src/upgrade-guards-baseline.ts +43 -0
- package/src/upgrade-guards.ts +37 -2
- 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 +55 -27
- package/src/upgrade-signals.ts +91 -0
- package/src/upgrade-unfinished.ts +61 -0
- package/src/verify-coverage-run.ts +42 -11
- package/src/verify-e2e.ts +115 -4
- package/src/verify-floor.ts +27 -0
- package/src/verify-guard-baseline.ts +109 -0
- package/src/verify-live.ts +72 -0
- package/src/verify-merge-skips.ts +51 -0
- package/src/verify-merge.ts +36 -2
- package/src/verify-run.ts +48 -7
- package/src/verify-services.ts +287 -0
- package/src/verify-skip-reason.ts +53 -0
- package/src/verify-strict.ts +108 -0
- package/src/verify-test-command.ts +129 -0
- package/src/verify-tests.ts +39 -126
- package/types/babel-modules.d.ts +2 -0
- package/wiki/CLI-Reference.md +200 -27
- package/wiki/Caching-And-Invalidation.md +1 -1
- package/wiki/Entities-And-Migrations.md +1 -1
- package/wiki/Interface-Rules.md +17 -8
- package/wiki/Jobs-And-Workflows.md +3 -3
- package/wiki/Known-Gaps.md +5 -1
- package/wiki/MCP-And-AI.md +1 -1
- package/wiki/Observability.md +1 -0
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Project-Layout.md +4 -4
- package/wiki/Troubleshooting.md +3 -3
- package/wiki/Tutorial-05-Deploy-Free.md +2 -2
- package/wiki/Upgrading.md +8 -0
|
@@ -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
|
|
@@ -13,6 +13,7 @@ import { sortedImports } from './imports';
|
|
|
13
13
|
import type { GeneratedFile, NameSet } from './naming';
|
|
14
14
|
import { dbClientFiles } from './scaffold-db-client';
|
|
15
15
|
import { packageShapeFiles, workspacePackageJson } from './scaffold-package-shape';
|
|
16
|
+
import { liveSuiteFiles } from './scaffold-suites';
|
|
16
17
|
|
|
17
18
|
const DESCRIPTION = 'Entity re-exports and SQL migrations, no business logic';
|
|
18
19
|
|
|
@@ -231,4 +232,6 @@ export const dbPackageFiles = (app: NameSet, example: boolean): readonly Generat
|
|
|
231
232
|
{ path: 'packages/db/src/schema.ts', contents: dbSchema(app, example) },
|
|
232
233
|
{ path: 'packages/db/src/seed.ts', contents: dbSeed(app, example) },
|
|
233
234
|
{ path: 'packages/db/src/seed.test.ts', contents: dbSeedTest(app, example) },
|
|
235
|
+
// The production driver against a real Postgres: the `live` step every scaffold runs.
|
|
236
|
+
...liveSuiteFiles(),
|
|
234
237
|
];
|
|
@@ -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:
|
|
@@ -86,13 +88,14 @@ branch whose test cannot fail is worse than an uncovered one, because it reads a
|
|
|
86
88
|
\`exclude\` entry under \`coverage\` is for code a unit test cannot execute — an island's
|
|
87
89
|
browser-only mount, a container entry point — carries its \`why\`, and is printed by \`bunx x doctor\`.
|
|
88
90
|
|
|
89
|
-
Every test the scaffold and the generators write is the idiom to copy.
|
|
90
|
-
|
|
91
|
+
Every test the scaffold and the generators write is the idiom to copy. A \`*.live.test.ts\` runs
|
|
92
|
+
on a real Postgres, a \`*.e2e.test.ts\` in a real browser; the rest on \`unit\`, in memory.
|
|
91
93
|
|
|
92
94
|
A suite that needs a real server reads it from \`docker/test-services.env\`: Postgres 18, Redis, NATS
|
|
93
|
-
and S3 from \`docker/docker-compose.test.yml\`, in RAM, with durability and logging off
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
and S3 from \`docker/docker-compose.test.yml\`, in RAM, with durability and logging off.
|
|
96
|
+
\`bun run verify\` starts it itself when nothing answers at \`TEST_DATABASE_URL\` and Docker is
|
|
97
|
+
there; by hand it is \`docker compose -f docker/docker-compose.test.yml up -d --wait\` then
|
|
98
|
+
\`set -a; . docker/test-services.env; set +a\`. A resource a test opens is held with
|
|
96
99
|
\`await using\` — \`await using db = await acquireWorkerDatabase()\` drops its database however
|
|
97
100
|
the test ends:
|
|
98
101
|
|
|
@@ -151,7 +154,8 @@ bun run dev # all roles in one process, embedded Postgres, /_x mounted
|
|
|
151
154
|
bun run verify # the gate: typecheck, lint, boundaries, tests, drift, budgets (it builds to weigh)
|
|
152
155
|
\`\`\`
|
|
153
156
|
|
|
154
|
-
Tests against real servers — Postgres 18, Redis, NATS, S3, in RAM and silent, as CI runs them
|
|
157
|
+
Tests against real servers — Postgres 18, Redis, NATS, S3, in RAM and silent, as CI runs them.
|
|
158
|
+
\`bun run verify\` starts them when nothing answers and Docker is there; by hand:
|
|
155
159
|
|
|
156
160
|
\`\`\`sh
|
|
157
161
|
docker compose -f docker/docker-compose.test.yml up -d --wait
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The
|
|
1
|
+
// The one list that names every guard the framework ships, and what `x new` writes into `guards/`.
|
|
2
2
|
//
|
|
3
3
|
// `x new` shipped ZERO guards while the `AGENTS.md` it writes stated nine non-negotiables — five of
|
|
4
4
|
// which nothing enforced, each measured green on `x verify` in a scaffolded app. The mechanism was
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
// until the apps are clean of it, and a `.all()` that says no bound — failing the gate in an app
|
|
30
30
|
// scaffolded from 31.23 on, while an older app keeps the report-only copy it was given.
|
|
31
31
|
|
|
32
|
+
import { SHIPPED_GUARD_NAMES as NAMES, type ShippedGuardName } from '../guards-shipped-names';
|
|
32
33
|
import { animatedLayoutPropertyGuardFiles } from './guard-animated-layout-property';
|
|
33
34
|
import { bareErrorGuardFiles } from './guard-bare-error';
|
|
34
35
|
import { errorDeclaredGuardFiles } from './guard-error-declared';
|
|
@@ -48,6 +49,7 @@ import { rawZIndexGuardFiles } from './guard-raw-z-index';
|
|
|
48
49
|
import { repoAwaitInLoopGuardFiles } from './guard-repo-await-in-loop';
|
|
49
50
|
import { repoRawSqlGuardFiles } from './guard-repo-raw-sql';
|
|
50
51
|
import { repoUnboundedGuardFiles } from './guard-repo-unbounded';
|
|
52
|
+
import { runtimePinGuardFiles } from './guard-runtime-pin';
|
|
51
53
|
import { semanticInteractiveGuardFiles } from './guard-semantic-interactive';
|
|
52
54
|
import { unboundedFanoutGuardFiles } from './guard-unbounded-fanout';
|
|
53
55
|
import { undeclaredCustomPropertyGuardFiles } from './guard-undeclared-custom-property';
|
|
@@ -57,48 +59,49 @@ import { unzonedDateGuardFiles } from './guard-unzoned-date';
|
|
|
57
59
|
import type { GeneratedFile } from './naming';
|
|
58
60
|
|
|
59
61
|
/**
|
|
60
|
-
* Every guard the framework ships, by the
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* Every guard the framework ships, keyed by the ONE list of names (`guards-shipped-names.ts`, a
|
|
63
|
+
* leaf the serving graph may read): a `Record`, so tsc refuses a name without its module and a
|
|
64
|
+
* module without its name. The `boundaries` step runs each from the installed framework; a new
|
|
65
|
+
* shipped guard is one module beside these, one name there and one row here.
|
|
64
66
|
*/
|
|
65
|
-
const SHIPPED:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
67
|
+
const SHIPPED: Readonly<Record<ShippedGuardName, () => readonly GeneratedFile[]>> = {
|
|
68
|
+
'animated-layout-property': animatedLayoutPropertyGuardFiles,
|
|
69
|
+
'bare-error': bareErrorGuardFiles,
|
|
70
|
+
'error-declared': errorDeclaredGuardFiles,
|
|
71
|
+
'focus-visible': focusVisibleGuardFiles,
|
|
72
|
+
'image-dimensions': imageDimensionsGuardFiles,
|
|
73
|
+
'island-mount-clears': islandMountClearsGuardFiles,
|
|
74
|
+
'island-without-states': islandWithoutStatesGuardFiles,
|
|
75
|
+
'native-confirm': nativeConfirmGuardFiles,
|
|
76
|
+
'raw-breakpoint': rawBreakpointGuardFiles,
|
|
77
|
+
'raw-colour': rawColourGuardFiles,
|
|
78
|
+
'raw-fetch': rawFetchGuardFiles,
|
|
79
|
+
'raw-interval': rawIntervalGuardFiles,
|
|
80
|
+
'raw-length': rawLengthGuardFiles,
|
|
81
|
+
'raw-motion': rawMotionGuardFiles,
|
|
82
|
+
'raw-shadow': rawShadowGuardFiles,
|
|
83
|
+
'raw-z-index': rawZIndexGuardFiles,
|
|
84
|
+
'repo-await-in-loop': repoAwaitInLoopGuardFiles,
|
|
85
|
+
'repo-raw-sql': repoRawSqlGuardFiles,
|
|
86
|
+
'repo-unbounded': () => repoUnboundedGuardFiles('error'),
|
|
87
|
+
'runtime-pin': runtimePinGuardFiles,
|
|
88
|
+
'semantic-interactive': semanticInteractiveGuardFiles,
|
|
89
|
+
'unbounded-fanout': unboundedFanoutGuardFiles,
|
|
90
|
+
'undeclared-custom-property': undeclaredCustomPropertyGuardFiles,
|
|
91
|
+
'undefined-style-class': undefinedStyleClassGuardFiles,
|
|
92
|
+
'untranslated-string': untranslatedStringGuardFiles,
|
|
93
|
+
'unzoned-date': unzonedDateGuardFiles,
|
|
94
|
+
};
|
|
92
95
|
|
|
93
96
|
/** The names, in the order every list of them is shown. */
|
|
94
|
-
export const SHIPPED_GUARD_NAMES: readonly string[] =
|
|
97
|
+
export const SHIPPED_GUARD_NAMES: readonly string[] = NAMES;
|
|
95
98
|
|
|
96
99
|
/**
|
|
97
100
|
* The shipped guard of that name with its test, or `undefined` when the name is not one — which
|
|
98
101
|
* is an app's own convention, and `x g guard` then writes the blank template instead.
|
|
99
102
|
*/
|
|
100
103
|
export const shippedGuardFiles = (name: string): readonly GeneratedFile[] | undefined =>
|
|
101
|
-
|
|
104
|
+
(Object.hasOwn(SHIPPED, name) ? SHIPPED[name as ShippedGuardName] : undefined)?.();
|
|
102
105
|
|
|
103
106
|
/**
|
|
104
107
|
* The current text of a shipped guard's rule file (`guards/<name>.ts`), or `undefined` when the
|
|
@@ -134,10 +137,41 @@ export const shippedGuardSources = (name: string): readonly string[] => {
|
|
|
134
137
|
return typeof earlier?.contents === 'string' ? [current, earlier.contents] : [current];
|
|
135
138
|
};
|
|
136
139
|
|
|
140
|
+
/** A rule-file text a shipped guard has been emitted as, and how that form reports. */
|
|
141
|
+
export interface ShippedGuardForm {
|
|
142
|
+
readonly source: string;
|
|
143
|
+
readonly severity: 'error' | 'warning';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** `severity: 'warning',` on a line of its own: the one spelling a shipped template emits. */
|
|
147
|
+
const REPORT_ONLY = /^\s*severity:\s*'warning',\s*$/m;
|
|
148
|
+
|
|
149
|
+
/** Whether a guard's rule-file text reports only. */
|
|
150
|
+
export const reportOnlyForm = (source: string): boolean => REPORT_ONLY.test(source);
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Every current form of a shipped guard with its severity, the template first — what the
|
|
154
|
+
* `vendored-guards` codemod matches an app's copy against. Empty when the name was never shipped.
|
|
155
|
+
*/
|
|
156
|
+
export const shippedGuardForms = (name: string): readonly ShippedGuardForm[] =>
|
|
157
|
+
shippedGuardSources(name).map((source) => ({
|
|
158
|
+
source,
|
|
159
|
+
severity: reportOnlyForm(source) ? 'warning' : 'error',
|
|
160
|
+
}));
|
|
161
|
+
|
|
162
|
+
/** The current text of a shipped guard's test (`guards/<name>.test.ts`), or `undefined`. */
|
|
163
|
+
export const shippedGuardTest = (name: string): string | undefined => {
|
|
164
|
+
const contents = shippedGuardFiles(name)?.find(
|
|
165
|
+
(file) => file.path === `guards/${name}.test.ts`,
|
|
166
|
+
)?.contents;
|
|
167
|
+
return typeof contents === 'string' ? contents : undefined;
|
|
168
|
+
};
|
|
169
|
+
|
|
137
170
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* `x g guard <name
|
|
171
|
+
* What `x new` writes into `guards/`: no guard at all — every shipped one runs from the installed
|
|
172
|
+
* framework (`guards-built-in.ts`) — only `guards/shipped.json`, whose presence opts the app into
|
|
173
|
+
* that and whose rows are its severities. The app's own guards join it from `x g guard <name>`.
|
|
141
174
|
*/
|
|
142
|
-
export const scaffoldGuardFiles = (): readonly GeneratedFile[] =>
|
|
143
|
-
|
|
175
|
+
export const scaffoldGuardFiles = (): readonly GeneratedFile[] => [
|
|
176
|
+
{ path: 'guards/shipped.json', contents: '{\n "severity": {}\n}\n' },
|
|
177
|
+
];
|
|
@@ -48,7 +48,7 @@ export const TYPESCRIPT_VERSION = '^7.0.2';
|
|
|
48
48
|
* that installed an older runtime than the compiler targets drifted as a buried literal (1.9.14
|
|
49
49
|
* beside the repository's 1.9.15). `scaffold-repo.test.ts` holds it equal to the root manifest's.
|
|
50
50
|
*/
|
|
51
|
-
const SOLID_VERSION = '1.9.
|
|
51
|
+
const SOLID_VERSION = '1.9.18';
|
|
52
52
|
|
|
53
53
|
// `engines.bun` is `REQUIRED_BUN`, the floor the SHIPPED `x` enforces
|
|
54
54
|
// (`packages/cli/src/app-root.ts`), and not a second literal. It was one: `>=1.3.0`, a whole minor
|
|
@@ -107,6 +107,7 @@ const rootPackage = (app: NameSet, version: string): string => `{
|
|
|
107
107
|
"@ultimat3/render": "^${version}",
|
|
108
108
|
"@ultimat3/schema": "^${version}",
|
|
109
109
|
"@ultimat3/seo": "^${version}",
|
|
110
|
+
"@ultimat3/storage": "^${version}",
|
|
110
111
|
"@ultimat3/ui": "^${version}",
|
|
111
112
|
"solid-js": "${SOLID_VERSION}"
|
|
112
113
|
},
|
|
@@ -320,12 +321,6 @@ const bunfig = (): string => `[test]
|
|
|
320
321
|
root = "."
|
|
321
322
|
# Frozen clock, seeded RNG, sealed network — nondeterminism in a test is a bug.
|
|
322
323
|
preload = ["@ultimat3/testing/preload"]
|
|
323
|
-
# An island is mounted from a BUILT chunk that \`mountIsland\` writes to a temp .mjs, so
|
|
324
|
-
# \`bun test --coverage\` reports that file: two minified lines, under a name no source has. Bun
|
|
325
|
-
# does not remap a pre-built module through its sourcemap (measured on 1.4.0, and the build does
|
|
326
|
-
# emit one), so the row can only ever be noise — the island's own .island.tsx is not what it
|
|
327
|
-
# describes. Ignoring it removes the phantom; it hides no line any test was covering.
|
|
328
|
-
coveragePathIgnorePatterns = ["**/*.mjs"]
|
|
329
324
|
`;
|
|
330
325
|
|
|
331
326
|
const scssTypes =
|
|
@@ -361,6 +356,7 @@ packages/*/dist/
|
|
|
361
356
|
/coverage/
|
|
362
357
|
playwright-report/
|
|
363
358
|
test-results/
|
|
359
|
+
repro/bundle-*.json
|
|
364
360
|
`;
|
|
365
361
|
|
|
366
362
|
// Values, not declarations — the declaration is `envSchema` and `.env.example` is its projection.
|
|
@@ -393,7 +389,7 @@ export function repoFiles(
|
|
|
393
389
|
{ path: 'biome.json', contents: biome() },
|
|
394
390
|
{ path: 'bunfig.toml', contents: bunfig() },
|
|
395
391
|
{ path: 'app.config.ts', contents: appConfig(app) },
|
|
396
|
-
{ path: VERIFY_FLOOR_FILE, contents: verifyFloor(example) },
|
|
392
|
+
{ path: VERIFY_FLOOR_FILE, contents: verifyFloor({ jobs: example, pages: true }) },
|
|
397
393
|
{ path: 'types/scss.d.ts', contents: scssTypes() },
|
|
398
394
|
{ path: '.gitignore', contents: gitignore() },
|
|
399
395
|
// Every text file LF whatever `core.autocrlf` says — a Windows checkout is otherwise CRLF.
|