cicy-code 0.1.0
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/cicy-code.js +23 -0
- package/package.json +25 -0
- package/scripts/install.js +60 -0
package/bin/cicy-code.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawn } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
const binDir = path.join(__dirname);
|
|
7
|
+
const platform = process.platform;
|
|
8
|
+
|
|
9
|
+
const binName = platform === 'win32' ? 'cicy-code.exe' : 'cicy-code';
|
|
10
|
+
const binPath = path.join(binDir, binName);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(binPath)) {
|
|
13
|
+
console.error(`Binary not found: ${binPath}`);
|
|
14
|
+
console.error('Run: npm install cicy-code');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const child = spawn(binPath, process.argv.slice(2), {
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
env: process.env
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
child.on('exit', (code) => process.exit(code || 0));
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cicy-code",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CiCy Code - AI-powered development environment",
|
|
5
|
+
"bin": {
|
|
6
|
+
"cicy-code": "bin/cicy-code.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node scripts/install.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"scripts/"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/cicy-ai/cicy-code.git"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/cicy-ai/cicy-code",
|
|
20
|
+
"keywords": ["cicy", "code", "ai", "agent", "development"],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=14"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
|
|
6
|
+
const VERSION = '0.1.0';
|
|
7
|
+
const BASE_URL = `https://github.com/cicy-ai/cicy-code/releases/download/v${VERSION}`;
|
|
8
|
+
|
|
9
|
+
const PLATFORMS = {
|
|
10
|
+
'darwin-arm64': 'cicy-code-darwin-arm64',
|
|
11
|
+
'darwin-x64': 'cicy-code-darwin-amd64',
|
|
12
|
+
'linux-x64': 'cicy-code-linux-amd64',
|
|
13
|
+
'linux-arm64': 'cicy-code-linux-arm64',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const key = `${process.platform}-${process.arch}`;
|
|
17
|
+
const binName = PLATFORMS[key];
|
|
18
|
+
|
|
19
|
+
if (!binName) {
|
|
20
|
+
console.error(`Unsupported platform: ${key}`);
|
|
21
|
+
console.error('Supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
26
|
+
const binPath = path.join(binDir, process.platform === 'win32' ? 'cicy-code.exe' : 'cicy-code');
|
|
27
|
+
const url = `${BASE_URL}/${binName}`;
|
|
28
|
+
|
|
29
|
+
console.log(`Downloading ${binName}...`);
|
|
30
|
+
|
|
31
|
+
function download(url, dest, redirects = 5) {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
if (redirects === 0) return reject(new Error('Too many redirects'));
|
|
34
|
+
|
|
35
|
+
const proto = url.startsWith('https') ? https : require('http');
|
|
36
|
+
proto.get(url, (res) => {
|
|
37
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
38
|
+
return download(res.headers.location, dest, redirects - 1).then(resolve).catch(reject);
|
|
39
|
+
}
|
|
40
|
+
if (res.statusCode !== 200) {
|
|
41
|
+
return reject(new Error(`HTTP ${res.statusCode}`));
|
|
42
|
+
}
|
|
43
|
+
const file = fs.createWriteStream(dest);
|
|
44
|
+
res.pipe(file);
|
|
45
|
+
file.on('finish', () => {
|
|
46
|
+
file.close();
|
|
47
|
+
fs.chmodSync(dest, 0o755);
|
|
48
|
+
resolve();
|
|
49
|
+
});
|
|
50
|
+
}).on('error', reject);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
download(url, binPath)
|
|
55
|
+
.then(() => console.log('Done!'))
|
|
56
|
+
.catch((err) => {
|
|
57
|
+
console.error('Download failed:', err.message);
|
|
58
|
+
console.error('You can manually download from:', url);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
});
|