Skip to content

refactor: convert remaining Tier 1 commands to return-based output#382

Merged
BYK merged 1 commit intomainfrom
feat/return-based-tier1
Mar 10, 2026
Merged

refactor: convert remaining Tier 1 commands to return-based output#382
BYK merged 1 commit intomainfrom
feat/return-based-tier1

Conversation

@BYK
Copy link
Member

@BYK BYK commented Mar 10, 2026

Summary

Convert 5 remaining Tier 1 commands to the return-based CommandOutput<T> pattern introduced in #380.

Each command now returns { data, hint?, footer? } and declares an OutputConfig with json: true and a human formatter — the framework handles JSON serialization and human-readable rendering.

Commands converted

Command Human formatter Return shape
event/view formatEventView() { data: { event, trace, spanTreeLines }, hint }
issue/view formatIssueView() { data: { issue, event, trace, spanTreeLines }, footer }
issue/plan formatPlanOutput() { data: { run_id, status, solution } }
project/create formatProjectCreated() { data: ProjectCreatedResult }
trace/view formatTraceView() { data: { summary, spans, spanTreeLines }, footer }

Infrastructure changes

  • Added footer?: string to CommandOutput<T> and RenderContext
  • renderCommandOutput() now renders footer via writeFooter()
  • handleReturnValue in command.ts passes value.footer through

What was removed

  • writeHumanOutput() from trace/view (replaced by formatTraceView)
  • outputSolution() from issue/plan (replaced by formatPlanOutput + buildPlanData)
  • Manual writeJson/writeFooter/stdout.write calls from all 5 commands
  • Writer type imports (no longer needed)

Test updates

  • test/commands/trace/view.func.test.ts: writeHumanOutput tests replaced with formatTraceView pure function tests
  • test/commands/project/create.test.ts: parsed.slugparsed.project.slug (JSON shape now uses full ProjectCreatedResult)

Net: -33 lines (188 insertions, 221 deletions)

Part of the output convergence plan: #373#376#380 → this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 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 ✨

Init

  • Accept multiple delimiter formats for --features flag by betegon in #386
  • Add git safety checks before wizard modifies files by betegon in #379
  • Add experimental warning before wizard runs by betegon in #378
  • Add init command for guided Sentry project setup by betegon in #283

Other

  • (issue-list) Redesign table to match Sentry web UI by BYK in #372
  • Return-based output with OutputConfig on buildCommand by BYK in #380
  • Add --fields flag for context-window-friendly JSON output by BYK in #373
  • Magic @ selectors (@latest, @most_frequent) for issue commands by BYK in #371
  • Input hardening against agent hallucinations by BYK in #370
  • Add response caching for read-only API calls by BYK in #330

Bug Fixes 🐛

Init

  • Remove implementation detail from help text by betegon in #385
  • Truncate uncommitted file list to first 5 entries by MathurAditya724 in #381

Other

  • (api) Convert --data to query params for GET requests by BYK in #383
  • (docs) Remove double borders and fix column alignment on landing page tables by betegon in #369
  • Add trace ID validation to trace view + UUID dash-stripping by BYK in #375

Internal Changes 🔧

Init

  • Remove --force flag by betegon in #377
  • Remove dead determine-pm step label by betegon in #374

Other

  • Convert remaining Tier 1 commands to return-based output by BYK in #382
  • Converge Tier 1 commands to writeOutput helper by BYK in #376

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

Codecov Results 📊

104 passed | Total: 104 | 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 95.93%. Project has 898 uncovered lines.
✅ Project coverage is 95.5%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
browser.ts 73.33% ⚠️ 16 Missing
view.ts 94.15% ⚠️ 12 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.49%    95.50%    +0.01%
==========================================
  Files          142       142         —
  Lines        19936     19935        -1
  Branches         0         0         —
==========================================
+ Hits         19037     19037         —
- Misses         899       898        -1
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review March 10, 2026 17:04
@BYK BYK force-pushed the feat/return-based-tier1 branch 2 times, most recently from bcd114a to ef64745 Compare March 10, 2026 17:25
@BYK BYK force-pushed the feat/return-based-tier1 branch 2 times, most recently from e347d5f to b13b810 Compare March 10, 2026 18:24
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 2 potential issues.

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

@BYK BYK force-pushed the feat/return-based-tier1 branch 2 times, most recently from bbca7b9 to 151de57 Compare March 10, 2026 18:45
Convert 5 remaining Tier 1 commands to the return-based CommandOutput<T>
pattern introduced in #380. Commands return { data, hint? } and declare
an OutputConfig with json: true and a human formatter — the framework
handles JSON serialization and human-readable rendering.

Commands converted:
- event/view: formatEventView + buildEventData
- issue/view: formatIssueView + buildIssueData
- issue/plan: formatPlanOutput + buildPlanData (removed outputSolution)
- project/create: formatProjectCreatedView
- trace/view: formatTraceView + buildTraceData

Additional cleanup from review feedback:
- Unify hint and footer into single hint field on CommandOutput<T>
- Replace normalizePlatform stderr.write with consola logger
- Remove stdout parameter from openInBrowser/openOrShowUrl (now uses
  process.stdout directly) — all 7 command callers updated
- Remove unused Writer imports and stdout destructuring from commands
@BYK BYK force-pushed the feat/return-based-tier1 branch from 151de57 to b9e1083 Compare March 10, 2026 18:56
@BYK BYK merged commit 39de00f into main Mar 10, 2026
21 checks passed
@BYK BYK deleted the feat/return-based-tier1 branch March 10, 2026 19:15
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.

1 participant