@buffcore/cli 0.8.46 → 0.8.48
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 +74 -0
- package/dist/commands/build/server-text.en.d.ts +5 -0
- package/dist/commands/build/server-text.en.js +5 -0
- package/dist/commands/build/server-text.js +5 -0
- package/dist/commands/build/server.d.ts +4 -0
- package/dist/commands/build/server.js +10 -1
- package/dist/commands/change-merge-remove.d.ts +9 -2
- package/dist/commands/change-merge-remove.js +27 -15
- package/dist/commands/change-merge.d.ts +2 -2
- package/dist/commands/design/check.d.ts +1 -1
- package/dist/commands/design/check.js +2 -1
- package/dist/commands/design/contract-size.d.ts +7 -0
- package/dist/commands/design/contract-size.js +47 -0
- package/dist/commands/design/tells.en.d.ts +2 -0
- package/dist/commands/design/tells.en.js +2 -0
- package/dist/commands/design/tells.es.js +2 -0
- package/dist/commands/dev.d.ts +9 -2
- package/dist/commands/dev.js +24 -5
- package/dist/commands/extension/places-approval.d.ts +4 -0
- package/dist/commands/hardening.d.ts +3 -0
- package/dist/commands/hardening.en.d.ts +3 -0
- package/dist/commands/hardening.en.js +3 -0
- package/dist/commands/hardening.es.d.ts +2 -0
- package/dist/commands/hardening.es.js +3 -0
- package/dist/commands/hardening.js +19 -0
- package/dist/commands/process-paths.d.ts +14 -0
- package/dist/commands/process-paths.js +90 -0
- package/dist/commands/prototype/ai-approval.d.ts +27 -0
- package/dist/commands/prototype/ai-approval.js +60 -0
- package/dist/commands/prototype/approver.d.ts +71 -0
- package/dist/commands/prototype/approver.js +168 -0
- package/dist/commands/prototype/comp-record.d.ts +5 -0
- package/dist/commands/prototype/comp-record.js +22 -0
- package/dist/commands/prototype/critique-gate.d.ts +14 -0
- package/dist/commands/prototype/critique-gate.js +48 -0
- package/dist/commands/prototype/fence.d.ts +1 -0
- package/dist/commands/prototype/fence.js +12 -0
- package/dist/commands/prototype/final-approval-grant.js +18 -0
- package/dist/commands/prototype/final-approval.js +4 -1
- package/dist/commands/prototype/index.js +3 -0
- package/dist/commands/prototype/layout-hints.d.ts +34 -0
- package/dist/commands/prototype/layout-hints.js +194 -0
- package/dist/commands/prototype/layout-measure.d.ts +39 -0
- package/dist/commands/prototype/layout-measure.js +97 -0
- package/dist/commands/prototype/layout-words.d.ts +2 -0
- package/dist/commands/prototype/layout-words.js +11 -0
- package/dist/commands/prototype/layout.en.d.ts +6 -0
- package/dist/commands/prototype/layout.en.js +7 -0
- package/dist/commands/prototype/load-location.js +2 -3
- package/dist/commands/prototype/messages.en.d.ts +14 -0
- package/dist/commands/prototype/messages.en.js +15 -1
- package/dist/commands/prototype/messages.js +15 -1
- package/dist/commands/prototype/milestone-versions.d.ts +4 -0
- package/dist/commands/prototype/prune-command.d.ts +5 -0
- package/dist/commands/prototype/prune-command.js +25 -0
- package/dist/commands/prototype/prune-words.d.ts +1 -0
- package/dist/commands/prototype/prune-words.js +7 -0
- package/dist/commands/prototype/prune.d.ts +16 -0
- package/dist/commands/prototype/prune.en.d.ts +9 -0
- package/dist/commands/prototype/prune.en.js +9 -0
- package/dist/commands/prototype/prune.es.d.ts +2 -0
- package/dist/commands/prototype/prune.es.js +9 -0
- package/dist/commands/prototype/prune.js +140 -0
- package/dist/commands/prototype/reopen-messages.d.ts +9 -0
- package/dist/commands/prototype/reopen-messages.js +19 -0
- package/dist/commands/prototype/report.d.ts +14 -0
- package/dist/commands/prototype/report.js +5 -1
- package/dist/commands/prototype/scene-layout.d.ts +17 -0
- package/dist/commands/prototype/scene-layout.js +57 -0
- package/dist/commands/prototype/scene-ready.js +8 -2
- package/dist/commands/prototype/scene.d.ts +15 -2
- package/dist/commands/prototype/scene.js +54 -42
- package/dist/commands/prototype/selector-answer.d.ts +43 -0
- package/dist/commands/prototype/selector-answer.js +73 -0
- package/dist/commands/prototype/selector-misses.d.ts +19 -0
- package/dist/commands/prototype/selector-misses.js +78 -0
- package/dist/commands/prototype/selector-prompt.d.ts +23 -0
- package/dist/commands/prototype/selector-prompt.js +32 -0
- package/dist/commands/prototype/selector-run.d.ts +13 -0
- package/dist/commands/prototype/selector-run.js +113 -0
- package/dist/commands/prototype/selector.d.ts +54 -0
- package/dist/commands/prototype/selector.js +96 -0
- package/dist/commands/prototype/snapshot-ancestor.js +2 -0
- package/dist/commands/prototype/snapshot-bundle.d.ts +17 -3
- package/dist/commands/prototype/snapshot-bundle.js +69 -7
- package/dist/commands/prototype/snapshot-check-files.d.ts +2 -0
- package/dist/commands/prototype/snapshot-check-files.js +41 -0
- package/dist/commands/prototype/snapshot-command.d.ts +2 -0
- package/dist/commands/prototype/snapshot-command.js +3 -0
- package/dist/commands/prototype/snapshot-completion.d.ts +4 -0
- package/dist/commands/prototype/snapshot-completion.js +30 -2
- package/dist/commands/prototype/snapshot-dependencies.d.ts +23 -2
- package/dist/commands/prototype/snapshot-dependencies.js +120 -14
- package/dist/commands/prototype/snapshot-hashes.d.ts +7 -0
- package/dist/commands/prototype/snapshot-hashes.js +28 -0
- package/dist/commands/prototype/snapshot-inputs.d.ts +15 -6
- package/dist/commands/prototype/snapshot-inputs.js +140 -197
- package/dist/commands/prototype/snapshot-matrix.d.ts +58 -0
- package/dist/commands/prototype/snapshot-matrix.js +95 -0
- package/dist/commands/prototype/snapshot-metro-inputs.d.ts +8 -0
- package/dist/commands/prototype/snapshot-metro-inputs.js +81 -0
- package/dist/commands/prototype/snapshot-owners.d.ts +6 -2
- package/dist/commands/prototype/snapshot-owners.js +12 -3
- package/dist/commands/prototype/snapshot-progress-entry.d.ts +14 -0
- package/dist/commands/prototype/snapshot-progress-entry.js +85 -0
- package/dist/commands/prototype/snapshot-progress.d.ts +19 -2
- package/dist/commands/prototype/snapshot-progress.js +54 -102
- package/dist/commands/prototype/snapshot-registry.d.ts +14 -0
- package/dist/commands/prototype/snapshot-registry.js +121 -0
- package/dist/commands/prototype/snapshot-report.d.ts +4 -0
- package/dist/commands/prototype/snapshot-report.js +77 -12
- package/dist/commands/prototype/snapshot-requests.d.ts +13 -3
- package/dist/commands/prototype/snapshot-requests.js +68 -30
- package/dist/commands/prototype/snapshot-reuse.d.ts +6 -1
- package/dist/commands/prototype/snapshot-reuse.js +17 -7
- package/dist/commands/prototype/snapshot-scene-inputs.d.ts +30 -0
- package/dist/commands/prototype/snapshot-scene-inputs.js +210 -0
- package/dist/commands/prototype/snapshot-served-inputs.d.ts +3 -0
- package/dist/commands/prototype/snapshot-served-inputs.js +12 -0
- package/dist/commands/prototype/snapshot-server-record.d.ts +26 -0
- package/dist/commands/prototype/snapshot-server-record.js +135 -0
- package/dist/commands/prototype/snapshot-servers.d.ts +3 -1
- package/dist/commands/prototype/snapshot-servers.js +50 -2
- package/dist/commands/prototype/snapshot-setup.d.ts +3 -1
- package/dist/commands/prototype/snapshot-setup.js +2 -1
- package/dist/commands/prototype/snapshot-surface-inputs.d.ts +23 -0
- package/dist/commands/prototype/snapshot-surface-inputs.js +161 -0
- package/dist/commands/prototype/snapshot-vite-inputs.d.ts +22 -0
- package/dist/commands/prototype/snapshot-vite-inputs.js +209 -0
- package/dist/commands/prototype/snapshot.d.ts +5 -0
- package/dist/commands/prototype/snapshot.js +72 -10
- package/dist/commands/prototype/version-commands.d.ts +4 -0
- package/dist/commands/prototype/version-commands.js +36 -8
- package/dist/commands/prototype/versions.d.ts +28 -2
- package/dist/commands/prototype/versions.js +25 -1
- package/dist/commands/prototype/vite-fs-path.d.ts +4 -0
- package/dist/commands/prototype/vite-fs-path.js +15 -0
- package/dist/commands/remove-links.d.ts +6 -0
- package/dist/commands/remove-links.js +17 -0
- package/dist/commands/server/build.d.ts +2 -1
- package/dist/commands/server/build.js +10 -2
- package/dist/commands/server/deploy-local.d.ts +3 -0
- package/dist/commands/server/deploy-local.js +9 -0
- package/dist/commands/server/deploy-plan.d.ts +5 -0
- package/dist/commands/server/deploy-plan.js +56 -0
- package/dist/commands/server/deploy-result.d.ts +7 -0
- package/dist/commands/server/deploy-result.js +1 -0
- package/dist/commands/server/deploy-script.d.ts +2 -0
- package/dist/commands/server/deploy-script.js +3 -2
- package/dist/commands/server/deploy.d.ts +9 -6
- package/dist/commands/server/deploy.js +39 -61
- package/dist/commands/server/files.d.ts +9 -1
- package/dist/commands/server/files.js +25 -5
- package/dist/commands/server/image.d.ts +4 -2
- package/dist/commands/server/image.js +6 -5
- package/dist/commands/server/setup.js +4 -0
- package/dist/commands/server/system-packages.d.ts +29 -0
- package/dist/commands/server/system-packages.js +103 -0
- package/dist/commands/services/compose.d.ts +1 -1
- package/dist/commands/services/compose.js +5 -3
- package/dist/commands/size-docs.d.ts +9 -0
- package/dist/commands/size-docs.en.d.ts +6 -0
- package/dist/commands/size-docs.en.js +6 -0
- package/dist/commands/size-docs.es.d.ts +2 -0
- package/dist/commands/size-docs.es.js +6 -0
- package/dist/commands/size-docs.js +28 -0
- package/dist/commands/size.d.ts +5 -2
- package/dist/commands/size.js +27 -9
- package/dist/commands/ui/agents-route.js +2 -0
- package/dist/commands/ui/approval-authority.d.ts +10 -2
- package/dist/commands/ui/approval-authority.en.d.ts +1 -0
- package/dist/commands/ui/approval-authority.en.js +1 -0
- package/dist/commands/ui/approval-authority.es.d.ts +1 -0
- package/dist/commands/ui/approval-authority.es.js +1 -0
- package/dist/commands/ui/approval-authority.js +8 -2
- package/dist/commands/ui/approve.js +2 -4
- package/dist/commands/ui/autopilot-ai-approve.d.ts +18 -0
- package/dist/commands/ui/autopilot-ai-approve.js +68 -0
- package/dist/commands/ui/autopilot-loop.js +5 -6
- package/dist/commands/ui/autopilot-merge.js +3 -0
- package/dist/commands/ui/autopilot-records.d.ts +2 -0
- package/dist/commands/ui/autopilot-records.js +5 -0
- package/dist/commands/ui/autopilot.en.d.ts +23 -0
- package/dist/commands/ui/autopilot.en.js +23 -0
- package/dist/commands/ui/autopilot.es.d.ts +23 -0
- package/dist/commands/ui/autopilot.es.js +23 -0
- package/dist/commands/ui/brand-approval.js +5 -1
- package/dist/commands/ui/chat/find.d.ts +2 -0
- package/dist/commands/ui/chat/find.js +13 -0
- package/dist/commands/ui/chat/fresh-codex.d.ts +39 -0
- package/dist/commands/ui/chat/fresh-codex.js +175 -0
- package/dist/commands/ui/chat/fresh-critique.js +13 -5
- package/dist/commands/ui/chat/fresh-launch.d.ts +19 -0
- package/dist/commands/ui/chat/fresh-launch.js +67 -11
- package/dist/commands/ui/chat/fresh-prompts.d.ts +2 -0
- package/dist/commands/ui/chat/fresh-prompts.js +2 -0
- package/dist/commands/ui/chat/fresh-secrets.d.ts +6 -0
- package/dist/commands/ui/chat/fresh-secrets.js +172 -0
- package/dist/commands/ui/chat/fresh.en.d.ts +1 -0
- package/dist/commands/ui/chat/fresh.en.js +2 -1
- package/dist/commands/ui/chat/fresh.es.d.ts +1 -0
- package/dist/commands/ui/chat/fresh.es.js +2 -1
- package/dist/commands/ui/chat/permissions.js +1 -1
- package/dist/commands/ui/chat/routes.js +4 -0
- package/dist/commands/ui/chat/worktree.js +25 -5
- package/dist/commands/ui/comp-approval.d.ts +14 -2
- package/dist/commands/ui/comp-approval.js +45 -8
- package/dist/commands/ui/index.js +3 -0
- package/dist/commands/ui/level-route.js +3 -0
- package/dist/commands/ui/loop-approve.d.ts +30 -1
- package/dist/commands/ui/loop-approve.js +2 -2
- package/dist/commands/ui/merge-authority.d.ts +4 -1
- package/dist/commands/ui/merge-authority.en.d.ts +4 -0
- package/dist/commands/ui/merge-authority.en.js +5 -1
- package/dist/commands/ui/merge-authority.es.d.ts +4 -0
- package/dist/commands/ui/merge-authority.es.js +5 -1
- package/dist/commands/ui/merge-authority.js +6 -3
- package/dist/commands/ui/merge-claims.d.ts +7 -0
- package/dist/commands/ui/merge-claims.js +21 -0
- package/dist/commands/ui/merge-delegation.js +8 -3
- package/dist/commands/ui/merge-hold-name.d.ts +5 -0
- package/dist/commands/ui/merge-hold-name.js +5 -0
- package/dist/commands/ui/merge-hold.d.ts +6 -1
- package/dist/commands/ui/merge-hold.js +23 -5
- package/dist/commands/ui/merge-publish-host.d.ts +1 -0
- package/dist/commands/ui/merge-publish-host.js +2 -2
- package/dist/commands/ui/merge-record.d.ts +2 -0
- package/dist/commands/ui/merge-record.js +1 -1
- package/dist/commands/ui/merge-route.js +20 -1
- package/dist/commands/ui/merge-settle.d.ts +32 -0
- package/dist/commands/ui/merge-settle.js +133 -0
- package/dist/commands/ui/merge-state.d.ts +5 -0
- package/dist/commands/ui/merge-state.js +7 -1
- package/dist/commands/ui/merge-withdraw.d.ts +9 -0
- package/dist/commands/ui/merge-withdraw.js +29 -0
- package/dist/commands/ui/places-change.d.ts +4 -0
- package/dist/commands/ui/plan-files.js +5 -2
- package/dist/commands/ui/plan-structure.js +5 -7
- package/dist/commands/ui/prototype-comp-route.d.ts +12 -3
- package/dist/commands/ui/prototype-comp-route.js +35 -17
- package/dist/commands/ui/prototype-main.d.ts +4 -0
- package/dist/commands/ui/real-file.d.ts +11 -0
- package/dist/commands/ui/real-file.js +84 -0
- package/dist/commands/ui/reopen-route.d.ts +117 -0
- package/dist/commands/ui/reopen-route.js +97 -0
- package/dist/commands/ui/save-route.d.ts +2 -0
- package/dist/commands/ui/save-route.js +8 -1
- package/dist/commands/ui/server.d.ts +1 -0
- package/dist/commands/ui/server.js +1 -0
- package/dist/commands/ui/studio-routes.js +2 -0
- package/dist/commands/ui/studio-state.d.ts +34 -0
- package/dist/commands/ui/studio-versions.d.ts +24 -0
- package/dist/commands/ui/studio-versions.js +19 -3
- package/dist/commands/ui/worktrees.d.ts +1 -1
- package/dist/commands/ui/worktrees.js +19 -3
- package/dist/commands/worktree-sweep.d.ts +45 -0
- package/dist/commands/worktree-sweep.js +188 -0
- package/dist/commands/worktrees-command.d.ts +32 -0
- package/dist/commands/worktrees-command.en.d.ts +25 -0
- package/dist/commands/worktrees-command.en.js +55 -0
- package/dist/commands/worktrees-command.js +96 -0
- package/dist/main.js +2 -0
- package/dist/ui/page.js +89 -89
- package/docs/PROTOTYPE.md +19 -3
- package/docs/WORKBENCH.md +41 -6
- package/package.json +11 -11
- package/skills/ape-critique/SKILL.md +41 -6
- package/skills/ape-deploy/SKILL.md +4 -2
- package/skills/ape-design-system/SKILL.md +3 -0
- package/skills/ape-plan-change/SKILL.md +6 -0
- package/skills/ape-prototype/SKILL.md +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,80 @@ One section per release (a git tag). **Upgrade notes** list anything that breaks
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## v0.8.48 (2026-12-05)
|
|
8
|
+
|
|
9
|
+
- A product may set `hardening` in `buffcore.config.ts`. With `refuseDebugOptions: true` (off by default), the API and each declared Node process refuse to start when Node's debugging or dump options (`--inspect*`, `--debug-port`, the heap snapshot options, `--diagnostic-dir`, `--report-*`) reach them on the command line or in `NODE_OPTIONS`: on a server a small module imported before the entry exits 1 naming the option, with `--disable-sigusr1`, and `ape dev` and `ape server setup` refuse every one of them in the `NODE_OPTIONS` they pass on (the shell's, `.env`'s, the settings file's) before starting anything, since `--inspect-brk` and `--inspect-wait` pause Node before any code runs. A `NODE_OPTIONS` word with a quote or a backslash is refused too. The compose file `ape server setup` writes now runs the API, each declared process and container, and the `ape` tools service with `ulimits: { core: 0 }`, so a crash writes no core dump; `coreDumps: true` keeps Docker's default. The compose file records the `hardening` it was written for, and `ape deploy` refuses a server whose file differs or predates it. Development is unchanged.
|
|
10
|
+
|
|
11
|
+
**Upgrade notes** (every product): run `ape server setup` again before the next deploy: `ape deploy` refuses a server whose compose file predates `hardening`, since it lacks the core-file limit; a product that needs core files sets `hardening: { coreDumps: true }` first.
|
|
12
|
+
|
|
13
|
+
- A product can add Debian system packages to its server image: `server: { systemPackages: ['openssh-client'] }` in `buffcore.config.ts`, for programs its API starts itself. `ape deploy` and `ape build server` install them in the image's last stage before it drops to the API's user, and record the installed versions in their `--json` (`systemPackages`). A name that isn't a Debian package name is refused with a plain sentence before anything is built, and a package that can't be installed fails the build. With no list the image is the same as before.
|
|
14
|
+
|
|
15
|
+
**Upgrade:** nothing to do. A tool that compares the whole `ape deploy --json` or `ape build server --json` line should expect the new `systemPackages` key.
|
|
16
|
+
|
|
17
|
+
- A hosted studio with an approval authority can approve the look. **Approve the look** now asks the host's authority once (`kind: 'comp'`, as for brand, prototype, release and places) and records its grant in `prototype/versions/comp.json` by the studio's own approval commit; it was refused with `approval_authority_invalid` before the host was asked. An agent or an AI approver is still refused. On a hosted studio the comp read shows the look approved only when the host confirms that record (`action: 'check'`), and shows the reason when it does not. The comp's pictures, and the plan, structure, design and version files the studio reads, are read only from a regular file with one link whose real path stays inside the product's folder: a link, junction or hard link leading out, or a folder, is not read. On Linux the check is made on the opened file itself. On Windows and macOS it resolves the path again, so a process that keeps swapping a folder on the path for a link while the studio reads can still slip one file past it; keep the product folder writable only by the people and agents who work on it.
|
|
18
|
+
|
|
19
|
+
**Upgrade notes** (every product): a host whose `approval` hook decides approvals now receives `{ kind: 'comp', version: null, commit, fingerprint }` with `action: 'approve'` and `'check'`. Answer as for the other kinds, with a person's signature only (no `agent`, no `ai`); the studio writes the record itself. The `check` names the commit the record's signature holds (the one checked out when the person approved), not today's HEAD, so key grants by commit and fingerprint. A `comp` rule in `plan/approvals.md` is still refused: the look is one person's approval. A host that refuses `comp` keeps the look unapproved, as before. A comp picture, plan file, `plan/structure.md`, `design/DESIGN.md` or `prototype/versions/*.json` that is a link (or a hard link) to a place outside the product's folder is no longer read: copy the file into the folder.
|
|
20
|
+
|
|
21
|
+
- A host whose `merge` hook answers `pending` for an Autopilot change can now settle it later from its own process: `settleHostMerge(root, { change, head, claim, outcome, code? })` from `@buffcore/cli/workbench`, where `claim` is the new `HostMergeInput.claim`, a secret the host was given with that ask (the studio keeps only its hash). It is accepted only for that exact waiting Autopilot claim (change, head and claim) while the saved level is Autopilot, runs under the same hold and publication lock as `publish`, and for `merged` only when main holds that exact head; the studio's next read records the merge and runs its Snapshot as for a published claim. BuffCore chose this over settling on main alone: since 0.8.27 an Autopilot success must pass the hold, and on a hosted studio the host itself writes main, so main holding the head shows a write happened, not that it respected a person's hold. A waiting merge now shows how long it has waited. A waiting Autopilot claim (not a person's own) ends when a person withdraws it from the merge preview (`POST /api/merge/withdraw`), turns the hold on, leaves Autopilot or presses Stop on the change, unless main already holds it; so a host that never answers cannot hold Autopilot, and Autopilot asks again after its next turn. A settle of any outcome that finds `plan/agents.md` or the hold edited since the ask withdraws the claim the same way, and the merge preview offers Withdraw only on an Autopilot wait (`automatic: true` in `work.merges`). Local studios, a person's own merge and a hook that answers `merged` are unchanged.
|
|
22
|
+
|
|
23
|
+
**Upgrade notes** (hosts with a `merge` hook): a queue that merges an Autopilot change after answering `pending` keeps `HostMergeInput.claim` with the queued request and calls `settleHostMerge` once the merge lands on main (or with `outcome: 'not_merged'` and a code when it gives up). Call it with `outcome: 'check'` (writes nothing, answers `ready`) just before the final write. When a settle answers `merge_settle_unknown` (the claim was withdrawn, held, stopped, or `plan/agents.md` or the hold changed since the ask), drop the queue entry and do not write main for it; the studio asks again when the change is merged next. A change the queue merged anyway shows in Work as a merge Git holds, like one made at a terminal, with no host line, record or Snapshot. On `merge_record_failed`, call again. On `merge_publication_lock` (the studio's publication lock stayed busy), call again later. `merge_settle_invalid` and `merge_settle_unknown` are now reserved codes.
|
|
24
|
+
|
|
25
|
+
## v0.8.47 (2026-12-04)
|
|
26
|
+
|
|
27
|
+
- On Linux and macOS, `ape prototype snapshot` reuses unchanged console scenes again: files Vite serves from outside the console's folder (`/@fs/…`) were read as paths under the working folder, so every console scene was drawn again. A worktree's snapshot also records its dev servers every few seconds while they start, so the next run stops the servers of a run killed during their cold start.
|
|
28
|
+
|
|
29
|
+
**Upgrade:** nothing to do.
|
|
30
|
+
|
|
31
|
+
- `ape worktrees` lists every worktree of the repository (the studio's and any other) as merged and clean, not merged, uncommitted work, in use or unknown, with `--size` for its size on disk; `ape worktrees clean` removes only the merged, clean, unused ones with the same safe removal as the studio, keeps every branch, and prints what it kept and why. `--json` for programs, exit 0, 1 (a removal failed) or 2 (nothing could be read).
|
|
32
|
+
- The studio cleans up its change worktrees: when it starts and after each merge (a person's or Autopilot's), each `.ape/worktrees/<change>` whose branch is merged into main, with nothing uncommitted and no running turn or process holding its folder, is removed with the safe removal (its packages' links and junctions first, then its `node_modules` through Node, which reaches Windows' long paths); its branch stays. Work says why a merged one was kept and lists worktrees that are no change's under Other worktrees, read-only. A change's worktree whose lockfile (or `pnpm-workspace.yaml`) changed since its last install, after a catch-up say, installs its packages again before its next turn.
|
|
33
|
+
- `ape prototype version` refuses while the critique on file (`design/critique.md`) marks an open P0, naming each line: one the Autopilot approver reads as a P0 (the report's Fix list writes `- **P0** <what>`; `[P0]` and `| P0 |` count too). A fixed P0 is struck through (`- ~~**P0** <what>~~ <how it was fixed>`). With no critique on file the version is recorded and the command says so (`note` in `--json`). The refusal is a record refusal (exit 1), at every door that records a version.
|
|
34
|
+
|
|
35
|
+
**Upgrade notes** (every product with a critique): before recording a version, strike through each fixed P0 in `design/critique.md`, commit it and take the snapshot again; an open P0 now refuses the version.
|
|
36
|
+
|
|
37
|
+
- The `ape-critique` skill gains a spacing and layout pass under Detail and craft (padding inside cards and controls, gaps between sections, shared edges and the grid, siblings that should match, crowding at 390 against emptiness at 1440), each finding naming the screenshot, the element and the spacing token; it reads the snapshot's layout hints first and confirms or dismisses each. `design/critique.md` now holds only the current review: the critique replaces the file, a recheck of the P0s edits that same report, and older reviews stay in git history (the studio's critique turn already wrote it this way). Before scoring it reads only the sections of the brief, the journeys and `design/DESIGN.md` that the change touches, found by heading, plus the contract's direction, voice, color, type and layout sections, instead of the files whole.
|
|
38
|
+
|
|
39
|
+
**Upgrade notes** (every product with a critique): `ape upgrade` refreshes the skill. Cut `design/critique.md` to its newest review (one `# Critique` section); git keeps the older ones.
|
|
40
|
+
|
|
41
|
+
- `ape prototype snapshot` suggests layout hints beside the font hints: in light mode and the first language, each theme's look measures its laid-out boxes and names siblings that overlap with neither a layer, a box with text a few pixels (up to 4) off the edge its siblings share, a sibling of the same component with other padding or gaps, and space between neighbours that is no step of the theme's spacing scale, with the nearest `space-*` token (`docs/PROTOTYPE.md` has the rules). They are advice only: the pictures, the checks, the exit code and the gates are unchanged, and the report's `hints` keeps its shape. A scene marks a hint it shows on purpose with `layoutExceptions` in `prototype/scenes.ts` (`kind`, optional `element` words, `reason`); `defineScenes` refuses one without a reason. Measuring costs a few milliseconds a look.
|
|
42
|
+
|
|
43
|
+
- The critique, the selector and the Autopilot approver now run with Codex as well as Claude Code, whichever `plan/agents.md` sets for validation: each turn is a new Codex session in its own read-only sandbox (`codex exec -s read-only`: no writes or network, no MCP servers or web search, the person's own sign-in). Unlike Claude's, a Codex turn can read secret files in the product; a product whose `.codex/` settings add MCP servers or hooks gets no Codex turn. Any fresh answer (Claude's too) that quotes a value from the product's secret files is dropped, naming the file only. The approver is still a fresh session of its own when the same agent built the change. OpenCode still has no read-only turn: with it, the floor is drawn alone and the version waits for a person, as before.
|
|
44
|
+
|
|
45
|
+
**Upgrade:** nothing to do.
|
|
46
|
+
|
|
47
|
+
- At Autopilot, a prototype version is approved only by a fresh, read-only approver turn of the agent and model `plan/agents.md` sets for validation, never by the agent that built it, and only when the report drew the floor, every check passed, the critique has no P0 and the selector's second turn agreed. Otherwise the version waits for a person, with the reason. The signature records it as an AI approval (`ai`: model and reason, beside `agent`). The studio's approval card marks it as approved by AI, with the model and reason, and a person reopens one with its Reopen button or `ape prototype reopen <change>`. A host's `approval` hook receives `ai` with an Autopilot prototype approval. A milestone's approval now takes only a version whose report drew every scene in the full matrix. You drive, Review and Lead are unchanged; releases, deploys and money still wait for a person.
|
|
48
|
+
|
|
49
|
+
**Upgrade notes** (every product): a host or tool that reads `prototype/versions/*.json` should treat a signature with `ai` as an AI approval, not a person's, and show it so. A host that implements the `approval` hook receives `ai` (model and reason) with an Autopilot prototype approval, and `agent` then names the approver's agent, not the agent that built the change; it should keep both on the signature it returns, and may answer the new `action: 'reopen'` (or refuse it, and the studio says the host cannot reopen). A hook that answers `reopen` reopens only the artifact named in the request, and only when that artifact's approval carries `ai`: never a person's approval, never another version. The studio waits 5 seconds for the answer. Reopened approvals move to `superseded` with `reopened` (who and when). A milestone approved from a floor report needs `ape prototype snapshot --full` of that commit, recorded again.
|
|
50
|
+
|
|
51
|
+
- Before a floor snapshot draws, two fresh read-only turns of the agent and model `plan/agents.md` sets for validation may add scenes to draw again and looks beyond the floor, each with a reason. The second turn only adds; nothing goes below the floor, and a pick outside the scenes or the matrix is dropped and noted. `report.json` keeps the turns, picks, drops and the reason when none ran. With an agent that has no read-only turn (OpenCode), in CI, or when a turn fails, takes over 120 seconds or answers out of shape, the floor is drawn alone and the terminal says why. `--full` skips it. A full run notes in `prototype/snapshots/selector-misses.json` the problems in looks the last selector run did not draw, and later turns learn from them.
|
|
52
|
+
|
|
53
|
+
**Upgrade:** nothing to do. Commit `selector-misses.json` with the report when a full run writes it.
|
|
54
|
+
|
|
55
|
+
- `ape prototype snapshot` draws the floor by default: the product's theme (the first starter when it names none), light and dark, its languages and `en-XA`, and `ar-XB` for a right-to-left language. The full matrix (every theme, mode and pseudo-locale) runs with the new `--full`, and by itself when the theme, `design/`, a shell or another shared input changed since the last full report. The report says which in `matrix`, `matrixReason` and each floor scene's `matrix`. `ape prototype version` accepts a floor report.
|
|
56
|
+
|
|
57
|
+
**Upgrade:** nothing to do. The first snapshot after upgrading draws the full matrix; take a release's or a milestone's report with `--full`.
|
|
58
|
+
|
|
59
|
+
- A prototype snapshot stopped half way (killed, Ctrl+C, or a scene that failed both tries) draws only the unfinished scenes when run again on the same checkout, `--scene` runs included; a `--scene` run no longer discards the kept scenes of the others, and the full-page fallback line says it counts the scenes drawn in that run. The dev servers a worktree's snapshot started are recorded (id, start time, command line), and the next run of that worktree stops the ones a hard kill left running, only while all three still match.
|
|
60
|
+
- Prototype snapshots reuse a scene's pictures from an earlier commit when nothing it draws from has changed. A view edit redraws only the scenes whose views import the changed file. A change to a shared part redraws every scene: the theme, `design/`, the shells, the store, the scene pages, or the snapshot's own code and message catalogs. A scene that made a request its inputs don't cover is drawn again. The first run after upgrading redraws every scene.
|
|
61
|
+
|
|
62
|
+
**Limits:** a scene whose props hold a function is never reused from another commit. An app on Metro is one bundle, so an app view edit redraws all the app's scenes. A stopped run keeps only scenes that called no API and whose every request was covered. A run the studio starts never uses kept scenes. Catalogs count as whole files. Data that reaches a scene only over the dev server's message socket, and a Vite optimizer file served with bytes other than the file on disk, are not seen.
|
|
63
|
+
|
|
64
|
+
**Upgrade notes** (every product): to reuse console scenes view by view, register each view in `apps/admin/src/prototype/views.ts` with React's `lazy` and a literal relative import, with the same named export in both files. A view imported directly counts as a shared part.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { lazy } from 'react';
|
|
68
|
+
|
|
69
|
+
export const NotesView = lazy(() =>
|
|
70
|
+
import('./NotesView.tsx').then((m) => ({ default: m.NotesView })),
|
|
71
|
+
);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- Process documents stay small enough to read. The `ape-prototype` and `ape-plan-change` skills read `plan/brief.md`, `plan/journeys.md`, `design/DESIGN.md` and `design/screens.md` by section (list the `## ` headings, then read the ones the change needs), not whole, and the studio's fresh review reads only the sections it needs of the earlier steps' files. A change file stays under about 15 KB: its history is in git.
|
|
75
|
+
- `design/DESIGN.md` stays a contract: the `ape-design-system` skill puts per-screen specs in `design/screens.md`, one `## <screen>` section each, and `ape design check` warns, without failing, when DESIGN.md passes about 40 KB or one of its sections about 15 KB.
|
|
76
|
+
- `ape size` (in `pnpm lint` and so `pnpm verify`) also warns, without failing, on process documents past their size: `design/critique.md` over 40 KB, `plan/changes/*.md` over 15 KB, other Markdown under `design/` and `plan/` over 50 KB. Its exit code is unchanged.
|
|
77
|
+
- `ape prototype prune [--dry-run] [--json]` removes committed snapshot folders under `prototype/snapshots/` that no record in `prototype/versions/` names (by source commit or report fingerprint), keeping the newest, HEAD's, any with unsaved changes and `comp/`; git keeps their history. The `ape-prototype` skill runs it after recording a version.
|
|
78
|
+
|
|
79
|
+
**Upgrade notes** (every product): nothing breaks; `ape upgrade` refreshes the skills. A one-time cleanup for a product that grew large process files: run `pnpm ape prototype prune --dry-run`, then `pnpm ape prototype prune`, and commit the deletion; cut `design/critique.md` to its newest review (earlier ones stay in git); move per-screen detail from `design/DESIGN.md` (often under `## Components`) into `design/screens.md`, one `## <screen>` section each, leaving the contract's rules; trim shipped change files' running logs. Then `pnpm ape design check` and `pnpm ape size` show no size warnings.
|
|
80
|
+
|
|
7
81
|
## v0.8.46 (2026-12-03)
|
|
8
82
|
|
|
9
83
|
- Prototype snapshots draw a scene's later looks in place, on the same page. Each scene starts in a fresh browser context and then checks its last look against a fresh load; when the picture or findings differ, the scene is drawn again with full loads. The terminal counts full-page fallbacks of looks and scenes. Every load now blurs a field that autofocuses late before the picture, so a scene's focus ring no longer depends on timing; this changes earlier pictures only where that ring came and went. A view that takes the focus back after the blur keeps it, as a plain load shows it. Limits: code above the scene page that reads the look or storage once at boot is not rechecked per look, and scenes whose pictures vary between loads always redraw fresh.
|
|
@@ -4,6 +4,11 @@ export declare const en: {
|
|
|
4
4
|
'build.server.name': string;
|
|
5
5
|
'build.server.inspect': string;
|
|
6
6
|
'build.server.made': string;
|
|
7
|
+
'build.server.packages': string;
|
|
8
|
+
'build.server.packagesFailed': string;
|
|
9
|
+
'build.server.versionsRun': string;
|
|
10
|
+
'build.server.label': string;
|
|
11
|
+
'build.server.versionsMissing': string;
|
|
7
12
|
'build.server.flags': string;
|
|
8
13
|
'build.server.platformOnly': string;
|
|
9
14
|
'build.server.platform': string;
|
|
@@ -5,6 +5,11 @@ export const en = {
|
|
|
5
5
|
'build.server.name': '{name} is not a name setup took.',
|
|
6
6
|
'build.server.inspect': 'Could not read the image ID for {image}.',
|
|
7
7
|
'build.server.made': 'Built {image}: {id}',
|
|
8
|
+
'build.server.packages': 'buffcore.config.ts: {problems}. Nothing was built: fix server.systemPackages, then run it again.',
|
|
9
|
+
'build.server.packagesFailed': 'The image did not build. It installs system packages ({names}): when the output above shows apt-get or "ape: the system package" failing, check those names in Debian. No image is made without them.',
|
|
10
|
+
'build.server.versionsRun': "Could not read the system packages' versions in {image}: Docker said {cause}. Is Docker running, and is the image on this machine?",
|
|
11
|
+
'build.server.label': "The image {image}'s ape.system-packages label names {name}, which is not a Debian package name: its system packages' versions were not read.",
|
|
12
|
+
'build.server.versionsMissing': '{name} is not installed in {image} by that name: list each system package by its own Debian name, not one another package provides.',
|
|
8
13
|
'build.server.flags': '--local, --builder and --simulator are for ape build ios only.',
|
|
9
14
|
'build.server.platformOnly': '--platform is for ape build server only.',
|
|
10
15
|
'build.server.platform': 'server only: the image platform (default: linux/amd64)',
|
|
@@ -6,6 +6,11 @@ const es = {
|
|
|
6
6
|
'build.server.name': '{name} no es un nombre aceptado por setup.',
|
|
7
7
|
'build.server.inspect': 'No se pudo leer el ID de la imagen {image}.',
|
|
8
8
|
'build.server.made': 'Imagen creada {image}: {id}',
|
|
9
|
+
'build.server.packages': 'buffcore.config.ts: {problems}. No se creó nada: corrige server.systemPackages y ejecútalo otra vez.',
|
|
10
|
+
'build.server.packagesFailed': 'La imagen no se creó. Instala paquetes del sistema ({names}): si la salida de arriba muestra un fallo de apt-get o de "ape: the system package", revisa esos nombres en Debian. No se crea ninguna imagen sin ellos.',
|
|
11
|
+
'build.server.versionsRun': 'No se pudieron leer las versiones de los paquetes del sistema en {image}: Docker dijo {cause}. ¿Está Docker en marcha y la imagen en esta máquina?',
|
|
12
|
+
'build.server.label': 'La etiqueta ape.system-packages de la imagen {image} nombra {name}, que no es un nombre de paquete de Debian: no se leyeron las versiones de sus paquetes del sistema.',
|
|
13
|
+
'build.server.versionsMissing': '{name} no está instalado en {image} con ese nombre: nombra cada paquete del sistema por su propio nombre en Debian, no por uno que otro paquete provee.',
|
|
9
14
|
'build.server.flags': '--local, --builder y --simulator son solo para ape build ios.',
|
|
10
15
|
'build.server.platformOnly': '--platform es solo para ape build server.',
|
|
11
16
|
'build.server.platform': 'solo server: la plataforma de la imagen (predeterminada: linux/amd64)',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Local } from '../server/build.ts';
|
|
2
2
|
import { type ImageReader } from '../server/image-id.ts';
|
|
3
|
+
import { type PackageReader } from '../server/system-packages.ts';
|
|
3
4
|
import { type Runner } from './runner.ts';
|
|
4
5
|
export interface ServerBuildOptions {
|
|
5
6
|
platform?: string;
|
|
@@ -17,6 +18,8 @@ export interface ServerBuildResult {
|
|
|
17
18
|
image: string;
|
|
18
19
|
id: string;
|
|
19
20
|
}[];
|
|
21
|
+
/** The system packages' installed versions in the image (`server.systemPackages`); `{}` for none. */
|
|
22
|
+
systemPackages: Record<string, string>;
|
|
20
23
|
}
|
|
21
24
|
export interface ServerBuildDeps {
|
|
22
25
|
root?: string;
|
|
@@ -24,6 +27,7 @@ export interface ServerBuildDeps {
|
|
|
24
27
|
run?: Runner;
|
|
25
28
|
log?: (line: string) => void;
|
|
26
29
|
readImage?: ImageReader;
|
|
30
|
+
readPackages?: PackageReader;
|
|
27
31
|
}
|
|
28
32
|
/** Only a failure after the build starts is exit 1; preparation failures are refusals (2). */
|
|
29
33
|
export declare class ServerBuildFailed extends Error {
|
|
@@ -4,6 +4,7 @@ import { buildImages, local } from '../server/build.js';
|
|
|
4
4
|
import { imagePlan, workspaceOf } from '../server/deploy.js';
|
|
5
5
|
import { dockerfile } from '../server/image.js';
|
|
6
6
|
import { imageIdOf } from '../server/image-id.js';
|
|
7
|
+
import { packageVersions, systemPackagesOf, } from '../server/system-packages.js';
|
|
7
8
|
import { shell } from './runner.js';
|
|
8
9
|
import { t } from './server-text.js';
|
|
9
10
|
/** Only a failure after the build starts is exit 1; preparation failures are refusals (2). */
|
|
@@ -29,7 +30,13 @@ export async function buildServer(options, deps = {}) {
|
|
|
29
30
|
const commit = here.commit(workspace);
|
|
30
31
|
if (commit.changed)
|
|
31
32
|
throw new Error(t('build.server.changed'));
|
|
32
|
-
const
|
|
33
|
+
const systemPackages = systemPackagesOf(product);
|
|
34
|
+
const plan = imagePlan(root, workspace, {
|
|
35
|
+
name: product.name,
|
|
36
|
+
commit: commit.sha,
|
|
37
|
+
systemPackages,
|
|
38
|
+
});
|
|
39
|
+
const docker = dockerfile(plan);
|
|
33
40
|
const info = run('docker info --format "{{.ServerVersion}}"', {
|
|
34
41
|
cwd: workspace,
|
|
35
42
|
capture: true,
|
|
@@ -44,6 +51,7 @@ export async function buildServer(options, deps = {}) {
|
|
|
44
51
|
json: Boolean(options.json),
|
|
45
52
|
log,
|
|
46
53
|
tag: commit.sha,
|
|
54
|
+
packages: systemPackages,
|
|
47
55
|
});
|
|
48
56
|
const images = [];
|
|
49
57
|
for (const image of tags)
|
|
@@ -52,6 +60,7 @@ export async function buildServer(options, deps = {}) {
|
|
|
52
60
|
...images[0],
|
|
53
61
|
commit: commit.sha,
|
|
54
62
|
containers: images.slice(1).map((image, i) => ({ name: built.names[i], ...image })),
|
|
63
|
+
systemPackages: await packageVersions(tags[0], systemPackages, where.platform, deps.readPackages),
|
|
55
64
|
};
|
|
56
65
|
}
|
|
57
66
|
catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SafeDiagnostics } from '@buffcore/contracts/workbench';
|
|
2
|
-
import { type Reason } from './change-merge.ts';
|
|
2
|
+
import { type MergeGit, type Reason } from './change-merge.ts';
|
|
3
3
|
export type RemovalResult = {
|
|
4
4
|
ok: true;
|
|
5
5
|
} | ({
|
|
@@ -12,5 +12,12 @@ export type RemovalResult = {
|
|
|
12
12
|
diagnostics: SafeDiagnostics;
|
|
13
13
|
detail?: never;
|
|
14
14
|
}));
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Remove one linked checkout and keep its branch: only when it is clean and its HEAD is reachable
|
|
17
|
+
* from main. Throws when Git or the disk fails; the caller keeps the worktree.
|
|
18
|
+
*/
|
|
19
|
+
export declare function removeCheckout(root: string, path: string, tools?: {
|
|
20
|
+
git: MergeGit;
|
|
21
|
+
}): Promise<RemovalResult>;
|
|
22
|
+
/** A change's worktree, under the merge lock: the same removal. */
|
|
16
23
|
export declare function removeWorktree(root: string, change: string, tools?: import("./change-merge.ts").MergeTools): Promise<RemovalResult>;
|
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
import { t } from './change-merge.en.js';
|
|
2
|
-
import { context, defaultMergeTools, dirty, locked, refuse } from './change-merge.js';
|
|
2
|
+
import { context, defaultMergeTools, dirty, locked, refuse, } from './change-merge.js';
|
|
3
3
|
import { mainCommit } from './main-ref.js';
|
|
4
|
-
import { removeLinks } from './remove-links.js';
|
|
5
|
-
/**
|
|
4
|
+
import { removeLinks, removePackages } from './remove-links.js';
|
|
5
|
+
/**
|
|
6
|
+
* Remove one linked checkout and keep its branch: only when it is clean and its HEAD is reachable
|
|
7
|
+
* from main. Throws when Git or the disk fails; the caller keeps the worktree.
|
|
8
|
+
*/
|
|
9
|
+
export async function removeCheckout(root, path, tools = defaultMergeTools) {
|
|
10
|
+
if (await dirty(path, tools.git))
|
|
11
|
+
return refuse('dirty', 'change.merge.dirty');
|
|
12
|
+
const [main, head] = await Promise.all([
|
|
13
|
+
mainCommit(root, tools.git),
|
|
14
|
+
tools.git(path, ['rev-parse', '--verify', 'HEAD^{commit}']),
|
|
15
|
+
]);
|
|
16
|
+
const merged = await tools.git(root, ['merge-base', '--is-ancestor', head.trim(), main]).then(() => true, () => false);
|
|
17
|
+
if (!merged)
|
|
18
|
+
return { ok: false, reason: 'unmerged', detail: t('change.merge.unmerged') };
|
|
19
|
+
// Its packages' links and junctions go first, as themselves: Git's removal never follows one.
|
|
20
|
+
await removeLinks(path);
|
|
21
|
+
// An untracked top `node_modules` (a clean status means ignored) goes through Node, which reaches
|
|
22
|
+
// the long paths Git for Windows cannot delete.
|
|
23
|
+
if (!(await tools.git(path, ['ls-files', '--', 'node_modules'])).trim())
|
|
24
|
+
await removePackages(path);
|
|
25
|
+
await tools.git(root, ['worktree', 'remove', path]);
|
|
26
|
+
return { ok: true };
|
|
27
|
+
}
|
|
28
|
+
/** A change's worktree, under the merge lock: the same removal. */
|
|
6
29
|
export async function removeWorktree(root, change, tools = defaultMergeTools) {
|
|
7
30
|
try {
|
|
8
31
|
return await locked(root, change, tools, async () => {
|
|
9
32
|
const { tree } = await context(root, change, tools.git);
|
|
10
|
-
|
|
11
|
-
return refuse('dirty', 'change.merge.dirty');
|
|
12
|
-
const main = await mainCommit(root, tools.git);
|
|
13
|
-
const merged = await tools
|
|
14
|
-
.git(root, ['merge-base', '--is-ancestor', `refs/heads/${tree.branch}`, main])
|
|
15
|
-
.then(() => true, () => false);
|
|
16
|
-
if (!merged)
|
|
17
|
-
return { ok: false, reason: 'unmerged', detail: t('change.merge.unmerged') };
|
|
18
|
-
// Its packages' links and junctions go first, as themselves: Git's removal never follows one.
|
|
19
|
-
await removeLinks(tree.path);
|
|
20
|
-
await tools.git(root, ['worktree', 'remove', tree.path]);
|
|
21
|
-
return { ok: true };
|
|
33
|
+
return removeCheckout(root, tree.path, tools);
|
|
22
34
|
});
|
|
23
35
|
}
|
|
24
36
|
catch {
|
|
@@ -103,11 +103,11 @@ export declare const hasMerge: (path: string, git: MergeGit) => Promise<boolean>
|
|
|
103
103
|
* may rewrite it). Any read failure holds it.
|
|
104
104
|
*/
|
|
105
105
|
export declare function hostLevelRefusal(root: string, refs: string[], tools: MergeTools): Promise<{
|
|
106
|
-
reason: 'held';
|
|
107
|
-
detail: string;
|
|
108
106
|
ok: false;
|
|
109
107
|
code: string;
|
|
110
108
|
error: string;
|
|
109
|
+
reason: 'held';
|
|
110
|
+
detail: string;
|
|
111
111
|
} | undefined>;
|
|
112
112
|
/** Person-only action shared by CLI and studio. Nothing pushes or forces a branch. */
|
|
113
113
|
export declare function mergeOne(root: string, change: string, tools?: MergeTools, approval?: MergeAuthority, level?: HostLevel): Promise<MergeResult>;
|
|
@@ -9,7 +9,7 @@ export interface DesignCheckResult {
|
|
|
9
9
|
/** The product's own components, by name. */
|
|
10
10
|
components: string[];
|
|
11
11
|
problems: DesignProblem[];
|
|
12
|
-
/** Advice that never fails the check: journeys that name no role. */
|
|
12
|
+
/** Advice that never fails the check: journeys that name no role, a contract grown too big. */
|
|
13
13
|
warnings: string[];
|
|
14
14
|
}
|
|
15
15
|
export declare function designCheck(root: string, advise?: (lines: string[]) => void): Promise<DesignCheckResult>;
|
|
@@ -7,6 +7,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
7
7
|
import { join } from 'node:path';
|
|
8
8
|
import { findRoot } from '../../project.js';
|
|
9
9
|
import { printJson } from '../json.js';
|
|
10
|
+
import { contractSizeWarnings } from './contract-size.js';
|
|
10
11
|
import { journeyRoleWarnings } from './journey-roles.js';
|
|
11
12
|
import { missingReferences } from './references.js';
|
|
12
13
|
import { outsideComponents, rawValues } from './rules.js';
|
|
@@ -197,7 +198,7 @@ export async function designCheck(root, advise) {
|
|
|
197
198
|
files: [...scanned.map((f) => fromRoot(root, f)), DESIGN, MANIFEST],
|
|
198
199
|
components: components.map(componentName),
|
|
199
200
|
problems,
|
|
200
|
-
warnings: await journeyRoleWarnings(root),
|
|
201
|
+
warnings: [...(await journeyRoleWarnings(root)), ...(await contractSizeWarnings(root))],
|
|
201
202
|
};
|
|
202
203
|
}
|
|
203
204
|
function print(result) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** About 40 KB for the whole contract, about 15 KB for one `## ` section. */
|
|
2
|
+
export declare const CONTRACT_LIMIT: number;
|
|
3
|
+
export declare const SECTION_LIMIT: number;
|
|
4
|
+
/** The warnings for a contract's text: the whole past its limit, and each section past its own. */
|
|
5
|
+
export declare function contractSizeLines(text: string, locale?: 'en' | 'es'): string[];
|
|
6
|
+
/** `ape design check`'s size warnings for `design/DESIGN.md`, in the person's language. */
|
|
7
|
+
export declare function contractSizeWarnings(root: string): Promise<string[]>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// The design contract stays a contract: `design/DESIGN.md` says the direction, the voice, the
|
|
2
|
+
// tokens' use and the components' rules, and per-screen specs live in `design/screens.md`. A
|
|
3
|
+
// contract past its size, or one section past its own, is a warning, never a failure.
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { createI18n } from '@buffcore/i18n';
|
|
7
|
+
import { en } from './tells.en.js';
|
|
8
|
+
import { es } from './tells.es.js';
|
|
9
|
+
const messages = createI18n({ catalogs: [{ en, es }] });
|
|
10
|
+
/** About 40 KB for the whole contract, about 15 KB for one `## ` section. */
|
|
11
|
+
export const CONTRACT_LIMIT = 40 * 1024;
|
|
12
|
+
export const SECTION_LIMIT = 15 * 1024;
|
|
13
|
+
const kb = (bytes) => Math.round(bytes / 1024);
|
|
14
|
+
/** Each `## ` heading and its size in bytes, heading line included, to the next `## `. */
|
|
15
|
+
function sectionSizes(text) {
|
|
16
|
+
const found = [];
|
|
17
|
+
for (const line of text.split('\n')) {
|
|
18
|
+
if (line.startsWith('## '))
|
|
19
|
+
found.push({ heading: line.slice(3).trim(), bytes: 0 });
|
|
20
|
+
const current = found.at(-1);
|
|
21
|
+
if (current)
|
|
22
|
+
current.bytes += Buffer.byteLength(line, 'utf8') + 1;
|
|
23
|
+
}
|
|
24
|
+
return found;
|
|
25
|
+
}
|
|
26
|
+
/** The warnings for a contract's text: the whole past its limit, and each section past its own. */
|
|
27
|
+
export function contractSizeLines(text, locale = 'en') {
|
|
28
|
+
const t = (key, values) => messages.t(locale, key, values);
|
|
29
|
+
const lines = [];
|
|
30
|
+
const bytes = Buffer.byteLength(text, 'utf8');
|
|
31
|
+
if (bytes > CONTRACT_LIMIT)
|
|
32
|
+
lines.push(t('design.contractSize', { size: kb(bytes), limit: kb(CONTRACT_LIMIT) }));
|
|
33
|
+
for (const section of sectionSizes(text))
|
|
34
|
+
if (section.bytes > SECTION_LIMIT)
|
|
35
|
+
lines.push(t('design.sectionSize', {
|
|
36
|
+
heading: section.heading,
|
|
37
|
+
size: kb(section.bytes),
|
|
38
|
+
limit: kb(SECTION_LIMIT),
|
|
39
|
+
}));
|
|
40
|
+
return lines;
|
|
41
|
+
}
|
|
42
|
+
/** `ape design check`'s size warnings for `design/DESIGN.md`, in the person's language. */
|
|
43
|
+
export async function contractSizeWarnings(root) {
|
|
44
|
+
const locale = /^es(?:[-_.]|$)/i.test(process.env.LC_ALL || process.env.LANG || '') ? 'es' : 'en';
|
|
45
|
+
const text = await readFile(join(root, 'design', 'DESIGN.md'), 'utf8').catch(() => '');
|
|
46
|
+
return contractSizeLines(text.replace(/\r\n/g, '\n'), locale);
|
|
47
|
+
}
|
|
@@ -10,4 +10,6 @@ export const en = {
|
|
|
10
10
|
'design.font': 'No font loading or bundle found for {family}. Load that family with the app fonts.',
|
|
11
11
|
'design.journeyRole': 'Warning {file} the journey {journey} names no role: say who it is for, one of the people in plan/journeys.md.',
|
|
12
12
|
'design.reference': 'The reference picture {path} is not on this computer. Capture it again, or remove its line.',
|
|
13
|
+
'design.contractSize': 'Warning design/DESIGN.md {size} KB, over about {limit} KB: keep the contract to its rules and move per-screen specs into design/screens.md, one "## <screen>" section each.',
|
|
14
|
+
'design.sectionSize': 'Warning design/DESIGN.md the section "{heading}" is {size} KB, over about {limit} KB: move per-screen specs into design/screens.md, one "## <screen>" section each.',
|
|
13
15
|
};
|
|
@@ -10,4 +10,6 @@ export const es = {
|
|
|
10
10
|
'design.font': 'No se encontró cómo se carga ni se incluye la fuente {family}. Cárgala junto con las fuentes de la aplicación.',
|
|
11
11
|
'design.journeyRole': 'Aviso {file} el recorrido {journey} no nombra un rol: di para quién es, una de las personas de plan/journeys.md.',
|
|
12
12
|
'design.reference': 'La imagen de referencia {path} no está en este equipo. Vuelve a capturarla o quita su línea.',
|
|
13
|
+
'design.contractSize': 'Aviso design/DESIGN.md {size} KB, más de unos {limit} KB: deja en el contrato solo sus reglas y pasa las especificaciones de cada pantalla a design/screens.md, una sección "## <pantalla>" por pantalla.',
|
|
14
|
+
'design.sectionSize': 'Aviso design/DESIGN.md la sección "{heading}" tiene {size} KB, más de unos {limit} KB: pasa las especificaciones de cada pantalla a design/screens.md, una sección "## <pantalla>" por pantalla.',
|
|
13
15
|
};
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CoreEnv, type ProductConfig, type ProductProcess } from '@buffcore/config';
|
|
1
|
+
import { type CoreEnv, type Hardening, type ProductConfig, type ProductProcess } from '@buffcore/config';
|
|
2
2
|
export { buffcorePackages, clearExpoCache } from './dev-expo-cache.ts';
|
|
3
3
|
/** The Docker services file: the product's, or BuffCore's own when in the BuffCore repository. */
|
|
4
4
|
export declare function composeFile(root: string): string;
|
|
@@ -40,13 +40,20 @@ export type DevEnv = Pick<CoreEnv, 'APE_API_PORT' | 'APE_API_URL' | 'APE_ADMIN_U
|
|
|
40
40
|
*/
|
|
41
41
|
export declare function devProcesses(root: string, declared: readonly ProductProcess[], env: DevEnv & Pick<CoreEnv, 'APE_ENV'>,
|
|
42
42
|
/** Start Expo with its cache cleared (`clearExpoCache`). */
|
|
43
|
-
clearApp?: boolean
|
|
43
|
+
clearApp?: boolean,
|
|
44
|
+
/** The product's `hardening`: its debug options refused before anything starts. */
|
|
45
|
+
hardening?: Hardening): DevProcess[];
|
|
44
46
|
/**
|
|
45
47
|
* The admin and app are told the API's address as `APE_API_URL`. On this computer that address
|
|
46
48
|
* must be the API's own port, or they would call another checkout's API (a copied `.env` where
|
|
47
49
|
* only `APE_API_PORT` changed). A tunnel or network address is the developer's to name.
|
|
48
50
|
*/
|
|
49
51
|
export declare function checkApiAddress(env: DevEnv): void;
|
|
52
|
+
/**
|
|
53
|
+
* `.env`'s settings. Node reads its NODE_OPTIONS through --env-file before any code runs, as the
|
|
54
|
+
* shell's, so `ape dev` refuses debugging options in either before starting anything.
|
|
55
|
+
*/
|
|
56
|
+
export declare const devSettings: (root: string) => Record<string, string | undefined>;
|
|
50
57
|
/**
|
|
51
58
|
* `ape dev`: Docker services and the product's containers (none with `APE_DEV_SERVICES=external`),
|
|
52
59
|
* then the API with hot reload, the product's other declared processes, and the admin and web app
|
package/dist/commands/dev.js
CHANGED
|
@@ -7,6 +7,7 @@ import { devAddresses, devPorts, findRoot, loadEnv, loadProduct, uiFolder } from
|
|
|
7
7
|
import { clearExpoCache } from './dev-expo-cache.js';
|
|
8
8
|
import { watchDevOutput } from './dev-output.js';
|
|
9
9
|
import { watchDevReady } from './dev-ready.js';
|
|
10
|
+
import { refuseDebugStart } from './hardening.js';
|
|
10
11
|
import { claimBlock } from './port-claims.js';
|
|
11
12
|
import { containersOf, devCompose } from './services/compose.js';
|
|
12
13
|
import { runComposeUp } from './services/compose-up.js';
|
|
@@ -106,7 +107,13 @@ export function apiFolder(root) {
|
|
|
106
107
|
*/
|
|
107
108
|
export function devProcesses(root, declared, env,
|
|
108
109
|
/** Start Expo with its cache cleared (`clearExpoCache`). */
|
|
109
|
-
clearApp = false
|
|
110
|
+
clearApp = false,
|
|
111
|
+
/** The product's `hardening`: its debug options refused before anything starts. */
|
|
112
|
+
hardening) {
|
|
113
|
+
refuseDebugStart(hardening, {
|
|
114
|
+
shell: process.env.NODE_OPTIONS,
|
|
115
|
+
'.env': devSettings(root).NODE_OPTIONS,
|
|
116
|
+
});
|
|
110
117
|
const api = apiFolder(root);
|
|
111
118
|
return [
|
|
112
119
|
{
|
|
@@ -168,6 +175,14 @@ export function checkApiAddress(env) {
|
|
|
168
175
|
throw new Error(`APE_API_URL (${env.APE_API_URL}) is not on APE_API_PORT (${env.APE_API_PORT}). Set both, or the admin and app call another API.`);
|
|
169
176
|
}
|
|
170
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* `.env`'s settings. Node reads its NODE_OPTIONS through --env-file before any code runs, as the
|
|
180
|
+
* shell's, so `ape dev` refuses debugging options in either before starting anything.
|
|
181
|
+
*/
|
|
182
|
+
export const devSettings = (root) => {
|
|
183
|
+
const file = join(root, '.env');
|
|
184
|
+
return existsSync(file) ? parseEnv(readFileSync(file, 'utf8')) : {};
|
|
185
|
+
};
|
|
171
186
|
/**
|
|
172
187
|
* `ape dev`: Docker services and the product's containers (none with `APE_DEV_SERVICES=external`),
|
|
173
188
|
* then the API with hot reload, the product's other declared processes, and the admin and web app
|
|
@@ -181,15 +196,19 @@ export async function dev() {
|
|
|
181
196
|
// This product's block stays claimed, so `ape create` picks another one even while it is stopped.
|
|
182
197
|
await claimBlock(root, String(Math.floor(env.APE_API_PORT / 100)));
|
|
183
198
|
const product = await loadProduct(root);
|
|
184
|
-
await startDevServices(root, product);
|
|
185
199
|
const app = uiFolder(root, 'app');
|
|
186
200
|
const clear = app !== undefined && clearExpoCache(root, app);
|
|
201
|
+
// Before the services: the product's debugging options are refused before anything starts.
|
|
202
|
+
refuseDebugStart(product.hardening, {
|
|
203
|
+
shell: process.env.NODE_OPTIONS,
|
|
204
|
+
'.env': devSettings(root).NODE_OPTIONS,
|
|
205
|
+
});
|
|
206
|
+
await startDevServices(root, product);
|
|
207
|
+
const entries = devProcesses(root, product.processes ?? [], env, clear, product.hardening);
|
|
187
208
|
if (clear)
|
|
188
209
|
console.log("BuffCore's packages changed: the app starts with Expo's cache cleared.");
|
|
189
|
-
const
|
|
210
|
+
const values = devSettings(root);
|
|
190
211
|
console.log(`API ${env.APE_API_URL} · admin ${env.APE_ADMIN_URL} · app ${env.APE_APP_URL}`);
|
|
191
|
-
const envFile = join(root, '.env');
|
|
192
|
-
const values = existsSync(envFile) ? parseEnv(readFileSync(envFile, 'utf8')) : {};
|
|
193
212
|
const containerNames = new Set(containersOf(product.processes).map(({ name }) => name));
|
|
194
213
|
// Keep using the process record for this checkout; readers see each complete update.
|
|
195
214
|
const record = { pid: process.pid, children: [] };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Hardening } from '@buffcore/config';
|
|
2
|
+
/** Throws, naming the options, when the setting is on and a NODE_OPTIONS carries any. */
|
|
3
|
+
export declare function refuseDebugStart(hardening: Hardening | undefined, nodeOptions: Readonly<Record<string, string | undefined>>): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
'hardening.refused': "buffcore.config.ts turns hardening.refuseDebugOptions on, and {where}'s NODE_OPTIONS carries Node's debugging or dump options, or a word with a quote or a backslash ({found}): Node reads it before any code runs, so nothing was started. Remove them and run this again.",
|
|
3
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const es = {
|
|
2
|
+
'hardening.refused': 'buffcore.config.ts activa hardening.refuseDebugOptions, y el NODE_OPTIONS de {where} lleva opciones de depuración o de volcado de Node, o una palabra con comillas o barra invertida ({found}): Node lo lee antes de ejecutar código, así que no se inició nada. Quítalas y vuelve a ejecutar esto.',
|
|
3
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// `hardening.refuseDebugOptions` where BuffCore starts the processes (`ape dev`) or writes what
|
|
2
|
+
// starts them (`ape server setup`): a NODE_OPTIONS Node would read before any code runs is
|
|
3
|
+
// refused before anything starts (`debug-options.ts` in @buffcore/config).
|
|
4
|
+
import { debugStartOptions } from '@buffcore/config';
|
|
5
|
+
import { createI18n } from '@buffcore/i18n';
|
|
6
|
+
import { en } from './hardening.en.js';
|
|
7
|
+
import { es } from './hardening.es.js';
|
|
8
|
+
const translator = createI18n({ catalogs: [{ en, es }] });
|
|
9
|
+
/** Throws, naming the options, when the setting is on and a NODE_OPTIONS carries any. */
|
|
10
|
+
export function refuseDebugStart(hardening, nodeOptions) {
|
|
11
|
+
for (const [where, value] of Object.entries(nodeOptions)) {
|
|
12
|
+
const found = debugStartOptions(hardening, [value]);
|
|
13
|
+
if (found.length)
|
|
14
|
+
throw new Error(translator.t(new Intl.NumberFormat().resolvedOptions().locale, 'hardening.refused', {
|
|
15
|
+
where,
|
|
16
|
+
found: found.join(', '),
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** One process's command line and, where the system says, its working folder. */
|
|
2
|
+
export interface ProcessPlace {
|
|
3
|
+
pid: number;
|
|
4
|
+
command: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Every process this account can see; throws when the table cannot be read. */
|
|
8
|
+
export declare const processPlaces: () => Promise<ProcessPlace[]>;
|
|
9
|
+
/**
|
|
10
|
+
* The folders of `paths` that some process other than this one holds: its working folder is the
|
|
11
|
+
* folder or inside it, or its command line names the folder (followed by a separator, a quote,
|
|
12
|
+
* a space or the end, so `C-001` never matches `C-0012`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function pathsHeld(paths: readonly string[], places: readonly ProcessPlace[], self?: number, win?: boolean): Set<string>;
|