|
1 | | -# CC-Hub |
| 1 | +# CC Hub |
2 | 2 |
|
3 | | -**Claude Code Web 管理平台** — 用 GUI 管理你的 Claude Code sessions。 |
| 3 | +Web dashboard for managing Claude Code configuration, sessions, and settings. |
4 | 4 |
|
5 | | -## 為什麼需要這個? |
| 5 | +## Why? |
6 | 6 |
|
7 | | -Claude Code CLI 很強,但有些事情用 GUI 更順: |
8 | | -- 📋 **總覽** — 一眼看到所有 sessions,不用 `ls ~/.claude/projects` |
9 | | -- 🔍 **搜尋** — 找那個「上週討論 auth 的對話」 |
10 | | -- 🗑️ **管理** — 刪除、整理、不讓 sessions 無限膨脹 |
11 | | -- 🔄 **同步** — Web 編輯 = CLI 同步,無縫切換 |
| 7 | +Claude Code CLI is powerful, but some tasks are easier with a GUI: |
| 8 | +- **Overview** — See all sessions at a glance instead of `ls ~/.claude/projects` |
| 9 | +- **Search** — Find that auth discussion from last week |
| 10 | +- **Manage** — Delete, archive, restore sessions without manual file wrangling |
| 11 | +- **Edit** — Modify agents, rules, hooks, MCP servers, and settings through a web UI |
12 | 12 |
|
13 | | -## 功能 |
| 13 | +## Features |
14 | 14 |
|
15 | | -### ✅ 已完成 |
| 15 | +| Feature | Description | |
| 16 | +|---------|-------------| |
| 17 | +| **Session Manager** | List, search, filter by project, with 300ms debounced search | |
| 18 | +| **Resume Sessions** | Click to continue a conversation, syncs with CLI `claude -r` | |
| 19 | +| **Archive / Trash** | Soft-delete to `~/.claude/trash/`, restore or permanently delete | |
| 20 | +| **Config Dashboard** | Browse and edit agents, rules, hooks, MCP servers, commands, plugins, settings | |
| 21 | +| **CLAUDE.md Editor** | Edit your project instructions with live markdown preview | |
| 22 | +| **AI Assistant** | Integrated web Claude Code with full tool access | |
| 23 | +| **Auth Middleware** | Per-start random token, httpOnly cookie, Bearer header support | |
16 | 24 |
|
17 | | -| 功能 | 說明 | |
18 | | -|------|------| |
19 | | -| **Session 列表** | 顯示所有 sessions,按時間排序,顯示標題 + 專案 | |
20 | | -| **Resume 對話** | 點擊繼續對話,狀態與 CLI `claude -r` 同步 | |
21 | | -| **刪除 + Trash** | 刪除移到 `~/.claude/trash/`,保留 metadata 可還原 | |
| 25 | +## Tech Stack |
22 | 26 |
|
23 | | -### 🚧 開發中 |
| 27 | +- **Frontend**: Nuxt 3 + Nuxt UI + VueUse |
| 28 | +- **Backend**: Nitro server with `~/.claude/` filesystem APIs |
| 29 | +- **AI**: `@anthropic-ai/claude-agent-sdk` with SSE streaming |
| 30 | +- **Auth**: Random token per server start, cookie-based for browser, Bearer for scripts |
24 | 31 |
|
25 | | -| 功能 | 優先度 | 說明 | |
26 | | -|------|--------|------| |
27 | | -| **開新 Session** | 🔴 高 | 從 Web 開始新對話,選擇 working directory | |
28 | | -| **搜尋對話** | 🔴 高 | 全文搜尋歷史對話內容 | |
29 | | -| **Project 分組** | 🟡 中 | 按專案資料夾分組顯示 | |
30 | | -| **Session 重命名** | 🟡 中 | 自訂標題,不只用第一句話 | |
31 | | -| **Token 統計** | 🟢 低 | 顯示用量、估算成本 | |
32 | | -| **Trash 還原** | 🟢 低 | 從垃圾桶救回誤刪 session | |
33 | | -| **匯出對話** | 🟢 低 | Markdown / JSON 匯出 | |
34 | | - |
35 | | -## 技術架構 |
| 32 | +## Project Structure |
36 | 33 |
|
37 | 34 | ``` |
38 | 35 | cc-hub/ |
39 | | -├── app/ # Nuxt frontend |
40 | | -│ ├── pages/ai.vue # 主頁面 |
41 | | -│ └── composables/ |
42 | | -│ └── useAiChat.ts # Chat 狀態管理 + resume |
| 36 | +├── app/ |
| 37 | +│ ├── pages/ |
| 38 | +│ │ ├── ai/index.vue # Full-page Claude Code |
| 39 | +│ │ ├── ai/sessions.vue # Session manager |
| 40 | +│ │ └── ... # Config dashboard pages |
| 41 | +│ ├── composables/useAiChat.ts # Chat state + SSE streaming |
| 42 | +│ └── utils/format.ts # Shared formatting utilities |
43 | 43 | ├── server/ |
44 | | -│ └── api/ai/ |
45 | | -│ ├── sessions.get.ts # GET /api/ai/sessions |
46 | | -│ └── sessions/[id].get.ts # GET /api/ai/sessions/:id |
47 | | -│ └── sessions/[id].delete.ts # DELETE /api/ai/sessions/:id |
48 | | -└── README.md |
| 44 | +│ ├── api/ai/ |
| 45 | +│ │ ├── chat.post.ts # AI chat endpoint (SSE) |
| 46 | +│ │ ├── sessions.get.ts # Session list + search |
| 47 | +│ │ └── sessions/ # Session CRUD + archive |
| 48 | +│ ├── api/ # Config CRUD endpoints |
| 49 | +│ ├── middleware/api-auth.ts # Auth middleware |
| 50 | +│ └── utils/ # Path guard, frontmatter parser, etc. |
| 51 | +└── public/favicon.svg |
49 | 52 | ``` |
50 | 53 |
|
51 | | -### 資料位置 |
52 | | - |
53 | | -| 路徑 | 用途 | |
54 | | -|------|------| |
55 | | -| `~/.claude/projects/` | Claude Code 原生 session 儲存位置 | |
56 | | -| `~/.claude/trash/` | 刪除的 sessions(含 .meta.json) | |
57 | | - |
58 | | -### Session 結構 |
| 54 | +## Data Layout |
59 | 55 |
|
60 | | -每個 session 是一個 `.jsonl` 檔: |
61 | | -``` |
62 | | -~/.claude/projects/{project-path}/{session-id}.jsonl |
63 | | -``` |
| 56 | +| Path | Purpose | |
| 57 | +|------|---------| |
| 58 | +| `~/.claude/projects/` | Claude Code session storage (`.jsonl` files) | |
| 59 | +| `~/.claude/trash/` | Archived sessions with `.meta.json` for restore | |
| 60 | +| `~/.claude/agents/` | Agent definitions (`.md` with frontmatter) | |
| 61 | +| `~/.claude/rules/` | Custom rules | |
| 62 | +| `~/.claude/settings.json` | Global settings | |
| 63 | +| `~/.claude/mcp.json` | MCP server configuration | |
64 | 64 |
|
65 | | -每行是一個 JSON entry: |
66 | | -```jsonl |
67 | | -{"type":"user","message":{"role":"user","content":"hi"},...} |
68 | | -{"type":"assistant","message":{"role":"assistant","content":"Hello!"},...} |
69 | | -``` |
70 | | - |
71 | | -## 開發 |
| 65 | +## Getting Started |
72 | 66 |
|
73 | 67 | ```bash |
74 | | -# 安裝 |
75 | 68 | pnpm install |
76 | | - |
77 | | -# 開發 |
78 | 69 | pnpm dev |
79 | | - |
80 | | -# 開啟 http://localhost:3000/ai |
| 70 | +# Open http://127.0.0.1:3200 |
81 | 71 | ``` |
82 | 72 |
|
83 | | -## 與 CLI 的關係 |
84 | | - |
85 | | -CC-Hub **不取代** Claude Code CLI,而是互補: |
86 | | - |
87 | | -| 場景 | 用什麼 | |
88 | | -|------|--------| |
89 | | -| 寫 code、pair programming | CLI(在 terminal 最順) | |
90 | | -| 找舊對話、管理 sessions | CC-Hub | |
91 | | -| 刪除 / 整理 | CC-Hub | |
92 | | -| 快速開始新專案 | 都可以 | |
| 73 | +The auth token is printed to the console on startup for programmatic access (curl, scripts). |
93 | 74 |
|
94 | | -**同步機制**:兩邊讀寫同一批 `.jsonl` 檔案,天然同步。 |
| 75 | +## Relationship with Claude Code CLI |
95 | 76 |
|
96 | | -## Roadmap |
| 77 | +CC Hub **complements** the CLI — it doesn't replace it. |
97 | 78 |
|
98 | | -### Phase 1: Core(目前) |
99 | | -- [x] Session list |
100 | | -- [x] Resume session |
101 | | -- [x] Delete + Trash |
102 | | -- [ ] New session |
103 | | -- [ ] Search |
| 79 | +| Scenario | Use | |
| 80 | +|----------|-----| |
| 81 | +| Coding, pair programming | CLI (native terminal experience) | |
| 82 | +| Finding old conversations | CC Hub | |
| 83 | +| Managing sessions, bulk cleanup | CC Hub | |
| 84 | +| Editing config files | CC Hub or CLI | |
104 | 85 |
|
105 | | -### Phase 2: Organization |
106 | | -- [ ] Project grouping |
107 | | -- [ ] Session rename |
108 | | -- [ ] Tags / favorites |
| 86 | +Both read/write the same `~/.claude/` files — naturally in sync. |
109 | 87 |
|
110 | | -### Phase 3: Insights |
111 | | -- [ ] Token usage stats |
112 | | -- [ ] Cost estimation |
113 | | -- [ ] Conversation export |
| 88 | +## Security |
114 | 89 |
|
115 | | -### Phase 4: Collaboration(未定) |
116 | | -- [ ] Share session(read-only link) |
117 | | -- [ ] Team workspace |
| 90 | +- All `/api/**` routes require authentication (cookie or Bearer token) |
| 91 | +- Path traversal protection via `resolveClaudePath` + `safeJoin` + `assertSafeSegment` |
| 92 | +- Error messages sanitized (no filesystem path leakage) |
| 93 | +- `gray-matter` JS eval engine disabled |
| 94 | +- Agent SDK env vars restricted to safe allowlist |
| 95 | +- CORS disabled on API routes |
118 | 96 |
|
119 | 97 | ## License |
120 | 98 |
|
|
0 commit comments