@ultimat3/cli 31.11.0 → 31.12.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/package.json +29 -29
- package/src/error-codes.ts +2 -0
- package/src/mcp-errors.ts +2 -0
- package/src/retained-assets-boot.ts +38 -4
- package/wiki/Deployment.md +3 -1
- package/wiki/Known-Gaps.md +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.12.0",
|
|
4
4
|
"description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -53,34 +53,34 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/core": "^8.0.9",
|
|
56
|
-
"@ultimat3/action": "31.
|
|
57
|
-
"@ultimat3/admin": "31.
|
|
58
|
-
"@ultimat3/ai": "31.
|
|
59
|
-
"@ultimat3/auth": "31.
|
|
60
|
-
"@ultimat3/cache": "31.
|
|
61
|
-
"@ultimat3/core": "31.
|
|
62
|
-
"@ultimat3/db": "31.
|
|
63
|
-
"@ultimat3/entity": "31.
|
|
64
|
-
"@ultimat3/flags": "31.
|
|
65
|
-
"@ultimat3/http": "31.
|
|
66
|
-
"@ultimat3/i18n": "31.
|
|
67
|
-
"@ultimat3/jobs": "31.
|
|
68
|
-
"@ultimat3/mail": "31.
|
|
69
|
-
"@ultimat3/manifest": "31.
|
|
70
|
-
"@ultimat3/mcp": "31.
|
|
71
|
-
"@ultimat3/money": "31.
|
|
72
|
-
"@ultimat3/notify": "31.
|
|
73
|
-
"@ultimat3/policy": "31.
|
|
74
|
-
"@ultimat3/pwa": "31.
|
|
75
|
-
"@ultimat3/query": "31.
|
|
76
|
-
"@ultimat3/realtime": "31.
|
|
77
|
-
"@ultimat3/render": "31.
|
|
78
|
-
"@ultimat3/schema": "31.
|
|
79
|
-
"@ultimat3/scraping": "31.
|
|
80
|
-
"@ultimat3/seo": "31.
|
|
81
|
-
"@ultimat3/storage": "31.
|
|
82
|
-
"@ultimat3/testing": "31.
|
|
83
|
-
"@ultimat3/time": "31.
|
|
56
|
+
"@ultimat3/action": "31.12.0",
|
|
57
|
+
"@ultimat3/admin": "31.12.0",
|
|
58
|
+
"@ultimat3/ai": "31.12.0",
|
|
59
|
+
"@ultimat3/auth": "31.12.0",
|
|
60
|
+
"@ultimat3/cache": "31.12.0",
|
|
61
|
+
"@ultimat3/core": "31.12.0",
|
|
62
|
+
"@ultimat3/db": "31.12.0",
|
|
63
|
+
"@ultimat3/entity": "31.12.0",
|
|
64
|
+
"@ultimat3/flags": "31.12.0",
|
|
65
|
+
"@ultimat3/http": "31.12.0",
|
|
66
|
+
"@ultimat3/i18n": "31.12.0",
|
|
67
|
+
"@ultimat3/jobs": "31.12.0",
|
|
68
|
+
"@ultimat3/mail": "31.12.0",
|
|
69
|
+
"@ultimat3/manifest": "31.12.0",
|
|
70
|
+
"@ultimat3/mcp": "31.12.0",
|
|
71
|
+
"@ultimat3/money": "31.12.0",
|
|
72
|
+
"@ultimat3/notify": "31.12.0",
|
|
73
|
+
"@ultimat3/policy": "31.12.0",
|
|
74
|
+
"@ultimat3/pwa": "31.12.0",
|
|
75
|
+
"@ultimat3/query": "31.12.0",
|
|
76
|
+
"@ultimat3/realtime": "31.12.0",
|
|
77
|
+
"@ultimat3/render": "31.12.0",
|
|
78
|
+
"@ultimat3/schema": "31.12.0",
|
|
79
|
+
"@ultimat3/scraping": "31.12.0",
|
|
80
|
+
"@ultimat3/seo": "31.12.0",
|
|
81
|
+
"@ultimat3/storage": "31.12.0",
|
|
82
|
+
"@ultimat3/testing": "31.12.0",
|
|
83
|
+
"@ultimat3/time": "31.12.0",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/error-codes.ts
CHANGED
|
@@ -239,6 +239,7 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
239
239
|
'X_TYPESCRIPT_VERSION',
|
|
240
240
|
'X_SEED_FAILED',
|
|
241
241
|
'X_NATIVE_FORM_UNANSWERED',
|
|
242
|
+
'X_ASSET_RETAIN_UNDECLARED',
|
|
242
243
|
] as const;
|
|
243
244
|
|
|
244
245
|
/**
|
|
@@ -464,6 +465,7 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
464
465
|
X_TYPESCRIPT_VERSION: 'The app declares a TypeScript older than the one x new scaffolds',
|
|
465
466
|
X_SEED_FAILED: 'a seed threw an uncoded error',
|
|
466
467
|
X_NATIVE_FORM_UNANSWERED: 'a page form posts to an action that declares no native answer',
|
|
468
|
+
X_ASSET_RETAIN_UNDECLARED: "A served build keeps no earlier build's assets",
|
|
467
469
|
};
|
|
468
470
|
|
|
469
471
|
// One unconditional call, so a second package claiming one of the CLI's codes throws
|
package/src/mcp-errors.ts
CHANGED
|
@@ -382,6 +382,8 @@ const CLI_FIXES: Readonly<Record<CliErrorCode, string>> = {
|
|
|
382
382
|
X_SEED_FAILED: 'bun --eval \'await (await import("./packages/db/seeds/dev.ts")).dev.run()\'',
|
|
383
383
|
X_NATIVE_FORM_UNANSWERED:
|
|
384
384
|
"native: { success: (output) => '/where-it-lands' } in the action's declaration, then x verify --only manifest",
|
|
385
|
+
X_ASSET_RETAIN_UNDECLARED:
|
|
386
|
+
"edit app.config.ts: add assets: { retain: { disk: 'assets', builds: 3 } }, naming a disk your defineStorage({ disks }) declares that every web pod reads",
|
|
385
387
|
};
|
|
386
388
|
|
|
387
389
|
const isCliCode = (code: string): code is CliErrorCode =>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// binds, so before `/readyz` can say ready — and hand back the reader the asset routes miss into.
|
|
4
4
|
|
|
5
5
|
import type { AppConfig, AssetsRetainConfig } from '@ultimat3/core';
|
|
6
|
-
import { ConfigInvalidError, renderFixLiteral } from '@ultimat3/core';
|
|
6
|
+
import { ConfigInvalidError, logger, renderFixLiteral, UltimateError } from '@ultimat3/core';
|
|
7
7
|
import type { Storage } from '@ultimat3/storage';
|
|
8
8
|
import type { IslandBundle } from './island-bundle';
|
|
9
9
|
import type { BuildAsset, PublishReport, RetainLog } from './retained-assets';
|
|
@@ -60,6 +60,35 @@ export function buildAssetsOf(surface: BuiltSurface): readonly BuildAsset[] {
|
|
|
60
60
|
return [...new Map(assets.map((asset) => [asset.url, asset] as const)).values()];
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* A served build that keeps no earlier build's hashed files. Logged, never thrown: one replica
|
|
65
|
+
* serving its own build is correct until the next deploy, and the boot cannot see how many
|
|
66
|
+
* replicas the platform runs — only that nothing would answer a URL another build named.
|
|
67
|
+
*/
|
|
68
|
+
export class AssetRetainUndeclaredError extends UltimateError {
|
|
69
|
+
constructor(input: { readonly environment: string; readonly disks: readonly string[] }) {
|
|
70
|
+
const disk = renderFixLiteral(input.disks[0], '"assets"');
|
|
71
|
+
super({
|
|
72
|
+
code: 'X_ASSET_RETAIN_UNDECLARED',
|
|
73
|
+
cause: `this web role serves the ${input.environment} environment with no assets.retain, so it answers only its own build's hashed files: across a rolling deploy with more than one replica, or after any deploy, a page can name a stylesheet or island chunk the answering replica 404s, and renders unstyled`,
|
|
74
|
+
fix: `assets: { retain: { disk: ${disk}, builds: 3 } } # in app.config.ts, over a disk every web pod reads${input.disks.length === 0 ? ' (declare one with defineStorage({ disks }))' : ''}`,
|
|
75
|
+
meta: { environment: input.environment },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Where a boot has no rolling deploy to survive: a laptop, a test run. */
|
|
81
|
+
const LOCAL_ENVIRONMENTS: ReadonlySet<string> = new Set(['development', 'test']);
|
|
82
|
+
|
|
83
|
+
function warnUndeclared(input: RetainBootInput): void {
|
|
84
|
+
if (LOCAL_ENVIRONMENTS.has(input.environment) || buildAssetsOf(input).length === 0) return;
|
|
85
|
+
const warning = new AssetRetainUndeclaredError({
|
|
86
|
+
environment: input.environment,
|
|
87
|
+
disks: input.storage.diskNames,
|
|
88
|
+
});
|
|
89
|
+
(input.log ?? logger).warn(warning.format(), { code: warning.code, ...warning.meta });
|
|
90
|
+
}
|
|
91
|
+
|
|
63
92
|
export interface RetainBootInput extends BuiltSurface {
|
|
64
93
|
readonly config: AppConfig | undefined;
|
|
65
94
|
/** The disks the app's routes read (`servedStorage`) — `retain.disk` must be one of them. */
|
|
@@ -79,15 +108,20 @@ export interface RetainedBoot {
|
|
|
79
108
|
}
|
|
80
109
|
|
|
81
110
|
/**
|
|
82
|
-
* `undefined` when the app declared no window
|
|
83
|
-
*
|
|
111
|
+
* `undefined` when the app declared no window — and, outside development and test, one
|
|
112
|
+
* `X_ASSET_RETAIN_UNDECLARED` warning naming the edit (`warnUndeclared`). A misnamed disk refuses
|
|
113
|
+
* the boot: it is the app's config, wrong, and every pod of the deploy would otherwise run without
|
|
114
|
+
* the window it asked for.
|
|
84
115
|
* A disk that refuses a write does NOT: `publishBuildAssets` logs it and the pod serves, reading
|
|
85
116
|
* earlier builds' files all the same. The scope is `config.name` and the environment, so staging
|
|
86
117
|
* and production on one bucket never sweep or serve each other.
|
|
87
118
|
*/
|
|
88
119
|
export async function retainBuildAssets(input: RetainBootInput): Promise<RetainedBoot | undefined> {
|
|
89
120
|
const retain = retainOf(input.config);
|
|
90
|
-
if (input.config === undefined || retain === undefined)
|
|
121
|
+
if (input.config === undefined || retain === undefined) {
|
|
122
|
+
warnUndeclared(input);
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
91
125
|
const names = input.storage.diskNames;
|
|
92
126
|
if (!names.includes(retain.disk)) {
|
|
93
127
|
throw new ConfigInvalidError({
|
package/wiki/Deployment.md
CHANGED
|
@@ -527,7 +527,9 @@ The refusal is the ROLLED-BACK image's code, so it protects from the release aft
|
|
|
527
527
|
|
|
528
528
|
### Hashed assets across a deploy — `assets.retain`
|
|
529
529
|
|
|
530
|
-
A web process serves only the hashed files it built: `/styles/<hash>.css`, `/islands/<island>-<hash>.js`, `/_x/assets/<script>/<hash>.js`, `/assets/<name>.<hash>.<ext>`. With no window, an open tab holding the previous build's document gets a 404 for its stylesheet, or for its island chunk on the first click, after every deploy, one replica or many. During a rolling update both directions fail
|
|
530
|
+
A web process serves only the hashed files it built: `/styles/<hash>.css`, `/islands/<island>-<hash>.js`, `/_x/assets/<script>/<hash>.js`, `/assets/<name>.<hash>.<ext>`. With no window, an open tab holding the previous build's document gets a 404 for its stylesheet, or for its island chunk on the first click, after every deploy, one replica or many. During a rolling update with more than one web replica both directions fail on every page load, not only in old tabs: the document and its stylesheet are two requests, the load balancer may send them to pods of different builds, and the page renders with no CSS at all (the AppShell's "Skip to content" link as its first line).
|
|
531
|
+
|
|
532
|
+
Without a window the framework only limits the damage (`As of 2026-11-12`): a soft navigation whose next sheet fails becomes a full load and never retires the working sheet. A full load whose sheet 404s stays unstyled: nothing reloads it for you. A web role booted outside `development` and `test` with no window logs `X_ASSET_RETAIN_UNDECLARED`. The window is the fix. Declare it over a disk every web pod can read:
|
|
531
533
|
|
|
532
534
|
```ts
|
|
533
535
|
// app.config.ts — `deploys` is a disk from the app's defineStorage({ disks })
|
package/wiki/Known-Gaps.md
CHANGED
|
@@ -45,7 +45,7 @@ CHANGELOG.md` finds its bounds, and it changes on any commit.
|
|
|
45
45
|
| `--target binary` is a **launcher** for an app tree, and has never been served from a bare VM | `As of 2026-10-06`. It boots: `x build --target binary` compiles `apps/web/server.ts` with `--compile-autoload-package-json`, `--compile-autoload-tsconfig` and `@ultimat3/*` external (`binaryArgs`, `packages/cli/src/cmd-build.ts`), and the required `windows` CI job starts the result from a scaffold and gets `200` from `/healthz`; `packages/cli/e2e/binary-launch.e2e.test.ts` proves the same on Linux. **It is not a self-contained artifact**: at run time it reads the app's `package.json` and `tsconfig.json`, imports `app.config.ts` and every module under `apps/*`, and loads the framework from the app's `node_modules` — one instance, so the app's registrations reach the server. Unmeasured: a scaffold compiled, copied with its tree to a VM with no Bun, and served under systemd [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/e2e/binary-launch.e2e.test.ts#the%20compiled%20launcher%20resolves%20its%20app%20tree%20at%20run%20time%2C%20against%20ONE%20framework%20instance) | ship the app root, its installed `node_modules` (installed for the target OS and CPU) and the binary together, and start the binary from that root. Prove it for your own app first — `./app --version`, then `ROLE=web PORT=3000 ./app` and `curl /readyz`. Prefer `--target docker`, the self-contained artifact → [Deployment](Deployment) |
|
|
46
46
|
| A local `typecheck` step can report green on a tree CI fails, on the same commit — **one sighting, unreproduced** | `As of 2026-10`. Observed once (2026-09-17, TypeScript 7.0.2): after a `git stash -u` → branch switch → `x verify` on the other branch → switch back → `stash pop` sequence, a type error that surfaces in an UNCHANGED file (a widened index signature in a file it imports) passed locally and failed CI; deleting `tsconfig.tsbuildinfo` then reproduced CI's red locally. Five faithful reproduction attempts against 7.0.2 all stayed correctly red ([#450](https://github.com/developerz-ai/ultimate/issues/450)). **[#450](https://github.com/developerz-ai/ultimate/issues/450) itself is closed `As of 2026-09-23`** — read from the shipped fix, not from the tracker: plan 101 row 14 r ("Close #450", `docs/plans/2026/09/23/101-framework-deep-sweep/14-guards-gate.md:37`; plan `status.yml` `complete`), recorded in `CHANGELOG.md` under 22.0.0 and pinned by `packages/cli/src/verify-typecheck.test.ts`. `tsc -b` decides "up to date" by **mtime**, and Bun installs a dependency as **hardlinks** carrying its cache's old mtimes, so an upgrade to an already-cached version left every input older than the buildinfo and a root without `references` — every scaffolded app — skipped the program and reported green while a cold CI was red. A scaffolded app's `typecheck` is now `tsc -p .` ([`packages/cli/src/templates/scaffold-repo.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/templates/scaffold-repo.ts), its `"typecheck"` script), which is incremental by **content hash**, and `x verify`'s `typecheck` step picks `-p .` over `-b` for any such root ([`packages/cli/src/verify-typecheck.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/verify-typecheck.ts)); the framework root keeps `-b`. **Still open**: a *second* `tsc` racing the same buildinfo is the one suspect not excluded, and no cause for it has been shown. `x verify` deliberately takes two flags and no `--cold` pin: none — one sighting, and five faithful reproductions stayed red, so no test can hold it | CI is always cold and is the judge of record. If a local `typecheck` disagrees with it again, capture the command, its argv and its exit code before deleting any `tsconfig.tsbuildinfo` |
|
|
47
47
|
| A `stream` page with a realtime island keeps every island on the page inert until its slowest hole closes | `As of 2026-11-02`. The runtime goes `async` so a shell island answers while a hole is open, but only with no realtime boot in the document: the boot (`script defer`) has to run first (`bootScript`, [`packages/cli/src/route-islands.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/route-islands.ts)), and a deferred script waits for parsing to end. Bound by the hole's 15 s deadline | keep the slow read out of such a page's holes, or give it a short deadline of its own: `fetch(url, { signal: AbortSignal.timeout(2_000) })` |
|
|
48
|
-
| An open tab can meet a dead island across a deploy | `As of 2026-11-
|
|
48
|
+
| An open tab can meet a dead island across a deploy | `As of 2026-11-12`. A web process serves only the hashed files it built, so with `assets.retain` unset (the default) a tab holding the previous build's document gets a `no-store` 404 for its stylesheet, or for its island chunk on the first click, after every deploy; during a rolling update a new document that reaches an old pod gets no stylesheet either. What the framework does about the stylesheet half without a window: a soft navigation whose next sheet fails never swaps an unstyled page in (a GET becomes a full load, the old sheet stays) [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/render/src/navigation-stylesheet-skew.test.ts#a%20GET%20is%20loaded%20by%20the%20browser%3B%20the%20page%20on%20screen%20keeps%20its%20sheet); a full load whose sheet 404s stays unstyled — the framework does not reload it, as a reload it cannot tell from a missing file offline or under a test harness is a navigation nobody asked for. A web role booted outside development and test with no window logs `X_ASSET_RETAIN_UNDECLARED` [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/retained-assets-boot.test.ts#undeclared%3A%20nothing%20is%20published%20and%20there%20is%20no%20reader). Declared, a tab survives six deploys with build 0's island alive [evidence](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/e2e/six-deploys.e2e.test.ts#with%20assets.retain%2C%20the%20click%20boots%20build%200%E2%80%99s%20island%3A%20its%20chunk%20200%2C%20no%20404%2C%20an%20update%20offered) | declare `assets: { retain: { disk, builds } }` over a disk every web pod reads → [Deployment](Deployment#hashed-assets-across-a-deploy--assetsretain) |
|
|
49
49
|
| A soft visit waits for the slowest hole | `As of 2026-11-02`. The client router reads `response.text()` ([`packages/render/src/navigation-fetch.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/render/src/navigation-fetch.ts)) and swaps the whole answer, so holes fill through the re-run scripts and the first paint of an in-app navigation is as late as a full `ssr` render. A full load streams. No incremental parse here [pin](https://github.com/developerz-ai/ultimate/blob/main/packages/render/src/navigation-fetch.test.ts#a%20page%3A%20its%20text%2C%20its%20build%2C%20no-store%20read%20off%20cache-control) | nothing to do in an app; a page that must paint first on a soft visit declares `navigation: 'document'` |
|
|
50
50
|
| A pod evaluates the framework from **source**, one module at a time — ~28 Mi of resident memory per pod that a bundle would not hold | `As of 2026-10-01`, measured on the framework serve graph alone: 1,071 modules from source settle at **80.4 Mi**; the same graph as one `bun build --target=bun` file is 5 modules and settles at **51.8 Mi** — ~34 kB of RSS per source module, the runtime's cost and not the code's. It is the largest saving left after the per-role load and the prebuilt store (a web pod of the demo app settles at 97–102 Mi, a worker at 80–85 Mi). **Not a patch**: a registry is a module instance, so the framework bundled apart from the app is two `@ultimat3/jobs`, two `@ultimat3/entity` — the app registers into one and the boot reads the other. The unit has to be the app **and** the framework as one graph, per role, built inside the image build from a generated entry that imports what `scanAppModules` would, with the `.tsx`/`.scss` loaders as build plugins. Containers only either way (axiom 7). Design note: [`docs/architecture/13-topology-runtime.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/architecture/13-topology-runtime.md#not-built-one-bundle-per-role) pin: none — a resident-memory measurement of a running pod, not a behaviour a unit test can assert | nothing to do in an app. Size a pod's memory request from `process_resident_memory_bytes` on `/metrics`, not from a guess |
|
|
51
51
|
| Every role evaluates all of `@ultimat3/jobs` — 96 modules (`As of 2026-10-02`, by file) — whatever it runs | `As of 2026-10-01`, read off the serve graph by the names each role's code uses: a `web` pod needs 43 of them (enqueue, the outbox relay, the purge task), a `scheduler` 46, a `worker` 62. The rest ride the barrel: `worker.ts` and its eighteen dependencies in a web pod, the `backfill()` / `exportJob()` / `webhook()` factories (17 modules, 123 kB of source) in an app that declares none, and the memory driver (3 modules) outside a test. ~1.6 Mi per web pod at the measured 34 kB a module. Closing it means subpath entries (`@ultimat3/jobs/worker`, one per factory) and every importer rewritten — a breaking move for a saving the per-role bundle above makes moot, so it waits on that decision. The operator surface is **not** in this list: `JobIntrospection` is a member of the driver, and the worker announces itself and counts settles through it pin: none — a module count read off a role's serve graph, measured rather than asserted | nothing to do in an app |
|