@citadel-labs/beads-ui 2.3.0 → 2.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/.claude/worktrees/agent-a7b97047/LICENSE +21 -0
- package/.claude/worktrees/agent-a7b97047/README.md +63 -0
- package/.claude/worktrees/agent-a7b97047/bin/beads-board.js +183 -0
- package/.claude/worktrees/agent-a7b97047/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/.claude/worktrees/agent-a7b97047/package-lock.json +1752 -0
- package/.claude/worktrees/agent-a7b97047/package.json +43 -0
- package/.claude/worktrees/agent-a7b97047/server/__tests__/api.test.js +206 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/angular-html-DA-rfuFy.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/angular-ts-BrjP3tb8.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/c-BIGW1oBm.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/cpp-BRuaLJcg.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/csharp-COcwbKMJ.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/css-CLj8gQPS.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/dockerfile-BcOcwvcX.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/dotenv-Da5cRb03.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/github-dark-DHJKELXO.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/go-C27-OAKa.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/graphql-ChdNCCLP.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/html-derivative-C6UeqQa8.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/html-pp8916En.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/http-l_GQhCeT.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/index-BBBYE21N.css +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/index-cZFE6wf9.js +231 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/ini-BEwlwnbL.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/java-CylS5w8V.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/javascript-wDzz0qaB.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/json-Cp-IABpG.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/jsonc-Des-eS-w.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/jsonl-DcaNXYhu.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/jsx-g9-lgVsj.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/kotlin-BdnUsdx6.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/kusto-wEQ09or8.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/latex-DdMFrP5M.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/markdown-Cvjx9yec.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/mdc-Dz5ISc6g.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/mermaid-mWjccvbQ.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/php-R6g_5hLQ.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/powershell-Dpen1YoG.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/python-B6aJPvgy.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/ruby-AcS3PBV-.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/rust-B1yitclQ.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/sass-Cj5Yp3dK.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/scss-D5BDwBP9.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/shellscript-DfDnw5Jg.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/sql-BLtJtn59.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/svelte-DR4MIrkg.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/swift-D82vCrfD.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/toml-vGWfd6FD.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/tsx-COt5Ahok.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/typescript-BPQ3VLAy.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/vue-CJgBXYWu.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/xml-sdJ4AIDG.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/yaml-Buea-lGh.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/assets/zig-VOosw3JB.js +1 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/favicon.svg +103 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/index.html +14 -0
- package/.claude/worktrees/agent-a7b97047/server/dist/vite.svg +1 -0
- package/.claude/worktrees/agent-a7b97047/server/handlers.js +357 -0
- package/.claude/worktrees/agent-a7b97047/server/index.js +88 -0
- package/.claude/worktrees/agent-a7b97047/server/terminal.js +103 -0
- package/.claude/worktrees/agent-a7b97047/vitest.config.mjs +8 -0
- package/.claude/worktrees/agent-a952bde8/LICENSE +21 -0
- package/.claude/worktrees/agent-a952bde8/README.md +63 -0
- package/.claude/worktrees/agent-a952bde8/bin/beads-board.js +183 -0
- package/.claude/worktrees/agent-a952bde8/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/.claude/worktrees/agent-a952bde8/package-lock.json +1752 -0
- package/.claude/worktrees/agent-a952bde8/package.json +43 -0
- package/.claude/worktrees/agent-a952bde8/server/__tests__/api.test.js +122 -0
- package/.claude/worktrees/agent-a952bde8/server/dist/assets/index-BsWRmNbj.js +79 -0
- package/.claude/worktrees/agent-a952bde8/server/dist/assets/index-C7JKZkTD.css +1 -0
- package/.claude/worktrees/agent-a952bde8/server/dist/favicon.svg +103 -0
- package/.claude/worktrees/agent-a952bde8/server/dist/index.html +14 -0
- package/.claude/worktrees/agent-a952bde8/server/dist/vite.svg +1 -0
- package/.claude/worktrees/agent-a952bde8/server/handlers.js +269 -0
- package/.claude/worktrees/agent-a952bde8/server/index.js +88 -0
- package/.claude/worktrees/agent-a952bde8/server/terminal.js +103 -0
- package/.claude/worktrees/agent-a952bde8/vitest.config.mjs +8 -0
- package/package.json +1 -1
- package/server/__tests__/api.test.js +139 -0
- package/server/dist/assets/angular-html-DA-rfuFy.js +1 -0
- package/server/dist/assets/angular-ts-BrjP3tb8.js +1 -0
- package/server/dist/assets/c-BIGW1oBm.js +1 -0
- package/server/dist/assets/cpp-BRuaLJcg.js +1 -0
- package/server/dist/assets/csharp-COcwbKMJ.js +1 -0
- package/server/dist/assets/css-CLj8gQPS.js +1 -0
- package/server/dist/assets/dockerfile-BcOcwvcX.js +1 -0
- package/server/dist/assets/dotenv-Da5cRb03.js +1 -0
- package/server/dist/assets/github-dark-DHJKELXO.js +1 -0
- package/server/dist/assets/go-C27-OAKa.js +1 -0
- package/server/dist/assets/graphql-ChdNCCLP.js +1 -0
- package/server/dist/assets/html-derivative-C6UeqQa8.js +1 -0
- package/server/dist/assets/html-pp8916En.js +1 -0
- package/server/dist/assets/http-l_GQhCeT.js +1 -0
- package/server/dist/assets/index-DOFQi_E1.js +231 -0
- package/server/dist/assets/index-DeppoR8O.css +1 -0
- package/server/dist/assets/ini-BEwlwnbL.js +1 -0
- package/server/dist/assets/java-CylS5w8V.js +1 -0
- package/server/dist/assets/javascript-wDzz0qaB.js +1 -0
- package/server/dist/assets/json-Cp-IABpG.js +1 -0
- package/server/dist/assets/jsonc-Des-eS-w.js +1 -0
- package/server/dist/assets/jsonl-DcaNXYhu.js +1 -0
- package/server/dist/assets/jsx-g9-lgVsj.js +1 -0
- package/server/dist/assets/kotlin-BdnUsdx6.js +1 -0
- package/server/dist/assets/kusto-wEQ09or8.js +1 -0
- package/server/dist/assets/latex-DdMFrP5M.js +1 -0
- package/server/dist/assets/markdown-Cvjx9yec.js +1 -0
- package/server/dist/assets/mdc-Dz5ISc6g.js +1 -0
- package/server/dist/assets/mdx-Cmh6b_Ma.js +1 -0
- package/server/dist/assets/mermaid-mWjccvbQ.js +1 -0
- package/server/dist/assets/php-R6g_5hLQ.js +1 -0
- package/server/dist/assets/powershell-Dpen1YoG.js +1 -0
- package/server/dist/assets/python-B6aJPvgy.js +1 -0
- package/server/dist/assets/ruby-AcS3PBV-.js +1 -0
- package/server/dist/assets/rust-B1yitclQ.js +1 -0
- package/server/dist/assets/sass-Cj5Yp3dK.js +1 -0
- package/server/dist/assets/scss-D5BDwBP9.js +1 -0
- package/server/dist/assets/shellscript-DfDnw5Jg.js +1 -0
- package/server/dist/assets/sql-BLtJtn59.js +1 -0
- package/server/dist/assets/svelte-DR4MIrkg.js +1 -0
- package/server/dist/assets/swift-D82vCrfD.js +1 -0
- package/server/dist/assets/toml-vGWfd6FD.js +1 -0
- package/server/dist/assets/tsx-COt5Ahok.js +1 -0
- package/server/dist/assets/typescript-BPQ3VLAy.js +1 -0
- package/server/dist/assets/vue-CJgBXYWu.js +1 -0
- package/server/dist/assets/xml-sdJ4AIDG.js +1 -0
- package/server/dist/assets/yaml-Buea-lGh.js +1 -0
- package/server/dist/assets/zig-VOosw3JB.js +1 -0
- package/server/dist/index.html +2 -2
- package/server/handlers.js +93 -6
- package/server/terminal.js +2 -4
- package/server/dist/assets/index-B2S7vHJ3.js +0 -79
- package/server/dist/assets/index-K-eN8vD6.css +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stuart Rimel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# beads-board
|
|
2
|
+
|
|
3
|
+
A minimal kanban dashboard and git log viewer for [Beads](https://github.com/steveyegge/beads). Runs as a standalone CLI tool.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Kanban board** — Issues organized by status: Ready, In Progress, Blocked, Done
|
|
8
|
+
- **Git log** — Scrollable commit history with branch selector
|
|
9
|
+
- **Bead ID linking** — Bead IDs in commit messages are highlighted as badges
|
|
10
|
+
- **Dark/light theme** — Toggle between themes, dark by default
|
|
11
|
+
- **Auto-refresh** — Polls for updates every 5 seconds
|
|
12
|
+
- **Integrated terminal** — Built-in terminal panel powered by node-pty and xterm.js
|
|
13
|
+
- **Minimal runtime dependencies** — Server uses Node.js stdlib plus `node-pty` and `ws` for the terminal
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Install globally
|
|
19
|
+
npm install -g @citadel-labs/beads-ui
|
|
20
|
+
|
|
21
|
+
# Or run directly with npx (installs temporarily)
|
|
22
|
+
npx @citadel-labs/beads-ui
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then from any project that uses [Beads](https://github.com/steveyegge/beads):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cd /path/to/your/project
|
|
29
|
+
bdui # Start dashboard in background, prints URL
|
|
30
|
+
bdui /path/to/project # Specify a project directory
|
|
31
|
+
bdui --port 9000 # Custom port
|
|
32
|
+
bdui status # Check if dashboard is running
|
|
33
|
+
bdui stop # Stop the dashboard
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or start the server directly:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
node server/index.js
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The server starts in the background and returns control to your terminal. Open the printed URL (default **http://localhost:8377**) in your browser. Port auto-increments if taken.
|
|
43
|
+
|
|
44
|
+
## How It Works
|
|
45
|
+
|
|
46
|
+
The server shells out to `bd` and `git` CLI commands to fetch data, then serves a React dashboard that polls the API every 5 seconds. No direct database access — all data flows through the Beads CLI.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Browser → GET /api/* → Node.js server → bd/git CLI → JSON response
|
|
50
|
+
← React app ← server/dist/
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
See [docs/architecture.md](docs/architecture.md) for details.
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
- [Architecture](docs/architecture.md) — How the server and UI fit together
|
|
58
|
+
- [API Reference](docs/api.md) — All API endpoints with examples
|
|
59
|
+
- [Contributing](docs/contributing.md) — How to set up a dev environment and make changes
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const { spawn } = require('node:child_process');
|
|
6
|
+
|
|
7
|
+
const SERVER_SCRIPT = path.join(__dirname, '..', 'server', 'index.js');
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Argument parsing
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
const rawArgs = process.argv.slice(2);
|
|
14
|
+
|
|
15
|
+
// Extract subcommand (start, stop, status) — default to "start"
|
|
16
|
+
const SUBCOMMANDS = ['start', 'stop', 'status'];
|
|
17
|
+
let subcommand = 'start';
|
|
18
|
+
const args = [];
|
|
19
|
+
for (const arg of rawArgs) {
|
|
20
|
+
if (SUBCOMMANDS.includes(arg) && args.length === 0 && subcommand === 'start') {
|
|
21
|
+
subcommand = arg;
|
|
22
|
+
} else {
|
|
23
|
+
args.push(arg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// --help
|
|
28
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
29
|
+
console.log(`bdui — Kanban dashboard and git log viewer for Beads
|
|
30
|
+
|
|
31
|
+
Usage:
|
|
32
|
+
bdui [project-dir] [options] Start the dashboard (default)
|
|
33
|
+
bdui start [project-dir] [options] Start the dashboard
|
|
34
|
+
bdui stop [project-dir] Stop a running dashboard
|
|
35
|
+
bdui status [project-dir] Show running dashboard info
|
|
36
|
+
|
|
37
|
+
Options:
|
|
38
|
+
--port <port> Port to listen on (default: 8377)
|
|
39
|
+
--foreground Run in foreground (don't daemonize)
|
|
40
|
+
--help, -h Show this help message
|
|
41
|
+
--version, -v Show version number
|
|
42
|
+
|
|
43
|
+
Examples:
|
|
44
|
+
bdui # Start dashboard for current directory
|
|
45
|
+
bdui /path/to/project # Specify project directory
|
|
46
|
+
bdui --port 9000 # Custom port
|
|
47
|
+
bdui stop # Stop the running dashboard
|
|
48
|
+
bdui status # Check if dashboard is running`);
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// --version
|
|
53
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
54
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
|
55
|
+
console.log(pkg.version);
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// --foreground
|
|
60
|
+
const foreground = args.includes('--foreground');
|
|
61
|
+
const filteredArgs = args.filter(a => a !== '--foreground');
|
|
62
|
+
|
|
63
|
+
// --port
|
|
64
|
+
let customPort = null;
|
|
65
|
+
const portIdx = filteredArgs.indexOf('--port');
|
|
66
|
+
if (portIdx !== -1) {
|
|
67
|
+
customPort = filteredArgs[portIdx + 1];
|
|
68
|
+
if (!customPort || isNaN(parseInt(customPort, 10))) {
|
|
69
|
+
console.error('Error: --port requires a numeric value');
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
filteredArgs.splice(portIdx, 2);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Remaining arg is the project directory
|
|
76
|
+
const projectDir = filteredArgs[0] ? path.resolve(filteredArgs[0]) : process.cwd();
|
|
77
|
+
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// Validation
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
if (!fs.existsSync(projectDir)) {
|
|
83
|
+
console.error(`Error: directory not found: ${projectDir}`);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!fs.existsSync(path.join(projectDir, '.beads'))) {
|
|
88
|
+
console.error(`Error: no .beads/ directory found in ${projectDir}`);
|
|
89
|
+
console.error('This project does not appear to use Beads issue tracking.');
|
|
90
|
+
console.error('See https://github.com/steveyegge/beads to get started.');
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Pidfile helpers
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
|
|
98
|
+
const PIDFILE = path.join(projectDir, '.beads-board.pid');
|
|
99
|
+
|
|
100
|
+
function getRunningInstance() {
|
|
101
|
+
try {
|
|
102
|
+
const data = JSON.parse(fs.readFileSync(PIDFILE, 'utf8'));
|
|
103
|
+
process.kill(data.pid, 0); // throws if not running
|
|
104
|
+
return data;
|
|
105
|
+
} catch {
|
|
106
|
+
// Clean up stale pidfile
|
|
107
|
+
try { fs.unlinkSync(PIDFILE); } catch {}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// Subcommands
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
|
|
116
|
+
if (subcommand === 'status') {
|
|
117
|
+
const instance = getRunningInstance();
|
|
118
|
+
if (instance) {
|
|
119
|
+
console.log(`beads-board running at http://localhost:${instance.port} (pid ${instance.pid})`);
|
|
120
|
+
} else {
|
|
121
|
+
console.log('beads-board is not running');
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
process.exit(0);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (subcommand === 'stop') {
|
|
128
|
+
const instance = getRunningInstance();
|
|
129
|
+
if (!instance) {
|
|
130
|
+
console.log('beads-board is not running');
|
|
131
|
+
process.exit(0);
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
process.kill(instance.pid, 'SIGTERM');
|
|
135
|
+
console.log(`beads-board stopped (was http://localhost:${instance.port}, pid ${instance.pid})`);
|
|
136
|
+
} catch (err) {
|
|
137
|
+
console.error(`Failed to stop beads-board (pid ${instance.pid}): ${err.message}`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
process.exit(0);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// subcommand === 'start'
|
|
144
|
+
const existing = getRunningInstance();
|
|
145
|
+
if (existing) {
|
|
146
|
+
console.log(`beads-board already running at http://localhost:${existing.port} (pid ${existing.pid})`);
|
|
147
|
+
process.exit(0);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (foreground) {
|
|
151
|
+
// Run server in foreground (debugging)
|
|
152
|
+
if (customPort) process.env.PORT = customPort;
|
|
153
|
+
process.argv = [process.argv[0], __filename, projectDir];
|
|
154
|
+
require(SERVER_SCRIPT);
|
|
155
|
+
} else {
|
|
156
|
+
// Spawn detached server process
|
|
157
|
+
const env = { ...process.env };
|
|
158
|
+
if (customPort) env.PORT = customPort;
|
|
159
|
+
|
|
160
|
+
const child = spawn(process.execPath, [SERVER_SCRIPT, projectDir], {
|
|
161
|
+
detached: true,
|
|
162
|
+
stdio: 'ignore',
|
|
163
|
+
env,
|
|
164
|
+
windowsHide: true,
|
|
165
|
+
});
|
|
166
|
+
child.unref();
|
|
167
|
+
|
|
168
|
+
// Wait for pidfile to confirm startup (poll up to 3s)
|
|
169
|
+
const start = Date.now();
|
|
170
|
+
const poll = setInterval(() => {
|
|
171
|
+
const instance = getRunningInstance();
|
|
172
|
+
if (instance) {
|
|
173
|
+
clearInterval(poll);
|
|
174
|
+
console.log(`beads-board running at http://localhost:${instance.port}`);
|
|
175
|
+
process.exit(0);
|
|
176
|
+
}
|
|
177
|
+
if (Date.now() - start > 3000) {
|
|
178
|
+
clearInterval(poll);
|
|
179
|
+
console.error('Error: server failed to start within 3 seconds');
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
}, 100);
|
|
183
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"4.0.18","results":[[":server/__tests__/api.test.js",{"duration":60.534099999999995,"failed":false}]]}
|