clawdock 0.2.1 → 0.2.3

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -311,13 +311,20 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
311
311
  const [runtimeName, runtimeVersion] = runtimeSpec.split("@");
312
312
  console.log(`\u{1F50D} Checking runtime: ${runtimeName}...`);
313
313
  let runtimeBin = null;
314
+ const isWindows = process.platform === "win32";
315
+ const whichCmd = isWindows ? "where" : "which";
316
+ const devNull = isWindows ? "2>NUL" : "2>/dev/null";
314
317
  if (runtimeName === "openclaw") {
315
318
  try {
316
- const which = execSync("which openclaw 2>/dev/null", { encoding: "utf-8" }).trim();
317
- if (which) {
318
- runtimeBin = which;
319
- const ver = execSync("openclaw --version 2>/dev/null", { encoding: "utf-8" }).trim();
320
- console.log(` Found openclaw ${ver}`);
319
+ const found = execSync(`${whichCmd} openclaw ${devNull}`, { encoding: "utf-8" }).trim().split("\n")[0];
320
+ if (found) {
321
+ runtimeBin = found;
322
+ try {
323
+ const ver = execSync(`openclaw --version ${devNull}`, { encoding: "utf-8" }).trim();
324
+ console.log(` Found openclaw ${ver}`);
325
+ } catch {
326
+ console.log(` Found openclaw at ${found}`);
327
+ }
321
328
  }
322
329
  } catch {
323
330
  }
@@ -325,7 +332,7 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
325
332
  console.log(" OpenClaw not found. Installing via npm...");
326
333
  try {
327
334
  execSync("npm install -g openclaw", { stdio: "inherit" });
328
- runtimeBin = execSync("which openclaw", { encoding: "utf-8" }).trim();
335
+ runtimeBin = execSync(`${whichCmd} openclaw`, { encoding: "utf-8" }).trim().split("\n")[0];
329
336
  console.log(" \u2705 OpenClaw installed");
330
337
  } catch {
331
338
  console.error("\u274C Failed to install OpenClaw. Install manually:");
@@ -337,11 +344,11 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
337
344
  const candidates = [
338
345
  "nullclaw",
339
346
  path.join(os.homedir(), ".nullclaw", "bin", "nullclaw"),
340
- "/usr/local/bin/nullclaw"
347
+ ...isWindows ? [] : ["/usr/local/bin/nullclaw"]
341
348
  ];
342
349
  for (const c of candidates) {
343
350
  try {
344
- execSync(`which ${c} 2>/dev/null || test -x ${c}`, { stdio: "pipe" });
351
+ execSync(`${whichCmd} ${c} ${devNull}`, { stdio: "pipe" });
345
352
  runtimeBin = c;
346
353
  break;
347
354
  } catch {
@@ -395,7 +402,7 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
395
402
  console.log();
396
403
  if (runtimeName === "openclaw") {
397
404
  try {
398
- const list = execSync("openclaw agents list --json 2>/dev/null", { encoding: "utf-8" });
405
+ const list = execSync(`openclaw agents list --json ${devNull}`, { encoding: "utf-8", shell: isWindows ? "cmd.exe" : void 0 });
399
406
  const agents = JSON.parse(list);
400
407
  if (!agents.find((a) => a.name === agentName)) {
401
408
  throw new Error("not found");
@@ -426,7 +433,8 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
426
433
  ["agent", "--agent", agentName, "--prompt", "Hello! I just pulled you from ClawDock. Introduce yourself."],
427
434
  {
428
435
  stdio: "inherit",
429
- env: { ...process.env }
436
+ env: { ...process.env },
437
+ shell: isWindows
430
438
  }
431
439
  );
432
440
  child.on("error", (err) => {
@@ -460,7 +468,8 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
460
468
  fs.writeFileSync(configPath, JSON.stringify(nullclawConfig, null, 2));
461
469
  const child = spawn(runtimeBin, ["--config", configPath, "--workspace", workspaceDir], {
462
470
  stdio: "inherit",
463
- cwd: workspaceDir
471
+ cwd: workspaceDir,
472
+ shell: isWindows
464
473
  });
465
474
  child.on("error", (err) => {
466
475
  console.error(`\u274C Failed to start NullClaw: ${err.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawdock",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "CLI for ClawDock — the agent registry",
5
5
  "bin": {
6
6
  "clawdock": "./dist/index.js"