fix(agy): map -r/--resume with session id to --conversation #146

Merged
rootiest merged 1 commits from fix/agy-resume-conversation-syntax into main 2026-09-10 03:38:01 +00:00
+22 -6
View File
@@ -25,14 +25,19 @@
# rather than at session end. # rather than at session end.
# #
# Arguments are forwarded verbatim to the real agy binary, except for # Arguments are forwarded verbatim to the real agy binary, except for
# -r/--resume which are translated to -c/--continue. # -r/--resume which use different syntax in agy than claude: bare
# -r/--resume (no session id following) translate to -c/--continue
# (resume most-recent session); -r/--resume given a session id (via
# =id or a following bare word) translate to --conversation(=id)
# (open that specific session).
# #
# Opinionated component (C1): when disabled via __fish_config_op_aliases # Opinionated component (C1): when disabled via __fish_config_op_aliases
# (or the __fish_config_opinionated master), the command is passed through # (or the __fish_config_opinionated master), the command is passed through
# to the real agy binary unchanged. # to the real agy binary unchanged.
# #
# ARGUMENTS # ARGUMENTS
# ARGS Arguments forwarded to the underlying agy binary (-r translates to -c) # ARGS Arguments forwarded to the underlying agy binary (-r/--resume
# translate to -c/--continue or --conversation, see DESCRIPTION)
# #
# EXIT STATUS # EXIT STATUS
# Exit status of the underlying agy binary # Exit status of the underlying agy binary
@@ -40,6 +45,7 @@
# EXAMPLE # EXAMPLE
# agy # agy
# agy --resume # agy --resume
# agy --resume=5fffb251-2cd6-4cfe-8dac-b5e913a86db6
# agy -i "initial prompt" # agy -i "initial prompt"
# agy models # agy models
function agy --wraps=agy --description 'agy wrapper: auto-initializes AGENTS/ sub-repo before launch' function agy --wraps=agy --description 'agy wrapper: auto-initializes AGENTS/ sub-repo before launch'
@@ -52,12 +58,22 @@ function agy --wraps=agy --description 'agy wrapper: auto-initializes AGENTS/ su
agents-vault --quiet agents-vault --quiet
for i in (seq (count $argv)) for i in (seq (count $argv))
if test "$argv[$i]" = -r switch "$argv[$i]"
case -r --resume
# Session id given as next bare word (not a flag) -> --conversation.
# Nothing follows, or next word is a flag -> resume most-recent (-c/--continue).
set -l next (math $i + 1)
if test $next -le (count $argv); and not string match -q -- '-*' "$argv[$next]"
set argv[$i] --conversation
else if test "$argv[$i]" = -r
set argv[$i] -c set argv[$i] -c
else if test "$argv[$i]" = --resume else
set argv[$i] --continue set argv[$i] --continue
else if string match -q -- "--resume=*" "$argv[$i]" end
set argv[$i] (string replace -- "--resume=" "--continue=" "$argv[$i]") case '-r=*'
set argv[$i] (string replace -- '-r=' '--conversation=' "$argv[$i]")
case '--resume=*'
set argv[$i] (string replace -- '--resume=' '--conversation=' "$argv[$i]")
end end
end end