Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions internal/campaign/edge_case_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,27 +464,36 @@ func (d *EdgeCaseDetector) suggestSplits(decision FileDecision) []SplitSuggestio
ext := filepath.Ext(decision.Path)
dir := filepath.Dir(decision.Path)

// Generic split suggestions based on common patterns
patterns := []struct {
suffix string
desc string
}{
{"_types", "Type definitions and interfaces"},
{"_helpers", "Helper functions and utilities"},
{"_handlers", "Request/response handlers"},
{"_validation", "Validation logic"},
{"_persistence", "Database/storage operations"},
}

// Suggest at most 3 splits
for i, p := range patterns {
if i >= 3 {
break
if decision.Language == "unknown" {
for i := 1; i <= 3; i++ {
suggestions = append(suggestions, SplitSuggestion{
NewFileName: filepath.Join(dir, fmt.Sprintf("%s_part%d%s", baseName, i, ext)),
Reason: fmt.Sprintf("Split part %d", i),
})
}
} else {
// Generic split suggestions based on common patterns
patterns := []struct {
suffix string
desc string
}{
{"_types", "Type definitions and interfaces"},
{"_helpers", "Helper functions and utilities"},
{"_handlers", "Request/response handlers"},
{"_validation", "Validation logic"},
{"_persistence", "Database/storage operations"},
}

// Suggest at most 3 splits
for i, p := range patterns {
if i >= 3 {
break
}
suggestions = append(suggestions, SplitSuggestion{
NewFileName: filepath.Join(dir, baseName+p.suffix+ext),
Reason: p.desc,
})
}
suggestions = append(suggestions, SplitSuggestion{
NewFileName: filepath.Join(dir, baseName+p.suffix+ext),
Reason: p.desc,
})
}

return suggestions
Expand Down Expand Up @@ -812,10 +821,6 @@ func (a *EdgeCaseAnalysis) GetPreworkTasks() []string {
// Check if Mangle returns NaN/Inf for floats; complexity logic might permanently
// trigger ActionRefactorFirst or create panics on math operations.

// TODO: Missing Edge Case - User Request Extremes: Unknown file extensions.
// For `.xyz` or unrecognized file extensions, suggestSplits appends hardcoded
// golang/typescript-style suffixes (`_types`, `_helpers`) which could be invalid syntax.

// TODO: Missing Edge Case - State Conflicts: Race condition between `intel` and actual filesystem.
// Files marked `Exists: true` in intelligence might have been deleted. Should verify
// against `os.Stat(path)` to prevent invalid `ActionExtend` or `ActionModularize` commands.
Expand Down