This tool uses Claude Code's MCP capabilities to automatically analyze GitHub repositories, generate documentation, and create visual diagrams of code architecture.
The fastest way to get started: Have your AI coding assistant help you set up this tool!
Simply tell your AI assistant: "Please read and execute the setup instructions in SETUP_ASSISTANT_PROMPT.md"
The AI assistant will guide you through the entire setup process in about 5-10 minutes.
After setup, use USAGE_ASSISTANT_PROMPT.md to have your AI assistant help you configure and use the tool effectively.
- Repository Analysis: Clone and analyze GitHub repositories
- Code Structure Mapping: Generate maps of code organization and relationships
- Critical File Identification: Highlight the most important files in the repository
- Diagram Generation: Create component, sequence, and class diagrams
- Documentation Creation: Generate comprehensive markdown documentation
- Multiple Analysis Profiles: Create targeted documentation for different audiences
You can find sample outputs generated by this tool in the examples/ directory of this repository. These examples include generated documentation and diagrams to help you understand what to expect from running the tool.
- Analysis Profiles: Generate different documentation for different audiences (developers, architects, operations, etc.) from the same repository
- Confluence Integration: Now supports automatic upload of documentation and diagrams to Atlassian Confluence spaces using the Conduit MCP server
Your AI coding assistant can set this up for you in minutes! Just tell it:
"Please read and execute the setup instructions in SETUP_ASSISTANT_PROMPT.md"
The assistant will handle most of the setup automatically.
-
Clone this repository:
git clone https://github.com/your-username/gh-repo-code-intelligence.git cd gh-repo-code-intelligence -
Configure Claude permissions by copying the settings template:
cp .claude/settings.local.json.template .claude/settings.local.json
This file contains the necessary permissions for Claude to use all required tools.
-
Configure MCP tools using the commands provided in the MCP Tool Setup section below.
-
Create a
config.jsonfile based on the template:cp config.json.template config.json
-
Edit
config.jsonto include the repositories you want to analyze:{ "repos": [ { "name": "organization/repository-name", "github_url": "https://github.com/organization/repository-name" } ], "preferred_diagrams": ["component", "sequence", "class"], "doc_format": "markdown", "analysis_options": { "critical_files_limit": 50, "include_metrics": true, "max_tokens": 5000, "analysis_profile": "standard" }, "confluence": { "enabled": false, "site_alias": "your-site-alias", // Must match a site in Conduit's config.yaml "space_key": "YOUR_SPACE", "parent_page_title": "Parent Page Title", "page_suffix": "" } }To enable automatic upload of documentation to Confluence:
- Set
confluence.enabledtotrue - Configure your Atlassian site alias, space key, and parent page
- Ensure the Conduit MCP server is configured in
.mcp.jsonwith proper authentication
When enabled, the tool will upload generated documentation and diagrams as Confluence pages.
IMPORTANT: Always use HTTPS URLs (
https://github.com/...) for repositories, not SSH URLs ([email protected]:...). SSH URLs will prompt for SSH key passphrase, which breaks automation. However, if you do provide a URL that starts with [email protected]:..., Claude Code will attempt to convert that to https://github.com/... and use that for clone operations. - Set
The tool supports different analysis profiles to create targeted documentation for specific audiences. You can run the tool multiple times on the same repository with different profiles to generate documentation tailored to different needs.
-
standard(default)- General-purpose technical documentation
- Balanced coverage of architecture, code, and functionality
- Output: ~15-20 pages
-
developer_onboarding- For new developers joining the project
- Focuses on: technology stack, development setup, code organization, design patterns
- Output: ~25-30 pages
-
architecture_review- For architects and technical leads
- Emphasizes: system design, architectural decisions, patterns, scalability
- Output: ~25-30 pages
-
business_understanding- For product managers and business stakeholders
- Highlights: business capabilities, domain concepts, workflows
- Output: ~20-25 pages
-
operations_handover- For DevOps and operations teams
- Covers: deployment, configuration, monitoring, dependencies
- Output: ~20-25 pages
To use a specific analysis profile, update your config.json:
{
"analysis_options": {
"analysis_profile": "developer_onboarding"
},
"confluence": {
"page_suffix": " - Developer Guide"
}
}The page_suffix is optional but recommended when using multiple profiles to distinguish between different versions of documentation for the same repository.
To create both developer and architecture documentation for the same repository:
-
First run with developer profile:
{ "analysis_options": { "analysis_profile": "developer_onboarding" }, "confluence": { "page_suffix": " - Developer Guide" } } -
Then run with architecture profile:
{ "analysis_options": { "analysis_profile": "architecture_review" }, "confluence": { "page_suffix": " - Architecture Review" } }
This will create two separate Confluence pages (if enabled) with different documentation perspectives for the same repository.
For help with configuration, running analyses, choosing profiles, and troubleshooting:
Tell your AI assistant: "Please read USAGE_ASSISTANT_PROMPT.md and help me use this tool"
Your AI assistant can help you:
- Configure repositories and analysis options
- Choose the right analysis profile for your needs
- Run the tool with appropriate output options
- Troubleshoot any issues
- Understand the generated documentation
Run the tool using Claude Code:
cd /path/to/gh-repo-code-intelligence
claude -p "Analyze repositories according to CLAUDE.md" --dangerously-skip-permissionsThe tool will follow the instructions in CLAUDE.md to analyze your configured repositories.
For automated or scheduled runs, use one of these approaches to avoid terminal hanging issues:
-
Simple output redirection (recommended for automation):
claude -p "Analyze repositories according to CLAUDE.md" --dangerously-skip-permissions --verbose --output-format stream-json > output.json
-
Unbuffered output with real-time viewing:
claude -p "Analyze repositories according to CLAUDE.md" --dangerously-skip-permissions --verbose --output-format stream-json | stdbuf -o0 tee output.json
-
Non-interactive mode for scripts:
claude -p "Analyze repositories according to CLAUDE.md" --dangerously-skip-permissions --verbose --output-format stream-json --no-interactive > output.json 2>&1
Note: The --dangerously-skip-permissions flag is required for this tool to function properly, as it needs to spawn sub-agents that process repositories in parallel.
Note: When using tee without unbuffering, the terminal may appear to hang even after completion. This is just buffering behavior - the analysis is complete. Press Ctrl+C to exit.
- Read repositories from your
config.json - Create or update
state.jsonto track progress - Clone or refresh each repository
- Analyze the repository structure
- Generate diagrams based on the code analysis
- Create comprehensive documentation with embedded diagrams
- Store all outputs in the
output/directory with timestamped folders - (Optional) Upload documentation and diagrams to Confluence if enabled
output/
└── {repo_name}/
└── {timestamp}/
├── docs.md <- Generated documentation
└── diagrams/ <- Generated diagrams
├── component_diagram.png
├── sequence_diagram.png
└── class_diagram.png
For troubleshooting or detailed analysis of the tool's operation, use verbose mode with JSON output:
claude -p "Analyze repositories according to CLAUDE.md" --dangerously-skip-permissions --verbose --output-format stream-json | tee output.jsonThis will:
- Show detailed progress and debugging information
- Output structured JSON data for each step
- Save all output to
output.jsonfor later analysis - Allow real-time monitoring of the analysis process
- Claude Code CLI
- MCP tools access:
- code-understanding (required)
- mermaid_image_generator (required)
- Conduit (required for Confluence integration)
This project depends on three MCP tools. There are two ways to add them to Claude Code:
# Add Mermaid Image Generator
claude mcp add-json -s user mermaid_image_generator '{"type":"stdio","command":"uvx","args":["mcp_mermaid_image_gen"]}'
# Add Code Understanding (replace YOUR_GITHUB_TOKEN with your personal access token if analyzing private repos)
claude mcp add-json -s user code-understanding '{"type":"stdio","command":"uvx","args":["code-understanding-mcp-server","--max-cached-repos","20"],"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"YOUR_GITHUB_TOKEN"}}'
# Add Conduit (requires prior installation - see special note below)
claude mcp add-json -s user Conduit '{"type":"stdio","command":"mcp-server-conduit","args":[]}'Alternatively, you can copy and modify the provided template:
cp .mcp.json.template ~/.claude/.mcp.jsonThen edit the file to add your GitHub token and adjust paths as needed. See .mcp.json.template for the structure.
IMPORTANT - Conduit Setup: The Conduit MCP server requires manual initialization regardless of installation method:
- Install:
pipx install conduit-connect - Initialize:
conduit --init - Configure: Edit
~/.config/conduit/config.yaml(or%APPDATA%\conduit\config.yamlon Windows) - Add your Atlassian credentials to the config.yaml file
Note: You'll need a GitHub Personal Access Token if analyzing private repositories. Create one at https://github.com/settings/tokens
-
Code Understanding MCP Tool (Required for repository analysis)
- GitHub Repository
- Provides repository cloning, analysis, and code structure mapping
-
Mermaid Image Generator MCP Tool (Required for diagram generation)
- GitHub Repository
- Creates visual diagrams from code analysis
-
Conduit MCP Tool (Required for Confluence integration)
- GitHub Repository
- Provides Confluence and Jira integration
- Developed by CodingTheFutureWithAI
- See the repository for installation instructions
If you want to enable automatic upload to Confluence:
- Install and configure the Conduit MCP server - see Conduit repository for installation instructions
- Configure your Atlassian credentials in Conduit's config file
- Set
confluence.enabled: truein your config.json - Provide the site_alias, space_key, and parent_page_title in config.json
The site_alias in your config.json must match a site configured in Conduit.
For the code-understanding MCP tool to clone repositories:
-
Public repositories: No authentication required, but rate limits apply
-
Private repositories: Requires a GitHub Personal Access Token:
"code-understanding": { "command": "code-understanding-mcp-server", "args": [ "--cache-dir", "/path/to/cache-dir", "--max-cached-repos", "20" ], "env": { "GITHUB_TOKEN": "your-personal-access-token" } }
-
URL format: Regardless of repository visibility:
- Always use HTTPS URLs in your config.json, not SSH URLs
- SSH URLs will prompt for SSH key passphrase, breaking automation
- Example: use
https://github.com/organization/repo-name.gitinstead of[email protected]:organization/repo-name.git
See config.json.template for the full configuration options. Key settings include:
repos: List of repositories to analyzepreferred_diagrams: Types of diagrams to generateanalysis_options: Settings for code analysis depth and detailanalysis_profile: Choose fromstandard,developer_onboarding,architecture_review,business_understanding, oroperations_handover
confluence.page_suffix: Optional suffix to distinguish between different profile outputs for the same repository
We're actively working on enhancing this tool with more features:
- Confluence Integration: Automatically publish documentation to Atlassian Confluence spaces
- Documentation Templates: Customizable templates for different types of documentation
- Enhanced Diagram Types: Additional diagram formats for more comprehensive visualization
- Automated Scheduling: Integrated scheduling for regular repository analysis updates
This project is licensed under the MIT License - see the LICENSE file for details.