Skip to content

feat: complete leetcode.cn support for problem list, detail, and id-based lookup#10

Merged
night-slayer18 merged 2 commits into
night-slayer18:devfrom
dong-frank:feat/leetcode.cn
Apr 21, 2026
Merged

feat: complete leetcode.cn support for problem list, detail, and id-based lookup#10
night-slayer18 merged 2 commits into
night-slayer18:devfrom
dong-frank:feat/leetcode.cn

Conversation

@dong-frank
Copy link
Copy Markdown
Contributor

Background

This branch already supports basic site switching, but LeetCode CN uses a different schema from LeetCode Global for problem list and problem detail queries.
As a result, commands such as list, show, hint, pick had compatibility gaps under leetcode.cn.

This PR fills those gaps and ensures the command layer receives a normalized, consistent data model.

What Changed( Coding with Codex)

  1. Added dedicated GraphQL queries for leetcode.cn (problem list and problem detail).
  2. Added CN-specific Zod schema validation for list/detail responses.
  3. Extended CN adapters to normalize list/detail payloads into the common internal model.
  4. Updated client logic to handle CN-specific branches:
  5. Problem list now uses CN query + CN schema + CN normalization.
  6. Problem detail now uses CN query + CN schema + CN normalization.
  7. ID-based lookup in CN now paginates list search by frontend ID, then fetches detail by slug.
  8. Improved status normalization for CN-specific values (for example: tried, not_started).

And I tested

  • npm run start -- list
  • npm run start -- show 1
  • npm run start -- hint 1
  • npm run start -- pick 1
  • npm run start Open the tui and successfully get the same problem list.

@night-slayer18 night-slayer18 merged commit 46893c4 into night-slayer18:dev Apr 21, 2026
12 checks passed
@dong-frank dong-frank deleted the feat/leetcode.cn branch April 21, 2026 15:31
@dong-frank dong-frank restored the feat/leetcode.cn branch April 21, 2026 15:31
@dong-frank dong-frank deleted the feat/leetcode.cn branch April 21, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants