Commit ec6448f
committed
feat(cli): integrate MetricsStore with automatic persistence
Phase 1 Complete! Foundation + Event Bus
CLI Integration:
- Wired up MetricsStore in dev index and dev update commands
- Created event bus for each command invocation
- Subscribed MetricsStore to index.updated events
- Automatic snapshot recording on every index/update
- Proper error logging (non-blocking, metrics are non-critical)
- Proper cleanup (close() on completion)
Metrics Database:
- Stored in ~/.dev-agent/indexes/<repo>/metrics.db
- SQLite with WAL mode for concurrency
- Automatic persistence via event-driven architecture
Phase 1 Deliverables (ALL COMPLETE):
✅ better-sqlite3 dependency added
✅ MetricsStore class with CRUD operations
✅ SQLite schema with indexes and WAL mode
✅ Comprehensive tests (25 tests, all passing)
✅ Event bus integration in RepositoryIndexer
✅ CLI commands automatically record metrics
✅ Fire-and-forget pattern for non-blocking persistence
✅ Proper error handling with logging
Next: Phase 2 - code_metadata table and hotspot detection1 parent fe0ab5f commit ec6448f
2 files changed
+68
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
127 | 140 | | |
128 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
129 | 155 | | |
130 | 156 | | |
131 | 157 | | |
| |||
165 | 191 | | |
166 | 192 | | |
167 | 193 | | |
| 194 | + | |
168 | 195 | | |
169 | 196 | | |
170 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
47 | 62 | | |
48 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
49 | 75 | | |
50 | 76 | | |
51 | 77 | | |
| |||
66 | 92 | | |
67 | 93 | | |
68 | 94 | | |
| 95 | + | |
69 | 96 | | |
70 | 97 | | |
71 | 98 | | |
| |||
0 commit comments