Commit 84d2812
authored
fix: show human-friendly names in trial list and surface plan trials (#412)
## Summary
Improves the `sentry trial list` and `sentry trial start` commands with
human-friendly names, plan trial visibility, deduplication, and better
error messages.
## Changes
### Human-friendly trial names
- Added mappings for `monitorSeats` → "Cron Monitors", `uptime` →
"Uptime Monitoring"
- Added `profileDurationUI` to existing `profiling` mapping
- Added `humanizeCategory()` fallback that converts unknown camelCase
categories to "Title Case"
- Added `kebabize()` fallback for CLI-friendly names
### Plan trial surfacing
- New `getCustomerTrialInfo()` API function returns plan trial data
(`canTrial`, `isTrial`, `trialEnd`, `planDetails`)
- Plan-level trials (e.g., "Developer -> Business") now appear in `trial
list` with status "Available" or "Active"
- Shows hint: `Tip: Use 'sentry trial start plan' to start a Business
plan trial`
### `sentry trial start plan`
- New "plan" pseudo-trial name that opens the org's billing page
- Shows billing URL, QR code, and optional browser prompt (TTY-aware)
- Checks eligibility via `canTrial`/`isTrial` before prompting
- Respects `--json` mode
### Simplified table format
- Merged NAME + PRODUCT into single "TRIAL" column with CLI name in
parentheses: `Profiling (profiling)`
- Dropped CATEGORY column from human output (kept in `--json`)
- Plan trial row: `Developer -> Business (plan) | ○ Available | —`
### Deduplication
- API returns separate entries for `profileDuration` and
`profileDurationUI`, both mapping to CLI name "profiling"
- `deduplicateTrials()` groups by CLI name, keeps best entry (active >
available > expired, latest endDate wins)
### Better error messages
- `ContextError` now shows usage with placeholder: `sentry trial list
<org>` instead of bare `sentry trial list`
- Default alternatives (DSN detection, `SENTRY_ORG` env var) shown
instead of being overridden
## Test coverage
89 tests passing across 3 files (154 assertions):
- `test/lib/trials.test.ts` — unit tests for name mappings,
humanization, kebabization
- `test/commands/trial/list.test.ts` — plan trial entries,
deduplication, table formatting
- `test/commands/trial/start.test.ts` — plan trial flow, eligibility
checks, JSON mode
## Related
- Discovered a pre-existing systemic bug where commands produce no
output when DSN auto-detection is slow on first run (uncached). Filed as
#411.1 parent fb38a16 commit 84d2812
File tree
10 files changed
+1047
-116
lines changed- src
- commands/trial
- lib
- api
- types
- test
- commands/trial
- lib
10 files changed
+1047
-116
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
| 36 | + | |
35 | 37 | | |
36 | | - | |
| 38 | + | |
37 | 39 | | |
38 | | - | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
61 | 154 | | |
62 | 155 | | |
63 | 156 | | |
64 | 157 | | |
65 | 158 | | |
66 | | - | |
| 159 | + | |
67 | 160 | | |
68 | 161 | | |
69 | 162 | | |
70 | | - | |
71 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
72 | 172 | | |
73 | 173 | | |
74 | 174 | | |
| |||
82 | 182 | | |
83 | 183 | | |
84 | 184 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 185 | | |
90 | 186 | | |
91 | 187 | | |
| |||
130 | 226 | | |
131 | 227 | | |
132 | 228 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 229 | + | |
136 | 230 | | |
137 | 231 | | |
138 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
139 | 248 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
151 | 254 | | |
152 | 255 | | |
153 | | - | |
154 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
155 | 260 | | |
156 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
157 | 267 | | |
158 | 268 | | |
159 | 269 | | |
| |||
0 commit comments