feat(dashboard): add dashboard list, view, and create commands#406
feat(dashboard): add dashboard list, view, and create commands#406
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Init
Issue List
Other
Bug Fixes 🐛Init
Other
Documentation 📚
Internal Changes 🔧Init
Other
Other
🤖 This preview updates automatically when you update the PR. |
Dashboard API functions now live in src/lib/api/dashboards.ts following the domain module pattern from #405. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
02c23d0 to
f05f91a
Compare
Codecov Results 📊✅ 104 passed | Total: 104 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 95.83%. Project has 729 uncovered lines. Files with missing lines (3)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 96.68% 96.65% -0.03%
==========================================
Files 159 166 +7
Lines 21011 21779 +768
Branches 0 0 —
==========================================
+ Hits 20314 21050 +736
- Misses 697 729 +32
- Partials 0 0 —Generated by Codecov Action |
…end existing test suites Add ~46 new tests covering dashboard commands (list, create, resolve), URL builders (property-based), human formatters, and type utilities (assignDefaultLayout, stripWidgetServerFields). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Convert list from buildListCommand to buildCommand with return-based output - Extract formatDashboardListHuman for human-readable table rendering - Add --fresh flag to both list and view commands - Update list tests to include fresh flag Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…olve.ts Align parseDashboardPositionalArgs with the established codebase pattern used in event/view, trace/view, trace/logs, and dashboard/create. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
updateDashboard has no callers in the core dashboard commands (list, view, create). It will be added back when widget commands are introduced. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…etServerFields These functions are only needed for widget update operations (add/edit/delete), which are not part of the core dashboard commands (list, view, create). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ner to list - Title column renders as markdown link to dashboard URL (clickable in terminal) - Add --limit flag (default 30) with per_page passed to API - Wrap fetch in withProgress() for "Fetching dashboards..." spinner - Add jsonTransform to keep JSON output as plain array Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Dashboard view URL uses wrong singular path segment
- Changed buildDashboardUrl to use /dashboards/ (plural) instead of /dashboard/ (singular) to match Sentry's routing.
Or push these changes by commenting:
@cursor push 1285439136
Preview (1285439136)
diff --git a/src/lib/sentry-urls.ts b/src/lib/sentry-urls.ts
--- a/src/lib/sentry-urls.ts
+++ b/src/lib/sentry-urls.ts
@@ -189,9 +189,9 @@
dashboardId: string
): string {
if (isSaaS()) {
- return `${getOrgBaseUrl(orgSlug)}/dashboard/${dashboardId}/`;
+ return `${getOrgBaseUrl(orgSlug)}/dashboards/${dashboardId}/`;
}
- return `${getSentryBaseUrl()}/organizations/${orgSlug}/dashboard/${dashboardId}/`;
+ return `${getSentryBaseUrl()}/organizations/${orgSlug}/dashboards/${dashboardId}/`;
}
/**This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
| return `${getOrgBaseUrl(orgSlug)}/dashboard/${dashboardId}/`; | ||
| } | ||
| return `${getSentryBaseUrl()}/organizations/${orgSlug}/dashboard/${dashboardId}/`; | ||
| } |
There was a problem hiding this comment.
Dashboard view URL uses wrong singular path segment
High Severity
buildDashboardUrl generates URLs with /dashboard/ (singular) but Sentry's web app routes specific dashboards under /dashboards/{id}/ (plural), the same base as the list page. This means every dashboard URL produced by the view, create, and list commands will be broken — linking users to a non-existent path. buildDashboardsListUrl correctly uses /dashboards/ but buildDashboardUrl inconsistently uses /dashboard/.
Replace invisible OSC 8 terminal hyperlink on title with a visible muted URL on a second line, so it's auto-clickable by the terminal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| return ref; | ||
| } | ||
|
|
||
| const dashboards = await listDashboards(orgSlug); |
There was a problem hiding this comment.
Title-based dashboard lookup limited to first API page
Medium Severity
resolveDashboardId calls listDashboards(orgSlug) without specifying a perPage parameter when resolving a dashboard by title. This means it only searches through the API's default page size (typically ~20 items). Organizations with many dashboards will get a false "not found" error for dashboards beyond the first page, along with a misleading "Available dashboards" list that only shows the first page of results.
|
Bugbot Autofix prepared a fix for the issue found in the latest run.
Or push these changes by commenting: Preview (6ffef7f85b)diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts
--- a/src/types/dashboard.ts
+++ b/src/types/dashboard.ts
@@ -565,23 +565,3 @@
return cleaned;
}
-
-/**
- * Prepare a full dashboard for PUT update.
- * Strips server-generated fields from all widgets while preserving
- * widgetType, displayType, and layout.
- *
- * @param dashboard - Dashboard detail from GET response
- * @returns Object with title and cleaned widgets, ready for PUT body
- */
-export function prepareDashboardForUpdate(dashboard: DashboardDetail): {
- title: string;
- widgets: DashboardWidget[];
- projects?: number[];
-} {
- return {
- title: dashboard.title,
- widgets: (dashboard.widgets ?? []).map(stripWidgetServerFields),
- projects: dashboard.projects,
- };
-}This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard. |



Summary
sentry dashboard list— list dashboards with--weband--jsonsupportsentry dashboard view— view dashboard detail by numeric ID or title (case-insensitive match)sentry dashboard create— create dashboards with optional inline--widget-*flags for quick widget creationlistDashboards,getDashboard,createDashboard,updateDashboard)parseAggregate()/parseSortExpression()shorthand for CLI-friendly aggregate syntax (e.g.count→count(),p95:span.duration→p95(span.duration))Split from #401. Widget commands (add/edit/delete) follow in a stacked PR.
Test plan
bun run typecheck— no new type errorsbun run lint— passesbun test test/types/dashboard.test.ts— 53 tests pass (enum constants, schema validation, parseAggregate, parseSortExpression, prepareWidgetQueries)🤖 Generated with Claude Code