Skip to content

Structure Analyzer

Analyze file structure: counts, types, sizes, and directory depth. Answers: "How big is this?"

A simple, fast tool that returns total files/directories, file type distribution, largest files, directory depth, and top-level layout.

Usage

CLI

python structure_analyzer.py <project_path>
python structure_analyzer.py <project_path> --output structure.json
python structure_analyzer.py <project_path> --json

MCP

drydock_structure(project_path: str) -> str

Returns structure analysis as JSON.

Example Output

{
  "total_files": 247,
  "total_dirs": 42,
  "total_size_bytes": 8_500_000,
  "top_level_dirs": [
    "src",
    "tests",
    "docs",
    "config",
    ".github"
  ],
  "file_types": {
    ".py": {
      "count": 89,
      "size": 2_450_000,
      "avg_size": 27_528
    },
    ".ts": {
      "count": 12,
      "size": 380_000,
      "avg_size": 31_667
    },
    ".json": {
      "count": 18,
      "size": 150_000,
      "avg_size": 8_333
    },
    ".md": {
      "count": 8,
      "size": 95_000,
      "avg_size": 11_875
    },
    ".yaml": {
      "count": 6,
      "size": 45_000,
      "avg_size": 7_500
    },
    ".js": {
      "count": 4,
      "size": 28_000,
      "avg_size": 7_000
    }
  },
  "largest_files": [
    {
      "path": "src/core/engine.py",
      "size": 45_000,
      "type": ".py"
    },
    {
      "path": "src/api/handler.py",
      "size": 32_000,
      "type": ".py"
    },
    {
      "path": "tests/integration/test_suite.py",
      "size": 28_500,
      "type": ".py"
    },
    {
      "path": "src/ui/components.ts",
      "size": 22_000,
      "type": ".ts"
    },
    {
      "path": "docs/API.md",
      "size": 18_000,
      "type": ".md"
    }
  ],
  "deepest_path": {
    "path": "src/core/engine/models/validators",
    "depth": 5
  }
}

Options

Flag Type Default Description
project_path positional required Path to project root
--output, -o string stdout Output file path
--json flag false Output as JSON (default for CLI)