capix-code 1.4.1 → 1.4.3
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/bin/capix-code.cjs +25 -14
- package/package.json +7 -2
- package/scripts/postinstall.cjs +43 -14
package/bin/capix-code.cjs
CHANGED
|
@@ -2,27 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
const { spawnSync } = require('node:child_process');
|
|
4
4
|
const { chmodSync, cpSync, existsSync, mkdirSync } = require('node:fs');
|
|
5
|
-
const {
|
|
5
|
+
const { join } = require('node:path');
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
const packageName = `@capix-code/${platform}-${process.arch}`;
|
|
9
|
-
let root;
|
|
7
|
+
const suffix = process.platform === 'win32' ? '.exe' : '';
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
// Look for the customer runtime in these locations:
|
|
10
|
+
// 1. npm global install: node_modules/capix-code/dist/customer
|
|
11
|
+
// 2. Local dev: dist/customer
|
|
12
|
+
// 3. Home directory: ~/.capix-code (from postinstall binary download)
|
|
13
|
+
const { homedir } = require('node:os');
|
|
14
|
+
const candidates = [
|
|
15
|
+
join(__dirname, '..', 'dist', 'customer'),
|
|
16
|
+
join(homedir(), '.capix-code'),
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
let root = null;
|
|
20
|
+
for (const candidate of candidates) {
|
|
21
|
+
const launcher = join(candidate, 'bin', `capix-code${suffix}`);
|
|
22
|
+
if (existsSync(launcher)) {
|
|
23
|
+
root = candidate;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
if (!root) {
|
|
19
|
-
console.error(
|
|
20
|
-
console.error(
|
|
29
|
+
console.error('Capix Code installation is incomplete. Reinstall the package and try again.');
|
|
30
|
+
console.error('If this persists, download the full binary from:');
|
|
31
|
+
console.error(' https://github.com/CapIX-Protocol/Capix-Code/releases');
|
|
21
32
|
process.exit(1);
|
|
22
33
|
}
|
|
23
34
|
|
|
24
|
-
const suffix = process.platform === 'win32' ? '.exe' : '';
|
|
25
35
|
const launcher = join(root, 'bin', `capix-code${suffix}`);
|
|
36
|
+
const engine = join(root, 'engine', `capix-engine${suffix}`);
|
|
26
37
|
|
|
27
38
|
if (!existsSync(launcher)) {
|
|
28
39
|
console.error('Capix Code installation is incomplete. Reinstall the package and try again.');
|
|
@@ -31,14 +42,14 @@ if (!existsSync(launcher)) {
|
|
|
31
42
|
|
|
32
43
|
try {
|
|
33
44
|
const runtimeProvider = join(root, 'runtime', 'node_modules', '@capix', 'runtime-provider');
|
|
34
|
-
if (!existsSync(runtimeProvider)) {
|
|
45
|
+
if (!existsSync(runtimeProvider) && existsSync(join(root, 'runtime', 'packages', 'runtime-provider'))) {
|
|
35
46
|
mkdirSync(join(root, 'runtime', 'node_modules', '@capix'), { recursive: true });
|
|
36
47
|
cpSync(join(root, 'runtime', 'packages', 'runtime-provider'), runtimeProvider, {
|
|
37
48
|
recursive: true,
|
|
38
49
|
});
|
|
39
50
|
}
|
|
40
51
|
chmodSync(launcher, 0o755);
|
|
41
|
-
|
|
52
|
+
if (existsSync(engine)) chmodSync(engine, 0o755);
|
|
42
53
|
} catch (error) {
|
|
43
54
|
console.error(`Capix Code could not prepare its native runtime: ${error.message}`);
|
|
44
55
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capix-code",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Capix Code — decentralized AI coding agent with GPU marketplace",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,12 @@
|
|
|
43
43
|
"prettier": "^3.0.0",
|
|
44
44
|
"typescript": "^5.7.0",
|
|
45
45
|
"typescript-eslint": "^8.0.0",
|
|
46
|
-
"vitest": "^2.1.0"
|
|
46
|
+
"vitest": "^2.1.0",
|
|
47
|
+
"@capix/runtime-provider": "file:packages/runtime-provider",
|
|
48
|
+
"@opencode-ai/plugin": "1.17.18",
|
|
49
|
+
"@opencode-ai/sdk": "1.17.18",
|
|
50
|
+
"bun": "^1.3.14",
|
|
51
|
+
"opencode-ai": "1.17.18"
|
|
47
52
|
},
|
|
48
53
|
"lint-staged": {
|
|
49
54
|
"*.{ts,js}": [
|
package/scripts/postinstall.cjs
CHANGED
|
@@ -10,27 +10,56 @@ if (process.env.CI || process.env.GITHUB_ACTIONS) {
|
|
|
10
10
|
process.exit(0);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
13
|
+
const VERSION = '1.4.2';
|
|
14
|
+
const PLATFORM_MAP = { darwin: 'darwin', linux: 'linux', win32: 'win32' };
|
|
15
|
+
const ARCH_MAP = { arm64: 'arm64', x64: 'x64' };
|
|
16
|
+
const platform = PLATFORM_MAP[process.platform] || 'linux';
|
|
17
|
+
const arch = ARCH_MAP[process.arch] || 'x64';
|
|
18
|
+
const ext = process.platform === 'win32' ? 'zip' : 'tar.gz';
|
|
19
|
+
const NAME = `capix-code-${VERSION}-${platform}-${arch}-unsigned`;
|
|
20
|
+
const RELEASE = `https://github.com/CapIX-Protocol/Capix-Code/releases/download/v${VERSION}/${NAME}.${ext}`;
|
|
17
21
|
|
|
18
22
|
const installDir = path.join(os.homedir(), '.capix-code');
|
|
19
|
-
const
|
|
20
|
-
const engineDir = path.join(installDir, 'engine');
|
|
23
|
+
const tmpDir = path.join(os.tmpdir(), 'capix-code-install');
|
|
21
24
|
|
|
22
|
-
fs.mkdirSync(
|
|
23
|
-
fs.mkdirSync(
|
|
25
|
+
fs.mkdirSync(installDir, { recursive: true });
|
|
26
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
24
27
|
|
|
25
28
|
try {
|
|
26
|
-
console.log(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
console.log(`Downloading capix-code v${VERSION} (${platform}-${arch})...`);
|
|
30
|
+
const archivePath = path.join(tmpDir, `${NAME}.${ext}`);
|
|
31
|
+
execSync(`curl -fsSL -o "${archivePath}" "${RELEASE}"`, { stdio: 'inherit' });
|
|
32
|
+
|
|
33
|
+
if (process.platform === 'win32') {
|
|
34
|
+
execSync(`tar -xf "${archivePath}" -C "${tmpDir}"`, { stdio: 'inherit' });
|
|
35
|
+
} else {
|
|
36
|
+
execSync(`tar -xzf "${archivePath}" -C "${tmpDir}"`, { stdio: 'inherit' });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const customerSrc = path.join(tmpDir, 'customer');
|
|
40
|
+
if (fs.existsSync(customerSrc)) {
|
|
41
|
+
// Copy bin/ and engine/ and runtime/ to ~/.capix-code
|
|
42
|
+
for (const dir of ['bin', 'engine', 'runtime']) {
|
|
43
|
+
const src = path.join(customerSrc, dir);
|
|
44
|
+
const dst = path.join(installDir, dir);
|
|
45
|
+
if (fs.existsSync(src)) {
|
|
46
|
+
execSync(`cp -a "${src}" "${dst}"`, { stdio: 'inherit' });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Ensure bin is executable
|
|
50
|
+
const binPath = path.join(installDir, 'bin', 'capix-code');
|
|
51
|
+
if (fs.existsSync(binPath)) {
|
|
52
|
+
fs.chmodSync(binPath, 0o755);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Cleanup
|
|
57
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
58
|
+
|
|
59
|
+
console.log(`✓ Capix Code v${VERSION} installed to ${installDir}`);
|
|
30
60
|
console.log('Run: capix-code --version');
|
|
31
61
|
} catch (err) {
|
|
32
62
|
console.warn('⚠ Binary download failed. Download manually from:');
|
|
33
|
-
console.warn(' https://github.com/CapIX-Protocol/
|
|
34
|
-
// Don't fail the install
|
|
63
|
+
console.warn(' https://github.com/CapIX-Protocol/Capix-Code/releases');
|
|
35
64
|
process.exit(0);
|
|
36
65
|
}
|