winter-super-cli 2026.6.24 → 2026.6.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -5
- package/README.md +85 -0
- package/package.json +5 -1
- package/resources/local/gsap-skills/.claude-plugin/marketplace.json +20 -0
- package/resources/local/gsap-skills/.claude-plugin/plugin.json +6 -0
- package/resources/local/gsap-skills/.cursor-plugin/marketplace.json +13 -0
- package/resources/local/gsap-skills/.cursor-plugin/plugin.json +22 -0
- package/resources/local/gsap-skills/.github/copilot-instructions.md +17 -0
- package/resources/local/gsap-skills/.github/instructions/react.instructions.md +15 -0
- package/resources/local/gsap-skills/.github/instructions/scrolltrigger.instructions.md +18 -0
- package/resources/local/gsap-skills/AGENTS.md +27 -0
- package/resources/local/gsap-skills/CLAUDE.md +1 -0
- package/resources/local/gsap-skills/GEMINI.md +1 -0
- package/resources/local/gsap-skills/LICENSE +21 -0
- package/resources/local/gsap-skills/README.md +163 -0
- package/resources/local/gsap-skills/assets/gsap-green.svg +7 -0
- package/resources/local/gsap-skills/assets/gsap-icon-inverted.svg +15 -0
- package/resources/local/gsap-skills/assets/gsap-icon-square.svg +1 -0
- package/resources/local/gsap-skills/assets/gsap-white.svg +7 -0
- package/resources/local/gsap-skills/examples/README.md +29 -0
- package/resources/local/gsap-skills/examples/nuxt/app/app.vue +3 -0
- package/resources/local/gsap-skills/examples/nuxt/app/composables/useGSAP.ts +91 -0
- package/resources/local/gsap-skills/examples/nuxt/app/pages/index.vue +55 -0
- package/resources/local/gsap-skills/examples/nuxt/nuxt.config.ts +4 -0
- package/resources/local/gsap-skills/examples/nuxt/package.json +18 -0
- package/resources/local/gsap-skills/examples/react/App.jsx +46 -0
- package/resources/local/gsap-skills/examples/react/index.html +12 -0
- package/resources/local/gsap-skills/examples/react/main.jsx +9 -0
- package/resources/local/gsap-skills/examples/react/package.json +21 -0
- package/resources/local/gsap-skills/examples/react/vite.config.js +7 -0
- package/resources/local/gsap-skills/examples/vanilla/index.html +33 -0
- package/resources/local/gsap-skills/examples/vanilla/main.js +36 -0
- package/resources/local/gsap-skills/examples/vue/app.vue +47 -0
- package/resources/local/gsap-skills/examples/vue/index.html +15 -0
- package/resources/local/gsap-skills/examples/vue/main.js +9 -0
- package/resources/local/gsap-skills/examples/vue/package.json +19 -0
- package/resources/local/gsap-skills/examples/vue/vite.config.js +7 -0
- package/resources/local/gsap-skills/skills/gsap-core/SKILL.md +254 -0
- package/resources/local/gsap-skills/skills/gsap-frameworks/SKILL.md +266 -0
- package/resources/local/gsap-skills/skills/gsap-performance/SKILL.md +79 -0
- package/resources/local/gsap-skills/skills/gsap-plugins/SKILL.md +433 -0
- package/resources/local/gsap-skills/skills/gsap-react/SKILL.md +136 -0
- package/resources/local/gsap-skills/skills/gsap-scrolltrigger/SKILL.md +296 -0
- package/resources/local/gsap-skills/skills/gsap-timeline/SKILL.md +107 -0
- package/resources/local/gsap-skills/skills/gsap-utils/SKILL.md +284 -0
- package/resources/local/gsap-skills/skills/llms.txt +39 -0
- package/resources/local/hermes-agent-core/AGENTS.md +1132 -0
- package/resources/local/hermes-agent-core/LICENSE +21 -0
- package/resources/local/hermes-agent-core/README.md +215 -0
- package/resources/local/hermes-agent-core/docs/2026-05-07-s6-overlay-dynamic-subagent-gateways.md +434 -0
- package/resources/local/hermes-agent-core/hermes-already-has-routines.md +160 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/DESCRIPTION.md +3 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/claude-code/SKILL.md +745 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/codex/SKILL.md +130 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/hermes-agent/SKILL.md +1021 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/kanban-codex-lane/SKILL.md +277 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/kanban-codex-lane/templates/pmb-codex-lane-prompt.md +57 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/opencode/SKILL.md +219 -0
- package/resources/local/hermes-agent-core/skills/github/DESCRIPTION.md +3 -0
- package/resources/local/hermes-agent-core/skills/github/codebase-inspection/SKILL.md +116 -0
- package/resources/local/hermes-agent-core/skills/github/github-auth/SKILL.md +247 -0
- package/resources/local/hermes-agent-core/skills/github/github-auth/scripts/gh-env.sh +66 -0
- package/resources/local/hermes-agent-core/skills/github/github-code-review/SKILL.md +481 -0
- package/resources/local/hermes-agent-core/skills/github/github-code-review/references/review-output-template.md +74 -0
- package/resources/local/hermes-agent-core/skills/github/github-issues/SKILL.md +370 -0
- package/resources/local/hermes-agent-core/skills/github/github-issues/templates/bug-report.md +35 -0
- package/resources/local/hermes-agent-core/skills/github/github-issues/templates/feature-request.md +31 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/SKILL.md +367 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/references/ci-troubleshooting.md +183 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/references/conventional-commits.md +71 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/templates/pr-body-bugfix.md +35 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/templates/pr-body-feature.md +33 -0
- package/resources/local/hermes-agent-core/skills/github/github-repo-management/SKILL.md +516 -0
- package/resources/local/hermes-agent-core/skills/github/github-repo-management/references/github-api-cheatsheet.md +161 -0
- package/resources/local/hermes-agent-core/skills/mcp/DESCRIPTION.md +3 -0
- package/resources/local/hermes-agent-core/skills/mcp/native-mcp/SKILL.md +357 -0
- package/resources/local/hermes-agent-core/skills/software-development/debugging-hermes-tui-commands/SKILL.md +152 -0
- package/resources/local/hermes-agent-core/skills/software-development/hermes-agent-skill-authoring/SKILL.md +165 -0
- package/resources/local/hermes-agent-core/skills/software-development/hermes-s6-container-supervision/SKILL.md +176 -0
- package/resources/local/hermes-agent-core/skills/software-development/node-inspect-debugger/SKILL.md +319 -0
- package/resources/local/hermes-agent-core/skills/software-development/plan/SKILL.md +58 -0
- package/resources/local/hermes-agent-core/skills/software-development/python-debugpy/SKILL.md +375 -0
- package/resources/local/hermes-agent-core/skills/software-development/requesting-code-review/SKILL.md +280 -0
- package/resources/local/hermes-agent-core/skills/software-development/spike/SKILL.md +197 -0
- package/resources/local/hermes-agent-core/skills/software-development/subagent-driven-development/SKILL.md +352 -0
- package/resources/local/hermes-agent-core/skills/software-development/subagent-driven-development/references/context-budget-discipline.md +53 -0
- package/resources/local/hermes-agent-core/skills/software-development/subagent-driven-development/references/gates-taxonomy.md +93 -0
- package/resources/local/hermes-agent-core/skills/software-development/systematic-debugging/SKILL.md +367 -0
- package/resources/local/hermes-agent-core/skills/software-development/test-driven-development/SKILL.md +343 -0
- package/resources/local/hermes-agent-core/skills/software-development/writing-plans/SKILL.md +297 -0
- package/resources/local/manifest.json +12 -0
- package/rule.md +2 -0
- package/scripts/audit-pack.js +5 -0
- package/scripts/smoke-browser.js +53 -0
- package/scripts/smoke-package.js +38 -4
- package/skill.md +36 -4
- package/skills/gsap.md +26 -0
- package/skills/hermes-agent.md +17 -0
- package/src/agent/agent-definitions.js +4 -4
- package/src/agent/runtime.js +179 -5
- package/src/agent/subagent-child.js +44 -0
- package/src/ai/capability-scorecard.js +193 -14
- package/src/ai/hermes-core.js +77 -0
- package/src/ai/model-capabilities.js +42 -2
- package/src/ai/prompts/system-prompt.js +18 -2
- package/src/ai/small-model-amplifier.js +35 -7
- package/src/ai/workflow-selector.js +22 -1
- package/src/cli/commands.js +46 -2
- package/src/cli/config.js +45 -6
- package/src/cli/context-loader.js +253 -9
- package/src/cli/conversation-format.js +5 -0
- package/src/cli/input-controller.js +79 -10
- package/src/cli/prompt-builder.js +47 -8
- package/src/cli/repl-commands.js +115 -0
- package/src/cli/repl.js +343 -85
- package/src/cli/slash-commands.js +4 -2
- package/src/cli/tui.js +133 -37
- package/src/mcp/client.js +54 -11
- package/src/mcp/presets.js +114 -0
- package/src/tools/agent.js +316 -25
- package/src/tools/executor.js +412 -12
- package/src/tools/permission.js +20 -17
- package/winter.d.ts +112 -10
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: github-auth
|
|
3
|
+
description: "GitHub auth setup: HTTPS tokens, SSH keys, gh CLI login."
|
|
4
|
+
version: 1.1.0
|
|
5
|
+
author: Hermes Agent
|
|
6
|
+
license: MIT
|
|
7
|
+
platforms: [linux, macos, windows]
|
|
8
|
+
metadata:
|
|
9
|
+
hermes:
|
|
10
|
+
tags: [GitHub, Authentication, Git, gh-cli, SSH, Setup]
|
|
11
|
+
related_skills: [github-pr-workflow, github-code-review, github-issues, github-repo-management]
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# GitHub Authentication Setup
|
|
15
|
+
|
|
16
|
+
This skill sets up authentication so the agent can work with GitHub repositories, PRs, issues, and CI. It covers two paths:
|
|
17
|
+
|
|
18
|
+
- **`git` (always available)** — uses HTTPS personal access tokens or SSH keys
|
|
19
|
+
- **`gh` CLI (if installed)** — richer GitHub API access with a simpler auth flow
|
|
20
|
+
|
|
21
|
+
## Detection Flow
|
|
22
|
+
|
|
23
|
+
When a user asks you to work with GitHub, run this check first:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Check what's available
|
|
27
|
+
git --version
|
|
28
|
+
gh --version 2>/dev/null || echo "gh not installed"
|
|
29
|
+
|
|
30
|
+
# Check if already authenticated
|
|
31
|
+
gh auth status 2>/dev/null || echo "gh not authenticated"
|
|
32
|
+
git config --global credential.helper 2>/dev/null || echo "no git credential helper"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Decision tree:**
|
|
36
|
+
1. If `gh auth status` shows authenticated → you're good, use `gh` for everything
|
|
37
|
+
2. If `gh` is installed but not authenticated → use "gh auth" method below
|
|
38
|
+
3. If `gh` is not installed → use "git-only" method below (no sudo needed)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Method 1: Git-Only Authentication (No gh, No sudo)
|
|
43
|
+
|
|
44
|
+
This works on any machine with `git` installed. No root access needed.
|
|
45
|
+
|
|
46
|
+
### Option A: HTTPS with Personal Access Token (Recommended)
|
|
47
|
+
|
|
48
|
+
This is the most portable method — works everywhere, no SSH config needed.
|
|
49
|
+
|
|
50
|
+
**Step 1: Create a personal access token**
|
|
51
|
+
|
|
52
|
+
Tell the user to go to: **https://github.com/settings/tokens**
|
|
53
|
+
|
|
54
|
+
- Click "Generate new token (classic)"
|
|
55
|
+
- Give it a name like "hermes-agent"
|
|
56
|
+
- Select scopes:
|
|
57
|
+
- `repo` (full repository access — read, write, push, PRs)
|
|
58
|
+
- `workflow` (trigger and manage GitHub Actions)
|
|
59
|
+
- `read:org` (if working with organization repos)
|
|
60
|
+
- Set expiration (90 days is a good default)
|
|
61
|
+
- Copy the token — it won't be shown again
|
|
62
|
+
|
|
63
|
+
**Step 2: Configure git to store the token**
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Set up the credential helper to cache credentials
|
|
67
|
+
# "store" saves to ~/.git-credentials in plaintext (simple, persistent)
|
|
68
|
+
git config --global credential.helper store
|
|
69
|
+
|
|
70
|
+
# Now do a test operation that triggers auth — git will prompt for credentials
|
|
71
|
+
# Username: <their-github-username>
|
|
72
|
+
# Password: <paste the personal access token, NOT their GitHub password>
|
|
73
|
+
git ls-remote https://github.com/<their-username>/<any-repo>.git
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
After entering credentials once, they're saved and reused for all future operations.
|
|
77
|
+
|
|
78
|
+
**Alternative: cache helper (credentials expire from memory)**
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Cache in memory for 8 hours (28800 seconds) instead of saving to disk
|
|
82
|
+
git config --global credential.helper 'cache --timeout=28800'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Alternative: set the token directly in the remote URL (per-repo)**
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Embed token in the remote URL (avoids credential prompts entirely)
|
|
89
|
+
git remote set-url origin https://<username>:<token>@github.com/<owner>/<repo>.git
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Step 3: Configure git identity**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Required for commits — set name and email
|
|
96
|
+
git config --global user.name "Their Name"
|
|
97
|
+
git config --global user.email "their-email@example.com"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Step 4: Verify**
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Test push access (this should work without any prompts now)
|
|
104
|
+
git ls-remote https://github.com/<their-username>/<any-repo>.git
|
|
105
|
+
|
|
106
|
+
# Verify identity
|
|
107
|
+
git config --global user.name
|
|
108
|
+
git config --global user.email
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Option B: SSH Key Authentication
|
|
112
|
+
|
|
113
|
+
Good for users who prefer SSH or already have keys set up.
|
|
114
|
+
|
|
115
|
+
**Step 1: Check for existing SSH keys**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ls -la ~/.ssh/id_*.pub 2>/dev/null || echo "No SSH keys found"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Step 2: Generate a key if needed**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Generate an ed25519 key (modern, secure, fast)
|
|
125
|
+
ssh-keygen -t ed25519 -C "their-email@example.com" -f ~/.ssh/id_ed25519 -N ""
|
|
126
|
+
|
|
127
|
+
# Display the public key for them to add to GitHub
|
|
128
|
+
cat ~/.ssh/id_ed25519.pub
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Tell the user to add the public key at: **https://github.com/settings/keys**
|
|
132
|
+
- Click "New SSH key"
|
|
133
|
+
- Paste the public key content
|
|
134
|
+
- Give it a title like "hermes-agent-<machine-name>"
|
|
135
|
+
|
|
136
|
+
**Step 3: Test the connection**
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
ssh -T git@github.com
|
|
140
|
+
# Expected: "Hi <username>! You've successfully authenticated..."
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Step 4: Configure git to use SSH for GitHub**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Rewrite HTTPS GitHub URLs to SSH automatically
|
|
147
|
+
git config --global url."git@github.com:".insteadOf "https://github.com/"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Step 5: Configure git identity**
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
git config --global user.name "Their Name"
|
|
154
|
+
git config --global user.email "their-email@example.com"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Method 2: gh CLI Authentication
|
|
160
|
+
|
|
161
|
+
If `gh` is installed, it handles both API access and git credentials in one step.
|
|
162
|
+
|
|
163
|
+
### Interactive Browser Login (Desktop)
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
gh auth login
|
|
167
|
+
# Select: GitHub.com
|
|
168
|
+
# Select: HTTPS
|
|
169
|
+
# Authenticate via browser
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Token-Based Login (Headless / SSH Servers)
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
echo "<THEIR_TOKEN>" | gh auth login --with-token
|
|
176
|
+
|
|
177
|
+
# Set up git credentials through gh
|
|
178
|
+
gh auth setup-git
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Verify
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
gh auth status
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Using the GitHub API Without gh
|
|
190
|
+
|
|
191
|
+
When `gh` is not available, you can still access the full GitHub API using `curl` with a personal access token. This is how the other GitHub skills implement their fallbacks.
|
|
192
|
+
|
|
193
|
+
### Setting the Token for API Calls
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Option 1: Export as env var (preferred — keeps it out of commands)
|
|
197
|
+
export GITHUB_TOKEN="<token>"
|
|
198
|
+
|
|
199
|
+
# Then use in curl calls:
|
|
200
|
+
curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
|
201
|
+
https://api.github.com/user
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Extracting the Token from Git Credentials
|
|
205
|
+
|
|
206
|
+
If git credentials are already configured (via credential.helper store), the token can be extracted:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Read from git credential store
|
|
210
|
+
grep "github.com" ~/.git-credentials 2>/dev/null | head -1 | sed 's|https://[^:]*:\([^@]*\)@.*|\1|'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Helper: Detect Auth Method
|
|
214
|
+
|
|
215
|
+
Use this pattern at the start of any GitHub workflow:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Try gh first, fall back to git + curl
|
|
219
|
+
if command -v gh &>/dev/null && gh auth status &>/dev/null; then
|
|
220
|
+
echo "AUTH_METHOD=gh"
|
|
221
|
+
elif [ -n "$GITHUB_TOKEN" ]; then
|
|
222
|
+
echo "AUTH_METHOD=curl"
|
|
223
|
+
elif [ -f ~/.hermes/.env ] && grep -q "^GITHUB_TOKEN=" ~/.hermes/.env; then
|
|
224
|
+
export GITHUB_TOKEN=$(grep "^GITHUB_TOKEN=" ~/.hermes/.env | head -1 | cut -d= -f2 | tr -d '\n\r')
|
|
225
|
+
echo "AUTH_METHOD=curl"
|
|
226
|
+
elif grep -q "github.com" ~/.git-credentials 2>/dev/null; then
|
|
227
|
+
export GITHUB_TOKEN=$(grep "github.com" ~/.git-credentials | head -1 | sed 's|https://[^:]*:\([^@]*\)@.*|\1|')
|
|
228
|
+
echo "AUTH_METHOD=curl"
|
|
229
|
+
else
|
|
230
|
+
echo "AUTH_METHOD=none"
|
|
231
|
+
echo "Need to set up authentication first"
|
|
232
|
+
fi
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Troubleshooting
|
|
238
|
+
|
|
239
|
+
| Problem | Solution |
|
|
240
|
+
|---------|----------|
|
|
241
|
+
| `git push` asks for password | GitHub disabled password auth. Use a personal access token as the password, or switch to SSH |
|
|
242
|
+
| `remote: Permission to X denied` | Token may lack `repo` scope — regenerate with correct scopes |
|
|
243
|
+
| `fatal: Authentication failed` | Cached credentials may be stale — run `git credential reject` then re-authenticate |
|
|
244
|
+
| `ssh: connect to host github.com port 22: Connection refused` | Try SSH over HTTPS port: add `Host github.com` with `Port 443` and `Hostname ssh.github.com` to `~/.ssh/config` |
|
|
245
|
+
| Credentials not persisting | Check `git config --global credential.helper` — must be `store` or `cache` |
|
|
246
|
+
| Multiple GitHub accounts | Use SSH with different keys per host alias in `~/.ssh/config`, or per-repo credential URLs |
|
|
247
|
+
| `gh: command not found` + no sudo | Use git-only Method 1 above — no installation needed |
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# GitHub environment detection helper for Hermes Agent skills.
|
|
3
|
+
#
|
|
4
|
+
# Usage (via terminal tool):
|
|
5
|
+
# source skills/github/github-auth/scripts/gh-env.sh
|
|
6
|
+
#
|
|
7
|
+
# After sourcing, these variables are set:
|
|
8
|
+
# GH_AUTH_METHOD - "gh", "curl", or "none"
|
|
9
|
+
# GITHUB_TOKEN - personal access token (set if method is "curl")
|
|
10
|
+
# GH_USER - GitHub username
|
|
11
|
+
# GH_OWNER - repo owner (only if inside a git repo with a github remote)
|
|
12
|
+
# GH_REPO - repo name (only if inside a git repo with a github remote)
|
|
13
|
+
# GH_OWNER_REPO - owner/repo (only if inside a git repo with a github remote)
|
|
14
|
+
|
|
15
|
+
# --- Auth detection ---
|
|
16
|
+
|
|
17
|
+
GH_AUTH_METHOD="none"
|
|
18
|
+
GITHUB_TOKEN="${GITHUB_TOKEN:-}"
|
|
19
|
+
GH_USER=""
|
|
20
|
+
|
|
21
|
+
if command -v gh &>/dev/null && gh auth status &>/dev/null 2>&1; then
|
|
22
|
+
GH_AUTH_METHOD="gh"
|
|
23
|
+
GH_USER=$(gh api user --jq '.login' 2>/dev/null)
|
|
24
|
+
elif [ -n "$GITHUB_TOKEN" ]; then
|
|
25
|
+
GH_AUTH_METHOD="curl"
|
|
26
|
+
elif [ -f "$HOME/.hermes/.env" ] && grep -q "^GITHUB_TOKEN=" "$HOME/.hermes/.env" 2>/dev/null; then
|
|
27
|
+
GITHUB_TOKEN=$(grep "^GITHUB_TOKEN=" "$HOME/.hermes/.env" | head -1 | cut -d= -f2 | tr -d '\n\r')
|
|
28
|
+
if [ -n "$GITHUB_TOKEN" ]; then
|
|
29
|
+
GH_AUTH_METHOD="curl"
|
|
30
|
+
fi
|
|
31
|
+
elif [ -f "$HOME/.git-credentials" ] && grep -q "github.com" "$HOME/.git-credentials" 2>/dev/null; then
|
|
32
|
+
GITHUB_TOKEN=$(grep "github.com" "$HOME/.git-credentials" | head -1 | sed 's|https://[^:]*:\([^@]*\)@.*|\1|')
|
|
33
|
+
if [ -n "$GITHUB_TOKEN" ]; then
|
|
34
|
+
GH_AUTH_METHOD="curl"
|
|
35
|
+
fi
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Resolve username for curl method
|
|
39
|
+
if [ "$GH_AUTH_METHOD" = "curl" ] && [ -z "$GH_USER" ]; then
|
|
40
|
+
GH_USER=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
|
41
|
+
https://api.github.com/user 2>/dev/null \
|
|
42
|
+
| python3 -c "import sys,json; print(json.load(sys.stdin).get('login',''))" 2>/dev/null)
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# --- Repo detection (if inside a git repo with a GitHub remote) ---
|
|
46
|
+
|
|
47
|
+
GH_OWNER=""
|
|
48
|
+
GH_REPO=""
|
|
49
|
+
GH_OWNER_REPO=""
|
|
50
|
+
|
|
51
|
+
_remote_url=$(git remote get-url origin 2>/dev/null)
|
|
52
|
+
if [ -n "$_remote_url" ] && echo "$_remote_url" | grep -q "github.com"; then
|
|
53
|
+
GH_OWNER_REPO=$(echo "$_remote_url" | sed -E 's|.*github\.com[:/]||; s|\.git$||')
|
|
54
|
+
GH_OWNER=$(echo "$GH_OWNER_REPO" | cut -d/ -f1)
|
|
55
|
+
GH_REPO=$(echo "$GH_OWNER_REPO" | cut -d/ -f2)
|
|
56
|
+
fi
|
|
57
|
+
unset _remote_url
|
|
58
|
+
|
|
59
|
+
# --- Summary ---
|
|
60
|
+
|
|
61
|
+
echo "GitHub Auth: $GH_AUTH_METHOD"
|
|
62
|
+
[ -n "$GH_USER" ] && echo "User: $GH_USER"
|
|
63
|
+
[ -n "$GH_OWNER_REPO" ] && echo "Repo: $GH_OWNER_REPO"
|
|
64
|
+
[ "$GH_AUTH_METHOD" = "none" ] && echo "⚠ Not authenticated — see github-auth skill"
|
|
65
|
+
|
|
66
|
+
export GH_AUTH_METHOD GITHUB_TOKEN GH_USER GH_OWNER GH_REPO GH_OWNER_REPO
|