Skip to content

feat(organizations): add sanity organizations list command#768

Closed
runeb wants to merge 1 commit intomainfrom
feat/organizations-list
Closed

feat(organizations): add sanity organizations list command#768
runeb wants to merge 1 commit intomainfrom
feat/organizations-list

Conversation

@runeb
Copy link
Copy Markdown
Member

@runeb runeb commented Mar 24, 2026

Adds sanity organizations list to display organizations the user has access to.

Displays id, name, and slug in a tabular format. Supports --sort and --order flags matching the projects list pattern. Includes singular topic alias so sanity organization list also works.

Adds a command to list organizations the user has access to, displaying
ID, name, and slug in a tabular format. Supports --sort and --order flags.

Includes singular topic alias so `sanity organization list` also works.

This addresses a gap where agents and CI systems had to query the REST API
directly to discover organization IDs needed for `sanity init --organization`.
@runeb runeb requested a review from a team as a code owner March 24, 2026 05:30
@runeb runeb requested review from mariuslundgard and removed request for a team March 24, 2026 05:30
@claude
Copy link
Copy Markdown

claude Bot commented Mar 24, 2026

Claude finished @runeb's task in 55s —— View job


Review

ProjectOrganization.slug type mismatch

organizations.ts:9 defines slug: string, but list.ts:47 uses slug ?? '' (null guard) and list.test.ts:114 passes slug: null. The interface should be slug: string | null to match actual API behavior. The null guard in the command is correct, but the interface type needs fixing so TypeScript enforces proper handling elsewhere.

Fix this →

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 24, 2026

Coverage Delta

File Statements
packages/@sanity/cli/src/commands/organizations/list.ts 100.0% (new)
packages/@sanity/cli/src/topicAliases.ts 100.0% (±0%)

Comparing 2 changed files against main @ 75d5154f6bd1eb3a9d344c1d65e91775c40ae345

Overall Coverage

Metric Coverage
Statements 83.0% (+ 0.0%)
Branches 72.7% (+ 0.0%)
Functions 83.3% (+ 0.0%)
Lines 83.5% (+ 0.0%)

@runeb
Copy link
Copy Markdown
Member Author

runeb commented Mar 24, 2026

Closing in favor of #762 which adds full organizations CRUD commands.

@runeb runeb closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant