Skip to content

feat: Smart links provider abstraction with server persistence and dismiss - #205

Closed
damianh wants to merge 2 commits into
pgermishuys:mainfrom
damianh:smart-links-provider-abstraction
Closed

damianh wants to merge 2 commits into
pgermishuys:mainfrom
damianh:smart-links-provider-abstraction

Conversation

@damianh

@damianh damianh commented May 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

The smart links sidebar (previously GitHub-only) is refactored into a provider-based abstraction that supports multiple link sources. Links are now persisted server-side with the session (SQLite) instead of only in localStorage, and users can dismiss individual links via a hover × button.

Adding a new provider (e.g. Jira) now requires only implementing a single SmartLinkProvider interface file and adding one import line to the registry. GitHub and Linear are the two built-in providers.

Reviewer focus

  • src/lib/smart-links/types.ts — the SmartLinkProvider interface is the core abstraction; review for extensibility
  • src/lib/smart-links/storage.tsuseSmartLinkStorage hook manages server sync, localStorage cache, v1 migration, and dismissal
  • src/app/api/sessions/[id]/smart-links/route.ts — GET/PUT/DELETE for persistence; no auth beyond session existence check (consistent with other session routes)
  • src/lib/smart-links/providers/github.tsx — visual parity with the old GitHubLinksSidebarPanel

Risk / impact

  • localStorage v1 migration: Existing v1 data is migrated to server on first load, then the v1 key is deleted. If migration fails (server down), cached data is still shown
  • Database schema: Two new TEXT columns on sessions table (smart_links, dismissed_smart_links) — added via ALTER TABLE with try/catch, consistent with existing migration pattern
  • Deleted modules: 8 old files removed (pr-utils, issue-utils, link-storage, github-rate-limit, use-pr-status, use-issue-status, github-links-sidebar-panel, pr-sidebar-panel) + 4 test files. No external consumers found

damianh added 2 commits May 3, 2026 15:37
…smiss

Replace GitHub-only smart links with a provider-based abstraction that
supports multiple link sources (GitHub, Linear, etc.).

- SmartLinkProvider interface + registry for extensible detection/rendering
- Server-side persistence (SQLite) replacing localStorage-only storage
- User can dismiss links via hover × button (persisted, won't re-detect)
- Unified polling hook with per-provider rate-limit tracking
- GitHub provider preserves exact existing PR/issue UI + behavior
- Linear provider added (issue detection, status via GraphQL API)
- localStorage v1 → server migration on first load
- Adding a new provider requires only 1 file + 1 import
Providers import registerProvider from registry.ts, so registry.ts
cannot also import the providers (circular dependency causes
registerProvider to be undefined at call time).

Move side-effect imports to a separate providers/index.ts entry-point
that page.tsx imports explicitly.
@damianh damianh closed this May 3, 2026
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