Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/cli/commands/search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { collectFile } from '../../db/query-builder.js';
import { search } from '../../domain/search/index.js';
import { search } from '../../presentation/search.js';
import type { CommandDefinition } from '../types.js';

export const command: CommandDefinition = {
Expand Down
8 changes: 4 additions & 4 deletions src/domain/search/generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';
import { closeDb, findDbPath, getBuildMeta, openDb } from '../../db/index.js';
import { warn } from '../../infrastructure/logger.js';
import { info, warn } from '../../infrastructure/logger.js';
import { DbError } from '../../shared/errors.js';
import type { BetterSqlite3Database, NodeRow } from '../../types.js';
import { embed, getModelConfig } from './models.js';
Expand Down Expand Up @@ -242,7 +242,7 @@ export async function buildEmbeddings(
const byFile = loadNodesByFile(db);

const nodeCount = [...byFile.values()].reduce((acc, list) => acc + list.length, 0);
console.log(`Building embeddings for ${nodeCount} symbols (strategy: ${strategy})...`);
info(`Building embeddings for ${nodeCount} symbols (strategy: ${strategy})...`);

let contextWindow: number;
let displayName: string;
Expand Down Expand Up @@ -275,7 +275,7 @@ export async function buildEmbeddings(
);
}

console.log(
info(
`Embedding ${prepared.texts.length} symbols${options.remote ? ` via remote provider (${displayName})` : ''}...`,
);
const { vectors, dim } = options.remote
Expand All @@ -289,7 +289,7 @@ export async function buildEmbeddings(
const provider = options.remote ? 'openai' : null;
persistEmbeddings(db, prepared, vectors as Float32Array[], dim, displayName, strategy, provider);

console.log(
info(
`\nStored ${vectors.length} embeddings (${dim}d, ${displayName}, strategy: ${strategy}) in graph.db`,
);
Comment on lines +292 to 294

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The leading that separated this final progress line from the previous output was dropped during the migration. The original console.log(' Stored ...') printed a blank line before the message; the new info(...) call omits it, so the three embed-progress lines now run together visually without the spacing the old output had.

Suggested change
info(
`Stored ${vectors.length} embeddings (${dim}d, ${displayName}, strategy: ${strategy}) in graph.db`,
);
info(
`\nStored ${vectors.length} embeddings (${dim}d, ${displayName}, strategy: ${strategy}) in graph.db`,
);

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — restored the leading \n in the embed completion message.

closeDb(db);
Expand Down
1 change: 0 additions & 1 deletion src/domain/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type { ModelConfig } from './models.js';
export { DEFAULT_MODEL, disposeModel, EMBEDDING_STRATEGIES, embed, MODELS } from './models.js';
export type { RemoteEmbeddingOptions } from './providers/remote.js';
export { embedRemote, resolveRemoteEmbeddingOptions } from './providers/remote.js';
export { search } from './search/cli-formatter.js';
export { hybridSearchData } from './search/hybrid.js';
export { ftsSearchData } from './search/keyword.js';
export { multiSearchData, searchData } from './search/semantic.js';
Expand Down
6 changes: 3 additions & 3 deletions src/domain/search/search/semantic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ function rowVector(row: StoredRow): Float32Array {
/** Warn when stored embeddings and the query model use different dimensions. */
function checkDimensionMismatch(storedDim: number | null, dim: number): boolean {
if (storedDim && dim !== storedDim) {
console.log(
`Warning: query model dimension (${dim}) doesn't match stored embeddings (${storedDim}).`,
warn(
`Query model dimension (${dim}) doesn't match stored embeddings (${storedDim}). ` +
'Re-run `codegraph embed` with the same model, or use --model to match.',
);
console.log(` Re-run \`codegraph embed\` with the same model, or use --model to match.`);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { warn } from '../../../infrastructure/logger.js';
import { hybridSearchData } from './hybrid.js';
import { ftsSearchData } from './keyword.js';
import type { SemanticSearchOpts } from './semantic.js';
import { multiSearchData, searchData } from './semantic.js';
import { hybridSearchData } from '../domain/search/search/hybrid.js';
import { ftsSearchData } from '../domain/search/search/keyword.js';
import type { SemanticSearchOpts } from '../domain/search/search/semantic.js';
import { multiSearchData, searchData } from '../domain/search/search/semantic.js';
import { warn } from '../infrastructure/logger.js';

interface SearchOpts extends SemanticSearchOpts {
mode?: 'hybrid' | 'semantic' | 'keyword';
Expand Down
2 changes: 1 addition & 1 deletion tests/search/embedder-search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import {
ftsSearchData,
hybridSearchData,
multiSearchData,
search,
searchData,
} from '../../src/domain/search/index.js';
import { search } from '../../src/presentation/search.js';

// ─── Helpers ───────────────────────────────────────────────────────────

Expand Down
Loading