@trops/dash-core 0.1.548 → 0.1.550

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.
@@ -50404,6 +50404,62 @@ function resolveLockdownCwd({ cwd, disableTools = false } = {}) {
50404
50404
  return null;
50405
50405
  }
50406
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
+
50407
50463
  /**
50408
50464
  * Build the argv array for spawning the Claude Code CLI.
50409
50465
  *
@@ -50450,6 +50506,31 @@ function buildClaudeCliArgs({
50450
50506
  // Write — every built-in tool the AI might otherwise invoke from
50451
50507
  // inside the modal where only text + code-block output is wanted.
50452
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 }));
50453
50534
  }
50454
50535
 
50455
50536
  if (model) {
@@ -50663,6 +50744,18 @@ const cliController$2 = {
50663
50744
  }
50664
50745
  spawnOpts.cwd = resolvedCwd;
50665
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 });
50757
+ }
50758
+ }
50666
50759
  const spawnCmd = IS_WINDOWS ? windowsQuote(binaryPath) : binaryPath;
50667
50760
  const spawnArgs = IS_WINDOWS ? args.map(windowsQuote) : args;
50668
50761
  const child = spawn(spawnCmd, spawnArgs, spawnOpts);
@@ -50984,6 +51077,8 @@ const cliController$2 = {
50984
51077
  cliController$3.exports = cliController$2;
50985
51078
  cliController$3.exports.buildClaudeCliArgs = buildClaudeCliArgs;
50986
51079
  cliController$3.exports.resolveLockdownCwd = resolveLockdownCwd;
51080
+ cliController$3.exports.resolveLockdownPluginDir = resolveLockdownPluginDir;
51081
+ cliController$3.exports.LOCKDOWN_DISALLOWED_TOOLS = LOCKDOWN_DISALLOWED_TOOLS;
50987
51082
 
50988
51083
  var cliControllerExports = cliController$3.exports;
50989
51084