Commit 3a80e09
feat(cli): show analytics stats in checks get [AI-55] (#1249)
* refactor(cli): extract analytics formatting into shared module
* feat(cli): show analytics stats in checks get output [AI-55]
* fix(cli): tighten extractMetrics return type and stats header style
- Return Record<string, number> with isNaN guard instead of Record<string, number | string>
- Use dim styling for range in STATS header for visual consistency
* chore(cli): remove standalone checks stats command
Stats are shown inline in checks get, no separate subcommand needed.
* chore(cli): wire analytics REST client into API module
* refactor(cli): use shared CheckTypes constant for check type mappings
Expands CheckTypes in constants.ts to include all 9 check types and
uses it in analytics.ts and list.ts instead of hardcoded strings.
* fix(cli): handle array series data and clean up stats output
- Fix extractMetrics to handle API returning series[0].data as array
- Filter out bonus fields (total, success) by using requestedMetrics
- Display metrics in intended order (availability first)
* fix(cli): use human-friendly range labels in stats output
"last24Hours" → "last 24 hours", "last7Days" → "last 7 days", etc.
* feat(cli): add --group-by, --metrics, --filter-status flags and fix error rendering
- Add --group-by location|statusCode for per-region/status-code stats breakdown
- Add --metrics flag for custom metric selection (overrides defaults)
- Add --filter-status success|failure to filter stats by run outcome
- Update browser/playwright defaults to include Web Vitals (LCP, CLS, TBT)
- Add CLS as "score" unit type with appropriate thresholds
- Fix formatMetricLabel to preserve uppercase acronyms (LCP, CLS, TBT)
- Fix Analytics.get() return type to match { data: T } pattern
- Replace non-null assertions with ?? fallbacks
- Remove dead listMetrics() method
- Use API metadata for unit detection with heuristic fallback
- Fix [object Object] rendering for Playwright Test error objects
- Expand test coverage: findUnit branches, grouped output, metadata, error objects
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 4301be2 commit 3a80e09
10 files changed
Lines changed: 752 additions & 8 deletions
File tree
- packages/cli/src
- commands/checks
- formatters
- __tests__
- __fixtures__
- rest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
44 | 62 | | |
45 | 63 | | |
46 | 64 | | |
| |||
59 | 77 | | |
60 | 78 | | |
61 | 79 | | |
62 | | - | |
63 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
64 | 85 | | |
65 | 86 | | |
66 | 87 | | |
67 | 88 | | |
68 | 89 | | |
69 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
70 | 97 | | |
71 | 98 | | |
72 | 99 | | |
73 | 100 | | |
74 | 101 | | |
75 | 102 | | |
76 | 103 | | |
77 | | - | |
| 104 | + | |
| 105 | + | |
78 | 106 | | |
79 | 107 | | |
80 | 108 | | |
| |||
85 | 113 | | |
86 | 114 | | |
87 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
88 | 121 | | |
89 | 122 | | |
90 | 123 | | |
| |||
106 | 139 | | |
107 | 140 | | |
108 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
109 | 148 | | |
110 | 149 | | |
111 | 150 | | |
| |||
133 | 172 | | |
134 | 173 | | |
135 | 174 | | |
| 175 | + | |
| 176 | + | |
136 | 177 | | |
137 | 178 | | |
138 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
7 | 16 | | |
8 | 17 | | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
338 | 350 | | |
339 | 351 | | |
340 | 352 | | |
| |||
0 commit comments