@night-slayer18/leetcode-cli 1.6.0 → 2.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/README.md +86 -0
- package/dist/index.js +1565 -564
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -17,7 +17,9 @@ A modern, feature-rich LeetCode CLI built with TypeScript.
|
|
|
17
17
|
- 📊 **View statistics** - Track your progress
|
|
18
18
|
- 🎯 **Daily challenge** - Get today's problem
|
|
19
19
|
- ⏱️ **Interview timer** - Timed practice with solve time tracking
|
|
20
|
+
- 📸 **Solution snapshots** - Save, restore, and compare solution versions
|
|
20
21
|
- 👥 **Collaborative coding** - Solve problems with a partner
|
|
22
|
+
- 📁 **Workspaces** - Isolate contexts (interview prep, study, contests)
|
|
21
23
|
- ⚙️ **Configurable** - Set language, editor, and working directory
|
|
22
24
|
- 📂 **Smart file discovery** - Use problem ID, filename, or full path
|
|
23
25
|
- 🔄 **Git Sync** - Auto-sync solutions to GitHub/GitLab
|
|
@@ -74,7 +76,10 @@ leetcode submit 1
|
|
|
74
76
|
| `submissions <id>` | View past submissions |
|
|
75
77
|
| `stat [username]` | Show user statistics |
|
|
76
78
|
| `timer <id>` | Interview mode with timer |
|
|
79
|
+
| `snapshot <cmd>` | Save and restore solution versions |
|
|
80
|
+
| `diff <id>` | Compare solution with past submissions |
|
|
77
81
|
| `collab <cmd>` | Collaborative coding with a partner |
|
|
82
|
+
| `workspace <cmd>` | Manage workspaces for different contexts |
|
|
78
83
|
| `config` | View or set configuration |
|
|
79
84
|
| `sync` | Sync solutions to Git repository |
|
|
80
85
|
|
|
@@ -136,6 +141,9 @@ leetcode test ./Easy/String/20.valid-parentheses.java
|
|
|
136
141
|
|
|
137
142
|
# With custom test case
|
|
138
143
|
leetcode test 20 -c "[1,2,3]\n4"
|
|
144
|
+
|
|
145
|
+
# Visual debugging (ASCII visualization for arrays, trees, etc.)
|
|
146
|
+
leetcode test 1 --visualize
|
|
139
147
|
```
|
|
140
148
|
|
|
141
149
|
### Random Problem
|
|
@@ -249,6 +257,64 @@ leetcode collab status
|
|
|
249
257
|
# Leave session
|
|
250
258
|
leetcode collab leave
|
|
251
259
|
```
|
|
260
|
+
|
|
261
|
+
### Solution Snapshots
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Save current approach
|
|
265
|
+
leetcode snapshot save 1 "brute-force"
|
|
266
|
+
|
|
267
|
+
# Try a new approach, then save
|
|
268
|
+
leetcode snapshot save 1 "hash-map"
|
|
269
|
+
|
|
270
|
+
# List all saved versions
|
|
271
|
+
leetcode snapshot list 1
|
|
272
|
+
|
|
273
|
+
# Compare approaches
|
|
274
|
+
leetcode snapshot diff 1 1 2
|
|
275
|
+
|
|
276
|
+
# Restore if needed
|
|
277
|
+
leetcode snapshot restore 1 brute-force
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Compare Solutions
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Compare with last accepted submission
|
|
284
|
+
leetcode diff 1
|
|
285
|
+
|
|
286
|
+
# Show unified diff (line-by-line changes)
|
|
287
|
+
leetcode diff 1 --unified
|
|
288
|
+
|
|
289
|
+
# Compare with specific submission
|
|
290
|
+
leetcode diff 1 --submission 12345
|
|
291
|
+
|
|
292
|
+
# Compare with local file
|
|
293
|
+
leetcode diff 1 --file other-solution.py
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Workspaces
|
|
297
|
+
|
|
298
|
+
Isolate your problem-solving contexts (e.g., interview prep vs daily practice).
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# Show current workspace
|
|
302
|
+
leetcode workspace current
|
|
303
|
+
|
|
304
|
+
# List all workspaces
|
|
305
|
+
leetcode workspace list
|
|
306
|
+
|
|
307
|
+
# Create new workspace
|
|
308
|
+
leetcode workspace create interview -w ~/leetcode-interview
|
|
309
|
+
|
|
310
|
+
# Switch workspace
|
|
311
|
+
leetcode workspace use interview
|
|
312
|
+
|
|
313
|
+
# Delete workspace (files not deleted)
|
|
314
|
+
leetcode workspace delete old-workspace
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Each workspace has its own config, timer history, and solution snapshots.
|
|
252
318
|
|
|
253
319
|
### Configuration
|
|
254
320
|
|
|
@@ -333,6 +399,26 @@ Config is stored at `~/.leetcode/config.json`:
|
|
|
333
399
|
|
|
334
400
|
- Node.js >= 20.0.0
|
|
335
401
|
|
|
402
|
+
## Development
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# Clone and install
|
|
406
|
+
git clone https://github.com/night-slayer18/leetcode-cli.git
|
|
407
|
+
cd leetcode-cli
|
|
408
|
+
npm install
|
|
409
|
+
|
|
410
|
+
# Build
|
|
411
|
+
npm run build
|
|
412
|
+
|
|
413
|
+
# Run tests
|
|
414
|
+
npm test
|
|
415
|
+
|
|
416
|
+
# Run with coverage
|
|
417
|
+
npm test -- --coverage
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
See [docs/testing.md](docs/testing.md) for detailed testing documentation.
|
|
421
|
+
|
|
336
422
|
## Docker Usage
|
|
337
423
|
|
|
338
424
|
You can run the CLI using Docker without installing Node.js.
|