# Findings — Issue #1: Create Extension File Structure ## Git Workflow - Branch: `issue-1` (based on origin/main) - Remote: `https://git.excelera.net/david/pi-worktrees.git` - Tool: `fj` CLI for Forgejo issues (auto-detected from git remote) - PR: Will use `fj pr create` when complete ## Project Context - **Extension location**: `.pi/extensions/pi-worktree.ts` - **Pattern**: Single-file extension with default export function - **API imports**: `@earendil-works/pi-coding-agent` (ExtensionAPI, ExtensionContext) - **Schema library**: TypeBox (`typebox`) for tool parameter schemas - **No npm dependencies** beyond what pi provides ## Validation Approach This project has no traditional test suite. Validation is: 1. File exists at `.pi/extensions/pi-worktree.ts` 2. Correct imports from `@earendil-works/pi-coding-agent` and `typebox` 3. Follows single-file extension pattern (default export function) 4. pi loads without errors via `/reload` or restart ## Issue #1 Acceptance Criteria - [ ] `.pi/extensions/pi-worktree.ts` exists - [ ] Correct imports from `@earendil-works/pi-coding-agent` and `typebox` - [ ] Extension loads without errors when pi starts - [ ] Follows the single-file extension pattern with default export function ## Related Files (from main branch) | File | Purpose | |------|---------| | `README.md` | User-facing docs — describes 4 tools + `/worktree` command | | `DESIGN.md` | Architecture decisions for the extension | | `DOMAIN.md` | Git worktree domain concepts and terminology | | `AGENTS.md` | Agent conventions, repo details, fj CLI usage | ## Session Discoveries - **TypeBox import**: Use `{ Type } from "@earendil-works/pi-ai"` (re-exported) rather than direct `typebox` import — matches pi's extension examples. - **Tool definition helper**: Use `defineTool()` from `@earendil-works/pi-coding-agent` for type-safe tool registration. - **Validation command**: `bun build --no-bundle --emit=metadata` compiles and validates TypeScript without bundling.