gh-load-pull-request 0.4.0 → 0.5.0

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-download-pull-request
1
+ # gh-load-pull-request
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/gh-download-pull-request)](https://www.npmjs.com/package/gh-download-pull-request)
3
+ [![npm version](https://img.shields.io/npm/v/gh-load-pull-request)](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-download-pull-request https://github.com/owner/repo/pull/123
20
+ gh-load-pull-request https://github.com/owner/repo/pull/123
21
21
 
22
22
  # Using shorthand format
23
- gh-download-pull-request owner/repo#123
23
+ gh-load-pull-request owner/repo#123
24
24
 
25
25
  # Save to file
26
- gh-download-pull-request owner/repo#123 -o pr.md
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-download-pull-request owner/private-repo#456
29
+ gh-load-pull-request owner/private-repo#456
30
30
  ```
31
31
 
32
32
  ## Installation
@@ -36,14 +36,10 @@ gh-download-pull-request owner/private-repo#456
36
36
  Install globally for system-wide access:
37
37
 
38
38
  ```bash
39
- # Using bun
40
- bun install -g gh-download-pull-request
41
-
42
- # Using npm
43
- npm install -g gh-download-pull-request
39
+ bun install -g gh-load-pull-request
44
40
 
45
41
  # After installation, use anywhere:
46
- gh-download-pull-request --help
42
+ gh-load-pull-request --help
47
43
  ```
48
44
 
49
45
  ### Uninstall
@@ -51,34 +47,30 @@ gh-download-pull-request --help
51
47
  Remove the global installation:
52
48
 
53
49
  ```bash
54
- # Using bun
55
- bun uninstall -g gh-download-pull-request
56
-
57
- # Using npm
58
- npm uninstall -g gh-download-pull-request
50
+ bun uninstall -g gh-load-pull-request
59
51
  ```
60
52
 
61
53
  ### Local Installation
62
54
 
63
55
  ```bash
64
56
  # Clone the repository
65
- git clone https://github.com/link-foundation/gh-download-pull-request.git
66
- cd gh-download-pull-request
57
+ git clone https://github.com/link-foundation/gh-load-pull-request.git
58
+ cd gh-load-pull-request
67
59
 
68
60
  # Install dependencies
69
- npm install
61
+ bun install
70
62
 
71
63
  # Make the script executable
72
- chmod +x gh-download-pull-request.mjs
64
+ chmod +x gh-load-pull-request.mjs
73
65
 
74
66
  # Run it
75
- ./gh-download-pull-request.mjs --help
67
+ ./gh-load-pull-request.mjs --help
76
68
  ```
77
69
 
78
70
  ## Usage
79
71
 
80
72
  ```
81
- Usage: gh-download-pull-request <pr-url> [options]
73
+ Usage: gh-load-pull-request <pr-url> [options]
82
74
 
83
75
  Options:
84
76
  -t, --token GitHub personal access token (optional for public PRs)
@@ -108,7 +100,7 @@ If you have [GitHub CLI](https://cli.github.com/) installed and authenticated, t
108
100
  gh auth login
109
101
 
110
102
  # Tool automatically detects and uses gh CLI authentication
111
- gh-download-pull-request owner/private-repo#123
103
+ gh-load-pull-request owner/private-repo#123
112
104
  ```
113
105
 
114
106
  ### 2. Environment Variable
@@ -117,7 +109,7 @@ Set the `GITHUB_TOKEN` environment variable:
117
109
 
118
110
  ```bash
119
111
  export GITHUB_TOKEN=ghp_your_token_here
120
- gh-download-pull-request owner/repo#123
112
+ gh-load-pull-request owner/repo#123
121
113
  ```
122
114
 
123
115
  ### 3. Command Line Token
@@ -125,7 +117,7 @@ gh-download-pull-request owner/repo#123
125
117
  Pass the token directly with `--token`:
126
118
 
127
119
  ```bash
128
- gh-download-pull-request owner/repo#123 --token ghp_your_token_here
120
+ gh-load-pull-request owner/repo#123 --token ghp_your_token_here
129
121
  ```
130
122
 
131
123
  ### Authentication Priority
@@ -154,27 +146,27 @@ The markdown output includes:
154
146
 
155
147
  ```bash
156
148
  # Basic usage - download and display PR
157
- gh-download-pull-request https://github.com/facebook/react/pull/28000
149
+ gh-load-pull-request https://github.com/facebook/react/pull/28000
158
150
 
159
151
  # Using shorthand format
160
- gh-download-pull-request facebook/react#28000
152
+ gh-load-pull-request facebook/react#28000
161
153
 
162
154
  # Save to file
163
- gh-download-pull-request facebook/react#28000 -o react-pr-28000.md
155
+ gh-load-pull-request facebook/react#28000 -o react-pr-28000.md
164
156
 
165
157
  # Download private PR using gh CLI auth
166
- gh-download-pull-request myorg/private-repo#42
158
+ gh-load-pull-request myorg/private-repo#42
167
159
 
168
160
  # Download with explicit token
169
- gh-download-pull-request myorg/repo#123 --token ghp_your_token_here
161
+ gh-load-pull-request myorg/repo#123 --token ghp_your_token_here
170
162
 
171
163
  # Pipe to other tools (e.g., AI for review)
172
- gh-download-pull-request owner/repo#123 | claude-analyze
164
+ gh-load-pull-request owner/repo#123 | claude-analyze
173
165
  ```
174
166
 
175
167
  ## Requirements
176
168
 
177
- - [Bun](https://bun.sh/) (>=1.2.0) or [Node.js](https://nodejs.org/) (>=22.17.0) runtime
169
+ - [Bun](https://bun.sh/) (>=1.2.0) runtime
178
170
  - For private repositories (optional):
179
171
  - [GitHub CLI](https://cli.github.com/) (recommended) OR
180
172
  - GitHub personal access token (via `--token` or `GITHUB_TOKEN` env var)
@@ -191,34 +183,30 @@ gh-download-pull-request owner/repo#123 | claude-analyze
191
183
 
192
184
  ```bash
193
185
  # Run all tests
194
- npm test
195
-
196
- # Or run test files directly
197
- node tests/all.test.mjs
198
- node tests/cli.test.mjs
186
+ bun test
199
187
  ```
200
188
 
201
189
  ## Development
202
190
 
203
191
  ```bash
204
192
  # Clone the repository
205
- git clone https://github.com/link-foundation/gh-download-pull-request.git
206
- cd gh-download-pull-request
193
+ git clone https://github.com/link-foundation/gh-load-pull-request.git
194
+ cd gh-load-pull-request
207
195
 
208
196
  # Install dependencies
209
- npm install
197
+ bun install
210
198
 
211
199
  # Make executable
212
- chmod +x gh-download-pull-request.mjs
200
+ chmod +x gh-load-pull-request.mjs
213
201
 
214
202
  # Test locally
215
- ./gh-download-pull-request.mjs owner/repo#123
203
+ ./gh-load-pull-request.mjs owner/repo#123
216
204
 
217
205
  # Run tests
218
- npm test
206
+ bun test
219
207
 
220
208
  # Run linting
221
- npm run lint
209
+ bun run lint
222
210
 
223
211
  # Bump version
224
212
  ./version.mjs patch # or minor, major
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "gh-load-pull-request",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Download GitHub pull request and convert it to markdown",
5
5
  "type": "module",
6
- "main": "src/gh-download-pull-request.mjs",
6
+ "main": "src/gh-load-pull-request.mjs",
7
7
  "bin": {
8
- "gh-download-pull-request": "./src/gh-download-pull-request.mjs"
8
+ "gh-load-pull-request": "./src/gh-load-pull-request.mjs"
9
9
  },
10
10
  "scripts": {
11
11
  "test": "node --test tests/",
@@ -37,14 +37,14 @@
37
37
  "license": "Unlicense",
38
38
  "repository": {
39
39
  "type": "git",
40
- "url": "git+https://github.com/link-foundation/gh-download-pull-request.git"
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-download-pull-request/issues"
43
+ "url": "https://github.com/link-foundation/gh-load-pull-request/issues"
44
44
  },
45
- "homepage": "https://github.com/link-foundation/gh-download-pull-request#readme",
45
+ "homepage": "https://github.com/link-foundation/gh-load-pull-request#readme",
46
46
  "engines": {
47
- "node": ">=20.0.0"
47
+ "bun": ">=1.2.0"
48
48
  },
49
49
  "files": [
50
50
  "src/",
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env sh
2
- ':'; // # ; exec "$(command -v bun || command -v node)" "$0" "$@"
1
+ #!/usr/bin/env bun
3
2
 
4
3
  // Import built-in Node.js modules
5
4
  import path from 'node:path';
@@ -240,7 +239,7 @@ function downloadFile(url, token, maxRedirects = 5) {
240
239
  const protocol = parsedUrl.protocol === 'https:' ? https : http;
241
240
 
242
241
  const headers = {
243
- 'User-Agent': 'gh-download-pull-request',
242
+ 'User-Agent': 'gh-load-pull-request',
244
243
  };
245
244
 
246
245
  // Add auth for GitHub URLs
@@ -821,6 +820,17 @@ async function main() {
821
820
  // Set verbose mode
822
821
  verboseMode = verbose;
823
822
 
823
+ // Parse PR input first (before potentially slow gh CLI token fetch)
824
+ const prInfo = parsePrUrl(prInput);
825
+ if (!prInfo) {
826
+ log('red', `❌ Invalid PR URL or format: ${prInput}`);
827
+ log('yellow', '💡 Supported formats:');
828
+ log('yellow', ' - https://github.com/owner/repo/pull/123');
829
+ log('yellow', ' - owner/repo#123');
830
+ log('yellow', ' - owner/repo/123');
831
+ process.exit(1);
832
+ }
833
+
824
834
  let token = tokenArg;
825
835
 
826
836
  // If no token provided, try to get it from gh CLI
@@ -832,17 +842,6 @@ async function main() {
832
842
  }
833
843
  }
834
844
 
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
845
  const { owner, repo, prNumber } = prInfo;
847
846
 
848
847
  // Fetch PR data
package/src/version.mjs CHANGED
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env sh
2
- ':'; // # ; exec "$(command -v bun || command -v node)" "$0" "$@"
1
+ #!/usr/bin/env bun
3
2
 
4
3
  import fs from 'node:fs';
5
4
  import path from 'node:path';
@@ -24,7 +23,7 @@ function updatePackageJson(newVersion) {
24
23
  }
25
24
 
26
25
  function updateMainScript(newVersion) {
27
- const scriptPath = path.join(__dirname, 'gh-download-pull-request.mjs');
26
+ const scriptPath = path.join(__dirname, 'gh-load-pull-request.mjs');
28
27
  const content = fs.readFileSync(scriptPath, 'utf8');
29
28
  const updatedContent = content.replace(
30
29
  /let version = '[^']+'/,
@@ -82,7 +81,7 @@ function main() {
82
81
 
83
82
  console.log('✅ Version updated successfully!');
84
83
  console.log(` 📄 package.json: ${newVersion}`);
85
- console.log(` 📄 gh-download-pull-request.mjs: ${newVersion}`);
84
+ console.log(` 📄 gh-load-pull-request.mjs: ${newVersion}`);
86
85
  console.log('');
87
86
 
88
87
  // Automatically commit and push changes