--- name: add-integration description: Add or replace a stack choice in the generator. Use when adding an integration, a capability, or a new option for a kind (a database, ORM, framework, runtime, deployment), or when renaming one. --- An integration reaches every layer that names its choices: the registry, templates, other integrations, the goldens, the Studio, and the docs. Read [`docs/architecture.md`](../../../docs/architecture.md) "Model", "Resolver", and "Contributions" first, and the vocabulary in [`GLOSSARY.md`](../../../GLOSSARY.md). `git show --stat 451fa8bc` (MongoDB and Mongoose) is the reference change. 1. **Shape.** Write down the kind, `provides`, `requires` (with alternatives), and whether it is `auxiliary`. List the legal stacks it opens and the ones it closes. Done when each new capability has a one-line description you will add to `capabilities` in `packages/integrations/src/registry.ts`. 2. **Tracer bullet.** Create `packages/integrations/src/.ts` with `defineIntegration`, register it in kind position in `registry.ts`, and add its packages to `src/catalog.ts`. Start from the smallest sibling of the same kind (`sqlite.ts` for a database). Done when `vp test packages/integrations/src/registry.test.ts` passes. 3. **Contributions.** Contribute through the slots other owners define (`packageJson`, `serverEnv`, `dockerRuntime`, `lintOverrides`, `readmeLayers`); a file you return is yours alone. Where another owner's file changes with your choice, branch inside that owner on `ctx.has("")` or a helper in `src/app.ts`. Static files go under `templates///`. Done when `rg 'ctx.has\(""\)' packages/integrations/src` shows every place a sibling is named, and each one decides what your id does there. 4. **Goldens.** The goldens together use every integration (`src/golden.test.ts`). Swap the new choice into the golden whose product it fits in `src/goldens.ts`, adjust that test's expected setup commands, and run `vp run stacks goldens`. Give the stack label a segment in `src/stack-label.ts` when two stacks would otherwise share a name. Done when `vp test packages/integrations/src/golden.test.ts` passes. 5. **Snapshots.** Run `vp test -u`, then read the diff of `src/__snapshots__/` and `schema.json`. It is what every generated project receives. Done when each changed hunk is one you meant. 6. **Services.** A database or server that tests need gets a URL in `src/stacks.ts` (`STACKS_*_URL`), a branch in `src/env-files.ts` (`MaterializeEnvOptions` and the scheme list in `localValue`), and a CI service in `.github/workflows/ci.yml` on Linux and Windows. 7. **Studio and docs.** In `apps/web`: `messages/en.json` and `zh.json` (`desc_`, `fit_`, any `cap_*` and `note_any_*`), `src/lib/i18n.ts`, `src/lib/roles.ts`, `src/assets/tech/.svg`, `src/components/docs/tech-icons.ts`, `src/components/docs/viz/stack-map.tsx`, and the topology in `src/components/topology/` when the choice runs as a process. Then the `stack/*.mdx` page in both languages, `README.md`, `README.zh.md`, `apps/cli/README.md`, and the `--` choices message in `apps/cli/src/command.test.ts`. Done when `vp test apps/web/src/lib/i18n.test.ts` passes. 8. **Finish.** Run the [`self-review`](../self-review/SKILL.md) skill, then `vp run ready`. CI verifies the stacks the change reaches; a red `verify` job names the stack and ends with its log. Done when `vp run ready` passes and the PR body says which legal stacks were added or removed.