@ultimat3/cli 31.40.0 → 31.41.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/cmd-new-spec.ts +4 -2
- package/src/cmd-new-target.ts +51 -9
- package/src/cmd-new.ts +1 -0
- package/src/codemods/index.ts +2 -0
- package/src/codemods/test-services.ts +31 -0
- package/src/dev-rebuild-isr.ts +8 -8
- package/src/dev-rebuild.ts +1 -1
- package/src/framework-schema-wait.ts +4 -0
- package/src/messages.ts +3 -0
- package/src/templates/guard-released-forms.ts +4 -1
- package/src/templates/guard-undeclared-env.ts +44 -2
- package/wiki/CLI-Reference.md +2 -2
- package/wiki/Installation.md +1 -1
- package/wiki/Realtime.md +10 -0
- package/wiki/Routes-And-Render-Modes.md +2 -1
- package/wiki/Upgrading.md +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.41.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.10",
|
|
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.41.0",
|
|
57
|
+
"@ultimat3/admin": "31.41.0",
|
|
58
|
+
"@ultimat3/ai": "31.41.0",
|
|
59
|
+
"@ultimat3/auth": "31.41.0",
|
|
60
|
+
"@ultimat3/cache": "31.41.0",
|
|
61
|
+
"@ultimat3/core": "31.41.0",
|
|
62
|
+
"@ultimat3/db": "31.41.0",
|
|
63
|
+
"@ultimat3/entity": "31.41.0",
|
|
64
|
+
"@ultimat3/flags": "31.41.0",
|
|
65
|
+
"@ultimat3/http": "31.41.0",
|
|
66
|
+
"@ultimat3/i18n": "31.41.0",
|
|
67
|
+
"@ultimat3/jobs": "31.41.0",
|
|
68
|
+
"@ultimat3/mail": "31.41.0",
|
|
69
|
+
"@ultimat3/manifest": "31.41.0",
|
|
70
|
+
"@ultimat3/mcp": "31.41.0",
|
|
71
|
+
"@ultimat3/money": "31.41.0",
|
|
72
|
+
"@ultimat3/notify": "31.41.0",
|
|
73
|
+
"@ultimat3/policy": "31.41.0",
|
|
74
|
+
"@ultimat3/pwa": "31.41.0",
|
|
75
|
+
"@ultimat3/query": "31.41.0",
|
|
76
|
+
"@ultimat3/realtime": "31.41.0",
|
|
77
|
+
"@ultimat3/render": "31.41.0",
|
|
78
|
+
"@ultimat3/schema": "31.41.0",
|
|
79
|
+
"@ultimat3/scraping": "31.41.0",
|
|
80
|
+
"@ultimat3/seo": "31.41.0",
|
|
81
|
+
"@ultimat3/storage": "31.41.0",
|
|
82
|
+
"@ultimat3/testing": "31.41.0",
|
|
83
|
+
"@ultimat3/time": "31.41.0",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/cmd-new-spec.ts
CHANGED
|
@@ -38,8 +38,10 @@ export const newSpec: CommandSpec = {
|
|
|
38
38
|
{
|
|
39
39
|
name: 'force',
|
|
40
40
|
type: 'boolean',
|
|
41
|
-
// Never over an app: `cmd-new-target.ts` refuses a directory holding
|
|
42
|
-
|
|
41
|
+
// Never over an app, never over a file: `cmd-new-target.ts` refuses a directory holding
|
|
42
|
+
// `app.config.ts` (D1) or any path the scaffold writes (round 3).
|
|
43
|
+
summary:
|
|
44
|
+
'write into an existing directory that holds no app.config.ts and none of the files x new writes',
|
|
43
45
|
},
|
|
44
46
|
],
|
|
45
47
|
};
|
package/src/cmd-new-target.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// `x new`'s refusal of a target directory that already exists. Its fix names a FREE directory —
|
|
2
2
|
// never `--force`: a fix is pasted with no diff in front of it, and `--force` over an existing app
|
|
3
|
-
// reset its `api/index.ts` and `roles.ts` to the template (D1, 2026-11-16).
|
|
3
|
+
// reset its `api/index.ts` and `roles.ts` to the template (D1, 2026-11-16). `--force` writes only
|
|
4
|
+
// into free paths: one planned path already on disk refuses the run (round 3, 2026-11-16).
|
|
4
5
|
|
|
5
|
-
// why: the target is a DIRECTORY, which `Bun.file().exists()` answers false for
|
|
6
|
-
|
|
6
|
+
// why: the target is a DIRECTORY, which `Bun.file().exists()` answers false for; `lstatSync`
|
|
7
|
+
// also sees a dangling symlink, which `Bun.write` would write through.
|
|
8
|
+
import { existsSync, lstatSync } from 'node:fs';
|
|
7
9
|
// why: Bun ships no path API; `dirname`/`join` place the sibling the fix names.
|
|
8
10
|
import { dirname, join } from 'node:path';
|
|
9
11
|
import { ERROR_DOCS_URL } from '@ultimat3/core';
|
|
@@ -37,29 +39,69 @@ export interface NewTarget {
|
|
|
37
39
|
readonly invocation: string;
|
|
38
40
|
/** The caller's flags as `reproducedFlags` spells them; `--force` is dropped here. */
|
|
39
41
|
readonly flags: readonly string[];
|
|
42
|
+
/** `planNewApp`'s paths, relative to `target`: what `--force` would write. */
|
|
43
|
+
readonly planned: readonly string[];
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
/** How many colliding paths the cause spells out before it counts the rest. */
|
|
47
|
+
const LISTED_COLLISIONS = 5;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The planned paths `--force` would overwrite: the path itself on disk (file, directory or link),
|
|
51
|
+
* or one of its parent segments on disk as something other than a directory.
|
|
52
|
+
*/
|
|
53
|
+
export function collisions(target: string, planned: readonly string[]): readonly string[] {
|
|
54
|
+
const hit = new Set<string>();
|
|
55
|
+
for (const path of planned) {
|
|
56
|
+
const segments = path.split('/');
|
|
57
|
+
for (let i = 1; i <= segments.length; i += 1) {
|
|
58
|
+
const prefix = segments.slice(0, i).join('/');
|
|
59
|
+
const stat = lstatSync(join(target, prefix), { throwIfNoEntry: false });
|
|
60
|
+
if (stat === undefined) break;
|
|
61
|
+
if (i === segments.length || !stat.isDirectory()) {
|
|
62
|
+
hit.add(prefix);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return [...hit].sort();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const listed = (paths: readonly string[]): string => {
|
|
71
|
+
const head = paths.slice(0, LISTED_COLLISIONS).join(', ');
|
|
72
|
+
const rest = paths.length - LISTED_COLLISIONS;
|
|
73
|
+
return rest > 0 ? `${head} and ${rest} more` : head;
|
|
74
|
+
};
|
|
75
|
+
|
|
42
76
|
/**
|
|
43
77
|
* The refusal of an existing target, before a byte is written — `undefined` when the run may go on.
|
|
44
|
-
* `--force` lifts it only for a directory that holds no `app.config.ts`
|
|
45
|
-
*
|
|
46
|
-
*
|
|
78
|
+
* `--force` lifts it only for a directory that holds no `app.config.ts` and none of the planned
|
|
79
|
+
* paths — a fresh clone the platform scaffolds into (`.git`, a `LICENSE`). Over an app it would
|
|
80
|
+
* reset every file the template also writes; over a monorepo root, its `package.json` and
|
|
81
|
+
* `README.md`. A result, not a throw, so the summary says which it was.
|
|
47
82
|
*/
|
|
48
83
|
export function targetConflict(input: NewTarget): CommandResult | undefined {
|
|
49
84
|
const { target, slug, force, invocation, flags } = input;
|
|
50
85
|
if (!existsSync(target)) return undefined;
|
|
51
86
|
const holdsApp = existsSync(join(target, 'app.config.ts'));
|
|
52
|
-
|
|
87
|
+
const taken = force && !holdsApp ? collisions(target, input.planned) : [];
|
|
88
|
+
if (force && !holdsApp && taken.length === 0) return undefined;
|
|
53
89
|
return {
|
|
54
90
|
ok: false,
|
|
55
91
|
command: 'new',
|
|
56
|
-
summary:
|
|
92
|
+
summary: holdsApp
|
|
93
|
+
? msg('cli.new.existsApp', { dir: target })
|
|
94
|
+
: taken.length > 0
|
|
95
|
+
? msg('cli.new.existsFiles', { dir: target, count: taken.length })
|
|
96
|
+
: msg('cli.new.exists', { dir: target }),
|
|
57
97
|
findings: [
|
|
58
98
|
{
|
|
59
99
|
code: 'X_GENERATE_CONFLICT',
|
|
60
100
|
cause: holdsApp
|
|
61
101
|
? `${target} already exists and holds an app (app.config.ts): scaffolding into it, --force included, would reset its registrations and grants to the template, so x new refuses it`
|
|
62
|
-
:
|
|
102
|
+
: taken.length > 0
|
|
103
|
+
? `${target} already holds ${taken.length} path(s) x new would write: ${listed(taken)}. --force writes only into free paths, so nothing was written — move each aside (mv -n ${quoteArg(taken[0] ?? '')} ${quoteArg(`${taken[0] ?? ''}.orig`)}, …) and run with --force again to scaffold here, or take a free name for a fresh app`
|
|
104
|
+
: `${target} already exists and holds no app.config.ts — --force writes the scaffold into it only when none of its paths are taken, a free name writes a fresh app`,
|
|
63
105
|
fix: [
|
|
64
106
|
invocation,
|
|
65
107
|
quoteArg(freeSibling(target, slug) ?? '<another-name>'),
|
package/src/cmd-new.ts
CHANGED
|
@@ -315,6 +315,7 @@ export const newCommand: CliCommand = {
|
|
|
315
315
|
force: flagBool(ctx.args, 'force'),
|
|
316
316
|
invocation: invocationOf(ctx, 'new'),
|
|
317
317
|
flags: callerFlags(ctx),
|
|
318
|
+
planned: planNewApp(options).map((file) => file.path),
|
|
318
319
|
});
|
|
319
320
|
if (conflict !== undefined) return conflict;
|
|
320
321
|
// Read BEFORE writing: `--force` into a directory that already held files must never
|
package/src/codemods/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { codemod as reproGitignore } from './repro-gitignore';
|
|
|
26
26
|
import { codemod as runtimePin } from './runtime-pin';
|
|
27
27
|
import { codemod as solidFloor } from './solid-floor';
|
|
28
28
|
import { codemod as testPorts } from './test-ports';
|
|
29
|
+
import { codemod as testServices } from './test-services';
|
|
29
30
|
import { codemod as testSuites } from './test-suites';
|
|
30
31
|
import { codemod as themeToggleMountOver } from './theme-toggle-mount-over';
|
|
31
32
|
import { codemod as vendoredGuards } from './vendored-guards';
|
|
@@ -61,4 +62,5 @@ export const CODEMODS: readonly Codemod[] = [
|
|
|
61
62
|
migrateJobOrdered,
|
|
62
63
|
ciServicesEnv,
|
|
63
64
|
docsEnvGuard,
|
|
65
|
+
testServices,
|
|
64
66
|
];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// 31.41.0: an app scaffolded before 31.27.0 gains the test-services stack `test-suites` and the
|
|
2
|
+
// `live` floor assume — `docker/docker-compose.test.yml` and `docker/test-services.env`, as `x new`
|
|
3
|
+
// writes them, under this app's own ports. A file the app already holds is its own.
|
|
4
|
+
|
|
5
|
+
import { names } from '../templates/naming';
|
|
6
|
+
import { testServicesFiles } from '../templates/scaffold-test-services';
|
|
7
|
+
import { appName } from './agents-dev-mcp';
|
|
8
|
+
import type { Codemod, CodemodResult } from './codemod';
|
|
9
|
+
import { mergeResults, readText, writeIfAbsent } from './engine-edits';
|
|
10
|
+
|
|
11
|
+
/** The live suite's host: an app with no db package has nothing for a test service to serve. */
|
|
12
|
+
const DB_HOST = 'packages/db/src/index.ts';
|
|
13
|
+
|
|
14
|
+
export const codemod: Codemod = {
|
|
15
|
+
id: 'test-services',
|
|
16
|
+
since: '31.41.0',
|
|
17
|
+
summary:
|
|
18
|
+
'the test-services stack a live suite needs, for an app scaffolded before it: docker/docker-compose.test.yml and docker/test-services.env',
|
|
19
|
+
async run(app) {
|
|
20
|
+
if (!(await app.exists(DB_HOST))) return { changed: [], skipped: [] };
|
|
21
|
+
const kebab = appName((await readText(app, 'package.json'))?.text ?? '');
|
|
22
|
+
if (kebab === undefined) return { changed: [], skipped: [] };
|
|
23
|
+
const results: CodemodResult[] = [];
|
|
24
|
+
for (const file of testServicesFiles(names(kebab))) {
|
|
25
|
+
if (typeof file.contents === 'string') {
|
|
26
|
+
results.push(await writeIfAbsent(app, file.path, file.contents));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return mergeResults(results);
|
|
30
|
+
},
|
|
31
|
+
};
|
package/src/dev-rebuild-isr.ts
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// request renders with the new module.
|
|
3
3
|
|
|
4
4
|
import { markAllInvalidated } from '@ultimat3/cache';
|
|
5
|
-
import type {
|
|
5
|
+
import type { IsrController } from '@ultimat3/render/server';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* the OLD module before the save samples its fence first; deleted paths alone left that fence
|
|
10
|
-
* valid
|
|
11
|
-
* `flushProcessTiers`: that also purges a CDN tier, the
|
|
8
|
+
* Forget every page a save made stale — after voiding every fill in flight. A render that began
|
|
9
|
+
* with the OLD module before the save samples its fence first; deleted paths alone left that fence
|
|
10
|
+
* valid (audit round 2), and a request after the save still JOINED that render's flight (round 3):
|
|
11
|
+
* `forgetAll` evicts the flights too. Never `flushProcessTiers`: that also purges a CDN tier, the
|
|
12
|
+
* real CDN when its keys are in `.env`.
|
|
12
13
|
*/
|
|
13
|
-
export async function clearIsrForRebuild(
|
|
14
|
+
export async function clearIsrForRebuild(isr: Pick<IsrController, 'forgetAll'>): Promise<void> {
|
|
14
15
|
markAllInvalidated();
|
|
15
|
-
|
|
16
|
-
for (const path of await store.paths()) await store.delete(path);
|
|
16
|
+
await isr.forgetAll();
|
|
17
17
|
}
|
package/src/dev-rebuild.ts
CHANGED
|
@@ -151,7 +151,7 @@ export function devRebuilder(
|
|
|
151
151
|
state.appFindings = findings;
|
|
152
152
|
state.islands = islands;
|
|
153
153
|
const unserved = await refreshDevices();
|
|
154
|
-
await clearIsrForRebuild(isr
|
|
154
|
+
await clearIsrForRebuild(isr);
|
|
155
155
|
state.reloads += 1;
|
|
156
156
|
// Read on EVERY rebuild, so a pin one save reached is never reported against the next save:
|
|
157
157
|
// this save's own pins name it, and only a save that reached none inherits the held ones.
|
|
@@ -94,6 +94,10 @@ export async function waitForSchema<T>(
|
|
|
94
94
|
let refuse: ((waitedMs?: number) => UltimateError) | undefined;
|
|
95
95
|
const drained = (): UltimateError => (refuse ?? waitDrained)(clock.monotonic() - startedAt);
|
|
96
96
|
try {
|
|
97
|
+
// A SIGTERM while the boot still loaded modules ran the `accept` phase before this hook existed,
|
|
98
|
+
// so its abort was never heard: refuse before the first read, which an unreachable database
|
|
99
|
+
// would hold past the pod's grace.
|
|
100
|
+
if (isDraining()) throw drained();
|
|
97
101
|
for (let attempt = 1; ; attempt += 1) {
|
|
98
102
|
// Raced against the drain like the sleep below: a read on an unreachable database hangs
|
|
99
103
|
// until the pool gives up — ~125 s on a worker, past the pod's grace, so SIGKILL (137).
|
package/src/messages.ts
CHANGED
|
@@ -226,6 +226,9 @@ const CATALOG = {
|
|
|
226
226
|
'cli.new.exists': '{dir} already exists — nothing was written',
|
|
227
227
|
'cli.new.existsApp':
|
|
228
228
|
'{dir} already holds an app — x new never scaffolds over one, --force included',
|
|
229
|
+
// `--force` over a directory that already holds paths the scaffold writes: refused, not overwritten.
|
|
230
|
+
'cli.new.existsFiles':
|
|
231
|
+
'{dir} already holds {count} of the files x new writes — nothing was written, --force included',
|
|
229
232
|
'cli.new.wrote': ' {count} files in {dir}',
|
|
230
233
|
'cli.new.noRepository': ' no repository — {problem}',
|
|
231
234
|
// `git init` ran and the commit did not: `.git` exists, so "no repository" was false.
|
|
@@ -70,7 +70,10 @@ export const RELEASED_GUARD_FORMS: Readonly<
|
|
|
70
70
|
['2xnl4zuy9xv6f', 'error'],
|
|
71
71
|
['3b0u9i8hze00x', 'error'],
|
|
72
72
|
],
|
|
73
|
-
'undeclared-env': [
|
|
73
|
+
'undeclared-env': [
|
|
74
|
+
['3gsy96z8bgrrl', 'error'],
|
|
75
|
+
['81vvl6xx5bb8', 'error'],
|
|
76
|
+
],
|
|
74
77
|
'undefined-style-class': [
|
|
75
78
|
['3food9t4vrzv8', 'error'],
|
|
76
79
|
['w7as1ib1ido8', 'error'],
|
|
@@ -47,7 +47,7 @@ const source =
|
|
|
47
47
|
// Read: \`process.env.X\`, \`Bun.env.X\`, \`import.meta.env.X\` and the \`['X']\` forms, in app source
|
|
48
48
|
// (\`apps/**\`, \`packages/**\`; never a test). Declared: a key of \`envSchema\` or of the object
|
|
49
49
|
// \`defineEnv({ … })\` is handed, in \`app.config.ts\` — the declaration \`x env check\` reads.
|
|
50
|
-
// Allowed: every name the framework reads itself, \`NODE_ENV\` among them.
|
|
50
|
+
// Allowed: every name the framework reads itself, \`NODE_ENV\` among them, and the OS's own.
|
|
51
51
|
|
|
52
52
|
import type { Finding, Guard } from '@ultimat3/cli';
|
|
53
53
|
|
|
@@ -113,6 +113,46 @@ export function declaredNames(config: string): ReadonlySet<string> {
|
|
|
113
113
|
return names;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/** The OS's own, set by the machine and never by a deploy: \`env: { PATH }\` for a child process. */
|
|
117
|
+
const AMBIENT = new Set(['HOME', 'HOSTNAME', 'LANG', 'PATH', 'PWD', 'SHELL', 'TMPDIR', 'USER']);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Every string's CONTENTS blanked in place, so a name quoted in prose or data (a generated docs
|
|
121
|
+
* file) is no read. A template's \`\${…}\` stays code. A regex literal holding a quote reads as a
|
|
122
|
+
* string opening: the rest of that file then reports less, never something false.
|
|
123
|
+
*/
|
|
124
|
+
const codeOnly = (text: string): string => {
|
|
125
|
+
const out = text.split('');
|
|
126
|
+
const braces: number[] = [];
|
|
127
|
+
let quote = '';
|
|
128
|
+
for (let index = 0; index < out.length; index += 1) {
|
|
129
|
+
const character = text.charAt(index);
|
|
130
|
+
if (quote === '') {
|
|
131
|
+
const top = braces.length - 1;
|
|
132
|
+
if (character === "'" || character === '"' || character === '\`') quote = character;
|
|
133
|
+
else if (character === '{' && top >= 0) braces[top] = (braces[top] ?? 0) + 1;
|
|
134
|
+
else if (character === '}' && top >= 0) {
|
|
135
|
+
if ((braces[top] ?? 0) === 0) {
|
|
136
|
+
braces.pop();
|
|
137
|
+
quote = '\`';
|
|
138
|
+
} else braces[top] = (braces[top] ?? 0) - 1;
|
|
139
|
+
}
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (character === '\\\\') {
|
|
143
|
+
out[index] = ' ';
|
|
144
|
+
if (text.charAt(index + 1) !== '\\n') out[index + 1] = ' ';
|
|
145
|
+
index += 1;
|
|
146
|
+
} else if (character === quote) quote = '';
|
|
147
|
+
else if (quote === '\`' && character === '$' && text.charAt(index + 1) === '{') {
|
|
148
|
+
braces.push(0);
|
|
149
|
+
quote = '';
|
|
150
|
+
index += 1;
|
|
151
|
+
} else if (character !== '\\n') out[index] = ' ';
|
|
152
|
+
}
|
|
153
|
+
return out.join('');
|
|
154
|
+
};
|
|
155
|
+
|
|
116
156
|
const isFramework = (name: string): boolean =>
|
|
117
157
|
FRAMEWORK.has(name) || FRAMEWORK_PREFIXES.some((head) => name.startsWith(head));
|
|
118
158
|
|
|
@@ -122,9 +162,11 @@ export function undeclaredEnv(files: readonly SourceFile[], config: string): rea
|
|
|
122
162
|
const findings: Finding[] = [];
|
|
123
163
|
for (const file of files) {
|
|
124
164
|
const text = blank(file.source);
|
|
165
|
+
const code = codeOnly(text);
|
|
125
166
|
for (const match of text.matchAll(READ)) {
|
|
126
167
|
const name = match[1] ?? match[3] ?? '';
|
|
127
|
-
if (
|
|
168
|
+
if (code.charAt(match.index) === ' ') continue;
|
|
169
|
+
if (declared.has(name) || isFramework(name) || AMBIENT.has(name)) continue;
|
|
128
170
|
findings.push({
|
|
129
171
|
code: CODE,
|
|
130
172
|
cause: \`\${file.path}:\${lineOf(text, match.index)} reads \${match[0]}, which app.config.ts does not declare — x env check never asks for it, so a deploy without it boots and fails at the first read\`,
|
package/wiki/CLI-Reference.md
CHANGED
|
@@ -87,7 +87,7 @@ x new <name> [--dir path] [--shape api|blog|dashboard] [--no-example] [--no-git]
|
|
|
87
87
|
| `--shape` | string | none | start from an app shape — `api`, `blog` or `dashboard`, each an overlay over this scaffold ([Shapes](Shapes)). An unknown name is `X_NEW_SHAPE_UNKNOWN`; with `--no-example`, `X_NEW_SHAPE_CONFLICT` (a shape is its own example). Both refuse before a file is written. `dashboard` then runs `x g sign-in --password` in the new app (listed under `data.generate` by `--dry-run`); a refusal there is `X_NEW_SHAPE_GENERATE_FAILED` |
|
|
88
88
|
| `--git` / `--no-git` | boolean | `true` | `git init`, then one commit named `x new`. On by default because three surfaces assume a repository — `x affected`, `x ci` and `x pr`. A git that is absent or fails never fails `x new`: the tree is the verdict, and `data.git` carries `{ initialized, committed, problem }` |
|
|
89
89
|
| `--dry-run` | boolean | `false` | print the file list, write nothing |
|
|
90
|
-
| `--force` | boolean | `false` | write into a directory that already exists and holds no `app.config.ts`. Over an app it is refused, `--force` included (`X_GENERATE_CONFLICT`), and the fix names a free directory (`<name>-2`), never `--force`. `As of 2026-11` |
|
|
90
|
+
| `--force` | boolean | `false` | write into a directory that already exists and holds no `app.config.ts`, only into free paths: one path the scaffold would write already on disk (`README.md`, `package.json`, `.gitignore`, …) refuses the run before a byte is written — `X_GENERATE_CONFLICT`, the first five taken paths and a count in `cause`, the same free-directory fix. Never an overwrite. A fresh clone holding `.git` and a `LICENSE` scaffolds. Over an app it is refused, `--force` included (`X_GENERATE_CONFLICT`), and the fix names a free directory (`<name>-2`), never `--force`. `As of 2026-11` |
|
|
91
91
|
|
|
92
92
|
**The name must be one `app.config.ts` accepts.** `x new` asks core's own `defineConfig` about the slug before anything is planned (`appNameIssue`, `packages/cli/src/app-name.ts`) — it is written verbatim as `name:`. Refused with `X_CLI_BAD_FLAG` and a corrected name in the `fix:`, the rest of your flags kept:
|
|
93
93
|
|
|
@@ -127,7 +127,7 @@ Deployment artifacts are part of the scaffold — an app is deployable the momen
|
|
|
127
127
|
|
|
128
128
|
The framework repo's own `docker/helm` carries one template the scaffold does not — `pdb.yaml`, cluster policy rather than app topology. It ships in no npm tarball, so copying it is a `git clone` of this repo, not an install. An app chart from before the monitoring pair gets it from `x g chart-alerts`.
|
|
129
129
|
|
|
130
|
-
`bunx create-ultimate myapp` is the same generator without a global install — and it says so in its own refusals, `As of 2026-08-23`: a `fix:` line is a command the reader is meant to RUN, and `x new myapp` named a binary they have not installed yet. Errors: `X_GENERATE_CONFLICT` (the directory exists — `fix` is the same command with `--force`), `X_CLI_BAD_FLAG` (no name given, or a path where a name goes), `X_BUN_VERSION`.
|
|
130
|
+
`bunx create-ultimate myapp` is the same generator without a global install — and it says so in its own refusals, `As of 2026-08-23`: a `fix:` line is a command the reader is meant to RUN, and `x new myapp` named a binary they have not installed yet. Errors: `X_GENERATE_CONFLICT` (the directory exists — `fix` is the same command with a free name, `<name>-2`; never `--force`), `X_CLI_BAD_FLAG` (no name given, or a path where a name goes), `X_BUN_VERSION`.
|
|
131
131
|
|
|
132
132
|
## x dev
|
|
133
133
|
|
package/wiki/Installation.md
CHANGED
|
@@ -69,7 +69,7 @@ one.
|
|
|
69
69
|
| `--shape <shape>` | none | start from `api`, `blog` or `dashboard` instead of the dashboard and example slice — what each writes and leaves out: [Shapes](Shapes) |
|
|
70
70
|
| `--git` / `--no-git` | `--git` | `git init` and commit the scaffold |
|
|
71
71
|
| `--dry-run` | off | print the file list, write nothing |
|
|
72
|
-
| `--force` | off | write into a directory that already exists
|
|
72
|
+
| `--force` | off | write into a directory that already exists, holds no `app.config.ts` and none of the paths the scaffold writes (a fresh clone: `.git`, a `LICENSE`); one taken path (`README.md`, `package.json`, …) refuses the run with `X_GENERATE_CONFLICT` naming them, nothing written — never an overwrite |
|
|
73
73
|
| `--json` | off | machine-readable result: the directory, every path written, the git outcome |
|
|
74
74
|
|
|
75
75
|
There is **no** `--admin`, `--locale`, `--tz`, `--currency`, `--no-install` or `--yes` — this table
|
package/wiki/Realtime.md
CHANGED
|
@@ -368,6 +368,16 @@ plan-101 DX ledger #21.
|
|
|
368
368
|
| the browser | `useChannel(decl, params, handlers?)`; `topic()` is the one way to spell a topic, and `bun run channel-literals` refuses any other |
|
|
369
369
|
| the manifest | lists every channel (`describeChannels`, on `@ultimat3/realtime/server`). In a contract diff these are **breaking**: a channel removed, its params changed, its policy changed, a record type no longer carried, `events` switched off |
|
|
370
370
|
|
|
371
|
+
### A tenant param is the subscriber's org
|
|
372
|
+
|
|
373
|
+
`As of 2026-11-17` (31.41.0). A channel param that names a records entity's tenant column — `orgId` on
|
|
374
|
+
`records: [posts]` — must equal the subscribing actor's org, checked by the hub before the policy
|
|
375
|
+
runs: the topic `org-feed.<orgId>` IS that org's stream of records, events and presence. Another
|
|
376
|
+
org's value is `X_TOPIC_FORBIDDEN` (cause `X_TENANCY_ACTOR_MISMATCH`), an actor with no org
|
|
377
|
+
`X_TENANCY_ACTOR_ORG_REQUIRED`, a proven `crossTenant()` scope passes. So `policy: can('post:read')`
|
|
378
|
+
is enough: the policy decides the permission, the mechanism decides the tenant — the same split an
|
|
379
|
+
HTTP read has.
|
|
380
|
+
|
|
371
381
|
## A channel event re-reads the page
|
|
372
382
|
|
|
373
383
|
`As of 30.0.0`. For a server-rendered page with nothing to push but "this changed": the channel
|
|
@@ -250,7 +250,7 @@ Order inside one bust: read tiers (farthest first) → this origin's ISR pages
|
|
|
250
250
|
|
|
251
251
|
## Why `stream` is the app default
|
|
252
252
|
|
|
253
|
-
An authed page needs fresh data and fast first paint. `ssr` gives freshness and a slow TTFB — the whole page waits for the slowest query. `stream` gives both halves: shell now, data as it resolves. A page whose body belongs in the browser declares an `island({ src })`, budgeted in real bytes; there is no client-side-only mode
|
|
253
|
+
An authed page needs fresh data and fast first paint. `ssr` gives freshness and a slow TTFB — the whole page waits for the slowest query. `stream` gives both halves: shell now, data as it resolves. A page whose body belongs in the browser declares an `island({ src })`, budgeted in real bytes; there is no client-side-only mode. Moving between pages without a full reload is the client router's ([Client Navigation](Client-Navigation)), opted into per surface with `navigation.client`; it swaps server-rendered documents, never renders one in the browser.
|
|
254
254
|
|
|
255
255
|
`x g route`, `x g resource` and `x new`'s dashboard write `render: 'stream'` on `app/`. A `stream` page with no hole registers and pays nothing: it is one flush.
|
|
256
256
|
|
|
@@ -311,6 +311,7 @@ In a VDOM framework a streaming shell still pays for hydrating the whole tree, w
|
|
|
311
311
|
| A hole's island | hydrates from its chunk: the chunk carries the hydration runtime after its reveal, and the realtime boot if this is the first island that needs it |
|
|
312
312
|
| A shell island while a hole is open | live: the runtime is `<script type="module" async>`, so it does not wait for parsing to end. With a realtime boot in the document it stays deferred ([Known gaps](Known-Gaps)) |
|
|
313
313
|
| Client router | a soft visit reads the whole answer before it swaps ([Known gaps](Known-Gaps)); every reveal still runs |
|
|
314
|
+
| A hand-rolled swap | the reveal is an inline `<script>`, and a document parsed by `DOMParser` or set through `innerHTML` runs none, so its holes keep their fallback. Re-run the scripts, or call `refresh()` / `scheduleRefresh()` from `@ultimat3/render/client`, which the router swaps through (`navigation-swap.ts`'s `runScripts`) |
|
|
314
315
|
| CSP | every chunk's inline script is a body `inlineScriptSources()` already hashes |
|
|
315
316
|
|
|
316
317
|
Solid's own boundary component is not this: it throws outside a Solid renderer, and the server JSX factory is inert by design.
|
package/wiki/Upgrading.md
CHANGED
|
@@ -301,6 +301,7 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
|
|
|
301
301
|
| a serving role over a schema behind its build **waits** for the migrate step (**31.29.0**) instead of exiting — framework stamp and app migrations alike — and exits after `ULTIMATE_SCHEMA_WAIT_MS` (default 300000); the chart's migrate Job is an Argo CD `Sync` hook in wave −1, named by a hash of its image, its migrate settings and the chart version, deleted on success, and runs on `helm rollback` too | `x upgrade --json` (codemods `migrate-job-ordered`, `helm-alerts-deploy`); after a pre-31.29 chart, `kubectl delete job <release>-migrate` once; `ULTIMATE_SCHEMA_WAIT_MS=0` keeps the old refuse-at-once |
|
|
302
302
|
| `overrides` an app carries for `seroval`, `seroval-plugins` or `source-map-js` are no longer needed from **31.28.0**: `@ultimat3/ui`'s `solid-js` peer is `^1.9.18`, which requires the patched `seroval`; `source-map-js` and `immutable` arrive through `sass` and need a refreshed lockfile. `x doctor` warns below each floor (`X_ADVISORY_FLOOR_UNMET`) | drop those `overrides`, then `x upgrade --json` (its `solid-floor` codemod raises `solid-js`) and `bun update source-map-js immutable` |
|
|
303
303
|
| two shipped guards report more (**31.40.0**), built in: `raw-colour` (`X_RAW_COLOUR`) also reads a component's inline `style` (`style={{ color: '#f00' }}`, a quoted CSS string), and `untranslated-string` (`X_UNTRANSLATED_STRING`) also reads typed user-facing attributes (`aria-label`, `title`, `placeholder`, `alt`, …). A third, `undeclared-env` (`X_UNDECLARED_ENV`), is new: a raw `process.env.X` / `Bun.env.X` that `app.config.ts` does not declare. Every app runs them on its next install; a copy still in `guards/` keeps the old rule until `x upgrade` migrates it to the release after 31.39.0 | each finding names its edit: a semantic token, a `t('…')` key, or the `envSchema` entry to add; `"<name>": "off"` in `guards/shipped.json` opts out |
|
|
304
|
+
| the shipped `undeclared-env` guard reports less (**31.41.0**), built in: a name quoted inside a string (a generated docs file holding `process.env.X` as text) and a read of the OS's own `PATH`, `HOME`, `TMPDIR`, `USER`, `SHELL`, `PWD`, `LANG` or `HOSTNAME` are no longer `X_UNDECLARED_ENV`. A read inside a template's `${…}` still is | nothing, for the built-in guard. A vendored `guards/undeclared-env.ts` you never edited: `x upgrade` migrates it. An edited one keeps your rule; compare it with `x g guard undeclared-env --force`'s diff |
|
|
304
305
|
|
|
305
306
|
## 29.x → 30.0.0, entry by entry
|
|
306
307
|
|