@algolia/wizard 0.41.0 → 0.42.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.
- package/dist/main.js +31 -14
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2683,17 +2683,38 @@ function storeApproval(root) {
|
|
|
2683
2683
|
return "approve";
|
|
2684
2684
|
};
|
|
2685
2685
|
}
|
|
2686
|
-
var
|
|
2686
|
+
var FILE_IO_COMMANDS = /* @__PURE__ */ new Set([
|
|
2687
|
+
"ls",
|
|
2688
|
+
"find",
|
|
2689
|
+
"fd",
|
|
2690
|
+
"tree",
|
|
2691
|
+
"dir",
|
|
2692
|
+
"locate",
|
|
2693
|
+
"cat",
|
|
2694
|
+
"head",
|
|
2695
|
+
"tail",
|
|
2696
|
+
"less",
|
|
2697
|
+
"more",
|
|
2698
|
+
"tac",
|
|
2699
|
+
"nl",
|
|
2700
|
+
"grep",
|
|
2701
|
+
"egrep",
|
|
2702
|
+
"fgrep",
|
|
2703
|
+
"rg",
|
|
2704
|
+
"ack",
|
|
2705
|
+
"ag",
|
|
2706
|
+
"xxd",
|
|
2707
|
+
"hexdump",
|
|
2708
|
+
"od",
|
|
2709
|
+
"strings"
|
|
2710
|
+
]);
|
|
2687
2711
|
function commandSegments(command) {
|
|
2688
2712
|
return command.split(/&&|;|\|/).map((segment) => segment.trim());
|
|
2689
2713
|
}
|
|
2690
|
-
function
|
|
2691
|
-
return commandSegments(command).map((segment) => segment.split(/\s+/)[0]).some((word) => word !== void 0 &&
|
|
2714
|
+
function isFileIOCommand(command) {
|
|
2715
|
+
return commandSegments(command).map((segment) => segment.split(/\s+/)[0]).some((word) => word !== void 0 && FILE_IO_COMMANDS.has(word));
|
|
2692
2716
|
}
|
|
2693
2717
|
var READ_ONLY_BINARIES = /* @__PURE__ */ new Set([
|
|
2694
|
-
"cat",
|
|
2695
|
-
"head",
|
|
2696
|
-
"tail",
|
|
2697
2718
|
"wc",
|
|
2698
2719
|
"pwd",
|
|
2699
2720
|
"echo",
|
|
@@ -2704,10 +2725,6 @@ var READ_ONLY_BINARIES = /* @__PURE__ */ new Set([
|
|
|
2704
2725
|
"which",
|
|
2705
2726
|
"file",
|
|
2706
2727
|
"stat",
|
|
2707
|
-
"grep",
|
|
2708
|
-
"egrep",
|
|
2709
|
-
"fgrep",
|
|
2710
|
-
"rg",
|
|
2711
2728
|
"diff"
|
|
2712
2729
|
]);
|
|
2713
2730
|
var READ_ONLY_NO_ARGS_BINARIES = /* @__PURE__ */ new Set(["env", "printenv"]);
|
|
@@ -2913,7 +2930,7 @@ async function approveAndRun(ctx, command, cwd, explanation) {
|
|
|
2913
2930
|
}
|
|
2914
2931
|
function runShellTool(ctx, createModel = defaultCreateModel) {
|
|
2915
2932
|
return tool8({
|
|
2916
|
-
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. Do not use this to find or read files \u2014 use listFiles, searchFiles, and readFile instead of ls/find/cat/head/tail/grep/rg. This tool refuses
|
|
2933
|
+
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. Do not use this to find or read files \u2014 use listFiles, searchFiles, and readFile instead of shell file-listing, reading, or search commands (ls/find/tree/cat/head/tail/grep/rg and similar). This tool refuses all of those outright: the dedicated tools enforce the project-root boundary and secret redaction that a raw shell read would bypass, and they won't count against this tool's command budget. The user approves any command that could change the project before it runs, so write a clear `explanation`. A command judged read-only (inspection, or running tests/typecheck/lint without an autofix flag, in any language) runs immediately without approval. If the user rejects a command, do not retry it \u2014 propose a different approach.",
|
|
2917
2934
|
inputSchema: z15.object({
|
|
2918
2935
|
command: z15.string().describe(
|
|
2919
2936
|
"The command to run, exactly as it would be typed in a shell. Pipes, && and redirects are allowed."
|
|
@@ -2931,8 +2948,8 @@ function runShellTool(ctx, createModel = defaultCreateModel) {
|
|
|
2931
2948
|
}
|
|
2932
2949
|
const resolved2 = resolveInRoot(ctx, cwd ?? ".");
|
|
2933
2950
|
if (!resolved2.ok) return resolved2.error;
|
|
2934
|
-
if (
|
|
2935
|
-
return "Refused: use listFiles or searchFiles to find files, and readFile to read one, instead of ls/find/tree/dir.";
|
|
2951
|
+
if (isFileIOCommand(command)) {
|
|
2952
|
+
return "Refused: use listFiles or searchFiles to find files, and readFile to read one, instead of a shell file-listing, reading, or search command (ls/find/fd/tree/dir/locate/cat/head/tail/less/more/tac/nl/grep/egrep/fgrep/rg/ack/ag/xxd/hexdump/od/strings).";
|
|
2936
2953
|
}
|
|
2937
2954
|
logger.info({ command, cwd: resolved2.target }, "called runShell tool");
|
|
2938
2955
|
const fast = fastPathSafety(command);
|
|
@@ -3455,7 +3472,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3455
3472
|
// package.json
|
|
3456
3473
|
var package_default = {
|
|
3457
3474
|
name: "@algolia/wizard",
|
|
3458
|
-
version: "0.
|
|
3475
|
+
version: "0.42.0",
|
|
3459
3476
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3460
3477
|
type: "module",
|
|
3461
3478
|
engines: {
|