@buffcore/cli 0.8.41 → 0.8.43

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 (219) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/commands/agents-file.d.ts +5 -0
  3. package/dist/commands/agents-file.js +30 -7
  4. package/dist/commands/change.d.ts +4 -0
  5. package/dist/commands/change.js +12 -5
  6. package/dist/commands/create-block.d.ts +2 -1
  7. package/dist/commands/create-block.js +7 -5
  8. package/dist/commands/create.d.ts +3 -2
  9. package/dist/commands/create.en.js +1 -1
  10. package/dist/commands/create.es.js +1 -1
  11. package/dist/commands/create.js +8 -6
  12. package/dist/commands/design/check.d.ts +2 -0
  13. package/dist/commands/design/check.js +6 -0
  14. package/dist/commands/design/journey-roles.d.ts +6 -0
  15. package/dist/commands/design/journey-roles.js +60 -0
  16. package/dist/commands/design/references.d.ts +12 -0
  17. package/dist/commands/design/references.js +44 -0
  18. package/dist/commands/design/tells-text.js +2 -2
  19. package/dist/commands/design/tells.d.ts +3 -1
  20. package/dist/commands/design/tells.en.d.ts +2 -0
  21. package/dist/commands/design/tells.en.js +2 -0
  22. package/dist/commands/design/tells.es.js +2 -0
  23. package/dist/commands/design/tells.js +10 -7
  24. package/dist/commands/dev.js +3 -0
  25. package/dist/commands/extension/places-approval.d.ts +1 -1
  26. package/dist/commands/port-claims.d.ts +23 -0
  27. package/dist/commands/port-claims.js +95 -0
  28. package/dist/commands/prototype/browser.d.ts +9 -4
  29. package/dist/commands/prototype/browser.js +26 -18
  30. package/dist/commands/prototype/comp-record.d.ts +27 -0
  31. package/dist/commands/prototype/comp-record.js +85 -0
  32. package/dist/commands/prototype/comp-words.d.ts +12 -0
  33. package/dist/commands/prototype/comp-words.js +24 -0
  34. package/dist/commands/prototype/comp.d.ts +26 -0
  35. package/dist/commands/prototype/comp.js +71 -0
  36. package/dist/commands/prototype/export-base.d.ts +27 -0
  37. package/dist/commands/prototype/export-base.js +80 -0
  38. package/dist/commands/prototype/export.d.ts +3 -2
  39. package/dist/commands/prototype/export.js +13 -6
  40. package/dist/commands/prototype/index.js +1 -0
  41. package/dist/commands/prototype/media-ready.d.ts +8 -0
  42. package/dist/commands/prototype/media-ready.js +36 -0
  43. package/dist/commands/prototype/messages.en.d.ts +6 -0
  44. package/dist/commands/prototype/messages.en.js +6 -0
  45. package/dist/commands/prototype/messages.js +6 -0
  46. package/dist/commands/prototype/milestone-versions.d.ts +1 -1
  47. package/dist/commands/prototype/record-look-child.js +4 -1
  48. package/dist/commands/prototype/scene.d.ts +3 -1
  49. package/dist/commands/prototype/scene.js +22 -6
  50. package/dist/commands/prototype/snapshot-command.js +1 -1
  51. package/dist/commands/prototype/snapshot-inputs.js +35 -7
  52. package/dist/commands/prototype/snapshot-setup.d.ts +12 -1
  53. package/dist/commands/prototype/snapshot-setup.js +31 -6
  54. package/dist/commands/prototype/snapshot.d.ts +2 -0
  55. package/dist/commands/prototype/snapshot.js +2 -1
  56. package/dist/commands/prototype/versions.d.ts +3 -3
  57. package/dist/commands/ui/agents-route.d.ts +2 -0
  58. package/dist/commands/ui/agents-route.js +8 -5
  59. package/dist/commands/ui/approval-authority.d.ts +1 -1
  60. package/dist/commands/ui/approve.js +7 -1
  61. package/dist/commands/ui/chat/allow-folder.js +23 -77
  62. package/dist/commands/ui/chat/claude-permissions.d.ts +21 -0
  63. package/dist/commands/ui/chat/claude-permissions.js +69 -0
  64. package/dist/commands/ui/chat/codex-idle.d.ts +2 -0
  65. package/dist/commands/ui/chat/codex-overrides.js +2 -1
  66. package/dist/commands/ui/chat/codex-permissions.d.ts +12 -0
  67. package/dist/commands/ui/chat/codex-permissions.js +97 -0
  68. package/dist/commands/ui/chat/command-parts.d.ts +33 -0
  69. package/dist/commands/ui/chat/command-parts.js +219 -0
  70. package/dist/commands/ui/chat/command-wrappers.d.ts +21 -0
  71. package/dist/commands/ui/chat/command-wrappers.js +100 -0
  72. package/dist/commands/ui/chat/design-deletes.d.ts +1 -0
  73. package/dist/commands/ui/chat/design-deletes.js +39 -0
  74. package/dist/commands/ui/chat/fresh-critique.d.ts +28 -0
  75. package/dist/commands/ui/chat/fresh-critique.js +121 -0
  76. package/dist/commands/ui/chat/fresh-launch.d.ts +31 -0
  77. package/dist/commands/ui/chat/fresh-launch.js +122 -0
  78. package/dist/commands/ui/chat/fresh-prompts.d.ts +17 -0
  79. package/dist/commands/ui/chat/fresh-prompts.js +76 -0
  80. package/dist/commands/ui/chat/fresh-report.d.ts +8 -0
  81. package/dist/commands/ui/chat/fresh-report.js +36 -0
  82. package/dist/commands/ui/chat/fresh-routes.d.ts +3 -0
  83. package/dist/commands/ui/chat/fresh-routes.js +64 -0
  84. package/dist/commands/ui/chat/fresh-settings.d.ts +12 -0
  85. package/dist/commands/ui/chat/fresh-settings.js +66 -0
  86. package/dist/commands/ui/chat/fresh-store.d.ts +17 -0
  87. package/dist/commands/ui/chat/fresh-store.js +67 -0
  88. package/dist/commands/ui/chat/fresh.d.ts +31 -0
  89. package/dist/commands/ui/chat/fresh.en.d.ts +7 -0
  90. package/dist/commands/ui/chat/fresh.en.js +7 -0
  91. package/dist/commands/ui/chat/fresh.es.d.ts +7 -0
  92. package/dist/commands/ui/chat/fresh.es.js +7 -0
  93. package/dist/commands/ui/chat/fresh.js +112 -0
  94. package/dist/commands/ui/chat/launch-input.d.ts +4 -2
  95. package/dist/commands/ui/chat/launch-input.js +16 -3
  96. package/dist/commands/ui/chat/limit-mentions.d.ts +5 -0
  97. package/dist/commands/ui/chat/limit-mentions.js +94 -0
  98. package/dist/commands/ui/chat/limit-patterns.d.ts +15 -0
  99. package/dist/commands/ui/chat/limit-patterns.js +182 -0
  100. package/dist/commands/ui/chat/limits-hook.d.ts +1 -0
  101. package/dist/commands/ui/chat/limits-hook.js +30 -0
  102. package/dist/commands/ui/chat/limits.d.ts +44 -0
  103. package/dist/commands/ui/chat/limits.en.d.ts +20 -0
  104. package/dist/commands/ui/chat/limits.en.js +20 -0
  105. package/dist/commands/ui/chat/limits.es.d.ts +2 -0
  106. package/dist/commands/ui/chat/limits.es.js +19 -0
  107. package/dist/commands/ui/chat/limits.js +236 -0
  108. package/dist/commands/ui/chat/local-settings.d.ts +17 -0
  109. package/dist/commands/ui/chat/local-settings.js +73 -0
  110. package/dist/commands/ui/chat/opencode-config.d.ts +22 -0
  111. package/dist/commands/ui/chat/opencode-config.js +83 -0
  112. package/dist/commands/ui/chat/parse-claude.js +25 -5
  113. package/dist/commands/ui/chat/permission-ask.d.ts +44 -0
  114. package/dist/commands/ui/chat/permission-ask.js +145 -0
  115. package/dist/commands/ui/chat/permission-channel.d.ts +18 -0
  116. package/dist/commands/ui/chat/permission-channel.js +67 -0
  117. package/dist/commands/ui/chat/permission-route.d.ts +10 -0
  118. package/dist/commands/ui/chat/permission-route.js +47 -0
  119. package/dist/commands/ui/chat/permission-tool.d.ts +1 -0
  120. package/dist/commands/ui/chat/permission-tool.js +86 -0
  121. package/dist/commands/ui/chat/permissions.d.ts +11 -12
  122. package/dist/commands/ui/chat/permissions.js +20 -102
  123. package/dist/commands/ui/chat/planning-limits.d.ts +12 -0
  124. package/dist/commands/ui/chat/planning-limits.js +46 -0
  125. package/dist/commands/ui/chat/process.js +4 -1
  126. package/dist/commands/ui/chat/prompt.d.ts +8 -1
  127. package/dist/commands/ui/chat/prompt.en.d.ts +4 -0
  128. package/dist/commands/ui/chat/prompt.en.js +4 -0
  129. package/dist/commands/ui/chat/prompt.es.d.ts +4 -0
  130. package/dist/commands/ui/chat/prompt.es.js +4 -0
  131. package/dist/commands/ui/chat/prompt.js +18 -50
  132. package/dist/commands/ui/chat/publish-limits.d.ts +4 -0
  133. package/dist/commands/ui/chat/publish-limits.js +97 -0
  134. package/dist/commands/ui/chat/recorded-turn.js +6 -0
  135. package/dist/commands/ui/chat/routes.js +2 -0
  136. package/dist/commands/ui/chat/secret-folders.d.ts +16 -0
  137. package/dist/commands/ui/chat/secret-folders.js +35 -0
  138. package/dist/commands/ui/chat/stdin-shells.d.ts +8 -0
  139. package/dist/commands/ui/chat/stdin-shells.js +102 -0
  140. package/dist/commands/ui/chat/step-rules.d.ts +13 -0
  141. package/dist/commands/ui/chat/step-rules.js +47 -0
  142. package/dist/commands/ui/chat/store.js +11 -2
  143. package/dist/commands/ui/chat/stream.en.d.ts +6 -0
  144. package/dist/commands/ui/chat/stream.en.js +6 -0
  145. package/dist/commands/ui/chat/stream.es.d.ts +6 -0
  146. package/dist/commands/ui/chat/stream.es.js +6 -0
  147. package/dist/commands/ui/chat/stream.js +8 -2
  148. package/dist/commands/ui/chat/turn-guard.d.ts +27 -0
  149. package/dist/commands/ui/chat/turn-guard.js +86 -0
  150. package/dist/commands/ui/chat/turn-input.d.ts +3 -2
  151. package/dist/commands/ui/chat/turn-input.js +3 -1
  152. package/dist/commands/ui/chat/turn-scenes.d.ts +19 -0
  153. package/dist/commands/ui/chat/turn-scenes.js +44 -0
  154. package/dist/commands/ui/chat/turn-state.d.ts +11 -0
  155. package/dist/commands/ui/chat/turn.js +9 -3
  156. package/dist/commands/ui/comp-approval.d.ts +6 -0
  157. package/dist/commands/ui/comp-approval.js +42 -0
  158. package/dist/commands/ui/host.js +3 -0
  159. package/dist/commands/ui/index.js +18 -6
  160. package/dist/commands/ui/level-route.js +8 -3
  161. package/dist/commands/ui/loop-approve.d.ts +4 -4
  162. package/dist/commands/ui/page.d.ts +19 -1
  163. package/dist/commands/ui/page.js +9 -6
  164. package/dist/commands/ui/places-change.d.ts +1 -1
  165. package/dist/commands/ui/plan-structure.d.ts +12 -2
  166. package/dist/commands/ui/plan-structure.en.d.ts +4 -0
  167. package/dist/commands/ui/plan-structure.en.js +4 -0
  168. package/dist/commands/ui/plan-structure.es.d.ts +4 -0
  169. package/dist/commands/ui/plan-structure.es.js +4 -0
  170. package/dist/commands/ui/plan-structure.js +48 -14
  171. package/dist/commands/ui/prototype-comp-route.d.ts +7 -0
  172. package/dist/commands/ui/prototype-comp-route.js +109 -0
  173. package/dist/commands/ui/prototype-main.d.ts +3 -1
  174. package/dist/commands/ui/prototype-scenes-child.js +6 -1
  175. package/dist/commands/ui/prototype-scenes-read.d.ts +1 -0
  176. package/dist/commands/ui/prototype-scenes-route.js +7 -1
  177. package/dist/commands/ui/prototype-snapshot-session.d.ts +1 -1
  178. package/dist/commands/ui/prototype-snapshot-session.js +3 -0
  179. package/dist/commands/ui/prototype-snapshot.d.ts +1 -1
  180. package/dist/commands/ui/routes.d.ts +6 -3
  181. package/dist/commands/ui/routes.js +3 -3
  182. package/dist/commands/ui/save-commit.js +6 -2
  183. package/dist/commands/ui/save-publish.js +3 -0
  184. package/dist/commands/ui/server-options.js +2 -0
  185. package/dist/commands/ui/server.d.ts +12 -22
  186. package/dist/commands/ui/server.js +10 -48
  187. package/dist/commands/ui/snapshot-runners.d.ts +22 -0
  188. package/dist/commands/ui/snapshot-runners.js +45 -0
  189. package/dist/commands/ui/structure-surface.d.ts +6 -0
  190. package/dist/commands/ui/structure-surface.js +94 -0
  191. package/dist/commands/ui/studio-routes.d.ts +1 -0
  192. package/dist/commands/ui/studio-routes.js +5 -0
  193. package/dist/commands/ui/studio-state.d.ts +9 -4
  194. package/dist/commands/ui/studio-state.js +1 -0
  195. package/dist/commands/ui/studio-versions.d.ts +3 -3
  196. package/dist/commands/ui/studio.en.d.ts +13 -0
  197. package/dist/commands/ui/studio.en.js +13 -0
  198. package/dist/commands/ui/studio.es.d.ts +13 -0
  199. package/dist/commands/ui/studio.es.js +13 -0
  200. package/dist/commands/ui/theme-option.d.ts +8 -0
  201. package/dist/commands/ui/theme-option.js +40 -0
  202. package/dist/commands/ui/theme-values.d.ts +5 -0
  203. package/dist/commands/ui/theme-values.js +113 -0
  204. package/dist/ui/page.js +94 -94
  205. package/docs/PROCESS.md +5 -0
  206. package/docs/PROTOTYPE.md +24 -1
  207. package/docs/WORKBENCH.md +76 -22
  208. package/package.json +11 -11
  209. package/skills/ape-critique/SKILL.md +16 -6
  210. package/skills/ape-design-system/SKILL.md +4 -3
  211. package/skills/ape-plan-change/SKILL.md +7 -3
  212. package/skills/ape-prototype/SKILL.md +12 -1
  213. package/templates/example/apps/app/src/i18n/en.ts +2 -0
  214. package/templates/example/apps/app/src/i18n/es.json +2 -0
  215. package/templates/product/apps/admin/src/fonts.ts +2 -1
  216. package/templates/product/apps/app/src/fonts.ts +5 -1
  217. package/templates/product/apps/app/src/i18n/en.ts +2 -0
  218. package/templates/product/apps/app/src/i18n/es.json +2 -0
  219. package/templates/product/prototype/journeys.ts +3 -0
@@ -14,7 +14,7 @@ export declare const placesGit: (root: string, args: string[]) => string;
14
14
  export declare function localSigner(root: string): string;
15
15
  export declare const parsePlaces: (text?: string) => {
16
16
  approvals: {
17
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
17
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
18
18
  signatures: {
19
19
  by: string;
20
20
  at: string;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Port blocks other products on this computer have claimed, so `ape create` picks another one
3
+ * even while those products are stopped. Two sources: product folders beside the new one (a
4
+ * `buffcore.config.ts`, its block from `.env` or `.env.example`), and `ports.json` in the user's
5
+ * config folder, which create and `ape dev` keep. Anything unreadable counts as no claim: the
6
+ * choice is then today's, by free ports only.
7
+ */
8
+ export interface PortClaims {
9
+ claimed: (target: string) => ReadonlySet<string>;
10
+ claim: (folder: string, block: string) => Promise<void>;
11
+ }
12
+ /** The user's BuffCore config folder: `APE_CONFIG_HOME`, else the platform's own. */
13
+ export declare function configHome(env?: NodeJS.ProcessEnv): string;
14
+ /** Folder → block, as `ports.json` lists them; a missing or malformed file lists none. */
15
+ export declare function readClaims(home?: string): Record<string, number>;
16
+ /** A product folder's block, from the API port its `.env` or `.env.example` names (not a link). */
17
+ export declare function folderBlock(folder: string): string | undefined;
18
+ /** Every block claimed by a product other than the one at `target`. */
19
+ export declare function claimedBlocks(target: string, home?: string): ReadonlySet<string>;
20
+ /** Records a product's block; folders that are gone drop out. Never fails the command. */
21
+ export declare function claimBlock(folder: string, block: string, home?: string): Promise<void>;
22
+ /** This computer's claims, in the user's config folder. */
23
+ export declare const machineClaims: PortClaims;
@@ -0,0 +1,95 @@
1
+ import { existsSync, lstatSync, readdirSync, readFileSync } from 'node:fs';
2
+ import { mkdir, rename, rm, writeFile } from 'node:fs/promises';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, join, resolve } from 'node:path';
5
+ const FILE = 'ports.json';
6
+ const SIBLINGS = 500;
7
+ /** The user's BuffCore config folder: `APE_CONFIG_HOME`, else the platform's own. */
8
+ export function configHome(env = process.env) {
9
+ if (env.APE_CONFIG_HOME)
10
+ return env.APE_CONFIG_HOME;
11
+ if (process.platform === 'win32' && env.APPDATA)
12
+ return join(env.APPDATA, 'buffcore');
13
+ return join(env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'buffcore');
14
+ }
15
+ /** One spelling per folder: Windows paths compare without case. */
16
+ const folderKey = (path) => process.platform === 'win32' ? resolve(path).toLowerCase() : resolve(path);
17
+ /** Folder → block, as `ports.json` lists them; a missing or malformed file lists none. */
18
+ export function readClaims(home) {
19
+ try {
20
+ const blocks = JSON.parse(readFileSync(join(home ?? configHome(), FILE), 'utf8'))?.blocks;
21
+ if (!blocks || typeof blocks !== 'object')
22
+ return {};
23
+ return Object.fromEntries(Object.entries(blocks).filter((entry) => Number.isInteger(entry[1]) && entry[1] >= 10 && entry[1] <= 64));
24
+ }
25
+ catch {
26
+ return {};
27
+ }
28
+ }
29
+ /** A product folder's block, from the API port its `.env` or `.env.example` names (not a link). */
30
+ export function folderBlock(folder) {
31
+ for (const name of ['.env', '.env.example']) {
32
+ try {
33
+ const path = join(folder, name);
34
+ if (lstatSync(path).isSymbolicLink())
35
+ continue;
36
+ const text = readFileSync(path, 'utf8');
37
+ const port = /^APE_API_PORT=(\d{4})\s*$/m.exec(text)?.[1];
38
+ if (port)
39
+ return String(Math.floor(Number(port) / 100));
40
+ }
41
+ catch {
42
+ // No such file, or unreadable: the next source, or no claim.
43
+ }
44
+ }
45
+ return undefined;
46
+ }
47
+ /** Every block claimed by a product other than the one at `target`. */
48
+ export function claimedBlocks(target, home) {
49
+ const own = folderKey(target);
50
+ const blocks = new Set();
51
+ for (const [path, block] of Object.entries(readClaims(home)))
52
+ if (folderKey(path) !== own && existsSync(path))
53
+ blocks.add(String(block));
54
+ try {
55
+ const parent = dirname(resolve(target));
56
+ const entries = readdirSync(parent, { withFileTypes: true }).slice(0, SIBLINGS);
57
+ for (const entry of entries) {
58
+ const folder = join(parent, entry.name);
59
+ if (!entry.isDirectory() || folderKey(folder) === own)
60
+ continue;
61
+ if (!existsSync(join(folder, 'buffcore.config.ts')))
62
+ continue;
63
+ const block = folderBlock(folder);
64
+ if (block)
65
+ blocks.add(block);
66
+ }
67
+ }
68
+ catch {
69
+ // The parent folder can't be listed: the list's claims only.
70
+ }
71
+ return blocks;
72
+ }
73
+ /** Records a product's block; folders that are gone drop out. Never fails the command. */
74
+ export async function claimBlock(folder, block, home) {
75
+ let temporary;
76
+ try {
77
+ const dir = home ?? configHome();
78
+ const kept = Object.fromEntries(Object.entries(readClaims(dir)).filter(([path]) => folderKey(path) !== folderKey(folder) && existsSync(path)));
79
+ kept[resolve(folder)] = Number(block);
80
+ await mkdir(dir, { recursive: true });
81
+ temporary = join(dir, `${FILE}.${process.pid}.tmp`);
82
+ await writeFile(temporary, `${JSON.stringify({ blocks: kept }, null, 2)}\n`);
83
+ await rename(temporary, join(dir, FILE));
84
+ }
85
+ catch {
86
+ // A list that can't be written changes nothing today; a half-written copy goes.
87
+ if (temporary)
88
+ await rm(temporary, { force: true }).catch(() => undefined);
89
+ }
90
+ }
91
+ /** This computer's claims, in the user's config folder. */
92
+ export const machineClaims = {
93
+ claimed: (target) => claimedBlocks(target),
94
+ claim: (folder, block) => claimBlock(folder, block),
95
+ };
@@ -43,14 +43,19 @@ export declare function sceneFrames(page: Page, locale: string): Promise<{
43
43
  index: number;
44
44
  locale: string;
45
45
  }[]>;
46
- /** Wait for the current scene and its framed scenes to finish drawing. */
47
- export declare function waitForScene(page: Page, locale: string, { live, animationWait, }?: {
46
+ /**
47
+ * Wait for the current scene and its framed scenes to finish drawing. True when a font or picture
48
+ * was still loading as its allowance ran out: the page is shot as it is.
49
+ */
50
+ export declare function waitForScene(page: Page, locale: string, { live, animationWait, mediaWait, }?: {
48
51
  live?: () => boolean;
49
52
  animationWait?: number;
50
- }): Promise<void>;
53
+ mediaWait?: number;
54
+ }): Promise<boolean>;
51
55
  /**
52
56
  * Show a scene page and wait until it has drawn. A scene that frames a scene page (a console
53
57
  * scene with the app's `/_scene` inside, e.g. a `DeviceFrame`) waits for that page too. A page
54
58
  * whose module fails to load (a busy dev server drops requests under load) is loaded again once.
59
+ * True when a font or picture was still loading after `mediaWait` (`MEDIA_WAIT` unset).
55
60
  */
56
- export declare function openScene(page: Page, url: string, locale: string): Promise<void>;
61
+ export declare function openScene(page: Page, url: string, locale: string, mediaWait?: number): Promise<boolean>;
@@ -5,6 +5,7 @@
5
5
  import { createRequire } from 'node:module';
6
6
  import { chromium, } from 'playwright-core';
7
7
  import { accessDenied } from './access-denied.js';
8
+ import { MEDIA_WAIT, mediaReady } from './media-ready.js';
8
9
  import { SnapshotAccessRefused } from './snapshot-refused.js';
9
10
  /**
10
11
  * The one command that installs the browser, anywhere (a product has no playwright-core of its
@@ -124,20 +125,20 @@ export async function animationsDone(timeout) {
124
125
  const ANIMATION_WAIT = 2_000;
125
126
  /**
126
127
  * Wait until a scene page in this frame has drawn: the view rendered in the asked language, the
127
- * fonts loaded, two frames painted, and animations finished within their allowance. The focused element is blurred
128
- * first, so a field that autofocuses shows no focus ring.
128
+ * fonts and pictures loaded (`mediaReady`), two frames painted, and animations finished within
129
+ * their allowance. The focused element is blurred first, so a field that autofocuses shows no
130
+ * focus ring. True when fonts or pictures were still loading as their allowance ran out.
129
131
  */
130
- async function drawn(frame, locale, live, animationWait) {
132
+ async function drawn(frame, locale, live, { animationWait, mediaWait }) {
131
133
  await frame.waitForFunction((lang) => document.documentElement.lang === lang &&
132
134
  (document.getElementById('root')?.childElementCount ?? 0) > 0, locale);
133
135
  // An attempt that lost its page (a module failed, the page loaded again) does nothing more.
134
136
  if (!live())
135
- return;
136
- await frame.evaluate(async () => {
137
- document.activeElement?.blur();
138
- await document.fonts.ready;
139
- });
137
+ return false;
138
+ await frame.evaluate(() => document.activeElement?.blur());
139
+ const ready = await frame.evaluate(mediaReady, mediaWait);
140
140
  await frame.evaluate(animationsDone, animationWait);
141
+ return !ready;
141
142
  }
142
143
  /** A script or module of the page failed to load: a busy dev server dropping a request. */
143
144
  class ModuleLost extends Error {
@@ -154,17 +155,23 @@ export async function sceneFrames(page, locale) {
154
155
  }));
155
156
  return frames.filter((entry) => entry !== undefined);
156
157
  }
157
- /** Wait for the current scene and its framed scenes to finish drawing. */
158
- export async function waitForScene(page, locale, { live = () => true, animationWait = ANIMATION_WAIT, } = {}) {
159
- await drawn(page.mainFrame(), locale, live, animationWait);
158
+ /**
159
+ * Wait for the current scene and its framed scenes to finish drawing. True when a font or picture
160
+ * was still loading as its allowance ran out: the page is shot as it is.
161
+ */
162
+ export async function waitForScene(page, locale, { live = () => true, animationWait = ANIMATION_WAIT, mediaWait = MEDIA_WAIT, } = {}) {
163
+ const waits = { animationWait, mediaWait };
164
+ let late = await drawn(page.mainFrame(), locale, live, waits);
160
165
  for (const entry of await sceneFrames(page, locale))
161
- await drawn(entry.frame, entry.locale, live, animationWait);
166
+ if (await drawn(entry.frame, entry.locale, live, waits))
167
+ late = true;
168
+ return late;
162
169
  }
163
170
  /**
164
171
  * Open the page (or load it again) and wait until it has drawn. A page whose script or module
165
172
  * fails to load never draws, so that ends the wait at once, not at the timeout.
166
173
  */
167
- async function show(page, url, locale, again) {
174
+ async function show(page, url, locale, again, mediaWait) {
168
175
  let lose = (_) => { };
169
176
  const lost = new Promise((_, reject) => {
170
177
  lose = reject;
@@ -192,13 +199,13 @@ async function show(page, url, locale, again) {
192
199
  throw new ConnectionRefused(url);
193
200
  throw error;
194
201
  }
195
- await waitForScene(page, locale, { live });
202
+ return waitForScene(page, locale, { live, ...(mediaWait === undefined ? {} : { mediaWait }) });
196
203
  })();
197
204
  // Whichever loses the race must not end the run as an unhandled rejection.
198
205
  drawing.catch(() => { });
199
206
  lost.catch(() => { });
200
207
  try {
201
- await Promise.race([drawing, lost]);
208
+ return await Promise.race([drawing, lost]);
202
209
  }
203
210
  finally {
204
211
  over = true;
@@ -209,16 +216,17 @@ async function show(page, url, locale, again) {
209
216
  * Show a scene page and wait until it has drawn. A scene that frames a scene page (a console
210
217
  * scene with the app's `/_scene` inside, e.g. a `DeviceFrame`) waits for that page too. A page
211
218
  * whose module fails to load (a busy dev server drops requests under load) is loaded again once.
219
+ * True when a font or picture was still loading after `mediaWait` (`MEDIA_WAIT` unset).
212
220
  */
213
- export async function openScene(page, url, locale) {
221
+ export async function openScene(page, url, locale, mediaWait) {
214
222
  try {
215
223
  try {
216
- await show(page, url, locale, false);
224
+ return await show(page, url, locale, false, mediaWait);
217
225
  }
218
226
  catch (error) {
219
227
  if (!(error instanceof ModuleLost))
220
228
  throw error;
221
- await show(page, url, locale, true);
229
+ return await show(page, url, locale, true, mediaWait);
222
230
  }
223
231
  }
224
232
  catch (error) {
@@ -0,0 +1,27 @@
1
+ import { type Approval } from '@buffcore/contracts/approvals';
2
+ import { type CompSnapshot } from './comp.ts';
3
+ export declare const COMP_FILE = "prototype/versions/comp.json";
4
+ /** The subject of the one commit that may write the record (`stepMessage`). */
5
+ export declare const COMP_SUBJECT = "prototype: approve the look";
6
+ export interface CompRecord {
7
+ folder: string;
8
+ approval: Approval;
9
+ }
10
+ /** The record as the approval commit left it: committed at HEAD by that commit, unchanged on disk. */
11
+ export declare function readCompApproval(root: string): CompRecord | undefined;
12
+ /** Whether a person's approval holds for this comp: its folder and the pictures it showed. */
13
+ export declare function compApproved(record: CompRecord | undefined, comp: CompSnapshot | undefined): boolean;
14
+ export interface CompSigner {
15
+ by: string;
16
+ /** The commit checked out when the person approved. */
17
+ commit: string;
18
+ fingerprint: string;
19
+ role?: string;
20
+ /** Set when an agent asks: always refused, at every level. */
21
+ agent?: string;
22
+ }
23
+ /**
24
+ * A person approves the comp the page showed; an agent never does. Writes the record when `write`
25
+ * (the studio's approval save commits it on its own); returns what the file holds.
26
+ */
27
+ export declare function approveComp(root: string, signer: CompSigner, write?: boolean): CompRecord;
@@ -0,0 +1,85 @@
1
+ // The comp's approval record, `prototype/versions/comp.json`: inside the folder the file tools,
2
+ // the coding commands and the merge guard keep from agents, as version approvals are, and saved
3
+ // only as the studio's own isolated commit (`saveApprovalRecord`, subject COMP_SUBJECT). A record
4
+ // put there any other way, or edited after that commit, does not count.
5
+ import { randomUUID } from 'node:crypto';
6
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { approvalHolds, approvalSchema } from '@buffcore/contracts/approvals';
9
+ import { ApprovalRefusal, approvalRule, signApproval } from '../approval-rules.js';
10
+ import { hostGitBytes } from '../safe-git.js';
11
+ import { newestComp } from './comp.js';
12
+ import { compT } from './comp-words.js';
13
+ export const COMP_FILE = 'prototype/versions/comp.json';
14
+ /** The subject of the one commit that may write the record (`stepMessage`). */
15
+ export const COMP_SUBJECT = 'prototype: approve the look';
16
+ const lf = (text) => text.replace(/\r\n/g, '\n');
17
+ /** The record as the approval commit left it: committed at HEAD by that commit, unchanged on disk. */
18
+ export function readCompApproval(root) {
19
+ try {
20
+ const git = (args) => hostGitBytes(root, args).toString('utf8');
21
+ const committed = git(['show', `HEAD:./${COMP_FILE}`]);
22
+ const subject = git(['log', '-1', '--format=%s', 'HEAD', '--', `./${COMP_FILE}`]).trim();
23
+ if (subject !== COMP_SUBJECT)
24
+ return;
25
+ if (lf(readFileSync(join(root, COMP_FILE), 'utf8')) !== lf(committed))
26
+ return;
27
+ const record = JSON.parse(committed);
28
+ const approval = approvalSchema.parse(record?.approval);
29
+ if (typeof record.folder !== 'string' || approval.kind !== 'comp')
30
+ return;
31
+ return { folder: record.folder, approval };
32
+ }
33
+ catch {
34
+ return;
35
+ }
36
+ }
37
+ /** Whether a person's approval holds for this comp: its folder and the pictures it showed. */
38
+ export function compApproved(record, comp) {
39
+ return (!!record &&
40
+ !!comp &&
41
+ record.folder === comp.folder &&
42
+ approvalHolds(record.approval, new Date()) &&
43
+ record.approval.signatures.every((s) => s.fingerprint === comp.fingerprint));
44
+ }
45
+ /**
46
+ * A person approves the comp the page showed; an agent never does. Writes the record when `write`
47
+ * (the studio's approval save commits it on its own); returns what the file holds.
48
+ */
49
+ export function approveComp(root, signer, write = true) {
50
+ if (signer.agent !== undefined)
51
+ throw new ApprovalRefusal(compT('comp.person'));
52
+ const comp = newestComp(root);
53
+ if (!comp)
54
+ throw new ApprovalRefusal(compT('comp.missing'));
55
+ if (!comp.report.scenes.length)
56
+ throw new ApprovalRefusal(compT('comp.empty'));
57
+ if (comp.fingerprint !== signer.fingerprint)
58
+ throw new ApprovalRefusal(compT('comp.changed'));
59
+ const earlier = readCompApproval(root);
60
+ if (compApproved(earlier, comp))
61
+ throw new ApprovalRefusal(compT('comp.approved'));
62
+ // A partial rule's signatures carry on for the same comp; a new comp starts a new approval.
63
+ const previous = earlier?.folder === comp.folder &&
64
+ earlier.approval.signatures.every((s) => s.fingerprint === comp.fingerprint)
65
+ ? earlier.approval
66
+ : undefined;
67
+ const approval = signApproval(previous, 'comp', {
68
+ by: signer.by.trim(),
69
+ at: new Date().toISOString(),
70
+ commit: signer.commit,
71
+ fingerprint: comp.fingerprint,
72
+ ...(signer.role ? { role: signer.role } : {}),
73
+ }, approvalRule(root, 'comp'));
74
+ const record = { folder: comp.folder, approval };
75
+ if (write)
76
+ writeRecord(root, record);
77
+ return record;
78
+ }
79
+ function writeRecord(root, record) {
80
+ const file = join(root, COMP_FILE);
81
+ mkdirSync(join(root, 'prototype', 'versions'), { recursive: true });
82
+ const temporary = `${file}.${randomUUID()}.tmp`;
83
+ writeFileSync(temporary, `${JSON.stringify(record, null, 2)}\n`);
84
+ renameSync(temporary, file);
85
+ }
@@ -0,0 +1,12 @@
1
+ declare const en: {
2
+ 'comp.person': string;
3
+ 'comp.missing': string;
4
+ 'comp.changed': string;
5
+ 'comp.empty': string;
6
+ 'comp.approved': string;
7
+ 'comp.identity': string;
8
+ 'comp.commitFirst': string;
9
+ 'comp.mixed': string;
10
+ };
11
+ export declare const compT: (key: keyof typeof en) => string;
12
+ export {};
@@ -0,0 +1,24 @@
1
+ import { createI18n } from '@buffcore/i18n';
2
+ import { locale } from './messages.js';
3
+ const en = {
4
+ 'comp.person': 'A person approves the look, at every level. An agent cannot.',
5
+ 'comp.missing': 'There is no comp to approve yet: ask the agent to draw the three screens and snapshot them.',
6
+ 'comp.changed': 'The comp changed since this page showed it. Look at the new screens, then approve.',
7
+ 'comp.empty': 'The comp snapshot lists no screens: snapshot the comp again.',
8
+ 'comp.approved': 'This look is already approved.',
9
+ 'comp.identity': 'Set your name in Git (git config user.email) so the approval can name you.',
10
+ 'comp.commitFirst': 'Commit first, so the approval can name a commit.',
11
+ 'comp.mixed': "Snapshot the comp on its own (--scene 'comp/*'): its screens are kept apart from the scenes.",
12
+ };
13
+ const es = {
14
+ 'comp.person': 'Una persona aprueba el aspecto, en todos los niveles. Un agente no puede.',
15
+ 'comp.missing': 'Aún no hay un boceto que aprobar: pide al agente que dibuje las tres pantallas y las capture.',
16
+ 'comp.changed': 'El boceto cambió desde que esta página lo mostró. Mira las pantallas nuevas y luego aprueba.',
17
+ 'comp.empty': 'La captura del boceto no tiene pantallas: vuelve a capturar el boceto.',
18
+ 'comp.approved': 'Este aspecto ya está aprobado.',
19
+ 'comp.identity': 'Pon tu nombre en Git (git config user.email) para que la aprobación te nombre.',
20
+ 'comp.commitFirst': 'Haz un commit primero, para que la aprobación nombre uno.',
21
+ 'comp.mixed': "Captura el boceto por separado (--scene 'comp/*'): sus pantallas se guardan aparte de las escenas.",
22
+ };
23
+ const translator = createI18n({ catalogs: [{ en, es }] });
24
+ export const compT = (key) => translator.t(locale(), key);
@@ -0,0 +1,26 @@
1
+ import type { Frame } from '@buffcore/config';
2
+ import type { FirstSurface } from '@buffcore/contracts/workbench';
3
+ import { type SnapshotReport } from './report.ts';
4
+ export declare const COMP_PREFIX = "comp/";
5
+ /**
6
+ * `plan/structure.md`'s one header field, before its table; absent, desktop comes first. Any case,
7
+ * spaces around the value allowed. `SURFACE_FIELD` finds a line meant as one, right or wrong.
8
+ */
9
+ export declare const SURFACE_LINE: RegExp;
10
+ export declare const SURFACE_FIELD: RegExp;
11
+ export declare const isCompScene: (key: string) => boolean;
12
+ /** Where a snapshot folder's comp runs go: beside the commits, never inside one. */
13
+ export declare const compDir: (snapshots: string) => string;
14
+ /** The frame the comp is judged in: the product's desktop frame, or the phone's 390. */
15
+ export declare const compFrame: (surface: FirstSurface) => Frame;
16
+ /** Which surface comes first, as `plan/structure.md` says (the parser's rule); absent, desktop. */
17
+ export declare function firstSurface(root: string): FirstSurface;
18
+ export interface CompSnapshot {
19
+ /** `prototype/snapshots/comp/<commit>`, from the product's root. */
20
+ folder: string;
21
+ report: SnapshotReport;
22
+ /** What Approve the look signs: the comp report's bytes (they hold each picture's hash). */
23
+ fingerprint: string;
24
+ }
25
+ /** The newest finished comp snapshot, by its report's date. */
26
+ export declare function newestComp(root: string): CompSnapshot | undefined;
@@ -0,0 +1,71 @@
1
+ // The comp (docs/PROTOTYPE.md): the three deciding screens, scenes under `comp/`, shot at the first
2
+ // surface's width into their own folder (`prototype/snapshots/comp/<commit>/`), never into the
3
+ // scenes' report. A person approves the look; `comp-record.ts` keeps that approval.
4
+ import { readdirSync, readFileSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import { snapshotsDir } from './report.js';
7
+ import { sha256 } from './snapshot-hashes.js';
8
+ export const COMP_PREFIX = 'comp/';
9
+ /**
10
+ * `plan/structure.md`'s one header field, before its table; absent, desktop comes first. Any case,
11
+ * spaces around the value allowed. `SURFACE_FIELD` finds a line meant as one, right or wrong.
12
+ */
13
+ export const SURFACE_LINE = /^surface:[ \t]*(desktop|phone)[ \t]*$/i;
14
+ export const SURFACE_FIELD = /^surface[ \t]*:/i;
15
+ export const isCompScene = (key) => key.startsWith(COMP_PREFIX);
16
+ /** Where a snapshot folder's comp runs go: beside the commits, never inside one. */
17
+ export const compDir = (snapshots) => join(snapshots, 'comp');
18
+ /** The frame the comp is judged in: the product's desktop frame, or the phone's 390. */
19
+ export const compFrame = (surface) => surface === 'phone' ? 'phone' : 'desktop';
20
+ /** Which surface comes first, as `plan/structure.md` says (the parser's rule); absent, desktop. */
21
+ export function firstSurface(root) {
22
+ let text = '';
23
+ try {
24
+ text = readFileSync(join(root, 'plan', 'structure.md'), 'utf8');
25
+ }
26
+ catch {
27
+ return 'desktop';
28
+ }
29
+ for (const line of text.replace(/^\uFEFF/, '').split(/\r\n|\r|\n/)) {
30
+ if (line.startsWith('|'))
31
+ break;
32
+ const found = SURFACE_LINE.exec(line);
33
+ if (found)
34
+ return found[1]?.toLowerCase();
35
+ }
36
+ return 'desktop';
37
+ }
38
+ /** The newest finished comp snapshot, by its report's date. */
39
+ export function newestComp(root) {
40
+ const dir = compDir(snapshotsDir(root));
41
+ let best;
42
+ let entries = [];
43
+ try {
44
+ entries = readdirSync(dir).filter((name) => /^[0-9a-f]{7,64}$/.test(name));
45
+ }
46
+ catch {
47
+ return;
48
+ }
49
+ for (const name of entries) {
50
+ let bytes;
51
+ let report;
52
+ try {
53
+ bytes = readFileSync(join(dir, name, 'report.json'));
54
+ report = JSON.parse(String(bytes));
55
+ }
56
+ catch {
57
+ continue;
58
+ }
59
+ const at = Date.parse(report?.createdAt ?? '');
60
+ if (!Array.isArray(report?.scenes) || report.commit !== name || !Number.isFinite(at))
61
+ continue;
62
+ if (best && best.at >= at)
63
+ continue;
64
+ const folder = `prototype/snapshots/comp/${name}`;
65
+ best = { folder, report, fingerprint: `comp:${sha256(bytes)}`, at };
66
+ }
67
+ if (!best)
68
+ return;
69
+ const { at: _at, ...comp } = best;
70
+ return comp;
71
+ }
@@ -0,0 +1,27 @@
1
+ export declare const ROOT_BASE = "/";
2
+ /**
3
+ * The base, checked and ending in `/`: `./` (or `.`), or a plain absolute path. Anything else is
4
+ * refused (a scheme, `..`, quotes or shell characters), since the base reaches a build command.
5
+ */
6
+ export declare function exportBase(text: string | undefined): string;
7
+ /** The viewer's own base for Vite: under `prototype/` of the site's root. */
8
+ export declare const viewerBase: (base: string) => string;
9
+ /** A page of the export: the viewer, the admin's scene page, or the app's scene page. */
10
+ export type ExportPage = 'viewer' | 'admin' | 'app';
11
+ /**
12
+ * Set before anything loads on an export's page: the export's root path (`__APE_EXPORT__` for the
13
+ * viewer's pages), a `<base>` its files resolve from, and for the app's scene page the root to its
14
+ * asset URLs (`__APE_SITE__`) and the path its router knows (`/_scene/`, a rewrite of the address
15
+ * only: Expo's router follows a base path in production builds alone, and the export's are
16
+ * development builds). Under a plain path the root is the one built in; only `./` finds it from
17
+ * the address, with leading slashes collapsed, and only when it resolves on the page's own origin,
18
+ * so an address such as `//other.example/..%2Fs/abc/_scene/` never sends the page elsewhere.
19
+ */
20
+ export declare function pageScript(page: ExportPage, base: string): string;
21
+ /**
22
+ * The app bundle's own files (its assets' `uri:"/assets/…"` or `exports="/assets/…"`, its chunks'
23
+ * `"paths"`), from the site's path rather than the server's root: each value becomes an expression.
24
+ */
25
+ export declare const siteAssets: (code: string) => string;
26
+ /** Make an export with a base other than `/` play from wherever its root is served. */
27
+ export declare function relocate(out: string, app: boolean, base: string): Promise<void>;
@@ -0,0 +1,80 @@
1
+ // Where a prototype export is served from (`ape prototype export --base <path>`): the site's root
2
+ // path, `/` by default (the viewer under `/prototype/`, as before), any other plain path such as
3
+ // `/s/abc/`, or `./` for paths relative to the page. Any base but `/` makes the scene pages find
4
+ // their files from where they are opened, so one export plays under any path, framed or not.
5
+ import { readdir, readFile, writeFile } from 'node:fs/promises';
6
+ import { join } from 'node:path';
7
+ import { t } from './messages.js';
8
+ export const ROOT_BASE = '/';
9
+ /** A plain path's segments: letters, digits, `-`, `_`, `~` and dots, never starting with a dot. */
10
+ const PLAIN = /^\/(?:[A-Za-z0-9_~-][A-Za-z0-9._~-]*\/)*$/;
11
+ /**
12
+ * The base, checked and ending in `/`: `./` (or `.`), or a plain absolute path. Anything else is
13
+ * refused (a scheme, `..`, quotes or shell characters), since the base reaches a build command.
14
+ */
15
+ export function exportBase(text) {
16
+ if (text === undefined)
17
+ return ROOT_BASE;
18
+ if (text === '.' || text === './')
19
+ return './';
20
+ const base = text.endsWith('/') ? text : `${text}/`;
21
+ if (!text || !PLAIN.test(base))
22
+ throw new Error(t('prototype.baseInvalid', { base: text }));
23
+ return base;
24
+ }
25
+ /** The viewer's own base for Vite: under `prototype/` of the site's root. */
26
+ export const viewerBase = (base) => (base === './' ? './' : `${base}prototype/`);
27
+ /** Where each page is under the export's root, found at the end of its path (regex source). */
28
+ const PAGE_AT = {
29
+ viewer: String.raw `\/prototype\/?$`,
30
+ admin: String.raw `\/prototype\/_scene\/?$`,
31
+ app: String.raw `\/_scene\/?$`,
32
+ };
33
+ /**
34
+ * Set before anything loads on an export's page: the export's root path (`__APE_EXPORT__` for the
35
+ * viewer's pages), a `<base>` its files resolve from, and for the app's scene page the root to its
36
+ * asset URLs (`__APE_SITE__`) and the path its router knows (`/_scene/`, a rewrite of the address
37
+ * only: Expo's router follows a base path in production builds alone, and the export's are
38
+ * development builds). Under a plain path the root is the one built in; only `./` finds it from
39
+ * the address, with leading slashes collapsed, and only when it resolves on the page's own origin,
40
+ * so an address such as `//other.example/..%2Fs/abc/_scene/` never sends the page elsewhere.
41
+ */
42
+ export function pageScript(page, base) {
43
+ const built = base === './' ? 'null' : JSON.stringify(base);
44
+ const set = page === 'app'
45
+ ? 'b.href=r;g.__APE_SITE__=r.slice(0,-1);' +
46
+ 'if(m)history.replaceState(history.state,"",p.slice(m.index)+location.search+location.hash);'
47
+ : `g.__APE_EXPORT__=r;${page === 'admin' ? 'b.href=r+"prototype/";' : ''}`;
48
+ const find = String.raw `p=location.pathname.replace(/^[\/\\]+/,"/"),m=/${PAGE_AT[page]}/.exec(p);`;
49
+ return (`<script>(function(){var g=globalThis,r=${built},${find}` +
50
+ 'if(r===null){if(!m)return;r=p.slice(0,m.index+1);' +
51
+ 'try{if(new URL(r,location.origin).origin!==location.origin)return}catch(e){return}}' +
52
+ `${page === 'viewer' ? '' : 'var b=document.createElement("base");document.head.prepend(b);'}` +
53
+ `${set}})()</script>`);
54
+ }
55
+ /**
56
+ * Root-relative `src` and `href` in a page moved under the base: absolute under a plain path (so
57
+ * the browser's early fetches find them too), or relative for `./`, resolved from its `<base>`.
58
+ */
59
+ const movedLinks = (html, base) => html.replace(/\b(src|href)="\/(?!\/)/g, `$1="${base === './' ? '' : base}`);
60
+ async function rewrite(file, change) {
61
+ await writeFile(file, change(await readFile(file, 'utf8')));
62
+ }
63
+ /**
64
+ * The app bundle's own files (its assets' `uri:"/assets/…"` or `exports="/assets/…"`, its chunks'
65
+ * `"paths"`), from the site's path rather than the server's root: each value becomes an expression.
66
+ */
67
+ export const siteAssets = (code) => code.replace(/(?<=[:(,[?]|(?<![=!<>])=)"\/(assets|_expo)\//g, '(globalThis.__APE_SITE__||"")+"/$1/');
68
+ /** Make an export with a base other than `/` play from wherever its root is served. */
69
+ export async function relocate(out, app, base) {
70
+ const head = (page) => (html) => html.replace(/<head[^>]*>/i, `$&${pageScript(page, base)}`);
71
+ await rewrite(join(out, 'prototype', 'index.html'), head('viewer'));
72
+ await rewrite(join(out, 'prototype', '_scene', 'index.html'), head('admin'));
73
+ if (!app)
74
+ return;
75
+ await rewrite(join(out, '_scene', 'index.html'), (html) => head('app')(movedLinks(html, base)));
76
+ const bundles = join(out, '_expo', 'static', 'js', 'web');
77
+ const files = await readdir(bundles).catch(() => []);
78
+ for (const file of files.filter((f) => f.endsWith('.js')))
79
+ await rewrite(join(bundles, file), siteAssets);
80
+ }
@@ -21,8 +21,9 @@ export declare function commitToExport(root: string, commit?: string): string;
21
21
  * and name the commit in its `export.json`. Development builds: production ones leave the scenes
22
22
  * and the sample data out.
23
23
  */
24
- export declare function buildSite(root: string, out: string, exported: ExportedCommit): Promise<void>;
25
- /** `ape prototype export [<commit>] [--out <dir>]` */
24
+ export declare function buildSite(root: string, out: string, exported: ExportedCommit, given?: string): Promise<void>;
25
+ /** `ape prototype export [<commit>] [--out <dir>] [--base <path>]` */
26
26
  export declare function exportCommit(text: string | undefined, options: {
27
27
  out?: string;
28
+ base?: string;
28
29
  }): Promise<void>;