@ccdevkit/ccyolo 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/ccyolo +28 -0
- package/install.js +105 -0
- package/package.json +40 -0
package/bin/ccyolo
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const binaryName = process.platform === 'win32' ? 'ccyolo.exe' : 'ccyolo';
|
|
7
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
8
|
+
|
|
9
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
10
|
+
stdio: 'inherit',
|
|
11
|
+
env: process.env,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
child.on('error', (err) => {
|
|
15
|
+
if (err.code === 'ENOENT') {
|
|
16
|
+
console.error('ccyolo binary not found. Try reinstalling: npm install -g @cckit/ccyolo');
|
|
17
|
+
} else {
|
|
18
|
+
console.error(`Failed to run ccyolo: ${err.message}`);
|
|
19
|
+
}
|
|
20
|
+
process.exit(1);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
child.on('exit', (code, signal) => {
|
|
24
|
+
if (signal) {
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
process.exit(code ?? 0);
|
|
28
|
+
});
|
package/install.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const zlib = require('zlib');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
const PACKAGE_VERSION = require('./package.json').version;
|
|
10
|
+
|
|
11
|
+
// Map Node.js platform/arch to Go GOOS/GOARCH
|
|
12
|
+
const PLATFORM_MAP = {
|
|
13
|
+
'darwin-x64': { goos: 'darwin', goarch: 'amd64' },
|
|
14
|
+
'darwin-arm64': { goos: 'darwin', goarch: 'arm64' },
|
|
15
|
+
'linux-x64': { goos: 'linux', goarch: 'amd64' },
|
|
16
|
+
'linux-arm64': { goos: 'linux', goarch: 'arm64' },
|
|
17
|
+
'win32-x64': { goos: 'windows', goarch: 'amd64' },
|
|
18
|
+
'win32-arm64': { goos: 'windows', goarch: 'arm64' },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
22
|
+
const platformInfo = PLATFORM_MAP[platformKey];
|
|
23
|
+
|
|
24
|
+
if (!platformInfo) {
|
|
25
|
+
console.error(`Unsupported platform: ${platformKey}`);
|
|
26
|
+
console.error(`Supported platforms: ${Object.keys(PLATFORM_MAP).join(', ')}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const { goos, goarch } = platformInfo;
|
|
31
|
+
const binaryName = process.platform === 'win32' ? 'ccyolo.exe' : 'ccyolo';
|
|
32
|
+
const assetName = `ccyolo-${goos}-${goarch}.tar.gz`;
|
|
33
|
+
const downloadUrl = `https://github.com/ccdevkit/ccyolo/releases/download/v${PACKAGE_VERSION}/${assetName}`;
|
|
34
|
+
const binDir = path.join(__dirname, 'bin');
|
|
35
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
36
|
+
|
|
37
|
+
function makeRequest(url) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const request = https.get(url, (response) => {
|
|
40
|
+
// Handle redirects (GitHub releases redirect to S3)
|
|
41
|
+
if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
42
|
+
makeRequest(response.headers.location).then(resolve, reject);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (response.statusCode < 200 || response.statusCode >= 300) {
|
|
47
|
+
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const chunks = [];
|
|
52
|
+
response.on('data', (chunk) => chunks.push(chunk));
|
|
53
|
+
response.on('end', () => resolve(Buffer.concat(chunks)));
|
|
54
|
+
response.on('error', reject);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
request.on('error', reject);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function extractTarGz(buffer, destDir) {
|
|
62
|
+
// Use tar command for extraction
|
|
63
|
+
// Windows 10+ includes tar.exe, and Git Bash/WSL also provide it
|
|
64
|
+
const tarball = path.join(destDir, 'temp.tar.gz');
|
|
65
|
+
fs.writeFileSync(tarball, buffer);
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
// Use tar command - available on Windows 10+, macOS, and Linux
|
|
69
|
+
execSync(`tar -xzf "${tarball}" -C "${destDir}"`, { stdio: 'pipe' });
|
|
70
|
+
} finally {
|
|
71
|
+
fs.unlinkSync(tarball);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function install() {
|
|
76
|
+
console.log(`Downloading ccyolo for ${goos}/${goarch}...`);
|
|
77
|
+
console.log(`URL: ${downloadUrl}`);
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
// Ensure bin directory exists
|
|
81
|
+
if (!fs.existsSync(binDir)) {
|
|
82
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const buffer = await makeRequest(downloadUrl);
|
|
86
|
+
console.log(`Downloaded ${buffer.length} bytes`);
|
|
87
|
+
|
|
88
|
+
extractTarGz(buffer, binDir);
|
|
89
|
+
|
|
90
|
+
// Make binary executable (not needed on Windows)
|
|
91
|
+
if (process.platform !== 'win32') {
|
|
92
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
console.log(`Installed ccyolo to ${binaryPath}`);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error(`Failed to install ccyolo: ${error.message}`);
|
|
98
|
+
console.error('');
|
|
99
|
+
console.error('You can manually download the binary from:');
|
|
100
|
+
console.error(`https://github.com/ccdevkit/ccyolo/releases/tag/v${PACKAGE_VERSION}`);
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
install();
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ccdevkit/ccyolo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Run Claude Code in a Docker container with YOLO mode enabled",
|
|
5
|
+
"bin": {
|
|
6
|
+
"ccyolo": "bin/ccyolo"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/ccdevkit/ccyolo.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"claude",
|
|
17
|
+
"claude-code",
|
|
18
|
+
"docker",
|
|
19
|
+
"ai",
|
|
20
|
+
"cli"
|
|
21
|
+
],
|
|
22
|
+
"author": "Sullivan Digital",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/ccdevkit/ccyolo/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/ccdevkit/ccyolo#readme",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"os": [
|
|
32
|
+
"darwin",
|
|
33
|
+
"linux",
|
|
34
|
+
"win32"
|
|
35
|
+
],
|
|
36
|
+
"cpu": [
|
|
37
|
+
"x64",
|
|
38
|
+
"arm64"
|
|
39
|
+
]
|
|
40
|
+
}
|