capix-code 1.6.7 → 1.6.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capix-code",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "description": "Capix Code — decentralized AI coding agent with GPU marketplace",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ if (process.env.CI || process.env.GITHUB_ACTIONS) {
9
9
  process.exit(0);
10
10
  }
11
11
 
12
- const VERSION = '1.6.1';
12
+ const VERSION = '1.6.3';
13
13
  const PLATFORM_MAP = { darwin: 'darwin', linux: 'linux', win32: 'win32' };
14
14
  const ARCH_MAP = { arm64: 'arm64', x64: 'x64' };
15
15
  const platform = PLATFORM_MAP[process.platform] || 'linux';
@@ -37,11 +37,11 @@ try {
37
37
 
38
38
  const customerSrc = path.join(tmpDir, 'customer');
39
39
  if (fs.existsSync(customerSrc)) {
40
- for (const dir of ['bin', 'engine', 'runtime', 'config']) {
40
+ for (const dir of ['bin', 'engine', 'runtime', 'config', 'mcp']) {
41
41
  const src = path.join(customerSrc, dir);
42
42
  const dst = path.join(installDir, dir);
43
43
  if (fs.existsSync(src)) {
44
- execSync(`cp -a "${src}" "${dst}"`, { stdio: 'inherit' });
44
+ execSync(`rm -rf "${dst}" && cp -a "${src}" "${dst}"`, { stdio: 'inherit' });
45
45
  }
46
46
  }
47
47
  const binPath = path.join(installDir, 'bin', 'capix-code');
@@ -50,63 +50,70 @@ try {
50
50
  }
51
51
  }
52
52
 
53
- // Install MCP server from npm
53
+ // Install runtime dependencies (typescript is required by plugin.ts)
54
+ const runtimeDir = path.join(installDir, 'runtime');
55
+ if (fs.existsSync(path.join(runtimeDir, 'package.json'))) {
56
+ console.log('Installing runtime dependencies...');
57
+ execSync(`npm install --omit=dev --ignore-scripts`, { cwd: runtimeDir, stdio: 'inherit' });
58
+ }
59
+
60
+ // Install MCP dependencies if not already bundled
54
61
  const mcpDir = path.join(installDir, 'mcp');
55
62
  const mcpEntry = path.join(mcpDir, 'capix-mcp.js');
56
- if (!fs.existsSync(mcpEntry)) {
57
- console.log('Installing capix-mcp server from npm...');
58
- fs.mkdirSync(mcpDir, { recursive: true });
63
+ if (!fs.existsSync(path.join(mcpDir, 'node_modules', '@modelcontextprotocol', 'sdk'))) {
64
+ console.log('Installing MCP dependencies...');
59
65
  execSync(`npm install capix-mcp@2.1.0`, { cwd: mcpDir, stdio: 'inherit' });
60
- // Create entry point wrapper that shares credentials with capix-code
66
+ // Create wrapper that shares credentials
61
67
  const mcpPkgPath = path.join(mcpDir, 'node_modules', 'capix-mcp', 'dist', 'index.js');
62
- fs.writeFileSync(mcpEntry,
63
- '#!/usr/bin/env node\n' +
64
- 'const { readFileSync, writeFileSync, chmodSync, existsSync } = require("node:fs");\n' +
65
- 'const { join } = require("node:path");\n' +
66
- 'const { homedir } = require("node:os");\n' +
67
- 'const credPath = join(homedir(), ".capix-code", "credentials.json");\n' +
68
- 'async function loadMcp() {\n' +
69
- ' const mcpPath = join(homedir(), ".capix-code", "mcp", "node_modules", "capix-mcp", "dist", "index.js");\n' +
70
- ` require('${mcpPkgPath}');\n` +
71
- '}\n' +
72
- '(async () => {\n' +
73
- ' try {\n' +
74
- ' if (existsSync(credPath)) {\n' +
75
- ' const creds = JSON.parse(readFileSync(credPath, "utf8"));\n' +
76
- ' const rt = creds["capix-code:oauth-refresh-token"];\n' +
77
- ' if (rt) {\n' +
78
- ' const res = await fetch("https://www.capix.network/oauth/token", {\n' +
79
- ' method: "POST",\n' +
80
- ' headers: { "Content-Type": "application/x-www-form-urlencoded" },\n' +
81
- ' body: new URLSearchParams({ grant_type: "refresh_token", refresh_token: rt, client_id: "capix-code" }).toString(),\n' +
82
- ' });\n' +
83
- ' const body = await res.json();\n' +
84
- ' if (body.access_token) {\n' +
85
- ' process.env.CAPIX_API_KEY = body.access_token;\n' +
86
- ' creds["capix-code:oauth-refresh-token"] = body.refresh_token;\n' +
87
- ' writeFileSync(credPath, JSON.stringify(creds, null, 2), { mode: 0o600 });\n' +
88
- ' chmodSync(credPath, 0o600);\n' +
89
- ' }\n' +
90
- ' }\n' +
91
- ' }\n' +
92
- ' } catch {}\n' +
93
- ' loadMcp();\n' +
94
- '})();\n'
95
- );
96
- fs.chmodSync(mcpEntry, 0o755);
97
- console.log('✓ capix-mcp installed with shared credentials');
68
+ if (!fs.existsSync(mcpEntry)) {
69
+ fs.writeFileSync(mcpEntry,
70
+ '#!/usr/bin/env node\n' +
71
+ 'const { readFileSync, writeFileSync, chmodSync, existsSync } = require("node:fs");\n' +
72
+ 'const { join } = require("node:path");\n' +
73
+ 'const { homedir } = require("node:os");\n' +
74
+ 'const credPath = join(homedir(), ".capix-code", "credentials.json");\n' +
75
+ 'async function loadMcp() {\n' +
76
+ ' require(join(homedir(), ".capix-code", "mcp", "node_modules", "capix-mcp", "dist", "index.js"));\n' +
77
+ '}\n' +
78
+ '(async () => {\n' +
79
+ ' try {\n' +
80
+ ' if (existsSync(credPath)) {\n' +
81
+ ' const creds = JSON.parse(readFileSync(credPath, "utf8"));\n' +
82
+ ' const rt = creds["capix-code:oauth-refresh-token"];\n' +
83
+ ' if (rt) {\n' +
84
+ ' const res = await fetch("https://www.capix.network/oauth/token", {\n' +
85
+ ' method: "POST",\n' +
86
+ ' headers: { "Content-Type": "application/x-www-form-urlencoded" },\n' +
87
+ ' body: new URLSearchParams({ grant_type: "refresh_token", refresh_token: rt, client_id: "capix-code" }).toString(),\n' +
88
+ ' });\n' +
89
+ ' const body = await res.json();\n' +
90
+ ' if (body.access_token) {\n' +
91
+ ' process.env.CAPIX_API_KEY = body.access_token;\n' +
92
+ ' creds["capix-code:oauth-refresh-token"] = body.refresh_token;\n' +
93
+ ' writeFileSync(credPath, JSON.stringify(creds, null, 2), { mode: 0o600 });\n' +
94
+ ' chmodSync(credPath, 0o600);\n' +
95
+ ' }\n' +
96
+ ' }\n' +
97
+ ' }\n' +
98
+ ' } catch {}\n' +
99
+ ' loadMcp();\n' +
100
+ '})();\n'
101
+ );
102
+ fs.chmodSync(mcpEntry, 0o755);
103
+ }
98
104
  }
99
105
 
100
- // Always update the MCP wrapper (in case credentials path changed)
101
- const existingMcp = path.join(mcpDir, 'capix-mcp.js');
102
- if (fs.existsSync(existingMcp) && !fs.existsSync(path.join(mcpDir, 'node_modules', 'capix-mcp'))) {
103
- // Reinstall if node_modules is missing
104
- execSync(`npm install capix-mcp@2.1.0`, { cwd: mcpDir, stdio: 'inherit' });
106
+ // Sign binaries on macOS to prevent Gatekeeper kills
107
+ if (process.platform === 'darwin') {
108
+ try {
109
+ execSync(`codesign --force --sign - "${path.join(installDir, 'bin', 'capix-code')}"`, { stdio: 'ignore' });
110
+ execSync(`codesign --force --sign - "${path.join(installDir, 'engine', 'capix-engine')}"`, { stdio: 'ignore' });
111
+ } catch {}
105
112
  }
106
113
 
107
114
  fs.rmSync(tmpDir, { recursive: true, force: true });
108
115
  console.log(`✓ Capix Code v${VERSION} installed to ${installDir}`);
109
- console.log('Run: capix-code --version');
116
+ console.log('Run: capix-code login && capix-code');
110
117
  } catch (err) {
111
118
  console.warn('⚠ Binary download failed. Download manually from:');
112
119
  console.warn(' https://github.com/CapIX-Protocol/Capix-Code/releases');