@bragduck/cli 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bragduck
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,494 @@
1
+ # Bragduck CLI
2
+
3
+ > Transform your git commits into polished achievements with AI-powered refinement
4
+
5
+ [![npm version](https://badge.fury.io/js/@bragduck%2Fcli.svg)](https://www.npmjs.com/package/@bragduck/cli)
6
+ [![Node.js Version](https://img.shields.io/node/v/@bragduck/cli)](https://nodejs.org)
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)
9
+
10
+ ## Overview
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.
13
+
14
+ ### Why Bragduck?
15
+
16
+ - ๐Ÿค– **AI-Powered**: Automatically refines your commit messages into professional achievements
17
+ - ๐ŸŽฏ **Context-Aware**: Analyzes commit diffs, file changes, and patterns
18
+ - ๐Ÿ”’ **Secure**: OAuth authentication with encrypted credential storage
19
+ - ๐ŸŽจ **Beautiful UI**: Interactive terminal experience with colors and spinners
20
+ - ๐Ÿš€ **Fast**: Optimized build size (69KB) for quick installation and execution
21
+ - ๐ŸŒ **Cross-Platform**: Works on macOS, Windows, and Linux
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install -g @bragduck/cli
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Quick Start
32
+
33
+ 1. **Install globally:**
34
+ ```bash
35
+ npm install -g @bragduck/cli
36
+ ```
37
+
38
+ 2. **Initialize and authenticate:**
39
+ ```bash
40
+ bragduck init
41
+ ```
42
+ This opens your browser for OAuth authentication. Once completed, your credentials are securely stored.
43
+
44
+ 3. **Scan your commits:**
45
+ ```bash
46
+ cd /path/to/your/git/repo
47
+ bragduck scan
48
+ ```
49
+ Select commits interactively, preview AI-refined brags, and create them.
50
+
51
+ 4. **View your brags:**
52
+ ```bash
53
+ bragduck list
54
+ ```
55
+
56
+ ### Commands
57
+
58
+ #### `bragduck init`
59
+
60
+ Authenticate with Bragduck using OAuth. Opens your browser for authentication and securely stores credentials.
61
+
62
+ ```bash
63
+ bragduck init
64
+ ```
65
+
66
+ #### `bragduck scan`
67
+
68
+ Scan git commits and create brags with AI-powered refinement.
69
+
70
+ ```bash
71
+ # Scan last 30 days (default)
72
+ bragduck scan
73
+
74
+ # Scan last 60 days
75
+ bragduck scan --days 60
76
+
77
+ # Include all commits (not just yours)
78
+ bragduck scan --all
79
+
80
+ # Combine options
81
+ bragduck scan --days 90 --all
82
+ ```
83
+
84
+ **Options:**
85
+ - `-d, --days <number>` - Number of days to scan (default: 30)
86
+ - `-a, --all` - Include all commits, not just current user's
87
+
88
+ **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
95
+
96
+ #### `bragduck list`
97
+
98
+ List your existing brags with filtering and pagination.
99
+
100
+ ```bash
101
+ # List all brags (default: 50)
102
+ bragduck list
103
+
104
+ # Show 25 brags
105
+ bragduck list --limit 25
106
+
107
+ # Show next page (skip first 50)
108
+ bragduck list --offset 50
109
+
110
+ # Filter by tags
111
+ bragduck list --tags "feature,bugfix"
112
+
113
+ # Search by keyword
114
+ bragduck list --search "implemented authentication"
115
+
116
+ # Combine filters
117
+ bragduck list --tags "feature" --search "API" --limit 20
118
+ ```
119
+
120
+ **Options:**
121
+ - `-l, --limit <number>` - Number of brags to display (default: 50)
122
+ - `-o, --offset <number>` - Number of brags to skip (default: 0)
123
+ - `-t, --tags <tags>` - Filter by tags (comma-separated)
124
+ - `-s, --search <query>` - Search brags by keyword
125
+
126
+ #### `bragduck config`
127
+
128
+ Manage CLI configuration.
129
+
130
+ ```bash
131
+ # List all configuration values
132
+ bragduck config list
133
+
134
+ # Get specific config value
135
+ bragduck config get apiBaseUrl
136
+ bragduck config get defaultCommitDays
137
+
138
+ # Set config value
139
+ bragduck config set defaultCommitDays 60
140
+ bragduck config set autoVersionCheck false
141
+ bragduck config set apiBaseUrl https://custom-api.example.com
142
+ ```
143
+
144
+ **Available Configuration Keys:**
145
+ - `apiBaseUrl` - API base URL (default: https://api.bragduck.com)
146
+ - `defaultCommitDays` - Default days to scan (1-365, default: 30)
147
+ - `autoVersionCheck` - Automatic version checking (true/false, default: true)
148
+
149
+ #### `bragduck logout`
150
+
151
+ Clear stored credentials from your system.
152
+
153
+ ```bash
154
+ bragduck logout
155
+ ```
156
+
157
+ ### Global Options
158
+
159
+ Available for all commands:
160
+
161
+ ```bash
162
+ # Enable debug mode (shows detailed logs)
163
+ bragduck --debug <command>
164
+
165
+ # Skip automatic version check
166
+ bragduck --skip-version-check <command>
167
+
168
+ # Show version
169
+ bragduck --version
170
+
171
+ # Show help
172
+ bragduck --help
173
+ ```
174
+
175
+ ## Features
176
+
177
+ ### Core Features
178
+ - ๐Ÿ” **OAuth Authentication** - Secure authentication with local callback server
179
+ - ๐Ÿค– **AI-Powered Refinement** - Transforms commit messages into professional achievements
180
+ - โœ… **Interactive Selection** - Checkbox interface for selecting commits
181
+ - ๐Ÿ“Š **Rich Preview** - Table preview of refined brags before creation
182
+ - ๐Ÿ” **Smart Filtering** - Filter brags by tags and search keywords
183
+ - ๐Ÿ“„ **Pagination Support** - Handle large numbers of brags efficiently
184
+
185
+ ### Technical Features
186
+ - ๐Ÿ”’ **Secure Storage** - Encrypted credential storage with AES-256-GCM
187
+ - ๐ŸŽจ **Beautiful UI** - Colorful terminal output with spinners and tables
188
+ - ๐Ÿ”„ **Auto-Updates** - Automatic version checking with update notifications
189
+ - ๐Ÿ› **Debug Mode** - Detailed logging for troubleshooting
190
+ - โš™๏ธ **Configurable** - Customize API URL, scan days, and more
191
+ - ๐Ÿš€ **Lightweight** - Only 69KB build size
192
+ - โœจ **TypeScript** - Fully typed for better IDE support
193
+
194
+ ### Platform Support
195
+ - โœ… macOS (Tested)
196
+ - โœ… Windows (Compatible)
197
+ - โœ… Linux (Compatible)
198
+ - โœ… Node.js โ‰ฅ18.0.0
199
+
200
+ ## Configuration
201
+
202
+ Configuration is stored in `~/.config/bragduck/config.json` (or equivalent on your OS).
203
+
204
+ ### Available Settings
205
+
206
+ | Key | Type | Default | Description |
207
+ |-----|------|---------|-------------|
208
+ | `apiBaseUrl` | string | `https://api.bragduck.com` | API base URL |
209
+ | `defaultCommitDays` | number | `30` | Default days to scan (1-365) |
210
+ | `autoVersionCheck` | boolean | `true` | Automatic version checking |
211
+
212
+ ### Credentials Storage
213
+
214
+ Credentials are encrypted and stored at:
215
+ - **File**: `~/.bragduck/credentials.enc`
216
+ - **Encryption**: AES-256-GCM with machine-specific key derivation
217
+ - **Access**: Only accessible by the CLI on your machine
218
+
219
+ ## Troubleshooting
220
+
221
+ ### Authentication Issues
222
+
223
+ **Problem**: "Not authenticated" error when running commands
224
+
225
+ **Solution**:
226
+ ```bash
227
+ # Re-authenticate
228
+ bragduck logout
229
+ bragduck init
230
+ ```
231
+
232
+ ### Git Repository Not Found
233
+
234
+ **Problem**: "Not a git repository" error
235
+
236
+ **Solution**:
237
+ ```bash
238
+ # Make sure you're in a git repository
239
+ cd /path/to/your/git/repo
240
+ git status # Verify it's a git repo
241
+ bragduck scan
242
+ ```
243
+
244
+ ### No Commits Found
245
+
246
+ **Problem**: "No commits found in the last X days"
247
+
248
+ **Solution**:
249
+ ```bash
250
+ # Increase the scan days
251
+ bragduck scan --days 90
252
+
253
+ # Or include all commits (not just yours)
254
+ bragduck scan --all
255
+ ```
256
+
257
+ ### API Connection Issues
258
+
259
+ **Problem**: Network or API errors
260
+
261
+ **Solution**:
262
+ ```bash
263
+ # Check your internet connection
264
+ # Try with debug mode to see detailed logs
265
+ bragduck --debug scan
266
+
267
+ # Check if custom API URL is correct
268
+ bragduck config get apiBaseUrl
269
+ ```
270
+
271
+ ### Version Check Failures
272
+
273
+ **Problem**: Version check taking too long or failing
274
+
275
+ **Solution**:
276
+ ```bash
277
+ # Skip version check for this run
278
+ bragduck --skip-version-check scan
279
+
280
+ # Or disable it permanently
281
+ bragduck config set autoVersionCheck false
282
+ ```
283
+
284
+ ### Enable Debug Mode
285
+
286
+ For any issues, enable debug mode to see detailed logs:
287
+
288
+ ```bash
289
+ bragduck --debug <command>
290
+ ```
291
+
292
+ This shows:
293
+ - API requests and responses
294
+ - Authentication status
295
+ - Configuration reads/writes
296
+ - Internal operations
297
+
298
+ ## Development
299
+
300
+ ### Prerequisites
301
+
302
+ - Node.js โ‰ฅ 18.0.0
303
+ - npm or yarn
304
+
305
+ ### Setup
306
+
307
+ ```bash
308
+ # Clone the repository
309
+ git clone https://github.com/medhatdawoud/bragduck-cli.git
310
+ cd bragduck-cli
311
+
312
+ # Install dependencies
313
+ npm install
314
+
315
+ # Build the project
316
+ npm run build
317
+
318
+ # Run tests
319
+ npm test
320
+
321
+ # Run tests with coverage
322
+ npm run test:coverage
323
+
324
+ # Lint code
325
+ npm run lint
326
+
327
+ # Format code
328
+ npm run format
329
+ ```
330
+
331
+ ### Project Structure
332
+
333
+ ```
334
+ bragduck-cli/
335
+ โ”œโ”€โ”€ src/
336
+ โ”‚ โ”œโ”€โ”€ commands/ # CLI commands
337
+ โ”‚ โ”œโ”€โ”€ services/ # Business logic services
338
+ โ”‚ โ”œโ”€โ”€ ui/ # Terminal UI components
339
+ โ”‚ โ”œโ”€โ”€ types/ # TypeScript type definitions
340
+ โ”‚ โ”œโ”€โ”€ utils/ # Utility functions
341
+ โ”‚ โ””โ”€โ”€ cli.ts # CLI entry point
342
+ โ”œโ”€โ”€ tests/ # Test files
343
+ โ”œโ”€โ”€ dist/ # Built files
344
+ โ””โ”€โ”€ package.json
345
+ ```
346
+
347
+ ### Scripts
348
+
349
+ | Script | Description |
350
+ |--------|-------------|
351
+ | `npm run build` | Build the project with tsup |
352
+ | `npm run dev` | Build in watch mode for development |
353
+ | `npm test` | Run test suite (122 tests) |
354
+ | `npm run test:coverage` | Run tests with coverage report |
355
+ | `npm run test:ui` | Run tests with interactive UI |
356
+ | `npm run lint` | Lint code with ESLint |
357
+ | `npm run lint:fix` | Lint and auto-fix issues |
358
+ | `npm run format` | Format code with Prettier |
359
+ | `npm run typecheck` | Type check without building |
360
+
361
+ ### Testing
362
+
363
+ The project has comprehensive test coverage:
364
+
365
+ ```bash
366
+ # Run all tests
367
+ npm test
368
+
369
+ # Run with coverage report
370
+ npm run test:coverage
371
+
372
+ # Run specific test file
373
+ npx vitest run tests/commands/config.test.ts
374
+
375
+ # Run in watch mode
376
+ npx vitest
377
+ ```
378
+
379
+ **Test Stats:**
380
+ - โœ… 122 tests passing
381
+ - ๐Ÿ“Š 50% code coverage (focused on core logic)
382
+ - ๐Ÿงช 7 test suites covering:
383
+ - Services (Storage, Git, API)
384
+ - Commands (Config, List)
385
+ - Utilities (Version, Errors)
386
+
387
+ ### Architecture
388
+
389
+ ```
390
+ src/
391
+ โ”œโ”€โ”€ commands/ # CLI command implementations
392
+ โ”‚ โ”œโ”€โ”€ init.ts # OAuth authentication flow
393
+ โ”‚ โ”œโ”€โ”€ scan.ts # Main feature - commit scanning
394
+ โ”‚ โ”œโ”€โ”€ list.ts # List brags with filtering
395
+ โ”‚ โ”œโ”€โ”€ config.ts # Configuration management
396
+ โ”‚ โ””โ”€โ”€ logout.ts # Credential cleanup
397
+ โ”œโ”€โ”€ services/ # Business logic services
398
+ โ”‚ โ”œโ”€โ”€ auth.service.ts # Authentication & token management
399
+ โ”‚ โ”œโ”€โ”€ api.service.ts # Backend API client (ofetch)
400
+ โ”‚ โ”œโ”€โ”€ git.service.ts # Git operations (simple-git)
401
+ โ”‚ โ””โ”€โ”€ storage.service.ts # Encrypted credential storage
402
+ โ”œโ”€โ”€ ui/ # Terminal UI components
403
+ โ”‚ โ”œโ”€โ”€ prompts.ts # Interactive prompts (Inquirer)
404
+ โ”‚ โ”œโ”€โ”€ formatters.ts # Output formatting (chalk, cli-table3)
405
+ โ”‚ โ””โ”€โ”€ spinners.ts # Loading indicators (ora)
406
+ โ”œโ”€โ”€ utils/ # Utility functions
407
+ โ”‚ โ”œโ”€โ”€ errors.ts # Custom error classes
408
+ โ”‚ โ”œโ”€โ”€ logger.ts # Logging utility
409
+ โ”‚ โ”œโ”€โ”€ version.ts # Version checking & comparison
410
+ โ”‚ โ”œโ”€โ”€ validators.ts # Input validation
411
+ โ”‚ โ”œโ”€โ”€ browser.ts # Cross-platform browser opening
412
+ โ”‚ โ””โ”€โ”€ oauth-server.ts # Local OAuth callback server
413
+ โ””โ”€โ”€ types/ # TypeScript type definitions
414
+ ```
415
+
416
+ ### Tech Stack
417
+
418
+ **Core:**
419
+ - TypeScript 5.x
420
+ - Node.js โ‰ฅ18.0.0
421
+ - Commander.js (CLI framework)
422
+
423
+ **Build & Test:**
424
+ - tsup (TypeScript bundler with esbuild)
425
+ - Vitest (testing framework)
426
+ - ESLint + Prettier
427
+
428
+ **Dependencies:**
429
+ - @inquirer/prompts (interactive UI)
430
+ - simple-git (Git operations)
431
+ - ofetch (HTTP client)
432
+ - chalk, ora, cli-table3, boxen (terminal styling)
433
+ - conf (configuration management)
434
+
435
+ ## Contributing
436
+
437
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
438
+
439
+ ### Quick Contribution Guide
440
+
441
+ 1. Fork the repository
442
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
443
+ 3. Make your changes
444
+ 4. Run tests (`npm test`)
445
+ 5. Commit your changes (`git commit -m 'Add amazing feature'`)
446
+ 6. Push to the branch (`git push origin feature/amazing-feature`)
447
+ 7. Open a Pull Request
448
+
449
+ ### Development Guidelines
450
+
451
+ - Write tests for new features
452
+ - Follow existing code style (ESLint + Prettier)
453
+ - Update documentation for user-facing changes
454
+ - Keep commits atomic and well-described
455
+
456
+ ## Support
457
+
458
+ ### Getting Help
459
+
460
+ - ๐Ÿ“– **Documentation**: Read this README and [PLAN.md](PLAN.md)
461
+ - ๐Ÿ› **Issues**: [GitHub Issues](https://github.com/medhatdawoud/bragduck-cli/issues)
462
+ - ๐Ÿ’ฌ **Discussions**: [GitHub Discussions](https://github.com/medhatdawoud/bragduck-cli/discussions)
463
+
464
+ ### Reporting Issues
465
+
466
+ When reporting issues, please include:
467
+
468
+ 1. **Environment**: OS, Node.js version, npm version
469
+ 2. **Steps to reproduce**: Clear steps to reproduce the issue
470
+ 3. **Expected behavior**: What you expected to happen
471
+ 4. **Actual behavior**: What actually happened
472
+ 5. **Debug output**: Run with `--debug` flag and include output
473
+
474
+ Example:
475
+ ```bash
476
+ bragduck --debug scan
477
+ ```
478
+
479
+ ## License
480
+
481
+ MIT License - see [LICENSE](LICENSE) file for details
482
+
483
+ ## Acknowledgments
484
+
485
+ Built with โค๏ธ using:
486
+ - [Commander.js](https://github.com/tj/commander.js) - CLI framework
487
+ - [Inquirer.js](https://github.com/SBoudrias/Inquirer.js) - Interactive prompts
488
+ - [simple-git](https://github.com/steveukx/git-js) - Git operations
489
+ - [Vitest](https://vitest.dev) - Testing framework
490
+ - And many other great open-source projects
491
+
492
+ ---
493
+
494
+ **Made by [Medhat Dawoud](https://github.com/medhatdawoud)** | **Powered by AI**
@@ -0,0 +1,2 @@
1
+
2
+ export { }