lazyleet

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT

README

lazyleet

A lazygit-style terminal UI for practising on LeetCode: browse problems and study plans, then solve them in a side-by-side workspace with a local test runner and one-key submit — in your own editor.

Status: early development. Working now: browse mode (lazyleet) — a sources sidebar, a fuzzy-filterable problem list, study plans with progress, and a live statement preview, all read from a local SQLite cache, and it reopens on whatever source and problem you had selected last time; and the coding workspace — statement + live solution mirror + local Python test runner, plus R run / s submit on LeetCode (with lazyleet auth) and i to import a failing case as a local test.

Building

go build -o dist/lazyleet ./cmd/lazyleet
# or
make build

Requires Go 1.27+. The SQLite driver is pure Go, so no C toolchain is needed.

Usage (so far)

lazyleet sync                 # cache the full problem list + study plans locally
lazyleet                      # browse mode: sidebar · list · preview
                              #   / fuzzy filter · d/f/p filter · S sort · c clear
                              #   tab panes · enter opens workspace · s sync · ? help

lazyleet solve two-sum        # jump straight into the workspace for one problem
lazyleet solve valid-parentheses --lang python3
lazyleet solve two-sum --refresh   # bypass the local cache

lazyleet auth                 # open a browser, sign in; lazyleet reads the
                              #   session over DevTools (no keychain prompt)
lazyleet auth import          # or: reuse cookies from a signed-in browser
lazyleet auth import --browser firefox
lazyleet auth paste           # or: enter LEETCODE_SESSION + csrftoken yourself
lazyleet auth browsers        # list detected browser cookie stores
lazyleet auth status | logout
# auth is only needed for `R` run / `s` submit on LeetCode

lazyleet debug list [--remote]     # cached (or live) problem list
lazyleet debug problem <slug>      # fetch + print one problem's detail
lazyleet debug plan leetcode-75    # print an official or bundled study plan
lazyleet debug paths | debug config
lazyleet --version

Problem data is read from a bundled fixture, then the local SQLite cache, then LeetCode (no login required for public problems; results are cached afterwards).

In the workspace: e edit in $EDITOR · r run local tests · R run on LeetCode · s submit · i import the last failing case · tab switch pane · j/k scroll · z zoom · q back. Saving the solution file (from $EDITOR or any other editor) re-runs the local tests automatically. R/s need lazyleet auth. The workspace lives at $XDG_DATA_HOME/lazyleet/workspace/<id>-<slug>/.

Configuration

config.yml lives in $XDG_CONFIG_HOME/lazyleet/ (default ~/.config/lazyleet/). Data — the SQLite cache, auth file, and problem workspaces — lives in $XDG_DATA_HOME/lazyleet/ (default ~/.local/share/lazyleet/). All keys are optional:

region: com                # com | cn
default_language: python3
editor: ""                 # empty -> $VISUAL, $EDITOR, then vi
theme: default
images: auto                # auto | off | blocks | kitty  (LAZYLEET_IMG overrides)
cache_ttl: 24h
keys: {}                   # semantic action -> key override
workspace:
  tier: auto               # auto | mirror | multiplexer | embedded
  run_on_save: true
  run_debounce_ms: 400

License

TBD.

Directories

Path Synopsis
cmd
lazyleet command
Command lazyleet is a lazygit-style terminal UI for practising on LeetCode: browse problems and study plans, then solve them in a side-by-side workspace with a local test runner and one-key submit.
Command lazyleet is a lazygit-style terminal UI for practising on LeetCode: browse problems and study plans, then solve them in a side-by-side workspace with a local test runner and one-key submit.
internal
browsercookies
Package browsercookies reads cookies for a given site straight out of the local browsers' cookie stores (Chrome, Firefox, Safari, Edge, Brave, Arc, Vivaldi, Opera, …) via the kooky library, so lazyleet can pick up a LeetCode session without the user copying cookies out of DevTools.
Package browsercookies reads cookies for a given site straight out of the local browsers' cookie stores (Chrome, Firefox, Safari, Edge, Brave, Arc, Vivaldi, Opera, …) via the kooky library, so lazyleet can pick up a LeetCode session without the user copying cookies out of DevTools.
browserlogin
Package browserlogin logs in to a site by launching an ordinary Chromium-family browser with a DevTools port open, letting the user sign in (Cloudflare/captcha included), and then reading the resulting cookies over CDP — no OS keychain, no cookie-file decryption.
Package browserlogin logs in to a site by launching an ordinary Chromium-family browser with a DevTools port open, letting the user sign in (Cloudflare/captcha included), and then reading the resulting cookies over CDP — no OS keychain, no cookie-file decryption.
config
Package config resolves lazyleet's on-disk locations and loads/saves the user configuration file.
Package config resolves lazyleet's on-disk locations and loads/saves the user configuration file.
leetcode
Package leetcode is the sole gateway to LeetCode: GraphQL queries, the REST run/submit endpoints, cookie auth, response DTOs, and result polling.
Package leetcode is the sole gateway to LeetCode: GraphQL queries, the REST run/submit endpoints, cookie auth, response DTOs, and result polling.
plans
Package plans provides study-plan definitions that are not official LeetCode study plans, as bundled ordered slug lists compiled into the binary.
Package plans provides study-plan definitions that are not official LeetCode study plans, as bundled ordered slug lists compiled into the binary.
runner
Package runner is the local judge: per-language drivers that wrap the user's solution, parse test-case input, invoke it in a sandboxed subprocess, and compare output.
Package runner is the local judge: per-language drivers that wrap the user's solution, parse test-case input, invoke it in a sandboxed subprocess, and compare output.
store
Package store is lazyleet's local persistence layer: a single SQLite database (pure-Go driver, no CGO) holding the problem cache, problem detail cache, study plans, submission history, and workspace state.
Package store is lazyleet's local persistence layer: a single SQLite database (pure-Go driver, no CGO) holding the problem cache, problem detail cache, study plans, submission history, and workspace state.
termimg
Package termimg renders raster images inline in a terminal.
Package termimg renders raster images inline in a terminal.
testcase
Package testcase defines lazyleet's on-disk test-case format and helpers to read, write, and derive cases.
Package testcase defines lazyleet's on-disk test-case format and helpers to read, write, and derive cases.
tui
Package tui holds the terminal UI: the pure layout solver, panes, the context/focus stack, the keymap and generated shortcut bar, and the theme.
Package tui holds the terminal UI: the pure layout solver, panes, the context/focus stack, the keymap and generated shortcut bar, and the theme.
workspace
Package workspace manages the on-disk problem directories (<frontendID>-<slug>/ with solution, meta, test cases, notes), scaffolding them from LeetCode data and watching the solution file for changes.
Package workspace manages the on-disk problem directories (<frontendID>-<slug>/ with solution, meta, test cases, notes), scaffolding them from LeetCode data and watching the solution file for changes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL