Skip to content

Codemap

Maps a codebase: files, classes, functions, entry points, language statistics. Answers: "What's in this codebase?"

Returns file roles (source, test, config, docs, build), language breakdown, class/function definitions with signatures, and detected entry points.

Usage

CLI

python codemap.py <project_path>
python codemap.py <project_path> --output codemap.json
python codemap.py <project_path> --markdown --output codemap.md
python codemap.py <project_path> --max-files 500
python codemap.py <project_path> --compact

MCP

drydock_codemap(project_path: str, max_files: int = 2000) -> str

Returns code map as JSON.

Example Output

{
  "summary": {
    "total_files": 156,
    "source_files": 89,
    "test_files": 34,
    "config_files": 12,
    "doc_files": 15,
    "build_files": 6,
    "languages": {
      "python": 89,
      "json": 12,
      "markdown": 15,
      "yaml": 8
    }
  },
  "entry_points": [
    {
      "path": "src/main.py",
      "type": "module",
      "is_app": true,
      "role": "source"
    },
    {
      "path": "src/cli.py",
      "type": "module",
      "role": "source"
    }
  ],
  "files": [
    {
      "path": "src/core/engine.py",
      "role": "source",
      "language": "python",
      "line_count": 450,
      "classes": [
        {
          "name": "Engine",
          "line": 25,
          "bases": ["ABC"],
          "decorators": ["@dataclass"],
          "methods": [
            {
              "name": "run",
              "line": 40,
              "args": [
                {"name": "input", "type": "str"},
                {"name": "timeout", "type": "int"}
              ],
              "returns": "bool",
              "is_async": false
            },
            {
              "name": "async_process",
              "line": 80,
              "args": [{"name": "data", "type": "list"}],
              "returns": "list",
              "is_async": true
            }
          ]
        }
      ],
      "functions": [
        {
          "name": "initialize",
          "line": 400,
          "args": [{"name": "config", "type": "dict"}],
          "returns": "Engine",
          "is_async": false
        }
      ],
      "constants": [
        {"name": "DEFAULT_TIMEOUT", "line": 5}
      ]
    },
    {
      "path": "src/api/handler.ts",
      "role": "source",
      "language": "typescript",
      "line_count": 320,
      "interfaces": [
        {
          "name": "RequestHandler",
          "line": 10,
          "methods": ["handle", "validate"]
        }
      ],
      "exports": [
        {"name": "RequestHandler", "type": "interface"},
        {"name": "handleRequest", "type": "function"}
      ]
    },
    {
      "path": "tests/test_engine.py",
      "role": "test",
      "language": "python",
      "line_count": 280,
      "functions": [
        {"name": "test_engine_run", "line": 15},
        {"name": "test_timeout_handling", "line": 40}
      ]
    }
  ]
}

Options

Flag Type Default Description
project_path positional required Path to project root
--output, -o string stdout Output file path
--markdown, -m flag false Output as Markdown instead of JSON
--max-files int 2000 Maximum files to scan
--compact, -c flag false Compact JSON (no indentation)