@@ -19,13 +19,17 @@ Use this skill when the user:
1919## How to use this skill
2020
21211 . ** Check prerequisites** — Verify ` GEMINI_API_KEY ` is set
22- 2 . ** Get the PR/Issue URL** — Ask user if not provided
23- 3 . ** Formulate a question** — Convert user's request into a specific question
24- 4 . ** Run the review command** — Execute ` npx asyncreview review --url <URL> -q "<question>" `
25- 5 . ** Present the results** — Share the AI's findings with sources
22+ 2 . ** Check if repo is private** — Use ` gh repo view ` to determine if ` GITHUB_TOKEN ` is required
23+ 3 . ** Set GITHUB_TOKEN if needed** — Use ` gh auth token ` for private repos
24+ 4 . ** Get the PR/Issue URL** — Ask user if not provided
25+ 5 . ** Formulate a question** — Convert user's request into a specific question
26+ 6 . ** Run the review command** — Execute ` npx asyncreview review --url <URL> -q "<question>" `
27+ 7 . ** Present the results** — Share the AI's findings with sources
2628
2729## Prerequisites
2830
31+ ### 1. Check for ` GEMINI_API_KEY ` (Required)
32+
2933** Before running any command, check for ` GEMINI_API_KEY ` :**
3034
3135``` bash
@@ -40,6 +44,103 @@ Then set it:
4044export GEMINI_API_KEY=" user-provided-key"
4145```
4246
47+ ### 2. Check if Repository is Private (Critical)
48+
49+ ** IMPORTANT:** Before reviewing a PR/Issue, you MUST check if the repository is private. If it is, ` GITHUB_TOKEN ` is ** REQUIRED** .
50+
51+ #### Step 1: Extract owner and repo from URL
52+
53+ From a URL like ` https://github.com/owner/repo/pull/123 ` , extract:
54+ - owner: ` owner `
55+ - repo: ` repo `
56+
57+ #### Step 2: Check repository visibility
58+
59+ ** Option A: Using GitHub CLI (if available)**
60+
61+ ``` bash
62+ gh repo view owner/repo --json isPrivate -q ' .isPrivate'
63+ ```
64+
65+ ** Option B: Without GitHub CLI (using curl)**
66+
67+ ``` bash
68+ # Try to access the repo via GitHub API without authentication
69+ curl -s -o /dev/null -w " %{http_code}" https://api.github.com/repos/owner/repo
70+ ```
71+
72+ ** Possible outcomes:**
73+ - ** With ` gh ` :**
74+ - ` true ` → Repository is ** private** , ` GITHUB_TOKEN ` is ** REQUIRED**
75+ - ` false ` → Repository is ** public** , ` GITHUB_TOKEN ` is ** optional**
76+ - Error (e.g., "not found") → May indicate private repo without auth, or repo doesn't exist
77+
78+ - ** With ` curl ` :**
79+ - ` 200 ` → Repository is ** public** , ` GITHUB_TOKEN ` is ** optional** (but recommended for higher rate limits)
80+ - ` 404 ` → Repository is ** private** or doesn't exist, ` GITHUB_TOKEN ` is ** REQUIRED**
81+ - ` 403 ` → Rate limited, need ` GITHUB_TOKEN `
82+
83+ #### Step 3: If private, ensure ` GITHUB_TOKEN ` is set
84+
85+ ``` bash
86+ # Check if GITHUB_TOKEN is already set
87+ echo $GITHUB_TOKEN
88+ ```
89+
90+ If empty or not set, obtain it using one of these methods:
91+
92+ ** Option A: Using GitHub CLI (if available)**
93+
94+ ``` bash
95+ # Get token from GitHub CLI (must be authenticated with `gh auth login` first)
96+ export GITHUB_TOKEN=$( gh auth token)
97+
98+ # Verify it's set
99+ echo $GITHUB_TOKEN
100+ ```
101+
102+ If ` gh auth token ` fails, authenticate first:
103+
104+ ``` bash
105+ gh auth login
106+ ```
107+
108+ ** Option B: Without GitHub CLI (create token via web)**
109+
110+ 1 . Go to GitHub: https://github.com/settings/tokens
111+ 2 . Click ** "Generate new token"** → ** "Generate new token (classic)"**
112+ 3 . Give it a descriptive name (e.g., "AsyncReview CLI")
113+ 4 . Select scopes:
114+ - ✅ ` repo ` (Full control of private repositories)
115+ 5 . Click ** "Generate token"**
116+ 6 . Copy the token (you won't see it again!)
117+ 7 . Set it in your terminal:
118+
119+ ``` bash
120+ export GITHUB_TOKEN=" ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
121+
122+ # Verify it's set
123+ echo $GITHUB_TOKEN
124+ ```
125+
126+ ** Security tip:** For better security, consider creating a fine-grained token with minimal permissions:
127+ - Go to: https://github.com/settings/personal-access-tokens/new
128+ - Select specific repositories
129+ - Grant only "Contents" read permission
130+
131+ ** Then run the review with the token:**
132+
133+ ``` bash
134+ npx asyncreview review --url < URL> -q " question" --github-token $GITHUB_TOKEN
135+ ```
136+
137+ Or set it as an environment variable for the session:
138+
139+ ``` bash
140+ export GITHUB_TOKEN=$( gh auth token)
141+ npx asyncreview review --url < URL> -q " question"
142+ ```
143+
43144## Quick start
44145
45146``` bash
@@ -105,6 +206,50 @@ The AI will:
1052063 . Analyze content in the Python sandbox
1062074 . Report findings with evidence
107208
209+ ## Example: Review a Private Repository PR
210+
211+ ** Complete workflow for private repositories:**
212+
213+ ``` bash
214+ # Step 1: Extract owner/repo from URL
215+ # URL: https://github.com/myorg/private-repo/pull/42
216+ # owner="myorg", repo="private-repo"
217+
218+ # Step 2: Check if repository is private
219+
220+ # # Option A: With GitHub CLI
221+ gh repo view myorg/private-repo --json isPrivate -q ' .isPrivate'
222+ # Output: true (it's private!)
223+
224+ # # Option B: Without GitHub CLI (using curl)
225+ curl -s -o /dev/null -w " %{http_code}" https://api.github.com/repos/myorg/private-repo
226+ # Output: 404 (likely private or doesn't exist)
227+
228+ # Step 3: Ensure GITHUB_TOKEN is set
229+ echo $GITHUB_TOKEN
230+
231+ # # If empty, Option A: Get from GitHub CLI
232+ export GITHUB_TOKEN=$( gh auth token)
233+
234+ # # If empty, Option B: Create via web (https://github.com/settings/tokens)
235+ # # Then:
236+ export GITHUB_TOKEN=" ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
237+
238+ # Step 4: Run the review with the token
239+ npx asyncreview review \
240+ --url https://github.com/myorg/private-repo/pull/42 \
241+ -q " Does this PR introduce any security vulnerabilities?" \
242+ --github-token $GITHUB_TOKEN
243+
244+ # Alternative: Token is already in environment, no flag needed
245+ npx asyncreview review \
246+ --url https://github.com/myorg/private-repo/pull/42 \
247+ -q " Does this PR introduce any security vulnerabilities?"
248+ ```
249+
250+ ** If you get a 404 or authentication error:** The repository is likely private, and you need to provide ` GITHUB_TOKEN ` .
251+
252+
108253## Output formats
109254
110255| Format | Flag | Description |
0 commit comments