cortad 0.3.0-rc.6 → 0.3.0-rc.7
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/local.mjs +13 -10
- package/package.json +1 -1
package/local.mjs
CHANGED
|
@@ -684,20 +684,23 @@ async function installOnce(said) {
|
|
|
684
684
|
|
|
685
685
|
// The port their start command names, moved when something else already holds it: two apps on one
|
|
686
686
|
// laptop both said --port 8000, and the second attached to the first's server as its own.
|
|
687
|
-
async function
|
|
687
|
+
async function freePortAbove(port) {
|
|
688
|
+
for (let next = port + 1; next < port + 30; next++) if (!(await listenerOn(next))) return next;
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
async function freed(cmd, lifted) {
|
|
688
692
|
const m = /(--port[= ]|-p |\bPORT=)(\d{4,5})\b/.exec(cmd);
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
return cmd;
|
|
693
|
+
const named = m ? Number(m[2]) : Number(lifted.PORT) || 0;
|
|
694
|
+
if (!named || !(await listenerOn(named))) return { cmd, lifted };
|
|
695
|
+
const port = await freePortAbove(named);
|
|
696
|
+
if (!port) return { cmd, lifted };
|
|
697
|
+
say(`port ${named} is taken on this machine, so your app starts on ${port}`);
|
|
698
|
+
// The same port their env file names, moved the same way.
|
|
699
|
+
return m ? { cmd: cmd.replace(m[0], `${m[1]}${port}`), lifted } : { cmd, lifted: { ...lifted, PORT: String(port) } };
|
|
696
700
|
}
|
|
697
701
|
|
|
698
702
|
async function start(waitMs) {
|
|
699
|
-
const { lifted } = launched;
|
|
700
|
-
const cmd = await freed(launched.cmd);
|
|
703
|
+
const { cmd, lifted } = await freed(launched.cmd, launched.lifted ?? {});
|
|
701
704
|
child = spawn("/bin/sh", ["-c", cmd], { cwd: appDir, env: { ...process.env, ...lifted, ...(capture ? capture.env(process.env) : {}), FORCE_COLOR: "0", ...(pinned.bin ? { PATH: `${pinned.bin}:${process.env.PATH ?? ""}` } : {}) }, stdio: ["ignore", "pipe", "pipe"], detached: true });
|
|
702
705
|
const mine = child;
|
|
703
706
|
let seen = "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortad",
|
|
3
|
-
"version": "0.3.0-rc.
|
|
3
|
+
"version": "0.3.0-rc.7",
|
|
4
4
|
"description": "Connects the AI app on your machine to Cortad for test conversations, and gives your coding agent the MCP and skill to run them. No dependencies.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cortad": "local.mjs"
|