stashes 0.1.52 → 0.1.53

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/cli.js CHANGED
@@ -548,7 +548,6 @@ import { writeFileSync as writeFileSync2, existsSync as existsSync4, mkdirSync a
548
548
  import { join as join4 } from "path";
549
549
  import { tmpdir } from "os";
550
550
  var CLAUDE_BIN = "/opt/homebrew/bin/claude";
551
- var DEFAULT_TOOLS = ["Read", "Write", "Edit", "Glob", "Grep", "Bash"];
552
551
  function getPlaywrightMcpConfigPath() {
553
552
  const configDir = join4(tmpdir(), "stashes-mcp");
554
553
  const configPath = join4(configDir, "playwright.json");
@@ -562,11 +561,29 @@ function getPlaywrightMcpConfigPath() {
562
561
  }
563
562
  return configPath;
564
563
  }
564
+ var OVERHEAD_TOOLS = [
565
+ "Agent",
566
+ "TodoWrite",
567
+ "TaskCreate",
568
+ "TaskUpdate",
569
+ "TaskList",
570
+ "TaskGet",
571
+ "Skill",
572
+ "ToolSearch",
573
+ "EnterPlanMode",
574
+ "ExitPlanMode",
575
+ "WebSearch",
576
+ "WebFetch",
577
+ "NotebookEdit",
578
+ "mcp__UseAI__*",
579
+ "mcp__stashes__*",
580
+ "mcp__plugin_drills*",
581
+ "mcp__plugin_coverit*"
582
+ ];
565
583
  var processes = new Map;
566
584
  function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
567
585
  const opts = typeof idOrOpts === "string" ? { id: idOrOpts, prompt, cwd, resumeSessionId, model } : idOrOpts;
568
- const bare = opts.bare ?? true;
569
- const tools = opts.tools ?? DEFAULT_TOOLS;
586
+ const restricted = opts.tools !== undefined;
570
587
  killAiProcess(opts.id);
571
588
  logger.info("claude", `spawning process: ${opts.id}`, {
572
589
  cwd: opts.cwd,
@@ -574,15 +591,14 @@ function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
574
591
  promptPreview: opts.prompt.substring(0, 100),
575
592
  resumeSessionId: opts.resumeSessionId,
576
593
  model: opts.model,
577
- bare,
578
- tools: bare ? tools.join(",") : "all"
594
+ restricted,
595
+ tools: restricted ? opts.tools.join(",") || "none" : "all"
579
596
  });
580
597
  const cmd = [CLAUDE_BIN, "-p", opts.prompt, "--output-format=stream-json", "--verbose", "--dangerously-skip-permissions"];
581
- if (bare) {
582
- cmd.push("--bare");
583
- if (tools.length > 0) {
584
- cmd.push("--tools", tools.join(","));
585
- }
598
+ if (restricted) {
599
+ cmd.push("--tools", opts.tools.length > 0 ? opts.tools.join(",") : '""');
600
+ cmd.push("--disallowedTools", OVERHEAD_TOOLS.join(","));
601
+ cmd.push("--strict-mcp-config");
586
602
  if (opts.mcpConfigPath) {
587
603
  cmd.push("--mcp-config", opts.mcpConfigPath);
588
604
  }
@@ -872,7 +888,6 @@ async function captureSmartScreenshots(opts) {
872
888
  prompt,
873
889
  cwd: worktreePath,
874
890
  model: modelFlag,
875
- bare: true,
876
891
  tools: [],
877
892
  mcpConfigPath: getPlaywrightMcpConfigPath()
878
893
  });
@@ -1041,8 +1056,7 @@ async function generate(opts) {
1041
1056
  const aiProcess = startAiProcess({
1042
1057
  id: stashId,
1043
1058
  prompt: stashPrompt,
1044
- cwd: worktree.path,
1045
- bare: false
1059
+ cwd: worktree.path
1046
1060
  });
1047
1061
  try {
1048
1062
  for await (const chunk of parseClaudeStream(aiProcess.process)) {
@@ -1242,8 +1256,7 @@ async function vary(opts) {
1242
1256
  const aiProcess = startAiProcess({
1243
1257
  id: stashId,
1244
1258
  prompt: varyPrompt,
1245
- cwd: worktree.path,
1246
- bare: false
1259
+ cwd: worktree.path
1247
1260
  });
1248
1261
  try {
1249
1262
  for await (const chunk of parseClaudeStream(aiProcess.process)) {
@@ -1914,7 +1927,6 @@ class StashService {
1914
1927
  prompt,
1915
1928
  cwd: this.projectPath,
1916
1929
  model: "claude-haiku-4-5-20251001",
1917
- bare: true,
1918
1930
  tools: ["Read", "Grep", "Glob", "Bash"]
1919
1931
  });
1920
1932
  let resolvedPath = "";
@@ -2030,8 +2042,7 @@ ${sourceCode.substring(0, 3000)}
2030
2042
  id: "chat",
2031
2043
  prompt: chatPrompt,
2032
2044
  cwd: this.projectPath,
2033
- resumeSessionId: existingSessionId,
2034
- bare: false
2045
+ resumeSessionId: existingSessionId
2035
2046
  });
2036
2047
  let thinkingBuf = "";
2037
2048
  let textBuf = "";
@@ -2130,11 +2141,13 @@ ${sourceCode.substring(0, 3000)}
2130
2141
  toolResult = parsed.result ?? chunk.content;
2131
2142
  isError = !!parsed.is_error;
2132
2143
  } catch {}
2144
+ const endToolName = chunk.toolName ?? "unknown";
2133
2145
  save({
2134
2146
  id: crypto.randomUUID(),
2135
2147
  role: "assistant",
2136
2148
  content: chunk.content,
2137
2149
  type: "tool_end",
2150
+ toolName: endToolName,
2138
2151
  toolStatus: isError ? "error" : "completed",
2139
2152
  toolResult: toolResult.substring(0, 300),
2140
2153
  stashActivity,
@@ -2145,6 +2158,7 @@ ${sourceCode.substring(0, 3000)}
2145
2158
  content: chunk.content,
2146
2159
  streamType: "tool_end",
2147
2160
  source: "chat",
2161
+ toolName: endToolName,
2148
2162
  toolStatus: isError ? "error" : "completed",
2149
2163
  toolResult: toolResult.substring(0, 300)
2150
2164
  });
package/dist/mcp.js CHANGED
@@ -533,7 +533,6 @@ import { writeFileSync as writeFileSync2, existsSync as existsSync4, mkdirSync a
533
533
  import { join as join4 } from "path";
534
534
  import { tmpdir } from "os";
535
535
  var CLAUDE_BIN = "/opt/homebrew/bin/claude";
536
- var DEFAULT_TOOLS = ["Read", "Write", "Edit", "Glob", "Grep", "Bash"];
537
536
  function getPlaywrightMcpConfigPath() {
538
537
  const configDir = join4(tmpdir(), "stashes-mcp");
539
538
  const configPath = join4(configDir, "playwright.json");
@@ -547,11 +546,29 @@ function getPlaywrightMcpConfigPath() {
547
546
  }
548
547
  return configPath;
549
548
  }
549
+ var OVERHEAD_TOOLS = [
550
+ "Agent",
551
+ "TodoWrite",
552
+ "TaskCreate",
553
+ "TaskUpdate",
554
+ "TaskList",
555
+ "TaskGet",
556
+ "Skill",
557
+ "ToolSearch",
558
+ "EnterPlanMode",
559
+ "ExitPlanMode",
560
+ "WebSearch",
561
+ "WebFetch",
562
+ "NotebookEdit",
563
+ "mcp__UseAI__*",
564
+ "mcp__stashes__*",
565
+ "mcp__plugin_drills*",
566
+ "mcp__plugin_coverit*"
567
+ ];
550
568
  var processes = new Map;
551
569
  function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
552
570
  const opts = typeof idOrOpts === "string" ? { id: idOrOpts, prompt, cwd, resumeSessionId, model } : idOrOpts;
553
- const bare = opts.bare ?? true;
554
- const tools = opts.tools ?? DEFAULT_TOOLS;
571
+ const restricted = opts.tools !== undefined;
555
572
  killAiProcess(opts.id);
556
573
  logger.info("claude", `spawning process: ${opts.id}`, {
557
574
  cwd: opts.cwd,
@@ -559,15 +576,14 @@ function startAiProcess(idOrOpts, prompt, cwd, resumeSessionId, model) {
559
576
  promptPreview: opts.prompt.substring(0, 100),
560
577
  resumeSessionId: opts.resumeSessionId,
561
578
  model: opts.model,
562
- bare,
563
- tools: bare ? tools.join(",") : "all"
579
+ restricted,
580
+ tools: restricted ? opts.tools.join(",") || "none" : "all"
564
581
  });
565
582
  const cmd = [CLAUDE_BIN, "-p", opts.prompt, "--output-format=stream-json", "--verbose", "--dangerously-skip-permissions"];
566
- if (bare) {
567
- cmd.push("--bare");
568
- if (tools.length > 0) {
569
- cmd.push("--tools", tools.join(","));
570
- }
583
+ if (restricted) {
584
+ cmd.push("--tools", opts.tools.length > 0 ? opts.tools.join(",") : '""');
585
+ cmd.push("--disallowedTools", OVERHEAD_TOOLS.join(","));
586
+ cmd.push("--strict-mcp-config");
571
587
  if (opts.mcpConfigPath) {
572
588
  cmd.push("--mcp-config", opts.mcpConfigPath);
573
589
  }
@@ -857,7 +873,6 @@ async function captureSmartScreenshots(opts) {
857
873
  prompt,
858
874
  cwd: worktreePath,
859
875
  model: modelFlag,
860
- bare: true,
861
876
  tools: [],
862
877
  mcpConfigPath: getPlaywrightMcpConfigPath()
863
878
  });
@@ -1026,8 +1041,7 @@ async function generate(opts) {
1026
1041
  const aiProcess = startAiProcess({
1027
1042
  id: stashId,
1028
1043
  prompt: stashPrompt,
1029
- cwd: worktree.path,
1030
- bare: false
1044
+ cwd: worktree.path
1031
1045
  });
1032
1046
  try {
1033
1047
  for await (const chunk of parseClaudeStream(aiProcess.process)) {
@@ -1227,8 +1241,7 @@ async function vary(opts) {
1227
1241
  const aiProcess = startAiProcess({
1228
1242
  id: stashId,
1229
1243
  prompt: varyPrompt,
1230
- cwd: worktree.path,
1231
- bare: false
1244
+ cwd: worktree.path
1232
1245
  });
1233
1246
  try {
1234
1247
  for await (const chunk of parseClaudeStream(aiProcess.process)) {
@@ -2138,7 +2151,6 @@ class StashService {
2138
2151
  prompt,
2139
2152
  cwd: this.projectPath,
2140
2153
  model: "claude-haiku-4-5-20251001",
2141
- bare: true,
2142
2154
  tools: ["Read", "Grep", "Glob", "Bash"]
2143
2155
  });
2144
2156
  let resolvedPath = "";
@@ -2254,8 +2266,7 @@ ${sourceCode.substring(0, 3000)}
2254
2266
  id: "chat",
2255
2267
  prompt: chatPrompt,
2256
2268
  cwd: this.projectPath,
2257
- resumeSessionId: existingSessionId,
2258
- bare: false
2269
+ resumeSessionId: existingSessionId
2259
2270
  });
2260
2271
  let thinkingBuf = "";
2261
2272
  let textBuf = "";
@@ -2354,11 +2365,13 @@ ${sourceCode.substring(0, 3000)}
2354
2365
  toolResult = parsed.result ?? chunk.content;
2355
2366
  isError = !!parsed.is_error;
2356
2367
  } catch {}
2368
+ const endToolName = chunk.toolName ?? "unknown";
2357
2369
  save({
2358
2370
  id: crypto.randomUUID(),
2359
2371
  role: "assistant",
2360
2372
  content: chunk.content,
2361
2373
  type: "tool_end",
2374
+ toolName: endToolName,
2362
2375
  toolStatus: isError ? "error" : "completed",
2363
2376
  toolResult: toolResult.substring(0, 300),
2364
2377
  stashActivity,
@@ -2369,6 +2382,7 @@ ${sourceCode.substring(0, 3000)}
2369
2382
  content: chunk.content,
2370
2383
  streamType: "tool_end",
2371
2384
  source: "chat",
2385
+ toolName: endToolName,
2372
2386
  toolStatus: isError ? "error" : "completed",
2373
2387
  toolResult: toolResult.substring(0, 300)
2374
2388
  });