@ultimat3/cli 31.40.1 → 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/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/templates/guard-released-forms.ts +4 -1
- package/src/templates/guard-undeclared-env.ts +44 -2
- 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/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).
|
|
@@ -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\`,
|
|
@@ -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
|
|