Skip to content

Releases: night-slayer18/leetcode-cli

v3.1.0

01 May 09:38
v3.1.0
2d4900d

Choose a tag to compare

Release Date: 2026-05-01
Focus: LeetCode China (leetcode.cn) Full Support + Credential UX

🌏 LeetCode China Support

  • Full leetcode.cn integration across CLI and TUI.
  • New LeetCodeSite type with site utility helpers (normalizeLeetCodeSiteInput, getLeetCodeSiteLabel).
  • GraphQL query packs split into site-specific files (queries.global.ts, queries.cn.ts) — CN uses the correct native schema for problem list, daily, and problem detail.
  • CN-specific Zod schemas for type-safe response parsing.
  • CN response adapters that normalize China API responses into the shared CLI data model.
  • LeetCodeClient is now fully site-aware: switches base URL, query pack, and cookie headers automatically.
  • Site selection available in login, config, and workspace commands.
  • Site preference persisted per workspace in config file.
  • TUI Config screen: site switching with a mandatory confirmation modal that forces an immediate session logout and redirect to login.

🔐 Credential & Auth UX

  • leetcode login --help now documents all three credential storage backends:
    1. System Keychain (default) — macOS/Windows/Linux OS-native secure storage via keytar.
    2. Encrypted File — AES-256-GCM via LEETCODECLI_CREDENTIAL_BACKEND=file + LEETCODECLI_MASTER_KEY.
    3. Environment Variables — read-only headless mode via LEETCODE_SESSION + LEETCODE_CSRF_TOKEN.
  • TUI site switch now correctly wipes the in-memory session (not just persisted config), ensuring users are immediately signed out and redirected to the login screen.

🧪 Test Stability

  • Mocked versionStorage in update/changelog tests to prevent phantom 999.0.0 update cache leakage into real environments.
  • Mocked outbound got network requests in changelog tests to prevent rate-limit failures in CI.
  • All 283 tests pass cleanly across Node 20/22/24 on Ubuntu and macOS.

What's Changed

Other Changes

  • feat: complete leetcode.cn support for problem list, detail, and id-based lookup by @dong-frank in #10
  • feat: add leetcode.cn support to TUI login flow by @dong-frank in #9
  • feat: LeetCode China full support + credential UX improvements (v3.1.0) by @night-slayer18 in #11

New Contributors

Full Changelog: v3.0.1...v3.1.0

v3.0.1

20 Apr 17:16
v3.0.1
e04e147

Choose a tag to compare

Release Date: 2026-04-20
Focus: Submission Parsing Hotfix + Dependency Security Patch

🐛 Hotfixes

  • Fixed submission-result parsing when LeetCode returns runtime_percentile and memory_percentile as null for non-accepted submissions.
  • Prevented false Submission check failed schema errors and restored expected wrong-answer style output in CLI/TUI submit flows.
  • Added regression coverage for nullable percentile payloads.

🔒 Security

  • Ran npm audit fix and updated transitive dependencies.
  • Resolved reported advisories in the dependency graph (npm audit now reports 0 vulnerabilities).

Full Changelog: v3.0.0...v3.0.1

v3.0.0

10 Mar 16:04
v3.0.0
36f5393

Choose a tag to compare

Release Date: 2026-03-10
Focus: Credential Backend Overhaul (Keychain-First) + Auth Hardening

⚠️ Breaking Changes

  • Credential persistence model is now backend-driven and no longer reads legacy plaintext ~/.leetcode/credentials.json.
  • Existing users with only legacy plaintext credentials must run leetcode login again.
  • Default credential backend is now OS keychain (keytar).

🔐 Security & Auth

  • Added deterministic credential backend resolver:
    • env-readonly mode when LEETCODE_SESSION and LEETCODE_CSRF_TOKEN are both set.
    • keychain backend by default.
    • Explicit encrypted-file backend via LEETCODECLI_CREDENTIAL_BACKEND=file + LEETCODECLI_MASTER_KEY.
  • Added typed auth storage status/reason handling across CLI and TUI:
    • ENV_PARTIAL, KEYCHAIN_UNAVAILABLE, KEYCHAIN_ERROR, FILE_MISSING_MASTER_KEY, FILE_DECRYPT_FAILED, LEGACY_CREDENTIALS_IGNORED.
  • Updated login, logout, whoami, and shared auth checks with consistent remediation messaging.

⚙️ Runtime & Platform

  • Added Linux keychain prerequisites in CI for deterministic native module builds (libsecret-1-dev, pkg-config).
  • Updated Docker image build/runtime dependencies for keytar compatibility in Linux containers.
  • Docker/headless guidance now documents env-readonly auth usage.

🧪 Testing

  • Added dedicated credential-store tests for resolver precedence, reason states, encrypted file read/write, and legacy-ignore behavior.
  • Added CLI and TUI auth tests for env-readonly mode and keychain-unavailable handling.

🔧 Additional Merged Fixes

  • Included merged PR #5:
    • Config file write normalization: config writes now include a trailing newline for POSIX-friendly file formatting.

What's Changed

Other Changes

  • fix(config): add '\n' when writing to config files for POSIX compliance by @greymistcube in #5

Full Changelog: v2.4.1...v3.0.0

v2.4.1

08 Mar 11:07
v2.4.1
5f4245d

Choose a tag to compare

Release Date: 2026-03-08
Focus: TUI Config Editing Hotfix

🐛 Bug Fixes

  • TUI Config Key Hijacking (#3): Fixed an issue where global navigation hotkeys (h, l, tab) would intercept keystrokes while editing a config field in the TUI. For example, typing python3 as the default language would fail because the h key triggered a focus-toggle instead of inserting text. The fix ensures that when a config field is in edit mode (isEditing), text input takes precedence over all interface hotkeys.

What's Changed

Other Changes

  • fix(tui): fixed config editing that wasn't working as intended by @greymistcube in #3

New Contributors

Full Changelog: v2.4.0...v2.4.1

v2.4.0

28 Feb 15:07
v2.4.0
006e7fc

Choose a tag to compare

Release Date: 2026-02-28
Focus: SQL Language Support + Cross-OS CLI E2E Coverage + Sync Security Hardening

🚀 Features

  • Added sql as a first-class supported language for CLI and TUI flows.
  • leetcode config -l sql and leetcode pick ... -l sql are now supported.
  • SQL solution files are generated and recognized with .sql extension.

⚙️ Improvements

  • Centralized language normalization and slug resolution logic in a shared utility.
  • Added SQL dialect resolution fallback (mysql default) for test/submit compatibility.
  • Updated config and help surfaces to display SQL as a supported language.
  • Replaced shell-interpolated command strings in sync with argument-vector execution for dynamic values.
  • Updated git commit -m, git remote add origin, and gh repo create dynamic flows to safer execFileSync(command, args) usage.

🔒 Security

  • Resolves CodeQL alert js/incomplete-sanitization by removing custom shell-escaping dependence for user/config-derived arguments.

🧪 Testing

  • Added dedicated SQL language unit tests for mapping, extension detection, and slug resolution.
  • Added deterministic cross-OS CLI E2E command-flow tests (config/workspace/snapshot/help) running in Linux/macOS/Windows CI matrix.

Full Changelog: v2.3.0...v2.4.0

v2.3.0

11 Feb 17:10
v2.3.0
5d48882

Choose a tag to compare

Release Date: 2026-02-11
Focus: TUI Functionality + Stability + Cross-Platform Fixes

✅ Compatibility

This is a minor, non-breaking release.

  • Existing CLI command signatures are unchanged.
  • Existing problem action shortcuts remain available in TUI (p/t/s/h/H/V/b/n/e).

🚀 Highlights

TUI Functionality (leetcode)

  • Running leetcode (no args, interactive terminal) launches full-screen TUI mode.
  • Problem screen uses a single-column statement layout with a unified bottom drawer for hints, submissions, snapshots, notes, diff, and status/test/submit output.
  • Added focus toggle (Tab) between statement body and drawer, with j/k and arrows scrolling the focused region.
  • Action shortcuts are available in problem view: p/t/s/h/H/V/b/n/e.
  • Close behavior is consistent: Esc closes drawer first, then navigates back.
  • Rendering and terminal handling include full-screen redraw and cleanup guards (ANSI reset, cursor/raw-mode restoration) to reduce residue/flicker issues.

Cross-Platform Sync Fixes

  • Fixed sync repository-name extraction on Windows by using path.basename() instead of Unix-style path splitting.
  • Updated shell argument escaping to use double quotes for better cross-platform behavior.

🧪 Quality

  • Added dedicated TUI tests for problem-screen drawer routing and state transitions.
  • Verified with npm run typecheck, npm run test, and npm run build.

What's Changed

Other Changes

  • fix(sync): fixed the issue of commiting in windows by @g7vind in #1

New Contributors

  • @g7vind made their first contribution in #1

Full Changelog: v2.2.2...v2.3.0

v2.2.2

18 Jan 05:29
v2.2.2
e42eaa7

Choose a tag to compare

Release Date: 2026-01-18
Focus: Critical Bug Fix (Update Command)

🐛 Bug Fixes

  • Update Command: Fixed a logic inversion where leetcode update would incorrectly report "You're on the latest version" even when updates were available. It now correctly prompts for updates.

v2.2.1

17 Jan 11:22
v2.2.1
34d4f57

Choose a tag to compare

Release Date: 2026-01-17
Focus: Security Hotfix & CI/CD Enhancements

🔒 Security Fixes

  • HTML Injection: Fixed vulnerabilities in problem descriptions, hints, and code templates by replacing regex-based sanitization with striptags (#security).
  • Double Escaping: Fixed issue where HTML entities (like ") could be double-unescaped (#security).
  • Dependencies: Updated CodeQL actions to v4 and added Dependency Review workflow.

🔧 Improvements

  • CI/CD: Added Stale issue management and optimized Docker builds with caching.
  • Linting: Resolved all ESLint warnings and enforced stricter type safety.

v2.2.0

17 Jan 07:43
v2.2.0
de74da7

Choose a tag to compare

Release Date: 2026-01-17
Focus: Problem Hints & Performance

🚀 New Features

Hint Command (leetcode hint)

Get hints for a problem when you're stuck.

  • leetcode hint <id> - Show hints one at a time (press Enter for next)
  • leetcode hint <id> --all - Show all hints at once
  • Supports both problem ID and slug
  • Cleans HTML formatting for terminal display
  • Alias: h

⚡ Performance Improvements

Submission Polling Optimization

  • Exponential backoff: Reduced API calls by 60% (30 → 12 calls)
  • Faster results: 500ms initial delay for quicker feedback
  • Network resilience: Added retry logic for transient network errors
  • Better error messages: "Test" vs "Submission" context in timeouts

v2.1.1

16 Jan 18:44
v2.1.1
70f7b91

Choose a tag to compare

Release Date: 2026-01-17
Focus: Refactoring & Robustness

🔧 Improvements

  • Code Refactoring: Extracted shared semver utility for consistent version comparison
  • Improved Parsing: Enhanced changelog parser regex to handle various version formats
  • Robustness: Integration tests now verify against real npm/GitHub APIs
  • Network Reliability: Fixed potential hangs by enforcing strict 10s total timeout for registry checks