claude-remote-cli 1.4.0 → 1.4.1

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.
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs';
4
+ import { execFile } from 'node:child_process';
5
+ import { promisify } from 'node:util';
4
6
  import { fileURLToPath } from 'node:url';
5
7
  import * as service from '../server/service.js';
6
8
  import { DEFAULTS } from '../server/config.js';
9
+ const execFileAsync = promisify(execFile);
7
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
11
  // Parse CLI flags
9
12
  const args = process.argv.slice(2);
@@ -12,6 +15,7 @@ if (args.includes('--help') || args.includes('-h')) {
12
15
  claude-remote-cli <command>
13
16
 
14
17
  Commands:
18
+ update Update to the latest version from npm
15
19
  install Install as a background service (survives reboot)
16
20
  uninstall Stop and remove the background service
17
21
  status Show whether the service is running
@@ -53,6 +57,36 @@ function runServiceCommand(fn) {
53
57
  process.exit(0);
54
58
  }
55
59
  const command = args[0];
60
+ if (command === 'update') {
61
+ try {
62
+ const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'));
63
+ console.log(`Current version: ${pkg.version}`);
64
+ console.log('Updating claude-remote-cli...');
65
+ await execFileAsync('npm', ['install', '-g', 'claude-remote-cli@latest']);
66
+ const updatedPkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf-8'));
67
+ if (updatedPkg.version === pkg.version) {
68
+ console.log(`Already on the latest version (${pkg.version}).`);
69
+ }
70
+ else {
71
+ console.log(`Updated to ${updatedPkg.version}.`);
72
+ if (service.isInstalled()) {
73
+ console.log('Background service detected — restarting...');
74
+ service.uninstall();
75
+ service.install({
76
+ configPath: resolveConfigPath(),
77
+ port: getArg('--port') ?? String(DEFAULTS.port),
78
+ host: getArg('--host') ?? DEFAULTS.host,
79
+ });
80
+ console.log('Service restarted.');
81
+ }
82
+ }
83
+ }
84
+ catch (e) {
85
+ console.error('Update failed:', e.message);
86
+ process.exit(1);
87
+ }
88
+ process.exit(0);
89
+ }
56
90
  if (command === 'install' || command === 'uninstall' || command === 'status' || args.includes('--bg')) {
57
91
  if (command === 'uninstall') {
58
92
  runServiceCommand(() => { service.uninstall(); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-remote-cli",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Remote web interface for Claude Code CLI sessions",
5
5
  "type": "module",
6
6
  "main": "dist/server/index.js",