Commit 4304ab8
refactor: migrate non-streaming commands to CommandOutput with markdown rendering (#398)
## Summary
Migrate 5 commands from imperative `log.info`/`log.success`/`log.warn`
output to the structured `CommandOutput<T>` return pattern with
dedicated markdown formatters. This is a continuation of the output
convergence work from PR #394.
### Commands migrated
| Command | Data Type | Key Change |
|---------|-----------|------------|
| `auth status` | `AuthStatusData` | Multi-section display (source,
user, token, defaults, verification) → `mdKvTable` + `colorTag` |
| `auth logout` | `LogoutResult` | Not-authenticated / env-token cases
now throw typed errors instead of `log.warn` |
| `cli feedback` | `FeedbackResult` | Telemetry-disabled case throws
`ConfigError` with suggestion |
| `cli fix` | `FixResult` / `FixIssue` | 20+ diagnostic log calls →
structured issues array. Uses `OutputError` for failures (renders data
then exits 1) |
| `cli upgrade` | `UpgradeResult` | Discriminated `ResolveResult` union.
Progress messages kept on stderr; final result returned as data |
### Pattern
Every migrated command follows the same structure:
```ts
// 1. Define data type
export type FooResult = { ... };
// 2. Add output config to buildCommand
output: { json: true, human: formatFooResult },
// 3. Return data from func()
return { data: result };
```
Human formatters in `src/lib/formatters/human.ts` use the shared
markdown helpers (`mdKvTable`, `colorTag`, `safeCodeSpan`,
`renderMarkdown`) for consistent terminal rendering. All commands now
automatically support `--json` and `--fields`.
### What's NOT in this PR
- **`auth login`** — Has an interactive OAuth path that needs raw
`stdout`/`stderr` Writers. Deferred to `buildStreamingCommand()`.
- **List commands** (`issue list`, `project list`, etc.) — Need
streaming infrastructure.
- **`api` command** — Intentionally raw (direct API proxy).
- **Progress `log.info` calls** in `cli/upgrade` — These are transient
status messages on stderr, which is the correct place for them.
### Commands now on return-based `CommandOutput` (19 total)
`api`, `auth/refresh`, `auth/whoami`, `auth/status`, `auth/logout`,
`auth/token`, `cli/feedback`, `cli/fix`, `cli/upgrade`, `issue/explain`,
`issue/plan`, `issue/view`, `event/view`, `log/view`, `trace/view`,
`org/view`, `project/view`, `project/create`, `team/create`
### Test results
917 pass, 0 fail, 30 test files.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent 4956615 commit 4304ab8
File tree
12 files changed
+1372
-708
lines changed- plugins/sentry-cli/skills/sentry-cli
- src
- commands
- auth
- cli
- lib/formatters
- test/commands
- auth
- cli
12 files changed
+1372
-708
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| 98 | + | |
| 99 | + | |
94 | 100 | | |
95 | 101 | | |
96 | 102 | | |
| |||
453 | 459 | | |
454 | 460 | | |
455 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
456 | 466 | | |
457 | 467 | | |
458 | 468 | | |
459 | 469 | | |
460 | 470 | | |
461 | 471 | | |
| 472 | + | |
| 473 | + | |
462 | 474 | | |
463 | 475 | | |
464 | 476 | | |
| |||
481 | 493 | | |
482 | 494 | | |
483 | 495 | | |
| 496 | + | |
| 497 | + | |
484 | 498 | | |
485 | 499 | | |
486 | 500 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
19 | 28 | | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
| 35 | + | |
26 | 36 | | |
27 | 37 | | |
28 | 38 | | |
29 | | - | |
| 39 | + | |
30 | 40 | | |
31 | | - | |
32 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
33 | 44 | | |
34 | 45 | | |
35 | 46 | | |
36 | 47 | | |
37 | | - | |
38 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
39 | 51 | | |
40 | 52 | | |
41 | | - | |
42 | 53 | | |
43 | 54 | | |
| 55 | + | |
44 | 56 | | |
45 | | - | |
46 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 24 | + | |
29 | 25 | | |
30 | 26 | | |
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 30 | | |
38 | 31 | | |
39 | 32 | | |
| 33 | + | |
40 | 34 | | |
| 35 | + | |
41 | 36 | | |
42 | 37 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 38 | | |
55 | 39 | | |
56 | 40 | | |
57 | 41 | | |
58 | 42 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | 81 | | |
65 | | - | |
| 82 | + | |
66 | 83 | | |
67 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
68 | 88 | | |
69 | 89 | | |
70 | 90 | | |
71 | 91 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 92 | + | |
| 93 | + | |
83 | 94 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
90 | 101 | | |
91 | 102 | | |
92 | 103 | | |
93 | | - | |
| 104 | + | |
94 | 105 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
98 | 109 | | |
99 | | - | |
| 110 | + | |
100 | 111 | | |
101 | 112 | | |
102 | 113 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
113 | 121 | | |
| 122 | + | |
114 | 123 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 124 | + | |
118 | 125 | | |
119 | 126 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
131 | 131 | | |
132 | | - | |
133 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| |||
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
| 146 | + | |
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
| |||
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
155 | | - | |
| 158 | + | |
156 | 159 | | |
157 | 160 | | |
158 | | - | |
| 161 | + | |
159 | 162 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 163 | + | |
166 | 164 | | |
167 | 165 | | |
168 | 166 | | |
| |||
171 | 169 | | |
172 | 170 | | |
173 | 171 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
186 | 193 | | |
187 | 194 | | |
0 commit comments