Skip to content

feat: async co-author discovery - #3

Merged
wassimk merged 6 commits into
mainfrom
wm/async-discovery
Feb 21, 2026
Merged

wassimk merged 6 commits into
mainfrom
wm/async-discovery

Conversation

@wassimk

@wassimk wassimk commented Feb 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Run GitHub API and git log discovery in background coroutines instead of blocking the UI on first @ trigger
  • Return file/inline handles instantly, stream discovered handles into the open completion menu when ready via blink.cmp's callback streaming
  • Deduplicate items when handles exist in both the local file and discovery results
  • Subsequent triggers are instant from cache

Changes

  • discover.lua: Add coroutine async runner (run_cmd, async_run), refactor internals to use run_cmd(), add discover_async()
  • handles.lua: Split load() into load_fast() (file/inline only) + async discovery, add listener mechanism for discovery completion
  • blink.lua: Call callback twice (fast handles, then discovered), filter duplicates on second call
  • README.md: Document the brief delay on first trigger

Test plan

  • make test passes (48 tests)
  • make lint passes
  • Manual: first @ trigger shows file handles instantly, discovered handles stream in
  • Manual: no duplicate entries when handles exist in both file and discovery
  • Manual: subsequent triggers are instant from cache

Query GitHub collaborators via gh CLI GraphQL API for real @handle
completions. Fall back to git log authors when gh is unavailable.
Cross-reference git log to resolve real emails over noreply addresses.
Manual file and inline handles override discovered entries.
The handles.get() function already loads on first access when the cache
is empty, so the explicit load() call in setup() was redundant. Removing
it defers handle loading until actually needed.
Return file/inline handles immediately on first @ trigger and run
GitHub/git log discovery in a coroutine background. Discovered handles
merge into the cache when complete and appear on the next keystroke.
Call blink.cmp's callback twice: once immediately with file/inline
handles, then again when async discovery completes. This updates the
open menu in-place without requiring the user to re-trigger completion.
Filter out items already sent in the first callback before appending
discovered handles, preventing duplicates for entries that exist in
both the local handles file and the discovery results.
@wassimk
wassimk merged commit e18f4d0 into main Feb 21, 2026
2 checks passed
@wassimk
wassimk deleted the wm/async-discovery branch February 21, 2026 05:11
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