@night-slayer18/leetcode-cli 1.5.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 +112 -0
- package/dist/index.js +1899 -555
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -16,6 +16,10 @@ A modern, feature-rich LeetCode CLI built with TypeScript.
|
|
|
16
16
|
- 📤 **Submit solutions** - Submit directly to LeetCode
|
|
17
17
|
- 📊 **View statistics** - Track your progress
|
|
18
18
|
- 🎯 **Daily challenge** - Get today's problem
|
|
19
|
+
- ⏱️ **Interview timer** - Timed practice with solve time tracking
|
|
20
|
+
- 📸 **Solution snapshots** - Save, restore, and compare solution versions
|
|
21
|
+
- 👥 **Collaborative coding** - Solve problems with a partner
|
|
22
|
+
- 📁 **Workspaces** - Isolate contexts (interview prep, study, contests)
|
|
19
23
|
- ⚙️ **Configurable** - Set language, editor, and working directory
|
|
20
24
|
- 📂 **Smart file discovery** - Use problem ID, filename, or full path
|
|
21
25
|
- 🔄 **Git Sync** - Auto-sync solutions to GitHub/GitLab
|
|
@@ -72,6 +76,10 @@ leetcode submit 1
|
|
|
72
76
|
| `submissions <id>` | View past submissions |
|
|
73
77
|
| `stat [username]` | Show user statistics |
|
|
74
78
|
| `timer <id>` | Interview mode with timer |
|
|
79
|
+
| `snapshot <cmd>` | Save and restore solution versions |
|
|
80
|
+
| `diff <id>` | Compare solution with past submissions |
|
|
81
|
+
| `collab <cmd>` | Collaborative coding with a partner |
|
|
82
|
+
| `workspace <cmd>` | Manage workspaces for different contexts |
|
|
75
83
|
| `config` | View or set configuration |
|
|
76
84
|
| `sync` | Sync solutions to Git repository |
|
|
77
85
|
|
|
@@ -133,6 +141,9 @@ leetcode test ./Easy/String/20.valid-parentheses.java
|
|
|
133
141
|
|
|
134
142
|
# With custom test case
|
|
135
143
|
leetcode test 20 -c "[1,2,3]\n4"
|
|
144
|
+
|
|
145
|
+
# Visual debugging (ASCII visualization for arrays, trees, etc.)
|
|
146
|
+
leetcode test 1 --visualize
|
|
136
147
|
```
|
|
137
148
|
|
|
138
149
|
### Random Problem
|
|
@@ -223,6 +234,87 @@ leetcode timer --stats
|
|
|
223
234
|
# Stop active timer
|
|
224
235
|
leetcode timer --stop
|
|
225
236
|
```
|
|
237
|
+
|
|
238
|
+
### Collaborative Coding
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Host a collaboration session
|
|
242
|
+
leetcode collab host 1
|
|
243
|
+
|
|
244
|
+
# Share the room code with your partner
|
|
245
|
+
# Partner joins with:
|
|
246
|
+
leetcode collab join ABC123
|
|
247
|
+
|
|
248
|
+
# Both solve the problem, then sync
|
|
249
|
+
leetcode collab sync
|
|
250
|
+
|
|
251
|
+
# Compare solutions
|
|
252
|
+
leetcode collab compare
|
|
253
|
+
|
|
254
|
+
# Check session status
|
|
255
|
+
leetcode collab status
|
|
256
|
+
|
|
257
|
+
# Leave session
|
|
258
|
+
leetcode collab leave
|
|
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.
|
|
226
318
|
|
|
227
319
|
### Configuration
|
|
228
320
|
|
|
@@ -307,6 +399,26 @@ Config is stored at `~/.leetcode/config.json`:
|
|
|
307
399
|
|
|
308
400
|
- Node.js >= 20.0.0
|
|
309
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
|
+
|
|
310
422
|
## Docker Usage
|
|
311
423
|
|
|
312
424
|
You can run the CLI using Docker without installing Node.js.
|