Skip to content

feat: add /repo and /pr slash commands for on-demand GitHub queries - #86

Merged
Kingvic300 merged 3 commits into
Txio-labs:mainfrom
Chigybillionz:feat/5-add-pr-repo-commands
Aug 30, 2026
Merged

Kingvic300 merged 3 commits into
Txio-labs:mainfrom
Chigybillionz:feat/5-add-pr-repo-commands

Conversation

@Chigybillionz

Copy link
Copy Markdown
Contributor

PR Text

// markdown

Add /repo and /pr on-demand Telegram commands

Summary

Add slash commands so the team can query GitHub state mid-conversation instead of scrolling through notification history.

Issue

Closes #5

Root Cause

The bot was entirely push-only — it only received GitHub webhook events and posted them to Telegram. There was no way for team members to query repository or PR status on demand.

Solution Implemented

Created a reusable GitHub REST API client and registered two new slash commands:

  • /repo <name> — fetches stars, forks, open issues, and open PR count for a tracked repo
  • /pr <repo>#<number> — fetches PR title, state, review state, and CI status

Both commands resolve short repo names (e.g. "backend") to full names (e.g. "txio-labs/txio-backend") using the existing repo routing config.

Key Changes

  • Added src/github/api.ts — reusable GitHub REST client with error handling
  • Added src/github/command-formatters.ts — response formatters for both commands
  • Updated src/telegram/client.ts — registered /repo and /pr command handlers
  • Updated src/config.ts — added resolveRepoName() and getConfiguredRepos()
  • Updated .env.example — documented GITHUB_TOKEN scope for new commands
  • Updated README.md — added "On-Demand Commands" section

Affected Files

  • src/github/api.ts — new REST client wrapper
  • src/github/command-formatters.ts — new response formatters
  • src/telegram/client.ts — new command handlers
  • src/config.ts — new repo name resolution functions
  • .env.example — documentation update
  • README.md — documentation update
  • src/github/api.test.ts — new tests
  • src/github/command-formatters.test.ts — new tests (21)
  • src/github/commands.test.ts — new tests (8)

Trade-offs / Considerations

  • Reuses existing GITHUB_TOKEN env var rather than adding a new one — the token already needs pull_requests:read scope for merge-conflict detection
  • Repo name resolution depends on the repo routing config (REPO_ROUTING_CONFIG_PATH) being set — without it, /repo and /pr won't work
  • Check runs take priority over commit status when both exist, matching GitHub's own UI behavior

Testing

Commands/checks performed:

  • npx tsc --noEmit — type check passed
  • npm run build — build passed
  • npx vitest run — 49/49 tests passed (21 new formatter tests, 8 new command tests, 4 new API tests, 16 existing tests)

CI Verification

No GitHub Actions workflows exist in the repository. Local validation (typecheck, build, tests) all pass.

Please kindly review this task. If there are any corrections, improvements, adjustments, or merge conflicts that you notice regarding my implementation, I'd really appreciate your feedback. I'd also love to hear your overall review of my work on this branch.
Thank you!

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@Chigybillionz
Chigybillionz force-pushed the feat/5-add-pr-repo-commands branch from 938dc8d to a8e1414 Compare August 30, 2026 21:00
Chigybillionz and others added 2 commits August 30, 2026 22:11
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@Kingvic300
Kingvic300 merged commit 7c4794b into Txio-labs:main Aug 30, 2026
1 check passed
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.

Add /pr and /repo on-demand Telegram commands

2 participants