@axhub/genie 0.1.2 → 0.1.4

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/dist/index.html CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  <!-- Prevent zoom on iOS -->
27
27
  <meta name="format-detection" content="telephone=no" />
28
- <script type="module" crossorigin src="/assets/index-DfLTVRPO.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-C_OkRKiC.js"></script>
29
29
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-C3RJLQGO.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-B88_OPWf.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-DfaPXD3y.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axhub/genie",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "server/index.js",
package/server/cli.js CHANGED
@@ -7,6 +7,7 @@
7
7
  * Commands:
8
8
  * (no args) - Start the server (default)
9
9
  * start - Start the server
10
+ * stop - Stop the running server
10
11
  * status - Show configuration and data locations
11
12
  * help - Show help information
12
13
  * version - Show version information
@@ -86,6 +87,10 @@ function getRuntimeStatusPath() {
86
87
  return process.env.CLOUDCLI_STATUS_PATH || path.join(os.homedir(), '.claude-code-ui', 'runtime-status.json');
87
88
  }
88
89
 
90
+ function sleep(ms) {
91
+ return new Promise(resolve => setTimeout(resolve, ms));
92
+ }
93
+
89
94
  function isProcessAlive(pid) {
90
95
  if (!Number.isInteger(pid) || pid <= 0) {
91
96
  return false;
@@ -128,6 +133,74 @@ function getRuntimeStatus() {
128
133
  }
129
134
  }
130
135
 
136
+ async function stopServer() {
137
+ const runtimeStatus = getRuntimeStatus();
138
+
139
+ if (!runtimeStatus.exists) {
140
+ console.log(`${c.warn('[WARN]')} Axhub Genie is not running (status file not found).`);
141
+ return;
142
+ }
143
+
144
+ if (runtimeStatus.parseError) {
145
+ console.log(`${c.warn('[WARN]')} Unable to stop server because runtime status file is unreadable.`);
146
+ console.log(`${c.dim(' ' + runtimeStatus.statusPath)}`);
147
+ return;
148
+ }
149
+
150
+ const pid = Number(runtimeStatus?.data?.pid);
151
+ if (!Number.isInteger(pid) || pid <= 0) {
152
+ console.log(`${c.warn('[WARN]')} Invalid PID in runtime status file.`);
153
+ console.log(`${c.dim(' ' + runtimeStatus.statusPath)}`);
154
+ return;
155
+ }
156
+
157
+ if (!runtimeStatus.running) {
158
+ try {
159
+ fs.unlinkSync(runtimeStatus.statusPath);
160
+ console.log(`${c.ok('[OK]')} Removed stale runtime status file.`);
161
+ } catch {
162
+ console.log(`${c.warn('[WARN]')} Runtime is not running (stale status file detected).`);
163
+ }
164
+ return;
165
+ }
166
+
167
+ if (pid === process.pid) {
168
+ console.log(`${c.warn('[WARN]')} Refusing to stop current CLI process.`);
169
+ return;
170
+ }
171
+
172
+ try {
173
+ process.kill(pid, 'SIGTERM');
174
+ } catch (error) {
175
+ console.error(`${c.error('[ERROR]')} Failed to send SIGTERM to PID ${pid}: ${error.message}`);
176
+ return;
177
+ }
178
+
179
+ const deadline = Date.now() + 5000;
180
+ while (Date.now() < deadline) {
181
+ if (!isProcessAlive(pid)) {
182
+ break;
183
+ }
184
+ await sleep(200);
185
+ }
186
+
187
+ if (isProcessAlive(pid)) {
188
+ console.error(`${c.error('[ERROR]')} Timed out waiting for PID ${pid} to stop.`);
189
+ console.log(`${c.tip('[TIP]')} You can retry or stop it manually: ${c.bright(`kill -9 ${pid}`)}`);
190
+ return;
191
+ }
192
+
193
+ try {
194
+ if (fs.existsSync(runtimeStatus.statusPath)) {
195
+ fs.unlinkSync(runtimeStatus.statusPath);
196
+ }
197
+ } catch {
198
+ // The process may have already cleaned up the status file.
199
+ }
200
+
201
+ console.log(`${c.ok('[OK]')} Axhub Genie stopped (PID ${pid}).`);
202
+ }
203
+
131
204
  function buildEndpointFromEnv(port) {
132
205
  const backendLocalUrl = process.env.BACKEND_URL || `http://localhost:${port}`;
133
206
  return {
@@ -238,9 +311,9 @@ function showStatus(options = {}) {
238
311
 
239
312
  console.log('\n' + c.dim('═'.repeat(60)));
240
313
  console.log(`\n${c.tip('[TIP]')} Hints:`);
241
- console.log(` ${c.dim('>')} Use ${c.bright('cloudcli --port 8080')} to run on a custom port`);
242
- console.log(` ${c.dim('>')} Use ${c.bright('cloudcli --database-path /path/to/db')} for custom database`);
243
- console.log(` ${c.dim('>')} Run ${c.bright('cloudcli help')} for all options`);
314
+ console.log(` ${c.dim('>')} Use ${c.bright('axhub-genie --port 8080')} to run on a custom port`);
315
+ console.log(` ${c.dim('>')} Use ${c.bright('axhub-genie --database-path /path/to/db')} for custom database`);
316
+ console.log(` ${c.dim('>')} Run ${c.bright('axhub-genie help')} for all options`);
244
317
  console.log(` ${c.dim('>')} Access the UI at http://localhost:${displayPort}\n`);
245
318
  }
246
319
 
@@ -253,10 +326,11 @@ function showHelp() {
253
326
 
254
327
  Usage:
255
328
  claude-code-ui [command] [options]
256
- cloudcli [command] [options]
329
+ axhub-genie [command] [options]
257
330
 
258
331
  Commands:
259
332
  start Start the Axhub Genie server (default)
333
+ stop Stop the running Axhub Genie server
260
334
  status Show configuration and data locations
261
335
  update Update to the latest version
262
336
  help Show this help information
@@ -270,12 +344,13 @@ Options:
270
344
  -v, --version Show version information
271
345
 
272
346
  Examples:
273
- $ cloudcli # Start with defaults
274
- $ cloudcli --port 8080 # Start on port 8080
275
- $ cloudcli -p 3000 # Short form for port
276
- $ cloudcli start --port 4000 # Explicit start command
277
- $ cloudcli status # Show configuration
278
- $ cloudcli status --json # Get machine-readable status
347
+ $ axhub-genie # Start with defaults
348
+ $ axhub-genie --port 8080 # Start on port 8080
349
+ $ axhub-genie -p 3000 # Short form for port
350
+ $ axhub-genie start --port 4000 # Explicit start command
351
+ $ axhub-genie stop # Stop running server
352
+ $ axhub-genie status # Show configuration
353
+ $ axhub-genie status --json # Get machine-readable status
279
354
 
280
355
  Environment Variables:
281
356
  PORT Set server port (default: 32123)
@@ -317,7 +392,7 @@ async function checkForUpdates(silent = false) {
317
392
 
318
393
  if (isNewerVersion(latestVersion, currentVersion)) {
319
394
  console.log(`\n${c.warn('[UPDATE]')} New version available: ${c.bright(latestVersion)} (current: ${currentVersion})`);
320
- console.log(` Run ${c.bright('cloudcli update')} to update\n`);
395
+ console.log(` Run ${c.bright('axhub-genie update')} to update\n`);
321
396
  return { hasUpdate: true, latestVersion, currentVersion };
322
397
  } else if (!silent) {
323
398
  console.log(`${c.ok('[OK]')} You are on the latest version (${currentVersion})`);
@@ -346,7 +421,7 @@ async function updatePackage() {
346
421
 
347
422
  console.log(`${c.info('[INFO]')} Updating from ${currentVersion} to ${latestVersion}...`);
348
423
  execSync('npm update -g @siteboon/claude-code-ui', { stdio: 'inherit' });
349
- console.log(`${c.ok('[OK]')} Update complete! Restart cloudcli to use the new version.`);
424
+ console.log(`${c.ok('[OK]')} Update complete! Restart axhub-genie to use the new version.`);
350
425
  } catch (e) {
351
426
  console.error(`${c.error('[ERROR]')} Update failed: ${e.message}`);
352
427
  console.log(`${c.tip('[TIP]')} Try running manually: npm update -g @siteboon/claude-code-ui`);
@@ -393,6 +468,8 @@ function parseArgs(args) {
393
468
 
394
469
  // Main CLI handler
395
470
  async function main() {
471
+ loadEnvFile();
472
+
396
473
  const args = process.argv.slice(2);
397
474
  const { command, options } = parseArgs(args);
398
475
 
@@ -412,6 +489,9 @@ async function main() {
412
489
  case 'info':
413
490
  showStatus(options);
414
491
  break;
492
+ case 'stop':
493
+ await stopServer();
494
+ break;
415
495
  case 'help':
416
496
  case '-h':
417
497
  case '--help':
@@ -427,7 +507,7 @@ async function main() {
427
507
  break;
428
508
  default:
429
509
  console.error(`\n❌ Unknown command: ${command}`);
430
- console.log(' Run "cloudcli help" for usage information.\n');
510
+ console.log(' Run "axhub-genie help" for usage information.\n');
431
511
  process.exit(1);
432
512
  }
433
513
  }
Binary file
package/server/index.js CHANGED
@@ -1925,7 +1925,7 @@ async function startServer() {
1925
1925
  console.log('');
1926
1926
  console.log(`${c.info('[INFO]')} Server URL: ${c.bright('http://0.0.0.0:' + PORT)}`);
1927
1927
  console.log(`${c.info('[INFO]')} Installed at: ${c.dim(appInstallPath)}`);
1928
- console.log(`${c.tip('[TIP]')} Run "cloudcli status" for full configuration details`);
1928
+ console.log(`${c.tip('[TIP]')} Run "axhub-genie status" for full configuration details`);
1929
1929
  console.log(`${c.info('[INFO]')} Runtime status file: ${c.dim(RUNTIME_STATUS_PATH)}`);
1930
1930
  console.log('');
1931
1931