1
0

feat: Implement a user-approved shell command execution tool and a Windows installer script.

This commit is contained in:
2026-03-04 11:04:01 +01:00
parent b05e905dc4
commit 2b122a28c9
4 changed files with 57 additions and 2 deletions

View File

@@ -11,7 +11,11 @@ internal static class CommandTool
{
public static Action<string> Log { get; set; } = Console.WriteLine;
[Description("Execute a shell command after user approval. Prompts with [Y/n] before running. Note: For file editing and operations, use the built-in file tools (ReadFile, ReplaceLines, InsertAfter, DeleteRange, CreateFile, etc.) instead of shell commands.")]
#if WINDOWS
[Description("Execute a PowerShell command after user approval. Prompts with [Y/n] before running. Note: For file editing and operations, use the built-in file tools (ReadFile, ReplaceLines, InsertAfter, DeleteRange, CreateFile, etc.) instead of shell commands.")]
#else
[Description("Execute a Bash shell command after user approval. Prompts with [Y/n] before running. Note: For file editing and operations, use the built-in file tools (ReadFile, ReplaceLines, InsertAfter, DeleteRange, CreateFile, etc.) instead of shell commands.")]
#endif
public static string ExecuteCommand(
[Description("The shell command to execute.")] string command)
{
@@ -41,8 +45,13 @@ internal static class CommandTool
{
var startInfo = new ProcessStartInfo
{
#if WINDOWS
FileName = "powershell.exe",
Arguments = $"-NoProfile -Command \"{command}\"",
#else
FileName = "/bin/bash",
Arguments = $"-c \"{command}\"",
#endif
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,