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
17 changes: 16 additions & 1 deletion src/commands/suggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function displaySuggestions(suggestions: Suggestion[]): Promise<void> {
}
}

export async function suggestCommand(options: { commit?: boolean; autoCommit?: boolean } = {}): Promise<void> {
export async function suggestCommand(options: { commit?: boolean; autoCommit?: boolean; verbose?: boolean } = {}): Promise<void> {
intro(pc.bold(pc.cyan('commit-echo')));

try {
Expand All @@ -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) {
Expand All @@ -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...');

Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down