xkat-cli 2.0.14 → 2.0.16

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,7 +1,7 @@
1
1
  {
2
- "xkat-agent-macos-aarch64": "4fbdb35672b2238bef6c610c60397d31d5081a93f80cf19696628d77e471dfd6",
3
- "xkat-agent-macos-x64": "5f219b9d640d2123e7f25df59cfbeb0a38f9c7f605ba5b53f0b892fc953c99b8",
4
- "xkat-agent-linux-x64": "4befdcb1c3b4c6e52bb2fcaf81e49071dace00b41e49d2abff2c55bf3114c845",
5
- "xkat-agent-linux-aarch64": "ea064e042f57247ff2a3dd5f9ec186f055824c02b854e7e694f0cc1c3a87b222",
6
- "xkat-agent-win-x64.exe": "77855811d43e0f173ac10aa8665f557833e81b1fcd4e9941f641c7d020677921"
2
+ "xkat-agent-macos-aarch64": "25c4d1d21981960f54a903f03bacfac4541ec6c0488299f21408e1be4d9d0cba",
3
+ "xkat-agent-macos-x64": "12e129862a0a3db9f1f3ab3a9053fdaa50f48683e2118c8197cca92a159fb353",
4
+ "xkat-agent-linux-x64": "2371ac2540cf1f996e436846b6cc5fb592d9034f3d0cf2c4c525f41f719d83f7",
5
+ "xkat-agent-linux-aarch64": "1c65926c101ede43154abaec99a0614664806bf7f3a8dcd359a2f73a4b65203b",
6
+ "xkat-agent-win-x64.exe": "67071b9cb027ca1c589110c1c1dbab23ebdf5530a8f04c14f2a2ccbea14ae3c9"
7
7
  }
package/bin/xkat-cli.js CHANGED
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ process.env.NODE_NO_WARNINGS = '1';
4
+
3
5
  /**
4
6
  * xkat-cli.js
5
7
  * Lightweight CLI entry point for `npx -y xkat-cli@latest`.
6
- * Launches the live local agent bridge in the foreground by default,
8
+ * Launches the live local agent bridge in the background by default,
7
9
  * connecting your browser to your local environment with zero manual configuration.
8
10
  */
9
11
  const { spawnSync } = require('child_process');
@@ -49,35 +51,51 @@ const binaryPath = candidatePaths.find((p) => fs.existsSync(p));
49
51
  const args = process.argv.slice(2);
50
52
  const subCmd = args.join(' ').trim();
51
53
 
52
- // ── 1. Zero-Touch Port 10022 Cleanup Command ──
54
+ // ── 1. Zero-Touch Port 38000..38050 & 10022 Cleanup Command ──
53
55
  if (subCmd === 'down' || subCmd === 'stop' || subCmd === 'kill' || subCmd === 'clean') {
54
- console.log('🛑 Cleaning up port 10022 and stopping existing xkat agent instances...');
56
+ console.log('🛑 Cleaning up agent ports (38000..38050, 10022) and stopping existing xkat agent instances...');
55
57
  if (os.platform() === 'win32') {
56
58
  spawnSync('powershell', [
57
59
  '-NoProfile',
58
60
  '-NonInteractive',
59
61
  '-Command',
60
- 'Get-NetTCPConnection -LocalPort 10022 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique | Where-Object { $_ -gt 0 } | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }; Get-Process -Name xkat-agent*, xkat* -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue'
62
+ '38000..38050 + @(10022) | ForEach-Object { Get-NetTCPConnection -LocalPort $_ -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique | Where-Object { $_ -gt 0 } | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue } }; Get-Process -Name xkat-agent*, xkat* -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue'
61
63
  ], { stdio: 'inherit' });
62
64
  } else {
63
- spawnSync('sh', ['-c', 'fuser -k 10022/tcp 2>/dev/null || true; pgrep -f "xkat-agent" | xargs -r kill -9 2>/dev/null || true'], { stdio: 'inherit' });
65
+ spawnSync('sh', ['-c', 'fuser -k 38000-38050/tcp 2>/dev/null || true; fuser -k 10022/tcp 2>/dev/null || true; pgrep -f "xkat-agent" | xargs -r kill -9 2>/dev/null || true'], { stdio: 'inherit' });
64
66
  }
65
- console.log('✅ Port 10022 is now completely free.');
67
+ console.log('✅ Agent ports are now completely free.');
66
68
  process.exit(0);
67
69
  }
68
70
 
71
+ function getMultipassCmd() {
72
+ if (os.platform() === 'win32') {
73
+ const candidates = [
74
+ 'multipass',
75
+ path.join(process.env.ProgramFiles || 'C:\\Program Files', 'Multipass', 'bin', 'multipass.exe'),
76
+ path.join(process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'Multipass', 'bin', 'multipass.exe'),
77
+ path.join(process.env.LOCALAPPDATA || '', 'Programs', 'Multipass', 'bin', 'multipass.exe'),
78
+ ];
79
+ for (const c of candidates) {
80
+ if (c === 'multipass' || fs.existsSync(c)) return c;
81
+ }
82
+ }
83
+ return 'multipass';
84
+ }
85
+
69
86
  // ── 2. Fallback for Lab VM commands when native agent is not built ──
70
87
  if (!binaryPath) {
88
+ const mp = getMultipassCmd();
71
89
  if (subCmd === 'lab shell') {
72
- const result = spawnSync('multipass', ['shell', LAB_NAME], { stdio: 'inherit' });
90
+ const result = spawnSync(mp, ['shell', LAB_NAME], { stdio: 'inherit', shell: os.platform() === 'win32' });
73
91
  process.exit(result.status || 0);
74
92
  }
75
93
 
76
94
  if (subCmd === 'lab reset') {
77
95
  console.log('🔄 Resetting Lab VM...');
78
- spawnSync('multipass', ['delete', LAB_NAME, '--purge'], { stdio: 'inherit' });
96
+ spawnSync(mp, ['delete', LAB_NAME, '--purge'], { stdio: 'inherit', shell: os.platform() === 'win32' });
79
97
  console.log('🚀 Launching fresh Lab VM...');
80
- const launch = spawnSync('multipass', ['launch', '--name', LAB_NAME, '24.04', '--cpus', '2', '--memory', '2G', '--disk', '10G'], { stdio: 'inherit' });
98
+ const launch = spawnSync(mp, ['launch', '--name', LAB_NAME, '24.04', '--cpus', '2', '--memory', '2G', '--disk', '10G'], { stdio: 'inherit', shell: os.platform() === 'win32' });
81
99
  if (launch.status === 0) {
82
100
  console.log('✅ Lab reset complete.');
83
101
  console.log(' Enter: npx -y xkat-cli@latest lab shell');
@@ -88,10 +106,10 @@ if (!binaryPath) {
88
106
  }
89
107
 
90
108
  if (subCmd === 'lab up' || subCmd === 'lab install') {
91
- const info = spawnSync('multipass', ['info', LAB_NAME], { encoding: 'utf8' });
109
+ const info = spawnSync(mp, ['info', LAB_NAME], { encoding: 'utf8', shell: os.platform() === 'win32' });
92
110
  if (info.status !== 0) {
93
111
  console.log('🚀 Creating Lab VM...');
94
- const launch = spawnSync('multipass', ['launch', '--name', LAB_NAME, '24.04', '--cpus', '2', '--memory', '2G', '--disk', '10G'], { stdio: 'inherit' });
112
+ const launch = spawnSync(mp, ['launch', '--name', LAB_NAME, '24.04', '--cpus', '2', '--memory', '2G', '--disk', '10G'], { stdio: 'inherit', shell: os.platform() === 'win32' });
95
113
  process.exit(launch.status || 0);
96
114
  } else {
97
115
  console.log(`✅ Lab VM '${LAB_NAME}' already exists.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xkat-cli",
3
- "version": "2.0.14",
3
+ "version": "2.0.16",
4
4
  "description": "xkat Agent - an AI agent that securely connects your browser to your machine",
5
5
  "main": "bin/xkat-cli.js",
6
6
  "bin": {