How krystofwoldrich/pr-agent works
PR Agent is a VS Code extension that inserts the current or next pull-request number, or a Markdown link, at the editor cursor. Commands are handled in the extension: it inspects the active file’s Git repository, obtains a number from GitHub, formats it, and edits the document. Current-number lookup follows the branch’s associated pull request; next-number lookup compares the latest issue, discussion, and pull-request numbers. The source excerpts show these calls directly; repository capabilities are documented in the README and command contributions in package.json.
Main entry points: extension.ts Insert workflow · secrets.ts Token management · api.ts GitHub GraphQL client · git.ts Repository and branch context
Components 14
VS Code interaction
- PR commands
src/extension.ts - Insert workflow
src/extension.ts - Remote and PR selection
src/extension.ts - Token management
src/secrets.ts
Git context
- Repository and branch context
src/git.ts - Local Git metadata
GitHub lookup
- Current PR lookup
src/extension.ts - Next number lookup
src/extension.ts - GitHub GraphQL client
src/api.ts
Formatting and output
- Markdown templates
src/template.ts - Active editor insertion
src/extension.ts
Other components
- Extension user
- GitHub GraphQL API
- VS Code secret storage
Connections 15
- Extension user → PR commands: runs command
- PR commands → Insert workflow: starts workflow
src/extension.ts - Insert workflow → Repository and branch context: reads repository
src/extension.ts - Repository and branch context → Local Git metadata: reads metadata
src/git.ts - Insert workflow → Remote and PR selection: prompts choices
src/extension.ts - Insert workflow → Token management: gets token
src/extension.ts - Insert workflow → Token management: clears token
src/extension.ts - Token management → VS Code secret storage: reads or clears
- Insert workflow → Current PR lookup: resolves current
src/extension.ts - Insert workflow → Next number lookup: resolves next
src/extension.ts - Current PR lookup → GitHub GraphQL client: fetches associated PRs
src/extension.ts - Next number lookup → GitHub GraphQL client: fetches latest numbers
src/extension.ts - GitHub GraphQL client → GitHub GraphQL API: sends GraphQL request
src/api.ts - Insert workflow → Markdown templates: formats result
src/extension.ts - Insert workflow → Active editor insertion: inserts content
src/extension.ts