| Crates.io | leetcli |
| lib.rs | leetcli |
| version | 0.1.6 |
| created_at | 2025-08-17 09:32:38.568337+00 |
| updated_at | 2025-08-17 17:52:00.445632+00 |
| description | A CLI tool that generates random LeetCode problems with skeleton code using AI |
| homepage | https://github.com/surajssc1232/leetcli |
| repository | https://github.com/surajssc1232/leetcli |
| max_upload_size | |
| id | 1799271 |
| size | 105,295 |
A CLI tool that generates random LeetCode problems with skeleton code in your preferred programming language.
problems/ directoryGet a Gemini API key from Google AI Studio
Build and run:
cargo build --release
cargo run
The tool will ask for your Gemini API key on first run and save it securely in ~/.leetcli_api_key for future use.
You can also set it as an environment variable to skip the prompt entirely:
export GEMINI_API_KEY="your-api-key-here"
leetcli
On first run, you'll be prompted to select a default difficulty level which will be saved for future use.
leetcli -d
Shows a dropdown menu to select difficulty level and updates your saved preference.
leetcli --difficulty hard
leetcli -d easy
Sets difficulty directly and updates your saved preference.
leetcli --model gemini-1.5-pro-latest --difficulty hard
leetcli -m gemini-2.0-flash-exp -d easy
leetcli --list-models
leetcli --list-difficulties
leetcli --help
gemini-2.5-flash-lite (default) - Fastest model, good for quick problem generationgemini-2.0-flash-exp - Experimental fast model with latest featuresgemini-1.5-flash-latest - Stable fast model, reliable performancegemini-1.5-pro-latest - More capable but slower, better for complex problemsgemini-pro - Older stable modeleasy - Simple problems with basic algorithms and data structuresmedium - Moderate complexity with common algorithmshard - Complex problems with advanced algorithms and optimizationThe tool saves your preferences locally:
~/.leetcli_api_key~/.leetcli_difficultyPreferences are automatically updated when you use command line arguments.
The tool checks for your API key in this order:
GEMINI_API_KEY environment variable~/.leetcli_api_key)$ leetcli
>> LeetCli - Generate LeetCode Problems
[!] No difficulty preference found
? Select default difficulty level: › medium
[+] Difficulty preference saved: medium
Using model: gemini-2.5-flash-lite
Difficulty: medium
[✓] Using saved Gemini API key
? Select a topic: › Arrays
? Select programming language: › Rust
Generating Arrays problem for Rust...
[✓] Problem generated: problems/two_sum.rs
$ leetcli
>> LeetCli - Generate LeetCode Problems
Using model: gemini-2.5-flash-lite
Difficulty: medium
[✓] Using saved Gemini API key
? Select a topic: › Dynamic Programming
? Select programming language: › Python
Generating Dynamic Programming problem for Python...
[✓] Problem generated: problems/coin_change.py
$ leetcli -d
>> LeetCli - Generate LeetCode Problems
? Select difficulty level: › hard
[+] Difficulty preference saved: hard
Using model: gemini-2.5-flash-lite
Difficulty: hard
Generated files include:
leetcli [OPTIONS]
Options:
-m, --model <MODEL> Gemini model to use [default: gemini-2.5-flash-lite]
-d, --difficulty [LEVEL] Problem difficulty level (interactive if no value)
--list-models Show available models
--list-difficulties Show available difficulty levels
-h, --help Print help
-V, --version Print version
# Generate problem with saved preferences
leetcli
# First time setup - will ask for difficulty preference
leetcli # Shows difficulty selection dropdown
# Interactive difficulty selection
leetcli -d # Shows dropdown to select and save new difficulty
# Direct difficulty setting
leetcli -d easy # Sets to easy and saves preference
leetcli --difficulty hard # Sets to hard and saves preference
# Generate easy problem with fast model
leetcli -d easy -m gemini-2.5-flash-lite
# Generate hard problem with pro model
leetcli --difficulty hard --model gemini-1.5-pro-latest
# List all available options
leetcli --list-models
leetcli --list-difficulties