with one click
demo-setup
// Set up demo environments for Pi extensions to record videos or screenshots for the Pi package browser. Use when preparing a demo, recording a video, or creating preview assets for an extension or theme.
// Set up demo environments for Pi extensions to record videos or screenshots for the Pi package browser. Use when preparing a demo, recording a video, or creating preview assets for an extension or theme.
| name | demo-setup |
| description | Set up demo environments for Pi extensions to record videos or screenshots for the Pi package browser. Use when preparing a demo, recording a video, or creating preview assets for an extension or theme. |
Set up self-contained demo directories for Pi extensions. The demo directory contains everything needed to showcase an extension: a prompt that runs through the features, fixture files, and pi configuration.
The Pi website has a package browser at buildwithpi.ai/packages. Packages can display preview media.
{
"pi": {
"extensions": ["./index.ts"],
"video": "https://example.com/demo.mp4",
"image": "https://example.com/preview.png"
}
}
Both video and image are optional. Video takes precedence when present.
aspect-ratio: 16/9 CSS)contain on black background.mp4 for video, .png/.jpg/.jpeg/.webp/.gif for imageThemes show better as images (screenshots of dark and light variants side by side). A single 16:9 image with both variants is ideal.
Northwind is a fictive Node.js REST API project used as the base environment for demos. It provides a realistic project structure with shell scripts, config files, and database workflows that extensions can hook into.
Use Northwind when the demo needs a project context. Customize it freely -- add files, remove scripts, tweak behavior to highlight the extension's features. Northwind is a starting point, not a rigid template.
Northwind is a trading company API with:
.env, .env.example, drizzle.config.tspackage.json, tsconfig.json, scripts/These are the full set. Pick only what your demo needs.
| Script | Command | Behavior |
|---|---|---|
scripts/server.sh | npm run server | Long-running API server with request logs on port 4000 |
scripts/dev.sh | npm run dev | Long-running dev server with HMR updates |
scripts/test.sh | npm run test | Stateful test suite (see below) |
scripts/migrate.sh | npm run migrate | Runs migrations (creates /tmp/northwind-migrated) |
scripts/seed.sh | npm run seed | Seeds fake data (creates /tmp/northwind-seeded) |
scripts/reset.sh | npm run reset | Clears state files for re-runs |
scripts/build.sh | npm run build | 5-step production build, exits 0 |
scripts/lint.sh | npm run lint | Lint check with warnings and errors, exits 1 |
scripts/typecheck.sh | npm run typecheck | Type check with 2 errors, exits 1 |
scripts/test-watch.sh | npm run test:watch | Continuous test watcher |
The test script uses marker files (/tmp/northwind-migrated, /tmp/northwind-seeded) to determine which stage the project is at:
relation "shipping_addresses" does not existcustomer.shippingAddress undefinedRun npm run reset before each demo to clear state.
You should adapt the project to create scenarios that naturally exercise your extension. Examples:
.env with real-looking secrets, .env.example with safe patterns, drizzle.config.ts for ORM config. The demo prompt can ask the agent to manually write a migration file (which guardrails should block, since the project uses drizzle-kit generate).Add whatever files make sense: .env, drizzle.config.ts, src/ stubs, docker-compose.yml, etc. The scripts are just bash with sleep/echo -- easy to create new ones or modify existing ones.
<demo-dir>/
āāā northwind/ # The fake project (agent runs pi here)
ā āāā .pi/
ā ā āāā settings.json # Registers the extension as a local path
ā ā āāā prompts/
ā ā āāā <demo-name>.md # The demo prompt
ā āāā AGENTS.md # Agent instructions
ā āāā package.json # npm scripts pointing to shell scripts
ā āāā scripts/ # Simulated shell scripts
āāā shell.nix # Nix dev environment (outside northwind)
āāā .envrc # direnv config (outside northwind)
The outer directory holds the Nix/direnv setup. The inner northwind/ directory is where pi runs. This way oh-my-posh (or similar prompt tools) display "northwind" in the terminal prompt.
Check package.json in the target directory for a pi key with extensions, themes, or skills. Read the README and source to understand what the extension provides: tools, commands, hooks, providers, themes.
demo_dir="<path>"
mkdir -p "$demo_dir/northwind/.pi/prompts"
mkdir -p "$demo_dir/northwind/scripts"
Create northwind/.pi/settings.json pointing to the extension's absolute path:
{
"packages": [
"/absolute/path/to/extension"
],
"defaultThinkingLevel": "off"
}
Use defaultThinkingLevel: "off" to keep responses fast and visible during demos.
Create northwind/.pi/prompts/<demo-name>.md. Name it after what the demo shows (e.g., test-shipping-feature.md). Structure it as numbered steps that run without user confirmation between steps.
---
description: Showcase the <extension-name> extension
---
Demo the <extension-name> extension by <scenario>. Run through all steps without waiting for confirmation. Keep messages short.
## 1. <Step Name>
<What to do.>
## 2. <Next Step>
...
Start from the Northwind base and customize:
northwind/scripts/northwind/package.json with npm script entries.env, config files, source stubs, etc.)Always add a northwind/AGENTS.md that:
The AGENTS.md should make the agent feel like it's working in a real project. Tailor it to the extension -- for guardrails, mention the ORM and conventions; for processes, emphasize which scripts are long-running.
Build a narrative workflow (like "test a new feature" or "set up the project") that naturally exercises the tools. The agent should encounter problems and react to them, not just call tools in sequence.
Build a workflow where the agent naturally triggers hooks. Include both blocked and allowed cases so the demo shows the extension intervening and also stepping aside. For example: the agent tries to manually write a migration (blocked), then uses the ORM generate command instead (allowed).
Run each command (e.g., /extension:command) to show the interactive UI.
/model <provider>Themes don't need Northwind. Just switch themes and write a code file for syntax highlighting.
After creating the demo directory, print the path and instructions:
Demo ready at: <path>
cd <path>/northwind
pi
Then type /<demo-name> to start.