@getmikk/cli 1.2.1 → 1.3.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/README.md ADDED
@@ -0,0 +1,329 @@
1
+ # @getmikk/cli
2
+
3
+ > The command-line interface for Mikk — initialize, analyze, watch, validate, visualize, and query your codebase architecture from the terminal.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@getmikk/cli)](https://www.npmjs.com/package/@getmikk/cli)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](../../LICENSE)
7
+
8
+ `@getmikk/cli` (binary: `mikk`) is the primary interface for the Mikk ecosystem. It orchestrates all other packages — parsing, graph building, diagram generation, AI context, intent pre-flight — into a cohesive developer experience.
9
+
10
+ ---
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install -g @getmikk/cli
16
+ # or
17
+ bunx @getmikk/cli
18
+ ```
19
+
20
+ ---
21
+
22
+ ## Quick Start
23
+
24
+ ```bash
25
+ # Initialize Mikk in your project
26
+ cd my-project
27
+ mikk init
28
+
29
+ # This will:
30
+ # 1. Scan for TypeScript files
31
+ # 2. Parse them into ASTs
32
+ # 3. Build the dependency graph
33
+ # 4. Auto-detect module clusters
34
+ # 5. Generate mikk.json (contract)
35
+ # 6. Generate mikk.lock.json (lock file)
36
+ # 7. Generate Mermaid diagrams in .mikk/diagrams/
37
+ # 8. Generate claude.md and AGENTS.md
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Commands
43
+
44
+ ### `mikk init`
45
+
46
+ Initialize Mikk in the current directory. Performs a full codebase scan, builds the dependency graph, detects module clusters, and generates all artifacts.
47
+
48
+ ```bash
49
+ mikk init
50
+ ```
51
+
52
+ **Generated files:**
53
+ - `mikk.json` — Architecture contract (modules, constraints, decisions)
54
+ - `mikk.lock.json` — Full codebase snapshot with Merkle hashes
55
+ - `.mikk/diagrams/main.mmd` — Architecture overview diagram
56
+ - `.mikk/diagrams/health.mmd` — Module health dashboard
57
+ - `.mikk/diagrams/matrix.mmd` — Dependency matrix
58
+ - `.mikk/diagrams/module-*.mmd` — Per-module detail diagrams
59
+ - `.mikk/diagrams/capsule-*.mmd` — Per-module API capsule diagrams
60
+ - `.mikk/diagrams/flow-entrypoints.mmd` — Entry point flow diagram
61
+ - `claude.md` / `AGENTS.md` — AI agent context files
62
+
63
+ ---
64
+
65
+ ### `mikk analyze`
66
+
67
+ Re-analyze the codebase and update all generated files. Run this after making code changes to bring the lock file, diagrams, and AI context files up to date.
68
+
69
+ ```bash
70
+ mikk analyze
71
+ ```
72
+
73
+ ---
74
+
75
+ ### `mikk diff`
76
+
77
+ Show what changed since the last analysis. Compares current file hashes against the lock file.
78
+
79
+ ```bash
80
+ mikk diff
81
+ ```
82
+
83
+ **Output:**
84
+ ```
85
+ Added: src/auth/two-factor.ts
86
+ Modified: src/auth/login.ts
87
+ Deleted: src/auth/legacy-auth.ts
88
+
89
+ 3 files changed (1 added, 1 modified, 1 deleted)
90
+ ```
91
+
92
+ ---
93
+
94
+ ### `mikk watch`
95
+
96
+ Start the live file watcher daemon. Keeps the lock file in sync as you edit code.
97
+
98
+ ```bash
99
+ mikk watch
100
+ ```
101
+
102
+ Uses `@getmikk/watcher` under the hood with debouncing, incremental analysis, and atomic writes. Press `Ctrl+C` to stop.
103
+
104
+ ---
105
+
106
+ ### `mikk contract` — Contract Management
107
+
108
+ #### `mikk contract validate`
109
+
110
+ Validate the current codebase against the contract. Checks for both file drift (hash mismatches) and boundary violations (cross-module constraint violations).
111
+
112
+ ```bash
113
+ # Full validation (drift + boundaries)
114
+ mikk contract validate
115
+
116
+ # Boundaries only (ideal for CI)
117
+ mikk contract validate --boundaries-only
118
+
119
+ # Drift only
120
+ mikk contract validate --drift-only
121
+
122
+ # Strict mode — warnings become errors
123
+ mikk contract validate --strict
124
+ ```
125
+
126
+ **Exit codes:**
127
+ - `0` — All checks pass
128
+ - `1` — Violations found
129
+
130
+ **CI integration example:**
131
+
132
+ ```yaml
133
+ # GitHub Actions
134
+ - name: Check architecture boundaries
135
+ run: mikk contract validate --boundaries-only --strict
136
+ ```
137
+
138
+ #### `mikk contract generate`
139
+
140
+ Regenerate the `mikk.json` skeleton from the current codebase. Useful after major refactoring.
141
+
142
+ ```bash
143
+ mikk contract generate
144
+ ```
145
+
146
+ #### `mikk contract update`
147
+
148
+ Update the lock file to match the current codebase state.
149
+
150
+ ```bash
151
+ mikk contract update
152
+ ```
153
+
154
+ #### `mikk contract show-boundaries`
155
+
156
+ Display all current cross-module function calls — shows which modules depend on which.
157
+
158
+ ```bash
159
+ mikk contract show-boundaries
160
+ ```
161
+
162
+ **Output:**
163
+ ```
164
+ auth → payments:
165
+ login.ts::processPayment → payments/stripe.ts::createCharge
166
+ login.ts::checkSubscription → payments/billing.ts::getSubscription
167
+
168
+ payments → users:
169
+ billing.ts::getUserPlan → users/profile.ts::getPlan
170
+
171
+ Total: 3 cross-module calls
172
+ ```
173
+
174
+ ---
175
+
176
+ ### `mikk context` — AI Context Queries
177
+
178
+ #### `mikk context query <question>`
179
+
180
+ Ask an architecture question. The CLI traces the dependency graph and returns relevant context.
181
+
182
+ ```bash
183
+ mikk context query "How does authentication work?"
184
+
185
+ # Options
186
+ mikk context query "..." --provider claude # Format for Claude (XML tags)
187
+ mikk context query "..." --provider generic # Plain text format
188
+ mikk context query "..." --hops 5 # BFS depth limit
189
+ mikk context query "..." --tokens 12000 # Token budget
190
+ mikk context query "..." --no-callgraph # Exclude call graph
191
+ mikk context query "..." --out context.md # Write to file
192
+ mikk context query "..." --meta # Show metadata (seeds, keywords, etc.)
193
+ ```
194
+
195
+ #### `mikk context impact <file>`
196
+
197
+ Analyze what breaks if a specific file changes.
198
+
199
+ ```bash
200
+ mikk context impact src/auth/login.ts
201
+
202
+ # Options
203
+ mikk context impact src/auth/login.ts --provider claude
204
+ mikk context impact src/auth/login.ts --tokens 8000
205
+ ```
206
+
207
+ #### `mikk context for <task>`
208
+
209
+ Get AI context for a specific task.
210
+
211
+ ```bash
212
+ mikk context for "Add rate limiting to API endpoints"
213
+ ```
214
+
215
+ ---
216
+
217
+ ### `mikk intent <prompt>` — Pre-flight Check
218
+
219
+ Run the full intent engine pipeline: interpret the prompt, detect conflicts, and suggest an implementation plan.
220
+
221
+ ```bash
222
+ mikk intent "Add a caching layer to the auth module"
223
+
224
+ # Options
225
+ mikk intent "..." --no-confirm # Skip confirmation prompts
226
+ mikk intent "..." --json # Output as JSON
227
+ ```
228
+
229
+ **Output:**
230
+ ```
231
+ 🔍 Interpreting prompt...
232
+
233
+ Intents:
234
+ 1. [CREATE] CacheLayer in module auth (confidence: 0.85)
235
+
236
+ ⚠️ Conflicts:
237
+ [warning] Creating new files in auth module — check naming constraint: ^handle|^use|^get
238
+
239
+ 📋 Suggestions:
240
+ Intent 1: Create CacheLayer
241
+ Affected files: src/auth/login.ts, src/auth/session.ts
242
+ New files: src/auth/cache-layer.ts
243
+ Impact: medium
244
+
245
+ ✅ No blocking conflicts. Proceed? (y/n)
246
+ ```
247
+
248
+ ---
249
+
250
+ ### `mikk visualize` — Diagram Generation
251
+
252
+ #### `mikk visualize all`
253
+
254
+ Regenerate all Mermaid diagrams.
255
+
256
+ ```bash
257
+ mikk visualize all
258
+ ```
259
+
260
+ #### `mikk visualize module <id>`
261
+
262
+ Regenerate the diagram for a specific module.
263
+
264
+ ```bash
265
+ mikk visualize module auth
266
+ ```
267
+
268
+ #### `mikk visualize impact`
269
+
270
+ Generate an impact diagram based on current file changes (files that differ from the lock file).
271
+
272
+ ```bash
273
+ mikk visualize impact
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Global Options
279
+
280
+ | Flag | Description |
281
+ |------|-------------|
282
+ | `--version`, `-V` | Print version |
283
+ | `--help`, `-h` | Show help |
284
+
285
+ ---
286
+
287
+ ## Project Structure After Init
288
+
289
+ ```
290
+ my-project/
291
+ ├── mikk.json ← Architecture contract
292
+ ├── mikk.lock.json ← Codebase snapshot (auto-generated)
293
+ ├── claude.md ← AI context file
294
+ ├── AGENTS.md ← AI context file (same content)
295
+ ├── .mikk/
296
+ │ ├── diagrams/
297
+ │ │ ├── main.mmd ← Architecture overview
298
+ │ │ ├── health.mmd ← Module health dashboard
299
+ │ │ ├── matrix.mmd ← Dependency matrix
300
+ │ │ ├── flow-entrypoints.mmd
301
+ │ │ ├── module-auth.mmd
302
+ │ │ ├── module-payments.mmd
303
+ │ │ ├── capsule-auth.mmd
304
+ │ │ └── capsule-payments.mmd
305
+ │ ├── hashes.db ← SQLite hash store
306
+ │ └── watcher.pid ← Watcher PID (when running)
307
+ └── src/
308
+ └── ...
309
+ ```
310
+
311
+ ---
312
+
313
+ ## Dependencies
314
+
315
+ | Package | Purpose |
316
+ |---------|---------|
317
+ | `@getmikk/core` | Parsing, graph, hashing, contracts |
318
+ | `@getmikk/ai-context` | Context building, claude.md generation |
319
+ | `@getmikk/diagram-generator` | Mermaid diagram generation |
320
+ | `@getmikk/intent-engine` | Pre-flight intent analysis |
321
+ | `commander` | CLI framework |
322
+ | `chalk` | Terminal colors |
323
+ | `ora` | Spinners |
324
+
325
+ ---
326
+
327
+ ## License
328
+
329
+ [MIT](../../LICENSE)
package/dist/index.js CHANGED
@@ -7043,7 +7043,7 @@ function registerVisualizeCommands(program3) {
7043
7043
 
7044
7044
  // src/index.ts
7045
7045
  var program2 = new Command();
7046
- program2.name("mikk").description("The structural nervous system of your codebase").version("1.2.1");
7046
+ program2.name("mikk").description("The structural nervous system of your codebase").version("1.3.0");
7047
7047
  registerInitCommand(program2);
7048
7048
  registerAnalyzeCommand(program2);
7049
7049
  registerDiffCommand(program2);