{"id":29895298,"url":"https://github.com/divar-ir/ai-doc-gen","last_synced_at":"2026-01-12T12:30:19.295Z","repository":{"id":305678486,"uuid":"1022508659","full_name":"divar-ir/ai-doc-gen","owner":"divar-ir","description":"AI-powered multi-agent system that automatically analyzes codebases and generates comprehensive documentation. Features GitLab integration, concurrent processing, and multiple LLM support for better code understanding and developer onboarding.","archived":false,"fork":false,"pushed_at":"2025-10-29T13:34:54.000Z","size":322,"stargazers_count":649,"open_issues_count":0,"forks_count":63,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-10-29T15:30:22.891Z","etag":null,"topics":["agent","ai","ai-documentation","code-analysis","documentation","multi-agent","pydantic-ai","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/divar-ir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-07-19T08:15:43.000Z","updated_at":"2025-10-29T13:47:24.000Z","dependencies_parsed_at":"2025-07-21T13:28:19.811Z","dependency_job_id":"3bf8ecdc-084f-42db-ad64-aafc39575b02","html_url":"https://github.com/divar-ir/ai-doc-gen","commit_stats":null,"previous_names":["divar-ir/ai-doc-gen"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/divar-ir/ai-doc-gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divar-ir%2Fai-doc-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divar-ir%2Fai-doc-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divar-ir%2Fai-doc-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divar-ir%2Fai-doc-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divar-ir","download_url":"https://codeload.github.com/divar-ir/ai-doc-gen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divar-ir%2Fai-doc-gen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","ai-documentation","code-analysis","documentation","multi-agent","pydantic-ai","python"],"created_at":"2025-08-01T07:01:25.971Z","updated_at":"2026-01-12T12:30:19.282Z","avatar_url":"https://github.com/divar-ir.png","language":"Python","funding_links":[],"categories":["Python","Browse The Shelves"],"sub_categories":["Documentation agents"],"readme":"# AI Documentation Generator\n\nAn AI-powered code documentation generator that automatically analyzes repositories and creates comprehensive documentation using advanced language models. The system employs a multi-agent architecture to perform specialized code analysis and generate structured documentation.\n\n## 📝 Blog Posts\n\nRead the full story behind this project:\n- 🇺🇸 [English: Docs That Don’t Rot: How Multi-Agent AI Rewrote Our Workflow](https://medium.com/@milad.noroozi/docs-that-dont-rot-how-multi-agent-ai-rewrote-our-workflow-6e0c911658d6)\n- 🇮🇷 [از دستیار کدنویس تا همکار هوشمند؛ گام اول: کابوس مستندسازی](https://virgool.io/@divar/%D8%A7%D8%B2-%D8%AF%D8%B3%D8%AA%DB%8C%D8%A7%D8%B1-%DA%A9%D8%AF%D9%86%D9%88%DB%8C%D8%B3-%D8%AA%D8%A7-%D9%87%D9%85%DA%A9%D8%A7%D8%B1-%D9%87%D9%88%D8%B4%D9%85%D9%86%D8%AF-%DA%AF%D8%A7%D9%85-%D8%A7%D9%88%D9%84-%DA%A9%D8%A7%D8%A8%D9%88%D8%B3-%D9%85%D8%B3%D8%AA%D9%86%D8%AF%D8%B3%D8%A7%D8%B2%DB%8C-jx7vhznchc9w)\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Architecture](#architecture)\n- [License](#license)\n\n## Features\n\n- **Multi-Agent Analysis**: Specialized AI agents for code structure, data flow, dependency, request flow, and API analysis\n- **Automated Documentation**: Generates comprehensive README files with configurable sections\n- **AI Assistant Configuration**: Automatically generates CLAUDE.md, AGENTS.md, and .cursor/rules/ files for AI coding assistants\n- **GitLab Integration**: Automated analysis for GitLab projects with merge request creation\n- **Concurrent Processing**: Parallel execution of analysis agents for improved performance\n- **Flexible Configuration**: YAML-based configuration with environment variable overrides\n- **Multiple LLM Support**: Works with any OpenAI-compatible API (OpenAI, OpenRouter, local models, etc.)\n- **Observability**: Built-in monitoring with OpenTelemetry tracing and Langfuse integration\n\n## Installation\n\n### Prerequisites\n\n- Python 3.13\n- Git\n- API access to an OpenAI-compatible LLM provider\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/divar-ir/ai-doc-gen.git\ncd ai-doc-gen\n```\n\n2. Install using uv (recommended):\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\nuv sync\n```\n\n3. Or install with pip:\n```bash\npip install -e .\n```\n\n## Quick Start\n\n1. Set up your environment and configuration:\n```bash\n# Copy and edit environment variables\ncp .env.sample .env\n\n# Copy and edit configuration\nmkdir -p .ai\ncp config_example.yaml .ai/config.yaml\n```\n\n2. Run analysis and generate documentation:\n```bash\n# Analyze your repository\nuv run src/main.py analyze --repo-path .\n\n# Generate README documentation\nuv run src/main.py generate readme --repo-path .\n\n# Generate AI assistant configuration files (CLAUDE.md, AGENTS.md, .cursor/rules/)\nuv run src/main.py generate ai-rules --repo-path .\n```\n\nGenerated documentation will be saved to `.ai/docs/` directory, and AI configuration files will be placed in your repository root.\n\n## Usage\n\n### Available Commands\n\n```bash\n# Analyze codebase\nuv run src/main.py analyze --repo-path \u003cpath\u003e\n\n# Generate README documentation\nuv run src/main.py generate readme --repo-path \u003cpath\u003e\n\n# Generate AI assistant configuration files\nuv run src/main.py generate ai-rules --repo-path \u003cpath\u003e\n\n# Run cronjob (GitLab integration)\nuv run src/main.py cronjob analyze\n```\n\n### Advanced Options\n\n**Analysis Options:**\n```bash\n# Analyze with specific exclusions\nuv run src/main.py analyze --repo-path . --exclude-code-structure --exclude-data-flow\n\n# Use custom configuration file\nuv run src/main.py analyze --repo-path . --config /path/to/config.yaml\n```\n\n**README Generation Options:**\n```bash\n# Generate with specific section exclusions\nuv run src/main.py generate readme --repo-path . --exclude-architecture --exclude-c4-model\n\n# Use existing README as context\nuv run src/main.py generate readme --repo-path . --use-existing-readme\n```\n\n**AI Rules Generation Options:**\n```bash\n# Skip overwriting existing files\nuv run src/main.py generate ai-rules --repo-path . \\\n    --skip-existing-claude-md \\\n    --skip-existing-agents-md \\\n    --skip-existing-cursor-rules\n\n# Customize detail level and line limits\nuv run src/main.py generate ai-rules --repo-path . \\\n    --detail-level comprehensive \\\n    --max-claude-lines 600 \\\n    --max-agents-lines 150\n```\n\n## Configuration\n\nThe tool automatically looks for configuration in `.ai/config.yaml` or `.ai/config.yml` in your repository.\n\n### Configuration Options\n\n- **Exclude specific analyses**: Skip code structure, data flow, dependencies, request flow, or API analysis\n- **Customize README sections**: Control which sections appear in generated documentation  \n- **Configure cronjob settings**: Set working paths and commit recency filters\n\nYou can use CLI flags for quick configuration overrides. See [`config_example.yaml`](config_example.yaml) for all available options and [`.env.sample`](.env.sample) for environment variables.\n\n## Architecture\n\nThe system uses a **multi-agent architecture** with specialized AI agents for different types of code analysis and generation:\n\n- **CLI Layer**: Entry point with command parsing and subcommand routing\n- **Handler Layer**: Command-specific business logic (analyze, generate, cronjob)\n- **Agent Layer**: AI-powered analysis and documentation generation\n  - Analyzer agents: Structure, data flow, dependencies, request flow, API analysis\n  - Documentation agent: README generation\n  - AI Rules generator: CLAUDE.md, AGENTS.md, and Cursor rules generation\n- **Tool Layer**: File system operations and utilities\n\n### Technology Stack\n\n- **Python 3.13** with pydantic-ai for AI agent orchestration\n- **OpenAI-compatible APIs** for LLM access (OpenAI, OpenRouter, etc.)\n- **GitPython \u0026 python-gitlab** for repository operations\n- **OpenTelemetry \u0026 Langfuse** for observability\n- **YAML + Pydantic** for configuration management\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Built with [pydantic-ai](https://ai.pydantic.dev/) for AI agent orchestration\n- Supports multiple LLM providers through OpenAI-compatible APIs (including OpenRouter)\n- Uses [Langfuse](https://langfuse.com/) for LLM observability\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivar-ir%2Fai-doc-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivar-ir%2Fai-doc-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivar-ir%2Fai-doc-gen/lists"}