Skip to content

Commit da88564

Browse files
fix(github-app): address Henry's review — source guard, consistent paths, symlink fix, README notes
1 parent 8535f40 commit da88564

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

plugins/github-app/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,29 @@ plugins/github-app/
191191
└── README.md
192192
```
193193
194+
## Upgrading from 0.1.x
195+
196+
### Migration
197+
198+
v0.2.0 moves credential storage from `~/.config/agent/` to `~/.agents/${AGENT_NAME}/.config/`. On first session start after upgrading, a fresh token is generated under the new path. The old files at `~/.config/agent/` become orphaned and can be safely deleted:
199+
200+
```bash
201+
rm -rf ~/.config/agent/github-token ~/.config/agent/github-token.meta ~/.config/agent/github-app-env
202+
```
203+
204+
### AGENT_NAME for git credential helper
205+
206+
`bin/git-credential-github-app.sh` is invoked by **git itself** outside the Claude harness. Git inherits the user's shell environment, where `AGENT_NAME` may not be set. To ensure the credential helper finds the correct per-agent token, export `AGENT_NAME` in your shell profile:
207+
208+
```bash
209+
# ~/.bashrc or ~/.zshrc
210+
export AGENT_NAME="jack" # or "henry", etc.
211+
```
212+
213+
Or in a systemd unit: `Environment=AGENT_NAME=jack`
214+
215+
If `AGENT_NAME` is not set, the credential helper falls back to `~/.agents/_UNKNOWN/.config/`, which may collide with other unconfigured agents.
216+
194217
## Related
195218

196219
- **[github](../github)** plugin — GitHub CLI installation, usage skill, and general auth

plugins/github-app/bin/token-check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ release_lock() {
9494
}
9595

9696
# Get token minutes remaining (shared utility)
97-
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
97+
PLUGIN_DIR="$(cd "$(dirname "$_self")/.." && pwd)"
9898
source "$PLUGIN_DIR/lib/token-utils.sh"
9999

100100
# Update the runtime env file with current token

plugins/github-app/hooks/scripts/github-token-check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set -euo pipefail
2222
# --- Configuration ---
2323

2424
# shellcheck source=../../lib/agent-paths.sh
25-
source "$(cd "$(dirname "$0")/../.." && pwd)/lib/agent-paths.sh"
25+
source "${CLAUDE_PLUGIN_ROOT}/lib/agent-paths.sh"
2626

2727
DEBOUNCE_FILE="${AGENT_CONFIG_DIR}/github-app-last-check"
2828
DEBOUNCE_SECONDS=30 # Don't check more often than every 30 seconds

plugins/github-app/lib/agent-paths.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
# Usage: source "$(dirname "$0")/../lib/agent-paths.sh"
99
# or: source "${CLAUDE_PLUGIN_ROOT}/lib/agent-paths.sh"
1010

11+
[[ -n "${_AGENT_PATHS_LOADED:-}" ]] && return 0
12+
_AGENT_PATHS_LOADED=1
13+
1114
AGENT_CONFIG_DIR="${HOME}/.agents/${AGENT_NAME:-_UNKNOWN}/.config"

0 commit comments

Comments
 (0)