fix(alias): fix alias generation and highlighting for prefix-related slugs#203
Merged
fix(alias): fix alias generation and highlighting for prefix-related slugs#203
Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ Patch coverage is 97.50%. Project has 1749 uncovered lines. Files with missing lines (34)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 77.99% 78.15% +0.16%
==========================================
Files 58 58 —
Lines 7933 8005 +72
Branches 0 0 —
==========================================
+ Hits 6187 6256 +69
- Misses 1746 1749 +3
- Partials 0 0 —Generated by Codecov Action |
9b6234e to
9c20937
Compare
9c20937 to
10d3420
Compare
10d3420 to
9c63fab
Compare
…ther When one project slug is a prefix of another (e.g., 'cli' and 'cli-website'), the alias generation would produce malformed aliases ending with '-', resulting in double-dashes like 'cli--1' when combined with issue suffixes. This fix detects prefix relationships between slugs and uses the suffix after the prefix for differentiation: - 'cli' + 'cli-website' → aliases 'c' and 'w' → 'c-33', 'w-1' - 'api' + 'api-server' + 'api-server-v2' → aliases 'a', 's', 'v' Also fixes SHORT ID highlighting in multi-project mode to highlight the portion that corresponds to the alias (e.g., 'CLI-WEBSITE-1' highlights 'WEBSITE-1' to match alias 'w-1').
9c63fab to
6093535
Compare
There was a problem hiding this comment.
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.
- Search backwards through project parts to find rightmost alias match - Handle aliases with embedded dashes by matching joined project portion - Add tests for highlighting edge cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two issues with
issue listoutput when one project slug is a prefix of another (e.g.,cliandcli-website).Issue 1: Double-Dash in Aliases
When generating aliases, slugs like
cli-websitewould get aliascli-(ending with dash), causing double-dashes in issue shorthands.cli→cli,cli-website→cli-cli→c,cli-website→wcli-33,cli--1❌c-33,w-1✓Issue 2: SHORT ID Highlighting
Highlighting now shows exactly which characters form the alias:
CLI-25c-25CLI-WEBSITE-4w-4Changes
src/lib/alias.ts: AddedapplyPrefixRelationships()to detect when one slug is a prefix of another and use the suffix for differentiationsrc/lib/formatters/human.ts: AddedformatShortIdWithAlias()to highlight only the alias characters (project prefix letter + issue suffix)test/lib/alias.test.ts: Added 3 test cases for prefix relationships