https://github.com/charliesbot/leetkick
A modern TypeScript CLI tool for scaffolding LeetCode exercises with language-specific testing setups.
https://github.com/charliesbot/leetkick
cli leetcode
Last synced: 2 months ago
JSON representation
A modern TypeScript CLI tool for scaffolding LeetCode exercises with language-specific testing setups.
- Host: GitHub
- URL: https://github.com/charliesbot/leetkick
- Owner: charliesbot
- Created: 2025-07-21T01:01:09.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-24T01:02:45.000Z (10 months ago)
- Last Synced: 2025-10-04T10:38:21.811Z (8 months ago)
- Topics: cli, leetcode
- Language: TypeScript
- Homepage:
- Size: 276 KB
- Stars: 65
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LeetKick
A modern CLI tool for scaffolding LeetCode exercises with language-specific testing setups. Fetch problems, auto-generate boilerplate, and start coding immediately!
> **🚧 Heads up!**
> LeetKick is still pretty new and changing fast. Things might break between updates as I add support for more programming languages. Once it hits v1.0, it'll be much more stable!
## Features
- **Fetch problems directly from LeetCode** - no copy/paste needed
- **Auto-scaffolding** - solution + test files generated instantly
- **Clean organization** - problems organized by language and number
- **Zero-config testing** - just run `leetkick test` from anywhere
- **Smart problem matching** - run tests by number, slug, or name
- **Multi-language support** - 8 languages supported, 10+ planned (goal: all LeetCode languages)
## Quick Start
```bash
# Setup once
leetkick init my-practice && cd my-practice
leetkick add python # or typescript, javascript, go, rust, kotlin, java, cpp
# Use daily
leetkick fetch two-sum --language python # Auto-generates solution + test files
leetkick test two-sum --language python # Run tests instantly
```
**What you get:** Ready-to-code files with problem description, starter code, and test setup. No configuration needed!
## Installation
**Prerequisites:** Node.js 18+
```bash
# Install from npm (recommended)
npm install -g leetkick
# Or build from source
git clone https://github.com/charliesbot/leetkick.git
cd leetkick && npm install && npm run compile && npm link
# Verify installation
leetkick --help
```
## Language Support
Our goal is to support all languages that LeetCode offers. Here's our current progress:
| Language | Status | Testing Framework | Formatter | Linter | Notes |
| -------------- | ---------------- | ----------------- | ------------ | ------ | ------------------------------- |
| **TypeScript** | ✅ **Supported** | Vitest | Biome | Biome | Full support with type checking |
| **C++** | ✅ **Supported** | Catch2 (bundled) | clang-format | — | C++17 standard |
| **Kotlin** | ✅ **Supported** | JUnit 5 + Gradle | — | — | Full Gradle integration |
| **Java** | ✅ **Supported** | JUnit 5 + Gradle | — | — | Full Gradle integration |
| **Go** | ✅ **Supported** | Built-in testing | — | — | Go 1.21+ with modules |
| **Rust** | ✅ **Supported** | cargo test | — | — | Rust 2021 edition |
| **Python** | ✅ **Supported** | pytest | ruff | ruff | Python 3.8+ with modern tooling |
| **JavaScript** | ✅ **Supported** | Vitest | Biome | Biome | ES Modules with modern tooling |
| **C** | 🚧 **Planned** | — | — | — | Coming soon |
| **C#** | 🚧 **Planned** | — | — | — | Coming soon |
| **Ruby** | 🚧 **Planned** | — | — | — | Coming soon |
| **Swift** | 🚧 **Planned** | — | — | — | Coming soon |
| **Scala** | 🚧 **Planned** | — | — | — | Coming soon |
| **PHP** | 🚧 **Planned** | — | — | — | Coming soon |
| **Dart** | 🚧 **Planned** | — | — | — | Coming soon |
**Legend:**
- ✅ **Supported** - Full integration with templates, testing, and tooling
- 🚧 **Planned** - On our roadmap, contributions welcome!
Each supported language workspace includes setup instructions, prerequisites, and testing guides in its own README.
## Command Reference
| Command | Purpose | Example |
| ----------------------------------- | -------------------- | ---------------------------------------------- |
| `init [dir]` | Create workspace | `leetkick init my-practice` |
| `add ` | Add language support | `leetkick add javascript` |
| `fetch --language ` | Get LeetCode problem | `leetkick fetch two-sum --language javascript` |
| `test --language ` | Run tests | `leetkick test 1 --language javascript` |
| `sync [lang]` | Update config files | `leetkick sync --all --dry-run` |
| `help [cmd]` | Show help | `leetkick help fetch` |
### Advanced Features
**Smart Problem Matching**
```bash
leetkick test 1 --language javascript # By number
leetkick test two-sum --language javascript # By slug
leetkick test problem_0001 --language javascript # By exact directory name
```
**Workspace Sync**
```bash
leetkick sync typescript # Sync specific language
leetkick sync --all # Sync all languages
leetkick sync --dry-run # Preview changes only
```
**Works Anywhere:** Run commands from any directory in your workspace
**Safe Overwrites:** CLI warns before overwriting existing solutions. Use `--force` to override
**Shortcuts:** Use `-l` instead of `--language`, `-f` instead of `--force`
## Project Structure
After using the CLI, your project will be organized by language:
```
your-project/
├── .leetkick.json # Workspace configuration
├── typescript/ # TypeScript workspace
│ ├── problem_0001/
│ │ ├── TwoSum.ts # Your solution
│ │ └── TwoSum.test.ts # Test cases
│ └── problem_0704/
│ ├── BinarySearch.ts
│ └── BinarySearch.test.ts
├── cpp/ # C++ workspace
│ ├── problem_0001/
│ │ ├── two_sum.cpp # Your solution
│ │ └── two_sum.test.cpp # Test cases
│ └── catch_amalgamated.hpp # Bundled testing framework
├── kotlin/ # Kotlin workspace
│ ├── src/main/kotlin/ # Solutions
│ │ └── problem0001/TwoSum.kt
│ ├── src/test/kotlin/ # Tests
│ │ └── problem0001/TwoSumTest.kt
│ └── build.gradle.kts # Gradle configuration
├── go/ # Go workspace
│ ├── go.mod # Module definition
│ ├── problem_0001/ # Each problem is its own package
│ │ ├── solution.go # Solution
│ │ └── solution_test.go # Tests
│ └── problem_0704/
│ ├── solution.go
│ └── solution_test.go
├── python/ # Python workspace
│ ├── src/ # Source code
│ │ ├── problem_0001/
│ │ │ └── two_sum.py # Your solution
│ │ └── problem_0704/
│ │ └── binary_search.py
│ ├── tests/ # Tests
│ │ ├── problem_0001/
│ │ │ └── test_two_sum.py
│ │ └── problem_0704/
│ │ └── test_binary_search.py
│ ├── requirements.txt # Dependencies
│ └── pyproject.toml # Configuration
└── ...
```
Each language workspace includes all necessary configuration files, testing frameworks, and formatting rules.
## What You Get
Each problem generates solution and test files with:
- Problem description and difficulty
- LeetCode starter code
- Test framework setup ready to use
- Language-specific project structure
**Workflow:** Implement solution → Add test cases → Run `leetkick test` → Success!
## Troubleshooting
**Installation Issues:**
- Ensure Node.js 18+ is installed: `node --version`
- Clear npm cache: `npm cache clean --force`
- Use `npm install -g leetkick --force` to reinstall
**Command Issues:**
- Run `leetkick --help` to verify installation
- Check you're in a leetkick workspace (contains `.leetkick.json`)
- Use full problem names if short names don't work
**Language Issues:**
- Check language-specific README for setup instructions and prerequisites
- Ensure required compilers/runtimes are installed
**Update LeetKick:**
```bash
npm update -g leetkick
leetkick --version
```
---
## Contributing
We'd love your contributions! Here's how to help:
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/awesome-feature`
3. Make your changes following the existing code style
4. Run tests: `npm test` and linting: `npm run lint`
5. Submit a pull request
### Development Setup
```bash
git clone https://github.com/charliesbot/leetkick.git
cd leetkick && npm install && npm run compile && npm link
```
**Commands:** `npm run compile` (build) | `npm test` (test) | `npm run lint` (style check)
### Adding New Language Support
Add new language templates easily:
1. Create `templates//` directory
2. Add `exercise_template.*` and `test_template.*` files with placeholders
3. Include config files (package.json, requirements.txt, etc.)
4. CLI automatically discovers new languages!
**Template placeholders:** `__PROBLEM_ID__`, `__PROBLEM_TITLE__`, `__PROBLEM_DESC__`, `__PROBLEM_DEFAULT_CODE__`, etc.
See existing templates in `templates/` for examples.
## License
MIT
## Acknowledgments
- Built with [Google TypeScript Style (gts)](https://github.com/google/gts)
- Uses LeetCode's GraphQL API for problem fetching
---