open-index/open-npm huggingface dataset:
npm package: @getmikk/diagram-generator
Description: > 7 Mermaid architecture diagrams generated from your lock file.
Latest version: 2.0.14
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

﻿# @getmikk/diagram-generator

> 7 Mermaid architecture diagrams generated from your lock file.

[![npm](https://img.shields.io/npm/v/@getmikk/diagram-generator)](https://www.npmjs.com/package/@getmikk/diagram-generator)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](../../LICENSE)

Generates Mermaid `.mmd` files from `mikk.lock.json` and `mikk.json`. All metrics are derived from the actual call graph — no manual input.

> Part of [Mikk](../../README.md) — live architectural context for your AI agent.

---

## Usage

Generated automatically by `mikk init` and `mikk analyze`. Or regenerate manually:

```bash
mikk visualize all          # all 7 diagrams
mikk visualize module <id>  # one module diagram
```

Programmatically:

```typescript
import { DiagramOrchestrator } from '@getmikk/diagram-generator'

const orchestrator = new DiagramOrchestrator(contract, lock, projectRoot)
const { generated } = await orchestrator.generateAll()
// generated: string[] — paths of written .mmd files
```

---

## Diagrams

All files are written to `.mikk/diagrams/`.

### `main.mmd`
Full architecture overview. All modules as nodes, inter-module dependencies as directed edges. Entry points marked distinctly.

### `health.mmd`
Module health dashboard. For each module, shows:
- **Cohesion** — ratio of internal calls to total calls (higher = more self-contained)
- **Coupling** — count of external function calls + cross-module file imports (lower = more independent)
- **Function count**
- **Health indicator** — 🟢 healthy (> 70%), 🟡 warning (40–70%), 🔴 critical (< 40%)

Metrics are computed directly from the call graph in the lock file — not estimated.

### `matrix.mmd`
Dependency matrix. Grid of which modules depend on which. Identifies tight coupling and potential circular dependencies at a glance.

### `flow-entrypoints.mmd`
Entry point call flow. Traces how calls propagate from declared entry functions into the rest of the codebase.

### `impact-<file>.mmd`
Blast radius visualization for a specific file change. Generated by `mikk context impact <file>`. Shows the change origin and all impacted nodes.

### `modules/<id>.mmd`
Per-module internal call graph. All functions in the module as nodes, internal function calls as edges. Exported functions marked distinctly.

### `capsules/<id>.mmd`
Per-module public API capsule. Shows only the exported surface — function names, params, return types — without internal implementation detail.

---

## Viewing Diagrams

Any Mermaid-compatible renderer works. Recommended:

- **VS Code**: install the "Mermaid Preview" extension, then open any `.mmd` file
- **GitHub**: Mermaid renders natively in `.md` files — embed with ` ```mermaid ` fences
- **Mermaid Live**: paste at https://mermaid.live