[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71T4BSCKGFZ12068A05WKM0":3,"skill-same:01M71T4BSCKGFZ12068A05WKM0":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M71T4BSCKGFZ12068A05WKM0","pi-test",null,"Test pi package TUI components using pilotty for PTY-based terminal automation. Use when the user wants to test, verify, or validate TUI components built with pi-tui in their pi package — interactive selectors, overlays, dialogs, custom editors, status indicators, or any ctx.ui.custom() output. Also use when the user says \"test the TUI\", \"verify the UI renders\", \"check my component\", \"run pilotty\", \"test my extension's UI\", or asks about TUI testing strategies for pi packages. Do not use for unit testing non-TUI code, linting, type checking, or testing tools that only return text without rendering a TUI.","S1M0N38\u002Fpi-package-template","S1M0N38","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F22257750?v=4","01M71T423QR9E0532E9AY8VGB4","01M71T424FQ6J25Z3V21MEK6KZ",5,"MIT","https:\u002F\u002Fgithub.com\u002FS1M0N38\u002Fpi-package-template\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpi-test\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"pi test","test","pi","ui","unit testing","status","edit","rendering","write","read","terminal","run","component","strategies","text","components","testing","overlays","tui testing","unit","2026-11-10 13:02:02",false,"---\nname: pi-test\ndescription: >\n  Test pi package TUI components using pilotty for PTY-based terminal automation.\n  Use when the user wants to test, verify, or validate TUI components built with\n  pi-tui in their pi package — interactive selectors, overlays, dialogs, custom\n  editors, status indicators, or any ctx.ui.custom() output. Also use when the user\n  says \"test the TUI\", \"verify the UI renders\", \"check my component\", \"run pilotty\",\n  \"test my extension's UI\", or asks about TUI testing strategies for pi packages.\n  Do not use for unit testing non-TUI code, linting, type checking, or testing\n  tools that only return text without rendering a TUI.\ncompatibility: Requires pilotty (npm install -g pilotty). macOS or Linux. No Windows support.\nallowed-tools: Bash read edit write\n---\n\n# Pi Package TUI Testing with Pilotty\n\nThis skill guides you through testing TUI components built with `@earendil-works\u002Fpi-tui` inside a pi package. Pilotty provides PTY-based terminal automation — it spawns terminal applications in background sessions, captures screen state as structured data, and sends keyboard\u002Fmouse input programmatically.\n\n## Why Pilotty for Pi TUI Testing\n\nPi TUI components render inside the pi terminal application. They use ANSI escape codes, theme colors, and interactive keyboard handling. Standard test runners can't see the rendered output because there's no real terminal. Pilotty solves this by:\n\n- Spawning pi in a real PTY (with a full VT100 terminal emulator)\n- Capturing screen state as structured JSON (text, cursor, elements, content hash)\n- Sending keyboard input (Tab, Enter, arrows, text typing, key sequences)\n- Waiting for screen changes instead of guessing sleep durations\n\nThis gives you a fully automated way to verify that your components render correctly, respond to input, and update on state changes — the things that are impossible to test with `pi -p` print mode.\n\n## Prerequisites\n\nBefore testing, confirm pilotty is installed:\n\n```bash\nwhich pilotty\n```\n\nIf not installed, install via npm:\n\n```bash\nnpm install -g pilotty\n```\n\nPilotty is a Rust binary distributed as a native npm package. It requires macOS or Linux (no Windows support).\n\nAlso confirm the package loads without errors:\n\n```bash\nnpm run typecheck && npm run lint\n```\n\n## Core Testing Workflow\n\nEvery TUI test follows the same pattern:\n\n1. **Spawn pi** with the package loaded in a pilotty PTY session\n2. **Wait for readiness** — pi shows a prompt or status line when loaded\n3. **Trigger the TUI** — invoke a slash command or tool that renders your component\n4. **Capture a snapshot** — verify the rendered output\n5. **Interact** — send keyboard input to exercise the component\n6. **Verify again** — snapshot after interaction to confirm state changed correctly\n7. **Clean up** — kill the session\n\n### Step 1: Spawn pi in a pilotty session\n\n```bash\npilotty spawn --name tui-test --cwd \u002Fpath\u002Fto\u002Fpackage -- pi -ne -e . --no-session\n```\n\nKey flags:\n- `--name tui-test` — named session for targeting with `-s tui-test`\n- `--cwd \u002Fpath\u002Fto\u002Fpackage` — run in the package directory so `-e .` works\n- `-ne` — no globally installed extensions (avoids interference)\n- `-e .` — load only this package's extensions\n- `--no-session` — fresh session, no session file\n\nAlways use `-ne` with `-e .` to isolate the package under test. Other extensions (like pi-mcp-adapter) can interfere with TUI rendering.\n\n### Step 2: Wait for pi to be ready\n\n```bash\npilotty wait-for -s tui-test \"[Skills]\" -t 10000\n```\n\nPi shows a startup info screen with `[Skills]`, `[Prompts]`, `[Extensions]`, `[Themes]` sections when ready. Wait for any of these strings. The timeout of 10 seconds accounts for startup time.\n\nAlternatively, use a short sleep which is more reliable across pi versions:\n\n```bash\nsleep 3\npilotty snapshot -s tui-test --format text | head -2\n```\n\nIf you see the skills list, pi is ready.\n\n### Step 3: Trigger the TUI component\n\nFor slash commands, type the command:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty type -s tui-test \"\u002Fpick\"\npilotty key -s tui-test Enter\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 100\n```\n\nFor tool-triggered TUIs, type a prompt that invokes the tool:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty type -s tui-test \"Call the settings tool\"\npilotty key -s tui-test Enter\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 500\n```\n\nUse `--settle` with a value of 100-500ms for pi's TUI rendering. The TUI renders quickly once the command executes.\n\n### Step 4: Capture and verify the snapshot\n\n```bash\npilotty snapshot -s tui-test\n```\n\nThis returns structured JSON:\n\n```json\n{\n  \"snapshot_id\": 42,\n  \"size\": { \"cols\": 80, \"rows\": 24 },\n  \"cursor\": { \"row\": 5, \"col\": 10, \"visible\": true },\n  \"text\": \"full screen text content\",\n  \"elements\": [\n    { \"kind\": \"button\", \"row\": 1, \"col\": 9, \"width\": 4, \"text\": \"[OK]\", \"confidence\": 0.8 }\n  ],\n  \"content_hash\": 12345678901234567890\n}\n```\n\nFor readable output during debugging:\n\n```bash\npilotty snapshot -s tui-test --format text\n```\n\n### Step 5: Interact with the component\n\n```bash\n# Navigate with arrow keys\npilotty key -s tui-test Down\npilotty key -s tui-test Up\n\n# Select an item\npilotty key -s tui-test Enter\n\n# Type text into an input field\npilotty type -s tui-test \"search query\"\n\n# Tab between elements\npilotty key -s tui-test Tab\n\n# Cancel \u002F close\npilotty key -s tui-test Escape\n```\n\nAlways capture a hash before interaction and use `--await-change` after to wait for the screen to update:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty key -s tui-test Down\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 50\n```\n\nThis avoids race conditions — no manual sleep guessing needed.\n\n### Step 6: Clean up\n\n```bash\npilotty kill -s tui-test\n```\n\nOr stop the entire daemon:\n\n```bash\npilotty stop\n```\n\n## Testing Common Pi TUI Patterns\n\nRead `references\u002FTEST_PATTERNS.md` for detailed test scripts covering the most common pi TUI component patterns:\n\n1. **SelectList dialogs** — verify items render, navigate, select\n2. **Overlays** — verify overlay appears and dismisses\n3. **SettingsList toggles** — verify toggle state changes\n4. **Custom editors** — verify mode switching and input handling\n5. **Widgets** — verify content appears above\u002Fbelow editor\n6. **BorderedLoader** — verify spinner appears during async work\n\n## Snapshot Verification Strategies\n\n### Text content verification\n\nExtract the `text` field and search for expected strings:\n\n```bash\npilotty snapshot -s tui-test | jq -r '.text' | grep -q \"Pick an Option\"\n```\n\n### Element verification\n\nCheck for detected UI elements (buttons, inputs, toggles):\n\n```bash\npilotty snapshot -s tui-test | jq '.elements[] | select(.kind == \"button\")'\n```\n\nElement detection is best-effort — pilotty detects common patterns like `[OK]`, `\u003CCancel>`, `[x]`, `[ ]`. For components with custom styling, rely on text content verification instead.\n\n### Content hash for change detection\n\nUse `content_hash` to verify that an action actually changed the screen:\n\n```bash\nHASH1=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty key -s tui-test Down\npilotty snapshot -s tui-test --await-change \"$HASH1\" --settle 50\nHASH2=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\n# If HASH1 != HASH2, the screen changed\n```\n\n### Plain text format for visual debugging\n\nWhen you need to see what the TUI looks like (including cursor position shown as `▌`):\n\n```bash\npilotty snapshot -s tui-test --format text\n```\n\n## Key Mapping for Pi TUI\n\nPi's TUI components use these key interactions:\n\n| Action | Key | pilotty command |\n|--------|-----|-----------------|\n| Navigate list | ↑\u002F↓ | `pilotty key Up` \u002F `pilotty key Down` |\n| Select item | Enter | `pilotty key Enter` |\n| Cancel\u002Fclose | Escape | `pilotty key Escape` |\n| Tab between items | Tab | `pilotty key Tab` |\n| Search in SelectList | Type text | `pilotty type \"query\"` |\n| Scroll | Page Up\u002FDown | `pilotty key PageUp` \u002F `pilotty key PageDown` |\n| Toggle setting | Enter | `pilotty key Enter` |\n| Abort pi | Ctrl+C | `pilotty key Ctrl+C` |\n\n## Testing Multiple Components\n\nWhen testing multiple slash commands or TUI flows, you can reuse a single session:\n\n```bash\n# Test command A\npilotty type -s tui-test \"\u002Fcommand-a\"\npilotty key -s tui-test Enter\n# ... verify and dismiss ...\npilotty key -s tui-test Escape\n\n# Test command B\npilotty type -s tui-test \"\u002Fcommand-b\"\npilotty key -s tui-test Enter\n# ... verify ...\n```\n\nAlternatively, spawn fresh sessions for test isolation:\n\n```bash\npilotty kill -s tui-test\npilotty spawn --name tui-test --cwd \u002Fpath\u002Fto\u002Fpackage -- pi -ne -e . --no-session\npilotty wait-for -s tui-test \"[Skills]\" -t 10000\n```\n\n## Important: Don't Send Enter Without a TUI Open\n\nPi treats Enter as \"submit prompt\" when the editor is focused. If you send `pilotty key Enter` before a TUI component is displayed, pi will process whatever is in the editor as a prompt — which can trigger the agent and disrupt your test session.\n\nOnly send Enter after confirming a TUI is visible via snapshot. For commands, prefer typing the full command and sending Enter once:\n\n```bash\n# Good: type command + Enter (pi processes the slash command)\npilotty type -s tui-test \"\u002Fmy-command\"\npilotty key -s tui-test Enter\n\n# Bad: sending random Enter keys before the TUI appears\npilotty key -s tui-test Enter  # This submits an empty prompt!\n```\n\nIf you accidentally trigger the agent, wait for it to finish:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 3000 -t 60000\n```\n\n## Snapshot Text vs Styled Elements\n\nThe snapshot `text` field contains screen content with ANSI escape codes stripped. This means ANSI-styled UI elements may not appear as expected in the text output. For example, pi's editor prompt `[ ]` uses styling and may show as empty space in the text field.\n\nFor verifying styled elements, use these alternatives:\n\n- **Cursor position** — Check `.cursor` in the JSON snapshot for row, col, and visibility\n- **Element detection** — Check `.elements` array for detected buttons, inputs, toggles\n- **Text format** — Use `--format text` for visual debugging with cursor indicator `▌`\n\n## Troubleshooting\n\n### Pi doesn't start in the PTY\n\nIncrease the wait timeout. Pi startup takes longer in a PTY:\n\n```bash\npilotty wait-for -s tui-test \"[Skills]\" -t 20000\n```\n\n### TUI doesn't appear after typing a command\n\nPi might still be processing. Use `--await-change` with a longer settle time:\n\n```bash\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 500 -t 10000\n```\n\n### Snapshot shows the wrong screen\n\nThe TUI might not have finished rendering. Always wait for the content hash to change after an action. Check with text format:\n\n```bash\npilotty snapshot -s tui-test --format text\n```\n\n### Session not found\n\nSessions are cleaned up automatically when the child process exits. If pi crashed or was killed, the session is gone. List active sessions:\n\n```bash\npilotty list-sessions\n```\n\n### ANSI escape codes in snapshot text\n\nThe `text` field contains the visible text content with ANSI codes stripped. If you see garbled output, the component might be emitting raw escape sequences that pilotty's VT100 emulator doesn't fully handle. Report edge cases to the pilotty project.\n\n## Reference Files\n\n- `references\u002FTEST_PATTERNS.md` — Ready-to-use test scripts for common pi TUI component patterns\n","# Pi Package TUI Testing with Pilotty\n\nThis skill guides you through testing TUI components built with `@earendil-works\u002Fpi-tui` inside a pi package. Pilotty provides PTY-based terminal automation — it spawns terminal applications in background sessions, captures screen state as structured data, and sends keyboard\u002Fmouse input programmatically.\n\n## Why Pilotty for Pi TUI Testing\n\nPi TUI components render inside the pi terminal application. They use ANSI escape codes, theme colors, and interactive keyboard handling. Standard test runners can't see the rendered output because there's no real terminal. Pilotty solves this by:\n\n- Spawning pi in a real PTY (with a full VT100 terminal emulator)\n- Capturing screen state as structured JSON (text, cursor, elements, content hash)\n- Sending keyboard input (Tab, Enter, arrows, text typing, key sequences)\n- Waiting for screen changes instead of guessing sleep durations\n\nThis gives you a fully automated way to verify that your components render correctly, respond to input, and update on state changes — the things that are impossible to test with `pi -p` print mode.\n\n## Prerequisites\n\nBefore testing, confirm pilotty is installed:\n\n```bash\nwhich pilotty\n```\n\nIf not installed, install via npm:\n\n```bash\nnpm install -g pilotty\n```\n\nPilotty is a Rust binary distributed as a native npm package. It requires macOS or Linux (no Windows support).\n\nAlso confirm the package loads without errors:\n\n```bash\nnpm run typecheck && npm run lint\n```\n\n## Core Testing Workflow\n\nEvery TUI test follows the same pattern:\n\n1. **Spawn pi** with the package loaded in a pilotty PTY session\n2. **Wait for readiness** — pi shows a prompt or status line when loaded\n3. **Trigger the TUI** — invoke a slash command or tool that renders your component\n4. **Capture a snapshot** — verify the rendered output\n5. **Interact** — send keyboard input to exercise the component\n6. **Verify again** — snapshot after interaction to confirm state changed correctly\n7. **Clean up** — kill the session\n\n### Step 1: Spawn pi in a pilotty session\n\n```bash\npilotty spawn --name tui-test --cwd \u002Fpath\u002Fto\u002Fpackage -- pi -ne -e . --no-session\n```\n\nKey flags:\n- `--name tui-test` — named session for targeting with `-s tui-test`\n- `--cwd \u002Fpath\u002Fto\u002Fpackage` — run in the package directory so `-e .` works\n- `-ne` — no globally installed extensions (avoids interference)\n- `-e .` — load only this package's extensions\n- `--no-session` — fresh session, no session file\n\nAlways use `-ne` with `-e .` to isolate the package under test. Other extensions (like pi-mcp-adapter) can interfere with TUI rendering.\n\n### Step 2: Wait for pi to be ready\n\n```bash\npilotty wait-for -s tui-test \"[Skills]\" -t 10000\n```\n\nPi shows a startup info screen with `[Skills]`, `[Prompts]`, `[Extensions]`, `[Themes]` sections when ready. Wait for any of these strings. The timeout of 10 seconds accounts for startup time.\n\nAlternatively, use a short sleep which is more reliable across pi versions:\n\n```bash\nsleep 3\npilotty snapshot -s tui-test --format text | head -2\n```\n\nIf you see the skills list, pi is ready.\n\n### Step 3: Trigger the TUI component\n\nFor slash commands, type the command:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty type -s tui-test \"\u002Fpick\"\npilotty key -s tui-test Enter\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 100\n```\n\nFor tool-triggered TUIs, type a prompt that invokes the tool:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty type -s tui-test \"Call the settings tool\"\npilotty key -s tui-test Enter\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 500\n```\n\nUse `--settle` with a value of 100-500ms for pi's TUI rendering. The TUI renders quickly once the command executes.\n\n### Step 4: Capture and verify the snapshot\n\n```bash\npilotty snapshot -s tui-test\n```\n\nThis returns structured JSON:\n\n```json\n{\n  \"snapshot_id\": 42,\n  \"size\": { \"cols\": 80, \"rows\": 24 },\n  \"cursor\": { \"row\": 5, \"col\": 10, \"visible\": true },\n  \"text\": \"full screen text content\",\n  \"elements\": [\n    { \"kind\": \"button\", \"row\": 1, \"col\": 9, \"width\": 4, \"text\": \"[OK]\", \"confidence\": 0.8 }\n  ],\n  \"content_hash\": 12345678901234567890\n}\n```\n\nFor readable output during debugging:\n\n```bash\npilotty snapshot -s tui-test --format text\n```\n\n### Step 5: Interact with the component\n\n```bash\n# Navigate with arrow keys\npilotty key -s tui-test Down\npilotty key -s tui-test Up\n\n# Select an item\npilotty key -s tui-test Enter\n\n# Type text into an input field\npilotty type -s tui-test \"search query\"\n\n# Tab between elements\npilotty key -s tui-test Tab\n\n# Cancel \u002F close\npilotty key -s tui-test Escape\n```\n\nAlways capture a hash before interaction and use `--await-change` after to wait for the screen to update:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty key -s tui-test Down\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 50\n```\n\nThis avoids race conditions — no manual sleep guessing needed.\n\n### Step 6: Clean up\n\n```bash\npilotty kill -s tui-test\n```\n\nOr stop the entire daemon:\n\n```bash\npilotty stop\n```\n\n## Testing Common Pi TUI Patterns\n\nRead `references\u002FTEST_PATTERNS.md` for detailed test scripts covering the most common pi TUI component patterns:\n\n1. **SelectList dialogs** — verify items render, navigate, select\n2. **Overlays** — verify overlay appears and dismisses\n3. **SettingsList toggles** — verify toggle state changes\n4. **Custom editors** — verify mode switching and input handling\n5. **Widgets** — verify content appears above\u002Fbelow editor\n6. **BorderedLoader** — verify spinner appears during async work\n\n## Snapshot Verification Strategies\n\n### Text content verification\n\nExtract the `text` field and search for expected strings:\n\n```bash\npilotty snapshot -s tui-test | jq -r '.text' | grep -q \"Pick an Option\"\n```\n\n### Element verification\n\nCheck for detected UI elements (buttons, inputs, toggles):\n\n```bash\npilotty snapshot -s tui-test | jq '.elements[] | select(.kind == \"button\")'\n```\n\nElement detection is best-effort — pilotty detects common patterns like `[OK]`, `\u003CCancel>`, `[x]`, `[ ]`. For components with custom styling, rely on text content verification instead.\n\n### Content hash for change detection\n\nUse `content_hash` to verify that an action actually changed the screen:\n\n```bash\nHASH1=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty key -s tui-test Down\npilotty snapshot -s tui-test --await-change \"$HASH1\" --settle 50\nHASH2=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\n# If HASH1 != HASH2, the screen changed\n```\n\n### Plain text format for visual debugging\n\nWhen you need to see what the TUI looks like (including cursor position shown as `▌`):\n\n```bash\npilotty snapshot -s tui-test --format text\n```\n\n## Key Mapping for Pi TUI\n\nPi's TUI components use these key interactions:\n\n| Action | Key | pilotty command |\n|--------|-----|-----------------|\n| Navigate list | ↑\u002F↓ | `pilotty key Up` \u002F `pilotty key Down` |\n| Select item | Enter | `pilotty key Enter` |\n| Cancel\u002Fclose | Escape | `pilotty key Escape` |\n| Tab between items | Tab | `pilotty key Tab` |\n| Search in SelectList | Type text | `pilotty type \"query\"` |\n| Scroll | Page Up\u002FDown | `pilotty key PageUp` \u002F `pilotty key PageDown` |\n| Toggle setting | Enter | `pilotty key Enter` |\n| Abort pi | Ctrl+C | `pilotty key Ctrl+C` |\n\n## Testing Multiple Components\n\nWhen testing multiple slash commands or TUI flows, you can reuse a single session:\n\n```bash\n# Test command A\npilotty type -s tui-test \"\u002Fcommand-a\"\npilotty key -s tui-test Enter\n# ... verify and dismiss ...\npilotty key -s tui-test Escape\n\n# Test command B\npilotty type -s tui-test \"\u002Fcommand-b\"\npilotty key -s tui-test Enter\n# ... verify ...\n```\n\nAlternatively, spawn fresh sessions for test isolation:\n\n```bash\npilotty kill -s tui-test\npilotty spawn --name tui-test --cwd \u002Fpath\u002Fto\u002Fpackage -- pi -ne -e . --no-session\npilotty wait-for -s tui-test \"[Skills]\" -t 10000\n```\n\n## Important: Don't Send Enter Without a TUI Open\n\nPi treats Enter as \"submit prompt\" when the editor is focused. If you send `pilotty key Enter` before a TUI component is displayed, pi will process whatever is in the editor as a prompt — which can trigger the agent and disrupt your test session.\n\nOnly send Enter after confirming a TUI is visible via snapshot. For commands, prefer typing the full command and sending Enter once:\n\n```bash\n# Good: type command + Enter (pi processes the slash command)\npilotty type -s tui-test \"\u002Fmy-command\"\npilotty key -s tui-test Enter\n\n# Bad: sending random Enter keys before the TUI appears\npilotty key -s tui-test Enter  # This submits an empty prompt!\n```\n\nIf you accidentally trigger the agent, wait for it to finish:\n\n```bash\nHASH=$(pilotty snapshot -s tui-test | jq -r '.content_hash')\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 3000 -t 60000\n```\n\n## Snapshot Text vs Styled Elements\n\nThe snapshot `text` field contains screen content with ANSI escape codes stripped. This means ANSI-styled UI elements may not appear as expected in the text output. For example, pi's editor prompt `[ ]` uses styling and may show as empty space in the text field.\n\nFor verifying styled elements, use these alternatives:\n\n- **Cursor position** — Check `.cursor` in the JSON snapshot for row, col, and visibility\n- **Element detection** — Check `.elements` array for detected buttons, inputs, toggles\n- **Text format** — Use `--format text` for visual debugging with cursor indicator `▌`\n\n## Troubleshooting\n\n### Pi doesn't start in the PTY\n\nIncrease the wait timeout. Pi startup takes longer in a PTY:\n\n```bash\npilotty wait-for -s tui-test \"[Skills]\" -t 20000\n```\n\n### TUI doesn't appear after typing a command\n\nPi might still be processing. Use `--await-change` with a longer settle time:\n\n```bash\npilotty snapshot -s tui-test --await-change \"$HASH\" --settle 500 -t 10000\n```\n\n### Snapshot shows the wrong screen\n\nThe TUI might not have finished rendering. Always wait for the content hash to change after an action. Check with text format:\n\n```bash\npilotty snapshot -s tui-test --format text\n```\n\n### Session not found\n\nSessions are cleaned up automatically when the child process exits. If pi crashed or was killed, the session is gone. List active sessions:\n\n```bash\npilotty list-sessions\n```\n\n### ANSI escape codes in snapshot text\n\nThe `text` field contains the visible text content with ANSI codes stripped. If you see garbled output, the component might be emitting raw escape sequences that pilotty's VT100 emulator doesn't fully handle. Report edge cases to the pilotty project.\n\n## Reference Files\n\n- `references\u002FTEST_PATTERNS.md` — Ready-to-use test scripts for common pi TUI component patterns\n",{"name":5,"description":43,"allowed-tools":44,"compatibility":45},"Test pi package TUI components using pilotty for PTY-based terminal automation. Use when the user wants to test, verify, or validate TUI components built with pi-tui in their pi package — interactive selectors, overlays, dialogs, custom editors, status indicators, or any ctx.ui.custom() output. Also use when the user says \"test the TUI\", \"verify the UI renders\", \"check my component\", \"run pilotty\", \"test my extension's UI\", or asks about TUI testing strategies for pi packages. Do not use for unit testing non-TUI code, linting, type checking, or testing tools that only return text without rendering a TUI.\n","Bash read edit write","Requires pilotty (npm install -g pilotty). macOS or Linux. No Windows support.","main","1c72dfcbc0ce688b9782df0daccac475b5172909",".agents\u002Fskills\u002Fpi-test",1,"https:\u002F\u002Fgithub.com\u002FS1M0N38\u002Fpi-package-template","https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fpi-package-template","https:\u002F\u002Fgithub.com\u002FS1M0N38","2026-05-17 01:15:28",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add S1M0N38\u002Fpi-package-template --skill pi-test",{"tool":60,"command":61},"bunx","bunx skills add S1M0N38\u002Fpi-package-template --skill pi-test",{"tool":63,"command":64},"pnpm","pnpm dlx skills add S1M0N38\u002Fpi-package-template --skill pi-test","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FS1M0N38\u002Fpi-package-template\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpi-test\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002FTEST_PATTERNS.md","REFERENCE","参考文档",16753,"https:\u002F\u002Fgithub.com\u002FS1M0N38\u002Fpi-package-template\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpi-test\u002Freferences\u002FTEST_PATTERNS.md",[75,81,107],{"skillNo":76,"name":77,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":38},"01M71T4HTVPG5AD3YG4PNC0X67","hello","https:\u002F\u002Fgithub.com\u002FS1M0N38\u002Fpi-package-template\u002Fblob\u002Fmain\u002Fskills\u002Fhello\u002FSKILL.md",[],[77],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":38},"01M71T47W6WBJ6CHCVXDNN4RAA","pi-package","Pi package development best practices and patterns. Use when planning, editing, implementing, or reviewing pi package code — structuring a new package, writing extensions, registering tools, commands, events, skills, prompt templates, or themes. Also use when the user asks about package architecture, conventions, or \"how should I implement\" a pi package feature. Do not use for general TypeScript development unrelated to pi packages, or for running tests (use pi-test skill if it exists).","https:\u002F\u002Fgithub.com\u002FS1M0N38\u002Fpi-package-template\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpi-package\u002FSKILL.md",[],[88,89,20,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106],"pi package","package","implementing","new package","new","themes","writing","when","code","architecture","Test Skill","packages","unrelated","how","typescript","commands","package development","patterns","Tools",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":38},"01M71T43H0P1MAADJWNSHSH2DY","pi-init","Initialize a pi package project after cloning from pi-package-template. Run once at the start of development to verify the development environment is set up correctly. Use when the user says \"init\", \"setup\", \"initialize\", \"check environment\", \"pi-init\", or asks to verify their pi package development setup. Also use when the user says they just cloned the template or wants to start developing a pi package. Do not use for general pi package development tasks (use pi-package) or for running tests.","https:\u002F\u002Fgithub.com\u002FS1M0N38\u002Fpi-package-template\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpi-init\u002FSKILL.md",[],[20,114,115,116,117,118,119,120,121,122,123,124,125,126,89,127,95,88,128,129],"init","pi init","general","do","initialize","development","for","project","just","environment","up","running","tests","use","SET","development environment"]