Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-mcp-install-remove-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@prosdevlab/dev-agent": patch
---

Fix `dev mcp install` failing with "Repository not indexed" after successful indexing. Remove dead metrics module and better-sqlite3 dependency (-36 packages, -2400 lines).
32 changes: 6 additions & 26 deletions packages/cli/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { join, resolve } from 'node:path';
import { resolve } from 'node:path';
import {
AsyncEventBus,
ensureStorageDirectory,
getStorageFilePaths,
getStoragePath,
type IndexUpdatedEvent,
MetricsStore,
RepositoryIndexer,
updateIndexedStats,
} from '@prosdevlab/dev-agent-core';
Expand Down Expand Up @@ -72,29 +69,13 @@ export const indexCommand = new Command('index')
await ensureStorageDirectory(storagePath);
const filePaths = getStorageFilePaths(storagePath);

// Create event bus for metrics
const eventBus = new AsyncEventBus();
const metricsDbPath = join(storagePath, 'metrics.db');
const metricsStore = new MetricsStore(metricsDbPath);

eventBus.on<IndexUpdatedEvent>('index.updated', async (event) => {
try {
metricsStore.recordSnapshot(event.stats, event.isIncremental ? 'update' : 'index');
} catch {
// Metrics are non-critical — don't fail indexing
}
const indexer = new RepositoryIndexer({
repositoryPath: resolvedRepoPath,
vectorStorePath: filePaths.vectors,
excludePatterns: config.repository?.excludePatterns || config.excludePatterns,
languages: config.repository?.languages || config.languages,
});

const indexer = new RepositoryIndexer(
{
repositoryPath: resolvedRepoPath,
vectorStorePath: filePaths.vectors,
excludePatterns: config.repository?.excludePatterns || config.excludePatterns,
languages: config.repository?.languages || config.languages,
},
eventBus
);

await indexer.initialize();

const indexLogger = createIndexLogger(options.verbose);
Expand Down Expand Up @@ -149,7 +130,6 @@ export const indexCommand = new Command('index')

// Finalize
await indexer.close();
metricsStore.close();

await updateIndexedStats(storagePath, {
files: stats.filesScanned,
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/src/commands/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ Available Tools (6):
try {
// Check if repository is indexed
const storagePath = await getStoragePath(repositoryPath);
const { vectors, watcherSnapshot } = getStorageFilePaths(storagePath);
const { vectors, metadata, watcherSnapshot } = getStorageFilePaths(storagePath);

const vectorsExist = await fs
.access(vectors)
const isIndexed = await fs
.access(metadata)
.then(() => true)
.catch(() => false);
if (!vectorsExist) {
if (!isIndexed) {
logger.error(`Repository not indexed. Run: ${chalk.yellow('dev index')}`);
process.exit(1);
}
Expand Down Expand Up @@ -205,15 +205,15 @@ Available Tools (6):
const spinner = ora(`Installing dev-agent MCP server in ${targetIDE}...`).start();

try {
// Check if repository is indexed
// Check if repository is indexed (metadata.json is written at index time)
const storagePath = await getStoragePath(repositoryPath);
const { vectors } = getStorageFilePaths(storagePath);
const { metadata } = getStorageFilePaths(storagePath);

const vectorsExist = await fs
.access(vectors)
const isIndexed = await fs
.access(metadata)
.then(() => true)
.catch(() => false);
if (!vectorsExist) {
if (!isIndexed) {
spinner.fail(`Repository not indexed. Run: ${chalk.yellow('dev index')}`);
process.exit(1);
}
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/commands/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,9 @@ Storage Location:
Each repository gets its own subdirectory based on path hash

What's Stored:
• vectors.lance/ Vector embeddings for semantic search
• indexer-state.json Repository indexing state
• github-state.json GitHub issues/PRs state
• metadata.json Repository metadata
• metrics.db Historical metrics (SQLite)

Vector data is stored in Antfly (local search backend).
`
);

Expand Down
2 changes: 0 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"test:watch": "vitest"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.13",
"@types/mdast": "^4.0.4",
"@types/node": "^24.10.1",
"tree-sitter-wasms": "^0.1.13",
Expand All @@ -40,7 +39,6 @@
"@antfly/sdk": "0.0.14",
"@prosdevlab/dev-agent-types": "workspace:*",
"@prosdevlab/kero": "workspace:*",
"better-sqlite3": "^12.5.0",
"globby": "^16.0.0",
"remark": "^15.0.1",
"remark-parse": "^11.0.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/events/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import type { DetailedIndexStats } from '../indexer/types.js';
import type { CodeMetadata } from '../metrics/types.js';

/**
* Event handler function type
Expand Down Expand Up @@ -148,8 +147,6 @@ export interface IndexUpdatedEvent {
stats: DetailedIndexStats;
/** Whether this was an incremental update (vs full index) */
isIncremental?: boolean;
/** Per-file code metadata for metrics storage */
codeMetadata?: CodeMetadata[];
}

export interface IndexErrorEvent {
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export * from './context';
export * from './events';
export * from './indexer';
export * from './map';
export * from './metrics';
export * from './observability';
export * from './scanner';
export * from './services';
Expand Down
Loading
Loading