workerssuper 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +13 -0
- package/.codex/INSTALL.md +67 -0
- package/.cursor-plugin/plugin.json +18 -0
- package/.gitattributes +18 -0
- package/.github/FUNDING.yml +3 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +52 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +34 -0
- package/.github/ISSUE_TEMPLATE/platform_support.md +23 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +87 -0
- package/.opencode/INSTALL.md +83 -0
- package/.opencode/plugins/superpowers.js +107 -0
- package/CHANGELOG.md +13 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/GEMINI.md +2 -0
- package/LICENSE +21 -0
- package/README.md +187 -0
- package/RELEASE-NOTES.md +1057 -0
- package/agents/code-reviewer.md +48 -0
- package/commands/brainstorm.md +5 -0
- package/commands/execute-plan.md +5 -0
- package/commands/write-plan.md +5 -0
- package/docs/README.codex.md +126 -0
- package/docs/README.opencode.md +130 -0
- package/docs/plans/2025-11-22-opencode-support-design.md +294 -0
- package/docs/plans/2025-11-22-opencode-support-implementation.md +1095 -0
- package/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +711 -0
- package/docs/plans/2026-01-17-visual-brainstorming.md +571 -0
- package/docs/superpowers/plans/2026-01-22-document-review-system.md +301 -0
- package/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +523 -0
- package/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +479 -0
- package/docs/superpowers/specs/2026-01-22-document-review-system-design.md +136 -0
- package/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +162 -0
- package/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +118 -0
- package/docs/testing.md +303 -0
- package/docs/windows/polyglot-hooks.md +212 -0
- package/gemini-extension.json +6 -0
- package/hooks/hooks-cursor.json +10 -0
- package/hooks/hooks.json +16 -0
- package/hooks/run-hook.cmd +46 -0
- package/hooks/session-start +57 -0
- package/package.json +5 -0
- package/skills/brainstorming/SKILL.md +164 -0
- package/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/brainstorming/scripts/server.cjs +338 -0
- package/skills/brainstorming/scripts/start-server.sh +153 -0
- package/skills/brainstorming/scripts/stop-server.sh +55 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +286 -0
- package/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/subagent-driven-development/SKILL.md +277 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/using-git-worktrees/SKILL.md +218 -0
- package/skills/using-superpowers/SKILL.md +115 -0
- package/skills/using-superpowers/references/codex-tools.md +25 -0
- package/skills/using-superpowers/references/gemini-tools.md +33 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/writing-plans/SKILL.md +145 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-skills/SKILL.md +655 -0
- package/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
- package/skills/writing-skills/render-graphs.js +168 -0
- package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/tests/brainstorm-server/package-lock.json +36 -0
- package/tests/brainstorm-server/package.json +10 -0
- package/tests/brainstorm-server/server.test.js +424 -0
- package/tests/brainstorm-server/windows-lifecycle.test.sh +351 -0
- package/tests/brainstorm-server/ws-protocol.test.js +392 -0
- package/tests/claude-code/README.md +158 -0
- package/tests/claude-code/analyze-token-usage.py +168 -0
- package/tests/claude-code/run-skill-tests.sh +187 -0
- package/tests/claude-code/test-document-review-system.sh +177 -0
- package/tests/claude-code/test-helpers.sh +202 -0
- package/tests/claude-code/test-subagent-driven-development-integration.sh +314 -0
- package/tests/claude-code/test-subagent-driven-development.sh +165 -0
- package/tests/explicit-skill-requests/prompts/action-oriented.txt +3 -0
- package/tests/explicit-skill-requests/prompts/after-planning-flow.txt +17 -0
- package/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +11 -0
- package/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +8 -0
- package/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +3 -0
- package/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +1 -0
- package/tests/explicit-skill-requests/prompts/skip-formalities.txt +3 -0
- package/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +1 -0
- package/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +1 -0
- package/tests/explicit-skill-requests/run-all.sh +70 -0
- package/tests/explicit-skill-requests/run-claude-describes-sdd.sh +100 -0
- package/tests/explicit-skill-requests/run-extended-multiturn-test.sh +113 -0
- package/tests/explicit-skill-requests/run-haiku-test.sh +144 -0
- package/tests/explicit-skill-requests/run-multiturn-test.sh +143 -0
- package/tests/explicit-skill-requests/run-test.sh +136 -0
- package/tests/opencode/run-tests.sh +163 -0
- package/tests/opencode/setup.sh +73 -0
- package/tests/opencode/test-plugin-loading.sh +72 -0
- package/tests/opencode/test-priority.sh +198 -0
- package/tests/opencode/test-tools.sh +104 -0
- package/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +8 -0
- package/tests/skill-triggering/prompts/executing-plans.txt +1 -0
- package/tests/skill-triggering/prompts/requesting-code-review.txt +3 -0
- package/tests/skill-triggering/prompts/systematic-debugging.txt +11 -0
- package/tests/skill-triggering/prompts/test-driven-development.txt +7 -0
- package/tests/skill-triggering/prompts/writing-plans.txt +10 -0
- package/tests/skill-triggering/run-all.sh +60 -0
- package/tests/skill-triggering/run-test.sh +88 -0
- package/tests/subagent-driven-dev/go-fractals/design.md +81 -0
- package/tests/subagent-driven-dev/go-fractals/plan.md +172 -0
- package/tests/subagent-driven-dev/go-fractals/scaffold.sh +45 -0
- package/tests/subagent-driven-dev/run-test.sh +106 -0
- package/tests/subagent-driven-dev/svelte-todo/design.md +70 -0
- package/tests/subagent-driven-dev/svelte-todo/plan.md +222 -0
- package/tests/subagent-driven-dev/svelte-todo/scaffold.sh +46 -0
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
# Visual Brainstorming Refactor Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** Refactor visual brainstorming from blocking TUI feedback model to non-blocking "Browser Displays, Terminal Commands" architecture.
|
|
6
|
+
|
|
7
|
+
**Architecture:** Browser becomes an interactive display; terminal stays the conversation channel. Server writes user events to a per-screen `.events` file that Claude reads on its next turn. Eliminates `wait-for-feedback.sh` and all `TaskOutput` blocking.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Node.js (Express, ws, chokidar), vanilla HTML/CSS/JS
|
|
10
|
+
|
|
11
|
+
**Spec:** `docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md`
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## File Map
|
|
16
|
+
|
|
17
|
+
| File | Action | Responsibility |
|
|
18
|
+
|------|--------|---------------|
|
|
19
|
+
| `lib/brainstorm-server/index.js` | Modify | Server: add `.events` file writing, clear on new screen, replace `wrapInFrame` |
|
|
20
|
+
| `lib/brainstorm-server/frame-template.html` | Modify | Template: remove feedback footer, add content placeholder + selection indicator |
|
|
21
|
+
| `lib/brainstorm-server/helper.js` | Modify | Client JS: remove send/feedback functions, narrow to click capture + indicator updates |
|
|
22
|
+
| `lib/brainstorm-server/wait-for-feedback.sh` | Delete | No longer needed |
|
|
23
|
+
| `skills/brainstorming/visual-companion.md` | Modify | Skill instructions: rewrite loop to non-blocking flow |
|
|
24
|
+
| `tests/brainstorm-server/server.test.js` | Modify | Tests: update for new template structure and helper.js API |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Chunk 1: Server, Template, Client, Tests, Skill
|
|
29
|
+
|
|
30
|
+
### Task 1: Update `frame-template.html`
|
|
31
|
+
|
|
32
|
+
**Files:**
|
|
33
|
+
- Modify: `lib/brainstorm-server/frame-template.html`
|
|
34
|
+
|
|
35
|
+
- [ ] **Step 1: Remove the feedback footer HTML**
|
|
36
|
+
|
|
37
|
+
Replace the feedback-footer div (lines 227-233) with a selection indicator bar:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<div class="indicator-bar">
|
|
41
|
+
<span id="indicator-text">Click an option above, then return to the terminal</span>
|
|
42
|
+
</div>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Also replace the default content inside `#claude-content` (lines 220-223) with the content placeholder:
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<div id="claude-content">
|
|
49
|
+
<!-- CONTENT -->
|
|
50
|
+
</div>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- [ ] **Step 2: Replace feedback footer CSS with indicator bar CSS**
|
|
54
|
+
|
|
55
|
+
Remove the `.feedback-footer`, `.feedback-footer label`, `.feedback-row`, and the textarea/button styles within `.feedback-footer` (lines 82-112).
|
|
56
|
+
|
|
57
|
+
Add indicator bar CSS:
|
|
58
|
+
|
|
59
|
+
```css
|
|
60
|
+
.indicator-bar {
|
|
61
|
+
background: var(--bg-secondary);
|
|
62
|
+
border-top: 1px solid var(--border);
|
|
63
|
+
padding: 0.5rem 1.5rem;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
text-align: center;
|
|
66
|
+
}
|
|
67
|
+
.indicator-bar span {
|
|
68
|
+
font-size: 0.75rem;
|
|
69
|
+
color: var(--text-secondary);
|
|
70
|
+
}
|
|
71
|
+
.indicator-bar .selected-text {
|
|
72
|
+
color: var(--accent);
|
|
73
|
+
font-weight: 500;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- [ ] **Step 3: Verify template renders**
|
|
78
|
+
|
|
79
|
+
Run the test suite to check the template still loads:
|
|
80
|
+
```bash
|
|
81
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
82
|
+
```
|
|
83
|
+
Expected: Tests 1-5 should still pass. Tests 6-8 may fail (expected — they assert old structure).
|
|
84
|
+
|
|
85
|
+
- [ ] **Step 4: Commit**
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git add lib/brainstorm-server/frame-template.html
|
|
89
|
+
git commit -m "Replace feedback footer with selection indicator bar in brainstorm template"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Task 2: Update `index.js` — content injection and `.events` file
|
|
95
|
+
|
|
96
|
+
**Files:**
|
|
97
|
+
- Modify: `lib/brainstorm-server/index.js`
|
|
98
|
+
|
|
99
|
+
- [ ] **Step 1: Write failing test for `.events` file writing**
|
|
100
|
+
|
|
101
|
+
Add to `tests/brainstorm-server/server.test.js` after Test 4 area — a new test that sends a WebSocket event with a `choice` field and verifies `.events` file is written:
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
// Test: Choice events written to .events file
|
|
105
|
+
console.log('Test: Choice events written to .events file');
|
|
106
|
+
const ws3 = new WebSocket(`ws://localhost:${TEST_PORT}`);
|
|
107
|
+
await new Promise(resolve => ws3.on('open', resolve));
|
|
108
|
+
|
|
109
|
+
ws3.send(JSON.stringify({ type: 'click', choice: 'a', text: 'Option A' }));
|
|
110
|
+
await sleep(300);
|
|
111
|
+
|
|
112
|
+
const eventsFile = path.join(TEST_DIR, '.events');
|
|
113
|
+
assert(fs.existsSync(eventsFile), '.events file should exist after choice click');
|
|
114
|
+
const lines = fs.readFileSync(eventsFile, 'utf-8').trim().split('\n');
|
|
115
|
+
const event = JSON.parse(lines[lines.length - 1]);
|
|
116
|
+
assert.strictEqual(event.choice, 'a', 'Event should contain choice');
|
|
117
|
+
assert.strictEqual(event.text, 'Option A', 'Event should contain text');
|
|
118
|
+
ws3.close();
|
|
119
|
+
console.log(' PASS');
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- [ ] **Step 2: Run test to verify it fails**
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
126
|
+
```
|
|
127
|
+
Expected: New test FAILS — `.events` file doesn't exist yet.
|
|
128
|
+
|
|
129
|
+
- [ ] **Step 3: Write failing test for `.events` file clearing on new screen**
|
|
130
|
+
|
|
131
|
+
Add another test:
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
// Test: .events cleared on new screen
|
|
135
|
+
console.log('Test: .events cleared on new screen');
|
|
136
|
+
// .events file should still exist from previous test
|
|
137
|
+
assert(fs.existsSync(path.join(TEST_DIR, '.events')), '.events should exist before new screen');
|
|
138
|
+
fs.writeFileSync(path.join(TEST_DIR, 'new-screen.html'), '<h2>New screen</h2>');
|
|
139
|
+
await sleep(500);
|
|
140
|
+
assert(!fs.existsSync(path.join(TEST_DIR, '.events')), '.events should be cleared after new screen');
|
|
141
|
+
console.log(' PASS');
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- [ ] **Step 4: Run test to verify it fails**
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
148
|
+
```
|
|
149
|
+
Expected: New test FAILS — `.events` not cleared on screen push.
|
|
150
|
+
|
|
151
|
+
- [ ] **Step 5: Implement `.events` file writing in `index.js`**
|
|
152
|
+
|
|
153
|
+
In the WebSocket `message` handler (line 74-77 of `index.js`), after the `console.log`, add:
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
// Write user events to .events file for Claude to read
|
|
157
|
+
if (event.choice) {
|
|
158
|
+
const eventsFile = path.join(SCREEN_DIR, '.events');
|
|
159
|
+
fs.appendFileSync(eventsFile, JSON.stringify(event) + '\n');
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
In the chokidar `add` handler (line 104-111), add `.events` clearing:
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
if (filePath.endsWith('.html')) {
|
|
167
|
+
// Clear events from previous screen
|
|
168
|
+
const eventsFile = path.join(SCREEN_DIR, '.events');
|
|
169
|
+
if (fs.existsSync(eventsFile)) fs.unlinkSync(eventsFile);
|
|
170
|
+
|
|
171
|
+
console.log(JSON.stringify({ type: 'screen-added', file: filePath }));
|
|
172
|
+
// ... existing reload broadcast
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- [ ] **Step 6: Replace `wrapInFrame` with comment placeholder injection**
|
|
177
|
+
|
|
178
|
+
Replace the `wrapInFrame` function (lines 27-32 of `index.js`):
|
|
179
|
+
|
|
180
|
+
```javascript
|
|
181
|
+
function wrapInFrame(content) {
|
|
182
|
+
return frameTemplate.replace('<!-- CONTENT -->', content);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
- [ ] **Step 7: Run all tests**
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
190
|
+
```
|
|
191
|
+
Expected: New `.events` tests PASS. Existing tests may still have failures from old assertions (fixed in Task 4).
|
|
192
|
+
|
|
193
|
+
- [ ] **Step 8: Commit**
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
git add lib/brainstorm-server/index.js tests/brainstorm-server/server.test.js
|
|
197
|
+
git commit -m "Add .events file writing and comment-based content injection to brainstorm server"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### Task 3: Simplify `helper.js`
|
|
203
|
+
|
|
204
|
+
**Files:**
|
|
205
|
+
- Modify: `lib/brainstorm-server/helper.js`
|
|
206
|
+
|
|
207
|
+
- [ ] **Step 1: Remove `sendToClaude` function**
|
|
208
|
+
|
|
209
|
+
Delete the `sendToClaude` function (lines 92-106) — the function body and the page takeover HTML.
|
|
210
|
+
|
|
211
|
+
- [ ] **Step 2: Remove `window.send` function**
|
|
212
|
+
|
|
213
|
+
Delete the `window.send` function (lines 120-129) — was tied to the removed Send button.
|
|
214
|
+
|
|
215
|
+
- [ ] **Step 3: Remove form submission and input change handlers**
|
|
216
|
+
|
|
217
|
+
Delete the form submission handler (lines 57-71) and the input change handler (lines 73-89) including the `inputTimeout` variable.
|
|
218
|
+
|
|
219
|
+
- [ ] **Step 4: Remove `pageshow` event listener**
|
|
220
|
+
|
|
221
|
+
Delete the `pageshow` listener we added earlier (no textarea to clear anymore).
|
|
222
|
+
|
|
223
|
+
- [ ] **Step 5: Narrow click handler to `[data-choice]` only**
|
|
224
|
+
|
|
225
|
+
Replace the click handler (lines 36-55) with a narrower version:
|
|
226
|
+
|
|
227
|
+
```javascript
|
|
228
|
+
// Capture clicks on choice elements
|
|
229
|
+
document.addEventListener('click', (e) => {
|
|
230
|
+
const target = e.target.closest('[data-choice]');
|
|
231
|
+
if (!target) return;
|
|
232
|
+
|
|
233
|
+
sendEvent({
|
|
234
|
+
type: 'click',
|
|
235
|
+
text: target.textContent.trim(),
|
|
236
|
+
choice: target.dataset.choice,
|
|
237
|
+
id: target.id || null
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
- [ ] **Step 6: Add indicator bar update on choice click**
|
|
243
|
+
|
|
244
|
+
After the `sendEvent` call in the click handler, add:
|
|
245
|
+
|
|
246
|
+
```javascript
|
|
247
|
+
// Update indicator bar
|
|
248
|
+
const indicator = document.getElementById('indicator-text');
|
|
249
|
+
if (indicator) {
|
|
250
|
+
const label = target.querySelector('h3, .content h3, .card-body h3')?.textContent?.trim() || target.dataset.choice;
|
|
251
|
+
indicator.innerHTML = '<span class="selected-text">' + label + ' selected</span> — return to terminal to continue';
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
- [ ] **Step 7: Remove `sendToClaude` from `window.brainstorm` API**
|
|
256
|
+
|
|
257
|
+
Update the `window.brainstorm` object (lines 132-136) to remove `sendToClaude`:
|
|
258
|
+
|
|
259
|
+
```javascript
|
|
260
|
+
window.brainstorm = {
|
|
261
|
+
send: sendEvent,
|
|
262
|
+
choice: (value, metadata = {}) => sendEvent({ type: 'choice', value, ...metadata })
|
|
263
|
+
};
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
- [ ] **Step 8: Run tests**
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
- [ ] **Step 9: Commit**
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
git add lib/brainstorm-server/helper.js
|
|
276
|
+
git commit -m "Simplify helper.js: remove feedback functions, narrow to choice capture + indicator"
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
### Task 4: Update tests for new structure
|
|
282
|
+
|
|
283
|
+
**Files:**
|
|
284
|
+
- Modify: `tests/brainstorm-server/server.test.js`
|
|
285
|
+
|
|
286
|
+
**Note:** Line references below are from the _original_ file. Task 2 inserted new tests earlier in the file, so actual line numbers will be shifted. Find tests by their `console.log` labels (e.g., "Test 5:", "Test 6:").
|
|
287
|
+
|
|
288
|
+
- [ ] **Step 1: Update Test 5 (full document assertion)**
|
|
289
|
+
|
|
290
|
+
Find the Test 5 assertion `!fullRes.body.includes('feedback-footer')`. Change it to: Full documents should NOT have the indicator bar either (they're served as-is):
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
293
|
+
assert(!fullRes.body.includes('indicator-bar') || fullDoc.includes('indicator-bar'),
|
|
294
|
+
'Should not wrap full documents in frame template');
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
- [ ] **Step 2: Update Test 6 (fragment wrapping)**
|
|
298
|
+
|
|
299
|
+
Line 125: Replace `feedback-footer` assertion with indicator bar assertion:
|
|
300
|
+
|
|
301
|
+
```javascript
|
|
302
|
+
assert(fragRes.body.includes('indicator-bar'), 'Fragment should get indicator bar from frame');
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Also verify content placeholder was replaced (fragment content appears, placeholder comment doesn't):
|
|
306
|
+
|
|
307
|
+
```javascript
|
|
308
|
+
assert(!fragRes.body.includes('<!-- CONTENT -->'), 'Content placeholder should be replaced');
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
- [ ] **Step 3: Update Test 7 (helper.js API)**
|
|
312
|
+
|
|
313
|
+
Lines 140-142: Update assertions to reflect the new API surface:
|
|
314
|
+
|
|
315
|
+
```javascript
|
|
316
|
+
assert(helperContent.includes('toggleSelect'), 'helper.js should define toggleSelect');
|
|
317
|
+
assert(helperContent.includes('sendEvent'), 'helper.js should define sendEvent');
|
|
318
|
+
assert(helperContent.includes('selectedChoice'), 'helper.js should track selectedChoice');
|
|
319
|
+
assert(helperContent.includes('brainstorm'), 'helper.js should expose brainstorm API');
|
|
320
|
+
assert(!helperContent.includes('sendToClaude'), 'helper.js should not contain sendToClaude');
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
- [ ] **Step 4: Replace Test 8 (sendToClaude theming) with indicator bar test**
|
|
324
|
+
|
|
325
|
+
Replace Test 8 (lines 145-149) — `sendToClaude` no longer exists. Test the indicator bar instead:
|
|
326
|
+
|
|
327
|
+
```javascript
|
|
328
|
+
// Test 8: Indicator bar uses CSS variables (theme support)
|
|
329
|
+
console.log('Test 8: Indicator bar uses CSS variables');
|
|
330
|
+
const templateContent = fs.readFileSync(
|
|
331
|
+
path.join(__dirname, '../../lib/brainstorm-server/frame-template.html'), 'utf-8'
|
|
332
|
+
);
|
|
333
|
+
assert(templateContent.includes('indicator-bar'), 'Template should have indicator bar');
|
|
334
|
+
assert(templateContent.includes('indicator-text'), 'Template should have indicator text element');
|
|
335
|
+
console.log(' PASS');
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
- [ ] **Step 5: Run full test suite**
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
342
|
+
```
|
|
343
|
+
Expected: ALL tests PASS.
|
|
344
|
+
|
|
345
|
+
- [ ] **Step 6: Commit**
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
git add tests/brainstorm-server/server.test.js
|
|
349
|
+
git commit -m "Update brainstorm server tests for new template structure and helper.js API"
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### Task 5: Delete `wait-for-feedback.sh`
|
|
355
|
+
|
|
356
|
+
**Files:**
|
|
357
|
+
- Delete: `lib/brainstorm-server/wait-for-feedback.sh`
|
|
358
|
+
|
|
359
|
+
- [ ] **Step 1: Verify no other files import or reference `wait-for-feedback.sh`**
|
|
360
|
+
|
|
361
|
+
Search the codebase:
|
|
362
|
+
```bash
|
|
363
|
+
grep -r "wait-for-feedback" /Users/drewritter/prime-rad/superpowers/ --include="*.js" --include="*.md" --include="*.sh" --include="*.json"
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Expected references: only `visual-companion.md` (rewritten in Task 6) and possibly release notes (historical, leave as-is).
|
|
367
|
+
|
|
368
|
+
- [ ] **Step 2: Delete the file**
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
rm lib/brainstorm-server/wait-for-feedback.sh
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
- [ ] **Step 3: Run tests to confirm nothing breaks**
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
378
|
+
```
|
|
379
|
+
Expected: All tests PASS (no test referenced this file).
|
|
380
|
+
|
|
381
|
+
- [ ] **Step 4: Commit**
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
git add -u lib/brainstorm-server/wait-for-feedback.sh
|
|
385
|
+
git commit -m "Delete wait-for-feedback.sh: replaced by .events file"
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
### Task 6: Rewrite `visual-companion.md`
|
|
391
|
+
|
|
392
|
+
**Files:**
|
|
393
|
+
- Modify: `skills/brainstorming/visual-companion.md`
|
|
394
|
+
|
|
395
|
+
- [ ] **Step 1: Update "How It Works" description (line 18)**
|
|
396
|
+
|
|
397
|
+
Replace the sentence about receiving feedback "as JSON" with:
|
|
398
|
+
|
|
399
|
+
```markdown
|
|
400
|
+
The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content, the user sees it in their browser and can click to select options. Selections are recorded to a `.events` file that you read on your next turn.
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
- [ ] **Step 2: Update fragment description (line 20)**
|
|
404
|
+
|
|
405
|
+
Remove "feedback footer" from the description of what the frame template provides:
|
|
406
|
+
|
|
407
|
+
```markdown
|
|
408
|
+
**Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, selection indicator, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
- [ ] **Step 3: Rewrite "The Loop" section (lines 36-61)**
|
|
412
|
+
|
|
413
|
+
Replace the entire "The Loop" section with:
|
|
414
|
+
|
|
415
|
+
```markdown
|
|
416
|
+
## The Loop
|
|
417
|
+
|
|
418
|
+
1. **Write HTML** to a new file in `screen_dir`:
|
|
419
|
+
- Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
|
|
420
|
+
- **Never reuse filenames** — each screen gets a fresh file
|
|
421
|
+
- Use Write tool — **never use cat/heredoc** (dumps noise into terminal)
|
|
422
|
+
- Server automatically serves the newest file
|
|
423
|
+
|
|
424
|
+
2. **Tell user what to expect and end your turn:**
|
|
425
|
+
- Remind them of the URL (every step, not just first)
|
|
426
|
+
- Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
|
|
427
|
+
- Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
|
|
428
|
+
|
|
429
|
+
3. **On your next turn** — after the user responds in the terminal:
|
|
430
|
+
- Read `$SCREEN_DIR/.events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
|
|
431
|
+
- Merge with the user's terminal text to get the full picture
|
|
432
|
+
- The terminal message is the primary feedback; `.events` provides structured interaction data
|
|
433
|
+
|
|
434
|
+
4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
|
|
435
|
+
|
|
436
|
+
5. Repeat until done.
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
- [ ] **Step 4: Replace "User Feedback Format" section (lines 165-174)**
|
|
440
|
+
|
|
441
|
+
Replace with:
|
|
442
|
+
|
|
443
|
+
```markdown
|
|
444
|
+
## Browser Events Format
|
|
445
|
+
|
|
446
|
+
When the user clicks options in the browser, their interactions are recorded to `$SCREEN_DIR/.events` (one JSON object per line). The file is cleared automatically when you push a new screen.
|
|
447
|
+
|
|
448
|
+
```jsonl
|
|
449
|
+
{"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
|
|
450
|
+
{"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
|
|
451
|
+
{"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
|
|
455
|
+
|
|
456
|
+
If `.events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
- [ ] **Step 5: Update "Writing Content Fragments" description (line 65)**
|
|
460
|
+
|
|
461
|
+
Remove "feedback footer" reference:
|
|
462
|
+
|
|
463
|
+
```markdown
|
|
464
|
+
Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, selection indicator, and all interactive infrastructure).
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
- [ ] **Step 6: Update Reference section (lines 200-203)**
|
|
468
|
+
|
|
469
|
+
Remove the helper.js reference description about "JS API" — the API is now minimal. Keep the path reference:
|
|
470
|
+
|
|
471
|
+
```markdown
|
|
472
|
+
## Reference
|
|
473
|
+
|
|
474
|
+
- Frame template (CSS reference): `${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/frame-template.html`
|
|
475
|
+
- Helper script (client-side): `${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/helper.js`
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
- [ ] **Step 7: Commit**
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
git add skills/brainstorming/visual-companion.md
|
|
482
|
+
git commit -m "Rewrite visual-companion.md for non-blocking browser-displays-terminal-commands flow"
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
### Task 7: Final verification
|
|
488
|
+
|
|
489
|
+
- [ ] **Step 1: Run full test suite**
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js
|
|
493
|
+
```
|
|
494
|
+
Expected: ALL tests PASS.
|
|
495
|
+
|
|
496
|
+
- [ ] **Step 2: Manual smoke test**
|
|
497
|
+
|
|
498
|
+
Start the server manually and verify the flow works end-to-end:
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
cd /Users/drewritter/prime-rad/superpowers && lib/brainstorm-server/start-server.sh --project-dir /tmp/brainstorm-smoke-test
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Write a test fragment, open in browser, click an option, verify `.events` file is written, verify indicator bar updates. Then stop the server:
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
lib/brainstorm-server/stop-server.sh <screen_dir from start output>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
- [ ] **Step 3: Verify no stale references remain**
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
grep -r "wait-for-feedback\|sendToClaude\|feedback-footer\|send-to-claude\|TaskOutput.*block.*true" /Users/drewritter/prime-rad/superpowers/ --include="*.js" --include="*.md" --include="*.sh" --include="*.html" | grep -v node_modules | grep -v RELEASE-NOTES | grep -v "\.md:.*spec\|plan"
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
Expected: No hits outside of release notes and the spec/plan docs (which are historical).
|
|
517
|
+
|
|
518
|
+
- [ ] **Step 4: Final commit if any cleanup needed**
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
git status
|
|
522
|
+
# Review untracked/modified files, stage specific files as needed, commit if clean
|
|
523
|
+
```
|