Skip to content

Add discussion command group scaffolding#13082

Merged
babakks merged 1 commit into
cli:feature/discussionfrom
maxbeizer:discussion-cmd
Apr 2, 2026
Merged

Add discussion command group scaffolding#13082
babakks merged 1 commit into
cli:feature/discussionfrom
maxbeizer:discussion-cmd

Conversation

@maxbeizer
Copy link
Copy Markdown
Contributor

@maxbeizer maxbeizer commented Apr 2, 2026

Summary

Scaffolding for the gh discussion command group — the first PR in a series that will bring native Discussions support to the CLI.

What's included

  • DiscussionClient interface in pkg/cmd/discussion/client/ — defines all planned operations (list, search, get, create, update, close, reopen, comment, lock/unlock, mark/unmark-answer) with stub implementations
  • Domain typesDiscussion, DiscussionCategory, DiscussionComment, etc. with ExportData for JSON output. No JSON struct tags per review guidance — serialization is explicit
  • Generated mock via moq for use in subcommand tests
  • Factory function in shared/ for lazy client creation
  • JSON field definitions for --json output
  • Root command registered in the core group alongside issue and pr

Architecture

Follows the agent-task/capi pattern per reviewer guidance:

  • Interface-based API client with generated mocks
  • Domain types separate from API types (private to implementation)
  • Safely typed GraphQL queries (to be added in subsequent PRs)

What's next

This is PR 1 of 11. See #12810 for the design proposal.

Next: discussion list (PR 2)

Refs: #12810

@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels Apr 2, 2026
Introduce the pkg/cmd/discussion/ package with:

- DiscussionClient interface and domain types (client/)
- Generated mock via moq (client/)
- Factory function for lazy client creation (shared/)
- JSON field definitions for --json output (shared/)
- Root 'discussion' command registered in the core group

The interface defines all planned operations (list, search, get, create,
update, close, reopen, comment, lock, unlock, mark-answer, unmark-answer)
with stub implementations that will be replaced as each subcommand is
added in subsequent PRs.

Domain types are intentionally separate from API types per review guidance.
No JSON struct tags are used; serialization is handled by ExportData methods.

Refs: cli#12810, github/gh-cli-and-desktop#115

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@babakks babakks changed the base branch from trunk to feature/discussion April 2, 2026 16:10
Copy link
Copy Markdown
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🙏 I know it's still draft, but I guess most of the scaffolding is done here, so I'm approving it.

@maxbeizer maxbeizer marked this pull request as ready for review April 2, 2026 16:57
@maxbeizer maxbeizer requested a review from a team as a code owner April 2, 2026 16:57
@maxbeizer maxbeizer requested review from BagToad and removed request for a team April 2, 2026 16:57
@babakks babakks merged commit 65f5b21 into cli:feature/discussion Apr 2, 2026
24 checks passed
@maxbeizer maxbeizer deleted the discussion-cmd branch April 2, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team needs-triage needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants