@night-slayer18/leetcode-cli 1.1.0 → 1.4.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 +94 -8
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1326 -370
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -18,6 +18,11 @@ A modern, feature-rich LeetCode CLI built with TypeScript.
|
|
|
18
18
|
- 🎯 **Daily challenge** - Get today's problem
|
|
19
19
|
- ⚙️ **Configurable** - Set language, editor, and working directory
|
|
20
20
|
- 📂 **Smart file discovery** - Use problem ID, filename, or full path
|
|
21
|
+
- 🔄 **Git Sync** - Auto-sync solutions to GitHub/GitLab
|
|
22
|
+
|
|
23
|
+
## 📚 Documentation
|
|
24
|
+
|
|
25
|
+
**[View Full Documentation →](https://night-slayer18.github.io/leetcode-cli/)**
|
|
21
26
|
|
|
22
27
|
## Installation
|
|
23
28
|
|
|
@@ -53,14 +58,22 @@ leetcode submit 1
|
|
|
53
58
|
| `login` | Login with LeetCode browser cookies |
|
|
54
59
|
| `logout` | Clear stored credentials |
|
|
55
60
|
| `whoami` | Check login status |
|
|
61
|
+
| `today` | Show daily progress & challenge |
|
|
56
62
|
| `list` | List problems with filters |
|
|
57
63
|
| `show <id>` | Display problem description |
|
|
58
|
-
| `daily` | Show today's challenge |
|
|
59
64
|
| `pick <id>` | Generate solution file |
|
|
65
|
+
| `pick-batch <ids>` | Pick multiple problems |
|
|
66
|
+
| `bookmark <action>` | Manage problem bookmarks |
|
|
67
|
+
| `note <id>` | Manage problem notes |
|
|
68
|
+
| `daily` | Show today's challenge |
|
|
69
|
+
| `random` | Get a random problem |
|
|
60
70
|
| `test <id\|file>` | Test solution against sample cases |
|
|
61
71
|
| `submit <id\|file>` | Submit solution to LeetCode |
|
|
72
|
+
| `submissions <id>` | View past submissions |
|
|
73
|
+
| `stat [username]` | Show user statistics |
|
|
62
74
|
| `stat [username]` | Show user statistics |
|
|
63
75
|
| `config` | View or set configuration |
|
|
76
|
+
| `sync` | Sync solutions to Git repository |
|
|
64
77
|
|
|
65
78
|
## Usage Examples
|
|
66
79
|
|
|
@@ -155,7 +168,47 @@ leetcode submissions 1 --last
|
|
|
155
168
|
leetcode submissions 1 --download
|
|
156
169
|
```
|
|
157
170
|
|
|
158
|
-
###
|
|
171
|
+
### Productivity Features
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Show today's progress & challenge
|
|
175
|
+
leetcode today
|
|
176
|
+
|
|
177
|
+
# Pick multiple problems at once
|
|
178
|
+
leetcode pick-batch 1 2 3 -l python3
|
|
179
|
+
|
|
180
|
+
# Bookmark problems
|
|
181
|
+
leetcode bookmark add 1
|
|
182
|
+
leetcode bookmark list
|
|
183
|
+
|
|
184
|
+
# Keep personal notes
|
|
185
|
+
leetcode note 1 edit
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### User Statistics
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Basic stats (solved count, rank, streak)
|
|
192
|
+
leetcode stat
|
|
193
|
+
|
|
194
|
+
# Weekly activity table (last 12 weeks)
|
|
195
|
+
leetcode stat -c
|
|
196
|
+
|
|
197
|
+
# Skill breakdown by topic tags
|
|
198
|
+
leetcode stat -s
|
|
199
|
+
|
|
200
|
+
# 7-day trend chart
|
|
201
|
+
leetcode stat -t
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Git Integration
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Sync all solutions to your configured git repo
|
|
208
|
+
leetcode sync
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Configuration
|
|
159
212
|
|
|
160
213
|
```bash
|
|
161
214
|
# View current config
|
|
@@ -168,6 +221,7 @@ leetcode config -i
|
|
|
168
221
|
leetcode config --lang python3
|
|
169
222
|
leetcode config --editor code
|
|
170
223
|
leetcode config --workdir ~/leetcode
|
|
224
|
+
leetcode config --repo https://github.com/username/leetcode-solutions.git
|
|
171
225
|
```
|
|
172
226
|
|
|
173
227
|
## Folder Structure
|
|
@@ -227,7 +281,8 @@ Config is stored at `~/.leetcode/config.json`:
|
|
|
227
281
|
"config": {
|
|
228
282
|
"language": "java",
|
|
229
283
|
"editor": "code",
|
|
230
|
-
"workDir": "/path/to/leetcode"
|
|
284
|
+
"workDir": "/path/to/leetcode",
|
|
285
|
+
"repo": "https://github.com/username/leetcode-solutions.git"
|
|
231
286
|
}
|
|
232
287
|
}
|
|
233
288
|
```
|
|
@@ -247,14 +302,45 @@ You can run the CLI using Docker without installing Node.js.
|
|
|
247
302
|
docker pull nightslayer/leetcode-cli:latest
|
|
248
303
|
```
|
|
249
304
|
|
|
250
|
-
2. **Setup
|
|
305
|
+
2. **Setup Shell Function** (Add to your shell config):
|
|
306
|
+
|
|
307
|
+
**Bash/Zsh** (`~/.bashrc` or `~/.zshrc`):
|
|
251
308
|
```bash
|
|
252
|
-
|
|
309
|
+
leetcode() {
|
|
310
|
+
docker run -it --rm \
|
|
311
|
+
-w /root/leetcode \
|
|
312
|
+
-v "$(pwd)/leetcode:/root/leetcode" \
|
|
313
|
+
-v "$HOME/.leetcode:/root/.leetcode" \
|
|
314
|
+
nightslayer/leetcode-cli:latest "$@"
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Fish** (`~/.config/fish/config.fish`):
|
|
319
|
+
```fish
|
|
320
|
+
function leetcode
|
|
321
|
+
docker run -it --rm \
|
|
322
|
+
-w /root/leetcode \
|
|
323
|
+
-v (pwd)/leetcode:/root/leetcode \
|
|
324
|
+
-v $HOME/.leetcode:/root/.leetcode \
|
|
325
|
+
nightslayer/leetcode-cli:latest $argv
|
|
326
|
+
end
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**PowerShell** (`$PROFILE`):
|
|
330
|
+
```powershell
|
|
331
|
+
function leetcode {
|
|
332
|
+
docker run -it --rm `
|
|
333
|
+
-w /root/leetcode `
|
|
334
|
+
-v "${PWD}/leetcode:/root/leetcode" `
|
|
335
|
+
-v "$env:USERPROFILE/.leetcode:/root/.leetcode" `
|
|
336
|
+
nightslayer/leetcode-cli:latest $args
|
|
337
|
+
}
|
|
253
338
|
```
|
|
254
339
|
|
|
255
340
|
3. **Usage**:
|
|
256
341
|
```bash
|
|
257
342
|
leetcode list
|
|
343
|
+
leetcode pick 1
|
|
258
344
|
```
|
|
259
345
|
|
|
260
346
|
### Method 2: Build Locally
|
|
@@ -266,10 +352,10 @@ You can run the CLI using Docker without installing Node.js.
|
|
|
266
352
|
|
|
267
353
|
2. **Run commands**:
|
|
268
354
|
```bash
|
|
269
|
-
# Run 'list' command
|
|
270
355
|
docker run -it --rm \
|
|
271
|
-
-
|
|
272
|
-
-v
|
|
356
|
+
-w /root/leetcode \
|
|
357
|
+
-v "$(pwd)/leetcode:/root/leetcode" \
|
|
358
|
+
-v "$HOME/.leetcode:/root/.leetcode" \
|
|
273
359
|
leetcode-cli list
|
|
274
360
|
```
|
|
275
361
|
*Note: We mount `~/.leetcode` to persist login credentials and `leetcode` folder to save solution files.*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
#!/usr/bin/env node
|