AGENT SKILL

run-promptvault-tui

Run, test, screenshot, and interact with the PromptVault Python TUI (promptvault-tui). Use when asked to run, start, drive, screenshot, smoke-test, or verify the TUI app, or to create/search items programmatically.

License 许可
MIT
最近更新
2026-07-03
Stars
★ 0
Forks
0

01 前言 Front Matter

name
run-promptvault-tui
description
Run, test, screenshot, and interact with the PromptVault Python TUI (promptvault-tui). Use when asked to run, start, drive, screenshot, smoke-test, or verify the TUI app, or to create/search items programmatically.

02 资源文件 1

03 SKILL.md 正文

run-promptvault-tui

PromptVault TUI is a Textual-based interactive terminal app. The driver uses Textual's run_test() + Pilot API to drive the app headlessly — no terminal emulator, no tmux, no display server needed. All commands run from PromptVault.Tui/ using uv run.

Prerequisites

uv pip install -e ".[dev]"

Already satisfied if .venv/ exists in PromptVault.Tui/.

Run (agent path)

The driver lives at .claude/skills/run-promptvault-tui/driver.py, run from PromptVault.Tui/:

cd PromptVault.Tui

# Verify app boots and items load
uv run python ../.claude/skills/run-promptvault-tui/driver.py smoke
# OK: 24 items loaded, search focused

# Search items and print titles
uv run python ../.claude/skills/run-promptvault-tui/driver.py search "code review"
# Code Review Checklist

# Take an SVG screenshot of the running app
uv run python ../.claude/skills/run-promptvault-tui/driver.py screenshot out.svg
# Screenshot saved: out.svg

# Create a new item and verify it persists
uv run python ../.claude/skills/run-promptvault-tui/driver.py new-item "My Title" "Body text here"
# OK: created 'My Title' (24 -> 25 items)

All four commands exit 0 on success.

The driver uses the real data file (~/.promptvault/cartridges/default.json) by default — smoke, search, and screenshot are read-only; new-item does mutate it.

Run (human path)

cd PromptVault.Tui
uv run promptvault-tui

Opens the full interactive TUI in the current terminal. q to quit.

Non-interactive CLI modes that work in any shell:

uv run promptvault-tui --list
uv run promptvault-tui search "terraform"

Test suite

cd PromptVault.Tui
uv run python -m unittest discover -s tests
# Ran 61 tests in ~29s OK

Gotchas

  • n key requires focus off search input. The search Input consumes all printable characters, so press("n") with search focused types "n" into the field — it does not open the new-item modal. The driver works around this by calling results_list.focus() before pressing n. This also means keyboard bindings (n, e, d, f, c, q) only fire when focus is on the results list or nothing.

  • Modal queries need pilot.app.screen not pilot.app. When FieldEditorScreen is pushed, pilot.app.query_one("#w-fld-title") raises NoMatches — query from pilot.app.screen instead (which is the active/top screen).

  • SVG export raises UnicodeEncodeError with default file open. Always open with encoding="utf-8" — the SVG contains non-ASCII box-drawing and braille characters that CP1252 can't encode.

  • Duplicate items after re-seed. If you call _build_repo() on a file that already has items, seeds are not re-added. But the test data file may already contain the seed items, so --list output can show them twice if the file was populated from a prior version. Not a driver bug.

Troubleshooting

ModuleNotFoundError: No module named 'promptvault_tui' — run uv pip install -e ".[dev]" from PromptVault.Tui/, or ensure you're running uv run from inside PromptVault.Tui/ (not from repo root).

uv recreates .venv on every run — expected if the interpreter version changes. It only reinstalls packages once; subsequent runs are fast.

pilot.pause() not long enough for async handlers — _refresh_display() is async and triggered by Input.Changed. Add an extra await pilot.pause() if assertions run before the DOM updates.

04 同仓库更多 Skills