# Pi Extensions Workspace ## New extension 1. `extensions/{name}/package.json` — template below 2. `extensions/{name}/index.ts` 3. `bun install` ## package.json ```json { "name": "@bugabinga/pi-ext-{name}", "version": "0.0.0", "private": true, "type": "module", "main": "index.ts", "peerDependencies": { "@earendil-works/pi-coding-agent": "*" } } ``` Add only deps actually imported by the extension. Prefer `peerDependencies` for Pi packages (`@earendil-works/*`). Run `bun install` after any structural change. ## Independence - Extensions must be standalone packages. - Never import from another `@bugabinga/pi-ext-*` package. - Optional integration must be capability/event based and degrade cleanly. - If behavior is important, provide a native fallback; decorative integration may no-op. ## Publishing - Source of truth for release gates: `justfile` → `scripts/extensions.py`. - Run `just check [{name}]` before `npm publish`. - License is MIT. ## Documentation - READMEs must be terse. - Do not duplicate source-of-truth docs/config/API details. - Link to canonical source files, commands, settings, or upstream docs instead. - Package README should answer: what, install/load, commands/tools, settings link, optional integrations. ## Imports | Package | Provides | Use | | ------------------------------- | ------------------------------------ | -------------------------------------- | | `@earendil-works/pi-coding-agent` | SDK — ExtensionAPI, types, ctx | Always (peer dep) | | `@earendil-works/pi-tui` | TUI components, truncateToWidth, Key | Rendering | | `@bugabinga/pi-ext-*` | — | **Never import from other extensions** |