@love-moon/conductor-cli 0.2.27 → 0.2.28
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/package.json +4 -4
- package/src/native-deps.js +34 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@love-moon/conductor-cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"gitCommitId": "
|
|
3
|
+
"version": "0.2.28",
|
|
4
|
+
"gitCommitId": "c690738",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"conductor": "bin/conductor.js"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"test": "node --test test/*.test.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@love-moon/ai-sdk": "0.2.
|
|
21
|
-
"@love-moon/conductor-sdk": "0.2.
|
|
20
|
+
"@love-moon/ai-sdk": "0.2.28",
|
|
21
|
+
"@love-moon/conductor-sdk": "0.2.28",
|
|
22
22
|
"dotenv": "^16.4.5",
|
|
23
23
|
"enquirer": "^2.4.1",
|
|
24
24
|
"js-yaml": "^4.1.1",
|
package/src/native-deps.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import process from "node:process";
|
|
3
4
|
import { spawn as spawnProcess } from "node:child_process";
|
|
@@ -166,6 +167,38 @@ export async function resolveGlobalPackageDirectory({
|
|
|
166
167
|
return path.join(normalizeRoot(rawRoot), packageName);
|
|
167
168
|
}
|
|
168
169
|
|
|
170
|
+
export function ensureNodePtySpawnHelperExecutableForPackageDirectory({
|
|
171
|
+
packageDirectory,
|
|
172
|
+
platform = process.platform,
|
|
173
|
+
arch = process.arch,
|
|
174
|
+
existsSync = fs.existsSync,
|
|
175
|
+
statSync = fs.statSync,
|
|
176
|
+
chmodSync = fs.chmodSync,
|
|
177
|
+
} = {}) {
|
|
178
|
+
if (!packageDirectory || platform === "win32") {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const helperCandidates = [
|
|
183
|
+
path.join(packageDirectory, "node_modules", "node-pty", "build", "Release", "spawn-helper"),
|
|
184
|
+
path.join(packageDirectory, "node_modules", "node-pty", "build", "Debug", "spawn-helper"),
|
|
185
|
+
path.join(packageDirectory, "node_modules", "node-pty", "prebuilds", `${platform}-${arch}`, "spawn-helper"),
|
|
186
|
+
];
|
|
187
|
+
const helperPath = helperCandidates.find((candidate) => existsSync(candidate));
|
|
188
|
+
if (!helperPath) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const currentMode = statSync(helperPath).mode & 0o777;
|
|
193
|
+
if ((currentMode & 0o111) !== 0) {
|
|
194
|
+
return { helperPath, updated: false };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const nextMode = currentMode | 0o111;
|
|
198
|
+
chmodSync(helperPath, nextMode);
|
|
199
|
+
return { helperPath, updated: true };
|
|
200
|
+
}
|
|
201
|
+
|
|
169
202
|
export function buildNodePtyVerificationScript() {
|
|
170
203
|
return String.raw`
|
|
171
204
|
const fs = require('node:fs');
|
|
@@ -252,6 +285,7 @@ export async function verifyNodePtyForPackageDirectory({
|
|
|
252
285
|
if (!packageDirectory) {
|
|
253
286
|
throw new Error("packageDirectory is required");
|
|
254
287
|
}
|
|
288
|
+
ensureNodePtySpawnHelperExecutableForPackageDirectory({ packageDirectory });
|
|
255
289
|
const result = await runCommand(nodeExecutable, ["-e", buildNodePtyVerificationScript(), packageDirectory], {
|
|
256
290
|
timeoutMs: 15_000,
|
|
257
291
|
});
|