@algolia/wizard 0.23.0 → 0.24.0

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.
Files changed (2) hide show
  1. package/dist/main.js +9 -2
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -3178,6 +3178,10 @@ function storeApproval(root) {
3178
3178
  return answer === "approve" ? "approve" : "reject";
3179
3179
  };
3180
3180
  }
3181
+ var EXPLORATORY_COMMANDS = /* @__PURE__ */ new Set(["ls", "find", "tree", "dir"]);
3182
+ function isExploratoryCommand(command) {
3183
+ return command.split(/&&|;|\|/).map((segment) => segment.trim().split(/\s+/)[0]).some((word) => word !== void 0 && EXPLORATORY_COMMANDS.has(word));
3184
+ }
3181
3185
  async function approveAndRun(ctx, command, cwd, explanation) {
3182
3186
  const decision = await ctx.shell.approve({ command, cwd, explanation });
3183
3187
  if (decision === "reject") {
@@ -3222,7 +3226,7 @@ async function approveAndRun(ctx, command, cwd, explanation) {
3222
3226
  }
3223
3227
  function runShellTool(ctx) {
3224
3228
  return tool8({
3225
- description: "Run a shell command in the project. Use this for anything the project needs done in its own ecosystem: installing dependencies, running a script you wrote, running the project's lint/typecheck/test commands. The user sees and approves every command before it runs, so write a clear `explanation`. If the user rejects a command, do not retry it \u2014 propose a different approach.",
3229
+ description: "Run a shell command in the project. Use this for anything the project needs done in its own ecosystem: installing dependencies, running a script you wrote, running the project's lint/typecheck/test commands. To inspect the project, use listFiles or searchFiles instead of ls/find \u2014 this tool refuses those. The user sees and approves every command before it runs, so write a clear `explanation`. If the user rejects a command, do not retry it \u2014 propose a different approach.",
3226
3230
  inputSchema: z15.object({
3227
3231
  command: z15.string().describe(
3228
3232
  "The command to run, exactly as it would be typed in a shell. Pipes, && and redirects are allowed."
@@ -3240,6 +3244,9 @@ function runShellTool(ctx) {
3240
3244
  }
3241
3245
  const resolved2 = resolveInRoot(ctx, cwd ?? ".");
3242
3246
  if (!resolved2.ok) return resolved2.error;
3247
+ if (isExploratoryCommand(command)) {
3248
+ return "Refused: use listFiles or searchFiles to inspect the project instead of ls/find/tree.";
3249
+ }
3243
3250
  logger.info({ command, cwd: resolved2.target }, "called runShell tool");
3244
3251
  return serializePrompt(
3245
3252
  () => approveAndRun(ctx, command, resolved2.target, explanation)
@@ -3700,7 +3707,7 @@ async function runAnalysis(mode, extraInstructions = []) {
3700
3707
  // package.json
3701
3708
  var package_default = {
3702
3709
  name: "@algolia/wizard",
3703
- version: "0.23.0",
3710
+ version: "0.24.0",
3704
3711
  description: "Magically implement Algolia functionality in your codebase",
3705
3712
  type: "module",
3706
3713
  engines: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {