The Problem

Large codebases accumulate documentation gaps as they grow. Developers lack a systematic way to generate holistic, structured documentation that captures cross-module interactions, architecture dependencies, and multilingual code — all while keeping pace with code changes. CodeWiki addresses this by automating repository‑level documentation generation, but the codebase itself has SDLC gaps that affect its readiness for production use.

What This Does

CodeWiki is a Python‑based framework (83 Python files) that scans codebases, analyzes dependencies across multiple languages (Python, JavaScript, TypeScript, PHP, C, C++, C#, Java, Kotlin), and produces structured documentation including diagrams and metadata. The core logic lives in codewiki/src/be/dependency_analyzer/ — analyzers for each language parse ASTs, build dependency graphs, and output results. Documentation generation flows through codewiki/src/be/documentation_generator.py (entry point run, reaches 167 functions) and is emitted via codewiki/cli/adapters/doc_generator.py. Configuration and CLI lives in codewiki/cli/main.py (entry point main, reaches 11 functions) and codewiki/cli/config_manager.py. The repository also exposes an MCP server (codewiki/mcp/server.py) with handlers like _handle_analyze_repo and call_tool. Docker and Flask are the only detected frameworks; the project is intended to be installed via pip install git+https://github.com/FSoft-AI4Code/CodeWiki.git and configured with an LLM provider key.

How It Is Wired

Execution starts at codewiki/cli/main.py:64 (main) or codewiki/src/be/documentation_generator.py:302 (run). From main, control reaches 11 functions including ensure_directories (filesystem). The run entry point reaches 167 functions and is called by nothing else in the repo — it is the primary code‑path for documentation generation. Key traced paths: main -> ensure_directories [filesystem], run -> ensure_directory [filesystem], call_tool -> _handle_get_module_tree [reads module_tree.json via Path.read_text]. Circular imports affect 6 modules: codewiki/src/be/backend.py, codewiki/cli/main.py, codewiki/src/be/caw_backend.py (instability 0.92). A hub module is codewiki/src/be/dependency_analyzer/models/core (20 dependents, instability 0); codewiki/src/config (12 dependents, instability 0). The dependency‑analyzer analysis cycle involves codewiki/src/be/pydantic_ai_backend and codewiki/src/be/caw_backend. The widest‑blast‑radius files are the dependency‑analyzer analyzers (php.py: 13 callers, javascript.py: 7 callers, typescript.py: 2 callers) and codewiki/src/utils.py (10 callers).

How To Use It

Setup

pip install git+https://github.com/FSoft-AI4Code/CodeWiki.git
codewiki --version

Configuration Edit codewiki/src/config.py or use the CLI codewiki config set to set provider, API key, and models. The config file lives at the repository root alongside pyproject.toml and requirements.txt. Required env vars or a .env file may be referenced by the codewiki/cli/config_manager.py module (which reads from keyring or a file on disk).

Running it

# CLI: analyze a repo and generate docs
codewiki analyze /path/to/codebase --output ./docs

# Or invoke the entry point directly
python -m codewiki.cli.main analyze /path/to/codebase

Real-World Use

A DevOps team onboards a 400‑kLOC monorepo with Python, TypeScript, and PHP services. They run codewiki analyze which walks the repo, invokes language‑specific analyzers (php.py, javascript.py, typescript.py, python.py), builds a call graph via codewiki/src/be/dependency_analyzer/analysis/call_graph_analyzer.py, and emits a markdown docs tree into ./docs/. The generated artifacts include module trees, relationship graphs, and architecture diagrams that can be published to a static site or integrated into an internal wiki. Because the tool is repository‑level, a single command captures cross‑module patterns that would otherwise require manual review across dozens of repositories.

Code Health & Issues

The static analysis (60 findings: 17 high, 43 medium, 0 low) reports the following production‑relevant items:

  • [HIGH/soundness] Import cycle member — 6 files participate in circular dependencies: codewiki/src/be/backend.py, codewiki/cli/main.py, codewiki/src/be/caw_backend.py. Fix: extract shared types, invert a dependency, or defer an import.
  • [HIGH/soundness] No LICENSE file — redistribution rights are undefined. Fix: add MIT or Apache-2.0 at the repository root.
  • [HIGH/soundliness] No test suite — 83 source files have no tests. Fix: add one test per public entry point, then CI step.
  • [HIGH/build] No lockfile beside pyproject.toml — non-reproducible builds. Fix: run the package manager once and commit the generated lockfile.
  • [HIGH/ci] No CI/CD pipeline — no automated build/test gate. Fix: add a workflow running build and test on push/pull_request.
  • [MEDIUM/resource_safety] File opened without context manager in 2 files (codewiki/src/be/utils.py, codewiki/src/be/dependency_analyzer/utils/security.py). Fix: use with open(...) as f:.
  • [MEDIUM/cognitive_load] Oversized files — codewiki/src/be/agent_tools/str_replace_editor.py (622 lines), codewiki/cli/commands/config.py, codewiki/src/be/dependency_analyzer/analyzers/typescript.py. Fix: split into cohesive units.
  • [MEDIUM/clarity] Duplicated code blocks — 127 repeated 6‑line blocks across 20 files including codewiki/cli/commands/config.py, codewiki/cli/commands/generate.py, codewiki/cli/git_manager.py. Fix: extract shared helpers.

Additional SDLC observations from structure: missing tests/ directory, no .github/ CI config, no LICENSE at root, no lockfile beside pyproject.toml, Dockerfile uses mutable base image python:3.12-slim without a digest or non‑root USER.

The Bottom Line

CodeWiki delivers a functional, multi‑language documentation‑generation pipeline that can save significant manual effort for large codebases. However, the repository lacks fundamental SDLC guards — no license, no tests, no CI, no lockfile, and circular imports that make refactiling risky. It is suitable for teams that need ad‑hoc documentation generation and are comfortable patching the identified code‑health gaps, but it is not yet production‑ready without those additions.