pi-leetcode-practice

Guided LeetCode practice workflow for Pi: start problems, learn with notes, and open LeetCode for manual Run/Submit.

Packages

Package details

extension

Install pi-leetcode-practice from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-leetcode-practice
Package
pi-leetcode-practice
Version
0.1.0
Published
Aug 9, 2026
Downloads
177/mo · 7/wk
Author
sudhanshu80
License
MIT
Types
extension
Size
42.1 KB
Dependencies
1 dependency · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/leetcode.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

Pi LeetCode Practice

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.

Why this exists

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>, and notes.md files.
  • 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.

Features

  • 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.md per 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.

Install

Try locally from this repo

npm install
pi -e ./src/leetcode.ts

Project-local install

mkdir -p .pi/extensions/pi-leetcode
cp src/leetcode.ts .pi/extensions/pi-leetcode/index.ts
/reload

Once published as a Pi package

pi install npm:pi-leetcode-practice

or try without installing:

pi -e npm:pi-leetcode-practice

Commands

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

Typical flow

/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

Files created per 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

Learning review

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.

Privacy

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.

Usage tracking

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.

Packaging for public release

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 public

If 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.0

Quality checks

npm run typecheck
npm run lint:namespaces

lint:namespaces verifies every command registered through pi.registerCommand starts with lc-.

Legacy live smoke tests

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.

License

MIT