- Add .pi/extensions/pi-worktree.ts with correct imports and default export - Define WorktreeEntry, WorktreeListResult, WorktreeError types - Register 4 tools: create, list, switch, remove (stubs) - Register /worktree command (stub) - Add helper function stubs: parseWorktreeList, pathExists, resolveWorktreeTarget - Uses defineTool() and Type from pi SDK for type-safe registration
2 KiB
2 KiB
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:
fjCLI for Forgejo issues (auto-detected from git remote) - PR: Will use
fj pr createwhen 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:
- File exists at
.pi/extensions/pi-worktree.ts - Correct imports from
@earendil-works/pi-coding-agentandtypebox - Follows single-file extension pattern (default export function)
- pi loads without errors via
/reloador restart
Issue #1 Acceptance Criteria
.pi/extensions/pi-worktree.tsexists- Correct imports from
@earendil-works/pi-coding-agentandtypebox - 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 directtypeboximport — matches pi's extension examples. - Tool definition helper: Use
defineTool()from@earendil-works/pi-coding-agentfor type-safe tool registration. - Validation command:
bun build <file> --no-bundle --emit=metadatacompiles and validates TypeScript without bundling.