Commit Graph

21 Commits

Author SHA1 Message Date
Pedram Amini
5ad4e36c70 refactor: extract main panel components (Round 3 - 232 line reduction)
Created two new components to modularize main workspace:
- TerminalOutput.tsx - Logs area with search/filter functionality
- InputArea.tsx - Input controls with image staging and command history

Changes:
- Extracted 68 lines of terminal output JSX into reusable TerminalOutput component
- Extracted 202 lines of input area JSX into reusable InputArea component
- Removed unused activeLogs variable (now calculated inside TerminalOutput)
- Replaced main panel sections in App.tsx with component calls (23 lines)

Impact:
- App.tsx reduced from 2,828 lines to 2,596 lines (232 line reduction, 8.2%)
- Total reduction from initial 3,091 lines: 495 lines (16% reduction)
- Build verified successfully

Part of task #5 from HOUSEKEEPING.md - Phase 2: Extract components
Progress: 3,091 → 2,988 → 2,828 → 2,596 lines
2025-11-23 22:50:12 -06:00
Pedram Amini
e542d27fb8 refactor: extract right panel components (Round 2 - 160 line reduction)
Created three new components to modularize right panel:
- FileExplorerPanel.tsx - File tree rendering with filtering and navigation
- HistoryPanel.tsx - Work log timeline display
- RightPanel.tsx - Wrapper combining files, history, and scratchpad tabs

Changes:
- Extracted 192 lines of right panel JSX into reusable components
- Moved getFileIcon helper to utils/theme.tsx for shared access
- Replaced right panel section in App.tsx with RightPanel component (30 lines)
- Updated theme.ts to theme.tsx to support JSX

Impact:
- App.tsx reduced from 2,988 lines to 2,828 lines (160 line reduction, 5.4%)
- Total reduction from initial 3,091 lines: 263 lines (8.5%)
- Build verified successfully

Part of task #5 from HOUSEKEEPING.md - Phase 2: Extract components
2025-11-23 22:44:55 -06:00
Pedram Amini
f3d70dd217 docs: add comprehensive refactoring plan for App.tsx reduction 2025-11-23 22:13:24 -06:00
Pedram Amini
c5ac8dcead docs: update README and CLAUDE.md to document hooks and services architecture 2025-11-23 22:11:54 -06:00
Pedram Amini
325fe00049 refactor: extract custom hooks, components, and services from App.tsx
Phase 1 (Partial - 3/5 complete):
- Add useSessionManager() hook for session CRUD and state management
- Add useFileExplorer() hook for file tree operations
- Add useSettings() hook for settings loading and persistence
- Skip useKeyboardShortcuts() (too complex/tightly coupled)
- Skip useTunnelManager() (tunnels not yet implemented)

Phase 2 (Partial - 1/5 complete):
- Extract SessionList component (left sidebar) - saves ~318 lines
- Remaining components (TerminalOutput, InputArea, FileExplorer, HistoryPanel) for future work

Phase 3 (Complete):
- Add git.ts service for git operations
- Add process.ts service for process IPC wrappers

Result: Reduced App.tsx from 3,091 lines to 2,988 lines (103 lines saved, 3.3% reduction)

This creates a foundation of reusable hooks and services for continued refactoring.
Further component extraction recommended to reach <500 line target.
2025-11-23 22:07:17 -06:00
Pedram Amini
bb3d47617c cleanups and minor fixes 2025-11-23 21:44:14 -06:00
Pedram Amini
4fd1f4a89a fix: replace deprecated substr() with crypto.randomUUID() for ID generation
- Replaced Math.random().toString(36).substr(2, 9) with crypto.randomUUID()
- Provides cryptographically secure random values instead of weak randomness
- Eliminates use of deprecated substr() method
- Returns standard RFC4122 UUID format
2025-11-23 21:20:53 -06:00
Pedram Amini
5f6f305951 fix: remove duplicate star emoji from emoji list
Removed duplicate star emoji () entry from the Nature section
(line 44) in emojis.ts. The star emoji now only appears once in
the Symbols section where it belongs.

Resolves housekeeping task #13
2025-11-23 21:19:09 -06:00
Pedram Amini
156fdafea4 fix: make shellCwd and commandHistory optional in Session interface
These properties may not exist on legacy sessions loaded from storage,
causing type inconsistencies. The code already handles their absence
with defensive patterns (|| []), so making them optional is the correct
fix. Also updated all MOCK_SESSIONS to include these properties for
consistency with real session creation.
2025-11-23 21:17:55 -06:00
Pedram Amini
f7a31e3a36 feat: migrate sessions/groups persistence from localStorage to electron-store
- Created separate electron-store instances for sessions and groups
- Added IPC handlers for sessions:getAll, sessions:setAll, groups:getAll, groups:setAll
- Exposed session/group persistence APIs via preload.ts
- Updated App.tsx to load from electron-store with automatic localStorage migration
- Migration runs once on first load and cleans up old localStorage data
- Resolves inconsistent persistence patterns and prevents data loss on cache clear

Completes housekeeping task #10
2025-11-23 21:15:30 -06:00
Pedram Amini
b0ea99c3e7 refactor: replace 'any' types with proper interfaces
Replace all identified 'any' types with proper TypeScript interfaces to improve type safety:

- Added ProcessConfig, AgentConfig, and DirectoryEntry interfaces to preload.ts
- Exported matching interfaces in src/renderer/types/index.ts
- Updated all MaestroAPI type definitions to use proper types
- Changed generic 'any' to 'unknown' for settings values (more type-safe)
- Updated SettingsModal.tsx to use Theme and Shortcut types instead of 'any'
- Fixed all theme picker and shortcuts filter type annotations

All files build successfully with proper type checking.
2025-11-23 21:11:43 -06:00
Pedram Amini
1135e8c439 fix: prevent mock data from shipping in production builds
Wrapped MOCK_GROUPS and MOCK_SESSIONS in process.env.NODE_ENV === 'development'
conditionals to ensure they only exist during development. Production builds now
receive empty arrays, preventing unnecessary test data from shipping to users.

This resolves housekeeping task #9.
2025-11-23 21:08:39 -06:00
Pedram Amini
75cce1ab56 chore: remove non-functional tunnel placeholder code
Removed incomplete tunnel implementation that was returning fake URLs.
- Removed tunnel:start and tunnel:stop IPC handlers from main process
- Removed tunnel API from preload contextBridge
- Added documentation comment noting tunnel feature is planned for Phase 6
- Tunnel UI settings remain in place for future implementation

The tunnel feature is documented as a planned Phase 6 feature in PRD.md
and CLAUDE.md:385. This change removes the non-functional placeholder
code from production while keeping the UI settings for future use.

Resolves housekeeping task #8
2025-11-23 21:06:43 -06:00
Pedram Amini
c1be375d56 chore: remove unused Lucide React icons
Removed Clock, Command, MessageSquare, and Sparkles icons from App.tsx import statement as they were not being used in the component. This reduces bundle size by approximately 2KB.

Resolves housekeeping task #7.
2025-11-23 21:04:55 -06:00
Pedram Amini
d76176a153 refactor: consolidate duplicate AgentConfig interface
Moved the AgentConfig interface definition from SettingsModal.tsx and
NewInstanceModal.tsx to the shared types file (src/renderer/types/index.ts)
to eliminate code duplication and establish a single source of truth.

Changes:
- Added AgentConfig interface to src/renderer/types/index.ts
- Updated SettingsModal.tsx to import AgentConfig from shared types
- Updated NewInstanceModal.tsx to import AgentConfig from shared types

Resolves housekeeping task #6
2025-11-23 21:03:43 -06:00
Pedram Amini
46859165b2 fix: replace dynamic require() with top-level ES6 import
Replace dynamic require('fs').promises calls with static import statement.
This improves security, enables better tree-shaking, and follows modern
ES6 module patterns.

Changes:
- Add 'import fs from "fs/promises"' at module top
- Remove dynamic require() in fs:readDir handler (line 181)
- Remove dynamic require() in fs:readFile handler (line 192)

Completes housekeeping task #4 (CRITICAL security issue)
2025-11-23 21:02:32 -06:00
Pedram Amini
3e6ef5b66a fix: remove vulnerable execCommand method from ProcessManager
Removed the execCommand() method that used naive space-splitting for argument parsing, which could break with filenames containing spaces. Replaced its single usage in git:isRepo handler with direct call to execFileNoThrow using structured array arguments.

This change:
- Eliminates command parsing vulnerability (#2)
- Reduces attack surface by removing unnecessary abstraction
- Maintains consistency with project security patterns
- All git operations now consistently use execFileNoThrow

Fixes #2 in Housekeeping.md (CRITICAL security issue)
2025-11-23 20:49:09 -06:00
Pedram Amini
fb8f011e0e builds nicely 2025-11-23 20:41:06 -06:00
Pedram Amini
253cfc963e more ux updates 2025-11-23 19:52:29 -06:00
Pedram Amini
69db83a490 UX iterations 2025-11-23 19:40:45 -06:00
Pedram Amini
ca85ff7c48 UX prototype complete 2025-11-23 19:00:08 -06:00