@getmikk/diagram-generator 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmikk/diagram-generator",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "dev": "tsc --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@getmikk/core": "^1.8.0"
24
+ "@getmikk/core": "^1.9.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "typescript": "^5.7.0",
@@ -0,0 +1,100 @@
1
+ import type { MikkContract, MikkLock } from '@getmikk/core'
2
+
3
+ /**
4
+ * Generates a Mermaid mindmap of all mikk CLI commands grouped by category.
5
+ * Does not depend on contract or lock data — it is a static reference diagram.
6
+ */
7
+ export class CommandsDiagramGenerator {
8
+ // contract/lock kept for interface consistency with other generators
9
+ constructor(
10
+ private _contract?: MikkContract,
11
+ private _lock?: MikkLock,
12
+ ) {}
13
+
14
+ generate(): string {
15
+ return `mindmap
16
+ root((mikk))
17
+ Setup
18
+ mikk init
19
+ Scan project
20
+ Build dependency graph
21
+ Generate all artifacts
22
+ mikk analyze
23
+ Re-analyze after changes
24
+ Update lock file
25
+ mikk watch
26
+ Live file watcher daemon
27
+ Incremental updates
28
+ 100ms debounce
29
+ mikk diff
30
+ Files changed since last analysis
31
+ mikk remove
32
+ Uninstall mikk
33
+ Delete all artifacts
34
+ Health
35
+ mikk stats
36
+ Per-module metrics
37
+ Function counts
38
+ Dead code %
39
+ mikk doctor
40
+ 7-point diagnostic check
41
+ Config validation
42
+ Lock freshness
43
+ mikk dead-code
44
+ Unused functions
45
+ Filter by module
46
+ Architecture
47
+ mikk ci
48
+ Exit non-zero on violations
49
+ CI pipeline gate
50
+ mikk ci --strict
51
+ Also enforce dead code threshold
52
+ mikk ci --format json
53
+ Machine-readable output
54
+ mikk contract validate
55
+ Constraint violations
56
+ Drift detection
57
+ mikk contract show-boundaries
58
+ Cross-module dependencies
59
+ Context
60
+ mikk context query
61
+ Architecture question
62
+ Graph-traced response
63
+ mikk context impact
64
+ Blast radius of a file change
65
+ Classified by severity
66
+ mikk context for
67
+ Token-budgeted task context
68
+ Refactoring
69
+ mikk intent
70
+ Pre-flight a refactor
71
+ Detect conflicts before coding
72
+ mikk rename
73
+ Coordinated multi-file rename
74
+ Find all call sites
75
+ MCP Server
76
+ mikk mcp
77
+ Start MCP server
78
+ 22 tools available
79
+ mikk mcp install
80
+ Install into Claude Desktop
81
+ Install into Cursor
82
+ Visualization
83
+ mikk visualize all
84
+ Regenerate all diagrams
85
+ 7 diagram types
86
+ mikk visualize module
87
+ Per-module call graph
88
+ Public API capsule
89
+ mikk visualize commands
90
+ This diagram
91
+ Decisions
92
+ mikk adr list
93
+ All architectural decisions
94
+ mikk adr add
95
+ New ADR
96
+ mikk adr get
97
+ Details for a specific ADR
98
+ `
99
+ }
100
+ }
@@ -93,7 +93,9 @@ export class DependencyMatrixGenerator {
93
93
  // Count file-level cross-module imports
94
94
  for (const file of Object.values(this.lock.files)) {
95
95
  if (!file.imports) continue
96
- for (const importedPath of file.imports) {
96
+ for (const imp of file.imports) {
97
+ const importedPath = imp.resolvedPath
98
+ if (!importedPath) continue
97
99
  const importedFile = this.lock.files[importedPath]
98
100
  if (importedFile && file.moduleId !== importedFile.moduleId) {
99
101
  const key = `${file.moduleId}|${importedFile.moduleId}`
@@ -45,7 +45,9 @@ export class HealthDiagramGenerator {
45
45
  }
46
46
  for (const file of Object.values(this.lock.files)) {
47
47
  if (!file.imports) continue
48
- for (const importedPath of file.imports) {
48
+ for (const imp of file.imports) {
49
+ const importedPath = imp.resolvedPath
50
+ if (!importedPath) continue
49
51
  const importedFile = this.lock.files[importedPath]
50
52
  if (importedFile && file.moduleId !== importedFile.moduleId) {
51
53
  const key = `${file.moduleId}|${importedFile.moduleId}`
@@ -88,7 +90,9 @@ export class HealthDiagramGenerator {
88
90
  }
89
91
  for (const file of moduleFiles) {
90
92
  if (!file.imports) continue
91
- for (const importedPath of file.imports) {
93
+ for (const imp of file.imports) {
94
+ const importedPath = imp.resolvedPath
95
+ if (!importedPath) continue
92
96
  const importedFile = this.lock.files[importedPath]
93
97
  if (importedFile) {
94
98
  if (importedFile.moduleId === moduleId) internalCalls++
@@ -61,7 +61,9 @@ export class MainDiagramGenerator {
61
61
  // File-level cross-module imports
62
62
  for (const file of Object.values(this.lock.files)) {
63
63
  if (!file.imports) continue
64
- for (const importedPath of file.imports) {
64
+ for (const imp of file.imports) {
65
+ const importedPath = imp.resolvedPath
66
+ if (!importedPath) continue
65
67
  const importedFile = this.lock.files[importedPath]
66
68
  if (importedFile && file.moduleId !== importedFile.moduleId) {
67
69
  const edgeKey = `${file.moduleId}→${importedFile.moduleId}`
@@ -103,7 +105,7 @@ export class MainDiagramGenerator {
103
105
  const ranked = allFiles
104
106
  .map(f => ({
105
107
  ...f,
106
- connections: (f.imports?.length || 0) + (Object.values(this.lock.files).filter(other => other.imports?.includes(f.path)).length),
108
+ connections: (f.imports?.length || 0) + (Object.values(this.lock.files).filter(other => other.imports?.some(i => i.resolvedPath === f.path)).length),
107
109
  }))
108
110
  .sort((a, b) => b.connections - a.connections)
109
111
 
@@ -146,8 +148,8 @@ export class MainDiagramGenerator {
146
148
  for (const file of filesToShow) {
147
149
  if (!file.imports) continue
148
150
  for (const imp of file.imports) {
149
- if (shownPaths.has(imp)) {
150
- lines.push(` ${this.sanitizeId(file.path)} --> ${this.sanitizeId(imp)}`)
151
+ if (imp.resolvedPath && shownPaths.has(imp.resolvedPath)) {
152
+ lines.push(` ${this.sanitizeId(file.path)} --> ${this.sanitizeId(imp.resolvedPath)}`)
151
153
  }
152
154
  }
153
155
  }
package/src/index.ts CHANGED
@@ -6,3 +6,4 @@ export { HealthDiagramGenerator } from './generators/health-diagram.js'
6
6
  export { FlowDiagramGenerator } from './generators/flow-diagram.js'
7
7
  export { CapsuleDiagramGenerator } from './generators/capsule-diagram.js'
8
8
  export { DependencyMatrixGenerator } from './generators/dependency-matrix.js'
9
+ export { CommandsDiagramGenerator } from './generators/commands-diagram.js'
@@ -8,6 +8,7 @@ import { HealthDiagramGenerator } from './generators/health-diagram.js'
8
8
  import { FlowDiagramGenerator } from './generators/flow-diagram.js'
9
9
  import { CapsuleDiagramGenerator } from './generators/capsule-diagram.js'
10
10
  import { DependencyMatrixGenerator } from './generators/dependency-matrix.js'
11
+ import { CommandsDiagramGenerator } from './generators/commands-diagram.js'
11
12
 
12
13
  /**
13
14
  * DiagramOrchestrator — generates all diagram types and writes them to