Skip to content

fix: cli command output consistency#709

Merged
peyton-alt merged 12 commits intomainfrom
cli-output-consistency
Mar 18, 2026
Merged

fix: cli command output consistency#709
peyton-alt merged 12 commits intomainfrom
cli-output-consistency

Conversation

@peyton-alt
Copy link
Contributor

@peyton-alt peyton-alt commented Mar 16, 2026

  • Consistent output across clean, reset, rewind, resume, trail, doctor,
    and status — cancellation messages, success prefixes (), branch name
    formatting, indentation, and full session ID display

    • Moved Note: advisory in trail from stderr to stdout to match rewind
    • Consolidated three redundant form cancellation helpers
      (handleResetConfirmationError, handleResetDecline,
      handleTrailInteractionError) into a single handleFormCancellation in utils.go
    • Extracted printSessionCommand helper to replace duplicate 6-case and 4-case
      switches in rewind.go and resume.go

    Test plan

    • Unit tests updated for all output string changes
    • Integration tests updated for resume session header rename (Session:
      Restored session)
    • TestHandleFormCancellation table test covers all cancellation paths
    • TestPrintMultiSessionResumeCommands_SingleSessionHasCheckmark covers new
      rewind ✓ header

Copilot AI review requested due to automatic review settings March 16, 2026 23:28
@cursor
Copy link

cursor bot commented Mar 16, 2026

PR Summary

Medium Risk
Touches multiple CLI commands and strategy APIs, changing stdout/stderr routing and adding an interactive deletion prompt; behavioral changes could impact scripting and user expectations around destructive operations.

Overview
Improves CLI output consistency by routing messages through Cobra’s OutOrStdout/ErrOrStderr and standardizing success messaging with across resume, rewind, doctor, reset, and trail.

Changes clean from a pure dry-run-by-default flow to preview + interactive confirmation before deletion (with --force skipping prompts), and refines deletion reporting (singular/plural grammar via itemWord, updated formatting).

Updates strategy method signatures (Reset, ResetSession, Rewind, RestoreLogsOnly, and PromptOverwriteNewerLogs) to accept output writers, and adjusts/extends tests to avoid TTY prompts and validate the new output text.

Written by Cursor Bugbot for commit c375949. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Stale "Run with --force" message before interactive prompt
    • Removed the stale 'Run with --force to delete these items.' message from the preview path in runCleanWithItems, since the interactive confirmation prompt now handles user consent.

View PR

Or push these changes by commenting:

@cursor push 25546e5f38
Preview (25546e5f38)
diff --git a/cmd/entire/cli/clean.go b/cmd/entire/cli/clean.go
--- a/cmd/entire/cli/clean.go
+++ b/cmd/entire/cli/clean.go
@@ -246,7 +246,6 @@
 			fmt.Fprintln(w)
 		}
 
-		fmt.Fprintln(w, "Run with --force to delete these items.")
 		return nil
 	}
 

diff --git a/cmd/entire/cli/clean_test.go b/cmd/entire/cli/clean_test.go
--- a/cmd/entire/cli/clean_test.go
+++ b/cmd/entire/cli/clean_test.go
@@ -143,9 +143,9 @@
 		t.Errorf("Should not list '%s', got: %s", paths.MetadataBranchName, output)
 	}
 
-	// Should prompt to use --force
-	if !strings.Contains(output, "--force") {
-		t.Errorf("Expected '--force' prompt in output, got: %s", output)
+	// Should NOT contain stale --force message (interactive prompt handles confirmation)
+	if strings.Contains(output, "--force") {
+		t.Errorf("Should not contain '--force' message in interactive mode, got: %s", output)
 	}
 
 	// Branches should still exist (preview mode doesn't delete)

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the entire clean command’s user-facing output formatting (including pluralization and success markers) and updates tests accordingly, while also changing the default command flow to preview + interactive confirmation before deletion.

Changes:

  • Update clean output formatting (✓ prefix, indentation tweaks, singular/plural “item(s)”).
  • Change clean default behavior to show preview and then prompt for confirmation (with --force skipping the prompt).
  • Refactor tests to call runClean with a cobra.Command (captured stdout) and to validate updated messages.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
cmd/entire/cli/clean.go Adds confirmation flow, revises preview/deletion output strings and pluralization logic.
cmd/entire/cli/clean_test.go Updates tests to match new output format and to invoke runClean via a test cobra command.

@peyton-alt
Copy link
Contributor Author

@BugBot review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@peyton-alt peyton-alt force-pushed the cli-output-consistency branch from c8b64a4 to 54d30a4 Compare March 17, 2026 03:47
@peyton-alt peyton-alt changed the title WIP: fix: cli command output consistency fix: cli command output consistency Mar 17, 2026
@peyton-alt peyton-alt marked this pull request as ready for review March 17, 2026 03:48
@peyton-alt peyton-alt requested a review from a team as a code owner March 17, 2026 03:48
@peyton-alt peyton-alt force-pushed the cli-output-consistency branch from 7286eb3 to 43aed19 Compare March 17, 2026 18:41
peyton-alt and others added 4 commits March 17, 2026 19:11
- resume: drop single-quotes around branch name in "Switched to branch" (align with trail)
- resume+rewind: replace "✓ Session: <id>" label style with verb-first "✓ Restored session <id>."
- rewind: add missing ✓ confirmation header before "To continue this session, run:" for single-session case
- trail: move "Note:" advisory message from stderr to stdout (align with rewind)

Tests: update TestDisplayRestoredSessions_SingleSessionOutput for new header;
add TestPrintMultiSessionResumeCommands_SingleSessionHasCheckmark for rewind single-session ✓

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… command formatting

- Replace handleResetConfirmationError, handleResetDecline (reset.go) and
  handleTrailInteractionError (trail_cmd.go) with a single handleFormCancellation
  in utils.go; update clean.go inline handling to use it too
- Extract printSessionCommand helper to utils.go, eliminating the duplicate
  6-case switch in rewind.go and 4-case switch in resume.go
- Remove 4 redundant helper-specific tests; replace with single
  TestHandleFormCancellation table test in utils_test.go
- Fix integration tests: update "Session:" assertions to "Restored session"
  to match the output consistency rename from the prior commit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@peyton-alt peyton-alt merged commit 7992c9e into main Mar 18, 2026
3 checks passed
@peyton-alt peyton-alt deleted the cli-output-consistency branch March 18, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants