[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71934":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":40,"readmeContent":41,"aiSummary":42,"trendingCount":16,"starSnapshotCount":16,"syncStatus":43,"lastSyncTime":44,"discoverSource":45},71934,"PocketFlow-Tutorial-Codebase-Knowledge","The-Pocket\u002FPocketFlow-Tutorial-Codebase-Knowledge","The-Pocket","Pocket Flow: Codebase to Tutorial","https:\u002F\u002Fcode2tutorial.com\u002F ",null,"Python",12386,1411,95,53,0,9,29,63,27,108.25,"MIT License",false,"main",true,[27,28,29,30,31,32,33,34,35,36,37,38,39],"coding","large-language-model","large-language-models","llm","llm-agent","llm-agents","llm-application","llm-apps","llm-framework","llm-frameworks","llms","pocket-flow","pocketflow","2026-06-12 04:01:02","\u003Ch1 align=\"center\">Turns Codebase into Easy Tutorial with AI\u003C\u002Fh1>\n\n![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)\n \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FhUHHE9Sa6T\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F1346833819172601907?logo=discord&style=flat\">\n\u003C\u002Fa>\n> *Ever stared at a new codebase written by others feeling completely lost? This tutorial shows you how to build an AI agent that analyzes GitHub repositories and creates beginner-friendly tutorials explaining exactly how the code works.*\n\n\u003Cp align=\"center\">\n  \u003Cimg\n    src=\".\u002Fassets\u002Fbanner.png\" width=\"800\"\n  \u002F>\n\u003C\u002Fp>\n\nThis is a tutorial project of [Pocket Flow](https:\u002F\u002Fgithub.com\u002FThe-Pocket\u002FPocketFlow), 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.\n\n- Check out the [YouTube Development Tutorial](https:\u002F\u002Fyoutu.be\u002FAFY67zOpbSo) for more!\n\n- Check out the [Substack Post Tutorial](https:\u002F\u002Fzacharyhuang.substack.com\u002Fp\u002Fai-codebase-knowledge-builder-full) for more!\n\n&nbsp;&nbsp;**🔸 🎉 Reached Hacker News Front Page** (April 2025) with >900 up‑votes:  [Discussion »](https:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=43739456)\n\n&nbsp;&nbsp;**🔸 🎊 Online Service Now Live!** (May&nbsp;2025) Try our new online version at [https:\u002F\u002Fcode2tutorial.com\u002F](https:\u002F\u002Fcode2tutorial.com\u002F) – just paste a GitHub link, no installation needed!\n\n## ⭐ Example Results for Popular GitHub Repositories!\n\n\u003Cp align=\"center\">\n    \u003Cimg\n      src=\".\u002Fassets\u002Fexample.png\" width=\"600\"\n    \u002F>\n\u003C\u002Fp>\n\n🤯 All these tutorials are generated **entirely by AI** by crawling the GitHub repo!\n\n- [AutoGen Core](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FAutoGen%20Core) - Build AI teams that talk, think, and solve problems together like coworkers!\n\n- [Browser Use](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FBrowser%20Use) - Let AI surf the web for you, clicking buttons and filling forms like a digital assistant!\n\n- [Celery](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FCelery) - Supercharge your app with background tasks that run while you sleep!\n\n- [Click](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FClick) - Turn Python functions into slick command-line tools with just a decorator!\n\n- [Codex](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FCodex) - Turn plain English into working code with this AI terminal wizard!\n\n- [Crawl4AI](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FCrawl4AI) - Train your AI to extract exactly what matters from any website!\n\n- [CrewAI](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FCrewAI) - Assemble a dream team of AI specialists to tackle impossible problems!\n\n- [DSPy](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FDSPy) - Build LLM apps like Lego blocks that optimize themselves!\n\n- [FastAPI](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FFastAPI) - Create APIs at lightning speed with automatic docs that clients will love!\n\n- [Flask](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FFlask) - Craft web apps with minimal code that scales from prototype to production!\n\n- [Google A2A](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FGoogle%20A2A) - The universal language that lets AI agents collaborate across borders!\n\n- [LangGraph](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FLangGraph) - Design AI agents as flowcharts where each step remembers what happened before!\n\n- [LevelDB](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FLevelDB) - Store data at warp speed with Google's engine that powers blockchains!\n\n- [MCP Python SDK](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FMCP%20Python%20SDK) - Build powerful apps that communicate through an elegant protocol without sweating the details!\n\n- [NumPy Core](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FNumPy%20Core) - Master the engine behind data science that makes Python as fast as C!\n\n- [OpenManus](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FOpenManus) - Build AI agents with digital brains that think, learn, and use tools just like humans do!\n\n- [PocketFlow](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FPocketFlow) - 100-line LLM framework. Let Agents build Agents!\n\n- [Pydantic Core](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FPydantic%20Core) - Validate data at rocket speed with just Python type hints!\n\n- [Requests](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FRequests) - Talk to the internet in Python with code so simple it feels like cheating!\n\n- [SmolaAgents](https:\u002F\u002Fthe-pocket.github.io\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002FSmolaAgents) - Build tiny AI agents that punch way above their weight class!\n\n- Showcase Your AI-Generated Tutorials in [Discussions](https:\u002F\u002Fgithub.com\u002FThe-Pocket\u002FPocketFlow-Tutorial-Codebase-Knowledge\u002Fdiscussions)!\n\n## 🚀 Getting Started\n\n1. Clone this repository\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002FThe-Pocket\u002FPocketFlow-Tutorial-Codebase-Knowledge\n   ```\n\n3. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. Set up LLM in [`utils\u002Fcall_llm.py`](.\u002Futils\u002Fcall_llm.py) by providing credentials. To do so, you can put the values in a `.env` file. By default, you can use the AI Studio key with this client for Gemini Pro 2.5 by setting the `GEMINI_API_KEY` environment variable. If you want to use another LLM, you can set the `LLM_PROVIDER` environment variable (e.g. `XAI`), and then set the model, url, and API key (e.g. `XAI_MODEL`, `XAI_URL`,`XAI_API_KEY`). If using Ollama, the url is `http:\u002F\u002Flocalhost:11434\u002F` and the API key can be omitted.\n   You can use your own models. We highly recommend the latest models with thinking capabilities (Claude 3.7 with thinking, O1). You can verify that it is correctly set up by running:\n   ```bash\n   python utils\u002Fcall_llm.py\n   ```\n\n5. Generate a complete codebase tutorial by running the main script:\n    ```bash\n    # Analyze a GitHub repository\n    python main.py --repo https:\u002F\u002Fgithub.com\u002Fusername\u002Frepo --include \"*.py\" \"*.js\" --exclude \"tests\u002F*\" --max-size 50000\n\n    # Or, analyze a local directory\n    python main.py --dir \u002Fpath\u002Fto\u002Fyour\u002Fcodebase --include \"*.py\" --exclude \"*test*\"\n\n    # Or, generate a tutorial in Chinese\n    python main.py --repo https:\u002F\u002Fgithub.com\u002Fusername\u002Frepo --language \"Chinese\"\n    ```\n\n    - `--repo` or `--dir` - Specify either a GitHub repo URL or a local directory path (required, mutually exclusive)\n    - `-n, --name` - Project name (optional, derived from URL\u002Fdirectory if omitted)\n    - `-t, --token` - GitHub token (or set GITHUB_TOKEN environment variable)\n    - `-o, --output` - Output directory (default: .\u002Foutput)\n    - `-i, --include` - Files to include (e.g., \"`*.py`\" \"`*.js`\")\n    - `-e, --exclude` - Files to exclude (e.g., \"`tests\u002F*`\" \"`docs\u002F*`\")\n    - `-s, --max-size` - Maximum file size in bytes (default: 100KB)\n    - `--language` - Language for the generated tutorial (default: \"english\")\n    - `--max-abstractions` - Maximum number of abstractions to identify (default: 10)\n    - `--no-cache` - Disable LLM response caching (default: caching enabled)\n\nThe 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: .\u002Foutput).\n\n\n\u003Cdetails>\n \n\u003Csummary> 🐳 \u003Cb>Running with Docker\u003C\u002Fb> \u003C\u002Fsummary>\n\nTo run this project in a Docker container, you'll need to pass your API keys as environment variables. \n\n1. Build the Docker image\n   ```bash\n   docker build -t pocketflow-app .\n   ```\n\n2. Run the container\n\n   You'll need to provide your `GEMINI_API_KEY` for the LLM to function. If you're analyzing private GitHub repositories or want to avoid rate limits, also provide your `GITHUB_TOKEN`.\n   \n   Mount a local directory to `\u002Fapp\u002Foutput` inside the container to access the generated tutorials on your host machine.\n   \n   **Example for analyzing a public GitHub repository:**\n   \n   ```bash\n   docker run -it --rm \\\n     -e GEMINI_API_KEY=\"YOUR_GEMINI_API_KEY_HERE\" \\\n     -v \"$(pwd)\u002Foutput_tutorials\":\u002Fapp\u002Foutput \\\n     pocketflow-app --repo https:\u002F\u002Fgithub.com\u002Fusername\u002Frepo\n   ```\n   \n   **Example for analyzing a local directory:**\n   \n   ```bash\n   docker run -it --rm \\\n     -e GEMINI_API_KEY=\"YOUR_GEMINI_API_KEY_HERE\" \\\n     -v \"\u002Fpath\u002Fto\u002Fyour\u002Flocal_codebase\":\u002Fapp\u002Fcode_to_analyze \\\n     -v \"$(pwd)\u002Foutput_tutorials\":\u002Fapp\u002Foutput \\\n     pocketflow-app --dir \u002Fapp\u002Fcode_to_analyze\n   ```\n\u003C\u002Fdetails>\n\n## 💡 Development Tutorial\n\n- I built using [**Agentic Coding**](https:\u002F\u002Fzacharyhuang.substack.com\u002Fp\u002Fagentic-coding-the-most-fun-way-to), the fastest development paradigm, where humans simply [design](docs\u002Fdesign.md) and agents [code](flow.py).\n\n- The secret weapon is [Pocket Flow](https:\u002F\u002Fgithub.com\u002FThe-Pocket\u002FPocketFlow), a 100-line LLM framework that lets Agents (e.g., Cursor AI) build for you\n\n- Check out the Step-by-step YouTube development tutorial:\n\n\u003Cbr>\n\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fyoutu.be\u002FAFY67zOpbSo\" target=\"_blank\">\n    \u003Cimg src=\".\u002Fassets\u002Fyoutube_thumbnail.png\" width=\"500\" alt=\"Pocket Flow Codebase Tutorial\" style=\"cursor: pointer;\">\n  \u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003Cbr>\n\n\n\n","Pocket Flow 是一个将代码库转换为易于理解的教程的项目。它基于一个仅有100行代码的大型语言模型框架，能够爬取GitHub仓库并构建知识库，通过分析整个代码库来识别核心抽象及其交互方式，并将复杂的代码转换成适合初学者的教程，配有清晰的可视化解释。该项目特别适用于那些需要快速理解和上手新代码库的开发者，无论是个人学习还是团队协作中的知识分享场景都非常适用。",2,"2026-06-11 03:39:34","high_star"]