Reshape the agent launcher into omarchy agent (#6757)
* Reshape the agent launcher into omarchy agent omarchy-launch-agent becomes omarchy-agent, with prompts on omarchy-agent-prompt rather than the bare route: `omarchy agent` is both a command and a group, so a positional prompt there would shadow any subcommand under it. The launcher takes flags only and points at `omarchy agent prompt` when handed one. Every agent window now launches under a fixed org.omarchy.agent app-id instead of omarchy-launch-tui's default of org.omarchy.<binary>, so one rule floats them all whichever agent is default. Omarchy also stops picking an agent for you. omarchy-default-agent prints nothing until one is chosen, leaving every entry under Setup > Defaults > Agent unchecked, and a first-run invitation offers to take you there. * Wordsmith * Cover the agent routes and the invitation The route split is the point of the change, so exercise `omarchy agent`, `omarchy agent prompt`, and a rejected positional prompt through the router rather than only the binaries behind them. The invitation gets the same treatment as the Voxtype and fingerprint ones: it notifies once, opens the agent defaults menu, and leaves both the notification and the marker alone for anyone who already chose an agent. * Offer the agent choice from the keybinding Super + Shift + Ctrl + A now runs `omarchy-agent --pick`, which opens Setup > Defaults > Agent when nothing is chosen yet. A keypress that writes to stderr and opens nothing just looks broken. * Reach existing installs with the agent invitation first-run installs the invitation hook, and existing accounts marked it complete long ago, so they would never see it -- while being the accounts most likely to need it, since the old getter returned opencode implicitly and most have no agent recorded at all. Post-update hooks run later in the same update, so the invitation arrives without waiting for another one. * Say what the Defaults submenus set Setup > Defaults lists Agent, Browser, Terminal, Editor, but the header inside each repeated the same bare word, which reads as a category rather than a setting -- and says nothing at all when the menu is summoned straight into it. The list keeps its short labels; the headers now name the setting.
This commit is contained in:
@@ -1,15 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Launch the default coding agent in a terminal
|
||||
# omarchy:args=[--inline] [prompt...]
|
||||
# omarchy:examples=omarchy launch agent | omarchy launch agent "Review this project"
|
||||
# omarchy:args=[--inline] [--pick]
|
||||
# omarchy:examples=omarchy agent | omarchy agent --inline
|
||||
|
||||
if [[ ${1:-} == "--inline" ]]; then
|
||||
inline=true
|
||||
shift
|
||||
else
|
||||
inline=false
|
||||
fi
|
||||
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.
|
||||
@@ -17,13 +37,18 @@ fi
|
||||
|
||||
agent=$(omarchy-default-agent)
|
||||
|
||||
if omarchy-cmd-missing "$agent"; then
|
||||
echo "$agent is not installed. Choose an installed agent with: omarchy default agent <name>" >&2
|
||||
# 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 (($# > 0)); then
|
||||
prompt="$*"
|
||||
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
|
||||
@@ -74,5 +99,7 @@ esac
|
||||
if [[ $inline == "true" ]]; then
|
||||
exec "${command[@]}"
|
||||
else
|
||||
exec omarchy-launch-tui "${command[@]}"
|
||||
# A fixed app-id rather than the default org.omarchy.<binary>, so every agent
|
||||
# window shares one class for default/hypr/apps/agent.lua to float.
|
||||
exec omarchy-launch-tui --app-id=org.omarchy.agent "${command[@]}"
|
||||
fi
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Launch the default coding agent with a prompt
|
||||
# omarchy:args=[--inline] <prompt...>
|
||||
# omarchy:examples=omarchy agent prompt "Review this project"
|
||||
|
||||
# Prompts live here rather than on `omarchy agent`, where a bare prompt would
|
||||
# shadow the subcommands under that group.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
inline=()
|
||||
if [[ ${1:-} == "--inline" ]]; then
|
||||
inline=(--inline)
|
||||
shift
|
||||
fi
|
||||
|
||||
if (($# == 0)); then
|
||||
echo "Usage: omarchy agent prompt [--inline] <prompt...>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec omarchy-agent "${inline[@]}" --prompt "$*"
|
||||
@@ -17,7 +17,9 @@ if (($# == 0)); then
|
||||
read -r agent <"$agent_file"
|
||||
fi
|
||||
|
||||
[[ -n $agent ]] && echo "$agent" || echo "opencode"
|
||||
# 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
|
||||
|
||||
@@ -57,7 +59,7 @@ printf '%s\n' "$agent" >"$agent_file"
|
||||
|
||||
if [[ $installing == "true" ]]; then
|
||||
printf '\033[2J\033[3J\033[H'
|
||||
exec omarchy-launch-agent --inline
|
||||
exec omarchy-agent --inline
|
||||
else
|
||||
exec omarchy-launch-agent
|
||||
exec omarchy-agent
|
||||
fi
|
||||
|
||||
@@ -72,6 +72,8 @@ run_first_run_step "install Voxtype post-update hook" \
|
||||
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/install-voxtype.hook"
|
||||
run_first_run_step "install fingerprint setup post-update hook" \
|
||||
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/setup-fingerprint.hook"
|
||||
run_first_run_step "install agent setup post-update hook" \
|
||||
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/setup-agent.hook"
|
||||
|
||||
run_first_run_step "enable user systemd units" \
|
||||
bash "$OMARCHY_PATH/install/user/first-run/enable-user-units.sh"
|
||||
|
||||
Reference in New Issue
Block a user