cortad 0.3.0-rc.5 → 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 +18 -1
- package/package.json +1 -1
package/local.mjs
CHANGED
|
@@ -682,8 +682,25 @@ async function installOnce(said) {
|
|
|
682
682
|
return true;
|
|
683
683
|
}
|
|
684
684
|
|
|
685
|
+
// The port their start command names, moved when something else already holds it: two apps on one
|
|
686
|
+
// laptop both said --port 8000, and the second attached to the first's server as its own.
|
|
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) {
|
|
692
|
+
const m = /(--port[= ]|-p |\bPORT=)(\d{4,5})\b/.exec(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) } };
|
|
700
|
+
}
|
|
701
|
+
|
|
685
702
|
async function start(waitMs) {
|
|
686
|
-
const { cmd, lifted } = launched;
|
|
703
|
+
const { cmd, lifted } = await freed(launched.cmd, launched.lifted ?? {});
|
|
687
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 });
|
|
688
705
|
const mine = child;
|
|
689
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"
|