ghw is a thin wrapper around the GitHub CLI (gh) that:
Portability note (POC):
ghwcurrently does not verify the code signature of theghbinary. To reduce PATH-based spoofing, it targets the Homebrew installation path (/opt/homebrew/bin/gh) by default.
- requires
--as <alias>on every command (no defaults) - stores GitHub personal access tokens in macOS Keychain
- injects environment variable
GH_TOKENinto theghsubprocess environment - blocks
gh auth ...soghcan’t store/read credentials via Keychain shell-outs
gh accesses keychain using shell's command security, leading to process /usr/bin/security getting access to the stored GitHub Token. This will allow any process using shell to get access to stored github tokens. See cli/cli#7123.
ghw keeps the token flow explicit and local:
ghwreads a token from Keychain using Keychain APIsghwrunsghwithGH_TOKENset only for that subprocess
- macOS
- GitHub CLI:
brew install gh
- Swift toolchain (Xcode Command Line Tools):
xcode-select --install
swift build -c releaseRun locally:
swift testThese tests cover the core security policies (blocking auth, selecting tokens by --as, validating-before-store for login, etc.).
Location:
scripts/acceptance-tests.sh
Run locally:
./scripts/acceptance-tests.shWhat they do (high level):
- Ensure
ghw auth ...is blocked. - Ensure
ghw loginfails for a fake token (deterministically in DEBUG by using a non-existentghpath).
Binary:
./.build/release/ghw
Install ghw to a stable location and add it to PATH, so you can run ghw directly.
Example:
mkdir -p /Users/agent/.openclaw/workspace/bin
cp -f ./.build/release/ghw /Users/agent/.openclaw/workspace/bin/ghw
chmod +x /Users/agent/.openclaw/workspace/bin/ghw
# zsh:
echo 'export PATH="/Users/agent/.openclaw/workspace/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Signing is recommended so we can store Keychain tokens with an ACL that trusts only the signed ghw binary.
scripts/sign.shcontains no keys. It just invokescodesignwith an identity that already exists in your Keychain.
- Open Keychain Access
- Keychain Access → Certificate Assistant → Create a Certificate…
- Name:
ghw-local - Identity Type: Self Signed Root
- Certificate Type: Code Signing
Then:
swift build -c release
SIGN_ID="ghw-local" ./scripts/sign.shUse your Developer ID Application identity, e.g.:
swift build -c release
SIGN_ID="Developer ID Application: Your Name (TEAMID)" ./scripts/sign.shDefault: interactive hidden prompt
If you run ghw login in a normal terminal, it will prompt for the token with hidden input.
ghw login --as <alias> If stdin is not a TTY (piped input), ghw login reads the token from stdin:
echo "$GITHUB_PAT" | ghw login --as <alias># sanity check
ghw --as <alias> whoami
# example command
ghw --as <alias> repo view <owner>/<repo>
# create PR using template
ghw --as <alias> pr create --body-file .github/pull_request_template.mdThis repo includes .github/pull_request_template.md copied from the org template.
This repo also includes a skill which uses ghw to create repository and manage pull requests along with mandated repository settings and PR templates.