Skip to content

Add discussions command to capture discussions authored by a user#13

Merged
maxbeizer merged 1 commit intomainfrom
add-discussions-command
Feb 26, 2026
Merged

Add discussions command to capture discussions authored by a user#13
maxbeizer merged 1 commit intomainfrom
add-discussions-command

Conversation

@maxbeizer
Copy link
Copy Markdown
Owner

Summary

Adds a new discussions <username> command that fetches GitHub Discussions authored by the specified user using the GraphQL API.

Changes

New GraphQLClient interface

  • GraphQLClient interface with Do(query, variables, response) method
  • DefaultGraphQLClient implementation using go-gh's api.DefaultGraphQLClient()

New discussions command

  • gh contrib discussions <username> — fetches discussions authored by the user via GraphQL
  • Supports --body-only, --since, --org flags
  • Uses cursor-based pagination for large result sets

Updated all command

  • Now includes discussions as a Discussion type row in CSV output

Updated graph command

  • Discussions appear with (closed) and (open) symbols
  • Legend and summary updated to include discussion counts

Testing

  • TestHandleDiscussionsCommand_CSV — verifies CSV output
  • TestHandleDiscussionsCommand_BodyOnly — verifies body-only output
  • TestFetchDiscussions — verifies GraphQL response mapping and state handling
  • Updated TestHandleAllCommand_CSV to include discussions
  • Updated all graph tests for new function signature
  • All 30 tests pass

Closes #12

- New GraphQLClient interface + DefaultGraphQLClient implementation
- New `discussions <username>` command using GitHub GraphQL search
- Discussions included in `all` and `graph` commands
- Graph uses ▲/△ symbols for discussions
- Comprehensive test coverage for discussions

Closes #12

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maxbeizer maxbeizer merged commit c096eff into main Feb 26, 2026
@maxbeizer maxbeizer deleted the add-discussions-command branch February 26, 2026 19:02
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 discussions command to capture discussions authored by a user

1 participant