@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,58 @@
|
|
|
1
|
+
// 31.6.0: named exports only, as a lint rule — biome.json turns on `noDefaultExport`, off for
|
|
2
|
+
// `scss.d.ts`. Turned on only where the app holds no default export: elsewhere the change is
|
|
3
|
+
// reported with the files it would red, never a lint failure the hop introduced.
|
|
4
|
+
|
|
5
|
+
import type { Codemod } from './codemod';
|
|
6
|
+
import { unifiedDiff } from './engine-diff';
|
|
7
|
+
import type { SnippetEdit } from './engine-edits';
|
|
8
|
+
import { editSnippets, fileText } from './engine-edits';
|
|
9
|
+
|
|
10
|
+
const BIOME = 'biome.json';
|
|
11
|
+
|
|
12
|
+
export const BIOME_EDITS: readonly SnippetEdit[] = [
|
|
13
|
+
{
|
|
14
|
+
from: ' "style": { "useNodejsImportProtocol": "error" }',
|
|
15
|
+
to: ' "style": { "useNodejsImportProtocol": "error", "noDefaultExport": "error" }',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
from: ' "overrides": [\n {\n "includes": ["**/*.scss"],',
|
|
19
|
+
to: ' "overrides": [\n {\n "includes": ["**/scss.d.ts"],\n "linter": { "rules": { "style": { "noDefaultExport": "off" } } }\n },\n {\n "includes": ["**/*.scss"],',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
/** The app's own sources that default-export: what the rule would red. */
|
|
24
|
+
async function defaultExports(app: Parameters<Codemod['run']>[0]): Promise<readonly string[]> {
|
|
25
|
+
const found: string[] = [];
|
|
26
|
+
for (const path of await app.glob('**/*.{ts,tsx,js,mjs}')) {
|
|
27
|
+
if (path.includes('node_modules/') || path.endsWith('scss.d.ts')) continue;
|
|
28
|
+
if (/^export default\b/m.test((await app.read(path)) ?? '')) found.push(path);
|
|
29
|
+
}
|
|
30
|
+
return found;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const codemod: Codemod = {
|
|
34
|
+
id: 'biome-no-default-export',
|
|
35
|
+
since: '31.6.0',
|
|
36
|
+
summary: `${BIOME}: noDefaultExport is an error, off for scss.d.ts — named exports only`,
|
|
37
|
+
async run(app) {
|
|
38
|
+
const held = await app.read(BIOME);
|
|
39
|
+
if (held === undefined || held.includes('"noDefaultExport"'))
|
|
40
|
+
return { changed: [], skipped: [] };
|
|
41
|
+
// Not the file x new wrote (a monorepo child extending the repo's): its rules are the app's.
|
|
42
|
+
const text = fileText(held).text;
|
|
43
|
+
if (BIOME_EDITS.some((edit) => !text.includes(edit.from))) return { changed: [], skipped: [] };
|
|
44
|
+
const blocking = await defaultExports(app);
|
|
45
|
+
if (blocking.length === 0) return editSnippets(app, BIOME, BIOME_EDITS);
|
|
46
|
+
const wanted = BIOME_EDITS.reduce((text, edit) => text.replace(edit.from, () => edit.to), held);
|
|
47
|
+
return {
|
|
48
|
+
changed: [],
|
|
49
|
+
skipped: [
|
|
50
|
+
{
|
|
51
|
+
path: BIOME,
|
|
52
|
+
reason: `noDefaultExport left off: ${blocking.slice(0, 5).join(', ')} default-export, and the rule would red lint. Make them named exports, then apply the diff`,
|
|
53
|
+
diff: unifiedDiff(BIOME, held, wanted),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// 31.27.0: island coverage is credited to its source through the chunk's source map, so the
|
|
2
|
+
// `coveragePathIgnorePatterns` line `x new` wrote to hide the built chunk hides nothing true now.
|
|
3
|
+
// Removed with its comment where it stands as written; an edited bunfig.toml keeps its own.
|
|
4
|
+
|
|
5
|
+
import type { Codemod } from './codemod';
|
|
6
|
+
import type { SnippetEdit } from './engine-edits';
|
|
7
|
+
import { editSnippets } from './engine-edits';
|
|
8
|
+
|
|
9
|
+
const BUNFIG = 'bunfig.toml';
|
|
10
|
+
const PRELOAD = 'preload = ["@ultimat3/testing/preload"]';
|
|
11
|
+
|
|
12
|
+
export const BUNFIG_EDITS: readonly SnippetEdit[] = [
|
|
13
|
+
{
|
|
14
|
+
from: [
|
|
15
|
+
PRELOAD,
|
|
16
|
+
'# An island is mounted from a BUILT chunk that `mountIsland` writes to a temp .mjs, so',
|
|
17
|
+
'# `bun test --coverage` reports that file: two minified lines, under a name no source has. Bun',
|
|
18
|
+
'# does not remap a pre-built module through its sourcemap (measured on 1.4.0, and the build does',
|
|
19
|
+
"# emit one), so the row can only ever be noise — the island's own .island.tsx is not what it",
|
|
20
|
+
'# describes. Ignoring it removes the phantom; it hides no line any test was covering.',
|
|
21
|
+
'coveragePathIgnorePatterns = ["**/*.mjs"]',
|
|
22
|
+
].join('\n'),
|
|
23
|
+
// No newline at either end: a bunfig.toml whose last line is the ignore still matches.
|
|
24
|
+
to: PRELOAD,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export const codemod: Codemod = {
|
|
29
|
+
id: 'bunfig-island-coverage',
|
|
30
|
+
since: '31.27.0',
|
|
31
|
+
summary: `${BUNFIG}: the island-chunk coverage ignore goes, now that island coverage maps to its source`,
|
|
32
|
+
run: (app) => editSnippets(app, BUNFIG, BUNFIG_EDITS),
|
|
33
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// 31.18.0: every chart ships a Grafana dashboard (`dashboards/ultimate-app.json`, its ConfigMap,
|
|
2
|
+
// off by default) and a `dashboard:` values block. A chart that predates it gains all three, as
|
|
3
|
+
// `x g chart-dashboard` writes them; a file or key the app already holds is the app's.
|
|
4
|
+
|
|
5
|
+
import { stringField } from '@ultimat3/core';
|
|
6
|
+
import { CHART_FILE, missingValueBlocks, VALUES_FILE } from '../generate-chart-alerts';
|
|
7
|
+
import { helmDashboardFiles } from '../templates/chart-dashboard';
|
|
8
|
+
import { names } from '../templates/naming';
|
|
9
|
+
import type { Codemod, CodemodApp, CodemodResult } from './codemod';
|
|
10
|
+
import { mergeResults, writeIfAbsent } from './engine-edits';
|
|
11
|
+
|
|
12
|
+
const NOTHING: CodemodResult = { changed: [], skipped: [] };
|
|
13
|
+
|
|
14
|
+
/** The values.yaml line `x new` writes right after the monitoring blocks. */
|
|
15
|
+
const BEFORE = "# The image's `bun` user, the same uid as the Dockerfile's USER";
|
|
16
|
+
|
|
17
|
+
/** The chart's `name`, which its helpers are named after; undefined when it declares none. */
|
|
18
|
+
export const chartName = (source: string): string | undefined => {
|
|
19
|
+
let parsed: unknown;
|
|
20
|
+
try {
|
|
21
|
+
parsed = Bun.YAML.parse(source);
|
|
22
|
+
} catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const name = stringField(parsed, 'name');
|
|
26
|
+
return name !== undefined && /^[a-z0-9][a-z0-9-]*$/.test(name) ? name : undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
async function valuesBlock(app: CodemodApp): Promise<CodemodResult> {
|
|
30
|
+
const values = await app.read(VALUES_FILE);
|
|
31
|
+
if (values === undefined) return NOTHING;
|
|
32
|
+
const blocks = missingValueBlocks(values, 'chart-dashboard');
|
|
33
|
+
if (blocks === '') return NOTHING;
|
|
34
|
+
// Where `x new` puts it, before the pod security block; past an edited values.yaml, at its end.
|
|
35
|
+
const at = values.indexOf(BEFORE);
|
|
36
|
+
const next =
|
|
37
|
+
at === -1
|
|
38
|
+
? `${values.trimEnd()}\n\n${blocks.trimEnd()}\n`
|
|
39
|
+
: `${values.slice(0, at)}${blocks}${values.slice(at)}`;
|
|
40
|
+
await app.write(VALUES_FILE, next);
|
|
41
|
+
return { changed: [VALUES_FILE], skipped: [] };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const codemod: Codemod = {
|
|
45
|
+
id: 'chart-dashboard',
|
|
46
|
+
since: '31.18.0',
|
|
47
|
+
summary:
|
|
48
|
+
'docker/helm gains the Grafana dashboard: dashboards/ultimate-app.json, templates/dashboard-configmap.yaml and a dashboard: block in values.yaml (off by default)',
|
|
49
|
+
async run(app) {
|
|
50
|
+
const chart = await app.read(CHART_FILE);
|
|
51
|
+
if (chart === undefined) return NOTHING;
|
|
52
|
+
const name = chartName(chart);
|
|
53
|
+
if (name === undefined) {
|
|
54
|
+
return {
|
|
55
|
+
changed: [],
|
|
56
|
+
skipped: [
|
|
57
|
+
{
|
|
58
|
+
path: CHART_FILE,
|
|
59
|
+
reason:
|
|
60
|
+
'it declares no chart name of lowercase letters, digits and hyphens, and the dashboard ConfigMap is named after it: set name:, then run x g chart-dashboard',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const written: CodemodResult[] = [];
|
|
66
|
+
for (const file of helmDashboardFiles(names(name))) {
|
|
67
|
+
if (typeof file.contents === 'string') {
|
|
68
|
+
written.push(await writeIfAbsent(app, file.path, file.contents));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return mergeResults([...written, await valuesBlock(app)]);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// `.github/workflows/ci.yml` as `x new` wrote it from 31.4.0 through 31.15.x — one job, the whole
|
|
2
|
+
// gate on one runner — kept byte for byte (the app's name as `<APP>`) so a workflow still exactly
|
|
3
|
+
// that is recognised and replaced whole by today's, and an edited one is not.
|
|
4
|
+
|
|
5
|
+
// biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub Actions' own ${{ … }}, never a JS template
|
|
6
|
+
|
|
7
|
+
/** The app's name stands where the scaffold wrote it; every `bun-version:` line is compared apart. */
|
|
8
|
+
export const CI_31_15_LINES: readonly string[] = [
|
|
9
|
+
'name: ci',
|
|
10
|
+
'',
|
|
11
|
+
'# The gate for <APP>: the same two commands `README.md` tells a human to run, in the same',
|
|
12
|
+
'# order, on a machine that has never seen this repository. A check that exists only in CI is one',
|
|
13
|
+
"# nobody can reproduce locally, and a CI file that restates the gate's steps is a second gate.",
|
|
14
|
+
'#',
|
|
15
|
+
'# `bun run verify` is `x verify`, the whole gate. Its `budgets` step runs',
|
|
16
|
+
'# `x build --target static` itself when `.x/build-stats.json` is missing or older than the source,',
|
|
17
|
+
'# which on a fresh runner it always is, so no build step comes first.',
|
|
18
|
+
'#',
|
|
19
|
+
'# `bun run setup` brings up embedded Postgres in-process; the TEST services come from',
|
|
20
|
+
'# `docker/docker-compose.test.yml` — Postgres 18, Redis, NATS and S3 in RAM, durability and logs',
|
|
21
|
+
'# off — started by the same two lines a laptop runs, never a `services:` block that restates them.',
|
|
22
|
+
'',
|
|
23
|
+
"# EVERY push, not just the default branch's. `x new` runs a plain `git init` and takes whatever",
|
|
24
|
+
'# `init.defaultBranch` this machine already agreed on, so a `branches: [main]` filter silently',
|
|
25
|
+
'# runs nothing on a repository whose branch is called something else — and `CLAUDE.md` promises a',
|
|
26
|
+
'# run on every push, which a filter would make untrue for the app that read it.',
|
|
27
|
+
'on:',
|
|
28
|
+
' push:',
|
|
29
|
+
' pull_request:',
|
|
30
|
+
'',
|
|
31
|
+
'# A newer push to a branch makes the run already in flight for it worthless, so it is cancelled —',
|
|
32
|
+
'# except on the default branch, where every commit keeps its own verdict: that group is keyed by',
|
|
33
|
+
'# SHA, so nothing there can supersede anything.',
|
|
34
|
+
'concurrency:',
|
|
35
|
+
" group: ci-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || github.ref }}",
|
|
36
|
+
' cancel-in-progress: true',
|
|
37
|
+
'',
|
|
38
|
+
'permissions:',
|
|
39
|
+
' contents: read',
|
|
40
|
+
'',
|
|
41
|
+
'jobs:',
|
|
42
|
+
' check:',
|
|
43
|
+
' # A branch in THIS repository with an open pull request fires both events for one commit, and',
|
|
44
|
+
' # the push run already gates that exact tree — so the pull_request run is skipped, not paid for',
|
|
45
|
+
' # twice. A pull request from a FORK fires no push here, and it still runs.',
|
|
46
|
+
" if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository",
|
|
47
|
+
' # A free GitHub-hosted runner unless the repository variable `CI_RUNNER` names another label.',
|
|
48
|
+
" runs-on: ${{ vars.CI_RUNNER || 'ubuntu-latest' }}",
|
|
49
|
+
" # A bound on a HANG, not on cost: a step that never returns holds a runner until GitHub's",
|
|
50
|
+
' # six-hour default expires, and the failure is invisible for all six of them.',
|
|
51
|
+
' timeout-minutes: 20',
|
|
52
|
+
' steps:',
|
|
53
|
+
' - uses: actions/checkout@v7',
|
|
54
|
+
' - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0',
|
|
55
|
+
' with:',
|
|
56
|
+
" # `package.json`'s `engines.bun` floor, exactly — the OLDEST runtime this app declares",
|
|
57
|
+
' # it supports, so a call that needs a newer Bun fails here rather than in the install of',
|
|
58
|
+
' # whoever took the app at its word. Never `latest`: a Bun minor landing unannounced is a',
|
|
59
|
+
' # runtime change nobody chose.',
|
|
60
|
+
" bun-version: '1.4.4'",
|
|
61
|
+
" # Bun's download cache, keyed on the lockfile: `bun run setup`'s install then links from",
|
|
62
|
+
' # disk instead of fetching every package again on every run.',
|
|
63
|
+
' - uses: actions/cache@v6',
|
|
64
|
+
' with:',
|
|
65
|
+
' path: ~/.bun/install/cache',
|
|
66
|
+
" key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}",
|
|
67
|
+
' restore-keys: bun-${{ runner.os }}-',
|
|
68
|
+
' # Two steps rather than one `&&`, so the log names which half failed and times each.',
|
|
69
|
+
' - run: bun run setup',
|
|
70
|
+
' # `--wait` returns once every healthcheck passes; the env file points the suites at them.',
|
|
71
|
+
' - run: docker compose -f docker/docker-compose.test.yml up -d --wait',
|
|
72
|
+
' - run: cat docker/test-services.env >> "$GITHUB_ENV"',
|
|
73
|
+
' - run: bun run verify',
|
|
74
|
+
'',
|
|
75
|
+
];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// 31.27.0: the CI part that runs `e2e` requires a browser (`E2E_BROWSER_REQUIRED=1`), so a runner
|
|
2
|
+
// with no Chrome is red with the command that locates one — never a step that skipped and passed.
|
|
3
|
+
// One step inserted after the test services start; the one-job workflow of 31.4–31.15, still
|
|
4
|
+
// byte for byte, is replaced whole by today's. An edited workflow is reported with the diff.
|
|
5
|
+
|
|
6
|
+
import { CI_WORKFLOW_PATH, githubFiles } from '../templates/github/ci.yml';
|
|
7
|
+
import { names } from '../templates/naming';
|
|
8
|
+
import { appName } from './agents-dev-mcp';
|
|
9
|
+
import { CI_31_15_LINES } from './ci-e2e-browser-stock';
|
|
10
|
+
import type { Codemod, CodemodApp, CodemodResult } from './codemod';
|
|
11
|
+
import type { FileText, SnippetEdit } from './engine-edits';
|
|
12
|
+
import { editSnippets, readText } from './engine-edits';
|
|
13
|
+
|
|
14
|
+
const CI = CI_WORKFLOW_PATH;
|
|
15
|
+
|
|
16
|
+
const lines = (...text: readonly string[]): string => text.join('\n');
|
|
17
|
+
|
|
18
|
+
const START = lines(
|
|
19
|
+
' docker compose -f docker/docker-compose.test.yml up -d --wait',
|
|
20
|
+
' cat docker/test-services.env >> "$GITHUB_ENV"',
|
|
21
|
+
);
|
|
22
|
+
const NEXT =
|
|
23
|
+
' # Under $RUNNER_TEMP, never in the checkout, where `lint` would walk the open file.';
|
|
24
|
+
|
|
25
|
+
export const CI_E2E_EDITS: readonly SnippetEdit[] = [
|
|
26
|
+
{
|
|
27
|
+
from: lines(START, NEXT),
|
|
28
|
+
to: lines(
|
|
29
|
+
START,
|
|
30
|
+
' # ubuntu-latest ships Chrome, and the `e2e` step finds it. Required here, so a runner that',
|
|
31
|
+
' # has none (a `CI_RUNNER` label) is red with the command that locates one — never a skip.',
|
|
32
|
+
" - if: contains(matrix.only, 'e2e')",
|
|
33
|
+
' run: echo "E2E_BROWSER_REQUIRED=1" >> "$GITHUB_ENV"',
|
|
34
|
+
NEXT,
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/** Every `bun-version:` line alike: a runtime-pin codemod may have moved it already. */
|
|
40
|
+
const pinless = (text: string): string => text.replace(/^(\s*bun-version:).*$/gm, '$1');
|
|
41
|
+
|
|
42
|
+
/** Today's workflow, when the app's is still the 31.4–31.15 one-job workflow exactly. */
|
|
43
|
+
async function wholeFile(app: CodemodApp, held: FileText): Promise<CodemodResult | undefined> {
|
|
44
|
+
const name = appName((await readText(app, 'package.json'))?.text ?? '');
|
|
45
|
+
if (name === undefined) return undefined;
|
|
46
|
+
const stock = CI_31_15_LINES.map((line) => line.replace('<APP>', name)).join('\n');
|
|
47
|
+
if (pinless(held.text) !== pinless(stock)) return undefined;
|
|
48
|
+
const today = githubFiles(names(name)).find((file) => file.path === CI)?.contents;
|
|
49
|
+
if (typeof today !== 'string') return undefined;
|
|
50
|
+
await app.write(CI, held.restore(today));
|
|
51
|
+
return { changed: [CI], skipped: [] };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const codemod: Codemod = {
|
|
55
|
+
id: 'ci-e2e-browser',
|
|
56
|
+
since: '31.27.0',
|
|
57
|
+
summary: `${CI}: the part that runs e2e requires a browser, so a runner with none is red, never skipped`,
|
|
58
|
+
async run(app) {
|
|
59
|
+
const held = await readText(app, CI);
|
|
60
|
+
if (held === undefined) return { changed: [], skipped: [] };
|
|
61
|
+
return (await wholeFile(app, held)) ?? editSnippets(app, CI, CI_E2E_EDITS);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// The codemod contract: a template change an app keeps, carried across by a pure function over an
|
|
2
|
+
// app it can read and write but never touch directly — so the engine can dry-run, report and diff.
|
|
3
|
+
// Every migration is one `codemods/<id>.ts` exporting `const codemod: Codemod`; `index.ts` lists them.
|
|
4
|
+
|
|
5
|
+
/** The app a codemod sees. Paths are app-root relative, posix separators. */
|
|
6
|
+
export interface CodemodApp {
|
|
7
|
+
readonly root: string;
|
|
8
|
+
read(path: string): Promise<string | undefined>;
|
|
9
|
+
write(path: string, source: string): Promise<void>;
|
|
10
|
+
remove(path: string): Promise<void>;
|
|
11
|
+
exists(path: string): Promise<boolean>;
|
|
12
|
+
glob(pattern: string): Promise<readonly string[]>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A file a codemod would not overwrite (app-edited, unrecognised), with the change it wanted. */
|
|
16
|
+
export interface CodemodSkip {
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly reason: string;
|
|
19
|
+
readonly diff?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CodemodResult {
|
|
23
|
+
readonly changed: string[];
|
|
24
|
+
readonly skipped: CodemodSkip[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Codemod {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
/** The framework version whose template change this carries an app across. */
|
|
30
|
+
readonly since: string;
|
|
31
|
+
readonly summary: string;
|
|
32
|
+
run(app: CodemodApp): Promise<CodemodResult>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** An in-memory `CodemodApp` for tests: `files` is the app, mutated in place. */
|
|
36
|
+
export function memoryCodemodApp(
|
|
37
|
+
files: Record<string, string>,
|
|
38
|
+
root = '/app',
|
|
39
|
+
): CodemodApp & { readonly files: Record<string, string> } {
|
|
40
|
+
return {
|
|
41
|
+
root,
|
|
42
|
+
files,
|
|
43
|
+
read: async (path) => (Object.hasOwn(files, path) ? files[path] : undefined),
|
|
44
|
+
write: async (path, source) => {
|
|
45
|
+
files[path] = source;
|
|
46
|
+
},
|
|
47
|
+
remove: async (path) => {
|
|
48
|
+
delete files[path];
|
|
49
|
+
},
|
|
50
|
+
exists: async (path) => Object.hasOwn(files, path),
|
|
51
|
+
glob: async (pattern) => {
|
|
52
|
+
const glob = new Bun.Glob(pattern);
|
|
53
|
+
return Object.keys(files)
|
|
54
|
+
.filter((path) => glob.match(path))
|
|
55
|
+
.sort();
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// 31.4.1: `defineError` comes from the `@ultimat3/core/page` leaf, which every bundle can load; the
|
|
2
|
+
// shipped `error-declared` guard refuses it from the `@ultimat3/core` barrel. A mechanical import
|
|
3
|
+
// rewrite over every app source file (the rest of an import stays put), and the prose that names it.
|
|
4
|
+
|
|
5
|
+
import type { Codemod, CodemodApp, CodemodResult } from './codemod';
|
|
6
|
+
import type { SnippetEdit } from './engine-edits';
|
|
7
|
+
import { editSnippets, mergeResults } from './engine-edits';
|
|
8
|
+
|
|
9
|
+
const IMPORT = /^import \{([^}]*)\} from '@ultimat3\/core';$/gm;
|
|
10
|
+
const LEAF = "import { defineError } from '@ultimat3/core/page';";
|
|
11
|
+
|
|
12
|
+
/** The rows that name where `defineError` comes from, in CLAUDE.md, the server agent and /feature. */
|
|
13
|
+
export const DEFINE_ERROR_PROSE: Readonly<Record<string, readonly SnippetEdit[]>> = {
|
|
14
|
+
'CLAUDE.md': [
|
|
15
|
+
{
|
|
16
|
+
from: '| Errors | never `throw new Error` — declare each code once, `defineError({ code, title, status, cause, fix })` from `@ultimat3/core`, and throw its class; never a handwritten `UltimateError` subclass | `guards/bare-error.ts`, `guards/error-declared.ts` |',
|
|
17
|
+
to: '| 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 | `guards/bare-error.ts`, `guards/error-declared.ts` |',
|
|
18
|
+
optional: true,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
'.claude/agents/server.md': [
|
|
22
|
+
{
|
|
23
|
+
from: '| Errors are instructions | never `throw new Error` — declare each code once with `defineError({ code, title, status, cause, fix })` from `@ultimat3/core`: a stable `X_SCREAMING_SNAKE` code, a cause and a `fix:` a caller can actually run. `guards/error-declared.ts` refuses a handwritten `UltimateError` subclass |',
|
|
24
|
+
to: '| 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. `guards/error-declared.ts` refuses a handwritten `UltimateError` subclass |',
|
|
25
|
+
optional: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
'.claude/commands/feature.md': [
|
|
29
|
+
{
|
|
30
|
+
from: 'Never a bare `throw new Error` — declare each code once with `defineError` from `@ultimat3/core`:',
|
|
31
|
+
to: 'Never a bare `throw new Error` — declare each code once with `defineError` from `@ultimat3/core/page`:',
|
|
32
|
+
optional: true,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** The import with `defineError` taken out to the leaf; unchanged when it does not name it. */
|
|
38
|
+
const rewrite = (whole: string, list: string): string => {
|
|
39
|
+
const names = list
|
|
40
|
+
.split(',')
|
|
41
|
+
.map((name) => name.trim())
|
|
42
|
+
.filter((name) => name !== '');
|
|
43
|
+
if (!names.includes('defineError')) return whole;
|
|
44
|
+
const rest = names.filter((name) => name !== 'defineError');
|
|
45
|
+
return rest.length === 0 ? LEAF : `import { ${rest.join(', ')} } from '@ultimat3/core';\n${LEAF}`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
async function sources(app: CodemodApp): Promise<CodemodResult> {
|
|
49
|
+
const changed: string[] = [];
|
|
50
|
+
for (const path of await app.glob('{apps,packages}/**/*.{ts,tsx}')) {
|
|
51
|
+
if (path.includes('node_modules/')) continue;
|
|
52
|
+
const source = (await app.read(path)) ?? '';
|
|
53
|
+
if (!source.includes('defineError')) continue;
|
|
54
|
+
const next = source.replace(IMPORT, rewrite);
|
|
55
|
+
if (next === source) continue;
|
|
56
|
+
await app.write(path, next);
|
|
57
|
+
changed.push(path);
|
|
58
|
+
}
|
|
59
|
+
return { changed, skipped: [] };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const codemod: Codemod = {
|
|
63
|
+
id: 'define-error-leaf',
|
|
64
|
+
since: '31.4.1',
|
|
65
|
+
summary: "defineError is imported from '@ultimat3/core/page', never the '@ultimat3/core' barrel",
|
|
66
|
+
async run(app) {
|
|
67
|
+
const results = [await sources(app)];
|
|
68
|
+
for (const [path, edits] of Object.entries(DEFINE_ERROR_PROSE)) {
|
|
69
|
+
results.push(await editSnippets(app, path, edits));
|
|
70
|
+
}
|
|
71
|
+
return mergeResults(results);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// 31.17.0: CI runs the gate cut into parts (`verify plan`, a runner per part, `verify merge`), so
|
|
2
|
+
// the app's CLAUDE.md, README.md and /feature say so, and CLAUDE.md gains the Fan-out row. Prose:
|
|
3
|
+
// each edit lands where the text stands as `x new` wrote it, and is skipped silently elsewhere.
|
|
4
|
+
|
|
5
|
+
import type { Codemod } from './codemod';
|
|
6
|
+
import type { SnippetEdit } from './engine-edits';
|
|
7
|
+
import { editSnippets, mergeResults } from './engine-edits';
|
|
8
|
+
|
|
9
|
+
const lines = (...text: readonly string[]): string => text.join('\n');
|
|
10
|
+
|
|
11
|
+
const REPOS =
|
|
12
|
+
'| Repos | a `repo.ts` reads through the typed handle, never a `sql` literal the handle can express | `guards/repo-raw-sql.ts` |';
|
|
13
|
+
|
|
14
|
+
export const DOCS_CI_PARTS_EDITS: Readonly<Record<string, readonly SnippetEdit[]>> = {
|
|
15
|
+
'CLAUDE.md': [
|
|
16
|
+
{
|
|
17
|
+
from: '| One gate | `bun run verify` — `bunx x verify`, which builds what its `budgets` step weighs. Green means shippable; never merge red. CI runs the same two commands as your terminal: `bun run setup && bun run verify` | the gate itself, and `.github/workflows/ci.yml` on every push and pull request; `.github/workflows/image.yml` publishes only a commit it passed |',
|
|
18
|
+
to: '| One gate | `bun run verify` — `bunx x verify`, which builds what its `budgets` step weighs. Green means shippable; never merge red. CI runs the same gate, cut into parts: `bun run verify plan --json` names them, each runner runs `bun run setup && bun run verify --only <steps>`, and `bun run verify merge` is the verdict | the gate itself, and `.github/workflows/ci.yml` on every push and pull request; `.github/workflows/image.yml` publishes only a commit it passed |',
|
|
19
|
+
optional: true,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
from: REPOS,
|
|
23
|
+
to: lines(
|
|
24
|
+
REPOS,
|
|
25
|
+
'| 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 | `guards/unbounded-fanout.ts` |',
|
|
26
|
+
),
|
|
27
|
+
optional: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
'README.md': [
|
|
31
|
+
{
|
|
32
|
+
from: '| `.github/workflows/ci.yml` | `bun run setup` then `bun run verify`, on push and pull request |',
|
|
33
|
+
to: '| `.github/workflows/ci.yml` | on push and pull request: `bun run verify plan` cuts the gate into parts, each runner runs `bun run setup` then its `bun run verify --only …`, and `bun run verify merge` folds them into the one verdict |',
|
|
34
|
+
optional: true,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
'.claude/commands/feature.md': [
|
|
38
|
+
{
|
|
39
|
+
from: lines(
|
|
40
|
+
'`.x/build-stats.json` is missing or older than the source. CI runs this same script —',
|
|
41
|
+
'`.github/workflows/ci.yml` is `bun run setup` and then `bun run verify`, nothing else.',
|
|
42
|
+
),
|
|
43
|
+
to: lines(
|
|
44
|
+
'`.x/build-stats.json` is missing or older than the source. CI runs this same script, cut into',
|
|
45
|
+
'parts — `.github/workflows/ci.yml` asks `bun run verify plan` for them, runs `bun run setup` and',
|
|
46
|
+
"each part's `bun run verify --only …`, and `bun run verify merge` is the verdict.",
|
|
47
|
+
),
|
|
48
|
+
optional: true,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const codemod: Codemod = {
|
|
54
|
+
id: 'docs-ci-parts',
|
|
55
|
+
since: '31.17.0',
|
|
56
|
+
summary:
|
|
57
|
+
'CLAUDE.md, README.md and /feature describe CI as the gate cut into parts; CLAUDE.md gains Fan-out',
|
|
58
|
+
async run(app) {
|
|
59
|
+
const results = [];
|
|
60
|
+
for (const [path, edits] of Object.entries(DOCS_CI_PARTS_EDITS)) {
|
|
61
|
+
results.push(await editSnippets(app, path, edits));
|
|
62
|
+
}
|
|
63
|
+
return mergeResults(results);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// 31.22.0: the app's CLAUDE.md states the refusal rule in one line, the Repos row names the two
|
|
2
|
+
// repo guards that report, and the paragraph `bunx x verify` already says of itself is gone.
|
|
3
|
+
// Prose the app may have reworded: each edit lands where the text stands as `x new` wrote it.
|
|
4
|
+
|
|
5
|
+
import type { Codemod } from './codemod';
|
|
6
|
+
import type { SnippetEdit } from './engine-edits';
|
|
7
|
+
import { editSnippets } from './engine-edits';
|
|
8
|
+
|
|
9
|
+
const lines = (...text: readonly string[]): string => text.join('\n');
|
|
10
|
+
|
|
11
|
+
const COMMANDS =
|
|
12
|
+
'Commands: `bun run setup`, `bun run dev`, `bun run verify`, `bunx x g <primitive>`,';
|
|
13
|
+
|
|
14
|
+
export const DOCS_GATE_EDITS: readonly SnippetEdit[] = [
|
|
15
|
+
{
|
|
16
|
+
from: lines(
|
|
17
|
+
'Every row below names what refuses it. A rule with nothing in the last column is a rule that does',
|
|
18
|
+
'not exist — five of these had an empty column and were each measured green on `bunx x verify`.',
|
|
19
|
+
),
|
|
20
|
+
to: lines(
|
|
21
|
+
'Every row below names what refuses it. A rule with nothing in the last column does not exist.',
|
|
22
|
+
),
|
|
23
|
+
optional: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
from: lines(
|
|
27
|
+
'| Repos | a `repo.ts` reads through the typed handle, never a `sql` literal the handle can express | `guards/repo-raw-sql.ts` |',
|
|
28
|
+
),
|
|
29
|
+
to: lines(
|
|
30
|
+
"| 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)`) | `guards/repo-raw-sql.ts`, `guards/repo-await-in-loop.ts`, `guards/repo-unbounded.ts` |",
|
|
31
|
+
),
|
|
32
|
+
optional: true,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
from: lines(
|
|
36
|
+
'`bun run verify` is `bunx x verify`, the whole gate: its `budgets` step runs',
|
|
37
|
+
'`bunx x build --target static` itself when `.x/build-stats.json` is missing or older than the',
|
|
38
|
+
'source, so nothing has to be built first.',
|
|
39
|
+
'',
|
|
40
|
+
COMMANDS,
|
|
41
|
+
),
|
|
42
|
+
// Matched with the line after it: an empty `to` would read as already done.
|
|
43
|
+
to: COMMANDS,
|
|
44
|
+
optional: true,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const codemod: Codemod = {
|
|
49
|
+
id: 'docs-gate-prose',
|
|
50
|
+
since: '31.22.0',
|
|
51
|
+
summary: 'CLAUDE.md: the refusal rule in one line, the Repos row with its reporting guards',
|
|
52
|
+
run: (app) => editSnippets(app, 'CLAUDE.md', DOCS_GATE_EDITS),
|
|
53
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// 31.14.0–31.15.0: an island re-reads a query on a timer through `useQuery`'s `poll`, and a mount
|
|
2
|
+
// replaces server markup through `mountOver` — two CLAUDE.md rows. Prose: each lands where the
|
|
3
|
+
// text stands as `x new` wrote it, and is skipped silently where the app reworded it.
|
|
4
|
+
|
|
5
|
+
import type { Codemod } from './codemod';
|
|
6
|
+
import type { SnippetEdit } from './engine-edits';
|
|
7
|
+
import { editSnippets } from './engine-edits';
|
|
8
|
+
|
|
9
|
+
const ISLANDS =
|
|
10
|
+
'| Islands | every `*.island.tsx` has a sibling `*.island.states.ts`, so `bunx x shot --island` can photograph its failures | `guards/island-without-states.ts` |';
|
|
11
|
+
|
|
12
|
+
export const DOCS_ISLAND_EDITS: readonly SnippetEdit[] = [
|
|
13
|
+
{
|
|
14
|
+
from: '| Polling | an island re-reads on a timer 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 | `guards/raw-interval.ts` |',
|
|
15
|
+
to: '| 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 | `guards/raw-interval.ts` |',
|
|
16
|
+
optional: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
from: ISLANDS,
|
|
20
|
+
to: `${ISLANDS}\n| Island mounts | a \`mount\` replaces its server markup through \`mountOver\`, so a render that throws shows the server's HTML, not a blank box | \`guards/island-mount-clears.ts\` |`,
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const codemod: Codemod = {
|
|
26
|
+
id: 'docs-island-rows',
|
|
27
|
+
since: '31.15.0',
|
|
28
|
+
summary:
|
|
29
|
+
"CLAUDE.md's Polling row names useQuery's poll, and an Island mounts row joins the table",
|
|
30
|
+
run: (app) => editSnippets(app, 'CLAUDE.md', DOCS_ISLAND_EDITS),
|
|
31
|
+
};
|