@adityaaria/spark 6.0.3

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 (91) hide show
  1. package/.claude-plugin/marketplace.json +20 -0
  2. package/.claude-plugin/plugin.json +20 -0
  3. package/.codex-plugin/plugin.json +48 -0
  4. package/.cursor-plugin/plugin.json +23 -0
  5. package/.kimi-plugin/plugin.json +38 -0
  6. package/.opencode/INSTALL.md +115 -0
  7. package/.opencode/plugins/spark.js +139 -0
  8. package/.pi/extensions/spark.ts +121 -0
  9. package/.version-bump.json +21 -0
  10. package/CLAUDE.md +115 -0
  11. package/CODE_OF_CONDUCT.md +128 -0
  12. package/GEMINI.md +2 -0
  13. package/LICENSE +21 -0
  14. package/README.md +282 -0
  15. package/RELEASE-NOTES.md +1299 -0
  16. package/assets/app-icon.png +0 -0
  17. package/assets/spark-small.svg +1 -0
  18. package/bin/spark.js +7 -0
  19. package/docs/README.kimi.md +94 -0
  20. package/docs/README.opencode.md +170 -0
  21. package/docs/porting-to-a-new-harness.md +830 -0
  22. package/gemini-extension.json +6 -0
  23. package/hooks/hooks-codex.json +16 -0
  24. package/hooks/hooks-cursor.json +10 -0
  25. package/hooks/hooks.json +16 -0
  26. package/hooks/run-hook.cmd +46 -0
  27. package/hooks/session-start +49 -0
  28. package/hooks/session-start-codex +26 -0
  29. package/package.json +52 -0
  30. package/skills/brainstorming/SKILL.md +159 -0
  31. package/skills/brainstorming/scripts/frame-template.html +213 -0
  32. package/skills/brainstorming/scripts/helper.js +167 -0
  33. package/skills/brainstorming/scripts/server.cjs +722 -0
  34. package/skills/brainstorming/scripts/start-server.sh +209 -0
  35. package/skills/brainstorming/scripts/stop-server.sh +120 -0
  36. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  37. package/skills/brainstorming/visual-companion.md +298 -0
  38. package/skills/dispatching-parallel-agents/SKILL.md +185 -0
  39. package/skills/executing-plans/SKILL.md +70 -0
  40. package/skills/finishing-a-development-branch/SKILL.md +241 -0
  41. package/skills/receiving-code-review/SKILL.md +213 -0
  42. package/skills/requesting-code-review/SKILL.md +103 -0
  43. package/skills/requesting-code-review/code-reviewer.md +172 -0
  44. package/skills/subagent-driven-development/SKILL.md +418 -0
  45. package/skills/subagent-driven-development/implementer-prompt.md +139 -0
  46. package/skills/subagent-driven-development/scripts/review-package +44 -0
  47. package/skills/subagent-driven-development/scripts/sdd-workspace +22 -0
  48. package/skills/subagent-driven-development/scripts/task-brief +40 -0
  49. package/skills/subagent-driven-development/task-reviewer-prompt.md +188 -0
  50. package/skills/systematic-debugging/CREATION-LOG.md +119 -0
  51. package/skills/systematic-debugging/SKILL.md +296 -0
  52. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  53. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  54. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  55. package/skills/systematic-debugging/find-polluter.sh +63 -0
  56. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  57. package/skills/systematic-debugging/test-academic.md +14 -0
  58. package/skills/systematic-debugging/test-pressure-1.md +58 -0
  59. package/skills/systematic-debugging/test-pressure-2.md +68 -0
  60. package/skills/systematic-debugging/test-pressure-3.md +69 -0
  61. package/skills/test-driven-development/SKILL.md +371 -0
  62. package/skills/test-driven-development/testing-anti-patterns.md +299 -0
  63. package/skills/using-git-worktrees/SKILL.md +202 -0
  64. package/skills/using-spark/SKILL.md +121 -0
  65. package/skills/using-spark/references/antigravity-tools.md +96 -0
  66. package/skills/using-spark/references/claude-code-tools.md +50 -0
  67. package/skills/using-spark/references/codex-tools.md +72 -0
  68. package/skills/using-spark/references/copilot-tools.md +49 -0
  69. package/skills/using-spark/references/gemini-tools.md +63 -0
  70. package/skills/using-spark/references/pi-tools.md +28 -0
  71. package/skills/verification-before-completion/SKILL.md +139 -0
  72. package/skills/writing-plans/SKILL.md +174 -0
  73. package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  74. package/skills/writing-skills/SKILL.md +689 -0
  75. package/skills/writing-skills/anthropic-best-practices.md +1150 -0
  76. package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  77. package/skills/writing-skills/graphviz-conventions.dot +172 -0
  78. package/skills/writing-skills/persuasion-principles.md +187 -0
  79. package/skills/writing-skills/render-graphs.js +168 -0
  80. package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
  81. package/src/cli/index.js +26 -0
  82. package/src/cli/install.js +47 -0
  83. package/src/cli/output.js +11 -0
  84. package/src/cli/parse-args.js +46 -0
  85. package/src/cli/prompt.js +10 -0
  86. package/src/installer/adapters/common.js +59 -0
  87. package/src/installer/adapters/extension-style.js +67 -0
  88. package/src/installer/adapters/shell-hook.js +57 -0
  89. package/src/installer/detect.js +168 -0
  90. package/src/installer/errors.js +7 -0
  91. package/src/installer/registry.js +35 -0
@@ -0,0 +1,167 @@
1
+ (function() {
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
+
17
+ let ws = null;
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
+ }
76
+
77
+ function connect() {
78
+ if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
79
+ setStatus(everConnected ? 'reconnecting' : 'connecting');
80
+ ws = new WebSocket(websocketUrl());
81
+
82
+ ws.onopen = () => {
83
+ const recovered = tombstoneShown;
84
+ everConnected = true;
85
+ disconnectedSince = null;
86
+ reconnectDelay = MIN_RECONNECT_MS;
87
+ tombstoneShown = false;
88
+ setStatus('connected');
89
+ eventQueue.forEach(e => ws.send(JSON.stringify(e)));
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();
95
+ };
96
+
97
+ ws.onmessage = (msg) => {
98
+ let data;
99
+ try { data = JSON.parse(msg.data); } catch (e) { return; }
100
+ if (data.type === 'reload') window.location.reload();
101
+ };
102
+
103
+ ws.onclose = () => {
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);
114
+ };
115
+
116
+ // Let onclose own reconnection so we don't schedule it twice.
117
+ ws.onerror = () => { try { ws.close(); } catch (e) {} };
118
+ }
119
+
120
+ function sendEvent(event) {
121
+ event.timestamp = Date.now();
122
+ if (ws && ws.readyState === WebSocket.OPEN) {
123
+ ws.send(JSON.stringify(event));
124
+ } else {
125
+ eventQueue.push(event);
126
+ }
127
+ }
128
+
129
+ // Capture clicks on choice elements
130
+ document.addEventListener('click', (e) => {
131
+ const target = e.target.closest('[data-choice]');
132
+ if (!target) return;
133
+
134
+ sendEvent({
135
+ type: 'click',
136
+ text: target.textContent.trim(),
137
+ choice: target.dataset.choice,
138
+ id: target.id || null
139
+ });
140
+
141
+ });
142
+
143
+ // Frame UI: selection tracking
144
+ window.selectedChoice = null;
145
+
146
+ window.toggleSelect = function(el) {
147
+ const container = el.closest('.options') || el.closest('.cards');
148
+ const multi = container && container.dataset.multiselect !== undefined;
149
+ if (container && !multi) {
150
+ container.querySelectorAll('.option, .card').forEach(o => o.classList.remove('selected'));
151
+ }
152
+ if (multi) {
153
+ el.classList.toggle('selected');
154
+ } else {
155
+ el.classList.add('selected');
156
+ }
157
+ window.selectedChoice = el.dataset.choice;
158
+ };
159
+
160
+ // Expose API for explicit use
161
+ window.brainstorm = {
162
+ send: sendEvent,
163
+ choice: (value, metadata = {}) => sendEvent({ type: 'choice', value, ...metadata })
164
+ };
165
+
166
+ connect();
167
+ })();