Releases: night-slayer18/leetcode-cli
v3.1.0
Release Date: 2026-05-01
Focus: LeetCode China (leetcode.cn) Full Support + Credential UX
🌏 LeetCode China Support
- Full
leetcode.cnintegration across CLI and TUI. - New
LeetCodeSitetype 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.
LeetCodeClientis now fully site-aware: switches base URL, query pack, and cookie headers automatically.- Site selection available in
login,config, andworkspacecommands. - 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 --helpnow documents all three credential storage backends:- System Keychain (default) — macOS/Windows/Linux OS-native secure storage via
keytar. - Encrypted File — AES-256-GCM via
LEETCODECLI_CREDENTIAL_BACKEND=file+LEETCODECLI_MASTER_KEY. - Environment Variables — read-only headless mode via
LEETCODE_SESSION+LEETCODE_CSRF_TOKEN.
- System Keychain (default) — macOS/Windows/Linux OS-native secure storage via
- 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
versionStoragein update/changelog tests to prevent phantom999.0.0update cache leakage into real environments. - Mocked outbound
gotnetwork 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
- @dong-frank made their first contribution in #10
- @night-slayer18 made their first contribution in #11
Full Changelog: v3.0.1...v3.1.0
v3.0.1
Release Date: 2026-04-20
Focus: Submission Parsing Hotfix + Dependency Security Patch
🐛 Hotfixes
- Fixed submission-result parsing when LeetCode returns
runtime_percentileandmemory_percentileasnullfor non-accepted submissions. - Prevented false
Submission check failedschema errors and restored expected wrong-answer style output in CLI/TUI submit flows. - Added regression coverage for nullable percentile payloads.
🔒 Security
- Ran
npm audit fixand updated transitive dependencies. - Resolved reported advisories in the dependency graph (
npm auditnow reports0 vulnerabilities).
Full Changelog: v3.0.0...v3.0.1
v3.0.0
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 loginagain. - Default credential backend is now OS keychain (
keytar).
🔐 Security & Auth
- Added deterministic credential backend resolver:
env-readonlymode whenLEETCODE_SESSIONandLEETCODE_CSRF_TOKENare both set.keychainbackend 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:
configwrites now include a trailing newline for POSIX-friendly file formatting.
- Config file write normalization:
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
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, typingpython3as the default language would fail because thehkey 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
- @greymistcube made their first contribution in #3
Full Changelog: v2.4.0...v2.4.1
v2.4.0
Release Date: 2026-02-28
Focus: SQL Language Support + Cross-OS CLI E2E Coverage + Sync Security Hardening
🚀 Features
- Added
sqlas a first-class supported language for CLI and TUI flows. leetcode config -l sqlandleetcode pick ... -l sqlare now supported.- SQL solution files are generated and recognized with
.sqlextension.
⚙️ Improvements
- Centralized language normalization and slug resolution logic in a shared utility.
- Added SQL dialect resolution fallback (
mysqldefault) for test/submit compatibility. - Updated config and help surfaces to display SQL as a supported language.
- Replaced shell-interpolated command strings in
syncwith argument-vector execution for dynamic values. - Updated
git commit -m,git remote add origin, andgh repo createdynamic flows to saferexecFileSync(command, args)usage.
🔒 Security
- Resolves CodeQL alert
js/incomplete-sanitizationby 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
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, withj/kand 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:
Esccloses 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
syncrepository-name extraction on Windows by usingpath.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, andnpm run build.
What's Changed
Other Changes
New Contributors
Full Changelog: v2.2.2...v2.3.0
v2.2.2
Release Date: 2026-01-18
Focus: Critical Bug Fix (Update Command)
🐛 Bug Fixes
- Update Command: Fixed a logic inversion where
leetcode updatewould incorrectly report "You're on the latest version" even when updates were available. It now correctly prompts for updates.
v2.2.1
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
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
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