Both install through the lazy mise wrappers (npm:dimcode and npm:@moonshot-ai/kimi-code), preinstalled on new machines and migrated onto existing ones unless preinstalls were removed, and each gets a menu entry in both places: under Setup > Defaults > Agent as a default-agent choice, and under Install > AI for installing without changing the default. The launch spellings come from each CLI's actual flags — bare dim is the TUI and `dim exec` the one-shot, kimi runs full-auto as `kimi --auto` with `--prompt` as its one-shot. The Install > AI entries are guarded by `mise where`, since the preinstalled stub would otherwise read as installed. The menu marks are the Kimi simpleicon and Dim's traced from its app icon, since upstream publishes no monochrome SVG.
69 lines
2.3 KiB
Bash
Executable File
69 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Set and launch the default coding agent
|
|
# omarchy:args=[pi|omp|opencode|ori|claude|codex|grok|agy|copilot|crush|dim|kimi]
|
|
# omarchy:examples=omarchy default agent | omarchy default agent codex | omarchy default agent claude
|
|
|
|
installing=false
|
|
if [[ ${1:-} == "--install" ]]; then
|
|
installing=true
|
|
shift
|
|
fi
|
|
|
|
agent_file="$HOME/.config/omarchy/defaults/agent"
|
|
|
|
if (($# == 0)); then
|
|
if [[ -f $agent_file ]]; then
|
|
read -r agent <"$agent_file"
|
|
fi
|
|
|
|
# Silent when unset rather than defaulting: Omarchy picks no agent for you, so
|
|
# the menu leaves every entry unchecked until one is chosen.
|
|
[[ -n ${agent:-} ]] && echo "$agent"
|
|
exit 0
|
|
fi
|
|
|
|
case "$1" in
|
|
pi) agent="pi"; name="Pi" ;;
|
|
omp | oh-my-pi) agent="omp"; name="Oh My Pi"; agent_package="github:can1357/oh-my-pi" ;;
|
|
opencode | open-code) agent="opencode"; name="OpenCode" ;;
|
|
ori | openrouter) agent="ori"; name="Ori"; agent_package="github:OpenRouterLabs/ori-releases" ;;
|
|
claude | claude-code) agent="claude"; name="Claude Code" ;;
|
|
codex) agent="codex"; name="Codex" ;;
|
|
crush) agent="crush"; name="Crush" ;;
|
|
dim | dimcode | dim-agent) agent="dim"; name="Dim Agent"; agent_package="npm:dimcode" ;;
|
|
grok) agent="grok"; name="Grok"; agent_package="npm:@xai-official/grok" ;;
|
|
kimi | kimi-code) agent="kimi"; name="Kimi Code"; agent_package="npm:@moonshot-ai/kimi-code" ;;
|
|
agy | antigravity | antigravity-cli | gemini | gemini-cli) agent="agy"; name="Antigravity"; agent_package="antigravity-cli" ;;
|
|
copilot | github-copilot) agent="copilot"; name="GitHub Copilot" ;;
|
|
*)
|
|
echo "Usage: omarchy-default-agent <pi|omp|opencode|ori|claude|codex|grok|agy|copilot|crush|dim|kimi>"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
agent_package=${agent_package:-$agent}
|
|
|
|
if [[ $installing == "false" ]] && ! mise where "$agent_package" &>/dev/null; then
|
|
exec omarchy-launch-floating-terminal-with-presentation omarchy-default-agent --install "$agent"
|
|
fi
|
|
|
|
if ! mise use -g "$agent_package"; then
|
|
if [[ $installing == "true" ]]; then
|
|
echo "Could not install $name with mise" >&2
|
|
else
|
|
echo "Could not set $name as the default coding agent" >&2
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$(dirname "$agent_file")"
|
|
printf '%s\n' "$agent" >"$agent_file"
|
|
|
|
if [[ $installing == "true" ]]; then
|
|
printf '\033[2J\033[3J\033[H'
|
|
exec omarchy-agent --inline
|
|
else
|
|
exec omarchy-agent
|
|
fi
|