feat(types): resolve TypeScript errors and enhance project analysis features

- Fixed TypeScript errors across the codebase, including updates to various files for improved type safety.
- Introduced new `FileTreeNode` and `ProjectAnalysis` interfaces to support project analysis functionality.
- Added `Badge` component for UI consistency and improved visual representation.
- Enhanced `useElectronAgent` and `electron` API with additional methods for project management.
- Updated `AnalysisView` to utilize new types and improve type annotations for better clarity.

These changes contribute to a more robust and type-safe codebase, facilitating future development and analysis capabilities.
This commit is contained in:
Kacper
2025-12-10 13:56:33 +01:00
parent 7ab2aaaa23
commit 55b8e6858e
8 changed files with 186 additions and 69 deletions

View File

@@ -126,6 +126,24 @@ export interface Feature {
branchName?: string; // Name of the feature branch
}
// File tree node for project analysis
export interface FileTreeNode {
name: string;
path: string;
isDirectory: boolean;
extension?: string;
children?: FileTreeNode[];
}
// Project analysis result
export interface ProjectAnalysis {
fileTree: FileTreeNode[];
totalFiles: number;
totalDirectories: number;
filesByExtension: Record<string, number>;
analyzedAt: string;
}
export interface AppState {
// Project state
projects: Project[];
@@ -173,6 +191,10 @@ export interface AppState {
// AI Profiles
aiProfiles: AIProfile[];
// Project Analysis
projectAnalysis: ProjectAnalysis | null;
isAnalyzing: boolean;
}
export interface AutoModeActivity {
@@ -267,6 +289,11 @@ export interface AppActions {
removeAIProfile: (id: string) => void;
reorderAIProfiles: (oldIndex: number, newIndex: number) => void;
// Project Analysis actions
setProjectAnalysis: (analysis: ProjectAnalysis | null) => void;
setIsAnalyzing: (analyzing: boolean) => void;
clearAnalysis: () => void;
// Reset
reset: () => void;
}
@@ -351,6 +378,8 @@ const initialState: AppState = {
defaultSkipTests: false, // Default to TDD mode (tests enabled)
useWorktrees: false, // Default to disabled (worktree feature is experimental)
aiProfiles: DEFAULT_AI_PROFILES,
projectAnalysis: null,
isAnalyzing: false,
};
export const useAppStore = create<AppState & AppActions>()(
@@ -713,6 +742,11 @@ export const useAppStore = create<AppState & AppActions>()(
set({ aiProfiles: profiles });
},
// Project Analysis actions
setProjectAnalysis: (analysis) => set({ projectAnalysis: analysis }),
setIsAnalyzing: (analyzing) => set({ isAnalyzing: analyzing }),
clearAnalysis: () => set({ projectAnalysis: null }),
// Reset
reset: () => set(initialState),
}),