@12ui/design 0.2.29 → 0.2.30
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 +31 -6
- package/SKILL.md +1 -1
- package/dist/branch-execution-types.d.ts +2 -0
- package/dist/branch-execution-types.d.ts.map +1 -1
- package/dist/branch-execution.d.ts.map +1 -1
- package/dist/branch-execution.js +3 -0
- package/dist/branch-execution.js.map +1 -1
- package/dist/branch-run-record.d.ts +1 -0
- package/dist/branch-run-record.d.ts.map +1 -1
- package/dist/branch-run-record.js.map +1 -1
- package/dist/cli-arguments.d.ts.map +1 -1
- package/dist/cli-arguments.js +1 -0
- package/dist/cli-arguments.js.map +1 -1
- package/dist/cli-branch-command.d.ts +4 -0
- package/dist/cli-branch-command.d.ts.map +1 -1
- package/dist/cli-branch-command.js +30 -3
- package/dist/cli-branch-command.js.map +1 -1
- package/dist/cli-capabilities.d.ts +9 -0
- package/dist/cli-capabilities.d.ts.map +1 -1
- package/dist/cli-capabilities.js +9 -0
- package/dist/cli-capabilities.js.map +1 -1
- package/dist/cli-help/design.d.ts +8 -1
- package/dist/cli-help/design.d.ts.map +1 -1
- package/dist/cli-help/design.js +12 -0
- package/dist/cli-help/design.js.map +1 -1
- package/dist/cli-help/index.d.ts +8 -1
- package/dist/cli-help/index.d.ts.map +1 -1
- package/dist/cli-prototype-command.d.ts +12 -0
- package/dist/cli-prototype-command.d.ts.map +1 -0
- package/dist/cli-prototype-command.js +29 -0
- package/dist/cli-prototype-command.js.map +1 -0
- package/dist/cli-review-command.d.ts.map +1 -1
- package/dist/cli-review-command.js +20 -1
- package/dist/cli-review-command.js.map +1 -1
- package/dist/cli-run.d.ts.map +1 -1
- package/dist/cli-run.js +8 -0
- package/dist/cli-run.js.map +1 -1
- package/dist/cli-usage.d.ts.map +1 -1
- package/dist/cli-usage.js +6 -1
- package/dist/cli-usage.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy-skill-catalog.d.ts.map +1 -1
- package/dist/legacy-skill-catalog.js +8 -0
- package/dist/legacy-skill-catalog.js.map +1 -1
- package/dist/prototype-gap-html.d.ts +10 -0
- package/dist/prototype-gap-html.d.ts.map +1 -0
- package/dist/prototype-gap-html.js +55 -0
- package/dist/prototype-gap-html.js.map +1 -0
- package/dist/prototype-gap-source.d.ts +14 -0
- package/dist/prototype-gap-source.d.ts.map +1 -0
- package/dist/prototype-gap-source.js +87 -0
- package/dist/prototype-gap-source.js.map +1 -0
- package/dist/prototype-gates.d.ts +24 -0
- package/dist/prototype-gates.d.ts.map +1 -0
- package/dist/prototype-gates.js +76 -0
- package/dist/prototype-gates.js.map +1 -0
- package/dist/prototype-label-client.d.ts +51 -0
- package/dist/prototype-label-client.d.ts.map +1 -0
- package/dist/prototype-label-client.js +53 -0
- package/dist/prototype-label-client.js.map +1 -0
- package/dist/prototype-label-score.d.ts +26 -0
- package/dist/prototype-label-score.d.ts.map +1 -0
- package/dist/prototype-label-score.js +51 -0
- package/dist/prototype-label-score.js.map +1 -0
- package/dist/prototype-process.d.ts +13 -0
- package/dist/prototype-process.d.ts.map +1 -0
- package/dist/prototype-process.js +26 -0
- package/dist/prototype-process.js.map +1 -0
- package/dist/prototype-requests.d.ts +29 -0
- package/dist/prototype-requests.d.ts.map +1 -0
- package/dist/prototype-requests.js +34 -0
- package/dist/prototype-requests.js.map +1 -0
- package/dist/prototype-runner.d.ts +22 -0
- package/dist/prototype-runner.d.ts.map +1 -0
- package/dist/prototype-runner.js +159 -0
- package/dist/prototype-runner.js.map +1 -0
- package/dist/prototype-source.d.ts +9 -0
- package/dist/prototype-source.d.ts.map +1 -0
- package/dist/prototype-source.js +48 -0
- package/dist/prototype-source.js.map +1 -0
- package/dist/review-discovery.d.ts +1 -0
- package/dist/review-discovery.d.ts.map +1 -1
- package/dist/review-discovery.js +49 -3
- package/dist/review-discovery.js.map +1 -1
- package/dist/review-page-assets.d.ts +2 -2
- package/dist/review-page-assets.d.ts.map +1 -1
- package/dist/review-page-assets.js +20 -1
- package/dist/review-page-assets.js.map +1 -1
- package/dist/review-page.d.ts.map +1 -1
- package/dist/review-page.js +38 -0
- package/dist/review-page.js.map +1 -1
- package/dist/review-prototype-gap.d.ts +48 -0
- package/dist/review-prototype-gap.d.ts.map +1 -0
- package/dist/review-prototype-gap.js +192 -0
- package/dist/review-prototype-gap.js.map +1 -0
- package/dist/review-server.d.ts +7 -0
- package/dist/review-server.d.ts.map +1 -1
- package/dist/review-server.js +64 -0
- package/dist/review-server.js.map +1 -1
- package/dist/review-types.d.ts +12 -0
- package/dist/review-types.d.ts.map +1 -1
- package/dist/run-journal-commands.d.ts.map +1 -1
- package/dist/run-journal-commands.js +13 -0
- package/dist/run-journal-commands.js.map +1 -1
- package/open-design.json +2 -2
- package/package.json +7 -1
- package/prototype-kit/analyze.mjs +275 -0
- package/prototype-kit/build.mjs +393 -0
- package/prototype-kit/inventory.mjs +104 -0
- package/prototype-kit/label-briefs.mjs +47 -0
- package/prototype-kit/lib/actions.mjs +15 -0
- package/prototype-kit/lib/navigation.mjs +33 -0
- package/prototype-kit/lib/runtime-check.mjs +126 -0
- package/prototype-kit/lib/shells.mjs +68 -0
- package/prototype-kit/lib/static-server.mjs +40 -0
- package/prototype-kit/lib/text.mjs +20 -0
- package/prototype-kit/runtime/proto.css +46 -0
- package/prototype-kit/runtime/proto.js +173 -0
- package/prototype-kit/score-labels.mjs +42 -0
- package/prototype-kit/tests/README.md +28 -0
- package/prototype-kit/tests/adversarial-runtime.mjs +90 -0
- package/prototype-kit/tests/discover-runs.mjs +29 -0
- package/prototype-kit/tests/fixtures/no-semantic/branch.plan.json +7 -0
- package/prototype-kit/tests/fixtures/no-semantic/pages/legacy.html +1 -0
- package/prototype-kit/tests/fixtures/partial-plan/branch.plan.json +5 -0
- package/prototype-kit/tests/fixtures/partial-plan/pages/orphan.html +4 -0
- package/prototype-kit/tests/fixtures/runtime/double.html +5 -0
- package/prototype-kit/tests/fixtures/runtime/history-destination.html +1 -0
- package/prototype-kit/tests/fixtures/runtime/history.html +6 -0
- package/prototype-kit/tests/fixtures/runtime/hover-stack.html +15 -0
- package/prototype-kit/tests/fixtures/runtime/invalid-dropdown.html +6 -0
- package/prototype-kit/tests/fixtures/runtime/nested.html +7 -0
- package/prototype-kit/tests/fixtures/three-shell/branch.plan.json +30 -0
- package/prototype-kit/tests/fixtures/three-shell/pages/p0-home.html +11 -0
- package/prototype-kit/tests/fixtures/three-shell/pages/p1-reports.html +11 -0
- package/prototype-kit/tests/lib/run-discovery.mjs +87 -0
- package/prototype-kit/tests/lib/run-process.mjs +49 -0
- package/prototype-kit/tests/offline-check.mjs +41 -0
- package/prototype-kit/tests/population-sweep.mjs +94 -0
- package/prototype-kit/tests/rules-check.mjs +50 -0
- package/prototype-kit/verify-runtime.mjs +36 -0
- package/skills/12ui-design/SKILL.md +8 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const appendPrototypeGapSource: (args: {
|
|
2
|
+
sourceDir: string;
|
|
3
|
+
slot: string;
|
|
4
|
+
title: string;
|
|
5
|
+
purpose: string;
|
|
6
|
+
html: string;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
pageId: string;
|
|
11
|
+
pagePath: string;
|
|
12
|
+
rewrittenIds: number;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=prototype-gap-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-gap-source.d.ts","sourceRoot":"","sources":["../src/prototype-gap-source.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,wBAAwB,GAAU,MAAM;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,KAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAsDrE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { branchPageId } from './branch-plan.js';
|
|
5
|
+
import { BRANCH_PLAN_FILENAME, BRANCH_PAGES_DIRECTORY } from './branch-run-record.js';
|
|
6
|
+
import { adaptPrototypeGapHtml } from './prototype-gap-html.js';
|
|
7
|
+
const writeReplacement = async (file, bytes) => {
|
|
8
|
+
const temporary = path.join(path.dirname(file), `.${path.basename(file)}.${randomUUID()}.tmp`);
|
|
9
|
+
try {
|
|
10
|
+
await writeFile(temporary, bytes, { flag: 'wx', mode: 0o600 });
|
|
11
|
+
await rename(temporary, file);
|
|
12
|
+
}
|
|
13
|
+
finally {
|
|
14
|
+
await rm(temporary, { force: true });
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const writeStablePage = async (file, html) => {
|
|
18
|
+
const existing = await readFile(file, 'utf8').catch(() => null);
|
|
19
|
+
if (existing !== null) {
|
|
20
|
+
if (existing !== html)
|
|
21
|
+
throw new Error(`Refusing to replace changed prototype gap page ${file}`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const temporary = path.join(path.dirname(file), `.${path.basename(file)}.${randomUUID()}.tmp`);
|
|
25
|
+
try {
|
|
26
|
+
await writeFile(temporary, html, { flag: 'wx', mode: 0o600 });
|
|
27
|
+
await rename(temporary, file);
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
await rm(temporary, { force: true });
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const appendPrototypeGapSource = async (args) => {
|
|
34
|
+
const planPath = path.join(args.sourceDir, BRANCH_PLAN_FILENAME);
|
|
35
|
+
const plan = JSON.parse(await readFile(planPath, 'utf8'));
|
|
36
|
+
if (!Array.isArray(plan.pages) || !Array.isArray(plan.screens)) {
|
|
37
|
+
throw new Error('Prototype source plan has no pages or screens');
|
|
38
|
+
}
|
|
39
|
+
const existingScreen = plan.screens.find((screen) => screen.slot === args.slot);
|
|
40
|
+
if (existingScreen) {
|
|
41
|
+
const existingPage = plan.pages.find((page) => page.index === existingScreen.pageIndex);
|
|
42
|
+
if (!existingPage)
|
|
43
|
+
throw new Error(`Prototype gap slot ${args.slot} has no page`);
|
|
44
|
+
return {
|
|
45
|
+
pageId: existingPage.id,
|
|
46
|
+
pagePath: path.join(args.sourceDir, BRANCH_PAGES_DIRECTORY, `${existingPage.id}.html`),
|
|
47
|
+
rewrittenIds: 0,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const index = Math.max(-1, ...plan.pages.map((page) => page.index)) + 1;
|
|
51
|
+
const pageId = branchPageId(index, args.title);
|
|
52
|
+
if (plan.pages.some((page) => page.id === pageId)) {
|
|
53
|
+
throw new Error(`Prototype gap page id already exists: ${pageId}`);
|
|
54
|
+
}
|
|
55
|
+
const adapted = adaptPrototypeGapHtml(args);
|
|
56
|
+
const pagePath = path.join(args.sourceDir, BRANCH_PAGES_DIRECTORY, `${pageId}.html`);
|
|
57
|
+
await mkdir(path.dirname(pagePath), { recursive: true });
|
|
58
|
+
await writeStablePage(pagePath, adapted.html);
|
|
59
|
+
plan.pages.push({
|
|
60
|
+
index,
|
|
61
|
+
id: pageId,
|
|
62
|
+
kind: 'additional',
|
|
63
|
+
title: args.title,
|
|
64
|
+
pageType: 'application',
|
|
65
|
+
surfaceType: 'web_app',
|
|
66
|
+
purpose: args.purpose,
|
|
67
|
+
startsFromWinner: false,
|
|
68
|
+
slots: [args.slot],
|
|
69
|
+
});
|
|
70
|
+
plan.screens.push({
|
|
71
|
+
slot: args.slot,
|
|
72
|
+
pageIndex: index,
|
|
73
|
+
viewportOrdinal: 1,
|
|
74
|
+
status: 'succeeded',
|
|
75
|
+
direction: args.title,
|
|
76
|
+
header: null,
|
|
77
|
+
footer: null,
|
|
78
|
+
pageEndsHere: true,
|
|
79
|
+
dependsOnSlot: null,
|
|
80
|
+
width: args.width,
|
|
81
|
+
height: args.height,
|
|
82
|
+
content: args.purpose,
|
|
83
|
+
});
|
|
84
|
+
await writeReplacement(planPath, `${JSON.stringify(plan, null, 2)}\n`);
|
|
85
|
+
return { pageId, pagePath, rewrittenIds: adapted.rewrittenIds };
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=prototype-gap-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-gap-source.js","sourceRoot":"","sources":["../src/prototype-gap-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAY,EAAE,KAAa,EAAiB,EAAE;IAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/F,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,IA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,OAAO;KACtB,CAAC,CAAC;IACH,MAAM,gBAAgB,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACvE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;AAClE,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type PrototypeGateStatus = 'passed' | 'accepted-partial' | 'failed';
|
|
2
|
+
export type PrototypeGateFacts = {
|
|
3
|
+
realPages: number;
|
|
4
|
+
holdingPages: number;
|
|
5
|
+
holdingRatio: number;
|
|
6
|
+
zeroActionRealPages: string[];
|
|
7
|
+
invalidDropdowns: number;
|
|
8
|
+
shellResiduals: number;
|
|
9
|
+
maxShellDeltaPx: number;
|
|
10
|
+
skippedShellTransplants: number;
|
|
11
|
+
untestedScriptDirections: Array<{
|
|
12
|
+
stateId: string;
|
|
13
|
+
scriptDirection: string;
|
|
14
|
+
writingMode: string;
|
|
15
|
+
}>;
|
|
16
|
+
visualReviewRequired: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type PrototypeGateEvaluation = {
|
|
19
|
+
blockers: string[];
|
|
20
|
+
warnings: string[];
|
|
21
|
+
facts: PrototypeGateFacts;
|
|
22
|
+
};
|
|
23
|
+
export declare const evaluatePrototypeGates: (manifest: Record<string, unknown>) => PrototypeGateEvaluation;
|
|
24
|
+
//# sourceMappingURL=prototype-gates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-gates.d.ts","sourceRoot":"","sources":["../src/prototype-gates.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,kBAAkB,GAAG,QAAQ,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,wBAAwB,EAAE,KAAK,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AA4CF,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,uBAmE1E,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const rows = (value) => Array.isArray(value) ? value : [];
|
|
2
|
+
const count = (value) => (typeof value === 'number' && Number.isFinite(value) ? value : 0);
|
|
3
|
+
const percentage = (ratio) => `${(ratio * 100).toFixed(1)}%`;
|
|
4
|
+
const shellDeltaMaximum = (value) => {
|
|
5
|
+
let maximum = 0;
|
|
6
|
+
for (const row of rows(value)) {
|
|
7
|
+
const candidate = row;
|
|
8
|
+
if (!Array.isArray(candidate.own) || !Array.isArray(candidate.canonical))
|
|
9
|
+
continue;
|
|
10
|
+
const own = candidate.own;
|
|
11
|
+
const canonicalDimensions = candidate.canonical;
|
|
12
|
+
own.forEach((dimension, index) => {
|
|
13
|
+
const canonical = canonicalDimensions[index];
|
|
14
|
+
if (typeof dimension === 'number' && typeof canonical === 'number') {
|
|
15
|
+
maximum = Math.max(maximum, Math.abs(dimension - canonical));
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return maximum;
|
|
20
|
+
};
|
|
21
|
+
export const evaluatePrototypeGates = (manifest) => {
|
|
22
|
+
const units = rows(manifest.units);
|
|
23
|
+
const holdings = rows(manifest.holdings);
|
|
24
|
+
const invalidDropdowns = rows(manifest.invalidDropdowns);
|
|
25
|
+
const shellResiduals = rows(manifest.shellSizeDelta);
|
|
26
|
+
const skippedShellTransplants = rows(manifest.skippedShellTransplants);
|
|
27
|
+
const holdingRatio = holdings.length / Math.max(1, units.length + holdings.length);
|
|
28
|
+
const zeroActionRealPages = units.flatMap((unit, index) => (count(unit.actions) + count(unit.fields) === 0
|
|
29
|
+
? [typeof unit.id === 'string' && unit.id ? unit.id : `page-${index + 1}`]
|
|
30
|
+
: []));
|
|
31
|
+
const untestedScriptDirections = rows(manifest.scriptDirections).flatMap((direction) => {
|
|
32
|
+
const scriptDirection = typeof direction.scriptDirection === 'string' ? direction.scriptDirection : 'ltr';
|
|
33
|
+
const writingMode = typeof direction.writingMode === 'string' ? direction.writingMode : 'horizontal-tb';
|
|
34
|
+
if (scriptDirection === 'ltr' && writingMode === 'horizontal-tb')
|
|
35
|
+
return [];
|
|
36
|
+
return [{
|
|
37
|
+
stateId: typeof direction.stateId === 'string' ? direction.stateId : 'unknown',
|
|
38
|
+
scriptDirection,
|
|
39
|
+
writingMode,
|
|
40
|
+
}];
|
|
41
|
+
});
|
|
42
|
+
const facts = {
|
|
43
|
+
realPages: units.length,
|
|
44
|
+
holdingPages: holdings.length,
|
|
45
|
+
holdingRatio,
|
|
46
|
+
zeroActionRealPages,
|
|
47
|
+
invalidDropdowns: invalidDropdowns.length,
|
|
48
|
+
shellResiduals: shellResiduals.length,
|
|
49
|
+
maxShellDeltaPx: shellDeltaMaximum(shellResiduals),
|
|
50
|
+
skippedShellTransplants: skippedShellTransplants.length,
|
|
51
|
+
untestedScriptDirections,
|
|
52
|
+
visualReviewRequired: shellResiduals.length > 0 || skippedShellTransplants.length > 0,
|
|
53
|
+
};
|
|
54
|
+
const blockers = [];
|
|
55
|
+
if (holdingRatio > 0.5) {
|
|
56
|
+
blockers.push(`${holdings.length} of ${holdings.length + units.length} destinations are holding pages (${percentage(holdingRatio)} > 50%).`);
|
|
57
|
+
}
|
|
58
|
+
if (zeroActionRealPages.length > 0) {
|
|
59
|
+
blockers.push(`${zeroActionRealPages.length} real page(s) have zero bound actions: ${zeroActionRealPages.join(', ')}.`);
|
|
60
|
+
}
|
|
61
|
+
if (invalidDropdowns.length > 0) {
|
|
62
|
+
blockers.push(`${invalidDropdowns.length} dropdown candidate(s) still have fewer than 3 distinct options after labeling.`);
|
|
63
|
+
}
|
|
64
|
+
const warnings = [];
|
|
65
|
+
if (holdingRatio > 0) {
|
|
66
|
+
warnings.push(`${holdings.length} of ${holdings.length + units.length} destinations are holding pages (${percentage(holdingRatio)}); review the missing product flow.`);
|
|
67
|
+
}
|
|
68
|
+
if (facts.visualReviewRequired) {
|
|
69
|
+
warnings.push(`${facts.skippedShellTransplants} shell transplant(s) were skipped and ${facts.shellResiduals} shell size residual(s) remain (maximum ${facts.maxShellDeltaPx.toFixed(1)}px); visual review is required.`);
|
|
70
|
+
}
|
|
71
|
+
if (untestedScriptDirections.length > 0) {
|
|
72
|
+
warnings.push(`${untestedScriptDirections.length} state(s) use an untested script direction or writing mode; visual and interaction review is required.`);
|
|
73
|
+
}
|
|
74
|
+
return { blockers, warnings, facts };
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=prototype-gates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-gates.js","sourceRoot":"","sources":["../src/prototype-gates.ts"],"names":[],"mappings":"AA0CA,MAAM,IAAI,GAAG,CAAC,KAAc,EAAa,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAE9E,MAAM,KAAK,GAAG,CAAC,KAAc,EAAU,EAAE,CAAC,CACxC,OAA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D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrB,QAAQ,CAAC,IAAI,CACX,GAAG,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,oCAAoC,UAAU,CAAC,YAAY,CAAC,qCAAqC,CACzJ,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC/B,QAAQ,CAAC,IAAI,CACX,GAAG,KAAK,CAAC,uBAAuB,yCAAyC,KAAK,CAAC,cAAc,2CAA2C,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAC1M,CAAC;IACJ,CAAC;IACD,IAAI,wBAAwB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxC,QAAQ,CAAC,IAAI,CACX,GAAG,wBAAwB,CAAC,MAAM,wGAAwG,CAC3I,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ConversionConfig } from './config.js';
|
|
2
|
+
export type PrototypeLabelCandidate = {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: 'button' | 'dropdown' | 'link' | 'nav' | 'row' | 'card' | 'utility' | 'other';
|
|
5
|
+
text: string;
|
|
6
|
+
inSharedChrome: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type PrototypeLabelRequest = {
|
|
9
|
+
product: string;
|
|
10
|
+
screen: {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
purpose: string;
|
|
14
|
+
content: string;
|
|
15
|
+
};
|
|
16
|
+
destinations: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
followOn: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
holdingTargets: string[];
|
|
22
|
+
candidates: PrototypeLabelCandidate[];
|
|
23
|
+
};
|
|
24
|
+
export type PrototypeLabelAction = {
|
|
25
|
+
id: string;
|
|
26
|
+
action: 'navigate' | 'dropdown' | 'modal' | 'none';
|
|
27
|
+
target: string | null;
|
|
28
|
+
options: string[] | null;
|
|
29
|
+
modal: {
|
|
30
|
+
title: string;
|
|
31
|
+
body: string;
|
|
32
|
+
confirm: string;
|
|
33
|
+
} | null;
|
|
34
|
+
};
|
|
35
|
+
export type PrototypeLabelResponse = {
|
|
36
|
+
actions: PrototypeLabelAction[];
|
|
37
|
+
model: string;
|
|
38
|
+
providerRequestId: string | null;
|
|
39
|
+
costMicros: number;
|
|
40
|
+
replayed: boolean;
|
|
41
|
+
};
|
|
42
|
+
export declare const prototypeLabelKey: (request: PrototypeLabelRequest) => string;
|
|
43
|
+
export declare class TwelveUiPrototypeLabelClient {
|
|
44
|
+
#private;
|
|
45
|
+
readonly origin: string;
|
|
46
|
+
constructor(options: ConversionConfig & {
|
|
47
|
+
fetch?: typeof fetch;
|
|
48
|
+
});
|
|
49
|
+
labelScreen(runId: string, input: PrototypeLabelRequest, signal?: AbortSignal): Promise<PrototypeLabelResponse>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=prototype-label-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-label-client.d.ts","sourceRoot":"","sources":["../src/prototype-label-client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACpF,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IACl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AM,EACb,KAAK,EAAE,qBAAqB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC;CAoCnC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { parseBranchFailure } from './branch-client.js';
|
|
3
|
+
import { declareClientVersion } from './client-version.js';
|
|
4
|
+
import { normalizeConversionOrigin } from './config.js';
|
|
5
|
+
export const prototypeLabelKey = (request) => createHash('sha256')
|
|
6
|
+
.update(JSON.stringify(request))
|
|
7
|
+
.digest('hex');
|
|
8
|
+
export class TwelveUiPrototypeLabelClient {
|
|
9
|
+
origin;
|
|
10
|
+
#apiKey;
|
|
11
|
+
#fetch;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.origin = normalizeConversionOrigin(options.origin);
|
|
14
|
+
this.#apiKey = options.apiKey.trim();
|
|
15
|
+
this.#fetch = options.fetch ?? fetch;
|
|
16
|
+
if (!this.#apiKey)
|
|
17
|
+
throw new Error('A 12ui API key is required');
|
|
18
|
+
}
|
|
19
|
+
async labelScreen(runId, input, signal) {
|
|
20
|
+
const labelKey = prototypeLabelKey(input);
|
|
21
|
+
const headers = declareClientVersion(new Headers({
|
|
22
|
+
accept: 'application/json',
|
|
23
|
+
authorization: `Bearer ${this.#apiKey}`,
|
|
24
|
+
'content-type': 'application/json',
|
|
25
|
+
'Idempotency-Key': `prototype-label:${labelKey}`,
|
|
26
|
+
}));
|
|
27
|
+
let response;
|
|
28
|
+
try {
|
|
29
|
+
response = await this.#fetch(`${this.origin}/api/v1/create/${encodeURIComponent(runId)}`
|
|
30
|
+
+ `/prototype-labels/${labelKey}`, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers,
|
|
33
|
+
body: JSON.stringify(input),
|
|
34
|
+
...(signal ? { signal } : {}),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (error instanceof Error && error.name === 'AbortError')
|
|
39
|
+
throw error;
|
|
40
|
+
throw parseBranchFailure(0, { message: 'Could not reach the prototype label service.' });
|
|
41
|
+
}
|
|
42
|
+
const payload = await response.json().catch(() => null);
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
throw parseBranchFailure(response.status, payload, response.headers.get('retry-after'));
|
|
45
|
+
}
|
|
46
|
+
if (!payload || !Array.isArray(payload.actions) || typeof payload.model !== 'string'
|
|
47
|
+
|| !Number.isSafeInteger(payload.costMicros) || typeof payload.replayed !== 'boolean') {
|
|
48
|
+
throw parseBranchFailure(0, { message: 'The prototype label service returned an unexpected response.' });
|
|
49
|
+
}
|
|
50
|
+
return payload;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=prototype-label-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-label-client.js","sourceRoot":"","sources":["../src/prototype-label-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAiCxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAA8B,EAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;KAC9F,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KAC/B,MAAM,CAAC,KAAK,CAAC,CAAC;AAEjB,MAAM,OAAO,4BAA4B;IAC9B,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,MAAM,CAAe;IAE9B,YAAY,OAAoD;QAC9D,IAAI,CAAC,MAAM,GAAG,yBAAyB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC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AAkC,CAAC;QACzF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,kBAAkB,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1F,CAAC;QACD,IACE,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;eAC7E,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,SAAS,EACrF,CAAC;YACD,MAAM,kBAAkB,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,8DAA8D,EAAE,CAAC,CAAC;QAC3G,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PrototypeLabelAction } from './prototype-label-client.js';
|
|
2
|
+
export type PrototypeLabelGoldCase = {
|
|
3
|
+
stateId: string;
|
|
4
|
+
id: string;
|
|
5
|
+
kind: string;
|
|
6
|
+
acceptable: string[];
|
|
7
|
+
action: PrototypeLabelAction | null;
|
|
8
|
+
};
|
|
9
|
+
export type PrototypeLabelScore = {
|
|
10
|
+
correct: number;
|
|
11
|
+
total: number;
|
|
12
|
+
fraction: number;
|
|
13
|
+
missing: number;
|
|
14
|
+
byKind: Record<string, {
|
|
15
|
+
correct: number;
|
|
16
|
+
total: number;
|
|
17
|
+
}>;
|
|
18
|
+
wrong: Array<{
|
|
19
|
+
stateId: string;
|
|
20
|
+
id: string;
|
|
21
|
+
got: string;
|
|
22
|
+
acceptable: string[];
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export declare const scorePrototypeLabels: (cases: readonly PrototypeLabelGoldCase[]) => PrototypeLabelScore;
|
|
26
|
+
//# sourceMappingURL=prototype-label-score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-label-score.d.ts","sourceRoot":"","sources":["../src/prototype-label-score.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAClF,CAAC;AAoBF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,SAAS,sBAAsB,EAAE,KACvC,mBA6BF,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const normalized = (value) => value
|
|
2
|
+
.toLowerCase()
|
|
3
|
+
.replace(/[^a-z0-9&]+/gu, ' ')
|
|
4
|
+
.trim();
|
|
5
|
+
const actionKey = (action) => {
|
|
6
|
+
if (!action?.action)
|
|
7
|
+
return 'missing';
|
|
8
|
+
return action.action === 'navigate' ? `navigate:${action.target ?? ''}` : action.action;
|
|
9
|
+
};
|
|
10
|
+
const acceptable = (got, expected) => expected.some((value) => {
|
|
11
|
+
if (value === got)
|
|
12
|
+
return true;
|
|
13
|
+
if (value === 'navigate:holding:*' && got.startsWith('navigate:holding:'))
|
|
14
|
+
return true;
|
|
15
|
+
return value.startsWith('navigate:holding:')
|
|
16
|
+
&& got.startsWith('navigate:holding:')
|
|
17
|
+
&& normalized(value.slice(17)) === normalized(got.slice(17));
|
|
18
|
+
});
|
|
19
|
+
export const scorePrototypeLabels = (cases) => {
|
|
20
|
+
const score = {
|
|
21
|
+
correct: 0,
|
|
22
|
+
total: cases.length,
|
|
23
|
+
fraction: 0,
|
|
24
|
+
missing: 0,
|
|
25
|
+
byKind: {},
|
|
26
|
+
wrong: [],
|
|
27
|
+
};
|
|
28
|
+
for (const entry of cases) {
|
|
29
|
+
const got = actionKey(entry.action);
|
|
30
|
+
const kind = score.byKind[entry.kind] ?? { correct: 0, total: 0 };
|
|
31
|
+
kind.total += 1;
|
|
32
|
+
score.byKind[entry.kind] = kind;
|
|
33
|
+
if (got === 'missing')
|
|
34
|
+
score.missing += 1;
|
|
35
|
+
if (acceptable(got, entry.acceptable)) {
|
|
36
|
+
score.correct += 1;
|
|
37
|
+
kind.correct += 1;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
score.wrong.push({
|
|
41
|
+
stateId: entry.stateId,
|
|
42
|
+
id: entry.id,
|
|
43
|
+
got,
|
|
44
|
+
acceptable: entry.acceptable,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
score.fraction = score.total === 0 ? 0 : score.correct / score.total;
|
|
49
|
+
return score;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=prototype-label-score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-label-score.js","sourceRoot":"","sources":["../src/prototype-label-score.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK;KAChD,WAAW,EAAE;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AAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAClE,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAChB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAChC,IAAI,GAAG,KAAK,SAAS;YAAE,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QAC1C,IAAI,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;YACtC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;YACnB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;gBACf,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,GAAG;gBACH,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;IACrE,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type PrototypeStageResult = {
|
|
2
|
+
stage: 'inventory' | 'analyze' | 'build' | 'runtime';
|
|
3
|
+
durationMs: number;
|
|
4
|
+
logFile: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const runPrototypeStage: (args: {
|
|
7
|
+
stage: PrototypeStageResult["stage"];
|
|
8
|
+
script: string;
|
|
9
|
+
argv: string[];
|
|
10
|
+
workDir: string;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
}) => Promise<PrototypeStageResult>;
|
|
13
|
+
//# sourceMappingURL=prototype-process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-process.d.ts","sourceRoot":"","sources":["../src/prototype-process.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAU,MAAM;IAC5C,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAG,OAAO,CAAC,oBAAoB,CAqB/B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export const runPrototypeStage = async (args) => {
|
|
5
|
+
const started = Date.now();
|
|
6
|
+
const logFile = path.join(args.workDir, `${args.stage}.log`);
|
|
7
|
+
const output = [];
|
|
8
|
+
const child = spawn(process.execPath, [args.script, ...args.argv], {
|
|
9
|
+
cwd: path.dirname(args.script),
|
|
10
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
11
|
+
...(args.signal ? { signal: args.signal } : {}),
|
|
12
|
+
});
|
|
13
|
+
child.stdout.on('data', (value) => output.push(value));
|
|
14
|
+
child.stderr.on('data', (value) => output.push(value));
|
|
15
|
+
const code = await new Promise((resolve, reject) => {
|
|
16
|
+
child.once('error', reject);
|
|
17
|
+
child.once('exit', resolve);
|
|
18
|
+
});
|
|
19
|
+
await writeFile(logFile, Buffer.concat(output));
|
|
20
|
+
if (code !== 0) {
|
|
21
|
+
const detail = Buffer.concat(output).toString('utf8').trim().split('\n').slice(-12).join('\n');
|
|
22
|
+
throw new Error(`Prototype ${args.stage} failed${detail ? `: ${detail}` : ''}`);
|
|
23
|
+
}
|
|
24
|
+
return { stage: args.stage, durationMs: Date.now() - started, logFile };
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=prototype-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-process.js","sourceRoot":"","sources":["../src/prototype-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAMvC,EAAiC,EAAE;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE;QACjE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;QAC9B,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD,CAAC,CAAC;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,E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|
+
content: string;
|
|
7
|
+
ordinal: number;
|
|
8
|
+
dependsOnSlot?: string | null;
|
|
9
|
+
candidates: Array<{
|
|
10
|
+
id: string;
|
|
11
|
+
kind: PrototypeLabelRequest['candidates'][number]['kind'];
|
|
12
|
+
text: string;
|
|
13
|
+
inShell: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
export type PrototypeModel = {
|
|
17
|
+
plan: {
|
|
18
|
+
sitePurpose?: string;
|
|
19
|
+
concept?: string;
|
|
20
|
+
};
|
|
21
|
+
states: ModelState[];
|
|
22
|
+
nav: Array<{
|
|
23
|
+
text: string;
|
|
24
|
+
holding?: string | null;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
export declare const prototypeLabelRequests: (model: PrototypeModel) => PrototypeLabelRequest[];
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=prototype-requests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-requests.d.ts","sourceRoot":"","sources":["../src/prototype-requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,KAAK,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,GAAG,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,OAAO,cAAc,KAAG,qBAAqB,EAgCnF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const prototypeLabelRequests = (model) => {
|
|
2
|
+
const product = model.plan.sitePurpose || model.plan.concept || 'Prototype';
|
|
3
|
+
const destinations = model.states.map((state) => ({
|
|
4
|
+
id: state.stateId,
|
|
5
|
+
title: state.title,
|
|
6
|
+
followOn: state.ordinal > 1 || Boolean(state.dependsOnSlot),
|
|
7
|
+
}));
|
|
8
|
+
const holdingTargets = model.nav
|
|
9
|
+
.filter((item) => item.holding)
|
|
10
|
+
.map((item) => `holding:${item.text}`);
|
|
11
|
+
return model.states.flatMap((state) => {
|
|
12
|
+
const candidates = state.candidates
|
|
13
|
+
.filter((candidate) => candidate.kind !== 'nav' || candidate.inShell)
|
|
14
|
+
.map((candidate) => ({
|
|
15
|
+
id: candidate.id,
|
|
16
|
+
kind: candidate.kind,
|
|
17
|
+
text: candidate.text,
|
|
18
|
+
inSharedChrome: candidate.inShell,
|
|
19
|
+
}));
|
|
20
|
+
return candidates.length === 0 ? [] : [{
|
|
21
|
+
product,
|
|
22
|
+
screen: {
|
|
23
|
+
id: state.stateId,
|
|
24
|
+
title: state.title,
|
|
25
|
+
purpose: state.purpose || 'Explore this screen',
|
|
26
|
+
content: state.content || state.title,
|
|
27
|
+
},
|
|
28
|
+
destinations,
|
|
29
|
+
holdingTargets,
|
|
30
|
+
candidates,
|
|
31
|
+
}];
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=prototype-requests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-requests.js","sourceRoot":"","sources":["../src/prototype-requests.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAqB,EAA2B,EAAE;IACvF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC;IAC5E,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAChD,EAAE,EAAE,KAAK,CAAC,OAAO;QACjB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC;KAC5D,CAAC,CAAC,CAAC;IACJ,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG;SAC7B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;SAC9B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACpC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU;aAChC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,IAAI,SAAS,CAAC,OAAO,CAAC;aACpE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YACnB,EAAE,EAAE,SAAS,CAAC,EAAE;YAChB,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,cAAc,EAAE,SAAS,CAAC,OAAO;SAClC,CAAC,CAAC,CAAC;QACN,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBACrC,OAAO;gBACP,MAAM,EAAE;oBACN,EAAE,EAAE,KAAK,CAAC,OAAO;oBACjB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,qBAAqB;oBAC/C,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,KAAK;iBACtC;gBACD,YAAY;gBACZ,cAAc;gBACd,UAAU;aACX,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TwelveUiPrototypeLabelClient } from './prototype-label-client.js';
|
|
2
|
+
import { type PrototypeStageResult } from './prototype-process.js';
|
|
3
|
+
export declare const PROTOTYPE_MANIFEST_FILENAME = "proto-manifest.json";
|
|
4
|
+
export declare const PROTOTYPE_DIRECTORY = "prototype";
|
|
5
|
+
export declare const PROTOTYPE_WORK_DIRECTORY = ".prototype-work";
|
|
6
|
+
export declare const PROTOTYPE_PIPELINE_REVISION = "prototype-v2";
|
|
7
|
+
export type PrototypeRunResult = {
|
|
8
|
+
branchDir: string;
|
|
9
|
+
outputDir: string;
|
|
10
|
+
manifestPath: string;
|
|
11
|
+
stages: PrototypeStageResult[];
|
|
12
|
+
screenCount: number;
|
|
13
|
+
labeledScreenCount: number;
|
|
14
|
+
labelCostMicros: number;
|
|
15
|
+
warnings: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare const runPrototypePipeline: (args: {
|
|
18
|
+
branchDir: string;
|
|
19
|
+
labelClient?: TwelveUiPrototypeLabelClient;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
}) => Promise<PrototypeRunResult>;
|
|
22
|
+
//# sourceMappingURL=prototype-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-runner.d.ts","sourceRoot":"","sources":["../src/prototype-runner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAGhF,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAItF,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AACjE,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAC1D,eAAO,MAAM,2BAA2B,iBAAiB,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAOF,eAAO,MAAM,oBAAoB,GAAU,MAAM;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,4BAA4B,CAAC;IAC3C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAG,OAAO,CAAC,kBAAkB,CA4J7B,CAAC"}
|