Skip to content

Commit 9ca29c1

Browse files
betegonclaude
andcommitted
fix(project): show org-fallback note above the table, not below
Use a `title` field rendered before the table (like issue list does) instead of `header` which renders after. This matches the pattern in issue list, trace list, and span list for pre-table context. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1783639 commit 9ca29c1

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/commands/project/list.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ import {
5858
import { getApiBaseUrl } from "../../lib/sentry-client.js";
5959
import type { SentryProject } from "../../types/index.js";
6060

61+
/** Extended result type with optional title shown above the table. */
62+
type ProjectListResult = ListResult<ProjectWithOrg> & { title?: string };
63+
6164
/** Command key for pagination cursor storage */
6265
export const PAGINATION_KEY = "project-list";
6366

@@ -538,9 +541,9 @@ export async function handleProjectSearch(
538541
contextKey,
539542
cursor: undefined,
540543
});
541-
const note = `'${projectSlug}' is an organization, not a project. Showing all projects in '${projectSlug}'.`;
542-
result.header = result.header ? `${note}\n${result.header}` : note;
543-
return result;
544+
const r = result as ProjectListResult;
545+
r.title = `'${projectSlug}' is an organization, not a project. Showing all projects in '${projectSlug}'`;
546+
return r;
544547
}
545548

546549
// JSON mode returns empty array; human mode throws a helpful error
@@ -601,11 +604,16 @@ export const listCommand = buildListCommand("project", {
601604
"Alias: `sentry projects` → `sentry project list`",
602605
},
603606
output: {
604-
human: (result: ListResult<ProjectWithOrg>) => {
607+
human: (data: ListResult<ProjectWithOrg>) => {
608+
const result = data as ProjectListResult;
605609
if (result.items.length === 0) {
606610
return result.hint ?? "No projects found.";
607611
}
608-
const parts: string[] = [displayProjectTable(result.items)];
612+
const parts: string[] = [];
613+
if (result.title) {
614+
parts.push(`\n${result.title}\n\n`);
615+
}
616+
parts.push(displayProjectTable(result.items));
609617
if (result.header) {
610618
parts.push(`\n${result.header}`);
611619
}

0 commit comments

Comments
 (0)