cicy-code 2.1.56 → 2.1.58
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 +28 -3
- package/package.json +6 -5
package/bin/cicy-code.js
CHANGED
|
@@ -17,13 +17,15 @@ const args = process.argv.slice(2);
|
|
|
17
17
|
const PORT = process.env.PORT || '8008';
|
|
18
18
|
|
|
19
19
|
const platformPkg = `cicy-code-${process.platform}-${process.arch}`;
|
|
20
|
+
// win32 ships the binary with the .exe extension (CreateProcess requires it).
|
|
21
|
+
const binName = process.platform === 'win32' ? 'cicy-code.exe' : 'cicy-code';
|
|
20
22
|
let binPath;
|
|
21
23
|
try {
|
|
22
|
-
binPath = require.resolve(`${platformPkg}
|
|
24
|
+
binPath = require.resolve(`${platformPkg}/${binName}`);
|
|
23
25
|
} catch {
|
|
24
26
|
console.error(`cicy-code: no prebuilt binary for ${process.platform}-${process.arch}.`);
|
|
25
27
|
console.error(`The optional dependency "${platformPkg}" is not installed.`);
|
|
26
|
-
console.error(`Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64.`);
|
|
28
|
+
console.error(`Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64.`);
|
|
27
29
|
console.error(`Reinstall: npm install -g cicy-code` +
|
|
28
30
|
` (in China add --registry=https://registry.npmmirror.com)`);
|
|
29
31
|
process.exit(1);
|
|
@@ -66,6 +68,19 @@ function ensurePortFree(port) {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
function pidOnPort(port) {
|
|
71
|
+
// win32: netstat -ano (no lsof/ss).
|
|
72
|
+
if (process.platform === 'win32') {
|
|
73
|
+
try {
|
|
74
|
+
const out = execSync(`netstat -ano -p TCP`, {
|
|
75
|
+
encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'],
|
|
76
|
+
});
|
|
77
|
+
for (const line of out.split('\n')) {
|
|
78
|
+
const m = line.match(/TCP\s+\S+:(\d+)\s+\S+\s+LISTENING\s+(\d+)/);
|
|
79
|
+
if (m && m[1] === String(port)) return m[2];
|
|
80
|
+
}
|
|
81
|
+
} catch {}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
69
84
|
// lsof first (macOS + Linux), then ss (Linux without lsof).
|
|
70
85
|
try {
|
|
71
86
|
const out = execSync(`lsof -ti TCP:${port} -sTCP:LISTEN`, {
|
|
@@ -84,6 +99,15 @@ function pidOnPort(port) {
|
|
|
84
99
|
}
|
|
85
100
|
|
|
86
101
|
function processCommand(pid) {
|
|
102
|
+
if (process.platform === 'win32') {
|
|
103
|
+
try {
|
|
104
|
+
const out = execSync(`tasklist /fi "PID eq ${pid}" /fo csv /nh`, {
|
|
105
|
+
encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'],
|
|
106
|
+
});
|
|
107
|
+
const m = out.match(/^"([^"]+)"/);
|
|
108
|
+
return m ? m[1] : '';
|
|
109
|
+
} catch { return ''; }
|
|
110
|
+
}
|
|
87
111
|
try {
|
|
88
112
|
return execSync(`ps -p ${pid} -o command=`, {
|
|
89
113
|
encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'],
|
|
@@ -100,7 +124,8 @@ function waitExit(pid, timeoutMs) {
|
|
|
100
124
|
const start = Date.now();
|
|
101
125
|
while (Date.now() - start < timeoutMs) {
|
|
102
126
|
if (!isAlive(pid)) return true;
|
|
103
|
-
|
|
127
|
+
// Portable 200ms block (win32 has no `sleep`).
|
|
128
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 200);
|
|
104
129
|
}
|
|
105
130
|
return !isAlive(pid);
|
|
106
131
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.58",
|
|
7
7
|
"description": "CiCy Code - AI-powered development environment",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "cicybot",
|
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
"bin/cicy-code.js"
|
|
17
17
|
],
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"cicy-code-darwin-arm64": "2.1.
|
|
20
|
-
"cicy-code-darwin-x64": "2.1.
|
|
21
|
-
"cicy-code-linux-x64": "2.1.
|
|
22
|
-
"cicy-code-linux-arm64": "2.1.
|
|
19
|
+
"cicy-code-darwin-arm64": "2.1.58",
|
|
20
|
+
"cicy-code-darwin-x64": "2.1.58",
|
|
21
|
+
"cicy-code-linux-x64": "2.1.58",
|
|
22
|
+
"cicy-code-linux-arm64": "2.1.58",
|
|
23
|
+
"cicy-code-win32-x64": "2.1.58"
|
|
23
24
|
},
|
|
24
25
|
"repository": {
|
|
25
26
|
"type": "git",
|