@night-slayer18/leetcode-cli 2.2.2 → 2.3.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/.prettierignore +26 -0
- package/.prettierrc +10 -0
- package/README.md +95 -76
- package/dist/index.js +273 -243
- package/package.json +8 -2
package/.prettierignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Build outputs
|
|
2
|
+
dist/
|
|
3
|
+
build/
|
|
4
|
+
*.tsbuildinfo
|
|
5
|
+
|
|
6
|
+
# Dependencies
|
|
7
|
+
node_modules/
|
|
8
|
+
package-lock.json
|
|
9
|
+
|
|
10
|
+
# Coverage
|
|
11
|
+
coverage/
|
|
12
|
+
.nyc_output/
|
|
13
|
+
|
|
14
|
+
# Logs
|
|
15
|
+
*.log
|
|
16
|
+
|
|
17
|
+
# OS files
|
|
18
|
+
.DS_Store
|
|
19
|
+
Thumbs.db
|
|
20
|
+
|
|
21
|
+
# Auto-generated files
|
|
22
|
+
*.min.js
|
|
23
|
+
*.min.css
|
|
24
|
+
|
|
25
|
+
# License (preserve original formatting)
|
|
26
|
+
LICENSE
|
package/.prettierrc
ADDED
package/README.md
CHANGED
|
@@ -26,15 +26,17 @@ A modern, feature-rich LeetCode CLI built with TypeScript.
|
|
|
26
26
|
- 👥 **Collaborative coding** - Solve problems with a partner
|
|
27
27
|
- 📁 **Workspaces** - Isolate contexts (interview prep, study, contests)
|
|
28
28
|
- ⚙️ **Configurable** - Set language, editor, and working directory
|
|
29
|
+
- 🖥️ **Interactive TUI** - Launch full-screen terminal workflow with `leetcode`
|
|
29
30
|
- 📂 **Smart file discovery** - Use problem ID, filename, or full path
|
|
30
31
|
- 🔄 **Git Sync** - Auto-sync solutions to GitHub/GitLab
|
|
31
32
|
- 🚀 **Auto-update notifications** - Get notified when updates are available
|
|
32
33
|
|
|
33
|
-
|
|
34
34
|
## 📚 Documentation
|
|
35
35
|
|
|
36
36
|
**[View Full Documentation →](https://night-slayer18.github.io/leetcode-cli/)**
|
|
37
37
|
|
|
38
|
+
**[TUI Guide →](docs/tui.md)**
|
|
39
|
+
|
|
38
40
|
**[Read the Blog Post →](https://leetcode-cli.hashnode.dev/leetcode-cli)**
|
|
39
41
|
|
|
40
42
|
## Installation
|
|
@@ -46,6 +48,9 @@ npm install -g @night-slayer18/leetcode-cli
|
|
|
46
48
|
## Quick Start
|
|
47
49
|
|
|
48
50
|
```bash
|
|
51
|
+
# Launch interactive TUI mode
|
|
52
|
+
leetcode
|
|
53
|
+
|
|
49
54
|
# Login with your LeetCode cookies
|
|
50
55
|
leetcode login
|
|
51
56
|
|
|
@@ -64,37 +69,46 @@ leetcode test ./Easy/Array/1.two-sum.java # Full path
|
|
|
64
69
|
leetcode submit 1
|
|
65
70
|
```
|
|
66
71
|
|
|
67
|
-
##
|
|
72
|
+
## Interactive TUI
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|---------|-------------|
|
|
71
|
-
| `login` | Login with LeetCode browser cookies |
|
|
72
|
-
| `logout` | Clear stored credentials |
|
|
73
|
-
| `whoami` | Check login status |
|
|
74
|
-
| `today` | Show daily progress & challenge |
|
|
75
|
-
| `list` | List problems with filters |
|
|
76
|
-
| `show <id>` | Display problem description |
|
|
77
|
-
| `hint <id>` | Show hints for a problem |
|
|
78
|
-
| `pick <id>` | Generate solution file |
|
|
79
|
-
| `pick-batch <ids>` | Pick multiple problems |
|
|
80
|
-
| `bookmark <action>` | Manage problem bookmarks |
|
|
81
|
-
| `note <id>` | Manage problem notes |
|
|
82
|
-
| `daily` | Show today's challenge |
|
|
83
|
-
| `random` | Get a random problem |
|
|
84
|
-
| `test <id\|file>` | Test solution against sample cases |
|
|
85
|
-
| `submit <id\|file>` | Submit solution to LeetCode |
|
|
86
|
-
| `submissions <id>` | View past submissions |
|
|
87
|
-
| `stat [username]` | Show user statistics |
|
|
88
|
-
| `timer <id>` | Interview mode with timer |
|
|
89
|
-
| `snapshot <cmd>` | Save and restore solution versions |
|
|
90
|
-
| `diff <id>` | Compare solution with past submissions |
|
|
91
|
-
| `collab <cmd>` | Collaborative coding with a partner |
|
|
92
|
-
| `workspace <cmd>` | Manage workspaces for different contexts |
|
|
93
|
-
| `config` | View or set configuration |
|
|
94
|
-
| `sync` | Sync solutions to Git repository |
|
|
95
|
-
| `update` | Check for CLI updates |
|
|
96
|
-
| `changelog` | View release notes and breaking changes |
|
|
74
|
+
Run `leetcode` with no arguments to open the full-screen TUI.
|
|
97
75
|
|
|
76
|
+
- Works in interactive terminals (TTY).
|
|
77
|
+
- Keeps existing command shortcuts for problem actions (`p/t/s/h/H/V/b/n/e`).
|
|
78
|
+
- Uses a unified bottom drawer in Problem view for hints, submissions, snapshots, notes, and status output.
|
|
79
|
+
|
|
80
|
+
See [docs/tui.md](docs/tui.md) for full keybindings and behavior.
|
|
81
|
+
|
|
82
|
+
## Commands
|
|
83
|
+
|
|
84
|
+
| Command | Description |
|
|
85
|
+
| ------------------- | ---------------------------------------- |
|
|
86
|
+
| `login` | Login with LeetCode browser cookies |
|
|
87
|
+
| `logout` | Clear stored credentials |
|
|
88
|
+
| `whoami` | Check login status |
|
|
89
|
+
| `today` | Show daily progress & challenge |
|
|
90
|
+
| `list` | List problems with filters |
|
|
91
|
+
| `show <id>` | Display problem description |
|
|
92
|
+
| `hint <id>` | Show hints for a problem |
|
|
93
|
+
| `pick <id>` | Generate solution file |
|
|
94
|
+
| `pick-batch <ids>` | Pick multiple problems |
|
|
95
|
+
| `bookmark <action>` | Manage problem bookmarks |
|
|
96
|
+
| `note <id>` | Manage problem notes |
|
|
97
|
+
| `daily` | Show today's challenge |
|
|
98
|
+
| `random` | Get a random problem |
|
|
99
|
+
| `test <id\|file>` | Test solution against sample cases |
|
|
100
|
+
| `submit <id\|file>` | Submit solution to LeetCode |
|
|
101
|
+
| `submissions <id>` | View past submissions |
|
|
102
|
+
| `stat [username]` | Show user statistics |
|
|
103
|
+
| `timer <id>` | Interview mode with timer |
|
|
104
|
+
| `snapshot <cmd>` | Save and restore solution versions |
|
|
105
|
+
| `diff <id>` | Compare solution with past submissions |
|
|
106
|
+
| `collab <cmd>` | Collaborative coding with a partner |
|
|
107
|
+
| `workspace <cmd>` | Manage workspaces for different contexts |
|
|
108
|
+
| `config` | View or set configuration |
|
|
109
|
+
| `sync` | Sync solutions to Git repository |
|
|
110
|
+
| `update` | Check for CLI updates |
|
|
111
|
+
| `changelog` | View release notes and breaking changes |
|
|
98
112
|
|
|
99
113
|
## Usage Examples
|
|
100
114
|
|
|
@@ -204,21 +218,21 @@ leetcode submissions 1 --download
|
|
|
204
218
|
```
|
|
205
219
|
|
|
206
220
|
### Productivity Features
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Show today's progress & challenge
|
|
224
|
+
leetcode today
|
|
225
|
+
|
|
226
|
+
# Pick multiple problems at once
|
|
227
|
+
leetcode pick-batch 1 2 3 -l python3
|
|
228
|
+
|
|
229
|
+
# Bookmark problems
|
|
230
|
+
leetcode bookmark add 1
|
|
231
|
+
leetcode bookmark list
|
|
232
|
+
|
|
233
|
+
# Keep personal notes
|
|
234
|
+
leetcode note 1 edit
|
|
235
|
+
```
|
|
222
236
|
|
|
223
237
|
### User Statistics
|
|
224
238
|
|
|
@@ -236,12 +250,12 @@ leetcode stat -s
|
|
|
236
250
|
leetcode stat -t
|
|
237
251
|
```
|
|
238
252
|
|
|
239
|
-
|
|
253
|
+
### Git Integration
|
|
240
254
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
255
|
+
```bash
|
|
256
|
+
# Sync all solutions to your configured git repo
|
|
257
|
+
leetcode sync
|
|
258
|
+
```
|
|
245
259
|
|
|
246
260
|
### Interview Timer
|
|
247
261
|
|
|
@@ -339,8 +353,8 @@ leetcode workspace delete old-workspace
|
|
|
339
353
|
```
|
|
340
354
|
|
|
341
355
|
Each workspace has its own config, timer history, and solution snapshots.
|
|
342
|
-
|
|
343
|
-
|
|
356
|
+
|
|
357
|
+
### Configuration
|
|
344
358
|
|
|
345
359
|
```bash
|
|
346
360
|
# View current config
|
|
@@ -377,19 +391,19 @@ leetcode/
|
|
|
377
391
|
|
|
378
392
|
## Supported Languages
|
|
379
393
|
|
|
380
|
-
| Language
|
|
381
|
-
|
|
382
|
-
| TypeScript | `.ts`
|
|
383
|
-
| JavaScript | `.js`
|
|
384
|
-
| Python3
|
|
385
|
-
| Java
|
|
386
|
-
| C++
|
|
387
|
-
| C
|
|
388
|
-
| C#
|
|
389
|
-
| Go
|
|
390
|
-
| Rust
|
|
391
|
-
| Kotlin
|
|
392
|
-
| Swift
|
|
394
|
+
| Language | Extension |
|
|
395
|
+
| ---------- | --------- |
|
|
396
|
+
| TypeScript | `.ts` |
|
|
397
|
+
| JavaScript | `.js` |
|
|
398
|
+
| Python3 | `.py` |
|
|
399
|
+
| Java | `.java` |
|
|
400
|
+
| C++ | `.cpp` |
|
|
401
|
+
| C | `.c` |
|
|
402
|
+
| C# | `.cs` |
|
|
403
|
+
| Go | `.go` |
|
|
404
|
+
| Rust | `.rs` |
|
|
405
|
+
| Kotlin | `.kt` |
|
|
406
|
+
| Swift | `.swift` |
|
|
393
407
|
|
|
394
408
|
## Authentication
|
|
395
409
|
|
|
@@ -450,6 +464,7 @@ You can run the CLI using Docker without installing Node.js.
|
|
|
450
464
|
### Method 1: Pre-built Image (Recommended)
|
|
451
465
|
|
|
452
466
|
1. **Pull the image**:
|
|
467
|
+
|
|
453
468
|
```bash
|
|
454
469
|
docker pull nightslayer/leetcode-cli:latest
|
|
455
470
|
```
|
|
@@ -457,6 +472,7 @@ You can run the CLI using Docker without installing Node.js.
|
|
|
457
472
|
2. **Setup Shell Function** (Add to your shell config):
|
|
458
473
|
|
|
459
474
|
**Bash/Zsh** (`~/.bashrc` or `~/.zshrc`):
|
|
475
|
+
|
|
460
476
|
```bash
|
|
461
477
|
leetcode() {
|
|
462
478
|
docker run -it --rm \
|
|
@@ -468,6 +484,7 @@ You can run the CLI using Docker without installing Node.js.
|
|
|
468
484
|
```
|
|
469
485
|
|
|
470
486
|
**Fish** (`~/.config/fish/config.fish`):
|
|
487
|
+
|
|
471
488
|
```fish
|
|
472
489
|
function leetcode
|
|
473
490
|
docker run -it --rm \
|
|
@@ -479,6 +496,7 @@ You can run the CLI using Docker without installing Node.js.
|
|
|
479
496
|
```
|
|
480
497
|
|
|
481
498
|
**PowerShell** (`$PROFILE`):
|
|
499
|
+
|
|
482
500
|
```powershell
|
|
483
501
|
function leetcode {
|
|
484
502
|
docker run -it --rm `
|
|
@@ -498,19 +516,20 @@ You can run the CLI using Docker without installing Node.js.
|
|
|
498
516
|
### Method 2: Build Locally
|
|
499
517
|
|
|
500
518
|
1. **Build the image**:
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
docker build -t leetcode-cli .
|
|
522
|
+
```
|
|
504
523
|
|
|
505
524
|
2. **Run commands**:
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
525
|
+
```bash
|
|
526
|
+
docker run -it --rm \
|
|
527
|
+
-w /root/leetcode \
|
|
528
|
+
-v "$(pwd)/leetcode:/root/leetcode" \
|
|
529
|
+
-v "$HOME/.leetcode:/root/.leetcode" \
|
|
530
|
+
leetcode-cli list
|
|
531
|
+
```
|
|
532
|
+
_Note: We mount `~/.leetcode` to persist login credentials and `leetcode` folder to save solution files._
|
|
514
533
|
|
|
515
534
|
## License
|
|
516
535
|
|