Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

refactor: generalize resolveOrgProjectTarget to support org-all mode #860

Closed

Description

@BYK

Context

In PR #857 (sentry explore), the command needs to resolve a target that supports all 4 modes from parseOrgProjectArg:

  • <org>/<project> → explicit org + project
  • <org>/ → org-all (no project filter)
  • <project> (bare) → fuzzy project search across orgs
  • (omitted) → auto-detect from DSN/config

The existing resolveOrgProjectTarget in src/lib/resolve-target.ts handles 3 of 4 modes but rejects org-all with a ContextError (since most commands require a project). It also returns project as required (non-optional).

This forced explore to define a local resolveExploreTarget() that's thin glue over the same shared helpers (parseOrgProjectArg + resolveProjectBySlug + resolveOrg).

Ref: #857 (comment)

Proposal

Generalize resolveOrgProjectTarget (or add a sibling) to support org-all mode:

type ResolvedOrgOptionalProject = {
  org: string;
  project?: string;
  projectData?: SentryProject;
};

export async function resolveOrgOptionalProjectTarget(
  parsed: ParsedOrgProject,
  cwd: string,
  commandName: string
): Promise<ResolvedOrgOptionalProject>;

When parsed.type === "org-all", return { org: parsed.org } instead of throwing. All other modes behave identically to the current resolveOrgProjectTarget.

Commands that would benefit

  • sentry explore — currently uses local resolveExploreTarget
  • Any future command that accepts <org>/ as a valid target (e.g., org-scoped analytics)

Files

  • src/lib/resolve-target.ts — add resolveOrgOptionalProjectTarget or extend resolveOrgProjectTarget with an options flag
  • src/commands/explore.ts — replace local resolveExploreTarget with the shared helper

Activity

  1. self-assigned this
    on Apr 29, 2026
  2. added a commit that references this issue on Apr 29, 2026
    d1ca245
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions