Bug Description
Selecting "Regenerate suggestions" in the suggest action menu recursively calls suggestCommand(), causing unbounded call stack growth and printing a new intro() banner each time.
Steps to Reproduce
- Run
commit-echo suggest
- When presented with the action menu, select "Regenerate suggestions"
- Repeat selecting "Regenerate suggestions" 10-20 times
Expected Behavior
Suggestions are regenerated in-place without growing the call stack or printing duplicate intro banners.
Actual Behavior
- Stack growth: Each call adds a frame to the call stack. After enough regenerations (hundreds), this causes
RangeError: Maximum call stack size exceeded.
- UI pollution: Each recursive call invokes
intro(pc.bold(pc.cyan("commit-echo"))) at src/commands/suggest.ts:87, printing a new clack intro banner on every regeneration.
Root Cause
src/commands/suggest.ts:267 — the "regenerate" action handler calls await suggestCommand(options) recursively instead of using a loop.
Suggested Fix
Refactor the suggestion flow into a loop:
while (true) {
// ... generate and display suggestions ...
const action = await select({ ... });
if (action === "regenerate") continue;
break;
}
Environment
- commit-echo latest
- Node.js (any version)
Bug Description
Selecting "Regenerate suggestions" in the suggest action menu recursively calls
suggestCommand(), causing unbounded call stack growth and printing a newintro()banner each time.Steps to Reproduce
commit-echo suggestExpected Behavior
Suggestions are regenerated in-place without growing the call stack or printing duplicate intro banners.
Actual Behavior
RangeError: Maximum call stack size exceeded.intro(pc.bold(pc.cyan("commit-echo")))atsrc/commands/suggest.ts:87, printing a new clack intro banner on every regeneration.Root Cause
src/commands/suggest.ts:267— the "regenerate" action handler callsawait suggestCommand(options)recursively instead of using a loop.Suggested Fix
Refactor the suggestion flow into a loop:
Environment