Skip to content

Commit f32a6ac

Browse files
committed
feat: clean output by default, --verbose for detailed logs
Default: shows 'Thinking...' and 'Searching codebase...' summary only. --verbose: shows full planning, tool calls, verifier, critic logs. --quiet: suppresses everything.
1 parent 06e1de9 commit f32a6ac

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/commands/ask.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface AskOptions extends CliOverrides {
4343
json?: boolean;
4444
noColor?: boolean;
4545
quiet?: boolean;
46+
verbose?: boolean;
4647
system?: string;
4748
/** Enable read-only tool use so the model can discover and read files.
4849
* Defaults to true when stdout is a TTY and the provider supports chatWithTools. */
@@ -140,7 +141,17 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
140141
}
141142

142143
// Quiet mode: suppress all non-essential stderr output
143-
const stderrLog = options.quiet ? (_msg: string) => {} : (msg: string) => process.stderr.write(msg);
144+
// Logging: --quiet suppresses all, --verbose shows everything, default shows summary
145+
const verbose = options.verbose ?? false;
146+
const stderrLog = options.quiet
147+
? (_msg: string) => {}
148+
: verbose
149+
? (msg: string) => process.stderr.write(msg)
150+
: (_msg: string) => {};
151+
// Summary log: shown by default (unless --quiet), for key status updates only
152+
const summaryLog = options.quiet
153+
? (_msg: string) => {}
154+
: (msg: string) => process.stderr.write(msg);
144155

145156
// Load config with CLI overrides
146157
const cliOverrides: CliOverrides = {
@@ -207,6 +218,7 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
207218
} catch { /* non-fatal */ }
208219

209220
// ── Planning phase: structured plan first, text plan fallback ────────
221+
summaryLog(formatInternalStatus('Thinking…', noColor) + '\n');
210222
stderrLog(formatSeparator('Planning', noColor));
211223
const projectCtxForPlan = [jamContext ?? workspaceCtx, symbolHint, pastContext].filter(Boolean).join('\n\n');
212224

@@ -251,6 +263,7 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
251263
let synthesisInjected = false;
252264

253265
if (!skipToolLoop) {
266+
summaryLog(formatInternalStatus('Searching codebase…', noColor) + '\n');
254267
stderrLog(formatSeparator('Searching codebase', noColor));
255268
}
256269

@@ -318,7 +331,7 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
318331
stderrLog(formatInternalStatus('Evaluating answer quality…', noColor) + '\n');
319332
const verdict = await criticEvaluate(adapter, prompt, finalText, { model: profile.model });
320333
if (verdict.pass) {
321-
stderrLog(formatSeparator('Answer', noColor));
334+
summaryLog('\n');
322335
await renderFinalAnswer(finalText, response.usage, options, profile, noColor, stderrLog);
323336
const log = memory.getAccessLog();
324337
updateContextWithUsage(workspaceRoot, log.readFiles, log.searchQueries).catch(() => {});
@@ -356,7 +369,7 @@ export async function runAsk(inlinePrompt: string | undefined, options: AskOptio
356369
}
357370
}
358371

359-
stderrLog(formatSeparator('Answer', noColor));
372+
summaryLog('\n');
360373
await renderFinalAnswer(finalText, response.usage, options, profile, noColor, stderrLog);
361374
const log = memory.getAccessLog();
362375
updateContextWithUsage(workspaceRoot, log.readFiles, log.searchQueries).catch(() => {});

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ program
5656
.option('--json', 'output response as JSON')
5757
.option('--system <prompt>', 'override the system prompt')
5858
.option('--no-tools', 'disable read-only tool use (file discovery off)')
59+
.option('-v, --verbose', 'show detailed planning and search logs')
5960
.action(async (prompt: string | undefined, cmdOpts: Record<string, unknown>) => {
6061
const g = globalOpts();
6162
const { runAsk } = await import('./commands/ask.js');
@@ -66,6 +67,7 @@ program
6667
baseUrl: g.baseUrl,
6768
noColor: g.color === false,
6869
quiet: g.quiet,
70+
verbose: cmdOpts['verbose'] as boolean | undefined,
6971
file: cmdOpts['file'] as string | undefined,
7072
json: cmdOpts['json'] as boolean | undefined,
7173
system: cmdOpts['system'] as string | undefined,

0 commit comments

Comments
 (0)