claude-dashboard 0.1.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.
Files changed (88) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +99 -0
  4. package/README.zh-TW.md +99 -0
  5. package/bin/cdb.ts +60 -0
  6. package/bun.lock +1612 -0
  7. package/bunfig.toml +4 -0
  8. package/components.json +20 -0
  9. package/next.config.ts +19 -0
  10. package/package.json +62 -0
  11. package/postcss.config.mjs +9 -0
  12. package/prompts/pm-system.md +61 -0
  13. package/prompts/rd-system.md +68 -0
  14. package/prompts/sec-system.md +93 -0
  15. package/prompts/test-system.md +71 -0
  16. package/prompts/ui-system.md +72 -0
  17. package/server.ts +118 -0
  18. package/sql.js.d.ts +33 -0
  19. package/src/__tests__/api/usage/route.test.ts +193 -0
  20. package/src/__tests__/components/layout/TopNav.test.tsx +155 -0
  21. package/src/__tests__/components/layout/UsageIndicator.test.tsx +503 -0
  22. package/src/__tests__/hooks/useUsage.test.tsx +174 -0
  23. package/src/__tests__/lib/usage/get-token.test.ts +117 -0
  24. package/src/__tests__/react-sanity.test.tsx +14 -0
  25. package/src/__tests__/sanity.test.ts +7 -0
  26. package/src/__tests__/setup.ts +1 -0
  27. package/src/app/api/health/route.ts +8 -0
  28. package/src/app/api/usage/route.ts +86 -0
  29. package/src/app/api/workflows/[id]/route.ts +17 -0
  30. package/src/app/api/workflows/route.ts +14 -0
  31. package/src/app/globals.css +74 -0
  32. package/src/app/history/page.tsx +15 -0
  33. package/src/app/layout.tsx +24 -0
  34. package/src/app/page.tsx +112 -0
  35. package/src/components/agent/AgentCard.tsx +117 -0
  36. package/src/components/agent/AgentCardGrid.tsx +14 -0
  37. package/src/components/agent/AgentOutput.tsx +87 -0
  38. package/src/components/agent/AgentStatusBadge.tsx +20 -0
  39. package/src/components/events/EventLog.tsx +65 -0
  40. package/src/components/events/EventLogItem.tsx +39 -0
  41. package/src/components/history/HistoryTable.tsx +105 -0
  42. package/src/components/layout/DashboardShell.tsx +12 -0
  43. package/src/components/layout/TopNav.tsx +86 -0
  44. package/src/components/layout/UsageIndicator.tsx +163 -0
  45. package/src/components/pipeline/PipelineBar.tsx +59 -0
  46. package/src/components/pipeline/PipelineNode.tsx +55 -0
  47. package/src/components/terminal/TerminalPanel.tsx +138 -0
  48. package/src/components/terminal/XTermRenderer.tsx +129 -0
  49. package/src/components/ui/badge.tsx +37 -0
  50. package/src/components/ui/button.tsx +55 -0
  51. package/src/components/ui/card.tsx +80 -0
  52. package/src/components/ui/input.tsx +26 -0
  53. package/src/components/ui/scroll-area.tsx +52 -0
  54. package/src/components/ui/separator.tsx +31 -0
  55. package/src/components/ui/textarea.tsx +25 -0
  56. package/src/components/ui/tooltip.tsx +73 -0
  57. package/src/components/workflow/WorkflowLauncher.tsx +102 -0
  58. package/src/hooks/useAgentStream.ts +27 -0
  59. package/src/hooks/useAutoScroll.ts +24 -0
  60. package/src/hooks/useUsage.ts +66 -0
  61. package/src/hooks/useWebSocket.ts +289 -0
  62. package/src/lib/agents/prompts.ts +341 -0
  63. package/src/lib/db/connection.ts +263 -0
  64. package/src/lib/db/queries.ts +257 -0
  65. package/src/lib/db/schema.ts +39 -0
  66. package/src/lib/output-buffer.ts +41 -0
  67. package/src/lib/terminal/pty-manager.ts +106 -0
  68. package/src/lib/usage/get-token.ts +48 -0
  69. package/src/lib/utils.ts +6 -0
  70. package/src/lib/websocket/connection-manager.ts +71 -0
  71. package/src/lib/websocket/protocol.ts +90 -0
  72. package/src/lib/websocket/server.ts +231 -0
  73. package/src/lib/workflow/agent-runner.ts +254 -0
  74. package/src/lib/workflow/context-builder.ts +62 -0
  75. package/src/lib/workflow/engine.ts +310 -0
  76. package/src/lib/workflow/pipeline.ts +28 -0
  77. package/src/lib/workflow/types.ts +111 -0
  78. package/src/stores/agentStore.ts +152 -0
  79. package/src/stores/eventStore.ts +35 -0
  80. package/src/stores/terminalStore.ts +20 -0
  81. package/src/stores/uiStore.ts +35 -0
  82. package/src/stores/workflowStore.ts +57 -0
  83. package/src/types/css.d.ts +4 -0
  84. package/src/types/index.ts +12 -0
  85. package/tailwind.config.ts +65 -0
  86. package/tsconfig.json +25 -0
  87. package/tsconfig.server.json +21 -0
  88. package/vitest.config.ts +25 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npx tsc:*)",
5
+ "Bash(node --version:*)",
6
+ "Bash(node:*)",
7
+ "Bash(npx vitest:*)"
8
+ ]
9
+ }
10
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Claude Dashboard
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.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ English | [繁體中文](README.zh-TW.md)
2
+
3
+ # Claude Dashboard
4
+
5
+ Multi-agent software development dashboard powered by Claude.
6
+
7
+ ![Claude Dashboard Screenshot](https://meee.com.tw/BF17g4Y.jpg)
8
+
9
+ ## Features
10
+
11
+ - **Multi-agent pipeline** — Automated PM → RD → UI → TEST → SEC workflow, each agent with dedicated responsibilities and tools
12
+ - **Real-time streaming output** — Token-by-token display of agent reasoning and actions via WebSocket
13
+ - **Interactive terminal** — Full-featured terminal (xterm.js + node-pty) for live command inspection
14
+ - **Workflow management** — Pause, resume, and cancel running workflows at any point
15
+ - **Event log & token tracking** — Monitor agent activities, tool usage, and token consumption per step
16
+ - **SQLite persistence** — All workflows, agent outputs, and metrics are persisted for later review
17
+
18
+ ## Tech Stack
19
+
20
+ | Layer | Technology |
21
+ |-------|------------|
22
+ | Frontend | Next.js 15, React 19, Tailwind CSS, Zustand |
23
+ | Backend | Express, WebSocket (ws), node-pty |
24
+ | Database | sql.js (SQLite WASM) |
25
+ | AI | Claude CLI |
26
+
27
+ ## Prerequisites
28
+
29
+ - **Platform** — Windows, macOS, Linux
30
+ - **Node.js** 23.6+
31
+ - **Claude CLI** installed and configured ([docs](https://docs.anthropic.com/en/docs/claude-cli))
32
+
33
+ ## Quick Start
34
+
35
+ ```bash
36
+ npm install # Install dependencies
37
+ npm link # Link CLI globally (one-time)
38
+ cd /path/to/your/project
39
+ cdb # Launch the dashboard
40
+ ```
41
+
42
+ ## Agent Roles
43
+
44
+ | Role | Responsibility | Tools | Timeout |
45
+ |------|---------------|-------|---------|
46
+ | **PM** | Analyze requirements, produce structured specifications | Read | 3 min |
47
+ | **RD** | Design backend architecture, implement server-side code | Read, Edit, Bash | 10 min |
48
+ | **UI** | Design and implement frontend components, pages, styling | Read, Edit, Bash | 10 min |
49
+ | **TEST** | Write and execute tests, report coverage and bugs | Read, Edit, Bash | 10 min |
50
+ | **SEC** | Security assessment, vulnerability scanning, audit | Read, Bash | 5 min |
51
+
52
+ Agents execute sequentially. Each agent receives the accumulated context from all prior agents.
53
+
54
+ ## Project Structure
55
+
56
+ ```
57
+ claude_dashboard/
58
+ ├── bin/ # CLI launcher (cdb)
59
+ ├── prompts/ # Agent system prompt templates
60
+ │ ├── pm-system.md
61
+ │ ├── rd-system.md
62
+ │ ├── ui-system.md
63
+ │ ├── test-system.md
64
+ │ └── sec-system.md
65
+ ├── server.ts # Express + WebSocket server entry
66
+ ├── src/
67
+ │ ├── app/ # Next.js pages & API routes
68
+ │ ├── components/ # React components
69
+ │ │ ├── agent/ # Agent cards & output display
70
+ │ │ ├── events/ # Event log
71
+ │ │ ├── history/ # Workflow history table
72
+ │ │ ├── layout/ # Shell & navigation
73
+ │ │ ├── pipeline/ # Pipeline visualization
74
+ │ │ ├── terminal/ # xterm.js terminal panel
75
+ │ │ ├── ui/ # Shared UI primitives
76
+ │ │ └── workflow/ # Workflow launcher
77
+ │ ├── hooks/ # Custom React hooks
78
+ │ ├── lib/
79
+ │ │ ├── agents/ # Prompt loading & construction
80
+ │ │ ├── db/ # SQLite schema, connection, queries
81
+ │ │ ├── terminal/ # PTY manager
82
+ │ │ ├── websocket/ # WebSocket server & protocol
83
+ │ │ └── workflow/ # Engine, pipeline, agent runner
84
+ │ ├── stores/ # Zustand state stores
85
+ │ └── types/ # TypeScript type definitions
86
+ ├── data/ # SQLite database files
87
+ ├── package.json
88
+ └── tsconfig.json
89
+ ```
90
+
91
+ ## ☕ Buy Me a Coffee
92
+
93
+ If you find this project helpful, consider buying me a coffee!
94
+
95
+ <a href="https://buymeacoffee.com/mowd" target="_blank"><img src="https://mowd.tw/buymeacoffee.png" alt="Buy Me A Coffee" width="300"></a>
96
+
97
+ ## License
98
+
99
+ [MIT](./LICENSE)
@@ -0,0 +1,99 @@
1
+ [English](README.md) | 繁體中文
2
+
3
+ # Claude Dashboard
4
+
5
+ 以 Claude 驅動的多代理軟體開發儀表板。
6
+
7
+ ![Claude Dashboard Screenshot](https://meee.com.tw/BF17g4Y.jpg)
8
+
9
+ ## 功能特色
10
+
11
+ - **多代理流水線** — 自動化 PM → RD → UI → TEST → SEC 工作流程,每個代理擁有專屬職責與工具
12
+ - **即時串流輸出** — 透過 WebSocket 逐 token 顯示代理的推理過程與操作
13
+ - **互動式終端機** — 完整功能的終端機(xterm.js + node-pty),可即時檢視命令執行
14
+ - **工作流程管理** — 隨時暫停、恢復、取消執行中的工作流程
15
+ - **事件日誌與 token 追蹤** — 監控代理活動、工具使用情況,以及每個步驟的 token 消耗
16
+ - **SQLite 持久化** — 所有工作流程、代理輸出與指標皆持久保存,供事後檢閱
17
+
18
+ ## 技術架構
19
+
20
+ | 層級 | 技術 |
21
+ |------|------|
22
+ | 前端 | Next.js 15、React 19、Tailwind CSS、Zustand |
23
+ | 後端 | Express、WebSocket (ws)、node-pty |
24
+ | 資料庫 | sql.js (SQLite WASM) |
25
+ | AI | Claude CLI |
26
+
27
+ ## 前置需求
28
+
29
+ - **平台** — Windows、macOS、Linux
30
+ - **Node.js** 23.6+
31
+ - **Claude CLI** 已安裝並設定完成([文件](https://docs.anthropic.com/en/docs/claude-cli))
32
+
33
+ ## 快速開始
34
+
35
+ ```bash
36
+ npm install # 安裝依賴套件
37
+ npm link # 全域連結 CLI(僅需一次)
38
+ cd /path/to/your/project
39
+ cdb # 啟動儀表板
40
+ ```
41
+
42
+ ## 代理角色
43
+
44
+ | 角色 | 職責 | 工具 | 逾時 |
45
+ |------|------|------|------|
46
+ | **PM** | 分析需求,產出結構化規格書 | Read | 3 分鐘 |
47
+ | **RD** | 設計後端架構,實作伺服器端程式碼 | Read、Edit、Bash | 10 分鐘 |
48
+ | **UI** | 設計並實作前端元件、頁面、樣式 | Read、Edit、Bash | 10 分鐘 |
49
+ | **TEST** | 撰寫並執行測試,回報覆蓋率與錯誤 | Read、Edit、Bash | 10 分鐘 |
50
+ | **SEC** | 安全性評估、弱點掃描、稽核 | Read、Bash | 5 分鐘 |
51
+
52
+ 代理依序執行,每個代理接收所有前序代理的累積上下文。
53
+
54
+ ## 專案結構
55
+
56
+ ```
57
+ claude_dashboard/
58
+ ├── bin/ # CLI 啟動器 (cdb)
59
+ ├── prompts/ # 代理系統提示詞模板
60
+ │ ├── pm-system.md
61
+ │ ├── rd-system.md
62
+ │ ├── ui-system.md
63
+ │ ├── test-system.md
64
+ │ └── sec-system.md
65
+ ├── server.ts # Express + WebSocket 伺服器入口
66
+ ├── src/
67
+ │ ├── app/ # Next.js 頁面與 API 路由
68
+ │ ├── components/ # React 元件
69
+ │ │ ├── agent/ # 代理卡片與輸出顯示
70
+ │ │ ├── events/ # 事件日誌
71
+ │ │ ├── history/ # 工作流程歷史紀錄
72
+ │ │ ├── layout/ # 外殼與導覽列
73
+ │ │ ├── pipeline/ # 流水線視覺化
74
+ │ │ ├── terminal/ # xterm.js 終端機面板
75
+ │ │ ├── ui/ # 共用 UI 基礎元件
76
+ │ │ └── workflow/ # 工作流程啟動器
77
+ │ ├── hooks/ # 自定義 React hooks
78
+ │ ├── lib/
79
+ │ │ ├── agents/ # 提示詞載入與建構
80
+ │ │ ├── db/ # SQLite schema、連線、查詢
81
+ │ │ ├── terminal/ # PTY 管理器
82
+ │ │ ├── websocket/ # WebSocket 伺服器與協議
83
+ │ │ └── workflow/ # 引擎、流水線、代理執行器
84
+ │ ├── stores/ # Zustand 狀態管理
85
+ │ └── types/ # TypeScript 型別定義
86
+ ├── data/ # SQLite 資料庫檔案
87
+ ├── package.json
88
+ └── tsconfig.json
89
+ ```
90
+
91
+ ## ☕ Buy Me a Coffee
92
+
93
+ 如果你覺得這個專案對你有幫助,可以請我喝杯咖啡喔!
94
+
95
+ <a href="https://buymeacoffee.com/mowd" target="_blank"><img src="https://mowd.tw/buymeacoffee.png" alt="Buy Me A Coffee" width="300"></a>
96
+
97
+ ## 授權條款
98
+
99
+ [MIT](./LICENSE)
package/bin/cdb.ts ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "child_process";
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ async function main() {
11
+ const projectPath = process.cwd();
12
+ const port = parseInt(process.env.PORT || "3000", 10);
13
+ const host = process.env.HOST || "localhost";
14
+ const dashboardDir = path.resolve(__dirname, "..");
15
+
16
+ console.log(`\x1b[35m[Claude Dashboard]\x1b[0m Starting...`);
17
+ console.log(` Project: ${projectPath}`);
18
+ console.log(` Dashboard: http://${host}:${port}`);
19
+ console.log();
20
+
21
+ const serverProcess = spawn("node", ["server.ts"], {
22
+ cwd: dashboardDir,
23
+ env: {
24
+ ...process.env,
25
+ PROJECT_PATH: projectPath,
26
+ PORT: String(port),
27
+ HOST: host,
28
+ },
29
+ stdio: "inherit",
30
+ });
31
+
32
+ // Wait a bit then open browser
33
+ setTimeout(async () => {
34
+ try {
35
+ const open = (await import("open")).default;
36
+ await open(`http://${host}:${port}`);
37
+ } catch {
38
+ console.log(`\x1b[35m[Claude Dashboard]\x1b[0m Open http://${host}:${port} in your browser`);
39
+ }
40
+ }, 3000);
41
+
42
+ // Graceful shutdown
43
+ const shutdown = () => {
44
+ console.log(`\n\x1b[35m[Claude Dashboard]\x1b[0m Shutting down...`);
45
+ serverProcess.kill("SIGTERM");
46
+ setTimeout(() => process.exit(0), 3000);
47
+ };
48
+
49
+ process.on("SIGINT", shutdown);
50
+ process.on("SIGTERM", shutdown);
51
+
52
+ serverProcess.on("exit", (code) => {
53
+ process.exit(code || 0);
54
+ });
55
+ }
56
+
57
+ main().catch((err) => {
58
+ console.error("Failed to start:", err);
59
+ process.exit(1);
60
+ });