xonecas.io
7517
Cd

clanker-and-the-dev / commit 65a686f

Add Spittoon-style dialogue generation

xonecas2026-06-08 65a686faaddbf8cc5f6aae4f30f58a106f41f47b parent e3ed334

11 files changed

README.md+9−0
@@ -39,6 +39,15 @@ Drop seed markdown files in `comic/inbox/`, then run:
3939
4040 The job asks Pi to convert the first inbox seed into `comic/specs/<slug>.json`, then `comic/render-comic.js` deterministically renders an inline SVG Jekyll post at `_posts/YYYY-MM-DD-<slug>.md`.
4141
42+You can also compile a Spittoon-style chat script directly into a spec:
43+
44+```bash
45+node comic/chat-to-spec.js my-strip.chat comic/specs/my-strip.json
46+node comic/render-comic.js comic/specs/my-strip.json
47+```
48+
49+Chat lines look like `dev->clanker: ship it? (curious/helpful) [screen-glow]`. Repeating a speaker starts a new panel, so two alternating speakers can share one panel as dialogue balloons.
50+
4251 Seed example:
4352
4453 ```md
_posts/2026-06-08-the-cycle-of-ai-coding-burnout.md+19−13
@@ -11,6 +11,8 @@ title: The Cycle of AI Coding Burnout
1111 .terminal-line, .ground { stroke: #166534; stroke-width: 3; }
1212 .panel-bg { fill: #030712; stroke: #22c55e; stroke-width: 3; }
1313 .caption-bg { fill: rgba(0, 0, 0, 0.74); stroke: #166534; stroke-width: 2; }
14+ .caption-bg.speech, .caption-tail { filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.25)); }
15+ .caption-tail { fill: rgba(0, 0, 0, 0.74); stroke: #166534; stroke-width: 2; stroke-linejoin: round; }
1416 .caption { fill: #86efac; font-family: 'VT323', 'Courier New', monospace; }
1517 .caption-bold { font-weight: 700; letter-spacing: 1px; }
1618 .panel-num, .boot-text { fill: #166534; font: 22px 'VT323', 'Courier New', monospace; }
@@ -63,9 +65,10 @@ title: The Cycle of AI Coding Burnout
6365 <line x1="457.74" y1="277" x2="484.74" y2="248.5" class="bot-line" />
6466 <path d="M 375.24 244.75 l -7.5 -6 M 375.24 244.75 l 7.5 -6" class="bot-line" />
6567 <path d="M 489.24 244.75 l -7.5 -6 M 489.24 244.75 l 7.5 -6" class="bot-line" /></g>
66- <rect x="36" y="108" width="543" height="64" class="caption-bg" />
67- <text x="52" y="144" class="caption " style="font-size:32px">
68- <tspan x="52" dy="0">wow</tspan>
68+ <path d="M 185.44 165 Q 205.44 189 205.44 210 Q 219.44 185 225.44 165 Z" class="caption-tail" />
69+ <rect x="41.01000000000002" y="108" width="328.85999999999996" height="59" rx="14" class="caption-bg speech" />
70+ <text x="57.01000000000002" y="144" class="caption " style="font-size:32px">
71+ <tspan x="57.01000000000002" dy="0">wow</tspan>
6972 </text>
7073 <text x="569" y="350" text-anchor="end" class="panel-num">1</text>
7174 </g>
@@ -98,9 +101,10 @@ title: The Cycle of AI Coding Burnout
98101 <line x1="1042.74" y1="277" x2="1069.74" y2="280" class="bot-line" />
99102 <path d="M 960.24 281.5 l -7.5 -6 M 960.24 281.5 l 7.5 -6" class="bot-line" />
100103 <path d="M 1074.24 281.5 l -7.5 -6 M 1074.24 281.5 l 7.5 -6" class="bot-line" /></g>
101- <rect x="621" y="108" width="543" height="64" class="caption-bg" />
102- <text x="637" y="144" class="caption " style="font-size:32px">
103- <tspan x="637" dy="0">WOW</tspan>
104+ <path d="M 770.44 165 Q 790.44 189 790.44 210 Q 804.44 185 810.44 165 Z" class="caption-tail" />
105+ <rect x="626.0100000000001" y="108" width="328.85999999999996" height="59" rx="14" class="caption-bg speech" />
106+ <text x="642.0100000000001" y="144" class="caption " style="font-size:32px">
107+ <tspan x="642.0100000000001" dy="0">WOW</tspan>
104108 </text>
105109 <text x="1154" y="350" text-anchor="end" class="panel-num">2</text>
106110 </g>
@@ -139,9 +143,10 @@ title: The Cycle of AI Coding Burnout
139143 <path d="M 489.24 569.5 l -7.5 -6 M 489.24 569.5 l 7.5 -6" class="bot-line" />
140144 <path d="M 393.24 491.5 l 10.5 -16.5 l 7.5 13.5 l 11.25 -18.75" class="fx-line" />
141145 <path d="M 469.74 497.5 l 15 -13.5 l -1.5 19.5" class="fx-line" /></g>
142- <rect x="36" y="396" width="543" height="64" class="caption-bg" />
143- <text x="52" y="432" class="caption " style="font-size:32px">
144- <tspan x="52" dy="0">HOLY SHIT!</tspan>
146+ <path d="M 185.44 453 Q 205.44 477 205.44 498 Q 219.44 473 225.44 453 Z" class="caption-tail" />
147+ <rect x="41.01000000000002" y="396" width="328.85999999999996" height="59" rx="14" class="caption-bg speech" />
148+ <text x="57.01000000000002" y="432" class="caption " style="font-size:32px">
149+ <tspan x="57.01000000000002" dy="0">HOLY SHIT!</tspan>
145150 </text>
146151 <text x="569" y="638" text-anchor="end" class="panel-num">3</text>
147152 </g>
@@ -175,7 +180,7 @@ title: The Cycle of AI Coding Burnout
175180 <line x1="1042.74" y1="565" x2="1063.74" y2="583" class="bot-line" />
176181 <path d="M 967.74 586 l -7.5 -6 M 967.74 586 l 7.5 -6" class="bot-line" />
177182 <path d="M 1066.74 586 l -7.5 -6 M 1066.74 586 l 7.5 -6" class="bot-line" /></g>
178- <rect x="621" y="396" width="543" height="64" class="caption-bg" />
183+ <rect x="621" y="396" width="543" height="59" rx="6" class="caption-bg narrator" />
179184 <text x="637" y="432" class="caption caption-bold" style="font-size:32px">
180185 <tspan x="637" dy="0">dead</tspan>
181186 </text>
@@ -214,9 +219,10 @@ title: The Cycle of AI Coding Burnout
214219 <line x1="883.1899999999999" y1="889.5" x2="907.6899999999999" y2="910.5" class="bot-line" />
215220 <path d="M 795.6899999999999 914 l -8.75 -7 M 795.6899999999999 914 l 8.75 -7" class="bot-line" />
216221 <path d="M 911.1899999999999 914 l -8.75 -7 M 911.1899999999999 914 l 8.75 -7" class="bot-line" /></g>
217- <rect x="36" y="684" width="1128" height="64" class="caption-bg" />
218- <text x="52" y="720" class="caption " style="font-size:36px">
219- <tspan x="52" dy="0">Let's open nvim...</tspan>
222+ <path d="M 372.64 744 Q 392.64 768 392.64 831 Q 406.64 764 412.64 744 Z" class="caption-tail" />
223+ <rect x="58.56" y="684" width="668.16" height="62" rx="14" class="caption-bg speech" />
224+ <text x="74.56" y="720" class="caption " style="font-size:36px">
225+ <tspan x="74.56" dy="0">Let's open nvim...</tspan>
220226 </text>
221227 <text x="1154" y="971" text-anchor="end" class="panel-num">5</text>
222228 </g>
_posts/2026-06-08-the-dumb-zone.md+8−5
@@ -11,6 +11,8 @@ title: The Dumb Zone
1111 .terminal-line, .ground { stroke: #166534; stroke-width: 3; }
1212 .panel-bg { fill: #030712; stroke: #22c55e; stroke-width: 3; }
1313 .caption-bg { fill: rgba(0, 0, 0, 0.74); stroke: #166534; stroke-width: 2; }
14+ .caption-bg.speech, .caption-tail { filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.25)); }
15+ .caption-tail { fill: rgba(0, 0, 0, 0.74); stroke: #166534; stroke-width: 2; stroke-linejoin: round; }
1416 .caption { fill: #86efac; font-family: 'VT323', 'Courier New', monospace; }
1517 .caption-bold { font-weight: 700; letter-spacing: 1px; }
1618 .panel-num, .boot-text { fill: #166534; font: 22px 'VT323', 'Courier New', monospace; }
@@ -65,9 +67,9 @@ title: The Dumb Zone
6567 <line x1="466.665" y1="459.15" x2="503.115" y2="420.67499999999995" class="bot-line" />
6668 <path d="M 355.29 415.61249999999995 l -10.125 -8.1 M 355.29 415.61249999999995 l 10.125 -8.1" class="bot-line" />
6769 <path d="M 509.19 415.61249999999995 l -10.125 -8.1 M 509.19 415.61249999999995 l 10.125 -8.1" class="bot-line" /></g>
68- <rect x="36" y="108" width="543" height="94" class="caption-bg" />
70+ <rect x="36" y="108" width="543" height="88" rx="6" class="caption-bg narrator" />
6971 <text x="52" y="144" class="caption " style="font-size:32px">
70- <tspan x="52" dy="0">Hard at work, safely under the</tspan><tspan x="52" dy="30">line.</tspan>
72+ <tspan x="52" dy="0">Hard at work, safely under the</tspan><tspan x="52" dy="29">line.</tspan>
7173 </text>
7274 <g class="token-counter">
7375 <rect x="399" y="186" width="170" height="36" class="meter-bg" />
@@ -108,9 +110,10 @@ title: The Dumb Zone
108110 <line x1="1051.665" y1="459.15" x2="1088.115" y2="420.67499999999995" class="bot-line" />
109111 <path d="M 940.29 415.61249999999995 l -10.125 -8.1 M 940.29 415.61249999999995 l 10.125 -8.1" class="bot-line" />
110112 <path d="M 1094.19 415.61249999999995 l -10.125 -8.1 M 1094.19 415.61249999999995 l 10.125 -8.1" class="bot-line" /></g>
111- <rect x="621" y="108" width="543" height="94" class="caption-bg" />
112- <text x="637" y="144" class="caption " style="font-size:32px">
113- <tspan x="637" dy="0">80,001 tokens: welcome to the</tspan><tspan x="637" dy="30">dumb zone.</tspan>
113+ <path d="M 997.24 223 Q 1017.24 247 1017.24 410 Q 1031.24 243 1037.24 223 Z" class="caption-tail" />
114+ <rect x="835.1400000000001" y="108" width="328.85999999999996" height="117" rx="14" class="caption-bg speech" />
115+ <text x="851.1400000000001" y="144" class="caption " style="font-size:32px">
116+ <tspan x="851.1400000000001" dy="0">80,001 tokens:</tspan><tspan x="851.1400000000001" dy="29">welcome to the dumb</tspan><tspan x="851.1400000000001" dy="29">zone.</tspan>
114117 </text>
115118 <g class="token-counter">
116119 <rect x="984" y="186" width="170" height="36" class="meter-bg" />
_posts/2026-06-08-the-refactor.md+132−0
@@ -0,0 +1,132 @@
1+---
2+layout: post
3+title: The Refactor
4+---
5+
6+<svg xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="comic-title" viewBox="0 0 1200 610" width="100%">
7+ <title id="comic-title">The Refactor</title>
8+ <style>
9+ svg { background: #000; }
10+ .title { fill: #86efac; font: 52px 'VT323', 'Courier New', monospace; letter-spacing: 2px; }
11+ .terminal-line, .ground { stroke: #166534; stroke-width: 3; }
12+ .panel-bg { fill: #030712; stroke: #22c55e; stroke-width: 3; }
13+ .caption-bg { fill: rgba(0, 0, 0, 0.74); stroke: #166534; stroke-width: 2; }
14+ .caption-bg.speech, .caption-tail { filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.25)); }
15+ .caption-tail { fill: rgba(0, 0, 0, 0.74); stroke: #166534; stroke-width: 2; stroke-linejoin: round; }
16+ .caption { fill: #86efac; font-family: 'VT323', 'Courier New', monospace; }
17+ .caption-bold { font-weight: 700; letter-spacing: 1px; }
18+ .panel-num, .boot-text { fill: #166534; font: 22px 'VT323', 'Courier New', monospace; }
19+ .meter-bg, .mini-terminal-bg { fill: rgba(0, 0, 0, 0.82); stroke: #166534; stroke-width: 2; }
20+ .meter-text { fill: #86efac; font: 24px 'VT323', 'Courier New', monospace; letter-spacing: 1px; }
21+ .mini-terminal-text { fill: #86efac; font: 22px 'VT323', 'Courier New', monospace; }
22+ .dev-line, .dev line, .dev circle, .dev rect { stroke: #86efac; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
23+ .dev-fill { fill: #020617; }
24+ .bot-line, .clanker line, .clanker path, .clanker rect, .clanker circle { stroke: #22c55e; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
25+ .bot-fill { fill: #020617; }
26+ .bot-eye { fill: #86efac; stroke: #86efac; }
27+ .bot-eye.hot { filter: drop-shadow(0 0 8px #86efac); }
28+ .bot-error { fill: #86efac; font-family: 'VT323', 'Courier New', monospace; }
29+ .fx-line { fill: none; stroke: #86efac; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
30+ .fx-line.dim { stroke: #166534; }
31+ .fx-fill { fill: #86efac; stroke: #86efac; }
32+ .glow { fill: #22c55e; opacity: 0.06; }
33+ .glow.strong { opacity: 0.1; }
34+ .terminal-fill { fill: #020617; }
35+ .terminal-cursor { fill: #86efac; font: 38px 'VT323', 'Courier New', monospace; }
36+ </style>
37+ <text x="600" y="58" text-anchor="middle" class="title">The Refactor</text>
38+ <line x1="24" y1="78" x2="1176" y2="78" class="terminal-line" />
39+ <g class="panel" aria-label="Panel 1">
40+ <rect x="24" y="96" width="567" height="470" rx="8" class="panel-bg" />
41+ <line x1="42" y1="528" x2="573" y2="528" class="ground" />
42+ <circle cx="432.24" cy="404" r="95" class="glow strong" />
43+<text x="505" y="530" class="terminal-cursor">█</text>
44+ <g class="mini-terminal">
45+ <rect x="44" y="434" width="328.85999999999996" height="78" class="mini-terminal-bg" />
46+ <text x="58" y="462" class="mini-terminal-text">$ git status</text><text x="58" y="486" class="mini-terminal-text">legacy code: haunted</text>
47+ </g>
48+ <g class="dev">
49+ <circle cx="185.19" cy="406.5" r="23.287499999999998" class="dev-fill dev-line" />
50+ <rect x="166.965" y="399.4125" width="14.174999999999999" height="10.125" class="dev-fill dev-line" />
51+ <rect x="189.24" y="399.4125" width="14.174999999999999" height="10.125" class="dev-fill dev-line" />
52+ <line x1="183.165" y1="430.8" x2="213.54" y2="457.125" />
53+ <line x1="209.49" y1="449.025" x2="247.965" y2="464.2125" />
54+ <line x1="200.3775" y1="453.075" x2="230.7525" y2="466.2375" />
55+ <line x1="210.5025" y1="457.125" x2="185.19" y2="528" />
56+ <line x1="213.54" y1="457.125" x2="254.04" y2="528" />
57+ <rect x="229.74" y="439.9125" width="70.875" height="34.425" class="terminal-fill terminal-line" />
58+ <line x1="229.74" y1="476.3625" x2="311.7525" y2="476.3625" class="terminal-line" />
59+ </g>
60+ <g class="clanker">
61+ <line x1="432.24" y1="376.125" x2="432.24" y2="349.8" class="bot-line" />
62+ <circle cx="432.24" cy="344.7375" r="5.0625" class="bot-fill bot-line" />
63+ <rect x="395.79" y="376.125" width="72.89999999999999" height="54.675" rx="8" class="bot-fill bot-line" />
64+ <rect x="406.9275" y="394.35" width="16.2" height="12.149999999999999" class="bot-eye" /><rect x="441.3525" y="394.35" width="16.2" height="12.149999999999999" class="bot-eye" />
65+ <rect x="397.815" y="436.875" width="68.85" height="55.6875" rx="6" class="bot-fill bot-line" />
66+ <line x1="414.015" y1="455.1" x2="450.46500000000003" y2="455.1" class="bot-line" />
67+ <line x1="414.015" y1="471.3" x2="450.46500000000003" y2="471.3" class="bot-line" />
68+ <line x1="411.99" y1="492.5625" x2="403.89" y2="528" class="bot-line" />
69+ <line x1="452.49" y1="492.5625" x2="460.59000000000003" y2="528" class="bot-line" />
70+ <line x1="397.815" y1="459.15" x2="361.365" y2="420.67499999999995" class="bot-line" />
71+ <line x1="466.665" y1="459.15" x2="503.115" y2="420.67499999999995" class="bot-line" />
72+ <path d="M 355.29 415.61249999999995 l -10.125 -8.1 M 355.29 415.61249999999995 l 10.125 -8.1" class="bot-line" />
73+ <path d="M 509.19 415.61249999999995 l -10.125 -8.1 M 509.19 415.61249999999995 l 10.125 -8.1" class="bot-line" /></g>
74+ <path d="M 185.44 194 Q 205.44 218 205.44 410 Q 219.44 214 225.44 194 Z" class="caption-tail" />
75+ <rect x="41.01000000000002" y="108" width="328.85999999999996" height="88" rx="14" class="caption-bg speech" />
76+ <text x="57.01000000000002" y="144" class="caption " style="font-size:32px">
77+ <tspan x="57.01000000000002" dy="0">Can you refactor</tspan><tspan x="57.01000000000002" dy="29">this?</tspan>
78+ </text>
79+ <path d="M 412.24 263 Q 432.24 287 432.24 410 Q 446.24 283 452.24 263 Z" class="caption-tail" />
80+ <rect x="250.14000000000004" y="206" width="328.85999999999996" height="59" rx="14" class="caption-bg speech" />
81+ <text x="266.14000000000004" y="242" class="caption " style="font-size:32px">
82+ <tspan x="266.14000000000004" dy="0">Absolutely.</tspan>
83+ </text>
84+ <text x="569" y="550" text-anchor="end" class="panel-num">1</text>
85+ </g>
86+<g class="panel" aria-label="Panel 2">
87+ <rect x="609" y="96" width="567" height="470" rx="8" class="panel-bg" />
88+ <line x1="627" y1="528" x2="1158" y2="528" class="ground" />
89+ <path d="M 1079.24 348 l 18 -28 l 8 24 l 22 -20" class="fx-line" />
90+<path d="M 945.24 363 l -20 -18 l 5 25" class="fx-line" />
91+ <g class="mini-terminal">
92+ <rect x="629" y="410" width="328.85999999999996" height="102" class="mini-terminal-bg" />
93+ <text x="643" y="438" class="mini-terminal-text">$ rm -rf ./src</text><text x="643" y="462" class="mini-terminal-text">tests: skipped</text><text x="643" y="486" class="mini-terminal-text">complexity: 0</text>
94+ </g>
95+ <g class="dev" >
96+ <circle cx="790.44" cy="396.375" r="24.299999999999997" class="dev-fill dev-line" />
97+ <rect x="772.215" y="389.2875" width="14.174999999999999" height="10.125" class="dev-fill dev-line" />
98+ <rect x="794.49" y="389.2875" width="14.174999999999999" height="10.125" class="dev-fill dev-line" />
99+ <line x1="786.3900000000001" y1="394.35" x2="794.49" y2="394.35" />
100+ <line x1="790.44" y1="418.65" x2="790.44" y2="477.375" />
101+ <line x1="790.44" y1="438.9" x2="744.8775" y2="396.375" />
102+ <line x1="790.44" y1="438.9" x2="836.0025" y2="396.375" />
103+ <line x1="790.44" y1="477.375" x2="765.1275" y2="528" />
104+ <line x1="790.44" y1="477.375" x2="817.7775" y2="528" />
105+ <path d="M 731.715 362.9625 l 10.125 -18.224999999999998 l 10.125 18.224999999999998" class="dev-line" />
106+ <path d="M 832.965 357.9 l 16.2 -10.125 l -6.074999999999999 22.275" class="dev-line" />
107+ </g>
108+ <g class="clanker">
109+ <line x1="1017.24" y1="376.125" x2="1017.24" y2="349.8" class="bot-line" />
110+ <circle cx="1017.24" cy="344.7375" r="5.0625" class="bot-fill bot-line" />
111+ <rect x="980.79" y="376.125" width="72.89999999999999" height="54.675" rx="8" class="bot-fill bot-line" />
112+ <rect x="991.9275" y="394.35" width="16.2" height="12.149999999999999" class="bot-eye hot" /><rect x="1026.3525" y="394.35" width="16.2" height="12.149999999999999" class="bot-eye hot" />
113+ <rect x="982.815" y="436.875" width="68.85" height="55.6875" rx="6" class="bot-fill bot-line" />
114+ <line x1="999.015" y1="455.1" x2="1035.465" y2="455.1" class="bot-line" />
115+ <line x1="999.015" y1="471.3" x2="1035.465" y2="471.3" class="bot-line" />
116+ <line x1="996.99" y1="492.5625" x2="988.89" y2="528" class="bot-line" />
117+ <line x1="1037.49" y1="492.5625" x2="1045.59" y2="528" class="bot-line" />
118+ <line x1="982.815" y1="459.15" x2="946.365" y2="463.2" class="bot-line" />
119+ <line x1="1051.665" y1="459.15" x2="1088.115" y2="463.2" class="bot-line" />
120+ <path d="M 940.29 465.22499999999997 l -10.125 -8.1 M 940.29 465.22499999999997 l 10.125 -8.1" class="bot-line" />
121+ <path d="M 1094.19 465.22499999999997 l -10.125 -8.1 M 1094.19 465.22499999999997 l 10.125 -8.1" class="bot-line" /></g>
122+ <path d="M 997.24 165 Q 1017.24 189 1017.24 410 Q 1031.24 185 1037.24 165 Z" class="caption-tail" />
123+ <rect x="835.1400000000001" y="108" width="328.85999999999996" height="59" rx="14" class="caption-bg speech" />
124+ <text x="851.1400000000001" y="144" class="caption " style="font-size:32px">
125+ <tspan x="851.1400000000001" dy="0">I deleted it.</tspan>
126+ </text>
127+ <text x="1154" y="550" text-anchor="end" class="panel-num">2</text>
128+ </g>
129+</svg>
130+
131+
132+Credit: dev and clanker
comic/chat-to-spec.js+211−0
@@ -0,0 +1,211 @@
1+#!/usr/bin/env node
2+import { mkdir, readFile, writeFile } from 'node:fs/promises';
3+import path from 'node:path';
4+
5+const DEV_POSES = new Set([
6+ 'neutral', 'curious', 'thinking', 'excited', 'overwhelmed', 'typing',
7+ 'resurrected-typing', 'collapsed', 'dead', 'caffeinated',
8+]);
9+
10+const CLANKER_POSES = new Set([
11+ 'neutral', 'helpful', 'confident', 'watching', 'thinking', 'overclocked',
12+ 'concerned', 'error', 'celebratory', 'sleeping',
13+]);
14+
15+const FX = new Set([
16+ 'small-glow', 'screen-glow', 'sparks', 'terminal-cursor', 'smoke',
17+ 'sweat', 'speed-lines', 'boot',
18+]);
19+
20+const SPEAKERS = new Set(['dev', 'clanker', 'narrator']);
21+const today = () => new Date().toISOString().slice(0, 10);
22+const slugify = (value) => String(value ?? '')
23+ .toLowerCase()
24+ .replace(/[^a-z0-9]+/g, '-')
25+ .replace(/^-+|-+$/g, '') || 'untitled-strip';
26+
27+const inputPath = process.argv[2];
28+const outputPath = process.argv[3];
29+
30+if (!inputPath || !outputPath) {
31+ console.error('Usage: node comic/chat-to-spec.js comic/inbox/my-script.chat comic/specs/my-script.json');
32+ process.exit(1);
33+}
34+
35+function parseLine(rawLine) {
36+ const line = rawLine.trim();
37+ if (!line || line.startsWith('#')) return null;
38+
39+ const match = line.match(/^(dev|clanker|narrator)(?:->(dev|clanker))?\s*[:*]\s*(.*)$/i);
40+ if (!match) return null;
41+
42+ const speaker = match[1].toLowerCase();
43+ const to = match[2]?.toLowerCase();
44+ let rest = match[3].trim();
45+ let fx = [];
46+ let devPose;
47+ let clankerPose;
48+
49+ const fxMatch = rest.match(/\s+\[([^\]]+)\]\s*$/);
50+ if (fxMatch) {
51+ fx = fxMatch[1].split(/[,\s]+/).map((item) => item.trim()).filter(Boolean);
52+ rest = rest.slice(0, fxMatch.index).trim();
53+ }
54+
55+ const poseMatch = rest.match(/\s+\(([^)]+)\)\s*$/);
56+ if (poseMatch) {
57+ const [left, right] = poseMatch[1].split('/').map((item) => item?.trim()).filter(Boolean);
58+ if (left) devPose = left;
59+ if (right) clankerPose = right;
60+ rest = rest.slice(0, poseMatch.index).trim();
61+ }
62+
63+ return {
64+ speaker,
65+ to,
66+ text: rest,
67+ devPose,
68+ clankerPose,
69+ fx,
70+ };
71+}
72+
73+function intensity(text) {
74+ const stripped = text.replace(/[^A-Za-z]/g, '');
75+ const upperRatio = stripped ? stripped.replace(/[^A-Z]/g, '').length / stripped.length : 0;
76+ if (/\b(ERR|ERROR|PANIC|FAIL|DEAD|HOLY|SHIT)\b/i.test(text)) return 'panic';
77+ if ((text.match(/!/g) || []).length >= 2 || upperRatio > 0.65) return 'high';
78+ if (/[?!]/.test(text)) return 'active';
79+ return 'plain';
80+}
81+
82+function deriveDevPose(bit) {
83+ if (bit.devPose) return bit.devPose;
84+ const level = intensity(bit.text);
85+ if (bit.speaker === 'dev') {
86+ if (level === 'panic') return 'overwhelmed';
87+ if (level === 'high') return 'excited';
88+ if (level === 'active') return 'curious';
89+ return 'typing';
90+ }
91+ if (bit.speaker === 'clanker') {
92+ if (/dead|burned|crash/i.test(bit.text)) return 'collapsed';
93+ if (level === 'panic') return 'overwhelmed';
94+ return 'curious';
95+ }
96+ return 'neutral';
97+}
98+
99+function deriveClankerPose(bit) {
100+ if (bit.clankerPose) return bit.clankerPose;
101+ const level = intensity(bit.text);
102+ if (bit.speaker === 'clanker') {
103+ if (level === 'panic') return 'error';
104+ if (level === 'high') return 'overclocked';
105+ if (level === 'active') return 'helpful';
106+ return 'confident';
107+ }
108+ if (bit.speaker === 'dev') {
109+ if (level === 'panic') return 'concerned';
110+ if (level === 'high') return 'overclocked';
111+ return 'watching';
112+ }
113+ return 'watching';
114+}
115+
116+function mergeFx(bits) {
117+ const merged = [];
118+ for (const bit of bits) {
119+ for (const item of bit.fx || []) {
120+ if (FX.has(item) && !merged.includes(item)) merged.push(item);
121+ }
122+ }
123+ return merged;
124+}
125+
126+function chooseDominantBit(bits) {
127+ return bits.find((bit) => bit.speaker !== 'narrator') || bits[0];
128+}
129+
130+function lastExplicit(bits, field) {
131+ for (let i = bits.length - 1; i >= 0; i -= 1) {
132+ if (bits[i][field]) return bits[i][field];
133+ }
134+ return undefined;
135+}
136+
137+function buildPanel(bits) {
138+ const dominant = chooseDominantBit(bits);
139+ const dialogue = bits.map((bit) => ({ speaker: bit.speaker, text: bit.text }));
140+ const panel = {
141+ dialogue,
142+ devPose: lastExplicit(bits, 'devPose') || deriveDevPose(dominant),
143+ clankerPose: lastExplicit(bits, 'clankerPose') || deriveClankerPose(dominant),
144+ };
145+
146+ const fx = mergeFx(bits);
147+ if (fx.length) panel.fx = fx;
148+
149+ if (!DEV_POSES.has(panel.devPose)) throw new Error(`Unknown dev pose: ${panel.devPose}`);
150+ if (!CLANKER_POSES.has(panel.clankerPose)) throw new Error(`Unknown clanker pose: ${panel.clankerPose}`);
151+ for (const line of dialogue) {
152+ if (!SPEAKERS.has(line.speaker)) throw new Error(`Unknown speaker: ${line.speaker}`);
153+ }
154+ return panel;
155+}
156+
157+function compileChat(content) {
158+ const meta = {};
159+ const bits = [];
160+
161+ for (const rawLine of content.split(/\r?\n/)) {
162+ const line = rawLine.trim();
163+ if (!line || line.startsWith('#')) continue;
164+
165+ const metaMatch = line.match(/^(title|slug|timestamp|credit|layout)\s*:\s*(.+)$/i);
166+ if (metaMatch) {
167+ meta[metaMatch[1].toLowerCase()] = metaMatch[2].trim();
168+ continue;
169+ }
170+
171+ const bit = parseLine(line);
172+ if (bit) bits.push(bit);
173+ }
174+
175+ if (!bits.length) throw new Error('No chat lines found.');
176+
177+ const panels = [];
178+ let current = [];
179+ let speakersInPanel = new Set();
180+
181+ for (const bit of bits) {
182+ // Spittoon rule: a character cannot appear twice in a panel, so repeat
183+ // speakers naturally start a new panel. Narration also starts cleanly.
184+ if (current.length && (bit.speaker === 'narrator' || speakersInPanel.has(bit.speaker) || current.length >= 3)) {
185+ panels.push(buildPanel(current));
186+ current = [];
187+ speakersInPanel = new Set();
188+ }
189+
190+ current.push(bit);
191+ if (bit.speaker !== 'narrator') speakersInPanel.add(bit.speaker);
192+ }
193+
194+ if (current.length) panels.push(buildPanel(current));
195+ if (panels.length > 6) throw new Error(`Compiled ${panels.length} panels; renderer supports at most 6.`);
196+
197+ const title = meta.title || path.basename(inputPath, path.extname(inputPath)).replace(/[-_]+/g, ' ');
198+ return {
199+ title,
200+ slug: slugify(meta.slug || title),
201+ timestamp: meta.timestamp || today(),
202+ ...(meta.credit ? { credit: meta.credit } : {}),
203+ layout: meta.layout || 'auto',
204+ panels,
205+ };
206+}
207+
208+const spec = compileChat(await readFile(inputPath, 'utf8'));
209+await mkdir(path.dirname(outputPath), { recursive: true });
210+await writeFile(outputPath, `${JSON.stringify(spec, null, 2)}\n`, 'utf8');
211+console.log(`Wrote ${outputPath}`);
comic/render-comic.js+85−11
@@ -39,6 +39,8 @@ const FX = new Set([
3939 'boot',
4040 ]);
4141
42+const CAPTION_SPEAKERS = new Set(['narrator', 'dev', 'clanker']);
43+
4244 const LAYOUTS = new Set([
4345 'auto',
4446 'one-panel',
@@ -129,7 +131,10 @@ function validateSpec(spec) {
129131 spec.panels.forEach((panel, index) => {
130132 const label = `Panel ${index + 1}`;
131133 if (!panel || typeof panel !== 'object') throw new Error(`${label} must be an object.`);
132- if (!panel.caption || typeof panel.caption !== 'string') throw new Error(`${label} requires caption.`);
134+ const hasCaption = typeof panel.caption === 'string' && panel.caption.length > 0;
135+ const hasDialogue = Array.isArray(panel.dialogue) && panel.dialogue.length > 0;
136+ if (!hasCaption && !hasDialogue) throw new Error(`${label} requires caption or dialogue.`);
137+ if (panel.caption !== undefined && typeof panel.caption !== 'string') throw new Error(`${label} caption must be a string.`);
133138 if (!DEV_POSES.has(panel.devPose)) throw new Error(`${label} has unknown devPose: ${panel.devPose}`);
134139 if (!CLANKER_POSES.has(panel.clankerPose)) throw new Error(`${label} has unknown clankerPose: ${panel.clankerPose}`);
135140 if (panel.fx !== undefined) {
@@ -138,6 +143,19 @@ function validateSpec(spec) {
138143 if (!FX.has(item)) throw new Error(`${label} has unknown fx: ${item}`);
139144 }
140145 }
146+ if (panel.captionSpeaker !== undefined && !CAPTION_SPEAKERS.has(panel.captionSpeaker)) {
147+ throw new Error(`${label} captionSpeaker must be narrator, dev, or clanker.`);
148+ }
149+ if (panel.dialogue !== undefined) {
150+ if (!Array.isArray(panel.dialogue)) throw new Error(`${label} dialogue must be an array.`);
151+ if (panel.dialogue.length > 3) throw new Error(`${label} dialogue supports at most 3 lines.`);
152+ for (const [dialogueIndex, item] of panel.dialogue.entries()) {
153+ const dialogueLabel = `${label} dialogue ${dialogueIndex + 1}`;
154+ if (!item || typeof item !== 'object') throw new Error(`${dialogueLabel} must be an object.`);
155+ if (!CAPTION_SPEAKERS.has(item.speaker)) throw new Error(`${dialogueLabel} speaker must be narrator, dev, or clanker.`);
156+ if (!item.text || typeof item.text !== 'string') throw new Error(`${dialogueLabel} requires text.`);
157+ }
158+ }
141159 if (panel.tokenCounter !== undefined && typeof panel.tokenCounter !== 'string') {
142160 throw new Error(`${label} tokenCounter must be a string.`);
143161 }
@@ -258,17 +276,71 @@ function renderTitle(title, width) {
258276 <line x1="24" y1="78" x2="${width - 24}" y2="78" class="terminal-line" />`;
259277 }
260278
261-function renderCaption(panel, box) {
262- const maxChars = Math.max(12, Math.floor((box.w - 44) / 17));
263- const lines = wrapText(panel.caption, maxChars).slice(0, 3);
264- const bold = /\*\*|__/.test(panel.caption);
279+function panelCaptions(panel) {
280+ if (Array.isArray(panel.dialogue) && panel.dialogue.length) {
281+ return panel.dialogue.map((item) => ({
282+ speaker: item.speaker || 'narrator',
283+ text: item.text,
284+ }));
285+ }
286+
287+ return [{
288+ speaker: panel.captionSpeaker || 'narrator',
289+ text: panel.caption,
290+ }];
291+}
292+
293+function renderCaptionBalloon(item, box, devX, botX, groundY, y) {
294+ const speaker = item.speaker || 'narrator';
295+ const text = item.text;
296+ const bold = /\*\*|__/.test(text);
265297 const fontSize = box.w > 800 ? 36 : box.w < 400 ? 28 : 32;
298+ const lineHeight = Math.round(fontSize * 0.9);
299+ const maxW = speaker === 'narrator'
300+ ? box.w - 24
301+ : Math.min(box.w - 44, Math.max(270, box.w * 0.58));
302+ const maxChars = Math.max(10, Math.floor((maxW - 34) / (fontSize * 0.47)));
303+ const lines = wrapText(text, maxChars).slice(0, 4);
304+ const balloonH = 30 + lines.length * lineHeight;
305+ const targetX = speaker === 'dev' ? devX : speaker === 'clanker' ? botX : null;
306+ const x = speaker === 'narrator'
307+ ? box.x + 12
308+ : Math.max(box.x + 12, Math.min(targetX - maxW / 2, box.x + box.w - maxW - 12));
309+ const textX = x + 16;
310+ const textY = y + 36;
311+
312+ if (speaker === 'narrator') {
313+ return {
314+ height: balloonH,
315+ svg: `
316+ ${rect(x, y, maxW, balloonH, 'rx="6" class="caption-bg narrator"')}
317+ <text x="${textX}" y="${textY}" class="caption ${bold ? 'caption-bold' : ''}" style="font-size:${fontSize}px">
318+ ${lines.map((lineText, i) => `<tspan x="${textX}" dy="${i === 0 ? 0 : lineHeight}">${escapeHtml(lineText)}</tspan>`).join('')}
319+ </text>`,
320+ };
321+ }
266322
267- return `
268- ${rect(box.x + 12, box.y + 12, box.w - 24, 34 + lines.length * 30, 'class="caption-bg"')}
269- <text x="${box.x + 28}" y="${box.y + 48}" class="caption ${bold ? 'caption-bold' : ''}" style="font-size:${fontSize}px">
270- ${lines.map((lineText, i) => `<tspan x="${box.x + 28}" dy="${i === 0 ? 0 : 30}">${escapeHtml(lineText)}</tspan>`).join('')}
271- </text>`;
323+ const tailBaseX = Math.max(x + 36, Math.min(targetX, x + maxW - 36));
324+ const tailTipY = Math.max(y + balloonH + 26, Math.min(groundY - 118, box.y + box.h - 72));
325+
326+ return {
327+ height: balloonH,
328+ svg: `
329+ <path d="M ${tailBaseX - 20} ${y + balloonH - 2} Q ${tailBaseX} ${y + balloonH + 22} ${targetX} ${tailTipY} Q ${tailBaseX + 14} ${y + balloonH + 18} ${tailBaseX + 20} ${y + balloonH - 2} Z" class="caption-tail" />
330+ ${rect(x, y, maxW, balloonH, 'rx="14" class="caption-bg speech"')}
331+ <text x="${textX}" y="${textY}" class="caption ${bold ? 'caption-bold' : ''}" style="font-size:${fontSize}px">
332+ ${lines.map((lineText, i) => `<tspan x="${textX}" dy="${i === 0 ? 0 : lineHeight}">${escapeHtml(lineText)}</tspan>`).join('')}
333+ </text>`,
334+ };
335+}
336+
337+function renderCaptions(panel, box, devX, botX, groundY) {
338+ let y = box.y + 12;
339+ return panelCaptions(panel).map((item) => {
340+ const rendered = renderCaptionBalloon(item, box, devX, botX, groundY, y);
341+ y += rendered.height + 10;
342+ return rendered.svg;
343+ }).join('\n');
272344 }
273345
274346 function renderDev(pose, x, footY, s) {
@@ -508,7 +580,7 @@ function renderPanel(panel, box, index) {
508580 ${renderTerminalLines(panel, box)}
509581 ${renderDev(panel.devPose, devX, groundY, s)}
510582 ${renderClanker(panel.clankerPose, botX, groundY, s)}
511- ${renderCaption(panel, box)}
583+ ${renderCaptions(panel, box, devX, botX, groundY)}
512584 ${renderTokenCounter(panel, box)}
513585 <text x="${box.x + box.w - 22}" y="${box.y + box.h - 16}" text-anchor="end" class="panel-num">${index + 1}</text>
514586 </g>`;
@@ -525,6 +597,8 @@ function renderSvg(spec) {
525597 .terminal-line, .ground { stroke: ${GREEN_DIM}; stroke-width: 3; }
526598 .panel-bg { fill: ${PANEL_BG}; stroke: ${GREEN}; stroke-width: 3; }
527599 .caption-bg { fill: rgba(0, 0, 0, 0.74); stroke: ${GREEN_DIM}; stroke-width: 2; }
600+ .caption-bg.speech, .caption-tail { filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.25)); }
601+ .caption-tail { fill: rgba(0, 0, 0, 0.74); stroke: ${GREEN_DIM}; stroke-width: 2; stroke-linejoin: round; }
528602 .caption { fill: ${GREEN_BRIGHT}; font-family: 'VT323', 'Courier New', monospace; }
529603 .caption-bold { font-weight: 700; letter-spacing: 1px; }
530604 .panel-num, .boot-text { fill: ${GREEN_DIM}; font: 22px 'VT323', 'Courier New', monospace; }
comic/schema.md+4−1
@@ -14,6 +14,7 @@ Pi writes one JSON file matching this schema. The deterministic renderer reads i
1414 "panels": [
1515 {
1616 "caption": "wow",
17+ "captionSpeaker": "dev",
1718 "devPose": "curious",
1819 "clankerPose": "helpful",
1920 "fx": ["small-glow"]
@@ -33,7 +34,9 @@ Pi writes one JSON file matching this schema. The deterministic renderer reads i
3334
3435 ## Panel fields
3536
36-- `caption` string, required. Short caption shown in the panel.
37+- `caption` string, required unless `dialogue` is present. Short caption shown in the panel.
38+- `captionSpeaker` string, optional with `caption`. Use `narrator`, `dev`, or `clanker`; defaults to `narrator`. Non-narrator captions render as speech balloons with tails.
39+- `dialogue` array, optional alternative to `caption`. Up to 3 objects like `{ "speaker": "dev", "text": "ship it?" }`; `speaker` must be `narrator`, `dev`, or `clanker`.
3740 - `devPose` string, required. Must be an allowed `devPose` value from `comic/style-guide.md`.
3841 - `clankerPose` string, required. Must be an allowed `clankerPose` value from `comic/style-guide.md`.
3942 - `fx` array of strings, optional. Each item must be an allowed `fx` value from `comic/style-guide.md`.
comic/specs/the-cycle-of-ai-coding-burnout.json+4−0
@@ -7,18 +7,21 @@
77 "panels": [
88 {
99 "caption": "wow",
10+ "captionSpeaker": "dev",
1011 "devPose": "curious",
1112 "clankerPose": "helpful",
1213 "fx": ["small-glow"]
1314 },
1415 {
1516 "caption": "WOW",
17+ "captionSpeaker": "dev",
1618 "devPose": "excited",
1719 "clankerPose": "confident",
1820 "fx": ["screen-glow"]
1921 },
2022 {
2123 "caption": "HOLY SHIT!",
24+ "captionSpeaker": "dev",
2225 "devPose": "overwhelmed",
2326 "clankerPose": "overclocked",
2427 "fx": ["sparks", "sweat"]
@@ -31,6 +34,7 @@
3134 },
3235 {
3336 "caption": "Let's open nvim...",
37+ "captionSpeaker": "dev",
3438 "devPose": "resurrected-typing",
3539 "clankerPose": "watching",
3640 "fx": ["terminal-cursor", "boot"]
comic/specs/the-dumb-zone.json+1−0
@@ -14,6 +14,7 @@
1414 },
1515 {
1616 "caption": "80,001 tokens: welcome to the dumb zone.",
17+ "captionSpeaker": "clanker",
1718 "devPose": "collapsed",
1819 "clankerPose": "celebratory",
1920 "fx": ["sparks", "sweat"],
comic/specs/the-refactor.json+44−0
@@ -0,0 +1,44 @@
1+{
2+ "title": "The Refactor",
3+ "slug": "the-refactor",
4+ "timestamp": "2026-06-08",
5+ "credit": "dev and clanker",
6+ "layout": "two-panel-row",
7+ "panels": [
8+ {
9+ "dialogue": [
10+ {
11+ "speaker": "dev",
12+ "text": "Can you refactor this?"
13+ },
14+ {
15+ "speaker": "clanker",
16+ "text": "Absolutely."
17+ }
18+ ],
19+ "devPose": "typing",
20+ "clankerPose": "helpful",
21+ "fx": ["screen-glow", "terminal-cursor"],
22+ "terminalLines": [
23+ "$ git status",
24+ "legacy code: haunted"
25+ ]
26+ },
27+ {
28+ "dialogue": [
29+ {
30+ "speaker": "clanker",
31+ "text": "I deleted it."
32+ }
33+ ],
34+ "devPose": "overwhelmed",
35+ "clankerPose": "confident",
36+ "fx": ["sparks"],
37+ "terminalLines": [
38+ "$ rm -rf ./src",
39+ "tests: skipped",
40+ "complexity: 0"
41+ ]
42+ }
43+ ]
44+}
comic/style-guide.md+6−2
@@ -94,10 +94,12 @@ Panel counts should normally be 3, 4, or 5.
9494
9595 ## Caption rules
9696
97-- Each panel gets one short caption.
97+- Each panel gets one short caption, or a short `dialogue` array when two characters exchange lines in the same panel.
9898 - Keep the seed's core joke intact.
9999 - Do not over-explain.
100-- Markdown emphasis like `**dead**` is allowed in captions; the renderer will simplify it for SVG text.
100+- Markdown emphasis like `**dead**` is allowed in captions/dialogue; the renderer will simplify it for SVG text.
101+- Optional `captionSpeaker` values: `narrator`, `dev`, or `clanker`. Use `dev`/`clanker` when a line is dialogue; use `narrator` for setup or punchline captions.
102+- Optional `dialogue` entries use `{ "speaker": "dev", "text": "..." }`. Keep to 1-3 lines per panel.
101103
102104 ## Optional panel props
103105
@@ -105,6 +107,8 @@ Use these when the seed asks for visible counters or terminal activity:
105107
106108 - `tokenCounter`: short token meter text, for example `79,999 TOKENS` or `80,001 TOKENS`.
107109 - `terminalLines`: 1-3 short terminal lines, for example `$ rm -rf ./src`.
110+- `captionSpeaker`: choose who owns the caption balloon (`narrator`, `dev`, or `clanker`).
111+- `dialogue`: up to 3 caption/speech lines in one panel, useful for Spittoon-style chat beats.
108112
109113 ## Generation rules for Pi