# Smart Roadmap - AI-Powered Development Roadmap Generator
**Version:** 2.0.0 (Zero-Dependency Edition)
**Author:** Chahua Development Co., Ltd.
**License:** MIT
## Overview
Smart Roadmap is an intelligent project analysis tool that automatically scans your codebase, identifies issues, calculates priorities, and generates actionable development roadmaps. It combines code quality analysis, security scanning, dependency checking, and test coverage assessment into a single comprehensive tool.
**Key Advantage:** 100% Zero External Dependencies - uses only Node.js built-in modules.
**Optional Enhancement:** Supports external parsers (@babel/parser, acorn, esprima) for maximum accuracy when installed, but works perfectly without them.
## Features
- **Automatic Project Scanning** - Analyzes entire codebase in seconds
- **Issue Detection** - Finds TODOs, FIXMEs, bugs, and unimplemented features
- **Priority Calculation** - Automatically assigns priorities based on context
- **Roadmap Generation** - Creates phased development plans with effort estimates
- **Security Analysis** - Detects potential security vulnerabilities
- **Dependency Tracking** - Analyzes imports/exports and module dependencies
- **Code Complexity** - Calculates cyclomatic complexity for functions
- **Multiple Output Formats** - JSON, Markdown, and HTML reports
- **Safe Operation** - Built-in security features prevent malicious path access
## Installation
### Global Installation (Recommended)
```bash
npm install -g @chahuadev/smart-roadmap
```
### Project-Specific Installation
```bash
npm install --save-dev @chahuadev/smart-roadmap
```
### Usage with npx (No Installation)
```bash
npx @chahuadev/smart-roadmap scan
```
## Usage
### Command Line Interface
**Scan current project:**
```bash
smart-roadmap scan
```
**Scan specific directory:**
```bash
smart-roadmap scan /path/to/project
```
**Generate detailed analysis:**
```bash
smart-roadmap analyze --verbose
```
**Dry run (preview only):**
```bash
smart-roadmap scan --dry-run
```
**Custom output directory:**
```bash
smart-roadmap scan --output ./reports
```
### CLI Options
```
smart-roadmap [command] [options]
Commands:
scan Scan project and generate roadmap
analyze Detailed project analysis
report Generate reports from existing scan
Options:
-v, --verbose Show detailed output
-d, --dry-run Preview without saving files
-o, --output
Output directory (default: docs/)
--format Output format: json, md, html (default: all)
--ignore Patterns to ignore (comma-separated)
-h, --help Show help information
--version Show version number
```
### Programmatic API
```javascript
import { SmartRoadmap } from '@chahuadev/smart-roadmap';
// Initialize scanner
const scanner = new SmartRoadmap({
projectPath: './my-project',
outputDir: './reports',
ignorePatterns: ['node_modules', '.git', 'dist']
});
// Scan project
const analysis = await scanner.scan();
console.log(`Files scanned: ${analysis.stats.filesScanned}`);
console.log(`Issues found: ${analysis.stats.totalIssues}`);
// Generate roadmap
const roadmap = scanner.generateRoadmap(analysis);
// Save reports
await scanner.saveReports(roadmap, {
formats: ['json', 'markdown', 'html']
});
```
### Configuration File
Create `.smartroadmap.json` in your project root:
```json
{
"scanDirs": ["src", "lib", "tests"],
"ignorePatterns": [
"node_modules",
".git",
"dist",
"build",
"coverage"
],
"fileExtensions": [".js", ".ts", ".jsx", ".tsx"],
"outputDir": "docs",
"outputFormats": ["json", "markdown", "html"],
"enableSecurity": true,
"complexityThreshold": 10,
"priorityWeights": {
"critical": 100,
"high": 75,
"medium": 50,
"low": 25
}
}
```
## Output Files
After scanning, Smart Roadmap generates:
- **project-analysis.json** - Machine-readable analysis data
- **DEVELOPMENT_ROADMAP.md** - Human-readable roadmap with priorities
- **PROJECT_ANALYSIS.md** - Detailed project health report
- **dashboard.html** - Interactive HTML dashboard (optional)
## Example Output
### DEVELOPMENT_ROADMAP.md Structure
```markdown
# Development Roadmap
## Executive Summary
- Total Phases: 4
- Total Tasks: 32
- Estimated Duration: 8 weeks
## Phase 1: Critical Bug Fixes
Priority: CRITICAL | Status: IN_PROGRESS | Estimated: 1 week
### Tasks (6)
#### P1-1: Fix memory leak in data processor
Location: src/processors/data-processor.js:145
Priority: CRITICAL
Estimated Effort: 4 hours
Impact: HIGH - System stability affected
Context: Memory leak detected in long-running process
Acceptance Criteria:
- [ ] Identify source of memory leak
- [ ] Implement fix with proper cleanup
- [ ] Add monitoring to prevent recurrence
- [ ] Verify fix under load testing
Dependencies: None
Code Reference:
// File: src/processors/data-processor.js:145
// FIXME: Memory leak in data processing loop
```
## Security Features
Smart Roadmap includes enterprise-grade security:
- **Path Validation** - Prevents directory traversal attacks
- **Symlink Protection** - Detects and handles symbolic links safely
- **ReDoS Prevention** - Timeout protection for regex operations
- **File Size Limits** - Prevents processing of extremely large files
- **System Directory Protection** - Blocks access to OS system folders
- **Safe Pattern Matching** - Validates regex patterns before execution
## Supported File Types
- **JavaScript/TypeScript**: .js, .ts, .jsx, .tsx, .mjs
- **Documentation**: .md, .txt
- **Configuration**: .json, .yaml, .yml
- **And more...**
## Architecture
```
smart-roadmap/
├── cli.js # CLI entry point
├── src/
│ ├── index.js # Main API export
│ ├── scanners/ # Scanner modules (5 files)
│ │ ├── code-quality-scanner.js
│ │ ├── dependency-scanner.js
│ │ ├── security-scanner.js # Uses Tokenizer
│ │ ├── architecture-scanner.js
│ │ └── test-coverage-scanner.js
│ ├── analyzers/ # Analysis engines (13 files)
│ │ ├── tokenizer.js # NEW: Zero-dependency lexer
│ │ ├── git-context-analyzer.js # NEW: Git integration (child_process)
│ │ ├── complexity-analyzer.js # Uses Tokenizer
│ │ ├── priority-analyzer.js # Uses GitContextAnalyzer
│ │ ├── pattern-analyzer.js # Uses Tokenizer
│ │ ├── phase-analyzer.js
│ │ ├── bug-tracker.js
│ │ ├── progress-calculator.js
│ │ ├── risk-analyzer.js
│ │ ├── code-context-analyzer.js
│ │ ├── dependency-analyzer.js
│ │ ├── duplication-detector.js
│ │ └── performance-analyzer.js
│ ├── reporters/ # Output generators (3 files)
│ │ ├── json-reporter.js
│ │ ├── markdown-reporter.js
│ │ └── html-reporter.js
│ ├── security/ # Security layer (4 files)
│ │ ├── path-validator.js
│ │ ├── security-config.js
│ │ ├── symlink-checker.js
│ │ └── redos-protector.js # Uses vm.Script sandbox
│ └── config/ # Configuration (1 file)
│ └── default-config.js
└── templates/ # Report templates
├── roadmap.template.md
└── dashboard.template.html
```
**Total: 29 JavaScript files (100% zero external dependencies)**
## Technical Improvements (v2.0)
### 1. Smart Tokenizer with Optional External Parser Support
Replaced regex pattern matching with intelligent tokenizer that adapts based on available tools:
**Without External Dependencies (Default):**
- Uses built-in JavaScript/TypeScript tokenizer
- Zero dependencies required
- Accurate enough for most use cases
**With Optional Parsers (Enhanced Mode):**
- Automatically detects and uses @babel/parser, acorn, or esprima if installed
- Maximum accuracy for complex JavaScript/TypeScript
- Perfect AST (Abstract Syntax Tree) parsing
- Install optionally: `npm install --save-optional @babel/parser acorn esprima`
**Benefits:**
- No false positives from comments or strings
- Understands code context perfectly
- Used in: ComplexityAnalyzer, SecurityScanner, PatternAnalyzer
### 2. Git Integration
Direct Git integration using Node.js `child_process` module:
- Accurate task age from `git blame`
- Commit history analysis from `git log`
- Conventional Commits detection (feat:, fix:, BREAKING CHANGE:)
- Author tracking and change frequency metrics
### 3. VM Sandbox Security
Enhanced ReDoS protection using `vm.Script`:
- Safer than setTimeout-based approaches
- True execution isolation in separate context
- Configurable timeout for regex operations
### 4. Async Performance
Improved scanning performance with async I/O:
- Uses `fs.promises` instead of sync operations
- `Promise.allSettled` for concurrent file processing
- Better performance on large projects
All improvements use **zero external dependencies** - only Node.js built-in modules.
## Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
## License
MIT License - see LICENSE file for details
## Support
- GitHub Issues: https://github.com/chahuadev-com/Chahuadev-smart-roadmap/issues
- Email: chahuadev@gmail.com
- Website: https://chahuadev.com
## Changelog
See CHANGELOG.md for version history
---
**Built with care by Chahua Development Co., Ltd.**
#