Skip to content

docs: add Mermaid classDiagram export to backlog (ID 86) - #445

Merged
carlos-alm merged 3 commits into
mainfrom
docs/backlog-class-diagram-export
Mar 16, 2026
Merged

docs: add Mermaid classDiagram export to backlog (ID 86)#445
carlos-alm merged 3 commits into
mainfrom
docs/backlog-class-diagram-export

Conversation

@carlos-alm

Copy link
Copy Markdown
Contributor

Summary

  • Adds backlog item ID 85 to Tier 1g (Visualization leverage): Mermaid classDiagram export
  • New codegraph export -f class-diagram command and exportClassDiagram programmatic API
  • Most required data already exists in the graph: class/interface/struct/trait/enum nodes, method parent_id (migration v11), property/constant children, extends/implements edges
  • Implementation needs: new rendering function in export.js, visibility markers, --scope option, class_diagram MCP tool

Test plan

  • Verify backlog table formatting renders correctly in GitHub markdown
  • Confirm ID 85 doesn't conflict with existing IDs
  • Verify placement in Tier 1g is appropriate (visualization leverage)

New Tier 1g visualization item — emit UML-style class hierarchy
diagrams from existing graph data (class nodes, parent_id, extends/
implements edges). Most data already exists; needs a new rendering
path in export.js and a class_diagram MCP tool.
@claude

claude Bot commented Mar 15, 2026

Copy link
Copy Markdown

Claude finished @carlos-alm's task —— View job


Reviewing this pull request

Todo List

  • Read the changed file to understand the modification
  • Check backlog structure and verify no ID conflicts
  • Apply comprehensive review analysis per Phase 1-5
  • Assess backlog compliance criteria
  • Post final review recommendation

Root Cause Analysis

Problem Being Solved: Adding a legitimate backlog item for Mermaid classDiagram export functionality to track planned work and communicate requirements.

Why This Approach: Simple documentation addition to the roadmap backlog follows the established pattern for tracking planned features.

Risk Assessment: Very low risk - documentation only change with no code impact.

Critical Issue - ID Conflict

DUPLICATE ID 85: This PR creates a duplicate ID 85. The backlog already has ID 85 for "Hot-path expensive-initialization detection" on line 70. The new classDiagram export entry should use ID 86 instead.

Backlog Compliance

  • Zero-dep: ✓ — Feature described would build on existing graph data (nodes, parent_id, extends/implements edges)
  • Foundation-aligned: ✓ — Visualization feature aligns with core principles, no cloud dependencies or code generation
  • Problem-fit: 3 — Useful for agents and PR reviewers to understand class hierarchies, though indirect benefit for the core "lost AI" problem
  • Breaking: No — Purely additive feature as described
  • Tier: 1 (zero-dep ✓ + foundation-aligned ✓)

Technical Assessment

The feature description is thorough and well-researched:

  • ✅ Correctly identifies existing data (class nodes, parent_id, extends/implements edges from migration v11)
  • ✅ Clear implementation requirements with specific technical details
  • ✅ Appropriate placement in Tier 1g (Visualization leverage)
  • ✅ Realistic scope and complexity assessment

Minor Issues

  1. Tier placement: While technically correct for Tier 1g, this could also fit in Tier 1 general since it leverages existing graph data
  2. Test plan: The PR shows completed test items but this is just a backlog addition - the actual implementation would need testing

Final Recommendation

  • Rating: ⭐⭐☆☆☆ (2/5)
  • Action: REQUEST CHANGES
  • Reasoning: The duplicate ID 85 must be fixed - use ID 86 instead. Otherwise, this is a solid backlog addition with clear requirements and appropriate technical depth.

Required Fix

Change line 139 from:

| 85 | Mermaid `classDiagram` export |

to:

| 86 | Mermaid `classDiagram` export |

Once the ID conflict is resolved, this will be ready to merge.

@greptile-apps

greptile-apps Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a single backlog entry — ID 86: Mermaid classDiagram export — to the Tier 1g (Visualization leverage) section of BACKLOG.md. The entry describes a new codegraph export -f class-diagram command and exportClassDiagram API, along with a corresponding class_diagram MCP tool.

  • The previous duplicate-ID issue (originally filed as ID 85, conflicting with the existing "Hot-path expensive-initialization detection" entry) has been resolved; the entry is correctly numbered 86.
  • All implementation primitives cited as "already existing" are confirmed present in the codebase: getClassHierarchy (src/shared/hierarchy.js), extractClassProperties and implements/extends edge extraction (src/extractors/javascript.js and multiple other language extractors), symbol_children MCP tool, and the parent_id column from DB migration v11.
  • The PR title still reads (ID 85) after the renumbering fix and should be updated to (ID 86) to avoid confusion.

Confidence Score: 4/5

  • Safe to merge — documentation-only change with no code modifications; the only open nit is a stale PR title.
  • Single-file documentation change that adds a well-formed backlog row. The duplicate-ID bug from the earlier review thread was already fixed. All referenced implementation details were verified against the live codebase. The only remaining issue is a cosmetic mismatch between the PR title ("ID 85") and the actual entry ID (86).
  • No files require special attention.

Important Files Changed

Filename Overview
docs/roadmap/BACKLOG.md Adds backlog item ID 86 (Mermaid classDiagram export) to Tier 1g; the entry is well-structured and all referenced implementation primitives (getClassHierarchy, extractClassProperties, symbol_children, migration v11, implements/extends edges) are confirmed to exist in the codebase. Minor: the PR title still says "(ID 85)" after the renumbering fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[codegraph export -f class-diagram] --> B{--scope provided?}
    B -- Yes --> C[getClassHierarchy BFS\nsrc/shared/hierarchy.js]
    B -- No --> D[Query all class/interface/\nstruct/trait/enum nodes]
    C --> D
    D --> E[Group child methods & properties\nvia symbol_children / parent_id]
    E --> F[Infer visibility markers\n+ / - / # from extractClassProperties]
    F --> G[Emit classDiagram syntax\nwith stereotypes <<abstract>> <<interface>>]
    G --> H[Add inheritance arrows\nfrom extends edges]
    G --> I[Add implementation arrows\nfrom implements edges]
    G --> J[Add dependency arrows\nfrom cross-class call edges]
    H & I & J --> K[Mermaid classDiagram output]
    K --> L[class_diagram MCP tool]
Loading

Last reviewed commit: 72969d4

Comment thread docs/roadmap/BACKLOG.md Outdated
| 69 | Node annotations in `diff-impact` / `branch-compare` / `communities` | Use 61's annotation formatter to show top exports on file nodes in `diff-impact -f mermaid`, `branch-compare --format mermaid`, and `communities` output. | Visualization | All visual tools show file API surfaces inline, not just in `export` | ✓ | ✓ | 3 | No | 61 |
| 70 | Drift/risk subgraph labels in `communities` and `triage` | Use 62's semantic label system to annotate `communities` subgraphs with drift status (`**(drifted)**` / `**(cohesive)**`) and add a new `--format mermaid` to `triage` with risk-severity group labels. | Intelligence | Community and triage diagrams communicate structural health directly in the layout | ✓ | ✓ | 3 | No | 62 |
| 84 | Call-count annotations on `sequence` diagram arrows | `sequence` currently deduplicates caller→callee pairs with `SELECT DISTINCT`, silently hiding multi-site calls. Instead, count how many times each caller→callee pair appears in the edges table and annotate the Mermaid arrow with the count when > 1 (e.g., `CallerFile ->> CalleeFile: fnName (×3)`). Requires grouping by `(source_id, target_id)` and emitting the count alongside the edge. | Visualization | Sequence diagrams reveal call intensity — a file calling another 8 times is architecturally different from one that calls it once; agents and reviewers can immediately spot hot paths and coupling strength | ✓ | ✓ | 3 | No | — |
| 85 | Mermaid `classDiagram` export | New `codegraph export -f class-diagram` (and `exportClassDiagram` programmatic API) that emits a Mermaid `classDiagram` for classes, interfaces, structs, traits, and enums in the graph. **What we already have:** class/interface/struct/trait/enum nodes in the `nodes` table, method nodes with `parent_id` linking them to their class (migration v11), property/parameter/constant child nodes via `symbol_children`, `extends` and `implements` edges stored by `builder.js`. **What's needed:** **(a)** New rendering function in `export.js` that queries classes → groups their child methods and properties → emits Mermaid `classDiagram` syntax with `<<abstract>>`/`<<interface>>` stereotypes, inheritance (`<\|--`) and implementation (`..\|>`) arrows; **(b)** visibility markers (`+`/`-`/`#`) — infer from JS `#private` fields (already detected as `private_property_identifier` in `extractClassProperties`) and language-specific access modifiers; **(c)** optional `--scope <file-or-class>` to restrict diagram to a class and its hierarchy (uses `getClassHierarchy` BFS); **(d)** dependency arrows (`..>`) derived from cross-class call edges. **Nice-to-have (not blocking):** type annotations on methods/fields (requires extractor changes to persist TS/Java type info). Add corresponding `class_diagram` MCP tool. | Visualization | Agents and PR reviewers get UML-style class hierarchy diagrams generated directly from the graph — useful for understanding inheritance structures, spotting god classes, and reviewing OOP designs without manual diagramming. Particularly valuable for Java, C#, TypeScript, and Rust codebases with deep type hierarchies | ✓ | ✓ | 3 | No | — |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate backlog ID 85

ID 85 is already used on line 70 for "Hot-path expensive-initialization detection" (Tier 1b). This entry should use the next available ID, which is 86.

Suggested change
| 85 | Mermaid `classDiagram` export | New `codegraph export -f class-diagram` (and `exportClassDiagram` programmatic API) that emits a Mermaid `classDiagram` for classes, interfaces, structs, traits, and enums in the graph. **What we already have:** class/interface/struct/trait/enum nodes in the `nodes` table, method nodes with `parent_id` linking them to their class (migration v11), property/parameter/constant child nodes via `symbol_children`, `extends` and `implements` edges stored by `builder.js`. **What's needed:** **(a)** New rendering function in `export.js` that queries classes → groups their child methods and properties → emits Mermaid `classDiagram` syntax with `<<abstract>>`/`<<interface>>` stereotypes, inheritance (`<\|--`) and implementation (`..\|>`) arrows; **(b)** visibility markers (`+`/`-`/`#`) — infer from JS `#private` fields (already detected as `private_property_identifier` in `extractClassProperties`) and language-specific access modifiers; **(c)** optional `--scope <file-or-class>` to restrict diagram to a class and its hierarchy (uses `getClassHierarchy` BFS); **(d)** dependency arrows (`..>`) derived from cross-class call edges. **Nice-to-have (not blocking):** type annotations on methods/fields (requires extractor changes to persist TS/Java type info). Add corresponding `class_diagram` MCP tool. | Visualization | Agents and PR reviewers get UML-style class hierarchy diagrams generated directly from the graph — useful for understanding inheritance structures, spotting god classes, and reviewing OOP designs without manual diagramming. Particularly valuable for Java, C#, TypeScript, and Rust codebases with deep type hierarchies | ✓ | ✓ | 3 | No | — |
| 86 | Mermaid `classDiagram` export | New `codegraph export -f class-diagram` (and `exportClassDiagram` programmatic API) that emits a Mermaid `classDiagram` for classes, interfaces, structs, traits, and enums in the graph. **What we already have:** class/interface/struct/trait/enum nodes in the `nodes` table, method nodes with `parent_id` linking them to their class (migration v11), property/parameter/constant child nodes via `symbol_children`, `extends` and `implements` edges stored by `builder.js`. **What's needed:** **(a)** New rendering function in `export.js` that queries classes → groups their child methods and properties → emits Mermaid `classDiagram` syntax with `<<abstract>>`/`<<interface>>` stereotypes, inheritance (`<|--`) and implementation (..|>) arrows; **(b)** visibility markers (`+`/`-`/`#`) — infer from JS `#private` fields (already detected as `private_property_identifier` in `extractClassProperties`) and language-specific access modifiers; **(c)** optional `--scope <file-or-class>` to restrict diagram to a class and its hierarchy (uses `getClassHierarchy` BFS); **(d)** dependency arrows (`..>`) derived from cross-class call edges. **Nice-to-have (not blocking):** type annotations on methods/fields (requires extractor changes to persist TS/Java type info). Add corresponding `class_diagram` MCP tool. | Visualization | Agents and PR reviewers get UML-style class hierarchy diagrams generated directly from the graph — useful for understanding inheritance structures, spotting god classes, and reviewing OOP designs without manual diagramming. Particularly valuable for Java, C#, TypeScript, and Rust codebases with deep type hierarchies | ✓ | ✓ | 3 | No | — |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 72969d4 — renumbered to ID 86.

ID 85 was already used by "Hot-path expensive-initialization
detection" in Tier 1b. Renumber classDiagram export to ID 86.
@carlos-alm

Copy link
Copy Markdown
Contributor Author

@greptileai

Comment thread docs/roadmap/BACKLOG.md
| 69 | Node annotations in `diff-impact` / `branch-compare` / `communities` | Use 61's annotation formatter to show top exports on file nodes in `diff-impact -f mermaid`, `branch-compare --format mermaid`, and `communities` output. | Visualization | All visual tools show file API surfaces inline, not just in `export` | ✓ | ✓ | 3 | No | 61 |
| 70 | Drift/risk subgraph labels in `communities` and `triage` | Use 62's semantic label system to annotate `communities` subgraphs with drift status (`**(drifted)**` / `**(cohesive)**`) and add a new `--format mermaid` to `triage` with risk-severity group labels. | Intelligence | Community and triage diagrams communicate structural health directly in the layout | ✓ | ✓ | 3 | No | 62 |
| 84 | Call-count annotations on `sequence` diagram arrows | `sequence` currently deduplicates caller→callee pairs with `SELECT DISTINCT`, silently hiding multi-site calls. Instead, count how many times each caller→callee pair appears in the edges table and annotate the Mermaid arrow with the count when > 1 (e.g., `CallerFile ->> CalleeFile: fnName (×3)`). Requires grouping by `(source_id, target_id)` and emitting the count alongside the edge. | Visualization | Sequence diagrams reveal call intensity — a file calling another 8 times is architecturally different from one that calls it once; agents and reviewers can immediately spot hot paths and coupling strength | ✓ | ✓ | 3 | No | — |
| 86 | Mermaid `classDiagram` export | New `codegraph export -f class-diagram` (and `exportClassDiagram` programmatic API) that emits a Mermaid `classDiagram` for classes, interfaces, structs, traits, and enums in the graph. **What we already have:** class/interface/struct/trait/enum nodes in the `nodes` table, method nodes with `parent_id` linking them to their class (migration v11), property/parameter/constant child nodes via `symbol_children`, `extends` and `implements` edges stored by `builder.js`. **What's needed:** **(a)** New rendering function in `export.js` that queries classes → groups their child methods and properties → emits Mermaid `classDiagram` syntax with `<<abstract>>`/`<<interface>>` stereotypes, inheritance (`<\|--`) and implementation (`..\|>`) arrows; **(b)** visibility markers (`+`/`-`/`#`) — infer from JS `#private` fields (already detected as `private_property_identifier` in `extractClassProperties`) and language-specific access modifiers; **(c)** optional `--scope <file-or-class>` to restrict diagram to a class and its hierarchy (uses `getClassHierarchy` BFS); **(d)** dependency arrows (`..>`) derived from cross-class call edges. **Nice-to-have (not blocking):** type annotations on methods/fields (requires extractor changes to persist TS/Java type info). Add corresponding `class_diagram` MCP tool. | Visualization | Agents and PR reviewers get UML-style class hierarchy diagrams generated directly from the graph — useful for understanding inheritance structures, spotting god classes, and reviewing OOP designs without manual diagramming. Particularly valuable for Java, C#, TypeScript, and Rust codebases with deep type hierarchies | ✓ | ✓ | 3 | No | — |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title still references old ID 85

The entry was correctly renumbered to ID 86 in this commit, but the PR title (docs: add Mermaid classDiagram export to backlog (ID 85)) was never updated to match. Anyone searching for "ID 85" from the PR title will land on a different entry (the "Hot-path expensive-initialization detection" item in Tier 1b). Consider updating the PR title to (ID 86) for consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — PR title updated to (ID 86).

@carlos-alm carlos-alm changed the title docs: add Mermaid classDiagram export to backlog (ID 85) docs: add Mermaid classDiagram export to backlog (ID 86) Mar 15, 2026
…agram-export

Impact: 9 functions changed, 14 affected
@carlos-alm
carlos-alm merged commit e7f9e78 into main Mar 16, 2026
13 checks passed
@carlos-alm
carlos-alm deleted the docs/backlog-class-diagram-export branch March 16, 2026 02:30
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant