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