github

GitHub via gh CLI: PRs, issues, reviews, repos, auth.

  • github
  • gh
  • git
  • pull-requests
  • issues
  • code-review
  • repos
  • auth
  • ci

Declared platforms: linux · macos · windows

Install
npx skills add 'https://github.com/NousResearch/hermes-agent/tree/main/skills/software-development/github'
Download bundle ↓
main · 24fd22bScanned 2026-09-15

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md
#!/usr/bin/env python3"""Print the first unambiguous GitHub token in a git credential-store file.""" from pathlib import Pathimport reimport sysfrom urllib.parse import unquote, urlsplit  _TOKEN_PREFIXES = ("ghp_", "github_pat_", "gho_", "ghu_", "ghs_", "ghr_")_INVALID_ESCAPE = re.compile(r"%(?![0-9A-Fa-f]{2})")  def _decode(value: str | None) -> str:    if value is None or _INVALID_ESCAPE.search(value):        return ""    decoded = unquote(value)    if not decoded or any(ord(char) <= 0x1F or 0x7F <= ord(char) <= 0x9F for char in decoded):        return ""    return decoded  def _token_from_url(line: str) -> str:    if "\r" in line or "\n" in line:        return ""    try:        credential = urlsplit(line)        port = credential.port    except ValueError:        return ""    if credential.scheme != "https" or credential.hostname != "github.com" or port not in (None, 443):        return ""     username = _decode(credential.username)    password = _decode(credential.password)    if not username:        return ""    if password and password != "x-oauth-basic":        return password    if password == "x-oauth-basic":        return username    return username if username.startswith(_TOKEN_PREFIXES) else ""  def main() -> int:    path = Path(sys.argv[1]).expanduser() if len(sys.argv) > 1 else Path.home() / ".git-credentials"    try:        lines = path.read_bytes().split(b"\n")    except OSError:        return 1     for raw_line in lines:        try:            line = raw_line.decode("utf-8")        except UnicodeDecodeError:            continue        token = _token_from_url(line)        if token:            print(token)            return 0    return 1  if __name__ == "__main__":    raise SystemExit(main()) 
Referenced from SKILL.md