GenCodeDoc
Intelligent code versioning (snapshots) and automatic documentation generator. With CLI, REST API, and MCP support.
๐ GenCodeDoc
Smart documentation generator and intelligent versioning system with full MCP support
Intelligent versioning and documentation for modern development workflows
Quick Start โข Features โข MCP Tools โข Documentation
โก Quick Start
# 1. Install
cd /path/to/gencodedoc
poetry install
# 2. Initialize your project
poetry run gencodedoc init --preset python
# 3. Create your first snapshot
poetry run gencodedoc snapshot create -m "Initial version" -t v1.0
# 4. Generate documentation (Smart Split)
poetry run gencodedoc doc generate --limit 5000
# 5. Visualize Tree
poetry run gencodedoc tree
๐ฏ For AI Assistants (Claude/Gemini): See MCP Integration
โจ Features ๐ฏ Core Features ๐ธ Smart Snapshots - Create intelligent snapshots with ~70% space savings via SHA256 deduplication ๐ Intelligent Autosave - 3 modes (timer/diff/hybrid) with configurable thresholds ๐ Beautiful Documentation - Generate Markdown docs with syntax highlighting, directory trees, and smart splitting ๐ Advanced Diff - Compare versions with unified, JSON, or AST-based diffs ๐๏ธ Efficient Storage - zstd compression (~3x reduction) + SQLite with optimized indexes ๐จ Project Presets - Pre-configured for Python, Node.js, Go, and Web projects ๐ MCP Integration (Model Context Protocol) 26 MCP Tools - Full CLI functionality exposed via MCP for AI Assistants 3 Transports - stdio (Gemini CLI) + SSE (Claude Desktop) + REST API Multi-Project - Manage multiple projects simultaneously Code Intelligence - File history, search, and changelog generation Live Status - Real-time project statistics and snapshot management ๐ฆ Installation Prerequisites Python 3.10+ Poetry (dependency manager) Install Poetry Bash
Linux/macOS
curl -sSL https://install.python-poetry.org | python3 -
Windows (PowerShell)
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - Install GenCodeDoc Bash
Clone or navigate to the project
cd /home/fkomp/Bureau/oracle/utilitaires/gencodedoc/gencodedoc
Install dependencies
poetry install
Verify installation
poetry run gencodedoc --help ๐ฏ Usage ๐ CLI Usage Initialize a Project Bash
Basic initialization
gencodedoc init
With Python preset (recommended for Oracle projects)
gencodedoc init --preset python
Available presets: python, nodejs, go, web
Snapshot Management Bash
Create snapshot
gencodedoc snapshot create --message "Feature X completed" --tag v1.0
List snapshots
gencodedoc snapshot list --limit 10
Show snapshot details
gencodedoc snapshot show v1.0
View file content at specific version (NEW)
gencodedoc snapshot cat v1.0 src/main.py
List files in a snapshot (NEW)
gencodedoc snapshot files v1.0 --pattern "*.py"
Compare versions
gencodedoc snapshot diff v1.0 v2.0
Restore snapshot (full or partial)
gencodedoc snapshot restore v1.0 --force gencodedoc snapshot restore v1.0 --filter "src/*.py" # Partial restore
Export snapshot (NEW)
gencodedoc snapshot export v1.0 ./dist-v1 --archive # Creates .tar.gz
Delete snapshot
gencodedoc snapshot delete old-version --force
Cleanup orphaned data (NEW)
gencodedoc snapshot cleanup Documentation Generation Bash
Full documentation
gencodedoc doc generate
Custom output
gencodedoc doc generate --output docs/API.md
Specific paths only
gencodedoc doc generate --include src/api/ --include README.md
Structure preview
gencodedoc doc preview --max-depth 3
Project statistics
gencodedoc doc stats Configuration Bash
View configuration
gencodedoc config show
Edit configuration
gencodedoc config edit
Set specific values
gencodedoc config set autosave.enabled true gencodedoc config set autosave.mode hybrid
Apply preset
gencodedoc config preset python
Manage ignore rules
gencodedoc config ignore --add-dir dist gencodedoc config ignore --add-ext .tmp gencodedoc config ignore --list-all
Customizable Presets
Presets are now defined in YAML files (gencodedoc/config/presets/*.yaml)
and can be modified directly in the source code.
Project Status Bash
Show project status
gencodedoc status ๐ MCP Integration GenCodeDoc exposes 22 powerful tools via the Model Context Protocol, compatible with Claude Desktop, Gemini CLI, and any MCP-compatible client.
๐ฏ Transport Modes Transport Use Case AI Assistants Port stdio CLI integration Gemini CLI, custom scripts stdin/stdout SSE Web/Desktop apps Claude Desktop, web UIs 8000 (HTTP) REST API integration Any HTTP client 8000 (HTTP) ๐ Setup for Gemini CLI (stdio)
- Find your Poetry venv path:
Bash
cd /home/fkomp/Bureau/oracle/utilitaires/gencodedoc/gencodedoc poetry env info --path
Copy the path and append /bin/python
- Add to ~/.config/gemini-desktop-app/settings.json:
JSON
{ "mcpServers": { "gencodedoc": { "command": "/path/to/your/venv/bin/python", "args": ["-m", "gencodedoc.mcp.server_stdio"], "env": { "PROJECT_PATH": "/home/fkomp/Bureau/oracle/utilitaires/gencodedoc/gencodedoc" } } } } 3. Restart Gemini CLI and you`re ready! ๐
๐ Setup for Claude Desktop (SSE)
- Start the SSE server:
Bash
Terminal 1: Start server
poetry run python -m gencodedoc.mcp.server_sse
Server runs on http://127.0.0.1:8000
- Add to Claude Desktop config:
Location:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json Config:
JSON
{ "mcpServers": { "gencodedoc": { "url": "http://127.0.0.1:8000/mcp/sse", "transport": "sse", "description": "GenCodeDoc - Smart documentation and versioning" } } } 3. Restart Claude Desktop and the server must remain running!
๐ REST API Bash
Start REST server
poetry run python -m gencodedoc.mcp.server
Available endpoints
GET http://127.0.0.1:8000/ # Server info GET http://127.0.0.1:8000/mcp/tools # List tools POST http://127.0.0.1:8000/mcp/execute # Execute tool ๐ ๏ธ MCP Tools (26 Tools)
๐ง Code Intelligence (3 tools)
| Tool | Description | Key Parameters |
|---|---|---|
get_file_history | Track file changes across versions | file_path |
search_snapshots | Search text in all snapshots | query, case_sensitive, file_filter |
generate_changelog | Generate Keep-a-Changelog | from_ref, to_ref |
๐ธ Snapshot Management (11 tools)
| Tool | Description | Key Parameters |
|---|---|---|
create_snapshot | Create a new snapshot | message, tag, include_paths |
list_snapshots | List all snapshots | limit, include_autosave |
get_snapshot_details | Get full snapshot info | snapshot_ref |
restore_snapshot | Restore a snapshot (full or partial) | snapshot_ref, force, file_filters |
restore_files | Restore specific files | snapshot_ref, file_filters |
delete_snapshot | Delete a snapshot | snapshot_ref |
diff_versions | Compare two versions | from_ref, to_ref, format, file_filters |
get_file_at_version | Get content of a single file | snapshot_ref, file_path |
list_files_at_version | List files in a snapshot | snapshot_ref, pattern |
export_snapshot | Export snapshot to folder/archive | snapshot_ref, output_path, archive |
cleanup_orphaned_contents | Cleanup unused data | none |
๐ Documentation (3 tools)
| Tool | Description | Key Parameters |
|---|---|---|
generate_documentation | Generate Markdown docs | output_path, split_limit, ignore_tree_patterns |
preview_structure | Show directory tree | max_depth, ignore_add, limit, page |
get_project_stats | Get project statistics | none |
๐ฏ Project Management (2 tools)
| Tool | Description | Key Parameters |
|---|---|---|
init_project | Initialize gencodedoc | project_path, preset |
get_project_status | Get project status | project_path |
โ๏ธ Configuration (4 tools)
| Tool | Description | Key Parameters |
|---|---|---|
get_config | View configuration | project_path |
set_config_value | Modify config value | key, value |
apply_preset | Apply preset config | preset (python/nodejs/go/web) |
manage_ignore_rules | Manage ignore rules | add_dir, add_file, add_ext, list_all |
๐ Autosave (3 tools)
| Tool | Description | Key Parameters |
|---|---|---|
start_autosave | Start automatic versioning | project_path, mode |
stop_autosave | Stop automatic versioning | project_path |
get_autosave_status | Get status of all autosaves | none |
๐ค Contributing Contributions welcome! ๐
๐ Report bugs via GitHub Issues ๐ก Suggest features via Discussions ๐ง Submit Pull Requests
Development workflow:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing) - Make your changes
- Run tests (
make test) - Submit PR
๐ License MIT License - See LICENSE file
๐ Issues: GitHub Issues ๐ฌ Discussions: GitHub Discussions ๐ Website: esprit-artificiel.com ๐ง Email: support@esprit-artificiel.com
๐ก Pro Tip: Use GenCodeDoc with Gemini CLI or Claude Desktop for AI-powered version control!
โญ Star this repo if you find it useful!
๐ค "Stop all autosaves and show me their status" โ Calls: stop_autosave(...) + get_autosave_status() โ๏ธ Configuration Configuration File (.gencodedoc.yaml) YAML
project_name: "my-project"
Files/directories to ignore
ignore: dirs: - node_modules - venv - .venv - pycache - .git - dist - build files: - "*.log" - package-lock.json - .DS_Store extensions: - .pyc - .pyo - .exe - .jpg - .png - .pdf patterns: [] # gitignore-style patterns
Intelligent autosave
autosave: enabled: false # Set to true to enable mode: hybrid # timer | diff | hybrid (recommended)
Timer mode: fixed interval
timer: interval: 300 # seconds (5 minutes)
Diff mode: threshold-based
diff_threshold: threshold: 0.05 # Save if 5% of files changed check_interval: 60 # Check every 60 seconds ignore_whitespace: true ignore_comments: false
Hybrid mode: combines timer + diff (RECOMMENDED)
hybrid: min_interval: 180 # Minimum 3 minutes between saves max_interval: 600 # Maximum 10 minutes between saves threshold: 0.03 # Save if 3% of files changed
Retention policy
retention: max_autosaves: 50 # Keep max 50 autosaves compress_after_days: 7 # Compress after 7 days delete_after_days: 30 # Delete after 30 days keep_manual: true # Always keep manual snapshots
Documentation output
output: default_name: "{project}doc{date}.md" include_tree: true include_code: true tree_full_code_select: false # Full tree, selected code only language_detection: true max_file_size: 1000000 # 1 MB max per file
Diff output format
diff_format: default: unified # unified | json | ast unified_context: 3 json_include_content: true ast_enabled: false # Experimental
Storage
storage_path: .gencodedoc compression_enabled: true compression_level: 3 # 1-22 (3 = good balance) Quick Config Commands Bash
Enable autosave
gencodedoc config set autosave.enabled true gencodedoc config set autosave.mode hybrid
Adjust autosave thresholds
gencodedoc config set autosave.hybrid.min_interval 300 gencodedoc config set autosave.hybrid.max_interval 1800 gencodedoc config set autosave.hybrid.threshold 0.03
Add ignore rules
gencodedoc config ignore --add-dir dist gencodedoc config ignore --add-ext .tmp gencodedoc config ignore --add-file debug.log ๐๏ธ Architecture text
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ GenCodeDoc System โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ CLI (Typer) โ โ MCP stdio โ โ MCP SSE/REST โ โ โ โ (Gemini CLI) โ โ (Claude/Web) โ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโผโโโโโโโโโโโ โ Core Managers โ โโโโโโโโโโโโโโโโโโโโโโโค โ โข ConfigManager โ โ โข VersionManager โ โ โข DocGenerator โ โ โข AutosaveManager โ โโโโโโโโโโโโฌโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ โ โ โ โโโโโโผโโโโโโ โโโโโโโผโโโโโโโ โโโโโโผโโโโโโโ โ Scanner โ โ Differ โ โ Storage โ โ โ โ โ โ โ โ โข Scan โ โ โข Unified โ โ โข SQLite โ โ โข Filter โ โ โข JSON โ โ โข zstd โ โ โข Detect โ โ โข AST โ โ โข Dedup โ โโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Storage Layer โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ .gencodedoc/ โ โ โโโ gencodedoc.db โ SQLite (metadata) โ โ โ โโโ snapshots โ Snapshot records โ โ โ โโโ snapshot_files โ File entries โ โ โ โโโ file_contents โ Deduplicated content (SHA256) โ โ โ โโโ autosave_state โ Autosave status โ โ โโโ config/ โ Configuration files โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Features: โข ๐ SHA256 deduplication โ ~70% space savings โข ๐๏ธ zstd compression โ ~3x size reduction โข ๐ Indexed SQLite โ Fast queries โข ๐ Watchdog observer โ Real-time file monitoring Project Structure text
gencodedoc/ โโโ gencodedoc/ # Source code โ โโโ cli/ # CLI commands (Typer) โ โ โโโ main.py # Entry point โ โ โโโ snapshot_cmd.py โ โ โโโ doc_cmd.py โ โ โโโ config_cmd.py โ โ โโโ mcp_cmd.py โ โโโ core/ # Business logic โ โ โโโ config.py # Configuration management โ โ โโโ scanner.py # File scanning & filtering โ โ โโโ versioning.py # Snapshot management โ โ โโโ documentation.py โ โ โโโ differ.py # Version comparison โ โ โโโ autosave.py # Intelligent autosave โ โโโ mcp/ # MCP servers โ โ โโโ server_stdio.py # stdio transport โ โ โโโ server_sse.py # SSE transport โ โ โโโ server.py # REST transport โ โ โโโ tools.py # Tool definitions โ โโโ models/ # Data models (Pydantic) โ โ โโโ config.py โ โ โโโ snapshot.py โ โโโ storage/ # Storage & compression โ โ โโโ database.py # SQLite manager โ โ โโโ snapshot_store.py โ โ โโโ compression.py # zstd compression โ โโโ utils/ # Utilities โ โโโ filters.py โ โโโ formatters.py โ โโโ tree.py โโโ config/ # Configuration presets โ โโโ presets/ โ โโโ python.yaml โ โโโ nodejs.yaml โ โโโ go.yaml โ โโโ web.yaml โโโ tests/ # Unit tests โโโ pyproject.toml # Poetry config โโโ Makefile # Dev commands โโโ README.md ๐ฌ Advanced Features ๐ฏ Intelligent Deduplication (~70% savings) GenCodeDoc uses SHA256-based deduplication:
โ Identical files across snapshots are stored once โ Massive space savings (~70% on real projects) โ zstd compression for ~3x additional reduction โ Optimized SQLite with indexes
Example: 10 snapshots of a 100 MB project
Without deduplication: 1 GB With GenCodeDoc: ~300 MB (dedup + compression) ๐ Autosave Modes Mode How it works Best for timer Save every X seconds Continuous development diff Save when X% changed Critical projects hybrid โญ Min/max interval + threshold General use (recommended) Hybrid mode example:
YAML
hybrid: min_interval: 300 # Don`t save more often than 5 min max_interval: 1800 # Force save after 30 min threshold: 0.03 # OR if 3% of files changed ๐ Diff Formats Format Description Use Case unified Git-style diff Human reading json Structured data Automation ast Semantic diff Code analysis (experimental) Bash
Unified diff (default)
gencodedoc snapshot diff v1.0 v2.0
JSON for scripts
gencodedoc snapshot diff v1.0 v2.0 --format json > changes.json
AST (semantic)
gencodedoc snapshot diff v1.0 v2.0 --format ast ๐ Troubleshooting Common Issues 1๏ธโฃ MCP Error: notifications/initialized Symptom: Error on MCP startup:
text
MCP ERROR: Unknown method: notifications/initialized Cause: MCP protocol sends notifications that older versions didn`t handle.
Solution: โ Already fixed in current version. The server now silently ignores MCP notifications.
2๏ธโฃ Snapshots created in wrong location Symptom: All snapshots go to gencodedoc`s own directory instead of target project.
Cause: project_path not properly extracted from MCP tools/call parameters.
Solution: โ Already fixed. The server now correctly extracts project_path from arguments.
Verify fix:
Bash
This should create snapshot in /path/to/project, not gencodedoc
/gencodedoc create_snapshot project_path=/path/to/project tag=test 3๏ธโฃ Zod validation errors (id=null) Symptom:
text
Error: Expected string or number, received null (path: ["id"]) Cause: JSON-RPC responses with "id": null instead of "id": 0.
Solution: โ Already fixed. All error responses now use request_id or 0.
4๏ธโฃ Files not properly scanned Symptom: Snapshot shows wrong number of files or files from wrong directory.
Cause: snapshot_store.py used relative paths instead of absolute.
Solution: โ Already fixed. SnapshotStore now receives and uses project_path for absolute file paths.
5๏ธโฃ DB not initialized Symptom:
text
Error: no such table: snapshots Cause: Project not initialized before creating snapshot.
Solution:
Bash
Always init first (creates tables)
gencodedoc init --preset python
Or via MCP
/gencodedoc init_project project_path=/path/to/project preset=python 6๏ธโฃ Autosave not starting Symptom: start_autosave tool doesn`t work.
Cause: Autosave requires the MCP server to remain running (it`s a background process).
Solution:
stdio mode: Server runs per-request โ autosave stops when request ends SSE/REST mode: โ Server persistent โ autosave works! Recommended: Use SSE/REST for autosave, stdio for one-off commands.
Debug Mode Bash
Enable verbose logging (if implemented)
export GENCODEDOC_DEBUG=1 poetry run gencodedoc snapshot create --message "test"
Check SQLite DB directly
sqlite3 /path/to/project/.gencodedoc/gencodedoc.db ".tables" sqlite3 /path/to/project/.gencodedoc/gencodedoc.db "SELECT * FROM snapshots;" ๐งช Testing Bash
Run all tests
poetry run pytest
With coverage
poetry run pytest --cov=gencodedoc --cov-report=html
Specific tests
poetry run pytest tests/test_scanner.py -v poetry run pytest tests/test_versioning.py -v poetry run pytest tests/test_mcp.py -v
Watch mode (requires pytest-watch)
poetry run ptw ๐ ๏ธ Development Setup Development Environment Bash
Install with dev dependencies
poetry install
Activate virtual environment
poetry shell
Install pre-commit hooks (if configured)
pre-commit install Makefile Commands Bash
make help # Show all commands make install # Install dependencies make test # Run tests make test-cov # Tests with coverage make lint # Check code quality make format # Format code (Black) make clean # Remove temporary files make docs # Generate documentation make serve-mcp-sse # Start SSE server make serve-mcp-stdio # Start stdio server make all # Lint + test + build Code Style Formatter: Black (line length 100) Linter: Ruff Type hints: Enforced with Pydantic Docstrings: Google style ๐ฏ Use Cases 1๏ธโฃ Continuous Documentation Bash
Initialize with autosave
gencodedoc init --preset python gencodedoc config set autosave.enabled true gencodedoc config set autosave.mode hybrid
Documentation is always up-to-date
gencodedoc doc generate --output docs/API.md 2๏ธโฃ Safe Refactoring Bash
Snapshot before critical changes
gencodedoc snapshot create
--message "Before refactoring authentication system"
--tag before-refactor
... make changes ...
Snapshot after
gencodedoc snapshot create
--message "After refactoring - tests passing"
--tag after-refactor
Compare
gencodedoc snapshot diff before-refactor after-refactor
Rollback if needed
gencodedoc snapshot restore before-refactor --force 3๏ธโฃ Selective API Documentation Bash
Document only specific modules
gencodedoc doc generate
--include src/api/
--include src/models/
--include README.md
--output docs/API_Reference.md
4๏ธโฃ AI-Assisted Workflow (Gemini/Claude)
Bash
1. Configure MCP (once)
Add gencodedoc to your AI assistant config
2. Use natural language
"Create a snapshot with tag v2.0" "Compare v1.0 and v2.0" "Show me project statistics" "Start autosave in hybrid mode" "Generate complete documentation"
AI automatically calls the right MCP tools! ๐
๐ Roadmap Git integration (auto-snapshot on commit) Cloud backup (S3, GCS) Web UI dashboard AST-based semantic diff (full implementation) Multi-language presets (Rust, Java, C++) Snapshot encryption Collaborative features (shared snapshots) ๐ License MIT License - See LICENSE file
๐ค Contributing Contributions welcome! ๐
๐ Report bugs via GitHub Issues ๐ก Suggest features via Discussions ๐ง Submit Pull Requests Development workflow:
Fork the repo Create a feature branch (git checkout -b feature/amazing) Make your changes Run tests (make test) Submit PR ๐ Support ๐ Issues: GitHub Issues ๐ฌ Discussions: GitHub Discussions ๐ Website: esprit-artificiel.com ๐ง Email: support@esprit-artificiel.com ๐ Acknowledgments Built with these amazing tools:
FastAPI - MCP server framework Pydantic - Data validation Typer - CLI framework Rich - Terminal formatting zstandard - Compression Watchdog - File monitoring SQLite - Embedded database
๐ก Pro Tip: Use GenCodeDoc with Gemini CLI or Claude Desktop for AI-powered version control!
โญ Star this repo if you find it useful!
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Figma
Access and interact with Figma files and prototypes directly from AI agents.
Merge MCP Server
Integrates the Merge Unified API with any LLM provider using the MCP protocol.
Xcode MCP
Integrate with Xcode to build and manage your projects.
MCP-CLI Adapter
Use command line tools in a secure fashion as MCP tools.
clj-kondo-MCP
Clojure linter
OpenRPC MCP Server
Provides JSON-RPC functionality through the OpenRPC specification.
Bucket
Flag features, manage company data, and control feature access using Bucket.
Onyx MCP Server
Search and query Onyx programming language documentation and GitHub code examples.
iOS MCP Server
An iOS mobile automation server using Appium and WebDriverAgent, built with clean architecture and SOLID principles.
Aider MCP Server
An MCP server for offloading AI coding tasks to Aider, enhancing development efficiency and flexibility.