1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// AI-Powered Automated Refactoring Handler
//
// FULLY IMPLEMENTED state machine for AI-driven automated refactoring:
// - Finds files with EXTREME quality violations (complexity, SATD, coverage)
// - Generates comprehensive rewrite requests for AI agents
// - Waits for AI to provide refactored code that meets ALL quality standards:
// * Functions with complexity <= 10 (target: 5)
// * Test coverage >= 80% per file
// * Zero SATD comments (self-admitted technical debt)
// * All lint violations fixed (pedantic + nursery)
// - Verifies the refactored code compiles and passes tests
// - Iterates until entire project meets RIGID extreme quality standards
//
// This is an AI-powered tool that outputs requests for AI agents to refactor code.
//
// Split into include!() sub-files for file health compliance (CB-040).
// Sub-files share this module's scope (all imports from parent mod.rs).
// Each sub-file contains a logical grouping of related functionality.
// // Functions are being integrated iteratively
use crateRefactorAutoOutputFormat;
// Types extracted to refactor_auto_types.rs for file health compliance (CB-040)
pub use ;
use ;
use ;
use regex;
use ;
use serde_json;
use ;
use WalkDir;
// Type definitions: RefactorAutoConfig, RefactorState, QualityProfile,
// RefactorConfig, RefactorMode, PatternConfig, OutputConfig, RefactorContext,
// GitHubIssueRef, GitHubIssueContent, ProjectQualityAnalysis, ComplexityAnalysis,
// SatdAnalysis, CoverageAnalysis, ComplexityViolation, SatdComment, UncoveredLine,
// RefactoringRequest, RefactoringType, RefactoringPriority, RefactoringEffort,
// LintHotspotJsonResponse, LintHotspotJson, ViolationDetailJson
include!;
// Setup and discovery: setup_refactoring_context, load_ignore_patterns,
// discover_source_files
include!;
// GitHub issue integration: handle_special_modes, process_github_issue,
// parse_github_issue_url, fetch_github_issue_content,
// extract_target_files_from_issue
include!;
// Quality analysis: analyze_project_quality, analyze_project_lint_violations,
// analyze_project_complexity, analyze_project_satd, analyze_project_coverage,
// parse_coverage_from_output
include!;
// Refactoring request generation: generate_refactoring_requests,
// create_complexity_reduction_request, create_lint_fix_requests,
// create_satd_cleanup_requests, create_coverage_improvement_requests
include!;