Skip to content

M3: Write actions on issues/PRs (+ mutation infrastructure)#290

Draft
michaeljolley wants to merge 1 commit into
mjolley/m2-notificationsfrom
mjolley/m3-write-actions
Draft

M3: Write actions on issues/PRs (+ mutation infrastructure)#290
michaeljolley wants to merge 1 commit into
mjolley/m2-notificationsfrom
mjolley/m3-write-actions

Conversation

@michaeljolley

Copy link
Copy Markdown

Part of the CmdPal GitHub extension parity roadmap (stacked on M2, PR #289).

Summary

Introduces shared write/mutation infrastructure and the first state-changing actions on existing issues and pull requests.

Mutation infrastructure (reused by M4/M5)

  • IGitHubMutationManager / GitHubMutationManager: Octokit REST writes (close/reopen issue, close/reopen/merge PR).
  • MutationMediator: weak-event signal so open surfaces refresh after a write (pages are recreated on every top-level rebuild, so strong subscriptions would leak).
  • GitHubMutationCommand: runs a single write, shows a success/error toast, notifies the mediator.
  • ConfirmedCommand: wraps destructive actions in CommandResult.Confirm.
  • MutationCommandsFactory: state-aware command building (close if open / reopen if closed; merge + close for open PRs).

Wiring

  • List views: IssuesSearchPage, PullRequestsSearchPage, CombinedSearchPage append mutation commands and subscribe to the mediator via a method-group handler to refresh on completion.
  • Detail views: IssueContentPage / PullRequestContentPage append the same mutation commands.
  • Composition root (Program.cs) constructs the manager/mediator/factory and threads them through SearchPageFactory.

Safety

Destructive ops (merge, close) are marked \IsCritical\ and require an explicit confirmation step; reopen runs immediately.

Deferrals (documented in plan)

  • Add Comment -> M4 (needs FormContent, natural fit for the create/forms milestone).
  • Enable/Disable Auto-merge -> M6 (GraphQL-only mutation; GraphQL client arrives in M6).

Tests

  • New \MutationCommandsFactoryTests\ covering state-aware command building and confirmation deferral.
  • Full suite: 177/177 passing. Build clean (x64 Debug).

Localization

Added command names, success/error toasts, and confirmation title/description strings to \Resources.resw.

Add shared mutation infrastructure and destructive-action confirmation:
- IGitHubMutationManager/GitHubMutationManager for Octokit REST writes
  (close/reopen issue, close/reopen/merge pull request)
- MutationMediator (weak event) to refresh surfaces after a write
- GitHubMutationCommand (write + success/error toast + notify)
- ConfirmedCommand wrapping destructive actions in CommandResult.Confirm
- MutationCommandsFactory building state-aware commands

Wire mutation commands into the issue/PR list pages and detail content
pages. Destructive ops (merge, close) require confirmation and are marked
critical; reopen runs immediately. Add resource strings and unit tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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