@appchy/jarvis 0.1.30 → 0.1.32

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.
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Jarvis CLI — Dev Launcher
5
+ *
6
+ * Always runs `tsx src/bin.ts` against the source tree so the dev binary
7
+ * can coexist on PATH with the prod `jarvis` (which runs `dist/bin.js`).
8
+ *
9
+ * Errors out cleanly if the source tree isn't present (e.g. someone
10
+ * installed the published prod package and got `jarvis-dev` along for
11
+ * the ride — there's nothing for it to run).
12
+ */
13
+
14
+ import { fileURLToPath } from "url";
15
+ import { dirname, join } from "path";
16
+ import { existsSync } from "fs";
17
+ import { execFileSync } from "child_process";
18
+
19
+ const __dirname = dirname(fileURLToPath(import.meta.url));
20
+ const root = join(__dirname, "..");
21
+ const srcEntry = join(root, "src", "bin.ts");
22
+ const tsxBin = join(root, "node_modules", ".bin", "tsx");
23
+
24
+ if (!existsSync(srcEntry)) {
25
+ console.error(
26
+ "jarvis-dev requires the source tree (apps/cli/src/bin.ts).\n" +
27
+ "Run it from a checkout of the repo, or use `jarvis` (prod) instead.",
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ try {
33
+ execFileSync(tsxBin, [srcEntry, ...process.argv.slice(2)], {
34
+ stdio: "inherit",
35
+ cwd: process.cwd(),
36
+ env: { ...process.env, NODE_NO_WARNINGS: "1" },
37
+ });
38
+ } catch (err) {
39
+ process.exit(err.status ?? 1);
40
+ }