Commit Graph

1896 Commits

Author SHA1 Message Date
Pedram Amini
b921834ea2 MAESTRO: Add DurationTrendsChart component for Usage Dashboard
- SVG-based line chart showing average response duration over time
- X-axis adapts to time range (day: HH:mm, week: EEE, month: MMM d, etc.)
- Y-axis auto-scales with formatted duration labels (Xs, Xm, Xh)
- Smoothing/moving average toggle with adaptive window size (3-7 periods)
- Gradient area fill under the line for visual depth
- Tooltip shows date, avg duration, query count (+ raw value when smoothing)
- Theme-aware colors for line, grid, labels, and data points
- 35 tests verifying rendering, interaction, theming, and edge cases
2025-12-29 06:19:32 -06:00
Pedram Amini
852b542995 MAESTRO: Add SourceDistributionChart component for Usage Dashboard
- Create donut/pie chart showing Interactive vs Auto Run breakdown
- Custom SVG arc path generation for smooth donut rendering
- Toggle between count-based and duration-based views
- Center label displays total queries or formatted duration
- Interactive legend with hover highlighting and percentages
- Theme-aware colors (accent for Interactive, slate for Auto)
- Tooltip shows percentage and exact values on segment hover
- 39 comprehensive tests covering all features
2025-12-29 06:19:32 -06:00
Pedram Amini
6fa98ba217 MAESTRO: Add AgentComparisonChart component for Usage Dashboard
Add horizontal bar chart component that compares time spent per agent type:
- Toggle between count-based and duration-based views
- Bars sorted by value descending
- Distinct colors per agent using predefined palette
- Percentage labels on bars
- Theme-aware axis and label colors
- Tooltip on hover showing exact count and duration
- Legend showing up to 6 agents with overflow indicator

Includes comprehensive test suite with 26 tests covering:
- Rendering, metric mode toggle, bar sorting
- Percentage labels, agent colors, legend display
- Tooltip functionality, theme support
- Value formatting for durations and large counts
2025-12-29 06:19:32 -06:00
Pedram Amini
e36cb29492 MAESTRO: Add ActivityHeatmap component for Usage Dashboard
- GitHub-style contribution grid showing AI usage activity by day
- X-axis weeks, Y-axis days (Sun-Sat), with month labels for longer ranges
- Toggle between query count and duration metrics
- 5-level color intensity scale using theme accent color gradient
- Hover tooltip showing full date, query count, and duration
- Responsive handling for different time ranges (day/week/month/year/all)
- Comprehensive test suite with 19 passing tests
2025-12-29 06:19:32 -06:00
Pedram Amini
17c2e2b99b MAESTRO: Add useStats hook for Usage Dashboard stats management
- Create useStats hook with data fetching, loading, error states
- Add 1-second debounce on real-time stats updates
- Include useComputedStats helper for derived calculations
- Add stats API mock to test setup for testing
- Comprehensive test coverage (23 tests)
2025-12-29 06:19:32 -06:00
Pedram Amini
c6c3ec98cd MAESTRO: Add UsageDashboardModal component with visualizations
- Create UsageDashboard component directory with modal and index
- Implement UsageDashboardModal with time range selection (day/week/month/year/all)
- Add view mode tabs (Overview, Agents, Activity, Auto Run)
- Display summary stats cards (total queries, time, avg duration, top agent, interactive %)
- Add agent time comparison bar chart visualization
- Add source distribution donut chart (interactive vs auto)
- Add activity timeline bar chart with hover tooltips
- Register modal with layer stack for proper Escape handling
- Wire modal through AppModals component and App.tsx
- Add 26 comprehensive unit tests for rendering, interactions, and data states
2025-12-29 06:19:31 -06:00
Pedram Amini
df8c618459 MAESTRO: Add Usage Dashboard menu integration and keyboard shortcut
- Add USAGE_DASHBOARD priority (540) to modalPriorities.ts
- Add usageDashboard shortcut (Alt+Cmd+U) to shortcuts.ts
- Add usageDashboardOpen state to ModalContext.tsx
- Add keyboard handler for usageDashboard in useMainKeyboardHandler.ts
- Update isSystemUtilShortcut to include 'u' for modal bypass
- Add Usage Dashboard action to QuickActionsModal.tsx
- Wire setUsageDashboardOpen through App.tsx and AppModals.tsx
2025-12-29 06:19:31 -06:00
Pedram Amini
79531d26a4 MAESTRO: Install recharts and date-fns dependencies for Usage Dashboard
Added recharts v3.6.0 for charting components and date-fns v4.1.0 for
date formatting and manipulation. These are required for the upcoming
Usage Dashboard modal with Recharts visualizations.
2025-12-29 06:19:31 -06:00
Pedram Amini
d0b041b49d MAESTRO: Add comprehensive tests for cross-platform database path resolution
Add 34 tests verifying stats database path resolution works correctly on
macOS, Windows, and Linux. Tests cover:

- macOS: ~/Library/Application Support paths with spaces and special chars
- Windows: %APPDATA% paths, drive letters, UNC paths, portable installations
- Linux: ~/.config paths, XDG_CONFIG_HOME, Snap/Flatpak sandboxed paths
- Edge cases: unicode, emoji, long paths, quotes, ampersands
- Electron integration: app.getPath('userData') called correctly

All 191 tests pass (157 existing + 34 new).
2025-12-29 06:19:31 -06:00
Pedram Amini
06dbbfa2b8 MAESTRO: Add comprehensive tests for aggregation query calculations
Add 36 new tests verifying getAggregatedStats returns correct calculations:
- totalQueries/totalDuration: count, sum, zero, large values
- avgDuration: calculation, division by zero, rounding, edge cases
- byAgent: single/multiple agents, empty results, duration sums
- bySource: user vs auto counts, initialization, verification
- byDay: structure, ordering, count/duration sums
- SQL structure: COALESCE, GROUP BY, date(), ORDER BY ASC
- Edge cases: sub-ms averages, MAX_SAFE_INTEGER, year boundaries

All 157 stats-db tests now pass.
2025-12-29 06:19:31 -06:00
Pedram Amini
2c6ae11fd4 MAESTRO: Add comprehensive tests for time-range filtering verification
Added 26 tests to verify time-range filtering works correctly for all
StatsTimeRange values: 'day', 'week', 'month', 'year', and 'all'.

Tests cover:
- getQueryEvents: Verifies correct timestamp calculation for each range
- getAutoRunSessions: Validates time filtering for Auto Run sessions
- getAggregatedStats: Confirms all aggregation queries use correct ranges
- exportToCsv: Ensures CSV export respects time range filtering
- SQL structure: Verifies WHERE start_time >= ? clause is present
- Boundary behavior: Events exactly at boundary are included
- Combined filters: Time ranges work with other filters (agent, source, etc.)
- Consistency: Multiple calls with same range produce consistent results

All 121 tests pass (95 existing + 26 new).
2025-12-29 06:19:31 -06:00
Pedram Amini
4fec4a76c0 MAESTRO: Add comprehensive tests for foreign key relationship between tasks and sessions
Verifies the foreign key constraint from auto_run_tasks.auto_run_session_id
to auto_run_sessions.id is properly defined in the schema and enforced:

- Schema definition tests: REFERENCES clause, NOT NULL constraint, FK index
- Referential integrity: task insertion with parent session ID, retrieval
- Data consistency: consistent IDs across tasks, independent sessions
- Query filtering: WHERE clause on FK column, ORDER BY task_index

Total: 95 tests passing (83 existing + 12 new)
2025-12-29 06:19:31 -06:00
Pedram Amini
590241b07e MAESTRO: Add comprehensive tests for Auto Run session and task recording
- Added 22 new tests in "Auto Run sessions and tasks recorded correctly" suite
- Tests verify complete Auto Run lifecycle: start -> record tasks -> end
- Tests verify session recording with all required fields
- Tests verify individual task recording with timing and success/failure status
- Tests verify proper snake_case to camelCase field mapping
- Tests verify time range filtering for Auto Run sessions
- Tests cover edge cases: multiple documents, loop mode, partial completion,
  user-stopped sessions, failed tasks, zero duration, different agent types
- All 83 tests pass
2025-12-29 06:19:30 -06:00
Pedram Amini
7d6adef396 MAESTRO: Add comprehensive tests for interactive session query event recording
- Add 13 tests in "Query events recorded for interactive sessions" suite
- Tests verify user-initiated query events are recorded with all fields
- Tests verify optional fields (projectPath, tabId) stored as NULL when omitted
- Tests verify multiple queries per session get unique IDs
- Tests verify different agent types (claude-code, opencode, codex) recorded
- Tests verify retrieval with source, sessionId, projectPath filters
- Tests verify snake_case to camelCase mapping for QueryEvent interface
- Tests verify aggregation includes interactive sessions in bySource.user
- Tests verify timing accuracy for startTime and duration values
2025-12-29 06:19:30 -06:00
Pedram Amini
561aa57c86 MAESTRO: Add comprehensive tests for stats database file creation on first launch
Expanded stats-db.test.ts from 27 tests to 50 tests with:
- Database path computation verification using electron app.getPath('userData')
- Directory creation verification when userData directory doesn't exist
- All 3 table creation verification (query_events, auto_run_sessions, auto_run_tasks)
- All 7 index creation verification
- Singleton pattern tests (getStatsDB, initializeStatsDB, closeStatsDB)
- Auto Run session and task recording tests with success boolean conversion
- Aggregation and filtering tests for time ranges and combined filters
- CSV export tests
2025-12-29 06:19:30 -06:00
Pedram Amini
560c3ed34a MAESTRO: Instrument batch processor for Auto Run stats tracking
- Add stats tracking calls to useBatchProcessor.ts:
  - Call startAutoRun when batch begins with session info and task count
  - Call recordAutoTask for each completed task with timing data
  - Call endAutoRun when batch completes with total duration
- Add stats API type definition to global.d.ts for TypeScript support
- All stats calls wrapped in try/catch to avoid failing batch on stats errors
2025-12-29 06:19:30 -06:00
Pedram Amini
03131fbd5c MAESTRO: Instrument process manager for query stats tracking
- Add querySource, tabId, projectPath fields to ProcessConfig and ManagedProcess
- Emit query-complete event when batch mode processes exit with timing data
- Add query-complete listener in main process to record stats to database
- Broadcast stats:updated event for real-time dashboard refresh
- Source type ('user' vs 'auto') passed via spawn config from callers
2025-12-29 06:18:49 -06:00
Pedram Amini
c8eed00ebf MAESTRO: Add IPC integration for stats database API
- Create src/main/ipc/handlers/stats.ts with all stats IPC handlers
- Add window.maestro.stats API to preload.ts with full type definitions
- Register stats handlers in main index.ts
- Initialize stats database on app startup
- Close stats database on app shutdown
- Export registerStatsHandlers from handlers index

Stats API methods:
- recordQuery: Record interactive query events
- startAutoRun/endAutoRun: Track Auto Run sessions
- recordAutoTask: Track individual Auto Run tasks
- getStats: Query events with filtering
- getAutoRunSessions/getAutoRunTasks: Query Auto Run data
- getAggregation: Get dashboard statistics
- exportCsv: Export stats to CSV
- onStatsUpdate: Subscribe to real-time updates
2025-12-29 06:18:12 -06:00
Pedram Amini
beb04e5963 MAESTRO: Add SQLite stats database for tracking AI interactions
- Create StatsDB class with full database lifecycle management
- Implement schema with query_events, auto_run_sessions, auto_run_tasks tables
- Add version-based migration system (v1) with WAL mode
- Create shared TypeScript types (QueryEvent, AutoRunSession, AutoRunTask, etc.)
- Add singleton pattern with getStatsDB(), initializeStatsDB(), closeStatsDB()
- Implement aggregation queries and CSV export functionality
- Add comprehensive test suite with mocked better-sqlite3
2025-12-29 06:16:57 -06:00
Pedram Amini
14db065d11 MAESTRO: Add better-sqlite3 native database module
- Install better-sqlite3@^12.5.0 for SQLite database support
- Add @types/better-sqlite3@^7.6.13 for TypeScript definitions
- Configure electron-rebuild to build both node-pty and better-sqlite3
- Add better-sqlite3 to asarUnpack for proper Electron packaging
- Foundation for upcoming global stats tracking system
2025-12-29 06:16:57 -06:00
Pedram Amini
f7fd242969 ## CHANGES
- Added `fs.directorySize` IPC API returning size, files, folders stats 📦
- File Explorer now shows bottom status bar with counts and size 📊
- File tree refresh fetches tree and directory stats in parallel 
- Session state now stores `fileTreeStats` for richer explorer context 🧾
- AutoRun task progress highlights completed/total counts with accent styling 🎯
- History detail markdown now uses consistent terminal prose styling 📝
- History panel scroll handling throttled to 4ms for smoother scrolling 🧈
- Terminal output scroll throttling upgraded for ultra-smooth scrollbar feel 🏎️
- Scrollbar highlight logic now batched via RAF and passive listeners 🧵
- System prompt clarifies read-only/plan mode: include artifacts plus summary 🧠
2025-12-29 06:12:34 -06:00
Pedram Amini
6f2135619c fix: Dev mode now shares sessions and agent configs with production
- Agent configs (paths, env vars, custom args) use productionDataPath to share between dev/prod
- Sessions and settings use the appropriate data directory based on mode:
  - npm run dev: uses maestro-dev directory (isolated from production)
  - npm run dev:prod-data: uses production directory (shares everything)
- NewInstanceModal now properly loads customPath/Args/EnvVars from stored agent configs
- Chromium service worker storage uses separate dev directory to avoid lock conflicts
2025-12-29 05:58:34 -06:00
Pedram Amini
bde14dc6ef fix: Add missing Python 3.11 and build-essential for Linux x64 builds
Fixes #114 - Linux x64 native module compilation was failing because:
1. Python 3.11 setup was missing (node-gyp needs distutils, removed in 3.12+)
2. build-essential package was not installed
3. No post-package verification to catch failures

Changes:
- Add build-essential to Linux x64 dependencies
- Add Python 3.11 setup for Linux x64 (matching ARM64/macOS)
- Add post-install architecture verification for Linux x64
- Add post-package verification for Linux x64 unpacked resources

Both Linux architectures now have symmetric build verification steps.
2025-12-29 05:38:39 -06:00
Pedram Amini
72e5abbc73 ## CHANGES
- Added Playbook Exchange browsing screenshot to docs for instant clarity 🖼️
- Added Playbook Details view screenshot to guide imports and metadata 🔍
- Removed outdated refactor task docs to keep repo leaner 📉
- Upgraded `useScrollPosition` default throttle to 4ms for buttery scroll 
- Updated hook documentation to reflect new ~240fps scroll throttling 📘
- Added a documentation-focused test covering the new default throttle value 🧪
2025-12-28 21:10:06 -06:00
Pedram Amini
3bb5f64709 Merge pull request #109 from pedramamini/playbook-marketplace
feat: Add Playbook Marketplace for community-contributed playbooks
2025-12-28 20:54:00 -06:00
Pedram Amini
2d71ebf18f updated screenshots 2025-12-28 20:53:26 -06:00
Pedram Amini
a07a6dfba6 ## CHANGES
- Added Cmd/Ctrl+Shift+[ ] document cycling inside playbook detail view ⌨️
- Wrapped document navigation to loop seamlessly from end to start 🔁
- Refreshed detail header/footer backgrounds to use main theme surface 🎨
- Gave markdown preview its own themed background for cleaner reading 📖
- Improved “Read more…” styling with subtle active-state highlight 🖱️
- Updated search bar and input backgrounds for stronger contrast 🔍
- Standardized text inputs: removed transparent styling, added activity background 🧩
- Switched modal layout to fixed 80vh height for stable scrolling 📐
2025-12-28 20:51:31 -06:00
Pedram Amini
4ce94036fd added screenshots 2025-12-28 20:24:42 -06:00
Pedram Amini
600827c137 OAuth enabled but no valid token found. Starting authentication...
Found expired OAuth token, attempting refresh...
Token refresh successful
## CHANGES

- AboutModal now accepts `handsOnTimeMs` instead of full sessions array 🚀
- Tests updated to verify displayed accumulated hands-on time totals ⏱️
- Removed Session test fixtures, keeping AboutModal tests leaner 🧹
- Edge-case coverage now targets zero hands-on time input behavior 🧪
- Dropped undefined per-session active-time handling from test suite 🗑️
2025-12-28 20:20:35 -06:00
Pedram Amini
5c4eb2d55b ## CHANGES
- Rebranded Playbook Marketplace into Playbook Exchange across docs and UI 🔄
- Added dedicated IPC handlers to fetch and import Exchange playbooks ⚙️
- Wired Playbook Exchange launch action through App modals and Auto Run 🧩
- Introduced Playbook Exchange quick action for one-keystroke access ⌨️
- Added Exchange button directly inside Batch Runner for faster discovery 🧰
- Upgraded Exchange detail view with clickable document list and “Read more” 📚
- Improved markdown preview styling with themed prose and link handling 🖋️
- Added folder picker to import playbooks into chosen relative/absolute paths 📂
- Introduced in-modal help popover with submission link to community repo 🆘
2025-12-28 17:50:03 -06:00
Pedram Amini
a561176e65 fix: Remove Playbook Marketplace keyboard shortcut, restore Move Agent to Group 2025-12-28 14:21:10 -06:00
Pedram Amini
a7adeb7dd5 Merge pull request #113 from pedramamini/openspec-integration
fix: register OpenSpec IPC handlers in main process
2025-12-28 14:18:31 -06:00
Pedram Amini
2e599aa4c9 fix: Restore GistPublishModal component 2025-12-28 14:16:32 -06:00
Pedram Amini
53ae8f9532 docs: Add Playbook Marketplace documentation 2025-12-28 14:12:16 -06:00
Pedram Amini
b7d3ec1fd0 MAESTRO: Add Playbook Marketplace Phase 6 polish improvements
- Add PlaybookTileSkeleton component for loading states (replaces spinner with 6 skeleton tiles)
- Enhance empty state UI with larger icons, contextual messaging for search/error/empty cases
- Add ARIA accessibility improvements: aria-labelledby, aria-label, aria-busy attributes
- Add tooltip (title attribute) to truncated playbook titles for hover reveal
- Update formatCacheAge to return 'just now' for null/0 values
- Remove unused useMemo import to fix ESLint warning
2025-12-28 14:12:15 -06:00
Pedram Amini
f783517ad3 MAESTRO: Add keyboard shortcut for Playbook Marketplace (Cmd+Shift+M)
- Add openMarketplace shortcut definition in shortcuts.ts
- Register shortcut handler in useMainKeyboardHandler.ts (only active when Auto Run folder is set)
- Add setMarketplaceModalOpen to keyboard handler context in App.tsx
2025-12-28 14:12:15 -06:00
Pedram Amini
41f15b1790 MAESTRO: Add Playbook Marketplace Phase 5 - Import Logic & Auto Run Panel Integration
- Added marketplace button (LayoutGrid icon) to AutoRun.tsx top controls
- Added marketplace button to AutoRunExpandedModal.tsx header
- Added onOpenMarketplace prop to AutoRun and AutoRunExpandedModal components
- Updated RightPanel.tsx to pass onOpenMarketplace through autoRunSharedProps
- Added marketplaceModalOpen state to ModalContext
- Wired up MarketplaceModal in App.tsx with handlers for opening and import completion
- Import completion handler refreshes Auto Run document list and shows success toast
2025-12-28 14:12:15 -06:00
Pedram Amini
e3fe6b0161 MAESTRO: Add PlaybookDetailView component for Playbook Marketplace Phase 4
Implement the detail view shown when a user selects a playbook tile:

- Add detail view state management (selectedPlaybook, showDetailView, etc.)
- Create PlaybookDetailView component with:
  - Header with back button and playbook title/category
  - Left metadata sidebar (description, author link, tags, documents, settings)
  - Document dropdown selector (matching AutoRunDocumentSelector pattern)
  - Markdown preview area with GitHub-flavored markdown support
  - Import footer with editable folder name and import button
- Implement document fetching via fetchReadme and fetchDocument
- Add handleImport callback for playbook import functionality
- Update escape key handling (returns to list view first, then closes modal)

All 57 Marketplace-related tests pass.
2025-12-28 14:11:40 -06:00
Pedram Amini
f723f20d3e MAESTRO: Add MarketplaceModal component for Playbook Marketplace Phase 3
- Create MarketplaceModal.tsx with full modal structure using createPortal
- Implement category tabs with Cmd+Shift+[/] keyboard navigation
- Add search bar filtering by title, description, and tags
- Create responsive 3-column playbook tiles grid
- Implement arrow key navigation for tile selection with Enter to select
- Add PlaybookTile sub-component with category badge, title, description
- Include loading spinner, error state with retry, and empty states
- Add footer with keyboard shortcut hints
- Register with layer stack for proper escape handling (MARKETPLACE: 708)
- All 12,146 tests pass
2025-12-28 14:11:39 -06:00
Pedram Amini
af4962e8e4 MAESTRO: Add useMarketplace React hook for Playbook Marketplace Phase 2
Implements the React hook for managing marketplace state:
- Initial manifest loading on mount with cache info
- Category extraction from playbooks (sorted, with 'All' option)
- Search filtering by title, description, and tags (case-insensitive)
- Refresh function to bypass cache
- Import playbook function with loading state
- Document fetching (README and individual documents)

Also adds:
- Marketplace mock to test setup for global test support
- Comprehensive test suite with 37 tests covering all functionality
2025-12-28 14:11:39 -06:00
Pedram Amini
ca89475492 MAESTRO: Add validation tests for Playbook Marketplace IPC handlers
- Created comprehensive test suite with 20 tests covering:
  - Cache creation after first fetch
  - Cache TTL validation (6-hour expiration)
  - Force refresh bypassing cache
  - Document and README fetching from GitHub
  - Import with correct folder structure
  - Null prompt fallback to empty string
  - Error handling for network errors and 404s
2025-12-28 14:11:39 -06:00
Pedram Amini
e454132882 MAESTRO: Add Playbook Marketplace Phase 1 - Types, IPC & Cache
Implements the foundation for the Playbook Marketplace feature:

Types (src/shared/marketplace-types.ts):
- MarketplaceManifest, MarketplacePlaybook, MarketplaceDocument types
- MarketplaceCache for local caching with TTL
- Custom error types: MarketplaceFetchError, MarketplaceCacheError, MarketplaceImportError
- Re-exported from src/shared/types.ts

IPC Handlers (src/main/ipc/handlers/marketplace.ts):
- marketplace:getManifest - Fetch with 6-hour cache TTL
- marketplace:refreshManifest - Force refresh bypassing cache
- marketplace:getDocument - Fetch individual document content
- marketplace:getReadme - Fetch playbook README
- marketplace:importPlaybook - Import playbook to local Auto Run folder

Preload Bridge:
- Added marketplace API to src/main/preload.ts
- Added TypeScript types to src/renderer/global.d.ts

Bug Fix:
- Fixed batch processor to use default Auto Run prompt when playbook.prompt
  is empty/null (marketplace playbooks use prompt: null to indicate default)
2025-12-28 14:11:39 -06:00
Pedram Amini
bdceee76d0 ## CHANGES
- Added framed screenshot to AI Commands docs for quicker navigation 🖼️
2025-12-28 14:08:52 -06:00
Pedram Amini
7c932f083a fix: register OpenSpec IPC handlers in main process
The OpenSpec handlers were defined but never registered - added the
missing import and registerOpenSpecHandlers() call in index.ts.
2025-12-28 13:31:26 -06:00
Pedram Amini
1967dea870 fix: register OpenSpec IPC handlers in main process
The OpenSpec handlers were defined but never registered - added the
missing import and registerOpenSpecHandlers() call in index.ts.
2025-12-28 13:30:57 -06:00
Pedram Amini
000f18e6ab ## CHANGES
- Agent configs now always persist in production userData path 🔒
- Dev/demo sessions no longer overwrite machine-level agent configuration 🧩
- Quick Actions “Edit Agent” now displays its keyboard shortcut hint ⌨️
- Alt-based shortcuts now correctly recognize punctuation keys across layouts 🗝️
- OpenSpec commands docs updated with the new pull-request icon 🗂️
- Troubleshooting docs refreshed with a clearer support icon choice 🛟
2025-12-28 13:05:42 -06:00
Pedram Amini
617bf91033 version bump 2025-12-28 12:56:46 -06:00
Pedram Amini
aa1ae5a2fc added doc MCP server information 2025-12-28 12:56:46 -06:00
Pedram Amini
92b3cc73e7 added doc MCP server information 2025-12-28 12:56:46 -06:00
Pedram Amini
616d7c8ed2 Merge pull request #108 from pedramamini/openspec-integration
feat(openspec): integrate OpenSpec spec-driven development commands
2025-12-28 12:51:55 -06:00