The batch_analyze tool enables you to analyze multiple files at once with complexity, quality, and structure metrics. Using parallel processing, it can quickly assess large numbers of files and aggregate the results for comprehensive codebase insights.
Stellarion uses a Rayon-powered parallel processing engine with 4-15 worker threads to analyze files concurrently, achieving 40-60% faster performance compared to sequential analysis. Files are matched using glob patterns, analyzed with real complexity metrics from the ComplexityAnalyzer, and results are aggregated with automatic output truncation to stay within token limits.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
pattern | string | No | - | Single glob pattern (e.g., "src/**/*.ts") |
patterns | array | No | - | Multiple glob patterns |
files | array | No | - | Explicit list of file paths |
operations | array | No | ["complexity"] | ["complexity", "quality", "structure"] |
parallel | boolean | No | false | Enable parallel processing |
aggregate | boolean | No | false | Compute aggregated metrics |
thresholds | object | No | - | Violation thresholds for quality gates |
limit | number | No | 50 | Maximum results to return |
workers | number | No | 4 | Number of parallel workers (1-15) |
outputFormat | string | No | json | json or csv |
compare | boolean | No | false | Compare results across files |
continueOnError | boolean | No | false | Continue if individual files fail |
mcp__stellarion__batch_analyze pattern:"src/**/*.ts" operations:["complexity","quality"] parallel:true aggregate:true
Calculate metrics for each file:
Score each file:
Count elements in each file:
Natural Language:
Analyze complexity of all TypeScript files in src/
Direct MCP Call:
mcp__stellarion__batch_analyze pattern:"src/**/*.ts" operations:["complexity"] parallel:true
Natural Language:
Run complexity and quality analysis on src/ and give me summary statistics
Direct MCP Call:
mcp__stellarion__batch_analyze pattern:"src/**/*.ts" operations:["complexity","quality"] parallel:true aggregate:true
Returns: Per-file results plus aggregated metrics (average complexity, total issues, etc.)
Natural Language:
Check if any files in src/ have complexity over 20
Direct MCP Call:
mcp__stellarion__batch_analyze pattern:"src/**/*.ts" operations:["complexity"] thresholds:{"complexity":20} parallel:true
Returns: List of files exceeding the threshold (violations)
Natural Language:
Compare the complexity of these service files
Direct MCP Call:
mcp__stellarion__batch_analyze files:["src/services/userService.ts","src/services/orderService.ts"] operations:["complexity","quality"] compare:true
Natural Language:
Analyze all TypeScript and JavaScript files in the project
Direct MCP Call:
mcp__stellarion__batch_analyze patterns:["src/**/*.ts","src/**/*.js"] operations:["complexity","structure"] parallel:true
Natural Language:
Export complexity metrics for all files to CSV format
Direct MCP Call:
mcp__stellarion__batch_analyze pattern:"src/**/*.ts" operations:["complexity"] outputFormat:csv
Returns:
file,cyclomatic,cognitive,maintainability,loc
src/a.ts,12,8,75,145
src/b.ts,25,18,62,320
Natural Language:
Count all functions, classes, and methods in the project
Direct MCP Call:
mcp__stellarion__batch_analyze pattern:"src/**/*.ts" operations:["structure"] parallel:true aggregate:true
Natural Language:
Analyze this large codebase using maximum parallelism
Direct MCP Call:
mcp__stellarion__batch_analyze pattern:"**/*.ts" operations:["complexity"] parallel:true workers:10 limit:100
Each file includes:
| Field | Description |
|---|---|
| File path | Location of the file |
| Cyclomatic complexity | Total complexity score |
| Cognitive complexity | Understanding difficulty |
| Maintainability index | Score from 0-100 |
| Lines of code | LOC and SLOC counts |
| Quality rating | excellent, good, needs attention, poor |
| Function count | Number of functions (structure operation) |
| Class count | Number of classes (structure operation) |
When aggregate: true:
| Metric | Description |
|---|---|
| Total files | Number of files analyzed |
| Average complexity | Mean cyclomatic complexity |
| Max complexity | Highest complexity found |
| Total issues | Sum of quality issues |
| Files by quality | Count per quality level |
When thresholds are set:
| Field | Description |
|---|---|
| File path | File exceeding threshold |
| Actual value | The measured value |
| Threshold | The configured limit |
| Violation type | What threshold was exceeded |
Use thresholds for automated quality checks:
mcp__stellarion__batch_analyze pattern:"src/**/*.ts" thresholds:{"complexity":20} operations:["complexity"] parallel:true
Returns:
{
"violations": [
{
"file": "src/complex.ts",
"complexity": 35,
"threshold": 20
}
],
"passed": false
}
Use the violations array and passed field for CI/CD integration.
parallel: true for 40-60% faster analysisworkers: 8 for large codebaseslimit: 50 for large analysesaggregate: true gives overview without all detailscontinueOnError: true for resilient batch processing| Approach | Time for 54 files |
|---|---|
| Sequential (file by file) | 30-60 seconds |
| batch_analyze (4 workers) | 5-10 seconds |
| batch_analyze (8 workers) | 3-6 seconds |
Full structured data with all metrics:
{
"results": [...],
"aggregate": {...},
"violations": [...],
"metadata": {
"files_analyzed": 54,
"processing_time_ms": 4500
}
}
Spreadsheet-compatible format:
file,cyclomatic,cognitive,maintainability,loc,quality
src/auth.ts,12,8,75,145,good
src/complex.ts,35,25,52,420,needs_attention
src/services/*.ts is faster than **/*.tsparallel: true for 10+ files