@night-slayer18/leetcode-cli 2.4.1 → 3.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.
Files changed (3) hide show
  1. package/README.md +24 -19
  2. package/dist/index.js +111 -101
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -410,32 +410,37 @@ leetcode/
410
410
 
411
411
  ## Authentication
412
412
 
413
- This CLI uses cookie-based authentication. To login:
413
+ This CLI uses cookie-based authentication from your LeetCode browser session.
414
414
 
415
415
  1. Open [leetcode.com](https://leetcode.com) in your browser
416
416
  2. Login to your account
417
417
  3. Open DevTools (F12) → Application → Cookies → leetcode.com
418
418
  4. Run `leetcode login` and paste your `LEETCODE_SESSION` and `csrftoken` values
419
419
 
420
- ## Configuration File
421
-
422
- Config is stored at `~/.leetcode/config.json`:
423
-
424
- ```json
425
- {
426
- "credentials": {
427
- "session": "...",
428
- "csrfToken": "..."
429
- },
430
- "config": {
431
- "language": "java",
432
- "editor": "code",
433
- "workDir": "/path/to/leetcode",
434
- "repo": "https://github.com/username/leetcode-solutions.git"
435
- }
436
- }
420
+ ### Credential Backend
421
+
422
+ - Default backend: system keychain (`keytar`)
423
+ - Explicit encrypted-file backend: set `LEETCODECLI_CREDENTIAL_BACKEND=file`
424
+ - File backend requires `LEETCODECLI_MASTER_KEY`
425
+ - Env read-only mode: set both `LEETCODE_SESSION` and `LEETCODE_CSRF_TOKEN`
426
+
427
+ If both env vars are present, the CLI uses them directly and `login/logout` run in read-only env mode.
428
+
429
+ Windows (PowerShell) quick setup:
430
+
431
+ ```powershell
432
+ $env:LEETCODECLI_CREDENTIAL_BACKEND = "keychain"
433
+ # or encrypted file backend:
434
+ # $env:LEETCODECLI_CREDENTIAL_BACKEND = "file"
435
+ # $env:LEETCODECLI_MASTER_KEY = "<your_master_key>"
437
436
  ```
438
437
 
438
+ ### Config File
439
+
440
+ Workspace config is stored at:
441
+
442
+ - `~/.leetcode/workspaces/<name>/config.json`
443
+
439
444
  ## Requirements
440
445
 
441
446
  - Node.js >= 20.0.0
@@ -532,7 +537,7 @@ You can run the CLI using Docker without installing Node.js.
532
537
  -v "$HOME/.leetcode:/root/.leetcode" \
533
538
  leetcode-cli list
534
539
  ```
535
- _Note: We mount `~/.leetcode` to persist login credentials and `leetcode` folder to save solution files._
540
+ _Note: We mount `~/.leetcode` to persist CLI data (workspace config, snapshots, optional file-backend credentials) and `leetcode` folder to save solution files._
536
541
 
537
542
  ## License
538
543