@buffcore/cli 0.8.47 → 0.8.49

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 (175) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/commands/build/server-text.en.d.ts +5 -0
  3. package/dist/commands/build/server-text.en.js +5 -0
  4. package/dist/commands/build/server-text.js +5 -0
  5. package/dist/commands/build/server.d.ts +4 -0
  6. package/dist/commands/build/server.js +10 -1
  7. package/dist/commands/change-merge-serial.d.ts +6 -2
  8. package/dist/commands/change-merge-serial.js +5 -1
  9. package/dist/commands/change-merge.d.ts +2 -2
  10. package/dist/commands/change.js +3 -0
  11. package/dist/commands/check-skills.d.ts +16 -0
  12. package/dist/commands/check-skills.en.d.ts +14 -0
  13. package/dist/commands/check-skills.en.js +14 -0
  14. package/dist/commands/check-skills.es.d.ts +2 -0
  15. package/dist/commands/check-skills.es.js +14 -0
  16. package/dist/commands/check-skills.js +146 -0
  17. package/dist/commands/check.js +5 -0
  18. package/dist/commands/dev.d.ts +9 -2
  19. package/dist/commands/dev.js +24 -5
  20. package/dist/commands/extension/config-text.d.ts +2 -0
  21. package/dist/commands/extension/config-text.js +2 -0
  22. package/dist/commands/extension/index.js +14 -2
  23. package/dist/commands/extension/new.d.ts +16 -0
  24. package/dist/commands/extension/new.js +52 -0
  25. package/dist/commands/extension/pack-files.d.ts +23 -0
  26. package/dist/commands/extension/pack-files.js +78 -0
  27. package/dist/commands/extension/pack-scan.d.ts +24 -0
  28. package/dist/commands/extension/pack-scan.js +131 -0
  29. package/dist/commands/extension/pack.d.ts +48 -0
  30. package/dist/commands/extension/pack.js +142 -0
  31. package/dist/commands/extension/share-text.d.ts +3 -0
  32. package/dist/commands/extension/share-text.js +6 -0
  33. package/dist/commands/extension/share.en.d.ts +32 -0
  34. package/dist/commands/extension/share.en.js +32 -0
  35. package/dist/commands/extension/share.es.d.ts +2 -0
  36. package/dist/commands/extension/share.es.js +32 -0
  37. package/dist/commands/hardening.d.ts +3 -0
  38. package/dist/commands/hardening.en.d.ts +3 -0
  39. package/dist/commands/hardening.en.js +3 -0
  40. package/dist/commands/hardening.es.d.ts +2 -0
  41. package/dist/commands/hardening.es.js +3 -0
  42. package/dist/commands/hardening.js +19 -0
  43. package/dist/commands/prototype/comp-record.d.ts +5 -0
  44. package/dist/commands/prototype/comp-record.js +22 -0
  45. package/dist/commands/server/build.d.ts +2 -1
  46. package/dist/commands/server/build.js +10 -2
  47. package/dist/commands/server/deploy-local.d.ts +3 -0
  48. package/dist/commands/server/deploy-local.js +9 -0
  49. package/dist/commands/server/deploy-plan.d.ts +5 -0
  50. package/dist/commands/server/deploy-plan.js +56 -0
  51. package/dist/commands/server/deploy-result.d.ts +7 -0
  52. package/dist/commands/server/deploy-result.js +1 -0
  53. package/dist/commands/server/deploy-script.d.ts +2 -0
  54. package/dist/commands/server/deploy-script.js +3 -2
  55. package/dist/commands/server/deploy.d.ts +9 -6
  56. package/dist/commands/server/deploy.js +39 -61
  57. package/dist/commands/server/files.d.ts +9 -1
  58. package/dist/commands/server/files.js +25 -5
  59. package/dist/commands/server/image.d.ts +4 -2
  60. package/dist/commands/server/image.js +6 -5
  61. package/dist/commands/server/setup.d.ts +1 -0
  62. package/dist/commands/server/setup.js +4 -0
  63. package/dist/commands/server/system-packages.d.ts +29 -0
  64. package/dist/commands/server/system-packages.js +103 -0
  65. package/dist/commands/services/compose.d.ts +1 -1
  66. package/dist/commands/services/compose.js +5 -3
  67. package/dist/commands/ui/agents-route.js +2 -0
  68. package/dist/commands/ui/approval-authority.en.d.ts +1 -0
  69. package/dist/commands/ui/approval-authority.en.js +1 -0
  70. package/dist/commands/ui/approval-authority.es.d.ts +1 -0
  71. package/dist/commands/ui/approval-authority.es.js +1 -0
  72. package/dist/commands/ui/approval-authority.js +7 -2
  73. package/dist/commands/ui/approve.js +2 -4
  74. package/dist/commands/ui/autopilot-records.d.ts +2 -0
  75. package/dist/commands/ui/autopilot-records.js +5 -0
  76. package/dist/commands/ui/brand-approval.js +5 -1
  77. package/dist/commands/ui/chat/permissions.js +1 -1
  78. package/dist/commands/ui/chat/routes.js +4 -0
  79. package/dist/commands/ui/comp-approval.d.ts +14 -2
  80. package/dist/commands/ui/comp-approval.js +45 -8
  81. package/dist/commands/ui/index.d.ts +1 -0
  82. package/dist/commands/ui/level-route.js +3 -0
  83. package/dist/commands/ui/merge-authority.d.ts +4 -1
  84. package/dist/commands/ui/merge-authority.en.d.ts +4 -0
  85. package/dist/commands/ui/merge-authority.en.js +5 -1
  86. package/dist/commands/ui/merge-authority.es.d.ts +4 -0
  87. package/dist/commands/ui/merge-authority.es.js +5 -1
  88. package/dist/commands/ui/merge-authority.js +6 -3
  89. package/dist/commands/ui/merge-claims.d.ts +7 -0
  90. package/dist/commands/ui/merge-claims.js +21 -0
  91. package/dist/commands/ui/merge-delegation.js +8 -3
  92. package/dist/commands/ui/merge-hold-name.d.ts +5 -0
  93. package/dist/commands/ui/merge-hold-name.js +5 -0
  94. package/dist/commands/ui/merge-hold.d.ts +6 -1
  95. package/dist/commands/ui/merge-hold.js +23 -5
  96. package/dist/commands/ui/merge-publish-host.d.ts +1 -0
  97. package/dist/commands/ui/merge-publish-host.js +2 -2
  98. package/dist/commands/ui/merge-record.d.ts +2 -0
  99. package/dist/commands/ui/merge-record.js +1 -1
  100. package/dist/commands/ui/merge-route.js +17 -1
  101. package/dist/commands/ui/merge-settle.d.ts +32 -0
  102. package/dist/commands/ui/merge-settle.js +133 -0
  103. package/dist/commands/ui/merge-state.d.ts +5 -0
  104. package/dist/commands/ui/merge-state.js +7 -1
  105. package/dist/commands/ui/merge-withdraw.d.ts +9 -0
  106. package/dist/commands/ui/merge-withdraw.js +29 -0
  107. package/dist/commands/ui/outside-merge.d.ts +13 -0
  108. package/dist/commands/ui/outside-merge.js +84 -0
  109. package/dist/commands/ui/outside.d.ts +7 -4
  110. package/dist/commands/ui/outside.js +3 -0
  111. package/dist/commands/ui/plan-extensions.d.ts +34 -0
  112. package/dist/commands/ui/plan-extensions.en.d.ts +4 -0
  113. package/dist/commands/ui/plan-extensions.en.js +4 -0
  114. package/dist/commands/ui/plan-extensions.es.d.ts +2 -0
  115. package/dist/commands/ui/plan-extensions.es.js +4 -0
  116. package/dist/commands/ui/plan-extensions.js +86 -0
  117. package/dist/commands/ui/plan-files.js +9 -3
  118. package/dist/commands/ui/plan-structure.js +5 -7
  119. package/dist/commands/ui/prototype-comp-route.d.ts +12 -3
  120. package/dist/commands/ui/prototype-comp-route.js +35 -17
  121. package/dist/commands/ui/prototype-main.d.ts +6 -0
  122. package/dist/commands/ui/real-file.d.ts +11 -0
  123. package/dist/commands/ui/real-file.js +84 -0
  124. package/dist/commands/ui/save-route.js +4 -1
  125. package/dist/commands/ui/server.d.ts +1 -0
  126. package/dist/commands/ui/server.js +1 -0
  127. package/dist/commands/ui/studio-routes.js +2 -0
  128. package/dist/commands/ui/studio-state.d.ts +8 -0
  129. package/dist/commands/ui/studio-versions.js +19 -3
  130. package/dist/commands/ui/studio.en.d.ts +2 -0
  131. package/dist/commands/ui/studio.en.js +2 -0
  132. package/dist/commands/ui/studio.es.d.ts +2 -0
  133. package/dist/commands/ui/studio.es.js +2 -0
  134. package/dist/commands/upgrade.js +1 -1
  135. package/dist/ui/page.js +91 -91
  136. package/docs/EXTENSIONS.md +6 -0
  137. package/docs/PROTOTYPE.md +13 -0
  138. package/docs/WORKBENCH.md +55 -2
  139. package/package.json +11 -11
  140. package/skills/ape-add-ai-purpose/SKILL.md +1 -1
  141. package/skills/ape-add-event/SKILL.md +1 -1
  142. package/skills/ape-add-extension/SKILL.md +5 -1
  143. package/skills/ape-add-feature/SKILL.md +1 -1
  144. package/skills/ape-add-generator/SKILL.md +1 -1
  145. package/skills/ape-add-module/SKILL.md +1 -1
  146. package/skills/ape-add-route/SKILL.md +3 -1
  147. package/skills/ape-add-service/SKILL.md +1 -1
  148. package/skills/ape-add-translations/SKILL.md +2 -2
  149. package/skills/ape-admin-screen/SKILL.md +1 -1
  150. package/skills/ape-app-screen/SKILL.md +1 -1
  151. package/skills/ape-critique/SKILL.md +11 -32
  152. package/skills/ape-critique/references/after.md +15 -0
  153. package/skills/ape-critique/references/spacing-pass.md +20 -0
  154. package/skills/ape-deploy/SKILL.md +8 -3
  155. package/skills/ape-design-system/SKILL.md +15 -15
  156. package/skills/ape-design-system/references/by-hand.md +7 -0
  157. package/skills/ape-design-system/references/reference-study.md +11 -0
  158. package/skills/ape-diagnose/SKILL.md +24 -0
  159. package/skills/ape-migration/SKILL.md +1 -1
  160. package/skills/ape-plan-change/SKILL.md +37 -31
  161. package/skills/ape-plan-change/references/change-file-fields.md +5 -0
  162. package/skills/ape-plan-change/references/extensions.md +25 -0
  163. package/skills/ape-plan-change/references/finishing.md +3 -0
  164. package/skills/ape-plan-change/references/fix-from-error.md +3 -0
  165. package/skills/ape-plan-change/references/refactor.md +9 -0
  166. package/skills/ape-plan-change/references/structure.md +19 -0
  167. package/skills/ape-prototype/SKILL.md +13 -23
  168. package/skills/ape-prototype/references/comp.md +3 -0
  169. package/skills/ape-prototype/references/scope-and-export.md +5 -0
  170. package/skills/ape-prototype/references/snapshot.md +3 -0
  171. package/skills/ape-prototype/references/structure.md +11 -0
  172. package/skills/ape-prototype/references/working-app.md +7 -0
  173. package/skills/ape-request/SKILL.md +1 -1
  174. package/skills/ape-upgrade/SKILL.md +4 -1
  175. package/templates/product/package.json +1 -1
@@ -108,6 +108,12 @@ Overview. The app keeps the template's approved home: after the extension's scre
108
108
  is approved and wired, point `apps/app/src/app/index.tsx` at it. Deploy the shell
109
109
  with `ape deploy` like any product. `--example` is refused because it adds a product module.
110
110
 
111
+ ### Built to share from a product
112
+
113
+ A product's plan can answer `build to share` for a capability (`plan/extensions.md`, below in [WORKBENCH.md](WORKBENCH.md)). `ape extension new <key>`, run in the product, writes `packages/<key>/` from the same template as `ape create --extension`: its own `<key>_` tables, words keyed `<key>.`, tests on its own small product, and its README as the agent's guide. The product's workspace lists `packages/*`, so its tests run with the product's; `ape add ./packages/<key>` installs it.
114
+
115
+ `ape extension pack <key> [--out <folder>]` writes a submission bundle to `.ape/pack/<key>/` (an `--out` folder stays inside `.ape/pack/`; absolute paths, `..` and a link or junction anywhere on the way, `.ape` included, are refused, and only a bundle pack wrote is ever replaced) for the catalog the product names (`catalog.url`): `package/` (its own files, without `node_modules`, `dist` or coverage), `check-report.json` (`ape check compatible`, its folders named from the product's root), `scan.json`, and `submission.json` (package, version, licence, what its grant lets it touch, its screens). It ships only what it scanned, the same bytes: text (UTF-8, or UTF-16 with its byte-order mark), and images and fonts (png, jpg, gif, webp, avif, ico, woff, ttf, otf), whose printable runs of six or more characters are scanned. That scan does not find a value split by a non-printable byte or held in compressed data (a PNG's zTXt and iTXt chunks); woff2, which is all compressed, does not ship. It refuses an archive or another binary, a dotfile or dot-folder (`.git/` included; only `.gitignore`, `.npmignore` and `.editorconfig` ship), and credential, key and certificate files (`credentials*.json`, `secrets.yaml`, `secrets.json`, `service-account*.json`, `kubeconfig`, `*.tfstate`, `.envrc`, `.npmrc`, `*.key`, `*.crt`, `*.ppk`, `*.keystore` and the like). It refuses a package holding a secret (the `ape check secrets` rules, and secret files by name), an email outside the example domains, a phone number outside the fictional ranges (555-0100 to 555-0199, 07700 900xxx), or the product's own name in any spelling (`bright-paws`, `Bright Paws`, `brightPawsApi`), listing each by file and line, never the value. Phone numbers are matched by their real shapes only (a `+` and a country code, North American 3-3-4 or ten digits with a 2-9 area code and exchange, a UK number from 0), so dates, versions, Unix times, integer limits and SVG path numbers pass; an email needs a letter top-level domain that is not a file ending (`logo@2x.png` and `pnpm@9.15.0` pass). A value listed in the product's `secrets-allow.txt` (reviewed as public) is not a finding. A value split or encoded (base64) is not found. It never publishes, uploads or calls the network: a person submits the folder.
116
+
111
117
  ## Extensions using each other (AO2)
112
118
 
113
119
  An extension lists its own actions and reads in `offers`, and the other packages' keys it calls in `uses`. Both are optional arrays on `defineExtension`. It imports no other extension: keys are found at runtime, so installs, upgrades and removals stay one at a time, without `requires` between extensions (replacing the 2026-10-15 direction above).
package/docs/PROTOTYPE.md CHANGED
@@ -207,6 +207,19 @@ hash) records the approval, its commit and signer in `prototype/versions/comp.js
207
207
  own commit (`prototype: approve the look`) as a version approval is, and refuses an agent. Agents'
208
208
  file tools, coding commands and merged branches cannot write it, and a record not made by that
209
209
  commit does not count.
210
+ Under a host's approval authority (`createUiServer({ approval })`) **Approve the look** asks the host
211
+ once, with `action: 'approve'` and the artifact `{ kind: 'comp', version: null, commit, fingerprint }`
212
+ (the commit checked out, the comp report's hash). The host answers as for the other kinds: refuse
213
+ with a code, accept with `approval: null` (pending), or return the approval, kind `comp`, whose
214
+ signatures name that commit and fingerprint and the viewer, never an `agent` or `ai`; the studio
215
+ records it in `comp.json` by its own approval commit, so the host writes nothing else. A caller with
216
+ an agent or an AI approver is refused before the host is asked. The comp read then asks the host
217
+ (`action: 'check'`, the artifact named by the record's first signature's commit) before it says
218
+ approved; a refusal, error or 5-second timeout shows the look not approved, with the reason in
219
+ `approvalRefusal`, which the page shows where the look waits. Comp pictures are read only from an
220
+ opened regular file with one link whose real path (links and junctions followed) is inside the
221
+ product's folder (a shot: inside the comp snapshot folder; a
222
+ reference the person's own studio lists outside the folder keeps working there). On Linux the studio also checks the open file's own path (`/proc/self/fd`); on Windows and macOS it can only check the path again, so a local process that swaps a folder back and forth several times within microseconds of the read is a remaining race.
210
223
  A redrawn comp is a new look to approve. The prototype and critique skills treat the approved comp
211
224
  as the reference the scenes must match.
212
225
 
package/docs/WORKBENCH.md CHANGED
@@ -60,6 +60,7 @@ build time, or from source when running in the checkout.
60
60
  Brand labels the base and chosen direction separately.
61
61
  The live preview URL is supplied when the app responds (`stack.answers.app`); empty cards point to Dev server to start it, and voice lists render separate accessible list items from the design contract.
62
62
  - The Brief's Not this project card reads `plan/not-this.md` even when the Brief is empty. Adding a line asks the Brief chat to edit the file, which the Brief's Save owns. The plan fact `notThis` carries up to 50 bullets of 300 characters with comments stripped, or null without the file. Every chat turn's step context quotes up to 20 lines and tells the agent to quote a conflicting line and ask.
63
+ - The Plan's Extensions card reads `plan/extensions.md`: one line per capability, `- <kind>: <name> - <why>`, the kind one of `use`, `improve`, `build to share`, `request`, `product only`, and `(extra: <cost>)` ending a line built to share. The plan fact `extensions` carries the lines with a known kind (100 at most); the card groups them by kind with each group's count and the extra cost of building to share. `ape change` names, by its line number, each top-level bullet whose word before the colon is a kind or a typo of one (one edit from a kind of four letters or fewer, two from a longer one) but is not a known kind or not in the form; other bullets (`- note: …`) and nested points are prose; the Plan's Save owns the file.
63
64
  - Setup's Where it runs shows Web fixed on and switches iOS and Android with the run ids `enable:<ios|android>:<id>` and `disable:<ios|android>`, which run `ape enable <platform> --id <id> --json` and `ape disable <platform> --json`, never with `--force`. The store ID sheet suggests an ID from a domain typed in Release. The `platforms` fact reads a literal list from `buffcore.config.ts` or shows Unknown, with IDs from `app.json` flagged as placeholders while they start with `com.example.`. A run refusal (its output's first line or the JSON `error`) appears under its switch; any other failed answer shows a plain failure sentence.
64
65
  - Brand shows the uploaded app icon or draws a placeholder in the chosen direction's colour. You can upload a PNG or ask the Brand chat to make one. The file `design/app-icon.png` must be 1024 by 1024 and at most 1 MB. Brand's Save owns it with the rest of `design/` and the brand fingerprint stays independent. `POST /api/brand/icon` (right `build`) checks the base64 PNG and writes it atomically to the working copy, refusing a link in `design/` or at the file with a plain sentence. The hosted save question comes at Brand's Save. The studio state carries `appIcon`, the size and fingerprint of a valid regular PNG, null otherwise, never its bytes. The studio fetches the PNG from `GET /api/brand/icon` (right `read:runs`, never cached) only when the fingerprint changes, and keeps nothing else of it; while that read is pending or failed the card shows no placeholder.
65
66
  - The rail leaves a step un-checked while any of its loop chats runs, and while every
@@ -827,8 +828,30 @@ options. Work changes report their state, can include a check result and carry a
827
828
  summary of up to 160 characters. An optional link is at most 2,048 characters and
828
829
  uses HTTPS without userinfo or a root-relative same-origin path.
829
830
 
830
- `outside.changes.act` is reserved for a future host-owned merge action. The
831
- decision tap is also reserved. Its planned `POST /api/outside/answer` accepts
831
+ **Merging an outside change.** Register `outside.changes.act({ viewer, change, signal })` and
832
+ studio state carries `merges: true`. Merge is offered only to a viewer with the `build` right
833
+ (`canMergeOutside`); `useOutsideMerge` posts it and gives the answer's sentence. The Work board
834
+ does not draw outside rows yet (they await a drawn prototype), so the button arrives with them. The host owns the merge: BuffCore never fetches or merges an
835
+ outside change's code, and the host checks that the id is one it listed and that this viewer may
836
+ merge it. `POST /api/outside/merge` takes exactly `{ change }` (the ID rule), needs `build`, a
837
+ signed-in hosted viewer and a same-origin `Origin`, and calls `act` once with the same frozen
838
+ viewer the reads get, within `outside.timeoutMs`. It runs in the studio's one merge queue: while a
839
+ studio merge (or a release) holds the merge lock it answers `busy` without asking the host, and a
840
+ studio merge started while `act` runs is refused as busy too. The Autopilot merge hold stops only
841
+ Autopilot, so, as with a person's inside merge, it does not refuse a person's outside Merge. `act` answers `{ status: 'merged', receipt? }`
842
+ (a plain-text receipt of at most 2,048 characters, for display), `{ status: 'refused', code }`
843
+ or `{ status: 'pending' }`; a throw, an answer out of that form or a closed studio is `error`, and
844
+ no answer in time is `timeout`. On a timeout or a closed studio the signal is aborted and the
845
+ answer goes out at once, but the merge lock stays taken until `act` settles (a second Merge or a
846
+ studio merge meanwhile is `busy`), for at most four time limits; then it is freed and the studio
847
+ logs it. So `act` must stop when its signal aborts and be safe to call again for the same id: a
848
+ person may press Merge again after a timeout, and it must not start a second merge. The page says each in its own words (English and Spanish), shows a
849
+ failed request as such (never as merged), and then reads the outside source again; nothing in the
850
+ studio changes on any answer. Autopilot never calls `act`: it merges only a change its own turn
851
+ ended, so an outside change is merged only by a person's Merge, at every level, as an inside one
852
+ is. Without `act` there is no Merge and the route answers 404.
853
+
854
+ The decision tap is reserved. Its planned `POST /api/outside/answer` accepts
832
855
  exactly `{ topic, option }` with the same ID rule. It requires an own-seat viewer
833
856
  with `approve:plan` and a same-origin `Origin` header. It will call
834
857
  `outside.issues.answer({ viewer, topic, option, signal })` within the configured
@@ -942,6 +965,36 @@ merge through Work or `ape change merge`. Hosted writers pass their final write
942
965
  the same publication lock as a local automatic merge. A held automatic queue entry is withdrawn when
943
966
  publication is refused or a person merges it. A hosted Autopilot success must come through `publish`.
944
967
 
968
+ **A queue that merges later settles through `settleHostMerge`.** `publish` lives in the hook's
969
+ call, so a queue in another process cannot reach it. An Autopilot ask carries `claim`, a random
970
+ secret for that one ask, given to the host; the studio's record keeps only its SHA-256 and compares
971
+ in constant time. When its queue has merged the change, the host's own process calls
972
+ `settleHostMerge(root, { change, head, claim, outcome: 'merged' })`, or `outcome: 'not_merged'` with
973
+ a code when it gives up; no HTTP route reaches it. `outcome: 'check'` runs the same gate under the
974
+ same lock, writes nothing and answers `{ status: 'ready' }` when a `merged` settle would pass now
975
+ (main aside), so a queue checks just before its final write. It answers
976
+ `{ status: 'merged' | 'not_merged' }`, or `{ status: 'refused', code, detail }` when the claim is
977
+ not the waiting Autopilot claim for that change and head, the branch moved, Autopilot merges are
978
+ held, the saved level is not Autopilot, `plan/agents.md` or the hold file changed since the ask
979
+ (any edit counts, and any settle refused for that, `check` and `not_merged` too, withdraws the claim so Autopilot asks again), or (for `merged`) main
980
+ does not hold that exact head; a record it cannot write answers `merge_record_failed`, and the
981
+ host may call again, as for `merge_publication_lock` when the publication lock stays busy. A merged settlement records what
982
+ `publish` records; the next read records the merge and starts the Snapshot. Main holding the head
983
+ is not enough on its own: the host writes main, so that shows a write, not one that respected a
984
+ person's hold.
985
+
986
+ A waiting Autopilot claim ends, unless main already holds its head, when a person turns the hold on
987
+ (`writeMergeHold`, under the hold's lock), changes the level away from Autopilot, presses Stop on
988
+ that change's chat (also when Stop only asks to confirm and the person cancels), or withdraws it (`POST /api/merge/withdraw { change }`, right `build`, the merge preview's Withdraw
989
+ button, shown only on an Autopilot wait, marked `automatic: true` in the read's `work.merges`). A person's own waiting merge is not withdrawn. Every wait shows how long it has waited.
990
+ After any of these, the host's settle answers `merge_settle_unknown`: the host drops that queue
991
+ entry and must not write main for it; to merge the change it waits for the studio to ask again
992
+ (Autopilot after a later turn, or the person's Merge). A queue that runs `outcome: 'check'` just
993
+ before its final write does not merge a claim already withdrawn; one withdrawn between the check
994
+ and the write is still possible. If its queue merged the change anyway, the studio shows it
995
+ as Git shows it, like a merge made at a terminal: the change reads as merged in Work, with no host
996
+ line, receipt, Autopilot record or Snapshot; a person runs `ape prototype snapshot` on main.
997
+
945
998
  **The host owns the atomic queue decision and the live rights check.** It must reject stale heads
946
999
  and bases, and must not call `mergeOne` itself: BuffCore holds its lock. `merge` may be called
947
1000
  again for the same change and head: on the next merge after a refusal or after main is rewound
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buffcore/cli",
3
- "version": "0.8.47",
3
+ "version": "0.8.49",
4
4
  "description": "The `ape` command: create, dev, migrate, seed, prototype, deploy and a local MCP server for coding agents.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "BuffApe",
@@ -45,20 +45,20 @@
45
45
  "playwright-core": "1.63.0",
46
46
  "yaml": "2.9.1",
47
47
  "zod": "4.6.5",
48
- "@buffcore/i18n": "0.8.47",
49
- "@buffcore/config": "0.8.47",
50
- "@buffcore/build-agent": "0.8.47",
51
- "@buffcore/modules": "0.8.47",
52
- "@buffcore/contracts": "0.8.47",
53
- "@buffcore/db": "0.8.47",
54
- "@buffcore/server": "0.8.47",
55
- "@buffcore/tokens": "0.8.47",
56
- "@buffcore/storage": "0.8.47"
48
+ "@buffcore/build-agent": "0.8.49",
49
+ "@buffcore/i18n": "0.8.49",
50
+ "@buffcore/config": "0.8.49",
51
+ "@buffcore/modules": "0.8.49",
52
+ "@buffcore/server": "0.8.49",
53
+ "@buffcore/contracts": "0.8.49",
54
+ "@buffcore/db": "0.8.49",
55
+ "@buffcore/tokens": "0.8.49",
56
+ "@buffcore/storage": "0.8.49"
57
57
  },
58
58
  "devDependencies": {
59
59
  "marked": "18.1.3",
60
60
  "tsx": "4.23.15",
61
- "@buffcore/admin-shell": "0.8.47"
61
+ "@buffcore/admin-shell": "0.8.49"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "node ../../scripts/build-package.mjs && node scripts/bundle.mjs",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-add-ai-purpose
3
- description: "Add an AI purpose: class, instructions, prompt, output schema, check, fallback, candidate models and how one is chosen, tools, agents, research, test set and fixtures. Never call a provider directly."
3
+ description: "AI purposes: instructions, prompt, output schema, check, fallback, models, tools, agents, research, test set. Use when adding or changing an AI feature, never by calling a provider directly."
4
4
  ---
5
5
 
6
6
  # Add an AI purpose
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-add-event
3
- description: "Add a typed event about a subject: naming, allowed properties (never free text), emitting it from the server or tracking it in the app, and subscribers that act on it."
3
+ description: "Typed events about a subject: names, allowed properties, emitting, tracking, subscribers. Use when recording that something happened, or acting on it."
4
4
  ---
5
5
 
6
6
  # Add an event
@@ -1,12 +1,16 @@
1
1
  ---
2
2
  name: ape-add-extension
3
- description: "Write an extension (a package any product can add: its table, actions, event, default rule, admin section, app screen) and install it with ape add, or remove it with ape remove: the key prefix, the grant, privacy, outbound(ctx), the ./admin and ./app entries."
3
+ description: "Extensions: packages any product can add, with tables, actions, events and screens. Use when writing an extension, or adding or removing one with ape add or ape remove."
4
4
  ---
5
5
 
6
6
  # Write and install an extension
7
7
 
8
8
  Start one with `ape create <name> --extension`.
9
9
 
10
+ **A piece the plan builds to share** (`build to share` or `request` in `plan/extensions.md`, the `ape-plan-change` skill) starts inside the product from the first day: `pnpm ape extension new <key>` writes `packages/<key>` from the same template, with its own `<key>_` tables, words keyed `<key>.` that name no product, tests on its own small product (step 9) and its README as its guide. The product's workspace lists `packages/*`, so its tests run with the product's checks. Then follow the steps below from step 2, and install it with step 5.
11
+
12
+ **When it is ready for a catalog,** `pnpm ape extension pack <key>` writes a submission bundle to `.ape/pack/<key>/` for the catalog `buffcore.config.ts` names: the package, `check-report.json` (`ape check compatible`), `scan.json` and `submission.json` (what it can touch, its licence, its screens). It refuses a secret, a real-looking email or phone number (use `example.com` and 555-0100 to 555-0199) or the product's own name, listing each by file and line. It never publishes, uploads or calls the network: a person submits the folder.
13
+
10
14
  Read `node_modules/@buffcore/cli/docs/EXTENSIONS.md` with the installed CLI. In a BuffCore checkout, read `docs/EXTENSIONS.md`.
11
15
 
12
16
  After adding or updating an extension, approve each new data destination with a literal `yes` on a TTY (`ape extension approve-places` lists any still missing); installation's `--yes` never approves places, and `ape check places` refuses them until a person does (see the extension guide).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-add-feature
3
- description: "Add a feature to a product end to end, in order: entity, composition, migration, contract, routes and roles, admin view, app view, strings, tests, pnpm verify. Each step points at the reference module, tasks."
3
+ description: "A feature end to end: entity, migration, contract, routes, admin and app views, strings, tests. Use when adding a feature that spans the data, the API and the screens."
4
4
  ---
5
5
 
6
6
  # Add a feature
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-add-generator
3
- description: "Add a generator: a content kind that generation runs write on the worker, with its generate purpose, code checks, QA playbook and tools, input form and glossary."
3
+ description: "Generators: a content kind generation runs write on the worker, with its purpose, checks, QA playbook and form. Use when adding a kind of generated content."
4
4
  ---
5
5
 
6
6
  # Add a generator
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-add-module
3
- description: "Add a module (its tables, functions and routes) to a BuffCore product or to BuffCore: boundaries, the manifest, entities, sensitive marks, roles, jobs, privacy hooks, notification kinds, services, safety flags, tests."
3
+ description: "Modules: tables, functions, routes, roles, jobs, privacy hooks, notification kinds, sensitive marks, safety flags, boundaries. Use when adding a module to a product or to BuffCore."
4
4
  ---
5
5
 
6
6
  # Add a module
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-add-route
3
- description: "Add or change an HTTP route: the shared Zod route schema, roles, actions, audited sensitive reads, MCP exposure."
3
+ description: "HTTP routes: the shared Zod schema, roles, actions, audited sensitive reads, MCP exposure. Use when adding or changing a route."
4
4
  ---
5
5
 
6
6
  # Add a route
@@ -11,7 +11,9 @@ description: "Add or change an HTTP route: the shared Zod route schema, roles, a
11
11
  - Who may call it: `access: 'public'`, the default (signed in), or `roles` for an admin route: `roles: ['owner']` for what only the Owner does (the product's money, settings, whatever publishes to every member), `roles: ['support']` (or another role the product declares, below) for what staff the Owner appoints may do too. The Owner always may, so another role only widens a route; `owner` needs no declaration. A signed-in route passes for an operator too, but they act only for the accounts they belong to, usually none: `callerAccountId` gives nothing, so tasks' member list answers empty and its create is refused `403` (the route test shows both). What the console needs from every account (a picker, a list) is an admin route with `roles`, never the member's. Reuse a role when the same person does the job (whoever handles one thing also handles the next); declare a new one, named for the job, when another person does. A role other than the Owner is declared where the app is composed, `buffcoreModules(product, { identity: { roles: ['support'] } })`, and named in the admin catalog as `admin.roles.<role>`.
12
12
  - `audit: 'sensitive-read'` when opening it reads something on the product's list of sensitive reads.
13
13
  - `audit: 'none-for-machines'` only for routine machine reports: skips successful automatic machine rows, preserves people's audit behavior, failures and explicit `server.audit` entries; start refuses it with `action` or sensitive `carries` kinds, and `ape manifest` shows the mark.
14
+ - `handle(route, handler, { auditOnce: { key, seconds } })` only on a `sensitive-read` a screen refreshes: `key(result, request, ctx)` names the state read from IDs and versions only, never field values; a person's successful screen read of an unchanged key and object writes one row per `seconds` (300). A second screen's read of the same state in the window writes none. Denials, errors, machine reads (a door, a credential, an added kind not read as people) and explicit rows are still written every time; start refuses it on an `action` or a route that isn't a `sensitive-read`.
14
15
  - `actors: ['device', 'profile']` for a route a device in profile mode (or the profile it acts as) may call, including a live-session start route (`['profile']` when only a profile may). Those kinds are closed by default: they reach only routes that name them and public ones, never a member's, nor one with `roles`; a profile acts for `ctx.actor.accountId` (`callerAccountId(ctx)`) as `ctx.actor.id`, a device for no account (`deviceOf(ctx.actor)` from `@buffcore/modules/devices` gives its grant), never `accountIds`.
16
+ - `actorsOnly: true` with `actors` when only those kinds may call it: the kernel's kinds (an operator, the Owner too, a member, an API key or MCP client, an agent, a preview) are refused as well, and `can()` answers no for them. Without it, `actors` only opens a route to added kinds and a signed-in person still passes. The host's routes use it (`docs/IDENTITY_ACCESS.md`).
15
17
  - `part: { type: 'project', param: 'projectId' }` when it acts on one part of an account (its module declares the type with identity's `parts`, the `ape-add-module` skill), or `{ type: 'account', param: 'accountId' }` when it acts on the account itself: the caller then needs the right to its key there, through their role in that account or a right given to them (an account's Owner, and a person alone in one, hold every right); otherwise `403 forbidden` with `{ right }`, at every door. It needs no account check of its own. Without `part`, a member route checks the account in its path or needs the route's account right when `X-Account-Id` selects a non-default account. Add the key to the presets that should give it (`identity: { accountRoles }`); `can(ctx, key, part)` from `@buffcore/server` asks first, for a button to show or hide (`docs/IDENTITY_ACCESS.md`, rights).
16
18
  - `preview: true` only for a write the admin's embedded app must make (e.g. starting a live session); the handler then keeps a preview (`ctx.actor.preview`) to its test profile, and checks no operator roles (a preview token carries none).
17
19
  - A `name` on every route: snake_case, unique in the module, verb first, without the module's own word (`publish_set` in `content`; tasks' `create_task`). Its key, `content.publish_set`, names it everywhere: the audit row, its rules, `runAction`, an agent's tool and the MCP tool (`content_publish_set`). The app won't start without it.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-add-service
3
- description: "Add a service the product runs beside its API: a Node process or a container (an image pinned by digest, or a Dockerfile in services/<name>), with its port, health check, size, count and volume, declared once in buffcore.config.ts's processes; ape dev, CI, ape server setup and ape deploy run it, backups hold its volume, ape services sizes it; a hosting change."
3
+ description: "Services beside the API: a Node process or a container, with port, health, size and volume. Use when adding or resizing a service, or making another hosting change."
4
4
  ---
5
5
 
6
6
  # Adding a service
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: ape-add-translations
3
- description: "Add or change words people read: t() with ICU messages, the English and Spanish catalogs, Intl formats, ape i18n check and translate, pseudo-locales."
3
+ description: "Words people read: t() with ICU messages, the English and Spanish catalogs, Intl formats, ape i18n. Use when adding, changing or translating text."
4
4
  ---
5
5
 
6
6
  # Add translations
7
7
 
8
8
  Every word a person reads goes through `t('module.area.key', values)`; every date, number and amount goes through `Intl` (`formatDate`, `formatMoney` and the others in `@buffcore/i18n`). A moment shows with `formatDateTime(locale, iso)`, in the viewer's zone; a day with no time (`'2026-10-13'`) with `formatDate(locale, day)`, as that day in every zone (the convention: `docs/LOCALIZATION.md`). A screen gets `locale` from `useLocale()` (`@buffcore/i18n/react`).
9
9
 
10
- The module's own catalog holds the words its **server** sends: a route's error sentence (`flushOrConflict(em, 'groups.errors.nameTaken')`), a notification, an action's title. It is not the screens' words (their catalogs are in step 3). Words no module owns, such as a plan's name in the `settings` that `defineApp` gives payments, go in the composition's own `catalogs: [{ en, es }]` in `apps/api/src/app.ts` (keys start with the product's name, `myapp.plans.plus`); `ape i18n check` reads them with the modules'.
10
+ The module's own catalog holds the words its **server** sends: a route's error sentence (`flushOrConflict(em, 'groups.errors.nameTaken')`), a notification, an action's title (`<key>.actions.<route name>`), a status line's name, a kill switch's description (`<key>.switches.<switch key>`; without one it shows as declared). The server answers in the request's language (the person's own, else `Accept-Language`), pseudo-localized in `en-XA` and `ar-XB` outside production; never translate data such as a person's name. It is not the screens' words (their catalogs are in step 3). Words no module owns, such as a plan's name in the `settings` that `defineApp` gives payments, go in the composition's own `catalogs: [{ en, es }]` in `apps/api/src/app.ts` (keys start with the product's name, `myapp.plans.plus`); `ape i18n check` reads them with the modules'.
11
11
 
12
12
  1. Add the English source to `apps/api/src/modules/<key>/locales/en.ts` (in BuffCore, `packages/modules/src/<key>/locales/en.ts`): a default export of `'<key>.<area>.<name>': 'text'` entries, `satisfies Record<string, string>`, every key starting with the module key. Use ICU for plurals and choices: `{count, plural, one {# note} other {# notes}}`.
13
13
  2. Add every key to each offered language's JSON beside it (`locales/es.json`), with the same placeholders.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-admin-screen
3
- description: "Add an admin console screen or section: a view, its route and roles, the audit line, strings."
3
+ description: "Admin console screens: a view, its route and roles, the audit line, strings. Use when adding an admin screen or a section of one."
4
4
  ---
5
5
 
6
6
  # Add an admin screen
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-app-screen
3
- description: "Add a screen to the Expo app: a view in src/screens, a route in src/app, @buffcore/ui components, strings, tests."
3
+ description: "Expo app screens: a view, a route, @buffcore/ui components, strings, tests. Use when adding a screen to the app."
4
4
  ---
5
5
 
6
6
  # Add an app screen
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-critique
3
- description: "Review a working prototype on seven dimensions, scoring Look from the snapshots before reading the design contract. Write design/critique.md with evidence, Keep / Fix / Quick wins and P0/P1 priorities. Run by a fresh agent, after a passing full prototype snapshot and before a version is recorded."
3
+ description: "Design critique: seven scores, Look first, written to design/critique.md by a fresh agent. Use when a full prototype snapshot passes, a look changes, or a person asks for a review."
4
4
  ---
5
5
 
6
6
  # The critique
@@ -52,6 +52,8 @@ says the critique comes next, as a turn of its own.
52
52
  (`ape-prototype`). Find the element named for each question on each screen the change adds or changes.
53
53
  6. Score the remaining six dimensions using that evidence.
54
54
 
55
+ Done when the Look score is written down before `design/DESIGN.md` was opened, and you hold evidence for each of the other six.
56
+
55
57
  ## The seven dimensions
56
58
 
57
59
  Score each dimension independently from 0 to 10.
@@ -90,24 +92,7 @@ The 90/10: alignment, leading, numbers on their baseline, 44px targets, the cut-
90
92
  focus ring, the long name, the date in the reader's language. Cite the element and, where you can,
91
93
  the screenshot or the line.
92
94
 
93
- **The spacing and layout pass.** Look at each screenshot at 1440 and at 390 for these, in order:
94
-
95
- - **Padding inside** cards, rows, sheets and controls: the same component has the same padding
96
- everywhere, and text never sits closer to an edge than to its neighbours.
97
- - **Gaps between sections:** a larger gap between groups than inside one, the same step for the
98
- same relationship on every screen, and nothing floating halfway.
99
- - **Shared edges and the grid:** titles, fields, cards and lists start on the same edge; a box a
100
- few pixels off its siblings is a slip; columns line up across rows.
101
- - **Siblings that should match:** cards in a list, buttons in a row and items in a menu share size,
102
- padding and alignment, unless one is meant to lead.
103
- - **Crowding and emptiness:** at 390, nothing touches, wraps awkwardly or loses its padding; at
104
- 1440, the content is not lost in empty space or stretched past a readable width.
105
-
106
- Each finding names the screenshot, the element and the spacing token that should apply (the
107
- theme's `space-*` steps, `design/DESIGN.md`'s layout rules). Then go through the snapshot's layout
108
- hints: confirm each one you see in the screenshot as a finding, or dismiss it with the reason (meant,
109
- or not visible). A meant one the scene should mark with `layoutExceptions` in
110
- `prototype/scenes.ts`, with the reason; say so under Fix as a P1.
95
+ **The spacing and layout pass.** Look at each screenshot at 1440 and at 390 in the order `references/spacing-pass.md` gives (padding inside, gaps between sections, shared edges and the grid, siblings that should match, crowding and emptiness), and confirm or dismiss each of the snapshot's layout hints there. Each finding names the screenshot, the element and the spacing token that should apply.
111
96
 
112
97
  - 0–4: visible tape and string. 5–6: most screens clean, a few ragged. 7–8: polished, an expert finds
113
98
  two or three misses. 9–10: nothing to apologise for.
@@ -164,6 +149,8 @@ for the person using the screen, not the thinnest screen.
164
149
  - **Compare with the checks, not instead of them.** The snapshot already covers contrast, cut-off
165
150
  text and touch targets; cite its report where relevant.
166
151
 
152
+ Done when every score names its screen, element or screenshot, and the total is out of 70.
153
+
167
154
  ## The report
168
155
 
169
156
  Write `design/critique.md` as the current review only: replace the whole file, never append to it.
@@ -229,21 +216,11 @@ One sentence in chat before writing the file ("The review of X across seven dime
229
216
  `design/critique.md`."), then the file. Do not paraphrase the whole report in chat. In a fresh studio
230
217
  turn the reply is the report itself, with no sentence before it.
231
218
 
219
+ Done when `design/critique.md` (or your reply, in a fresh studio turn) has every heading of the template, from Scores to Quick wins.
220
+
232
221
  ## After the critique
233
222
 
234
- 1. The agent fixes the P0s and P1s; a change of look goes back through `ape-design-system`, the
235
- design check and the snapshot. A change of journey goes back through `plan/journeys.md` and the
236
- prototype.
237
- 2. Rerun the critique only when the person asks, or when the fixes changed the look or a journey.
238
- 3. The prototype's version is recorded only after the P0s are fixed (the fixes are another snapshot
239
- and another review). A person approves the commit. The critique is advice, never approval.
240
- `ape prototype version` refuses while `design/critique.md` marks an open P0, naming it: any line
241
- that starts with P0 (the Fix list's `- **P0**`) or marks one (`[P0]`, `| P0 |`), as the Autopilot
242
- approver reads it. Write P0 nowhere else. Once one is fixed, strike it through and say how:
243
- `- ~~**P0** <what>~~ <how it was fixed>`. Commit the critique, then take the snapshot again: the
244
- version reads the critique in the commit it records. With no critique on file the version is
245
- recorded and the command says so.
246
- 4. Update `design/critique.md` in place: one report, the current one; git keeps the older ones.
223
+ Fixing the P0s and P1s, rerunning the critique and recording the version follow `references/after.md`. `ape prototype version` refuses while `design/critique.md` marks an open P0; a fixed one is struck through: `- ~~**P0** <what>~~ <how it was fixed>`. Done when the report is written (or, in a fresh studio turn, is your whole reply).
247
224
 
248
225
  ## Hard rules
249
226
 
@@ -254,3 +231,5 @@ turn the reply is the report itself, with no sentence before it.
254
231
  - **Never replace the checks.** `ape design check`, the snapshot, the journeys' tests and the data
255
232
  model are the objective gates; the critique is the human judgment on top.
256
233
  - **Local only.** The review reads the repository; no cloud is needed.
234
+
235
+ Done when the report keeps every rule above: seven scores, evidence for each, no fixes made.
@@ -0,0 +1,15 @@
1
+ # After the critique
2
+
3
+ 1. The agent fixes the P0s and P1s; a change of look goes back through `ape-design-system`, the
4
+ design check and the snapshot. A change of journey goes back through `plan/journeys.md` and the
5
+ prototype.
6
+ 2. Rerun the critique only when the person asks, or when the fixes changed the look or a journey.
7
+ 3. The prototype's version is recorded only after the P0s are fixed (the fixes are another snapshot
8
+ and another review). A person approves the commit. The critique is advice, never approval.
9
+ `ape prototype version` refuses while `design/critique.md` marks an open P0, naming it: any line
10
+ that starts with P0 (the Fix list's `- **P0**`) or marks one (`[P0]`, `| P0 |`), as the Autopilot
11
+ approver reads it. Write P0 nowhere else. Once one is fixed, strike it through and say how:
12
+ `- ~~**P0** <what>~~ <how it was fixed>`. Commit the critique, then take the snapshot again: the
13
+ version reads the critique in the commit it records. With no critique on file the version is
14
+ recorded and the command says so.
15
+ 4. Update `design/critique.md` in place: one report, the current one; git keeps the older ones.
@@ -0,0 +1,20 @@
1
+ # The spacing and layout pass
2
+
3
+ **The spacing and layout pass.** Look at each screenshot at 1440 and at 390 for these, in order:
4
+
5
+ - **Padding inside** cards, rows, sheets and controls: the same component has the same padding
6
+ everywhere, and text never sits closer to an edge than to its neighbours.
7
+ - **Gaps between sections:** a larger gap between groups than inside one, the same step for the
8
+ same relationship on every screen, and nothing floating halfway.
9
+ - **Shared edges and the grid:** titles, fields, cards and lists start on the same edge; a box a
10
+ few pixels off its siblings is a slip; columns line up across rows.
11
+ - **Siblings that should match:** cards in a list, buttons in a row and items in a menu share size,
12
+ padding and alignment, unless one is meant to lead.
13
+ - **Crowding and emptiness:** at 390, nothing touches, wraps awkwardly or loses its padding; at
14
+ 1440, the content is not lost in empty space or stretched past a readable width.
15
+
16
+ Each finding names the screenshot, the element and the spacing token that should apply (the
17
+ theme's `space-*` steps, `design/DESIGN.md`'s layout rules). Then go through the snapshot's layout
18
+ hints: confirm each one you see in the screenshot as a finding, or dismiss it with the reason (meant,
19
+ or not visible). A meant one the scene should mark with `layoutExceptions` in
20
+ `prototype/scenes.ts`, with the reason; say so under Fix as a P1.
@@ -1,12 +1,15 @@
1
1
  ---
2
2
  name: ape-deploy
3
- description: "Deploy the product to a server: ape server setup on a plain Ubuntu server, the bucket for uploads and backups, the settings file (production or staging), ape deploy and what one deploy ships (the API, the console, the web app) and checks before it calls a release good (migrations that only add, every process steady, health), going back to the previous image, a failed first deploy, the first Owner, phone builds, and the job queue's numbers on /health."
3
+ description: "Deploying: server setup, settings file, bucket, ape deploy, going back, a failed first deploy, first Owner, phone builds, /health's queue. Use when a person asks to deploy; read it by path to prepare."
4
+ disable-model-invocation: true
4
5
  ---
5
6
 
6
7
  # Deploying to a server
7
8
 
8
9
  A person decides to deploy; an agent prepares and explains, and runs `ape deploy` only when the person asked for that deploy to that server (section 2). What only a person types stays theirs: the first Owner's password (section 4), the bucket's account. Never put a secret on a command line or in a commit.
9
10
 
11
+ Only a person starts this skill (`disable-model-invocation: true`), because it ships. For the work an agent does alone, read it by path, `.claude/skills/ape-deploy/SKILL.md`: the settings file, the bucket, phone builds, a failed first deploy, the job queue's numbers on /health. Shipping itself still waits for a person.
12
+
10
13
  ## 1. Prepare the server, once (and again when settings or processes change)
11
14
 
12
15
  1. A plain Ubuntu server (24.04 or later) you reach by SSH with a key, for this product alone: setup and deploy take its ports (80, 443, the web app's, the API's, Postgres, Redis) and setup its firewall and SSH settings, so both refuse a server that runs another product (another `/srv/<name>`), naming it.
@@ -15,7 +18,9 @@ A person decides to deploy; an agent prepares and explains, and runs `ape deploy
15
18
  - **Staging or production:** `docs/ARCHITECTURE.md`, "Staging or production for a server of your own?" (`APE_ENV=staging` in its own file, `--env .env.staging`).
16
19
  4. `pnpm ape server setup <user@server> --domain <name> --env <file>` (or `--network-only <address>` for a server only your network reaches; `-i <key>` as `ssh`). It makes the secrets the file lacks and adds them to it: keep a copy of the file offline.
17
20
 
18
- Run setup again after changing the settings file or `processes` in `buffcore.config.ts`, or after an upgrade whose notes say so: until then `ape deploy` refuses, saying what differs.
21
+ On a server the API and each declared process run with `ulimits: { core: 0 }` (no core dumps) unless `hardening.coreDumps` is on, and with `hardening.refuseDebugOptions` each refuses Node's debugging and dump options, setup refusing a settings file whose `NODE_OPTIONS` carries them (`docs/FEATURES.md`).
22
+
23
+ Run setup again after changing the settings file, `processes` or `hardening` in `buffcore.config.ts`, or after an upgrade whose notes say so: until then `ape deploy` refuses, saying what differs.
19
24
 
20
25
  ## 2. Deploy
21
26
 
@@ -38,7 +43,7 @@ The server's Caddy serves all three with HTTPS. The web app is built in the imag
38
43
  What it does, in order, stopping at the first failure:
39
44
  Before building, deploy refuses tracked changes, checks Change and Task trailers on each change branch's own commits through its named merge on main's first-parent history since the server's deployed commit (no history on a first deploy), then runs the product's `pnpm lint`; a failure refuses with exit 2, while `--local` keeps its signed approval check.
40
45
  The trailer check follows `--no-ff` merges of change branches; fast-forward, squash and rebase merges, or a deploy straight from a change branch, aren't checked.
41
- 1. Builds one image from the commit. The image names no server: the console reads its addresses from `/console.json` when it starts, and deploy writes the server's API address into the web app's files, so the same image runs on staging and production.
46
+ 1. Builds one image from the commit. The image names no server: the console reads its addresses from `/console.json` when it starts, and deploy writes the server's API address into the web app's files, so the same image runs on staging and production. Debian packages the API's own programs need (`ssh`, `ffmpeg`) go in `server.systemPackages` in `buffcore.config.ts`: installed in the image, a bad name refused and a package that can't be installed failing the build, and their installed versions in `--json`'s `systemPackages` (`--local` reads them from the approved image; `null` when they can't be read).
42
47
  2. Asks the running image what it reads (`ape migrate reads`), and backs up.
43
48
  3. **Checks the migrations** with the new image (`ape migrate check`): a pending migration that drops or renames a table or column the running release reads, narrows its type or makes it required stops the deploy, nothing migrated (`refused`).
44
49
  4. Migrates, copies the console's and the web app's files, restarts (each old process stopped gracefully, with 30 seconds to finish), checks `/health`, then watches every process (the API, each Node process, each container) for 15 seconds: each must be running, healthy if it has a health check, and not restarting.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ape-design-system
3
- description: "Keep a product's design system in design/: its written contract (DESIGN.md: direction, voice and tone, color, type, components, layout, do's and don'ts; manifest.json), its theme, its own components and their showcase; the five directions; ape design check (the contract, no raw colors, fonts or sizes, only design-system components, a showcase scene for each), ape design diff against a commit, the hash in the snapshot, ape-critique after a look change; a new component as its own change."
3
+ description: "The design system in design/: DESIGN.md with voice and tone, the five directions, theme, components, showcase, design check and diff. Use when choosing or changing the look, or adding a component."
4
4
  ---
5
5
 
6
6
  # The design system
@@ -22,17 +22,11 @@ A product's look and words live in one folder, `design/`, at its root (THEMING_A
22
22
 
23
23
  **DESIGN.md stays a contract.** It holds the rules every screen follows, not specs for one screen: `Components` says what each component is for and how it behaves, never where it sits on a given screen or its pixel sizes there. A screen's detail lives in its view and scene; when words are still needed, they go in `design/screens.md` under that screen's `## ` heading, so agents read only the screen they change. `ape design check` warns, without failing, when DESIGN.md passes about 40 KB or one of its sections about 15 KB.
24
24
 
25
- ## Reference study
26
-
27
- Before choosing a direction, study real products. If the person already gave a brand or a study (a folder or file they point to), read that instead and skip the capture.
25
+ Done when each file in the table that the product needs exists and `pnpm ape design check` passes.
28
26
 
29
- 1. **Collect pictures.** About 10 to 25 products: the ones the product's buyers already use, and modern products they admire. Take each at a computer width (1440) and a phone width (390), plus one inner page.
30
- 2. **Capture politely.** Read each site's `robots.txt` first and skip any page it closes. Skip any page behind a bot check or a login; never work around it. Hide cookie banners with CSS rather than clicking them. Note every skip.
31
- 3. **Keep the pictures private.** They stay outside the repository (a folder of the person's, never committed) and are never published.
32
- 4. **Write `design/references.md`** from the pictures, and keep it: what buyers expect (the patterns that repeat), what they admire, what looks dated, and the gap this product can own; then each picture's path on this computer and what it shows (`~/refs/acme/home-1440.png`: a calm dashboard, one number first; a path in backticks or as a link), never the pictures themselves. `ape-prototype` reads it before drawing and `ape-critique` looks there first for references; `ape design check` notes a listed path that no longer exists. The studio shows its pictures beside the comp (the three deciding screens `ape-prototype` draws first), in the order listed: any path in `ape ui` on your own computer; under a host, only pictures inside the product's folder (others show a placeholder).
33
- 5. **The comp settles the look.** After the theme and before the scenes, `ape-prototype` draws the comp; once a person approves it, the scenes and the critique follow it. A later change to the look is a new comp to approve.
27
+ ## Reference study
34
28
 
35
- Learn patterns; copy no brand. No logo, name, color or layout is lifted from a single product.
29
+ Before choosing a direction, study about 10 to 25 real products, politely and privately, and write `design/references.md` from the pictures: the steps and rules are in `references/reference-study.md`. If the person already gave a brand or a study, read that instead. Learn patterns; copy no brand. Done when `design/references.md` exists and `pnpm ape design check` notes no missing picture.
36
30
 
37
31
  ## Choose a direction
38
32
 
@@ -44,14 +38,12 @@ Five original starting directions are in `references/directions/`: **Clear and c
44
38
 
45
39
  The template's `design/DESIGN.md` is Clear and calm. A direction is a starting point, not a straitjacket: the product's own direction wins, written down in the same sections.
46
40
 
41
+ Ask the person in rounds, as `ape-plan-change` says under "Questions in rounds": every choice ready to decide, numbered, each with your recommendation.
42
+
47
43
 
48
44
  ## Set it up by hand
49
45
 
50
- 0. **The contract.** Write `design/DESIGN.md` with the sections (Direction; Voice, tone and character; Visual theme; Color roles; Typography; Components; Layout; Motion; Depth; Do's and don'ts; Agent guide), or start from a direction and make it the product's. Write `design/manifest.json`: `schemaVersion` `buffcore-design-system/v1`, `id` the product's name (the `package.json` name), `name`, `source` (`type` and `origin`), and `files` (`design: DESIGN.md`, `theme: theme.ts`). `pnpm ape design check` holds both.
51
- 1. **The theme.** In `design/theme.ts`, `export const theme = extendTheme(themes.neutral, { key: 'myapp', label: 'MyApp', color: { light: { … }, dark: { … } } })` (`extendTheme` and `themes` from `@buffcore/tokens`; THEMING_AND_UI.md, "Themes"). Give only what makes it yours. A brand color is the eight `brand-*` colors together (`brand-solid`, `brand-hover`, `brand-pressed`, `brand-on-solid`, `brand-tint`, `brand-tint-strong`, `brand-ink`, `brand-border`) and `text-link`, in `light` and `dark`, each `#rrggbb`. Nothing derives the nine from one color yet (the brand ramp generator comes with `orgs`), so choose them by Neutral's pattern (print it: `themes.neutral.color.light` and `.dark`). Light: `brand-solid` is the main color under a white `brand-on-solid`, `brand-hover` and `brand-pressed` two darker steps of it, `brand-tint` and `brand-tint-strong` its two palest washes, `brand-ink` about as dark as `brand-hover`, `brand-border` a mid-light step, and `text-link` the same as `brand-solid`. Dark flips it: `brand-solid` and `text-link` a light step, `brand-hover` and `brand-pressed` lighter still under a dark `brand-on-solid`, the tints dark washes, `brand-ink` light, `brand-border` a mid step. Type, shape and space stay the starter's until you give `font`, `radius` and the like. The `contrast` mode (high contrast) stays the starter's until you give `color.contrast` its own. A full `pnpm ape prototype snapshot` checks the theme in every mode and names each token that fails (text on its ground 4.5:1, 7:1 in `contrast`; `brand-solid` 60° of hue from `success-solid`).
52
- 2. **A component** in `design/components/<Name>.tsx`, and every word a prop. In the app it reads the theme as `@buffcore/ui` does: `StyleSheet.create((theme) => ({ … theme.color['surface-panel'], theme.space['space-3'], theme.radius['radius-panel'] … }))` from `react-native-unistyles`, with `Text` and the rest from `@buffcore/ui`. In the console it uses the CSS variables (`var(--surface-panel)`, `var(--space-3)`).
53
- 3. **Its showcase view,** `<Name>Showcase` in `design/components/<Name>.showcase.tsx`: a caption above each state. BuffCore's own `Board`, `State` and `Row` aren't exported, so write them plain. In the app, put the states inside `AppFrame` and `Page` from `@buffcore/ui`, which paint the page (a bare `View` has no background, and dark mode fails the contrast check); in the console, a `div` with `background: 'var(--surface-canvas)'`. The showcase's words go through `t()`, with their keys in the surface's catalog (`apps/app/src/i18n/en.ts` and each language beside it, `apps/admin/src/i18n/`): `design/` has no catalog of its own.
54
- 4. **Show it:** the view in the surface's `src/prototype/views.ts` and its scene in `design/showcase.ts` (the checks, below), then the snapshot (the `ape-prototype` skill).
46
+ Without the studio, write the contract and `design/manifest.json`, the theme, each component and its showcase view, in the steps of `references/by-hand.md`. Done when `pnpm ape design check` passes.
55
47
 
56
48
  ## The checks
57
49
 
@@ -71,15 +63,21 @@ Draw the small visual inside a 44 px hit area, for example a 24 px icon inside a
71
63
 
72
64
  `ape design check` gives advisory hints on the tells listed in `THEMING_AND_UI.md` under “The design system”.
73
65
 
66
+ Done when `pnpm ape design check` exits 0.
67
+
74
68
  ## The critique
75
69
 
76
70
  When a look changes, run `ape-critique` after the snapshot passes. It scores Look from the screenshots before reading the contract, then reviews the other six dimensions and reports Keep / Fix / Quick wins. Take the fixes back through this skill, the snapshot and the critique.
77
71
 
72
+ Done when `design/critique.md` marks no open P0.
73
+
78
74
  ## The hash and the diff
79
75
 
80
76
  - **The hash** is a sha256 over the tokens, resolved in every theme and mode the snapshot checks, and the sources in `design/components/`. `pnpm ape prototype snapshot` writes it into `report.json`, and the tokens and component hashes into `design.json` beside it: commit both.
81
77
  - **`pnpm ape design diff --against <commit>`** compares the design system now with that commit's (the `design.json` of its newest snapshot): the tokens changed per theme and mode, the component files added, changed or removed, and the scenes they reach. A component reaches the scenes whose views import it. A token reaches the scenes whose views' files name it; a token no file of the product names is read by BuffCore's components, so it reaches every scene.
82
78
 
79
+ Done when the snapshot's `report.json` and `design.json` are committed with the change.
80
+
83
81
  ## A new component, as its own change
84
82
 
85
83
  A component enters the design system before a screen uses it, in a change of its own (`type: design` in `plan/changes/`, the `ape-plan-change` skill):
@@ -90,3 +88,5 @@ A component enters the design system before a screen uses it, in a change of its
90
88
  4. Commit with the snapshot's `report.json`, `data.json` and `design.json`; the commit is approved like any look. Then the screens use it, in their own change.
91
89
 
92
90
  A component BuffCore lacks that any product would need the same way is a request to BuffCore (the `ape-request` skill), not a product component.
91
+
92
+ Done when its commit holds the component, its showcase scene and the passing snapshot's report.
@@ -0,0 +1,7 @@
1
+ # Set it up by hand
2
+
3
+ 0. **The contract.** Write `design/DESIGN.md` with the sections (Direction; Voice, tone and character; Visual theme; Color roles; Typography; Components; Layout; Motion; Depth; Do's and don'ts; Agent guide), or start from a direction and make it the product's. Write `design/manifest.json`: `schemaVersion` `buffcore-design-system/v1`, `id` the product's name (the `package.json` name), `name`, `source` (`type` and `origin`), and `files` (`design: DESIGN.md`, `theme: theme.ts`). `pnpm ape design check` holds both.
4
+ 1. **The theme.** In `design/theme.ts`, `export const theme = extendTheme(themes.neutral, { key: 'myapp', label: 'MyApp', color: { light: { … }, dark: { … } } })` (`extendTheme` and `themes` from `@buffcore/tokens`; THEMING_AND_UI.md, "Themes"). Give only what makes it yours. A brand color is the eight `brand-*` colors together (`brand-solid`, `brand-hover`, `brand-pressed`, `brand-on-solid`, `brand-tint`, `brand-tint-strong`, `brand-ink`, `brand-border`) and `text-link`, in `light` and `dark`, each `#rrggbb`. Nothing derives the nine from one color yet (the brand ramp generator comes with `orgs`), so choose them by Neutral's pattern (print it: `themes.neutral.color.light` and `.dark`). Light: `brand-solid` is the main color under a white `brand-on-solid`, `brand-hover` and `brand-pressed` two darker steps of it, `brand-tint` and `brand-tint-strong` its two palest washes, `brand-ink` about as dark as `brand-hover`, `brand-border` a mid-light step, and `text-link` the same as `brand-solid`. Dark flips it: `brand-solid` and `text-link` a light step, `brand-hover` and `brand-pressed` lighter still under a dark `brand-on-solid`, the tints dark washes, `brand-ink` light, `brand-border` a mid step. Type, shape and space stay the starter's until you give `font`, `radius` and the like. The `contrast` mode (high contrast) stays the starter's until you give `color.contrast` its own. A full `pnpm ape prototype snapshot` checks the theme in every mode and names each token that fails (text on its ground 4.5:1, 7:1 in `contrast`; `brand-solid` 60° of hue from `success-solid`).
5
+ 2. **A component** in `design/components/<Name>.tsx`, and every word a prop. In the app it reads the theme as `@buffcore/ui` does: `StyleSheet.create((theme) => ({ … theme.color['surface-panel'], theme.space['space-3'], theme.radius['radius-panel'] … }))` from `react-native-unistyles`, with `Text` and the rest from `@buffcore/ui`. In the console it uses the CSS variables (`var(--surface-panel)`, `var(--space-3)`).
6
+ 3. **Its showcase view,** `<Name>Showcase` in `design/components/<Name>.showcase.tsx`: a caption above each state. BuffCore's own `Board`, `State` and `Row` aren't exported, so write them plain. In the app, put the states inside `AppFrame` and `Page` from `@buffcore/ui`, which paint the page (a bare `View` has no background, and dark mode fails the contrast check); in the console, a `div` with `background: 'var(--surface-canvas)'`. The showcase's words go through `t()`, with their keys in the surface's catalog (`apps/app/src/i18n/en.ts` and each language beside it, `apps/admin/src/i18n/`): `design/` has no catalog of its own.
7
+ 4. **Show it:** the view in the surface's `src/prototype/views.ts` and its scene in `design/showcase.ts` (the checks, below), then the snapshot (the `ape-prototype` skill).
@@ -0,0 +1,11 @@
1
+ # Reference study
2
+
3
+ Before choosing a direction, study real products. If the person already gave a brand or a study (a folder or file they point to), read that instead and skip the capture.
4
+
5
+ 1. **Collect pictures.** About 10 to 25 products: the ones the product's buyers already use, and modern products they admire. Take each at a computer width (1440) and a phone width (390), plus one inner page.
6
+ 2. **Capture politely.** Read each site's `robots.txt` first and skip any page it closes. Skip any page behind a bot check or a login; never work around it. Hide cookie banners with CSS rather than clicking them. Note every skip.
7
+ 3. **Keep the pictures private.** They stay outside the repository (a folder of the person's, never committed) and are never published.
8
+ 4. **Write `design/references.md`** from the pictures, and keep it: what buyers expect (the patterns that repeat), what they admire, what looks dated, and the gap this product can own; then each picture's path on this computer and what it shows (`~/refs/acme/home-1440.png`: a calm dashboard, one number first; a path in backticks or as a link), never the pictures themselves. `ape-prototype` reads it before drawing and `ape-critique` looks there first for references; `ape design check` notes a listed path that no longer exists. The studio shows its pictures beside the comp (the three deciding screens `ape-prototype` draws first), in the order listed: any path in `ape ui` on your own computer; under a host, only pictures inside the product's folder (others show a placeholder).
9
+ 5. **The comp settles the look.** After the theme and before the scenes, `ape-prototype` draws the comp; once a person approves it, the scenes and the critique follow it. A later change to the look is a new comp to approve.
10
+
11
+ Learn patterns; copy no brand. No logo, name, color or layout is lifted from a single product.