Skip to content

Instantly share code, notes, and snippets.

@edxeth
Created April 21, 2026 20:48
Show Gist options
  • Select an option

  • Save edxeth/c86717482b5868d45560427bdc38c6fb to your computer and use it in GitHub Desktop.

Select an option

Save edxeth/c86717482b5868d45560427bdc38c6fb to your computer and use it in GitHub Desktop.
~/.pi/agent/bin/agent-browser
#!/usr/bin/env bash
set -euo pipefail
BUN_AGENT_BROWSER_LINK="$HOME/.bun/bin/agent-browser"
REAL_AGENT_BROWSER="$(readlink -f "$BUN_AGENT_BROWSER_LINK" 2>/dev/null || true)"
if [[ -z "$REAL_AGENT_BROWSER" || ! -x "$REAL_AGENT_BROWSER" ]]; then
echo "agent-browser wrapper error: could not resolve Bun global agent-browser from $BUN_AGENT_BROWSER_LINK" >&2
exit 1
fi
if [[ "${1-}" == "skills" && "${2-}" == "get" ]]; then
full=0
json=0
name=""
for a in "$@"; do
[[ "$a" == "--full" ]] && full=1
[[ "$a" == "--json" ]] && json=1
done
if [[ -n "${3-}" && "${3-}" != --* ]]; then
name="${3}"
else
name="core"
fi
if [[ $full -eq 1 ]]; then
path="$($REAL_AGENT_BROWSER skills path "$name")"
message=$(cat <<EOF
READ:
- $path/SKILL.md
- $path/references/*
- $path/templates/*
EOF
)
if [[ $json -eq 1 ]]; then
python - <<'PY' "$name" "$message"
import json, sys
name = sys.argv[1]
message = sys.argv[2]
print(json.dumps({"success": True, "data": [{"name": name, "content": message}]}))
PY
else
printf '%s\n' "$message"
fi
exit 0
fi
fi
exec "$REAL_AGENT_BROWSER" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment