@epiphytic/claudecodeui 1.0.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/LICENSE +675 -0
- package/README.md +414 -0
- package/dist/api-docs.html +879 -0
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/index-DfR9xEkp.css +32 -0
- package/dist/assets/index-DvlVn6Eb.js +1231 -0
- package/dist/assets/vendor-codemirror-CJLzwpLB.js +39 -0
- package/dist/assets/vendor-react-DcyRfQm3.js +59 -0
- package/dist/assets/vendor-xterm-DfaPXD3y.js +66 -0
- package/dist/clear-cache.html +85 -0
- package/dist/convert-icons.md +53 -0
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +9 -0
- package/dist/generate-icons.js +49 -0
- package/dist/icons/claude-ai-icon.svg +1 -0
- package/dist/icons/codex-white.svg +3 -0
- package/dist/icons/codex.svg +3 -0
- package/dist/icons/cursor-white.svg +12 -0
- package/dist/icons/cursor.svg +1 -0
- package/dist/icons/generate-icons.md +19 -0
- package/dist/icons/icon-128x128.png +0 -0
- package/dist/icons/icon-128x128.svg +12 -0
- package/dist/icons/icon-144x144.png +0 -0
- package/dist/icons/icon-144x144.svg +12 -0
- package/dist/icons/icon-152x152.png +0 -0
- package/dist/icons/icon-152x152.svg +12 -0
- package/dist/icons/icon-192x192.png +0 -0
- package/dist/icons/icon-192x192.svg +12 -0
- package/dist/icons/icon-384x384.png +0 -0
- package/dist/icons/icon-384x384.svg +12 -0
- package/dist/icons/icon-512x512.png +0 -0
- package/dist/icons/icon-512x512.svg +12 -0
- package/dist/icons/icon-72x72.png +0 -0
- package/dist/icons/icon-72x72.svg +12 -0
- package/dist/icons/icon-96x96.png +0 -0
- package/dist/icons/icon-96x96.svg +12 -0
- package/dist/icons/icon-template.svg +12 -0
- package/dist/index.html +52 -0
- package/dist/logo-128.png +0 -0
- package/dist/logo-256.png +0 -0
- package/dist/logo-32.png +0 -0
- package/dist/logo-512.png +0 -0
- package/dist/logo-64.png +0 -0
- package/dist/logo.svg +17 -0
- package/dist/manifest.json +61 -0
- package/dist/screenshots/cli-selection.png +0 -0
- package/dist/screenshots/desktop-main.png +0 -0
- package/dist/screenshots/mobile-chat.png +0 -0
- package/dist/screenshots/tools-modal.png +0 -0
- package/dist/sw.js +107 -0
- package/package.json +120 -0
- package/server/claude-sdk.js +721 -0
- package/server/cli.js +469 -0
- package/server/cursor-cli.js +267 -0
- package/server/database/db.js +554 -0
- package/server/database/init.sql +54 -0
- package/server/index.js +2120 -0
- package/server/middleware/auth.js +161 -0
- package/server/openai-codex.js +389 -0
- package/server/orchestrator/client.js +989 -0
- package/server/orchestrator/github-auth.js +308 -0
- package/server/orchestrator/index.js +216 -0
- package/server/orchestrator/protocol.js +299 -0
- package/server/orchestrator/proxy.js +364 -0
- package/server/orchestrator/status-tracker.js +226 -0
- package/server/projects.js +1604 -0
- package/server/routes/agent.js +1230 -0
- package/server/routes/auth.js +135 -0
- package/server/routes/cli-auth.js +341 -0
- package/server/routes/codex.js +345 -0
- package/server/routes/commands.js +521 -0
- package/server/routes/cursor.js +795 -0
- package/server/routes/git.js +1128 -0
- package/server/routes/mcp-utils.js +48 -0
- package/server/routes/mcp.js +650 -0
- package/server/routes/projects.js +378 -0
- package/server/routes/settings.js +178 -0
- package/server/routes/taskmaster.js +1963 -0
- package/server/routes/user.js +106 -0
- package/server/utils/commandParser.js +303 -0
- package/server/utils/gitConfig.js +24 -0
- package/server/utils/mcp-detector.js +198 -0
- package/server/utils/taskmaster-websocket.js +129 -0
- package/shared/modelConstants.js +65 -0
package/server/cli.js
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code UI CLI
|
|
4
|
+
*
|
|
5
|
+
* Provides command-line utilities for managing Claude Code UI
|
|
6
|
+
*
|
|
7
|
+
* Commands:
|
|
8
|
+
* (no args) - Start the server (default)
|
|
9
|
+
* start - Start the server
|
|
10
|
+
* status - Show configuration and data locations
|
|
11
|
+
* help - Show help information
|
|
12
|
+
* version - Show version information
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import fs from "fs";
|
|
16
|
+
import path from "path";
|
|
17
|
+
import os from "os";
|
|
18
|
+
import { fileURLToPath } from "url";
|
|
19
|
+
import { dirname } from "path";
|
|
20
|
+
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = dirname(__filename);
|
|
23
|
+
|
|
24
|
+
// ANSI color codes for terminal output
|
|
25
|
+
const colors = {
|
|
26
|
+
reset: "\x1b[0m",
|
|
27
|
+
bright: "\x1b[1m",
|
|
28
|
+
dim: "\x1b[2m",
|
|
29
|
+
|
|
30
|
+
// Foreground colors
|
|
31
|
+
cyan: "\x1b[36m",
|
|
32
|
+
green: "\x1b[32m",
|
|
33
|
+
yellow: "\x1b[33m",
|
|
34
|
+
blue: "\x1b[34m",
|
|
35
|
+
magenta: "\x1b[35m",
|
|
36
|
+
white: "\x1b[37m",
|
|
37
|
+
gray: "\x1b[90m",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Helper to colorize text
|
|
41
|
+
const c = {
|
|
42
|
+
info: (text) => `${colors.cyan}${text}${colors.reset}`,
|
|
43
|
+
ok: (text) => `${colors.green}${text}${colors.reset}`,
|
|
44
|
+
warn: (text) => `${colors.yellow}${text}${colors.reset}`,
|
|
45
|
+
error: (text) => `${colors.yellow}${text}${colors.reset}`,
|
|
46
|
+
tip: (text) => `${colors.blue}${text}${colors.reset}`,
|
|
47
|
+
bright: (text) => `${colors.bright}${text}${colors.reset}`,
|
|
48
|
+
dim: (text) => `${colors.dim}${text}${colors.reset}`,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Load package.json for version info
|
|
52
|
+
const packageJsonPath = path.join(__dirname, "../package.json");
|
|
53
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
54
|
+
|
|
55
|
+
// Load environment variables from .env file if it exists
|
|
56
|
+
function loadEnvFile() {
|
|
57
|
+
try {
|
|
58
|
+
const envPath = path.join(__dirname, "../.env");
|
|
59
|
+
const envFile = fs.readFileSync(envPath, "utf8");
|
|
60
|
+
envFile.split("\n").forEach((line) => {
|
|
61
|
+
const trimmedLine = line.trim();
|
|
62
|
+
if (trimmedLine && !trimmedLine.startsWith("#")) {
|
|
63
|
+
const [key, ...valueParts] = trimmedLine.split("=");
|
|
64
|
+
if (key && valueParts.length > 0 && !process.env[key]) {
|
|
65
|
+
process.env[key] = valueParts.join("=").trim();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
} catch (e) {
|
|
70
|
+
// .env file is optional
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Get the database path (same logic as db.js)
|
|
75
|
+
function getDatabasePath() {
|
|
76
|
+
loadEnvFile();
|
|
77
|
+
return (
|
|
78
|
+
process.env.DATABASE_PATH || path.join(__dirname, "database", "auth.db")
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Get the installation directory
|
|
83
|
+
function getInstallDir() {
|
|
84
|
+
return path.join(__dirname, "..");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Show status command
|
|
88
|
+
function showStatus() {
|
|
89
|
+
console.log(`\n${c.bright("Claude Code UI - Status")}\n`);
|
|
90
|
+
console.log(c.dim("═".repeat(60)));
|
|
91
|
+
|
|
92
|
+
// Version info
|
|
93
|
+
console.log(
|
|
94
|
+
`\n${c.info("[INFO]")} Version: ${c.bright(packageJson.version)}`,
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Installation location
|
|
98
|
+
const installDir = getInstallDir();
|
|
99
|
+
console.log(`\n${c.info("[INFO]")} Installation Directory:`);
|
|
100
|
+
console.log(` ${c.dim(installDir)}`);
|
|
101
|
+
|
|
102
|
+
// Database location
|
|
103
|
+
const dbPath = getDatabasePath();
|
|
104
|
+
const dbExists = fs.existsSync(dbPath);
|
|
105
|
+
console.log(`\n${c.info("[INFO]")} Database Location:`);
|
|
106
|
+
console.log(` ${c.dim(dbPath)}`);
|
|
107
|
+
console.log(
|
|
108
|
+
` Status: ${dbExists ? c.ok("[OK] Exists") : c.warn("[WARN] Not created yet (will be created on first run)")}`,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
if (dbExists) {
|
|
112
|
+
const stats = fs.statSync(dbPath);
|
|
113
|
+
console.log(
|
|
114
|
+
` Size: ${c.dim((stats.size / 1024).toFixed(2) + " KB")}`,
|
|
115
|
+
);
|
|
116
|
+
console.log(` Modified: ${c.dim(stats.mtime.toLocaleString())}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Environment variables
|
|
120
|
+
console.log(`\n${c.info("[INFO]")} Configuration:`);
|
|
121
|
+
console.log(
|
|
122
|
+
` PORT: ${c.bright(process.env.PORT || "3001")} ${c.dim(process.env.PORT ? "" : "(default)")}`,
|
|
123
|
+
);
|
|
124
|
+
console.log(
|
|
125
|
+
` DATABASE_PATH: ${c.dim(process.env.DATABASE_PATH || "(using default location)")}`,
|
|
126
|
+
);
|
|
127
|
+
console.log(
|
|
128
|
+
` CLAUDE_CLI_PATH: ${c.dim(process.env.CLAUDE_CLI_PATH || "claude (default)")}`,
|
|
129
|
+
);
|
|
130
|
+
console.log(
|
|
131
|
+
` CONTEXT_WINDOW: ${c.dim(process.env.CONTEXT_WINDOW || "160000 (default)")}`,
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
// Orchestrator configuration
|
|
135
|
+
console.log(`\n${c.info("[INFO]")} Orchestrator Configuration:`);
|
|
136
|
+
const orchestratorMode = process.env.ORCHESTRATOR_MODE || "standalone";
|
|
137
|
+
console.log(
|
|
138
|
+
` ORCHESTRATOR_MODE: ${orchestratorMode === "client" ? c.bright(orchestratorMode) : c.dim(orchestratorMode)}`,
|
|
139
|
+
);
|
|
140
|
+
if (orchestratorMode === "client") {
|
|
141
|
+
console.log(
|
|
142
|
+
` ORCHESTRATOR_URL: ${c.dim(process.env.ORCHESTRATOR_URL || "(not set)")}`,
|
|
143
|
+
);
|
|
144
|
+
console.log(
|
|
145
|
+
` ORCHESTRATOR_TOKEN: ${process.env.ORCHESTRATOR_TOKEN ? c.ok("[configured]") : c.warn("(not set)")}`,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
// GitHub pass-through auth configuration
|
|
149
|
+
const githubOrg = process.env.ORCHESTRATOR_GITHUB_ORG;
|
|
150
|
+
const githubTeam = process.env.ORCHESTRATOR_GITHUB_TEAM;
|
|
151
|
+
const githubUsers = process.env.ORCHESTRATOR_GITHUB_USERS;
|
|
152
|
+
const hasGitHubAuth = githubOrg || githubTeam || githubUsers;
|
|
153
|
+
|
|
154
|
+
console.log(`\n${c.info("[INFO]")} Pass-through Authentication:`);
|
|
155
|
+
if (hasGitHubAuth) {
|
|
156
|
+
if (githubOrg) {
|
|
157
|
+
console.log(` GITHUB_ORG: ${c.bright(githubOrg)}`);
|
|
158
|
+
}
|
|
159
|
+
if (githubTeam) {
|
|
160
|
+
console.log(` GITHUB_TEAM: ${c.bright(githubTeam)}`);
|
|
161
|
+
}
|
|
162
|
+
if (githubUsers) {
|
|
163
|
+
console.log(` GITHUB_USERS: ${c.bright(githubUsers)}`);
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
console.log(
|
|
167
|
+
` ${c.warn("(not configured - requests will not require user validation)")}`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Claude projects folder
|
|
173
|
+
const claudeProjectsPath = path.join(os.homedir(), ".claude", "projects");
|
|
174
|
+
const projectsExists = fs.existsSync(claudeProjectsPath);
|
|
175
|
+
console.log(`\n${c.info("[INFO]")} Claude Projects Folder:`);
|
|
176
|
+
console.log(` ${c.dim(claudeProjectsPath)}`);
|
|
177
|
+
console.log(
|
|
178
|
+
` Status: ${projectsExists ? c.ok("[OK] Exists") : c.warn("[WARN] Not found")}`,
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
// Config file location
|
|
182
|
+
const envFilePath = path.join(__dirname, "../.env");
|
|
183
|
+
const envExists = fs.existsSync(envFilePath);
|
|
184
|
+
console.log(`\n${c.info("[INFO]")} Configuration File:`);
|
|
185
|
+
console.log(` ${c.dim(envFilePath)}`);
|
|
186
|
+
console.log(
|
|
187
|
+
` Status: ${envExists ? c.ok("[OK] Exists") : c.warn("[WARN] Not found (using defaults)")}`,
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
console.log("\n" + c.dim("═".repeat(60)));
|
|
191
|
+
console.log(`\n${c.tip("[TIP]")} Hints:`);
|
|
192
|
+
console.log(
|
|
193
|
+
` ${c.dim(">")} Use ${c.bright("cloudcli --port 8080")} to run on a custom port`,
|
|
194
|
+
);
|
|
195
|
+
console.log(
|
|
196
|
+
` ${c.dim(">")} Use ${c.bright("cloudcli --database-path /path/to/db")} for custom database`,
|
|
197
|
+
);
|
|
198
|
+
console.log(
|
|
199
|
+
` ${c.dim(">")} Run ${c.bright("cloudcli help")} for all options`,
|
|
200
|
+
);
|
|
201
|
+
console.log(
|
|
202
|
+
` ${c.dim(">")} Access the UI at http://localhost:${process.env.PORT || "3001"}\n`,
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Show help
|
|
207
|
+
function showHelp() {
|
|
208
|
+
console.log(`
|
|
209
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
210
|
+
║ Claude Code UI - Command Line Tool ║
|
|
211
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
212
|
+
|
|
213
|
+
Usage:
|
|
214
|
+
claude-code-ui [command] [options]
|
|
215
|
+
cloudcli [command] [options]
|
|
216
|
+
|
|
217
|
+
Commands:
|
|
218
|
+
start Start the Claude Code UI server (default)
|
|
219
|
+
status Show configuration and data locations
|
|
220
|
+
update Update to the latest version
|
|
221
|
+
help Show this help information
|
|
222
|
+
version Show version information
|
|
223
|
+
|
|
224
|
+
Options:
|
|
225
|
+
-p, --port <port> Set server port (default: 3001)
|
|
226
|
+
--database-path <path> Set custom database location
|
|
227
|
+
--orchestrator-mode <mode> Set orchestrator mode (standalone|client)
|
|
228
|
+
--orchestrator-url <url> Orchestrator WebSocket URL
|
|
229
|
+
--orchestrator-token <tok> Orchestrator authentication token
|
|
230
|
+
--github-org <org> Allow GitHub org members (pass-through auth)
|
|
231
|
+
--github-team <org/team> Allow GitHub team members (pass-through auth)
|
|
232
|
+
--github-users <users> Allow specific GitHub users (comma-separated)
|
|
233
|
+
-h, --help Show this help information
|
|
234
|
+
-v, --version Show version information
|
|
235
|
+
|
|
236
|
+
Examples:
|
|
237
|
+
$ cloudcli # Start with defaults
|
|
238
|
+
$ cloudcli --port 8080 # Start on port 8080
|
|
239
|
+
$ cloudcli -p 3000 # Short form for port
|
|
240
|
+
$ cloudcli start --port 4000 # Explicit start command
|
|
241
|
+
$ cloudcli status # Show configuration
|
|
242
|
+
|
|
243
|
+
# Orchestrator client mode with GitHub org auth:
|
|
244
|
+
$ cloudcli --orchestrator-mode client \\
|
|
245
|
+
--orchestrator-url wss://orchestrator.example.com/ws/connect \\
|
|
246
|
+
--orchestrator-token YOUR_TOKEN \\
|
|
247
|
+
--github-org your-org-name
|
|
248
|
+
|
|
249
|
+
Environment Variables:
|
|
250
|
+
PORT Set server port (default: 3001)
|
|
251
|
+
DATABASE_PATH Set custom database location
|
|
252
|
+
CLAUDE_CLI_PATH Set custom Claude CLI path
|
|
253
|
+
CONTEXT_WINDOW Set context window size (default: 160000)
|
|
254
|
+
ORCHESTRATOR_MODE Orchestrator mode: standalone | client
|
|
255
|
+
ORCHESTRATOR_URL Orchestrator WebSocket URL (for client mode)
|
|
256
|
+
ORCHESTRATOR_TOKEN Orchestrator authentication token
|
|
257
|
+
ORCHESTRATOR_GITHUB_ORG Allow users from this GitHub organization
|
|
258
|
+
ORCHESTRATOR_GITHUB_TEAM Allow users from this GitHub team (org/team)
|
|
259
|
+
ORCHESTRATOR_GITHUB_USERS Allow specific GitHub usernames (comma-separated)
|
|
260
|
+
|
|
261
|
+
Documentation:
|
|
262
|
+
${packageJson.homepage || "https://github.com/siteboon/claudecodeui"}
|
|
263
|
+
|
|
264
|
+
Report Issues:
|
|
265
|
+
${packageJson.bugs?.url || "https://github.com/siteboon/claudecodeui/issues"}
|
|
266
|
+
`);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Show version
|
|
270
|
+
function showVersion() {
|
|
271
|
+
console.log(`${packageJson.version}`);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Compare semver versions, returns true if v1 > v2
|
|
275
|
+
function isNewerVersion(v1, v2) {
|
|
276
|
+
const parts1 = v1.split(".").map(Number);
|
|
277
|
+
const parts2 = v2.split(".").map(Number);
|
|
278
|
+
for (let i = 0; i < 3; i++) {
|
|
279
|
+
if (parts1[i] > parts2[i]) return true;
|
|
280
|
+
if (parts1[i] < parts2[i]) return false;
|
|
281
|
+
}
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Check for updates
|
|
286
|
+
async function checkForUpdates(silent = false) {
|
|
287
|
+
try {
|
|
288
|
+
const { execSync } = await import("child_process");
|
|
289
|
+
const latestVersion = execSync(
|
|
290
|
+
"npm show @siteboon/claude-code-ui version",
|
|
291
|
+
{ encoding: "utf8" },
|
|
292
|
+
).trim();
|
|
293
|
+
const currentVersion = packageJson.version;
|
|
294
|
+
|
|
295
|
+
if (isNewerVersion(latestVersion, currentVersion)) {
|
|
296
|
+
console.log(
|
|
297
|
+
`\n${c.warn("[UPDATE]")} New version available: ${c.bright(latestVersion)} (current: ${currentVersion})`,
|
|
298
|
+
);
|
|
299
|
+
console.log(` Run ${c.bright("cloudcli update")} to update\n`);
|
|
300
|
+
return { hasUpdate: true, latestVersion, currentVersion };
|
|
301
|
+
} else if (!silent) {
|
|
302
|
+
console.log(
|
|
303
|
+
`${c.ok("[OK]")} You are on the latest version (${currentVersion})`,
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
return { hasUpdate: false, latestVersion, currentVersion };
|
|
307
|
+
} catch (e) {
|
|
308
|
+
if (!silent) {
|
|
309
|
+
console.log(`${c.warn("[WARN]")} Could not check for updates`);
|
|
310
|
+
}
|
|
311
|
+
return { hasUpdate: false, error: e.message };
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Update the package
|
|
316
|
+
async function updatePackage() {
|
|
317
|
+
try {
|
|
318
|
+
const { execSync } = await import("child_process");
|
|
319
|
+
console.log(`${c.info("[INFO]")} Checking for updates...`);
|
|
320
|
+
|
|
321
|
+
const { hasUpdate, latestVersion, currentVersion } =
|
|
322
|
+
await checkForUpdates(true);
|
|
323
|
+
|
|
324
|
+
if (!hasUpdate) {
|
|
325
|
+
console.log(
|
|
326
|
+
`${c.ok("[OK]")} Already on the latest version (${currentVersion})`,
|
|
327
|
+
);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
console.log(
|
|
332
|
+
`${c.info("[INFO]")} Updating from ${currentVersion} to ${latestVersion}...`,
|
|
333
|
+
);
|
|
334
|
+
execSync("npm update -g @siteboon/claude-code-ui", { stdio: "inherit" });
|
|
335
|
+
console.log(
|
|
336
|
+
`${c.ok("[OK]")} Update complete! Restart cloudcli to use the new version.`,
|
|
337
|
+
);
|
|
338
|
+
} catch (e) {
|
|
339
|
+
console.error(`${c.error("[ERROR]")} Update failed: ${e.message}`);
|
|
340
|
+
console.log(
|
|
341
|
+
`${c.tip("[TIP]")} Try running manually: npm update -g @siteboon/claude-code-ui`,
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Start the server
|
|
347
|
+
async function startServer() {
|
|
348
|
+
// Check for updates silently on startup
|
|
349
|
+
checkForUpdates(true);
|
|
350
|
+
|
|
351
|
+
// Import and run the server
|
|
352
|
+
await import("./index.js");
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Parse CLI arguments
|
|
356
|
+
function parseArgs(args) {
|
|
357
|
+
const parsed = { command: "start", options: {} };
|
|
358
|
+
|
|
359
|
+
for (let i = 0; i < args.length; i++) {
|
|
360
|
+
const arg = args[i];
|
|
361
|
+
|
|
362
|
+
if (arg === "--port" || arg === "-p") {
|
|
363
|
+
parsed.options.port = args[++i];
|
|
364
|
+
} else if (arg.startsWith("--port=")) {
|
|
365
|
+
parsed.options.port = arg.split("=")[1];
|
|
366
|
+
} else if (arg === "--database-path") {
|
|
367
|
+
parsed.options.databasePath = args[++i];
|
|
368
|
+
} else if (arg.startsWith("--database-path=")) {
|
|
369
|
+
parsed.options.databasePath = arg.split("=")[1];
|
|
370
|
+
} else if (arg === "--orchestrator-mode") {
|
|
371
|
+
parsed.options.orchestratorMode = args[++i];
|
|
372
|
+
} else if (arg.startsWith("--orchestrator-mode=")) {
|
|
373
|
+
parsed.options.orchestratorMode = arg.split("=")[1];
|
|
374
|
+
} else if (arg === "--orchestrator-url") {
|
|
375
|
+
parsed.options.orchestratorUrl = args[++i];
|
|
376
|
+
} else if (arg.startsWith("--orchestrator-url=")) {
|
|
377
|
+
parsed.options.orchestratorUrl = arg.split("=")[1];
|
|
378
|
+
} else if (arg === "--orchestrator-token") {
|
|
379
|
+
parsed.options.orchestratorToken = args[++i];
|
|
380
|
+
} else if (arg.startsWith("--orchestrator-token=")) {
|
|
381
|
+
parsed.options.orchestratorToken = arg.split("=")[1];
|
|
382
|
+
} else if (arg === "--github-org") {
|
|
383
|
+
parsed.options.githubOrg = args[++i];
|
|
384
|
+
} else if (arg.startsWith("--github-org=")) {
|
|
385
|
+
parsed.options.githubOrg = arg.split("=")[1];
|
|
386
|
+
} else if (arg === "--github-team") {
|
|
387
|
+
parsed.options.githubTeam = args[++i];
|
|
388
|
+
} else if (arg.startsWith("--github-team=")) {
|
|
389
|
+
parsed.options.githubTeam = arg.split("=")[1];
|
|
390
|
+
} else if (arg === "--github-users") {
|
|
391
|
+
parsed.options.githubUsers = args[++i];
|
|
392
|
+
} else if (arg.startsWith("--github-users=")) {
|
|
393
|
+
parsed.options.githubUsers = arg.split("=")[1];
|
|
394
|
+
} else if (arg === "--help" || arg === "-h") {
|
|
395
|
+
parsed.command = "help";
|
|
396
|
+
} else if (arg === "--version" || arg === "-v") {
|
|
397
|
+
parsed.command = "version";
|
|
398
|
+
} else if (!arg.startsWith("-")) {
|
|
399
|
+
parsed.command = arg;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return parsed;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// Main CLI handler
|
|
407
|
+
async function main() {
|
|
408
|
+
const args = process.argv.slice(2);
|
|
409
|
+
const { command, options } = parseArgs(args);
|
|
410
|
+
|
|
411
|
+
// Apply CLI options to environment variables
|
|
412
|
+
if (options.port) {
|
|
413
|
+
process.env.PORT = options.port;
|
|
414
|
+
}
|
|
415
|
+
if (options.databasePath) {
|
|
416
|
+
process.env.DATABASE_PATH = options.databasePath;
|
|
417
|
+
}
|
|
418
|
+
if (options.orchestratorMode) {
|
|
419
|
+
process.env.ORCHESTRATOR_MODE = options.orchestratorMode;
|
|
420
|
+
}
|
|
421
|
+
if (options.orchestratorUrl) {
|
|
422
|
+
process.env.ORCHESTRATOR_URL = options.orchestratorUrl;
|
|
423
|
+
}
|
|
424
|
+
if (options.orchestratorToken) {
|
|
425
|
+
process.env.ORCHESTRATOR_TOKEN = options.orchestratorToken;
|
|
426
|
+
}
|
|
427
|
+
if (options.githubOrg) {
|
|
428
|
+
process.env.ORCHESTRATOR_GITHUB_ORG = options.githubOrg;
|
|
429
|
+
}
|
|
430
|
+
if (options.githubTeam) {
|
|
431
|
+
process.env.ORCHESTRATOR_GITHUB_TEAM = options.githubTeam;
|
|
432
|
+
}
|
|
433
|
+
if (options.githubUsers) {
|
|
434
|
+
process.env.ORCHESTRATOR_GITHUB_USERS = options.githubUsers;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
switch (command) {
|
|
438
|
+
case "start":
|
|
439
|
+
await startServer();
|
|
440
|
+
break;
|
|
441
|
+
case "status":
|
|
442
|
+
case "info":
|
|
443
|
+
showStatus();
|
|
444
|
+
break;
|
|
445
|
+
case "help":
|
|
446
|
+
case "-h":
|
|
447
|
+
case "--help":
|
|
448
|
+
showHelp();
|
|
449
|
+
break;
|
|
450
|
+
case "version":
|
|
451
|
+
case "-v":
|
|
452
|
+
case "--version":
|
|
453
|
+
showVersion();
|
|
454
|
+
break;
|
|
455
|
+
case "update":
|
|
456
|
+
await updatePackage();
|
|
457
|
+
break;
|
|
458
|
+
default:
|
|
459
|
+
console.error(`\n❌ Unknown command: ${command}`);
|
|
460
|
+
console.log(' Run "cloudcli help" for usage information.\n');
|
|
461
|
+
process.exit(1);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Run the CLI
|
|
466
|
+
main().catch((error) => {
|
|
467
|
+
console.error("\n❌ Error:", error.message);
|
|
468
|
+
process.exit(1);
|
|
469
|
+
});
|