Skip to content

Commit 1122431

Browse files
committed
feat(cli): add stats compare and export subcommands
- Restructure stats command to support subcommands: - 'dev stats' or 'dev stats show' - Show current stats (default) - 'dev stats compare <before> <after>' - Compare two stat snapshots - 'dev stats export [--format json|csv|markdown]' - Export stats Features: - Compare shows overall changes, trend analysis, and per-language/component diffs - Export supports JSON, CSV, and Markdown table formats - Rich visual comparison with color-coded changes and percentages - Helper function for human-readable duration formatting Benefits: - Users can track codebase evolution over time - Dashboard-ready data export for visualization - Clean CLI UX with consistent formatting - Maintains backward compatibility (stats show is default) All 736 tests passing (including updated CLI structure tests).
1 parent 63a2d36 commit 1122431

2 files changed

Lines changed: 317 additions & 68 deletions

File tree

packages/cli/src/cli.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,16 @@ describe('CLI Structure', () => {
5858
expect(jsonOption).toBeDefined();
5959
});
6060

61-
it('stats command should have json option', () => {
62-
const options = statsCommand.options;
63-
const jsonOption = options.find((opt) => opt.long === '--json');
61+
it('stats command should have show subcommand with json option', () => {
62+
const subcommands = statsCommand.commands;
63+
const showCommand = subcommands.find((cmd) => cmd.name() === 'show');
6464

65-
expect(jsonOption).toBeDefined();
65+
expect(showCommand).toBeDefined();
66+
67+
if (showCommand) {
68+
const jsonOption = showCommand.options.find((opt) => opt.long === '--json');
69+
expect(jsonOption).toBeDefined();
70+
}
6671
});
6772

6873
it('clean command should have force option', () => {

0 commit comments

Comments
 (0)