singularity-forge/docs/dev/extending-pi/03-getting-started.md

37 lines
639 B
Markdown
Raw Normal View History

# Getting Started
### Minimal Extension
Create `~/.sf/agent/extensions/my-extension.ts`:
```typescript
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
export default function (pi: ExtensionAPI) {
pi.on("session_start", async (_event, ctx) => {
ctx.ui.notify("Extension loaded!", "info");
});
}
```
### Testing
```bash
# Quick test (doesn't need to be in extensions dir)
pi -e ./my-extension.ts
# Or just place it in the extensions dir and start pi
pi
```
### Hot Reload
Extensions in auto-discovered locations (`~/.sf/agent/extensions/` or `.sf/extensions/`) can be hot-reloaded:
```
/reload
```
---