Skip to content

fix: improve CLI output for auth login and upgrade flows#454

Merged
BYK merged 4 commits intomainfrom
fix/improve-cli-output-formatting
Mar 18, 2026
Merged

fix: improve CLI output for auth login and upgrade flows#454
BYK merged 4 commits intomainfrom
fix/improve-cli-output-formatting

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Mar 17, 2026

Migrate diagnostic output from cluttered stderr log.info() calls to the markdown-rendering pipeline for cleaner, more consistent formatting.

Auth login (interactive-login.ts)

  • Show verification_uri_complete (with user_code embedded) instead of bare verification_uri so the URL works in headless environments (SSH, CI)
  • Use log.log() for URL/code detail lines instead of log.info() to avoid repeated ℹ icon prefixes
  • Only show copy hint when browser didn't open
  • Render user code as inline code span via renderInlineMarkdown()

CLI upgrade (upgrade.ts + human.ts)

  • Demote method/version/channel/latest log.info() calls to log.debug()
  • Add metadata key-value table (method, channel) to formatUpgradeResult via mdKvTable(), rendering through the standard markdown pipeline
  • Keep log.info() only for progress indicators that fire before the result is ready (Upgrading to..., nightly migration)

Closes #452

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (dashboard) Add dashboard list, view, and create commands by betegon in #406
  • (upgrade) Add --offline flag and automatic offline fallback by BYK in #450
  • Add project delete command by MathurAditya724 in #397
  • Add sentry schema command for API introspection by BYK in #437

Bug Fixes 🐛

  • (dsn) Prevent hang during DSN auto-detection in repos with test fixtures by BYK in #445
  • (formatters) Pad priority labels for consistent TRIAGE column alignment by MathurAditya724 in #449
  • (upgrade) Remove hard chain depth cap for nightly delta upgrades by BYK in #444
  • Improve CLI output for auth login and upgrade flows by BYK in #454

Internal Changes 🔧

  • Cache org listing in listOrganizations + DSN shortcut for issue view by betegon in #446

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2026

Codecov Results 📊

116 passed | Total: 116 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 70.73%. Project has 1136 uncovered lines.
❌ Project coverage is 95.2%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
interactive-login.ts 22.76% ⚠️ 95 Missing
human.ts 96.35% ⚠️ 46 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.21%    95.20%    -0.01%
==========================================
  Files          175       175         —
  Lines        23653     23679       +26
  Branches         0         0         —
==========================================
+ Hits         22519     22543       +24
- Misses        1134      1136        +2
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review March 17, 2026 23:48
Migrate diagnostic output from cluttered stderr log.info() calls to the
markdown-rendering pipeline for cleaner, more consistent formatting.

**Auth login (interactive-login.ts):**
- Show verification_uri_complete (with user_code embedded) instead of
  bare verification_uri so the URL works in headless environments
- Use log.log() for URL/code detail lines instead of log.info() to
  avoid repeated ℹ icon prefixes
- Only show copy hint when browser didn't open
- Render user code as inline code span via renderInlineMarkdown()

**CLI upgrade (upgrade.ts + human.ts):**
- Demote method/version/channel/latest log.info() calls to log.debug()
- Add metadata key-value table (method, channel) to formatUpgradeResult
  via mdKvTable(), rendering through the standard markdown pipeline
- Keep log.info() only for progress indicators that fire before the
  result is ready (Upgrading to..., nightly migration)

Closes #452
@BYK BYK force-pushed the fix/improve-cli-output-formatting branch from 2b91d66 to 4bfa18b Compare March 17, 2026 23:55
- Escape verificationUriComplete with escapeMarkdownInline() before
  passing to renderInlineMarkdown() to prevent underscores in URLs
  (e.g., self-hosted instances) from being interpreted as emphasis
- Set SENTRY_PLAIN_OUTPUT=1 in upgrade test mock context so table
  assertions use raw markdown pipes instead of Unicode box-drawing
  characters that only appear in TTY mode
- Add test for URL escaping with underscore-containing URLs
@BYK
Copy link
Copy Markdown
Member Author

BYK commented Mar 18, 2026

Addressed both review comments in af24db3:

Seer (URL escaping): Good catch. Wrapped verificationUriComplete with escapeMarkdownInline() before passing to renderInlineMarkdown(). Added a test with underscore-containing URLs to verify.

Cursor BugBot (TTY-dependent assertions): Set SENTRY_PLAIN_OUTPUT=1 in the upgrade test mock context (createMockContext) so formatUpgradeResult always renders raw markdown tables with ASCII pipes, regardless of whether the test runner is in a TTY.

The verification URL must stay intact for copy-paste in all output
modes. Passing it through renderInlineMarkdown() after escaping with
escapeMarkdownInline() would leave literal backslash-underscore
sequences in plain/CI mode (e.g., user\_code=), breaking the URL.

Instead, emit the URL line as plain text via log.log() — it doesn't
need styling. Only the user code (backtick code span) and copy hint
(italic) use renderInlineMarkdown().
@BYK
Copy link
Copy Markdown
Member Author

BYK commented Mar 18, 2026

Fixed in f0c404e: Removed markdown rendering from the URL line entirely. The URL is now emitted as plain text via log.log() so it stays intact for copy-paste in all output modes (TTY, plain, CI). Only the user code (backtick code span) and copy hint (italic) use renderInlineMarkdown().

Copy link
Copy Markdown

@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.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@BYK BYK merged commit 062bb74 into main Mar 18, 2026
22 checks passed
@BYK BYK deleted the fix/improve-cli-output-formatting branch March 18, 2026 00:33
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.

Improve CLI output for auth login flow

1 participant