claude-code-kanban 7.32.0 → 7.34.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.
- package/cli.js +12 -2
- package/hub-app.json +8 -1
- package/lib/parsers.js +0 -43
- package/lib/program-status.js +194 -0
- package/lib/reveal.js +30 -0
- package/lib/terminal-client.js +13 -1
- package/lib/terminal-host.js +3 -0
- package/lib/terminal.js +82 -11
- package/package.json +1 -1
- package/plugin/plugins/claude-code-kanban/.claude-plugin/plugin.json +1 -1
- package/plugin/plugins/claude-code-kanban/skills/kanban/SKILL.md +4 -0
- package/public/app.js +394 -172
- package/public/index.html +4 -2
- package/public/style.css +107 -11
- package/public/terminal-frame.js +55 -5
- package/server.js +75 -126
- package/lib/scratch-servers.js +0 -119
package/lib/scratch-servers.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// One `scratch ui --json` browser viewer per pad, for scratchpad panes. Each child holds a pipe on
|
|
2
|
-
// its stdin that cck never writes to: when cck exits, the pipe closes and the viewer exits with it.
|
|
3
|
-
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
const { canonicalPath } = require('./linked-docs');
|
|
6
|
-
|
|
7
|
-
const READY_TIMEOUT_MS = 15000;
|
|
8
|
-
const HEALTH_TIMEOUT_MS = 1500;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @param {object} o
|
|
12
|
-
* @param {() => string|null} o.resolveBin the `scratch` executable, or null when it cannot be launched
|
|
13
|
-
* @param {(file: string, args: string[], opts: object) => import('node:child_process').ChildProcess} o.spawn
|
|
14
|
-
* @param {(pad: string) => void} [o.onExit] the canonical pad dir of a viewer that exited
|
|
15
|
-
*/
|
|
16
|
-
function createScratchServers({ resolveBin, spawn, fetch = globalThis.fetch, onExit = () => {}, max = 4, readyTimeoutMs = READY_TIMEOUT_MS }) {
|
|
17
|
-
// Map order is recency: the first entry is the one stopped when a new pad needs room.
|
|
18
|
-
const live = new Map();
|
|
19
|
-
const starting = new Map();
|
|
20
|
-
|
|
21
|
-
function stop(key) {
|
|
22
|
-
const entry = live.get(key);
|
|
23
|
-
if (!entry) return;
|
|
24
|
-
live.delete(key);
|
|
25
|
-
entry.child.kill();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function healthy(entry, key) {
|
|
29
|
-
try {
|
|
30
|
-
const res = await fetch(new URL(`/__scratch/health${new URL(entry.url).search}`, entry.url), {
|
|
31
|
-
signal: AbortSignal.timeout(HEALTH_TIMEOUT_MS),
|
|
32
|
-
});
|
|
33
|
-
if (!res.ok) return false;
|
|
34
|
-
const { pid, pads } = await res.json();
|
|
35
|
-
return pid === entry.pid && Array.isArray(pads) && pads.some((p) => canonicalPath(p) === key);
|
|
36
|
-
} catch {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function start(dir, key) {
|
|
42
|
-
const file = resolveBin();
|
|
43
|
-
if (!file) {
|
|
44
|
-
const err = new Error('scratch CLI not found on PATH');
|
|
45
|
-
err.status = 501;
|
|
46
|
-
throw err;
|
|
47
|
-
}
|
|
48
|
-
// No `detached`: on Windows it overrides `windowsHide` and the bun shim opens a console window.
|
|
49
|
-
const child = spawn(file, ['ui', path.basename(dir), '--dir', path.dirname(dir), '--json'], {
|
|
50
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
51
|
-
windowsHide: true,
|
|
52
|
-
});
|
|
53
|
-
child.stdin.on('error', () => {});
|
|
54
|
-
let stderr = '';
|
|
55
|
-
child.stderr.on('data', (b) => {
|
|
56
|
-
stderr = (stderr + b).slice(-2000);
|
|
57
|
-
});
|
|
58
|
-
return new Promise((resolve, reject) => {
|
|
59
|
-
let buf = '';
|
|
60
|
-
let entry = null;
|
|
61
|
-
const fail = (msg) => {
|
|
62
|
-
clearTimeout(timer);
|
|
63
|
-
child.kill();
|
|
64
|
-
reject(new Error(`${msg}${stderr.trim() ? `: ${stderr.trim().split('\n').pop()}` : ''}`));
|
|
65
|
-
};
|
|
66
|
-
const timer = setTimeout(() => fail('scratch viewer did not start'), readyTimeoutMs);
|
|
67
|
-
// Read stdout to the end, so a chatty viewer never fills the pipe and blocks.
|
|
68
|
-
child.stdout.on('data', (b) => {
|
|
69
|
-
if (entry) return;
|
|
70
|
-
buf += b;
|
|
71
|
-
const nl = buf.indexOf('\n');
|
|
72
|
-
if (nl < 0) return;
|
|
73
|
-
clearTimeout(timer);
|
|
74
|
-
try {
|
|
75
|
-
const ready = JSON.parse(buf.slice(0, nl));
|
|
76
|
-
entry = { child, url: ready.url, pid: ready.pid };
|
|
77
|
-
} catch {
|
|
78
|
-
fail('scratch viewer printed no ready line (needs scratch with `ui --json`)');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
buf = '';
|
|
82
|
-
while (live.size >= max) stop(live.keys().next().value);
|
|
83
|
-
live.set(key, entry);
|
|
84
|
-
resolve(entry);
|
|
85
|
-
});
|
|
86
|
-
child.on('error', (e) => fail(`scratch viewer failed to start (${e.message})`));
|
|
87
|
-
child.on('exit', (code) => {
|
|
88
|
-
if (!entry) {
|
|
89
|
-
fail(`scratch viewer exited (${code})`);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (live.get(key) === entry) live.delete(key);
|
|
93
|
-
onExit(key);
|
|
94
|
-
});
|
|
95
|
-
child.unref();
|
|
96
|
-
child.stdin.unref?.();
|
|
97
|
-
child.stdout.unref?.();
|
|
98
|
-
child.stderr.unref?.();
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** The viewer URL for the pad at `dir`, started when no live one answers for it. */
|
|
103
|
-
async function serve(dir) {
|
|
104
|
-
const key = canonicalPath(dir);
|
|
105
|
-
const entry = live.get(key);
|
|
106
|
-
if (entry && (await healthy(entry, key))) {
|
|
107
|
-
live.delete(key);
|
|
108
|
-
live.set(key, entry);
|
|
109
|
-
return entry.url;
|
|
110
|
-
}
|
|
111
|
-
if (entry) stop(key);
|
|
112
|
-
if (!starting.has(key)) starting.set(key, start(dir, key).finally(() => starting.delete(key)));
|
|
113
|
-
return (await starting.get(key)).url;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return { serve, size: () => live.size };
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
module.exports = { createScratchServers };
|