Skip to content

fix(alias): fix alias generation and highlighting for prefix-related slugs#203

Merged
BYK merged 2 commits intomainfrom
byk/fix-alias-prefix-double-dash
Feb 5, 2026
Merged

fix(alias): fix alias generation and highlighting for prefix-related slugs#203
BYK merged 2 commits intomainfrom
byk/fix-alias-prefix-double-dash

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 5, 2026

Summary

Fixes two issues with issue list output when one project slug is a prefix of another (e.g., cli and cli-website).

Issue 1: Double-Dash in Aliases

When generating aliases, slugs like cli-website would get alias cli- (ending with dash), causing double-dashes in issue shorthands.

Before After
clicli, cli-websitecli- clic, cli-websitew
cli-33, cli--1 c-33, w-1

Issue 2: SHORT ID Highlighting

Highlighting now shows exactly which characters form the alias:

SHORT ID Alias Highlighting
CLI-25 c-25 CLI-25
CLI-WEBSITE-4 w-4 CLI-WEBSITE-4

Changes

  • src/lib/alias.ts: Added applyPrefixRelationships() to detect when one slug is a prefix of another and use the suffix for differentiation
  • src/lib/formatters/human.ts: Added formatShortIdWithAlias() to highlight only the alias characters (project prefix letter + issue suffix)
  • test/lib/alias.test.ts: Added 3 test cases for prefix relationships

@github-actions
Copy link

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


Bug Fixes 🐛

  • (alias) Fix alias generation and highlighting for prefix-related slugs by BYK in #203

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

github-actions bot commented Feb 5, 2026

Codecov Results 📊

✅ Patch coverage is 97.50%. Project has 1749 uncovered lines.
✅ Project coverage is 78.15%. Comparing base (base) to head (head).

Files with missing lines (34)
File Patch % Lines
human.ts 55.31% ⚠️ 391 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
migration.ts 47.44% ⚠️ 82 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
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
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
alias.ts 99.42% ⚠️ 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%    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

@BYK BYK force-pushed the byk/fix-alias-prefix-double-dash branch 2 times, most recently from 9b6234e to 9c20937 Compare February 5, 2026 22:17
@BYK BYK marked this pull request as ready for review February 5, 2026 22:22
@BYK BYK changed the title fix(alias): prevent double-dash in aliases when slug is prefix of another fix(alias): fix alias generation and highlighting for prefix-related slugs Feb 5, 2026
@BYK BYK force-pushed the byk/fix-alias-prefix-double-dash branch from 9c20937 to 10d3420 Compare February 5, 2026 22:48
@BYK BYK force-pushed the byk/fix-alias-prefix-double-dash branch from 10d3420 to 9c63fab Compare February 5, 2026 22:59
…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').
@BYK BYK force-pushed the byk/fix-alias-prefix-double-dash branch from 9c63fab to 6093535 Compare February 5, 2026 23:02
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.

- 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
@BYK BYK merged commit e3d78f6 into main Feb 5, 2026
24 checks passed
@BYK BYK deleted the byk/fix-alias-prefix-double-dash branch February 5, 2026 23:47
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