Skip to content

Commit 39faa8d

Browse files
committed
refactor: consolidate limit constants into shared LIST_MAX_LIMIT/LIST_MIN_LIMIT/LIST_DEFAULT_LIMIT
Every list command duplicated MAX_LIMIT (1000), MIN_LIMIT (1), and DEFAULT_LIMIT (varying 20-100) locally. Move them to list-command.ts as LIST_MAX_LIMIT, LIST_MIN_LIMIT, and LIST_DEFAULT_LIMIT (standardized to 25). - trace list default: 20 → 25 - trace logs default: 100 → 25 - log list default: 100 → 25 - buildListLimitFlag default: 30 → 25 - issue list: remove redundant explicit "25" (now the default)
1 parent 6b6d816 commit 39faa8d

File tree

16 files changed

+70
-84
lines changed

16 files changed

+70
-84
lines changed

plugins/sentry-cli/skills/sentry-cli/references/dashboard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ List dashboards
1717

1818
**Flags:**
1919
- `-w, --web - Open in browser`
20-
- `-n, --limit <value> - Maximum number of dashboards to list - (default: "30")`
20+
- `-n, --limit <value> - Maximum number of dashboards to list - (default: "25")`
2121
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`
2222
- `-c, --cursor <value> - Navigate pages: "next", "prev", "first" (or raw cursor string)`
2323

plugins/sentry-cli/skills/sentry-cli/references/log.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ View Sentry logs
1616
List logs from a project
1717

1818
**Flags:**
19-
- `-n, --limit <value> - Number of log entries (1-1000) - (default: "100")`
19+
- `-n, --limit <value> - Number of log entries (1-1000) - (default: "25")`
2020
- `-q, --query <value> - Filter query (Sentry search syntax)`
2121
- `-f, --follow <value> - Stream logs (optionally specify poll interval in seconds)`
2222
- `-t, --period <value> - Time period (e.g., "30d", "14d", "24h"). Default: 30d (project mode), 14d (trace mode)`

plugins/sentry-cli/skills/sentry-cli/references/org.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Work with Sentry organizations
1616
List organizations
1717

1818
**Flags:**
19-
- `-n, --limit <value> - Maximum number of organizations to list - (default: "30")`
19+
- `-n, --limit <value> - Maximum number of organizations to list - (default: "25")`
2020
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`
2121

2222
### `sentry org view <org>`

plugins/sentry-cli/skills/sentry-cli/references/project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ sentry project delete my-org/old-project --yes
5656
List projects
5757

5858
**Flags:**
59-
- `-n, --limit <value> - Maximum number of projects to list - (default: "30")`
59+
- `-n, --limit <value> - Maximum number of projects to list - (default: "25")`
6060
- `-p, --platform <value> - Filter by platform (e.g., javascript, python)`
6161
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`
6262
- `-c, --cursor <value> - Navigate pages: "next", "prev", "first" (or raw cursor string)`

plugins/sentry-cli/skills/sentry-cli/references/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Work with Sentry releases
1616
List releases
1717

1818
**Flags:**
19-
- `-n, --limit <value> - Maximum number of releases to list - (default: "30")`
19+
- `-n, --limit <value> - Maximum number of releases to list - (default: "25")`
2020
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`
2121
- `-c, --cursor <value> - Navigate pages: "next", "prev", "first" (or raw cursor string)`
2222

plugins/sentry-cli/skills/sentry-cli/references/repo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Work with Sentry repositories
1616
List repositories
1717

1818
**Flags:**
19-
- `-n, --limit <value> - Maximum number of repositories to list - (default: "30")`
19+
- `-n, --limit <value> - Maximum number of repositories to list - (default: "25")`
2020
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`
2121
- `-c, --cursor <value> - Navigate pages: "next", "prev", "first" (or raw cursor string)`
2222

plugins/sentry-cli/skills/sentry-cli/references/team.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Work with Sentry teams
1616
List teams
1717

1818
**Flags:**
19-
- `-n, --limit <value> - Maximum number of teams to list - (default: "30")`
19+
- `-n, --limit <value> - Maximum number of teams to list - (default: "25")`
2020
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`
2121
- `-c, --cursor <value> - Navigate pages: "next", "prev", "first" (or raw cursor string)`
2222

plugins/sentry-cli/skills/sentry-cli/references/trace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ View distributed traces
1616
List recent traces in a project
1717

1818
**Flags:**
19-
- `-n, --limit <value> - Number of traces (1-1000) - (default: "20")`
19+
- `-n, --limit <value> - Number of traces (1-1000) - (default: "25")`
2020
- `-q, --query <value> - Search query (Sentry search syntax)`
2121
- `-s, --sort <value> - Sort by: date, duration - (default: "date")`
2222
- `-t, --period <value> - Time period (e.g., "1h", "24h", "7d", "30d") - (default: "7d")`
@@ -79,7 +79,7 @@ View logs associated with a trace
7979
**Flags:**
8080
- `-w, --web - Open trace in browser`
8181
- `-t, --period <value> - Time period to search (e.g., "14d", "7d", "24h"). Default: 14d - (default: "14d")`
82-
- `-n, --limit <value> - Number of log entries (<=1000) - (default: "100")`
82+
- `-n, --limit <value> - Number of log entries (<=1000) - (default: "25")`
8383
- `-q, --query <value> - Additional filter query (Sentry search syntax)`
8484
- `-s, --sort <value> - Sort order: "newest" (default) or "oldest" - (default: "newest")`
8585
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`

src/commands/event/shared-events.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ import { filterFields } from "../../lib/formatters/json.js";
1111
import { colorTag, escapeMarkdownCell } from "../../lib/formatters/markdown.js";
1212
import { type Column, formatTable } from "../../lib/formatters/table.js";
1313
import { formatRelativeTime } from "../../lib/formatters/time-utils.js";
14-
import { LIST_PERIOD_FLAG, PERIOD_ALIASES } from "../../lib/list-command.js";
14+
import {
15+
LIST_DEFAULT_LIMIT,
16+
LIST_MAX_LIMIT,
17+
LIST_MIN_LIMIT,
18+
LIST_PERIOD_FLAG,
19+
PERIOD_ALIASES,
20+
} from "../../lib/list-command.js";
1521
import type { IssueEvent } from "../../types/index.js";
1622

1723
// ---------------------------------------------------------------------------
@@ -55,15 +61,6 @@ export type EventsResult = {
5561
// Constants
5662
// ---------------------------------------------------------------------------
5763

58-
/** Maximum allowed value for --limit flag */
59-
export const MAX_LIMIT = 1000;
60-
61-
/** Minimum allowed value for --limit flag */
62-
export const MIN_LIMIT = 1;
63-
64-
/** Default number of events to show */
65-
export const DEFAULT_LIMIT = 25;
66-
6764
/** Default time period for event queries */
6865
export const DEFAULT_PERIOD = "7d";
6966

@@ -192,7 +189,7 @@ export function appendEventsFlags(
192189

193190
/** Parse --limit flag, delegating range validation to shared utility. */
194191
export function parseLimit(value: string): number {
195-
return validateLimit(value, MIN_LIMIT, MAX_LIMIT);
192+
return validateLimit(value, LIST_MIN_LIMIT, LIST_MAX_LIMIT);
196193
}
197194

198195
// ---------------------------------------------------------------------------
@@ -204,8 +201,8 @@ export const EVENTS_FLAGS = {
204201
limit: {
205202
kind: "parsed",
206203
parse: parseLimit,
207-
brief: `Number of events (${MIN_LIMIT}-${MAX_LIMIT})`,
208-
default: String(DEFAULT_LIMIT),
204+
brief: `Number of events (${LIST_MIN_LIMIT}-${LIST_MAX_LIMIT})`,
205+
default: String(LIST_DEFAULT_LIMIT),
209206
},
210207
query: {
211208
kind: "parsed",

src/commands/issue/list.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
buildListCommand,
5858
buildListLimitFlag,
5959
LIST_BASE_ALIASES,
60+
LIST_MAX_LIMIT,
6061
LIST_TARGET_POSITIONAL,
6162
paginationHint,
6263
parseCursorFlag,
@@ -132,12 +133,6 @@ const VALID_SORT_VALUES: SortValue[] = ["date", "new", "freq", "user"];
132133
/** Usage hint for ContextError messages */
133134
const USAGE_HINT = "sentry issue list <org>/<project>";
134135

135-
/**
136-
* Maximum --limit value (user-facing ceiling for practical CLI response times).
137-
* Auto-pagination can theoretically fetch more, but 1000 keeps responses reasonable.
138-
*/
139-
const MAX_LIMIT = 1000;
140-
141136
/** Options returned by {@link buildListApiOptions}. */
142137
type ListApiOptions = {
143138
/** Fields to collapse (omit) from the API response for performance. */
@@ -1374,7 +1369,7 @@ async function handleResolvedTargets(
13741369

13751370
let moreHint: string | undefined;
13761371
if (hasMoreToShow) {
1377-
const higherLimit = Math.min(flags.limit * 2, MAX_LIMIT);
1372+
const higherLimit = Math.min(flags.limit * 2, LIST_MAX_LIMIT);
13781373
const canIncreaseLimit = higherLimit > flags.limit;
13791374
const actionParts: string[] = [];
13801375
if (canIncreaseLimit) {
@@ -1429,7 +1424,7 @@ export const __testing = {
14291424
compareDates,
14301425
parseSort,
14311426
CURSOR_SEP,
1432-
MAX_LIMIT,
1427+
MAX_LIMIT: LIST_MAX_LIMIT,
14331428
VALID_SORT_VALUES,
14341429
};
14351430

@@ -1542,7 +1537,7 @@ export const listCommand = buildListCommand("issue", {
15421537
brief: "Search query (Sentry search syntax)",
15431538
optional: true,
15441539
},
1545-
limit: buildListLimitFlag("issues", "25"),
1540+
limit: buildListLimitFlag("issues"),
15461541
sort: {
15471542
kind: "parsed",
15481543
parse: parseSort,
@@ -1586,9 +1581,9 @@ export const listCommand = buildListCommand("issue", {
15861581
if (flags.limit < 1) {
15871582
throw new ValidationError("--limit must be at least 1.", "limit");
15881583
}
1589-
if (flags.limit > MAX_LIMIT) {
1584+
if (flags.limit > LIST_MAX_LIMIT) {
15901585
throw new ValidationError(
1591-
`--limit cannot exceed ${MAX_LIMIT}. ` +
1586+
`--limit cannot exceed ${LIST_MAX_LIMIT}. ` +
15921587
"Use --cursor to paginate through larger result sets.",
15931588
"limit"
15941589
);

0 commit comments

Comments
 (0)