xkat-cli 2.0.10 → 2.0.11

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": "3e6df88e8f534dd66f9a410be26cb00994b6de1747be95284b51687e5ba62f69",
3
- "xkat-agent-macos-x64": "73a6c8d12e8c26384dd5879237080f5910339a96ced93d23b18316ceb98c2ab4",
4
- "xkat-agent-linux-x64": "d4c2ace7ff9eb0edae8f600681f1c39c100b119a87842c7cd158fb2f3d53ad55",
5
- "xkat-agent-linux-aarch64": "e7a758176302b542da7169652e0b4dad9d9c7638f22ca4b39a3ad8ae32665ad0",
6
- "xkat-agent-win-x64.exe": "bfc81c226e52de7343ffa467df1e7b8885106ba37c6b544d3968d95b457e2c35"
2
+ "xkat-agent-macos-aarch64": "48409b8a9290e1b9fb5d434a7e9c544ed02d6824532a30dff060bac79c2ff289",
3
+ "xkat-agent-macos-x64": "9fcc7eb9b0fc8b492c3a971d5d514979f19f76a03efb84b2fc17dd26d6a73522",
4
+ "xkat-agent-linux-x64": "473983cfbb1595e2831d6f8d71bcc1b8ad257813408c529ee45b71bff018279e",
5
+ "xkat-agent-linux-aarch64": "9ee1f78c7897e722ee287c20391c73353b4612a9455bcd6d2ac51e71dc6ff519",
6
+ "xkat-agent-win-x64.exe": "27de16aafefb59bd0d794cdc661ef32cd9d9f3853c9da93b814897aa85e0b240"
7
7
  }
package/bin/xkat-cli.js CHANGED
@@ -5,6 +5,11 @@
5
5
  * A lightweight wrapper invoked when the user runs the `xkat` command from npm.
6
6
  * Its only job: locate the Rust binary downloaded during postinstall and hand
7
7
  * over execution to it.
8
+ *
9
+ * Fallback: When the native binary is not found, `lab shell` and `lab reset`
10
+ * commands are handled directly via multipass, since they are thin wrappers
11
+ * around `multipass shell xkat-lab` and `multipass delete/launch` respectively.
12
+ * This allows `npx xkat-cli@latest lab shell` to work without a compiled binary.
8
13
  */
9
14
  const { spawnSync } = require('child_process');
10
15
  const path = require('path');
@@ -35,15 +40,55 @@ function getBinaryName() {
35
40
  return binary;
36
41
  }
37
42
 
43
+ const LAB_NAME = 'xkat-lab';
44
+
38
45
  const candidatePaths = [
39
46
  path.join(__dirname, '..', 'target', 'release', os.platform() === 'win32' ? 'xkat-agent.exe' : 'xkat-agent'),
40
47
  path.join(__dirname, '..', 'target', 'debug', os.platform() === 'win32' ? 'xkat-agent.exe' : 'xkat-agent'),
41
48
  path.join(__dirname, '..', 'binaries', getBinaryName()),
49
+ path.join(os.homedir(), '.xkat', os.platform() === 'win32' ? 'xkat-agent.exe' : 'xkat-agent'),
42
50
  ];
43
51
 
44
52
  const binaryPath = candidatePaths.find((p) => fs.existsSync(p));
45
53
 
46
54
  if (!binaryPath) {
55
+ // ── Fallback: handle lab commands directly via multipass ──
56
+ const args = process.argv.slice(2);
57
+ const subCmd = args.join(' ').trim();
58
+
59
+ if (subCmd === 'lab shell') {
60
+ const result = spawnSync('multipass', ['shell', LAB_NAME], { stdio: 'inherit' });
61
+ process.exit(result.status || 0);
62
+ }
63
+
64
+ if (subCmd === 'lab reset') {
65
+ console.log('🔄 Resetting Lab VM...');
66
+ spawnSync('multipass', ['delete', LAB_NAME, '--purge'], { stdio: 'inherit' });
67
+ console.log('🚀 Launching fresh Lab VM...');
68
+ const launch = spawnSync('multipass', ['launch', '--name', LAB_NAME, '24.04', '--cpus', '2', '--memory', '2G', '--disk', '10G'], { stdio: 'inherit' });
69
+ if (launch.status === 0) {
70
+ console.log('✅ Lab reset complete.');
71
+ console.log(' Enter: xkat lab shell');
72
+ } else {
73
+ console.error('❌ Could not recreate Lab. Check multipass installation.');
74
+ }
75
+ process.exit(launch.status || 0);
76
+ }
77
+
78
+ if (subCmd === 'lab up' || subCmd === 'lab install') {
79
+ // Ensure multipass VM exists and is running
80
+ const info = spawnSync('multipass', ['info', LAB_NAME], { encoding: 'utf8' });
81
+ if (info.status !== 0) {
82
+ console.log('🚀 Creating Lab VM...');
83
+ const launch = spawnSync('multipass', ['launch', '--name', LAB_NAME, '24.04', '--cpus', '2', '--memory', '2G', '--disk', '10G'], { stdio: 'inherit' });
84
+ process.exit(launch.status || 0);
85
+ } else {
86
+ console.log(`✅ Lab VM '${LAB_NAME}' already exists.`);
87
+ console.log(' Enter: xkat lab shell');
88
+ process.exit(0);
89
+ }
90
+ }
91
+
47
92
  console.error('❌ xkat-agent binary not found.');
48
93
  console.error(' Try reinstalling: npm install -g xkat-cli');
49
94
  console.error(' Or for local development: cargo build');
@@ -57,3 +102,4 @@ const result = spawnSync(binaryPath, process.argv.slice(2), {
57
102
  });
58
103
 
59
104
  process.exit(result.status || 0);
105
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xkat-cli",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
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": {