Skip to content

feat: add --verbose flag to commit-echo suggest#74

Open
lb1192176991-lab wants to merge 1 commit into
404-PF:mainfrom
lb1192176991-lab:feat/verbose-flag
Open

feat: add --verbose flag to commit-echo suggest#74
lb1192176991-lab wants to merge 1 commit into
404-PF:mainfrom
lb1192176991-lab:feat/verbose-flag

Conversation

@lb1192176991-lab
Copy link
Copy Markdown
Contributor

What

Added -v / --verbose flag to the commit-echo suggest command that prints extra diagnostic information.

Why

Makes it easier to debug and understand what the tool is doing under the hood — which model/provider is being used, whether the diff was truncated, and the style profile statistics.

Verbose output includes

  • Model name and provider
  • Diff size in chars (or truncation details if applicable)
  • Style profile: number of commits analyzed, average length, imperative mood rate
  • All output uses pc.dim() for less prominent styling

Testing

  • commit-echo suggest -v works as alias for --verbose
  • Without --verbose, output is unchanged (no breaking change)
  • npm run build passes

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
Copy link
Copy Markdown
Contributor

@404-Page-Found 404-Page-Found left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: feat: add --verbose flag to commit-echo suggest (#74)

Verdict: Request Changes 🟡

The PR adds a useful -v/--verbose flag and is generally well-structured. However, there are a few issues that should be addressed before merging.


What the PR does well

  1. Focused scope — Single feature, clean 20-line delta.
  2. Good naming-v/--verbose follows CLI conventions.
  3. Consistent styling — Uses pc.dim() for verbose output, same pattern as existing profile display.
  4. Edge cases handled:
    • Profile stats only shown when profile.totalCommits > 0 (no crash on empty history)
    • Diff size only shown when no truncation occurred (else if ensures mutual exclusion)
    • Flag is properly converted to boolean with Boolean(options.verbose) preventing Commander's default string behavior
  5. No breaking changes — Existing behavior untouched when --verbose is omitted.

Issues to address

1. Missing automated tests (Important)

The PR adds a new user-facing CLI flag but includes no tests. The project has an existing test suite with patterns like tests/e2e/suggest-smoke.test.mjs that mock a server and test the CLI end-to-end. A similar test should verify that:

  • commit-echo suggest -v exits successfully
  • Verbose output (model, provider, diff size, or profile stats) appears on stdout when the flag is set
  • Without --verbose, output is unchanged (no regression)

2. Unnecessary undefined guard on imperativeRate (Nitpick → should clean up)

if (profile.imperativeRate !== undefined) {

StyleProfile.imperativeRate is typed as number (not optional), and the outer check profile.totalCommits > 0 guarantees buildProfile returns a meaningful value. This guard is dead code and should be removed.

3. Inconsistent abbreviation with existing formatProfile (Nitpick)

The existing formatProfile() displays:

Average length: 42 characters

But the new verbose output uses:

Avg length: 42 chars

Consider aligning the wording to match the existing convention ("characters" instead of "chars").


Security ✅

No new dependencies, no exposed secrets, no injection vectors.

Performance ✅

Negligible — adds a handful of console.log calls.

Documentation ✅

-v, --verbose is properly registered in Commander. The PR description documents what each verbose line produces.


Summary: The feature is well-conceived and the implementation is mostly clean. Please add tests for the new flag, remove the dead-code guard, and consider the wording nitpick above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants