loom-agent 1.2.1 → 1.2.4
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-tui.js +7 -2
- package/package.json +1 -1
- package/src/core/cli.js +7 -2
- package/src/tui-bootstrap.js +12 -0
- package/src/tui-open.tsx +1 -1
package/bin/loom-tui.js
CHANGED
|
@@ -26,13 +26,18 @@ function findBun() {
|
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const entry = path.join(__dirname, '..', 'src', 'tui-
|
|
29
|
+
const entry = path.join(__dirname, '..', 'src', 'tui-bootstrap.js');
|
|
30
|
+
// Start bun from the package root so it discovers our bunfig.toml/tsconfig.json
|
|
31
|
+
// (Solid JSX preloader); the user's real cwd rides along in LOOM_START_CWD and
|
|
32
|
+
// is restored by the bootstrap shim before app code runs.
|
|
33
|
+
const pkgRoot = path.join(__dirname, '..');
|
|
34
|
+
process.env.LOOM_START_CWD = process.cwd();
|
|
30
35
|
const bun = findBun();
|
|
31
36
|
|
|
32
37
|
if (bun) {
|
|
33
38
|
const result = spawnSync(bun, ['run', entry, ...process.argv.slice(2)], {
|
|
34
39
|
stdio: 'inherit',
|
|
35
|
-
cwd:
|
|
40
|
+
cwd: pkgRoot,
|
|
36
41
|
env: process.env,
|
|
37
42
|
});
|
|
38
43
|
process.exit(result.status ?? 0);
|
package/package.json
CHANGED
package/src/core/cli.js
CHANGED
|
@@ -557,15 +557,20 @@ if (args.includes('--help') || args.includes('-h')) {
|
|
|
557
557
|
if (canRaw) {
|
|
558
558
|
// Launch new OpenTUI TUI via bun
|
|
559
559
|
const bunPath = findBun();
|
|
560
|
-
const tuiEntry = path.join(__dirname, '..', 'tui-
|
|
560
|
+
const tuiEntry = path.join(__dirname, '..', 'tui-bootstrap.js');
|
|
561
561
|
if (bunPath && fs.existsSync(tuiEntry)) {
|
|
562
562
|
const { spawnSync } = require('child_process');
|
|
563
|
+
// Start bun from the package root so it discovers bunfig.toml /
|
|
564
|
+
// tsconfig.json (Solid JSX preloader) even for global installs;
|
|
565
|
+
// LOOM_START_CWD restores the user's project dir in tui-bootstrap.js.
|
|
566
|
+
const pkgRoot = path.join(__dirname, '..', '..');
|
|
567
|
+
process.env.LOOM_START_CWD = process.cwd();
|
|
563
568
|
const tuiArgs = [tuiEntry];
|
|
564
569
|
if (sessionId) tuiArgs.push('-s', sessionId);
|
|
565
570
|
if (autoMode) tuiArgs.push('--auto');
|
|
566
571
|
const prompt = promptArgs.join(' ');
|
|
567
572
|
if (prompt) tuiArgs.push(...prompt.split(/\s+/));
|
|
568
|
-
process.exit(spawnSync(bunPath, tuiArgs, { stdio: 'inherit', env: process.env }).status ?? 0);
|
|
573
|
+
process.exit(spawnSync(bunPath, tuiArgs, { stdio: 'inherit', cwd: pkgRoot, env: process.env }).status ?? 0);
|
|
569
574
|
}
|
|
570
575
|
console.error('[loom] bun not found — full TUI requires bun (https://bun.sh/). Falling back to line-mode REPL.');
|
|
571
576
|
console.error('[loom] Use --basic to skip this warning.\n');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Bootstrap shim for globally-installed launches.
|
|
2
|
+
//
|
|
3
|
+
// Bun only discovers bunfig.toml / tsconfig.json by walking UP from its
|
|
4
|
+
// working directory. When installed via npm the package lives outside the
|
|
5
|
+
// user's project tree, so launchers start bun from the PACKAGE root (where
|
|
6
|
+
// those files ship) and hand the real project directory through
|
|
7
|
+
// LOOM_START_CWD. This file must stay import-free so the chdir happens
|
|
8
|
+
// before any Loom module (which may read cwd at import time) executes.
|
|
9
|
+
if (process.env.LOOM_START_CWD) {
|
|
10
|
+
try { process.chdir(process.env.LOOM_START_CWD); } catch {}
|
|
11
|
+
}
|
|
12
|
+
await import("./tui-open.tsx");
|
package/src/tui-open.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { defaultMcpInstall } from "./core/plugin-cmd.js";
|
|
|
8
8
|
const args = process.argv.slice(2);
|
|
9
9
|
|
|
10
10
|
if (args.includes("--version") || args.includes("-v")) {
|
|
11
|
-
console.log(
|
|
11
|
+
console.log(`loom-code v${import.meta.require("../package.json").version}`);
|
|
12
12
|
process.exit(0);
|
|
13
13
|
}
|
|
14
14
|
|