@algolia/wizard 0.9.0-rc.93.91 → 0.9.0-rc.96.101
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 +6 -21
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -662,10 +662,9 @@ function CommandApproval({
|
|
|
662
662
|
command,
|
|
663
663
|
onDecide
|
|
664
664
|
}) {
|
|
665
|
-
useInput((
|
|
665
|
+
useInput((_input, key) => {
|
|
666
666
|
if (key.return) onDecide("approve");
|
|
667
667
|
else if (key.escape) onDecide("reject");
|
|
668
|
-
else if (input.toLowerCase() === "a") onDecide("always");
|
|
669
668
|
});
|
|
670
669
|
return /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", gap: 1, children: [
|
|
671
670
|
/* @__PURE__ */ jsx4(Text5, { color: COLORS.primary, bold: true, children: "Run this command?" }),
|
|
@@ -698,15 +697,7 @@ function CommandApproval({
|
|
|
698
697
|
),
|
|
699
698
|
/* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", children: [
|
|
700
699
|
/* @__PURE__ */ jsx4(NextAction, { action: "approve", keyHint: "enter" }),
|
|
701
|
-
/* @__PURE__ */ jsx4(NextAction, { action: "reject", keyHint: "esc", hierarchy: "secondary" })
|
|
702
|
-
/* @__PURE__ */ jsx4(
|
|
703
|
-
NextAction,
|
|
704
|
-
{
|
|
705
|
-
action: "approve, and don't ask again for this command",
|
|
706
|
-
keyHint: "a",
|
|
707
|
-
hierarchy: "secondary"
|
|
708
|
-
}
|
|
709
|
-
)
|
|
700
|
+
/* @__PURE__ */ jsx4(NextAction, { action: "reject", keyHint: "esc", hierarchy: "secondary" })
|
|
710
701
|
] })
|
|
711
702
|
] });
|
|
712
703
|
}
|
|
@@ -2733,7 +2724,6 @@ function createShellContext(overrides = {}) {
|
|
|
2733
2724
|
return {
|
|
2734
2725
|
env: async () => ({}),
|
|
2735
2726
|
timeoutMs: DEFAULT_SHELL_TIMEOUT_MS,
|
|
2736
|
-
approved: /* @__PURE__ */ new Set(),
|
|
2737
2727
|
executions: [],
|
|
2738
2728
|
approve: refuseByDefault,
|
|
2739
2729
|
...overrides
|
|
@@ -2808,9 +2798,6 @@ function runShell(command, opts) {
|
|
|
2808
2798
|
}
|
|
2809
2799
|
|
|
2810
2800
|
// src/lib/tools/runShell.ts
|
|
2811
|
-
function approvalKey(cwd, command) {
|
|
2812
|
-
return `${cwd}\0${command}`;
|
|
2813
|
-
}
|
|
2814
2801
|
function storeApproval(root) {
|
|
2815
2802
|
return async (req) => {
|
|
2816
2803
|
const rel = relative2(root, req.cwd);
|
|
@@ -2823,12 +2810,12 @@ function storeApproval(root) {
|
|
|
2823
2810
|
cwd: rel === "" || rel.startsWith("..") ? req.cwd : rel
|
|
2824
2811
|
}
|
|
2825
2812
|
});
|
|
2826
|
-
return answer === "approve"
|
|
2813
|
+
return answer === "approve" ? "approve" : "reject";
|
|
2827
2814
|
};
|
|
2828
2815
|
}
|
|
2829
2816
|
function runShellTool(ctx) {
|
|
2830
2817
|
return tool8({
|
|
2831
|
-
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.",
|
|
2818
|
+
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. Never `cd`, `pushd` or `popd` inside the command \u2014 pass `cwd` instead. Never leave the project root: no `..` in any path, no absolute paths outside the root, and no `-C`/`--prefix` flag pointing outside it. Everything you need is inside the root.",
|
|
2832
2819
|
inputSchema: z14.object({
|
|
2833
2820
|
command: z14.string().describe(
|
|
2834
2821
|
"The command to run, exactly as it would be typed in a shell. Pipes, && and redirects are allowed."
|
|
@@ -2847,8 +2834,7 @@ function runShellTool(ctx) {
|
|
|
2847
2834
|
const resolved2 = resolveInRoot(ctx, cwd ?? ".");
|
|
2848
2835
|
if (!resolved2.ok) return resolved2.error;
|
|
2849
2836
|
logger.info({ command, cwd: resolved2.target }, "called runShell tool");
|
|
2850
|
-
const
|
|
2851
|
-
const decision = ctx.shell.approved.has(key) ? "approve" : await ctx.shell.approve({
|
|
2837
|
+
const decision = await ctx.shell.approve({
|
|
2852
2838
|
command,
|
|
2853
2839
|
cwd: resolved2.target,
|
|
2854
2840
|
explanation
|
|
@@ -2862,7 +2848,6 @@ function runShellTool(ctx) {
|
|
|
2862
2848
|
logger.info({ command }, "runShell: user rejected the command");
|
|
2863
2849
|
return "The user rejected this command. Do not retry it. Propose a different command, or report the limitation via reportStatus.";
|
|
2864
2850
|
}
|
|
2865
|
-
if (decision === "always") ctx.shell.approved.add(key);
|
|
2866
2851
|
useWizard.getState().pushNotice({ messages: [`Running: ${command}`] });
|
|
2867
2852
|
const env = await ctx.shell.env().catch((err) => {
|
|
2868
2853
|
logger.warn({ err, command }, "runShell: could not resolve command env");
|
|
@@ -3275,7 +3260,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3275
3260
|
// package.json
|
|
3276
3261
|
var package_default = {
|
|
3277
3262
|
name: "@algolia/wizard",
|
|
3278
|
-
version: "0.9.0-rc.
|
|
3263
|
+
version: "0.9.0-rc.96.101",
|
|
3279
3264
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3280
3265
|
type: "module",
|
|
3281
3266
|
engines: {
|