* refactor(skills): shipped-set slim — 15 skills to optional, github six-way merge, pdf absorbs OCR+nano-pdf, channel-gated teams pipeline
Maintainer-directed shipped-skills curation (skills index 1,900 -> ~1,400
tok/call on desktop; every session pays the index, so this is a per-call
diet on all installs):
- optional-skills moves (installable via skills hub, history preserved):
creative comfyui/ascii-art/excalidraw/pretext/sketch/touchdesigner-mcp;
ALL of mlops (huggingface-hub, llama-cpp, serving-llms-vllm,
weights-and-biases, evaluating-llms-harness — subcategory structure
kept); research-paper-writing (55 supporting files, 17.3K-tok load);
openhue; blogwatcher (first taught the cronjob monitor-field watch
pattern + web_extract instead of pre-cron manual workflows)
- DELETED session-librarian (Aug-12 'inspired by Perplexity Computer'
port, never maintainer-intended; session_search covers discovery)
- github: six skills (auth, issues, pr-workflow, issue-to-pr,
code-review, repo-management) merged into ONE software-development/
github skill — routing body + complete per-workflow references;
benbarclay authorship credited; codebase-inspection rides along;
discipline pins from test_github_issue_to_pr_skill.py preserved
against the reference body in the new test_github_skill.py
- pdf absorbs ocr-and-documents + nano-pdf as references/ + scripts
(extract_pymupdf, extract_marker converted to the argparse house
standard its contract test enforces)
- NEW session_platforms frontmatter gate (metadata.hermes): hides a
skill from the index on gateway channels it is not for; fail-open on
unknown platform; teams-meeting-pipeline gated to [teams, cron]
- blocked-page-recovery: research -> new web category; trigger-first
description ('Use when a fetch fails: 403/429, paywall, WAF, bot
wall.') so the model actually reaches for it on blocked fetches
- docs regenerated via generate-skill-docs.py (195 pages); related_skills
swept repo-wide; tests: 1672 passed (2 openclaw failures pre-existing
on clean main, Windows-local)
* chore: ignore .skills_prompt_snapshot.json (local index cache, accidentally committed)
67 lines
2.5 KiB
Bash
Executable File
67 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# GitHub environment detection helper for Hermes Agent skills.
|
|
#
|
|
# Usage (via terminal tool):
|
|
# source skills/github/github-auth/scripts/gh-env.sh
|
|
#
|
|
# After sourcing, these variables are set:
|
|
# GH_AUTH_METHOD - "gh", "curl", or "none"
|
|
# GITHUB_TOKEN - personal access token (set if method is "curl")
|
|
# GH_USER - GitHub username
|
|
# GH_OWNER - repo owner (only if inside a git repo with a github remote)
|
|
# GH_REPO - repo name (only if inside a git repo with a github remote)
|
|
# GH_OWNER_REPO - owner/repo (only if inside a git repo with a github remote)
|
|
|
|
# --- Auth detection ---
|
|
|
|
GH_AUTH_METHOD="none"
|
|
GITHUB_TOKEN="${GITHUB_TOKEN:-}"
|
|
GH_USER=""
|
|
|
|
if command -v gh &>/dev/null && gh auth status &>/dev/null 2>&1; then
|
|
GH_AUTH_METHOD="gh"
|
|
GH_USER=$(gh api user --jq '.login' 2>/dev/null)
|
|
elif [ -n "$GITHUB_TOKEN" ]; then
|
|
GH_AUTH_METHOD="curl"
|
|
elif _hermes_env="${HERMES_HOME:-$HOME/.hermes}/.env"; [ -f "$_hermes_env" ] && grep -q "^GITHUB_TOKEN=" "$_hermes_env" 2>/dev/null; then
|
|
GITHUB_TOKEN=$(grep "^GITHUB_TOKEN=" "$_hermes_env" | head -1 | cut -d= -f2 | tr -d '\n\r')
|
|
if [ -n "$GITHUB_TOKEN" ]; then
|
|
GH_AUTH_METHOD="curl"
|
|
fi
|
|
elif [ -f "$HOME/.git-credentials" ]; then
|
|
GITHUB_TOKEN=$(uv run python3 "${HERMES_HOME:-$HOME/.hermes}/skills/github/github-auth/scripts/git-credential-token.py")
|
|
if [ -n "$GITHUB_TOKEN" ]; then
|
|
GH_AUTH_METHOD="curl"
|
|
fi
|
|
fi
|
|
|
|
# Resolve username for curl method
|
|
if [ "$GH_AUTH_METHOD" = "curl" ] && [ -z "$GH_USER" ]; then
|
|
GH_USER=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
|
https://api.github.com/user 2>/dev/null \
|
|
| python3 -c "import sys,json; print(json.load(sys.stdin).get('login',''))" 2>/dev/null)
|
|
fi
|
|
|
|
# --- Repo detection (if inside a git repo with a GitHub remote) ---
|
|
|
|
GH_OWNER=""
|
|
GH_REPO=""
|
|
GH_OWNER_REPO=""
|
|
|
|
_remote_url=$(git remote get-url origin 2>/dev/null)
|
|
if [ -n "$_remote_url" ] && echo "$_remote_url" | grep -q "github.com"; then
|
|
GH_OWNER_REPO=$(echo "$_remote_url" | sed -E 's|.*github\.com[:/]||; s|\.git$||')
|
|
GH_OWNER=$(echo "$GH_OWNER_REPO" | cut -d/ -f1)
|
|
GH_REPO=$(echo "$GH_OWNER_REPO" | cut -d/ -f2)
|
|
fi
|
|
unset _remote_url
|
|
|
|
# --- Summary ---
|
|
|
|
echo "GitHub Auth: $GH_AUTH_METHOD"
|
|
[ -n "$GH_USER" ] && echo "User: $GH_USER"
|
|
[ -n "$GH_OWNER_REPO" ] && echo "Repo: $GH_OWNER_REPO"
|
|
[ "$GH_AUTH_METHOD" = "none" ] && echo "⚠ Not authenticated — see github-auth skill"
|
|
|
|
export GH_AUTH_METHOD GITHUB_TOKEN GH_USER GH_OWNER GH_REPO GH_OWNER_REPO
|