-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat(issue): replace --org/--project flags with <org>/ID syntax #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replace explicit --org and --project flags with a more intuitive positional syntax for issue commands (view, explain, plan). New issue ID formats: - <org>/ID: Explicit org prefix (e.g., sentry/EXTENSION-7) - <project>-suffix: Project + suffix (e.g., cli-G) - searches across orgs - suffix: Short suffix only (e.g., G) - requires DSN context - numeric: Direct fetch by numeric ID (e.g., 123456789) Resolution logic: 1. Alias cache lookup (fast, local) 2. Project search across accessible orgs 3. DSN detection for project context Closes CLI-16
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ Patch coverage is 85.57%. Project has 2022 uncovered lines. Files with missing lines (29)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 69.68% 69.20% -0.48%
==========================================
Files 56 57 +1
Lines 6462 6565 +103
Branches 0 0 —
==========================================
+ Hits 4503 4543 +40
- Misses 1959 2022 +63
- Partials 0 0 —Generated by Codecov Action |
|
Good question! While both functions share the "split on slash" pattern for org prefix, they serve different purposes with different downstream handling:
The only overlap is the 3-line slash detection. Merging them would mix concerns and require callers to handle cases they don't care about. I think keeping them separate is cleaner. That said, if you'd prefer, I could extract a tiny |
Extract shared org/project parsing logic into src/lib/arg-parsing.ts: - Move parseOrgProjectArg from resolve-target.ts - Refactor parseIssueArg to use parseOrgProjectArg for left part of dash-separated inputs - Flatten ParsedIssueArg types for better ergonomics New parseIssueArg flow: 1. Split on last '-' to get (leftPart, suffix) 2. Pass leftPart through parseOrgProjectArg 3. Combine with suffix into flattened result types This consolidates the org/project parsing pattern used by both issue list (org/project targets) and issue view/explain/plan (issue IDs).
|
Done! I've consolidated the parsing logic as suggested in commit c21779b: New structure:
Flow for
Invalid combinations rejected at parse time:
This consolidates the org/project parsing pattern used by both listing commands and single-item commands. |
- Remove unused splitProjectSuffix function (dead code) - Replace with isNumericId helper for detecting pure numeric IDs - Fix buildCommandHint to suggest <org>/ID for numeric IDs instead of incorrectly suggesting <project>-ID - Add tests for isNumericId and buildCommandHint
- Remove duplicate NUMERIC_ID_PATTERN, import isNumericId from issue-id.ts - Remove ASCII-art style separator comment - Add validation for empty suffixes (trailing dash like 'cli-') - Add validation for missing issue ID after slash (like 'org/') - Add tests for empty suffix error cases
There was a problem hiding this 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.
- Remove DSN fallback from resolveExplicitOrgSuffix - mixing explicit
org with DSN-detected project (which belongs to a different org) is
semantically wrong and confusing
- Add validation for empty project slug in parseOrgProjectArg ('/')
- Add test for '/' input throwing error
Summary
Replace explicit
--organd--projectflags with a more intuitive positional syntax for issue commands (view,explain,plan).Closes CLI-16 - User got unhelpful error when running
sentry issue view EXTENSION-7without org context.New Issue ID Formats
<org>/IDsentry/EXTENSION-7<project>-suffixcli-GsuffixGnumeric123456789Resolution Logic
issue listresultsExamples
Changes
src/commands/issue/{view,explain,plan}.ts- Updated to use new syntaxsrc/commands/issue/utils.ts- New resolution logic withfindProjectsBySlug()src/lib/issue-id.ts- New parsing functions for issue ID formatstest/commands/issue/utils.test.ts- Updated tests for new API