/deepwiki-community-bot

A generic bot for answering queries across any open source community, build on top of deepwiki.

Primary LanguagePython

DeepWiki Community Bot

A powerful solution for open source communities to leverage DeepWiki for code exploration, documentation, and support. This project provides both a robust API service and Slack bot integration to help maintainers and contributors interact with their code repositories more effectively.

GitHub Organization

This project is maintained by the manojradhakrishnan GitHub organization. Visit our organization page for more projects and contributions.

Overview

DeepWiki Community Bot enables:

  1. Code Base Understanding - Help new contributors and community members understand complex code repositories
  2. Automated Query Resolution - Reduce maintainer workload by automatically addressing common questions
  3. Knowledge Sharing - Make repository knowledge accessible to everyone in the community
  4. Multi-platform Support - Access via API, web interface, or Slack integration

Use Cases

  • For Open Source Maintainers: Reduce support burden by automating responses to common contributor questions
  • For New Contributors: Quickly understand code structure and functionality without extensive manual searching
  • For Community Managers: Provide a self-service support channel for the community
  • For Documentation Teams: Supplement existing documentation with interactive Q&A capabilities

Integration Methods

1. API Integration

Make direct API calls to query DeepWiki about your repositories:

curl -X POST "http://your-server:8000/query-deepwiki" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://deepwiki.com/owner/repo",
    "question": "How does the authentication system work?"
  }'

2. Slack Bot Integration

Two integration modes are supported:

One-way Integration: Post responses to Slack channels through webhooks

  • Great for announcements or scheduled reports

Two-way Interactive Bot: Full interactive bot that responds to questions in channels

  • Users can mention the bot or use slash commands
  • Example: @DeepWikiBot facebook/react How does React's virtual DOM work?
  • Or with slash command: /deepwiki facebook/react What is the component lifecycle?

Project Structure

deepwiki-community-bot/
├── app.py                 # Main FastAPI application
├── src/                   # Source code
│   ├── extraction/        # Extraction utilities
│   │   ├── __init__.py
│   │   └── deepwiki.py    # DeepWiki answer extraction logic
│   ├── formatting/        # Response formatting
│   │   ├── __init__.py
│   │   └── slack.py       # Slack-specific formatting
│   └── utils/             # Utility functions
│       ├── __init__.py
│       └── common.py      # Common utility functions
├── slack/                 # Slack integration
│   ├── bot.py             # Slack bot implementation
│   └── setup.sh           # Slack bot setup script
├── tests/                 # Test suite
├── config/                # Configuration files
├── docs/                  # Documentation
├── docker-compose.yml     # Docker compose configuration
├── Dockerfile             # Docker configuration
└── requirements.txt       # Project dependencies

Installation

  1. Clone the repository

    git clone https://github.com/your-username/deepwiki-community-bot.git
    cd deepwiki-community-bot
  2. Create a virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Install Playwright browsers (required for DeepWiki page interaction)

    playwright install chromium

Configuration

Copy the example environment file and update with your values:

cp .env.example .env

Required environment variables:

  • Set your preferred DeepWiki URL (instructions in the file)
  • For Slack bot: Add your Slack API credentials

IMPORTANT: Never commit your .env file to version control as it contains sensitive tokens. The .gitignore file is configured to exclude it.

GitHub Deployment

To deploy this project to your own GitHub repository under your organization:

  1. Fork this repository to your GitHub organization (e.g., manojradhakrishnan/deepwiki-community-bot)

  2. Clone your forked repository

    git clone https://github.com/your-org/deepwiki-community-bot.git
    cd deepwiki-community-bot
  3. Set up environment variables

    cp .env.example .env
    # Edit the .env file with your specific configurations
  4. Make sure not to commit sensitive tokens

    # Verify .env is in .gitignore
    grep .env .gitignore
  5. Test locally before pushing changes

    # Start the API server
    python -m uvicorn app:app --host 0.0.0.0 --port 8000
    
    # In another terminal, start the Slack bot
    cd slack
    python bot.py
  6. Commit and push your changes

    git add .
    git commit -m "Initial setup of DeepWiki Community Bot"
    git push origin main

Running the API Server

python -m uvicorn app:app --host 0.0.0.0 --port 8000

Running the Slack Bot

cd slack
python bot.py

Docker Deployment

For production deployment, use Docker:

docker-compose up -d

How It Works

  1. Repository Access: DeepWiki provides an interactive interface to GitHub repositories
  2. Question Processing: Questions about your code are routed to DeepWiki
  3. Knowledge Extraction: The system extracts relevant information from DeepWiki
  4. Response Delivery: Answers are formatted and delivered via API or Slack

Benefits for Open Source Projects

  • Reduced Maintainer Workload: Automate answers to common community questions
  • Faster Onboarding: Help new contributors understand the codebase quickly
  • Enhanced Documentation: Supplement existing docs with interactive Q&A
  • Community Engagement: Provide an always-available support channel for questions
  • Knowledge Preservation: Make institutional knowledge accessible to all

Contributing

We welcome contributions to enhance the DeepWiki Community Bot! See CONTRIBUTING.md for guidelines.

License

This project is open-source and available under the MIT License.