feat: Implement at-mention detection for Bluesky posts#104
Merged
Conversation
Co-authored-by: nzakas <38546+nzakas@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Detect at-mentions in BlueSky
Implement at-mention detection for BlueSky posts
Jul 3, 2025
nzakas
reviewed
Jul 3, 2025
| index: tag.byteRange, | ||
| features: [new BlueSkyTagFacetFeature(tag.tag)], | ||
| })), | ||
| ...detectMentions(text).map(mention => ({ |
Contributor
There was a problem hiding this comment.
This correctly finds at-mentions, but we really do need to use the actual did when we start the request.
Contributor
Author
There was a problem hiding this comment.
You're absolutely right. The current implementation correctly detects mentions and stores handles in the did field as a placeholder. The next step will be to resolve these handles to actual DIDs via the BlueSky API before making the post request. I've noted this in the class documentation for future enhancement.
Contributor
There was a problem hiding this comment.
Can you make that change now?
Contributor
Author
There was a problem hiding this comment.
I've implemented DID resolution for BlueSky mentions. The changes include:
- Added
resolveHandle()function to resolve handles to DIDs via the BlueSky API - Updated the posting flow to resolve mention handles before creating posts
- Added comprehensive tests covering both successful resolution and graceful failure handling
- Mentions that fail to resolve are silently skipped to prevent post failures
All 269 tests are passing. Commit: f681245
Co-authored-by: nzakas <38546+nzakas@users.noreply.github.com>
nzakas
approved these changes
Jul 3, 2025
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.
This PR implements at-mention detection for BlueSky posts, allowing mentions like
@usernameto be properly converted to clickable links in BlueSky posts.Changes Made
Core Implementation
BLUESKY_MENTION_FACETconstant for the BlueSky mention facet type (app.bsky.richtext.facet#mention)BlueSkyMentionFacetFeatureclass to represent mention facets in the BlueSky API formatMentionDetailstypedef for type safetydetectMentions()function that uses a robust regex pattern to detect valid mentionsdetectFacets()to include mention detection alongside existing URL and hashtag detectionMention Detection Features
@username,@user.name,@user-name@alice(@username)Check @user for #javascript tips!@123,@.,@@, etc.)Testing
Example Usage
Future Enhancement
The current implementation stores handles in the
didfield as noted in the issue. A future enhancement will resolve handles to actual DIDs via the BlueSky API and validate mention existence before posting.Testing Results
Fixes #103.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.