input-kanban 0.0.4 → 0.0.6
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/ENVIRONMENT.md +1 -1
- package/PROJECT_GUIDE.md +1 -1
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/public/assets/input-kanban-apple-touch-icon.png +0 -0
- package/public/assets/input-kanban-favicon-32.png +0 -0
- package/public/assets/input-kanban-icon.png +0 -0
- package/public/index.html +37 -8
- package/src/orchestrator.js +24 -1
- package/src/server.js +2 -2
package/ENVIRONMENT.md
CHANGED
|
@@ -8,7 +8,7 @@ CLI options take precedence over environment variables. Environment variables ta
|
|
|
8
8
|
|
|
9
9
|
- `PORT`: HTTP server port. Default: `8787`. CLI option: `--port`.
|
|
10
10
|
- `HOST`: HTTP bind host. Default: `127.0.0.1`. CLI option: `--host`.
|
|
11
|
-
- `KANBAN_DEFAULT_REPO`: Default target repository path for new runs. Default: the current working directory when `input-kanban` is launched. CLI option: `--repo`.
|
|
11
|
+
- `KANBAN_DEFAULT_REPO`: Default target repository path for new runs. Default: the current working directory when `input-kanban` is launched. CLI option: `--repo`. Creating a run validates that this path is inside a Git work tree.
|
|
12
12
|
- `KANBAN_RUNS_DIR`: Directory for run state, logs, and artifacts. Default: `.input-kanban/runs` under the user's home directory. CLI option: `--runs-dir`.
|
|
13
13
|
- `KANBAN_CODEX_BIN`: Codex CLI executable name or path. Default: `codex`. CLI option: `--codex-bin`.
|
|
14
14
|
- `KANBAN_RUNNER`: Runner mode. Supported values: `headless`, `tmux`. Default: `headless`. CLI option: `--runner`.
|
package/PROJECT_GUIDE.md
CHANGED
|
@@ -67,7 +67,7 @@ Supported options:
|
|
|
67
67
|
|
|
68
68
|
Default behavior:
|
|
69
69
|
|
|
70
|
-
- default repo: current working directory when `input-kanban` is launched;
|
|
70
|
+
- default repo: current working directory when `input-kanban` is launched; run creation validates that the selected repo is inside a Git work tree;
|
|
71
71
|
- default host: `127.0.0.1`;
|
|
72
72
|
- default port: `8787`;
|
|
73
73
|
- default runs directory: `~/.input-kanban/runs`;
|
package/README.en.md
CHANGED
|
@@ -56,7 +56,7 @@ input-kanban --open
|
|
|
56
56
|
|
|
57
57
|
Defaults:
|
|
58
58
|
|
|
59
|
-
- target repository: the current directory where `input-kanban` is launched
|
|
59
|
+
- target repository: the current directory where `input-kanban` is launched; creating a run validates that it is inside a Git work tree
|
|
60
60
|
- host: `127.0.0.1`
|
|
61
61
|
- port: `8787`
|
|
62
62
|
- runs directory: `~/.input-kanban/runs`
|
package/README.md
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/public/index.html
CHANGED
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Input 看板</title>
|
|
7
|
+
<link rel="icon" type="image/png" sizes="32x32" href="/assets/input-kanban-favicon-32.png" />
|
|
8
|
+
<link rel="apple-touch-icon" sizes="180x180" href="/assets/input-kanban-apple-touch-icon.png" />
|
|
7
9
|
<style>
|
|
8
10
|
:root { --bg:#0b1220; --panel:#111827; --panel-2:#0f172a; --line:#334155; --line-strong:#64748b; --text:#e2e8f0; --muted:#94a3b8; --blue:#2563eb; --green:#166534; --red:#991b1b; --gray:#475569; --orange:#b45309; }
|
|
9
11
|
body { font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin: 0; background: var(--bg); color: var(--text); }
|
|
10
12
|
header { padding: 18px 24px; background: #0a1020; border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(255,255,255,.03); }
|
|
11
13
|
h1 { margin: 0; font-size: 22px; letter-spacing: .2px; }
|
|
14
|
+
.brand { display: inline-flex; align-items: center; gap: 10px; }
|
|
15
|
+
.brand-icon { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; border: 1px solid rgba(148,163,184,.35); box-shadow: 0 1px 0 rgba(255,255,255,.08); }
|
|
12
16
|
h2 { margin: 0 0 12px; font-size: 24px; }
|
|
13
17
|
h3 { margin: 18px 0 8px; font-size: 15px; color: #cbd5e1; }
|
|
14
18
|
main { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; padding: 18px; align-items: start; min-height: calc(100vh - 59px); }
|
|
@@ -43,6 +47,10 @@
|
|
|
43
47
|
.plan_empty { background: var(--orange); }
|
|
44
48
|
.pending, .created { background: var(--gray); }
|
|
45
49
|
.batch-row td { border-top: 3px solid var(--line-strong); background: #101827; font-weight: 800; font-size: 14px; padding-top: 13px; }
|
|
50
|
+
.batch-row-content { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
51
|
+
.batch-row-title { font-size: 15px; }
|
|
52
|
+
.batch-row-meta { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
|
|
53
|
+
.batch-row-meta .meta-chip { padding: 4px 7px; font-size: 11px; }
|
|
46
54
|
.job-row.selected { background: rgba(37,99,235,.16); box-shadow: inset 3px 0 0 #60a5fa; }
|
|
47
55
|
.task-name { min-width: 0; overflow: hidden; overflow-wrap: anywhere; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
|
48
56
|
.task-role { display: block; margin-top: 2px; }
|
|
@@ -61,8 +69,9 @@
|
|
|
61
69
|
.run-card-name { min-width: 0; overflow: hidden; overflow-wrap: anywhere; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
|
62
70
|
.run-card-title .pill { flex: 0 0 auto; }
|
|
63
71
|
.run-card-id { margin-top: 5px; word-break: break-all; }
|
|
64
|
-
.run-card-
|
|
65
|
-
.run-card-
|
|
72
|
+
.run-card-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
|
|
73
|
+
.run-card-meta .meta-chip { padding: 4px 7px; font-size: 11px; }
|
|
74
|
+
.run-card-meta .meta-chip.long .meta-value { max-width: 248px; }
|
|
66
75
|
.build-header { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel-2); margin-bottom: 14px; }
|
|
67
76
|
.build-title { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 900; }
|
|
68
77
|
.build-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
|
|
@@ -91,7 +100,7 @@
|
|
|
91
100
|
</style>
|
|
92
101
|
</head>
|
|
93
102
|
<body>
|
|
94
|
-
<header><h1
|
|
103
|
+
<header><h1 class="brand"><img class="brand-icon" src="/assets/input-kanban-icon.png" alt="" aria-hidden="true" />Input 看板</h1></header>
|
|
95
104
|
<main>
|
|
96
105
|
<div class="sidebar">
|
|
97
106
|
<section>
|
|
@@ -284,9 +293,13 @@ function renderRunList() {
|
|
|
284
293
|
const cards = visibleRuns.map(r => `
|
|
285
294
|
<div class="run-card ${selectedRun === r.runId ? 'active' : ''}" onclick="selectRun('${r.runId}')">
|
|
286
295
|
<div class="run-card-title"><span class="run-card-name" title="${esc(r.label)}">${esc(r.label)}</span><span>${pill(r.status)}</span></div>
|
|
287
|
-
<div class="run-card-
|
|
288
|
-
|
|
289
|
-
|
|
296
|
+
<div class="run-card-meta">
|
|
297
|
+
${metaChip('Run ID', r.runId, { long: true })}
|
|
298
|
+
${metaChip('创建', formatDateTime(r.createdAt))}
|
|
299
|
+
${metaChip('进度', `${r.completed}/${r.total}`)}
|
|
300
|
+
${metaChip('执行中', r.running)}
|
|
301
|
+
${metaChip('失败', r.failed, { danger: Number(r.failed) > 0 })}
|
|
302
|
+
</div>
|
|
290
303
|
</div>`);
|
|
291
304
|
if (latestRuns.length > runListVisibleCount) {
|
|
292
305
|
cards.push(`<button class="secondary run-list-more" onclick="showMoreRuns()">查看更多(${runListVisibleCount}/${latestRuns.length})</button>`);
|
|
@@ -315,7 +328,11 @@ function renderSelectedHeader() {
|
|
|
315
328
|
const sandbox = currentState.workerSandbox || 'workspace-write';
|
|
316
329
|
const chips = [
|
|
317
330
|
metaChip('Run ID', currentState.runId, { long: true }),
|
|
318
|
-
metaChip('仓库', basenamePath(currentState.repo), {
|
|
331
|
+
metaChip('仓库', basenamePath(currentState.repo), {
|
|
332
|
+
title: currentState.repo,
|
|
333
|
+
long: true,
|
|
334
|
+
extra: `<button class="secondary copy-btn" title="复制仓库地址" onclick="copyRepoPath(event)">⧉</button>`
|
|
335
|
+
}),
|
|
319
336
|
metaChip('沙箱', sandbox, { danger: sandbox === 'danger-full-access' }),
|
|
320
337
|
metaChip('开始', formatDateTime(currentState.createdAt)),
|
|
321
338
|
metaChip('用时', `${durationSeconds(currentState.createdAt, runDurationEnd(currentState))} 秒`)
|
|
@@ -414,7 +431,7 @@ function renderTasks() {
|
|
|
414
431
|
if (Array.isArray(s.batches) && s.batches.length) {
|
|
415
432
|
for (const b of s.batches) {
|
|
416
433
|
const done = (b.tasks || []).filter(t => t.status === 'completed').length;
|
|
417
|
-
rows.push(`<tr class="batch-row"><td colspan="${columnCount}">${esc(b.name || b.id)}
|
|
434
|
+
rows.push(`<tr class="batch-row"><td colspan="${columnCount}"><div class="batch-row-content"><span class="batch-row-title">${esc(b.name || b.id)}</span>${pill(b.status)}<span class="batch-row-meta">${metaChip('Batch ID', b.id)}${metaChip('最大并发', b.maxParallel || '-')}${metaChip('进度', `${done}/${(b.tasks || []).length}`)}</span></div></td></tr>`);
|
|
418
435
|
for (const t of b.tasks || []) rows.push(taskRow(t.id, t.name, t));
|
|
419
436
|
}
|
|
420
437
|
} else rows.push(...(s.tasks||[]).map(t => taskRow(t.id, t.name, t)));
|
|
@@ -503,6 +520,18 @@ function hideExecutionSummary() {
|
|
|
503
520
|
el.classList.add('hidden');
|
|
504
521
|
el.innerHTML = '';
|
|
505
522
|
}
|
|
523
|
+
async function copyRepoPath(event) {
|
|
524
|
+
event.stopPropagation();
|
|
525
|
+
const repoPath = currentState?.repo || '';
|
|
526
|
+
if (!repoPath) return;
|
|
527
|
+
try {
|
|
528
|
+
await navigator.clipboard.writeText(repoPath);
|
|
529
|
+
event.currentTarget.textContent = '已复制';
|
|
530
|
+
setTimeout(() => { event.currentTarget.textContent = '⧉'; }, 900);
|
|
531
|
+
} catch {
|
|
532
|
+
prompt('复制仓库地址', repoPath);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
506
535
|
async function copyTmuxRunCommand(event) {
|
|
507
536
|
event.stopPropagation();
|
|
508
537
|
const command = runAttachCommand(currentState);
|
package/src/orchestrator.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
1
2
|
import fs from 'node:fs';
|
|
2
3
|
import fsp from 'node:fs/promises';
|
|
3
4
|
import path from 'node:path';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
4
6
|
import {
|
|
5
7
|
DEFAULT_REPO, RUNS_DIR, ensureDir, nowIso, makeRunId, readJson,
|
|
6
8
|
writeJsonAtomic, fileInfo, readTextMaybe, extractFirstJsonObject, listRunDirs,
|
|
@@ -10,6 +12,7 @@ import { matchThreadToMarkers } from './appServerClient.js';
|
|
|
10
12
|
import { formatCodexEventsJsonl } from './eventFormatter.js';
|
|
11
13
|
import { defaultRunner } from './runners/index.js';
|
|
12
14
|
|
|
15
|
+
const execFileAsync = promisify(execFile);
|
|
13
16
|
const runner = defaultRunner;
|
|
14
17
|
const VALID_SANDBOXES = new Set(['read-only', 'workspace-write', 'danger-full-access']);
|
|
15
18
|
|
|
@@ -22,13 +25,33 @@ function normalizeSandbox(value, fallback = 'workspace-write') {
|
|
|
22
25
|
function statePath(runDir) { return path.join(runDir, 'run_state.json'); }
|
|
23
26
|
function planPath(runDir) { return path.join(runDir, 'plan.json'); }
|
|
24
27
|
|
|
28
|
+
function userInputError(message) {
|
|
29
|
+
const error = new Error(message);
|
|
30
|
+
error.statusCode = 400;
|
|
31
|
+
return error;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function assertGitWorkTree(repo) {
|
|
35
|
+
const resolvedRepo = path.resolve(repo || DEFAULT_REPO);
|
|
36
|
+
let stat;
|
|
37
|
+
try { stat = await fsp.stat(resolvedRepo); }
|
|
38
|
+
catch { throw userInputError(`target repository does not exist: ${resolvedRepo}`); }
|
|
39
|
+
if (!stat.isDirectory()) throw userInputError(`target repository is not a directory: ${resolvedRepo}`);
|
|
40
|
+
try {
|
|
41
|
+
const { stdout } = await execFileAsync('git', ['-C', resolvedRepo, 'rev-parse', '--is-inside-work-tree'], { timeout: 5000 });
|
|
42
|
+
if (stdout.trim() === 'true') return resolvedRepo;
|
|
43
|
+
} catch {}
|
|
44
|
+
throw userInputError(`target repository is not a git work tree: ${resolvedRepo}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
25
47
|
export async function createRun({ label = 'task', taskText = '', repo = DEFAULT_REPO, maxParallel = 3, workerSandbox = 'workspace-write' } = {}) {
|
|
48
|
+
const resolvedRepo = await assertGitWorkTree(repo);
|
|
26
49
|
const runId = makeRunId(label);
|
|
27
50
|
const runDir = pathForRun(runId);
|
|
28
51
|
await ensureDir(runDir);
|
|
29
52
|
await fsp.writeFile(path.join(runDir, 'task.md'), taskText || '');
|
|
30
53
|
const state = {
|
|
31
|
-
runId, label, repo:
|
|
54
|
+
runId, label, repo: resolvedRepo, maxParallel: Number(maxParallel) || 3, workerSandbox: normalizeSandbox(workerSandbox),
|
|
32
55
|
runner: RUNNER,
|
|
33
56
|
status: 'created', createdAt: nowIso(), updatedAt: nowIso(),
|
|
34
57
|
planner: { status: 'pending' }, batches: [], tasks: [], judge: { status: 'pending' }
|
package/src/server.js
CHANGED
|
@@ -32,7 +32,7 @@ async function serveStatic(req, res, pathname) {
|
|
|
32
32
|
try {
|
|
33
33
|
const data = await fsp.readFile(file);
|
|
34
34
|
const ext = path.extname(file);
|
|
35
|
-
const type = ext === '.html' ? 'text/html' : ext === '.js' ? 'text/javascript' : ext === '.css' ? 'text/css' : 'text/plain';
|
|
35
|
+
const type = ext === '.html' ? 'text/html' : ext === '.js' ? 'text/javascript' : ext === '.css' ? 'text/css' : ext === '.png' ? 'image/png' : ext === '.svg' ? 'image/svg+xml' : 'text/plain';
|
|
36
36
|
res.writeHead(200, { 'Content-Type': `${type}; charset=utf-8` });
|
|
37
37
|
res.end(data);
|
|
38
38
|
} catch { notFound(res); }
|
|
@@ -78,7 +78,7 @@ async function handleApi(req, res, url, appClient) {
|
|
|
78
78
|
}
|
|
79
79
|
notFound(res);
|
|
80
80
|
} catch (e) {
|
|
81
|
-
send(res, 500, { error: e.message });
|
|
81
|
+
send(res, e.statusCode || 500, { error: e.message });
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|