Skip to content

feat(issue): add short ID aliases for multi-project support#31

Merged
betegon merged 6 commits intomainfrom
feat/issue-short-aliases
Jan 23, 2026
Merged

feat(issue): add short ID aliases for multi-project support#31
betegon merged 6 commits intomainfrom
feat/issue-short-aliases

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Jan 22, 2026

Summary

Adds short ID aliases for easier issue lookup in monorepos with multiple Sentry projects.

Features

  • Alias-suffix format: Type e-4y instead of SPOTLIGHT-ELECTRON-4Y
  • Smart prefix stripping: Common prefixes like spotlight- are stripped, giving aliases like e, w, s instead of spotlight-e, spotlight-w
  • Short suffix expansion: In single-project mode, type 4y to get PROJECT-4Y
  • Cached aliases: Aliases are cached when running issue list for fast lookup in issue get

Example

# In a monorepo with spotlight-electron, spotlight-website, spotlight projects:
$ sentry issue list
# Shows issues with aliases: e, w, s

$ sentry issue get e-4y
# Expands to SPOTLIGHT-ELECTRON-4Y

# Single project mode:
$ sentry issue get 4y
# Expands to PROJECT-4Y using detected/configured project

Changes

  • src/commands/issue/list.ts - Add alias generation with common prefix stripping
  • src/commands/issue/get.ts - Add alias-suffix parsing and expansion
  • src/lib/config.ts - Add project alias caching functions
  • src/lib/formatters/human.ts - Add short ID formatting with alias display
  • src/types/config.ts - Add ProjectAliasEntry schema
  • test/commands/issue-*.ts - Add tests for alias generation and parsing

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 22, 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 ✨

  • (issue) Add short ID aliases for multi-project support by BYK in #31

🤖 This preview updates automatically when you update the PR.

@BYK BYK force-pushed the feat/issue-short-aliases branch from 8387c43 to 6824e4d Compare January 22, 2026 01:00
- Add project alias caching for quick issue lookup in monorepos
- Support alias-suffix format (e.g., 'e-4y' → 'SPOTLIGHT-ELECTRON-4Y')
- Strip common word prefix for cleaner aliases (spotlight-* → e, w, s)
- Add short suffix expansion with project context (e.g., '4y' → 'PROJECT-4Y')
- Include tests for alias generation and short ID parsing
@BYK BYK force-pushed the feat/issue-short-aliases branch from 6824e4d to f232713 Compare January 22, 2026 01:02
…c IDs

Pure numeric strings like '12345' should be treated as issue IDs, not
short suffixes. Update isShortSuffix pattern to require at least one
letter, fixing the E2E test that passes '12345' expecting an auth error.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 22, 2026

Codecov Results 📊

✅ Patch coverage is 89.57%. Project has 1179 uncovered lines.
❌ Project coverage is 58.15%. Comparing base (base) to head (head).

Files with missing lines (18)
File Patch % Lines
human.ts 16.37% ⚠️ 378 Missing
oauth.ts 21.71% ⚠️ 202 Missing
api-client.ts 49.77% ⚠️ 109 Missing
resolver.ts 3.77% ⚠️ 102 Missing
errors.ts 5.94% ⚠️ 95 Missing
fixture.ts 28.74% ⚠️ 62 Missing
api.ts 66.30% ⚠️ 61 Missing
errors.ts 51.61% ⚠️ 60 Missing
config.ts 83.57% ⚠️ 34 Missing
preload.ts 39.02% ⚠️ 25 Missing
detector.ts 87.79% ⚠️ 16 Missing
cache.ts 76.27% ⚠️ 14 Missing
colors.ts 85.42% ⚠️ 7 Missing
index.ts 95.06% ⚠️ 4 Missing
parser.ts 93.75% ⚠️ 4 Missing
env-file.ts 97.17% ⚠️ 3 Missing
alias.ts 96.43% ⚠️ 2 Missing
java.ts 97.22% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    64.18%    58.15%    -6.03%
==========================================
  Files           28        32        +4
  Lines         2211      2817      +606
  Branches         0         0         —
==========================================
+ Hits          1419      1638      +219
- Misses         792      1179      +387
- Partials         0         0         —

Generated by Codecov Action

…suffix

Short suffixes like '12' are valid (e.g., CRAFT-12), so we can't require
letters in the pattern. Instead, when no project context is available to
expand a short suffix, fall back to treating it as a numeric issue ID.

This fixes the E2E test where '12345' without project context should
attempt to fetch as a numeric ID (triggering auth error) rather than
throwing ContextError about missing org/project.
BYK added 3 commits January 22, 2026 19:58
Move issue suffix parsing functions to a shared location for reuse by
future commands (issue fix, issue why):
- isShortId: check if ID contains letters (vs numeric)
- isShortSuffix: check if input is alphanumeric without hyphens
- parseAliasSuffix: parse alias-suffix format (e.g., 'e-4y')
- expandToFullShortId: expand suffix to full short ID

Also includes:
- Fix strippedPrefix handling for projects without common prefix
- Use boldUnderline for alias/suffix highlighting
- Move tests to test/lib/issue-id.test.ts
- Add tests for project alias config functions (setProjectAliases,
  getProjectAliases, getProjectByAlias, clearProjectAliases)
- Extract findCommonWordPrefix and findShortestUniquePrefixes to
  src/lib/alias.ts for reuse and proper test coverage
- Update tests to import from lib instead of re-implementing
- Add ANSI formatting tests for formatShortId
@BYK BYK requested a review from betegon January 23, 2026 07:32
@betegon betegon marked this pull request as ready for review January 23, 2026 11:03
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 2 potential issues.

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

@betegon betegon merged commit 4b066aa into main Jan 23, 2026
14 checks passed
@betegon betegon deleted the feat/issue-short-aliases branch January 23, 2026 13:06
@betegon
Copy link
Copy Markdown
Member

betegon commented Jan 23, 2026

this closed #44

BYK added a commit that referenced this pull request Jan 27, 2026
## Summary

Fixes #42 - The `explain` and `plan` commands now support all issue ID
formats introduced in PR #31:

- **Alias-suffix format** (e.g., `f-g` where `f` is a cached project
alias from `issue list`)
- **Short suffix format** (e.g., `G` or `4Y` - requires project context)
- **Full short ID format** (e.g., `CRAFT-G`)
- **Numeric ID format** (e.g., `123456789`)

## Changes

- Updated `resolveOrgAndIssueId` in `src/commands/issue/utils.ts` to
handle all four issue ID formats with proper fallback logic
- Added tests for alias-suffix and short suffix format resolution
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.

2 participants