Skip to content

Support repository-aware labels for GitHub blob URL smart chips#122

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/feature-support-file-urls
Draft

Support repository-aware labels for GitHub blob URL smart chips#122
Copilot wants to merge 3 commits into
mainfrom
copilot/feature-support-file-urls

Conversation

Copilot AI commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description:

Direct GitHub file links were rendered as repository chips, hiding file context. This change updates blob URL chips to include the repository name (without owner) and handle long paths while preserving existing behavior for repo/issue/PR/user/project URLs.

  • URL parsing

    • parseGitHubURL detects blob file URLs and extracts path.
    • GitHubURLInfo includes optional path?: string.
  • Chip title selection

    • Blob URL titles now use:
      • (repository name without owner)/(path) when the title is less than 60 characters.
      • (repository name without owner) - (base file name) when the full path title is 60+ characters.
    • onLinkPreview applies this title formatting before rendering repository cards.
    • createRepositoryCard continues supporting an optional title override (default: data.full_name).
  • Coverage updates

    • Added/updated tests for blob path parsing, repository card custom title support, and end-to-end preview title behavior for:
      • normal blob paths
      • long blob paths with basename fallback
const filePattern = /github\.com\/([^/]+)\/([^/]+)\/blob\/[^/]+\/([^?#]+)/;
// ...
const title = urlInfo.path
  ? createRepositoryTitle(repo.name, urlInfo.path)
  : undefined;
card = createRepositoryCard(repo, title);

Related Issues:

  • [feature] Support file URLs

Checklist:

  • Review the CONTRIBUTING.md documentation.
  • Add a reference to a related issue in the repository.
  • Add a description of the changes proposed in the pull request.
  • Add unit tests if applicable.
  • Update documentation if applicable.
  • Add a note in the CHANGELOG.md if applicable.

Copilot AI linked an issue May 29, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add support for displaying file names in smart chips Support file-path labels for GitHub blob URL smart chips May 29, 2026
Copilot AI requested a review from ianlewis May 29, 2026 00:31
Comment thread src/addon.test.ts Outdated

onLinkPreview(event);

expect(mockCardHeader.setTitle).toHaveBeenCalledWith("src/addon.ts");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The title should include the repo name in addition to the filename. It should also handle situations where the path is very long.

The title should be (repository name without owner)(path) if less than 60 characters. Otherwise, it should be (repository name without owner) - (base file name).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in ee760d8. Blob URL titles now use repoName/path when the result is under 60 chars, and fall back to repoName - basename for long paths. I also updated src/addon.test.ts to cover both title formats.

Copilot AI changed the title Support file-path labels for GitHub blob URL smart chips Support repository-aware labels for GitHub blob URL smart chips Jun 14, 2026
Copilot AI requested a review from ianlewis June 14, 2026 06:08
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.

[feature] Support file URLs

2 participants