@ultimat3/cli 31.50.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.
Files changed (80) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +9 -9
  3. package/package.json +29 -29
  4. package/src/app-boundaries.ts +2 -0
  5. package/src/app-dev-imports.ts +77 -0
  6. package/src/app-load-import-chain.ts +112 -0
  7. package/src/app-load-unresolved.ts +173 -16
  8. package/src/app-load.ts +22 -5
  9. package/src/catalog-layout.ts +194 -0
  10. package/src/cmd-i18n-spec.ts +4 -4
  11. package/src/cmd-i18n-split.ts +133 -0
  12. package/src/cmd-i18n.ts +46 -66
  13. package/src/config-redact.ts +20 -4
  14. package/src/db-rollback-pass.ts +4 -1
  15. package/src/dev-child-watch.ts +16 -0
  16. package/src/dev-db-migrate.ts +27 -46
  17. package/src/dev-db-migrator-hold.ts +131 -0
  18. package/src/dev-db-rollback.ts +11 -2
  19. package/src/dev-only-imports.ts +59 -0
  20. package/src/dev-rebuild-schema.ts +7 -24
  21. package/src/error-codes-boundary.ts +2 -0
  22. package/src/evaluated-walk.ts +103 -0
  23. package/src/generate-catalog-locales.ts +25 -2
  24. package/src/generate-follow-ups.ts +8 -3
  25. package/src/i18n-audit.ts +17 -33
  26. package/src/i18n-index.ts +108 -31
  27. package/src/i18n-locale-parity.ts +14 -6
  28. package/src/i18n-new-locale.ts +75 -0
  29. package/src/i18n-registration.ts +52 -27
  30. package/src/index.ts +2 -0
  31. package/src/island-capture.ts +36 -7
  32. package/src/mcp-errors.ts +3 -1
  33. package/src/merge-state.ts +3 -2
  34. package/src/messages-floor.ts +2 -0
  35. package/src/messages.ts +2 -0
  36. package/src/module-imports.ts +26 -15
  37. package/src/page-route.ts +75 -0
  38. package/src/scan-ways.ts +145 -0
  39. package/src/serve-boot-telemetry.ts +106 -0
  40. package/src/serve-boot.ts +23 -4
  41. package/src/shot-blank.ts +70 -0
  42. package/src/templates/catalog-barrel.ts +84 -0
  43. package/src/templates/guard-released-forms.ts +2 -1
  44. package/src/templates/guard-untranslated-string.ts +27 -6
  45. package/src/templates/locales.ts +6 -0
  46. package/src/templates/scaffold-gitattributes.ts +9 -2
  47. package/src/templates/scaffold-i18n.ts +10 -6
  48. package/src/templates/shapes/offline.ts +5 -2
  49. package/src/test-ignores.ts +3 -2
  50. package/src/verify-checks.ts +7 -3
  51. package/src/verify-floor.ts +9 -1
  52. package/src/verify-local-only.ts +66 -0
  53. package/src/verify-run.ts +17 -2
  54. package/wiki/Actions.md +1 -1
  55. package/wiki/Auth.md +4 -4
  56. package/wiki/Batching-And-Preloading.md +1 -0
  57. package/wiki/CLI-Reference-Data.md +241 -0
  58. package/wiki/CLI-Reference-Gate.md +572 -0
  59. package/wiki/CLI-Reference-Project.md +414 -0
  60. package/wiki/CLI-Reference-Ship.md +348 -0
  61. package/wiki/CLI-Reference-Tools.md +666 -0
  62. package/wiki/CLI-Reference.md +14 -2225
  63. package/wiki/Compared.md +8 -8
  64. package/wiki/Configuration.md +26 -2
  65. package/wiki/Deployment.md +1 -1
  66. package/wiki/Entities-And-Migrations.md +3 -2
  67. package/wiki/I18n.md +39 -5
  68. package/wiki/Installation.md +1 -1
  69. package/wiki/Jobs-And-Workflows.md +29 -1
  70. package/wiki/Known-Gaps.md +3 -0
  71. package/wiki/Observability.md +15 -1
  72. package/wiki/Outbound-HTTP.md +62 -2
  73. package/wiki/PWA-And-Offline.md +1 -1
  74. package/wiki/Policies-And-Authz.md +10 -0
  75. package/wiki/Realtime.md +29 -2
  76. package/wiki/Static-Assets.md +1 -1
  77. package/wiki/Testing.md +58 -0
  78. package/wiki/Theming.md +31 -8
  79. package/wiki/Troubleshooting.md +2 -2
  80. package/wiki/Upgrading.md +6 -1
@@ -0,0 +1,84 @@
1
+ // The module a split locale's directory holds beside its namespace files: each file imported and
2
+ // set at the key path its name stands for, so `packages/i18n/src/index.ts` imports one locale as
3
+ // one object and `typeof` it is still the typed key space. Derived from the file list alone, so
4
+ // every writer re-derives it and none can drift from another.
5
+
6
+ import { catalogFilePrefix } from '@ultimat3/i18n';
7
+ import { pascal } from './naming';
8
+
9
+ /** The export every barrel declares — `import { catalog as en } from '../catalogs/en'`. */
10
+ export const BARREL_EXPORT = 'catalog';
11
+
12
+ interface Node {
13
+ binding?: string;
14
+ readonly children: Map<string, Node>;
15
+ }
16
+
17
+ const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
18
+
19
+ /** `'my-ns'` where a segment is not an identifier; bare where it is, as Biome formats it. */
20
+ const property = (segment: string): string => (IDENTIFIER.test(segment) ? segment : `'${segment}'`);
21
+
22
+ /**
23
+ * One binding per file, `ns` + its prefix in PascalCase: `site/home.json` → `nsSiteHome`. The
24
+ * prefix keeps every binding clear of a reserved word (`default.json`, `new.json`) and of a leading
25
+ * digit (`404.json`); a second file reshaped to the same name takes a counter.
26
+ */
27
+ function bindingsOf(prefixes: readonly string[]): ReadonlyMap<string, string> {
28
+ const taken = new Set<string>();
29
+ const bindings = new Map<string, string>();
30
+ for (const prefix of prefixes) {
31
+ const base = `ns${pascal(prefix.replaceAll('.', '-'))}`;
32
+ let binding = base;
33
+ for (let n = 2; taken.has(binding); n += 1) binding = `${base}${n}`;
34
+ taken.add(binding);
35
+ bindings.set(prefix, binding);
36
+ }
37
+ return bindings;
38
+ }
39
+
40
+ /** A node as an expression: a file alone is its binding; children make an expanded object. */
41
+ function render(node: Node, indent: string): string {
42
+ if (node.children.size === 0) return node.binding ?? '{}';
43
+ const inner = `${indent} `;
44
+ const lines = node.binding === undefined ? [] : [`${inner}...${node.binding},`];
45
+ for (const [segment, child] of node.children) {
46
+ lines.push(`${inner}${property(segment)}: ${render(child, inner)},`);
47
+ }
48
+ return `{\n${lines.join('\n')}\n${indent}}`;
49
+ }
50
+
51
+ /**
52
+ * The barrel for a locale directory holding `files` (names relative to it: `billing.json`,
53
+ * `site/home.json`). Imports in file-name order — Biome's import sort is told to leave them, as
54
+ * it puts `site/home.json` before `site.json` by a rule no writer here restates — and every object
55
+ * expanded one entry per line: the shape Biome's formatter keeps, and the one `x merge-driver`
56
+ * merges when two branches each add a namespace.
57
+ */
58
+ export function catalogBarrel(files: readonly string[]): string {
59
+ const names = [...new Set(files)].sort();
60
+ const prefixes = names.map(catalogFilePrefix);
61
+ const bindings = bindingsOf(prefixes);
62
+ const root: Node = { children: new Map() };
63
+ for (const prefix of [...prefixes].sort()) {
64
+ let node = root;
65
+ for (const segment of prefix.split('.')) {
66
+ const child = node.children.get(segment) ?? { children: new Map() };
67
+ node.children.set(segment, child);
68
+ node = child;
69
+ }
70
+ const binding = bindings.get(prefix);
71
+ if (binding !== undefined) node.binding = binding;
72
+ }
73
+ const imports = names.map((name, index) => {
74
+ const prefix = prefixes[index] ?? '';
75
+ return `import ${bindings.get(prefix) ?? ''} from './${name}';`;
76
+ });
77
+ const block = imports.length === 0 ? '' : `${imports.join('\n')}\n\n`;
78
+ return `// Generated from the namespace files beside it — never hand-edited: \`bunx x i18n split\` and
79
+ // every x i18n command re-derive it. Each file sits at the key path its name stands for.
80
+ // biome-ignore-all assist/source/organizeImports: in file-name order, the order every writer derives
81
+
82
+ ${block}export const ${BARREL_EXPORT} = ${render(root, '')};
83
+ `;
84
+ }
@@ -147,6 +147,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
147
147
  ['w7as1ib1ido8', 'error'],
148
148
  ],
149
149
  'untranslated-string': [
150
+ ['14xfnj5h9tq91', 'error'],
150
151
  ['211cleyx8cmgn', 'error'],
151
152
  ['2tmea7cmz7rvr', 'error'],
152
153
  ['2x85ib5eqdxzi', 'error'],
@@ -191,6 +192,6 @@ export const RELEASED_GUARD_TEST_FORMS: Readonly<Record<string, readonly string[
191
192
  'undeclared-custom-property': ['30bi2v92swukf', 'svuf8sm14fm8'],
192
193
  'undeclared-env': ['38run3rew6y0c', '8xdp7gp7hol7'],
193
194
  'undefined-style-class': ['1uy88gpk5k8p8', '2sy8me3i3bmzw'],
194
- 'untranslated-string': ['30q3u45cey2eq', 'cgvfv231gnvg', 'kdo3fxwgix3j'],
195
+ 'untranslated-string': ['30q3u45cey2eq', '3bocce437rxn7', 'cgvfv231gnvg', 'kdo3fxwgix3j'],
195
196
  'unzoned-date': ['1m46q3h8t4v7v', '1siep3fqscks4', '20x6l238r09jk', '3jzdaqcytkgil'],
196
197
  };
@@ -91,8 +91,19 @@ const withoutExpressions = (children: string): string => {
91
91
  return out;
92
92
  };
93
93
 
94
- /** Pure — the caller does the I/O — so the rule is testable without a filesystem. */
95
- export function untranslatedStrings(files: readonly SourceFile[]): readonly Finding[] {
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 packages/i18n/catalogs/en.json, render it as {t('…')} in \${file.path}, then: x verify --only boundaries\`,
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 packages/i18n/catalogs/en.json, write it as \${name}={t('…')} in \${file.path}, then: x verify --only boundaries\`,
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(_root, sources) {
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
- return untranslatedStrings(files);
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. */
@@ -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/*.json merge=x-registry
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
- export const localeImport = (locale: string): string =>
51
- `import ${camel(locale)} from '../catalogs/${locale}.json';`;
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
- budget: { js: '156kb' },`;
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('156kb');",
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
  {
@@ -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 =>
@@ -10,6 +10,7 @@ import type { MetaIssue } from '@ultimat3/seo';
10
10
  import { llmsDescriptionIssues, validateMeta } from '@ultimat3/seo';
11
11
  import { checkAgentsMd } from './app-agents-md';
12
12
  import { readAppSources } from './app-boundaries';
13
+ import { devImportWarnings } from './app-dev-imports';
13
14
  import { envExampleFindings } from './app-env';
14
15
  import { loadApp } from './app-load';
15
16
  import { appManifest } from './app-manifest';
@@ -125,18 +126,21 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
125
126
  // second time (`guard-sources.ts`).
126
127
  //
127
128
  // A report-only guard's findings ride as warnings, as the filesize band does: listed, never red.
129
+ // So does a development entry a role loads (`app-dev-imports.ts`).
128
130
  async run(ctx) {
129
131
  const sources = await readAppSources(ctx.root);
130
132
  const guards = await guardReport(ctx.root, sources);
133
+ const warnings = [
134
+ ...guards.warnings.map(guardWarningLine),
135
+ ...(await devImportWarnings(ctx.root)),
136
+ ];
131
137
  return {
132
138
  ...fromFindings([
133
139
  ...(await appBoundaryFindings(ctx.root, sources)),
134
140
  ...guards.findings,
135
141
  ...(await hostFindings(ctx, 'boundaries')),
136
142
  ]),
137
- ...(guards.warnings.length === 0
138
- ? {}
139
- : { warnings: guards.warnings.map(guardWarningLine) }),
143
+ ...(warnings.length === 0 ? {} : { warnings }),
140
144
  };
141
145
  },
142
146
  },
@@ -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 selected = only === undefined ? steps : steps.filter((step) => only.includes(step.name));
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,8 +226,8 @@ 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)) |
230
- | sign-in by mailed link | Not exported yet: `signInWithLink` stays internal to `@ultimat3/auth` and ships in the next minor (`As of 2026-11`). A mailed credential today is `defineVerificationPurpose` + `consumeVerification` |
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
+ | 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 |
233
233
  | an external issuer's bearer (`As of 2026-11`) | `jwtBearerResolver({ keys, issuers, audience, requiredScope?, accept?, actorOf })` — `apiKeyResolver`'s twin for JWTs, the `resolveToken` a bearer mount and `defineAppMcp()` take. `keys` is a thunk read when a token arrives (no discovery at import); `accept(raw)` is the app's own claim check after the signature; `actorOf(token)` builds the actor. Every refusal — signature, issuer, audience, expiry, scope, `accept`, and a key set that cannot be read — is `null` plus one `auth.jwt_bearer.refused` log line naming the check, never a claim's value. The mount answers that `null` as `401 X_UNAUTHENTICATED` |
@@ -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