graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Merge PR #38: Add /bash slash command + show current folder in prompt
codegraff-bot81d13ffd2c53
diff --cc gui/src-tauri/src/runtime/simple.rsindex c3287de4,6a071f44..bf131af5--- a/gui/src-tauri/src/runtime/simple.rs+++ b/gui/src-tauri/src/runtime/simple.rs@@@ -425,8 -403,7 +425,9 @@@ impl RuntimeManagerOk(vec![command("help", "Show available commands.", false),command("agent", "Show active agent.", false),+ command("goal", "Set/show the current objective.", true),+ command("loop", "Run an autonomous plan→act→verify pass.", true),+ bash_command(),command("compact", "Compact current conversation.", true),command("workspace-status", "Show git status.", true),])@@@ -1203,7 -1112,7 +1229,7 @@@_ => Ok(CommandRunResultDto {title: format!("/{name}"),body: Some(format!(- "Available MVP commands: /help, /agent, /goal, /loop, /compact, /workspace-status. Args: {}",- "Available MVP commands: /help, /agent, /bash <command>, /compact, /workspace-status. Args: {}",++ "Available MVP commands: /help, /agent, /goal, /loop, /bash <command>, /compact, /workspace-status. Args: {}",args.join(" "))),snapshot: None,@@@ -2293,37 -2198,13 +2319,45 @@@ fn command(name: &str, usage: &str, req}}+/// macOS GUI processes launched from Finder/Dock get launchd's minimal+/// environment, not the user's shell — so `export OPENAI_API_KEY=…` (and any+/// other `*_API_KEY`) from .zshrc/.zprofile is invisible to children we spawn.+/// Capture the login shell's environment once (best-effort, time-bounded) so a+/// GUI-spawned `graff` sees the same provider keys the terminal `graff` does.+fn login_shell_env() -> &'static std::collections::HashMap<String, String> {+ static ENV: std::sync::OnceLock<std::collections::HashMap<String, String>> =+ std::sync::OnceLock::new();+ ENV.get_or_init(|| {+ let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/zsh".to_string());+ let (tx, rx) = std::sync::mpsc::channel();+ std::thread::spawn(move || {+ // -il = interactive login shell: sources the login profile AND+ // .zshrc/.bashrc, where most users export their *_API_KEY.+ let out = std::process::Command::new(&shell).args(["-ilc", "env"]).output();+ let _ = tx.send(out);+ });+ let mut map = std::collections::HashMap::new();+ if let Ok(Ok(out)) = rx.recv_timeout(std::time::Duration::from_secs(4)) {+ if out.status.success() {+ for line in String::from_utf8_lossy(&out.stdout).lines() {+ if let Some((k, v)) = line.split_once('=') {+ map.insert(k.to_string(), v.to_string());+ }+ }+ }+ }+ map+ })+}++ fn bash_command() -> CommandDescriptorDto {+ CommandDescriptorDto {+ argument_hint: Some("<command>".into()),+ ..command("bash", "Run a shell command in the workspace.", true)+ }+++ }+/// Spawns a persistent `graff --json` child for a conversation. `--yolo` skips/// permission prompts (the GUI has no approval surface yet); stderr is discarded/// since the protocol carries errors as `error` events on stdout.diff --cc gui/src/hooks/useCommandRouter.tsindex 002d8178,88367c10..9a30b4d4--- a/gui/src/hooks/useCommandRouter.ts+++ b/gui/src/hooks/useCommandRouter.ts@@@ -18,8 -18,7 +18,9 @@@ const ARG_COMMANDS = new Set("workspace-query","workspace-search","workflow",+ "goal",+ "loop",+ "bash","reasoning-effort",]);diff --cc gui/src/services/desktop/client.tsindex 938c96da,e8c86e50..2b02b0ab--- a/gui/src/services/desktop/client.ts+++ b/gui/src/services/desktop/client.ts@@@ -70,10 -70,9 +70,11 @@@ const qaCommandRows: Array<]> = [["help", "Show available slash commands.", null, "text"],["agent", "Show active agent and available agents.", null, "agents"],+ ["bash", "Run a shell command in the workspace.", "<command>", "text"],["sage", "Switch to Sage.", null, "agents"],["reasoning-effort", "Update reasoning effort.", "<low|medium|high>", "text"],+ ["goal", "Set/show the current objective.", "<objective|clear>", "text"],+ ["loop", "Run an autonomous plan→act→verify pass.", "<prompt>", "snapshot"],["workspace-info", "Show indexed workspace metadata.", null, "workspaceInfo"],["workspace-status", "Show workspace file status.", null, "workspaceStatus"],["workspace-query", "Search the workspace semantically.", "<query>", "workspaceSearch"],diff --cc src/main.zigindex 5f7b38a7,56fa7318..a079cdec--- a/src/main.zig+++ b/src/main.zig@@@ -701,12 -696,11 +701,12 @@@ const schema_version = "0.4"/// the GUI settings page so its provider list stays tied to the harness).fn providerDisplayName(id: []const u8) []const u8 {const names = .{-- .{ "codegraff", "Codegraff" }, .{ "anthropic", "Anthropic" },-- .{ "deepseek", "DeepSeek" }, .{ "openai", "OpenAI" },-- .{ "minimax", "MiniMax" }, .{ "xiaomi", "Xiaomi" },-- .{ "kimi", "Kimi" }, .{ "xai", "xAI" },- .{ "moonshot", "Moonshot" },-- .{ "zai", "Z.AI" }, .{ "codex", "Codex (ChatGPT)" },++ .{ "codegraff", "Codegraff" }, .{ "anthropic", "Anthropic" },++ .{ "deepseek", "DeepSeek" }, .{ "openai", "OpenAI" },++ .{ "minimax", "MiniMax" }, .{ "xiaomi", "Xiaomi" },++ .{ "kimi", "Kimi" }, .{ "xai", "xAI" },++ .{ "moonshot", "Moonshot" }, .{ "zai", "Z.AI" },++ .{ "codex", "Codex (ChatGPT)" },};inline for (names) |n| {if (std.mem.eql(u8, id, n[0])) return n[1];