Skip to content

refactor(commands): replace --org/--project flags with positional args for event view#205

Merged
BYK merged 3 commits intomainfrom
refactor/positional-args-non-profile
Feb 5, 2026
Merged

refactor(commands): replace --org/--project flags with positional args for event view#205
BYK merged 3 commits intomainfrom
refactor/positional-args-non-profile

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 5, 2026

Summary

  • Migrate event view command from --org/--project flags to <org>/<project> positional argument syntax
  • Update all error messages and hints to use the new positional syntax
  • Update documentation (CONTRIBUTING.md, issue.md, features.md)
  • Add unit tests for positional arg parsing

Motivation

Ensures consistency with other commands like issue list and project list which already use positional args. The <org>/<project> syntax is more concise and follows gh CLI conventions.

Changes

Command updated:

  • sentry event view [<org>/<project>] <event-id> - now takes optional positional target

Error messages updated:

  • src/lib/dsn/errors.ts - 4 hints updated
  • src/lib/resolve-target.ts - JSDoc and default usageHint values updated
  • src/lib/dsn/resolver.ts - Error message updated
  • src/commands/project/view.ts - Error message updated

Documentation updated:

  • CONTRIBUTING.md - Command patterns documentation
  • docs/src/content/docs/commands/issue.md - Plan command section
  • docs/src/content/docs/features.md - Examples
  • plugins/sentry-cli/skills/sentry-cli/SKILL.md - Regenerated

Testing

  • All tests pass
  • Typecheck passes
  • Lint passes

…s for event view

Migrate event view command from --org/--project flags to use the
<org>/<project> positional argument syntax for consistency with other
commands like issue list and project list.

Changes:
- event view now uses: sentry event view [<org>/<project>] <event-id>
- Updated error messages and hints to use positional syntax
- Updated documentation (CONTRIBUTING.md, issue.md, features.md)
- Added unit tests for parsePositionalArgs
- Regenerated SKILL.md
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

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


Internal Changes 🔧

  • (commands) Replace --org/--project flags with positional args for event view by BYK in #205

Other

  • test: add tests for project-cache and env-file modules by BYK in #200

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-02-05 23:09 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Codecov Results 📊

❌ Patch coverage is 33.33%. Project has 2018 uncovered lines.
❌ Project coverage is 75.64%. Comparing base (base) to head (head).

Files with missing lines (40)
File Patch % Lines
human.ts 53.59% ⚠️ 388 Missing
resolve-target.ts 15.28% ⚠️ 366 Missing
oauth.ts 25.10% ⚠️ 194 Missing
api-client.ts 70.62% ⚠️ 176 Missing
upgrade.ts 45.49% ⚠️ 139 Missing
view.ts 33.71% ⚠️ 116 Missing
migration.ts 47.44% ⚠️ 82 Missing
browser.ts 4.11% ⚠️ 70 Missing
span-tree.ts 5.00% ⚠️ 57 Missing
telemetry.ts 77.51% ⚠️ 56 Missing
api.ts 89.80% ⚠️ 47 Missing
seer.ts 75.54% ⚠️ 45 Missing
schema.ts 89.56% ⚠️ 40 Missing
seer.ts 79.87% ⚠️ 30 Missing
preload.ts 53.23% ⚠️ 29 Missing
utils.ts 88.94% ⚠️ 25 Missing
detector.ts 90.10% ⚠️ 20 Missing
output.ts 15.00% ⚠️ 17 Missing
code-scanner.ts 95.00% ⚠️ 16 Missing
arg-parsing.ts 90.00% ⚠️ 12 Missing
dsn-cache.ts 94.62% ⚠️ 12 Missing
fix.ts 83.61% ⚠️ 10 Missing
qrcode.ts 33.33% ⚠️ 10 Missing
fs-utils.ts 57.14% ⚠️ 9 Missing
project-root.ts 97.73% ⚠️ 7 Missing
version-check.ts 91.14% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
auth.ts 95.52% ⚠️ 6 Missing
upgrade.ts 93.83% ⚠️ 5 Missing
resolver.ts 94.57% ⚠️ 5 Missing
index.ts 95.96% ⚠️ 4 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
project-root-cache.ts 96.92% ⚠️ 2 Missing
json.ts 33.33% ⚠️ 2 Missing
alias.ts 99.28% ⚠️ 1 Missing
env-file.ts 99.19% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
colors.ts 97.96% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    77.99%    75.64%    -2.35%
==========================================
  Files           58        65        +7
  Lines         7933      8285      +352
  Branches         0         0         —
==========================================
+ Hits          6187      6267       +80
- Misses        1746      2018      +272
- Partials         0         0         —

Generated by Codecov Action

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 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Fix foundProject.organization?.slug bug (use orgSlug instead)
- Make formatMultipleProjectsFooter generic (not hardcoded to issue list)
- Fix ContextError misuse producing garbled messages:
  - Use ValidationError for 'multiple orgs' error
  - Use ValidationError for 'invalid target' error
  - Use noun phrase 'Specific project' for OrgAll case
- Update dsn/errors.ts to use generic 'sentry <command>' in hints
- Update test expectations to match new messages
@BYK BYK merged commit 4164a09 into main Feb 5, 2026
25 checks passed
@BYK BYK deleted the refactor/positional-args-non-profile branch February 5, 2026 23:50
BYK added a commit that referenced this pull request Feb 6, 2026
## Summary

Adds unit tests for the `resolveFromProjectSearch` function in
`src/commands/event/view.ts` to improve patch coverage.

## Changes

**`src/commands/event/view.ts`:**
- Export `resolveFromProjectSearch` function for testing
- Export `ResolvedEventTarget` type for testing
- Add JSDoc documentation for the exported function

**`test/commands/event/view.test.ts`:**
- Add 8 new tests for `resolveFromProjectSearch`:
- **No projects found:** throws `ContextError` with project name and
usage hint
- **Multiple projects found:** throws `ValidationError` with list of
orgs and usage example
- **Single project found:** returns resolved target with org/project
info
- Use `spyOn` to mock `findProjectsBySlug` without complex module
mocking

## Testing

```bash
bun test test/commands/event/view.test.ts
# 18 pass, 0 fail
```

## Motivation

PR #205 had 33% patch coverage, below the 80% threshold. This PR adds
tests for the `resolveFromProjectSearch` function which handles the
project-search case when users specify just a project slug without an
org.
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