@ultimat3/cli 31.51.0 → 31.52.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/README.md +9 -9
- package/package.json +29 -29
- package/src/catalog-layout.ts +194 -0
- package/src/cmd-i18n-spec.ts +4 -4
- package/src/cmd-i18n-split.ts +133 -0
- package/src/cmd-i18n.ts +46 -66
- package/src/config-redact.ts +20 -4
- package/src/db-rollback-pass.ts +4 -1
- package/src/dev-child-watch.ts +16 -0
- package/src/dev-db-migrate.ts +27 -46
- package/src/dev-db-migrator-hold.ts +131 -0
- package/src/dev-db-rollback.ts +11 -2
- package/src/dev-rebuild-schema.ts +7 -24
- package/src/generate-catalog-locales.ts +25 -2
- package/src/generate-follow-ups.ts +8 -3
- package/src/i18n-audit.ts +17 -33
- package/src/i18n-index.ts +108 -31
- package/src/i18n-locale-parity.ts +14 -6
- package/src/i18n-new-locale.ts +75 -0
- package/src/i18n-registration.ts +52 -27
- package/src/island-capture.ts +36 -7
- package/src/merge-state.ts +3 -2
- package/src/messages-floor.ts +2 -0
- package/src/messages.ts +2 -0
- package/src/serve-boot-telemetry.ts +106 -0
- package/src/serve-boot.ts +23 -4
- package/src/shot-blank.ts +70 -0
- package/src/templates/catalog-barrel.ts +84 -0
- package/src/templates/guard-released-forms.ts +2 -1
- package/src/templates/guard-untranslated-string.ts +27 -6
- package/src/templates/locales.ts +6 -0
- package/src/templates/scaffold-gitattributes.ts +9 -2
- package/src/templates/scaffold-i18n.ts +10 -6
- package/src/templates/shapes/offline.ts +5 -2
- package/src/test-ignores.ts +3 -2
- package/src/verify-floor.ts +9 -1
- package/src/verify-local-only.ts +66 -0
- package/src/verify-run.ts +17 -2
- package/wiki/Actions.md +1 -1
- package/wiki/Auth.md +3 -3
- package/wiki/Batching-And-Preloading.md +1 -0
- package/wiki/CLI-Reference-Data.md +241 -0
- package/wiki/CLI-Reference-Gate.md +572 -0
- package/wiki/CLI-Reference-Project.md +414 -0
- package/wiki/CLI-Reference-Ship.md +348 -0
- package/wiki/CLI-Reference-Tools.md +666 -0
- package/wiki/CLI-Reference.md +14 -2225
- package/wiki/Compared.md +8 -8
- package/wiki/Configuration.md +26 -2
- package/wiki/Deployment.md +1 -1
- package/wiki/Entities-And-Migrations.md +3 -2
- package/wiki/I18n.md +39 -5
- package/wiki/Installation.md +1 -1
- package/wiki/Jobs-And-Workflows.md +29 -1
- package/wiki/Known-Gaps.md +3 -0
- package/wiki/Observability.md +15 -1
- package/wiki/Outbound-HTTP.md +62 -2
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Policies-And-Authz.md +10 -0
- package/wiki/Realtime.md +29 -2
- package/wiki/Static-Assets.md +1 -1
- package/wiki/Testing.md +33 -0
- package/wiki/Theming.md +31 -8
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Upgrading.md +5 -1
|
@@ -91,8 +91,19 @@ const withoutExpressions = (children: string): string => {
|
|
|
91
91
|
return out;
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
/**
|
|
95
|
-
|
|
94
|
+
/** Where the default locale's strings are written: the one file, or a split locale's directory. */
|
|
95
|
+
const FLAT_CATALOG = 'packages/i18n/catalogs/en.json';
|
|
96
|
+
const SPLIT_CATALOG =
|
|
97
|
+
"its namespace's file in packages/i18n/catalogs/en/ (app.billing.title goes in en/app.json)";
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Pure — the caller does the I/O — so the rule is testable without a filesystem. \`catalog\` is
|
|
101
|
+
* where the fix sends the new key: the flat file, unless the app splits its catalogs.
|
|
102
|
+
*/
|
|
103
|
+
export function untranslatedStrings(
|
|
104
|
+
files: readonly SourceFile[],
|
|
105
|
+
catalog = FLAT_CATALOG,
|
|
106
|
+
): readonly Finding[] {
|
|
96
107
|
const findings: Finding[] = [];
|
|
97
108
|
for (const file of files) {
|
|
98
109
|
const text = blank(file.source);
|
|
@@ -102,7 +113,7 @@ export function untranslatedStrings(files: readonly SourceFile[]): readonly Find
|
|
|
102
113
|
findings.push({
|
|
103
114
|
code: CODE,
|
|
104
115
|
cause: \`\${file.path}:\${lineOf(text, match.index)} renders the typed string "\${typed}" inside <\${match[1] ?? 'element'}> — it is in no catalog, so every locale but the one it was typed in reads it verbatim\`,
|
|
105
|
-
fix: \`add a key for "\${typed}" to
|
|
116
|
+
fix: \`add a key for "\${typed}" to \${catalog}, render it as {t('…')} in \${file.path}, then: x verify --only boundaries\`,
|
|
106
117
|
at: file.path,
|
|
107
118
|
});
|
|
108
119
|
}
|
|
@@ -113,7 +124,7 @@ export function untranslatedStrings(files: readonly SourceFile[]): readonly Find
|
|
|
113
124
|
findings.push({
|
|
114
125
|
code: CODE,
|
|
115
126
|
cause: \`\${file.path}:\${lineOf(text, match.index)} renders the typed string "\${typed}" as its \${name} — it is in no catalog, so every locale but the one it was typed in reads it verbatim\`,
|
|
116
|
-
fix: \`add a key for "\${typed}" to
|
|
127
|
+
fix: \`add a key for "\${typed}" to \${catalog}, write it as \${name}={t('…')} in \${file.path}, then: x verify --only boundaries\`,
|
|
117
128
|
at: file.path,
|
|
118
129
|
});
|
|
119
130
|
}
|
|
@@ -123,7 +134,7 @@ export function untranslatedStrings(files: readonly SourceFile[]): readonly Find
|
|
|
123
134
|
|
|
124
135
|
export const guard: Guard = {
|
|
125
136
|
summary: 'a rendered string comes from t(), never typed into the page',
|
|
126
|
-
async check(
|
|
137
|
+
async check(root, sources) {
|
|
127
138
|
const files: SourceFile[] = [];
|
|
128
139
|
// Every rendered surface: an app's \`site/\` and \`app/\`, and the shared components under
|
|
129
140
|
// \`packages/*/src\` — \`x new\` scaffolds a \`packages/ui\` whose components render to a user, so
|
|
@@ -144,7 +155,9 @@ export const guard: Guard = {
|
|
|
144
155
|
files.push({ path: file.path, source: file.text });
|
|
145
156
|
}
|
|
146
157
|
}
|
|
147
|
-
|
|
158
|
+
// A split app's \`en/\` holds the barrel \`x i18n split\` writes; a flat app has no such file.
|
|
159
|
+
const split = await Bun.file(\`\${root}/packages/i18n/catalogs/en/index.ts\`).exists();
|
|
160
|
+
return untranslatedStrings(files, split ? SPLIT_CATALOG : FLAT_CATALOG);
|
|
148
161
|
},
|
|
149
162
|
};
|
|
150
163
|
`;
|
|
@@ -206,6 +219,14 @@ unitTest('a typed aria-label is refused, and a t() call in one is not', () => {
|
|
|
206
219
|
unitTest('one word character is a symbol, not a sentence', () => {
|
|
207
220
|
expect(untranslatedStrings(file('<span>&</span>'))).toEqual([]);
|
|
208
221
|
});
|
|
222
|
+
|
|
223
|
+
unitTest('the fix names the file the key goes in, flat or split', () => {
|
|
224
|
+
expect(untranslatedStrings(file('<h1>Welcome back</h1>'))[0]?.fix).toContain(
|
|
225
|
+
'packages/i18n/catalogs/en.json',
|
|
226
|
+
);
|
|
227
|
+
const split = untranslatedStrings(file('<h1>Welcome back</h1>'), 'en/app.json');
|
|
228
|
+
expect(split[0]?.fix).toContain('en/app.json');
|
|
229
|
+
});
|
|
209
230
|
`;
|
|
210
231
|
|
|
211
232
|
/** `guards/untranslated-string.ts` and its test. The directory is the registration. */
|
package/src/templates/locales.ts
CHANGED
|
@@ -13,6 +13,12 @@ export const CATALOG_ROOT = 'packages/i18n/catalogs';
|
|
|
13
13
|
/** The catalog layout, written down once: `x g route` and `x g resource` both merge into it. */
|
|
14
14
|
export const catalogPath = (locale: string): string => `${CATALOG_ROOT}/${locale}.json`;
|
|
15
15
|
|
|
16
|
+
/** A split locale's directory: one `<namespace>.json` per namespace (`catalog-layout.ts`). */
|
|
17
|
+
export const catalogDir = (locale: string): string => `${CATALOG_ROOT}/${locale}`;
|
|
18
|
+
|
|
19
|
+
/** The generated module in a split locale's directory that joins its files into one catalog. */
|
|
20
|
+
export const CATALOG_BARREL = 'index.ts';
|
|
21
|
+
|
|
16
22
|
/** The runnable form of the flag, used as the fix on every rejection below. */
|
|
17
23
|
const LOCALES_FIX = 'x g resource <name> --locales=en,es';
|
|
18
24
|
|
|
@@ -46,10 +46,16 @@ export const LINE_ENDING_ATTRIBUTES = `# Every text file is LF, in the index and
|
|
|
46
46
|
${BINARY_EXTENSIONS.map((extension) => `*.${extension} binary`).join('\n')}
|
|
47
47
|
`;
|
|
48
48
|
|
|
49
|
+
/** The catalog rule `x new` wrote before split catalogs, and what `x i18n split` replaces it with. */
|
|
50
|
+
export const FLAT_CATALOG_ATTRIBUTE = 'packages/i18n/catalogs/*.json merge=x-registry';
|
|
51
|
+
|
|
49
52
|
/**
|
|
50
53
|
* How two branches' features merge. `bunx x merge-driver install` (a step of `bun run setup`) defines
|
|
51
54
|
* the drivers in `.git/config`; a clone without them gets git's ordinary text merge, so nothing here
|
|
52
|
-
* can lose work. Also carried into existing apps by the `merge-drivers` codemod.
|
|
55
|
+
* can lose work. Also carried into existing apps by the `merge-drivers` codemod. The catalog rule
|
|
56
|
+
* holds a flat `<locale>.json` and every namespace file of a split locale alike (git's `**` also
|
|
57
|
+
* matches no directory); a split locale's barrel is one import and one entry per line, so the
|
|
58
|
+
* registry driver keeps the namespace each branch added.
|
|
53
59
|
*/
|
|
54
60
|
export const MERGE_ATTRIBUTES = `# Merging two features. x-registry keeps what both branches added and leaves a real conflict alone;
|
|
55
61
|
# x-generated keeps our copy of a projection, which \`bunx x manifest\` then rebuilds.
|
|
@@ -57,7 +63,8 @@ apps/web/api/index.ts merge=x-registry
|
|
|
57
63
|
apps/web/exercise.ts merge=x-registry
|
|
58
64
|
apps/web/shared/roles.ts merge=x-registry
|
|
59
65
|
packages/db/src/client.ts merge=x-registry
|
|
60
|
-
packages/i18n/catalogs
|
|
66
|
+
packages/i18n/catalogs/**/*.json merge=x-registry
|
|
67
|
+
packages/i18n/catalogs/*/index.ts merge=x-registry
|
|
61
68
|
x.manifest.json merge=x-generated
|
|
62
69
|
openapi.json merge=x-generated
|
|
63
70
|
`;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// of scaffold-repo.ts to stay under the file-size ceiling.
|
|
4
4
|
|
|
5
5
|
import { APP_CATALOGS_PATH } from '@ultimat3/i18n/app-catalogs';
|
|
6
|
+
import { BARREL_EXPORT } from './catalog-barrel';
|
|
6
7
|
import { catalogJson } from './catalog-json';
|
|
7
8
|
import type { GeneratedFile, NameSet } from './naming';
|
|
8
9
|
import { camel } from './naming';
|
|
@@ -46,9 +47,12 @@ const orderedLocales = (locales: readonly string[]): readonly string[] => {
|
|
|
46
47
|
|
|
47
48
|
/** A locale tag is not always a valid JS binding (`zh-hant`) — `camel()` is the one identifier
|
|
48
49
|
* derivation every generated file already uses for names, so the import agrees with the rest of
|
|
49
|
-
* the app's own naming instead of inventing a second casing rule.
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
* the app's own naming instead of inventing a second casing rule. A split locale is its
|
|
51
|
+
* directory's generated barrel (`catalog-barrel.ts`), read as the same one object a JSON file is. */
|
|
52
|
+
export const localeImport = (locale: string, split = false): string =>
|
|
53
|
+
split
|
|
54
|
+
? `import { ${BARREL_EXPORT} as ${camel(locale)} } from '../catalogs/${locale}';`
|
|
55
|
+
: `import ${camel(locale)} from '../catalogs/${locale}.json';`;
|
|
52
56
|
|
|
53
57
|
/** The object-literal entry for one locale: shorthand when the binding IS the tag (`en`, `es`, …),
|
|
54
58
|
* `'tag': binding` when `camel()` had to reshape it (`zh-hant` → `zhHant`) — `defineCatalogs` reads
|
|
@@ -61,13 +65,13 @@ export const localeEntry = (locale: string): string => {
|
|
|
61
65
|
/**
|
|
62
66
|
* The app's one catalog-registration module — regenerated, never hand-edited, to the full current
|
|
63
67
|
* locale set every time `x g ... --locales` lands a new catalog file (`syncI18nIndex` in
|
|
64
|
-
* `cmd-generate.ts`). `i18nFiles` below calls this with `['en']` for the shape `x new` has always
|
|
68
|
+
* `cmd-generate.ts`). `split` names the locales held as a directory of namespace files. `i18nFiles` below calls this with `['en']` for the shape `x new` has always
|
|
65
69
|
* scaffolded; a later run passes whatever `packages/i18n/catalogs/` actually holds.
|
|
66
70
|
*/
|
|
67
|
-
export function i18nIndex(locales: readonly string[]): string {
|
|
71
|
+
export function i18nIndex(locales: readonly string[], split: readonly string[] = []): string {
|
|
68
72
|
const ordered = orderedLocales(locales);
|
|
69
73
|
const fallback = defaultLocaleOf(locales);
|
|
70
|
-
const imports = ordered.map(localeImport).join('\n');
|
|
74
|
+
const imports = ordered.map((locale) => localeImport(locale, split.includes(locale))).join('\n');
|
|
71
75
|
const entries = ordered.map(localeEntry).join(', ');
|
|
72
76
|
return `// The app's catalog, registered once and typed against English. Every surface resolves strings
|
|
73
77
|
// through this module, and an unknown key is a compile error via useT() — never a runtime miss
|
|
@@ -29,7 +29,10 @@ const OFFLINE_BUDGET = ` // measured: 158,171 B (\`bunx x verify --only budgets
|
|
|
29
29
|
// raised 155kb → 156kb, measured: 158,737 B (2026-11-17) — the page boot 84,889 + the island
|
|
30
30
|
// 72,576 + inline 1,272. why: +12 B in each chunk, \`uuidV7\` minting at timestamp 0 for a clock
|
|
31
31
|
// before 1970 (it used to throw), in core's ids, which both chunks carry.
|
|
32
|
-
|
|
32
|
+
// raised 156kb → 157kb, measured: 159,827 B (2026-11-28) — the page boot 85,564 + the island
|
|
33
|
+
// 72,891 + inline 1,372. why: the page boot carries realtime's live cursor and now keeps the
|
|
34
|
+
// \`sig\` each patch carries to hand back on resume (+253 B, #1280).
|
|
35
|
+
budget: { js: '157kb' },`;
|
|
33
36
|
|
|
34
37
|
const lan = (): string => `## 📶 Offline, and on your LAN
|
|
35
38
|
|
|
@@ -76,7 +79,7 @@ const edits = (): readonly ShapeEdit[] => [
|
|
|
76
79
|
{
|
|
77
80
|
path: 'apps/web/app/posts/page.test.ts',
|
|
78
81
|
find: " expect(page.config.budget.js).toBe('66kb');",
|
|
79
|
-
replace: " expect(page.config.budget.js).toBe('
|
|
82
|
+
replace: " expect(page.config.budget.js).toBe('157kb');",
|
|
80
83
|
},
|
|
81
84
|
// A write replayed from the outbox may already have landed: the key answers it, never twice.
|
|
82
85
|
{
|
package/src/test-ignores.ts
CHANGED
|
@@ -12,9 +12,10 @@ const IGNORED_ANYWHERE = ['dist', 'node_modules', '.git', '.x'] as const;
|
|
|
12
12
|
* Nested projects with their own gate (`examples/`, `dummy/`, run by
|
|
13
13
|
* `scripts/reference-app-gate.ts`) and the root `build/` — skipped AT THE ROOT only. Matched at any
|
|
14
14
|
* depth they swallowed an app's own slice: `x g resource build` lost 14 of its 16 test files and
|
|
15
|
-
* `x g resource example` its `examples/` page tests, from `x test` and the gate alike.
|
|
15
|
+
* `x g resource example` its `examples/` page tests, from `x test` and the gate alike. Likewise
|
|
16
|
+
* `.claude/worktrees/`: each agent worktree is a whole checkout, so scanning it doubled the run (#1287).
|
|
16
17
|
*/
|
|
17
|
-
const IGNORED_AT_ROOT = ['build', 'examples', 'dummy'] as const;
|
|
18
|
+
const IGNORED_AT_ROOT = ['build', 'examples', 'dummy', '.claude/worktrees'] as const;
|
|
18
19
|
|
|
19
20
|
/** Whether a root-relative POSIX path is excluded from every test selection. */
|
|
20
21
|
export const isIgnoredTestPath = (path: string): boolean =>
|
package/src/verify-floor.ts
CHANGED
|
@@ -17,6 +17,8 @@ import type { StepTimeouts } from './verify-deadline';
|
|
|
17
17
|
import { readStepTimeouts, STEP_TIMEOUT_FIELD } from './verify-deadline';
|
|
18
18
|
import type { GuardBaseline } from './verify-guard-baseline';
|
|
19
19
|
import { GUARD_BASELINE_FIELD, readGuardBaseline } from './verify-guard-baseline';
|
|
20
|
+
import type { LocalOnlyReasons } from './verify-local-only';
|
|
21
|
+
import { LOCAL_ONLY_FIELD, readLocalOnly } from './verify-local-only';
|
|
20
22
|
import type { SkipCeiling } from './verify-skip-ceiling';
|
|
21
23
|
import { readSkipCeiling, SKIP_CEILING_FIELD } from './verify-skip-ceiling';
|
|
22
24
|
import { GATE_COMMAND, VERIFY_STEP_NAMES } from './verify-step';
|
|
@@ -92,6 +94,8 @@ export interface VerifyFloor {
|
|
|
92
94
|
readonly strict?: boolean;
|
|
93
95
|
/** Step → the written reason it runs no check in this repository (`verify-strict.ts`). */
|
|
94
96
|
readonly skip?: SkipReasons;
|
|
97
|
+
/** Step → why CI leaves it out; it runs on a developer's machine (`verify-local-only.ts`). */
|
|
98
|
+
readonly localOnly?: LocalOnlyReasons;
|
|
95
99
|
/** Guard → the findings it may still report as notices (`verify-guard-baseline.ts`). */
|
|
96
100
|
readonly guardBaseline?: GuardBaseline;
|
|
97
101
|
/** Why part of the file is not a floor. The `manifest` step reports these; nothing swallows them. */
|
|
@@ -216,6 +220,7 @@ export function parseVerifyFloor(
|
|
|
216
220
|
const exercise = readExerciseFloor(record);
|
|
217
221
|
const strict = readStrict(record, declared);
|
|
218
222
|
const guards = readGuardBaseline(record);
|
|
223
|
+
const local = readLocalOnly(record, declared);
|
|
219
224
|
const rest = {
|
|
220
225
|
...(budget.budget === undefined ? {} : { agentsMdMaxBytes: budget.budget }),
|
|
221
226
|
...(typecheckBin.bin === undefined ? {} : { typecheckBin: typecheckBin.bin }),
|
|
@@ -227,9 +232,10 @@ export function parseVerifyFloor(
|
|
|
227
232
|
...(exercise.floor === undefined ? {} : { exercise: exercise.floor }),
|
|
228
233
|
...(strict.strict === undefined ? {} : { strict: strict.strict }),
|
|
229
234
|
...(strict.skip === undefined ? {} : { skip: strict.skip }),
|
|
235
|
+
...(local.localOnly === undefined ? {} : { localOnly: local.localOnly }),
|
|
230
236
|
...(guards.baseline === undefined ? {} : { guardBaseline: guards.baseline }),
|
|
231
237
|
};
|
|
232
|
-
const later = [...strict.problems, ...guards.problems];
|
|
238
|
+
const later = [...strict.problems, ...guards.problems, ...local.problems];
|
|
233
239
|
const steps = record?.['steps'];
|
|
234
240
|
if (!Array.isArray(steps)) {
|
|
235
241
|
return {
|
|
@@ -352,6 +358,8 @@ export const floorProblemFindings = (floor: VerifyFloor | undefined): readonly F
|
|
|
352
358
|
const fixFor = (problem: string): string => {
|
|
353
359
|
if (problem.includes(`"${STRICT_FIELD}"`))
|
|
354
360
|
return `x verify --json # then set "${STRICT_FIELD}" in ${VERIFY_FLOOR_FILE} to true or false`;
|
|
361
|
+
if (problem.startsWith(`"${LOCAL_ONLY_FIELD}"`))
|
|
362
|
+
return `x verify --json # then write "${LOCAL_ONLY_FIELD}" in ${VERIFY_FLOOR_FILE} as { "e2e": "<why>" } — a step it runs, a written reason — or drop the entry`;
|
|
355
363
|
if (problem.startsWith(`"${SKIP_FIELD}"`))
|
|
356
364
|
return `x verify --json # then write "${SKIP_FIELD}" in ${VERIFY_FLOOR_FILE} as { "e2e": "<why>" } — a step it runs and "steps" does not list, a written reason`;
|
|
357
365
|
if (problem.includes(`"${GUARD_BASELINE_FIELD}"`))
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// `localOnly` in `x.verify.json`: steps the gate runs on a developer's machine and leaves out of
|
|
2
|
+
// CI, each with a written why. For a check that costs CI minutes and answers a question the
|
|
3
|
+
// author's own run already did (a real-browser pass, say). A step the floor's `steps` lists stays
|
|
4
|
+
// floored where it runs (a laptop). `--only <step>` still runs it anywhere.
|
|
5
|
+
|
|
6
|
+
import { msg } from './messages';
|
|
7
|
+
|
|
8
|
+
/** The floor's field: step name → why CI does not run it. */
|
|
9
|
+
export const LOCAL_ONLY_FIELD = 'localOnly';
|
|
10
|
+
|
|
11
|
+
/** Step name → the written reason CI leaves it out. */
|
|
12
|
+
export type LocalOnlyReasons = Readonly<Record<string, string>>;
|
|
13
|
+
|
|
14
|
+
/** `localOnly` as `{ "<step>": "<why>" }`, or the problems; absent is none. */
|
|
15
|
+
export function readLocalOnly(
|
|
16
|
+
payload: Record<string, unknown> | undefined,
|
|
17
|
+
declared: readonly string[],
|
|
18
|
+
): { readonly localOnly?: LocalOnlyReasons; readonly problems: readonly string[] } {
|
|
19
|
+
const raw = payload?.[LOCAL_ONLY_FIELD];
|
|
20
|
+
if (raw === undefined) return { problems: [] };
|
|
21
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
22
|
+
return { problems: [`"${LOCAL_ONLY_FIELD}" is not an object of { "<step>": "<why>" }`] };
|
|
23
|
+
const problems: string[] = [];
|
|
24
|
+
const reasons: Record<string, string> = {};
|
|
25
|
+
for (const [step, why] of Object.entries(raw)) {
|
|
26
|
+
if (!declared.includes(step))
|
|
27
|
+
problems.push(
|
|
28
|
+
`"${LOCAL_ONLY_FIELD}" names ${JSON.stringify(step)}, which x verify does not run`,
|
|
29
|
+
);
|
|
30
|
+
else if (typeof why !== 'string' || why.trim() === '')
|
|
31
|
+
problems.push(`"${LOCAL_ONLY_FIELD}" gives ${JSON.stringify(step)} no written why`);
|
|
32
|
+
else reasons[step] = why.trim();
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
...(Object.keys(reasons).length === 0 ? {} : { localOnly: reasons }),
|
|
36
|
+
problems,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The steps this run leaves out, each with its why: reported, never silently gone. */
|
|
41
|
+
export const leftOutSteps = (
|
|
42
|
+
localOnly: LocalOnlyReasons | undefined,
|
|
43
|
+
steps: readonly string[],
|
|
44
|
+
ci: boolean,
|
|
45
|
+
only: readonly string[] | undefined,
|
|
46
|
+
): LocalOnlyReasons =>
|
|
47
|
+
Object.fromEntries(
|
|
48
|
+
steps.flatMap((step) =>
|
|
49
|
+
leftOutOfCi(localOnly, step, ci, only) ? [[step, localOnly?.[step] ?? '']] : [],
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/** One human line per step left out, under the step table. */
|
|
54
|
+
export const leftOutLines = (leftOut: LocalOnlyReasons): readonly string[] =>
|
|
55
|
+
Object.entries(leftOut).map(([step, reason]) =>
|
|
56
|
+
msg('cli.verify.localOnly.line', { step, reason }),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
/** Is this step left out of this run? Only in CI, and never when `--only` names it. */
|
|
60
|
+
export const leftOutOfCi = (
|
|
61
|
+
localOnly: LocalOnlyReasons | undefined,
|
|
62
|
+
step: string,
|
|
63
|
+
ci: boolean,
|
|
64
|
+
only: readonly string[] | undefined,
|
|
65
|
+
): boolean =>
|
|
66
|
+
ci && localOnly !== undefined && Object.hasOwn(localOnly, step) && !only?.includes(step);
|
package/src/verify-run.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
skippedSuiteFinding,
|
|
17
17
|
vanishedSuiteFinding,
|
|
18
18
|
} from './verify-floor';
|
|
19
|
+
import { leftOutLines, leftOutOfCi, leftOutSteps } from './verify-local-only';
|
|
19
20
|
import { inCi, judgeSkips } from './verify-skip-ceiling';
|
|
20
21
|
import { appliesReason, ranNothingReason, skipLines } from './verify-skip-reason';
|
|
21
22
|
import { stalledOutput, stepTimeoutFinding } from './verify-stalled';
|
|
@@ -48,7 +49,19 @@ export async function runVerify(
|
|
|
48
49
|
resetTestDiscovery();
|
|
49
50
|
const floor = await readVerifyFloor(ctx.root);
|
|
50
51
|
const only = onlyList(ctx.only);
|
|
51
|
-
const
|
|
52
|
+
const ci = inCi(ctx.env ?? Bun.env);
|
|
53
|
+
// A step the floor's `localOnly` names is a developer's, not CI's (`verify-local-only.ts`).
|
|
54
|
+
const selected = steps.filter(
|
|
55
|
+
(step) =>
|
|
56
|
+
(only === undefined || only.includes(step.name)) &&
|
|
57
|
+
!leftOutOfCi(floor?.localOnly, step.name, ci, only),
|
|
58
|
+
);
|
|
59
|
+
const leftOut = leftOutSteps(
|
|
60
|
+
floor?.localOnly,
|
|
61
|
+
steps.map((step) => step.name),
|
|
62
|
+
ci,
|
|
63
|
+
only,
|
|
64
|
+
);
|
|
52
65
|
const byName = new Map<string, StepResult>();
|
|
53
66
|
// Per step: the numbers a judged run measured, or — under `--shard`, which cannot judge — the
|
|
54
67
|
// `facts` its slice covered, for `x verify merge` to fold.
|
|
@@ -146,7 +159,7 @@ export async function runVerify(
|
|
|
146
159
|
floor?.strict === true
|
|
147
160
|
? []
|
|
148
161
|
: skippedSteps.filter((name) => unrun.has(name) && skipWhy(floor, name) === undefined);
|
|
149
|
-
const lines = skipLines(skipReasons, unwaived);
|
|
162
|
+
const lines = [...skipLines(skipReasons, unwaived), ...leftOutLines(leftOut)];
|
|
150
163
|
const summary = verifySummary({
|
|
151
164
|
results,
|
|
152
165
|
failed: failedSteps,
|
|
@@ -170,6 +183,8 @@ export async function runVerify(
|
|
|
170
183
|
durationMs: totalMs,
|
|
171
184
|
...(unrun.size === 0 ? {} : { skipReasons }),
|
|
172
185
|
...(unwaived.length === 0 ? {} : { unwaived }),
|
|
186
|
+
// The steps `localOnly` left out of this CI run, with their why: omitted coverage, said.
|
|
187
|
+
...(Object.keys(leftOut).length === 0 ? {} : { localOnly: leftOut }),
|
|
173
188
|
// A BOOLEAN beside the banner, so a reader of `--json` never has to substring-match a
|
|
174
189
|
// summary line to learn that this run checked one thing.
|
|
175
190
|
// `only` is always the LIST, in declared order — one name is a list of one.
|
package/wiki/Actions.md
CHANGED
|
@@ -289,7 +289,7 @@ Every projection needs the name `defineApi({ actions })` stamps on at boot. It n
|
|
|
289
289
|
| 5 | **MCP tool** | `mcp` + `input` + `policy` | `toolFrom(publishPost)` from `@ultimat3/mcp` — one tool named `publishPost` per exposed action, exactly the `tools/list` entry, JSON Schema from `input`, every call through this action's `invoke` (authz unchanged) |
|
|
290
290
|
| 6 | **Test** | `input` + `policy` + `handle` | `publishPost.contract({ exercise })`, handed `apps/web/exercise.ts`'s export, where `x g` declares its entry — schema round-trip, a denial test per policy branch, and the handler on generated legal input, generated green, not as a `TODO` |
|
|
291
291
|
|
|
292
|
-
**A client for code that cannot import the app.** `rpc` needs the app's action types, so a customer's TypeScript never had one. `x client customer --out <dir>` compiles the committed `openapi.json` (or a bearer mount's own document, `--mount /v1`) into `index.ts` + `types.ts` with no import beyond the platform: `createClient({ baseUrl, headers })`, one method per `operationId`, a non-2xx as `ProblemError`, and `refusalOf(error, 'publishPost')` narrowing to the codes that operation declares under `errors:`. The calling direction is `x client vendor <name>` — `outbound()` and `t` schemas from a third party's document. One compiler for both, never a second way: [CLI reference](CLI-Reference#x-client). `As of 2026-11`.
|
|
292
|
+
**A client for code that cannot import the app.** `rpc` needs the app's action types, so a customer's TypeScript never had one. `x client customer --out <dir>` compiles the committed `openapi.json` (or a bearer mount's own document, `--mount /v1`) into `index.ts` + `types.ts` with no import beyond the platform: `createClient({ baseUrl, headers })`, one method per `operationId`, a non-2xx as `ProblemError`, and `refusalOf(error, 'publishPost')` narrowing to the codes that operation declares under `errors:`. The calling direction is `x client vendor <name>` — `outbound()` and `t` schemas from a third party's document. One compiler for both, never a second way: [CLI reference](CLI-Reference-Tools#x-client). `As of 2026-11`.
|
|
293
293
|
|
|
294
294
|
**A bulk endpoint is one action.** `hive({ member, split, onMemberError })` (`@ultimat3/ai`) runs `member` once per item under its own policy and answers per-item outcomes — `{ index, status: 'ok' | 'failed', … }` — so a bulk operation is in OpenAPI, the typed client, the customer client and MCP by construction, with no batch route to hand-write.
|
|
295
295
|
|
package/wiki/Auth.md
CHANGED
|
@@ -66,7 +66,7 @@ issuer, discovered on the first sign-in). Both write the sign-in page, the `dest
|
|
|
66
66
|
its sign-in keys unset refuses to start (`X_AUTH_SIGN_IN_UNCONFIGURED`). `--password` also writes
|
|
67
67
|
`createSession` / `confirmSession` and the second-factor page; `--oidc` writes the start and
|
|
68
68
|
callback routes, passes `mfaPath` and writes the second-factor page and its `confirmSession` action, so an MFA-enrolled user finishes SSO (`As of 2026-11-19`; an app generated before adds `mfaPath` by hand — [Upgrading](Upgrading)), and drops `x new`'s development viewer while its files are still `x new`'s own. What each writes:
|
|
69
|
-
[CLI reference](CLI-Reference#x-g).
|
|
69
|
+
[CLI reference](CLI-Reference-Project#x-g).
|
|
70
70
|
|
|
71
71
|
## OAuth
|
|
72
72
|
|
|
@@ -226,7 +226,7 @@ const approved = await verifyPasskeyEvidence(evidence, { rpId: 'example.com', or
|
|
|
226
226
|
| Capability | Calls |
|
|
227
227
|
|---|---|
|
|
228
228
|
| TOTP + recovery codes | `enrolTotp`, `saveTotpSecret`, `generateRecoveryCodes`. The secret is **sealed at rest** under the app's master key and a plaintext one is refused, never read (`X_MFA_SECRET_UNSEALED`; `x auth seal-mfa` seals rows from before); a recovery code is consumed in one statement, so it works once. A password proven with a factor outstanding is `X_MFA_REQUIRED`, whose `meta.challenge` is a sealed five-minute credential; `completeMfa(auth, challenge, code)` finishes the sign-in, meters the guess against the same lockout buckets a password guess spends, and refuses a spent code on every replica (`x_totp_steps`, installed by the boot) |
|
|
229
|
-
| email verification, password reset, any other mailed credential | `defineVerificationPurpose({ name, template, ttlMs, identifier? })` → `{ issue, consume }` (`As of 2026-11`); `emailVerification` and `passwordReset` are its two built-in instances, and `issueVerification` / `consumeVerification` take any declared name. A token is consumed only when its hash matches, so a wrong guess cannot burn the victim's live link, and one purpose's token never consumes another's. A name declared twice or with no template is `X_VERIFICATION_PURPOSE_INVALID` at boot; an undeclared one at the call is `X_VERIFICATION_PURPOSE_UNKNOWN` (400). `VerificationPurpose` is `string`: a `switch` over it needs a default arm. The mail is sent through an injected `MailSender` ([Mail](Mail)) |
|
|
229
|
+
| email verification, password reset, any other mailed credential | `defineVerificationPurpose({ name, template, ttlMs, identifier? })` → `{ issue, consume }` (`As of 2026-11`); `emailVerification` and `passwordReset` are its two built-in instances, and `issueVerification` / `consumeVerification` take any declared name. A token is consumed only when its hash matches, so a wrong guess cannot burn the victim's live link, and one purpose's token never consumes another's. A name declared twice or with no template is `X_VERIFICATION_PURPOSE_INVALID` at boot; an undeclared one at the call is `X_VERIFICATION_PURPOSE_UNKNOWN` (400). `VerificationPurpose` is `string`: a `switch` over it needs a default arm. The mail is sent through an injected `MailSender` ([Mail](Mail)). `defineVerificationPurpose({ recipient: 'explicit' })` (`As of 2026-11`) is for a purpose whose identifier is a store key, not an address (the member invite): its `issue` requires a `to`, mailed as given, never normalised. On any other purpose, `passwordReset` and every sign-in purpose included, a `to` is `X_CONFIG_INVALID` before any row is written |
|
|
230
230
|
| sign-in by mailed link | `signInWithLink(auth, { purpose, identifier, token, signUp? })` (`As of 2026-11`): consumes a link issued under a purpose declared `signIn: true` (`defineVerificationPurpose`) and answers what `login()` answers. TOTP enrolled: `X_MFA_REQUIRED` with the sealed challenge and no session, finished by `completeMfa`. The link is spent first, so it is good for one attempt; a wrong token leaves it live. No account: refused, or created verified and passwordless when the call declares `signUp`. A disabled account, and one that never verified its address, are refused. Recovery requires an app-owned flow that proves the inbox, clears all credentials while disabled and atomically checks ownership before reopening, coordinated with every administrative disable. `updateUser` and `enableUser` do not supply that check. `'email-verify'`, `'password-reset'` and any declared purpose not marked `signIn: true` are not sign-in purposes (`X_CONFIG_INVALID`); an undeclared name is `X_VERIFICATION_PURPOSE_UNKNOWN` |
|
|
231
231
|
| API keys — how an agent authenticates | `issueApiKey` → `ult_<env>_<id>_<secret>`, shown once; `verifyApiKey` + `apiKeyActor` give a `kind: 'agent'` actor whose scopes are the key's and never the owner's roles (`X_API_KEY_INVALID`). A key is its owner's credential: a missing or disabled owner refuses it on the next use, a wildcard scope (`*`, `<resource>:*`) is refused at issue, and an owned key keeps only the scopes its owner's grants cover — pass `grantsOf` to expand roles ([`packages/auth/README.md`](https://github.com/developerz-ai/ultimate/blob/main/packages/auth/README.md)); a key with no `userId` is unchanged. `apiKeyResolver(() => store)` is both as the `resolveToken` a bearer mount and `defineAppMcp()` take: `{ actor, scopes }` for a live key, one `null` for every wrong one, and a store fault left a throw. In a test the store is `memoryAuthAdapter()` |
|
|
232
232
|
| service-to-service | `verifyWorkloadToken` reads a Kubernetes service-account token, a SPIFFE JWT-SVID or a cloud IMDS token (they are all one JWT); `actorFromService` gives a `kind: 'service'` actor. The returned `WorkloadToken` carries `raw`, the whole decoded payload, read only after every check held. mTLS is the mesh's job |
|
|
@@ -253,7 +253,7 @@ are the app's `policy` and the app's wrapper action.
|
|
|
253
253
|
The flow is functions, not actions: `@ultimat3/auth` is tier 2 and cannot import
|
|
254
254
|
`@ultimat3/action`. Wrap each call in the app's own `action()` with the app's policy — the shape
|
|
255
255
|
`x g sign-in` writes for `login()`; `x g invite` writes those three actions, their policy and the two pages
|
|
256
|
-
([CLI reference](CLI-Reference#x-g)). Proof: `bun test ./packages/auth/src/member-invite.test.ts`,
|
|
256
|
+
([CLI reference](CLI-Reference-Project#x-g)). Proof: `bun test ./packages/auth/src/member-invite.test.ts`,
|
|
257
257
|
including a seeded property test that an invite for tenant X never yields membership in Y.
|
|
258
258
|
|
|
259
259
|
## Authorization server
|
|
@@ -141,6 +141,7 @@ const removed = await db.likes.deleteWhere({ orgId, postId, memberId });
|
|
|
141
141
|
| `insertAll(rows)` | one multi-row `insert`, every row parsed through `$parse` exactly as `insert(row)` parses one |
|
|
142
142
|
| `upsertAll(rows, { onConflict, onMatch })` | `on conflict (…) do update` / `do nothing`; a collision overwrites every column the batch names except the conflict target, the primary key, and the soft-delete stamp |
|
|
143
143
|
| `updateWhere(filter, patch)` | the bulk form of `update(id, patch)` — and the only write path for a composite-key entity (`likes`, `blocks`, any join table) with no single-column id to address |
|
|
144
|
+
| `updateWhereReturning(filter, patch)` | `updateWhere` answering the rows it wrote. On Postgres one `update … returning *` decides, with no explicit lock; a pre-write count past `MAX_ASSERTED_ROWS` is refused, and a transaction rolls back if concurrent changes increase the result past the bound. A custom store refuses before writing. `updateWhereReturning({ id, status: 'open' }, { status: 'claimed' })` is `[]` when another caller got there first |
|
|
144
145
|
| `deleteWhere(filter)` | the bulk form of `delete(id)`, same reason |
|
|
145
146
|
| `countBy(column)` | one grouped count, the aggregate a `count()` per row is the N+1 of — see [Entities and migrations → A count per row is one grouped count](Entities-And-Migrations#a-count-per-row-is-one-grouped-count) |
|
|
146
147
|
|