feat: add Fish function wrappers for copilot suggest/explain commands

Replace gh copilot aliases with custom Fish functions that provide better help
text and wrap the copilot CLI with appropriate prompts
This commit is contained in:
2025-12-30 00:26:22 -06:00
parent f2e2fd1215
commit 005b2ed850
8 changed files with 72 additions and 7 deletions
@@ -949,8 +949,8 @@ alias romanlog = ssh roman 'tail -F /var/log/syslog' --lines 100
# Other aliases # Other aliases
alias gpt = chatgpt alias gpt = chatgpt
alias copilot = gh copilot alias copilot = copilot
alias suggest = gh copilot suggest -t shell alias suggest = copilot -p "suggest:" --allow-all-tools
alias spt = spotify_player alias spt = spotify_player
{{ if eq .chezmoi.os "linux" }} {{ if eq .chezmoi.os "linux" }}
alias mousefix = sudo udevadm trigger alias mousefix = sudo udevadm trigger
+1 -2
View File
@@ -48,8 +48,7 @@ abbr -a copeh 'claude --model haiku'
abbr -a hcope 'claude --model haiku' abbr -a hcope 'claude --model haiku'
abbr -a gpt 'chatgpt' abbr -a gpt 'chatgpt'
abbr -a share 'share.ts' abbr -a share 'share.ts'
abbr -a copilot 'gh copilot' abbr -a copilot 'copilot'
abbr -a suggest 'gh copilot suggest -t shell'
abbr -a spt 'spotify_player' abbr -a spt 'spotify_player'
abbr -a gitalias 'alias | grep "git "' abbr -a gitalias 'alias | grep "git "'
abbr -a mousefix 'sudo udevadm trigger' abbr -a mousefix 'sudo udevadm trigger'
@@ -23,7 +23,7 @@ function chai --description "Interactive chezmoi apply with fzf diff preview"
--with-nth=4 \ --with-nth=4 \
--nth=1 \ --nth=1 \
--prompt='Apply Changes > ' \ --prompt='Apply Changes > ' \
--preview='chezmoi diff {1} 2>/dev/null | bat -pp --color=always --language=diff' \ --preview='chezmoi diff ~/{1} 2>/dev/null | bat -pp --color=always --language=diff' \
--preview-window=right:60%:wrap \ --preview-window=right:60%:wrap \
--multi \ --multi \
--bind='ctrl-a:toggle-all' \ --bind='ctrl-a:toggle-all' \
@@ -0,0 +1,28 @@
function explain --description "Explain a command using GitHub Copilot"
argparse --name=explain \
'd/debug' \
'h/help' \
'hostname=' \
-- $argv
or return 1
if set -q _flag_help
echo "Wrapper around \`copilot\` to explain a command."
echo
echo "USAGE"
echo " explain [flags] <command>"
echo
echo "FLAGS"
echo " -d, --debug Enable debugging"
echo " -h, --help Display help usage"
echo " --hostname HOST GitHub host for authentication"
echo
echo "EXAMPLES"
echo " explain 'du -sh | sort -h'"
echo " explain 'git log --oneline --graph --decorate --all'"
echo " explain 'bfg --strip-blobs-bigger-than 50M'"
return 0
end
copilot -p "explain: $argv" --allow-all-tools
end
+3
View File
@@ -0,0 +1,3 @@
function ghce --wraps explain --description "Alias for explain (GitHub Copilot)"
explain $argv
end
+3
View File
@@ -0,0 +1,3 @@
function ghcs --wraps suggest --description "Alias for suggest (GitHub Copilot)"
suggest $argv
end
@@ -0,0 +1,32 @@
function suggest --description "Suggest a command using GitHub Copilot"
argparse --name=suggest \
'd/debug' \
'h/help' \
'hostname=' \
't/target=' \
-- $argv
or return 1
if set -q _flag_help
echo "Wrapper around \`copilot\` to suggest a command."
echo "Places suggested command on the command line for review/editing."
echo
echo "USAGE"
echo " suggest [flags] <prompt>"
echo
echo "FLAGS"
echo " -d, --debug Enable debugging"
echo " -h, --help Display help usage"
echo " --hostname HOST GitHub host for authentication"
echo " -t, --target TARGET Target: shell (default), gh, git"
echo
echo "EXAMPLES"
echo " suggest"
echo " suggest -t git 'Undo the most recent local commits'"
echo " suggest -t gh 'Create pull request'"
echo " suggest 'Convert MOV to animated PNG'"
return 0
end
copilot -p "suggest: $argv" --allow-all-tools
end
+2 -2
View File
@@ -44,8 +44,8 @@ alias copes='claude --model sonnet'
alias copeh='claude --model haiku' alias copeh='claude --model haiku'
alias hcope='claude --model haiku' alias hcope='claude --model haiku'
alias gpt='chatgpt' alias gpt='chatgpt'
alias copilot='gh copilot' alias copilot='copilot'
alias suggest='gh copilot suggest -t shell' alias suggest='copilot -p "suggest:" --allow-all-tools'
alias spt='spotify_player' alias spt='spotify_player'
alias gitalias='alias | grep "git "' alias gitalias='alias | grep "git "'
alias mousefix='sudo udevadm trigger' # helped with mouse issues on laptop alias mousefix='sudo udevadm trigger' # helped with mouse issues on laptop