Skip to content

fix: context bomb shows zeros for lines and language counts #7

@greynewell

Description

@greynewell

Problem

The context bomb output shows 0 lines and go (0), json (0) because the IR-to-ProjectGraph conversion doesn't correctly map the available API fields.

**Codebase:** 15 files · 51 functions · 0 lines
**Languages:** go (0), json (0)

Root cause (confirmed from raw API response)

The SupermodelIR response does not contain a line count field — TotalLines is simply not available.

For language counts, metadata.languages is []string (names only, no per-language file counts). The conversion currently builds map[string]int with all values set to 0, which renders as go (0), json (0).

The actual file/function counts live in summary (free-form map) and stats.nodeTypes:

"summary": { "filesProcessed": 15, "functions": 51, "primaryLanguage": null, ... }
"stats": { "nodeTypes": { "File": 15, "Function": 51, "Class": 52, ... } }
"metadata": { "fileCount": 15, "languages": ["go", "json"] }

Fix

  1. TotalLines — remove from template (not in API), or derive from stats.nodeTypes if a line-count node type is ever added
  2. Language counts — either:
    • Remove counts and just show names: go, json
    • Derive per-language file counts from stats.nodeTypes or by walking the graph nodes (nodes have a language property)
  3. summary field — currently typed as a struct but the SDK defines it as map[string]any; should be unmarshalled accordingly to avoid silent zero-fills if field names change

Also noted

primaryLanguage came back null in the response for this repo — the language detection falls back correctly to metadata.languages[0].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions