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.
131 lines
3.7 KiB
Bash
Executable File
131 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Launch the default coding agent in a terminal
|
|
# omarchy:args=[--inline] [--pick]
|
|
# omarchy:examples=omarchy agent | omarchy agent --inline
|
|
|
|
inline=false
|
|
pick=false
|
|
|
|
# Flags only. A bare prompt would shadow the subcommands under this group, so
|
|
# prompts go through omarchy-agent-prompt, which passes one here as --prompt.
|
|
while (($#)); do
|
|
case "$1" in
|
|
--inline)
|
|
inline=true
|
|
shift
|
|
;;
|
|
--pick)
|
|
pick=true
|
|
shift
|
|
;;
|
|
--prompt)
|
|
prompt=${2:?--prompt needs a value}
|
|
shift 2
|
|
;;
|
|
*)
|
|
echo "Unexpected argument: $1" >&2
|
|
echo "To pass a prompt: omarchy agent prompt \"$*\"" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Agents refuse to remember trust for $HOME, so launches from the keybinding or
|
|
# menu start in the work directory instead of re-asking on every session.
|
|
[[ $PWD == "$HOME" && -d $HOME/Work ]] && cd "$HOME/Work"
|
|
|
|
agent=$(omarchy-default-agent)
|
|
|
|
# Omarchy ships without a default, so there is nothing to launch until one is
|
|
# picked. --pick offers the choice instead of the error, which is what the
|
|
# keybinding wants: a keypress that opens nothing explains nothing.
|
|
if [[ -z $agent ]]; then
|
|
[[ $pick == "true" ]] && exec omarchy-menu summon setup.default.agent
|
|
echo "Choose default agent with: omarchy default agent <name>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if omarchy-cmd-missing "$agent"; then
|
|
echo "$agent is not installed. Choose an installed agent with: omarchy default agent <name>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Agents launched from the keybinding or menu run unattended, so each one starts
|
|
# with its own spelling of "don't stop to ask". Pi, Ori and Dim have none to
|
|
# skip.
|
|
case "$agent" in
|
|
opencode)
|
|
command=(opencode --auto)
|
|
[[ -n ${prompt:-} ]] && command+=(--prompt "$prompt")
|
|
;;
|
|
agy)
|
|
command=(agy --dangerously-skip-permissions)
|
|
[[ -n ${prompt:-} ]] && command+=(--prompt-interactive "$prompt")
|
|
;;
|
|
copilot)
|
|
command=(copilot --allow-all)
|
|
[[ -n ${prompt:-} ]] && command+=(--interactive "$prompt")
|
|
;;
|
|
crush)
|
|
# --yolo belongs to the interactive command only; `crush run` never prompts.
|
|
if [[ -n ${prompt:-} ]]; then
|
|
command=(crush run "$prompt")
|
|
else
|
|
command=(crush --yolo)
|
|
fi
|
|
;;
|
|
claude)
|
|
command=(claude --permission-mode auto)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
dim)
|
|
# `dim exec` is the one-shot prompt form; interactive dim is the bare TUI.
|
|
if [[ -n ${prompt:-} ]]; then
|
|
command=(dim exec "$prompt")
|
|
else
|
|
command=(dim)
|
|
fi
|
|
;;
|
|
grok)
|
|
command=(grok --permission-mode bypassPermissions)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
kimi)
|
|
# --prompt is kimi's one-shot form, like `crush run`; --auto spares its questions.
|
|
command=(kimi --auto)
|
|
[[ -n ${prompt:-} ]] && command+=(--prompt "$prompt")
|
|
;;
|
|
codex)
|
|
command=(codex --approve-for-me)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
omp)
|
|
command=(omp --auto-approve)
|
|
[[ -n ${prompt:-} ]] && command+=(-- "$prompt")
|
|
;;
|
|
ori)
|
|
# Ori is a harness launcher, and `ori code` is the agent it runs itself.
|
|
# A prompt alone means one headless turn there, printed after the turn ends,
|
|
# so --interactive is what seeds the session with it and keeps the window.
|
|
command=(ori code)
|
|
[[ -n ${prompt:-} ]] && command+=(--interactive --prompt "$prompt")
|
|
;;
|
|
pi)
|
|
command=(pi)
|
|
[[ -n ${prompt:-} ]] && command+=("$prompt")
|
|
;;
|
|
*)
|
|
echo "Unsupported default agent: $agent" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
if [[ $inline == "true" ]]; then
|
|
exec "${command[@]}"
|
|
else
|
|
# A fixed app-id rather than the default org.omarchy.<binary>, so every agent
|
|
# window shares one class for window rules and themes to single out.
|
|
exec omarchy-launch-tui --app-id=org.omarchy.agent "${command[@]}"
|
|
fi
|