MCPcopy Index your code
hub / github.com/clearloop/leetcode-cli

github.com/clearloop/leetcode-cli @v0.5.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.4 ↗ · + Follow
161 symbols 277 edges 29 files 69 documented · 43%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

leetcode-cli

Rust crate doc downloads telegram LICENSE

May the code be with you.

Install

# Linux build deps: system SQLite + OpenSSL headers + pkg-config
#   (Debian/Ubuntu: libsqlite3-dev libssl-dev pkg-config). macOS ships both.
cargo install leetcode-cli

Python filtering scripts (the --plan flag) require the optional pym feature:

cargo install leetcode-cli --features pym

Nix users can nix build / nix develop against the bundled flake.nix.

Quickstart

Sign in to LeetCode in Chrome first — on macOS and Linux leetcode-cli reads its cookies automatically (on Windows, set them manually). See Cookies for manual setup and environment-variable overrides.

leetcode pick 1        # pick a problem and print its description
leetcode edit 1        # open the solution file in your editor
leetcode test 1        # run the sample test cases
leetcode exec 1        # submit the solution

Run leetcode --help (or leetcode <command> --help) for the full, always-current list of commands and flags. The headline ones:

Command Alias What it does
pick p Pick a problem by id, --name, --tag, --query, --plan, or --daily
edit e Open a problem's code file; --lang overrides the configured language, --daily opens today's challenge
test t Run test cases; --watch re-runs on save, --daily targets today's challenge
exec x Submit the solution
list l List/filter problems by category, tag, id range, or --query
stat s Show a chart of your submissions
data d Manage the local cache (--update, --delete)
completions c Generate shell completions (bash, elvish, fish, powershell, zsh)

Shell completions

By default the shell is inferred from $SHELL:

eval "$(leetcode completions)"

Copy that line into .bash_profile or .zshrc. Pass a shell explicitly to target another:

leetcode completions fish

Documentation

  • Configuration — the full leetcode.toml reference: editor, code generation, filename templates, and storage paths.
  • Cookies — automatic Chrome cookies, manual setup from any browser, leetcode.cn support, and environment-variable overrides.
  • Editors & LSP — getting rust-analyzer (and other language servers) working with generated solution files.
  • Scripting — filtering problems with custom Python plans.

Contributing

Feel free to add your name and email to the authors field of Cargo.toml, and open a pull request.

License

MIT

Extension points exported contracts — how you extend this code

Digit (Interface)
Abstract Digit trait, fill the empty space to specific length. [3 implementers]
src/helper.rs
Formatter (Interface)
Formatter for str [1 implementers]
src/cache/models.rs
HTML (Interface)
Html render plugin [1 implementers]
src/helper.rs

Core symbols most depended-on inside this repo

conn
called by 9
src/cache/mod.rs
run
called by 8
src/cmd/stat.rs
send
called by 7
src/plugins/leetcode.rs
cache
called by 5
src/config/storage.rs
squash
called by 4
src/helper.rs
get_problem
called by 4
src/cache/mod.rs
get_daily_problem_id
called by 4
src/cache/mod.rs
get_problems
called by 4
src/cache/mod.rs

Shape

Method 72
Function 44
Class 37
Enum 5
Interface 3

Languages

Rust100%

Modules by API surface

src/cache/models.rs23 symbols
src/cache/mod.rs22 symbols
src/plugins/leetcode.rs13 symbols
src/helper.rs12 symbols
src/config/sys.rs11 symbols
tests/de.rs10 symbols
src/plugins/chrome.rs10 symbols
src/cache/parser.rs10 symbols
src/config/storage.rs6 symbols
src/config/cookies.rs6 symbols
src/config/code.rs6 symbols
src/config/mod.rs5 symbols

For agents

$ claude mcp add leetcode-cli \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact