@buffcore/cli 0.8.48 → 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.
- package/CHANGELOG.md +34 -0
- package/dist/commands/change-merge-serial.d.ts +6 -2
- package/dist/commands/change-merge-serial.js +5 -1
- package/dist/commands/change.js +3 -0
- package/dist/commands/check-skills.d.ts +16 -0
- package/dist/commands/check-skills.en.d.ts +14 -0
- package/dist/commands/check-skills.en.js +14 -0
- package/dist/commands/check-skills.es.d.ts +2 -0
- package/dist/commands/check-skills.es.js +14 -0
- package/dist/commands/check-skills.js +146 -0
- package/dist/commands/check.js +5 -0
- package/dist/commands/extension/config-text.d.ts +2 -0
- package/dist/commands/extension/config-text.js +2 -0
- package/dist/commands/extension/index.js +14 -2
- package/dist/commands/extension/new.d.ts +16 -0
- package/dist/commands/extension/new.js +52 -0
- package/dist/commands/extension/pack-files.d.ts +23 -0
- package/dist/commands/extension/pack-files.js +78 -0
- package/dist/commands/extension/pack-scan.d.ts +24 -0
- package/dist/commands/extension/pack-scan.js +131 -0
- package/dist/commands/extension/pack.d.ts +48 -0
- package/dist/commands/extension/pack.js +142 -0
- package/dist/commands/extension/share-text.d.ts +3 -0
- package/dist/commands/extension/share-text.js +6 -0
- package/dist/commands/extension/share.en.d.ts +32 -0
- package/dist/commands/extension/share.en.js +32 -0
- package/dist/commands/extension/share.es.d.ts +2 -0
- package/dist/commands/extension/share.es.js +32 -0
- package/dist/commands/server/setup.d.ts +1 -0
- package/dist/commands/ui/index.d.ts +1 -0
- package/dist/commands/ui/outside-merge.d.ts +13 -0
- package/dist/commands/ui/outside-merge.js +84 -0
- package/dist/commands/ui/outside.d.ts +7 -4
- package/dist/commands/ui/outside.js +3 -0
- package/dist/commands/ui/plan-extensions.d.ts +34 -0
- package/dist/commands/ui/plan-extensions.en.d.ts +4 -0
- package/dist/commands/ui/plan-extensions.en.js +4 -0
- package/dist/commands/ui/plan-extensions.es.d.ts +2 -0
- package/dist/commands/ui/plan-extensions.es.js +4 -0
- package/dist/commands/ui/plan-extensions.js +86 -0
- package/dist/commands/ui/plan-files.js +4 -1
- package/dist/commands/ui/prototype-main.d.ts +6 -0
- package/dist/commands/ui/studio-routes.js +2 -0
- package/dist/commands/ui/studio-state.d.ts +7 -0
- package/dist/commands/ui/studio.en.d.ts +2 -0
- package/dist/commands/ui/studio.en.js +2 -0
- package/dist/commands/ui/studio.es.d.ts +2 -0
- package/dist/commands/ui/studio.es.js +2 -0
- package/dist/commands/upgrade.js +1 -1
- package/dist/ui/page.js +82 -82
- package/docs/EXTENSIONS.md +6 -0
- package/docs/WORKBENCH.md +25 -2
- package/package.json +11 -11
- package/skills/ape-add-ai-purpose/SKILL.md +1 -1
- package/skills/ape-add-event/SKILL.md +1 -1
- package/skills/ape-add-extension/SKILL.md +5 -1
- package/skills/ape-add-feature/SKILL.md +1 -1
- package/skills/ape-add-generator/SKILL.md +1 -1
- package/skills/ape-add-module/SKILL.md +1 -1
- package/skills/ape-add-route/SKILL.md +3 -1
- package/skills/ape-add-service/SKILL.md +1 -1
- package/skills/ape-add-translations/SKILL.md +2 -2
- package/skills/ape-admin-screen/SKILL.md +1 -1
- package/skills/ape-app-screen/SKILL.md +1 -1
- package/skills/ape-critique/SKILL.md +11 -32
- package/skills/ape-critique/references/after.md +15 -0
- package/skills/ape-critique/references/spacing-pass.md +20 -0
- package/skills/ape-deploy/SKILL.md +4 -1
- package/skills/ape-design-system/SKILL.md +15 -15
- package/skills/ape-design-system/references/by-hand.md +7 -0
- package/skills/ape-design-system/references/reference-study.md +11 -0
- package/skills/ape-diagnose/SKILL.md +24 -0
- package/skills/ape-migration/SKILL.md +1 -1
- package/skills/ape-plan-change/SKILL.md +37 -31
- package/skills/ape-plan-change/references/change-file-fields.md +5 -0
- package/skills/ape-plan-change/references/extensions.md +25 -0
- package/skills/ape-plan-change/references/finishing.md +3 -0
- package/skills/ape-plan-change/references/fix-from-error.md +3 -0
- package/skills/ape-plan-change/references/refactor.md +9 -0
- package/skills/ape-plan-change/references/structure.md +19 -0
- package/skills/ape-prototype/SKILL.md +13 -23
- package/skills/ape-prototype/references/comp.md +3 -0
- package/skills/ape-prototype/references/scope-and-export.md +5 -0
- package/skills/ape-prototype/references/snapshot.md +3 -0
- package/skills/ape-prototype/references/structure.md +11 -0
- package/skills/ape-prototype/references/working-app.md +7 -0
- package/skills/ape-request/SKILL.md +1 -1
- package/skills/ape-upgrade/SKILL.md +4 -1
- package/templates/product/package.json +1 -1
package/docs/EXTENSIONS.md
CHANGED
|
@@ -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/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
|
|
831
|
-
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buffcore/cli",
|
|
3
|
-
"version": "0.8.
|
|
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/
|
|
49
|
-
"@buffcore/
|
|
50
|
-
"@buffcore/
|
|
51
|
-
"@buffcore/modules": "0.8.
|
|
52
|
-
"@buffcore/
|
|
53
|
-
"@buffcore/
|
|
54
|
-
"@buffcore/db": "0.8.
|
|
55
|
-
"@buffcore/tokens": "0.8.
|
|
56
|
-
"@buffcore/storage": "0.8.
|
|
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.
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
-
|
|
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: "
|
|
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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ape-design-system
|
|
3
|
-
description: "
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ape-diagnose
|
|
3
|
+
description: "Diagnosing a bug: a failing command first, a cut-down case, hypotheses, tagged logs, a regression test. Use when something is broken, an error repeats, or recent_errors shows a group."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnose a bug
|
|
7
|
+
|
|
8
|
+
A gated loop: each gate ends with something you can check, and the next starts only when it holds. Work on the development server with seed data and sandbox keys, never on production.
|
|
9
|
+
|
|
10
|
+
## Where the bug is seen
|
|
11
|
+
|
|
12
|
+
- From the running product: the `ape mcp` tool `recent_errors` lists the recent error groups (scrubbed), each with its id, where it happened, how often, since when and its latest stack. Pick the group the report points at.
|
|
13
|
+
- Once you know which group it is, `change_from_error` with that `group` (or `pnpm ape change new --from-error <group>`) writes the `fix` change file in `plan/changes/`; build the fix on that change's branch (`ape-plan-change`). A second ask for the same group returns the same file.
|
|
14
|
+
|
|
15
|
+
## The gates
|
|
16
|
+
|
|
17
|
+
1. **A command that fails because of the bug.** First write the one command that shows it: a test (`pnpm --filter <package> test -- <file>`), a script or a request that fails now. No guessing at causes before it exists. Done when the command fails, and fails for this bug, not for another reason.
|
|
18
|
+
2. **Cut the case down.** Remove data, steps, screens and settings one at a time while the command still fails, until every part left matters: take any one away and it passes. Done when the case is that small and still fails.
|
|
19
|
+
3. **Three to five hypotheses that can be proven wrong.** Write each with the check that would prove it wrong (a value to print, a line to step over, an input to change), then run the checks, cheapest first. Drop each one its check rules out. Done when one hypothesis has survived its check and the others are ruled out, or you have written the next round of three to five.
|
|
20
|
+
4. **Debug logging with one prefix.** Every line you add to look inside is tagged with the same prefix, such as `[diag-C-031]`, so removing them all is one search. Done when a search for the prefix finds none of them before you commit.
|
|
21
|
+
5. **A regression test that fails before the fix and passes after.** Turn the cut-down case into a test beside the code. Run it without the fix (it fails), then with it (it passes). Done when both runs are seen and the change's `doneWhen` checks pass (`pnpm ape change <id> --check`).
|
|
22
|
+
6. **Secrets redacted in anything quoted.** In the change file, a commit message, a report or a test fixture, quote logs, stacks and requests with tokens, passwords, keys, cookies, email addresses and phone numbers replaced by `<redacted>`; refer to a person by ID only. Done when nothing quoted holds a secret or a person's details.
|
|
23
|
+
|
|
24
|
+
When the loop needs the owner (a behavior the brief does not settle, or a fix that changes what people see), ask in a round, as `ape-plan-change` says under "Questions in rounds".
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ape-migration
|
|
3
|
-
description: "
|
|
3
|
+
description: "Database migrations: change entities, generate, review up and down, round-trip. Use when creating or changing tables."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Migrations
|