Instructor is not just a code reviewer; it's a storytelling engine for software. It takes any source file, dissects it using advanced Abstract Syntax Trees (AST), feeds it to a local AI Senior Engineer, and produces a stunning, interactive presentation that walks you through the logic, intent, and brilliance of your code.
Whether you're onboarding new devs, reviewing complex legacy code, or just documenting your masterpiece, Instructor turns static text into a dynamic masterclass.
- 🧠 Senior Engineer/Teacher Persona: The AI doesn't just explain what the code does; it explains why it matters, using high-level analogies and professional insights.
- 🔒 100% Local & Private: Powered by Ollama, your code never leaves your machine. No API keys, no data leaks.
- ⚡ Precision Parsing: Uses ast-grep to structurally understand your code (functions, classes, methods) rather than dumb regex splitting.
- ✨ Beautiful Output: Generates a Quarto (Reveal.js) presentation with side-by-side code and explanation views, auto-advancing slides, and syntax highlighting.
- Scan:
ast-grepparses your source file to identify logical blocks (functions, classes) based on the language grammar. - Analyze: Each block is sent to a local LLM (via Ollama) with a "Senior Engineer" system prompt to generate a pedagogical explanation.
- Render: The results are woven into a
Quartomarkdown file (.qmd). - Present: Quarto compiles this into a standalone HTML5 presentation.
- Python 3.9+
- Ollama (Running locally with a model like
qwen2.5-coderorllama3) - ast-grep (
sgcommand line tool) - Jupyter (Jupyter Notebooks)
- Quarto (CLI for rendering presentations)
-
Clone the Repository
git clone https://github.com/plantacerium/PowererPointererSilice.git cd PowererPointererSilice -
Install Python Dependencies
pip install requests
-
Ensure External Tools are Ready
- Start Ollama:
ollama serve(and make sure you've pulled your model, e.g.,ollama pull qwen3:8b) - Check
sgandquartoare in your PATH.
- Start Ollama:
-
Run Instructor
# Analyze a Python file python instructor.py path/to/your/code.py -
View the Magic Instructor generates a
.qmdfile. Render it using Quarto:quarto render ai_ast_grep_review.qmd --to revealjs
Open the generated HTML file in your browser and enjoy the show! 🍿
Instructor uses ast-grep's powerful pattern matching. Out of the box, it supports:
- 🐍 Python (
.py) - 📜 JavaScript (
.js) - 📘 TypeScript (
.ts) - 🐹 Go (
.go) - 🦀 Rust (
.rs) - ☕ Java (
.java) - 🇨 C (
.c)
Adding more languages is as easy as adding a single line to the LANGUAGE_MAP in instructor.py!
Open instructor.py to tweak:
OLLAMA_MODEL: Change the AI brain (e.g.,mistral,codellama,deepseek-coder).presentation settings: Adjust slide timing, themes, or transition speeds in thegenerate_qmdfunction.
We want to make code literacy universal. If you have ideas for better prompts, cooler Quarto themes, or more language support:
- Fork it.
- Branch it.
- Pull Request it.
MIT. Let's build something awesome.