clawdock 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +31 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -303,21 +303,28 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
303
303
  const model = opts.model || rt.model;
304
304
  const runtimeSpec = opts.runtime || rt.runtime || "openclaw@latest";
305
305
  if (!provider || !apiKey) {
306
- console.error("\u274C No runtime credentials configured.");
307
- console.error(" Run: clawdock credentials set");
308
- console.error(" Or pass --provider and --api-key");
309
- process.exit(1);
306
+ console.log("\u2139\uFE0F No runtime credentials configured \u2014 launching without provider override.");
307
+ console.log(" To set defaults: clawdock credentials set");
308
+ console.log(" Or pass --provider and --api-key");
309
+ console.log();
310
310
  }
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 {
@@ -386,12 +393,12 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
386
393
  console.error(" Run without --no-pull to download first.");
387
394
  process.exit(1);
388
395
  }
389
- const resolvedModel = model || `${provider}/claude-sonnet-4`;
396
+ const resolvedModel = model || (provider ? `${provider}/claude-sonnet-4` : null);
390
397
  console.log(`
391
398
  \u{1F980} Starting ${owner}/${slug}...`);
392
399
  console.log(` Runtime: ${runtimeSpec}`);
393
400
  console.log(` Workspace: ${workspaceDir}`);
394
- console.log(` Model: ${resolvedModel}`);
401
+ if (resolvedModel) console.log(` Model: ${resolvedModel}`);
395
402
  console.log();
396
403
  if (runtimeName === "openclaw") {
397
404
  try {
@@ -403,8 +410,9 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
403
410
  } catch {
404
411
  console.log(` Registering agent "${agentName}"...`);
405
412
  try {
413
+ const modelFlag = resolvedModel ? ` --model ${resolvedModel}` : "";
406
414
  execSync(
407
- `openclaw agents add ${agentName} --workspace ${workspaceDir} --model ${resolvedModel} --non-interactive`,
415
+ `openclaw agents add ${agentName} --workspace ${workspaceDir}${modelFlag} --non-interactive`,
408
416
  { stdio: "inherit" }
409
417
  );
410
418
  } catch (err) {
@@ -412,13 +420,14 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
412
420
  process.exit(1);
413
421
  }
414
422
  }
415
- const agentDir = path.join(os.homedir(), ".openclaw", "agents", agentName, "agent");
416
- const authDir = path.join(agentDir);
417
- fs.mkdirSync(authDir, { recursive: true });
418
- const authProfilesPath = path.join(authDir, "auth-profiles.json");
419
- const authProfiles = {};
420
- authProfiles[provider] = { type: "api-key", apiKey };
421
- fs.writeFileSync(authProfilesPath, JSON.stringify(authProfiles, null, 2));
423
+ if (provider && apiKey) {
424
+ const agentDir = path.join(os.homedir(), ".openclaw", "agents", agentName, "agent");
425
+ fs.mkdirSync(agentDir, { recursive: true });
426
+ const authProfilesPath = path.join(agentDir, "auth-profiles.json");
427
+ const authProfiles = {};
428
+ authProfiles[provider] = { type: "api-key", apiKey };
429
+ fs.writeFileSync(authProfilesPath, JSON.stringify(authProfiles, null, 2));
430
+ }
422
431
  const child = spawn(
423
432
  runtimeBin,
424
433
  ["agent", "--agent", agentName, "--prompt", "Hello! I just pulled you from ClawDock. Introduce yourself."],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawdock",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "CLI for ClawDock — the agent registry",
5
5
  "bin": {
6
6
  "clawdock": "./dist/index.js"