@commandgarden/cli 1.1.5 → 1.2.0

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/main.js +14 -4
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -17244,6 +17244,7 @@ async function executeGuiStart(baseUrl, cgHome, appScript, opts) {
17244
17244
  const pid = parseInt(readFileSync7(pidPath, "utf-8").trim(), 10);
17245
17245
  if (isProcessAlive(pid)) {
17246
17246
  const message = "GUI is already running.";
17247
+ if (!opts.noOpen) openBrowser(`http://127.0.0.1:${appPort}`);
17247
17248
  return opts.background ? { status: "already-running", message } : message;
17248
17249
  }
17249
17250
  unlinkSync3(pidPath);
@@ -17348,12 +17349,15 @@ async function waitForServer(url, child) {
17348
17349
  return false;
17349
17350
  }
17350
17351
  function openBrowser(url) {
17352
+ console.error("Opening browser...");
17351
17353
  const child = process.platform === "darwin" ? spawn2("open", [url], { stdio: "ignore" }) : process.platform === "win32" ? spawn2("cmd", ["/c", "start", "", url], { stdio: "ignore" }) : spawn2("xdg-open", [url], { stdio: "ignore" });
17354
+ child.on("error", () => {
17355
+ });
17352
17356
  child.unref();
17353
17357
  }
17354
17358
 
17355
17359
  // src/commands/up-down.ts
17356
- async function executeUp(baseUrl, cgHome, daemonScript, appScript, configPath) {
17360
+ async function executeUp(baseUrl, cgHome, daemonScript, appScript, configPath, opts = {}) {
17357
17361
  const lines = [];
17358
17362
  const daemonResult = await executeDaemonStart(baseUrl, cgHome, daemonScript);
17359
17363
  lines.push(daemonResult.message);
@@ -17361,7 +17365,11 @@ async function executeUp(baseUrl, cgHome, daemonScript, appScript, configPath) {
17361
17365
  if (!canProceed) {
17362
17366
  return lines.join("\n");
17363
17367
  }
17364
- const guiResult = await executeGuiStart(baseUrl, cgHome, appScript, { background: true, configPath });
17368
+ const guiResult = await executeGuiStart(baseUrl, cgHome, appScript, {
17369
+ background: true,
17370
+ configPath,
17371
+ noOpen: opts.noOpen
17372
+ });
17365
17373
  lines.push(typeof guiResult === "string" ? guiResult : guiResult.message);
17366
17374
  return lines.join("\n");
17367
17375
  }
@@ -17479,8 +17487,10 @@ gui.command("stop").description("Stop the GUI").action(() => {
17479
17487
  gui.command("status").description("Check GUI status").action(() => {
17480
17488
  console.log(executeGuiStatus(CG_HOME));
17481
17489
  });
17482
- program2.command("up").description("Start daemon + GUI, open browser").action(async () => {
17483
- console.log(await executeUp(BASE_URL, CG_HOME, getDaemonScript(), getAppScript(), CONFIG_PATH));
17490
+ program2.command("up").description("Start daemon + GUI, open browser (use --no-open to skip)").option("--no-open", "Do not open browser").action(async (opts) => {
17491
+ console.log(await executeUp(BASE_URL, CG_HOME, getDaemonScript(), getAppScript(), CONFIG_PATH, {
17492
+ noOpen: opts.open === false
17493
+ }));
17484
17494
  });
17485
17495
  program2.command("down").description("Stop GUI + daemon").action(async () => {
17486
17496
  console.log(await executeDown(CG_HOME));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commandgarden/cli",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "description": "Enterprise browser automation CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",