gh-load-pull-request 0.4.0 → 0.4.2
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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# gh-
|
|
1
|
+
# gh-load-pull-request
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/gh-load-pull-request)
|
|
4
4
|
|
|
5
5
|
Download GitHub pull request and convert it to markdown - perfect for AI review and analysis.
|
|
6
6
|
|
|
@@ -17,16 +17,16 @@ Download GitHub pull request and convert it to markdown - perfect for AI review
|
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
# Download a PR and display as markdown
|
|
20
|
-
gh-
|
|
20
|
+
gh-load-pull-request https://github.com/owner/repo/pull/123
|
|
21
21
|
|
|
22
22
|
# Using shorthand format
|
|
23
|
-
gh-
|
|
23
|
+
gh-load-pull-request owner/repo#123
|
|
24
24
|
|
|
25
25
|
# Save to file
|
|
26
|
-
gh-
|
|
26
|
+
gh-load-pull-request owner/repo#123 -o pr.md
|
|
27
27
|
|
|
28
28
|
# Download private PR (uses gh CLI auth automatically)
|
|
29
|
-
gh-
|
|
29
|
+
gh-load-pull-request owner/private-repo#456
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Installation
|
|
@@ -37,13 +37,13 @@ Install globally for system-wide access:
|
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
39
|
# Using bun
|
|
40
|
-
bun install -g gh-
|
|
40
|
+
bun install -g gh-load-pull-request
|
|
41
41
|
|
|
42
42
|
# Using npm
|
|
43
|
-
npm install -g gh-
|
|
43
|
+
npm install -g gh-load-pull-request
|
|
44
44
|
|
|
45
45
|
# After installation, use anywhere:
|
|
46
|
-
gh-
|
|
46
|
+
gh-load-pull-request --help
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
### Uninstall
|
|
@@ -52,33 +52,33 @@ Remove the global installation:
|
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
# Using bun
|
|
55
|
-
bun uninstall -g gh-
|
|
55
|
+
bun uninstall -g gh-load-pull-request
|
|
56
56
|
|
|
57
57
|
# Using npm
|
|
58
|
-
npm uninstall -g gh-
|
|
58
|
+
npm uninstall -g gh-load-pull-request
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### Local Installation
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
# Clone the repository
|
|
65
|
-
git clone https://github.com/link-foundation/gh-
|
|
66
|
-
cd gh-
|
|
65
|
+
git clone https://github.com/link-foundation/gh-load-pull-request.git
|
|
66
|
+
cd gh-load-pull-request
|
|
67
67
|
|
|
68
68
|
# Install dependencies
|
|
69
69
|
npm install
|
|
70
70
|
|
|
71
71
|
# Make the script executable
|
|
72
|
-
chmod +x gh-
|
|
72
|
+
chmod +x gh-load-pull-request.mjs
|
|
73
73
|
|
|
74
74
|
# Run it
|
|
75
|
-
./gh-
|
|
75
|
+
./gh-load-pull-request.mjs --help
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
## Usage
|
|
79
79
|
|
|
80
80
|
```
|
|
81
|
-
Usage: gh-
|
|
81
|
+
Usage: gh-load-pull-request <pr-url> [options]
|
|
82
82
|
|
|
83
83
|
Options:
|
|
84
84
|
-t, --token GitHub personal access token (optional for public PRs)
|
|
@@ -108,7 +108,7 @@ If you have [GitHub CLI](https://cli.github.com/) installed and authenticated, t
|
|
|
108
108
|
gh auth login
|
|
109
109
|
|
|
110
110
|
# Tool automatically detects and uses gh CLI authentication
|
|
111
|
-
gh-
|
|
111
|
+
gh-load-pull-request owner/private-repo#123
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
### 2. Environment Variable
|
|
@@ -117,7 +117,7 @@ Set the `GITHUB_TOKEN` environment variable:
|
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
119
|
export GITHUB_TOKEN=ghp_your_token_here
|
|
120
|
-
gh-
|
|
120
|
+
gh-load-pull-request owner/repo#123
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
### 3. Command Line Token
|
|
@@ -125,7 +125,7 @@ gh-download-pull-request owner/repo#123
|
|
|
125
125
|
Pass the token directly with `--token`:
|
|
126
126
|
|
|
127
127
|
```bash
|
|
128
|
-
gh-
|
|
128
|
+
gh-load-pull-request owner/repo#123 --token ghp_your_token_here
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
### Authentication Priority
|
|
@@ -154,22 +154,22 @@ The markdown output includes:
|
|
|
154
154
|
|
|
155
155
|
```bash
|
|
156
156
|
# Basic usage - download and display PR
|
|
157
|
-
gh-
|
|
157
|
+
gh-load-pull-request https://github.com/facebook/react/pull/28000
|
|
158
158
|
|
|
159
159
|
# Using shorthand format
|
|
160
|
-
gh-
|
|
160
|
+
gh-load-pull-request facebook/react#28000
|
|
161
161
|
|
|
162
162
|
# Save to file
|
|
163
|
-
gh-
|
|
163
|
+
gh-load-pull-request facebook/react#28000 -o react-pr-28000.md
|
|
164
164
|
|
|
165
165
|
# Download private PR using gh CLI auth
|
|
166
|
-
gh-
|
|
166
|
+
gh-load-pull-request myorg/private-repo#42
|
|
167
167
|
|
|
168
168
|
# Download with explicit token
|
|
169
|
-
gh-
|
|
169
|
+
gh-load-pull-request myorg/repo#123 --token ghp_your_token_here
|
|
170
170
|
|
|
171
171
|
# Pipe to other tools (e.g., AI for review)
|
|
172
|
-
gh-
|
|
172
|
+
gh-load-pull-request owner/repo#123 | claude-analyze
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
## Requirements
|
|
@@ -202,17 +202,17 @@ node tests/cli.test.mjs
|
|
|
202
202
|
|
|
203
203
|
```bash
|
|
204
204
|
# Clone the repository
|
|
205
|
-
git clone https://github.com/link-foundation/gh-
|
|
206
|
-
cd gh-
|
|
205
|
+
git clone https://github.com/link-foundation/gh-load-pull-request.git
|
|
206
|
+
cd gh-load-pull-request
|
|
207
207
|
|
|
208
208
|
# Install dependencies
|
|
209
209
|
npm install
|
|
210
210
|
|
|
211
211
|
# Make executable
|
|
212
|
-
chmod +x gh-
|
|
212
|
+
chmod +x gh-load-pull-request.mjs
|
|
213
213
|
|
|
214
214
|
# Test locally
|
|
215
|
-
./gh-
|
|
215
|
+
./gh-load-pull-request.mjs owner/repo#123
|
|
216
216
|
|
|
217
217
|
# Run tests
|
|
218
218
|
npm test
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gh-load-pull-request",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Download GitHub pull request and convert it to markdown",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "src/gh-
|
|
6
|
+
"main": "src/gh-load-pull-request.mjs",
|
|
7
7
|
"bin": {
|
|
8
|
-
"gh-
|
|
8
|
+
"gh-load-pull-request": "./src/gh-load-pull-request.mjs"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "node --test tests/",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"license": "Unlicense",
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
|
-
"url": "git+https://github.com/link-foundation/gh-
|
|
40
|
+
"url": "git+https://github.com/link-foundation/gh-load-pull-request.git"
|
|
41
41
|
},
|
|
42
42
|
"bugs": {
|
|
43
|
-
"url": "https://github.com/link-foundation/gh-
|
|
43
|
+
"url": "https://github.com/link-foundation/gh-load-pull-request/issues"
|
|
44
44
|
},
|
|
45
|
-
"homepage": "https://github.com/link-foundation/gh-
|
|
45
|
+
"homepage": "https://github.com/link-foundation/gh-load-pull-request#readme",
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=20.0.0"
|
|
48
48
|
},
|
|
@@ -240,7 +240,7 @@ function downloadFile(url, token, maxRedirects = 5) {
|
|
|
240
240
|
const protocol = parsedUrl.protocol === 'https:' ? https : http;
|
|
241
241
|
|
|
242
242
|
const headers = {
|
|
243
|
-
'User-Agent': 'gh-
|
|
243
|
+
'User-Agent': 'gh-load-pull-request',
|
|
244
244
|
};
|
|
245
245
|
|
|
246
246
|
// Add auth for GitHub URLs
|
|
@@ -821,6 +821,17 @@ async function main() {
|
|
|
821
821
|
// Set verbose mode
|
|
822
822
|
verboseMode = verbose;
|
|
823
823
|
|
|
824
|
+
// Parse PR input first (before potentially slow gh CLI token fetch)
|
|
825
|
+
const prInfo = parsePrUrl(prInput);
|
|
826
|
+
if (!prInfo) {
|
|
827
|
+
log('red', `❌ Invalid PR URL or format: ${prInput}`);
|
|
828
|
+
log('yellow', '💡 Supported formats:');
|
|
829
|
+
log('yellow', ' - https://github.com/owner/repo/pull/123');
|
|
830
|
+
log('yellow', ' - owner/repo#123');
|
|
831
|
+
log('yellow', ' - owner/repo/123');
|
|
832
|
+
process.exit(1);
|
|
833
|
+
}
|
|
834
|
+
|
|
824
835
|
let token = tokenArg;
|
|
825
836
|
|
|
826
837
|
// If no token provided, try to get it from gh CLI
|
|
@@ -832,17 +843,6 @@ async function main() {
|
|
|
832
843
|
}
|
|
833
844
|
}
|
|
834
845
|
|
|
835
|
-
// Parse PR input
|
|
836
|
-
const prInfo = parsePrUrl(prInput);
|
|
837
|
-
if (!prInfo) {
|
|
838
|
-
log('red', `❌ Invalid PR URL or format: ${prInput}`);
|
|
839
|
-
log('yellow', '💡 Supported formats:');
|
|
840
|
-
log('yellow', ' - https://github.com/owner/repo/pull/123');
|
|
841
|
-
log('yellow', ' - owner/repo#123');
|
|
842
|
-
log('yellow', ' - owner/repo/123');
|
|
843
|
-
process.exit(1);
|
|
844
|
-
}
|
|
845
|
-
|
|
846
846
|
const { owner, repo, prNumber } = prInfo;
|
|
847
847
|
|
|
848
848
|
// Fetch PR data
|
package/src/version.mjs
CHANGED
|
@@ -24,7 +24,7 @@ function updatePackageJson(newVersion) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function updateMainScript(newVersion) {
|
|
27
|
-
const scriptPath = path.join(__dirname, 'gh-
|
|
27
|
+
const scriptPath = path.join(__dirname, 'gh-load-pull-request.mjs');
|
|
28
28
|
const content = fs.readFileSync(scriptPath, 'utf8');
|
|
29
29
|
const updatedContent = content.replace(
|
|
30
30
|
/let version = '[^']+'/,
|
|
@@ -82,7 +82,7 @@ function main() {
|
|
|
82
82
|
|
|
83
83
|
console.log('✅ Version updated successfully!');
|
|
84
84
|
console.log(` 📄 package.json: ${newVersion}`);
|
|
85
|
-
console.log(` 📄 gh-
|
|
85
|
+
console.log(` 📄 gh-load-pull-request.mjs: ${newVersion}`);
|
|
86
86
|
console.log('');
|
|
87
87
|
|
|
88
88
|
// Automatically commit and push changes
|