Skip to content

shadowmkj/leetrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 leetrs

Rust Crates.io License: MIT Status Neovim

leetrs is a blazing-fast, Rust-powered CLI engine that makes solving LeetCode problems from the terminal a first-class developer experience.

Built specifically for developers who live in the terminal and rely on Neovim, leetrs strips away the distraction of the browser. It handles intelligent authentication, Markdown problem generation, native editor window splitting, and asynchronous code submission without ever leaving your workflow.

leetrs.mp4

✨ Features

  • Intelligent Authentication (leetrs auth)
    • Automatically extracts LEETCODE_SESSION and csrftoken cookies from your active Chrome or Firefox sessions.
    • Secure, hidden manual fallback for containerized browser profiles.
  • Frictionless Problem Fetching (leetrs pick)
    • Fetch problems using their URL slug (e.g., two-sum) or standard numerical ID (e.g., 1).
    • Automatically parses LeetCode's raw HTML into clean, readable Markdown.
    • Generates idiomatic snake_case.rs files containing the exact boilerplate required.
  • Native Neovim Integration
    • Instantly hijacks the terminal process to launch Neovim.
    • Forces a clean vertical split (vsplit) to place your problem description and code side-by-side, bypassing layout quirks from custom dashboards.
  • Async Submission Engine (leetrs submit)
    • Submit your local file directly to LeetCode's execution servers.
    • Automatic ID resolution and CSRF token bypass.
    • Color-coded terminal output for execution results, including Runtime/Memory statistics and detailed compiler error logs.

🛠️ Installation

Choose the method that best fits your setup.

Option 1 — cargo install (Recommended for Rust users)

Requires Rust & Cargo to be installed.

cargo install leetrs

The binary will be placed in ~/.cargo/bin/. Make sure that directory is in your $PATH.


Option 2 — Homebrew (macOS & Linux)

brew install shadowmkj/tap/leetrs

Note: If the tap isn't published yet, use one of the other methods below while it is being set up.


Option 3 — curl Installer (Quickstart, no Rust required)

The installer script downloads the appropriate pre-built binary for your platform and places it in /usr/local/bin.

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/shadowmkj/leetrs/releases/download/v1.0.18/leetrs-installer.sh | sh

Option 4 — Build from Source

Use this if you want to contribute, run unreleased features, or modify the code yourself.

Prerequisites

Steps

# 1. Clone the repository
git clone https://github.com/shadowmkj/leetrs.git
cd leetrs

# 2. Build the optimised release binary
cargo build --release

# 3. Move the binary somewhere on your PATH
cp target/release/leetrs ~/.cargo/bin/
# — or —
sudo cp target/release/leetrs /usr/local/bin/

Verify the installation:

leetrs --version

⚡ Quick Start

# 1. Authenticate with your LeetCode session
leetrs auth

# 2. Pick a problem (by slug or numeric ID)
leetrs pick two-sum
leetrs pick 1

# 3. Open it in Neovim — the problem description opens in a vertical split automatically

# 4. Solve it, then submit
leetrs submit two_sum.rs

🔧 Prerequisites (all methods)

Requirement Version Notes
Neovim 0.9+ Must be available as nvim in $PATH
LeetCode account Required for auth & submission
Chrome or Firefox Any Used for automatic cookie extraction

🤝 Contributing

See CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, and submitting pull requests.


📄 License

MIT © shadowmkj

About

leetrs is a blazing-fast, Rust-powered CLI and engine designed to make solving LeetCode problems from the terminal a first-class developer experience.

Topics

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Languages