claude-code-kanban 7.30.0 → 7.32.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/hub-app.json +11 -0
- package/lib/terminal-client.js +7 -1
- package/lib/terminal-host.js +4 -1
- package/lib/terminal.js +15 -7
- package/package.json +1 -1
- package/plugin/plugins/claude-code-kanban/.claude-plugin/plugin.json +1 -1
- package/plugin/plugins/claude-code-kanban/skills/addon/references/build.md +15 -3
- package/plugin/plugins/claude-code-kanban/skills/addon/scripts/theme-check.mjs +94 -0
- package/public/app.js +296 -89
- package/public/index.html +18 -3
- package/public/style.css +92 -18
- package/public/vendor/claude-hub-sdk.js +54 -10
- package/server.js +8 -0
package/hub-app.json
CHANGED
|
@@ -53,6 +53,17 @@
|
|
|
53
53
|
{ "value": "grid", "label": "Grid" }
|
|
54
54
|
],
|
|
55
55
|
"default": "dots"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"key": "terminalHost",
|
|
59
|
+
"type": "choice",
|
|
60
|
+
"label": "Terminal host (Windows)",
|
|
61
|
+
"help": "Bundled passes color queries through, so apps such as hunk and vim follow the board's theme. Applies to terminals started after the change.",
|
|
62
|
+
"options": [
|
|
63
|
+
{ "value": "system", "label": "System" },
|
|
64
|
+
{ "value": "bundled", "label": "Bundled" }
|
|
65
|
+
],
|
|
66
|
+
"default": "system"
|
|
56
67
|
}
|
|
57
68
|
],
|
|
58
69
|
"keys": { "keeps": ["ctrl+alt+1", "ctrl+alt+2", "ctrl+alt+3", "ctrl+alt+4", "ctrl+alt+5", "ctrl+alt+6", "ctrl+alt+7", "ctrl+alt+8", "ctrl+alt+9", "ctrl+alt+n", "ctrl+alt+r", "ctrl+alt+s", "ctrl+alt+shift+s","ctrl+shift+d", "ctrl+shift+k", "ctrl+shift+l", "ctrl+shift+m", "ctrl+shift+p", "ctrl+shift+z"] },
|
package/lib/terminal-client.js
CHANGED
|
@@ -215,6 +215,12 @@ function createTerminalClient(o) {
|
|
|
215
215
|
if (child?.connected) child.send({ t: 'port', url });
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
// Terminals started after the change use it; a restarted host gets it with its config.
|
|
219
|
+
function setConptyDll(on) {
|
|
220
|
+
config.conptyDll = !!on;
|
|
221
|
+
if (child?.connected) child.send({ t: 'conptyDll', on: config.conptyDll });
|
|
222
|
+
}
|
|
223
|
+
|
|
218
224
|
// With no host there are no terminals, which the hub's eviction check must still read.
|
|
219
225
|
async function sessions() {
|
|
220
226
|
return child?.connected ? call('sessions') : [];
|
|
@@ -240,7 +246,7 @@ function createTerminalClient(o) {
|
|
|
240
246
|
|
|
241
247
|
return {
|
|
242
248
|
token, handleUpgrade, clientConfig, unavailableReason, authorized, isRunning, hasTerminal, sessionOfTerminal, startNew, end, paste, type, restore,
|
|
243
|
-
setServerUrl, sessions, stats, shutdown, started,
|
|
249
|
+
setServerUrl, setConptyDll, sessions, stats, shutdown, started,
|
|
244
250
|
ids: () => [...ids],
|
|
245
251
|
awaitingTrust: () => [...awaitingTrust],
|
|
246
252
|
};
|
package/lib/terminal-host.js
CHANGED
|
@@ -9,6 +9,7 @@ const { whichSync } = require('./open-editor');
|
|
|
9
9
|
|
|
10
10
|
let service = null;
|
|
11
11
|
let serverUrl = null;
|
|
12
|
+
let config = null;
|
|
12
13
|
let lastState = null;
|
|
13
14
|
let nextAsk = 0;
|
|
14
15
|
const asks = new Map();
|
|
@@ -43,9 +44,10 @@ function pushState() {
|
|
|
43
44
|
|
|
44
45
|
function init(msg) {
|
|
45
46
|
serverUrl = msg.serverUrl;
|
|
47
|
+
config = msg.config;
|
|
46
48
|
const liveSessions = () => readLiveSessions(msg.sessionsDir);
|
|
47
49
|
service = createTerminalService({
|
|
48
|
-
config
|
|
50
|
+
config,
|
|
49
51
|
// cck checked Host, Origin and exposure before it handed the socket over.
|
|
50
52
|
net: { EXPOSED: false, upgradeVerdict: () => null },
|
|
51
53
|
claudeDir: msg.claudeDir,
|
|
@@ -89,6 +91,7 @@ async function call(msg) {
|
|
|
89
91
|
process.on('message', (msg, socket) => {
|
|
90
92
|
if (msg.t === 'init') init(msg);
|
|
91
93
|
else if (msg.t === 'port') serverUrl = msg.url;
|
|
94
|
+
else if (msg.t === 'conptyDll' && config) config.conptyDll = msg.on;
|
|
92
95
|
else if (msg.t === 'upgrade') {
|
|
93
96
|
if (!socket) return;
|
|
94
97
|
service.handleUpgrade({ method: msg.method, url: msg.url, headers: msg.headers }, socket, Buffer.from(msg.head, 'base64'));
|
package/lib/terminal.js
CHANGED
|
@@ -114,6 +114,7 @@ function readTerminalConfig({ argv = process.argv, env = process.env, getArgValu
|
|
|
114
114
|
scrollback: posInt(cfg.scrollback, 5000),
|
|
115
115
|
noFlicker: cfg.noFlicker !== false,
|
|
116
116
|
restore: cfg.restore !== false,
|
|
117
|
+
conptyDll: cfg.conptyDll === true,
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
|
|
@@ -652,6 +653,19 @@ function createTerminalService(o) {
|
|
|
652
653
|
}
|
|
653
654
|
}
|
|
654
655
|
|
|
656
|
+
// Windows' own ConPTY swallows OSC 10/11 color queries and drops OSC replies on input, so apps such as
|
|
657
|
+
// hunk cannot read the theme. The ConPTY that node-pty ships passes both; a spawn it fails falls back.
|
|
658
|
+
function spawnPty(args, opts) {
|
|
659
|
+
if (process.platform === 'win32' && config.conptyDll) {
|
|
660
|
+
try {
|
|
661
|
+
return pty.spawn(shell, args, { ...opts, useConptyDll: true });
|
|
662
|
+
} catch (e) {
|
|
663
|
+
console.log(`Bundled ConPTY failed, using the system one: ${e.message}`);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return pty.spawn(shell, args, opts);
|
|
667
|
+
}
|
|
668
|
+
|
|
655
669
|
function spawnSession(id, mode, cwdCandidate, cols, rows, spec, extraEnv) {
|
|
656
670
|
const cwd = cwdCandidate && fs.existsSync(cwdCandidate) ? cwdCandidate : os.homedir();
|
|
657
671
|
const terminalId = savedTerminalIds[id] || crypto.randomUUID();
|
|
@@ -661,13 +675,7 @@ function createTerminalService(o) {
|
|
|
661
675
|
// Git Bash's login profile cds to $HOME unless this is set.
|
|
662
676
|
if (shellFamily(shell) === 'gitbash') env.CHERE_INVOKING = '1';
|
|
663
677
|
const claudeArgs = claudeArgsFor(mode, id, spec);
|
|
664
|
-
const proc =
|
|
665
|
-
name: 'xterm-256color',
|
|
666
|
-
cols,
|
|
667
|
-
rows,
|
|
668
|
-
cwd,
|
|
669
|
-
env,
|
|
670
|
-
});
|
|
678
|
+
const proc = spawnPty(shellArgs(shell, spec?.edit ? null : claudeArgs), { name: 'xterm-256color', cols, rows, cwd, env });
|
|
671
679
|
const term = new Headless({ cols, rows, scrollback: config.scrollback, allowProposedApi: true });
|
|
672
680
|
const serializer = new Serialize();
|
|
673
681
|
term.loadAddon(serializer);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-kanban",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "claude-code-kanban dashboard integration: agent activity tracking, context and cost tracking, board moves and reviews delivered to the session, and skills to drive the board from a session"
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Build an add-on
|
|
2
2
|
|
|
3
|
-
An add-on is one HTML page and a small server that serves it. The board frames the page by its URL, so any stack works; this guide uses Node with no dependencies. The build is done when the server answers 200 and `addon add` printed an id.
|
|
3
|
+
An add-on is one HTML page and a small server that serves it. The board frames the page by its URL, so any stack works; this guide uses Node with no dependencies. The build is done when the theme check passes, the server answers 200 and `addon add` printed an id.
|
|
4
4
|
|
|
5
5
|
## 1. Write the server and the page
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ The URL is the page's only input from the board. The page reads the values the b
|
|
|
28
28
|
|
|
29
29
|
## 3. Take the board's theme
|
|
30
30
|
|
|
31
|
-
Style the page with the variables of the HTML contract in [the show skill](../../show/SKILL.md#html-contract), in its flat style. Set fallback values for them in `:where(:root)`, and
|
|
31
|
+
Style the page with the variables of the HTML contract in [the show skill](../../show/SKILL.md#html-contract), in its flat style. Set fallback values for them in `:where(:root)`, and set `:root { color-scheme: var(--color-scheme, light dark); }` so scrollbars and form controls follow the board, not the OS. Apply the board's values from its message, which it sends on each load and each theme change:
|
|
32
32
|
|
|
33
33
|
```js
|
|
34
34
|
addEventListener('message', (e) => {
|
|
@@ -69,7 +69,19 @@ When the content follows files, the server watches them (`fs.watch`) and pushes
|
|
|
69
69
|
|
|
70
70
|
The dock is 360 to 900 px wide and the full height of the terminal. Lay the page out in normal flow that wraps at 360 px, and let the body scroll.
|
|
71
71
|
|
|
72
|
-
## 7.
|
|
72
|
+
## 7. Verify the theme
|
|
73
|
+
|
|
74
|
+
Run the static check, `scripts/theme-check.mjs` in this skill's base directory, on the page, and fix every error before you register it:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
node <skill base dir>/scripts/theme-check.mjs <folder>/index.html
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
It fails on a literal color (hex, `rgb()`, `hsl()`, `oklch()`, a named color) in CSS, a `style` attribute, an SVG `fill` or `stroke`, or a JS string, and on a page with no `cck-show:tokens` listener. It warns on a variable that is not a board token, a token with no fallback, a literal font, and a missing `color-scheme`. A literal color is allowed only as a token's fallback in `:where(:root)`. For a shade, mix a token: `color-mix(in srgb, var(--color-accent) 14%, transparent)`.
|
|
81
|
+
|
|
82
|
+
A pass does not prove the page follows the theme. The check reads one file, so it does not see colors built at runtime (`'#' + hex`, colors from the server), linked stylesheets, library CSS, canvas or images. Keep those on tokens too, and when the page has any of them, open it on the rail and switch the board between light and dark.
|
|
83
|
+
|
|
84
|
+
## 8. Run and register
|
|
73
85
|
|
|
74
86
|
1. Start the server where the user can see and stop it, such as a tmux window, or ask the user to start it.
|
|
75
87
|
2. Check that it answers 200: `curl -s -o /dev/null -w '%{http_code}' http://localhost:4100/`.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Static theme check for an add-on page: node theme-check.mjs <page.html>. Exits 1 on an error.
|
|
2
|
+
// The token list mirrors the HTML contract in skills/show/SKILL.md.
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const CONTRACT = new Set([
|
|
6
|
+
'--color-bg', '--color-bg-subtle', '--color-text', '--color-text-muted', '--color-border', '--color-accent',
|
|
7
|
+
'--color-info', '--color-success', '--color-warning', '--color-danger', '--font-sans', '--font-mono', '--color-scheme',
|
|
8
|
+
...Array.from({ length: 8 }, (_, i) => `--color-series-${i + 1}`),
|
|
9
|
+
...Array.from({ length: 5 }, (_, i) => `--color-ramp-${i + 1}`),
|
|
10
|
+
]);
|
|
11
|
+
const NAMED = 'white|black|red|green|blue|gray|grey|silver|orange|yellow|purple|pink|navy|teal|maroon|olive|lime|aqua|fuchsia|gold|crimson|tomato|coral|salmon|indigo|violet|brown|beige|ivory|khaki|lavender|tan|cyan|magenta|whitesmoke|gainsboro|lightgray|lightgrey|darkgray|darkgrey|dimgray|dimgrey';
|
|
12
|
+
const RAW_FN = '#[0-9a-f]{3,8}\\b|\\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\\(';
|
|
13
|
+
const RAW = new RegExp(`${RAW_FN}|\\b(?:${NAMED})\\b`, 'i');
|
|
14
|
+
// In JS a named color is too likely an ordinary word, so only hex and color functions count.
|
|
15
|
+
const RAW_JS = new RegExp(RAW_FN, 'i');
|
|
16
|
+
const COLOR_PROPS = /^(?:color|background(?:-color|-image)?|border(?:-[a-z]+)*|outline(?:-color)?|fill|stroke|box-shadow|text-shadow|caret-color|accent-color|text-decoration(?:-color)?|column-rule(?:-color)?|stop-color|flood-color|lighting-color|--[\w-]+)$/i;
|
|
17
|
+
|
|
18
|
+
const file = process.argv[2];
|
|
19
|
+
const src = readFileSync(file, 'utf8');
|
|
20
|
+
const lineOf = (i) => src.slice(0, i).split('\n').length;
|
|
21
|
+
const findings = [];
|
|
22
|
+
const report = (level, i, rule, text) =>
|
|
23
|
+
findings.push({ level, line: i == null ? 0 : lineOf(i), rule, text: text.trim().slice(0, 110) });
|
|
24
|
+
|
|
25
|
+
const usedVars = new Set();
|
|
26
|
+
const definedVars = new Set();
|
|
27
|
+
const fallbackVars = new Set();
|
|
28
|
+
const collectVars = (s) => {
|
|
29
|
+
for (const v of s.matchAll(/var\(\s*(--[\w-]+)/g)) usedVars.add(v[1]);
|
|
30
|
+
};
|
|
31
|
+
const stripVars = (s) => s.replace(/var\([^)]*\)/g, '');
|
|
32
|
+
|
|
33
|
+
// CSS: every declaration inside <style> blocks and style="" attributes.
|
|
34
|
+
function checkCss(css, base, inline) {
|
|
35
|
+
const bodies = inline
|
|
36
|
+
? [{ sel: '[style]', body: css, at: 0 }]
|
|
37
|
+
: [...css.matchAll(/([^{}]*)\{([^{}]*)\}/g)].map((m) => ({ sel: m[1].trim(), body: m[2], at: m.index + m[1].length + 1 }));
|
|
38
|
+
for (const { sel, body, at } of bodies) {
|
|
39
|
+
const isRoot = /(^|,)\s*(:where\(\s*:root\s*\)|:root|html)\s*$/.test(sel);
|
|
40
|
+
for (const d of body.matchAll(/([-\w]+)\s*:\s*([^;]+)/g)) {
|
|
41
|
+
const [, prop, value] = d;
|
|
42
|
+
const i = base + at + d.index;
|
|
43
|
+
collectVars(value);
|
|
44
|
+
if (prop.startsWith('--')) {
|
|
45
|
+
definedVars.add(prop);
|
|
46
|
+
if (isRoot && CONTRACT.has(prop)) fallbackVars.add(prop);
|
|
47
|
+
}
|
|
48
|
+
if (/^font(-family)?$/.test(prop) && !/var\(--font-/.test(value) && !/^(inherit|initial|unset)$/.test(value.trim()))
|
|
49
|
+
report('warn', i, 'font-literal', `${prop}: ${value}`);
|
|
50
|
+
if (!COLOR_PROPS.test(prop) || !RAW.test(stripVars(value))) continue;
|
|
51
|
+
if (isRoot && CONTRACT.has(prop)) continue; // fallback value for a board token
|
|
52
|
+
if (/^(?:transparent|currentcolor|inherit|none)$/i.test(value.trim())) continue;
|
|
53
|
+
report('error', i, prop.startsWith('--') ? 'raw-color-in-custom-prop' : 'raw-color', `${sel ? `${sel.split('\n').pop().trim()} { ` : ''}${prop}: ${value}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const m of src.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/gi)) checkCss(m[1], m.index + m[0].indexOf(m[1]), false);
|
|
59
|
+
for (const m of src.matchAll(/\sstyle\s*=\s*"([^"]*)"/gi)) checkCss(m[1], m.index, true);
|
|
60
|
+
for (const m of src.matchAll(/\s(fill|stroke|color|bgcolor|stop-color)\s*=\s*"([^"]*)"/gi)) {
|
|
61
|
+
collectVars(m[2]);
|
|
62
|
+
if (RAW.test(stripVars(m[2]))) report('error', m.index, 'raw-color-attr', `${m[1]}="${m[2]}"`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// JS: string literals and template parts that carry a color.
|
|
66
|
+
let hasListener = false;
|
|
67
|
+
for (const m of src.matchAll(/<script[^>]*>([\s\S]*?)<\/script>/gi)) {
|
|
68
|
+
const js = m[1];
|
|
69
|
+
const base = m.index + m[0].indexOf(js);
|
|
70
|
+
if (/cck-show:tokens/.test(js)) hasListener = true;
|
|
71
|
+
for (const s of js.matchAll(/(['"`])((?:\\.|(?!\1)[^\\])*)\1/g)) {
|
|
72
|
+
const str = s[2];
|
|
73
|
+
collectVars(str);
|
|
74
|
+
const selectorArg = /(?:querySelector(?:All)?|closest|matches|getElementById)\(\s*$/.test(js.slice(Math.max(0, s.index - 30), s.index));
|
|
75
|
+
if (!selectorArg && RAW_JS.test(stripVars(str)))
|
|
76
|
+
report('error', base + s.index, 'raw-color-js', s[0]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!/color-scheme\s*:\s*var\(\s*--color-scheme/.test(src))
|
|
81
|
+
report('warn', null, 'no-color-scheme', 'color-scheme does not follow var(--color-scheme): scrollbars and native controls follow the OS');
|
|
82
|
+
if (!hasListener) report('error', null, 'no-token-listener', "no 'cck-show:tokens' message listener");
|
|
83
|
+
for (const v of usedVars) {
|
|
84
|
+
if (!CONTRACT.has(v) && !definedVars.has(v)) report('warn', null, 'unknown-var', `${v} is not a board token and is not defined`);
|
|
85
|
+
if (CONTRACT.has(v) && v !== '--color-scheme' && !fallbackVars.has(v)) report('warn', null, 'no-fallback', `${v} has no fallback in :where(:root)`);
|
|
86
|
+
}
|
|
87
|
+
const unused = [...CONTRACT].filter((t) => !usedVars.has(t) && !t.startsWith('--color-series') && !t.startsWith('--color-ramp') && t !== '--color-scheme');
|
|
88
|
+
if (unused.length) report('info', null, 'unused-tokens', unused.join(', '));
|
|
89
|
+
|
|
90
|
+
findings.sort((a, b) => a.line - b.line);
|
|
91
|
+
for (const f of findings) console.log(`${f.level.padEnd(5)} ${String(f.line || '-').padStart(4)} ${f.rule.padEnd(24)} ${f.text}`);
|
|
92
|
+
const errors = findings.filter((f) => f.level === 'error').length;
|
|
93
|
+
console.log(`\n${errors} error(s), ${findings.filter((f) => f.level === 'warn').length} warning(s)`);
|
|
94
|
+
process.exit(errors ? 1 : 0);
|