@ultimat3/cli 31.30.0 → 31.32.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 +30 -30
- package/src/app-boundaries.ts +11 -7
- package/src/cdp-shot-driver.ts +21 -5
- package/src/ci-runs.ts +27 -8
- package/src/cmd-build.ts +11 -7
- package/src/cmd-ci.ts +1 -1
- package/src/cmd-db-backfill.ts +8 -5
- package/src/cmd-deploy.ts +1 -1
- package/src/cmd-doctor.ts +14 -3
- package/src/cmd-i18n.ts +3 -2
- package/src/cmd-planned.ts +2 -1
- package/src/cmd-repro.ts +8 -2
- package/src/cmd-shot-island.ts +4 -2
- package/src/cmd-test.ts +5 -2
- package/src/db-seed.ts +2 -1
- package/src/dev-lock.ts +2 -2
- package/src/duplicate-packages.ts +5 -1
- package/src/errors.ts +11 -10
- package/src/flag-number.ts +2 -1
- package/src/generate-files.ts +1 -1
- package/src/generate-kinds.ts +2 -2
- package/src/gh-target.ts +3 -2
- package/src/guards.ts +2 -1
- package/src/i18n-registration.ts +2 -1
- package/src/island-capture.ts +5 -4
- package/src/island-shot-errors.ts +2 -1
- package/src/mcp-errors.ts +3 -1
- package/src/parse.ts +3 -3
- package/src/pr-threads.ts +2 -1
- package/src/role-start.ts +3 -2
- package/src/role-sync.ts +2 -1
- package/src/schema-drift.ts +11 -14
- package/src/shell-quote.ts +8 -1
- package/src/shot-locale.ts +2 -1
- package/src/shot-route.ts +2 -1
- package/src/static-report.ts +18 -15
- package/src/test-select.ts +1 -1
- package/src/verify-floor.ts +2 -1
- package/src/verify-services.ts +2 -1
- package/src/workspace-checks.ts +4 -3
- package/src/workspace-external-deps.ts +4 -2
- package/wiki/Known-Gaps.md +30 -0
- package/wiki/Stability.md +21 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.32.0",
|
|
4
4
|
"description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -52,35 +52,35 @@
|
|
|
52
52
|
"dev": "bun run src/bin.ts dev"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@babel/core": "^8.0.
|
|
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.
|
|
55
|
+
"@babel/core": "^8.0.10",
|
|
56
|
+
"@ultimat3/action": "31.32.0",
|
|
57
|
+
"@ultimat3/admin": "31.32.0",
|
|
58
|
+
"@ultimat3/ai": "31.32.0",
|
|
59
|
+
"@ultimat3/auth": "31.32.0",
|
|
60
|
+
"@ultimat3/cache": "31.32.0",
|
|
61
|
+
"@ultimat3/core": "31.32.0",
|
|
62
|
+
"@ultimat3/db": "31.32.0",
|
|
63
|
+
"@ultimat3/entity": "31.32.0",
|
|
64
|
+
"@ultimat3/flags": "31.32.0",
|
|
65
|
+
"@ultimat3/http": "31.32.0",
|
|
66
|
+
"@ultimat3/i18n": "31.32.0",
|
|
67
|
+
"@ultimat3/jobs": "31.32.0",
|
|
68
|
+
"@ultimat3/mail": "31.32.0",
|
|
69
|
+
"@ultimat3/manifest": "31.32.0",
|
|
70
|
+
"@ultimat3/mcp": "31.32.0",
|
|
71
|
+
"@ultimat3/money": "31.32.0",
|
|
72
|
+
"@ultimat3/notify": "31.32.0",
|
|
73
|
+
"@ultimat3/policy": "31.32.0",
|
|
74
|
+
"@ultimat3/pwa": "31.32.0",
|
|
75
|
+
"@ultimat3/query": "31.32.0",
|
|
76
|
+
"@ultimat3/realtime": "31.32.0",
|
|
77
|
+
"@ultimat3/render": "31.32.0",
|
|
78
|
+
"@ultimat3/schema": "31.32.0",
|
|
79
|
+
"@ultimat3/scraping": "31.32.0",
|
|
80
|
+
"@ultimat3/seo": "31.32.0",
|
|
81
|
+
"@ultimat3/storage": "31.32.0",
|
|
82
|
+
"@ultimat3/testing": "31.32.0",
|
|
83
|
+
"@ultimat3/time": "31.32.0",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/app-boundaries.ts
CHANGED
|
@@ -50,13 +50,17 @@ export interface SourceFile {
|
|
|
50
50
|
readonly source: string;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
// Null-prototype: a rule that is not one of these reads `undefined`, never an `Object` member.
|
|
54
|
+
const CODE_OF: Readonly<Record<BoundaryRule, BoundaryCode>> = Object.assign(
|
|
55
|
+
Object.create(null) as object,
|
|
56
|
+
{
|
|
57
|
+
'site-imports-app': 'X_BOUNDARY_SITE_TO_APP',
|
|
58
|
+
'shared-is-a-leaf': 'X_BOUNDARY_SHARED_LEAF',
|
|
59
|
+
'app-imports-api-at-runtime': 'X_BOUNDARY_APP_TO_API',
|
|
60
|
+
// Every other crossing `SURFACE_SPECS` does not allow: the table is the rule (`@ultimat3/render`).
|
|
61
|
+
'surface-imports-surface': 'X_BOUNDARY_SURFACE_IMPORT',
|
|
62
|
+
} satisfies Record<BoundaryRule, BoundaryCode>,
|
|
63
|
+
);
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* The one rule → diagnostic-code mapping. `x verify` reports a surface violation as a finding and
|
package/src/cdp-shot-driver.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// else runs over `--cdp-url`. One `open()` is one browser and one page, so a picture's console and
|
|
4
4
|
// network are its own. The page is `cdp-shot-page.ts`; this file is the session around it.
|
|
5
5
|
|
|
6
|
+
import { renderThrowable } from '@ultimat3/core';
|
|
6
7
|
import type { CdpConnection, LaunchedBrowser } from '@ultimat3/scraping/cdp';
|
|
7
8
|
import {
|
|
8
9
|
CdpBrowserMissingError,
|
|
@@ -31,7 +32,7 @@ export interface CdpShotDriverOptions {
|
|
|
31
32
|
| ((executable: string, timeoutMs: number) => Promise<LaunchedBrowser>)
|
|
32
33
|
| undefined;
|
|
33
34
|
readonly connect?: ((endpoint: string, timeoutMs: number) => Promise<CdpConnection>) | undefined;
|
|
34
|
-
readonly fetchJson?: ((url: string) => Promise<unknown>) | undefined;
|
|
35
|
+
readonly fetchJson?: ((url: string, timeoutMs: number) => Promise<unknown>) | undefined;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const field = (value: unknown, key: string): string | undefined => {
|
|
@@ -46,11 +47,12 @@ const field = (value: unknown, key: string): string | undefined => {
|
|
|
46
47
|
*/
|
|
47
48
|
async function socketUrl(
|
|
48
49
|
cdpUrl: string,
|
|
49
|
-
|
|
50
|
+
timeoutMs: number,
|
|
51
|
+
fetchJson: (url: string, timeoutMs: number) => Promise<unknown>,
|
|
50
52
|
): Promise<string> {
|
|
51
53
|
if (cdpUrl.startsWith('ws://') || cdpUrl.startsWith('wss://')) return cdpUrl;
|
|
52
54
|
const version = new URL('/json/version', cdpUrl).toString();
|
|
53
|
-
const socket = field(await fetchJson(version), 'webSocketDebuggerUrl');
|
|
55
|
+
const socket = field(await fetchJson(version, timeoutMs), 'webSocketDebuggerUrl');
|
|
54
56
|
if (socket === undefined) {
|
|
55
57
|
throw new CdpCallFailedError({
|
|
56
58
|
method: `GET ${version}`,
|
|
@@ -60,7 +62,17 @@ async function socketUrl(
|
|
|
60
62
|
return socket;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Under the session's own deadline: a sidecar that accepts the socket and never answers held
|
|
67
|
+
* `x shot` for as long as it liked, because nothing else bounds this one request.
|
|
68
|
+
*/
|
|
69
|
+
const defaultFetchJson = async (url: string, timeoutMs: number): Promise<unknown> => {
|
|
70
|
+
try {
|
|
71
|
+
return await (await fetch(url, { signal: AbortSignal.timeout(timeoutMs) })).json();
|
|
72
|
+
} catch (error) {
|
|
73
|
+
throw new CdpCallFailedError({ method: `GET ${url}`, detail: renderThrowable(error) });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
64
76
|
|
|
65
77
|
export function cdpShotDriver(options: CdpShotDriverOptions): ShotDriver {
|
|
66
78
|
const viewport = options.viewport ?? DEFAULT_SHOT_VIEWPORT;
|
|
@@ -76,7 +88,11 @@ export function cdpShotDriver(options: CdpShotDriverOptions): ShotDriver {
|
|
|
76
88
|
timeoutMs: number,
|
|
77
89
|
): Promise<{ connection: CdpConnection; end: () => Promise<void> }> => {
|
|
78
90
|
if (options.cdpUrl !== undefined) {
|
|
79
|
-
const endpoint = await socketUrl(
|
|
91
|
+
const endpoint = await socketUrl(
|
|
92
|
+
options.cdpUrl,
|
|
93
|
+
timeoutMs,
|
|
94
|
+
options.fetchJson ?? defaultFetchJson,
|
|
95
|
+
);
|
|
80
96
|
const connection = await connect(endpoint, timeoutMs);
|
|
81
97
|
return {
|
|
82
98
|
connection,
|
package/src/ci-runs.ts
CHANGED
|
@@ -6,15 +6,26 @@ import { t } from '@ultimat3/schema';
|
|
|
6
6
|
import type { GhHost } from './gh';
|
|
7
7
|
import { ghJson, runGh } from './gh';
|
|
8
8
|
import type { GhRepo } from './gh-target';
|
|
9
|
+
import { quoteArg } from './shell-quote';
|
|
9
10
|
|
|
10
11
|
/** The fields both `gh run list` and `gh run view` accept, named once so the two agree. */
|
|
11
12
|
export const RUN_FIELDS =
|
|
12
13
|
'databaseId,status,conclusion,headBranch,displayTitle,workflowName,url,createdAt,headSha';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A run's, a job's or a step's verdict as `gh` prints it: `""` until it has one (captured
|
|
17
|
+
* 2026-11-16, `ci-runs-fixture.ts`), so the empty string is read here and becomes `null` below.
|
|
18
|
+
*/
|
|
19
|
+
const VERDICT = t.nullable(t.string.min(0));
|
|
20
|
+
|
|
21
|
+
/** `""` is no verdict yet: the one spelling the rest of `x ci` reads is `null`. */
|
|
22
|
+
const verdictOf = (conclusion: string | null): string | null =>
|
|
23
|
+
conclusion === '' ? null : conclusion;
|
|
24
|
+
|
|
14
25
|
const RUN_ROW = t.object({
|
|
15
26
|
databaseId: t.number,
|
|
16
27
|
status: t.string,
|
|
17
|
-
conclusion:
|
|
28
|
+
conclusion: VERDICT,
|
|
18
29
|
headBranch: t.string,
|
|
19
30
|
headSha: t.string,
|
|
20
31
|
displayTitle: t.string,
|
|
@@ -23,12 +34,12 @@ const RUN_ROW = t.object({
|
|
|
23
34
|
createdAt: t.string,
|
|
24
35
|
});
|
|
25
36
|
|
|
26
|
-
const STEP = t.object({ name: t.string, conclusion:
|
|
37
|
+
const STEP = t.object({ name: t.string, conclusion: VERDICT, number: t.number });
|
|
27
38
|
|
|
28
39
|
const JOB = t.object({
|
|
29
40
|
name: t.string,
|
|
30
41
|
status: t.string,
|
|
31
|
-
conclusion:
|
|
42
|
+
conclusion: VERDICT,
|
|
32
43
|
url: t.string,
|
|
33
44
|
steps: t.array(STEP),
|
|
34
45
|
});
|
|
@@ -97,7 +108,7 @@ interface RunRow {
|
|
|
97
108
|
const runOf = (row: RunRow): CiRun => ({
|
|
98
109
|
id: row.databaseId,
|
|
99
110
|
status: row.status,
|
|
100
|
-
conclusion: row.conclusion,
|
|
111
|
+
conclusion: verdictOf(row.conclusion),
|
|
101
112
|
branch: row.headBranch,
|
|
102
113
|
headSha: row.headSha,
|
|
103
114
|
title: row.displayTitle,
|
|
@@ -152,7 +163,7 @@ export async function listRuns(
|
|
|
152
163
|
RUN_LIST,
|
|
153
164
|
{
|
|
154
165
|
label: `gh run list --branch ${branch}`,
|
|
155
|
-
fix: `x ci --branch ${branch} --repo ${repo.slug} --json`,
|
|
166
|
+
fix: `x ci --branch ${quoteArg(branch)} --repo ${quoteArg(repo.slug)} --json`,
|
|
156
167
|
},
|
|
157
168
|
);
|
|
158
169
|
return rows.map(runOf);
|
|
@@ -168,9 +179,17 @@ export async function viewRun(
|
|
|
168
179
|
host,
|
|
169
180
|
['run', 'view', String(id), '--repo', repo.slug, '--json', `${RUN_FIELDS},jobs`],
|
|
170
181
|
RUN_VIEW,
|
|
171
|
-
{
|
|
182
|
+
{
|
|
183
|
+
label: `gh run view ${id}`,
|
|
184
|
+
fix: `x ci --run ${quoteArg(String(id))} --repo ${quoteArg(repo.slug)} --json`,
|
|
185
|
+
},
|
|
172
186
|
);
|
|
173
|
-
|
|
187
|
+
const jobs = viewed.jobs.map((job) => ({
|
|
188
|
+
...job,
|
|
189
|
+
conclusion: verdictOf(job.conclusion),
|
|
190
|
+
steps: job.steps.map((step) => ({ ...step, conclusion: verdictOf(step.conclusion) })),
|
|
191
|
+
}));
|
|
192
|
+
return { run: runOf(viewed), jobs };
|
|
174
193
|
}
|
|
175
194
|
|
|
176
195
|
/**
|
|
@@ -184,7 +203,7 @@ export async function failedLog(host: GhHost, repo: GhRepo, id: number): Promise
|
|
|
184
203
|
['run', 'view', String(id), '--repo', repo.slug, '--log-failed'],
|
|
185
204
|
{
|
|
186
205
|
label: `gh run view ${id} --log-failed`,
|
|
187
|
-
fix: `gh run view ${id} --repo ${repo.slug} --log # the whole log, when the failed steps carry none`,
|
|
206
|
+
fix: `gh run view ${quoteArg(String(id))} --repo ${quoteArg(repo.slug)} --log # the whole log, when the failed steps carry none`,
|
|
188
207
|
},
|
|
189
208
|
);
|
|
190
209
|
return result.stdout;
|
package/src/cmd-build.ts
CHANGED
|
@@ -69,13 +69,17 @@ export function readTarget(raw: string | undefined): BuildTarget {
|
|
|
69
69
|
* has to refuse a missing entry by name before it spawns anything, and the spawned command has to
|
|
70
70
|
* name the same file — a second copy is how `binary` came to compile a path `x new` never wrote.
|
|
71
71
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
// Null-prototype: a target that is not one of these reads `undefined`, never an `Object` member.
|
|
73
|
+
export const BUILD_ENTRY: Readonly<Record<BuildTarget, string>> = Object.assign(
|
|
74
|
+
Object.create(null) as object,
|
|
75
|
+
{
|
|
76
|
+
docker: 'docker/Dockerfile',
|
|
77
|
+
binary: 'apps/web/server.ts',
|
|
78
|
+
static: 'apps/web/prerender.ts',
|
|
79
|
+
// What boots from the store: an image with no server entry has nothing to prebuild for.
|
|
80
|
+
prebuilt: 'apps/web/server.ts',
|
|
81
|
+
} satisfies Record<BuildTarget, string>,
|
|
82
|
+
);
|
|
79
83
|
|
|
80
84
|
/** Absolute path of the target's entry, or the error that names the file and what writes it. */
|
|
81
85
|
export function requireEntry(root: string, target: BuildTarget): string {
|
package/src/cmd-ci.ts
CHANGED
|
@@ -75,7 +75,7 @@ export class CiRunNotFoundError extends UltimateError {
|
|
|
75
75
|
super({
|
|
76
76
|
code: 'X_CI_RUN_NOT_FOUND',
|
|
77
77
|
cause: `no workflow run on ${input.repo} for branch "${input.branch}"${matching}`,
|
|
78
|
-
fix: `x ci --branch main --repo ${input.repo} --json`,
|
|
78
|
+
fix: `x ci --branch main --repo ${quoteArg(input.repo)} --json`,
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
}
|
package/src/cmd-db-backfill.ts
CHANGED
|
@@ -47,11 +47,14 @@ const SHAPE_OF_FLAG = Object.freeze<Record<string, BackfillShape>>({
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
/** One runnable line per shape, so a refusal hands back the invocation the caller meant. */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
// Null-prototype: a shape that is not one of these reads `undefined`, never an `Object` member.
|
|
51
|
+
const FIX_OF_SHAPE: Readonly<Record<BackfillShape, string>> = Object.freeze(
|
|
52
|
+
Object.assign(Object.create(null) as object, {
|
|
53
|
+
list: 'x db backfill --list --json',
|
|
54
|
+
pending: 'x db backfill --pending --json',
|
|
55
|
+
pass: 'x db backfill --all --write --json',
|
|
56
|
+
} satisfies Record<BackfillShape, string>),
|
|
57
|
+
);
|
|
55
58
|
|
|
56
59
|
const refuseShape = (flag: string, reason: string, fix: string): never => {
|
|
57
60
|
throw new BadFlagError({ flag, command: 'db', reason, fix });
|
package/src/cmd-deploy.ts
CHANGED
|
@@ -209,7 +209,7 @@ export function planDeploy(
|
|
|
209
209
|
flag: 'image',
|
|
210
210
|
command: 'deploy',
|
|
211
211
|
reason: `"${image}" pins a digest, and docker/helm renders repository:tag with no digest branch`,
|
|
212
|
-
fix: `x deploy --method helm --image ${image.slice(0, image.lastIndexOf('@'))}:<tag> --json`,
|
|
212
|
+
fix: `x deploy --method helm --image ${quoteArg(image.slice(0, image.lastIndexOf('@')))}:<tag> --json`,
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
// Helm splits a `--set-string` argument on `,` and reads `=` as key/value: an image built from
|
package/src/cmd-doctor.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { CliCommand, CommandContext } from './command';
|
|
|
10
10
|
import { advisoryFloorFindings } from './doctor-advisory-floors';
|
|
11
11
|
import { appUrlFindings } from './doctor-app-url';
|
|
12
12
|
import { authStorageFindings } from './doctor-auth';
|
|
13
|
+
import type { BrowserFact } from './doctor-browser';
|
|
13
14
|
import { browserProbe, browserWarnings, withBrowserReport } from './doctor-browser';
|
|
14
15
|
import { chartAlertsProbe, NOTHING_MISSING, withChartAlertsListing } from './doctor-chart-alerts';
|
|
15
16
|
import { coverageExcludesProbe, withCoverageExcludes } from './doctor-coverage';
|
|
@@ -144,8 +145,17 @@ export async function runDoctor(probe: DoctorProbe): Promise<readonly Finding[]>
|
|
|
144
145
|
return findings;
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
/**
|
|
149
|
+
* The report's probe: the verdict's, and the browser listed beside it. Its own member, never asked
|
|
150
|
+
* from inside the report: a `chrome --version` there was every report test's, on its clock.
|
|
151
|
+
*/
|
|
152
|
+
export interface DoctorReportProbe extends DoctorProbe {
|
|
153
|
+
/** Which Chrome the e2e driver would launch, and whether one is required (`doctor-browser.ts`). */
|
|
154
|
+
browser(): Promise<BrowserFact | undefined>;
|
|
155
|
+
}
|
|
156
|
+
|
|
147
157
|
/** The whole report over one probe: the verdict, then the listings and warnings beside it. */
|
|
148
|
-
export async function reportDoctor(probe:
|
|
158
|
+
export async function reportDoctor(probe: DoctorReportProbe): Promise<CommandResult> {
|
|
149
159
|
// Asked once: `runDoctor` reads the verdict and the report beside it reads the numbers.
|
|
150
160
|
const pooler = probe.root === undefined ? NO_POOLER_FACT : await probe.pooler();
|
|
151
161
|
const findings = await runDoctor({ ...probe, pooler: async () => pooler });
|
|
@@ -189,7 +199,7 @@ export async function reportDoctor(probe: DoctorProbe): Promise<CommandResult> {
|
|
|
189
199
|
);
|
|
190
200
|
// Last, and beside the verdict on `main`: the 31.16.0 checks (`doctor-warnings.ts`).
|
|
191
201
|
// A copy of a shipped guard among them (`X_GUARD_VENDORED`): a warning, so exit stays.
|
|
192
|
-
const browser = await
|
|
202
|
+
const browser = await probe.browser();
|
|
193
203
|
return withDoctorWarnings(withBrowserReport(reminded, browser), [
|
|
194
204
|
...(await doctorWarnings(probe)),
|
|
195
205
|
...vendoredGuardWarnings(guardEntries),
|
|
@@ -205,6 +215,7 @@ export const doctorCommand: CliCommand = {
|
|
|
205
215
|
spec: doctorSpec,
|
|
206
216
|
run(ctx: CommandContext): Promise<CommandResult> {
|
|
207
217
|
const port = doctorPort(ctx.args, ctx.env);
|
|
208
|
-
|
|
218
|
+
const probe = probeFor(ctx.cwd, ctx.bunVersion, port, ctx.env);
|
|
219
|
+
return reportDoctor({ ...probe, browser: () => browserProbe(probe.root, ctx.env) });
|
|
209
220
|
},
|
|
210
221
|
};
|
package/src/cmd-i18n.ts
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
} from './i18n-registration';
|
|
39
39
|
import { msg } from './messages';
|
|
40
40
|
import type { CommandResult, Finding, JsonValue } from './output';
|
|
41
|
+
import { quoteArg } from './shell-quote';
|
|
41
42
|
import { renderTable } from './table';
|
|
42
43
|
import { catalogPath, resolveLocales } from './templates/locales';
|
|
43
44
|
|
|
@@ -104,7 +105,7 @@ function requireLocalePositional(ctx: CommandContext, sub: string): string {
|
|
|
104
105
|
function resolveOneLocale(ctx: CommandContext, sub: string): string {
|
|
105
106
|
const raw = requireLocalePositional(ctx, sub);
|
|
106
107
|
const resolved = resolveLocales([raw], {
|
|
107
|
-
fix: `x i18n ${sub} es`,
|
|
108
|
+
fix: `x i18n ${quoteArg(sub)} es`,
|
|
108
109
|
command: 'i18n',
|
|
109
110
|
flag: 'locale',
|
|
110
111
|
});
|
|
@@ -315,7 +316,7 @@ async function runSync(root: string, ctx: CommandContext): Promise<CommandResult
|
|
|
315
316
|
flag: 'locale',
|
|
316
317
|
command: 'i18n',
|
|
317
318
|
reason: `no catalog for "${locale}" at ${catalogPath(locale)}`,
|
|
318
|
-
fix: `x i18n add ${locale}`,
|
|
319
|
+
fix: `x i18n add ${quoteArg(locale)}`,
|
|
319
320
|
});
|
|
320
321
|
}
|
|
321
322
|
|
package/src/cmd-planned.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { NotImplementedError } from '@ultimat3/core';
|
|
|
7
7
|
import type { CliCommand } from './command';
|
|
8
8
|
import type { CommandResult } from './output';
|
|
9
9
|
import type { CommandSpec } from './parse';
|
|
10
|
+
import { quoteArg } from './shell-quote';
|
|
10
11
|
|
|
11
12
|
export interface PlannedCommand {
|
|
12
13
|
readonly name: string;
|
|
@@ -97,7 +98,7 @@ export function plannedSubcommand(command: string, subcommand: string): NotImple
|
|
|
97
98
|
cause: `x ${command} ${subcommand} is not implemented in this build`,
|
|
98
99
|
// `x help <command>`, not `x <command> --help`: for a command that declares subcommands and no
|
|
99
100
|
// default, the latter is refused by the parser before help is ever rendered.
|
|
100
|
-
fix: planned?.fix ?? `x help ${command}`,
|
|
101
|
+
fix: planned?.fix ?? `x help ${quoteArg(command.split(' '))}`,
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
|
package/src/cmd-repro.ts
CHANGED
|
@@ -172,7 +172,10 @@ export const reproCommand: CliCommand = {
|
|
|
172
172
|
flag: 'include-rows',
|
|
173
173
|
command: 'repro',
|
|
174
174
|
reason: 'it chooses what a bundle carries, and no --bundle was asked for',
|
|
175
|
-
fix:
|
|
175
|
+
fix:
|
|
176
|
+
id === undefined
|
|
177
|
+
? 'x repro --from <file> --bundle --include-rows'
|
|
178
|
+
: `x repro ${renderFixShellArg(id, '<id>')} --bundle --include-rows`,
|
|
176
179
|
});
|
|
177
180
|
}
|
|
178
181
|
if (bundle && (flagBool(ctx.args, 'write') || flagBool(ctx.args, 'verify'))) {
|
|
@@ -180,7 +183,10 @@ export const reproCommand: CliCommand = {
|
|
|
180
183
|
flag: 'bundle',
|
|
181
184
|
command: 'repro',
|
|
182
185
|
reason: 'a bundle is written for an issue, and --write/--verify run the test in this app',
|
|
183
|
-
fix:
|
|
186
|
+
fix:
|
|
187
|
+
id === undefined
|
|
188
|
+
? 'x repro --from <file> --bundle'
|
|
189
|
+
: `x repro ${renderFixShellArg(id, '<id>')} --bundle`,
|
|
184
190
|
});
|
|
185
191
|
}
|
|
186
192
|
// The app's declarations are what mask a job's input and what a written test replays against.
|
package/src/cmd-shot-island.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
// why: no Bun native joins or resolves a path; `--out` is resolved against the app root.
|
|
11
11
|
import { join, resolve } from 'node:path';
|
|
12
|
+
import { renderFixShellArg } from '@ultimat3/core';
|
|
12
13
|
import type { IslandStatesManifest, IslandViewport } from '@ultimat3/testing';
|
|
13
14
|
import { findIslandStates } from '@ultimat3/testing';
|
|
14
15
|
import { appBrowser } from './browser-launcher';
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
islandVerdictJson,
|
|
27
28
|
} from './island-verdict';
|
|
28
29
|
import type { CommandResult } from './output';
|
|
30
|
+
import { quoteArg } from './shell-quote';
|
|
29
31
|
import type { ShotCookiePair } from './shot-cookie';
|
|
30
32
|
import type { ShotServer } from './shot-server';
|
|
31
33
|
import { SHOT_DIR } from './shot-server';
|
|
@@ -71,7 +73,7 @@ export function readStateFlag(
|
|
|
71
73
|
flag: 'state',
|
|
72
74
|
command: 'shot',
|
|
73
75
|
reason: `${manifest.island} declares no state "${wanted}" — it declares ${known.join(', ')}`,
|
|
74
|
-
fix: `x shot --island ${manifest.name} --state ${known[0]
|
|
76
|
+
fix: `x shot --island ${quoteArg(manifest.name)} --state ${renderFixShellArg(known[0], '<id>')} --json`,
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
|
|
@@ -85,7 +87,7 @@ export function refuseRouteWithIsland(route: string | undefined, island: string)
|
|
|
85
87
|
flag: 'island',
|
|
86
88
|
command: 'shot',
|
|
87
89
|
reason: `--island ${island} photographs a component and "${route ?? ''}" is a route; x shot takes one subject`,
|
|
88
|
-
fix: `x shot --island ${island} --json`,
|
|
90
|
+
fix: `x shot --island ${quoteArg(island)} --json`,
|
|
89
91
|
});
|
|
90
92
|
}
|
|
91
93
|
|
package/src/cmd-test.ts
CHANGED
|
@@ -98,7 +98,7 @@ function readOnlyType(positionals: readonly string[]): TestType | undefined {
|
|
|
98
98
|
flag: 'type',
|
|
99
99
|
command: 'test',
|
|
100
100
|
reason: `takes at most one test type, got ${positionals.length}: ${positionals.join(' ')}`,
|
|
101
|
-
fix: `x test ${type} --filter ${quoteArg(second)}`,
|
|
101
|
+
fix: `x test ${quoteArg(type)} --filter ${quoteArg(second)}`,
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -119,7 +119,10 @@ async function readAffectedScope(ctx: CommandContext): Promise<AffectedScope | u
|
|
|
119
119
|
flag: idle,
|
|
120
120
|
command: 'test',
|
|
121
121
|
reason: 'only narrows a run together with --affected, and on its own it changes nothing',
|
|
122
|
-
fix:
|
|
122
|
+
fix:
|
|
123
|
+
idle === 'base'
|
|
124
|
+
? `x test --affected --base ${quoteArg(DEFAULT_BASE)}`
|
|
125
|
+
: 'x test --affected --dirty',
|
|
123
126
|
});
|
|
124
127
|
}
|
|
125
128
|
return undefined;
|
package/src/db-seed.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { BadFlagError } from './errors';
|
|
|
16
16
|
import type { Finding, JsonValue } from './output';
|
|
17
17
|
import { findingFrom } from './output';
|
|
18
18
|
import { hasPathSegment } from './path-segments';
|
|
19
|
+
import { quoteArg } from './shell-quote';
|
|
19
20
|
import { isTest } from './source-files';
|
|
20
21
|
import { renderTable } from './table';
|
|
21
22
|
|
|
@@ -74,7 +75,7 @@ export class SeedEnvironmentError extends UltimateError {
|
|
|
74
75
|
super({
|
|
75
76
|
code: 'X_SEED_ENVIRONMENT',
|
|
76
77
|
cause: `seed "${input.seed}" is tier ${input.tier} and ULTIMATE_ENV resolved ${input.environment}, where x db seed runs ${input.tiers.join(', ')} — ULTIMATE_SEED_TIER=${input.tier} says this deploy takes it anyway`,
|
|
77
|
-
fix: `x db seed ${input.seed} --tier ${input.tier} --json`,
|
|
78
|
+
fix: `x db seed ${quoteArg(input.seed)} --tier ${quoteArg(input.tier)} --json`,
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
}
|
package/src/dev-lock.ts
CHANGED
|
@@ -200,8 +200,8 @@ export class DevPortInUseError extends UltimateError {
|
|
|
200
200
|
cause: `:${input.port} is already bound by ${named}, so the web role cannot listen — on a machine running several projects this is usually another one's dev server, not a stale copy of this one`,
|
|
201
201
|
fix:
|
|
202
202
|
holder.pid === undefined
|
|
203
|
-
? `x dev --port ${input.suggestion}`
|
|
204
|
-
: `x dev --port ${input.suggestion} # or free it, if that pid is yours: kill ${holder.pid}`,
|
|
203
|
+
? `x dev --port ${quoteArg(String(input.suggestion))}`
|
|
204
|
+
: `x dev --port ${quoteArg(String(input.suggestion))} # or free it, if that pid is yours: kill ${holder.pid}`,
|
|
205
205
|
meta: { port: input.port, ...holder },
|
|
206
206
|
});
|
|
207
207
|
}
|
|
@@ -225,7 +225,11 @@ const manifestOf = (from: string): string | undefined =>
|
|
|
225
225
|
* app-relative one an agent can open.
|
|
226
226
|
*/
|
|
227
227
|
export function duplicateCause(root: string, duplicate: DuplicateInstall): string {
|
|
228
|
-
|
|
228
|
+
// The package name is data: `constructor` is a published package, and the bare read answered
|
|
229
|
+
// `Object`'s own function into the cause.
|
|
230
|
+
const registry = Object.hasOwn(REGISTRY_PACKAGES, duplicate.pkg)
|
|
231
|
+
? REGISTRY_PACKAGES[duplicate.pkg]
|
|
232
|
+
: 'registry';
|
|
229
233
|
const copies = duplicate.copies.map((copy) => renderCopy(root, copy)).join(' and ');
|
|
230
234
|
return (
|
|
231
235
|
`${duplicate.copies.length} copies of ${duplicate.pkg} are installed: ${copies} — each is ` +
|
package/src/errors.ts
CHANGED
|
@@ -17,7 +17,7 @@ export class UnknownCommandError extends UltimateError {
|
|
|
17
17
|
super({
|
|
18
18
|
code: 'X_CLI_UNKNOWN_COMMAND',
|
|
19
19
|
cause: `"x ${input.path}" is not a command (known: ${input.known.join(', ')})${input.why === undefined ? '' : ` — ${input.why}`}`,
|
|
20
|
-
fix: input.suggestion === undefined ? 'x help' : `x ${input.suggestion}`,
|
|
20
|
+
fix: input.suggestion === undefined ? 'x help' : `x ${quoteArg(input.suggestion.split(' '))}`,
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -32,7 +32,7 @@ export class BadFlagError extends UltimateError {
|
|
|
32
32
|
super({
|
|
33
33
|
code: 'X_CLI_BAD_FLAG',
|
|
34
34
|
cause: `--${input.flag} on "x ${input.command}": ${input.reason}`,
|
|
35
|
-
fix: input.fix ?? `x ${input.command} --help`,
|
|
35
|
+
fix: input.fix ?? `x ${quoteArg(input.command.split(' '))} --help`,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -111,7 +111,7 @@ export class MissingSubcommandError extends UltimateError {
|
|
|
111
111
|
super({
|
|
112
112
|
code: 'X_CLI_BAD_FLAG',
|
|
113
113
|
cause: `"x ${input.command}" takes a subcommand and got none (one of: ${input.known.join(', ')})`,
|
|
114
|
-
fix: `x help ${input.command}`,
|
|
114
|
+
fix: `x help ${quoteArg(input.command.split(' '))}`,
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -245,7 +245,7 @@ export class CatalogExistsError extends UltimateError {
|
|
|
245
245
|
super({
|
|
246
246
|
code: 'X_GENERATE_CONFLICT',
|
|
247
247
|
cause: `${input.path} already exists`,
|
|
248
|
-
fix: `x i18n sync ${input.locale}`,
|
|
248
|
+
fix: `x i18n sync ${quoteArg(input.locale)}`,
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
}
|
|
@@ -277,7 +277,7 @@ export class ErrorCodeUnknownError extends UltimateError {
|
|
|
277
277
|
fix:
|
|
278
278
|
input.suggestion === undefined
|
|
279
279
|
? 'x errors list --json'
|
|
280
|
-
: `x errors explain ${input.suggestion}`,
|
|
280
|
+
: `x errors explain ${quoteArg(input.suggestion)}`,
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
}
|
|
@@ -302,8 +302,8 @@ export class DeclarationUnknownError extends UltimateError {
|
|
|
302
302
|
cause: `no ${input.singular} named "${input.name}" is registered (${input.known.length} known)`,
|
|
303
303
|
fix:
|
|
304
304
|
input.suggestion === undefined
|
|
305
|
-
? `x ${input.kind} list --json`
|
|
306
|
-
: `x ${input.kind} ${input.verb ?? 'show'} ${input.suggestion}`,
|
|
305
|
+
? `x ${quoteArg(input.kind)} list --json`
|
|
306
|
+
: `x ${quoteArg(input.kind)} ${quoteArg(input.verb ?? 'show')} ${quoteArg(input.suggestion)}`,
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
}
|
|
@@ -332,7 +332,7 @@ export class FixTargetUnknownError extends UltimateError {
|
|
|
332
332
|
fix:
|
|
333
333
|
input.suggestion === undefined
|
|
334
334
|
? 'x routes --json # every registered route file, app-root-relative'
|
|
335
|
-
: `x fix boundary ${input.suggestion}`,
|
|
335
|
+
: `x fix boundary ${quoteArg(input.suggestion)}`,
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
}
|
|
@@ -347,7 +347,7 @@ export class IslandBuildFailedError extends UltimateError {
|
|
|
347
347
|
super({
|
|
348
348
|
code: 'X_BUILD_FAILED',
|
|
349
349
|
cause: `${input.file} is an island entry point and would not bundle: ${input.logs}`,
|
|
350
|
-
fix: `bun build --target browser ${input.file}`,
|
|
350
|
+
fix: `bun build --target browser ${quoteArg(input.file)}`,
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -450,10 +450,11 @@ export class PortInvalidError extends UltimateError {
|
|
|
450
450
|
/** `name` so the scrape port reports itself; the code stays one, because the fault is one. */
|
|
451
451
|
constructor(input: { value: string; name?: string }) {
|
|
452
452
|
const name = input.name ?? 'PORT';
|
|
453
|
+
const example = quoteArg(`${name}=${name === 'PORT' ? 3000 : 9090}`);
|
|
453
454
|
super({
|
|
454
455
|
code: 'X_PORT_INVALID',
|
|
455
456
|
cause: `${name}="${input.value}" is not a TCP port number between 0 and 65535`,
|
|
456
|
-
fix: `docker run -e ${
|
|
457
|
+
fix: `docker run -e ${example} my-app:latest`,
|
|
457
458
|
});
|
|
458
459
|
}
|
|
459
460
|
}
|
package/src/flag-number.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { UltimateError } from '@ultimat3/core';
|
|
|
7
7
|
import { BadFlagError } from './errors';
|
|
8
8
|
import type { ParsedArgs } from './parse';
|
|
9
9
|
import { flagString } from './parse';
|
|
10
|
+
import { quoteArg } from './shell-quote';
|
|
10
11
|
|
|
11
12
|
export interface IntFlag {
|
|
12
13
|
readonly name: string;
|
|
@@ -93,7 +94,7 @@ class SyncPortUnavailableError extends UltimateError {
|
|
|
93
94
|
super({
|
|
94
95
|
code: 'X_PORT_INVALID',
|
|
95
96
|
cause: `the sync role binds PORT + 1, and PORT=${input.port} is the top of the range — it would ask for ${input.port + 1}, which is not a TCP port`,
|
|
96
|
-
fix: `x dev --port ${neighbouringPort(input.port)} # leaves ${PORT_RANGE.max} free for the sync node`,
|
|
97
|
+
fix: `x dev --port ${quoteArg(String(neighbouringPort(input.port)))} # leaves ${PORT_RANGE.max} free for the sync node`,
|
|
97
98
|
meta: { port: input.port },
|
|
98
99
|
});
|
|
99
100
|
}
|
package/src/generate-files.ts
CHANGED
|
@@ -335,7 +335,7 @@ export function generate(options: GenerateOptions): readonly GeneratedFile[] {
|
|
|
335
335
|
default:
|
|
336
336
|
throw new NotImplementedError({
|
|
337
337
|
cause: `generator "${String(options.kind)}" is not implemented in this build`,
|
|
338
|
-
fix: `x g ${GENERATORS.join('
|
|
338
|
+
fix: `x help g # one of: ${GENERATORS.join(', ')}`,
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
}
|