A guided LeetCode practice workflow for Pi: start problems, learn with notes, edit locally, and open LeetCode for manual Run/Submit.
The main idea: only learn 5 commands. Everything else happens through a numbered /lc-next menu.
Most LeetCode helpers either expose too many commands, depend on brittle LeetCode judge APIs, or try to automate the browser. This extension is intentionally calmer:
- Fetches public problem data.
- Creates local
problem.md,solution.<ext>, andnotes.mdfiles. - Guides practice through a dashboard and numbered action menu.
- Tracks what you learned across problems.
- Opens the LeetCode URL for manual Run/Submit in your normal browser.
- Does not require LeetCode cookies for the default workflow.
- Does not send your code, notes, cookies, or telemetry anywhere by default.
- Native Pi extension; no web server required.
- Only 5 user-facing
/lc-commands. - Language selection: TypeScript, JavaScript, Python3, C++, Java, Go, Rust.
- Practice dashboard with status, confidence, last action, files, and notes.
- Numbered actions: understand, hint, co-code, edit, debug, run, submit prep, review, solve, learning history.
notes.mdper problem with highlights, approach, mistakes, edge cases, and complexity.- Learning review across past notes and tracked topics.
- Privacy-safe local usage counters in
.pi/leetcode/usage.json.
npm install
pi -e ./src/leetcode.tsmkdir -p .pi/extensions/pi-leetcode
cp src/leetcode.ts .pi/extensions/pi-leetcode/index.ts
/reloadpi install npm:pi-leetcode-practiceor try without installing:
pi -e npm:pi-leetcode-practice| Command | Purpose |
|---|---|
/lc-start [titleSlug] |
Start a problem. With no slug, continue current, pick recent, review history, search, or random top-50 |
/lc-next |
Show the numbered “What next?” menu for the active problem |
/lc-lang |
Choose your LeetCode solution language |
/lc-list [search] |
Search/select a problem, then continue with /lc-start |
/lc-help |
Show help inside Pi |
/lc-lang
/lc-start 3sum
# choose an action from the numbered menu
/lc-next
# use /lc-next anytime to continue practicing
Or start without a slug:
/lc-start
You can then choose:
- Continue current problem
- Recent problem
- Review learning history
- Search new problem
- Random top-50 problem
leetcode/<titleSlug>/problem.md
leetcode/<titleSlug>/solution.<ext>
leetcode/<titleSlug>/notes.md
State and local usage counters:
.pi/leetcode/state.json
.pi/leetcode/usage.json
Use /lc-start with no slug or /lc-next and choose learning history. It scans tracked problems and notes.md files to summarize:
- skills practiced
- key lessons
- mistakes to remember
- missing notes files
If you delete leetcode/, the review may still know which problems were tracked, but detailed notes are gone unless backed up.
Default behavior is local and privacy-safe:
- No telemetry is sent.
- No code is uploaded by this extension.
- No LeetCode cookies are required.
- Local usage counters stay in
.pi/leetcode/usage.json. - Run/Submit opens LeetCode in your normal browser for manual action.
If you publish or fork this project, keep telemetry opt-in only.
The extension writes local counters only:
{
"commands": {
"lc-start": 3,
"lc-next": 8
},
"actions": {
"1. Understand": 2,
"6. Run": 1
},
"languages": {
"javascript": 4
},
"difficulties": {
"Medium": 3
}
}For public adoption after publishing, use npm downloads and GitHub stars/issues. Do not collect user code or notes.
This repo is configured as a Pi package via package.json:
{
"keywords": ["pi-package", "pi-extension", "leetcode"],
"pi": {
"extensions": ["./src/leetcode.ts"]
}
}To publish to npm you need an npm account:
npm login
npm publish --access publicIf you do not have npm login, publish to GitHub first and install via git:
git tag v0.1.0
git push origin main --tags
pi install git:github.com/YOUR_USER/pi-leetcode-practice@v0.1.0npm run typecheck
npm run lint:namespaceslint:namespaces verifies every command registered through pi.registerCommand starts with lc-.
npm run smoke:live and npm run smoke:live:prompt are legacy API/auth smoke tests. They are not part of the default workflow, which avoids LeetCode judge APIs and opens LeetCode for manual Run/Submit instead.
MIT