repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

demo: add side-by-side terse demo

4d5c4d47ab26c9660cc941206d0ae4a501ef188b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (7)

+104 / −6 text lines · 2 binary (striped old/new sizes in 64-byte units, not churn) · lines and sizes scale separately

Diff layout

.pi/prompts/drive-demo.md

Modified

+11 / −3 text lines

1818- `targets` are README/asset owners, usually exactly one primary extension.
1919- `extensions` may include support extensions when needed for visible UX.
2020- README demo block is generated after the H1 title:
21 `<!-- demo:<name>:start -->` … `<!-- demo:<name>:end -->`.
21 `<!-- demo:<readme_id-or-name>:start -->` … `<!-- demo:<readme_id-or-name>:end -->`.
22- Side-by-side before/after demos use the same user prompt; only loaded extensions/support state may differ.
23- Side-by-side demos use shared `readme_id` + identical `readme_items = [(caption, gif), ...]` across paired drivers.
2224- Existing generated demo blocks and `## Demo\n\nNone.` placeholders are removed.
2325- No screenshots. GIF is source of truth for visual QA.
4143- Type commands/prompts char-by-char with deliberate delay so GIF shows typing.
4244- Pause before Enter.
4345- Use longer holds for human readability.
46- With `--capture-input`, `expect(...)` can match typed prompt text; do not expect strings that appear in the prompt.
4447- Modifiers/key overlays: skip unless Pi visibly reacts; asciinema has no native modifier overlay here.
4649Good pacing baseline:
6265 `agg --cols 100 --rows 28 --theme asciinema --text-font-family "JetBrains Mono" --font-size 14 --line-height 1.25 --idle-time-limit 4.0 --last-frame-duration 5 --fps-cap 24 <cast> <gif>`
6467QA:
65- Inspect GIF, not `.txt`, as visual truth.
66- Also generate text for quick sanity:
68- Inspect GIF manually as source of visual truth.
69- Use `.txt` only for semantic sanity:
6770 `asciinema convert -f txt <cast> <txt> --overwrite`
6871- `.txt` may show duplicate lines/artifacts from terminal control sequences; acceptable if GIF looks good.
72- Extract representative PNG frames for assistant-side visual checks:
73 `convert '<gif>[80]' /tmp/<demo>-80.png` or `magick '<gif>[80]' /tmp/<demo>-80.png`.
74- Prefer final/mid frames over first frame; first frame is often blank startup.
75- `understand_image` on animated GIFs is unreliable; it may hallucinate unrelated terminal content.
76- If using vision, run it on extracted PNG frames, not GIFs.
6977- Avoid `asciinema play` in main terminal; it can disturb visible scrollback due recorded control sequences.
7179Driver shape:

drivers/terse_after.py

Added
new file mode 100644

+30 / −0 text lines

1title = "After terse"
2
3readme_id = "terse"
4readme_items = [
5 ("Same prompt", "terse_before.gif"),
6 ("Same prompt + terse", "terse_after.gif"),
7]
8
9extensions = [
10 "terse",
11]
13targets = [
14 "terse",
15]
17cols = 100
18rows = 28
19cwd = "."
21prompt = """Use only these facts; do not inspect files or run tools.
22Facts: pi-ext is a Pi extension pack with tools, footers, workflow helpers, prompts, skills, and themes.
23Explain what pi-ext contains, what each part contributes, and how a new Pi user should think about it according to the active response style.
24End with marker: same terse demo prompt."""
26steps = [
27 ("wait", 1500),
28 ("prompt", prompt, 30000),
29 ("wait", 6000),
30]

drivers/terse_before.py

Added
new file mode 100644

+28 / −0 text lines

1title = "Before terse"
2
3readme_id = "terse"
4readme_items = [
5 ("Same prompt", "terse_before.gif"),
6 ("Same prompt + terse", "terse_after.gif"),
7]
8
9extensions = []
11targets = [
12 "terse",
13]
15cols = 100
16rows = 28
17cwd = "."
19prompt = """Use only these facts; do not inspect files or run tools.
20Facts: pi-ext is a Pi extension pack with tools, footers, workflow helpers, prompts, skills, and themes.
21Explain what pi-ext contains, what each part contributes, and how a new Pi user should think about it according to the active response style.
22End with marker: same terse demo prompt."""
24steps = [
25 ("wait", 1500),
26 ("prompt", prompt, 30000),
27 ("wait", 6000),
28]

extensions/terse/README.md

Modified

+7 / −0 text lines

11# terse
3<!-- demo:terse:start -->
4<table>
5<tr><td align="center"><strong>Same prompt</strong></td><td align="center"><strong>Same prompt + terse</strong></td></tr>
6<tr><td><img src="assets/terse_before.gif" alt="Same prompt" width="100%"></td><td><img src="assets/terse_after.gif" alt="Same prompt + terse" width="100%"></td></tr>
7</table>
8<!-- demo:terse:end -->
9
310Terse response protocol injector for Pi.
512## Install / load

extensions/terse/assets/terse_after.gif

Added
new file mode 100644

Binary size (old → new): 0 → 417710 bytes.

extensions/terse/assets/terse_before.gif

Added
new file mode 100644

Binary size (old → new): 0 → 403352 bytes.

scripts/demo.py

Modified

+28 / −3 text lines

4646 rows: int
4747 cwd: Path
4848 steps: list[tuple]
49 readme_id: str
50 readme_items: list[tuple[str, str]] | None
5153def load_module(name: str) -> ModuleType:
9193 for step in steps:
9294 validate_step(step)
96 readme_id = getattr(module, "readme_id", name)
97 if not isinstance(readme_id, str) or not readme_id:
98 raise SystemExit("readme_id must be string")
100 readme_items = getattr(module, "readme_items", None)
101 if readme_items is not None:
102 if not isinstance(readme_items, list) or not readme_items:
103 raise SystemExit("readme_items must be non-empty list")
104 for item in readme_items:
105 if not (isinstance(item, tuple) and len(item) == 2 and all(isinstance(x, str) and x for x in item)):
106 raise SystemExit(f"readme_items entries must be (caption, gif): {item!r}")
94108 driver = Driver(
95109 name=name,
96110 title=title,
100114 rows=rows,
101115 cwd=cwd,
102116 steps=steps,
117 readme_id=readme_id,
118 readme_items=readme_items,
103119 )
104120 validate_driver(driver)
105121 return driver
289305def readme_block(driver: Driver) -> str:
306 if driver.readme_items:
307 headers = "".join(f"<td align=\"center\"><strong>{caption}</strong></td>" for caption, _gif in driver.readme_items)
308 images = "".join(
309 f"<td><img src=\"assets/{gif}\" alt=\"{caption}\" width=\"100%\"></td>"
310 for caption, gif in driver.readme_items
311 )
312 body = f"<table>\n<tr>{headers}</tr>\n<tr>{images}</tr>\n</table>"
313 else:
314 body = f"![{driver.title}](assets/{driver.name}.gif)"
290315 return (
291 f"<!-- demo:{driver.name}:start -->\n"
292 f"![{driver.title}](assets/{driver.name}.gif)\n"
293 f"<!-- demo:{driver.name}:end -->"
316 f"<!-- demo:{driver.readme_id}:start -->\n"
317 f"{body}\n"
318 f"<!-- demo:{driver.readme_id}:end -->"
294319 )