@ultimat3/cli 30.9.0 → 31.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +80 -64
- package/README.md +4 -1
- package/package.json +30 -29
- package/src/admin-registration.ts +1 -1
- package/src/affected-base.ts +51 -0
- package/src/affected.ts +34 -11
- package/src/app-boundaries.ts +88 -9
- package/src/app-load-async.ts +133 -0
- package/src/app-load-batch.ts +203 -0
- package/src/app-load-prebuilt.ts +147 -0
- package/src/app-load-register.ts +175 -0
- package/src/app-load.ts +143 -175
- package/src/app-loader-imports.ts +31 -0
- package/src/app-root.ts +13 -0
- package/src/app-runtime.ts +5 -1
- package/src/boundary-findings.ts +12 -0
- package/src/browser-launcher-port.ts +3 -7
- package/src/browser-launcher.ts +1 -1
- package/src/budgets-scan.ts +8 -0
- package/src/budgets.ts +10 -1
- package/src/build-registry-background.ts +59 -0
- package/src/build-registry.ts +207 -0
- package/src/cdp-shot-clock.ts +3 -11
- package/src/cdp-shot-driver.ts +3 -2
- package/src/cdp-shot-element.ts +3 -2
- package/src/cdp-shot-page.ts +2 -2
- package/src/cdp-shot-watch.ts +4 -3
- package/src/ci-log.ts +76 -13
- package/src/cmd-affected-spec.ts +7 -3
- package/src/cmd-affected.ts +91 -77
- package/src/cmd-auth.ts +3 -3
- package/src/cmd-ci.ts +6 -3
- package/src/cmd-db-recount.ts +15 -0
- package/src/cmd-drill.ts +10 -6
- package/src/cmd-exercise.ts +2 -1
- package/src/cmd-generate-spec.ts +6 -0
- package/src/cmd-generate.ts +22 -4
- package/src/cmd-mail.ts +1 -1
- package/src/cmd-pr-spec.ts +1 -1
- package/src/cmd-pr.ts +72 -1
- package/src/cmd-routes.ts +2 -2
- package/src/cmd-secrets-spec.ts +4 -1
- package/src/cmd-shot.ts +14 -262
- package/src/cmd-test-spec.ts +2 -2
- package/src/cmd-verify-spec.ts +21 -1
- package/src/cmd-verify.ts +16 -4
- package/src/coverage-source.ts +4 -1
- package/src/db-diagnostics.ts +8 -1
- package/src/dev-boot.ts +29 -15
- package/src/dev-dashboard-invalidations.ts +43 -0
- package/src/dev-dashboard.ts +13 -16
- package/src/dev-n-plus-one.ts +7 -3
- package/src/dev-rebuild.ts +2 -1
- package/src/dev-route-table.ts +1 -1
- package/src/dev-traces.ts +16 -15
- package/src/document-options.ts +12 -1
- package/src/drift-store.ts +55 -0
- package/src/error-catalog.ts +8 -3
- package/src/error-codes-boundary.ts +32 -0
- package/src/error-codes-package.ts +38 -0
- package/src/error-codes.ts +28 -40
- package/src/errors.ts +17 -7
- package/src/exercise-database.ts +13 -1
- package/src/exercise-findings.ts +36 -18
- package/src/exercise-services.ts +84 -0
- package/src/exercise-subject.ts +38 -13
- package/src/failure-capture-boot.ts +9 -5
- package/src/framework-schema.ts +5 -5
- package/src/generate-exercise.ts +1 -1
- package/src/generate-files.ts +27 -7
- package/src/generate-kinds.ts +5 -0
- package/src/generate-refresh.ts +53 -0
- package/src/generate-workspace.ts +169 -0
- package/src/generate-write.ts +8 -2
- package/src/hold.ts +19 -8
- package/src/image-prepare.ts +6 -2
- package/src/index.ts +5 -20
- package/src/island-bundle.ts +7 -3
- package/src/island-capture.ts +2 -2
- package/src/island-harness.ts +1 -1
- package/src/job-registration.ts +43 -6
- package/src/jobs-driver.ts +4 -5
- package/src/mcp-errors.ts +20 -4
- package/src/mcp-host.ts +5 -1
- package/src/mcp-ui-interact.ts +3 -0
- package/src/messages-gate.ts +10 -0
- package/src/new-shapes-generate.ts +1 -1
- package/src/otlp-export.ts +94 -29
- package/src/output.ts +24 -10
- package/src/page-sync.ts +3 -1
- package/src/pr-activity.ts +150 -0
- package/src/pr-bots.ts +109 -0
- package/src/pr-threads.ts +7 -2
- package/src/role-load.ts +17 -11
- package/src/role-start.ts +5 -4
- package/src/role-sync.ts +7 -8
- package/src/route-islands-preload.ts +46 -0
- package/src/route-islands.ts +6 -2
- package/src/runtime-admin.ts +5 -1
- package/src/runtime-bindings.ts +25 -19
- package/src/runtime-boot-ports.ts +66 -0
- package/src/runtime-bus.ts +29 -5
- package/src/runtime-cache-bus.ts +53 -0
- package/src/runtime-cache.ts +43 -13
- package/src/runtime-isr-outcome.ts +5 -4
- package/src/runtime-jobs.ts +2 -2
- package/src/runtime-keys.ts +37 -0
- package/src/runtime-overrides.ts +148 -42
- package/src/runtime-port-bindings-queue.ts +36 -0
- package/src/runtime-port-bindings.ts +117 -0
- package/src/runtime-ports.ts +164 -0
- package/src/runtime-purge.ts +41 -28
- package/src/runtime-push.ts +7 -3
- package/src/runtime-queue.ts +70 -55
- package/src/runtime-realtime.ts +5 -5
- package/src/runtime-render-document.ts +4 -1
- package/src/runtime-services.ts +110 -158
- package/src/runtime-storage-boot.ts +111 -0
- package/src/runtime-storage-upload.ts +9 -7
- package/src/runtime-storage.ts +7 -1
- package/src/serve-boot.ts +8 -4
- package/src/serve-entry.ts +3 -0
- package/src/serve-env.ts +47 -14
- package/src/serve-prebuilt-paths.ts +3 -0
- package/src/serve-prebuilt.ts +15 -4
- package/src/serve.ts +2 -2
- package/src/shot-gpu.ts +61 -0
- package/src/shot-route.ts +95 -0
- package/src/shot-run.ts +189 -0
- package/src/shot-verdict.ts +5 -0
- package/src/static-cards.ts +3 -2
- package/src/static-report.ts +2 -2
- package/src/style-bundle.ts +1 -1
- package/src/sync-authenticator.ts +17 -18
- package/src/templates/action-tests.ts +4 -4
- package/src/templates/backfill.ts +5 -8
- package/src/templates/entity.ts +3 -0
- package/src/templates/github/ci.yml.ts +3 -1
- package/src/templates/github/dependabot.yml.ts +73 -0
- package/src/templates/job.ts +13 -22
- package/src/templates/naming.ts +20 -1
- package/src/templates/pinned/docker-compose.yml +1 -1
- package/src/templates/query.ts +7 -8
- package/src/templates/route.ts +5 -3
- package/src/templates/scaffold-api.ts +1 -1
- package/src/templates/scaffold-auth.ts +5 -3
- package/src/templates/scaffold-claude-commands.ts +6 -3
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +2 -4
- package/src/templates/scaffold-domain-package.ts +1 -1
- package/src/templates/scaffold-entries.ts +6 -1
- package/src/templates/scaffold-helm-fences.ts +3 -2
- package/src/templates/scaffold-helm.ts +35 -6
- package/src/templates/scaffold-repo.ts +47 -135
- package/src/templates/scaffold-runtime-ports.ts +62 -0
- package/src/templates/scaffold-verify-floor.ts +97 -0
- package/src/templates/shapes/overlay.ts +1 -1
- package/src/templates/sign-in-oidc.ts +5 -3
- package/src/templates/sign-in-shared.ts +28 -10
- package/src/templates/workspace.ts +75 -0
- package/src/test-ignores.ts +5 -2
- package/src/test-select.ts +4 -1
- package/src/tsconfig-aliases.ts +85 -0
- package/src/upgrade-gate.ts +30 -5
- package/src/upgrade-report.ts +7 -1
- package/src/verify-changed-facts.ts +53 -0
- package/src/verify-changed-scope.ts +162 -0
- package/src/verify-changed.ts +174 -0
- package/src/verify-checks.ts +33 -19
- package/src/verify-drift-owner.ts +30 -0
- package/src/verify-e2e.ts +2 -1
- package/src/verify-factories.ts +86 -0
- package/src/verify-run.ts +13 -11
- package/src/verify-step.ts +13 -0
- package/src/verify-tests.ts +58 -6
- package/src/workspace-external-deps.ts +164 -0
- package/src/write-line.ts +21 -6
- package/wiki/Actions.md +2 -2
- package/wiki/Adapters.md +400 -0
- package/wiki/Admin-Dashboard.md +1 -1
- package/wiki/Agents.md +9 -9
- package/wiki/Auth.md +78 -2
- package/wiki/Building-Your-Own-Base.md +1 -1
- package/wiki/CLI-Reference.md +45 -14
- package/wiki/Caching-And-Invalidation.md +17 -5
- package/wiki/Compared.md +8 -2
- package/wiki/Configuration.md +14 -14
- package/wiki/Deployment.md +28 -1
- package/wiki/Entities-And-Migrations.md +47 -1
- package/wiki/FAQ.md +8 -2
- package/wiki/Feature-Flags.md +1 -1
- package/wiki/Home.md +3 -2
- package/wiki/Jobs-And-Workflows.md +107 -6
- package/wiki/Known-Gaps.md +4 -3
- package/wiki/MCP-And-AI.md +18 -4
- package/wiki/Mail.md +14 -5
- package/wiki/Migrations-And-Backfills.md +29 -4
- package/wiki/Money.md +2 -0
- package/wiki/N-Plus-One-Detection.md +24 -22
- package/wiki/Notify.md +28 -4
- package/wiki/Observability.md +121 -15
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +9 -4
- package/wiki/Routes-And-Render-Modes.md +5 -0
- package/wiki/Scraping.md +57 -11
- package/wiki/Shapes.md +2 -2
- package/wiki/Stability.md +7 -5
- package/wiki/Storage-And-Uploads.md +56 -4
- package/wiki/Testing.md +65 -52
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Tutorial-01-First-App.md +1 -1
- package/wiki/Tutorial-04-Jobs-And-Realtime.md +1 -1
- package/wiki/Tutorial-05-Deploy-Free.md +1 -1
- package/wiki/Tutorial-06-Growing-Up.md +8 -8
- package/wiki/Upgrading.md +136 -5
package/src/cmd-affected.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { msg } from './messages';
|
|
|
14
14
|
import type { CommandResult, JsonValue } from './output';
|
|
15
15
|
import { flagBool } from './parse';
|
|
16
16
|
import { renderTable } from './table';
|
|
17
|
+
import { writeLine } from './write-line';
|
|
17
18
|
|
|
18
19
|
const HEADER = ['workspace', 'dir'] as const;
|
|
19
20
|
|
|
@@ -36,81 +37,94 @@ export const AFFECTED_MESSAGE_KEYS = [
|
|
|
36
37
|
'cli.affected.testsAll',
|
|
37
38
|
] as const;
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
/**
|
|
41
|
+
* `--paths` is for `bun test $(x affected --paths)`, so its stdout is the directories and nothing
|
|
42
|
+
* else: each one written here, on fd 1, and the rest of the render — the notes and the `✓` summary,
|
|
43
|
+
* which a shell would split into bogus arguments — sent to fd 2 by `stream: 'stderr'`. The one
|
|
44
|
+
* write a command makes itself: `CommandResult` has no "bare stdout" channel, and the one sink
|
|
45
|
+
* `dispatch` picks per result cannot split a result across both fds. `writeOut` is injectable so a
|
|
46
|
+
* test reads fd 1 exactly as a shell would.
|
|
47
|
+
*/
|
|
48
|
+
export function createAffectedCommand(writeOut: (line: string) => void = writeLine): CliCommand {
|
|
49
|
+
return { spec: affectedSpec, run: (ctx) => runAffected(ctx, writeOut) };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function runAffected(
|
|
53
|
+
ctx: CommandContext,
|
|
54
|
+
writeOut: (line: string) => void,
|
|
55
|
+
): Promise<CommandResult> {
|
|
56
|
+
// The one resolver `x test --affected` narrows with, so this command reports exactly what that
|
|
57
|
+
// one runs. It reads `--base` before git is spawned (a malformed ref must not cost a
|
|
58
|
+
// subprocess) and takes the diff at the CHECKOUT root, which is what git prints paths against.
|
|
59
|
+
const { selection, root, plan } = await affectedScope({
|
|
60
|
+
runner: ctx.runner,
|
|
61
|
+
cwd: ctx.cwd,
|
|
62
|
+
args: ctx.args,
|
|
63
|
+
command: 'affected',
|
|
64
|
+
});
|
|
65
|
+
const params = { base: selection.base, changed: plan.changed.length };
|
|
66
|
+
const tests = await appTestScope(ctx.cwd, root, plan.changed);
|
|
67
|
+
const table = renderTable(
|
|
68
|
+
HEADER,
|
|
69
|
+
plan.workspaces.map((workspace) => [workspace.name, workspace.dir]),
|
|
70
|
+
).map((line) => ` ${line}`);
|
|
71
|
+
const data: JsonValue = {
|
|
72
|
+
base: selection.base,
|
|
73
|
+
dirty: selection.dirty,
|
|
74
|
+
root,
|
|
75
|
+
changed: [...plan.changed],
|
|
76
|
+
ignored: [...plan.ignored],
|
|
77
|
+
rootWide: [...plan.rootWide],
|
|
78
|
+
workspaces: plan.workspaces.map((workspace) => ({
|
|
79
|
+
name: workspace.name,
|
|
80
|
+
dir: workspace.dir,
|
|
81
|
+
})),
|
|
82
|
+
paths: plan.workspaces.map((workspace) => workspace.dir),
|
|
83
|
+
...(tests === undefined
|
|
84
|
+
? {}
|
|
85
|
+
: {
|
|
86
|
+
tests: {
|
|
87
|
+
app: tests.app,
|
|
88
|
+
all: tests.all,
|
|
89
|
+
forcing: [...tests.forcing],
|
|
90
|
+
files: [...tests.tests],
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
const bare = flagBool(ctx.args, 'paths') && !ctx.args.json;
|
|
95
|
+
if (bare) for (const workspace of plan.workspaces) writeOut(workspace.dir);
|
|
96
|
+
return {
|
|
97
|
+
...(bare ? { stream: 'stderr' as const } : {}),
|
|
98
|
+
// An empty answer is a fact, not a failure: a `.md`-only diff genuinely re-checks nothing,
|
|
99
|
+
// and reporting it red would fail a build for editing a doc. The count is in the summary and
|
|
100
|
+
// `data.changed`/`data.ignored` say what was looked at, so "green because nothing is
|
|
101
|
+
// affected" is never mistaken for "green because everything passed".
|
|
102
|
+
ok: true,
|
|
103
|
+
command: 'affected',
|
|
104
|
+
summary:
|
|
105
|
+
plan.workspaces.length === 0
|
|
106
|
+
? msg('cli.affected.none', params)
|
|
107
|
+
: msg('cli.affected.count', { ...params, count: plan.workspaces.length }),
|
|
108
|
+
lines: [
|
|
109
|
+
...(selection.dirty ? [msg('cli.affected.dirty')] : []),
|
|
69
110
|
...(tests === undefined
|
|
70
|
-
?
|
|
71
|
-
:
|
|
72
|
-
tests
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
: msg('cli.affected.count', { ...params, count: plan.workspaces.length }),
|
|
91
|
-
lines: [
|
|
92
|
-
...(selection.dirty ? [msg('cli.affected.dirty')] : []),
|
|
93
|
-
...(tests === undefined
|
|
94
|
-
? []
|
|
95
|
-
: [
|
|
96
|
-
tests.all
|
|
97
|
-
? msg('cli.affected.testsAll', {
|
|
98
|
-
files: `${tests.forcing.slice(0, 3).join(', ')}${tests.forcing.length > 3 ? ` (+${tests.forcing.length - 3})` : ''}`,
|
|
99
|
-
})
|
|
100
|
-
: msg('cli.affected.tests', { count: tests.tests.length }),
|
|
101
|
-
]),
|
|
102
|
-
...(plan.rootWide.length === 0
|
|
103
|
-
? []
|
|
104
|
-
: [msg('cli.affected.rootWide', { files: plan.rootWide.join(', ') })]),
|
|
105
|
-
...(plan.workspaces.length === 0
|
|
106
|
-
? []
|
|
107
|
-
: // `--paths` changes only what the human sees; `--json` carries both projections on
|
|
108
|
-
// every run, so the two renderers can never state different sets.
|
|
109
|
-
flagBool(ctx.args, 'paths')
|
|
110
|
-
? plan.workspaces.map((workspace) => workspace.dir)
|
|
111
|
-
: table),
|
|
112
|
-
],
|
|
113
|
-
data,
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
};
|
|
111
|
+
? []
|
|
112
|
+
: [
|
|
113
|
+
tests.all
|
|
114
|
+
? msg('cli.affected.testsAll', {
|
|
115
|
+
files: `${tests.forcing.slice(0, 3).join(', ')}${tests.forcing.length > 3 ? ` (+${tests.forcing.length - 3})` : ''}`,
|
|
116
|
+
})
|
|
117
|
+
: msg('cli.affected.tests', { count: tests.tests.length }),
|
|
118
|
+
]),
|
|
119
|
+
...(plan.rootWide.length === 0
|
|
120
|
+
? []
|
|
121
|
+
: [msg('cli.affected.rootWide', { files: plan.rootWide.join(', ') })]),
|
|
122
|
+
// `--paths` changes only what the human sees; `--json` carries both projections on every
|
|
123
|
+
// run, so the two renderers can never state different sets.
|
|
124
|
+
...(plan.workspaces.length === 0 || bare ? [] : table),
|
|
125
|
+
],
|
|
126
|
+
data,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const affectedCommand: CliCommand = createAffectedCommand();
|
package/src/cmd-auth.ts
CHANGED
|
@@ -12,8 +12,7 @@ import type { CliCommand, CommandContext } from './command';
|
|
|
12
12
|
import { ok } from './command';
|
|
13
13
|
import { msg } from './messages';
|
|
14
14
|
import type { CommandResult } from './output';
|
|
15
|
-
import {
|
|
16
|
-
import { startQueue } from './runtime-queue';
|
|
15
|
+
import { openAppQueue } from './runtime-boot-ports';
|
|
17
16
|
|
|
18
17
|
export interface OpenAuthStore extends MfaSecretStore {
|
|
19
18
|
close(): Promise<void>;
|
|
@@ -25,7 +24,8 @@ export interface OpenAuthStore extends MfaSecretStore {
|
|
|
25
24
|
* exits holding the PGlite lock breaks the next command run against this app.
|
|
26
25
|
*/
|
|
27
26
|
async function openAppAuthStore(root: string, ctx: CommandContext): Promise<OpenAuthStore> {
|
|
28
|
-
|
|
27
|
+
// `runtime.ts` read: sealing asks the master key, and a KMS app's key is its `secretSource`'s.
|
|
28
|
+
const queue = await openAppQueue(root, ctx.env);
|
|
29
29
|
return { adapter: postgresAuthAdapter(queue.db), close: () => queue.stop() };
|
|
30
30
|
}
|
|
31
31
|
|
package/src/cmd-ci.ts
CHANGED
|
@@ -275,9 +275,12 @@ async function inspect(
|
|
|
275
275
|
// this repair closes — so when the log had nothing, the finding reads nothing.
|
|
276
276
|
findings.push({
|
|
277
277
|
...finding,
|
|
278
|
-
//
|
|
279
|
-
// log author's instruction, not this CLI's
|
|
280
|
-
|
|
278
|
+
// Tagged, never fenced inside the value: the log is foreign text, and a `fix:` read from it
|
|
279
|
+
// is the log author's instruction, not this CLI's — `source` says so to a machine, and
|
|
280
|
+
// `output-findings.ts` never rewrites it into a runnable `bunx x`. A `<comment>` fence
|
|
281
|
+
// INSIDE `fix` reached the human render as one line of markup and literal `\n` (31.0
|
|
282
|
+
// field report), so the value stays the clean text and the job rides on `meta.job`.
|
|
283
|
+
meta: { ...finding.meta, job: name },
|
|
281
284
|
source: 'ci-log',
|
|
282
285
|
});
|
|
283
286
|
}
|
package/src/cmd-db-recount.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from '@ultimat3/db';
|
|
13
13
|
import { countersOf, describeCounter, getEntity } from '@ultimat3/entity';
|
|
14
14
|
import { loadApp } from './app-load';
|
|
15
|
+
import { loadAppRuntime } from './app-runtime';
|
|
15
16
|
import type { CommandContext } from './command';
|
|
16
17
|
import { DevAlreadyRunningError, liveDevLock } from './dev-lock';
|
|
17
18
|
import { BadFlagError } from './errors';
|
|
@@ -19,6 +20,7 @@ import { msg } from './messages';
|
|
|
19
20
|
import type { CommandResult } from './output';
|
|
20
21
|
import { flagBool } from './parse';
|
|
21
22
|
import { resolveServices } from './runtime-bindings';
|
|
23
|
+
import { installBootPorts } from './runtime-boot-ports';
|
|
22
24
|
import { startDb } from './runtime-queue';
|
|
23
25
|
import { quoteArg } from './shell-quote';
|
|
24
26
|
|
|
@@ -54,7 +56,20 @@ function counterNamed(target: string) {
|
|
|
54
56
|
return { parent, counter: describeCounter(counter) };
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
/**
|
|
60
|
+
* `runtime.ts`'s boot ports first: `loadApp` evaluates the app's modules, and one that seals or
|
|
61
|
+
* reads a secret at module scope must see the app's own source and clock (`runtime-boot-ports.ts`).
|
|
62
|
+
*/
|
|
57
63
|
export async function runRecountCommand(ctx: CommandContext, root: string): Promise<CommandResult> {
|
|
64
|
+
const booted = await installBootPorts(await loadAppRuntime(root));
|
|
65
|
+
try {
|
|
66
|
+
return await recount(ctx, root);
|
|
67
|
+
} finally {
|
|
68
|
+
for (const release of booted.reverse()) await release();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function recount(ctx: CommandContext, root: string): Promise<CommandResult> {
|
|
58
73
|
const target = ctx.args.positionals[0];
|
|
59
74
|
if (target === undefined) return refuse('', 'is missing: name the counter as <entity>.<column>');
|
|
60
75
|
const { findings } = await loadApp(root);
|
package/src/cmd-drill.ts
CHANGED
|
@@ -40,12 +40,16 @@ const READY_TIMEOUT_MS = 90_000;
|
|
|
40
40
|
/** `@ultimat3/http`'s own default — the app's `configureHttp` is runtime code, not config. */
|
|
41
41
|
const HTTP_DEFAULT_DEADLINE_MS = 30_000;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* What the app runs on. NATS is the environment's (v31: `realtime.transport` is gone, and
|
|
45
|
+
* `NATS_URL` alone selects the bus), so an unset `NATS_URL` is an app with no bus to fault.
|
|
46
|
+
*/
|
|
47
|
+
const declarationsOf = (
|
|
48
|
+
config: AppConfig | undefined,
|
|
49
|
+
env: Readonly<Record<string, string | undefined>>,
|
|
50
|
+
): DrillDeclarations => ({
|
|
44
51
|
redis: config?.cache.tiers.includes('redis') ?? false,
|
|
45
|
-
nats:
|
|
46
|
-
config?.realtime.transport === 'nats'
|
|
47
|
-
? { env: config.realtime.urlEnv ?? 'NATS_URL' }
|
|
48
|
-
: undefined,
|
|
52
|
+
nats: (env['NATS_URL']?.trim() ?? '') === '' ? undefined : { env: 'NATS_URL' },
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
/** The facts the thresholds derive from; `drillBudgets` screens every number it is handed. */
|
|
@@ -116,7 +120,7 @@ export const drillCommand: CliCommand = {
|
|
|
116
120
|
});
|
|
117
121
|
}
|
|
118
122
|
const config = await loadAppConfig(root);
|
|
119
|
-
const declared = declarationsOf(config);
|
|
123
|
+
const declared = declarationsOf(config, ctx.env);
|
|
120
124
|
// Every drill's services, decided before any process starts. A named drill's gap is thrown; in
|
|
121
125
|
// a whole run an undeclared service is stated as not run — an unset URL still refuses it all.
|
|
122
126
|
const planned: { drill: Drill; services: ReturnType<typeof drillServices> }[] = [];
|
package/src/cmd-exercise.ts
CHANGED
|
@@ -117,7 +117,8 @@ async function exercise(
|
|
|
117
117
|
...(only === undefined ? entityTenantFindings(describeEntities()) : []),
|
|
118
118
|
...subjectStatic,
|
|
119
119
|
...subjectProofs,
|
|
120
|
-
|
|
120
|
+
// The fix pastes into the file the app has, or hands it the file it lacks.
|
|
121
|
+
...exerciseFindings(records, overrides === undefined ? 'absent' : 'present'),
|
|
121
122
|
];
|
|
122
123
|
return {
|
|
123
124
|
ok: findings.length === 0,
|
package/src/cmd-generate-spec.ts
CHANGED
|
@@ -25,6 +25,12 @@ export const generateSpec: CommandSpec = {
|
|
|
25
25
|
{ name: 'admin', type: 'boolean', summary: 'resource: also emit the admin override' },
|
|
26
26
|
{ name: 'locales', type: 'string', summary: 'comma-separated locales, default en' },
|
|
27
27
|
{ name: 'at', type: 'string', summary: 'island, admin:page: directory to write into' },
|
|
28
|
+
{
|
|
29
|
+
name: 'app',
|
|
30
|
+
type: 'string',
|
|
31
|
+
summary: 'route, island, query: app under apps/',
|
|
32
|
+
default: 'web',
|
|
33
|
+
},
|
|
28
34
|
{ name: 'permission', type: 'string', summary: 'admin:page: the permission it needs' },
|
|
29
35
|
{ name: 'oidc', type: 'string', summary: 'sign-in: an OpenID Connect provider id' },
|
|
30
36
|
{ name: 'password', type: 'boolean', summary: 'sign-in: an address and a password' },
|
package/src/cmd-generate.ts
CHANGED
|
@@ -17,17 +17,19 @@ import { appDisk, plannedDisk } from './generate-disk';
|
|
|
17
17
|
import { writtenExercises } from './generate-exercise';
|
|
18
18
|
import { assertFeatureExists } from './generate-feature';
|
|
19
19
|
import { assertSliceToRead } from './generate-feature-required';
|
|
20
|
-
import { generate, sliceDir } from './generate-files';
|
|
20
|
+
import { DEFAULT_APP, generate, sliceDir } from './generate-files';
|
|
21
21
|
import { followUpEdits } from './generate-follow-ups';
|
|
22
22
|
import { formatWritten } from './generate-format-written';
|
|
23
23
|
import type { Generator } from './generate-kinds';
|
|
24
24
|
import { readFeature, readKind, readName, readPermission, readSurface } from './generate-kinds';
|
|
25
25
|
import { refusePluralTable } from './generate-plural';
|
|
26
26
|
import { followReexports } from './generate-reexports';
|
|
27
|
+
import { manifestCanChange } from './generate-refresh';
|
|
27
28
|
import { refuseShadowedTypes, refuseShadowedValues } from './generate-shadow';
|
|
28
29
|
import { declaresOnlyOtherEntities } from './generate-sibling';
|
|
29
30
|
import { runSignIn } from './generate-sign-in';
|
|
30
31
|
import { refuseSignInFlags } from './generate-sign-in-mode';
|
|
32
|
+
import { isWorkspaceKind, readApp, runWorkspace } from './generate-workspace';
|
|
31
33
|
import { containedPath, planWrites, writeFiles } from './generate-write';
|
|
32
34
|
import { resolveDbModule } from './handle-registration';
|
|
33
35
|
import { resolveCatalogModule } from './i18n-audit';
|
|
@@ -79,6 +81,8 @@ export const generateCommand: CliCommand = {
|
|
|
79
81
|
if (kind === 'sign-in') return await runSignIn(ctx, root);
|
|
80
82
|
// One chart per app, named by its `Chart.yaml`: the same shape, for the same reason.
|
|
81
83
|
if (kind === 'chart-alerts') return await runChartAlerts(ctx, root);
|
|
84
|
+
// A workspace, not a slice: no feature, no surface, no follow-up edit (`generate-workspace.ts`).
|
|
85
|
+
if (isWorkspaceKind(kind)) return await runWorkspace(ctx, root, kind);
|
|
82
86
|
const name = readName(ctx.args.positionals[1], kind);
|
|
83
87
|
const featureFlag = readFeature(flagString(ctx.args, 'feature'), kind);
|
|
84
88
|
// Both flags are resolved before a single file is planned: a bad surface or a locale that is
|
|
@@ -86,6 +90,8 @@ export const generateCommand: CliCommand = {
|
|
|
86
90
|
const surface = readSurface(flagString(ctx.args, 'surface'), kind, name);
|
|
87
91
|
const locales = resolveLocales(await namedOrAppLocales(root, flagList(ctx.args, 'locales')));
|
|
88
92
|
const at = flagString(ctx.args, 'at');
|
|
93
|
+
// The app workspace the slice lands in; `web` unless an app-local generator names another.
|
|
94
|
+
const app = readApp(flagString(ctx.args, 'app'), root, kind, name);
|
|
89
95
|
// Read with the two above, and refused here for their reason: the value is spliced into the
|
|
90
96
|
// emitted source three times, and a value that is not a `<resource>:<verb>` is a page the app
|
|
91
97
|
// cannot compile — found after the files are on disk, which is the worst place to find it.
|
|
@@ -98,7 +104,7 @@ export const generateCommand: CliCommand = {
|
|
|
98
104
|
// And whether the app has the frame a resource's page sits in.
|
|
99
105
|
const shell = existsSync(containedPath(root, SHELL_MODULE));
|
|
100
106
|
// Read for the same reason: which errors the slice declares is written on THIS app's disk.
|
|
101
|
-
const slice = sliceDir(surface, kebab(featureFlag ?? name));
|
|
107
|
+
const slice = sliceDir(surface, kebab(featureFlag ?? name), app);
|
|
102
108
|
// A named slice that is not there is refused, never invented (X_FEATURE_UNKNOWN).
|
|
103
109
|
assertFeatureExists(root, kind, featureFlag, slice, name);
|
|
104
110
|
// And a read with no table to read, never handed one (X_FEATURE_REQUIRED).
|
|
@@ -135,6 +141,7 @@ export const generateCommand: CliCommand = {
|
|
|
135
141
|
...(sliceEntity === undefined ? {} : { sliceEntity }),
|
|
136
142
|
...(sliceRepo === undefined ? {} : { sliceRepo }),
|
|
137
143
|
...(at === undefined ? {} : { at }),
|
|
144
|
+
...(app === DEFAULT_APP ? {} : { app }),
|
|
138
145
|
...(permission === undefined ? {} : { permission }),
|
|
139
146
|
surface,
|
|
140
147
|
live: flagBool(ctx.args, 'live'),
|
|
@@ -207,8 +214,12 @@ export const generateCommand: CliCommand = {
|
|
|
207
214
|
const touched = refused.length === 0 ? [...plan.written, ...follow.edited] : [];
|
|
208
215
|
// Re-projected after a real write, from the loaded app: named, since their bytes are not
|
|
209
216
|
// knowable without the files on disk.
|
|
217
|
+
// By the rule the run follows (`generate-refresh.ts`): files that cannot move a manifest
|
|
218
|
+
// fact name no refresh, because the run will not load the app to make one.
|
|
210
219
|
const refreshes =
|
|
211
|
-
plan.written.length === 0 ||
|
|
220
|
+
plan.written.length === 0 ||
|
|
221
|
+
refused.length > 0 ||
|
|
222
|
+
!(await manifestCanChange(root, [...plan.written, ...follow.edited], planned))
|
|
212
223
|
? []
|
|
213
224
|
: [MANIFEST_FILENAME, 'openapi.json'].filter((file) =>
|
|
214
225
|
existsSync(containedPath(root, file)),
|
|
@@ -261,7 +272,14 @@ export const generateCommand: CliCommand = {
|
|
|
261
272
|
// `openapi.json` rides with it (`writeAppArtifacts`): refreshing one contract and not the other
|
|
262
273
|
// made this command's own output fail the `contract-diff` step.
|
|
263
274
|
const artifacts: string[] = [];
|
|
264
|
-
|
|
275
|
+
// And only when the run's files can move one of its facts: the load is the whole app, the one
|
|
276
|
+
// step of a scaffold that grows with it, and an island, a test or a stylesheet moves nothing
|
|
277
|
+
// it projects (`generate-refresh.ts`).
|
|
278
|
+
if (
|
|
279
|
+
report.written.length > 0 &&
|
|
280
|
+
existsSync(containedPath(root, MANIFEST_FILENAME)) &&
|
|
281
|
+
(await manifestCanChange(root, [...report.written, ...edited]))
|
|
282
|
+
) {
|
|
265
283
|
const { manifest, findings } = await appManifest(root);
|
|
266
284
|
if (findings.length === 0) {
|
|
267
285
|
artifacts.push(
|
package/src/cmd-mail.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const mailCommand: CliCommand = {
|
|
|
28
28
|
throw new MissingPositionalError({
|
|
29
29
|
command: 'mail preview',
|
|
30
30
|
positional: 'id',
|
|
31
|
-
example: 'x mail preview
|
|
31
|
+
example: 'x mail preview <id> --locale es --json # the id given to defineMail({ id })',
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
await loadApp(root);
|
package/src/cmd-pr-spec.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const PR_SUBCOMMANDS = ['review', 'resolve', 'reply'] as const;
|
|
|
7
7
|
|
|
8
8
|
export const prSpec: CommandSpec = {
|
|
9
9
|
name: 'pr',
|
|
10
|
-
summary: '
|
|
10
|
+
summary: 'reviews, comments, bots that did not review, and inline threads; resolve or reply',
|
|
11
11
|
usage:
|
|
12
12
|
'x pr review [--pr <n>] [--repo owner/name] [--all] [--full] | x pr resolve <thread-id> | x pr reply <thread-id> --body "…"',
|
|
13
13
|
subcommands: PR_SUBCOMMANDS,
|
package/src/cmd-pr.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { PrNotFoundError, resolvePrNumber, resolveRepo } from './gh-target';
|
|
|
19
19
|
import { msg } from './messages';
|
|
20
20
|
import type { CommandResult, JsonValue } from './output';
|
|
21
21
|
import { flagBool, flagString } from './parse';
|
|
22
|
+
import { botsSummary } from './pr-bots';
|
|
22
23
|
import type { PrReviewReport, PrThread } from './pr-threads';
|
|
23
24
|
import { fetchReviewReport, replyToThread, resolveThread, THREAD_PAGE } from './pr-threads';
|
|
24
25
|
|
|
@@ -38,6 +39,9 @@ export const PR_MESSAGE_KEYS = [
|
|
|
38
39
|
'cli.pr.review.current',
|
|
39
40
|
'cli.pr.review.undecided',
|
|
40
41
|
'cli.pr.review.truncated',
|
|
42
|
+
'cli.pr.review.activity',
|
|
43
|
+
'cli.pr.bot.blocked',
|
|
44
|
+
'cli.pr.bot.notice',
|
|
41
45
|
'cli.pr.thread.open',
|
|
42
46
|
'cli.pr.thread.closed',
|
|
43
47
|
'cli.pr.thread.outdated',
|
|
@@ -111,7 +115,11 @@ async function runReview(ctx: CommandContext): Promise<CommandResult> {
|
|
|
111
115
|
repo: report.repo,
|
|
112
116
|
pr: report.number,
|
|
113
117
|
}),
|
|
114
|
-
lines: [
|
|
118
|
+
lines: [
|
|
119
|
+
...decisionLines(report),
|
|
120
|
+
...activityLines(report),
|
|
121
|
+
...shown.flatMap((thread) => threadLines(thread, bodyLines)),
|
|
122
|
+
],
|
|
115
123
|
data: reviewJson(report, shown, bodyLines, unresolved),
|
|
116
124
|
};
|
|
117
125
|
}
|
|
@@ -144,6 +152,43 @@ function decisionLines(report: PrReviewReport): readonly string[] {
|
|
|
144
152
|
];
|
|
145
153
|
}
|
|
146
154
|
|
|
155
|
+
/**
|
|
156
|
+
* The rest of the conversation, in as few lines as it takes: one count, then one line per review
|
|
157
|
+
* bot that posted a "did not review" notice. Bodies stay in `--json` — the terminal is for the
|
|
158
|
+
* fact that a review is MISSING, which no thread would ever show.
|
|
159
|
+
*/
|
|
160
|
+
function activityLines(report: PrReviewReport): readonly string[] {
|
|
161
|
+
const bots = botsSummary(report.reviews, report.comments);
|
|
162
|
+
const out = [
|
|
163
|
+
msg('cli.pr.review.activity', {
|
|
164
|
+
reviews: report.reviews.length,
|
|
165
|
+
comments: report.comments.length,
|
|
166
|
+
bots: bots.length,
|
|
167
|
+
}),
|
|
168
|
+
];
|
|
169
|
+
for (const bot of bots) {
|
|
170
|
+
const notice = bot.notice;
|
|
171
|
+
if (notice === null) continue;
|
|
172
|
+
out.push(
|
|
173
|
+
bot.blocked
|
|
174
|
+
? msg('cli.pr.bot.blocked', {
|
|
175
|
+
login: bot.login,
|
|
176
|
+
kind: notice.kind,
|
|
177
|
+
excerpt: notice.excerpt,
|
|
178
|
+
at: notice.at,
|
|
179
|
+
url: notice.url,
|
|
180
|
+
})
|
|
181
|
+
: msg('cli.pr.bot.notice', {
|
|
182
|
+
login: bot.login,
|
|
183
|
+
kind: notice.kind,
|
|
184
|
+
at: notice.at,
|
|
185
|
+
reviewed: bot.lastReviewAt ?? '',
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
|
|
147
192
|
const truncationLines = (report: PrReviewReport): readonly string[] =>
|
|
148
193
|
report.truncated ? [msg('cli.pr.review.truncated', { count: THREAD_PAGE })] : [];
|
|
149
194
|
|
|
@@ -189,6 +234,12 @@ export function clampBody(
|
|
|
189
234
|
return { lines: lines.slice(0, limit), hidden: lines.length - limit };
|
|
190
235
|
}
|
|
191
236
|
|
|
237
|
+
/** `clampBody` as the two fields every `--json` body row carries. */
|
|
238
|
+
const clampedBody = (body: string, limit: number) => {
|
|
239
|
+
const clamped = clampBody(body, limit);
|
|
240
|
+
return { body: clamped.lines.join('\n'), bodyLinesHidden: clamped.hidden };
|
|
241
|
+
};
|
|
242
|
+
|
|
192
243
|
function reviewJson(
|
|
193
244
|
report: PrReviewReport,
|
|
194
245
|
shown: readonly PrThread[],
|
|
@@ -221,6 +272,26 @@ function reviewJson(
|
|
|
221
272
|
shown: shown.length,
|
|
222
273
|
},
|
|
223
274
|
truncated: report.truncated,
|
|
275
|
+
// Additive beside `threads`: every review with its verdict and body, every issue comment, and
|
|
276
|
+
// which review bots said they did NOT review — a rate-limited bot leaves no thread, so its
|
|
277
|
+
// silence would otherwise read as a clean review.
|
|
278
|
+
reviews: report.reviews.map(({ body, ...review }) => ({
|
|
279
|
+
...review,
|
|
280
|
+
...clampedBody(body, bodyLines),
|
|
281
|
+
})),
|
|
282
|
+
comments: report.comments.map(({ body, ...comment }) => ({
|
|
283
|
+
...comment,
|
|
284
|
+
...clampedBody(body, bodyLines),
|
|
285
|
+
})),
|
|
286
|
+
reviewsTruncated: report.reviewsTruncated,
|
|
287
|
+
commentsTruncated: report.commentsTruncated,
|
|
288
|
+
bots: botsSummary(report.reviews, report.comments).map(({ notice, ...bot }) => ({
|
|
289
|
+
...bot,
|
|
290
|
+
notice:
|
|
291
|
+
notice === null
|
|
292
|
+
? null
|
|
293
|
+
: { kind: notice.kind, excerpt: notice.excerpt, at: notice.at, url: notice.url },
|
|
294
|
+
})),
|
|
224
295
|
threads: shown.map((thread) => {
|
|
225
296
|
const comments = thread.comments.map((comment) => {
|
|
226
297
|
const clamped = clampBody(comment.body, bodyLines);
|
package/src/cmd-routes.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// The rows are `route-table.ts`'s — the one builder the MCP dev tool `routes.list` reads too — so
|
|
5
5
|
// the CLI keeps no second table.
|
|
6
6
|
|
|
7
|
+
import { SURFACES } from '@ultimat3/core';
|
|
7
8
|
import type { Surface } from '@ultimat3/render';
|
|
8
|
-
import { SURFACES } from '@ultimat3/render';
|
|
9
9
|
import { loadApp } from './app-load';
|
|
10
10
|
import { requireAppRoot } from './app-root';
|
|
11
11
|
import { routesSpec } from './cmd-routes-spec';
|
|
@@ -20,7 +20,7 @@ import { plainAppRoutes, renderRouteRows, routeRows } from './route-table';
|
|
|
20
20
|
* A closed set, because the filter was a bare `===`: `x routes --surface App` and `--surface pages`
|
|
21
21
|
* matched no row and reported `0 routes` with exit 0, which is the same output an app with no
|
|
22
22
|
* routes gives — so a typo and an empty route table are indistinguishable, and only one of them is
|
|
23
|
-
* a bug the caller can see. `SURFACES` is `@ultimat3/
|
|
23
|
+
* a bug the caller can see. `SURFACES` is `@ultimat3/core`'s one declaration of what a surface
|
|
24
24
|
* is; a list restated here would be a second answer to it (`x g --surface` is `generate-kinds.ts`'s
|
|
25
25
|
* narrower question — which surface to SCAFFOLD onto — and takes site|app alone).
|
|
26
26
|
*/
|
package/src/cmd-secrets-spec.ts
CHANGED
|
@@ -8,7 +8,10 @@ export const SECRETS_SUBCOMMANDS = ['show', 'init', 'edit', 'set', 'rotate'] as
|
|
|
8
8
|
|
|
9
9
|
export const secretsSpec: CommandSpec = {
|
|
10
10
|
name: 'secrets',
|
|
11
|
-
|
|
11
|
+
// The key is read from the env and the file only, and the summary says so: importing
|
|
12
|
+
// `apps/<app>/runtime.ts` for its `secretSource` would run the app's boot guards, which may need
|
|
13
|
+
// the very secrets this command edits. A KMS/Vault source is the booted app's (`runtime.ts`).
|
|
14
|
+
summary: `the committed encrypted secrets, decrypted into the ${ENV_SCHEMA_EXPORT} variables of the same names; the master key is ULTIMATE_SECRETS_KEY or .secrets.key only — a runtime.ts secretSource is the booted app's`,
|
|
12
15
|
usage: 'x secrets [show|init|edit|set <NAME>|rotate [--drop <keyId>]] [--json]',
|
|
13
16
|
requiresApp: true,
|
|
14
17
|
subcommands: [...SECRETS_SUBCOMMANDS],
|