/** * @file Pre-built lockdown profiles for spawnAiAgent. Per CLAUDE.md * "Programmatic Claude calls" rule: every spawn must set tools / disallow / * permissionMode (and the helper always sets --print + * --add-dir cwd). `AI_PROFILE` is a capability ladder — each tier permits * everything the tier above it does, plus one more capability. Spread a tier * and override per call (`tools`/`disallow` to tighten further, `model`, * `addDirs`). Choose the LEAST-capable tier that gets the job done: * * - `AI_PROFILE.read` — research / scanning. Read + Grep + Glob + WebFetch + * WebSearch. No Edit, no Write, no Bash. Static-analysis skills such as * scanning-quality and scanning-security. * - `AI_PROFILE.edit` — in-place edits only. Read + Edit + Grep + Glob. NO * Write, so it cannot create files, and NO Bash. Lint autofix / codemods * constrained to existing files. * - `AI_PROFILE.create` — edit AND create files. Adds Write on top of `.edit`. * Still no Bash. Codegen, adding a test, refactors that split modules. * - `AI_PROFILE.verify` — `.create` plus a READ-ONLY Bash allowlist (node / * `pnpm test`+run / `git status`·diff·log). Lets an agent author files AND * run the verifier, whether its own tests or a check script, but it CANNOT * mutate the repo: no `git add`, no `git commit`, no install. For codegen * that must self-verify without being trusted to land. * - `AI_PROFILE.full` — `.verify` plus the mutating git commands (`git add` / * `git commit`) and `pnpm exec`. Skills that commit, run tests, install * deps. No "wide open" tier exists by design — letting an agent run * arbitrary tools is the lockdown rule's exact failure mode. The ladder is * read ⊂ edit ⊂ create ⊂ verify ⊂ full: each tier's tool set is a superset * of the one above. Bash allowlists are composed from the `BASH_ALLOW` * building blocks below so a caller can assemble a custom tier * (`[...BASH_ALLOW.git, ...BASH_ALLOW.test]`) without forking a profile * literal. */ import type { PermissionMode } from './types.js'; export interface AiProfile { readonly allow: readonly string[]; readonly disallow: readonly string[]; readonly permissionMode: PermissionMode; readonly tools: readonly string[]; } /** * Composable Bash-allowlist building blocks. Each group is a frozen list of * `Bash(:*)` glob entries; the profiles below compose tiers from them, and * callers can mix their own (`allow: [...BASH_ALLOW.test, 'Bash(make:*)']`) * without rewriting a whole tier's literal. * * - `gitRead` — non-mutating inspection (`status` / `diff` / `log`). * - `gitWrite` — mutating (`add` / `commit`). The bright line between `verify`, * which may not land, and `full`, which may. * - `node` — run a `.mts` / `.js` directly: tests, check scripts, codegen. * - `test` — `pnpm test` / `pnpm run