@mblua/agentscommander 0.10.0 → 0.30.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/README.md +32 -32
- package/install.js +153 -153
- package/package.json +5 -4
- package/run.js +45 -45
package/README.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
# AgentsCommander
|
|
2
|
-
|
|
3
|
-
Install and run AgentsCommander from npm.
|
|
4
|
-
|
|
5
|
-
AgentsCommander coordinates
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install -g @mblua/agentscommander
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Run
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
agentscommander
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The npm package is `@mblua/agentscommander`. The installed CLI command is `agentscommander`.
|
|
20
|
-
|
|
21
|
-
## Desktop and Manual Installers
|
|
22
|
-
|
|
23
|
-
If you prefer a desktop installer, portable binary, or direct release asset, use GitHub Releases:
|
|
24
|
-
|
|
25
|
-
https://github.com/mblua/AgentsCommander/releases/latest
|
|
26
|
-
|
|
27
|
-
## Requirements
|
|
28
|
-
|
|
29
|
-
- Node.js 18+
|
|
30
|
-
- One supported coding-agent CLI installed separately: Claude Code, Codex, or
|
|
31
|
-
|
|
32
|
-
AgentsCommander does not install coding-agent CLIs for you.
|
|
1
|
+
# AgentsCommander
|
|
2
|
+
|
|
3
|
+
Install and run AgentsCommander from npm.
|
|
4
|
+
|
|
5
|
+
AgentsCommander coordinates coding agents such as Claude Code, Codex, Antigravity, and Pi in real terminal sessions. Agents work in local folders and exchange markdown messages you can inspect, diff, and audit.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @mblua/agentscommander
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Run
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
agentscommander
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The npm package is `@mblua/agentscommander`. The installed CLI command is `agentscommander`.
|
|
20
|
+
|
|
21
|
+
## Desktop and Manual Installers
|
|
22
|
+
|
|
23
|
+
If you prefer a desktop installer, portable binary, or direct release asset, use GitHub Releases:
|
|
24
|
+
|
|
25
|
+
https://github.com/mblua/AgentsCommander/releases/latest
|
|
26
|
+
|
|
27
|
+
## Requirements
|
|
28
|
+
|
|
29
|
+
- Node.js 18+
|
|
30
|
+
- One supported coding-agent CLI installed separately: Claude Code, Codex, Antigravity, or Pi
|
|
31
|
+
|
|
32
|
+
AgentsCommander does not install coding-agent CLIs for you.
|
package/install.js
CHANGED
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const https = require('https');
|
|
4
|
-
const crypto = require('crypto');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
const { execSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
const VERSION = "0.
|
|
9
|
-
const OWNER = 'mblua';
|
|
10
|
-
const REPO = 'AgentsCommander';
|
|
11
|
-
|
|
12
|
-
const platform = os.platform();
|
|
13
|
-
const arch = os.arch();
|
|
14
|
-
|
|
15
|
-
// Map Node platform/arch to our release asset names
|
|
16
|
-
let assetName = '';
|
|
17
|
-
if (platform === 'darwin') {
|
|
18
|
-
assetName = `agentscommander-mac-${arch === 'arm64' ? 'aarch64' : 'x86_64'}.app.tar.gz`;
|
|
19
|
-
} else if (platform === 'win32') {
|
|
20
|
-
assetName = `agentscommander-windows-${arch === 'arm64' ? 'aarch64' : 'x86_64'}.exe`;
|
|
21
|
-
} else if (platform === 'linux') {
|
|
22
|
-
assetName = `agentscommander-linux-${arch === 'arm64' ? 'aarch64' : 'x86_64'}`;
|
|
23
|
-
} else {
|
|
24
|
-
console.error(`Unsupported platform: ${platform}`);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const binDir = path.join(__dirname, 'bin');
|
|
29
|
-
if (!fs.existsSync(binDir)) {
|
|
30
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const targetPath = path.join(binDir, assetName);
|
|
34
|
-
const tmpPath = targetPath + '.tmp';
|
|
35
|
-
const shasumUrl = `https://github.com/${OWNER}/${REPO}/releases/download/v${VERSION}/SHASUMS256.txt`;
|
|
36
|
-
const assetUrl = `https://github.com/${OWNER}/${REPO}/releases/download/v${VERSION}/${assetName}`;
|
|
37
|
-
|
|
38
|
-
function fetchUrl(url, redirectCount = 0) {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
if (redirectCount > 5) {
|
|
41
|
-
return reject(new Error('Too many redirects'));
|
|
42
|
-
}
|
|
43
|
-
https.get(url, (res) => {
|
|
44
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
45
|
-
res.resume();
|
|
46
|
-
return fetchUrl(res.headers.location, redirectCount + 1).then(resolve).catch(reject);
|
|
47
|
-
}
|
|
48
|
-
if (res.statusCode !== 200) {
|
|
49
|
-
return reject(new Error(`Failed to fetch ${url}: HTTP ${res.statusCode}`));
|
|
50
|
-
}
|
|
51
|
-
resolve(res);
|
|
52
|
-
}).on('error', reject);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function downloadFile(url, dest) {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
fetchUrl(url).then(res => {
|
|
59
|
-
const file = fs.createWriteStream(dest);
|
|
60
|
-
|
|
61
|
-
const handleError = (err) => {
|
|
62
|
-
file.close(() => {
|
|
63
|
-
if (fs.existsSync(dest)) fs.unlinkSync(dest);
|
|
64
|
-
reject(err);
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
res.on('error', handleError);
|
|
69
|
-
file.on('error', handleError);
|
|
70
|
-
|
|
71
|
-
res.pipe(file);
|
|
72
|
-
file.on('finish', () => {
|
|
73
|
-
file.close(() => {
|
|
74
|
-
resolve();
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}).catch(reject);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async function verifyChecksum(filePath, fileName, expectedShasums) {
|
|
82
|
-
return new Promise((resolve, reject) => {
|
|
83
|
-
const hash = crypto.createHash('sha256');
|
|
84
|
-
const stream = fs.createReadStream(filePath);
|
|
85
|
-
stream.on('data', data => hash.update(data));
|
|
86
|
-
stream.on('end', () => {
|
|
87
|
-
const fileHash = hash.digest('hex');
|
|
88
|
-
const expectedLines = expectedShasums.split('\n');
|
|
89
|
-
const expectedLine = expectedLines.find(line => line.includes(fileName));
|
|
90
|
-
if (!expectedLine) {
|
|
91
|
-
return reject(new Error(`Checksum for ${fileName} not found in SHASUMS256.txt`));
|
|
92
|
-
}
|
|
93
|
-
const expectedHash = expectedLine.split(/\s+/)[0];
|
|
94
|
-
if (fileHash !== expectedHash) {
|
|
95
|
-
return reject(new Error(`Checksum mismatch for ${fileName}. Expected: ${expectedHash}, Actual: ${fileHash}`));
|
|
96
|
-
}
|
|
97
|
-
resolve();
|
|
98
|
-
});
|
|
99
|
-
stream.on('error', reject);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async function main() {
|
|
104
|
-
const shasumTmpPath = path.join(binDir, 'SHASUMS256.txt.tmp');
|
|
105
|
-
try {
|
|
106
|
-
console.log(`Downloading SHASUMS256.txt from ${shasumUrl}`);
|
|
107
|
-
// moved to top
|
|
108
|
-
await downloadFile(shasumUrl, shasumTmpPath);
|
|
109
|
-
const expectedShasums = fs.readFileSync(shasumTmpPath, 'utf8');
|
|
110
|
-
|
|
111
|
-
console.log(`Downloading ${assetName} from ${assetUrl}`);
|
|
112
|
-
await downloadFile(assetUrl, tmpPath);
|
|
113
|
-
|
|
114
|
-
console.log(`Verifying checksum for ${assetName}`);
|
|
115
|
-
await verifyChecksum(tmpPath, assetName, expectedShasums);
|
|
116
|
-
console.log('Checksum verified.');
|
|
117
|
-
|
|
118
|
-
if (platform === 'darwin') {
|
|
119
|
-
console.log('Extracting macOS bundle...');
|
|
120
|
-
const extractTmpDir = path.join(binDir, 'tmp-extract');
|
|
121
|
-
if (fs.existsSync(extractTmpDir)) fs.rmSync(extractTmpDir, { recursive: true, force: true });
|
|
122
|
-
fs.mkdirSync(extractTmpDir, { recursive: true });
|
|
123
|
-
try {
|
|
124
|
-
execSync(`tar -xzf "${tmpPath}" -C "${extractTmpDir}"`);
|
|
125
|
-
const extractedFiles = fs.readdirSync(extractTmpDir);
|
|
126
|
-
for (const file of extractedFiles) {
|
|
127
|
-
const dest = path.join(binDir, file);
|
|
128
|
-
if (fs.existsSync(dest)) fs.rmSync(dest, { recursive: true, force: true });
|
|
129
|
-
fs.renameSync(path.join(extractTmpDir, file), dest);
|
|
130
|
-
}
|
|
131
|
-
} finally {
|
|
132
|
-
if (fs.existsSync(extractTmpDir)) fs.rmSync(extractTmpDir, { recursive: true, force: true });
|
|
133
|
-
}
|
|
134
|
-
fs.unlinkSync(tmpPath);
|
|
135
|
-
} else {
|
|
136
|
-
const finalBinPath = path.join(binDir, platform === 'win32' ? 'agentscommander.exe' : 'agentscommander');
|
|
137
|
-
if (platform !== 'win32') {
|
|
138
|
-
fs.chmodSync(tmpPath, 0o755);
|
|
139
|
-
}
|
|
140
|
-
fs.renameSync(tmpPath, finalBinPath);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
fs.unlinkSync(shasumTmpPath);
|
|
144
|
-
console.log('Installation completed successfully.');
|
|
145
|
-
} catch (err) {
|
|
146
|
-
console.error('Installation failed:', err.message);
|
|
147
|
-
if (fs.existsSync(tmpPath)) fs.unlinkSync(tmpPath);
|
|
148
|
-
if (typeof shasumTmpPath !== 'undefined' && fs.existsSync(shasumTmpPath)) fs.unlinkSync(shasumTmpPath);
|
|
149
|
-
process.exit(1);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
main();
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const crypto = require('crypto');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const VERSION = "0.30.3"; // Must match package.json
|
|
9
|
+
const OWNER = 'mblua';
|
|
10
|
+
const REPO = 'AgentsCommander';
|
|
11
|
+
|
|
12
|
+
const platform = os.platform();
|
|
13
|
+
const arch = os.arch();
|
|
14
|
+
|
|
15
|
+
// Map Node platform/arch to our release asset names
|
|
16
|
+
let assetName = '';
|
|
17
|
+
if (platform === 'darwin') {
|
|
18
|
+
assetName = `agentscommander-mac-${arch === 'arm64' ? 'aarch64' : 'x86_64'}.app.tar.gz`;
|
|
19
|
+
} else if (platform === 'win32') {
|
|
20
|
+
assetName = `agentscommander-windows-${arch === 'arm64' ? 'aarch64' : 'x86_64'}.exe`;
|
|
21
|
+
} else if (platform === 'linux') {
|
|
22
|
+
assetName = `agentscommander-linux-${arch === 'arm64' ? 'aarch64' : 'x86_64'}`;
|
|
23
|
+
} else {
|
|
24
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const binDir = path.join(__dirname, 'bin');
|
|
29
|
+
if (!fs.existsSync(binDir)) {
|
|
30
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const targetPath = path.join(binDir, assetName);
|
|
34
|
+
const tmpPath = targetPath + '.tmp';
|
|
35
|
+
const shasumUrl = `https://github.com/${OWNER}/${REPO}/releases/download/v${VERSION}/SHASUMS256.txt`;
|
|
36
|
+
const assetUrl = `https://github.com/${OWNER}/${REPO}/releases/download/v${VERSION}/${assetName}`;
|
|
37
|
+
|
|
38
|
+
function fetchUrl(url, redirectCount = 0) {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
if (redirectCount > 5) {
|
|
41
|
+
return reject(new Error('Too many redirects'));
|
|
42
|
+
}
|
|
43
|
+
https.get(url, (res) => {
|
|
44
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
45
|
+
res.resume();
|
|
46
|
+
return fetchUrl(res.headers.location, redirectCount + 1).then(resolve).catch(reject);
|
|
47
|
+
}
|
|
48
|
+
if (res.statusCode !== 200) {
|
|
49
|
+
return reject(new Error(`Failed to fetch ${url}: HTTP ${res.statusCode}`));
|
|
50
|
+
}
|
|
51
|
+
resolve(res);
|
|
52
|
+
}).on('error', reject);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function downloadFile(url, dest) {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
fetchUrl(url).then(res => {
|
|
59
|
+
const file = fs.createWriteStream(dest);
|
|
60
|
+
|
|
61
|
+
const handleError = (err) => {
|
|
62
|
+
file.close(() => {
|
|
63
|
+
if (fs.existsSync(dest)) fs.unlinkSync(dest);
|
|
64
|
+
reject(err);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
res.on('error', handleError);
|
|
69
|
+
file.on('error', handleError);
|
|
70
|
+
|
|
71
|
+
res.pipe(file);
|
|
72
|
+
file.on('finish', () => {
|
|
73
|
+
file.close(() => {
|
|
74
|
+
resolve();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}).catch(reject);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function verifyChecksum(filePath, fileName, expectedShasums) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const hash = crypto.createHash('sha256');
|
|
84
|
+
const stream = fs.createReadStream(filePath);
|
|
85
|
+
stream.on('data', data => hash.update(data));
|
|
86
|
+
stream.on('end', () => {
|
|
87
|
+
const fileHash = hash.digest('hex');
|
|
88
|
+
const expectedLines = expectedShasums.split('\n');
|
|
89
|
+
const expectedLine = expectedLines.find(line => line.includes(fileName));
|
|
90
|
+
if (!expectedLine) {
|
|
91
|
+
return reject(new Error(`Checksum for ${fileName} not found in SHASUMS256.txt`));
|
|
92
|
+
}
|
|
93
|
+
const expectedHash = expectedLine.split(/\s+/)[0];
|
|
94
|
+
if (fileHash !== expectedHash) {
|
|
95
|
+
return reject(new Error(`Checksum mismatch for ${fileName}. Expected: ${expectedHash}, Actual: ${fileHash}`));
|
|
96
|
+
}
|
|
97
|
+
resolve();
|
|
98
|
+
});
|
|
99
|
+
stream.on('error', reject);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function main() {
|
|
104
|
+
const shasumTmpPath = path.join(binDir, 'SHASUMS256.txt.tmp');
|
|
105
|
+
try {
|
|
106
|
+
console.log(`Downloading SHASUMS256.txt from ${shasumUrl}`);
|
|
107
|
+
// moved to top
|
|
108
|
+
await downloadFile(shasumUrl, shasumTmpPath);
|
|
109
|
+
const expectedShasums = fs.readFileSync(shasumTmpPath, 'utf8');
|
|
110
|
+
|
|
111
|
+
console.log(`Downloading ${assetName} from ${assetUrl}`);
|
|
112
|
+
await downloadFile(assetUrl, tmpPath);
|
|
113
|
+
|
|
114
|
+
console.log(`Verifying checksum for ${assetName}`);
|
|
115
|
+
await verifyChecksum(tmpPath, assetName, expectedShasums);
|
|
116
|
+
console.log('Checksum verified.');
|
|
117
|
+
|
|
118
|
+
if (platform === 'darwin') {
|
|
119
|
+
console.log('Extracting macOS bundle...');
|
|
120
|
+
const extractTmpDir = path.join(binDir, 'tmp-extract');
|
|
121
|
+
if (fs.existsSync(extractTmpDir)) fs.rmSync(extractTmpDir, { recursive: true, force: true });
|
|
122
|
+
fs.mkdirSync(extractTmpDir, { recursive: true });
|
|
123
|
+
try {
|
|
124
|
+
execSync(`tar -xzf "${tmpPath}" -C "${extractTmpDir}"`);
|
|
125
|
+
const extractedFiles = fs.readdirSync(extractTmpDir);
|
|
126
|
+
for (const file of extractedFiles) {
|
|
127
|
+
const dest = path.join(binDir, file);
|
|
128
|
+
if (fs.existsSync(dest)) fs.rmSync(dest, { recursive: true, force: true });
|
|
129
|
+
fs.renameSync(path.join(extractTmpDir, file), dest);
|
|
130
|
+
}
|
|
131
|
+
} finally {
|
|
132
|
+
if (fs.existsSync(extractTmpDir)) fs.rmSync(extractTmpDir, { recursive: true, force: true });
|
|
133
|
+
}
|
|
134
|
+
fs.unlinkSync(tmpPath);
|
|
135
|
+
} else {
|
|
136
|
+
const finalBinPath = path.join(binDir, platform === 'win32' ? 'agentscommander.exe' : 'agentscommander');
|
|
137
|
+
if (platform !== 'win32') {
|
|
138
|
+
fs.chmodSync(tmpPath, 0o755);
|
|
139
|
+
}
|
|
140
|
+
fs.renameSync(tmpPath, finalBinPath);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
fs.unlinkSync(shasumTmpPath);
|
|
144
|
+
console.log('Installation completed successfully.');
|
|
145
|
+
} catch (err) {
|
|
146
|
+
console.error('Installation failed:', err.message);
|
|
147
|
+
if (fs.existsSync(tmpPath)) fs.unlinkSync(tmpPath);
|
|
148
|
+
if (typeof shasumTmpPath !== 'undefined' && fs.existsSync(shasumTmpPath)) fs.unlinkSync(shasumTmpPath);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mblua/agentscommander",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Install and run AgentsCommander, the local terminal session manager for AI coding agent teams.",
|
|
3
|
+
"version": "0.30.3",
|
|
4
|
+
"description": "Install and run AgentsCommander, the local terminal session manager for AI coding agent teams with Claude Code, Codex, Hermes, Cursor CLI, OpenCode, and more to come.",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"bin": {
|
|
6
7
|
"agentscommander": "run.js"
|
|
7
8
|
},
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
"engines": {
|
|
16
17
|
"node": ">=18.0.0"
|
|
17
18
|
},
|
|
18
|
-
"homepage": "https://
|
|
19
|
+
"homepage": "https://agentscommander.dev",
|
|
19
20
|
"bugs": {
|
|
20
21
|
"url": "https://github.com/mblua/AgentsCommander/issues"
|
|
21
22
|
},
|
|
@@ -28,6 +29,6 @@
|
|
|
28
29
|
],
|
|
29
30
|
"repository": {
|
|
30
31
|
"type": "git",
|
|
31
|
-
"url": "https://github.com/mblua/AgentsCommander.git"
|
|
32
|
+
"url": "git+https://github.com/mblua/AgentsCommander.git"
|
|
32
33
|
}
|
|
33
34
|
}
|
package/run.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { spawn } = require('child_process');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const os = require('os');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
|
|
7
|
-
const binName = os.platform() === 'win32' ? 'agentscommander.exe' : 'agentscommander';
|
|
8
|
-
const binPath = path.join(__dirname, 'bin', binName);
|
|
9
|
-
|
|
10
|
-
if (!fs.existsSync(binPath)) {
|
|
11
|
-
console.error(`Error: Cannot find AgentsCommander executable at ${binPath}`);
|
|
12
|
-
console.error('Please ensure the package was installed correctly.');
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const child = spawn(binPath, process.argv.slice(2), {
|
|
17
|
-
stdio: 'inherit',
|
|
18
|
-
windowsHide: true
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
child.on('error', (err) => {
|
|
22
|
-
console.error('Failed to start AgentsCommander:', err.message);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
child.on('exit', (code, signal) => {
|
|
27
|
-
if (signal) {
|
|
28
|
-
try {
|
|
29
|
-
process.kill(process.pid, signal);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
process.exit(code !== null ? code : 1);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const signals = ['SIGINT', 'SIGTERM', 'SIGQUIT'];
|
|
39
|
-
signals.forEach(sig => {
|
|
40
|
-
process.on(sig, () => {
|
|
41
|
-
if (child && !child.killed) {
|
|
42
|
-
child.kill(sig);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawn } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const binName = os.platform() === 'win32' ? 'agentscommander.exe' : 'agentscommander';
|
|
8
|
+
const binPath = path.join(__dirname, 'bin', binName);
|
|
9
|
+
|
|
10
|
+
if (!fs.existsSync(binPath)) {
|
|
11
|
+
console.error(`Error: Cannot find AgentsCommander executable at ${binPath}`);
|
|
12
|
+
console.error('Please ensure the package was installed correctly.');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const child = spawn(binPath, process.argv.slice(2), {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
windowsHide: true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
child.on('error', (err) => {
|
|
22
|
+
console.error('Failed to start AgentsCommander:', err.message);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.on('exit', (code, signal) => {
|
|
27
|
+
if (signal) {
|
|
28
|
+
try {
|
|
29
|
+
process.kill(process.pid, signal);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
process.exit(code !== null ? code : 1);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGQUIT'];
|
|
39
|
+
signals.forEach(sig => {
|
|
40
|
+
process.on(sig, () => {
|
|
41
|
+
if (child && !child.killed) {
|
|
42
|
+
child.kill(sig);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|