-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Context
The codebase has inconsistent naming for similar concepts, making it confusing. This issue standardizes type names.
Priority
🟡 HIGH - Improves code clarity significantly
Steps
1. Rename App
to AppConfig
(Remove Settings
alias)
In src/config.rs
:
// BEFORE
pub struct App { ... }
pub static ref APP: App = ...;
// AFTER
pub struct AppConfig { ... }
pub static ref APP_CONFIG: AppConfig = ...;
Update all references:
# Find all usages
rg "config::APP" src/
rg "App::new" src/
rg "Settings" src/
# Replace throughout:
# config::APP → config::APP_CONFIG
# App::new() → AppConfig::new()
# Settings → AppConfig (remove type alias)
2. Unify File-Related Types
Create src/generation/types.rs
(new file):
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FileChange {
pub path: String,
pub operation: OperationType,
pub diff_content: Option<String>,
// Analysis fields (filled after analysis)
pub lines_added: Option<u32>,
pub lines_removed: Option<u32>,
pub category: Option<FileCategory>,
pub summary: Option<String>,
pub impact_score: Option<f32>,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub enum OperationType {
Added, Modified, Deleted, Renamed, Binary
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub enum FileCategory {
Source, Test, Config, Docs, Binary, Build
}
Replace these types with FileChange
:
FileAnalysisResult
in multi_step_analysis.rsFileWithScore
in multi_step_analysis.rsFileDataForScoring
in multi_step_analysis.rsParsedFile
in multi_step_integration.rs
3. Unify Response Types
In src/function_calling.rs
or new src/generation/response.rs
:
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommitResponse {
pub message: String,
pub reasoning: String,
pub files: HashMap<String, FileChange>,
}
Replace:
openai::Response
→CommitResponse
CommitFunctionArgs
→CommitResponse
(or keep as internal parsing type)
Verification Criteria
✅ Pass:
- No references to
App
remain (all areAppConfig
) - No references to
Settings
remain - All file-related types consolidated to single
FileChange
struct - Response types unified to
CommitResponse
-
cargo build
succeeds -
cargo test
passes -
cargo clippy
shows no warnings - All imports updated correctly
Estimated Time
4-6 hours
Dependencies
- Issue Include the repository field #1 (Remove dead code markers)
- Issue Proper token count based on model #2 (Remove commented code)
Notes
- Use IDE refactoring tools when possible for rename operations
- Commit after each major rename (e.g., App→AppConfig, then file types, then responses)
- This enables easier rollback if issues arise
Labels
- refactor
- naming
- breaking-change
Copilot