Skip to content

Commit 9f492ed

Browse files
refactor(docs): code analysis engine
changes: - file: command_handlers.py area: cli modified: [batch_command] - file: output_formatters.py area: cli modified: [output_batch_yaml, output_batch_json, output_batch_rich, output_json, output_batch_toon] - file: settings_builders.py area: cli modified: [build_batch_settings] dependencies: flow: "command_handlers→validation" - command_handlers.py -> validation.py stats: lines: "+2594/-1272 (net +1322)" files: 23 complexity: "Stable complexity"
1 parent 32d7850 commit 9f492ed

29 files changed

+2618
-1275
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Git
2+
.git/
3+
14
releases
25
vendor/
36
publish-env

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
124124
- **Tree-sitter for all** — syntax validation for 165+ languages
125125
- **Example 07** — comprehensive multi-language demo with 8 languages
126126

127+
## [0.1.17] - 2026-03-23
128+
129+
### Docs
130+
- Update README.md
131+
- Update docs/README.md
132+
- Update project/README.md
133+
- Update project/context.md
134+
135+
### Other
136+
- Update .gitignore
137+
- Update project.sh
138+
- Update project/analysis.toon
139+
- Update project/calls.mmd
140+
- Update project/calls.png
141+
- Update project/compact_flow.mmd
142+
- Update project/compact_flow.png
143+
- Update project/dashboard.html
144+
- Update project/duplication.toon
145+
- Update project/evolution.toon
146+
- ... and 8 more files
147+
127148
## [0.1.16] - 2026-03-23
128149

129150
### Docs

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,63 @@ vallm check src/main.go
136136
vallm info
137137
```
138138

139+
### Fast Validation Options
140+
141+
When validating large projects (100+ files), use these options to speed up validation:
142+
143+
```bash
144+
# Fastest - syntax only (skip imports and complexity)
145+
vallm batch . --recursive --no-imports --no-complexity
146+
147+
# Fast - skip import validation (often the slowest)
148+
vallm batch . --recursive --no-imports
149+
150+
# Parallel processing for multi-core speedup
151+
vallm batch . --recursive --parallel
152+
153+
# Combine for maximum speed
154+
vallm batch . --recursive --parallel --no-imports --no-complexity
155+
156+
# Quick syntax check only (single files)
157+
vallm check src/proxym/config.py
158+
```
159+
160+
| Option | Speed Impact | Description |
161+
|--------|--------------|-------------|
162+
| `--no-imports` | **High** | Skip import resolution (slowest validator) |
163+
| `--no-complexity` | **Medium** | Skip complexity analysis (radon/lizard) |
164+
| `--parallel` | **High** | Process files in parallel (multi-core) |
165+
| `--security` | **Low** | Add security checks (fast pattern matching) |
166+
167+
**Recommendation for CI/CD:**
168+
```bash
169+
# Fast validation for quick feedback
170+
vallm batch src/ --recursive --no-imports --parallel
171+
172+
# Full validation before merge (slower but thorough)
173+
vallm batch src/ --recursive --parallel
174+
```
175+
139176
### Generate Validation Summary File
140177

141178
```bash
142179
# JSON summary for entire project (with per-file details and issues)
143-
vallm batch . --recursive --format json > validation-summary.json
180+
vallm batch . --recursive --output json > validation-summary.json
144181

145182
# YAML summary for src/ directory (with per-file details and issues)
146-
vallm batch src/ --recursive --format yaml > validation-summary.yaml
183+
vallm batch src/ --recursive --output yaml > validation-summary.yaml
147184

148185
# TOON format (compact, human-readable) with per-file details
149-
vallm batch . --recursive --format toon > validation-summary.toon
186+
vallm batch . --recursive --output toon > validation-summary.toon
150187

151188
# Text format with security checks
152-
vallm batch . --recursive --format text --security > validation-report.txt
189+
vallm batch . --recursive --output text --security > validation-report.txt
153190

154191
# Full validation with semantic review - save to file
155-
vallm batch . --recursive --semantic --model qwen2.5-coder:7b --format json > full-validation.json
192+
vallm batch . --recursive --semantic --model qwen2.5-coder:7b --output json > full-validation.json
156193

157194
# Tee output to both console and file
158-
vallm batch . --recursive --format json | tee validation-summary.json
195+
vallm batch . --recursive --output json | tee validation-summary.json
159196
```
160197

161198
**Output Structure (JSON/YAML/TOON formats now include per-file details):**

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.16
1+
0.1.17

docs/README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -151,31 +151,31 @@ Content outside the markers is preserved when regenerating. Enable this with `sy
151151

152152
```
153153
vallm/
154-
├── bump_version ├── cli/├── examples/ ├── hookspecs ├── vallm/ ├── __main__ ├── base ├── logical ├── complexity ├── validators/ ├── security ├── semantic_cache ├── syntax ├── lint ├── semantic ├── imports/ ├── graph_diff ├── core/ ├── ast_compare ├── proposal ├── gitignore ├── scoring ├── output_formatters ├── batch_processor ├── languages ├── sandbox/ ├── base ├── javascript_imports ├── python_imports ├── go_imports ├── c_imports ├── rust_imports ├── utils ├── wrapper ├── factory ├── java_imports ├── main_template ├── main ├── main ├── claude_autonomous_demo ├── main ├── ollama_simple_demo ├── iteration_1 ├── best_version ├── iteration_2 ├── main ├── main ├── main ├── main_template ├── main ├── main ├── refactored_output ├── mcp_demo ├── runner ├── utils/ ├── save_analysis_data ├── extraction ├── extract_code_from_response ├── logging_utils ├── validation_runner ├── order_processor ├── main ├── simple_buggy ├── load_config ├── utils/ ├── process_user_input ├── calculate_total ├── main ├── save_data├── project ├── run ├── run ├── docker-entrypoint ├── run ├── docker-entrypoint ├── run ├── docker-entrypoint ├── data_processor ├── config ├── command_handlers```
154+
├── hookspecs ├── cli/ ├── bump_version ├── vallm/ ├── __main__├── examples/ ├── complexity ├── logical ├── security ├── base ├── validators/ ├── semantic_cache ├── syntax ├── lint ├── imports/ ├── semantic ├── graph_diff ├── core/ ├── scoring ├── gitignore ├── languages ├── output_formatters ├── ast_compare ├── batch_processor ├── proposal ├── sandbox/ ├── base ├── javascript_imports ├── python_imports ├── go_imports ├── c_imports ├── rust_imports ├── utils ├── wrapper ├── factory ├── java_imports ├── main_template ├── main ├── main ├── claude_autonomous_demo ├── main ├── ollama_simple_demo ├── iteration_1 ├── best_version ├── iteration_2 ├── main ├── main ├── main ├── main_template ├── main ├── main ├── runner ├── refactored_output ├── utils/ ├── extraction ├── save_analysis_data ├── mcp_demo ├── extract_code_from_response ├── validation_runner ├── logging_utils ├── order_processor ├── main ├── process_user_input ├── load_config ├── utils/ ├── simple_buggy ├── calculate_total ├── main ├── save_data├── project ├── run ├── run ├── docker-entrypoint ├── run ├── docker-entrypoint ├── run ├── docker-entrypoint ├── data_processor ├── command_handlers ├── config```
155155
156156
## API Overview
157157
158158
### Classes
159159
160160
- **`VallmSpec`** — Hook specifications that validators must implement.
161-
- **`BaseValidator`** — Base class for all vallm validators.
162-
- **`LogicalErrorValidator`** — Validator for logical errors using pyflakes.
163161
- **`ComplexityValidator`** — Tier 2: Cyclomatic complexity, maintainability index, and function metrics.
162+
- **`LogicalErrorValidator`** — Validator for logical errors using pyflakes.
164163
- **`SecurityValidator`** — Tier 2: Security analysis using built-in patterns and optionally bandit.
164+
- **`BaseValidator`** — Base class for all vallm validators.
165165
- **`SemanticCache`** — Cache for semantic validation results to improve performance.
166166
- **`SyntaxValidator`** — Tier 1: Fast syntax validation.
167167
- **`LintValidator`** — Validator for linting issues using ruff.
168168
- **`SemanticValidator`** — Tier 3: LLM-as-judge semantic code review.
169169
- **`GraphDiffResult`** — Result of comparing two code graphs.
170-
- **`Proposal`** — A code proposal to be validated.
171-
- **`GitignoreParser`** — Parse .gitignore files and match paths against patterns.
172170
- **`Verdict`** — —
173171
- **`Severity`** — —
174172
- **`Issue`** — A single issue found during validation.
175173
- **`ValidationResult`** — Result from a single validator.
176174
- **`PipelineResult`** — Aggregated result from all validators.
177-
- **`BatchProcessor`** — Handles batch validation of multiple files.
175+
- **`GitignoreParser`** — Parse .gitignore files and match paths against patterns.
178176
- **`Language`** — Supported programming languages with their tree-sitter identifiers.
177+
- **`BatchProcessor`** — Handles batch validation of multiple files.
178+
- **`Proposal`** — A code proposal to be validated.
179179
- **`BaseImportValidator`** — Base class for all import validators.
180180
- **`JavaScriptImportValidator`** — JavaScript/TypeScript import validator.
181181
- **`PythonImportValidator`** — Python-specific import validator.
@@ -187,10 +187,10 @@ vallm/
187187
- **`JavaImportValidator`** — Java import validator.
188188
- **`Colors`** — —
189189
- **`Colors`** — —
190-
- **`OrderManager`** — Class with single responsibility - adheres to SOLID principles.
191-
- **`Colors`** — —
192190
- **`ExecutionResult`** — Result of sandboxed code execution.
193191
- **`SandboxRunner`** — Unified interface for running code in a sandbox.
192+
- **`OrderManager`** — Class with single responsibility - adheres to SOLID principles.
193+
- **`Colors`** — —
194194
- **`Colors`** — ANSI color codes for terminal output.
195195
- **`OrderManager`** — Class with mixed responsibilities - SOLID violation.
196196
- **`BadClass`** — Class with multiple issues.
@@ -208,19 +208,14 @@ vallm/
208208
- `create_validator(settings)` — Factory function for LintValidator.
209209
- `diff_graphs(before, after)` — Compare two CodeGraphs and return the diff.
210210
- `diff_python_code(before_code, after_code)` — Convenience function: build graphs from code strings and diff them.
211-
- `parse_code(code, language)` — Parse code using tree-sitter and return the tree.
212-
- `parse_python_ast(code)` — Parse Python code using the built-in ast module. Returns None on failure.
213-
- `normalize_python_ast(tree)` — Normalize a Python AST by replacing identifiers with canonical names.
214-
- `python_ast_similarity(code1, code2)` — Compute structural similarity between two Python code snippets.
215-
- `tree_sitter_node_count(code, language)` — Count the number of nodes in a tree-sitter parse tree.
216-
- `tree_sitter_error_count(code, language)` — Count syntax errors reported by tree-sitter.
217-
- `structural_diff_summary(code1, code2, language)` — Return a summary of structural differences between two code snippets.
211+
- `compute_verdict(results, settings)` — Compute the aggregate verdict from a list of validation results.
212+
- `validate(proposal, settings, validators, context)` — Run the full validation pipeline on a proposal.
218213
- `load_gitignore(path)` — Load .gitignore from a directory.
219214
- `get_default_excludes()` — Get default exclude patterns used when no .gitignore exists.
220215
- `create_default_gitignore_parser()` — Create a parser with default exclude patterns.
221216
- `should_exclude(path, gitignore_parser, use_defaults)` — Check if a path should be excluded.
222-
- `compute_verdict(results, settings)` — Compute the aggregate verdict from a list of validation results.
223-
- `validate(proposal, settings, validators, context)` — Run the full validation pipeline on a proposal.
217+
- `detect_language(source)` — Auto-detect language from file path, extension, or name.
218+
- `get_language_for_validation(source, explicit)` — Get tree-sitter language ID for validation.
224219
- `output_validate_result(result, output_format, verbose)` — Output validation result in the specified format.
225220
- `output_batch_results(results_by_language, filtered_files, passed_count, failed_files)` — Output batch validation results in the specified format.
226221
- `output_batch_empty(output_format)` — Output empty results.
@@ -234,8 +229,13 @@ vallm/
234229
- `output_batch_toon(results_by_language, filtered_files, passed_count, failed_files)` — Output TOON format batch summary with detailed per-file results.
235230
- `print_summary_header()` — Print summary header for batch results.
236231
- `build_results_table(results_by_language)` — Build results table for rich output.
237-
- `detect_language(source)` — Auto-detect language from file path, extension, or name.
238-
- `get_language_for_validation(source, explicit)` — Get tree-sitter language ID for validation.
232+
- `parse_code(code, language)` — Parse code using tree-sitter and return the tree.
233+
- `parse_python_ast(code)` — Parse Python code using the built-in ast module. Returns None on failure.
234+
- `normalize_python_ast(tree)` — Normalize a Python AST by replacing identifiers with canonical names.
235+
- `python_ast_similarity(code1, code2)` — Compute structural similarity between two Python code snippets.
236+
- `tree_sitter_node_count(code, language)` — Count the number of nodes in a tree-sitter parse tree.
237+
- `tree_sitter_error_count(code, language)` — Count syntax errors reported by tree-sitter.
238+
- `structural_diff_summary(code1, code2, language)` — Return a summary of structural differences between two code snippets.
239239
- `walk(root, project_root, gitignore_matcher, skip_tests)` — Walk directory tree yielding Python files.
240240
- `validate_import_path(import_path, source_file, project_root, known_modules)` — Validate if an import path is resolvable.
241241
- `main()` — —
@@ -297,6 +297,13 @@ vallm/
297297
- `save_data(data, filename)` — Save data safely using json.dump.
298298
- `process_order(data)` — Process order data with proper error handling and validation.
299299
- `main()` — —
300+
- `save_analysis_data(example_name, result_data)` — Save analysis data to .vallm folder.
301+
- `run_validation_examples(example_name, good_code, bad_code, complex_code)` — Run standard validation examples (good, bad, complex code).
302+
- `validate_code_example(name, code, settings, all_results)` — Validate a code example and store results.
303+
- `print_summary(all_results)` — Print summary of all validation results.
304+
- `extract_code_from_response(response, language)` — Extract code from LLM response.
305+
- `extract_json_from_response(response)` — Extract JSON object from LLM response.
306+
- `save_analysis_data(example_name, result_data)` — Save analysis data to JSON file.
300307
- `log_section(title)` — Print a section header.
301308
- `log_step(step, description)` — Print a step.
302309
- `log_code(label, code, max_lines)` — Log code with label.
@@ -306,19 +313,12 @@ vallm/
306313
- `generate_refactoring_prompt(code, analysis)` — Generate prompt for LLM to refactor code.
307314
- `run_mcp_workflow(code_path, max_iterations)` — Run the complete MCP workflow.
308315
- `main()` — Main entry point.
309-
- `save_analysis_data(example_name, result_data)` — Save analysis data to .vallm folder.
310-
- `run_validation_examples(example_name, good_code, bad_code, complex_code)` — Run standard validation examples (good, bad, complex code).
311-
- `validate_code_example(name, code, settings, all_results)` — Validate a code example and store results.
312-
- `print_summary(all_results)` — Print summary of all validation results.
313-
- `save_analysis_data(example_name, result_data)` — Save analysis data to JSON file.
314-
- `extract_code_from_response(response, language)` — Extract code from LLM response.
315-
- `extract_json_from_response(response)` — Extract JSON object from LLM response.
316316
- `extract_code_from_response(response)` — Extract Python code from LLM response.
317+
- `run_validation_examples(example_name, good_code, bad_code, complex_code)` — Run standard validation examples (good, bad, complex code).
317318
- `log_section(title)` — Print a section header.
318319
- `log_step(step, description)` — Print a step indicator.
319320
- `log_code(label, code, max_lines)` — Log code with label and truncation.
320321
- `log_result(status, message)` — Log a result with appropriate color.
321-
- `run_validation_examples(example_name, good_code, bad_code, complex_code)` — Run standard validation examples (good, bad, complex code).
322322
- `process_order(data)` — Process order data - has multiple issues.
323323
- `load_config()` — Load config - security issue with eval.
324324
- `save_data(data, filename)` — Save data - uses pickle without validation.
@@ -332,15 +332,15 @@ vallm/
332332
- `validate_with_vallm(project_path)` — Validate all Python files with vallm.
333333
- `generate_report(code2llm_result, vallm_result, output_path)` — Generate combined analysis report.
334334
- `main()` — Main example function.
335+
- `process_user_input(user_input)` — Process user input with standard logic.
336+
- `load_config()` — Load configuration with default values.
335337
- `process_user_input(user_input)` — Process user input with security issues.
336338
- `load_config()` — Load configuration with eval.
337339
- `save_data(data, filename)` — Save data without validation.
338340
- `calculate_total(items)` — Calculate total with no error handling.
339341
- `duplicate_function()` — Another duplicate function.
340342
- `unused_function()` — This function is never used.
341343
- `main()` — Main function with problems.
342-
- `load_config()` — Load configuration with default values.
343-
- `process_user_input(user_input)` — Process user input with standard logic.
344344
- `calculate_total(items)` — Calculate total price from items list.
345345
- `run_demo_main()` — Run the standard demo main function pattern.
346346
- `save_data(data, filename)` — Save data to JSON file.

project.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22
clear
3+
.venv/bin/pip install -e .
34
.venv/bin/pip install redup --upgrade
45
.venv/bin/pip install glon --upgrade
56
.venv/bin/pip install goal --upgrade
@@ -15,4 +16,6 @@ rm project/analysis.yaml
1516
.venv/bin/code2docs ./ --readme-only
1617
.venv/bin/redup scan . --format toon --output ./project
1718
# --parallel --functions-only --incremental --min-lines 5
18-
#.venv/bin/redup scan . --format toon --output ./project --parallel --incremental --functions-only
19+
#.venv/bin/redup scan . --format toon --output ./project --parallel --incremental --functions-only
20+
.venv/bin/vallm batch . --recursive --output toon > ./project/validation.toon
21+
#.venv/bin/vallm batch . --recursive --no-imports --no-complexity

project/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ When you run `code2llm ./ -f all`, the following files are created:
1010

1111
| File | Format | Purpose | Key Insights |
1212
|------|--------|---------|--------------|
13-
| `analysis.toon` | **TOON** | **🔥 Health diagnostics** - Complexity, god modules, coupling | 7 critical functions, 0 god modules |
13+
| `analysis.toon` | **TOON** | **🔥 Health diagnostics** - Complexity, god modules, coupling | 8 critical functions, 0 god modules |
1414
| `evolution.toon` | **TOON** | **📋 Refactoring queue** - Prioritized improvements | 0 refactoring actions needed |
1515
| `flow.toon` | **TOON** | **🔄 Data flow analysis** - Pipelines, contracts, types | Data dependencies and side effects |
1616
| `map.toon` | **TOON** | **🗺️ Structural map** - Modules, imports, signatures | Project architecture overview |

0 commit comments

Comments
 (0)