@trops/dash-core 0.1.547 → 0.1.548

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.
@@ -50368,6 +50368,42 @@ function safeSend(win, channel, data) {
50368
50368
  }
50369
50369
  }
50370
50370
 
50371
+ /**
50372
+ * Resolve the working directory the spawned CLI should run in.
50373
+ *
50374
+ * Pure / no I/O — extracted so it can be unit-tested. The actual
50375
+ * mkdir + spawnOpts.cwd assignment happens at the spawn site.
50376
+ *
50377
+ * Why this exists: when the widget-builder modal launches the CLI in
50378
+ * lockdown mode, the spawned process inherits the parent (Electron)
50379
+ * process cwd. In a dev build that's the dash-electron project root,
50380
+ * which contains a CLAUDE.md describing the 4-phase development
50381
+ * workflow. The CLI auto-loads that file and the AI announces "Let me
50382
+ * scan the existing project to understand what's already here." —
50383
+ * exactly what the lockdown was meant to prevent.
50384
+ *
50385
+ * Resolution order:
50386
+ * 1. Caller passed an explicit cwd → use that (caller wins).
50387
+ * 2. disableTools: true and no cwd → scratch dir under os.tmpdir().
50388
+ * 3. Otherwise → null (caller doesn't set spawnOpts.cwd; the child
50389
+ * inherits the parent's cwd, preserving AssistantPanel behavior
50390
+ * where project context may be wanted).
50391
+ *
50392
+ * @param {object} opts
50393
+ * @param {string=} opts.cwd
50394
+ * @param {boolean=} opts.disableTools
50395
+ * @returns {string|null}
50396
+ */
50397
+ function resolveLockdownCwd({ cwd, disableTools = false } = {}) {
50398
+ if (cwd) return cwd;
50399
+ if (disableTools) {
50400
+ const os = require$$2$1;
50401
+ const path = require$$1$1;
50402
+ return path.join(os.tmpdir(), "dash-widget-builder-cli");
50403
+ }
50404
+ return null;
50405
+ }
50406
+
50371
50407
  /**
50372
50408
  * Build the argv array for spawning the Claude Code CLI.
50373
50409
  *
@@ -50619,12 +50655,13 @@ const cliController$2 = {
50619
50655
  // files directly without a shell — ENOENT otherwise.
50620
50656
  shell: IS_WINDOWS,
50621
50657
  };
50622
- if (cwd) {
50658
+ const resolvedCwd = resolveLockdownCwd({ cwd, disableTools });
50659
+ if (resolvedCwd) {
50623
50660
  const fs = require("fs");
50624
- if (!fs.existsSync(cwd)) {
50625
- fs.mkdirSync(cwd, { recursive: true });
50661
+ if (!fs.existsSync(resolvedCwd)) {
50662
+ fs.mkdirSync(resolvedCwd, { recursive: true });
50626
50663
  }
50627
- spawnOpts.cwd = cwd;
50664
+ spawnOpts.cwd = resolvedCwd;
50628
50665
  }
50629
50666
  const spawnCmd = IS_WINDOWS ? windowsQuote(binaryPath) : binaryPath;
50630
50667
  const spawnArgs = IS_WINDOWS ? args.map(windowsQuote) : args;
@@ -50946,6 +50983,7 @@ const cliController$2 = {
50946
50983
 
50947
50984
  cliController$3.exports = cliController$2;
50948
50985
  cliController$3.exports.buildClaudeCliArgs = buildClaudeCliArgs;
50986
+ cliController$3.exports.resolveLockdownCwd = resolveLockdownCwd;
50949
50987
 
50950
50988
  var cliControllerExports = cliController$3.exports;
50951
50989