Skip to content

Commit cb33f41

Browse files
committed
feat(cli): enhance git stats output with clean UX
- Remove logger timestamps from git stats command - Add clean summary with commit count and storage info - Consistent styling with other enhanced commands Affects: temp/cli-output-improvements-plan.md (Phase 5 complete)
1 parent 66599f4 commit cb33f41

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

packages/cli/src/commands/git.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import { createLogger } from '@lytics/kero';
1414
import chalk from 'chalk';
1515
import { Command } from 'commander';
1616
import ora from 'ora';
17+
import { loadConfig } from '../utils/config.js';
1718
import { keroLogger, logger } from '../utils/logger.js';
19+
import { output, printGitStats } from '../utils/output.js';
1820

1921
/**
2022
* Create Git indexer with centralized storage
@@ -179,18 +181,20 @@ export const gitCommand = new Command('git')
179181
spinner.stop();
180182

181183
if (totalCommits === 0) {
182-
logger.log('');
183-
logger.log(chalk.yellow('Git history not indexed'));
184-
logger.log('Run "dev git index" to index commits');
184+
output.log();
185+
output.log(chalk.yellow('Git history not indexed'));
186+
output.log();
187+
output.log(`Run ${chalk.cyan('dev git index')} to index commits`);
188+
output.log();
185189
await vectorStore.close();
186190
return;
187191
}
188192

189-
logger.log('');
190-
logger.log(chalk.bold.cyan('Git History Stats'));
191-
logger.log('');
192-
logger.log(`Total Commits Indexed: ${chalk.yellow(totalCommits)}`);
193-
logger.log('');
193+
// Print clean stats output
194+
printGitStats({
195+
totalCommits,
196+
// Date range would require additional query - defer for now
197+
});
194198

195199
await vectorStore.close();
196200
} catch (error) {

packages/cli/src/utils/output.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,42 @@ export function printCleanSuccess(data: { totalSize: number }): void {
861861
output.log();
862862
}
863863

864+
/**
865+
* Print git history statistics
866+
*/
867+
export function printGitStats(data: {
868+
totalCommits: number;
869+
dateRange?: {
870+
oldest: string;
871+
newest: string;
872+
};
873+
}): void {
874+
const { totalCommits, dateRange } = data;
875+
876+
output.log();
877+
output.log(chalk.bold(`Git History • ${formatNumber(totalCommits)} commits indexed`));
878+
879+
if (dateRange) {
880+
const oldest = new Date(dateRange.oldest);
881+
const newest = new Date(dateRange.newest);
882+
const span = newest.getTime() - oldest.getTime();
883+
const days = Math.floor(span / (1000 * 60 * 60 * 24));
884+
const years = (days / 365).toFixed(1);
885+
886+
output.log();
887+
output.log(`Date Range: ${oldest.toLocaleDateString()} to ${newest.toLocaleDateString()}`);
888+
output.log(`Duration: ${years} years (${formatNumber(days)} days)`);
889+
}
890+
891+
output.log();
892+
output.log(`Storage: ${chalk.gray('~/.dev-agent/indexes/.../git-commits/')}`);
893+
output.log();
894+
output.log(chalk.green('✓ Git history indexed and ready for semantic search'));
895+
output.log();
896+
output.log(`Run ${chalk.cyan('dev git search "<query>"')} to search commit history`);
897+
output.log();
898+
}
899+
864900
/**
865901
* Print GitHub indexing statistics (gh CLI inspired)
866902
*/

0 commit comments

Comments
 (0)