capix-code 1.6.11 → 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capix-code",
3
- "version": "1.6.11",
3
+ "version": "2.0.1",
4
4
  "description": "Capix Code — decentralized AI coding agent with GPU marketplace",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -3,98 +3,62 @@ const { execSync } = require('child_process');
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
-
6
+ const crypto = require('crypto');
7
7
  if (process.env.CI || process.env.GITHUB_ACTIONS) { process.exit(0); }
8
-
9
- const VERSION = '1.6.3';
8
+ const VERSION = require('../package.json').version;
10
9
  const plat = process.platform === 'win32' ? 'win32' : process.platform;
11
10
  const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
12
11
  const ext = process.platform === 'win32' ? 'zip' : 'tar.gz';
13
12
  const NAME = `capix-code-${VERSION}-${plat}-${arch}-unsigned`;
14
13
  const URL = `https://github.com/CapIX-Protocol/Capix-Code/releases/download/v${VERSION}/${NAME}.${ext}`;
14
+ const CHECKSUM_URL = `${URL}.sha256`;
15
15
  const ROOT = path.join(os.homedir(), '.capix-code');
16
- const TMP = path.join(os.tmpdir(), 'capix-code-install');
17
-
16
+ const TMP = path.join(os.tmpdir(), `capix-install-${VERSION}`);
17
+ const archivePath = path.join(TMP, `${NAME}.${ext}`);
18
18
  fs.mkdirSync(ROOT, { recursive: true });
19
19
  fs.mkdirSync(TMP, { recursive: true });
20
-
21
- try {
22
- console.log(`Downloading capix-code v${VERSION} (${plat}-${arch})...`);
23
- execSync(`curl -fsSL -o "${TMP}/${NAME}.${ext}" "${URL}"`, { stdio: 'inherit' });
24
- execSync(`tar -xzf "${TMP}/${NAME}.${ext}" -C "${TMP}"`, { stdio: 'inherit' });
25
-
26
- const src = path.join(TMP, 'customer');
27
- if (fs.existsSync(src)) {
28
- for (const dir of ['bin', 'engine', 'runtime', 'config', 'mcp']) {
29
- const s = path.join(src, dir);
30
- const d = path.join(ROOT, dir);
31
- if (fs.existsSync(s)) execSync(`rm -rf "${d}" && cp -a "${s}" "${d}"`, { stdio: 'inherit' });
32
- }
33
- fs.chmodSync(path.join(ROOT, 'bin', 'capix-code'), 0o755);
34
- }
35
-
36
- // Install runtime deps (typescript required by plugin.ts)
37
- console.log('Installing runtime dependencies...');
38
- execSync('npm install --omit=dev --ignore-scripts', { cwd: path.join(ROOT, 'runtime'), stdio: 'inherit' });
39
-
40
- // Install MCP deps if not bundled
41
- const mcpDir = path.join(ROOT, 'mcp');
42
- if (!fs.existsSync(path.join(mcpDir, 'node_modules', '@modelcontextprotocol'))) {
43
- console.log('Installing MCP dependencies...');
44
- execSync('npm install capix-mcp@2.1.0', { cwd: mcpDir, stdio: 'inherit' });
45
- // Write MCP wrapper that does NOT refresh token (uses CAPIX_API_KEY from env)
46
- fs.writeFileSync(path.join(mcpDir, 'capix-mcp.js'),
47
- '#!/usr/bin/env node\n' +
48
- 'const { join } = require("node:path");\n' +
49
- 'const { homedir } = require("node:os");\n' +
50
- 'require(join(homedir(), ".capix-code", "mcp", "node_modules", "capix-mcp", "dist", "index.js"));\n'
51
- );
52
- fs.chmodSync(path.join(mcpDir, 'capix-mcp.js'), 0o755);
53
- }
54
-
55
- // Create config at the path the engine ACTUALLY reads
56
- // The core package uses ~/.config/opencode/ (not capix-code)
57
- const cfgDir = path.join(os.homedir(), '.config', 'opencode');
58
- fs.mkdirSync(cfgDir, { recursive: true });
59
- const rtDir = path.join(ROOT, 'runtime');
60
- const providerUrl = `file://${rtDir}/packages/runtime-provider/src/index.ts`;
61
- const apiBase = 'https://www.capix.network/api/v1';
62
-
63
- const config = {
64
- model: 'capix/auto',
65
- enabled_providers: ['capix'],
66
- plugin: [
67
- path.join(rtDir, 'src', 'native-bridge.ts'),
68
- path.join(rtDir, 'src', 'plugin.ts')
69
- ],
70
- provider: {
71
- capix: {
72
- npm: providerUrl,
73
- name: 'Capix',
74
- models: {
75
- auto: {
76
- name: 'Capix Auto (smart route)',
77
- limit: { context: 128000, output: 64000 },
78
- api: { url: apiBase, npm: providerUrl }
79
- }
80
- }
81
- }
82
- }
83
- };
84
- fs.writeFileSync(path.join(cfgDir, 'capix-code.json'), JSON.stringify(config, null, 2));
85
-
86
- // Sign on macOS
87
- if (process.platform === 'darwin') {
88
- try {
89
- execSync(`codesign --force --sign - "${path.join(ROOT, 'bin', 'capix-code')}"`, { stdio: 'ignore' });
90
- execSync(`codesign --force --sign - "${path.join(ROOT, 'engine', 'capix-engine')}"`, { stdio: 'ignore' });
91
- } catch {}
92
- }
93
-
94
- fs.rmSync(TMP, { recursive: true, force: true });
95
- console.log(`✓ Capix Code v${VERSION} installed`);
96
- console.log('Run: capix-code login && capix-code');
97
- } catch (err) {
98
- console.warn('Install failed. Download manually from https://github.com/CapIX-Protocol/Capix-Code/releases');
99
- process.exit(0);
20
+ console.log(`Capix Code v${VERSION} (${plat}-${arch})`);
21
+ execSync(`curl -fsSL -o "${archivePath}" "${URL}"`, { stdio: 'inherit' });
22
+ const checksumPath = path.join(TMP, 'checksum.sha256');
23
+ execSync(`curl -fsSL -o "${checksumPath}" "${CHECKSUM_URL}"`, { stdio: 'inherit' });
24
+ const expected = fs.readFileSync(checksumPath, 'utf8').trim().split(/\s+/)[0];
25
+ const actual = crypto.createHash('sha256').update(fs.readFileSync(archivePath)).digest('hex');
26
+ if (expected !== actual) { console.error(`Checksum mismatch!`); process.exit(1); }
27
+ if (process.platform === 'win32') { execSync(`tar -xf "${archivePath}" -C "${TMP}"`, { stdio: 'inherit' }); }
28
+ else { execSync(`tar -xzf "${archivePath}" -C "${TMP}"`, { stdio: 'inherit' }); }
29
+ const src = path.join(TMP, 'customer');
30
+ if (!fs.existsSync(src)) { console.error('Missing customer/'); process.exit(1); }
31
+ const backup = ROOT + '.bak';
32
+ if (fs.existsSync(backup)) fs.rmSync(backup, { recursive: true });
33
+ if (fs.existsSync(ROOT)) fs.renameSync(ROOT, backup);
34
+ fs.mkdirSync(ROOT, { recursive: true });
35
+ for (const dir of ['bin', 'engine', 'runtime', 'config', 'mcp']) {
36
+ const s = path.join(src, dir);
37
+ if (fs.existsSync(s)) execSync(`cp -a "${s}" "${path.join(ROOT, dir)}"`, { stdio: 'inherit' });
38
+ }
39
+ fs.chmodSync(path.join(ROOT, 'bin', 'capix-code'), 0o755);
40
+ console.log('Installing runtime deps...');
41
+ execSync('npm install --omit=dev --ignore-scripts', { cwd: path.join(ROOT, 'runtime'), stdio: 'inherit' });
42
+ const mcpDir = path.join(ROOT, 'mcp');
43
+ if (!fs.existsSync(path.join(mcpDir, 'node_modules', '@modelcontextprotocol'))) {
44
+ console.log('Installing MCP deps...');
45
+ execSync('npm install capix-mcp@2.1.0', { cwd: mcpDir, stdio: 'inherit' });
46
+ fs.writeFileSync(path.join(mcpDir, 'capix-mcp.js'), '#!/usr/bin/env node\nconst{join}=require("node:path");const{homedir}=require("node:os");require(join(homedir(),".capix-code","mcp","node_modules","capix-mcp","dist","index.js"));\n');
47
+ fs.chmodSync(path.join(mcpDir, 'capix-mcp.js'), 0o755);
48
+ }
49
+ const cfgDir = path.join(os.homedir(), '.config', 'opencode');
50
+ fs.mkdirSync(cfgDir, { recursive: true });
51
+ const rt = path.join(ROOT, 'runtime');
52
+ const pu = `file://${rt}/packages/runtime-provider/src/index.ts`;
53
+ fs.writeFileSync(path.join(cfgDir, 'capix-code.json'), JSON.stringify({
54
+ model: 'capix/auto', enabled_providers: ['capix'],
55
+ plugin: [path.join(rt, 'src', 'native-bridge.ts'), path.join(rt, 'src', 'plugin.ts')],
56
+ provider: { capix: { npm: pu, name: 'Capix', models: { auto: { name: 'Capix Auto', limit: { context: 128000, output: 64000 }, api: { url: 'https://www.capix.network/api/v1', npm: pu } } } } }
57
+ }, null, 2));
58
+ if (process.platform === 'darwin') {
59
+ try { execSync(`codesign --force --sign - "${path.join(ROOT, 'bin', 'capix-code')}"`, { stdio: 'ignore' }); } catch {}
60
+ try { execSync(`codesign --force --sign - "${path.join(ROOT, 'engine', 'capix-engine')}"`, { stdio: 'ignore' }); } catch {}
100
61
  }
62
+ fs.rmSync(TMP, { recursive: true, force: true });
63
+ if (fs.existsSync(backup)) fs.rmSync(backup, { recursive: true });
64
+ console.log(`Capix Code v${VERSION} installed. Run: capix-code login && capix-code`);
@@ -216,6 +216,20 @@ for relative in "${PRESENTATION_FILES[@]}"; do
216
216
  done
217
217
  echo " ✓ terminal title, splash, logo and customer command copy replaced"
218
218
 
219
+ # 6c. Fix split-span: <b>Open</b><b>Code</b> → <b>Capix Code</b>
220
+ for file in \
221
+ "$CAPIX_CODE_DIR/packages/tui/src/routes/session/sidebar.tsx" \
222
+ "$CAPIX_CODE_DIR/packages/tui/src/feature-plugins/sidebar/footer.tsx" \
223
+ "$CAPIX_CODE_DIR/packages/tui/src/feature-plugins/home/footer.tsx" \
224
+ "$CAPIX_CODE_DIR/packages/tui/src/feature-plugins/home/tips-view.tsx"; do
225
+ if [ -f "$file" ]; then
226
+ perl -0pi.bak -e 's/<b>Open<\/b>\s*\n\s*<b>Code<\/b>/<b>Capix Code<\/b>/gs' "$file"
227
+ perl -0pi.bak -e 's/OpenCode/Capix Code/g' "$file"
228
+ rm -f "$file.bak"
229
+ fi
230
+ done
231
+ echo " ✓ split-span branding fixed"
232
+
219
233
  # 7. Install script references.
220
234
  INSTALL="$CAPIX_CODE_DIR/install"
221
235
  if [ -f "$INSTALL" ]; then