{"data":{"slug":"the-pocket-pocketflow-tutorial-codebase-knowledge","name":"PocketFlow-Tutorial-Codebase-Knowledge","tagline":"Generates tutorials from codebases using LLMs","github_url":"https://github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge","owner":"The-Pocket","repo":"PocketFlow-Tutorial-Codebase-Knowledge","owner_avatar_url":"https://avatars.githubusercontent.com/u/193350244?v=4","primary_language":"Python","stars":12621,"forks":1446,"topics":["coding","large-language-model","large-language-models","llm","llm-agent","llm-agents","llm-application","llm-apps","llm-framework","llm-frameworks","llms","pocket-flow","pocketflow"],"archived":false,"github_pushed_at":"2026-05-31T01:26:41+00:00","maintenance_label":"Steady","stars_delta_30d":176,"url":"https://www.graphcanon.com/tools/the-pocket-pocketflow-tutorial-codebase-knowledge","markdown_url":"https://www.graphcanon.com/tools/the-pocket-pocketflow-tutorial-codebase-knowledge.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/the-pocket-pocketflow-tutorial-codebase-knowledge","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=the-pocket-pocketflow-tutorial-codebase-knowledge","description":"Pocket Flow: Codebase to Tutorial","homepage_url":"https://code2tutorial.com/","license":"MIT","open_issues":76,"watchers":95,"ai_summary":"PocketFlow is a tool for generating comprehensive tutorial documents for software projects from their source code, utilizing large language models.","readme_excerpt":"## 🚀 Getting Started\n\n1. Clone this repository\n   ```bash\n   git clone https://github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge\n   ```\n\n3. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. Set up LLM in [`utils/call_llm.py`](./utils/call_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://localhost:11434/` 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/call_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://github.com/username/repo --include \"*.py\" \"*.js\" --exclude \"tests/*\" --max-size 50000\n\n    # Or, analyze a local directory\n    python main.py --dir /path/to/your/codebase --include \"*.py\" --exclude \"*test*\"\n\n    # Or, generate a tutorial in Chinese\n    python main.py --repo https://github.com/username/repo --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/directory if omitted)\n    - `-t, --token` - GitHub token (or set GITHUB_TOKEN environment variable)\n    - `-o, --output` - Output directory (default: ./output)\n    - `-i, --include` - Files to include (e.g., \"`*.py`\" \"`*.js`\")\n    - `-e, --exclude` - Files to exclude (e.g., \"`tests/*`\" \"`docs/*`\")\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: ./output).\n\n\n<details>\n \n<summary> 🐳 <b>Running with Docker</b> </summary>\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 `/app/output` 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)/output_tutorials\":/app/output \\\n     pocketflow-app --repo https://github.com/username/repo\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 \"/path/to/your/local_codebase\":/app/code_to_analyze \\\n     -v \"$(pwd)/output_tutorials\":/app/output \\\n     pocketflow-app --dir /app/code_to_analyze\n   ```\n</details>","github_created_at":"2025-04-02T20:56:33+00:00","created_at":"2026-07-07T17:33:50.260884+00:00","updated_at":"2026-08-17T06:01:47.872519+00:00","categories":[{"slug":"ai-agents","name":"AI Agents","url":"https://www.graphcanon.com/categories/ai-agents","markdown_url":"https://www.graphcanon.com/categories/ai-agents.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/ai-agents"},{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"}],"tags":[{"slug":"coding","name":"coding"},{"slug":"large-language-models","name":"large language models"},{"slug":"llm-agents","name":"llm-agents"},{"slug":"pocket-flow","name":"pocket-flow"}],"trust":{"provenance":{"is_fork":false,"github_id":959473422,"owner_type":"Organization","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-08-17T06:01:47.104Z","maintenance":{"label":"Steady","score":60,"methodology":"github_public_v1","releases_90d":0,"days_since_push":78,"last_release_at":null,"stars_delta_30d":176,"open_issues_delta_30d":1},"security_summary":{"status":"findings","scanner":"osv@v1","low_count":23,"high_count":0,"last_scan_at":"2026-07-11T11:02:00.109Z","medium_count":0,"scan_profile":"deps","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-08-17T06:01:47.566Z"},"deploy":{"source":"dockerfile:Dockerfile","self_host":true,"observed_at":"2026-08-17T06:01:47.566Z","managed_saas":false},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-08-17T06:01:47.566Z"},"has_docker":{"value":true,"source":"dockerfile:Dockerfile","observed_at":"2026-08-17T06:01:47.566Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-08-17T06:01:47.566Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["- When you need detailed and automatically generated documentation for complex codebases, ensuring that the tutorials are up-to-date with the latest source code.","- If your development process involves frequent updates or refactors that necessitate maintaining accurate, dynamic documentation without manual intervention.","- For projects where multiple programming languages (Python, JavaScript) are used, as PocketFlow supports excluding certain files and customizing tutorial generation for different language contexts."],"when_not_to_use":["- If the requirement is to generate tutorials for deeply domain-specific applications that don't match the training data of general-purpose LLMs used by PocketFlow.","- In environments where API keys for external models are prohibited or not available, which limits the operation of this tool as it relies on third-party LLM providers."],"source":"enrich:decision_facts","observed_at":"2026-07-11T15:24:03.847Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"PocketFlow-Tutorial-Codebase-Knowledge is a tool designed to generate comprehensive tutorial documents from software project codebases using large language models."}]}}