# Pi Extensions Workspace Monorepo for Pi extensions under `extensions/*`. ## Automation law - Mise is the only public automation interface. - `mise.toml` files are the source of truth for tools, tasks, dependencies, and orchestration. - Use an existing Mise task instead of invoking its npm script, Node script, formatter, test runner, or browser runner directly. - Root npm scripts are task implementation details. - Extension package scripts are prohibited. - Add missing automation to the appropriate `mise.toml`; do not create ad hoc scripts or bypass Mise. - If Mise or its project config blocks progress, report the exact failure and stop rather than working around it. ## Task discovery Run `mise tasks --all` to list tasks. Use monorepo-root task addresses: `//:` or `//extensions/:`. Use extension-local tasks for one extension; root tasks for repository-wide checks. Before selecting unfamiliar tasks, editing Mise configuration, or managing hooks, read [docs/automation.md](docs/automation.md). ## Efficient execution Choose the smallest task that proves the change. - During iteration, use one extension's local `lint`, `test`, or `check` task. - Agents stop after the smallest affected tasks pass. - Agents run `//:ci`, `//:e2e`, or unrelated suites only when the user explicitly requests that exact wider gate. - Commits, merges, and generic verification requests do not imply wider gates. - For explicitly requested complete tests, run root `//:test` once; do not fan out all extension `test` wrappers into one Vitest process per extension. - For explicitly requested complete static validation, run root `//:check` once; do not fan out all extension `check` wrappers because each repeats repository-wide TypeScript checking. Mise task jobs and tool workers multiply. Set `--jobs` deliberately when invoking multiple independent tasks, because Vitest, Playwright, and other tools manage their own workers. Use `:::` only for independent ad hoc tasks that should run concurrently. ## CI hosting Luci at `ci.bugabinga.net` auto-discovers `.ci/*.kdl` from the public Soft Serve repository. Repository CI must delegate to `CI=true mise run //:ci`; do not duplicate gates in Luci configuration. Full CI runs on Luci after pushing. Run `mise run //:ci` locally only when the user explicitly requests it. ## Extension engineering - Nested model calls must use `ctx.modelRegistry`, never pi-ai compatibility dispatchers, so extension-registered providers work. ### Startup performance - Treat every Win32 process spawn as expensive. - Prefer native Node APIs and defer unavoidable spawns until first use. - Keep entry modules thin and lazy-load command or tool implementations. - Gate optional domain work with cheap relevance checks before imports. - Never block startup or reload on subprocess probes, broad filesystem scans, or Git status. - Abort asynchronous startup work on reload and ignore stale results. - Check executable presence through native `PATH` access, not version subprocesses. - Preserve registration, validation, rendering, and first-use behavior when deferring work. - Measure performance with the complete extension set on Win32 and WSL. ### Tool widget rendering Tool widgets must match Pi built-ins: compact by default, expanded details on `app.tools.expand` (`ctrl+o` by default). Normal tool rows must rely on Pi-owned keyboard and mouse expansion; do not register extension shortcuts or mouse handlers for them. Every custom `renderCall` and `renderResult` must honor native expanded state, including progress, errors, and malformed-detail fallback paths. Collapsed `renderResult` output may show status, counts, paths, IDs, and tiny bounded summaries only. Full content, previews, snippets, verbose logs, structured bodies, and per-result lists require `expanded === true`. When content is hidden, show `keyHint("app.tools.expand", "to expand")`; do not use legacy `expandTools`. Focused custom overlays and non-tool widgets may handle their own expansion action because they do not inherit normal tool-row input handling. ### Cross-platform requirements All extensions must work on Windows, macOS, and Linux. Do not add OS-scoped extensions. Do not rely on shell helpers such as `which`, `bash`, `sed`, `grep`, or `/tmp` when Node APIs can do the job. If an extension uses platform tools, check availability when the extension loads. Notify missing required tools with warning severity and missing optional tools with info severity. Tests for platform-tool behavior must exercise the real extension or tool path with controlled fake binaries on `PATH`, not only mocked helpers. ## Markdown style Use one sentence per line for prose. Keep semantic line breaks unless rewording the sentence. Let `rumdl` handle Markdown structure; do not manually reflow paragraphs for visual width. ## Git hooks - `pre-commit` runs check and lint. - `pre-push` runs check and lint. - Luci runs full CI. ## Troubleshooting Run `mise doctor` when a task fails because a command is unavailable. Common causes are missing activation, missing shims, or a mismatched tool binary name.