Skip to content

barankul/codepractice

Repository files navigation

日本語 | English

CodePractice

CodePractice

AI-powered coding practice generator for VS Code
Generate exercises, run code, auto-judge, and track your progress — all inside your editor.

Open in GitHub Codespaces

Languages 138 Offline Practices 8 AI Providers MIT License

Screenshots

Main Screen

CodePractice Main Screen

Practice & Judge Screens

CodePractice Additional Screen

CodePractice Practice and Judge Screen


Why CodePractice?

Most coding practice platforms run in a browser. CodePractice brings the entire experience inside VS Code — where you already write code. No context switching, no browser tabs. Generate a problem, solve it in the editor, get instant feedback with auto-judging, and track your progress in the same workflow.

Key highlights:

  • Works 100% offline with 138 built-in exercises, localized offline practice text, and verified offline bug-fix variants
  • Supports 8 AI providers (free tiers available) for unlimited unique exercises
  • Built-in code runners — no external setup for Java, TypeScript, or SQL
  • Multi-test validation with detailed pass/fail feedback per test case when the practice includes multiple test inputs
  • Review scheduling to help you revisit practice topics over time

Features

Practice Generation

Feature Description
3 Languages Java, TypeScript, SQL — each with built-in runner
Adaptive Difficulty 5 levels, auto-adjusted based on your performance
AI-Generated Unique problems every time via free AI providers
138 Offline Practices Full built-in exercise bank that works without internet
Custom Practice Describe what you want to practice, AI generates it in AI mode
Bug Fix Mode AI mode uses real GitHub code; offline mode generates verified local bug-fix variants

Code Execution & Judging

Feature Description
Built-in Runners Run Java, TypeScript, SQL directly — no terminal needed
Multi-Test Cases Each exercise validated against multiple inputs
Auto Judge Output comparison with intelligent normalization
Partial Pass Feedback See exactly which test cases failed and why
SQL Schema View In-memory SQLite with visual schema browser

Learning Tools

Feature Description
AI Feedback Line-by-line code review on wrong solutions
Progressive Hints Hints inserted as comments in your code
Quick Solve AI solves and explains the approach
Teach Me Step-by-step teaching with examples
Ghost Text Inline code suggestions while you type
Alternative Solutions 2-3 different approaches to the same problem
Cross-Language Open translated solution files with per-line notes; offline only shows targets authored for that practice
Localized Practice Text Offline titles, tasks, hints, judge feedback, alternative-method notes, and cross-language notes follow the selected UI language

Progress Tracking

Feature Description
XP System Earn XP for each completed exercise
Level Progression Difficulty scales as you improve
Topic Mastery Per-language, per-topic retention tracking
Daily Goals Track daily practice targets
Weekly Trends 7-day practice history with pass rates
Review Scheduling Helps surface practice topics again over time

Internationalization

  • UI languages: English, Japanese, Turkish
  • Offline practice prose is localized for Japanese and Turkish while runnable code stays in English
  • Bug-fix explanations, custom-panel AI-required messages, and cross-language annotations follow the selected UI language

Quick Start

Option 1: GitHub Codespaces (Fastest — zero setup)

Click "Open in GitHub Codespaces" above → wait for setup → click the CodePractice icon in the sidebar. Everything is pre-configured: Node.js, JDK 21, and the extension auto-installed.

Option 2: Local Development

git clone https://github.com/barankul/codepractice.git
cd codepractice
npm install
npm run compile

Press F5 in VS Code to launch the extension, then click the CodePractice icon in the sidebar.

Option 3: Install from VSIX

npm install && npm run package
npx @vscode/vsce package --no-dependencies -o codepractice.vsix
code --install-extension codepractice.vsix

Requirements

Language Requirement Auto-install?
SQL Nothing — built-in SQLite (WASM) N/A
TypeScript Node.js Comes with VS Code
Java JDK 21+ Yes — click "Install JDK Now" when prompted

Java auto-install uses winget (Windows), brew (macOS), or apt/dnf (Linux). If none are available, it downloads directly from Adoptium.


AI Providers

CodePractice supports the 8 provider options currently exposed in Settings. Models are configurable; the table below reflects the current built-in selections shown in the settings UI.

Provider Pricing Current selectable models
Groq Free tier available GPT-OSS 120B, GPT-OSS 20B, Llama 3.3 70B, Llama 3.1 8B
Cerebras Free tier available Qwen 3 235B, GPT-OSS 120B, Llama 3.1 8B
Together AI Free credit on signup Llama 3.3 70B Turbo, Llama 3.1 8B Turbo
OpenRouter Free tier available Nemotron 3 Super 120B, Qwen3 Coder 480B, GPT-OSS 120B, Hunter Alpha 1T, Llama 3.3 70B, Gemini 2.0 Flash, Qwen 3 235B
Google Gemini Free tier available (region dependent) Gemini 2.5 Flash, Gemini 2.5 Pro, Gemini 2.0 Flash
OpenAI Pay-as-you-go GPT-4.1 Mini, GPT-4.1 Nano, GPT-4.1, o4-mini, o3
Claude Pay-as-you-go Sonnet 4.6, Sonnet 4, Haiku 4.5, Opus 4.6
Local Free (self-hosted) LM Studio, Ollama, or any OpenAI-compatible endpoint

Setup: Open sidebar → gear icon → select provider → enter API key → Save.

No API key? CodePractice includes 138 built-in exercises that work completely offline with judging, localized hints and feedback, offline bug-fix mode, progress tracking, and authored cross-language comparisons where available.


Offline Mode

Works without any API key or internet connection. Toggle between AI and Offline mode from the main screen.

  • 138 practices across Java, TypeScript, and SQL
  • All difficulty levels (1-5)
  • Offline bug-fix mode for the built-in catalog
  • Multi-test validation when the selected practice includes multiple test cases
  • Full judging with feedback
  • Hints, judge feedback, alternative methods, and cross-language notes localized to English, Japanese, or Turkish
  • Cross-language comparison for authored offline targets only; unsupported targets are hidden
  • Progress tracking and XP
  • Randomized values — different numbers/names each time

Offline limitations:

  • Custom Practice, AI Chat, Teach Me, and other provider-backed features still require AI mode
  • SQL offline practices do not expose cross-language targets
  • In bug-fix mode, the sidebar focuses on the buggy file and hides "Other Ways" / "Other Languages"

Topics covered:

Java TypeScript SQL
Array, ArrayList Arrays, Objects SELECT, WHERE
HashMap, HashSet Functions, Types JOIN, GROUP BY
String, Methods Union Types, Async ORDER BY, INSERT/UPDATE

Keyboard Shortcuts

Shortcut Action
Ctrl+Enter Run SQL file
Ctrl+Shift+E Explain selected code

Architecture

src/
  extension.ts            Entry point & command registration
  appView.ts              Webview provider (sidebar UI host)
  webviewHtml.ts          Frontend UI (HTML/CSS/JS)
  aiHelpers.ts            AI provider routing & configuration
  aiGenerators.ts         Prompt engineering for all AI features
  javaRunner.ts           Java compilation & execution
  sqlRunner.ts            SQL execution via sql.js (WASM)
  multiTestRunner.ts      Multi-test harness generation
  outputChecker.ts        Output normalization & comparison
  parsers.ts              AI response parsing & error patterns
  progressTracker.ts      XP, levels, and review scheduling
  practiceRandomizer.ts   Offline practice value randomization
  demoData.ts             Offline mode detection, selection, and localization hookup
  offlineBugFix.ts        Verified offline bug-fix mutation generation
  offlinePracticeLocalization.ts
                          Offline prose / feedback localization (en/ja/tr)
  offlinePracticeAudit.ts Offline catalog integrity + localization coverage checks
  offlineSmokeAudit.ts    Full offline runtime smoke matrix
  offlineSmokeCli.ts      CLI entry for offline smoke reports
  smokeTest.ts            Automated AI quality audit
  i18n.ts                 Internationalization (en/ja/tr)
  offlinePractices/       138 built-in exercises
  handlers/
    generateHandler.ts    Practice generation flow
    executionHandler.ts   Code execution & judging pipeline
    aiFeatureHandler.ts   AI features (hints, teach, solve, ghost text)
    settingsHandler.ts    Settings & progress management

core-java/src/
  CoreMain.java           Practice generator (Java subprocess)
  Ai.java                 AI client for Java-side generation
  DebugMain.java          Bug fix practice generator

Tech stack: TypeScript × esbuild × VS Code Webview API × sql.js (WASM)


Quality Checks

For extension-side AI audits:

npm test

For the offline catalog smoke matrix:

npm run offline:smoke

The offline smoke command writes reports to:

  • .codepractice/offline-smoke/report.txt
  • .codepractice/offline-smoke/report.json

It verifies topic coverage, runtime health, offline bug-fix generation, and Japanese localization coverage across the built-in catalog.


License

MIT

About

AI-powered coding practice generator for VS Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors