Skip to main content

Wiki's for nerds, by nerds

Project description

WikiGen

WIKIGEN

PyPI Python Downloads License GitHub

WikiGen (Previously named "salt-docs") is a compact, human-readable documentation generator for codebases that minimizes tokens and makes structure easy for models to follow.
It's intended for LLM input as a drop-in, lossless representation of your existing codebase.

Installation

Option 1: Install from PyPI

pip install wikigen

Option 2: Install from source

git clone https://github.com/usesalt/wikigen.git
cd wikigen
pip install -e .

Quick Start

1. Initial Setup

Run the setup wizard to configure your API keys and preferences:

wikigen init

2. Generate Documentation

Analyze GitHub repository

wikigen run https://github.com/username/repo

Analyze local directory

wikigen run /path/to/your/codebase

With custom options

wikigen run https://github.com/username/repo --output /custom/path --language spanish --max-abstractions 10

Configuration

WikiGen stores configuration in a per-user config file and uses your system's keyring for secure API key storage.

  • macOS/Linux: ~/.config/wikigen/config.json (or $XDG_CONFIG_HOME/wikigen/config.json)
  • Windows: %APPDATA%\wikigen\config.json

Configuration Options

  • llm_provider: LLM provider to use (gemini, openai, anthropic, openrouter, ollama) - default: gemini
  • llm_model: Model name to use (e.g., "gemini-2.5-flash", "gpt-4o-mini", "claude-3-5-sonnet-20241022") - default: gemini-2.5-flash
  • output_dir: Default output directory
  • language: Default language for generated docs
  • max_abstractions: Default number of abstractions to identify
  • max_file_size: Maximum file size in bytes
  • use_cache: Enable/disable LLM response caching
  • include_patterns: Default file patterns to include
  • exclude_patterns: Default file patterns to exclude
  • ollama_base_url: Custom Ollama base URL (optional, default: http://localhost:11434)

Managing Configuration

View Current Configuration

wikigen config show

Update API Keys

# Update API key for any provider (interactive)
wikigen config update-api-key gemini
wikigen config update-api-key openai
wikigen config update-api-key anthropic
wikigen config update-api-key openrouter

# Legacy command (still works, redirects to update-api-key)
wikigen config update-gemini-key

# Update GitHub token (interactive)
wikigen config update-github-token

# Update GitHub token directly
wikigen config update-github-token "your-token-here"

Update Other Settings

# Change LLM provider
wikigen config set llm-provider openai

# Change LLM model
wikigen config set llm-model gpt-4o-mini

# Change default language
wikigen config set language spanish

# Change max abstractions
wikigen config set max_abstractions 15

# Disable caching
wikigen config set use_cache false

# Update output directory
wikigen config set output_dir /custom/path

CI/CD Integration

WikiGen can automatically generate and update documentation in your CI/CD pipeline. Perfect for keeping docs in sync with code changes!

Quick Setup for GitHub Actions

  1. Add workflow file to .github/workflows/wikigen.yml:
name: WikiGen

on:
  push:
    branches: [main]

jobs:
  docs:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: pip install wikigen
      - run: wikigen run . --ci --output-path docs/
        env:
          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
      - uses: peter-evans/create-pull-request@v6
        with:
          commit-message: 'docs: updated documentation for new changes'
          branch: wikigen/update-${{ github.run_number }}
          title: 'Update Documentation'
  1. Add your LLM API key to GitHub Secrets:

    • Go to SettingsSecrets and variablesActions
    • Add GEMINI_API_KEY (or OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)
  2. Push to main - Documentation will be automatically generated and a PR will be created!

CI-Specific Flags

  • --ci - Enable CI mode (non-interactive, better error messages)
  • --output-path <path> - Custom output directory (e.g., docs/, documentation/)
  • --update - Merge with existing docs instead of overwriting
  • --check-changes - Exit with code 1 if docs changed, 0 if unchanged

Learn More

See the complete CI/CD Integration Guide for:

  • Advanced configuration options
  • Multiple LLM provider setup
  • Troubleshooting tips
  • Best practices
  • Future integrations (Confluence, Notion, etc.)

MCP Server Setup

WikiGen includes an MCP (Model Context Protocol) server that exposes your generated documentation to AI assistants in IDEs like Cursor, Continue.dev, and Claude Desktop.

MCP Tools Available

The MCP server provides these tools:

  • list_docs - List all available documentation files
  • get_docs - Fetch the full content of a documentation file (by resource name or absolute path)
  • search_docs - Full-text search across documentation (paths, names, and resource names)
  • index_directories - Index directories for fast searching

Setup Instructions

Cursor

  1. Open or create your MCP configuration file:

    • macOS/Linux: ~/.cursor/mcp.json
    • Windows: %APPDATA%\Cursor\mcp.json
  2. Add the wikigen server configuration:

{
  "mcpServers": {
    "wikigen": {
      "command": "wikigen",
      "args": ["mcp"]
    }
  }
}
  1. Restart Cursor to load the MCP server.

  2. The AI assistant in Cursor can now access your documentation using tools like:

    • "What documentation do we have?"
    • "Get me the documentation for 'WIKIGEN project"
    • "Read the README documentation"

Claude Desktop

  1. Open or create your Claude configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Add the wikigen server configuration:

{
  "mcpServers": {
    "wikigen": {
      "command": "wikigen",
      "args": ["mcp"]
    }
  }
}
  1. Restart Claude Desktop to load the MCP server.

Troubleshooting

  • Command not found: Make sure wikigen is in your PATH. You can verify by running wikigen --version in your terminal.
  • Server not starting: Ensure you've run wikigen init and have generated at least one documentation project.
  • No docs found: The MCP server discovers docs from your configured output_dir. Run wikigen config show to check your output directory.

Testing the MCP Server

You can test the MCP server directly:

wikigen mcp

This will start the server in stdio mode (for MCP clients). To test locally, you can use the test scripts in the tests/ directory.

LLM Provider Support

WikiGen supports multiple LLM providers, allowing you to choose the best option for your needs:

Supported Providers

  1. Google Gemini (default)

    • Recommended models: gemini-2.5-pro, gemini-2.5-flash, gemini-1.5-pro, gemini-1.5-flash
    • API key required: Yes (GEMINI_API_KEY)
  2. OpenAI

    • Recommended models: gpt-4o-mini, gpt-4.1-mini, gpt-5-mini, gpt-5-nano
    • API key required: Yes (OPENAI_API_KEY)
    • Supports o1 models with reasoning capabilities
  3. Anthropic Claude

    • Recommended models: claude-3-5-sonnet, claude-3-5-haiku, claude-3-7-sonnet (with extended thinking), claude-3-opus
    • API key required: Yes (ANTHROPIC_API_KEY)
  4. OpenRouter

    • Recommended models: google/gemini-2.5-flash:free, meta-llama/llama-3.1-8b-instruct:free, openai/gpt-4o-mini, anthropic/claude-3.5-sonnet
    • API key required: Yes (OPENROUTER_API_KEY)
    • Access multiple models through a single API
  5. Ollama (Local)

    • Recommended models: llama3.2, llama3.1, mistral, codellama, phi3
    • API key required: No (runs locally)
    • Default URL: http://localhost:11434
    • Perfect for privacy-sensitive projects or offline usage

Switching Providers

You can switch between providers at any time:

# Switch to OpenAI
wikigen config set llm-provider openai
wikigen config set llm-model gpt-4o-mini
wikigen config update-api-key openai

# Switch to Ollama (local)
wikigen config set llm-provider ollama
wikigen config set llm-model llama3.2
# No API key needed for Ollama!

CLI Options

Required

  • run - GitHub repo URL, current open directory or local directory path
  • --repo or --dir - GitHub repo URL or local directory path (depricated)

Optional

  • -n, --name - Project name (derived from repo/directory if omitted)
  • -t, --token - GitHub personal access token
  • -o, --output - Output directory (overrides config default)
  • -i, --include - File patterns to include (e.g., ".py", ".js")
  • -e, --exclude - File patterns to exclude (e.g., "tests/", "docs/")
  • -s, --max-size - Maximum file size in bytes (default: 100KB)
  • --language - Language for generated docs (default: "english")
  • --no-cache - Disable LLM response caching
  • --max-abstractions - Maximum number of abstractions to identify (default: 10)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wikigen-1.1.0.tar.gz (62.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wikigen-1.1.0-py3-none-any.whl (67.8 kB view details)

Uploaded Python 3

File details

Details for the file wikigen-1.1.0.tar.gz.

File metadata

  • Download URL: wikigen-1.1.0.tar.gz
  • Upload date:
  • Size: 62.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wikigen-1.1.0.tar.gz
Algorithm Hash digest
SHA256 825333256f5549ee4231a20b5aca56edde3005dd94ab321a81473784dbce8af3
MD5 d4b99a8ae08cff460d16145a379b158d
BLAKE2b-256 5312ab48ff8cc98f79777d8fa347ed361eb75440b2d6441d3d5afc2cd345e293

See more details on using hashes here.

File details

Details for the file wikigen-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: wikigen-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 67.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wikigen-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38777433291a5c89d6ba4dd0d57fa8d3017ac89b1b89666e7e9d4c8cc7a5ec7e
MD5 73333599c90b8ce78fa897f07bed1cd9
BLAKE2b-256 221188a498954474393e9409d0e18a9bd6410a6f0715ff3ca105a2f0649d31e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page