Skip to main content

CLI tool for explaining unfamiliar codebases.

Project description

Explain Codebase

CLI tool that analyzes any repository and explains its architecture, entrypoints, dependencies, and impact of changes.

explain-codebase analyzes a repository and helps developers understand unfamiliar projects faster by showing how the system is structured and where execution likely starts.

It works with both local folders and public GitHub repositories.


Why

When opening a new repository, it is often unclear:

  • where the application starts
  • which modules are central
  • which files interact with external systems
  • what files are risky to modify

explain-codebase scans the project, builds a dependency graph, detects architectural signals, and produces a compact CLI overview that helps you understand the codebase faster.


Installation

pip install explain-codebase

For local development:

pip install -e .[dev]

Quick Start

Analyze the current repository:

explain-codebase .

Verbose architecture output:

explain-codebase . --verbose

Deep architecture analysis:

explain-codebase . --deep

Analyze a GitHub repository:

explain-codebase https://github.com/user/repo

Example Output

Explain Codebase
--------------------------------

Repository

  Path        C:\Projects\orders-api
  Type        Python backend service
  Language    python
  Files       7

Architecture

  Entrypoints        1
  Core modules       5
  Side effects       4

Suggested starting point

  api_server.py

Run with --verbose to see full architecture

Verbose mode provides a deeper architecture view:

Execution flow

api_server.py
|- routes/order_routes.py
|- services/order_service.py
|  |- repositories/order_repository.py
|  \- clients/warehouse_client.py
\- middleware/auth_guard.py

Features

  • Analyze local folders and public GitHub repositories
  • Detect project language and project type
  • Detect entrypoints automatically
  • Rank core modules by dependency usage
  • Infer likely execution flow
  • Detect modules that interact with database, network, filesystem, or cache
  • Detect architecture folders such as services, repositories, routes, and models
  • Detect large modules and highly coupled files
  • Detect architecture smells such as circular dependencies
  • Generate dependency graph visualizations
  • Generate HTML architecture reports
  • Explain a single file in project context
  • Suggest onboarding reading paths
  • Support CI mode for architecture checks

Common Commands

Analyze a repository:

explain-codebase .

Verbose architecture output:

explain-codebase . --verbose

Deep architecture analysis:

explain-codebase . --deep

Suggest a reading order for a new developer:

explain-codebase onboarding .

Explain a single file:

explain-codebase file src/services/order_service.ts

Generate a dependency graph:

explain-codebase . --graph

Generate an HTML architecture report:

explain-codebase . --report

Run in CI mode:

explain-codebase . --ci

Remote Repositories

You can analyze a public GitHub repository directly:

explain-codebase https://github.com/user/repo

The tool will:

  1. Resolve the repository
  2. Check that it exists and is publicly accessible
  3. Ask for confirmation before cloning
  4. Clone it into a temporary workspace
  5. Run the analysis
  6. Remove the temporary workspace automatically

Output Modes

Default mode shows a compact overview:

explain-codebase .

Verbose mode shows the full architecture structure:

explain-codebase . --verbose

Deep mode focuses on architecture risks and potential issues:

explain-codebase . --deep

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

explain_codebase-0.1.2.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

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

explain_codebase-0.1.2-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file explain_codebase-0.1.2.tar.gz.

File metadata

  • Download URL: explain_codebase-0.1.2.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for explain_codebase-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9754d07c833e8a897bcb5cf3ceda8c81b113d2543f51f422e763bb027bc178c4
MD5 5f005950cbef6faea570dfee99ec82cf
BLAKE2b-256 250d5d7784097fc88926b56babc19e1a523a83b1ab27ae79862c3ca1192c5417

See more details on using hashes here.

File details

Details for the file explain_codebase-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for explain_codebase-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d7c3942b9c78fe23573dd6c63016e0d4f78d2fa0d9c15d9b023a058c27730f
MD5 cd32f52a80e6f02c008ecb4ce36532cb
BLAKE2b-256 2b0fe3ffc0501e5918c39dd793401e2547e09c66ba07dbbe2bc5f27d981de1da

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