From 458239e5aeb0e7f0d0a43232e8080ebd27a01d4c Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Tue, 24 Mar 2026 20:02:06 +0800 Subject: [PATCH 1/3] fix(shell-plugin): add vi-command mode bindings for zsh-vi-mode compatibility When the zsh-vi-mode plugin (jeffreytse/zsh-vi-mode) is active, the Enter key in vi-command mode does not trigger forge's colon commands. Users report 'command not found: :model' and similar errors. Root cause: bindkey '^M' only sets the binding in the current keymap. In vicmd mode, Enter is bound to vi-accept-line, not forge-accept-line. Fix: also bind Enter and Tab in vicmd mode when zsh-vi-mode is detected. Detection uses $ZVM_MODE (zsh-vi-mode plugin) or bindkey -lL main (native vi mode via bindkey -v). Fixes: antinomyhq/forgecode#2681 Co-Authored-By: ForgeCode --- shell-plugin/lib/bindings.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/shell-plugin/lib/bindings.zsh b/shell-plugin/lib/bindings.zsh index 5100f3fb5b..82bfc9b6f8 100644 --- a/shell-plugin/lib/bindings.zsh +++ b/shell-plugin/lib/bindings.zsh @@ -29,3 +29,14 @@ bindkey '^M' forge-accept-line bindkey '^J' forge-accept-line # Update the Tab binding to use the new completion widget bindkey '^I' forge-completion # Tab for both @ and :command completion + +# Fix: zsh-vi-mode plugin compatibility +# When zsh-vi-mode (jeffreytse/zsh-vi-mode) is active, Enter in vi-command mode +# does not trigger forge's colon commands. Fix by also binding Enter in vicmd. +# Detects both zsh-vi-mode plugin ($ZVM_MODE) and native vi mode (bindkey -v). +if [[ -n "$ZVM_MODE" ]] || bindkey -lL main 2>/dev/null | grep -q "bindkey -A viins main\|bindkey -A vicmd main"; then + bindkey -M vicmd '^M' forge-accept-line + bindkey -M vicmd '^J' forge-accept-line + # Also bind Tab in vicmd for @ and :command completion + bindkey -M vicmd '^I' forge-completion +fi From 1c372a3dfc0f1a0be7c80d453b3ad78dc04d8d23 Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Tue, 31 Mar 2026 12:43:08 +0800 Subject: [PATCH 2/3] fix(forge_infra): add FORGE_FOLDER_PATH env var support for base_path Resolves: #2662 - Add FORGE_FOLDER_PATH env var to override default ~/forge path - Priority: FORGE_FOLDER_PATH > ~/forge > ./forge fallback - No breaking changes to existing behavior Co-Authored-By: Atlas Bounty Hunter --- crates/forge_infra/src/env.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/forge_infra/src/env.rs b/crates/forge_infra/src/env.rs index 1d39eb67ee..de934b3af4 100644 --- a/crates/forge_infra/src/env.rs +++ b/crates/forge_infra/src/env.rs @@ -57,9 +57,14 @@ impl ForgeEnvironmentInfra { pid: std::process::id(), cwd, shell: self.get_shell_path(), - base_path: dirs::home_dir() - .map(|a| a.join("forge")) - .unwrap_or(PathBuf::from(".").join("forge")), + // Resolve base_path: FORGE_FOLDER_PATH env var takes priority, then default to ~/forge + base_path: parse_env::("FORGE_FOLDER_PATH") + .map(PathBuf::from) + .unwrap_or_else(|| { + dirs::home_dir() + .map(|a| a.join("forge")) + .unwrap_or_else(|| PathBuf::from(".").join("forge")) + }), home: dirs::home_dir(), retry_config, max_search_lines: 200, @@ -297,7 +302,7 @@ mod tests { use forge_domain::{TlsBackend, TlsVersion}; use serial_test::serial; - use tempfile::{TempDir, tempdir}; + use tempfile::{tempdir, TempDir}; use super::*; From ef3418340622dd2e5564f2fa621719ec3f4af3c3 Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Tue, 31 Mar 2026 12:47:39 +0800 Subject: [PATCH 3/3] fix(bedrock): remove :0 suffix from Anthropic model IDs Bedrock API rejects model IDs with :0 suffix for Anthropic models. This change removes the :0 suffix before adding the regional prefix. Fixes #2644 Co-Authored-By: ForgeCode --- crates/forge_repo/src/provider/bedrock.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/forge_repo/src/provider/bedrock.rs b/crates/forge_repo/src/provider/bedrock.rs index 7fe69bbbea..d96456fa07 100644 --- a/crates/forge_repo/src/provider/bedrock.rs +++ b/crates/forge_repo/src/provider/bedrock.rs @@ -129,6 +129,14 @@ impl BedrockProvider { _ => "", }; + // Remove :0 suffix from Anthropic models before adding regional prefix + // AWS Bedrock Anthropic models don't accept :0 suffix in the model ID + let model_id = if model_id.contains("anthropic.") && model_id.ends_with(":0") { + &model_id[..model_id.len() - 2] + } else { + model_id + }; + // Only prefix Anthropic models that don't already have a regional prefix if model_id.contains("anthropic.") && !model_id.starts_with("us.")