From 6c40999bd360789f05c27e851ab0113efed4fde1 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 28 Oct 2026 23:58:08 +0000 Subject: [PATCH] ref(cli): Move agent-conversation list onto the org-optional target positional agent-conversation list declared its target with LIST_TARGET_POSITIONAL and called resolveOrgOptionalFromArg in func. It now uses orgOptionalTarget and awaits target.resolved, like feedback list, replay list and explore. Resolution still goes through resolveOrgOptionalTarget with the same command name. Refs #1564 Co-Authored-By: BYK --- .../src/commands/agent-conversation/list.ts | 32 +++++++++++++------ .../commands/agent-conversation/list.test.ts | 7 ++-- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/packages/cli/src/commands/agent-conversation/list.ts b/packages/cli/src/commands/agent-conversation/list.ts index 3c915269a..1297e1d6e 100644 --- a/packages/cli/src/commands/agent-conversation/list.ts +++ b/packages/cli/src/commands/agent-conversation/list.ts @@ -24,16 +24,17 @@ import { LIST_MAX_LIMIT, LIST_MIN_LIMIT, LIST_PERIOD_FLAG, - LIST_TARGET_POSITIONAL, + ORG_ALL_TARGET_BRIEF, PERIOD_ALIASES, paginationHint, targetPatternExplanation, } from "../../lib/list-command.js"; import { withProgress } from "../../lib/polling.js"; +import { toNumericId } from "../../lib/resolve-target.js"; import { - resolveOrgOptionalFromArg, - toNumericId, -} from "../../lib/resolve-target.js"; + type OrgOptionalTarget, + orgOptionalTarget, +} from "../../lib/target-positional.js"; import { appendPeriodHint, serializeTimeRange, @@ -86,7 +87,6 @@ type ConversationListResult = { project?: string; }; -const COMMAND_NAME = "agent-conversation list"; const PAGINATION_KEY = "agent-conversation-list"; const DEFAULT_PERIOD = "7d"; @@ -194,7 +194,17 @@ export const listCommand = buildListCommand("agent-conversation", { schema: ConversationListItemSchema, }, parameters: { - positional: LIST_TARGET_POSITIONAL, + positional: { + kind: "tuple", + parameters: [ + { + placeholder: "org/project", + brief: ORG_ALL_TARGET_BRIEF, + parse: orgOptionalTarget, + optional: true, + }, + ], + }, flags: { limit: { kind: "parsed", @@ -225,10 +235,12 @@ export const listCommand = buildListCommand("agent-conversation", { s: "sort", }, }, - async *func(this: SentryContext, flags: ListFlags, target?: string) { - const { cwd } = this; - - const resolved = await resolveOrgOptionalFromArg(target, cwd, COMMAND_NAME); + async *func( + this: SentryContext, + flags: ListFlags, + target: OrgOptionalTarget, + ) { + const resolved = await target.resolved; const { org, project } = resolved; let projectId: number | undefined; if (project) { diff --git a/packages/cli/test/commands/agent-conversation/list.test.ts b/packages/cli/test/commands/agent-conversation/list.test.ts index 4b80d1d28..b042846fb 100644 --- a/packages/cli/test/commands/agent-conversation/list.test.ts +++ b/packages/cli/test/commands/agent-conversation/list.test.ts @@ -103,6 +103,7 @@ function createMockContext() { stdout: { write: stdoutWrite }, stderr: { write: stderrWrite }, cwd: "/tmp", + commandPrefix: ["sentry", "agent-conversation", "list"], }, stdoutWrite, stderrWrite, @@ -208,7 +209,7 @@ describe("listCommand.func", () => { getProjectSpy = vi.spyOn(apiClient, "getProject"); listConversationsSpy = vi.spyOn(apiClient, "listConversations"); resolveTargetSpy = vi - .spyOn(resolveTarget, "resolveOrgOptionalFromArg") + .spyOn(resolveTarget, "resolveOrgOptionalTarget") .mockResolvedValue({ org: ORG }); withProgressSpy = vi .spyOn(polling, "withProgress") @@ -246,7 +247,7 @@ describe("listCommand.func", () => { await func.call(context, JSON_FLAGS, `${ORG}/`); expect(resolveTargetSpy).toHaveBeenCalledWith( - `${ORG}/`, + { type: "org-all", org: ORG }, "/tmp", "agent-conversation list", ); @@ -268,7 +269,7 @@ describe("listCommand.func", () => { await func.call(context, JSON_FLAGS, undefined); expect(resolveTargetSpy).toHaveBeenCalledWith( - undefined, + { type: "auto-detect" }, "/tmp", "agent-conversation list", );