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

feat(project): create multiple projects in one command - #1191

Merged
betegon merged 2 commits into
mainfrom
fix/project-create-multiple
Aug 3, 2026
Merged

betegon merged 2 commits into
mainfrom
fix/project-create-multiple

Conversation

@betegon

@betegon betegon commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

Summary

sentry project create can now create any number of projects in one invocation. Every project is a [<org>/]<name>:<platform> pair — the platform is always attached with :. There is no space-separated form; we do not add a --platform / -p flag either.

CLI contract

Input Result
project1:javascript Create one project, org auto-detected
acme/project1:javascript Create one project in an explicit org
project1:javascript project2:python-django Create multiple projects, each with its own platform
project1 javascript Rejected: the platform must be attached with : — use project1:javascript
web api node Rejected: one trailing platform cannot describe multiple projects
--platform node Unsupported: platform is always part of the pair

Parsing is deterministic:

  • Every non-empty positional must be a [<org>/]<name>:<platform> pair.
  • A single positional with no : at all gets a friendlier "platform is required" error instead of the generic syntax error.
  • The final : separates name and platform, so a project name containing a colon remains valid: sentry project create api:europe:node.
  • All projects in a batch belong to one organization. Conflicting explicit organization prefixes are rejected.

Examples

# One project: org auto-detected
sentry project create project1:javascript

# One project: explicit org
sentry project create acme/project1:javascript

# Any number of projects
sentry project create project1:javascript project2:python-django worker:node

# Explicit organization for the batch
sentry project create acme/project1:javascript project2:python-django

# Specific team
sentry project create project1:javascript project2:python-django --team backend

# Preview the batch
sentry project create project1:javascript project2:python-django --dry-run

# Machine-readable batch output
sentry project create project1:javascript project2:python-django --json

Platform values use canonical Sentry identifiers. For example, Django is python-django, not django.

Compatibility and intentional behavior change

We're reducing this command down to exactly one shape: [<org>/]<name>:<platform>, org optional, single or batch. That mirrors the org/project convention used everywhere else in the CLI (org can be omitted and auto-detected) while keeping the platform separator unambiguous.

The intentional breaking surface:

  • The space-separated <name> <platform> form is removed entirely, with or without an explicit org. It required a special case in the positional parser to disambiguate a plain two-word invocation from name:platform batch pairs, and matching legacy shell-completion logic, for no real benefit — the colon form already covers both the org-optional and org-explicit cases. sentry project create my-app node is now rejected with a message pointing at my-app:node.
  • Project names containing whitespace are rejected. Quoted multi-word names are rejected. This keeps positional parsing unambiguous and enforces the project-name constraint requested for this command.
  • Trailing-platform batches, such as web api node, are deliberately not supported. Multi-project calls must pair every project with its platform.

Implementation details

  • Creates projects sequentially under one resolved organization.
  • Reuses team selection, including an auto-created team, across the batch.
  • Preserves the historical JSON object for one project; batch and partial-batch output use one JSON array.
  • Emits successful creations before surfacing a later batch error, so partial mutations remain visible.
  • Every positional is parsed the same way regardless of count, so a colon-containing project name (api:europe) is still valid via the final-colon-as-separator rule (api:europe:node).
  • Updates native help, web docs, generated SDK metadata, shell completions, and the bundled Sentry CLI skill.

Test plan

  • pnpm exec vitest run test/commands/project/create.test.ts test/lib/complete.test.ts test/lib/completions.test.ts test/lib/help-positional.test.ts test/lib/introspect.test.ts test/script/generate-skill-markdown.test.ts — 235 passed
  • pnpm run typecheck
  • pnpm run lint
  • pnpm run check:errors
  • pnpm run check:fragments
  • pnpm run check:deps
  • All applicable PR checks are green, including unit, E2E, generated files, build, package smoke tests, CodeQL, Semgrep, Seer, Cursor Bugbot, and Warden.

Related Sentry issue: CLI-1YY

@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1191/

Built to branch gh-pages at 2026-08-03 14:55 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 93.67%. Project has 5478 uncovered lines.
✅ Project coverage is 81.75%. Comparing base (base) to head (head).

Files with missing lines (3)
File Patch % Lines
src/commands/project/create.ts 93.62% ⚠️ 6 Missing and 7 partials
src/lib/complete.ts 92.73% ⚠️ 4 Missing and 3 partials
script/generate-skill-markdown.ts 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.69%    81.75%    +0.06%
==========================================
  Files          426       427        +1
  Lines        29909     30009      +100
  Branches     19433     19524       +91
==========================================
+ Hits         24431     24531      +100
- Misses        5478      5478         —
- Partials      2035      2040        +5

Generated by Codecov Action

@betegon
betegon marked this pull request as ready for review July 3, 2026 14:31
Comment thread src/commands/project/create.ts Resolved
Comment thread src/commands/project/create.ts Resolved
Comment thread src/commands/project/create.ts Resolved
Comment thread src/commands/project/create.ts Resolved
Comment thread src/commands/project/create.ts Resolved
@betegon betegon changed the title fix(project): create multiple projects; clear error on space-crammed names feat(project): create multiple projects in one command Jul 14, 2026
Comment thread src/commands/project/create.ts Resolved
Comment thread src/commands/project/create.ts Resolved
Comment thread src/lib/complete.ts Resolved
sentry project create now accepts any number of [<org>/]<name>:<platform>
pairs in one invocation, creating each project under the same resolved
org. The platform is always attached with ":" — there is no
space-separated form, with or without an explicit org, matching the
org/project convention used elsewhere in the CLI (org optional,
auto-detected when omitted).

Rebased onto the pnpm-workspace monorepo layout (src/ moved under
packages/cli/, docs under apps/cli-docs/); no unrelated files were
touched during the move.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@betegon
betegon force-pushed the fix/project-create-multiple branch from 954da7d to dec974a Compare August 3, 2026 14:40

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dec974a. Configure here.

…r a batch

teamAutoCreateSlug was always slugify(parsed[0].name), and createOneProject
combined it with `?? expectedSlug` — which doesn't fall back on an empty
string, only null/undefined. A first project name that slugifies to ""
(punctuation-only or non-ASCII) disabled team auto-create for the whole
batch in an org with no teams, even when a later project's own name would
have produced a usable slug. Search the whole batch for the first
non-empty slug instead of hard-coding parsed[0].

Found by Cursor Bugbot on PR #1191.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@betegon
betegon merged commit b421031 into main Aug 3, 2026
44 of 46 checks passed
@betegon
betegon deleted the fix/project-create-multiple branch August 3, 2026 16:02
BYK pushed a commit that referenced this pull request Aug 3, 2026
## Summary
- PR #1191 (merged as b421031) introduced the colon-only syntax for
`sentry project create` — `[<org>/]<name>:<platform>...`, no
space-separated form. That decision (rationale, rejected alternatives,
and implementation pointers) was distilled by the background knowledge
process but never reached `main`: the source branch was squash-merged
and its remote ref deleted before the `.lore.md` commit landed, so it
was stranded on an orphaned re-created branch.
- This PR carries over just those two `.lore.md` entries:
- `sentry project create: only colon forms valid — space forms removed
entirely`
- `project create: explain product rationale before making code changes`

## Test plan
- `.lore.md`-only change, no code touched.

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant