Skip to content

feat(config): support .sentryclirc config file for per-directory defaults#693

Open
BYK wants to merge 1 commit intomainfrom
feat/sentryclirc-config
Open

feat(config): support .sentryclirc config file for per-directory defaults#693
BYK wants to merge 1 commit intomainfrom
feat/sentryclirc-config

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 8, 2026

Summary

  • Adds backward-compatible .sentryclirc INI config file support, matching the legacy sentry-cli format
  • Walks up from CWD to find config files, merging them (closest file wins per-field) with ~/.sentryclirc as global fallback
  • Enables per-directory org/project defaults for monorepos
  • Token and URL are applied via env shim (SENTRY_AUTH_TOKEN, SENTRY_URL); org/project are inserted directly into the resolution chain with source tracking

Resolution chain (updated)

1. Explicit CLI args          (highest)
2. Environment variables
3. .sentryclirc file          ← NEW
4. SQLite defaults
5. DSN auto-detection
6. Directory name inference   (lowest)

Monorepo example

monorepo/
  .sentryclirc              # [defaults] org = my-company
  packages/
    frontend/.sentryclirc   # [defaults] project = frontend-web
    backend/.sentryclirc    # [defaults] project = backend-api

New files

File Purpose
src/lib/ini.ts Zero-dep INI parser (BOM, quotes, case-insensitive)
src/lib/sentryclirc.ts Walk-up discovery + merge + env shim + cache
test/lib/ini.test.ts 26 unit tests
test/lib/ini.property.test.ts 6 property-based tests (fast-check)
test/lib/sentryclirc.test.ts 24 unit tests
test/lib/sentryclirc.property.test.ts 3 property-based tests

Modified files

  • src/cli.ts — call applySentryCliRcEnvShim() early in boot
  • src/lib/resolve-target.ts — insert step 3 in all 4 resolution functions
  • docs/src/content/docs/configuration.md — new .sentryclirc section with monorepo guide
  • docs/src/content/docs/features.md — link to resolution priority + tip
  • docs/src/content/docs/agent-guidance.md — updated auto-detection references
  • plugins/sentry-cli/skills/sentry-cli/SKILL.md — regenerated

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 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 ✨

  • (commands) Add buildRouteMap wrapper with standard subcommand aliases by BYK in #690
  • (config) Support .sentryclirc config file for per-directory defaults by BYK in #693

Bug Fixes 🐛

  • (init,feedback) Default to tracing only in feature select and attach user email to feedback by MathurAditya724 in #688

Internal Changes 🔧

  • (eval) Replace OpenAI with Anthropic SDK in init-eval judge by betegon in #683
  • (init) Use markdown pipeline for spinner messages by betegon in #686
  • Regenerate skill files and command docs by github-actions[bot] in 584ec0e0

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-04-08 20:16 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Codecov Results 📊

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

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 86.18%. Project has 1508 uncovered lines.
❌ Project coverage is 95.4%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
src/lib/resolve-target.ts 34.88% ⚠️ 28 Missing
src/lib/sentryclirc.ts 98.40% ⚠️ 2 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.44%    95.40%    -0.04%
==========================================
  Files          224       226        +2
  Lines        32538     32754      +216
  Branches         0         0         —
==========================================
+ Hits         31052     31246      +194
- Misses        1486      1508       +22
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK force-pushed the feat/sentryclirc-config branch 2 times, most recently from 7ca1150 to e0b746c Compare April 8, 2026 19:42
@BYK BYK marked this pull request as ready for review April 8, 2026 19:42
@BYK BYK force-pushed the feat/sentryclirc-config branch from e0b746c to c0ef499 Compare April 8, 2026 20:00
@BYK BYK force-pushed the feat/sentryclirc-config branch from c0ef499 to 8d86cbd Compare April 8, 2026 20:09
Copy link
Copy Markdown
Contributor

@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.

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 8d86cbd. Configure here.

…ults

Add backward-compatible support for .sentryclirc INI config files.
The CLI walks up from CWD to find config files, merging them
(closest wins per-field) with ~/.sentryclirc as a global fallback.

Supported fields:
- [defaults] org, project, url
- [auth] token

Token and URL are applied via env shim (SENTRY_AUTH_TOKEN, SENTRY_URL).
Org and project are inserted into the resolution chain between env vars
and SQLite defaults with source tracking.

This enables per-directory project defaults in monorepos and seamless
migration from legacy sentry-cli.
@BYK BYK force-pushed the feat/sentryclirc-config branch from 8d86cbd to 465e9f9 Compare April 8, 2026 20:15
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