Skip to content

feat(github): rewrite plugin with OAuth Device Flow#102

Merged
wrxck merged 2 commits intodevelopfrom
feat/github-oauth
Feb 18, 2026
Merged

feat(github): rewrite plugin with OAuth Device Flow#102
wrxck merged 2 commits intodevelopfrom
feat/github-oauth

Conversation

@wrxck
Copy link
Owner

@wrxck wrxck commented Feb 18, 2026

Summary

  • Rewrites the minimal GitHub plugin (75 lines, repo info only) into a full integration (770 lines) with OAuth Device Flow authentication, 11 subcommands, paginated list views, and cron-based auth polling
  • Adds GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET to .env.example
  • Adds comprehensive test suite (73 tests) covering all handlers, cron polling, callback queries, and error handling

Commands

Command Description Auth
/gh login Start Device Flow OAuth (PM only) No
/gh logout Revoke + delete stored token (PM only) Yes
/gh me Show authenticated user profile Yes
/gh repos [user] List repos (own or specified user) Yes
/gh owner/repo View repo info (uses token if available) No*
/gh issues owner/repo List open issues No*
/gh issue owner/repo#123 View specific issue No*
/gh starred List starred repos Yes
/gh star owner/repo Star a repo Yes
/gh unstar owner/repo Unstar a repo Yes
/gh notifications View unread notifications Yes

Key design decisions

  • OAuth Device Flow (RFC 8628): no web server needed — user gets a code to enter on github.com, cron polls for completion
  • Redis-backed state: tokens (github:token:{uid}, 1yr TTL), pending device flows (github:device:{uid}, 15min TTL), pending set for cron enumeration
  • Pagination: callback query buttons with short prefixes (r:, i:, s:, n:) to stay within Telegram's 64-byte callback data limit
  • Cron safety: respects GitHub's interval field, handles slow_down responses, caps at 10 polls per tick, cleans up expired flows

Test plan

  • busted spec/plugins/utility/github_spec.lua — 73/73 pass
  • busted — 668/668 pass (no regressions)
  • Manual: configure OAuth app, test /gh login flow end-to-end
  • Manual: verify pagination buttons work in Telegram

Matt Hesketh added 2 commits February 18, 2026 18:54
…ntegration

Replace the minimal repo-info-only GitHub plugin with a full integration
supporting OAuth Device Flow authentication, 11 subcommands (login, logout,
me, repos, issues, issue, starred, star, unstar, notifications), paginated
list views with callback query navigation, and cron-based auth polling.
Replace unused `code` return values with `_` in star/unstar handlers,
callback query handlers, and cron polling. Remove unused logger require.
@wrxck wrxck merged commit 432d9ea into develop Feb 18, 2026
1 check passed
@wrxck wrxck deleted the feat/github-oauth branch February 18, 2026 19:15
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