@bragduck/cli 1.0.3 โ†’ 2.0.1

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,15 +1,15 @@
1
1
  # Bragduck CLI
2
2
 
3
- > Transform your git commits into polished achievements with AI-powered refinement
3
+ > Transform your GitHub Pull Requests into polished achievements with AI-powered refinement
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/@bragduck%2Fcli.svg)](https://www.npmjs.com/package/@bragduck/cli)
6
6
  [![Node.js Version](https://img.shields.io/node/v/@bragduck/cli)](https://nodejs.org)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
- [![Tests](https://img.shields.io/badge/tests-122%20passing-brightgreen)](https://github.com/medhatdawoud/bragduck-cli)
8
+ [![Tests](https://img.shields.io/badge/tests-126%20passing-brightgreen)](https://github.com/medhatdawoud/bragduck-cli)
9
9
 
10
10
  ## Overview
11
11
 
12
- Bragduck CLI is a powerful command-line tool that helps developers track and showcase their achievements by transforming git commits into polished "brags" using AI-powered refinement. Perfect for updating your portfolio, preparing for performance reviews, or simply keeping track of your accomplishments.
12
+ Bragduck CLI is a powerful command-line tool that helps developers track and showcase their achievements by transforming GitHub Pull Requests into polished "brags" using AI-powered refinement. Perfect for updating your portfolio, preparing for performance reviews, or simply keeping track of your accomplishments.
13
13
 
14
14
  ### Why Bragduck?
15
15
 
@@ -20,6 +20,33 @@ Bragduck CLI is a powerful command-line tool that helps developers track and sho
20
20
  - ๐Ÿš€ **Fast**: Optimized build size (69KB) for quick installation and execution
21
21
  - ๐ŸŒ **Cross-Platform**: Works on macOS, Windows, and Linux
22
22
 
23
+ ## Prerequisites
24
+
25
+ Before installing Bragduck CLI, you need:
26
+
27
+ 1. **Node.js โ‰ฅ18.0.0**
28
+ ```bash
29
+ node --version # Should be v18.0.0 or higher
30
+ ```
31
+
32
+ 2. **GitHub CLI (gh)**
33
+ ```bash
34
+ # macOS
35
+ brew install gh
36
+
37
+ # Windows
38
+ winget install --id GitHub.cli
39
+
40
+ # Linux
41
+ # See https://github.com/cli/cli#installation
42
+ ```
43
+
44
+ 3. **Authenticate with GitHub CLI**
45
+ ```bash
46
+ gh auth login
47
+ ```
48
+ Follow the prompts to authenticate with your GitHub account.
49
+
23
50
  ## Installation
24
51
 
25
52
  ```bash
@@ -30,25 +57,34 @@ npm install -g @bragduck/cli
30
57
 
31
58
  ### Quick Start
32
59
 
33
- 1. **Install globally:**
60
+ 1. **Install GitHub CLI and authenticate:**
61
+ ```bash
62
+ # Install GitHub CLI (if not already installed)
63
+ brew install gh # macOS
64
+
65
+ # Authenticate with GitHub
66
+ gh auth login
67
+ ```
68
+
69
+ 2. **Install Bragduck CLI globally:**
34
70
  ```bash
35
71
  npm install -g @bragduck/cli
36
72
  ```
37
73
 
38
- 2. **Initialize and authenticate:**
74
+ 3. **Initialize and authenticate:**
39
75
  ```bash
40
76
  bragduck init
41
77
  ```
42
78
  This opens your browser for OAuth authentication. Once completed, your credentials are securely stored.
43
79
 
44
- 3. **Scan your commits:**
80
+ 4. **Scan your merged PRs:**
45
81
  ```bash
46
- cd /path/to/your/git/repo
82
+ cd /path/to/your/github/repo
47
83
  bragduck scan
48
84
  ```
49
- Select commits interactively, preview AI-refined brags, and create them.
85
+ Select PRs interactively, preview AI-refined brags, and create them.
50
86
 
51
- 4. **View your brags:**
87
+ 5. **View your brags:**
52
88
  ```bash
53
89
  bragduck list
54
90
  ```
@@ -65,16 +101,16 @@ bragduck init
65
101
 
66
102
  #### `bragduck scan`
67
103
 
68
- Scan git commits and create brags with AI-powered refinement.
104
+ Scan merged GitHub Pull Requests and create brags with AI-powered refinement.
69
105
 
70
106
  ```bash
71
- # Scan last 30 days (default)
107
+ # Scan last 30 days (default, your PRs only)
72
108
  bragduck scan
73
109
 
74
110
  # Scan last 60 days
75
111
  bragduck scan --days 60
76
112
 
77
- # Include all commits (not just yours)
113
+ # Include all PRs (not just yours)
78
114
  bragduck scan --all
79
115
 
80
116
  # Combine options
@@ -83,15 +119,28 @@ bragduck scan --days 90 --all
83
119
 
84
120
  **Options:**
85
121
  - `-d, --days <number>` - Number of days to scan (default: 30)
86
- - `-a, --all` - Include all commits, not just current user's
122
+ - `-a, --all` - Include all PRs, not just current user's
87
123
 
88
124
  **Workflow:**
89
- 1. Detects git repository
90
- 2. Fetches recent commits
91
- 3. Interactive checkbox selection
92
- 4. AI refines selected commits
93
- 5. Preview refined brags in table format
94
- 6. Confirm and create brags
125
+ 1. Validates GitHub repository
126
+ 2. Fetches merged PRs in timeframe (filtered by author unless --all)
127
+ 3. Displays PRs in format: `#123 PR Title [stats]`
128
+ 4. Interactive checkbox selection
129
+ 5. AI refines selected PRs (using title + description)
130
+ 6. Preview refined brags in table format
131
+ 7. Confirm and create brags
132
+
133
+ **What gets scanned:**
134
+ - โœ… Merged Pull Requests only
135
+ - โœ… PR title and description used for context
136
+ - โœ… Aggregate PR statistics (files changed, insertions, deletions)
137
+ - โœ… Filtered by PR author (person who created the PR)
138
+ - โŒ Draft or closed-without-merge PRs excluded
139
+ - โŒ Individual commits not scanned
140
+
141
+ **Requirements:**
142
+ - Must be in a GitHub repository (GitLab/Bitbucket not supported)
143
+ - GitHub CLI must be installed and authenticated (`gh auth login`)
95
144
 
96
145
  #### `bragduck list`
97
146
 
@@ -132,20 +181,19 @@ Manage CLI configuration.
132
181
  bragduck config list
133
182
 
134
183
  # Get specific config value
135
- bragduck config get apiBaseUrl
136
184
  bragduck config get defaultCommitDays
137
185
 
138
186
  # Set config value
139
187
  bragduck config set defaultCommitDays 60
140
188
  bragduck config set autoVersionCheck false
141
- bragduck config set apiBaseUrl https://custom-api.example.com
142
189
  ```
143
190
 
144
191
  **Available Configuration Keys:**
145
- - `apiBaseUrl` - API base URL (default: https://api.bragduck.com)
146
192
  - `defaultCommitDays` - Default days to scan (1-365, default: 30)
147
193
  - `autoVersionCheck` - Automatic version checking (true/false, default: true)
148
194
 
195
+ **Note:** The API base URL is set to `https://api.bragduck.com` by default. You can override it using the `API_BASE_URL` environment variable if needed for custom deployments.
196
+
149
197
  #### `bragduck logout`
150
198
 
151
199
  Clear stored credentials from your system.
@@ -196,6 +244,7 @@ bragduck --help
196
244
  - โœ… Windows (Compatible)
197
245
  - โœ… Linux (Compatible)
198
246
  - โœ… Node.js โ‰ฅ18.0.0
247
+ - โœ… GitHub repositories only (GitLab/Bitbucket not supported)
199
248
 
200
249
  ## Configuration
201
250
 
@@ -205,10 +254,11 @@ Configuration is stored in `~/.config/bragduck/config.json` (or equivalent on yo
205
254
 
206
255
  | Key | Type | Default | Description |
207
256
  |-----|------|---------|-------------|
208
- | `apiBaseUrl` | string | `https://api.bragduck.com` | API base URL |
209
257
  | `defaultCommitDays` | number | `30` | Default days to scan (1-365) |
210
258
  | `autoVersionCheck` | boolean | `true` | Automatic version checking |
211
259
 
260
+ **API Base URL:** The CLI connects to `https://api.bragduck.com` by default. For custom deployments, set the `API_BASE_URL` environment variable.
261
+
212
262
  ### Credentials Storage
213
263
 
214
264
  Credentials are encrypted and stored at:
@@ -241,17 +291,62 @@ git status # Verify it's a git repo
241
291
  bragduck scan
242
292
  ```
243
293
 
244
- ### No Commits Found
294
+ ### GitHub CLI Not Authenticated
295
+
296
+ **Problem**: "Not authenticated with GitHub" error
297
+
298
+ **Solution**:
299
+ ```bash
300
+ # Authenticate with GitHub CLI
301
+ gh auth login
302
+
303
+ # Verify authentication
304
+ gh auth status
305
+ ```
306
+
307
+ ### Not a GitHub Repository
245
308
 
246
- **Problem**: "No commits found in the last X days"
309
+ **Problem**: "This repository is not hosted on GitHub" error
310
+
311
+ **Solution**:
312
+ - Bragduck CLI currently only supports GitHub repositories
313
+ - Make sure you're in a repository with a GitHub remote:
314
+ ```bash
315
+ git remote -v # Should show github.com URL
316
+ ```
317
+
318
+ ### No Merged PRs Found
319
+
320
+ **Problem**: "No merged PRs found in the last X days"
247
321
 
248
322
  **Solution**:
249
323
  ```bash
250
324
  # Increase the scan days
251
325
  bragduck scan --days 90
252
326
 
253
- # Or include all commits (not just yours)
327
+ # Or include all PRs (not just yours)
254
328
  bragduck scan --all
329
+
330
+ # Check if you have merged PRs on GitHub
331
+ gh pr list --state merged --limit 10
332
+ ```
333
+
334
+ ### GitHub CLI Not Installed
335
+
336
+ **Problem**: "GitHub CLI (gh) is not installed" error
337
+
338
+ **Solution**:
339
+ ```bash
340
+ # macOS
341
+ brew install gh
342
+
343
+ # Windows
344
+ winget install --id GitHub.cli
345
+
346
+ # Linux - see https://github.com/cli/cli#installation
347
+
348
+ # Verify installation
349
+ gh --version
255
350
  ```
256
351
 
257
352
  ### API Connection Issues
@@ -263,9 +358,6 @@ bragduck scan --all
263
358
  # Check your internet connection
264
359
  # Try with debug mode to see detailed logs
265
360
  bragduck --debug scan
266
-
267
- # Check if custom API URL is correct
268
- bragduck config get apiBaseUrl
269
361
  ```
270
362
 
271
363
  ### Version Check Failures
@@ -377,10 +469,10 @@ npx vitest
377
469
  ```
378
470
 
379
471
  **Test Stats:**
380
- - โœ… 122 tests passing
472
+ - โœ… 126 tests passing
381
473
  - ๐Ÿ“Š 50% code coverage (focused on core logic)
382
- - ๐Ÿงช 7 test suites covering:
383
- - Services (Storage, Git, API)
474
+ - ๐Ÿงช 8 test suites covering:
475
+ - Services (Storage, Git, API, GitHub)
384
476
  - Commands (Config, List)
385
477
  - Utilities (Version, Errors)
386
478
 
@@ -398,6 +490,7 @@ src/
398
490
  โ”‚ โ”œโ”€โ”€ auth.service.ts # Authentication & token management
399
491
  โ”‚ โ”œโ”€โ”€ api.service.ts # Backend API client (ofetch)
400
492
  โ”‚ โ”œโ”€โ”€ git.service.ts # Git operations (simple-git)
493
+ โ”‚ โ”œโ”€โ”€ github.service.ts # GitHub PR fetching (gh CLI)
401
494
  โ”‚ โ””โ”€โ”€ storage.service.ts # Encrypted credential storage
402
495
  โ”œโ”€โ”€ ui/ # Terminal UI components
403
496
  โ”‚ โ”œโ”€โ”€ prompts.ts # Interactive prompts (Inquirer)
@@ -432,6 +525,9 @@ src/
432
525
  - chalk, ora, cli-table3, boxen (terminal styling)
433
526
  - conf (configuration management)
434
527
 
528
+ **External Tools:**
529
+ - GitHub CLI (gh) - Required for PR scanning
530
+
435
531
  ## Contributing
436
532
 
437
533
  Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
@@ -457,7 +553,7 @@ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for gui
457
553
 
458
554
  ### Getting Help
459
555
 
460
- - ๐Ÿ“– **Documentation**: Read this README and [PLAN.md](PLAN.md)
556
+ - ๐Ÿ“– **Documentation**: Read this README and [TESTING_GUIDE.md](TESTING_GUIDE.md)
461
557
  - ๐Ÿ› **Issues**: [GitHub Issues](https://github.com/medhatdawoud/bragduck-cli/issues)
462
558
  - ๐Ÿ’ฌ **Discussions**: [GitHub Discussions](https://github.com/medhatdawoud/bragduck-cli/discussions)
463
559