@ultimat3/cli 31.51.0 → 31.53.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 +1 -1
- package/README.md +9 -9
- package/package.json +29 -29
- package/src/app-kit-disk.ts +39 -0
- package/src/app-kit-forms.ts +27 -0
- package/src/app-kit.ts +146 -0
- package/src/budgets.ts +3 -1
- package/src/catalog-layout.ts +194 -0
- package/src/cdp-shot-driver-screen.ts +72 -0
- package/src/cdp-shot-driver.ts +17 -1
- package/src/cmd-design-capture.ts +210 -0
- package/src/cmd-design-errors.ts +50 -0
- package/src/cmd-design-paths.ts +47 -0
- package/src/cmd-design-publish.ts +64 -0
- package/src/cmd-design-run.ts +229 -0
- package/src/cmd-design-spec.ts +47 -0
- package/src/cmd-design-theme.ts +107 -0
- package/src/cmd-design-url.ts +201 -0
- package/src/cmd-design.ts +188 -0
- package/src/cmd-doctor.ts +3 -0
- package/src/cmd-generate-spec.ts +5 -0
- package/src/cmd-generate.ts +3 -1
- 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/cmd-kit-spec.ts +13 -0
- package/src/cmd-kit.ts +133 -0
- package/src/cmd-shot-against.ts +275 -0
- package/src/cmd-shot-spec.ts +9 -1
- package/src/cmd-shot.ts +19 -0
- package/src/cmd-upgrade.ts +11 -0
- package/src/codemods/agent-kit.ts +130 -0
- package/src/codemods/agents-md-budget.ts +47 -0
- package/src/codemods/docs-visual-quality.ts +198 -0
- package/src/codemods/index.ts +8 -0
- package/src/codemods/settings-kit-allow.ts +49 -0
- package/src/config-redact.ts +20 -4
- package/src/db-rollback-pass.ts +4 -1
- package/src/design-extract-script.ts +187 -0
- package/src/design-extract.ts +311 -0
- package/src/design-map-colors.ts +180 -0
- package/src/design-map.ts +288 -0
- 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/doctor-kit.ts +25 -0
- package/src/error-catalog.ts +4 -2
- package/src/error-codes-kit.ts +24 -0
- package/src/error-codes.ts +12 -10
- package/src/generate-catalog-locales.ts +25 -2
- package/src/generate-files.ts +31 -1
- package/src/generate-follow-ups.ts +8 -3
- package/src/guards-shipped-names.ts +5 -0
- 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/kit/agent-audit.ts +49 -0
- package/src/kit/agent-data.ts +32 -0
- package/src/kit/agent-server.ts +34 -0
- package/src/kit/agent-shape.ts +61 -0
- package/src/kit/agent-web.ts +49 -0
- package/src/kit/design-map.ts +106 -0
- package/src/kit/managed.ts +12 -0
- package/src/kit/registry.ts +89 -0
- package/src/kit/skill-design-research.ts +119 -0
- package/src/kit/skill-feature.ts +159 -0
- package/src/kit/skill-planx.ts +139 -0
- package/src/kit/skill-upgrade.ts +94 -0
- package/src/kit/skill-verify.ts +80 -0
- package/src/mcp-errors.ts +5 -0
- package/src/mcp-ui-diff.ts +13 -38
- package/src/mcp-ui.ts +30 -1
- package/src/merge-state.ts +3 -2
- package/src/messages-design.ts +104 -0
- package/src/messages-floor.ts +2 -0
- package/src/messages-upgrade.ts +9 -0
- package/src/messages.ts +4 -0
- package/src/registry.ts +4 -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/shot-diff.ts +96 -0
- package/src/shot-gpu.ts +17 -5
- package/src/templates/catalog-barrel.ts +84 -0
- package/src/templates/guard-animated-layout-script.ts +173 -0
- package/src/templates/guard-effect-without-fallback.ts +117 -0
- package/src/templates/guard-motion-adapter.ts +161 -0
- package/src/templates/guard-raw-frame-loop.ts +134 -0
- package/src/templates/guard-raw-motion-script.ts +132 -0
- package/src/templates/guard-raw-motion-ts-scan.ts +95 -0
- package/src/templates/guard-released-forms.ts +12 -1
- package/src/templates/guard-untranslated-string.ts +27 -6
- package/src/templates/index.ts +1 -2
- package/src/templates/island.ts +55 -8
- package/src/templates/kit-released-forms.ts +63 -0
- package/src/templates/locales.ts +6 -0
- package/src/templates/motion-scale.ts +115 -0
- package/src/templates/scaffold-claude.ts +39 -26
- package/src/templates/scaffold-design.ts +41 -0
- package/src/templates/scaffold-docs.ts +31 -7
- package/src/templates/scaffold-gitattributes.ts +9 -2
- package/src/templates/scaffold-guards.ts +31 -2
- package/src/templates/scaffold-i18n.ts +10 -6
- package/src/templates/scaffold-verify-floor.ts +3 -0
- package/src/templates/shapes/blog-site.ts +15 -0
- package/src/templates/shapes/blog.ts +2 -0
- package/src/templates/shapes/content-site.ts +13 -0
- package/src/templates/shapes/content.ts +2 -0
- package/src/templates/shapes/dashboard-detail.ts +2 -0
- package/src/templates/shapes/dashboard-motion.ts +284 -0
- package/src/templates/shapes/dashboard.ts +19 -1
- package/src/templates/shapes/landing-motion.ts +67 -0
- package/src/templates/shapes/offline.ts +5 -2
- package/src/templates/shapes/saas.ts +4 -0
- package/src/test-ignores.ts +3 -2
- package/src/upgrade-gate.ts +14 -2
- package/src/upgrade-kit.ts +65 -0
- package/src/upgrade-report-kit.ts +28 -0
- package/src/upgrade-report.ts +3 -0
- package/src/verify-checks.ts +9 -1
- package/src/verify-floor.ts +9 -1
- package/src/verify-local-only.ts +66 -0
- package/src/verify-run.ts +17 -2
- package/src/workspace-checks.ts +3 -3
- package/wiki/Actions.md +1 -1
- package/wiki/Agents.md +33 -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 +687 -0
- package/wiki/CLI-Reference.md +18 -2227
- package/wiki/Compared.md +8 -8
- package/wiki/Configuration.md +26 -2
- package/wiki/Deployment.md +1 -1
- package/wiki/Design-Research.md +96 -0
- package/wiki/Effects.md +83 -0
- package/wiki/Entities-And-Migrations.md +3 -2
- package/wiki/FAQ.md +1 -1
- package/wiki/Getting-Started.md +1 -1
- package/wiki/Home.md +2 -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 +6 -2
- package/wiki/MCP-And-AI.md +4 -0
- package/wiki/Motion.md +85 -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/Project-Layout.md +1 -1
- 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/Tutorial-02-First-Feature.md +1 -1
- package/wiki/UI-Components.md +2 -0
- package/wiki/Upgrading.md +9 -3
- package/src/templates/scaffold-claude-agents.ts +0 -161
- package/src/templates/scaffold-claude-commands.ts +0 -239
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
import { DEFAULT_LOCALE, ERROR_DOCS_URL } from '@ultimat3/core';
|
|
7
7
|
import type { Catalog, Locale } from '@ultimat3/i18n';
|
|
8
8
|
import { isMiss, placeholdersOf } from '@ultimat3/i18n';
|
|
9
|
+
import type { CatalogLayout } from './catalog-layout';
|
|
10
|
+
import { catalogFileOf } from './catalog-layout';
|
|
9
11
|
import type { Finding } from './output';
|
|
10
|
-
import { catalogPath } from './templates/locales';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* The length above which two identical values are a copy rather than a name. `Postly`, `Free` and
|
|
@@ -41,6 +42,8 @@ const shownValue = (value: string): string =>
|
|
|
41
42
|
*/
|
|
42
43
|
export function localeParityFindings(
|
|
43
44
|
catalogs: Readonly<Record<Locale, Catalog>>,
|
|
45
|
+
/** Each locale's form on disk, so a split locale's finding names the namespace file. */
|
|
46
|
+
layout?: CatalogLayout,
|
|
44
47
|
): readonly Finding[] {
|
|
45
48
|
const reference = catalogs[DEFAULT_LOCALE];
|
|
46
49
|
if (reference === undefined) return [];
|
|
@@ -56,7 +59,11 @@ export function localeParityFindings(
|
|
|
56
59
|
// `X_CATALOG_MISSING_KEYS`'s finding. Reporting it here too would be one defect under two
|
|
57
60
|
// codes, and the second code's repair is not the first one's.
|
|
58
61
|
if (value === undefined || translated === undefined) continue;
|
|
59
|
-
|
|
62
|
+
const files = {
|
|
63
|
+
path: catalogFileOf(layout, locale, key),
|
|
64
|
+
reference: catalogFileOf(layout, DEFAULT_LOCALE, key),
|
|
65
|
+
};
|
|
66
|
+
findings.push(...keyFindings(locale, key, value, translated, files));
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
return findings;
|
|
@@ -76,8 +83,9 @@ function keyFindings(
|
|
|
76
83
|
key: string,
|
|
77
84
|
reference: string,
|
|
78
85
|
translated: string,
|
|
86
|
+
files: { readonly path: string; readonly reference: string },
|
|
79
87
|
): readonly Finding[] {
|
|
80
|
-
const path =
|
|
88
|
+
const { path } = files;
|
|
81
89
|
// A loud miss (`⟦key⟧`) is a placeholder, not a translation, and it carries no slot of its own:
|
|
82
90
|
// a slot comparison across it blames the marker — `x i18n sync` seeds one into every key
|
|
83
91
|
// nobody has translated — and prints a fix ("add {name}") that edits the placeholder. The hole
|
|
@@ -93,7 +101,7 @@ function keyFindings(
|
|
|
93
101
|
if (comparable && extra.length > 0) {
|
|
94
102
|
findings.push({
|
|
95
103
|
code: 'X_CATALOG_SLOT_MISMATCH',
|
|
96
|
-
cause: `${path} defines "${key}" with ${shownSlots(extra)}, which ${
|
|
104
|
+
cause: `${path} defines "${key}" with ${shownSlots(extra)}, which ${files.reference} does not — interpolate substitutes by name, so ${locale} renders ${shownMisses(extra)}`,
|
|
97
105
|
fix:
|
|
98
106
|
referenceSlots.length === 0
|
|
99
107
|
? `x i18n check --json # remove ${shownSlots(extra)} from "${key}" in ${path}`
|
|
@@ -107,7 +115,7 @@ function keyFindings(
|
|
|
107
115
|
if (comparable && missing.length > 0) {
|
|
108
116
|
findings.push({
|
|
109
117
|
code: 'X_CATALOG_SLOT_MISMATCH',
|
|
110
|
-
cause: `${
|
|
118
|
+
cause: `${files.reference} defines "${key}" with ${shownSlots(missing)}, which ${path} does not — the value it carries never renders in ${locale}`,
|
|
111
119
|
fix: `x i18n check --json # add ${shownSlots(missing)} to "${key}" in ${path}`,
|
|
112
120
|
docs: ERROR_DOCS_URL,
|
|
113
121
|
at: path,
|
|
@@ -122,7 +130,7 @@ function keyFindings(
|
|
|
122
130
|
if (translated === reference && reference.length > COPY_LENGTH && !isMiss(reference)) {
|
|
123
131
|
findings.push({
|
|
124
132
|
code: 'X_CATALOG_UNTRANSLATED',
|
|
125
|
-
cause: `${path} defines "${key}" exactly as ${
|
|
133
|
+
cause: `${path} defines "${key}" exactly as ${files.reference} does ("${shownValue(reference)}") — ${reference.length} characters, so ${locale} reads the reference's sentence instead of its own`,
|
|
126
134
|
fix: `x i18n check --json # translate "${key}" in ${path}`,
|
|
127
135
|
docs: ERROR_DOCS_URL,
|
|
128
136
|
at: path,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// `x i18n add`'s one write: a locale with no catalog yet, created in the form the default locale is
|
|
2
|
+
// in — one flat file, or a directory holding the default's namespace files — and never over a
|
|
3
|
+
// catalog already there, in either form: a flat file beside a directory is `X_CATALOG_LAYOUT_MIXED`.
|
|
4
|
+
|
|
5
|
+
// why: `node:` and not Bun: Bun has no exclusive-create write, and `open(path, 'wx')` / `mkdir`
|
|
6
|
+
// without `recursive` are the only ones there are — `Bun.write` overwrites, so an existence check
|
|
7
|
+
// before it is a race a second `x i18n add` wins. `existsSync` because `Bun.file().exists()`
|
|
8
|
+
// answers false for a directory, and `node:path` because Bun exposes no path API.
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
import { type FileHandle, mkdir, open } from 'node:fs/promises';
|
|
11
|
+
import { dirname, join } from 'node:path';
|
|
12
|
+
import { stringField } from '@ultimat3/core';
|
|
13
|
+
import type { Catalog } from '@ultimat3/i18n';
|
|
14
|
+
import type { LocaleLayout } from './catalog-layout';
|
|
15
|
+
import { catalogWrites } from './catalog-layout';
|
|
16
|
+
import { CatalogExistsError } from './errors';
|
|
17
|
+
import { catalogDir, catalogPath } from './templates/locales';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* `open`'s and `mkdir`'s failure when the path is already there — the one errno translated here.
|
|
21
|
+
*
|
|
22
|
+
* `stringField`, never `'code' in error && error.code`: `in` narrows for the COMPILER and promises
|
|
23
|
+
* the runtime nothing, so a throwing getter takes the command down one line after the guard.
|
|
24
|
+
*/
|
|
25
|
+
const isAlreadyExists = (error: unknown): boolean => stringField(error, 'code') === 'EEXIST';
|
|
26
|
+
|
|
27
|
+
/** Runs the exclusive create, answering `CatalogExistsError` for a path someone got to first. */
|
|
28
|
+
async function exclusive<T>(locale: string, path: string, create: () => Promise<T>): Promise<T> {
|
|
29
|
+
try {
|
|
30
|
+
return await create();
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (isAlreadyExists(error)) throw new CatalogExistsError({ locale, path });
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The other form already on disk is a catalog too: refused before anything is created. */
|
|
38
|
+
function refuseOtherForm(root: string, locale: string, other: string): void {
|
|
39
|
+
if (existsSync(join(root, other))) throw new CatalogExistsError({ locale, path: other });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Writes `catalog` as `locale`'s new catalog, shaped like `source` (the default locale's layout),
|
|
44
|
+
* and answers where it landed. The exclusive step is the file itself for a flat locale and the
|
|
45
|
+
* directory for a split one, so two concurrent `x i18n add fr` never both succeed.
|
|
46
|
+
*/
|
|
47
|
+
export async function writeNewLocale(
|
|
48
|
+
root: string,
|
|
49
|
+
locale: string,
|
|
50
|
+
catalog: Catalog,
|
|
51
|
+
source: LocaleLayout | undefined,
|
|
52
|
+
): Promise<string> {
|
|
53
|
+
const split = source?.form === 'split';
|
|
54
|
+
const writes = catalogWrites(locale, catalog, split ? 'split' : 'flat', source?.files);
|
|
55
|
+
if (!split) {
|
|
56
|
+
refuseOtherForm(root, locale, catalogDir(locale));
|
|
57
|
+
const absolute = join(root, catalogPath(locale));
|
|
58
|
+
await mkdir(dirname(absolute), { recursive: true });
|
|
59
|
+
const handle: FileHandle = await exclusive(locale, catalogPath(locale), () =>
|
|
60
|
+
open(absolute, 'wx'),
|
|
61
|
+
);
|
|
62
|
+
try {
|
|
63
|
+
await handle.writeFile(writes[0]?.contents ?? '{}\n');
|
|
64
|
+
} finally {
|
|
65
|
+
await handle.close();
|
|
66
|
+
}
|
|
67
|
+
return catalogPath(locale);
|
|
68
|
+
}
|
|
69
|
+
refuseOtherForm(root, locale, catalogPath(locale));
|
|
70
|
+
const dir = join(root, catalogDir(locale));
|
|
71
|
+
await mkdir(dirname(dir), { recursive: true });
|
|
72
|
+
await exclusive(locale, `${catalogDir(locale)}/`, () => mkdir(dir));
|
|
73
|
+
for (const file of writes) await Bun.write(join(root, file.path), file.contents);
|
|
74
|
+
return `${catalogDir(locale)}/`;
|
|
75
|
+
}
|
package/src/i18n-registration.ts
CHANGED
|
@@ -25,6 +25,8 @@ import { APP_CATALOGS_PATH } from '@ultimat3/i18n/app-catalogs';
|
|
|
25
25
|
import { mountedAdminKeys } from './admin-catalog-keys';
|
|
26
26
|
import type { LoadedApp } from './app-load';
|
|
27
27
|
import { loadApp } from './app-load';
|
|
28
|
+
import type { CatalogLayout } from './catalog-layout';
|
|
29
|
+
import { catalogLocation } from './catalog-layout';
|
|
28
30
|
import type { DuplicateProbe } from './duplicate-packages';
|
|
29
31
|
import { duplicateCause, duplicateFinding, findDuplicateInstalls } from './duplicate-packages';
|
|
30
32
|
import { auditApp } from './i18n-audit';
|
|
@@ -33,7 +35,7 @@ import { mailPreviewFindings } from './mail-preview-findings';
|
|
|
33
35
|
import type { Finding } from './output';
|
|
34
36
|
import { findingFrom } from './output';
|
|
35
37
|
import { quoteArg } from './shell-quote';
|
|
36
|
-
import { CATALOG_ROOT
|
|
38
|
+
import { CATALOG_ROOT } from './templates/locales';
|
|
37
39
|
|
|
38
40
|
/** The one package this check probes for a duplicate: its registry is the one it reads. */
|
|
39
41
|
const I18N_PKG = '@ultimat3/i18n';
|
|
@@ -48,8 +50,10 @@ export type AppLoader = (root: string) => Promise<Pick<LoadedApp, 'findings' | '
|
|
|
48
50
|
|
|
49
51
|
export interface RegistrationInput {
|
|
50
52
|
readonly root: string;
|
|
51
|
-
/** The catalogs on disk, parsed — `packages/i18n/catalogs/*.json
|
|
53
|
+
/** The catalogs on disk, parsed — `packages/i18n/catalogs/*.json` and `catalogs/<locale>/`. */
|
|
52
54
|
readonly catalogs: Readonly<Record<Locale, Catalog>>;
|
|
55
|
+
/** Each locale's form on disk, so a finding names the file or directory it is about. */
|
|
56
|
+
readonly layout?: CatalogLayout;
|
|
53
57
|
readonly extraction: Extraction;
|
|
54
58
|
readonly ignoreUnused: readonly string[];
|
|
55
59
|
readonly load?: AppLoader;
|
|
@@ -105,19 +109,20 @@ export async function checkRegistration(input: RegistrationInput): Promise<Regis
|
|
|
105
109
|
const findings: Finding[] =
|
|
106
110
|
duplicate === undefined ? [] : [duplicateFinding(input.root, duplicate, RECHECK)];
|
|
107
111
|
for (const gap of gaps) {
|
|
108
|
-
const
|
|
112
|
+
const at = catalogLocation(input.layout, gap.locale);
|
|
113
|
+
const finding = findingFrom(catalogUnregistered({ ...gap, file: at }));
|
|
109
114
|
findings.push(
|
|
110
115
|
duplicate === undefined
|
|
111
|
-
? { ...finding, ...unregisteredFix(gap.locale, index), at
|
|
116
|
+
? { ...finding, ...unregisteredFix(gap.locale, index), at }
|
|
112
117
|
: // The registry's own fix names a source edit — move the `defineCatalogs()` call — that an
|
|
113
118
|
// agent following it performs on a file that is already right (one adopter, 2026-09-05).
|
|
114
119
|
// With a duplicate on disk the cause IS the install, so the finding says so and the fix
|
|
115
120
|
// is the one the duplicate carries.
|
|
116
121
|
{
|
|
117
122
|
...finding,
|
|
118
|
-
cause: `${duplicateCause(input.root, duplicate)}; ${gap.missing.length} of ${
|
|
123
|
+
cause: `${duplicateCause(input.root, duplicate)}; ${gap.missing.length} of ${at}'s ${gap.shipped} key(s) registered into the copy the CLI does not read`,
|
|
119
124
|
fix: findings[0]?.fix ?? finding.fix,
|
|
120
|
-
at
|
|
125
|
+
at,
|
|
121
126
|
},
|
|
122
127
|
);
|
|
123
128
|
}
|
|
@@ -142,7 +147,7 @@ export async function checkRegistration(input: RegistrationInput): Promise<Regis
|
|
|
142
147
|
.filter((tag) => !unregisteredSet.has(tag))
|
|
143
148
|
.sort()) {
|
|
144
149
|
const missing = unanswered(catalogFor(locale), adminKeys);
|
|
145
|
-
if (missing.length > 0) findings.push(adminKeysFinding(locale, missing));
|
|
150
|
+
if (missing.length > 0) findings.push(adminKeysFinding(locale, missing, input.layout));
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
return {
|
|
@@ -180,8 +185,13 @@ const ADMIN_KEYS_WRITTEN =
|
|
|
180
185
|
'writes each key above: in the default locale the label x g resource --admin generates, a real string to keep or reword; in any other locale that label inside ⟦…⟧, to translate';
|
|
181
186
|
|
|
182
187
|
/** The finding with the code's own COMMAND and a comment that is true of what it writes. */
|
|
183
|
-
function missingKeysFinding(
|
|
184
|
-
|
|
188
|
+
function missingKeysFinding(
|
|
189
|
+
locale: Locale,
|
|
190
|
+
missing: readonly string[],
|
|
191
|
+
written: string,
|
|
192
|
+
layout: CatalogLayout | undefined,
|
|
193
|
+
): Finding {
|
|
194
|
+
const finding = findingFrom(catalogMissingKeys(locale, missing, catalogLocation(layout, locale)));
|
|
185
195
|
const [command = finding.fix] = finding.fix.split(' #');
|
|
186
196
|
return { ...finding, fix: `${command} # ${written}` };
|
|
187
197
|
}
|
|
@@ -192,12 +202,16 @@ function missingKeysFinding(locale: Locale, missing: readonly string[], written:
|
|
|
192
202
|
* too (`cmd-i18n.ts`), nested. The hand edit this used to name was a dotted key, which
|
|
193
203
|
* `loadCatalog` refuses as `X_CATALOG_INVALID`.
|
|
194
204
|
*/
|
|
195
|
-
function adminKeysFinding(
|
|
196
|
-
|
|
205
|
+
function adminKeysFinding(
|
|
206
|
+
locale: Locale,
|
|
207
|
+
missing: readonly string[],
|
|
208
|
+
layout: CatalogLayout | undefined,
|
|
209
|
+
): Finding {
|
|
210
|
+
const path = catalogLocation(layout, locale);
|
|
197
211
|
const shown = missing.slice(0, 12).map((key) => `"${key}"`);
|
|
198
212
|
const more = missing.length > shown.length ? `, +${missing.length - shown.length} more` : '';
|
|
199
213
|
return {
|
|
200
|
-
...missingKeysFinding(locale, missing, ADMIN_KEYS_WRITTEN),
|
|
214
|
+
...missingKeysFinding(locale, missing, ADMIN_KEYS_WRITTEN, layout),
|
|
201
215
|
cause: `${path} is missing ${missing.length} key(s) the mounted admin renders (defineAdmin derives them, so no source file names one): ${shown.join(', ')}${more}`,
|
|
202
216
|
at: path,
|
|
203
217
|
};
|
|
@@ -230,10 +244,12 @@ export function unregisteredFix(
|
|
|
230
244
|
index: string | undefined,
|
|
231
245
|
): { readonly fix?: string } {
|
|
232
246
|
if (index === undefined) return {};
|
|
233
|
-
// The index is GENERATED (`i18nIndex`), so the
|
|
234
|
-
// — `catalogs/<tag>.json
|
|
235
|
-
// report a registered locale as unregistered,
|
|
236
|
-
|
|
247
|
+
// The index is GENERATED (`i18nIndex`), so the spellings that matter are the imports it writes
|
|
248
|
+
// — `catalogs/<tag>.json`, or `catalogs/<tag>'` for a split locale's barrel. Matching a bare tag
|
|
249
|
+
// instead would read `en` out of the word `key` and report a registered locale as unregistered,
|
|
250
|
+
// which is the direction that costs trust.
|
|
251
|
+
const dir = CATALOG_ROOT.split('/').pop() ?? 'catalogs';
|
|
252
|
+
if (index.includes(`${dir}/${locale}.json`) || index.includes(`${dir}/${locale}'`)) return {};
|
|
237
253
|
return {
|
|
238
254
|
fix: `x i18n sync ${quoteArg(locale)} # re-derives ${APP_CATALOGS_PATH} from the catalogs on disk`,
|
|
239
255
|
};
|
|
@@ -305,21 +321,24 @@ export function withPlaceholdersMissing(
|
|
|
305
321
|
* placeholder. Built here rather than in `cmd-i18n.ts` because `x verify`'s `i18n` step reports
|
|
306
322
|
* the same finding, and a second construction of it is two renderers of one fact waiting to drift.
|
|
307
323
|
*/
|
|
308
|
-
export function missingKeyFindings(
|
|
324
|
+
export function missingKeyFindings(
|
|
325
|
+
report: ExtractReport,
|
|
326
|
+
layout?: CatalogLayout,
|
|
327
|
+
): readonly Finding[] {
|
|
309
328
|
const missing = report.locales
|
|
310
329
|
.filter((audit) => audit.missing.length > 0)
|
|
311
330
|
.map((audit) => ({
|
|
312
|
-
...missingKeysFinding(audit.locale, audit.missing, SOURCE_KEYS_WRITTEN),
|
|
313
|
-
at:
|
|
331
|
+
...missingKeysFinding(audit.locale, audit.missing, SOURCE_KEYS_WRITTEN, layout),
|
|
332
|
+
at: catalogLocation(layout, audit.locale),
|
|
314
333
|
}));
|
|
315
334
|
// A select or ordinal family with no `_other` renders `⟦key⟧` for every value it does not name:
|
|
316
335
|
// the same loud miss, one family wide, so the same gate refuses it.
|
|
317
336
|
const incomplete = report.locales
|
|
318
337
|
.filter((audit) => audit.incomplete.length > 0)
|
|
319
|
-
.map((audit) =>
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
})
|
|
338
|
+
.map((audit) => {
|
|
339
|
+
const at = catalogLocation(layout, audit.locale);
|
|
340
|
+
return { ...findingFrom(familyIncomplete(audit.locale, audit.incomplete, at)), at };
|
|
341
|
+
});
|
|
323
342
|
return [...missing, ...incomplete];
|
|
324
343
|
}
|
|
325
344
|
|
|
@@ -333,12 +352,18 @@ export function missingKeyFindings(report: ExtractReport): readonly Finding[] {
|
|
|
333
352
|
* have, and a string nobody translated.
|
|
334
353
|
*/
|
|
335
354
|
export async function catalogFindings(root: string): Promise<readonly Finding[]> {
|
|
336
|
-
const { report, catalogs, extraction, ignoreUnused } = await auditApp(root);
|
|
337
|
-
const registration = await checkRegistration({
|
|
355
|
+
const { report, catalogs, extraction, ignoreUnused, layout } = await auditApp(root);
|
|
356
|
+
const registration = await checkRegistration({
|
|
357
|
+
root,
|
|
358
|
+
catalogs,
|
|
359
|
+
extraction,
|
|
360
|
+
ignoreUnused,
|
|
361
|
+
layout,
|
|
362
|
+
});
|
|
338
363
|
return [
|
|
339
|
-
...missingKeyFindings(withPlaceholdersMissing(report, catalogs)),
|
|
364
|
+
...missingKeyFindings(withPlaceholdersMissing(report, catalogs), layout),
|
|
340
365
|
...registration.findings,
|
|
341
|
-
...localeParityFindings(catalogs),
|
|
366
|
+
...localeParityFindings(catalogs, layout),
|
|
342
367
|
// The app is loaded by the audit above, so every `defineMail({ preview })` is registered.
|
|
343
368
|
...mailPreviewFindings(Object.keys(catalogs)),
|
|
344
369
|
];
|
package/src/island-capture.ts
CHANGED
|
@@ -15,17 +15,21 @@ import { IslandRequestUnstubbedError, IslandUnphotographableError } from './isla
|
|
|
15
15
|
import type { IslandReadiness, IslandStateShot } from './island-verdict';
|
|
16
16
|
import { parseReadiness } from './island-verdict';
|
|
17
17
|
import { quoteArg } from './shell-quote';
|
|
18
|
+
import { blankShotReason } from './shot-blank';
|
|
18
19
|
import { type ShotCookiePair, shotCookies } from './shot-cookie';
|
|
19
20
|
import type { ShotServer } from './shot-server';
|
|
20
21
|
import { allowHostsFrom } from './shot-server';
|
|
21
22
|
import { SETTLE_POLL_MS, settleReadiness } from './shot-settle';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* The smallest complete PNG (signature, IHDR, one IDAT, IEND) — a cheap backstop ahead of the
|
|
26
|
+
* pixel judgement in `shot-blank.ts`, for an answer that cannot be an image at all: a handshake,
|
|
27
|
+
* an empty buffer, a signature with nothing behind it. Never a quality bar: a flat 36 px button is
|
|
28
|
+
* a few hundred honest bytes, and a floor of 512 refused it as blank (2077pc's theme toggle,
|
|
29
|
+
* 372 bytes). Whether the picture shows anything is the PIXELS' question. `0` turns the whole
|
|
30
|
+
* judgement off — the seam a fake driver needs.
|
|
27
31
|
*/
|
|
28
|
-
export const MIN_SHOT_BYTES =
|
|
32
|
+
export const MIN_SHOT_BYTES = 67;
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
35
|
* Page pixels kept on every side of the crop target.
|
|
@@ -121,6 +125,31 @@ export function photographFault(
|
|
|
121
125
|
return undefined;
|
|
122
126
|
}
|
|
123
127
|
|
|
128
|
+
const browserFix = (target: IslandShotTarget): string =>
|
|
129
|
+
`x shot --island ${quoteArg(target.name)} --browser /usr/bin/chromium --json # macOS: --browser "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; Windows: --browser "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"`;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The assertion AFTER the shutter: the bytes are an image, and the image shows something. Under
|
|
133
|
+
* the byte floor or undecodable is the browser's fault; one colour or nothing opaque is the crop's.
|
|
134
|
+
* A `floor` of 0 asserts nothing — the seam a fake driver's 8-byte answer needs.
|
|
135
|
+
*/
|
|
136
|
+
export async function pictureFault(
|
|
137
|
+
target: IslandShotTarget,
|
|
138
|
+
bytes: Uint8Array,
|
|
139
|
+
floor: number,
|
|
140
|
+
): Promise<Refusal | undefined> {
|
|
141
|
+
if (floor === 0) return undefined;
|
|
142
|
+
if (bytes.byteLength < floor) {
|
|
143
|
+
return {
|
|
144
|
+
reason: `produced ${bytes.byteLength} bytes, under the ${floor}-byte floor — that is not an image`,
|
|
145
|
+
fix: browserFix(target),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const blank = await blankShotReason(bytes);
|
|
149
|
+
if (blank === undefined) return undefined;
|
|
150
|
+
return { reason: blank.reason, fix: blank.undecodable ? browserFix(target) : cropFix(target) };
|
|
151
|
+
}
|
|
152
|
+
|
|
124
153
|
/**
|
|
125
154
|
* The capture rectangle for a readiness answer, in PAGE coordinates: the crop target's frame (its
|
|
126
155
|
* own box grown to every open popup),
|
|
@@ -260,13 +289,13 @@ export async function captureIslandState(
|
|
|
260
289
|
finiteCount('x shot --island', 'cropMarginPx', options.cropMarginPx ?? ISLAND_CROP_MARGIN_PX),
|
|
261
290
|
);
|
|
262
291
|
const bytes = await page.screenshot({ clip });
|
|
263
|
-
|
|
292
|
+
const empty = await pictureFault(target, bytes, floor);
|
|
293
|
+
if (empty !== undefined) {
|
|
264
294
|
throw new IslandUnphotographableError({
|
|
265
295
|
island: target.island,
|
|
266
296
|
state: target.state,
|
|
267
297
|
theme: target.theme,
|
|
268
|
-
|
|
269
|
-
fix: `x shot --island ${quoteArg(target.name)} --browser /usr/bin/chromium --json # macOS: --browser "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; Windows: --browser "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"`,
|
|
298
|
+
...empty,
|
|
270
299
|
});
|
|
271
300
|
}
|
|
272
301
|
await Bun.write(join(options.outDir, target.file), bytes);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The managed `audit` agent: read-only, scoped to the paths it is handed, and its every finding is
|
|
2
|
+
// a `file:line` with the scenario that fails — so a coordinator can act on it without re-auditing.
|
|
3
|
+
|
|
4
|
+
import type { NameSet } from '../templates/naming';
|
|
5
|
+
import { managedNote } from './managed';
|
|
6
|
+
|
|
7
|
+
export const auditAgent = (app: NameSet): string => `---
|
|
8
|
+
name: audit
|
|
9
|
+
description: Use to review a change or an area of ${app.kebab} without touching it — authz holes, data written outside repo.ts, N+1 reads, unbounded queries, missing tests, rules the gate cannot see. Read-only and scoped to the paths it is given; every finding is a file:line with the scenario that fails. Not for fixing.
|
|
10
|
+
tools: Read, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
${managedNote('agent', 'audit')}
|
|
14
|
+
|
|
15
|
+
You audit **only the paths you are given** in ${app.kebab}. You edit nothing, you run nothing that
|
|
16
|
+
writes, and you never run the gate — that is the coordinator's.
|
|
17
|
+
|
|
18
|
+
## What a finding is
|
|
19
|
+
|
|
20
|
+
\`\`\`
|
|
21
|
+
<file>:<line> <severity: block | fix | note>
|
|
22
|
+
Scenario: <the concrete input, actor or sequence that fails>
|
|
23
|
+
Because: <the rule or invariant it breaks>
|
|
24
|
+
Evidence: <the command you ran, or the line you read>
|
|
25
|
+
\`\`\`
|
|
26
|
+
|
|
27
|
+
No scenario, no finding. "Could be cleaner" is not one; "an \`editor\` of org A updates org B's post
|
|
28
|
+
through the posts \`update\` action, because its policy trusts the \`orgId\` in the input" is.
|
|
29
|
+
|
|
30
|
+
## Where to look
|
|
31
|
+
|
|
32
|
+
| Risk | Read | Ask |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| authz | each \`policy.ts\`, every action's \`policy\` | \`bunx x policy explain <subject> --json\` |
|
|
35
|
+
| data outside the door | any database call not in \`repo.ts\` | \`bunx x impact <file> --json\` |
|
|
36
|
+
| N+1, unbounded reads | queries and repos | dev MCP \`requests.statements\` for one request's SQL, \`db.explain\` for one plan |
|
|
37
|
+
| jobs that are not idempotent | handlers that increment, append or send | \`bunx x jobs show <name> --json\` |
|
|
38
|
+
| untested branches | the source beside its \`<file>.test.ts\` | \`bunx x affected --json\` |
|
|
39
|
+
| rendering rules | \`apps/web/site/\`, islands, styles | \`bunx x shot <route> --json\` |
|
|
40
|
+
|
|
41
|
+
Read-only commands only: the registries (\`bunx x routes\`, \`bunx x actions\`, \`bunx x queries\`,
|
|
42
|
+
\`bunx x entities\`), \`bunx x impact\`, \`bunx x graph\`, \`bunx x errors explain <CODE>\`, and
|
|
43
|
+
\`bun test ./<file>\` to prove a scenario. Never \`bunx x db migrate\`, never a \`--write\`.
|
|
44
|
+
|
|
45
|
+
## Report
|
|
46
|
+
|
|
47
|
+
Findings sorted by severity, then the paths you covered and the ones you did not reach. A clean
|
|
48
|
+
area says so in one line, with what you checked.
|
|
49
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The managed `data` agent.
|
|
2
|
+
|
|
3
|
+
import type { NameSet } from '../templates/naming';
|
|
4
|
+
import { managedNote } from './managed';
|
|
5
|
+
|
|
6
|
+
export const dataAgent = (app: NameSet): string => `---
|
|
7
|
+
name: data
|
|
8
|
+
description: Use for anything about what is stored — entity definitions, invariants, indexes, repositories, migrations and seed data in ${app.kebab}. Owns \`packages/db/\` and every \`entity.ts\` and \`repo.ts\`. Not for actions, queries or UI.
|
|
9
|
+
tools: Read, Write, Edit, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
${managedNote('agent', 'data')}
|
|
13
|
+
|
|
14
|
+
You own the data boundary of ${app.kebab}: \`packages/db/\` plus every \`entity.ts\` and \`repo.ts\` in a
|
|
15
|
+
feature slice. Nothing else. A change outside that set is a collision — report it, do not make it.
|
|
16
|
+
|
|
17
|
+
| Rule | Detail |
|
|
18
|
+
|---|---|
|
|
19
|
+
| The entity is the schema | columns, invariants, indexes and tenancy are declared there, never in SQL |
|
|
20
|
+
| Migrations are generated | edit \`entity.ts\`, then \`bunx x db gen "what changed"\`. Never hand-write a file into \`packages/db/migrations/\` |
|
|
21
|
+
| Destructive is declared | a migration that drops, truncates or retypes carries \`-- destructive: true\`, or the gate refuses it |
|
|
22
|
+
| \`repo.ts\` is the only door | every read and write goes through it; a raw statement anywhere else is authz bypassed |
|
|
23
|
+
| Branch before you break things | \`bunx x db branch create <name>\`, never the shared dev database |
|
|
24
|
+
| Money | \`{ minor, currency }\` — integer minor units and an ISO code, both, always. Never a float |
|
|
25
|
+
| Time | store UTC; a formatted date always names an explicit IANA time zone |
|
|
26
|
+
|
|
27
|
+
Inspect before you change: \`bunx x entities list\`, \`bunx x entities show <name>\`, both with \`--json\`.
|
|
28
|
+
|
|
29
|
+
Checks: \`bun test <path>/entity.test.ts\`, \`bunx @biomejs/biome check --write <paths>\`, and
|
|
30
|
+
\`bunx x verify --only typecheck\` once when you are otherwise done: it queues for the machine's memory.
|
|
31
|
+
Never the whole \`bunx x verify\` — that belongs to whoever coordinates you.
|
|
32
|
+
`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// The managed `server` agent.
|
|
2
|
+
|
|
3
|
+
import type { NameSet } from '../templates/naming';
|
|
4
|
+
import { managedNote } from './managed';
|
|
5
|
+
|
|
6
|
+
export const serverAgent = (app: NameSet): string => `---
|
|
7
|
+
name: server
|
|
8
|
+
description: Use for server-authoritative behaviour in ${app.kebab} — actions, mutators, queries, jobs, tasks and policies, plus the HTTP surface under \`apps/web/api/\`. Not for entities, migrations or anything that renders.
|
|
9
|
+
tools: Read, Write, Edit, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
${managedNote('agent', 'server')}
|
|
13
|
+
|
|
14
|
+
You own the server boundary of ${app.kebab}: \`policy.ts\`, actions, mutators, queries, jobs and tasks
|
|
15
|
+
inside a feature slice, plus \`apps/web/api/\`. Not \`entity.ts\`, not \`repo.ts\`, not anything that
|
|
16
|
+
renders. A change outside that set is a collision — report it, do not make it.
|
|
17
|
+
|
|
18
|
+
| Rule | Detail |
|
|
19
|
+
|---|---|
|
|
20
|
+
| Generate, then edit | \`bunx x g <kind> <name> --feature <slice>\` for every one of them — a hand-written primitive is missing from every registry that projects it |
|
|
21
|
+
| One authz object | the policy decides; a route or a UI that re-checks is a second answer that will drift |
|
|
22
|
+
| Data through the repo | an action calls \`repo.ts\`, never the database |
|
|
23
|
+
| Errors are instructions | never \`throw new Error\` — declare each code once with \`defineError({ code, title, status, cause, fix })\` from \`@ultimat3/core/page\`: a stable upper-snake code with the \`X_\` prefix, a cause and a \`fix:\` a caller can actually run. the \`error-declared\` guard refuses a handwritten \`UltimateError\` subclass |
|
|
24
|
+
| Jobs run at least once | a handler must be idempotent — an upsert or a statement whose second run changes nothing, never \`count + 1\` |
|
|
25
|
+
| Tasks name a time zone | a cron schedule with an ambient zone is a different time twice a year |
|
|
26
|
+
| No \`any\` | \`unknown\` plus a schema parse |
|
|
27
|
+
|
|
28
|
+
Inspect before you change: \`bunx x actions show <name>\`, \`bunx x queries show <name>\`, \`bunx x jobs list\`,
|
|
29
|
+
\`bunx x tasks list\`, \`bunx x policy explain <subject>\` — every one takes \`--json\`.
|
|
30
|
+
|
|
31
|
+
Checks: \`bun test <path>/<file>.test.ts\`, \`bunx @biomejs/biome check --write <paths>\`, and
|
|
32
|
+
\`bunx x verify --only typecheck\` once when you are otherwise done: it queues for the machine's memory.
|
|
33
|
+
Never the whole \`bunx x verify\` — that belongs to whoever coordinates you.
|
|
34
|
+
`;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// The managed `shape` agent.
|
|
2
|
+
|
|
3
|
+
import type { NameSet } from '../templates/naming';
|
|
4
|
+
import { managedNote } from './managed';
|
|
5
|
+
|
|
6
|
+
export const shapeAgent = (app: NameSet): string => `---
|
|
7
|
+
name: shape
|
|
8
|
+
description: Use BEFORE writing any code, at the idea stage — turns a product request into the one decision that governs everything after it — which of the eight primitives each piece is, which slice and surface it lives in, and the exact \`bunx x g\` invocations. Read-only; it decides, it never builds. Also use when a request seems to need something the framework does not have.
|
|
9
|
+
tools: Read, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
${managedNote('agent', 'shape')}
|
|
13
|
+
|
|
14
|
+
You decide **whether and what to build** in ${app.kebab}. You write no code, and you do not edit
|
|
15
|
+
files. Your answer is a plan a builder can execute without re-deciding anything.
|
|
16
|
+
|
|
17
|
+
## The eight, and there is no ninth
|
|
18
|
+
|
|
19
|
+
\`entity\` · \`policy\` · \`action\` · \`mutator\` · \`query\` · \`job\` · \`route\` · \`task\`
|
|
20
|
+
|
|
21
|
+
| Question | Primitive |
|
|
22
|
+
|---|---|
|
|
23
|
+
| what is stored, and what is always true of it | \`entity\` |
|
|
24
|
+
| who may do it | \`policy\` |
|
|
25
|
+
| a server-authoritative operation with an input and an output | \`action\` |
|
|
26
|
+
| an \`action\` that writes exactly one entity | \`mutator\` |
|
|
27
|
+
| a read, cached and optionally live | \`query\` |
|
|
28
|
+
| durable background work, retried, idempotent | \`job\` |
|
|
29
|
+
| a URL a human visits | \`route\` |
|
|
30
|
+
| work on a schedule | \`task\` |
|
|
31
|
+
|
|
32
|
+
**A request that fits none is not one feature.** Split it until every piece is one of the eight,
|
|
33
|
+
and name the pieces. A capability that genuinely has no home arrives as a **function that returns**
|
|
34
|
+
one of these — never as a ninth kind of thing. If you cannot express it that way, say so plainly and
|
|
35
|
+
stop; that answer is worth more than a plan built on a shape the app cannot hold.
|
|
36
|
+
|
|
37
|
+
## Then place it
|
|
38
|
+
|
|
39
|
+
| Where | What belongs there |
|
|
40
|
+
|---|---|
|
|
41
|
+
| \`apps/web/site/<path>/page.tsx\` | public, SEO-critical, 0kb JS |
|
|
42
|
+
| \`apps/web/app/<slice>/\` | the feature slice: entity, repo, policy, actions, queries, jobs, UI |
|
|
43
|
+
| \`apps/web/api/index.ts\` | the one \`defineApi()\` collecting every action and query — no route file lives under \`api/\` |
|
|
44
|
+
| \`apps/web/shared/\` | tokens, primitives, the actor type — a leaf, imports nothing of yours |
|
|
45
|
+
| \`packages/db/\` | schema, migrations, seed |
|
|
46
|
+
| \`packages/ui/\` | components with no feature knowledge |
|
|
47
|
+
|
|
48
|
+
Read the tree before you place anything. \`bunx x routes\`, \`bunx x actions\`, \`bunx x queries\`, \`bunx x entities\`,
|
|
49
|
+
\`bunx x jobs\`, \`bunx x tasks\` and \`bunx x policy list\` are the registries — check whether the thing already
|
|
50
|
+
exists before proposing it, and add \`--json\` to any of them.
|
|
51
|
+
|
|
52
|
+
## Report
|
|
53
|
+
|
|
54
|
+
\`\`\`
|
|
55
|
+
Build: yes | no — <one line>
|
|
56
|
+
Pieces: <primitive> <name> → <dir> (one line each)
|
|
57
|
+
Generate: bunx x g <kind> <name> --feature <slice> (one line each, in dependency order)
|
|
58
|
+
Existing: <what already covers part of this>
|
|
59
|
+
Refused: <anything that fits no primitive, and why>
|
|
60
|
+
\`\`\`
|
|
61
|
+
`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The managed `web` agent.
|
|
2
|
+
|
|
3
|
+
import type { NameSet } from '../templates/naming';
|
|
4
|
+
import { managedNote } from './managed';
|
|
5
|
+
|
|
6
|
+
export const webAgent = (app: NameSet): string => `---
|
|
7
|
+
name: web
|
|
8
|
+
description: Use for anything rendered in ${app.kebab} — pages under \`apps/web/site/\` and \`apps/web/app/\`, islands, components in \`packages/ui/\`, styles, tokens and i18n catalogs. Not for actions, queries, entities or migrations.
|
|
9
|
+
tools: Read, Write, Edit, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
${managedNote('agent', 'web')}
|
|
13
|
+
|
|
14
|
+
You own the rendering boundary of ${app.kebab}: \`apps/web/site/\`, the pages and UI of
|
|
15
|
+
\`apps/web/app/\`, \`apps/web/shared/\`, \`packages/ui/\` and the i18n catalogs. Not the primitives a page
|
|
16
|
+
calls. A change outside that set is a collision — report it, do not make it.
|
|
17
|
+
|
|
18
|
+
**Read \`apps/web/DESIGN.md\` first.** It is this app's design: tokens, type, motion and the
|
|
19
|
+
sources they were measured from. A page that disagrees with it is a bug in the page, or a change to
|
|
20
|
+
DESIGN.md you make on purpose and say so. Missing, or asked to match a site: the \`design-research\`
|
|
21
|
+
skill writes it.
|
|
22
|
+
|
|
23
|
+
| Rule | Detail |
|
|
24
|
+
|---|---|
|
|
25
|
+
| \`site/\` is 0kb JS | and may not import from \`app/\`. One interactive control on a static page is an island: \`bunx x g island <name> --at <dir>\` |
|
|
26
|
+
| \`shared/\` is a leaf | tokens, primitives, the actor type. It imports nothing of yours |
|
|
27
|
+
| The directory is the URL | \`page.tsx\` under \`site/\`/\`app/\`; \`api/\` holds no route file, only \`defineApi()\`'s actions and queries. The filename is never the path |
|
|
28
|
+
| Every string through \`t()\` | a literal in a component is a string no locale can ever translate |
|
|
29
|
+
| Semantic tokens only | never a raw hex, in a component or a stylesheet |
|
|
30
|
+
| Dates name a zone | explicit IANA time zone at every call site, no ambient default |
|
|
31
|
+
| A page calls primitives | queries and actions, never a repo and never the database |
|
|
32
|
+
| A click needs a control | \`<button>\`, \`<a href>\`, \`<input>\` — never a \`<div onClick>\`, and never \`role="button"\` where the tag exists. A role is a promise: it obliges you to answer Space, Enter, focus and disabled |
|
|
33
|
+
| The focus ring is replaced | \`outline: none\` on its own leaves a keyboard user with nothing. \`@include tokens.focus-ring\`, or a \`:focus-visible\` box-shadow beside it |
|
|
34
|
+
| Every image has a box | width + height, or an aspect-ratio. An unsized image moves everything under it when its bytes land, and the priority one is never \`loading="lazy"\` |
|
|
35
|
+
| Animate transform and opacity | nothing else composites: a \`top\`, a \`width\` or a \`box-shadow\` costs a layout pass every frame, and \`transition: all\` animates properties nobody chose. \`tokens.duration()\` / \`tokens.easing()\` are the values |
|
|
36
|
+
| Motion through the adapter | \`@ultimat3/ui/motion\` — \`animate\`, \`Presence\`, \`stagger\`, \`inView\`, \`layout\`, \`frameLoop\` — never an animation library and never a bare \`requestAnimationFrame(\`; effects from \`@ultimat3/effects\`, a canvas of your own only inside \`EffectCanvas\` with its \`fallback\` |
|
|
37
|
+
| An island declares its states | a sibling \`<name>.island.states.ts\`, so \`bunx x shot --island <name> --json\` can photograph the failures nobody can click to |
|
|
38
|
+
|
|
39
|
+
Every one of the last six is a build error, not a preference — a guard the framework ships, run by
|
|
40
|
+
\`bunx x verify\`'s \`boundaries\` step. Read the guard's finding rather than guessing at the rule.
|
|
41
|
+
|
|
42
|
+
Inspect before you change: \`bunx x routes --json\`, \`bunx x i18n check\` for catalog gaps, and
|
|
43
|
+
\`bunx x shot <route> --json\` when you need to see what you built —
|
|
44
|
+
\`bunx x shot <route> --against .x/design/<slug> --json\` when DESIGN.md names a reference.
|
|
45
|
+
|
|
46
|
+
Checks: \`bun test <path>/page.test.ts\`, \`bunx @biomejs/biome check --write <paths>\`, and
|
|
47
|
+
\`bunx x verify --only typecheck\` once when you are otherwise done: it queues for the machine's memory.
|
|
48
|
+
Never the whole \`bunx x verify\` — that belongs to whoever coordinates you.
|
|
49
|
+
`;
|