A powerful command-line tool that lets you manage your LeetCode practice progress within your local IDE, featuring built-in spaced repetition learning, progress tracking, and Git integration. Additionally, it integrates a large language model (LLM) to boost your practice efficiency by automatically generating solutions, debugging test cases, and visualizing your weak areas.
-
🎯 Problem Management
- Add new problems with auto-generated templates
- Submit solutions with comprehensive metadata
- Track practice history and performance
- Auto-archive previous solutions
-
📊 Progress Tracking
- Visual practice heatmap
- Learning streaks
- Weekly goals
- Practice statistics click here to view the statistics page introduction
-
🧠 Spaced Repetition
- Smart review scheduling based on the Ebbinghaus Forgetting Curve
- Review reminders for optimal learning
- Retention rate tracking
- Customized review intervals: 1, 3, 7, 14, 30, 90, 180 days
-
🔄 Git Integration
- Automatic commits with detailed metadata
- Structured commit messages
- Practice history preservation
-
🤖 AI Integration
- Multiple AI providers supported:
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude)
- DeepSeek
- Smart solution templates
- Test case generation
- Code analysis
- Multiple AI providers supported:
Before installing leego, you need to have Bun.js installed on your system:
# For macOS, Linux, and WSL
curl -fsSL https://bun.sh/install | bash
# Verify installation
bun --version
For more installation options and troubleshooting, visit bun.sh.
npm install -g leego
- Set up your workspace:
# Initialize the workspace
leego setup
# Configure LeetCode authentication
leego set-cookies
# Set AI provider (optional)
leego set-ai-key
- Start practicing:
# Add a new problem
leego add
# Start practicing a problem
leego start <problem-number>
# Submit your solution
leego submit <problem-number>
- Track your progress:
# View practice statistics
leego stats
# Set weekly goals
leego set-goals
- Open Chrome/Edge and go to leetcode.com
- Log in to your LeetCode account
- Open DevTools:
- Press
F12
or - Right-click anywhere and select "Inspect"
- Press
- In DevTools:
- Select the "Network" tab
- Check "XHR" filter
- Click any button on leetcode.com (e.g., click your profile)
- In the Network panel:
- Click any request to leetcode.com
- In the request details, find "Headers" tab
- Scroll to find "Cookie:" under "Request Headers"
- Copy the entire cookie string (starts with
cf_clearance=
or__cfduid=
and ends with_gat=1
)
- Set the cookies in leego:
leego set-cookies
- Paste the copied cookie string when prompted
The tool will verify the cookies work before saving them.
-
leego add [problem-number]
- Add a new LeetCode problem
- Auto-generates solution template and test files
- Organizes problems by type
- Uses AI for template generation (if configured)
-
leego start <problem-number>
- Start practicing a problem
- Initializes test environment
- Archives previous attempts
- Starts test watch mode
-
leego submit <problem-number>
- Submit your solution
- Runs tests
- Records practice metadata
- Updates learning progress
- Creates Git commit
-
leego stats
- Opens statistics dashboard in browser
- Shows practice heatmap
- Displays learning progress
- Shows review schedule
-
leego set-goals
- Set weekly practice goals
- Track completion rate
- View historical performance
-
🤖 Large Language Model Support
- Multiple LLM providers:
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude)
- DeepSeek
- Custom LLM implementations:
- Local models (e.g., llama.cpp, ggml)
- Self-hosted services
- Alternative providers
- Custom API endpoints
- Intelligent code generation:
- Solution templates
- Test cases
- Code analysis
- Complexity analysis
- Multiple LLM providers:
You can integrate your own LLM implementation by:
- Creating
.leetcode/llm.ts
in your workspace - Implementing the
generateWithAI
function:
export async function generateWithAI(prompt: string): Promise<string> {
try {
// Implement your custom LLM logic here
// Examples:
// - Call local models (llama.cpp, ggml)
// - Use self-hosted services
// - Connect to alternative AI providers
// - Call custom API endpoints
return 'Generated response';
} catch (error) {
throw new Error(`Custom LLM error: ${error.message}`);
}
}
workspace/
├── 01-arrays-hashing/ # Problem categories
├── 02-two-pointers/
├── 03-sliding-window/
├── ...
└── problem-folder/
├── index.ts # Solution implementation
├── index.test.ts # Test cases
├── README.md # Problem description
└── .meta/
├── metadata.json # Practice metadata
├── template.ts # Original template
└── archives/ # Previous solutions
The tool tracks comprehensive metadata for each problem:
- Practice history
- Time spent
- Approach used
- Complexity analysis
- Test results
- Review schedule
- Retention rates
Automatic commits include:
solve(0011M): Container With Most Water [Medium]
Status: passed
Time Spent: 30m
Approach: Two Pointers
Time Complexity: O(n)
Space Complexity: O(1)
Timestamp: 24-01-27 15:30:45
The tool implements a spaced repetition system based on the Ebbinghaus Forgetting Curve:
- Review intervals: 1, 3, 7, 14, 30, 90, 180 days
- Retention rate calculation based on:
- Time since last review
- Number of practice attempts
- Problem difficulty
- Smart scheduling based on performance
- Visual retention indicators
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - see LICENSE file for details