create-metaclaw 3.3.1 → 3.3.2

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.
@@ -1,24 +1,32 @@
1
1
  #!/usr/bin/env node
2
- import { execFileSync } from "child_process";
3
2
  import { fileURLToPath } from "url";
4
3
  import { dirname, join } from "path";
5
- import { existsSync } from "fs";
6
4
 
7
5
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const root = join(__dirname, "..");
9
- const entry = join(root, "installer", "index.ts");
6
+ const entry = join(__dirname, "..", "installer", "index.ts");
10
7
 
11
- // Find tsx - check .bin for both unix and windows
12
- const candidates = [
13
- join(root, "node_modules", ".bin", "tsx.cmd"),
14
- join(root, "node_modules", ".bin", "tsx"),
15
- "tsx",
16
- ];
17
-
18
- let tsx = candidates.find((c) => c === "tsx" || existsSync(c)) || "tsx";
19
-
20
- try {
21
- execFileSync(tsx, [entry], { stdio: "inherit", cwd: root, shell: tsx.endsWith(".cmd") });
22
- } catch (e) {
23
- process.exit(e.status || 1);
24
- }
8
+ // Use tsx's programmatic API works regardless of where .bin lands
9
+ import("tsx/esm/api").then(({ register }) => {
10
+ register();
11
+ import(new URL(`file://${entry.replace(/\\/g, "/")}`).href);
12
+ }).catch(() => {
13
+ // Fallback: spawn tsx as a child process
14
+ import("child_process").then(({ execFileSync }) => {
15
+ import("fs").then(({ existsSync }) => {
16
+ const root = join(__dirname, "..");
17
+ const places = [
18
+ join(root, "node_modules", ".bin", "tsx.cmd"),
19
+ join(root, "node_modules", ".bin", "tsx"),
20
+ join(root, "..", ".bin", "tsx.cmd"),
21
+ join(root, "..", ".bin", "tsx"),
22
+ ];
23
+ const tsx = places.find(p => existsSync(p)) || "tsx";
24
+ try {
25
+ execFileSync(tsx, [entry], { stdio: "inherit", cwd: root, shell: tsx.endsWith(".cmd") });
26
+ } catch (e) {
27
+ console.error("Failed to start MetaClaw. Make sure tsx is installed: npm install -g tsx");
28
+ process.exit(1);
29
+ }
30
+ });
31
+ });
32
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-metaclaw",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "MetaClaw — Autonomous AI Agent Platform by Yonder Zenith LLC",
5
5
  "type": "module",
6
6
  "bin": {