Skip to content

Commit 77ec512

Browse files
committed
fix: forward --reason flag to performIndexing in reindex command
1 parent 344a645 commit 77ec512

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/cli.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ async function initToolContext(): Promise<ToolContext> {
107107
status: indexExists ? 'ready' : 'idle'
108108
};
109109

110-
const performIndexing = async (incrementalOnly?: boolean): Promise<void> => {
110+
const performIndexing = async (incrementalOnly?: boolean, reason?: string): Promise<void> => {
111111
indexState.status = 'indexing';
112112
const mode = incrementalOnly ? 'incremental' : 'full';
113-
console.error(`Indexing (${mode}): ${rootPath}`);
113+
console.error(`Indexing (${mode})${reason ? ` — ${reason}` : ''}: ${rootPath}`);
114114

115115
try {
116116
let lastLoggedProgress = { phase: '', percentage: -1 };
@@ -324,9 +324,9 @@ export async function handleCliCommand(argv: string[]): Promise<void> {
324324
}
325325
case 'reindex': {
326326
const usage = 'codebase-context reindex [--incremental] [--reason <r>]';
327-
optionalStringFlag(flags, 'reason', usage);
327+
const reason = optionalStringFlag(flags, 'reason', usage);
328328
const incremental = booleanFlag(flags, 'incremental', usage);
329-
await ctx.performIndexing(incremental);
329+
await ctx.performIndexing(incremental, reason);
330330
const statusResult = await dispatchTool('get_indexing_status', {}, ctx);
331331
formatJson(extractText(statusResult), useJson);
332332
return;

src/tools/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface ToolContext {
3737
indexState: IndexState;
3838
paths: ToolPaths;
3939
rootPath: string;
40-
performIndexing: (incrementalOnly?: boolean) => void;
40+
performIndexing: (incrementalOnly?: boolean, reason?: string) => void;
4141
}
4242

4343
export interface ToolResponse {

0 commit comments

Comments
 (0)