Skip to content

Commit 65d7925

Browse files
committed
fix: use AppleScript injection for Crush prompts instead of -i flag
- Remove -i flag usage for crush (flag doesn't exist) - Implement delayed prompt sending via AppleScript like kimi - Add crush single-agent mode with Ghostty split method - Update help text to indicate crush requires Ghostty for prompts - Make crush behavior consistent with other agents without -i support 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land> Signed-off-by: Lars Trieloff <lars@trieloff.net>
1 parent 5600644 commit 65d7925

1 file changed

Lines changed: 49 additions & 4 deletions

File tree

executable_yolo

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Supported Commands:
102102
qwen Uses --yolo; adds -i when prompt present
103103
kimi Uses --yolo (requires Ghostty for interactive prompts)
104104
opencode No extra flags added
105-
crush Uses --yolo; adds -i when prompt present
105+
crush Uses --yolo (requires Ghostty for interactive prompts)
106106
<other> Adds --yolo (generic fallback)
107107
108108
Multi-agent Mode:
@@ -927,8 +927,8 @@ run_multi_agents() {
927927
fi
928928
agent_prompts+=("") # opencode handles prompts via --prompt flag
929929
;;
930-
gemini|qwen|crush)
931-
# gemini/qwen/crush: add -i when prompt present to remain interactive
930+
gemini|qwen)
931+
# gemini/qwen: add -i when prompt present to remain interactive
932932
cmd_arr+=("$agent")
933933
if [[ -n "$flags" ]]; then
934934
# shellcheck disable=SC2206
@@ -940,7 +940,24 @@ run_multi_agents() {
940940
prompt_joined=$(printf '%s ' "${common_args[@]}"); prompt_joined=${prompt_joined%% }
941941
cmd_arr+=("-i" "$prompt_joined")
942942
fi
943-
agent_prompts+=("") # gemini/qwen/crush handle prompts via -i flag
943+
agent_prompts+=("") # gemini/qwen handle prompts via -i flag
944+
;;
945+
crush)
946+
# crush: no -i flag, so use delayed prompt sending like kimi
947+
cmd_arr+=("$agent")
948+
if [[ -n "$flags" ]]; then
949+
# shellcheck disable=SC2206
950+
local flag_array=($flags)
951+
cmd_arr+=("${flag_array[@]}")
952+
fi
953+
# Store prompt for delayed sending via AppleScript
954+
if (( ${#common_args[@]} )); then
955+
local prompt_joined
956+
prompt_joined=$(printf '%s ' "${common_args[@]}"); prompt_joined=${prompt_joined%% }
957+
agent_prompts+=("$prompt_joined")
958+
else
959+
agent_prompts+=("") # No prompt for this agent
960+
fi
944961
;;
945962
droid)
946963
# droid: allow inline prompt to seed session
@@ -1547,6 +1564,34 @@ main() {
15471564
fi
15481565
fi
15491566
;;
1567+
crush)
1568+
if (( ${#command_args[@]} )); then
1569+
local prompt_joined
1570+
prompt_joined=$(printf '%s ' "${command_args[@]}"); prompt_joined=${prompt_joined%% }
1571+
local flags_str=""
1572+
if [[ -n "$flags" ]]; then flags_str="$flags"; fi
1573+
1574+
# crush doesn't have -i flag, use delayed prompt sending like kimi
1575+
# Use Ghostty split method for proper interactive experience
1576+
if is_ghostty; then
1577+
local agent_cmd
1578+
agent_cmd="crush $flags_str"
1579+
run_single_agent_ghostty_with_prompt "$agent_cmd" "$prompt_joined"
1580+
exit $?
1581+
else
1582+
print_error "crush with prompts requires Ghostty terminal for interactive mode"
1583+
print_info "Either run in Ghostty or launch crush without a prompt"
1584+
exit 1
1585+
fi
1586+
else
1587+
# No prompt - just launch interactively
1588+
if [[ -n "$flags" ]]; then
1589+
# shellcheck disable=SC2206
1590+
local flag_array=($flags)
1591+
full_command+=("${flag_array[@]}")
1592+
fi
1593+
fi
1594+
;;
15501595
opencode)
15511596
if (( ${#command_args[@]} )); then
15521597
local prompt_joined

0 commit comments

Comments
 (0)