diff --git a/crates/forge_main/src/built_in_commands.json b/crates/forge_main/src/built_in_commands.json index a8f95f14e1..def764c393 100644 --- a/crates/forge_main/src/built_in_commands.json +++ b/crates/forge_main/src/built_in_commands.json @@ -107,6 +107,10 @@ "command": "keyboard-shortcuts", "description": "Display ZSH keyboard shortcuts [alias: kb]" }, + { + "command": "echo", + "description": "Echo the input text" + }, { "command": "setup", "description": "Setup zsh integration by updating .zshrc" diff --git a/shell-plugin/forge.plugin.zsh b/shell-plugin/forge.plugin.zsh index e877afdff7..8f92c395f8 100755 --- a/shell-plugin/forge.plugin.zsh +++ b/shell-plugin/forge.plugin.zsh @@ -26,6 +26,7 @@ source "${0:A:h}/lib/actions/editor.zsh" source "${0:A:h}/lib/actions/provider.zsh" source "${0:A:h}/lib/actions/doctor.zsh" source "${0:A:h}/lib/actions/keyboard.zsh" +source "${0:A:h}/lib/actions/echo.zsh" # Main dispatcher and widget registration source "${0:A:h}/lib/dispatcher.zsh" diff --git a/shell-plugin/lib/actions/echo.zsh b/shell-plugin/lib/actions/echo.zsh new file mode 100644 index 0000000000..4656c68d1f --- /dev/null +++ b/shell-plugin/lib/actions/echo.zsh @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh + +# Echo action handler + +# Action handler: Echo the input text +function _forge_action_echo() { + local input_text="$1" + if [[ -n "$input_text" ]]; then + echo "$input_text" + fi +} diff --git a/shell-plugin/lib/dispatcher.zsh b/shell-plugin/lib/dispatcher.zsh index 7bbd0d48da..21618d1e7b 100644 --- a/shell-plugin/lib/dispatcher.zsh +++ b/shell-plugin/lib/dispatcher.zsh @@ -65,8 +65,6 @@ function _forge_action_default() { _FORGE_CONVERSATION_ID="$new_id" fi - echo - # Only set the agent if user explicitly specified one if [[ -n "$user_action" ]]; then _FORGE_ACTIVE_AGENT="$user_action" @@ -223,7 +221,12 @@ function forge-accept-line() { keyboard-shortcuts|kb) _forge_action_keyboard ;; + echo) + zle -I + _forge_action_echo "$input_text" + ;; *) + zle -I _forge_action_default "$user_action" "$input_text" ;; esac