Gathering detailed insights and metrics for @paulohenriquevn/m2js
Gathering detailed insights and metrics for @paulohenriquevn/m2js
Gathering detailed insights and metrics for @paulohenriquevn/m2js
Gathering detailed insights and metrics for @paulohenriquevn/m2js
M2JS is an open-source CLI tool that transforms TypeScript/JavaScript files into clean, LLM-optimized Markdown summaries.
npm install @paulohenriquevn/m2js
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (94.06%)
JavaScript (5.07%)
CSS (0.87%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
40 Commits
7 Branches
2 Contributors
Updated on Jul 07, 2025
Latest Version
1.3.1
Package Id
@paulohenriquevn/m2js@1.3.1
Unpacked Size
768.11 kB
Size
156.58 kB
File Count
106
NPM Version
10.8.2
Node Version
20.19.2
Published on
Jul 07, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
🚀 Transform TypeScript/JavaScript code into LLM-friendly Markdown summaries + Smart Dead Code Detection + Graph-Deep Diff Analysis with 60-90% token reduction
M2JS is a comprehensive ecosystem that extracts and analyzes TypeScript/JavaScript code, converting it into optimized Markdown documentation perfect for AI coding assistants like ChatGPT, Claude, and GitHub Copilot. Now with intelligent dead code detection and architectural change analysis that goes beyond traditional linters.
1. AI-Ready Documentation - Transform your code into perfect LLM context
2. Smart Dead Code Detection - Find and safely remove unused code with confidence levels
3. Graph-Deep Diff Analysis - Track architectural changes and detect problematic patterns
For AI-Assisted Development:
For Code Maintenance:
For Architectural Evolution:
AI Documentation:
Smart Dead Code Detection:
Graph-Deep Diff Analysis:
Short Answer: No, but we're making the wheel intelligent.
1# ESLint detects basic unused code 2"no-unused-vars": "error" 3"@typescript-eslint/no-unused-imports": "error"
Output: "unusedFunction is never used"
❌
1m2js src --detect-unused
Output:
🔥 Remove function: internalHelper [HIGH CONFIDENCE] ✅ SAFE TO REMOVE
# Remove lines around 25 in utils.ts
⚠️ Review function: createApi [MEDIUM CONFIDENCE] ⚠️ REVIEW NEEDED
Risk: Export name suggests it may be used by external packages
🚨 Review function: default [LOW CONFIDENCE] 🚨 HIGH RISK
Risks: Default export, Type definition, Configuration file
Traditional Linters | M2JS Smart Detection |
---|---|
"This is unused" | "This is unused AND here's how to safely remove it" |
File-by-file analysis | Cross-project understanding |
Binary unused/used | Confidence levels + risk assessment |
Generic warnings | Context-aware suggestions |
Manual investigation needed | Ready-to-execute commands |
1# Don't replace ESLint - enhance it! 2npm run lint # ESLint for code quality 3m2js src --detect-unused # M2JS for smart dead code removal
M2JS is not a linter replacement. It's a smart assistant for confident dead code cleanup.
Use ESLint for:
Use M2JS for:
1# Install globally 2npm install -g @paulohenriquevn/m2js 3 4# Analyze your project for dead code 5m2js src --detect-unused 6 7# Generate configuration for persistent settings 8m2js --init-config 9 10# Get detailed help 11m2js --help-dead-code
1# Transform your code for AI 2m2js UserService.ts --ai-enhanced
1# Compare your current branch with main 2m2js src/ --graph-diff --baseline main 3 4# Track architectural changes over time 5m2js . --graph-diff --baseline v1.0.0 --current v1.1.0 6 7# Get detailed help 8m2js --help-graph-diff
1# Analyze single file 2m2js utils.ts --detect-unused 3 4# Analyze entire project 5m2js src/ --detect-unused 6 7# JSON output for CI/CD 8m2js src --detect-unused --format json 9 10# With progress bar for large projects 11M2JS_SHOW_PROGRESS=true m2js src --detect-unused
1m2js --init-config # Creates .m2jsrc in current directory
1{ 2 "deadCode": { 3 "enableCache": true, 4 "maxCacheSize": 1000, 5 "chunkSize": 50, 6 "showProgress": true, 7 "format": "table", 8 "includeMetrics": true, 9 "includeSuggestions": true 10 }, 11 "files": { 12 "extensions": [".ts", ".tsx", ".js", ".jsx"], 13 "ignorePatterns": [ 14 "**/node_modules/**", 15 "**/dist/**", 16 "**/*.test.*", 17 "**/*.spec.*" 18 ], 19 "maxFileSize": 10 20 } 21}
1# Performance tuning 2M2JS_CACHE_ENABLED=true # Enable/disable cache (default: true) 3M2JS_CACHE_SIZE=1000 # Max files in cache (default: 1000) 4M2JS_CHUNK_SIZE=50 # Files per processing chunk (default: 50) 5M2JS_SHOW_PROGRESS=true # Show progress bar (default: true) 6M2JS_MAX_FILE_SIZE=10 # Max file size in MB (default: 10) 7 8# Usage examples 9M2JS_SHOW_PROGRESS=false m2js src --detect-unused 10M2JS_CHUNK_SIZE=100 m2js large-project --detect-unused
⚠️ Risk factors:
• Export name suggests it may be used by external packages
• Framework import - may be used implicitly
• Type definition - may be used in type annotations
• Located in test file - may be used by test framework
• Default export - may be imported with different names
1🛠️ Removal Suggestions: 2┌─────────────────────────────────────────────────┐ 3│ ✅ SAFE TO REMOVE: 4│ 🔥 Remove function: helper 5│ utils.ts:25 6│ Remove unused function (~10 lines) 7│ # Remove lines around 25 in utils.ts 8│ 9│ ⚠️ REVIEW BEFORE REMOVING: 10│ ⚡ Remove function: createApi 11│ api.ts:15 12│ ⚠️ Export name suggests it may be used by external packages 13│ 14│ 🚨 HIGH RISK: 15│ 3 suggestions require careful analysis 16│ Manual review strongly recommended 17└─────────────────────────────────────────────────┘
1🔍 [████████████████████████████████████████] 85% (127/150) UserService.ts - 2.3s remaining 2✅ Analysis complete in 12.7s
1# .github/workflows/dead-code.yml 2name: Dead Code Analysis 3on: [push, pull_request] 4 5jobs: 6 dead-code: 7 runs-on: ubuntu-latest 8 steps: 9 - uses: actions/checkout@v3 10 - uses: actions/setup-node@v3 11 with: 12 node-version: '18' 13 - run: npm install -g @paulohenriquevn/m2js 14 - run: m2js src --detect-unused --format json > dead-code-report.json 15 - uses: actions/upload-artifact@v3 16 with: 17 name: dead-code-report 18 path: dead-code-report.json
1{ 2 "scripts": { 3 "dead-code": "m2js src --detect-unused", 4 "dead-code-ci": "m2js src --detect-unused --format json", 5 "cleanup-safe": "m2js src --detect-unused | grep 'SAFE TO REMOVE' -A2" 6 } 7}
1export class AuthService { 2 private readonly jwtSecret: string; 3 private readonly tokenExpiry: number; 4 private readonly userRepository: UserRepository; 5 // ... 200+ lines of implementation details 6 7 async login(email: string, password: string): Promise<AuthResult> { 8 // Complex implementation with error handling, 9 // rate limiting, validation, logging, etc. 10 // All private details that AI doesn't need 11 } 12}
1# 📝 AuthService.ts
2
3## 🧠 Business Context
4**Domain**: Authentication (98% confidence)
5**Framework**: Node.js + JWT + TypeScript
6**Patterns**: Service Layer, Repository Pattern
7
8## 🔧 Functions
9
10### login
11```typescript
12async login(email: string, password: string): Promise<AuthResult>
Business Rules:
Usage Pattern: Authentication workflow Returns: AuthResult with JWT token and user data Throws: AuthenticationError, RateLimitError
**Result**: 83% fewer tokens, 100% of the essential information, plus business context!
## 🏗️ Graph-Deep Diff Analysis: Complete Guide
### **🎯 Basic Usage**
```bash
# Compare current branch with main
m2js src/ --graph-diff --baseline main
# Compare two specific commits
m2js . --graph-diff --baseline v1.0.0 --current v1.1.0
# Track changes over time (commit by commit)
m2js src/ --graph-diff --baseline HEAD~1
# JSON output for CI/CD integration
m2js . --graph-diff --baseline main --format json
# Filter by severity (focus on critical issues)
m2js src/ --graph-diff --baseline main --min-severity high
# Get comprehensive help
m2js --help-graph-diff
1📊 GRAPH-DEEP DIFF ANALYSIS REPORT 2============================================================ 3 4📋 COMPARISON OVERVIEW 5---------------------------------------- 6Project: /home/user/my-project/src 7Baseline: main 8Current: feature-branch 9Total Changes: 3 10 11🎯 IMPACT SUMMARY 12---------------------------------------- 13Severity Distribution: 14 🚨 CRITICAL: 1 changes 15 ⚠️ HIGH: 1 changes 16 ⚡ MEDIUM: 1 changes 17 18📈 Health Score: 85 → 78 (-7.0) 📉 Declining 19 20📈 KEY METRICS CHANGES 21---------------------------------------- 22🔄 Circular Dependencies: 0 → 2 (+2) 23🔗 Average Coupling: 3.2 → 4.8 (+1.6) 24📦 External Dependencies: 15 → 18 (+3) 25📁 Module Count: 45 → 47 (+2) 26 27🏗️ ARCHITECTURAL CHANGES 28---------------------------------------- 29 301. 🚨 CRITICAL - 🔄 dependencies 31 2 new circular dependencies introduced 32 Risk: critical | Overall Score: -12 33 Reasoning: Circular dependencies make code harder to understand, test, and maintain 34 Affected Areas: maintainability, testability, code organization 35 36💡 RECOMMENDATIONS 37---------------------------------------- 38 391. 🔧 HIGH - Resolve Circular Dependencies 40 New circular dependencies were introduced that should be resolved. 41 🔴 Effort: medium | Impact: Improve code organization and testability 42 Actions: 43 • Identify the circular dependency chain 44 • Extract common functionality to a shared module 45 • Use dependency injection or event-driven patterns 46 • Consider architectural refactoring
1# Required 2--baseline <ref> # Baseline git reference (branch, commit, tag) 3 4# Optional 5--current <ref> # Current reference (default: working directory) 6--format <type> # Output format: table (default), json 7--min-severity <level> # Filter: low, medium, high, critical 8--include-details # Include detailed analysis (default: true) 9--include-impact # Include impact scoring (default: true) 10--include-suggestions # Include recommendations (default: true)
1# Branches 2m2js src/ --graph-diff --baseline main 3m2js src/ --graph-diff --baseline develop --current feature-branch 4 5# Commits 6m2js . --graph-diff --baseline HEAD~1 7m2js . --graph-diff --baseline abc123def --current xyz789abc 8 9# Tags 10m2js src/ --graph-diff --baseline v1.0.0 --current v1.1.0 11 12# Remote references 13m2js . --graph-diff --baseline origin/main
1# .github/workflows/architecture-check.yml 2name: Architecture Health Check 3on: [pull_request] 4 5jobs: 6 arch-diff: 7 runs-on: ubuntu-latest 8 steps: 9 - uses: actions/checkout@v3 10 with: 11 fetch-depth: 0 # Need full history for git refs 12 - uses: actions/setup-node@v3 13 with: 14 node-version: '18' 15 - run: npm install -g @paulohenriquevn/m2js 16 - run: | 17 m2js src --graph-diff --baseline origin/main --format json > arch-report.json 18 # Fail if health score decreases more than 10 points 19 if [ $(jq '.impact.healthChange.delta' arch-report.json) -lt -10 ]; then 20 echo "❌ Architecture health declined significantly" 21 exit 1 22 fi
1#!/bin/sh 2# .git/hooks/pre-commit 3# Check architectural health before commits 4 5echo "🔍 Checking architectural changes..." 6m2js src --graph-diff --baseline HEAD~1 --min-severity high 7 8if [ $? -ne 0 ]; then 9 echo "❌ High-severity architectural issues detected" 10 echo "Review changes or use 'git commit --no-verify' to skip" 11 exit 1 12fi
1. Pre-merge Validation
1# Before merging feature branch 2m2js src/ --graph-diff --baseline main --current feature-branch 3# Review recommendations before merge
2. Release Preparation
1# Compare current release candidate with last stable 2m2js . --graph-diff --baseline v1.0.0 --current release/v1.1.0 3# Ensure architectural health before release
3. Refactoring Tracking
1# Monitor improvements during refactoring 2m2js src/ --graph-diff --baseline refactor-start --current refactor-end 3# Validate that refactoring improved architecture
4. Technical Debt Audit
1# Analyze architectural evolution over time 2m2js . --graph-diff --baseline v1.0.0 --current main 3# Understand how architecture has changed since initial release
Project Size | Files | Analysis Time | Memory Usage |
---|---|---|---|
Small | < 50 | < 10s | < 100MB |
Medium | 50-200 | 10-30s | 100-200MB |
Large | 200-1000 | 30-120s | 200-400MB |
Enterprise | > 1000 | 2-5min | 400-800MB |
--min-severity high
for focused analysis on critical issues1# Smart analysis with confidence levels 2m2js src --detect-unused 3 4# Performance optimized for large codebases 5m2js large-project --detect-unused --chunk-size 100 6 7# CI/CD friendly JSON output 8m2js src --detect-unused --format json
1# Track architectural changes 2m2js src/ --graph-diff --baseline main 3 4# Compare releases for technical debt tracking 5m2js . --graph-diff --baseline v1.0.0 --current v1.1.0 6 7# CI/CD integration with health scoring 8m2js src --graph-diff --baseline origin/main --format json
1# Basic analysis 2m2js UserService.ts 3 4# AI-enhanced with business context 5m2js UserService.ts --ai-enhanced 6 7# Batch processing 8m2js src/ --batch --output docs/
.m2jsrc
for persistent settingsFeature | ESLint | ts-unused-exports | knip | Dependabot | M2JS |
---|---|---|---|---|---|
Unused Imports | ✅ | ❌ | ✅ | ❌ | ✅ |
Unused Exports | ❌ | ✅ | ✅ | ❌ | ✅ |
Cross-file Analysis | ❌ | ✅ | ✅ | ❌ | ✅ |
Confidence Levels | ❌ | ❌ | ❌ | ❌ | ✅ |
Risk Assessment | ❌ | ❌ | ❌ | ❌ | ✅ |
Actionable Commands | ❌ | ❌ | ❌ | ❌ | ✅ |
AI Documentation | ❌ | ❌ | ❌ | ❌ | ✅ |
Architectural Health | ❌ | ❌ | ❌ | ❌ | ✅ |
Graph Diff Analysis | ❌ | ❌ | ❌ | ❌ | ✅ |
Change Impact Scoring | ❌ | ❌ | ❌ | ❌ | ✅ |
Circular Dependency Tracking | ❌ | ❌ | ❌ | ❌ | ✅ |
Performance Caching | ✅ | ❌ | ❌ | ❌ | ✅ |
Progress Indicators | ❌ | ❌ | ❌ | ❌ | ✅ |
Configuration Files | ✅ | ❌ | ✅ | ✅ | ✅ |
Dead Code Cleanup:
1# Before major refactoring 2m2js src --detect-unused 3# Follow safe removal suggestions 4# Clean codebase with confidence
AI-Assisted Development:
1# Before asking AI for help (save 80% on tokens) 2m2js UserService.ts --ai-enhanced | pbcopy 3# Paste optimized context into ChatGPT/Claude
Architectural Health Monitoring:
1# Before major refactoring 2m2js src/ --graph-diff --baseline main 3# Track progress and prevent regressions
ROI: 50% faster cleanup, 30x faster context preparation, 10x better AI responses, 40% reduction in architectural debt
Legacy Code Maintenance:
AI-Enhanced Workflows:
Technical Debt Management:
ROI: 70% faster legacy cleanup, 50% faster onboarding, 70% reduction in documentation maintenance, 60% reduction in architectural debt accumulation
System Modernization:
AI Transformation:
Enterprise Architecture Governance:
ROI: Millions saved in system understanding, modernization prep, documentation costs, and prevented architectural debt
1# CLI Tool 2npm install -g @paulohenriquevn/m2js 3 4# VS Code Extension 5# Search "M2JS" in VS Code Extensions marketplace
1m2js --version 2m2js --help-dead-code 3m2js --help-graph-diff
1# Generate configuration 2m2js --init-config 3 4# Analyze your project 5m2js src --detect-unused 6 7# Start with safe removals 8# Follow the actionable suggestions from M2JS output
1# Check architectural health vs main branch 2m2js src/ --graph-diff --baseline main 3 4# Track changes over time 5m2js . --graph-diff --baseline HEAD~5
1# Try with your own code 2m2js src/services/UserService.ts --ai-enhanced 3 4# Generate project overview 5m2js src/ --graph --mermaid --output project-overview.md
1graph TB 2 A[Source Files] --> B[Babel Parser] 3 B --> C[AST Analysis] 4 C --> D[Export Extraction] 5 C --> E[Import Extraction] 6 C --> F[Usage Analysis] 7 8 D --> G[Cross-Reference Analysis] 9 E --> G 10 F --> G 11 12 G --> H[Risk Assessment Engine] 13 H --> I[Confidence Calculation] 14 H --> J[Context Analysis] 15 16 I --> K[Actionable Suggestions] 17 J --> K 18 K --> L[Safe Removal Commands]
Project Size | Files | Processing Time | Memory Usage | Cache Hit Rate |
---|---|---|---|---|
Small | < 50 | < 5s | < 100MB | N/A (first run) |
Medium | 50-500 | 10-30s | 100-300MB | 60-80% |
Large | 500-2000 | 30-120s | 300-500MB | 80-90% |
Enterprise | > 2000 | 2-10min | 500MB-1GB | 90%+ |
File Size | Processing Time | Memory Usage | Token Reduction |
---|---|---|---|
< 10KB | < 1s | < 50MB | 60-70% |
10-100KB | 1-5s | 50-100MB | 70-80% |
100KB-1MB | 5-15s | 100-200MB | 80-90% |
> 1MB | 15-30s | 200-300MB | 85-90% |
We welcome contributions from developers of all experience levels!
1git clone https://github.com/paulohenriquevn/m2js.git 2cd m2js 3npm install 4npm run build 5npm test 6npm link 7m2js examples/User.ts --ai-enhanced 8m2js src --detect-unused
See our Contributing Guide for detailed instructions.
1# Installation issues 2npm cache clean --force 3npm install -g @paulohenriquevn/m2js --verbose 4 5# Processing errors 6m2js yourfile.ts --verbose --debug 7 8# Performance issues with large projects 9m2js largefile.ts --chunk-size 25 10M2JS_CACHE_SIZE=2000 m2js src --detect-unused 11 12# Dead code analysis help 13m2js --help-dead-code 14m2js --init-config 15 16# Graph diff analysis help 17m2js --help-graph-diff 18m2js src/ --graph-diff --baseline main --min-severity high
MIT License - see LICENSE for details.
Privacy Guarantee: M2JS processes all code locally on your machine. No code is ever sent to external servers.
Made with ❤️ for developers working with AI coding assistants
Transform your code into AI-ready documentation and confidently clean dead code in seconds, not hours.
No vulnerabilities found.
No security vulnerabilities found.