$ show samueltuoyo15/Dokugen
Dokugen is an open-source, AI-powered documentation generator delivered as a monorepo (Turborepo + pnpm). The core product is a CLI that generates, updates, and maintains README files, AI commit messages, licenses, changelogs, and OG social cards. It ships three CLI clients (TypeScript, Python, and a Go stub), a companion Express backend that proxies AI API calls (DeepSeek, OpenRouter, Gemini) and tracks usage via Supabase, a Next.js documentation site, a minimal VS Code extension, and a Remotion promotional video project. The architecture is client-server: CLIs detect project type using a heuristic pattern-matching algorithm, scan files, and send compressed payloads to the backend for AI generation, with streaming SSE responses. The system also includes auto-update mechanisms, interactive menus, and caching. While the product is functional and well-structured, there is significant duplication across CLI implementations (e.g., project detection logic is nearly identical in TypeScript and Python but drifts), a Go client that is only a placeholder, and a VS Code extension that is boilerplate. The codebase demonstrates solid engineering practices (rate limiting, security hardening, Docker multi-stage builds) but suffers from maintenance overhead due to the multi-language surface and some stale generated artifacts.
The LLM identified 4 files worth highlighting for reuse:
Implements a self-contained project-type detection algorithm that scans files, folders, package.json contents, and dependency lists to infer the language/framework with weighted confidence scores (30/25/20/15/10). It is reusable across any CLI or tool that needs to auto-detect project characteristics without external dependencies, and the pattern is language-agnostic (a Python twin exists). Despite duplication, the core logic is isolated and could be extracted into a standalone library.
Provides file traversal, content filtering (ignoring .env, credentials, binary files), and incremental hashing to avoid re-sending unchanged files to the AI backend. This is a reusable pattern for any tool that needs to efficiently package a project snapshot while respecting privacy and bandwidth constraints. The logic is self-contained and could be adapted to other languages or use cases.
A lightweight in-memory cache manager with TTL support, used to store AI responses and reduce redundant API calls. It is a clean, dependency-free utility that can be dropped into any Node.js service needing simple key-value caching with expiration. Demonstrates good separation of concerns and is easily testable.
Configurable rate-limiting middleware for Express that protects the AI backend from abuse. It is parameterized (window, max requests) and can be reused across different routes or services. While rate limiting is common, this implementation is clean, well-typed, and integrates with the server's logging, making it a solid reference pattern.