Skip to content

mhatresujal/CodeLadder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeLadder – Chrome Extension (MV3)

Step-by-step coding mentor for LeetCode-like problems.
Graduated hints (H1 → H2 → H3 → Plan → Pseudocode), no spoilers by default. BYOK (Bring Your Own) Gemini key.

Widget on a problem

✨ Features

  • On-page mentor widget (draggable; position persists).
  • Hint ladder: H1 (nudge) → H2 (concept) → H3 (approach) → Plan → Pseudocode.
  • AI integration (BYOK): calls Gemini from the background; the key never touches content scripts or the page.
  • Monaco code capture: reliably reads the editor’s real buffer for context (not just visible lines).
  • Clean error messages for common cases (invalid key, rate limit, model busy).

🧩 How it works

  • A content script injects the widget on leetcode.com / leetcode.cn.
  • You pick a hint level and (optionally) type what you’re stuck on.
  • Content → Background: sends problem title/URL/difficulty, your question, and editor code.
  • Background builds a prompt and calls Gemini → returns a small next-step hint.

📦 Install (Load Unpacked)

  1. Download or clone this repo.
  2. Open Chrome → visit chrome://extensions.
  3. Toggle Developer mode (top-right).
  4. Click Load unpacked → select the project folder.
  5. Click the extension’s Options page → paste your Gemini API keySave.

BYOK = Bring Your Own Key. Each user creates their own key and pastes it.
The key is saved only in your browser profile via chrome.storage.local.

Options

🔑 Get a Gemini API key (summary)

  • Create a Web API key in Google AI Studio.
  • Copy the key (looks like AIza…) and paste it in the extension Options page.
  • Free tier has quotas; see troubleshooting below.

🖱️ Draggable widget

Drag the widget by its header; position is saved.

Dragging the widget

📸 More screenshots

Hint example (H1/H2/H3):

Hint example

Pseudocode example:

Pseudocode example

🧪 What to test

  • H1/H2/H3/Plan/Pseudocode on a few problems.
  • Empty editor vs. with your code (the model can comment on your actual code).
  • leetcode.com and leetcode.cn.
  • Error handling paths: 401 (bad key), 429 (free-tier rate limit), 503 (model busy).

🛠️ Troubleshooting

  • “API key invalid” (401/403): Open Options and re-paste a valid Gemini key.
  • “Free-tier rate limit hit” (429): Wait a bit and try again.
  • “Model is busy” (503): Wait ~20–60s and click again (busiest times cause this).
  • No widget? Ensure the page matches leetcode.com/* or leetcode.cn/*. Reload the extension and the page.

🛡️ Privacy & security

  • Your Gemini key is not hard-coded in the repo; it’s stored locally via chrome.storage.local.
  • Network calls happen from the background service worker.
  • The extension only sends context (title/URL/difficulty, your question, and editor code) when you click Get hint.
  • No analytics.

🗂️ Project structure

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published