|
1 | | -import { join, resolve } from 'node:path'; |
| 1 | +import { resolve } from 'node:path'; |
2 | 2 | import { |
3 | | - AsyncEventBus, |
4 | 3 | ensureStorageDirectory, |
5 | 4 | getStorageFilePaths, |
6 | 5 | getStoragePath, |
7 | | - type IndexUpdatedEvent, |
8 | | - MetricsStore, |
9 | 6 | RepositoryIndexer, |
10 | 7 | updateIndexedStats, |
11 | 8 | } from '@prosdevlab/dev-agent-core'; |
@@ -72,29 +69,13 @@ export const indexCommand = new Command('index') |
72 | 69 | await ensureStorageDirectory(storagePath); |
73 | 70 | const filePaths = getStorageFilePaths(storagePath); |
74 | 71 |
|
75 | | - // Create event bus for metrics |
76 | | - const eventBus = new AsyncEventBus(); |
77 | | - const metricsDbPath = join(storagePath, 'metrics.db'); |
78 | | - const metricsStore = new MetricsStore(metricsDbPath); |
79 | | - |
80 | | - eventBus.on<IndexUpdatedEvent>('index.updated', async (event) => { |
81 | | - try { |
82 | | - metricsStore.recordSnapshot(event.stats, event.isIncremental ? 'update' : 'index'); |
83 | | - } catch { |
84 | | - // Metrics are non-critical — don't fail indexing |
85 | | - } |
| 72 | + const indexer = new RepositoryIndexer({ |
| 73 | + repositoryPath: resolvedRepoPath, |
| 74 | + vectorStorePath: filePaths.vectors, |
| 75 | + excludePatterns: config.repository?.excludePatterns || config.excludePatterns, |
| 76 | + languages: config.repository?.languages || config.languages, |
86 | 77 | }); |
87 | 78 |
|
88 | | - const indexer = new RepositoryIndexer( |
89 | | - { |
90 | | - repositoryPath: resolvedRepoPath, |
91 | | - vectorStorePath: filePaths.vectors, |
92 | | - excludePatterns: config.repository?.excludePatterns || config.excludePatterns, |
93 | | - languages: config.repository?.languages || config.languages, |
94 | | - }, |
95 | | - eventBus |
96 | | - ); |
97 | | - |
98 | 79 | await indexer.initialize(); |
99 | 80 |
|
100 | 81 | const indexLogger = createIndexLogger(options.verbose); |
@@ -149,7 +130,6 @@ export const indexCommand = new Command('index') |
149 | 130 |
|
150 | 131 | // Finalize |
151 | 132 | await indexer.close(); |
152 | | - metricsStore.close(); |
153 | 133 |
|
154 | 134 | await updateIndexedStats(storagePath, { |
155 | 135 | files: stats.filesScanned, |
|
0 commit comments