@trops/dash-core 0.1.550 → 0.1.552

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,98 +50368,6 @@ 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
-
50407
- /**
50408
- * Resolve the plugin directory the spawned CLI should look in.
50409
- *
50410
- * Same shape as resolveLockdownCwd. When in lockdown, point Claude
50411
- * Code at an empty scratch directory so plugin auto-discovery finds
50412
- * nothing — sealing the gap left by `--bare` (which strips CLAUDE.md
50413
- * and auto-memory but NOT user plugins under ~/.claude/plugins/).
50414
- * The Skill tool gets loaded from those plugins, which is how it
50415
- * survived the slice 17f flag set.
50416
- *
50417
- * Sibling of the scratch cwd dir — DIFFERENT name so plugin discovery
50418
- * doesn't pick up the cwd itself.
50419
- *
50420
- * @param {object} opts
50421
- * @param {string=} opts.pluginDir
50422
- * @param {boolean=} opts.disableTools
50423
- * @returns {string|null}
50424
- */
50425
- function resolveLockdownPluginDir({ pluginDir, disableTools = false } = {}) {
50426
- if (pluginDir) return pluginDir;
50427
- if (disableTools) {
50428
- const os = require$$2$1;
50429
- const path = require$$1$1;
50430
- return path.join(os.tmpdir(), "dash-widget-builder-cli-plugins");
50431
- }
50432
- return null;
50433
- }
50434
-
50435
- /**
50436
- * Canonical denylist for the lockdown — every built-in tool name we
50437
- * know about, comma-separated (no whitespace) so the single arg is
50438
- * Windows-shell-safe. Adding a new built-in upstream means appending
50439
- * its name here; the flag is belt-and-suspenders alongside `--tools ""`,
50440
- * but it's the only layer that actually keeps the Skill tool from
50441
- * being callable when a user has plugins installed in
50442
- * ~/.claude/plugins/.
50443
- */
50444
- const LOCKDOWN_DISALLOWED_TOOLS = [
50445
- "Skill",
50446
- "Bash",
50447
- "BashOutput",
50448
- "Read",
50449
- "Edit",
50450
- "Write",
50451
- "Glob",
50452
- "Grep",
50453
- "WebFetch",
50454
- "WebSearch",
50455
- "NotebookRead",
50456
- "NotebookEdit",
50457
- "Task",
50458
- "TodoWrite",
50459
- "KillBash",
50460
- "SlashCommand",
50461
- ].join(",");
50462
-
50463
50371
  /**
50464
50372
  * Build the argv array for spawning the Claude Code CLI.
50465
50373
  *
@@ -50468,19 +50376,28 @@ const LOCKDOWN_DISALLOWED_TOOLS = [
50468
50376
  *
50469
50377
  * Defaults preserve AssistantPanel behavior: system prompt is APPENDED
50470
50378
  * to Claude Code's default (so the AI still sees its tool / MCP /
50471
- * skill preamble) and built-in tools stay available. The widget
50472
- * builder modal opts into a stricter mode by passing both
50473
- * `replaceSystemPrompt: true` (replace the default rather than append
50474
- * — strips the tool / skill preamble) and `disableTools: true` (deny
50475
- * all built-in tools so the AI cannot invoke Skill / Bash / Read /
50476
- * Glob / etc.).
50379
+ * skill preamble) and built-in tools / plugins / CLAUDE.md / auto-
50380
+ * memory all load normally.
50381
+ *
50382
+ * Callers may opt into `replaceSystemPrompt: true` to swap
50383
+ * `--append-system-prompt` for `--system-prompt`, replacing Claude
50384
+ * Code's default preamble with the caller's. The widget builder
50385
+ * modal does this so its terse "use the dash-widget-builder skill"
50386
+ * prompt isn't drowned out by Claude Code's default tool-advertising
50387
+ * preamble. The skill itself still auto-loads — that's the point.
50388
+ *
50389
+ * The `disableTools` prop survives for backwards compatibility with
50390
+ * existing callers, but no longer adds any CLI flag (slice 19B
50391
+ * dropped the flag-based lockdown after we discovered the project
50392
+ * skill carries the same constraints more reliably). The prop now
50393
+ * only gates the dash MCP auto-wire downstream of this helper.
50477
50394
  *
50478
50395
  * @param {object} opts
50479
50396
  * @param {string=} opts.model
50480
50397
  * @param {string=} opts.systemPrompt
50481
50398
  * @param {string=} opts.sessionId
50482
50399
  * @param {boolean=} opts.replaceSystemPrompt
50483
- * @param {boolean=} opts.disableTools
50400
+ * @param {boolean=} opts.disableTools (no-op for argv; gates MCP wiring elsewhere)
50484
50401
  * @returns {string[]}
50485
50402
  */
50486
50403
  function buildClaudeCliArgs({
@@ -50488,6 +50405,7 @@ function buildClaudeCliArgs({
50488
50405
  systemPrompt,
50489
50406
  sessionId,
50490
50407
  replaceSystemPrompt = false,
50408
+ // eslint-disable-next-line no-unused-vars
50491
50409
  disableTools = false,
50492
50410
  } = {}) {
50493
50411
  const args = [
@@ -50500,39 +50418,6 @@ function buildClaudeCliArgs({
50500
50418
  "--verbose",
50501
50419
  ];
50502
50420
 
50503
- if (disableTools) {
50504
- // Empty-string value documented in `claude --help` as "disable
50505
- // all tools". Catches Skill / Bash / Read / Glob / Grep / Edit /
50506
- // Write — every built-in tool the AI might otherwise invoke from
50507
- // inside the modal where only text + code-block output is wanted.
50508
- args.push("--tools", "");
50509
-
50510
- // `--tools ""` alone leaks ambient context: in 2.1.138 we saw the
50511
- // AI mention `mcp__dash__*` tool names by name, and the Skill
50512
- // tool kept firing despite the empty allowlist. The leak comes
50513
- // from outside cwd — global ~/.claude/CLAUDE.md, project memory
50514
- // under ~/.claude/projects/<key>/memory/, and user-installed
50515
- // skills. `--bare` is documented as "skip hooks, LSP, plugin
50516
- // sync, attribution, auto-memory, background prefetches, keychain
50517
- // reads, and CLAUDE.md auto-discovery." Combined with
50518
- // `--strict-mcp-config` (which suppresses every MCP server we
50519
- // don't explicitly pass via --mcp-config), the spawned CLI gets
50520
- // exactly our --system-prompt and nothing else.
50521
- args.push("--bare");
50522
- args.push("--strict-mcp-config");
50523
-
50524
- // `--bare` strips CLAUDE.md and auto-memory but NOT user plugins
50525
- // (under ~/.claude/plugins/). The Skill TOOL gets loaded from
50526
- // those plugins, which is why it kept firing despite slices 17e
50527
- // and 17f. Two layers seal it:
50528
- // 1. --disallowed-tools denies every known built-in by name
50529
- // (comma-separated, no whitespace, Windows-shell-safe).
50530
- // 2. --plugin-dir points at an empty scratch dir under
50531
- // os.tmpdir() so plugin auto-discovery finds nothing.
50532
- args.push("--disallowed-tools", LOCKDOWN_DISALLOWED_TOOLS);
50533
- args.push("--plugin-dir", resolveLockdownPluginDir({ disableTools: true }));
50534
- }
50535
-
50536
50421
  if (model) {
50537
50422
  args.push("--model", model);
50538
50423
  }
@@ -50736,25 +50621,17 @@ const cliController$2 = {
50736
50621
  // files directly without a shell — ENOENT otherwise.
50737
50622
  shell: IS_WINDOWS,
50738
50623
  };
50739
- const resolvedCwd = resolveLockdownCwd({ cwd, disableTools });
50740
- if (resolvedCwd) {
50624
+ // Caller may pass an explicit cwd (e.g., the widget-builder
50625
+ // modal points at the dash-electron project root so its
50626
+ // dash-widget-builder skill auto-loads). When absent, the child
50627
+ // inherits the parent process's cwd — which is what the
50628
+ // AssistantPanel relies on.
50629
+ if (cwd) {
50741
50630
  const fs = require("fs");
50742
- if (!fs.existsSync(resolvedCwd)) {
50743
- fs.mkdirSync(resolvedCwd, { recursive: true });
50744
- }
50745
- spawnOpts.cwd = resolvedCwd;
50746
- }
50747
- // The --plugin-dir argv we built above points at a scratch
50748
- // directory; create it on first run so the CLI doesn't error
50749
- // out trying to read a missing path.
50750
- if (disableTools) {
50751
- const fs = require("fs");
50752
- const lockdownPluginDir = resolveLockdownPluginDir({
50753
- disableTools: true,
50754
- });
50755
- if (lockdownPluginDir && !fs.existsSync(lockdownPluginDir)) {
50756
- fs.mkdirSync(lockdownPluginDir, { recursive: true });
50631
+ if (!fs.existsSync(cwd)) {
50632
+ fs.mkdirSync(cwd, { recursive: true });
50757
50633
  }
50634
+ spawnOpts.cwd = cwd;
50758
50635
  }
50759
50636
  const spawnCmd = IS_WINDOWS ? windowsQuote(binaryPath) : binaryPath;
50760
50637
  const spawnArgs = IS_WINDOWS ? args.map(windowsQuote) : args;
@@ -51076,9 +50953,6 @@ const cliController$2 = {
51076
50953
 
51077
50954
  cliController$3.exports = cliController$2;
51078
50955
  cliController$3.exports.buildClaudeCliArgs = buildClaudeCliArgs;
51079
- cliController$3.exports.resolveLockdownCwd = resolveLockdownCwd;
51080
- cliController$3.exports.resolveLockdownPluginDir = resolveLockdownPluginDir;
51081
- cliController$3.exports.LOCKDOWN_DISALLOWED_TOOLS = LOCKDOWN_DISALLOWED_TOOLS;
51082
50956
 
51083
50957
  var cliControllerExports = cliController$3.exports;
51084
50958