loom-agent 1.2.17 → 1.2.19
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/loom-bun.js +7 -5
- package/bin/loom-tui.js +30 -30
- package/package.json +1 -1
package/bin/loom-bun.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const { spawnSync } = require("child_process");
|
|
6
6
|
|
|
7
|
-
// Bun discovers bunfig.toml ONLY from its starting cwd
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// Bun discovers bunfig.toml ONLY from its starting cwd, and the Solid JSX
|
|
8
|
+
// plugin ONLY works when loaded through that bunfig preload phase — runtime
|
|
9
|
+
// registration from another cwd silently no-ops (proven). So unless bun is
|
|
10
|
+
// ALREADY sitting in the package root, respawn it there once. The user's
|
|
11
|
+
// real directory rides along in LOOM_START_CWD and is restored by
|
|
12
|
+
// tui-open.tsx after its imports finish loading.
|
|
11
13
|
const pkgRoot = path.join(__dirname, "..");
|
|
12
14
|
const underBun = typeof Bun !== "undefined" && !!process.versions.bun;
|
|
13
15
|
const inPkgRoot = path.resolve(process.cwd()) === path.resolve(pkgRoot);
|
|
@@ -37,4 +39,4 @@ process.title = "loom-code";
|
|
|
37
39
|
console.error(err && err.message ? err.message : String(err));
|
|
38
40
|
process.exit(1);
|
|
39
41
|
}
|
|
40
|
-
})();
|
|
42
|
+
})();
|
package/bin/loom-tui.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
// npm invokes bin targets through Node on Windows, so re-launch under Bun
|
|
3
|
-
// when this file was not started by Bun itself.
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const { spawnSync } = require("child_process");
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(async () => { await import("../src/tui-open.tsx"); })();
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// npm invokes bin targets through Node on Windows, so re-launch under Bun
|
|
3
|
+
// when this file was not started by Bun itself.
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
|
|
7
|
+
// Respawn from the package root so bunfig.toml's preload chain (Solid JSX
|
|
8
|
+
// transform) loads natively — see bin/loom-bun.js.
|
|
9
|
+
const pkgRoot = path.join(__dirname, "..");
|
|
10
|
+
const underBun = typeof Bun !== "undefined" && !!process.versions.bun;
|
|
11
|
+
const inPkgRoot = path.resolve(process.cwd()) === path.resolve(pkgRoot);
|
|
12
|
+
if (!underBun || !inPkgRoot) {
|
|
13
|
+
const result = spawnSync(
|
|
14
|
+
process.platform === "win32" ? "bun.exe" : "bun",
|
|
15
|
+
[__filename, ...process.argv.slice(2)],
|
|
16
|
+
{
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
cwd: pkgRoot,
|
|
19
|
+
env: { ...process.env, LOOM_START_CWD: process.env.LOOM_START_CWD || process.cwd() },
|
|
20
|
+
windowsHide: false,
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
if (result.error) {
|
|
24
|
+
console.error("[loom] Bun is required for the TUI. Install it from https://bun.sh/");
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
process.exit(result.status == null ? 1 : result.status);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
(async () => { await import("../src/tui-open.tsx"); })();
|