@d86e/hive-panel 0.3.11 → 0.4.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/README.md CHANGED
@@ -12,17 +12,19 @@
12
12
  ## Quick start
13
13
 
14
14
  ```bash
15
- npx @d86e/hive-panel --repo ~/Codes/project
15
+ npx @d86e/hive-panel --repo /path/to/repo
16
16
  # → http://127.0.0.1:7717
17
17
  ```
18
18
 
19
19
  `--repo` defaults to the current directory and `--port` defaults to `7717`. The
20
20
  server binds `127.0.0.1` only and is read-only without `--write`.
21
21
 
22
- Ask the OS for a free port and read the real one from the startup output:
22
+ If `7717` is already taken the server exits with a one-line message instead of a
23
+ stack trace. Ask the OS for a free port and read the real one from the startup
24
+ output (`--port 0`):
23
25
 
24
26
  ```bash
25
- npx @d86e/hive-panel --repo ~/Codes/project --port 0
27
+ npx @d86e/hive-panel --repo /path/to/repo --port 0
26
28
  # hive-panel http://127.0.0.1:52341
27
29
  # port 52341
28
30
  ```
@@ -33,7 +35,8 @@ From a checkout of this repository (the same entry point the npm package ships):
33
35
  node bin/hive-panel.js --repo .
34
36
  ```
35
37
 
36
- If the Hive CLIs are not on PATH, point at them:
38
+ If the Hive CLIs are not on PATH, point at them with the env vars (no file
39
+ needs editing; `git` is resolved from PATH and the port bind is IPv4 loopback only):
37
40
 
38
41
  ```bash
39
42
  HIVE_TASKS_BIN=/path/to/hive-tasks/bin/hive-tasks.js \
@@ -58,7 +61,7 @@ CI, or a second browser tab. The two share only the repository — the refs and
58
61
  | Column | Source |
59
62
  | --- | --- |
60
63
  | Agents | `hive board --json` (state, current card, files, last seen) |
61
- | Tasks | `hive-tasks list --json`, split into pending / claimed / done / blocked / failed |
64
+ | Tasks | `hive-tasks list --json`, split into pending / claimed / done / failed |
62
65
  | Events | the last 80 lines of `.hive/events.jsonl` |
63
66
  | Header | mode (free / freeze) and `hive-tasks stats --json` |
64
67
 
@@ -76,7 +79,7 @@ initialised" to ready without treating it as an error.
76
79
  ## Write mode
77
80
 
78
81
  ```bash
79
- npx @d86e/hive-panel --repo ~/Codes/project --write
82
+ npx @d86e/hive-panel --repo /path/to/repo --write
80
83
  ```
81
84
 
82
85
  Adds a freeze toggle, `New task` (add), `Give the Queen a goal` (plan),
package/README.zh-CN.md CHANGED
@@ -12,16 +12,17 @@
12
12
  ## 快速开始
13
13
 
14
14
  ```bash
15
- npx @d86e/hive-panel --repo ~/Codes/project
15
+ npx @d86e/hive-panel --repo /path/to/repo
16
16
  # 打开 http://127.0.0.1:7717
17
17
  ```
18
18
 
19
19
  `--repo` 默认是当前目录,`--port` 默认是 `7717`。服务只绑 `127.0.0.1`;不加 `--write` 时是只读的。
20
20
 
21
- 让系统分配一个空闲端口,并从启动输出里读真实端口:
21
+ 如果 `7717` 已被占用,服务只打印一行提示后退出,不再抛原始堆栈。让系统分配一个空闲端口,
22
+ 并从启动输出里读真实端口(`--port 0`):
22
23
 
23
24
  ```bash
24
- npx @d86e/hive-panel --repo ~/Codes/project --port 0
25
+ npx @d86e/hive-panel --repo /path/to/repo --port 0
25
26
  # hive-panel http://127.0.0.1:52341
26
27
  # port 52341
27
28
  ```
@@ -32,7 +33,8 @@ npx @d86e/hive-panel --repo ~/Codes/project --port 0
32
33
  node bin/hive-panel.js --repo .
33
34
  ```
34
35
 
35
- Hive 的 CLI 不在 PATH 上时,指给它们:
36
+ Hive 的 CLI 不在 PATH 上时,用环境变量指给它们(不需要改任何文件;`git` 从 PATH 解析,
37
+ 端口只绑 IPv4 回环):
36
38
 
37
39
  ```bash
38
40
  HIVE_TASKS_BIN=/path/to/hive-tasks/bin/hive-tasks.js \
@@ -51,7 +53,7 @@ DSH Web 界面自带 **Hive / 蜂群** 标签页,由另一个插件 `dsh-hive-
51
53
  | 列 | 来源 |
52
54
  | --- | --- |
53
55
  | Agents | `hive board --json`(状态、当前卡、文件、最后出现) |
54
- | Tasks | `hive-tasks list --json`,分成 pending / claimed / done / blocked / failed |
56
+ | Tasks | `hive-tasks list --json`,分成 pending / claimed / done / failed |
55
57
  | Events | `.hive/events.jsonl` 最后 80 行 |
56
58
  | 顶部 | 模式(free / freeze)与 `hive-tasks stats --json` |
57
59
 
@@ -64,7 +66,7 @@ DSH Web 界面自带 **Hive / 蜂群** 标签页,由另一个插件 `dsh-hive-
64
66
  ## 写模式
65
67
 
66
68
  ```bash
67
- npx @d86e/hive-panel --repo ~/Codes/project --write
69
+ npx @d86e/hive-panel --repo /path/to/repo --write
68
70
  ```
69
71
 
70
72
  多出冻结开关、新建任务(add)、给女王下目标(plan)、提交(commit),以及卡片动作(认领/完成/失败/重试/删除);每个动作对应 `/api/actions/*` 里一个固定入口,参数由固定构造函数拼装,别的一概不可调用。页面本身仍然只读——它发 POST,然后靠轮询刷新。删除是抽屉里的红色按钮,带二次确认;已认领的卡按钮保持禁用(先释放或重开)。
package/SPEC.md CHANGED
@@ -75,7 +75,6 @@ one shell-out with a fixed argv builder — the panel never imports the core.
75
75
  | `fail` | HIVE_TASKS_BIN | `fail <id> --reason R` |
76
76
  | `retry` | HIVE_TASKS_BIN | `retry <id>` |
77
77
  | `remove` | HIVE_TASKS_BIN | `rm <id>` |
78
- | `block` | HIVE_TASKS_BIN | `block <id> --reason R` |
79
78
  | `renew` | HIVE_TASKS_BIN | `renew <id> --ttl 5m [--agent A]` |
80
79
  | `mode` | HIVE_BIN | `mode free\|freeze --reason R` |
81
80
  | `learn` | HIVE_BIN | `lesson add --scope G TEXT` |
@@ -100,7 +99,7 @@ POST /api/retry { "id": "<card>" } -> retry
100
99
  | Variable | Default | Used for |
101
100
  | --- | --- | --- |
102
101
  | HIVE_BIN | hive | board, init, mode, learn, recall, verdict |
103
- | HIVE_TASKS_BIN | hive-tasks | list, stats, add, claim, done, fail, retry, block, renew, remove |
102
+ | HIVE_TASKS_BIN | hive-tasks | list, stats, add, claim, done, fail, retry, renew, remove |
104
103
  | HIVE_RUN_BIN | hive-run | plan, run |
105
104
  | MOC_BIN | moc | commit |
106
105
 
package/bin/hive-panel.js CHANGED
@@ -7,10 +7,21 @@ let repo = process.cwd();
7
7
  let port = 7717;
8
8
  let writable = false;
9
9
 
10
+ function fail(message) {
11
+ process.stderr.write("hive-panel: " + message + "\n");
12
+ process.exit(2);
13
+ }
14
+
10
15
  for (let i = 0; i < args.length; i++) {
11
- if (args[i] === "--port") port = Number(args[++i]);
12
- else if (args[i] === "--repo") repo = path.resolve(args[++i]);
13
- else if (args[i] === "--write") writable = true;
16
+ if (args[i] === "--port") {
17
+ const raw = args[++i];
18
+ port = Number(raw);
19
+ if (!Number.isInteger(port) || port < 0 || port > 65535) fail("--port must be an integer in 0..65535 (got " + JSON.stringify(raw) + ")");
20
+ } else if (args[i] === "--repo") {
21
+ const raw = args[++i];
22
+ if (raw === undefined || raw === "") fail("--repo needs a directory");
23
+ repo = path.resolve(raw);
24
+ } else if (args[i] === "--write") writable = true;
14
25
  else if (args[i] === "-h" || args[i] === "--help") {
15
26
  process.stdout.write("hive-panel [--port 7717] [--repo PATH] [--write]\n");
16
27
  process.exit(0);
@@ -19,6 +30,14 @@ for (let i = 0; i < args.length; i++) {
19
30
 
20
31
  const publicDir = path.resolve(import.meta.dirname, "..", "public");
21
32
  const server = createServer({ repo: path.resolve(repo), publicDir, writable });
33
+ server.on("error", (error) => {
34
+ if (error && error.code === "EADDRINUSE") {
35
+ process.stderr.write("hive-panel: port " + port + " is already in use; retry with --port 0 to pick a free one, or --port <n> for a specific one\n");
36
+ process.exit(1);
37
+ }
38
+ process.stderr.write("hive-panel: " + (error && error.message ? error.message : String(error)) + "\n");
39
+ process.exit(1);
40
+ });
22
41
  server.listen(port, "127.0.0.1", () => {
23
42
  const address = server.address();
24
43
  const actualPort = address && typeof address === "object" ? address.port : port;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d86e/hive-panel",
3
- "version": "0.3.11",
3
+ "version": "0.4.0",
4
4
  "description": "A read-only board for a Hive swarm: agents, task lanes and the event tail, served from the refs and files you already have.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "LICENSE"
17
17
  ],
18
18
  "engines": {
19
- "node": ">=20"
19
+ "node": ">=22.19"
20
20
  },
21
21
  "scripts": {
22
22
  "test": "node --test test/*.test.mjs",