Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tommy/expand-list-discussions-tool#690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
tommaso-moro wants to merge19 commits intogithub:main
base:main
Choose a base branch
Loading
fromtommaso-moro:tommy/expand-discussions-tools

Conversation

tommaso-moro
Copy link
Contributor

@tommaso-morotommaso-moro commentedJul 16, 2025
edited
Loading

Addresses#670

Overview
This PR expands the functionality of thelist_discussions tool. It adds

  • TheupdatedAt andauthor.login (i.e. username) fields to the discussions payload in thelist_discussions tool
  • The ability to order discussions by field (updated_at andcreated_at) and direction (ascending order, descending order)

Refactoring
The PR includes extensive refactoring of thelist_discussions tool to handle optional parameters in our graphql queries. This was needed because the githubv4 library requires GraphQL queries to be defined using Go struct tags that must be known at compile time, so we could not dynamically construct query strings at runtime based on user input.

The changes made include

  • Introduced reusableDiscussionFragment struct to avoid field duplication
  • Created 4 pre-defined query variants:
    • BasicNoOrder: No optional parameters (uses GitHub API's defaults)
    • BasicWithOrder: Only ordering parameters
    • WithCategoryNoOrder: Only category filtering
    • WithCategoryAndOrder: Both category and ordering
  • Added runtime query selection logic to choose the appropriate variant based on user input

Tests
I updated the tests indiscussions_test.go to match the new queries, and to test the new ordering functionality with different sorting combinations.

Demo

Simple "list discussions" prompt

Screenshot 2025-07-17 at 17 37 47

 

Ordering: from most recently created to least recently created
Screenshot 2025-07-17 at 17 43 14

 

Ordering: from least recently updated to most recently updated
Screenshot 2025-07-17 at 17 44 05

 

Less explicit prompt: show me discussions from last 10 days
Screenshot 2025-07-17 at 17 47 09

 

Ordering with weaker model (GPT-4o)
Screenshot 2025-07-17 at 17 59 42


Note: this PR adds author data to the payload of thelist_discussions tool but doesn't add support for filtering by author when listing discussions because that is not supported on the discussions field in the API, and it would need to be achieved in a separate search tool.

tommaso-moroand others added17 commitsJuly 14, 2025 23:03
@tommaso-morotommaso-moro marked this pull request as ready for reviewJuly 17, 2025 17:03
@CopilotCopilotAI review requested due to automatic review settingsJuly 17, 2025 17:03
@tommaso-morotommaso-moro requested a review froma team as acode ownerJuly 17, 2025 17:03
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances thelist_discussions tool by adding ordering capabilities and expanding the discussion payload to include author information and updated timestamps. The changes enable users to sort discussions by creation or update date in ascending or descending order, while maintaining backward compatibility with existing functionality.

  • AddedupdatedAt andauthor.login fields to the discussion payload
  • Implemented ordering support withorderBy anddirection parameters
  • Refactored GraphQL query handling to support optional parameters through pre-defined query variants

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.

FileDescription
pkg/github/discussions.goAdded new query struct types, ordering logic, and GraphQL query selection based on parameters
pkg/github/discussions_test.goUpdated test data and added comprehensive test cases for ordering functionality
README.mdUpdated documentation to reflect new ordering parameters

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@omgitsadsomgitsadsAwaiting requested review from omgitsads

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@tommaso-moro

[8]ページ先頭

©2009-2025 Movatter.jp