This is a tutorial project of Pocket Flow, a 100-line LLM framework. It crawls GitHub repositories and builds a knowledge base from the code. It analyzes entire codebases to identify core abstractions and how they interact, and transforms complex code into beginner-friendly tutorials with clear visualizations.
-
Clone this repository
-
Install python 3.10 venv inside project folder:
pyenv install 3.10 pip install virtualenv virtualenv --python="~/.pyenv/versions/3.10/bin/python3.10" venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Copy example configuration for Google AI studio:
cp .env_example .env
If you need more settings, check
/utils/settings.py
- ollama settings
- google project settings
- ... and more
-
Generate a complete codebase tutorial by running the main script:
# Analyze a GitHub repository python main.py --repo https://github.com/username/repo --include "*.py" "*.js" --exclude "tests/*" --max-size 50000 # Or, analyze a local directory python main.py --dir /path/to/your/codebase --include "*.py" --exclude "*test*" # Or, generate a tutorial in Chinese python main.py --repo https://github.com/username/repo --language "Chinese"
--repo
or--dir
- Specify either a GitHub repo URL or a local directory path (required, mutually exclusive)-n, --name
- Project name (optional, derived from URL/directory if omitted)-t, --token
- GitHub token (or set GITHUB_TOKEN environment variable)-o, --output
- Output directory (default: ./output)-i, --include
- Files to include (e.g., ".py" ".js")-e, --exclude
- Files to exclude (e.g., "tests/" "docs/")-s, --max-size
- Maximum file size in bytes (default: 100KB)--language
- Language for the generated tutorial (default: "russian")
The application will crawl the repository, analyze the codebase structure, generate tutorial content in the specified language, and save the output in the specified directory (default: ./output).