model-mesh-codemap 1.1.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,461 @@
1
+ # 📦 model-mesh-codemap
2
+
3
+ Interactive CLI tool for generating project codemaps with multi-folder selection and batch processing.
4
+
5
+ **Generate comprehensive code structure maps for your project with automatic framework detection, symbol extraction, and file statistics.**
6
+
7
+ ---
8
+
9
+ ## ✨ Features
10
+
11
+ ✅ **Interactive Folder Selection** — Visual discovery of all project folders with file counts
12
+ ✅ **Multi-Folder Processing** — Generate codemaps for multiple folders in one execution
13
+ ✅ **Flexible Selection** — Support ranges (`1-3`), mixed (`1,3-5`), and "all"
14
+ ✅ **Framework Detection** — Automatically detects Rails, React, Express, Django, etc.
15
+ ✅ **Multi-Language Support** — TypeScript, JavaScript, Ruby, ERB, JSON, YAML
16
+ ✅ **Batch Operations** — Process multiple folders with success/failure summary
17
+ ✅ **No Dependencies** — Uses only Node.js stdlib (compiled JS has zero runtime dependencies)
18
+ ✅ **Type-Safe** — Full TypeScript with declaration files
19
+
20
+ ---
21
+
22
+ ## 📦 Installation
23
+
24
+ ### Via npm (Global)
25
+ ```bash
26
+ npm install -g model-mesh-codemap
27
+ model-mesh-codemap # Interactive mode
28
+ model-mesh-codemap app,src # Direct mode
29
+ ```
30
+
31
+ ### Via npx (No Installation)
32
+ ```bash
33
+ npx model-mesh-codemap # Interactive mode
34
+ npx model-mesh-codemap app,client # Direct mode
35
+ ```
36
+
37
+ ### Local Installation
38
+ ```bash
39
+ npm install --save-dev model-mesh-codemap
40
+ npx model-mesh-codemap # Use via npx
41
+ ```
42
+
43
+ ---
44
+
45
+ ## 🚀 Usage
46
+
47
+ ### Interactive Mode (Recommended)
48
+
49
+ Run without arguments to get interactive folder selection:
50
+
51
+ ```bash
52
+ $ model-mesh-codemap
53
+ ```
54
+
55
+ **Output:**
56
+ ```
57
+ 🔍 Codemap Generation Tool
58
+
59
+ 📂 Available Folders:
60
+
61
+ 1. app (180 files)
62
+ 2. client (95 files)
63
+ 3. lib (42 files)
64
+ 4. server (67 files)
65
+ 5. src (156 files)
66
+
67
+ 💡 Enter folder numbers to select (e.g., "1,2,4" or "all" or "1-3"):
68
+ ▶ Select folders: 1,2,5
69
+
70
+ ✅ Selected 3 folder(s):
71
+ • app (180 files)
72
+ • client (95 files)
73
+ • src (156 files)
74
+
75
+ ⏳ Generating codemaps...
76
+ ```
77
+
78
+ ### Direct Mode (Command-line Arguments)
79
+
80
+ Specify folders directly:
81
+
82
+ ```bash
83
+ # Single folder
84
+ $ model-mesh-codemap app
85
+
86
+ # Multiple folders (comma-separated)
87
+ $ model-mesh-codemap app,client,src
88
+ ```
89
+
90
+ ### Selection Formats
91
+
92
+ | Format | Example | Meaning |
93
+ |--------|---------|---------|
94
+ | Individual | `1` | Folder 1 only |
95
+ | Multiple | `1,3,5` | Folders 1, 3, 5 |
96
+ | Range | `1-3` | Folders 1, 2, 3 |
97
+ | Mixed | `1,3-5` | Folder 1 + folders 3-5 |
98
+ | All | `all` | All available folders |
99
+
100
+ ---
101
+
102
+ ## 📊 Output
103
+
104
+ Codemaps are generated as JSON files in `.claude/codemaps/`:
105
+
106
+ ```
107
+ .claude/codemaps/
108
+ ├── app.codemap.json
109
+ ├── client.codemap.json
110
+ ├── src.codemap.json
111
+ └── ...
112
+ ```
113
+
114
+ ### Codemap Structure
115
+
116
+ ```json
117
+ {
118
+ "timestamp": "2026-04-14T06:10:49.978Z",
119
+ "folderPath": "/path/to/project/app",
120
+ "relativePath": "app",
121
+ "statistics": {
122
+ "totalFiles": 180,
123
+ "totalLines": 45230,
124
+ "totalSymbols": 234,
125
+ "testFiles": 32,
126
+ "languages": {
127
+ "typescript": 120,
128
+ "tsx": 45,
129
+ "json": 8,
130
+ "yaml": 7
131
+ }
132
+ },
133
+ "files": [
134
+ {
135
+ "path": "app/models/user.ts",
136
+ "extension": "ts",
137
+ "language": "typescript",
138
+ "size": 2048,
139
+ "lines": 89,
140
+ "imports": ["express", "bcrypt"],
141
+ "exports": ["User", "UserService"],
142
+ "symbols": [
143
+ {
144
+ "name": "UserService",
145
+ "type": "class",
146
+ "line": 15
147
+ }
148
+ ]
149
+ }
150
+ // ... more files
151
+ ],
152
+ "structure": {
153
+ "name": "app",
154
+ "type": "directory",
155
+ "path": "app",
156
+ "children": [
157
+ {
158
+ "name": "models",
159
+ "type": "directory",
160
+ "children": [...]
161
+ }
162
+ ]
163
+ },
164
+ "metadata": {
165
+ "generatedBy": "model-mesh-codemap",
166
+ "version": "1.0.0"
167
+ }
168
+ }
169
+ ```
170
+
171
+ ---
172
+
173
+ ## 🔧 Supported Languages
174
+
175
+ - **TypeScript/JavaScript** — Classes, interfaces, exports, imports
176
+ - **Ruby** — Classes, methods, modules, constants
177
+ - **ERB** — Template includes, embedded Ruby
178
+ - **JSON** — Top-level keys and structure
179
+ - **YAML** — Configuration keys
180
+
181
+ ---
182
+
183
+ ## 🎯 Use Cases
184
+
185
+ ### 1. **Onboarding New Developers**
186
+ Generate codemaps to help new team members understand project structure.
187
+
188
+ ```bash
189
+ model-mesh-codemap # Show all folders
190
+ # Select key folders: "app,config,lib"
191
+ ```
192
+
193
+ ### 2. **AI Model Context**
194
+ Use codemaps with Claude AI for context-aware code assistance.
195
+
196
+ ```bash
197
+ # Generate codemap for your project
198
+ model-mesh-codemap src
199
+
200
+ # Then provide .claude/codemaps/src.codemap.json to Claude
201
+ ```
202
+
203
+ ### 3. **Documentation Generation**
204
+ Extract code structure for automated documentation.
205
+
206
+ ```bash
207
+ model-mesh-codemap app,lib,config
208
+ # Codemaps are JSON-parseable for doc generation
209
+ ```
210
+
211
+ ### 4. **Code Audits & Analysis**
212
+ Analyze file counts, language distribution, and structure.
213
+
214
+ ```bash
215
+ model-mesh-codemap # Interactive selection
216
+ # Review statistics and framework detection
217
+ ```
218
+
219
+ ---
220
+
221
+ ## 📋 Examples
222
+
223
+ ### Example 1: Rails + React Project
224
+
225
+ ```bash
226
+ $ model-mesh-codemap
227
+
228
+ 📂 Available Folders:
229
+ 1. app (245 files)
230
+ 2. client (178 files)
231
+ 3. config (42 files)
232
+ 4. db (8 files)
233
+ 5. lib (34 files)
234
+
235
+ ▶ Select folders: 1,2
236
+ # Generates app.codemap.json and client.codemap.json
237
+ ```
238
+
239
+ ### Example 2: Microservices
240
+
241
+ ```bash
242
+ $ model-mesh-codemap services,shared,config
243
+
244
+ # Batch process multiple folders with direct argument
245
+ ✅ Successful: 3
246
+ ❌ Failed: 0
247
+ ```
248
+
249
+ ### Example 3: Integration with Node Scripts
250
+
251
+ ```javascript
252
+ const { exec } = require('child_process');
253
+
254
+ // Generate codemaps programmatically
255
+ exec('model-mesh-codemap src,lib', (error, stdout) => {
256
+ if (error) console.error(error);
257
+ console.log('Codemaps generated!');
258
+ });
259
+ ```
260
+
261
+ ---
262
+
263
+ ## ⚙️ Configuration
264
+
265
+ The tool automatically:
266
+ - Discovers folders in your project root
267
+ - Filters ignored directories (node_modules, .git, .claude, dist, etc.)
268
+ - Counts files efficiently (1000 file limit per folder for performance)
269
+ - Sorts folders by common names (app, src, client, server, lib first)
270
+
271
+ No configuration file needed — works out of the box!
272
+
273
+ ---
274
+
275
+ ## 🔍 Ignored Directories
276
+
277
+ The following directories are automatically filtered:
278
+
279
+ ```
280
+ node_modules, .git, .claude, dist, build, coverage,
281
+ .next, tmp, .cache, .nuxt, out, .env, .env.local,
282
+ .env.*.local, .idea, .vscode, .DS_Store, Thumbs.db
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 🚨 Troubleshooting
288
+
289
+ ### "No folders found"
290
+ The tool couldn't discover any folders. Check that:
291
+ - You're running from your project root
292
+ - You have folders at the root level (not hidden with dot-prefix)
293
+
294
+ ### "Module not found" Error
295
+ Ensure Node.js 18+ is installed:
296
+ ```bash
297
+ node --version # Should be v18.0.0 or higher
298
+ ```
299
+
300
+ ### Codemap files are empty
301
+ This happens if the target folders are empty or contain no supported file types. The tool works best with:
302
+ - Source code files (ts, tsx, js, jsx, rb, py, etc.)
303
+ - Configuration files (json, yaml, yml)
304
+ - Template files (erb, html)
305
+
306
+ ---
307
+
308
+ ## 📈 Performance
309
+
310
+ - **Scanning:** ~1 second per 100 files
311
+ - **Parsing:** Regex-based, very fast
312
+ - **Output:** Compact JSON (30KB per 200 files)
313
+ - **Memory:** < 50MB for typical projects
314
+
315
+ **Batch Processing:** Generate 5 codemaps in ~5-10 seconds
316
+
317
+ ---
318
+
319
+ ## 🔐 Security & Privacy
320
+
321
+ ✅ **No external API calls** — All processing local
322
+ ✅ **No data collection** — Runs entirely on your machine
323
+ ✅ **Open source** — Full transparency
324
+ ✅ **Standalone** — Zero runtime dependencies (compiled)
325
+
326
+ ---
327
+
328
+ ## 📚 Advanced Usage
329
+
330
+ ### Programmatic API
331
+
332
+ ```typescript
333
+ import { CodemapCLI } from 'model-mesh-codemap';
334
+
335
+ const cli = new CodemapCLI(process.cwd());
336
+
337
+ // Interactive mode
338
+ await cli.run();
339
+
340
+ // Direct mode with folders
341
+ await cli.run('app,src,client');
342
+ ```
343
+
344
+ ### Integration with Other Tools
345
+
346
+ ```bash
347
+ # Use output in Node.js scripts
348
+ const fs = require('fs');
349
+ const codemap = JSON.parse(
350
+ fs.readFileSync('.claude/codemaps/app.codemap.json', 'utf-8')
351
+ );
352
+
353
+ console.log(`Total files: ${codemap.statistics.totalFiles}`);
354
+ console.log(`Frameworks: ${codemap.frameworks}`);
355
+ ```
356
+
357
+ ---
358
+
359
+ ## 🛠️ Development
360
+
361
+ ### Build from Source
362
+
363
+ ```bash
364
+ # Clone repository
365
+ git clone https://github.com/ioit-solutions/model-mesh.git
366
+ cd model-mesh
367
+
368
+ # Install dependencies
369
+ npm install
370
+
371
+ # Build TypeScript
372
+ npm run build
373
+
374
+ # Test
375
+ npm run test
376
+ ```
377
+
378
+ ### Development Mode
379
+
380
+ ```bash
381
+ # Run directly from TypeScript
382
+ npm run dev
383
+
384
+ # Or use tsx
385
+ npx tsx ./.claude/cli/codemap.ts
386
+ ```
387
+
388
+ ---
389
+
390
+ ## 📝 What's Included
391
+
392
+ - ✅ Interactive CLI with folder discovery
393
+ - ✅ Multi-selection support (ranges, mixed, all)
394
+ - ✅ Multi-language symbol extraction
395
+ - ✅ Framework auto-detection
396
+ - ✅ Batch processing with error handling
397
+ - ✅ TypeScript declarations
398
+ - ✅ Source maps for debugging
399
+ - ✅ Zero external dependencies
400
+
401
+ ---
402
+
403
+ ## 📦 Package Contents
404
+
405
+ ```
406
+ model-mesh-codemap/
407
+ ├── dist/cli/
408
+ │ ├── bin.js # Executable entry point
409
+ │ ├── codemap.js # Main CLI class
410
+ │ ├── codemap-generator.js # Core scanning engine
411
+ │ ├── folder-selector.js # Interactive folder selection
412
+ │ ├── language-parsers.js # Symbol extraction
413
+ │ ├── ignore-rules.js # File filtering
414
+ │ ├── types.js # Type definitions
415
+ │ └── *.d.ts # TypeScript declarations
416
+ ├── package.json
417
+ ├── tsconfig.json
418
+ └── README.md
419
+ ```
420
+
421
+ ---
422
+
423
+ ## 📄 License
424
+
425
+ MIT
426
+
427
+ ---
428
+
429
+ ## 🤝 Contributing
430
+
431
+ Contributions welcome!
432
+
433
+ Areas for improvement:
434
+ - [ ] Additional language support (Go, Rust, Python, Java)
435
+ - [ ] Progress bar for large folders
436
+ - [ ] Watch mode for incremental updates
437
+ - [ ] HTML report generation
438
+ - [ ] Integration with popular IDEs (VS Code extension)
439
+ - [ ] Performance optimizations for large codebases
440
+
441
+ ---
442
+
443
+ ## 📞 Support
444
+
445
+ - **Issues**: [GitHub Issues](https://github.com/ioit-solutions/model-mesh/issues)
446
+ - **Discussions**: [GitHub Discussions](https://github.com/ioit-solutions/model-mesh/discussions)
447
+ - **Documentation**: [model-mesh docs](https://github.com/ioit-solutions/model-mesh)
448
+
449
+ ---
450
+
451
+ ## 🌟 Quick Links
452
+
453
+ - **GitHub**: [ioit-solutions/model-mesh](https://github.com/ioit-solutions/model-mesh)
454
+ - **NPM**: [model-mesh-codemap](https://npmjs.com/package/model-mesh-codemap)
455
+ - **Documentation**: [docs/codemap](https://github.com/ioit-solutions/model-mesh/docs/codemap)
456
+
457
+ ---
458
+
459
+ **Made with ❤️ by IOIT Solutions**
460
+
461
+ *Transform your project structure into actionable intelligence.*
package/dist/bin.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI Entry Point for model-mesh-codemap
4
+ * Usage:
5
+ * npx model-mesh-codemap # Interactive mode
6
+ * npx model-mesh-codemap app,src,client # Direct mode with multiple folders
7
+ * npx model-mesh-codemap app # Single folder
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG"}
package/dist/bin.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * CLI Entry Point for model-mesh-codemap
5
+ * Usage:
6
+ * npx model-mesh-codemap # Interactive mode
7
+ * npx model-mesh-codemap app,src,client # Direct mode with multiple folders
8
+ * npx model-mesh-codemap app # Single folder
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ const codemap_1 = require("./codemap");
12
+ const projectRoot = process.cwd();
13
+ const folderArg = process.argv[2];
14
+ const cli = new codemap_1.CodemapCLI(projectRoot);
15
+ cli.run(folderArg).catch(error => {
16
+ console.error('❌ Fatal error:', error);
17
+ process.exit(1);
18
+ });
19
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;AAEA;;;;;;GAMG;;AAGH,uCAAuC;AAEvC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAClC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAElC,MAAM,GAAG,GAAG,IAAI,oBAAU,CAAC,WAAW,CAAC,CAAC;AAExC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IAC/B,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Core Codemap Generator
3
+ * Scans directories, extracts metadata, generates codemaps
4
+ */
5
+ import { FolderCodemap, CodemapConfig } from './types.js';
6
+ export declare class CodemapGenerator {
7
+ private ignoreRules;
8
+ private config;
9
+ private projectRoot;
10
+ constructor(projectRoot: string, customConfig?: Partial<CodemapConfig>);
11
+ generate(folderPath: string): Promise<FolderCodemap>;
12
+ private scanDirectory;
13
+ private extractFileMetadata;
14
+ private detectLanguage;
15
+ private isTestFile;
16
+ private getLanguageStats;
17
+ private buildDirectoryTree;
18
+ }
19
+ //# sourceMappingURL=codemap-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codemap-generator.d.ts","sourceRoot":"","sources":["../src/codemap-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACL,aAAa,EAGb,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAS;gBAEhB,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC;IAwBhE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;YAiD5C,aAAa;YAkCb,mBAAmB;IAwCjC,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,gBAAgB;YAUV,kBAAkB;CA2CjC"}