{"data":{"slug":"the-pocket-pocketflow-tutorial-codebase-knowledge","name":"PocketFlow-Tutorial-Codebase-Knowledge","tagline":"Codebase to Tutorial Generator 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":12669,"forks":1450,"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":"Slowing","stars_delta_30d":48,"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":97,"ai_summary":"Pocket Flow is a tool that uses large language models to generate tutorials from codebases, supporting multiple languages and customization for different LLM providers.","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-09-20T04:33:35.065095+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":"code-analysis","name":"code-analysis"},{"slug":"coding","name":"coding"},{"slug":"language-agnostic","name":"language-agnostic"},{"slug":"large-language-model","name":"large-language-model"},{"slug":"llm-agent","name":"llm-agent"},{"slug":"llm-framework","name":"llm-framework"},{"slug":"pocket-flow","name":"pocket-flow"},{"slug":"tutorial-generation","name":"tutorial-generation"}],"trust":{"provenance":{"is_fork":false,"github_id":959473422,"owner_type":"Organization","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-09-18T08:48:53.220Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":110,"last_release_at":null,"stars_delta_30d":48,"open_issues_delta_30d":0},"security_summary":{"status":"findings","scanner":"osv@v1","low_count":76,"high_count":0,"last_scan_at":"2026-09-18T08:48:55.417Z","medium_count":0,"scan_profile":"deps","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-09-18T08:48:52.116Z"},"deploy":{"source":"dockerfile:Dockerfile","self_host":true,"observed_at":"2026-09-18T08:48:52.116Z","managed_saas":false},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-09-18T08:48:52.116Z"},"has_docker":{"value":true,"source":"dockerfile:Dockerfile","observed_at":"2026-09-18T08:48:52.116Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-09-18T08:48:52.116Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["When you need to generate comprehensive tutorials from existing codebases in multiple programming languages.","When you want to customize the tutorial generation process by specifying which files to include or exclude, and setting the maximum file size.","When you prefer to use specific LLM providers such as Gemini Pro 2.5, Claude 3.7, or Ollama, and you can configure the tool to use these models.","When you require the ability to generate tutorials in different languages, such as Chinese, by specifying the language parameter."],"when_not_to_use":["If you do not have access to the required LLM API keys or credentials, as the tool requires setup with an LLM provider.","If you need real-time or interactive tutorial generation, as PocketFlow-Tutorial-Codebase-Knowledge is designed for batch processing of codebases.","If you are working with very large codebases that exceed the maximum file size limit set by the tool, which could lead to incomplete tutorial generation.","If you require a tool that does not rely on external LLM services and can operate entirely offline, as PocketFlow-Tutorial-Codebase-Knowledge requires an active internet connection to the LLM provider"],"source":"enrich:decision_facts","observed_at":"2026-09-18T10:27:57.618Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"PocketFlow-Tutorial-Codebase-Knowledge is a tool that leverages large language models to generate tutorials from codebases, supporting multiple languages and customization for different LLM providers."}]}}