Skip to content

feat(vscode): add codev.referencePRInArchitect inline action on PR rows - #1044

Merged
amrmelsayed merged 5 commits into
mainfrom
builder/air-1043
Jun 13, 2026
Merged

amrmelsayed merged 5 commits into
mainfrom
builder/air-1043

Conversation

@amrmelsayed

Copy link
Copy Markdown
Collaborator

Summary

Implements #1043: adds a codev.referencePRInArchitect command that mirrors the existing codev.referenceIssueInArchitect backlog action for the Pull Requests sidebar.

  • PullRequestTreeItem — new typed subclass of vscode.TreeItem (in pull-requests.ts) that carries prId and prTitle as typed fields, so the command handler can read them via instanceof (same pattern as BacklogTreeItem).
  • package.json — declares codev.referencePRInArchitect with $(mention) icon, hides it from the command palette (when: false), and adds a view/item/context inline entry at inline@1 scoped to view == codev.pullRequests && viewItem == pull-request.
  • extension.ts — registers the handler: guards on instanceof PullRequestTreeItem, opens the architect terminal, and calls buildArchitectReferenceInjection(prId, prTitle) — reusing the shared injection helper from vscode: backlog → architect reference should include the issue title alongside the id #808.

Behavior

Clicking the $(mention) inline icon on a PR row injects #<pr-number> "<title> " into the architect's prompt buffer without pressing Enter, leaving the cursor ready for the user's next word. Architect terminal opens automatically if not already open. Falls back to #<id> if title is unavailable (same as the backlog action's fallback).

Tests

11 unit tests in src/__tests__/reference-pr-in-architect.test.ts:

  • Command declared in package.json with $(mention) icon
  • Unique title (no duplicate with referenceIssueInArchitect)
  • view/item/context inline entry targets codev.pullRequests/pull-request at inline@1
  • Does NOT appear on backlog-item rows
  • Hidden from command palette (when: false)
  • extension.ts registers the command and calls buildArchitectReferenceInjection
  • Guards on instanceof PullRequestTreeItem
  • Injection format for PR with title: #42 "Fix the thing"
  • Fallback when title is undefined: #42
  • Escapes embedded quotes in PR titles

All 304 pre-existing tests continue to pass.

Review

This is a small, fully-specified feature add (3 files changed, ~55 LOC) that mirrors an established well-tested pattern. No architectural decisions needed. Implementation stayed within scope.

Lessons

  • The PullRequestTreeItem subclass pattern follows BacklogTreeItem exactly and stays clean.
  • The buildArchitectReferenceInjection helper being unit-testable without VS Code mocking is a good design pattern to maintain.

…R rows

Mirrors codev.referenceIssueInArchitect for the Pull Requests sidebar.
Injects #<pr-number> "<title> " into the architect prompt buffer via the
existing buildArchitectReferenceInjection plumbing.

- PullRequestTreeItem subclass carries prId/prTitle for typed command args
- package.json: command declaration ($(mention) icon), palette hiding, inline menu entry
- extension.ts: command handler registered alongside referenceIssueInArchitect
- 11 unit tests covering declaration, wiring, palette, handler, injection format
@amrmelsayed
amrmelsayed merged commit 7dcf660 into main Jun 13, 2026
6 checks 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.

1 participant