@trops/dash-core 0.1.547 → 0.1.549
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.
- package/dist/electron/index.js +56 -4
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -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
|
*
|
|
@@ -50414,6 +50450,20 @@ function buildClaudeCliArgs({
|
|
|
50414
50450
|
// Write — every built-in tool the AI might otherwise invoke from
|
|
50415
50451
|
// inside the modal where only text + code-block output is wanted.
|
|
50416
50452
|
args.push("--tools", "");
|
|
50453
|
+
|
|
50454
|
+
// `--tools ""` alone leaks ambient context: in 2.1.138 we saw the
|
|
50455
|
+
// AI mention `mcp__dash__*` tool names by name, and the Skill
|
|
50456
|
+
// tool kept firing despite the empty allowlist. The leak comes
|
|
50457
|
+
// from outside cwd — global ~/.claude/CLAUDE.md, project memory
|
|
50458
|
+
// under ~/.claude/projects/<key>/memory/, and user-installed
|
|
50459
|
+
// skills. `--bare` is documented as "skip hooks, LSP, plugin
|
|
50460
|
+
// sync, attribution, auto-memory, background prefetches, keychain
|
|
50461
|
+
// reads, and CLAUDE.md auto-discovery." Combined with
|
|
50462
|
+
// `--strict-mcp-config` (which suppresses every MCP server we
|
|
50463
|
+
// don't explicitly pass via --mcp-config), the spawned CLI gets
|
|
50464
|
+
// exactly our --system-prompt and nothing else.
|
|
50465
|
+
args.push("--bare");
|
|
50466
|
+
args.push("--strict-mcp-config");
|
|
50417
50467
|
}
|
|
50418
50468
|
|
|
50419
50469
|
if (model) {
|
|
@@ -50619,12 +50669,13 @@ const cliController$2 = {
|
|
|
50619
50669
|
// files directly without a shell — ENOENT otherwise.
|
|
50620
50670
|
shell: IS_WINDOWS,
|
|
50621
50671
|
};
|
|
50622
|
-
|
|
50672
|
+
const resolvedCwd = resolveLockdownCwd({ cwd, disableTools });
|
|
50673
|
+
if (resolvedCwd) {
|
|
50623
50674
|
const fs = require("fs");
|
|
50624
|
-
if (!fs.existsSync(
|
|
50625
|
-
fs.mkdirSync(
|
|
50675
|
+
if (!fs.existsSync(resolvedCwd)) {
|
|
50676
|
+
fs.mkdirSync(resolvedCwd, { recursive: true });
|
|
50626
50677
|
}
|
|
50627
|
-
spawnOpts.cwd =
|
|
50678
|
+
spawnOpts.cwd = resolvedCwd;
|
|
50628
50679
|
}
|
|
50629
50680
|
const spawnCmd = IS_WINDOWS ? windowsQuote(binaryPath) : binaryPath;
|
|
50630
50681
|
const spawnArgs = IS_WINDOWS ? args.map(windowsQuote) : args;
|
|
@@ -50946,6 +50997,7 @@ const cliController$2 = {
|
|
|
50946
50997
|
|
|
50947
50998
|
cliController$3.exports = cliController$2;
|
|
50948
50999
|
cliController$3.exports.buildClaudeCliArgs = buildClaudeCliArgs;
|
|
51000
|
+
cliController$3.exports.resolveLockdownCwd = resolveLockdownCwd;
|
|
50949
51001
|
|
|
50950
51002
|
var cliControllerExports = cliController$3.exports;
|
|
50951
51003
|
|