Extract teachable snippets from git repos
- Rust 100%
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.toml | ||
| patch.txt | ||
| README.md | ||
| tutorial.md | ||
Git-Teach
An application that provides non-repeating random snippets of codebase logic, segmenting code dependencies based on N depth.
Features
- Tree-Sitter Indexing: Scans Rust, Python, TypeScript, JavaScript, and Go to build a local call graph mapping
Entity->Dependencies. - Rich CLI: Colored outputs, JSON/Markdown format support, and shell completion.
- API Server & RSS: Exposes a local API and RSS feed for easy integrations.
- Model Context Protocol (MCP): Native integration for AI agents.
Database Management
git-teach comes with a suite of commands to easily manage the seen snippets database. You are never trapped!
git-teach db status # View total vs seen snippets
git-teach db list --limit 10 # List recently seen snippets and timestamps
git-teach db mark-seen <name> # Manually mark a specific snippet as seen
git-teach db mark-unseen <name> # Manually mark a snippet as unseen
git-teach db reset # Reset all snippets to unseen
Quick Setup
See tutorial.md for full setup and usage instructions.
Examples
Get a colored terminal snippet:
git-teach snippet --depth 1
Get a JSON snippet for piping to jq or other tools:
git-teach snippet --depth 2 --format json | jq .
Start the API / RSS server on port 8080:
git-teach server --port 8080
Then visit http://localhost:8080/rss in your RSS reader.
Generate bash completions:
git-teach generate-completion bash > ~/.local/share/bash-completion/completions/git-teach
Architecture
- Graph Builder: From a randomly chosen, unseen
rootnode,Ndepth dependencies are predictably grouped to form a complete, contextual snippet. - SQLite Tracker: Keeps track of
seen_snippetsin~/.local/share/git-teach/.