From a91cc1e3360d0bce1174b10fb2d2eaa511904d8f Mon Sep 17 00:00:00 2001 From: lb1192176991-lab Date: Sat, 30 May 2026 13:38:14 +0800 Subject: [PATCH] feat: add --verbose flag to suggest command Adds -v/--verbose flag to 'commit-echo suggest' that prints: - Model name and provider - Diff size (or truncation details) - Style profile summary (avg length, imperative mood rate) - Number of commits analyzed --- src/commands/suggest.ts | 17 ++++++++++++++++- src/index.ts | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/commands/suggest.ts b/src/commands/suggest.ts index 769a05a..ec8ddcb 100644 --- a/src/commands/suggest.ts +++ b/src/commands/suggest.ts @@ -24,7 +24,7 @@ async function displaySuggestions(suggestions: Suggestion[]): Promise { } } -export async function suggestCommand(options: { commit?: boolean; autoCommit?: boolean } = {}): Promise { +export async function suggestCommand(options: { commit?: boolean; autoCommit?: boolean; verbose?: boolean } = {}): Promise { intro(pc.bold(pc.cyan('commit-echo'))); try { @@ -42,6 +42,11 @@ export async function suggestCommand(options: { commit?: boolean; autoCommit?: b return; } + if (options.verbose) { + console.log(pc.dim(` Model: ${config.model}`)); + console.log(pc.dim(` Provider: ${config.provider}`)); + } + let diffResult = getStagedDiff(); if (!diffResult.hasChanges) { @@ -58,6 +63,14 @@ export async function suggestCommand(options: { commit?: boolean; autoCommit?: b console.log(pc.dim(profileStr) + '\n'); } + if (options.verbose && profile.totalCommits > 0) { + console.log(pc.dim(` Style profile: ${profile.totalCommits} commits analyzed`)); + console.log(pc.dim(` Avg length: ${profile.avgLength} chars`)); + if (profile.imperativeRate !== undefined) { + console.log(pc.dim(` Imperative mood rate: ${(profile.imperativeRate * 100).toFixed(0)}%`)); + } + } + const genSpinner = spinner(); genSpinner.start('Generating commit suggestions...'); @@ -67,6 +80,8 @@ export async function suggestCommand(options: { commit?: boolean; autoCommit?: b if (truncation) { showTruncationWarning(truncation); + } else if (options.verbose) { + console.log(pc.dim(` Diff size: ${diffResult.diff.length} chars (no truncation needed)`)); } await displaySuggestions(suggestions); diff --git a/src/index.ts b/src/index.ts index 72c804d..52c274a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -50,8 +50,9 @@ program .option('--commit', 'Commit the selected suggestion', false) .option('-y, --yes', 'Automatically select the first suggestion and skip prompts') .option('--auto', 'Alias for --yes') + .option('-v, --verbose', 'Show verbose diagnostic info') .action(async (options) => { - await suggestCommand({ commit: options.commit, autoCommit: Boolean(options.yes || options.auto) }); + await suggestCommand({ commit: options.commit, autoCommit: Boolean(options.yes || options.auto), verbose: Boolean(options.verbose) }); }); program