Repository navigation
Install herdr's agent integrations when an agent is first used #17281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
63314a1
Install herdr's agent integrations when an agent is first used
dhh 8fd8643
Keep the herdr integration migration pending when an install fails
dhh 741a91c
Skip agents whose herdr integration fails instead of stalling migrations
dhh afb3ba7
Simplify the herdr agent integration to the mise hook alone
dhh adbf516
Honor XDG_CONFIG_HOME for herdr's opencode, devin and kilo integrations
dhh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/bash | ||
|
|
||
| # omarchy:summary=Install herdr's status and session-restore integration for agents mise just installed | ||
| # omarchy:hidden=true | ||
|
|
||
| # mise runs this as a postinstall hook (etc/mise/conf.d/omarchy.toml), naming the | ||
| # tools it just installed in MISE_INSTALLED_TOOLS. Omarchy's agents are lazy and | ||
| # self-updating, so that is an agent's first use and every upgrade after it. | ||
| # herdr only installs into a config directory the agent already made, and the | ||
| # agent makes it on its first run, after this hook, so it is created here. | ||
| # A failure only warns: the agent should still start. | ||
|
|
||
| config=${XDG_CONFIG_HOME:-$HOME/.config} | ||
|
|
||
| while IFS= read -r tool; do | ||
| case $tool in | ||
| pi) target=pi dir=$HOME/.pi/agent ;; | ||
| oh-my-pi) target=omp dir=$HOME/.omp/agent ;; | ||
| claude) target=claude dir=${CLAUDE_CONFIG_DIR:-$HOME/.claude} ;; | ||
| codex) target=codex dir=${CODEX_HOME:-$HOME/.codex} ;; | ||
| grok) target=grok dir=${GROK_HOME:-$HOME/.grok} ;; | ||
| copilot) target=copilot dir=$HOME/.copilot ;; | ||
| qwen) target=qwen dir=$HOME/.qwen ;; | ||
| opencode) target=opencode dir=$config/opencode ;; | ||
| antigravity-cli) target=antigravity-cli dir=$HOME/.gemini/config ;; | ||
| cursor-agent | http:cursor-agent) target=cursor dir=$HOME/.cursor ;; | ||
| http:devin) target=devin dir=$config/devin ;; | ||
| npm:@kilocode/cli) target=kilo dir=$config/kilo ;; | ||
| npm:@moonshot-ai/kimi-code) target=kimi dir=$HOME/.kimi-code ;; | ||
| *) continue ;; | ||
| esac | ||
|
|
||
| # herdr reports to stdout, which would land on the agent's first screen. | ||
| if ! mkdir -p "$dir" || ! herdr integration install "$target" >/dev/null; then | ||
| echo "Could not install the herdr integration for $target" >&2 | ||
| fi | ||
| done < <(jq -r '.[].name' <<<"${MISE_INSTALLED_TOOLS:-[]}" 2>/dev/null) | ||
|
|
||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(dirname "$0")/base-test.sh" | ||
|
|
||
| if ! command -v herdr >/dev/null; then | ||
| skip "herdr not installed; skipping agent herdr integration" | ||
| exit 0 | ||
| fi | ||
|
|
||
| test_home=$(mktemp -d) | ||
| trap 'rm -rf -- "$test_home"' EXIT | ||
| export HOME=$test_home | ||
| # herdr honors each of these over HOME, which would reach the developer's own agent homes. | ||
| unset PI_CODING_AGENT_DIR PI_CONFIG_DIR COPILOT_HOME KIMI_CODE_HOME OPENCODE_CONFIG_DIR QWEN_HOME \ | ||
| CURSOR_CONFIG_DIR ANTIGRAVITY_CLI_CONFIG_DIR GROK_CONFIG_DIR QODER_CONFIG_DIR HERMES_HOME XDG_CONFIG_HOME | ||
|
|
||
| integration_state() { | ||
| herdr integration status | awk -v target="$1" -F ': ' '$1 == target { split($2, state, " "); print state[1] }' | ||
| } | ||
|
|
||
| # A first install from mise names tools by their mise names, before the agent | ||
| # has ever run and made the config directory herdr installs into. | ||
| MISE_INSTALLED_TOOLS='[{"name":"grok"},{"name":"npm:@moonshot-ai/kimi-code"},{"name":"oh-my-pi"},{"name":"hunk"}]' \ | ||
| "$ROOT/bin/omarchy-agent-integrate-herdr" >"$test_home/out.log" 2>&1 || fail "integrating new agents succeeds" "$(cat "$test_home/out.log")" | ||
|
|
||
| for target in grok kimi omp; do | ||
| [[ $(integration_state "$target") == "current" ]] || fail "a first mise install integrates $target with herdr" "$(herdr integration status)" | ||
| done | ||
| [[ ! -s $test_home/out.log ]] || fail "integrating stays quiet in the agent's first screen" "$(cat "$test_home/out.log")" | ||
| pass "a first mise install integrates the agent with herdr" | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.