Wikigen: Automate GitHub Wiki Generation with a Single CLI Command

Wikigen: Automate GitHub Wiki Generation with a Single CLI Command

Wikigen is a Go CLI that uses Claude Code to analyze your repo and generate comprehensive GitHub Wiki documentation automatically.

1d ago·3 min read·27 views·via hn_claude_code, medium_agentic, gn_claude_code_tips, hn_claude_cli
Share:

Wikigen: Automate GitHub Wiki Generation with a Single CLI Command

What It Does — Zero-Infrastructure Documentation Generation

Wikigen is a single Go binary that connects directly to your GitHub repositories, uses Claude Code to analyze the source code, and generates complete GitHub Wiki documentation. It works by:

  1. Cloning repositories via SSH or PAT
  2. Using Claude Code's built-in tools (Read, Grep, Glob, Bash) to analyze the codebase
  3. Generating GitHub Wiki-compatible Markdown files
  4. Outputting a directory structure ready to push to your {repo}.wiki.git repository

The tool requires no Docker, Ollama, or embedding infrastructure. It's a pure CLI tool that leverages Claude Code's existing capabilities for code analysis.

Setup — Get Running in Minutes

# Prerequisites:
# - Go 1.22+
# - git with SSH key configured
# - Claude Code CLI installed and authenticated

git clone https://github.com/tomohiro-owada/wikigen.git
cd wikigen
cp .env.example .env
# Edit .env as needed
go build -o wikigen .

When To Use It — Perfect for These Scenarios

1. New Repository Onboarding

Instead of manually creating documentation for new projects, run:

./wikigen owner/new-repo

This generates a complete wiki with:

  • Home.md (landing page with table of contents)
  • _Sidebar.md (navigation)
  • System-Architecture.md
  • API-Specification.md
  • Data-Model.md

2. Multi-Repository Documentation

For projects spanning multiple repos, use the multi-repo syntax:

# In repos.txt:
myproject:owner/frontend-repo
myproject:owner/backend-repo
myproject:owner/shared-repo

./wikigen -f repos.txt -p 2 -pp 5

This creates cross-repository documentation showing how services interact, with repo-level and page-level parallelism for speed.

3. Batch Updates Across Teams

# Generate wikis for all team repos
./wikigen -f all-repos.txt -model haiku -lang en

# Retry only failed pages later
./wikigen -retry

Use -model haiku for faster generation or -lang en to ensure English documentation.

Advanced Features You'll Actually Use

Dry Run Mode

Preview what will be generated without actually creating pages:

./wikigen -dry-run owner/repo

JSON Output for Automation

Get structured results for CI/CD pipelines:

./wikigen -json owner/repo

Error Handling That Doesn't Lose Work

  • Auto-retry: Each page retries up to 3 times
  • Incremental save: Pages saved immediately after generation
  • Partial results preserved if process is interrupted
  • _errors.log with timestamped details

Integration Workflow

Push generated wikis directly to GitHub:

# Generate the wiki
./wikigen owner/repo

# Clone the wiki repo
git clone git@github.com:owner/repo.wiki.git

# Copy generated content
cp -r wiki-output/repo/* repo.wiki/

# Commit and push
cd repo.wiki
git add -A && git commit -m "Update wiki" && git push

Security Considerations

Wikigen validates all repository inputs:

  • Must match owner/repo format
  • Rejects path traversal (..)
  • Rejects shell injection characters (;, &, |, etc.)

All configuration can be set via .env file, with CLI flags taking precedence.

Why This Matters for Claude Code Users

This tool demonstrates a powerful pattern: using Claude Code as an analysis engine within automated workflows. Instead of manually prompting Claude to document code, Wikigen structures the entire process:

  1. It automatically discovers files via Glob
  2. Uses Grep to find patterns and relationships
  3. Leverages Read to understand code context
  4. Uses Bash for git operations
  5. Structures the output consistently

This is exactly the type of automation Claude Code enables when you treat it as a programmable component rather than just a chat interface.

AI Analysis

Wikigen shows how to productize Claude Code interactions. Instead of manually prompting for documentation, it creates a repeatable pipeline. Claude Code users should think about: 1. **Automating repetitive analysis tasks**: If you find yourself asking Claude the same types of questions about codebases ("What's the architecture?", "How do these services connect?"), consider building a CLI tool that structures those prompts automatically. Wikigen's source code is a great template. 2. **Using Claude Code's tools programmatically**: Notice how Wikigen uses `claude -p --add-dir ./repo` with Read, Grep, Glob, and Bash tools. You can build similar tools for code review automation, dependency analysis, or migration planning. 3. **Batch processing with parallelism**: The `-p 2 -pp 5` flags show repo-level and page-level parallelism. When building your own Claude Code automation, implement similar parallelism to handle multiple repositories or files efficiently. **Actionable next step**: Clone the Wikigen repo and look at how it constructs prompts for Claude. The pattern is reusable for any code analysis task you do regularly.
Original sourcegithub.com

Trending Now

More in Products & Launches

View all