superpowers-zh 1.3.0 → 1.6.0

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.
Files changed (49) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.cursor-plugin/plugin.json +2 -2
  5. package/.pi/extensions/superpowers.ts +121 -0
  6. package/CLAUDE.md +1 -1
  7. package/README.md +77 -34
  8. package/RELEASE-NOTES.zh.md +150 -0
  9. package/assets/qr-wechat.jpg +0 -0
  10. package/assets/sponsors/5cookie-code.png +0 -0
  11. package/bin/superpowers-zh.js +69 -18
  12. package/docs/README.antigravity.md +7 -7
  13. package/docs/README.kimi.md +86 -0
  14. package/docs/README.openclaw.md +7 -4
  15. package/docs/README.pi.md +54 -0
  16. package/docs/README.qoder.md +95 -0
  17. package/docs/README.trae.md +6 -4
  18. package/gemini-extension.json +1 -1
  19. package/hooks/hooks-cursor.json +1 -1
  20. package/hooks/session-start +4 -12
  21. package/package.json +18 -5
  22. package/skills/brainstorming/SKILL.md +5 -0
  23. package/skills/brainstorming/scripts/frame-template.html +25 -26
  24. package/skills/brainstorming/scripts/helper.js +101 -22
  25. package/skills/brainstorming/scripts/server.cjs +428 -43
  26. package/skills/brainstorming/scripts/start-server.sh +76 -20
  27. package/skills/brainstorming/scripts/stop-server.sh +74 -9
  28. package/skills/chinese-code-review/SKILL.md +5 -0
  29. package/skills/chinese-commit-conventions/SKILL.md +5 -0
  30. package/skills/chinese-documentation/SKILL.md +5 -0
  31. package/skills/chinese-git-workflow/SKILL.md +5 -0
  32. package/skills/dispatching-parallel-agents/SKILL.md +5 -0
  33. package/skills/executing-plans/SKILL.md +7 -2
  34. package/skills/finishing-a-development-branch/SKILL.md +112 -32
  35. package/skills/mcp-builder/SKILL.md +5 -0
  36. package/skills/receiving-code-review/SKILL.md +5 -0
  37. package/skills/requesting-code-review/SKILL.md +13 -10
  38. package/skills/requesting-code-review/code-reviewer.md +124 -104
  39. package/skills/subagent-driven-development/SKILL.md +5 -0
  40. package/skills/systematic-debugging/SKILL.md +5 -0
  41. package/skills/test-driven-development/SKILL.md +5 -0
  42. package/skills/using-git-worktrees/SKILL.md +104 -97
  43. package/skills/using-superpowers/SKILL.md +6 -1
  44. package/skills/using-superpowers/references/pi-tools.md +28 -0
  45. package/skills/using-superpowers/references/qoder-tools.md +43 -0
  46. package/skills/verification-before-completion/SKILL.md +5 -0
  47. package/skills/workflow-runner/SKILL.md +5 -0
  48. package/skills/writing-plans/SKILL.md +5 -0
  49. package/skills/writing-skills/SKILL.md +5 -0
@@ -9,11 +9,11 @@
9
9
  *
10
10
  * This template provides a consistent frame with:
11
11
  * - OS-aware light/dark theming
12
- * - Fixed header and selection indicator bar
12
+ * - Header branding and connection status
13
13
  * - Scrollable main content area
14
14
  * - CSS helpers for common UI patterns
15
15
  *
16
- * Content is injected via placeholder comment in #claude-content.
16
+ * Content is injected via placeholder comment in #frame-content.
17
17
  */
18
18
 
19
19
  * { box-sizing: border-box; margin: 0; padding: 0; }
@@ -63,34 +63,37 @@
63
63
  }
64
64
 
65
65
  /* ===== FRAME STRUCTURE ===== */
66
- .header {
67
- background: var(--bg-secondary);
68
- padding: 0.5rem 1.5rem;
69
- display: flex;
70
- justify-content: space-between;
71
- align-items: center;
72
- border-bottom: 1px solid var(--border);
73
- flex-shrink: 0;
66
+ .brand { display: flex; align-items: center; min-width: 0; overflow: hidden; color: var(--text-secondary); line-height: 1; }
67
+ .brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1; }
68
+ .brand-copy { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; transform: translateY(-1px); }
69
+ .brand-logo { display: block; height: 1em; width: auto; max-width: 180px; flex-shrink: 0; filter: invert(1); }
70
+ @media (prefers-color-scheme: dark) {
71
+ .brand-logo { filter: none; }
74
72
  }
75
- .header h1 { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
76
- .header .status { font-size: 0.7rem; color: var(--success); display: flex; align-items: center; gap: 0.4rem; }
77
- .header .status::before { content: ''; width: 6px; height: 6px; background: var(--success); border-radius: 50%; }
73
+ .status { font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex; align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1; }
74
+ .status::before { content: ''; width: 6px; height: 6px; background: var(--status-color, var(--success)); border-radius: 50%; }
78
75
 
79
76
  .main { flex: 1; overflow-y: auto; }
80
- #claude-content { padding: 2rem; min-height: 100%; }
77
+ #frame-content { padding: 2rem; min-height: 100%; }
81
78
 
82
- .indicator-bar {
79
+ .header {
83
80
  background: var(--bg-secondary);
84
- border-top: 1px solid var(--border);
81
+ border-bottom: 1px solid var(--border);
85
82
  padding: 0.5rem 1.5rem;
86
83
  flex-shrink: 0;
87
- text-align: center;
84
+ display: grid;
85
+ grid-template-columns: minmax(0, 1fr) auto;
86
+ align-items: center;
87
+ gap: 1rem;
88
+ min-height: 42px;
88
89
  }
89
- .indicator-bar span {
90
+ .header .brand { justify-self: start; width: 100%; font-size: 0.75rem; line-height: 1; }
91
+ .header .status { grid-column: 2; line-height: 1; }
92
+ .header span {
90
93
  font-size: 0.75rem;
91
94
  color: var(--text-secondary);
92
95
  }
93
- .indicator-bar .selected-text {
96
+ .header .selected-text {
94
97
  color: var(--accent);
95
98
  font-weight: 500;
96
99
  }
@@ -196,19 +199,15 @@
196
199
  </head>
197
200
  <body>
198
201
  <div class="header">
199
- <h1><a href="https://github.com/obra/superpowers" style="color: inherit; text-decoration: none;">Superpowers Brainstorming</a></h1>
200
- <div class="status">Connected</div>
202
+ <!-- BRANDING -->
203
+ <div class="status">Connecting…</div>
201
204
  </div>
202
205
 
203
206
  <div class="main">
204
- <div id="claude-content">
207
+ <div id="frame-content">
205
208
  <!-- CONTENT -->
206
209
  </div>
207
210
  </div>
208
211
 
209
- <div class="indicator-bar">
210
- <span id="indicator-text">Click an option above, then return to the terminal</span>
211
- </div>
212
-
213
212
  </body>
214
213
  </html>
@@ -1,26 +1,120 @@
1
1
  (function() {
2
- const WS_URL = 'ws://' + window.location.host;
2
+ const MIN_RECONNECT_MS = 500;
3
+ const MAX_RECONNECT_MS = 30000;
4
+ const TOMBSTONE_AFTER_MS = 15000; // show the "paused" overlay after this long disconnected
5
+
6
+ // Pure: next backoff delay (doubles, capped). Exported for unit tests.
7
+ function nextReconnectDelay(current, max) {
8
+ return Math.min(current * 2, max);
9
+ }
10
+ if (typeof module !== 'undefined' && module.exports) {
11
+ module.exports = { nextReconnectDelay, MIN_RECONNECT_MS, MAX_RECONNECT_MS, TOMBSTONE_AFTER_MS };
12
+ }
13
+
14
+ // Everything below is browser-only; bail out when loaded in Node (tests).
15
+ if (typeof window === 'undefined') return;
16
+
3
17
  let ws = null;
4
18
  let eventQueue = [];
19
+ let reconnectDelay = MIN_RECONNECT_MS;
20
+ let reconnectTimer = null;
21
+ let disconnectedSince = null;
22
+ let everConnected = false;
23
+ let tombstoneShown = false;
24
+
25
+ function sessionKey() {
26
+ try {
27
+ return window.sessionStorage && window.sessionStorage.getItem('brainstorm-session-key');
28
+ } catch (e) {}
29
+ return null;
30
+ }
31
+
32
+ function websocketUrl() {
33
+ const key = sessionKey();
34
+ return 'ws://' + window.location.host + (key ? '/?key=' + encodeURIComponent(key) : '');
35
+ }
36
+
37
+ function reloadAfterRecovery() {
38
+ const key = sessionKey();
39
+ if (key) {
40
+ window.location.replace('/?key=' + encodeURIComponent(key));
41
+ } else {
42
+ window.location.reload();
43
+ }
44
+ }
45
+
46
+ // Reflect connection state in the frame's status pill (absent on full-doc screens).
47
+ function setStatus(state) {
48
+ const el = document.querySelector('.status');
49
+ if (!el) return;
50
+ const map = {
51
+ connecting: ['Connecting…', 'var(--text-tertiary)'],
52
+ connected: ['Connected', 'var(--success)'],
53
+ reconnecting: ['Reconnecting…', 'var(--warning)'],
54
+ disconnected: ['Disconnected', 'var(--error)']
55
+ };
56
+ const [text, color] = map[state] || map.disconnected;
57
+ el.textContent = text;
58
+ el.style.setProperty('--status-color', color);
59
+ }
60
+
61
+ // Self-styled so it works on framed and full-document screens alike.
62
+ function showTombstone() {
63
+ if (tombstoneShown) return;
64
+ tombstoneShown = true;
65
+ const el = document.createElement('div');
66
+ el.id = 'bs-tombstone';
67
+ el.style.cssText = 'position:fixed;inset:0;z-index:99999;display:flex;' +
68
+ 'align-items:center;justify-content:center;padding:2rem;text-align:center;' +
69
+ 'background:rgba(20,20,22,0.92);color:#f5f5f7;font-family:system-ui,sans-serif';
70
+ el.innerHTML = '<div style="max-width:480px">' +
71
+ '<h2 style="margin:0 0 .5rem;font-weight:600">Companion paused</h2>' +
72
+ '<p style="margin:0;opacity:.85">This brainstorm companion has stopped. ' +
73
+ 'Ask your coding agent to bring it back — this page reconnects automatically.</p></div>';
74
+ if (document.body) document.body.appendChild(el);
75
+ }
5
76
 
6
77
  function connect() {
7
- ws = new WebSocket(WS_URL);
78
+ if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
79
+ setStatus(everConnected ? 'reconnecting' : 'connecting');
80
+ ws = new WebSocket(websocketUrl());
8
81
 
9
82
  ws.onopen = () => {
83
+ const recovered = tombstoneShown;
84
+ everConnected = true;
85
+ disconnectedSince = null;
86
+ reconnectDelay = MIN_RECONNECT_MS;
87
+ tombstoneShown = false;
88
+ setStatus('connected');
10
89
  eventQueue.forEach(e => ws.send(JSON.stringify(e)));
11
90
  eventQueue = [];
91
+ // Recovered from a tombstoned outage (e.g. the server restarted on the same
92
+ // port) — reload through the keyed bootstrap when possible so the cookie is
93
+ // refreshed before the visible URL returns to bare /.
94
+ if (recovered) reloadAfterRecovery();
12
95
  };
13
96
 
14
97
  ws.onmessage = (msg) => {
15
- const data = JSON.parse(msg.data);
16
- if (data.type === 'reload') {
17
- window.location.reload();
18
- }
98
+ let data;
99
+ try { data = JSON.parse(msg.data); } catch (e) { return; }
100
+ if (data.type === 'reload') window.location.reload();
19
101
  };
20
102
 
21
103
  ws.onclose = () => {
22
- setTimeout(connect, 1000);
104
+ ws = null;
105
+ if (disconnectedSince === null) disconnectedSince = Date.now();
106
+ if (Date.now() - disconnectedSince >= TOMBSTONE_AFTER_MS) {
107
+ setStatus('disconnected');
108
+ showTombstone();
109
+ } else {
110
+ setStatus('reconnecting');
111
+ }
112
+ reconnectTimer = setTimeout(connect, reconnectDelay);
113
+ reconnectDelay = nextReconnectDelay(reconnectDelay, MAX_RECONNECT_MS);
23
114
  };
115
+
116
+ // Let onclose own reconnection so we don't schedule it twice.
117
+ ws.onerror = () => { try { ws.close(); } catch (e) {} };
24
118
  }
25
119
 
26
120
  function sendEvent(event) {
@@ -44,21 +138,6 @@
44
138
  id: target.id || null
45
139
  });
46
140
 
47
- // Update indicator bar (defer so toggleSelect runs first)
48
- setTimeout(() => {
49
- const indicator = document.getElementById('indicator-text');
50
- if (!indicator) return;
51
- const container = target.closest('.options') || target.closest('.cards');
52
- const selected = container ? container.querySelectorAll('.selected') : [];
53
- if (selected.length === 0) {
54
- indicator.textContent = 'Click an option above, then return to the terminal';
55
- } else if (selected.length === 1) {
56
- const label = selected[0].querySelector('h3, .content h3, .card-body h3')?.textContent?.trim() || selected[0].dataset.choice;
57
- indicator.innerHTML = '<span class="selected-text">' + label + ' selected</span> — return to terminal to continue';
58
- } else {
59
- indicator.innerHTML = '<span class="selected-text">' + selected.length + ' selected</span> — return to terminal to continue';
60
- }
61
- }, 0);
62
141
  });
63
142
 
64
143
  // Frame UI: selection tracking