Skip to content

Commit 4ac5c55

Browse files
committed
fix: address bot review comments
- handleOrgAll: apply withOrg mapping so ORG column is populated in paginated output - handleOrgAllIssues: use isMultiProject=true in header (already true in row formatOptions) - displayFetchedItems: add orgSlugForHint field so truncation hint emits valid CLI command - project/list: move resolveCursor inside org-all override closure so ValidationError fires before ContextError - list-command.ts: clean up leftover syntax fragment from reverted bare-slug change - Update PR description: bare slug = project search (consistent across all list commands)
1 parent 7c02d9f commit 4ac5c55

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

src/commands/issue/list.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,10 @@ async function handleOrgAllIssues(options: OrgAllIssuesOptions): Promise<void> {
446446
return;
447447
}
448448

449-
writeListHeader(stdout, `Issues in ${org}`, false);
449+
// isMultiProject=true: org-all shows issues from every project, so the ALIAS
450+
// column is needed to identify which project each issue belongs to.
451+
writeListHeader(stdout, `Issues in ${org}`, true);
450452
const termWidth = process.stdout.columns || 80;
451-
// isMultiProject=true so the ALIAS column shows which project each issue belongs to
452453
const issuesWithOpts = response.data.map((issue) => ({
453454
issue,
454455
formatOptions: {

src/commands/project/list.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,6 @@ export const listCommand = buildCommand({
664664
const { stdout, cwd } = this;
665665

666666
const parsed = parseOrgProjectArg(target);
667-
const contextKey = buildContextKey(parsed, flags, getApiBaseUrl());
668-
const cursor = resolveCursor(flags.cursor, contextKey);
669667

670668
await dispatchOrgScopedList({
671669
config: projectListMeta,
@@ -682,14 +680,14 @@ export const listCommand = buildCommand({
682680
parsed.type === "explicit" ? parsed.project : "",
683681
flags
684682
),
685-
"org-all": () =>
686-
handleOrgAll({
687-
stdout,
688-
org: parsed.type === "org-all" ? parsed.org : "",
689-
flags,
690-
contextKey,
691-
cursor,
692-
}),
683+
"org-all": () => {
684+
// Build context key and resolve cursor only in org-all mode, after
685+
// dispatchOrgScopedList has already validated --cursor is allowed here.
686+
const org = parsed.type === "org-all" ? parsed.org : "";
687+
const contextKey = buildContextKey(parsed, flags, getApiBaseUrl());
688+
const cursor = resolveCursor(flags.cursor, contextKey);
689+
return handleOrgAll({ stdout, org, flags, contextKey, cursor });
690+
},
693691
"project-search": () =>
694692
handleProjectSearch(
695693
stdout,

src/lib/org-list.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ export async function handleOrgAll<TEntity, TWithOrg>(
225225
perPage: flags.limit,
226226
});
227227

228-
const { data: items, nextCursor } = response;
228+
const { data: rawItems, nextCursor } = response;
229+
// Attach org context to each entity so displayTable can show the ORG column
230+
const items = rawItems.map((entity) => config.withOrg(entity, org));
229231
const hasMore = !!nextCursor;
230232

231233
if (nextCursor) {
@@ -255,7 +257,7 @@ export async function handleOrgAll<TEntity, TWithOrg>(
255257
return;
256258
}
257259

258-
config.displayTable(stdout, items as unknown as TWithOrg[]);
260+
config.displayTable(stdout, items);
259261

260262
if (hasMore) {
261263
stdout.write(
@@ -341,7 +343,15 @@ type DisplayFetchedItemsOptions<TEntity, TWithOrg> = {
341343
stdout: Writer;
342344
items: TWithOrg[];
343345
flags: BaseListFlags;
346+
/** Human-readable context for "No X found in <label>" messages (e.g. "organization 'my-org'"). */
344347
contextLabel: string;
348+
/**
349+
* Raw org slug for the pagination hint command (e.g. "my-org").
350+
* When provided and results are truncated, emits a hint like
351+
* `sentry team list my-org/ for paginated results`.
352+
* Omit when there is no meaningful paginated target (e.g. project-scoped fetch).
353+
*/
354+
orgSlugForHint?: string;
345355
};
346356

347357
/**
@@ -351,7 +361,7 @@ type DisplayFetchedItemsOptions<TEntity, TWithOrg> = {
351361
function displayFetchedItems<TEntity, TWithOrg>(
352362
opts: DisplayFetchedItemsOptions<TEntity, TWithOrg>
353363
): void {
354-
const { config, stdout, items, flags, contextLabel } = opts;
364+
const { config, stdout, items, flags, contextLabel, orgSlugForHint } = opts;
355365
const limited = items.slice(0, flags.limit);
356366

357367
if (flags.json) {
@@ -367,9 +377,11 @@ function displayFetchedItems<TEntity, TWithOrg>(
367377
config.displayTable(stdout, limited);
368378

369379
if (items.length > limited.length) {
380+
const hint = orgSlugForHint
381+
? ` Use '${config.commandPrefix} ${orgSlugForHint}/' for paginated results.`
382+
: "";
370383
stdout.write(
371-
`\nShowing ${limited.length} of ${items.length} ${config.entityPlural}. ` +
372-
`Use '${config.commandPrefix} ${contextLabel}/' for paginated results.\n`
384+
`\nShowing ${limited.length} of ${items.length} ${config.entityPlural}.${hint}\n`
373385
);
374386
} else {
375387
stdout.write(`\nShowing ${limited.length} ${config.entityPlural}\n`);
@@ -410,6 +422,7 @@ export async function handleExplicitOrg<TEntity, TWithOrg>(
410422
items,
411423
flags,
412424
contextLabel: `organization '${org}'`,
425+
orgSlugForHint: org,
413426
});
414427

415428
if (!flags.json && items.length > 0) {
@@ -455,6 +468,7 @@ export async function handleExplicitProject<TEntity, TWithOrg>(
455468
items,
456469
flags,
457470
contextLabel: `project '${org}/${project}'`,
471+
// No orgSlugForHint: the footer already points to `${org}/` for pagination
458472
});
459473

460474
if (!flags.json && items.length > 0) {

0 commit comments

Comments
 (0)