fish: only read the keychain PAT on systems that have security

The bare command substitution ran on every shell start regardless of
platform, so Linux/WSL printed "fish: Unknown command: security" at
login — the 2>/dev/null only redirects the command's own stderr, not
fish's command-not-found diagnostic.

Guard with `type -q security`, matching conf.d/codex-github-mcp.fish,
and skip the export when the lookup returns nothing so a missing
keychain item no longer exports an empty GITHUB_PERSONAL_ACCESS_TOKEN.
This commit is contained in:
Anton Volnuhin 2026-08-06 01:23:07 +03:00
parent 384bfe57b3
commit 739e906080

View File

@ -275,7 +275,11 @@ fish_add_path $HOME/.antigravity/antigravity/bin
source ~/.orbstack/shell/init2.fish 2>/dev/null || :
# GitHub MCP plugin auth — pull PAT from keychain (avoids plaintext in config files)
set -gx GITHUB_PERSONAL_ACCESS_TOKEN (security find-generic-password -s codex-github-mcp-pat -w 2>/dev/null)
if type -q security
set -l github_pat (security find-generic-password -s codex-github-mcp-pat -w 2>/dev/null)
test -n "$github_pat"
and set -gx GITHUB_PERSONAL_ACCESS_TOKEN "$github_pat"
end
# >>> grok installer >>>