Skip to content

feat(init): add create-sentry-project local op with org resolution fallback#333

Merged
betegon merged 7 commits intofeat/init-commandfrom
feat/init-create-sentry-project
Mar 4, 2026
Merged

feat(init): add create-sentry-project local op with org resolution fallback#333
betegon merged 7 commits intofeat/init-commandfrom
feat/init-create-sentry-project

Conversation

@betegon
Copy link
Member

@betegon betegon commented Mar 4, 2026

Summary

Adds the create-sentry-project local operation so the remote workflow can ask the CLI to create a Sentry project. Resolves the org via local config / env vars first, falling back to listing orgs from the API (auto-selects if only one, prompts interactively if multiple).

Changes

  • New createSentryProject handler in local-ops.ts with extracted resolveOrgSlug helper that handles all org resolution paths (config, single-org auto-select, multi-org interactive prompt, --yes guard)
  • CreateSentryProjectPayload type added to types.ts
  • Test suite covering success, single-org fallback, no-orgs, multi-org --yes, interactive select, user cancel, API error, and missing DSN paths
  • Downstream mock setup extracted into mockDownstreamSuccess helper to reduce test duplication

Test Plan

bun test test/lib/init/local-ops.create-sentry-project.test.ts  # 8 pass
bun run lint  # clean

betegon and others added 2 commits March 4, 2026 12:11
…llback

Adds a new `create-sentry-project` local operation that resolves the org
(via local config, env, or interactive API fallback), resolves/creates a
team, creates the project, fetches the DSN, and returns all details.

Includes tests with extracted `mockDownstreamSuccess` helper and coverage
for the cancel path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Init

  • Add create-sentry-project local op with org resolution fallback by betegon in #333
  • Add init command for guided Sentry project setup by betegon in #283

Trace

Other

  • (api) Add --data/-d flag and auto-detect JSON body in fields by BYK in #320
  • (formatters) Render all terminal output as markdown by BYK in #297
  • (issue-list) Global limit with fair distribution, compound cursor, and richer progress by BYK in #306
  • (project) Add project create command by betegon in #237
  • (upgrade) Add binary delta patching via TRDIFF10/bsdiff by BYK in #327

Bug Fixes 🐛

Api

  • Use numeric project ID to avoid "not actively selected" error by betegon in #312
  • Use limit param for issues endpoint page size by BYK in #309
  • Auto-correct ':' to '=' in --field values with a warning by BYK in #302

Formatters

  • Expand streaming table to fill terminal width by betegon in #314
  • Fix HTML entities and escaped underscores in table output by betegon in #313

Setup

  • Suppress agent skills and welcome messages on upgrade by BYK in #328
  • Suppress shell completion messages on upgrade by BYK in #326

Other

  • (ci) Generate JUnit XML to silence codecov-action warnings by BYK in #300
  • (install) Fix nightly digest extraction on macOS by BYK in #331
  • (nightly) Push to GHCR from artifacts dir so layer titles are bare filenames by BYK in #301
  • (region) Resolve DSN org prefix at resolution layer by BYK in #316
  • (test) Handle 0/-0 in getComparator anti-symmetry property test by BYK in #308
  • (trace-logs) Timestamp_precise is a number, not a string by BYK in #323
  • Added auth headers in the mastra client by MathurAditya724 in #264

Internal Changes 🔧

Api

  • Upgrade @sentry/api to 0.21.0, remove raw HTTP pagination workarounds by BYK in #321
  • Wire listIssuesPaginated through @sentry/api SDK for type safety by BYK in #310

Other

  • (craft) Add sentry-release-registry target by BYK in #325

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Codecov Results 📊

100 passed | Total: 100 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -2531
Passed Tests 📉 -2531
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 95.74%. Project has 3197 uncovered lines.
✅ Project coverage is 82.91%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
create.ts 95.60% ⚠️ 11 Missing
local-ops.ts 97.59% ⚠️ 11 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    82.43%    82.91%    +0.48%
==========================================
  Files          126       133        +7
  Lines        17792     18704      +912
  Branches         0         0         —
==========================================
+ Hits         14666     15507      +841
- Misses        3126      3197       +71
- Partials         0         0         —

Generated by Codecov Action

betegon and others added 3 commits March 4, 2026 14:38
Fixes TS2532 where TypeScript couldn't infer that orgs[0] is defined
after checking orgs.length === 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… slug

Biome's noNonNullAssertion rule disallows `!`. Use `&& orgs[0]` guard
to narrow the type safely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@betegon betegon marked this pull request as ready for review March 4, 2026 13:51
Move the shared `slugify` function to `src/lib/utils.ts` and import it
in both consumers (`project/create.ts` and `local-ops.ts`) to avoid
duplicated logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
slugify(name) can produce an empty string when the project name contains
only special characters, which silently skips team auto-creation and
results in a confusing "No teams found" error. Pre-compute the slug and
return an early error if it's empty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@betegon betegon merged commit 30eb4e8 into feat/init-command Mar 4, 2026
16 checks passed
@betegon betegon deleted the feat/init-create-sentry-project branch March 4, 2026 15:46
Copy link

@cursor cursor bot left a comment

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.

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

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