@ultimat3/cli 30.9.0 → 31.0.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 +75 -64
- package/README.md +4 -1
- package/package.json +30 -29
- package/src/admin-registration.ts +1 -1
- package/src/affected.ts +5 -1
- package/src/app-boundaries.ts +88 -9
- package/src/app-load-async.ts +133 -0
- package/src/app-load-batch.ts +203 -0
- package/src/app-load-prebuilt.ts +147 -0
- package/src/app-load-register.ts +175 -0
- package/src/app-load.ts +143 -175
- package/src/app-loader-imports.ts +31 -0
- package/src/app-root.ts +13 -0
- package/src/app-runtime.ts +5 -1
- package/src/boundary-findings.ts +12 -0
- package/src/browser-launcher-port.ts +3 -7
- package/src/browser-launcher.ts +1 -1
- package/src/budgets-scan.ts +8 -0
- package/src/budgets.ts +10 -1
- package/src/build-registry-background.ts +59 -0
- package/src/build-registry.ts +207 -0
- package/src/cdp-shot-clock.ts +3 -11
- package/src/cdp-shot-driver.ts +3 -2
- package/src/cdp-shot-element.ts +3 -2
- package/src/cdp-shot-page.ts +2 -2
- package/src/cdp-shot-watch.ts +4 -3
- package/src/cmd-auth.ts +3 -3
- package/src/cmd-db-recount.ts +15 -0
- package/src/cmd-drill.ts +10 -6
- package/src/cmd-exercise.ts +2 -1
- package/src/cmd-generate-spec.ts +6 -0
- package/src/cmd-generate.ts +22 -4
- package/src/cmd-mail.ts +1 -1
- package/src/cmd-routes.ts +2 -2
- package/src/cmd-secrets-spec.ts +4 -1
- package/src/cmd-shot.ts +14 -4
- package/src/cmd-verify-spec.ts +21 -1
- package/src/cmd-verify.ts +16 -4
- package/src/coverage-source.ts +4 -1
- package/src/db-diagnostics.ts +8 -1
- package/src/dev-boot.ts +29 -15
- package/src/dev-dashboard-invalidations.ts +43 -0
- package/src/dev-dashboard.ts +13 -16
- package/src/dev-n-plus-one.ts +7 -3
- package/src/dev-rebuild.ts +2 -1
- package/src/dev-route-table.ts +1 -1
- package/src/dev-traces.ts +16 -15
- package/src/document-options.ts +12 -1
- package/src/drift-store.ts +55 -0
- package/src/error-catalog.ts +8 -3
- package/src/error-codes-boundary.ts +32 -0
- package/src/error-codes.ts +23 -19
- package/src/errors.ts +17 -7
- package/src/exercise-database.ts +13 -1
- package/src/exercise-findings.ts +36 -18
- package/src/exercise-services.ts +84 -0
- package/src/exercise-subject.ts +38 -13
- package/src/failure-capture-boot.ts +9 -5
- package/src/framework-schema.ts +5 -5
- package/src/generate-exercise.ts +1 -1
- package/src/generate-files.ts +27 -7
- package/src/generate-kinds.ts +5 -0
- package/src/generate-refresh.ts +53 -0
- package/src/generate-workspace.ts +169 -0
- package/src/generate-write.ts +8 -2
- package/src/hold.ts +19 -8
- package/src/image-prepare.ts +6 -2
- package/src/index.ts +5 -20
- package/src/island-bundle.ts +7 -3
- package/src/island-capture.ts +2 -2
- package/src/island-harness.ts +1 -1
- package/src/job-registration.ts +43 -6
- package/src/jobs-driver.ts +4 -5
- package/src/mcp-errors.ts +18 -4
- package/src/mcp-host.ts +5 -1
- package/src/mcp-ui-interact.ts +3 -0
- package/src/messages-gate.ts +4 -0
- package/src/new-shapes-generate.ts +1 -1
- package/src/otlp-export.ts +94 -29
- package/src/output.ts +3 -7
- package/src/page-sync.ts +3 -1
- package/src/role-load.ts +17 -11
- package/src/role-start.ts +5 -4
- package/src/role-sync.ts +7 -8
- package/src/route-islands-preload.ts +46 -0
- package/src/route-islands.ts +6 -2
- package/src/runtime-admin.ts +5 -1
- package/src/runtime-bindings.ts +25 -19
- package/src/runtime-boot-ports.ts +66 -0
- package/src/runtime-bus.ts +29 -5
- package/src/runtime-cache-bus.ts +53 -0
- package/src/runtime-cache.ts +43 -13
- package/src/runtime-isr-outcome.ts +5 -4
- package/src/runtime-jobs.ts +2 -2
- package/src/runtime-keys.ts +37 -0
- package/src/runtime-overrides.ts +148 -42
- package/src/runtime-port-bindings-queue.ts +36 -0
- package/src/runtime-port-bindings.ts +117 -0
- package/src/runtime-ports.ts +164 -0
- package/src/runtime-purge.ts +41 -28
- package/src/runtime-push.ts +7 -3
- package/src/runtime-queue.ts +70 -55
- package/src/runtime-realtime.ts +5 -5
- package/src/runtime-render-document.ts +4 -1
- package/src/runtime-services.ts +110 -158
- package/src/runtime-storage-boot.ts +111 -0
- package/src/runtime-storage-upload.ts +9 -7
- package/src/runtime-storage.ts +7 -1
- package/src/serve-boot.ts +8 -4
- package/src/serve-entry.ts +3 -0
- package/src/serve-env.ts +47 -14
- package/src/serve-prebuilt-paths.ts +3 -0
- package/src/serve-prebuilt.ts +15 -4
- package/src/serve.ts +2 -2
- package/src/static-cards.ts +3 -2
- package/src/static-report.ts +2 -2
- package/src/style-bundle.ts +1 -1
- package/src/sync-authenticator.ts +17 -18
- package/src/templates/action-tests.ts +4 -4
- package/src/templates/backfill.ts +5 -8
- package/src/templates/entity.ts +3 -0
- package/src/templates/github/ci.yml.ts +3 -1
- package/src/templates/github/dependabot.yml.ts +73 -0
- package/src/templates/job.ts +13 -22
- package/src/templates/naming.ts +20 -1
- package/src/templates/pinned/docker-compose.yml +1 -1
- package/src/templates/query.ts +7 -8
- package/src/templates/route.ts +5 -3
- package/src/templates/scaffold-api.ts +1 -1
- package/src/templates/scaffold-auth.ts +5 -3
- package/src/templates/scaffold-claude-commands.ts +6 -3
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +2 -4
- package/src/templates/scaffold-domain-package.ts +1 -1
- package/src/templates/scaffold-entries.ts +6 -1
- package/src/templates/scaffold-helm-fences.ts +3 -2
- package/src/templates/scaffold-helm.ts +35 -6
- package/src/templates/scaffold-repo.ts +47 -135
- package/src/templates/scaffold-runtime-ports.ts +62 -0
- package/src/templates/scaffold-verify-floor.ts +97 -0
- package/src/templates/shapes/overlay.ts +1 -1
- package/src/templates/sign-in-oidc.ts +5 -3
- package/src/templates/sign-in-shared.ts +28 -10
- package/src/templates/workspace.ts +75 -0
- package/src/test-ignores.ts +5 -2
- package/src/test-select.ts +4 -1
- package/src/upgrade-gate.ts +30 -5
- package/src/upgrade-report.ts +7 -1
- package/src/verify-changed-facts.ts +53 -0
- package/src/verify-changed-scope.ts +161 -0
- package/src/verify-changed.ts +174 -0
- package/src/verify-checks.ts +31 -19
- package/src/verify-drift-owner.ts +30 -0
- package/src/verify-e2e.ts +2 -1
- package/src/verify-factories.ts +86 -0
- package/src/verify-run.ts +13 -11
- package/src/verify-step.ts +13 -0
- package/src/verify-tests.ts +58 -6
- package/src/write-line.ts +21 -6
- package/wiki/Actions.md +2 -2
- package/wiki/Adapters.md +400 -0
- package/wiki/Admin-Dashboard.md +1 -1
- package/wiki/Agents.md +9 -9
- package/wiki/Auth.md +78 -2
- package/wiki/Building-Your-Own-Base.md +1 -1
- package/wiki/CLI-Reference.md +34 -7
- package/wiki/Caching-And-Invalidation.md +17 -5
- package/wiki/Compared.md +8 -2
- package/wiki/Configuration.md +14 -14
- package/wiki/Deployment.md +28 -1
- package/wiki/Entities-And-Migrations.md +47 -1
- package/wiki/FAQ.md +8 -2
- package/wiki/Feature-Flags.md +1 -1
- package/wiki/Home.md +3 -2
- package/wiki/Jobs-And-Workflows.md +107 -6
- package/wiki/Known-Gaps.md +4 -3
- package/wiki/MCP-And-AI.md +18 -4
- package/wiki/Mail.md +14 -5
- package/wiki/Migrations-And-Backfills.md +29 -4
- package/wiki/Money.md +2 -0
- package/wiki/N-Plus-One-Detection.md +24 -22
- package/wiki/Notify.md +28 -4
- package/wiki/Observability.md +121 -15
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +9 -4
- package/wiki/Routes-And-Render-Modes.md +5 -0
- package/wiki/Scraping.md +57 -11
- package/wiki/Shapes.md +2 -2
- package/wiki/Stability.md +7 -5
- package/wiki/Storage-And-Uploads.md +56 -4
- package/wiki/Testing.md +65 -52
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Tutorial-01-First-App.md +1 -1
- package/wiki/Tutorial-04-Jobs-And-Realtime.md +1 -1
- package/wiki/Tutorial-05-Deploy-Free.md +1 -1
- package/wiki/Tutorial-06-Growing-Up.md +8 -8
- package/wiki/Upgrading.md +129 -4
|
@@ -87,8 +87,9 @@ bun run verify --json # the same, machine-readable
|
|
|
87
87
|
|
|
88
88
|
Red is instructions, not a verdict: **every finding carries an executable \`fix:\` — run it verbatim
|
|
89
89
|
before improvising**, and \`bunx x errors explain <CODE>\` expands any code it names. Never narrow the gate
|
|
90
|
-
to make it pass:
|
|
91
|
-
|
|
90
|
+
to make it pass: \`--only <step>\` narrows feedback and prints \`NOT A GATE RUN\`, so it is never the
|
|
91
|
+
verdict; there is no \`--skip\`, on purpose; disabling a lint rule or loosening a compiler flag is the
|
|
92
|
+
same move wearing a different hat.
|
|
92
93
|
|
|
93
94
|
While you iterate, narrow the *feedback*, not the gate:
|
|
94
95
|
|
|
@@ -97,6 +98,7 @@ While you iterate, narrow the *feedback*, not the gate:
|
|
|
97
98
|
| one test file | \`bun test <path>/<file>.test.ts\` |
|
|
98
99
|
| one test by name | \`bun test -t '<name>'\` |
|
|
99
100
|
| a whole type | \`bunx x test unit\` · \`bunx x test contract\` · \`bunx x test e2e\` |
|
|
101
|
+
| one gate step | \`bunx x verify --only <step> --json\` — \`NOT A GATE RUN\` |
|
|
100
102
|
| lint the files you touched | \`bunx biome check --write <paths>\` |
|
|
101
103
|
| types, once, when otherwise done | \`bun run typecheck\` |
|
|
102
104
|
| a broken environment | \`bunx x doctor\` |
|
|
@@ -213,7 +215,8 @@ executable \`fix:\` — **run the \`fix:\` verbatim before improvising**, and us
|
|
|
213
215
|
when the cause is not enough. \`bun run verify --json\` gives the same steps machine-readably; \`bunx x doctor\`
|
|
214
216
|
covers the case where the environment, not the code, is what is broken.
|
|
215
217
|
|
|
216
|
-
Do not narrow the gate to make it pass.
|
|
218
|
+
Do not narrow the gate to make it pass. \`bunx x verify --only <step>\` re-runs one step while you fix it,
|
|
219
|
+
and says \`NOT A GATE RUN\`: green is the run with no flag. There is no \`--skip\`; disabling a lint rule,
|
|
217
220
|
loosening a compiler flag, or deleting an assertion is the same evasion. Fix the code.
|
|
218
221
|
|
|
219
222
|
Report one line per fix: the code, the file, what changed.
|
|
@@ -116,10 +116,10 @@ means it rewrites that file in place** — the same safe fixes \`biome check --w
|
|
|
116
116
|
repo-wide, but your working tree does change after every agent edit. Scoped to one file, so it costs
|
|
117
117
|
milliseconds, and it settles formatting arguments before they reach a diff.
|
|
118
118
|
|
|
119
|
-
It is not a typecheck, because a *scoped* one does not exist: \`tsc\` needs the project, and
|
|
120
|
-
|
|
121
|
-
the
|
|
122
|
-
are choosing to pay for it.
|
|
119
|
+
It is not a typecheck, because a *scoped* one does not exist: \`tsc\` needs the project, and even
|
|
120
|
+
\`bunx x verify --only typecheck\` checks the whole tree — and says \`NOT A GATE RUN\`, because green
|
|
121
|
+
means the run with no flag. There is no \`--skip\`. If you want types on every edit, \`bun run typecheck\`
|
|
122
|
+
is the whole project and you are choosing to pay for it.
|
|
123
123
|
|
|
124
124
|
## Where the rules live
|
|
125
125
|
|
|
@@ -151,12 +151,10 @@ services:
|
|
|
151
151
|
migrate: { condition: service_completed_successfully }
|
|
152
152
|
# OFF by default (zero replicas). A sync node on this database hears committed changes only
|
|
153
153
|
# from a replicator it can reach, and this file runs none: booted anyway it is refused
|
|
154
|
-
# (X_REALTIME_TOPOLOGY). To turn live queries and channels on:
|
|
155
|
-
# true, transport: 'nats', urlEnv: 'NATS_URL' } in app.config.ts, add a NATS service and set the
|
|
154
|
+
# (X_REALTIME_TOPOLOGY). To turn live queries and channels on: add a NATS service and set the
|
|
156
155
|
# SAME NATS_URL for web, sync and a replicator service (ROLE=replicator, exactly one), start
|
|
157
156
|
# Postgres with wal_level=logical and a REPLICATION role on a cluster dedicated to this app (the replicator creates its publication at boot), then set replicas: 1.
|
|
158
|
-
#
|
|
159
|
-
# without one.
|
|
157
|
+
# NATS_URL alone selects the bus: unset, each process fans out in-process only.
|
|
160
158
|
deploy: { replicas: 0 } # when on: scales on concurrent websockets — pinned to 1 by the port
|
|
161
159
|
# The sync role binds PORT + 1. PORT is unset here, so it is 3000 and this listens on 3001.
|
|
162
160
|
ports: ['3001:3001']
|
|
@@ -42,7 +42,7 @@ export const ${app.pascal}CurrencyMismatchError = defineError<CurrencyPair>({
|
|
|
42
42
|
cause: (pair) =>
|
|
43
43
|
\`cannot add \${pair.left} to \${pair.right}: Money is only additive inside one currency\`,
|
|
44
44
|
fix: (pair) =>
|
|
45
|
-
\`bun test packages/domain/src/index.test.ts # add() is defined only inside one currency — convert \${pair.right} to \${pair.left} before calling it\`,
|
|
45
|
+
\`bun test ./packages/domain/src/index.test.ts # add() is defined only inside one currency — convert \${pair.right} to \${pair.left} before calling it\`,
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
export const zero = (currency: string): Money => ({ minor: 0, currency });
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// answers, so an upgrade moves them without a codemod in every app that ever shipped.
|
|
6
6
|
|
|
7
7
|
import type { GeneratedFile } from './naming';
|
|
8
|
+
import { baseRuntimeFiles } from './scaffold-runtime-ports';
|
|
8
9
|
|
|
9
10
|
const server =
|
|
10
11
|
(): string => `// The production entry. \`docker/Dockerfile\` starts this, and \`x build --target binary\` compiles it.
|
|
@@ -131,8 +132,12 @@ if (import.meta.main) {
|
|
|
131
132
|
}
|
|
132
133
|
`;
|
|
133
134
|
|
|
134
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* The process, its runtime (every adapter port, commented — `scaffold-runtime-ports.ts`), then the
|
|
137
|
+
* artifact, in the order a deploy meets them.
|
|
138
|
+
*/
|
|
135
139
|
export const entryFiles = (): readonly GeneratedFile[] => [
|
|
136
140
|
{ path: 'apps/web/server.ts', contents: server() },
|
|
141
|
+
...baseRuntimeFiles(),
|
|
137
142
|
{ path: 'apps/web/prerender.ts', contents: prerender() },
|
|
138
143
|
];
|
|
@@ -19,8 +19,9 @@ pressure, where with a limit the kubelet evicts that pod alone.
|
|
|
19
19
|
const networkPolicy = (app: NameSet): string => `{{/*
|
|
20
20
|
One NetworkPolicy per enabled role: \`http\` (web, sync) from networkPolicy.httpFrom, \`metrics\`
|
|
21
21
|
(every role) from networkPolicy.metricsFrom, nothing else. A \`from\` that renders empty is omitted,
|
|
22
|
-
which Kubernetes reads as "any source". Egress
|
|
23
|
-
|
|
22
|
+
which Kubernetes reads as "any source". Egress renders networkPolicy.egress verbatim: values.yaml
|
|
23
|
+
defaults it CLOSED (DNS, this namespace, the public internet minus metadata, CGNAT and private
|
|
24
|
+
ranges); \`egress: []\` turns filtering off. Serving roles
|
|
24
25
|
only: the migrate Job is a pre-install hook that runs before this exists, and opens no port.
|
|
25
26
|
*/}}
|
|
26
27
|
{{- if .Values.networkPolicy.enabled }}
|
|
@@ -98,14 +98,45 @@ tmp:
|
|
|
98
98
|
# httpFrom empty = any source; narrow it to your ingress controller's namespace, e.g.
|
|
99
99
|
# [{ namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: ingress-nginx } } }]
|
|
100
100
|
# metricsFrom default: any pod in the cluster and no address outside it
|
|
101
|
-
# egress
|
|
102
|
-
#
|
|
101
|
+
# egress FILTERED by default, and closed only where it is dangerous: DNS, every pod in the
|
|
102
|
+
# cluster, and every routable address — private ranges INCLUDED, so a database on a
|
|
103
|
+
# VPC address (RDS on 10.x) keeps working — but never 169.254.0.0/16 (the cloud
|
|
104
|
+
# metadata endpoint, which hands any pod the node's credentials, and link-local),
|
|
105
|
+
# fe80::/10, AWS's fd00:ec2::254 or its NAT64 spelling 64:ff9b::a9fe:a9fe.
|
|
106
|
+
# A list you set REPLACES it whole; \`egress: []\` turns filtering OFF.
|
|
107
|
+
# Recommended hardening, once you know your backends' addresses: replace the
|
|
108
|
+
# cluster-pods rule with \`- to: [{ podSelector: {} }]\` (this namespace only), add
|
|
109
|
+
# 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16 to the IPv4 except and
|
|
110
|
+
# fc00::/7, 64:ff9b::/96 to the IPv6 one, then one rule per backend, e.g.
|
|
111
|
+
# - to: [{ ipBlock: { cidr: 10.0.12.0/24 } }]
|
|
112
|
+
# ports: [{ port: 5432, protocol: TCP }]
|
|
113
|
+
# An IPv6 cluster whose pods hold GLOBAL addresses must narrow ::/0 itself: no
|
|
114
|
+
# except list knows another tenant's global prefix.
|
|
103
115
|
networkPolicy:
|
|
104
116
|
enabled: true
|
|
105
117
|
httpFrom: []
|
|
106
118
|
metricsFrom:
|
|
107
119
|
- namespaceSelector: {}
|
|
108
|
-
egress:
|
|
120
|
+
egress:
|
|
121
|
+
# Port 53 to cluster pods (CoreDNS behind kube-dns) and NodeLocal DNSCache's 169.254.20.10.
|
|
122
|
+
- to:
|
|
123
|
+
- namespaceSelector: {}
|
|
124
|
+
- ipBlock: { cidr: 169.254.20.10/32 }
|
|
125
|
+
ports:
|
|
126
|
+
- { port: 53, protocol: UDP }
|
|
127
|
+
- { port: 53, protocol: TCP }
|
|
128
|
+
# Every pod in the cluster, on every port: an in-cluster Postgres, NATS, Redis or collector in
|
|
129
|
+
# any namespace — named by selector, because some CNIs never match a pod by its ipBlock.
|
|
130
|
+
- to:
|
|
131
|
+
- namespaceSelector: {}
|
|
132
|
+
# Every routable address, private ranges included; never metadata or link-local.
|
|
133
|
+
- to:
|
|
134
|
+
- ipBlock:
|
|
135
|
+
cidr: 0.0.0.0/0
|
|
136
|
+
except: [169.254.0.0/16]
|
|
137
|
+
- ipBlock:
|
|
138
|
+
cidr: ::/0
|
|
139
|
+
except: [fe80::/10, fd00:ec2::254/128, 64:ff9b::a9fe:a9fe/128]
|
|
109
140
|
|
|
110
141
|
# The scrape listener every serving role opens, on its own port and never the app's: the ingress
|
|
111
142
|
# routes / to web, so /metrics beside /healthz on 3000 is /metrics on the internet. This is
|
|
@@ -178,9 +209,7 @@ roles:
|
|
|
178
209
|
sync:
|
|
179
210
|
# OFF by default. A sync pod on a real database hears committed changes only from a replicator
|
|
180
211
|
# it can reach, and a fresh deploy has none: booted anyway it is refused (X_REALTIME_TOPOLOGY).
|
|
181
|
-
# To turn live queries and channels on:
|
|
182
|
-
# urlEnv: 'NATS_URL' } in app.config.ts (a NATS_URL under transport 'memory' is refused, and
|
|
183
|
-
# 'nats' without it is too); run NATS and set the SAME NATS_URL for web, sync and the
|
|
212
|
+
# To turn live queries and channels on: run NATS and set the SAME NATS_URL for web, sync and the
|
|
184
213
|
# replicator; enable exactly one replicator (below) against a Postgres started with
|
|
185
214
|
# wal_level=logical (the replicator creates its publication at boot) and a role with REPLICATION on a cluster dedicated to this app; then set this to true.
|
|
186
215
|
enabled: false
|
|
@@ -6,10 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { ENV_EXAMPLE_PATH } from '@ultimat3/core';
|
|
8
8
|
import { REQUIRED_BUN } from '../app-root';
|
|
9
|
-
import type { CoverageExclude } from '../coverage-floor';
|
|
10
|
-
import { COVERAGE_BAR } from '../coverage-floor';
|
|
11
9
|
import { VERIFY_FLOOR_FILE } from '../verify-floor';
|
|
12
|
-
import type { VerifyStepName } from '../verify-step';
|
|
13
10
|
import type { GeneratedFile, NameSet } from './naming';
|
|
14
11
|
import { titleCase } from './naming';
|
|
15
12
|
import { BIN_SCRIPTS, binScript } from './scaffold-bin';
|
|
@@ -23,14 +20,15 @@ import { scaffoldGuardFiles } from './scaffold-guards';
|
|
|
23
20
|
import { i18nFiles } from './scaffold-i18n';
|
|
24
21
|
import { mcpPackageFiles } from './scaffold-mcp-package';
|
|
25
22
|
import { uiPackageFiles } from './scaffold-ui-package';
|
|
23
|
+
import { verifyFloor } from './scaffold-verify-floor';
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* Spelled once and pinned EXACTLY, because two places named it and a caret let them disagree:
|
|
29
27
|
* `"^2.4.15"` beside a `$schema` of `2.4.15` installed 2.5.8, whose own parser then reported the
|
|
30
|
-
* config as out of date on every `bun run lint`. A formatter is a build input
|
|
28
|
+
* config as out of date on every `bun run lint`. A formatter is a build input: a floating range
|
|
31
29
|
* is a `lint` step whose verdict depends on the day the app was installed.
|
|
32
30
|
*/
|
|
33
|
-
const BIOME_VERSION = '2.
|
|
31
|
+
const BIOME_VERSION = '2.6.3';
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
34
|
* The checker a scaffolded app typechecks with, and it must not lag the one the FRAMEWORK is built
|
|
@@ -58,10 +56,9 @@ const SOLID_VERSION = '1.9.17';
|
|
|
58
56
|
// floor admitting a runtime the app's own first command refuses. Interpolated, the two cannot
|
|
59
57
|
// disagree; `scripts/bun-pin.test.ts` reads the emitted string as one more pin site, and
|
|
60
58
|
// `github/ci.yml.ts` pins the workflow's Bun to the same constant.
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
// the `manifest` verify step and every production boot with X_APP_PACKAGE_INVALID.
|
|
59
|
+
// `version` is not decoration: the manifest's app version IS the contract's compatibility gate, and
|
|
60
|
+
// the manifest never fabricates one, so an app scaffolded without it failed `x manifest` and every
|
|
61
|
+
// production boot with X_APP_PACKAGE_INVALID.
|
|
65
62
|
const rootPackage = (app: NameSet, version: string): string => `{
|
|
66
63
|
"name": "${app.kebab}",
|
|
67
64
|
"version": "0.1.0",
|
|
@@ -127,12 +124,17 @@ const rootPackage = (app: NameSet, version: string): string => `{
|
|
|
127
124
|
* `references`). `-b` decides "up to date?" by MTIME, and Bun installs a dependency as hardlinks
|
|
128
125
|
* carrying its cache's old mtimes: upgrading to a version already in the cache left every input
|
|
129
126
|
* older than the buildinfo, so `-b` skipped the program and reported green while a cold CI was
|
|
130
|
-
* red. `-p` with `incremental` compares content hashes
|
|
131
|
-
* `app.config.js` that `noEmit` never writes
|
|
127
|
+
* red. `-p` with `incremental` compares content hashes, and `-b` also wanted an emitted
|
|
128
|
+
* `app.config.js` that `noEmit` never writes — which is why this line was first needed.
|
|
132
129
|
*
|
|
133
|
-
* The note lives HERE and not in the emitted file, for the reason `biome.json` below gives: an
|
|
134
|
-
*
|
|
130
|
+
* The note lives HERE and not in the emitted file, for the reason `biome.json` below gives: an app
|
|
131
|
+
* author has no use for eight lines of framework archaeology in their own tsconfig, and
|
|
135
132
|
* `*.tsbuildinfo` is already in the scaffold's `.gitignore`.
|
|
133
|
+
*
|
|
134
|
+
* ONE alias for every workspace: `@<app>/<pkg>` tries `packages/<pkg>/src` first, then
|
|
135
|
+
* `@<app>/<app-ws>/<module>` falls through to `apps/<app-ws>/<module>` — TypeScript tries each
|
|
136
|
+
* substitution in order. A per-app line (`@<app>/web/*`) meant `x g app <name>` had to edit this
|
|
137
|
+
* file, and an app added by hand without one failed `typecheck` on its first import.
|
|
136
138
|
*/
|
|
137
139
|
const rootTsconfig = (app: NameSet): string => `{
|
|
138
140
|
"compilerOptions": {
|
|
@@ -142,9 +144,7 @@ const rootTsconfig = (app: NameSet): string => `{
|
|
|
142
144
|
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
143
145
|
"types": ["bun"],
|
|
144
146
|
"paths": {
|
|
145
|
-
"@${app.kebab}
|
|
146
|
-
"@${app.kebab}/admin/*": ["./apps/admin/*"],
|
|
147
|
-
"@${app.kebab}/*": ["./packages/*/src"]
|
|
147
|
+
"@${app.kebab}/*": ["./packages/*/src", "./apps/*"]
|
|
148
148
|
},
|
|
149
149
|
"strict": true,
|
|
150
150
|
"noUncheckedIndexedAccess": true,
|
|
@@ -212,9 +212,9 @@ export const config = defineConfig({
|
|
|
212
212
|
// The tiers ARE the cache selection: add 'redis' to build the shared rung, which reads
|
|
213
213
|
// \`REDIS_URL\` and refuses the boot when it is unset.
|
|
214
214
|
cache: { tiers: ['request-memo', 'lru'] },
|
|
215
|
-
jobs: { queues: ['
|
|
216
|
-
//
|
|
217
|
-
realtime: { enabled: true
|
|
215
|
+
jobs: { queues: ['default'], concurrency: 4 },
|
|
216
|
+
// The bus is NATS_URL's: unset, one node's in-process fanout; set it to scale past one node.
|
|
217
|
+
realtime: { enabled: true },
|
|
218
218
|
// \`name\` and \`colors\` are what an install prompt shows and what a browser paints the splash
|
|
219
219
|
// with before any stylesheet has loaded — the four values the framework cannot derive, so
|
|
220
220
|
// \`defineConfig\` refuses \`pwa.enabled: true\` without them. Raw hex is legal here and nowhere
|
|
@@ -252,30 +252,23 @@ defineMeasurementActor(async () => {
|
|
|
252
252
|
`;
|
|
253
253
|
|
|
254
254
|
// `biome.json` is strict JSON — Biome's own parser rejects a `//` comment in it, which made every
|
|
255
|
-
// scaffolded app fail its first `x verify` on the config rather than on the code. The note
|
|
256
|
-
//
|
|
257
|
-
//
|
|
258
|
-
//
|
|
259
|
-
//
|
|
260
|
-
//
|
|
261
|
-
//
|
|
262
|
-
//
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
//
|
|
272
|
-
// `--no-example` hid it, because an app with no island has nothing under `.x/static/islands`.
|
|
273
|
-
//
|
|
274
|
-
// `vcs.useIgnoreFile` is the second half and not a duplicate of the first: it makes every future
|
|
275
|
-
// generated directory the app adds to `.gitignore` excluded by the act of ignoring it, rather than
|
|
276
|
-
// by an edit to this file nobody will remember to make. It needs `.gitignore` to EXIST — Biome
|
|
277
|
-
// exits 1 with `couldn't find an ignore file` when it does not — which `x new` writes, and which
|
|
278
|
-
// is why the two are declared together rather than one of them alone.
|
|
255
|
+
// scaffolded app fail its first `x verify` on the config rather than on the code. The note lives
|
|
256
|
+
// here, where whoever would change the line reads it: x.manifest.json and openapi.json are
|
|
257
|
+
// emitted byte-for-byte by `x manifest`, so a formatter rewriting them puts `x manifest` and
|
|
258
|
+
// `x verify` in a loop neither can win; `**/migrations` is the same rule and the same glob this
|
|
259
|
+
// repo's own biome.json carries, because `x db gen` writes the `.sql` and its sidecar. `preset`,
|
|
260
|
+
// not `recommended`: the older key is deprecated from 2.5 on and printed a migration notice.
|
|
261
|
+
// `!**/.x` makes the app's fix chain terminate: `x build` writes MINIFIED island bundles there, and
|
|
262
|
+
// without it `lint` reported ~175 `noCommaOperator`/`noAssignInExpressions` errors in Bun's own
|
|
263
|
+
// output whose `fix:` still exits 1, so `x verify` was red forever once `x build` ran. `--unsafe` was
|
|
264
|
+
// worse — it REWROTE a content-hashed chunk in place, so the name no longer matched the bytes.
|
|
265
|
+
// `vcs.useIgnoreFile` excludes every future generated directory the app adds to `.gitignore`, and
|
|
266
|
+
// needs that file to EXIST else Biome exits 1 — `x new` writes it. `markdown`/`yaml` formatters are
|
|
267
|
+
// OFF and `**/helm/templates` leaves the file list: 2.6 is the first Biome that reads either, and
|
|
268
|
+
// Go-templated manifests are a parse ERROR, not a format miss. `css.quoteStyle` is `single` and SCSS
|
|
269
|
+
// turns `noUnknownUnit` off: 2.6 begins PARSING SCSS too, its default is double, and a token call
|
|
270
|
+
// reads as a dimension (`tokens.text('lg')` → unit `lg`), so both misfire on the framework's own
|
|
271
|
+
// idiom.
|
|
279
272
|
const biome = (): string => `{
|
|
280
273
|
"$schema": "https://biomejs.dev/schemas/${BIOME_VERSION}/schema.json",
|
|
281
274
|
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
|
|
@@ -286,11 +279,13 @@ const biome = (): string => `{
|
|
|
286
279
|
"!**/dist",
|
|
287
280
|
"!**/.output",
|
|
288
281
|
"!**/migrations",
|
|
282
|
+
"!**/helm/templates",
|
|
289
283
|
"!x.manifest.json",
|
|
290
284
|
"!openapi.json"
|
|
291
285
|
]
|
|
292
286
|
},
|
|
293
287
|
"formatter": { "indentStyle": "space", "indentWidth": 2, "lineWidth": 100 },
|
|
288
|
+
"css": { "formatter": { "quoteStyle": "single" } },
|
|
294
289
|
"linter": {
|
|
295
290
|
"rules": {
|
|
296
291
|
"preset": "recommended",
|
|
@@ -301,100 +296,17 @@ const biome = (): string => `{
|
|
|
301
296
|
},
|
|
302
297
|
"javascript": {
|
|
303
298
|
"formatter": { "quoteStyle": "single", "semicolons": "always", "trailingCommas": "all" }
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
`;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* The suite ratchet, committed on day one. Without it `readVerifyFloor` answers "no file is no
|
|
310
|
-
* floor" and a deleted suite turns its step from green into skipped-and-green — so
|
|
311
|
-
* `X_VERIFY_SUITE_VANISHED` was unreachable in every generated app, in the one repo shape that
|
|
312
|
-
* grows suites fastest.
|
|
313
|
-
*
|
|
314
|
-
* Every name here is a step this scaffold has proved it can run: the SIX that declare no `applies`
|
|
315
|
-
* at all — typecheck, lint, boundaries, filesize, errors, manifest — plus `package-shape` (five
|
|
316
|
-
* workspace packages), `unit` (every generator emits a `<file>.test.ts`; like every suite step it
|
|
317
|
-
* applies on its own file list, `verify-tests.ts`), and `eval`, `drift` and `budgets`, which apply
|
|
318
|
-
* to any root with an `app.config.ts`. Typed as `VerifyStepName`, so a name the gate does not run
|
|
319
|
-
* is a compile error rather than a floor that covers nothing.
|
|
320
|
-
*
|
|
321
|
-
* Plus `contract`, which every variant now ships a file for — `apps/web/api/health.contract.test.ts`
|
|
322
|
-
* — and, with the example slice, `live` and `job`: its query is a `liveTest` and its job a
|
|
323
|
-
* `jobTest`, and both were written into plain `<name>.test.ts` files that the `unit` step ran while
|
|
324
|
-
* `x test live` and `x test job` answered X_TEST_NO_FILES. This is the commit that makes the app's
|
|
325
|
-
* own gate run them, which is what the paragraph below always said the condition was.
|
|
326
|
-
*
|
|
327
|
-
* Two remain absent. `e2e` has a scaffolded file and it is an `e2eTest` — `test.skip` until the app
|
|
328
|
-
* registers a browser driver, so the step would run zero tests and fail the ratchet on the
|
|
329
|
-
* scaffold's own placeholder. Its absence is visible rather than silent: a suite that executed
|
|
330
|
-
* nothing reports as a SKIPPED step, not the green check it printed until #434, so the app's own
|
|
331
|
-
* gate line says `- e2e` and names it in the summary until a driver makes it run. `contract-diff` needs a committed `x.manifest.json`, which
|
|
332
|
-
* `x manifest` writes later. Each joins the list in the commit that makes the app's gate run it.
|
|
333
|
-
*/
|
|
334
|
-
const SCAFFOLD_FLOOR: readonly VerifyStepName[] = [
|
|
335
|
-
'typecheck',
|
|
336
|
-
'lint',
|
|
337
|
-
'boundaries',
|
|
338
|
-
'filesize',
|
|
339
|
-
'package-shape',
|
|
340
|
-
'errors',
|
|
341
|
-
'unit',
|
|
342
|
-
'contract',
|
|
343
|
-
// Every app has an `app.config.ts` and primitives to run: `x new` writes `apps/web/exercise.ts`.
|
|
344
|
-
'exercise',
|
|
345
|
-
'eval',
|
|
346
|
-
'drift',
|
|
347
|
-
'budgets',
|
|
348
|
-
// Always applicable to a scaffolded app — it has an `app.config.ts`, roles and two guarded
|
|
349
|
-
// routes — so a run that reports it skipped is a gate that lost the step, not an app with
|
|
350
|
-
// nothing to check. It is the step that would have caught the 500 `x new` used to ship.
|
|
351
|
-
'policy',
|
|
352
|
-
'manifest',
|
|
353
|
-
];
|
|
354
|
-
|
|
355
|
-
/** The two suites only the example slice writes a file for — a floor step with no file is red. */
|
|
356
|
-
const EXAMPLE_FLOOR: readonly VerifyStepName[] = ['live', 'job'];
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* What a unit test cannot execute in a scaffolded app, each with its reason — `x doctor` prints
|
|
360
|
-
* them. Two kinds and no more: a file here is a file the floor does not see, so the list is not
|
|
361
|
-
* a place to put code that merely has no test yet.
|
|
362
|
-
*/
|
|
363
|
-
export const SCAFFOLD_COVERAGE_EXCLUDE: readonly CoverageExclude[] = [
|
|
364
|
-
{
|
|
365
|
-
glob: 'apps/**/*.island.tsx',
|
|
366
|
-
why: 'an island runs in a browser: its test mounts a BUILT chunk (mountIsland), and Bun cannot map that chunk back to this source — its states are held by guards/island-without-states.ts and photographed by x shot --island',
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
glob: 'apps/*/server.ts',
|
|
370
|
-
why: 'the container entry point: it boots the roles and lives as long as the process — bun run dev and the image exercise it',
|
|
371
299
|
},
|
|
372
|
-
{
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
];
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* The coverage floor every scaffolded app starts on: the bar the framework holds its own packages
|
|
380
|
-
* to (`COVERAGE_BAR`), not a softer one for apps. `scaffold-smoke` runs the app's own `x verify`,
|
|
381
|
-
* so the scaffold is green at it on what it generates or the job is red.
|
|
382
|
-
*/
|
|
383
|
-
const verifyFloor = (example: boolean): string =>
|
|
384
|
-
`${JSON.stringify(
|
|
300
|
+
"markdown": { "formatter": { "enabled": false } },
|
|
301
|
+
"yaml": { "formatter": { "enabled": false } },
|
|
302
|
+
"overrides": [
|
|
385
303
|
{
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
// The rolling rail judges from the first migration: a new app has nothing to grandfather.
|
|
393
|
-
rollingSince: '0',
|
|
394
|
-
},
|
|
395
|
-
null,
|
|
396
|
-
2,
|
|
397
|
-
)}\n`;
|
|
304
|
+
"includes": ["**/*.scss"],
|
|
305
|
+
"linter": { "rules": { "correctness": { "noUnknownUnit": "off" } } }
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
`;
|
|
398
310
|
|
|
399
311
|
const bunfig = (): string => `[test]
|
|
400
312
|
root = "."
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// The commented port lines `apps/<app>/runtime.ts` is written with: one per `ADAPTER_PORTS` row,
|
|
2
|
+
// derived from the table, so a row core adds reaches the next scaffold with no edit here. Each line
|
|
3
|
+
// is the field to uncomment, the interface to implement, and the default the boot builds instead.
|
|
4
|
+
|
|
5
|
+
import { ADAPTER_PORTS } from '@ultimat3/core';
|
|
6
|
+
import { isWired } from '../runtime-ports';
|
|
7
|
+
import type { GeneratedFile } from './naming';
|
|
8
|
+
|
|
9
|
+
/** Where the generated runtime lives: `apps/<app>/runtime.ts` is what both boots read first. */
|
|
10
|
+
export const RUNTIME_MODULE = 'apps/web/runtime.ts';
|
|
11
|
+
export const RUNTIME_TEST = 'apps/web/runtime.test.ts';
|
|
12
|
+
|
|
13
|
+
/** What the header of every generated `runtime.ts` says, whichever generator wrote it. */
|
|
14
|
+
export const RUNTIME_HEADER = `// What this app hands the framework's boot — \`x dev\` and the container both import it before a
|
|
15
|
+
// port is bound. The ONE place a backend is swapped: uncomment a port, hand it your adapter (the
|
|
16
|
+
// interface is on its package's \`/adapter\` subpath, its conformance suite in @ultimat3/testing).
|
|
17
|
+
// This file runs BEFORE its own ports are installed: import no app module that seals a secret or
|
|
18
|
+
// builds auth at module scope — it would run on the default clock and secret source.`;
|
|
19
|
+
|
|
20
|
+
/** The camel-cased value name a line suggests (`JobDriver` → `myJobDriver`). */
|
|
21
|
+
const valueName = (iface: string): string => `my${iface}`;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Every row as a comment. A wired row is a `RuntimeOverrides` field — uncommented it typechecks
|
|
25
|
+
* against the interface it names. A pending row says so, because uncommenting it is TS2353 until
|
|
26
|
+
* the boot honours it (`runtime-port-bindings.ts`).
|
|
27
|
+
*/
|
|
28
|
+
export function runtimePortLines(indent = ' '): string {
|
|
29
|
+
return ADAPTER_PORTS.map((row) => {
|
|
30
|
+
const port = row.port;
|
|
31
|
+
const where = `${row.interface} from '${row.pkg}/adapter'; default: ${row.envDefault}`;
|
|
32
|
+
return isWired(port)
|
|
33
|
+
? `${indent}// ${port}: ${valueName(row.interface)}, // ${where}`
|
|
34
|
+
: `${indent}// ${port}: not a runtime.ts field yet (${row.interface}, ${row.pkg})`;
|
|
35
|
+
}).join('\n');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** `x new`'s `runtime.ts`: no routes, no guard — every port commented, the object typed. */
|
|
39
|
+
export const baseRuntimeSource = (): string => `${RUNTIME_HEADER}
|
|
40
|
+
import type { RuntimeOverrides } from '@ultimat3/cli/serve';
|
|
41
|
+
|
|
42
|
+
export const runtime = {
|
|
43
|
+
${runtimePortLines()}
|
|
44
|
+
} satisfies RuntimeOverrides;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
/** Its test: the module loads, and names no port until the author uncomments one. */
|
|
48
|
+
export const baseRuntimeTest =
|
|
49
|
+
(): string => `// The runtime loads under test, and swaps nothing until a port is uncommented.
|
|
50
|
+
import { expect, unitTest } from '@ultimat3/testing';
|
|
51
|
+
import { runtime } from './runtime';
|
|
52
|
+
|
|
53
|
+
unitTest('the runtime loads', () => {
|
|
54
|
+
expect(runtime).toEqual({});
|
|
55
|
+
});
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
/** The pair `x new` writes; `x g sign-in` replaces both while they are still these bytes. */
|
|
59
|
+
export const baseRuntimeFiles = (): readonly GeneratedFile[] => [
|
|
60
|
+
{ path: RUNTIME_MODULE, contents: baseRuntimeSource() },
|
|
61
|
+
{ path: RUNTIME_TEST, contents: baseRuntimeTest() },
|
|
62
|
+
];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// `x new`'s `x.verify.json`: the suite floor and the coverage bar every scaffolded app starts on.
|
|
2
|
+
// Split from `scaffold-repo.ts` (the repo's root files), which had reached the 500-line ceiling.
|
|
3
|
+
|
|
4
|
+
import type { CoverageExclude } from '../coverage-floor';
|
|
5
|
+
import { COVERAGE_BAR } from '../coverage-floor';
|
|
6
|
+
import type { VerifyStepName } from '../verify-step';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The suite ratchet, committed on day one. Without it `readVerifyFloor` answers "no file is no
|
|
10
|
+
* floor" and a deleted suite turns its step from green into skipped-and-green — so
|
|
11
|
+
* `X_VERIFY_SUITE_VANISHED` was unreachable in every generated app, in the one repo shape that
|
|
12
|
+
* grows suites fastest.
|
|
13
|
+
*
|
|
14
|
+
* Every name here is a step this scaffold has proved it can run: the SIX that declare no `applies`
|
|
15
|
+
* at all — typecheck, lint, boundaries, filesize, errors, manifest — plus `package-shape` (five
|
|
16
|
+
* workspace packages), `unit` (every generator emits a `<file>.test.ts`; like every suite step it
|
|
17
|
+
* applies on its own file list, `verify-tests.ts`), and `eval`, `drift` and `budgets`, which apply
|
|
18
|
+
* to any root with an `app.config.ts`. Typed as `VerifyStepName`, so a name the gate does not run
|
|
19
|
+
* is a compile error rather than a floor that covers nothing.
|
|
20
|
+
*
|
|
21
|
+
* Plus `contract`, which every variant now ships a file for — `apps/web/api/health.contract.test.ts`
|
|
22
|
+
* — and, with the example slice, `live` and `job`: its query is a `liveTest` and its job a
|
|
23
|
+
* `jobTest`, and both were written into plain `<name>.test.ts` files that the `unit` step ran while
|
|
24
|
+
* `x test live` and `x test job` answered X_TEST_NO_FILES. This is the commit that makes the app's
|
|
25
|
+
* own gate run them, which is what the paragraph below always said the condition was.
|
|
26
|
+
*
|
|
27
|
+
* Two remain absent. `e2e` has a scaffolded file and it is an `e2eTest` — `test.skip` until the app
|
|
28
|
+
* registers a browser driver, so the step would run zero tests and fail the ratchet on the
|
|
29
|
+
* scaffold's own placeholder. Its absence is visible rather than silent: a suite that executed
|
|
30
|
+
* nothing reports as a SKIPPED step, not the green check it printed until #434, so the app's own
|
|
31
|
+
* gate line says `- e2e` and names it in the summary until a driver makes it run. `contract-diff` needs a committed `x.manifest.json`, which
|
|
32
|
+
* `x manifest` writes later. Each joins the list in the commit that makes the app's gate run it.
|
|
33
|
+
*/
|
|
34
|
+
const SCAFFOLD_FLOOR: readonly VerifyStepName[] = [
|
|
35
|
+
'typecheck',
|
|
36
|
+
'lint',
|
|
37
|
+
'boundaries',
|
|
38
|
+
'filesize',
|
|
39
|
+
'package-shape',
|
|
40
|
+
'errors',
|
|
41
|
+
'unit',
|
|
42
|
+
'contract',
|
|
43
|
+
// Every app has an `app.config.ts` and primitives to run: `x new` writes `apps/web/exercise.ts`.
|
|
44
|
+
'exercise',
|
|
45
|
+
'eval',
|
|
46
|
+
'drift',
|
|
47
|
+
'budgets',
|
|
48
|
+
// Always applicable to a scaffolded app — it has an `app.config.ts`, roles and two guarded
|
|
49
|
+
// routes — so a run that reports it skipped is a gate that lost the step, not an app with
|
|
50
|
+
// nothing to check. It is the step that would have caught the 500 `x new` used to ship.
|
|
51
|
+
'policy',
|
|
52
|
+
'manifest',
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
/** The two suites only the example slice writes a file for — a floor step with no file is red. */
|
|
56
|
+
const EXAMPLE_FLOOR: readonly VerifyStepName[] = ['live', 'job'];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* What a unit test cannot execute in a scaffolded app, each with its reason — `x doctor` prints
|
|
60
|
+
* them. Two kinds and no more: a file here is a file the floor does not see, so the list is not
|
|
61
|
+
* a place to put code that merely has no test yet.
|
|
62
|
+
*/
|
|
63
|
+
export const SCAFFOLD_COVERAGE_EXCLUDE: readonly CoverageExclude[] = [
|
|
64
|
+
{
|
|
65
|
+
glob: 'apps/**/*.island.tsx',
|
|
66
|
+
why: 'an island runs in a browser: its test mounts a BUILT chunk (mountIsland), and Bun cannot map that chunk back to this source — its states are held by guards/island-without-states.ts and photographed by x shot --island',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
glob: 'apps/*/server.ts',
|
|
70
|
+
why: 'the container entry point: it boots the roles and lives as long as the process — bun run dev and the image exercise it',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
glob: 'apps/*/prerender.ts',
|
|
74
|
+
why: "the static build's entry point: x build --target static runs it, and the budgets step weighs what it writes",
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The coverage floor every scaffolded app starts on: the bar the framework holds its own packages
|
|
80
|
+
* to (`COVERAGE_BAR`), not a softer one for apps. `scaffold-smoke` runs the app's own `x verify`,
|
|
81
|
+
* so the scaffold is green at it on what it generates or the job is red.
|
|
82
|
+
*/
|
|
83
|
+
export const verifyFloor = (example: boolean): string =>
|
|
84
|
+
`${JSON.stringify(
|
|
85
|
+
{
|
|
86
|
+
steps: example ? [...SCAFFOLD_FLOOR, ...EXAMPLE_FLOOR] : SCAFFOLD_FLOOR,
|
|
87
|
+
coverage: {
|
|
88
|
+
lines: COVERAGE_BAR,
|
|
89
|
+
funcs: COVERAGE_BAR,
|
|
90
|
+
exclude: SCAFFOLD_COVERAGE_EXCLUDE,
|
|
91
|
+
},
|
|
92
|
+
// The rolling rail judges from the first migration: a new app has nothing to grandfather.
|
|
93
|
+
rollingSince: '0',
|
|
94
|
+
},
|
|
95
|
+
null,
|
|
96
|
+
2,
|
|
97
|
+
)}\n`;
|
|
@@ -32,7 +32,7 @@ export interface ShapeOverlay {
|
|
|
32
32
|
const CATALOG = 'packages/i18n/catalogs/en.json';
|
|
33
33
|
|
|
34
34
|
/** A stale overlay is the framework's bug, never the app's: the shape tests name which one. */
|
|
35
|
-
const FIX = 'bun test packages/cli/src/templates/shapes';
|
|
35
|
+
const FIX = 'bun test ./packages/cli/src/templates/shapes';
|
|
36
36
|
|
|
37
37
|
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
38
38
|
typeof value === 'object' && value !== null && !Array.isArray(value);
|