fellow-agents 0.0.10 → 0.0.11
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/dist/commands/start.js +35 -8
- package/package.json +1 -1
package/dist/commands/start.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync } from "fs";
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
2
2
|
import http from "http";
|
|
3
3
|
import { join, resolve } from "path";
|
|
4
4
|
import { execSync } from "child_process";
|
|
@@ -7,6 +7,15 @@ import { downloadBinaries } from "../lib/download.js";
|
|
|
7
7
|
import { startEmcomServer, startPtyWin, stopAll, logPath } from "../lib/services.js";
|
|
8
8
|
import { scaffoldWorkspaces, registerAgents, writeHooks } from "../lib/workspaces.js";
|
|
9
9
|
import { binarySuffix } from "../lib/platform.js";
|
|
10
|
+
// Minimal engines.node range check — handles ">=N", "<N", and combinations.
|
|
11
|
+
function nodeInRange(version, range) {
|
|
12
|
+
const major = parseInt(version.split(".")[0], 10);
|
|
13
|
+
const minMatch = range.match(/>=?\s*(\d+)/);
|
|
14
|
+
const maxMatch = range.match(/<\s*(\d+)/);
|
|
15
|
+
const min = minMatch ? parseInt(minMatch[1], 10) : 0;
|
|
16
|
+
const max = maxMatch ? parseInt(maxMatch[1], 10) : Infinity;
|
|
17
|
+
return major >= min && major < max;
|
|
18
|
+
}
|
|
10
19
|
export async function start(opts) {
|
|
11
20
|
console.log("");
|
|
12
21
|
console.log(" fellow-agents");
|
|
@@ -53,16 +62,34 @@ export async function start(opts) {
|
|
|
53
62
|
}
|
|
54
63
|
// 3. Install pty-win dependencies
|
|
55
64
|
console.log("[3/7] Installing pty-win...");
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
execSync("npm install --production", { cwd: ptyWinDir, stdio: "pipe" });
|
|
59
|
-
}
|
|
60
|
-
console.log(" pty-win ready");
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
65
|
+
const ptyPkgPath = join(ptyWinDir, "package.json");
|
|
66
|
+
if (!existsSync(ptyPkgPath)) {
|
|
63
67
|
console.error(" pty-win not found — download may have failed");
|
|
64
68
|
process.exit(1);
|
|
65
69
|
}
|
|
70
|
+
// Warn fail-fast if Node is outside pty-win's supported range
|
|
71
|
+
try {
|
|
72
|
+
const ptyPkg = JSON.parse(readFileSync(ptyPkgPath, "utf-8"));
|
|
73
|
+
const range = ptyPkg.engines?.node;
|
|
74
|
+
if (range && !nodeInRange(nodeVer, range)) {
|
|
75
|
+
console.error(` WARNING: pty-win supports Node ${range}, you have ${nodeVer}.`);
|
|
76
|
+
console.error(` Install may fail. Consider using Node 22 LTS.`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch { }
|
|
80
|
+
// Probe for a real dep instead of just node_modules/ — partial installs leave the dir but miss packages
|
|
81
|
+
const expressInstalled = existsSync(join(ptyWinDir, "node_modules", "express", "package.json"));
|
|
82
|
+
if (!expressInstalled) {
|
|
83
|
+
try {
|
|
84
|
+
execSync("npm install --omit=dev", { cwd: ptyWinDir, stdio: "inherit" });
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
console.error(` pty-win install failed — see output above`);
|
|
88
|
+
console.error(` Logs will be written to: ${logPath("pty-win")}`);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
console.log(" pty-win ready");
|
|
66
93
|
// 4. Scaffold workspaces
|
|
67
94
|
console.log("[4/7] Scaffolding workspaces...");
|
|
68
95
|
scaffoldWorkspaces(workDir);
|