@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.
Files changed (89) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/commands/change-merge-serial.d.ts +6 -2
  3. package/dist/commands/change-merge-serial.js +5 -1
  4. package/dist/commands/change.js +3 -0
  5. package/dist/commands/check-skills.d.ts +16 -0
  6. package/dist/commands/check-skills.en.d.ts +14 -0
  7. package/dist/commands/check-skills.en.js +14 -0
  8. package/dist/commands/check-skills.es.d.ts +2 -0
  9. package/dist/commands/check-skills.es.js +14 -0
  10. package/dist/commands/check-skills.js +146 -0
  11. package/dist/commands/check.js +5 -0
  12. package/dist/commands/extension/config-text.d.ts +2 -0
  13. package/dist/commands/extension/config-text.js +2 -0
  14. package/dist/commands/extension/index.js +14 -2
  15. package/dist/commands/extension/new.d.ts +16 -0
  16. package/dist/commands/extension/new.js +52 -0
  17. package/dist/commands/extension/pack-files.d.ts +23 -0
  18. package/dist/commands/extension/pack-files.js +78 -0
  19. package/dist/commands/extension/pack-scan.d.ts +24 -0
  20. package/dist/commands/extension/pack-scan.js +131 -0
  21. package/dist/commands/extension/pack.d.ts +48 -0
  22. package/dist/commands/extension/pack.js +142 -0
  23. package/dist/commands/extension/share-text.d.ts +3 -0
  24. package/dist/commands/extension/share-text.js +6 -0
  25. package/dist/commands/extension/share.en.d.ts +32 -0
  26. package/dist/commands/extension/share.en.js +32 -0
  27. package/dist/commands/extension/share.es.d.ts +2 -0
  28. package/dist/commands/extension/share.es.js +32 -0
  29. package/dist/commands/server/setup.d.ts +1 -0
  30. package/dist/commands/ui/index.d.ts +1 -0
  31. package/dist/commands/ui/outside-merge.d.ts +13 -0
  32. package/dist/commands/ui/outside-merge.js +84 -0
  33. package/dist/commands/ui/outside.d.ts +7 -4
  34. package/dist/commands/ui/outside.js +3 -0
  35. package/dist/commands/ui/plan-extensions.d.ts +34 -0
  36. package/dist/commands/ui/plan-extensions.en.d.ts +4 -0
  37. package/dist/commands/ui/plan-extensions.en.js +4 -0
  38. package/dist/commands/ui/plan-extensions.es.d.ts +2 -0
  39. package/dist/commands/ui/plan-extensions.es.js +4 -0
  40. package/dist/commands/ui/plan-extensions.js +86 -0
  41. package/dist/commands/ui/plan-files.js +4 -1
  42. package/dist/commands/ui/prototype-main.d.ts +6 -0
  43. package/dist/commands/ui/studio-routes.js +2 -0
  44. package/dist/commands/ui/studio-state.d.ts +7 -0
  45. package/dist/commands/ui/studio.en.d.ts +2 -0
  46. package/dist/commands/ui/studio.en.js +2 -0
  47. package/dist/commands/ui/studio.es.d.ts +2 -0
  48. package/dist/commands/ui/studio.es.js +2 -0
  49. package/dist/commands/upgrade.js +1 -1
  50. package/dist/ui/page.js +82 -82
  51. package/docs/EXTENSIONS.md +6 -0
  52. package/docs/WORKBENCH.md +25 -2
  53. package/package.json +11 -11
  54. package/skills/ape-add-ai-purpose/SKILL.md +1 -1
  55. package/skills/ape-add-event/SKILL.md +1 -1
  56. package/skills/ape-add-extension/SKILL.md +5 -1
  57. package/skills/ape-add-feature/SKILL.md +1 -1
  58. package/skills/ape-add-generator/SKILL.md +1 -1
  59. package/skills/ape-add-module/SKILL.md +1 -1
  60. package/skills/ape-add-route/SKILL.md +3 -1
  61. package/skills/ape-add-service/SKILL.md +1 -1
  62. package/skills/ape-add-translations/SKILL.md +2 -2
  63. package/skills/ape-admin-screen/SKILL.md +1 -1
  64. package/skills/ape-app-screen/SKILL.md +1 -1
  65. package/skills/ape-critique/SKILL.md +11 -32
  66. package/skills/ape-critique/references/after.md +15 -0
  67. package/skills/ape-critique/references/spacing-pass.md +20 -0
  68. package/skills/ape-deploy/SKILL.md +4 -1
  69. package/skills/ape-design-system/SKILL.md +15 -15
  70. package/skills/ape-design-system/references/by-hand.md +7 -0
  71. package/skills/ape-design-system/references/reference-study.md +11 -0
  72. package/skills/ape-diagnose/SKILL.md +24 -0
  73. package/skills/ape-migration/SKILL.md +1 -1
  74. package/skills/ape-plan-change/SKILL.md +37 -31
  75. package/skills/ape-plan-change/references/change-file-fields.md +5 -0
  76. package/skills/ape-plan-change/references/extensions.md +25 -0
  77. package/skills/ape-plan-change/references/finishing.md +3 -0
  78. package/skills/ape-plan-change/references/fix-from-error.md +3 -0
  79. package/skills/ape-plan-change/references/refactor.md +9 -0
  80. package/skills/ape-plan-change/references/structure.md +19 -0
  81. package/skills/ape-prototype/SKILL.md +13 -23
  82. package/skills/ape-prototype/references/comp.md +3 -0
  83. package/skills/ape-prototype/references/scope-and-export.md +5 -0
  84. package/skills/ape-prototype/references/snapshot.md +3 -0
  85. package/skills/ape-prototype/references/structure.md +11 -0
  86. package/skills/ape-prototype/references/working-app.md +7 -0
  87. package/skills/ape-request/SKILL.md +1 -1
  88. package/skills/ape-upgrade/SKILL.md +4 -1
  89. package/templates/product/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,40 @@ One section per release (a git tag). **Upgrade notes** list anything that breaks
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## v0.8.49 (2026-12-06)
8
+
9
+ - A `sensitive-read` route that a screen refreshes can be audited once per person and state: bind it with `handle(route, handler, { auditOnce: { key, seconds } })`, where `key(result, request, ctx)` names the state read from IDs and versions only (it is stored hashed, not secret) and `seconds` is the window (300 unless set). A successful call whose person, route, object, account and key already have a row younger than the window writes none; a changed key, another person or object, or a passed window writes one. The audit log checks and writes under one database lock, so several API processes and a restart share the window, and at worst write an extra row; the window reads each process's clock, so drift between them (seconds with NTP) moves its edge by that much. A read of the same state from a second screen within the window writes none. Denials, errors, machines' reads (through a door or a credential, or an added kind not read as people), and the rows a handler writes itself are recorded every time, and the route stays a `sensitive-read` everywhere else. Start refuses `auditOnce` on a route that isn't a `sensitive-read` or is an action. Routes without it are unchanged.
10
+
11
+ **Upgrade:** nothing to do.
12
+ - BuffCore's `ape-*` skills are cheaper to load and easier to follow. Each description now says what the skill is, then "Use when …", in under 200 characters. `ape-upgrade` and `ape-deploy` carry `disable-model-invocation: true`, so only a person starts them; an agent still reads them by path for the work it does alone (phone builds, the settings file, the notes after an upgrade). The four longest skills (`ape-prototype`, `ape-plan-change`, `ape-critique`, `ape-design-system`) keep what every path needs and point into a `references/` folder beside them for the rest, and their steps end with something to check. A new `ape-diagnose` skill runs a bug down in six gates (a failing command first, a cut-down case, hypotheses that can be proven wrong, debug logging with one prefix, a regression test, secrets redacted), starting from `ape mcp`'s `recent_errors` and `change_from_error`. Skills that ask the owner ask in numbered rounds, each question with a recommendation. `ape check skills` checks all of this.
13
+
14
+ **Upgrade notes** (every product): `ape upgrade` refreshes the skills, their `references/` folders included, and the skills list in AGENTS.md. Add `ape check skills` to the `lint` script in `package.json` (after `ape check secrets`), as new products have it. A product's own skill that changes versions or ships can take `disable-model-invocation: true` in its front matter too.
15
+ - Payments bills usage by the unit (BuffApe's request, BR50). A plan in `settings.payments.plans` may name metered prices, `metered: { '<lookup key>': { unit, lineType? } }`: Stripe prices whose `recurring.usage_type` is `metered`, on a Billing Meter. Checkout and `change_items` put them on the subscription with no quantity, and refuse, in English or Spanish, a named key whose price isn't metered, a meter that isn't active or doesn't sum, a price with `transform_quantity`, and two metered prices on one meter; while a plan has metered prices, the portal offers no plan switch. Server code reports usage with `reportUsage(ctx, accountId, { price, quantity, at, key })`: one row per `key`, written with its send job in one transaction (the same report again answers `counted: false` and re-queues an unsent one; the same key for other usage is refused), refused for a price the account's plan doesn't name; the job `payments.send_usage` sends it to Stripe's meter events and retries a failed send, never resending one reported over 23 hours ago once a send was started (`too_late`), and the row says whether Stripe took it. No route or tool reports usage. `get_billing` and the console's `get_overview` show each metered price's quantity this period and amount so far (a new `usage` list), to those who already see them. On the invoice, usage is a paid line of its own type (`usage` unless set), so affiliates' commission treats it like a plan. Migration `payments/0004-metered-usage` only adds (the `payments_usage` table and the subscription's period start).
16
+
17
+ **Upgrade notes** (every product): with `@buffcore/payments`, a test or screen that builds a `Billing` value by hand adds `usage: []`; nothing else changes for a product that names no metered price. To bill usage, follow the payments README's "Metered prices".
18
+
19
+ - A hosted studio can merge an outside change through its host: register `outside.changes.act({ viewer, change, signal })` and `POST /api/outside/merge` (a person with the `build` right, from the page) calls it once, in the studio's one merge queue (refused as busy while a studio merge runs, and the reverse; like a person's inside merge, it is not stopped by the Autopilot merge hold), within `outside.timeoutMs`. The answer (`merged` with an optional receipt, `refused` with a code, `pending`, or a timeout or error) comes back in the page's words, English and Spanish, and the outside source is read again; Autopilot never calls it. Studio state carries `outside.merges: true`; the studio's page has the Merge action ready for the Work board's outside rows, which are not drawn yet (they wait for a drawn prototype). A host without `act` sees no change.
20
+
21
+ **Upgrade notes** (hosts with `outside.changes`): `act` was reserved and typed `Promise<unknown>`; it now must answer `{ status: 'merged', receipt? }`, `{ status: 'refused', code }` or `{ status: 'pending' }` (`OutsideActAnswer` from `@buffcore/contracts/workbench`), merge only ids the host listed for a viewer it lets merge, stop when its `signal` aborts, and be safe to call again for the same id (after a timeout the studio keeps the merge queue taken until `act` settles, at most four time limits, but a person may press Merge again later); it is refused at start when it is not a function. Hosts with no `act` do nothing.
22
+ - **The host's agent can read and propose a product setting (HS1).** A product that runs on a machine its host manages may set `hostSettings: { service, fields }` in `buffcore.config.ts` (with `automation` on): the host's agent, signed in with the host's key (`x-host-key`; the product's settings hold only its SHA-256 in `APE_HOST_KEY_SHA256`), reads those fields of that one service at `GET /v1/host/settings` (a secret only as set or not) and proposes a change at `POST /v1/host/settings` (a secret only as the host's `{ ref }`). Each proposal waits for an Owner in Automation › Approvals, showing the values and the reference, and is set only when an active Owner approves it. The key reaches nothing else, every step is audited without values, and a product that doesn't set `hostSettings` is unchanged. The approval shows each plain value as it was and becomes, and says when a saved secret will be sent to a new server. A route may now say `actorsOnly: true` to refuse every kind not in its `actors`, the kernel's too. The host: make a random key of 32 bytes or more, keep it in your vault, give the product its SHA-256, and answer only this product's references.
23
+ - The words the server sends the admin console follow the request's language: action titles, status lines and kill-switch descriptions arrive in Spanish when the console asks for Spanish, and pseudo-localized when it is in `en-XA` or `ar-XB` (outside production a pseudo-locale asked for first now wins over the person's saved language for the words served back; the request's `ctx.locale`, which rows, jobs and emails get, stays the real language), so a pseudo-locale audit sees them too. An approval's subject in the inbox is now its action's title in the reader's language, read when it is shown, and a status line whose name is a catalog key no catalog has shows its check's key instead of the raw message key (a plain name, such as `Queue`, still shows as given). A kill switch's description now reads from its declaring module's catalog, `<module>.switches.<switch key>`; BuffCore's own switches (Apps and its AI purposes) ship in English and Spanish. A product switch or purpose without that key shows its description as declared, as before; data such as a status item's name is never translated.
24
+
25
+ **Upgrade:** nothing to do. To translate a product's own switch or purpose description, add `<module>.switches.<switch key>` to the module's catalogs.
26
+
27
+ - A product's plan says what it will do for each capability it needs. `plan/extensions.md` holds one line each, `- <kind>: <name> - <why>`: `use` what exists, `improve` a catalog extension, `build to share`, `request` from BuffCore, or `product only`, with `(extra: <cost>)` on a line built to share. `ape change` names a line with an unknown kind, and the studio's Plan page shows the lines in groups with the extra cost of sharing. `ape extension new <key>` starts a shared piece in the product's `packages/` from the extension template, and `ape extension pack <key>` writes a submission bundle for the catalog the product names (the package, its check report, the scan, what it can touch, its licence, its screens), refusing a secret, real-looking personal data or the product's own name. It never publishes or calls the network. The `ape-plan-change` and `ape-add-extension` skills say how.
28
+
29
+ **Upgrade notes** (every product): `ape upgrade` refreshes the two skills. A product with a `plan/extensions.md` written another way gets its lines named by `ape change`: rewrite each as `- <kind>: <name> - <why>`.
30
+
31
+ - Members can sign up and in without a password, and use passkeys, each where the product turns it on. `signIn: { methods: ['email-code'] }` alone is now allowed: `POST /v1/sign-up` then takes a name and an email, answers `next: 'sign-in-code'` after the same work for every address, and a queued job makes the member with no password and emails a sign-in code; signing in with it confirms the address; a known address gets a code to its own account. Without `password` listed, a member's password signs nobody in and their reset sets none; operators keep theirs. With `methods: ['password', 'email-code']` the password may be left out the same way. `signIn: { members: { passkeys: 'offer' } }` lets a signed-in member add a passkey in the app and sign in with it, on operators' rules (confirmed on the device, its last use kept), listed and removed through the new `GET /v1/me/sign-in` and `DELETE /v1/me/passkeys/:passkeyId`, with an audit row as the member; the API warns at start when the app's host can't use them. `signIn: { newDevice: 'confirm' }` has a member confirm once each device they sign in on with a password: from a device the server didn't make and record as theirs (an httpOnly cookie on the web, `x-ape-sign-in-device` from a phone through the SDK's `signInDevice`), a right password answers 403 `confirm_device` with no session and the member is emailed a code; `POST /v1/auth/sign-in/confirm-device { token, code }` (the SDK's `auth.confirmDevice`, read the answer with `confirmDeviceOf`) or a passkey sign-in gives the session. Code, passkey, Apple and Google sign-ins confirm their own device; an ID is kept only when it is already the member's own (a `__Host-` cookie in production), and an address gets at most 5 of these code emails an hour. A wrong password answers as always. Wrong, expired and used confirmation codes and wrong sign-in codes count toward the address's pause with wrong passwords, which holds the confirmation too. `GET /v1/me/sign-in` lists the member's devices and `DELETE /v1/me/sign-in-devices/:deviceId` removes one, signing it out; devices are in privacy export and deletion (and an account's deletion now removes its members' passkeys too). All three are off by default, and operators are unchanged. The template's and the console's sign-in screens follow in a later release.
32
+
33
+ **Upgrade:** nothing to do. A product that turns members' passkeys on keeps the app on the console's host or one under it (the passkeys' relying party). Sign-up by code runs on the worker, so a product that offers it runs one; a code sign-up whose job runs more than an hour late is dropped, with a warning in the log. A tool that reads `POST /v1/sign-up` should accept `next: 'sign-in-code'`. Identity's migration `0009-sign-in-devices` only adds (a table, and a column on `auth_sessions`). A product that turns on `newDevice` and has a phone app passes `signInDevice` (secure storage) to `createClient` there, and shows a confirmation step on `confirm_device`.
34
+
35
+ - Sign in with GitHub, the first outside provider: a person signs up or in with GitHub (state and PKCE), links it to their account from a fresh sign-in, and disconnects it; the Owner lists and unlinks a person's linked identities. The token is sealed at rest and never reaches a client, a log, an audit row or an export; the product's server code gets it for the signed-in person with `outsideToken(ctx, 'github')` from `@buffcore/modules/identity`, audited and renewed when GitHub allows. Extensions add other providers with `outsideProviders`. An outside sign-in is never joined to an existing person by email: they link it themselves. Staff never get a session from Apple, Google or GitHub, nor a link to one, so two-step sign-in is never skipped (this also closes that gap for Apple and Google, which could join an operator by a verified email). Details in IDENTITY_ACCESS.md.
36
+
37
+ **Upgrade notes** (every product): an active operator can no longer reach the product's app by Apple, Google or GitHub (the app already refuses their password and emailed code): staff who used one there need a separate member address. Adding an operator, or turning one back on, now ends that person's sessions, so they sign in again with password and authenticator. The app still shows its general sign-in failure for `?error=USE_PASSWORD` (no message for it yet).
38
+
39
+ To turn it on, add `'github'` to `signIn.methods` in `buffcore.config.ts`, register `<API>/v1/auth/callback/github` as the callback of a GitHub OAuth app (or GitHub App), and set its client ID and secret (and any more scopes, e.g. `repo`) in Admin › Services › Sign in with GitHub. The sign-in library's `/v1/auth/get-access-token`, `/refresh-token`, `/account-info` and `/unlink-account` now answer 404, and `/v1/auth/link-social` takes only outside providers.
40
+
7
41
  ## v0.8.48 (2026-12-05)
8
42
 
9
43
  - 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.
@@ -2,6 +2,10 @@ import { type MergeResult, type MergeTools } from './change-merge.ts';
2
2
  export declare function lockPath(root: string, git?: import("./change-merge.ts").MergeGit): Promise<string>;
3
3
  /** Shared across checkouts and studios; a stopped merge's lock waits for the person to remove it. */
4
4
  export declare function mergingChange(root: string): Promise<string | null>;
5
- export declare function locked<T>(root: string, change: string, tools: MergeTools, action: () => Promise<T>): Promise<T | (MergeResult & {
5
+ type Busy = MergeResult & {
6
6
  ok: false;
7
- })>;
7
+ };
8
+ export declare function locked<T>(root: string, change: string, tools: MergeTools, action: () => Promise<T>): Promise<T | Busy>;
9
+ /** The one merge queue: whoever holds the lock (a studio change, an outside merge, a release). */
10
+ export declare function serialized<T>(root: string, holder: string, tools: MergeTools, action: () => Promise<T>): Promise<T | Busy>;
11
+ export {};
@@ -23,9 +23,13 @@ export async function mergingChange(root) {
23
23
  export async function locked(root, change, tools, action) {
24
24
  if (!/^C-\d{3,}$/.test(change))
25
25
  return refuse('held', 'change.merge.missing');
26
+ return serialized(root, change, tools, action);
27
+ }
28
+ /** The one merge queue: whoever holds the lock (a studio change, an outside merge, a release). */
29
+ export async function serialized(root, holder, tools, action) {
26
30
  const path = await lockPath(root, tools.git);
27
31
  try {
28
- const text = lockText(change);
32
+ const text = lockText(holder);
29
33
  await writeFile(path, text, { flag: 'wx' }).catch(async (error) => {
30
34
  if (error?.code !== 'EEXIST')
31
35
  throw error;
@@ -17,6 +17,7 @@ import { MilestoneVersionsPending, requireLegacyChange } from './prototype/miles
17
17
  import { serviceEnvWithExample, unavailableService } from './services/reachability.js';
18
18
  import { checkNotice, t as checkT } from './ui/command-environment.en.js';
19
19
  import { commandEnvironment } from './ui/command-environment.js';
20
+ import { planExtensionProblems } from './ui/plan-extensions.js';
20
21
  export { runChecks } from './change-checks.js';
21
22
  /** Resolve what a change touches against the manifest: what exists (and where), what is new. */
22
23
  export function resolveTouches(touches, manifest) {
@@ -77,6 +78,8 @@ export async function changeResult(id, options, load, root = findRoot()) {
77
78
  file,
78
79
  branch,
79
80
  }));
81
+ // The plan's extension list is checked with the change files: an unknown kind is a problem.
82
+ problems.push(...(await planExtensionProblems(root)));
80
83
  return { ok: problems.length === 0, changes: listed, problems };
81
84
  }
82
85
  const own = problems.filter((p) => p.file.startsWith(`plan/changes/${id}-`));
@@ -0,0 +1,16 @@
1
+ import { en } from './check-skills.en.ts';
2
+ export declare const t: (key: keyof typeof en, values?: Record<string, unknown>) => string;
3
+ export declare const DESCRIPTION_LIMIT = 200;
4
+ /** Skills a person starts: the model never starts them by itself. */
5
+ export declare const PERSON_STARTED: string[];
6
+ /** The four longest skills, kept under the limit by moving branch-only detail to `references/`. */
7
+ export declare const LONG_SKILLS: string[];
8
+ export declare const SKILL_LIMIT = 13500;
9
+ /** ape-diagnose's six gates, each by the words that name it. */
10
+ export declare const DIAGNOSE_GATES: string[];
11
+ /** The words that make a question round, in ape-plan-change. */
12
+ export declare const ROUND_WORDING: string[];
13
+ /** Every problem with the `ape-*` skills in a skills folder (a product's `.claude/skills`). */
14
+ export declare function skillsProblems(skillsDir: string): string[];
15
+ /** Run from a product's root (or BuffCore's): exit 1 with each problem on its own line. */
16
+ export declare function checkSkills(root?: string): void;
@@ -0,0 +1,14 @@
1
+ export declare const en: {
2
+ readonly 'skills.command': "Fail on a BuffCore skill out of shape: its description's trigger form and length, the person-started flag, the long skills' size and references, ape-diagnose's gates, questions in rounds";
3
+ readonly 'skills.form': '{skill}: the description is not in trigger form ("<what it is>. Use when <case>, <case>.")';
4
+ readonly 'skills.length': '{skill}: the description is {length} characters, over {limit}';
5
+ readonly 'skills.flag': '{skill}: a person starts it, so its front matter needs disable-model-invocation: true';
6
+ readonly 'skills.size': '{skill}: SKILL.md is {size} bytes, over {limit}: move branch-only detail to references/';
7
+ readonly 'skills.noReferences': '{skill}: a long skill with no pointer into references/';
8
+ readonly 'skills.pointer': '{skill}: {file} points at {target}, which does not exist';
9
+ readonly 'skills.orphan': '{skill}: {file} is in references/ but SKILL.md never points at it';
10
+ readonly 'skills.missing': '{skill} is missing';
11
+ readonly 'skills.gate': '{skill}: the gate "{gate}" is missing';
12
+ readonly 'skills.rounds': '{skill}: it has the agent ask the owner, but never says to ask in rounds';
13
+ readonly 'skills.roundWording': '{skill}: the question-round wording "{words}" is missing';
14
+ };
@@ -0,0 +1,14 @@
1
+ export const en = {
2
+ 'skills.command': "Fail on a BuffCore skill out of shape: its description's trigger form and length, the person-started flag, the long skills' size and references, ape-diagnose's gates, questions in rounds",
3
+ 'skills.form': '{skill}: the description is not in trigger form ("<what it is>. Use when <case>, <case>.")',
4
+ 'skills.length': '{skill}: the description is {length} characters, over {limit}',
5
+ 'skills.flag': '{skill}: a person starts it, so its front matter needs disable-model-invocation: true',
6
+ 'skills.size': '{skill}: SKILL.md is {size} bytes, over {limit}: move branch-only detail to references/',
7
+ 'skills.noReferences': '{skill}: a long skill with no pointer into references/',
8
+ 'skills.pointer': '{skill}: {file} points at {target}, which does not exist',
9
+ 'skills.orphan': '{skill}: {file} is in references/ but SKILL.md never points at it',
10
+ 'skills.missing': '{skill} is missing',
11
+ 'skills.gate': '{skill}: the gate "{gate}" is missing',
12
+ 'skills.rounds': '{skill}: it has the agent ask the owner, but never says to ask in rounds',
13
+ 'skills.roundWording': '{skill}: the question-round wording "{words}" is missing',
14
+ };
@@ -0,0 +1,2 @@
1
+ import type { en } from './check-skills.en.ts';
2
+ export declare const es: Record<keyof typeof en, string>;
@@ -0,0 +1,14 @@
1
+ export const es = {
2
+ 'skills.command': 'Falla si una habilidad de BuffCore no tiene la forma debida: la forma de activación y la longitud de su descripción, la marca de inicio por una persona, el tamaño y las referencias de las habilidades largas, las compuertas de ape-diagnose, las preguntas por rondas',
3
+ 'skills.form': '{skill}: la descripción no tiene forma de activación ("<qué es>. Use when <caso>, <caso>.")',
4
+ 'skills.length': '{skill}: la descripción tiene {length} caracteres, más de {limit}',
5
+ 'skills.flag': '{skill}: la inicia una persona, así que su cabecera necesita disable-model-invocation: true',
6
+ 'skills.size': '{skill}: SKILL.md tiene {size} bytes, más de {limit}: pasa el detalle de un solo camino a references/',
7
+ 'skills.noReferences': '{skill}: una habilidad larga sin ningún enlace a references/',
8
+ 'skills.pointer': '{skill}: {file} apunta a {target}, que no existe',
9
+ 'skills.orphan': '{skill}: {file} está en references/ pero SKILL.md nunca apunta a él',
10
+ 'skills.missing': 'falta {skill}',
11
+ 'skills.gate': '{skill}: falta la compuerta "{gate}"',
12
+ 'skills.rounds': '{skill}: hace que el agente pregunte al dueño, pero nunca dice que pregunte por rondas',
13
+ 'skills.roundWording': '{skill}: falta el texto de las preguntas por rondas "{words}"',
14
+ };
@@ -0,0 +1,146 @@
1
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
2
+ import { join, relative, sep } from 'node:path';
3
+ import { createI18n } from '@buffcore/i18n';
4
+ import { en } from './check-skills.en.js';
5
+ import { es } from './check-skills.es.js';
6
+ import { descriptionOf } from './skills-list.js';
7
+ /**
8
+ * `ape check skills`: BuffCore's `ape-*` skills keep the shape agents rely on. Every session loads
9
+ * each description, so it says what the skill is and when to use it, short. A skill a person starts
10
+ * (it ships, deploys or changes a running product's versions) is never started by the model. The
11
+ * long skills keep what every path needs and point into `references/` for the rest, and those
12
+ * pointers resolve. `ape-diagnose` keeps its six gates, and a skill that has the agent ask the
13
+ * owner asks in rounds.
14
+ */
15
+ const messages = createI18n({ catalogs: [{ en, es }] });
16
+ export const t = (key, values) => messages.t(/^es(?:[-_.]|$)/i.test(process.env.LC_ALL || process.env.LANG || '') ? 'es' : 'en', key, values);
17
+ export const DESCRIPTION_LIMIT = 200;
18
+ /** "<what it is>. Use when <case>, <case>.": one sentence of what, then the cases. */
19
+ const TRIGGER_FORM = /^\S[^\n]*?\. Use when [^\n]+\.$/;
20
+ /** Skills a person starts: the model never starts them by itself. */
21
+ export const PERSON_STARTED = ['ape-upgrade', 'ape-deploy', 'ape-release'];
22
+ /** The four longest skills, kept under the limit by moving branch-only detail to `references/`. */
23
+ export const LONG_SKILLS = [
24
+ 'ape-prototype',
25
+ 'ape-plan-change',
26
+ 'ape-critique',
27
+ 'ape-design-system',
28
+ ];
29
+ export const SKILL_LIMIT = 13_500;
30
+ /** ape-diagnose's six gates, each by the words that name it. */
31
+ export const DIAGNOSE_GATES = [
32
+ 'A command that fails because of the bug',
33
+ 'Cut the case down',
34
+ 'Three to five hypotheses that can be proven wrong',
35
+ 'Debug logging with one prefix',
36
+ 'A regression test that fails before the fix and passes after',
37
+ 'Secrets redacted in anything quoted',
38
+ '`recent_errors`',
39
+ '`change_from_error`',
40
+ ];
41
+ /** The words that make a question round, in ape-plan-change. */
42
+ export const ROUND_WORDING = [
43
+ 'ask every question that is ready to decide in one numbered round',
44
+ 'worded so that "yes" accepts it',
45
+ 'Look facts up',
46
+ ];
47
+ /** A skill that has the agent ask the owner or the person something. */
48
+ const ASKS = /\b(?:ask|check with|confirm with)\s+(?:the\s+)?(?:person|owner|founder|user)s?\b|\bask them\b|\bwith the (?:person|owner)\b/i;
49
+ const frontMatter = (text) => text.replace(/\r\n/g, '\n').match(/^---\n([\s\S]*?)\n---/)?.[1] ?? '';
50
+ /** The files under a folder, as paths relative to it with `/`. */
51
+ function filesUnder(dir) {
52
+ if (!existsSync(dir))
53
+ return [];
54
+ return readdirSync(dir, { recursive: true, withFileTypes: true })
55
+ .filter((e) => e.isFile())
56
+ .map((e) => relative(dir, join(e.parentPath, e.name)).split(sep).join('/'))
57
+ .sort();
58
+ }
59
+ /**
60
+ * The `references/…` paths a Markdown file points at, relative to the skill's folder: in
61
+ * backticks, or as a Markdown link (`[the comp](references/comp.md#heading)`).
62
+ */
63
+ function pointersIn(text) {
64
+ const ticked = [...text.matchAll(/`(references\/[^`\s]+)`/g)].map((m) => m[1]);
65
+ const linked = [...text.matchAll(/\]\((?:\.\/)?(references\/[^)\s#]+)(?:#[^)\s]*)?\)/g)].map((m) => m[1]);
66
+ return [...ticked, ...linked].map((p) => p.replace(/\/$/, ''));
67
+ }
68
+ /** Problems with the `references/` pointers of one skill: dangling ones, and orphan files. */
69
+ function referenceProblems(skill, dir) {
70
+ const problems = [];
71
+ const skillText = readFileSync(join(dir, 'SKILL.md'), 'utf8');
72
+ const markdown = [
73
+ 'SKILL.md',
74
+ ...filesUnder(join(dir, 'references')).map((f) => `references/${f}`),
75
+ ];
76
+ for (const file of markdown.filter((f) => f.endsWith('.md'))) {
77
+ for (const target of pointersIn(readFileSync(join(dir, file), 'utf8')))
78
+ if (!existsSync(join(dir, target)))
79
+ problems.push(t('skills.pointer', { skill, file, target }));
80
+ }
81
+ const named = pointersIn(skillText);
82
+ for (const file of filesUnder(join(dir, 'references'))) {
83
+ const path = `references/${file}`;
84
+ const reached = named.some((n) => path === n || path.startsWith(`${n}/`));
85
+ if (!reached)
86
+ problems.push(t('skills.orphan', { skill, file: path }));
87
+ }
88
+ return problems;
89
+ }
90
+ /** Every problem with the `ape-*` skills in a skills folder (a product's `.claude/skills`). */
91
+ export function skillsProblems(skillsDir) {
92
+ const problems = [];
93
+ const names = existsSync(skillsDir)
94
+ ? readdirSync(skillsDir)
95
+ .filter((n) => n.startsWith('ape-') && existsSync(join(skillsDir, n, 'SKILL.md')))
96
+ .sort()
97
+ : [];
98
+ for (const skill of names) {
99
+ const dir = join(skillsDir, skill);
100
+ const text = readFileSync(join(dir, 'SKILL.md'), 'utf8');
101
+ const description = descriptionOf(text);
102
+ if (!TRIGGER_FORM.test(description))
103
+ problems.push(t('skills.form', { skill }));
104
+ if (description.length > DESCRIPTION_LIMIT)
105
+ problems.push(t('skills.length', { skill, length: description.length, limit: DESCRIPTION_LIMIT }));
106
+ const flagged = /^disable-model-invocation:\s*true\s*$/m.test(frontMatter(text));
107
+ if (PERSON_STARTED.includes(skill) && !flagged)
108
+ problems.push(t('skills.flag', { skill }));
109
+ problems.push(...referenceProblems(skill, dir));
110
+ if (LONG_SKILLS.includes(skill)) {
111
+ // Bytes with `\n` line ends, so a checkout with CRLF measures the same.
112
+ const size = Buffer.byteLength(text.replace(/\r\n/g, '\n'));
113
+ if (size > SKILL_LIMIT)
114
+ problems.push(t('skills.size', { skill, size, limit: SKILL_LIMIT }));
115
+ if (!pointersIn(text).length)
116
+ problems.push(t('skills.noReferences', { skill }));
117
+ }
118
+ if (ASKS.test(text) && !/\bin rounds\b/i.test(text))
119
+ problems.push(t('skills.rounds', { skill }));
120
+ }
121
+ if (!names.length)
122
+ return problems;
123
+ const diagnose = join(skillsDir, 'ape-diagnose', 'SKILL.md');
124
+ if (!existsSync(diagnose))
125
+ problems.push(t('skills.missing', { skill: 'ape-diagnose' }));
126
+ else {
127
+ const text = readFileSync(diagnose, 'utf8');
128
+ for (const gate of DIAGNOSE_GATES.filter((g) => !text.includes(g)))
129
+ problems.push(t('skills.gate', { skill: 'ape-diagnose', gate }));
130
+ }
131
+ const plan = join(skillsDir, 'ape-plan-change', 'SKILL.md');
132
+ if (existsSync(plan)) {
133
+ const text = readFileSync(plan, 'utf8');
134
+ for (const words of ROUND_WORDING.filter((w) => !text.includes(w)))
135
+ problems.push(t('skills.roundWording', { skill: 'ape-plan-change', words }));
136
+ }
137
+ return problems;
138
+ }
139
+ /** Run from a product's root (or BuffCore's): exit 1 with each problem on its own line. */
140
+ export function checkSkills(root = process.cwd()) {
141
+ const problems = skillsProblems(join(root, '.claude', 'skills'));
142
+ if (!problems.length)
143
+ return;
144
+ console.error(problems.join('\n'));
145
+ process.exitCode = 1;
146
+ }
@@ -2,6 +2,7 @@ import { checkBoundaries } from './check-boundaries.js';
2
2
  import { checkPlaces } from './check-places.js';
3
3
  import { checkPublic } from './check-public.js';
4
4
  import { checkSecrets } from './check-secrets.js';
5
+ import { checkSkills, t as skillsT } from './check-skills.js';
5
6
  import { checkCompatible, t } from './compatible.js';
6
7
  import { t as placesT } from './extension/places-messages.js';
7
8
  /** `ape check …`: checks on the repository, each part of `pnpm lint`. */
@@ -28,4 +29,8 @@ export function addCheckCommand(program) {
28
29
  .command('boundaries')
29
30
  .description("Fail on a module reaching past another's public entry: its files, entities or tables")
30
31
  .action(() => checkBoundaries());
32
+ check
33
+ .command('skills')
34
+ .description(skillsT('skills.command'))
35
+ .action(() => checkSkills());
31
36
  }
@@ -15,6 +15,8 @@ export declare function configObject(text: string): {
15
15
  export declare function literalGrants(config: Map<string, Field>): Grants;
16
16
  export declare function readEditConfig(root: string): Promise<{
17
17
  grants: Grants;
18
+ /** The product's own name, as its config writes it. */
19
+ name: () => string;
18
20
  catalog: () => Pick<ProductConfig, 'buffcore' | 'catalog'>;
19
21
  }>;
20
22
  export {};
@@ -108,6 +108,8 @@ export async function readEditConfig(root) {
108
108
  const { fields: config } = configObject(file);
109
109
  return {
110
110
  grants: literalGrants(config),
111
+ /** The product's own name, as its config writes it. */
112
+ name: () => string(config.get('name'), 'name'),
111
113
  catalog: () => {
112
114
  const buffcore = string(config.get('buffcore'), 'buffcore');
113
115
  const node = config.get('catalog');
@@ -2,9 +2,12 @@ import { t as compatibleT } from '../compatible.js';
2
2
  import { add } from './add.js';
3
3
  import { exportProduct } from './export.js';
4
4
  import { checkExtensionGrants } from './grant-check.js';
5
+ import { newExtensionCommand } from './new.js';
6
+ import { packCommand } from './pack.js';
5
7
  import { t } from './places-messages.js';
6
8
  import { approvePlacesCommand } from './places-terminal.js';
7
9
  import { remove } from './remove.js';
10
+ import { t as shareText } from './share-text.js';
8
11
  import { t as stepsText } from './steps.js';
9
12
  /** `ape add`, `ape remove` and `ape export`: extensions in and out of a product (EXTENSIONS.md). */
10
13
  export function addExtensionCommands(program) {
@@ -14,11 +17,20 @@ export function addExtensionCommands(program) {
14
17
  .description(stepsText('extension.check.command'))
15
18
  .option('--json', compatibleT('compatible.json'))
16
19
  .action(checkExtensionGrants);
17
- program
18
- .command('extension')
20
+ const extension = program.command('extension');
21
+ extension
19
22
  .command('approve-places')
20
23
  .description(t('places.command'))
21
24
  .action(() => approvePlacesCommand());
25
+ extension
26
+ .command('new <key>')
27
+ .description(shareText('share.new.command'))
28
+ .action((key) => newExtensionCommand(key));
29
+ extension
30
+ .command('pack <key>')
31
+ .description(shareText('share.pack.command'))
32
+ .option('--out <folder>', shareText('share.pack.out'))
33
+ .action((key, options) => packCommand(key, options));
22
34
  program
23
35
  .command('add <name|path>')
24
36
  .description('Install an extension (development only): show what it asks for and ask, write its grant into buffcore.config.ts and the generated imports, migrate')
@@ -0,0 +1,16 @@
1
+ export declare class ShareRefused extends Error {
2
+ }
3
+ /**
4
+ * `ape extension new <key>`: a "build to share" piece starts as an extension in the product's
5
+ * `packages/`, from the same template `ape create --extension` writes: its own `<key>_` tables,
6
+ * words keyed `<key>.` that name no product, tests on its own small product, and its README as the
7
+ * agent's guide. The product's workspace already lists `packages/*`, so its tests run with the
8
+ * product's; installing it stays `ape add ./packages/<key>`.
9
+ */
10
+ export declare function newExtension(key: string, root?: string): Promise<{
11
+ key: string;
12
+ name: string;
13
+ path: string;
14
+ written: string[];
15
+ }>;
16
+ export declare function newExtensionCommand(key: string): Promise<void>;
@@ -0,0 +1,52 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { readFile, writeFile } from 'node:fs/promises';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { findRoot } from '../../project.js';
6
+ import { BUFFCORE_RELEASE } from '../../version.js';
7
+ import { writeTemplates } from '../create-template.js';
8
+ import { readEditConfig } from './config-text.js';
9
+ import { t } from './share-text.js';
10
+ const template = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', 'templates', 'extension');
11
+ export class ShareRefused extends Error {
12
+ }
13
+ /**
14
+ * `ape extension new <key>`: a "build to share" piece starts as an extension in the product's
15
+ * `packages/`, from the same template `ape create --extension` writes: its own `<key>_` tables,
16
+ * words keyed `<key>.` that name no product, tests on its own small product, and its README as the
17
+ * agent's guide. The product's workspace already lists `packages/*`, so its tests run with the
18
+ * product's; installing it stays `ape add ./packages/<key>`.
19
+ */
20
+ export async function newExtension(key, root = findRoot()) {
21
+ if (!/^[a-z][a-z0-9]*$/.test(key))
22
+ throw new ShareRefused(t('share.new.key'));
23
+ if (!existsSync(join(root, 'buffcore.config.ts')))
24
+ throw new ShareRefused(t('share.new.product'));
25
+ if (/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/.test(key))
26
+ throw new ShareRefused(t('share.new.reserved', { key }));
27
+ if ((await readEditConfig(root)).grants[key])
28
+ throw new ShareRefused(t('share.new.installed', { key }));
29
+ const path = `packages/${key}`;
30
+ const dir = join(root, path);
31
+ if (existsSync(dir))
32
+ throw new ShareRefused(t('share.new.exists', { path }));
33
+ const Key = key[0]?.toUpperCase() + key.slice(1);
34
+ const { written } = await writeTemplates(dir, { name: key, key, Key, buffcore: BUFFCORE_RELEASE }, false, [template]);
35
+ // Inside a product, the sample product is the one its tests define; this product is its first user.
36
+ const readme = join(dir, 'README.md');
37
+ const text = await readFile(readme, 'utf8');
38
+ await writeFile(readme, text.replace(/^`packages\/\w+` is the extension; this repository is its first sample product\.$/m, `\`${path}\` is an extension built to share: its tests run their own small product, and this product is its first user.`));
39
+ return { key, name: `${key}-extension`, path, written };
40
+ }
41
+ export async function newExtensionCommand(key) {
42
+ try {
43
+ const made = await newExtension(key);
44
+ console.log(t('share.new.made', made));
45
+ }
46
+ catch (error) {
47
+ if (!(error instanceof ShareRefused))
48
+ throw error;
49
+ console.error(error.message);
50
+ process.exitCode = 1;
51
+ }
52
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * What `ape extension pack` may ship, as an allow-list: a file it can read as text (UTF-8, or
3
+ * UTF-16 with its byte-order mark), or an image or font whose printable runs it scans. Anything
4
+ * else (an archive, another binary, a file that does not decode) is refused and named. Dotfiles
5
+ * and dot-folders never ship, except a few known to hold no data; nor do credential, key and
6
+ * certificate files. Each file is read once: the bytes scanned are the bytes written.
7
+ */
8
+ export interface PackFile {
9
+ file: string;
10
+ bytes: Buffer;
11
+ /** The text the rules read: the file's own, or an image's or font's printable runs. */
12
+ text: string;
13
+ }
14
+ export type Unshippable = {
15
+ file: string;
16
+ why: 'hidden' | 'secretFile' | 'notText';
17
+ };
18
+ /** The file's text, or null when it is not text: UTF-16 by its mark, else strict UTF-8 with no NUL. */
19
+ export declare function decode(bytes: Buffer): string | null;
20
+ export declare function readPackage(dir: string): Promise<{
21
+ files: PackFile[];
22
+ refused: Unshippable[];
23
+ }>;
@@ -0,0 +1,78 @@
1
+ import { readdir, readFile } from 'node:fs/promises';
2
+ import { join, relative, sep } from 'node:path';
3
+ import { SECRET_FILE } from '../check-secrets.js';
4
+ /** Built output and installed packages are not the package's own; they are neither read nor shipped. */
5
+ const SKIPPED_DIRS = new Set(['node_modules', 'dist', 'coverage']);
6
+ const SAFE_DOTFILES = new Set(['.gitignore', '.npmignore', '.editorconfig']);
7
+ /** Credentials, keys and certificates by their name, beyond `ape check secrets`' own list. */
8
+ const SECRET_NAME = /(^|\/)(credentials[^/]*\.json|secrets\.(ya?ml|json)|service-account[^/]*\.json|kubeconfig|\.envrc|\.npmrc|\.dev\.vars|id_[a-z0-9]+)$|\.(pem|key|crt|cer|der|p8|p12|pfx|ppk|jks|keystore|kdbx|gpg|asc|tfstate|tfstate\.backup)$/i;
9
+ /**
10
+ * Images and fonts may ship; their printable runs are scanned. Compressed data (woff2, a PNG's
11
+ * zTXt and iTXt chunks) cannot be read that way, so woff2 is not on the list.
12
+ */
13
+ const MEDIA = /\.(png|jpe?g|gif|webp|avif|ico|woff|ttf|otf)$/i;
14
+ /** Compressed by their kind, whatever their bytes look like: never shipped. */
15
+ const COMPRESSED = /\.(woff2|zip|gz|tgz|tar|7z|rar|jar|br|zst|xz|bz2)$/i;
16
+ async function walk(dir, at, out) {
17
+ for (const entry of await readdir(at, { withFileTypes: true })) {
18
+ if (entry.isSymbolicLink())
19
+ continue;
20
+ const path = join(at, entry.name);
21
+ if (entry.isDirectory()) {
22
+ if (!SKIPPED_DIRS.has(entry.name))
23
+ await walk(dir, path, out);
24
+ }
25
+ else if (entry.isFile())
26
+ out.push(relative(dir, path).split(sep).join('/'));
27
+ }
28
+ }
29
+ /** The file's text, or null when it is not text: UTF-16 by its mark, else strict UTF-8 with no NUL. */
30
+ export function decode(bytes) {
31
+ if (bytes[0] === 0xff && bytes[1] === 0xfe)
32
+ return bytes.subarray(2).toString('utf16le');
33
+ if (bytes[0] === 0xfe && bytes[1] === 0xff) {
34
+ const swapped = Buffer.from(bytes.subarray(2));
35
+ swapped.swap16();
36
+ return swapped.toString('utf16le');
37
+ }
38
+ if (bytes.includes(0))
39
+ return null;
40
+ try {
41
+ return new TextDecoder('utf-8', { fatal: true }).decode(bytes);
42
+ }
43
+ catch {
44
+ return null;
45
+ }
46
+ }
47
+ /** Printable ASCII runs of 6 or more, one a line: what `strings` would show of a binary. */
48
+ const runs = (bytes) => (bytes.toString('latin1').match(/[\x20-\x7e]{6,}/g) ?? []).join('\n');
49
+ export async function readPackage(dir) {
50
+ const names = [];
51
+ await walk(dir, dir, names);
52
+ const files = [];
53
+ const refused = [];
54
+ for (const file of names.sort()) {
55
+ if (file.split('/').some((part) => part.startsWith('.') && !SAFE_DOTFILES.has(part))) {
56
+ refused.push({
57
+ file,
58
+ why: SECRET_FILE.test(file) || SECRET_NAME.test(file) ? 'secretFile' : 'hidden',
59
+ });
60
+ continue;
61
+ }
62
+ if (SECRET_FILE.test(file) || SECRET_NAME.test(file)) {
63
+ refused.push({ file, why: 'secretFile' });
64
+ continue;
65
+ }
66
+ if (COMPRESSED.test(file)) {
67
+ refused.push({ file, why: 'notText' });
68
+ continue;
69
+ }
70
+ const bytes = await readFile(join(dir, file));
71
+ const text = MEDIA.test(file) ? runs(bytes) : decode(bytes);
72
+ if (text === null)
73
+ refused.push({ file, why: 'notText' });
74
+ else
75
+ files.push({ file, bytes, text });
76
+ }
77
+ return { files, refused };
78
+ }
@@ -0,0 +1,24 @@
1
+ import { type PackFile } from './pack-files.ts';
2
+ /**
3
+ * What `ape extension pack` refuses to hand on: a secret (the rules `ape check secrets` runs), an
4
+ * email or phone number that looks like a real person's, the product's own name, and any file it
5
+ * may not ship (`pack-files.ts`). A finding names the file and line, never the value. A value in
6
+ * the product's `secrets-allow.txt` (reviewed, public by design) is not a finding.
7
+ * Every pattern here runs in time linear in the line: each starts at a boundary and is capped.
8
+ * (Where a pattern is written, it is also spelled so that its own source does not match it.)
9
+ */
10
+ export interface Finding {
11
+ file: string;
12
+ line?: number;
13
+ kind: 'secret' | 'secretFile' | 'hidden' | 'notText' | 'email' | 'phone' | 'name' | 'nameFile';
14
+ message: string;
15
+ }
16
+ /** A text's words, lower case: split at every non-letter-or-digit and at camelCase, in one pass. */
17
+ export declare function words(text: string): string[];
18
+ /** Each finding in one file's text; `allowed` are the product's reviewed public values. */
19
+ export declare function scanText(file: string, text: string, productName: string, allowed?: readonly string[]): Finding[];
20
+ /** Every finding in the package, and the files to ship: exactly the bytes that were scanned. */
21
+ export declare function scanPackage(dir: string, productName: string, allowed?: readonly string[]): Promise<{
22
+ files: PackFile[];
23
+ findings: Finding[];
24
+ }>;