feat: LeetCode China full support + credential UX improvements (v3.1.0)#11
Merged
Conversation
- Add LeetCodeSite type ('leetcode.com' | 'leetcode.cn') to types.ts
- Add optional site field to UserConfig interface
- Create src/utils/site.ts with site constants, alias map,
normalization, and label helpers
- Default site is leetcode.com for backward compatibility
Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Create queries.global.ts with existing leetcode.com queries and QueryPack interface - Create queries.cn.ts with CN-specific queries for daily challenge (todayRecord), user profile, and skill stats - Create query-resolver.ts to select the correct QueryPack based on configured LeetCodeSite - Reduce queries.ts to backward-compatible re-exports Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Add CnDailyChallengeSchema for todayRecord response shape - Add CnUserProfileSchema for userProfilePublicProfile and userProfileUserQuestionProgress response shapes - Add CnSkillStatsSchema for skillSet topicAreaScores shape - All CN schemas use lenient optional fields to handle evolving API responses gracefully Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Create adapters/cn.ts with normalization functions:
- normalizeCnDailyChallenge: maps todayRecord[0] to DailyChallenge
- normalizeCnUserProfile: maps split CN profile queries to
unified profile shape
- normalizeCnSkillStats: maps topicAreaScores into
fundamental/intermediate/advanced buckets
- Create adapters/index.ts barrel export
Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Accept LeetCodeSite in constructor, default to leetcode.com - Add setSite()/getSite() for runtime site switching - Use QueryPack from query-resolver for all GraphQL operations - Add GraphQLOperation type with labeled error messages - Add multi-endpoint fallback for CN submissions (noj-go) - Add CN-specific schema mismatch error detection with helpful recovery message - Wire CN adapters for daily challenge, user profile, and skill stats normalization Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Add site field to WorkspaceConfig interface - Add getSite()/setSite() to config storage module - Default new workspaces to leetcode.com - Site selection is per-workspace for isolation Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Add configureLeetCodeClientSite() helper that reads site from config and calls setSite() on the singleton client - Call it in validateSession, requireAuth, setupClientIfLoggedIn, and getCurrentUsername to ensure correct site before API calls Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- login: add site picker prompt before cookie input, show domain-specific instructions, persist selection - config: add --site flag and interactive site selection, display site in config output - workspace: show site in workspace list and current output, default new workspaces to leetcode.com - index: add --site option to config command help text Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Add site option to config screen with validation - Wire configureLeetCodeClientSite in executeCommand entry - Handle site saves in saveConfig effect - Show site example hint in config detail view Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Add cn-adapter.test.ts covering daily challenge, user profile, and skill stats normalization - Add query-resolver.test.ts verifying correct pack selection - Update mock client with setSite method - Update auth, config, and integration tests with site mocks - Add site config assertion to e2e cross-OS tests Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- README: add site support section with config examples - commands.md: document --site flag and login site picker - config.md: add site to config table and setup steps - index.md: add site-aware API support to features list - testing.md: note site selection in e2e test coverage Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
- Add dev to push and pull_request branch triggers in ci.yml - Add dev to push and pull_request branch triggers in codeql.yml Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
feat: complete leetcode.cn support for problem list, detail, and id-based lookup
…fety - Add interactive confirmation prompt before clearing credentials when switching sites in CLI and TUI - Skip interactive prompts and auto-update background checks in non-TTY environments - Mock got network requests in update and changelog command tests to prevent rate limit failures Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
…ssion clear on TUI site switch Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR merges the
devbranch intomainfor the v3.1.0 release.What's Included
🌏 LeetCode China (leetcode.cn)
login,config, andworkspacecommands🔐 Credential UX
leetcode login --helpexplains all 3 backends: Keychain, Encrypted File, Env Vars🧪 Tests
versionStorageand network mocks added to prevent CI flakinessCommits Since v3.0.1
3552cafchore(release): prepare v3.1.0286dd03fix(docs/tui): add auth backend details to CLI help & force active session clear on TUI site switchc22ff26fix: ensure credential clearance on site switch & improve CLI test safety46893c4Merge pull request feat: complete leetcode.cn support for problem list, detail, and id-based lookup #10 from dong-frank/feat/leetcode.cnde623e0feat: add support for 'list' and other commands for leetcode.cnf9e6d4cfeat: add support for leetcode.cn in tui84f91baci: run CI and CodeQL workflows on dev branchd85689adocs: document leetcode.cn site support8d8bc72test: add tests for CN adapters, query resolver, and site-aware mocks46ecab5feat: add site support to TUI config and effectsee94495feat: add site selection to login, config, and workspace commands4e9cb7cfeat: configure client site from workspace config on auth3f5e15cfeat: persist site selection in workspace config09822e4feat: make LeetCodeClient site-awareecceb06feat: add CN response adapters for data normalizationc47f8c6feat: add Zod schemas for leetcode.cn API responsesa5aec84feat: split GraphQL queries into site-specific packsb855ad8feat: add LeetCodeSite type and site utility helpers