Commit graph

5446 commits

Author SHA1 Message Date
Kynan Ware
3a7465ed96 Remove redundant 'error:' prefix from repo error
Simplifies the error message when a repository is missing by removing the unnecessary 'error:' prefix, making the output clearer and more user-friendly.
2025-09-03 10:26:58 -06:00
Kynan Ware
a81cff3fdf Update command usage for agent task creation
Changed the command usage string from 'create <problem statement>' to 'create "<task description>"' for improved clarity in the agent task creation command.
2025-09-03 10:06:30 -06:00
Kynan Ware
a3fa83071d Update agent-task create command argument handling
Changed argument parsing to accept a maximum of one argument and assign it directly to ProblemStatement. Added error handling for missing problem statement and removed unused strings import.
2025-09-03 10:03:48 -06:00
Melissa Xie
926e29392e
Merge pull request #11592 from luxass/cache-delete-with-ref
feat: add support for `--ref` in `gh cache delete`
2025-09-03 08:04:55 -07:00
Kynan Ware
3574ee9c30 Add agent task creation command and job API
Introduces the 'create' subcommand for agent tasks, allowing users to create agent jobs via the Copilot API. Adds job API client methods, job model, and polling logic to retrieve associated pull requests. Includes tests for various job creation scenarios.
2025-09-02 20:42:39 -06:00
Kyle Kelly
30994ddc5b Remove mention of public preview in trustedroot.go 2025-09-02 23:42:03 +00:00
Kynan Ware
2a99dcd2ce Add pager support to agent-task list output
Introduces pager functionality to the agent-task list command output for improved readability. If the pager fails to start, an error message is printed to stderr. Aligns with implementations in other commands.
2025-09-02 17:13:43 -06:00
Kynan Ware
c5f7be9adb Replace panic with require.FailNow in test
Updated the test to use require.FailNow instead of panic when CapiClient is called with --web, improving test failure reporting and consistency.
2025-09-02 13:14:37 -06:00
Kynan Ware
c4c0ddc8c2 Add test for web mode with repo flag in listRun
Added a test case to ensure that web mode in listRun uses the global URL even when the --repo flag is set. This improves coverage for scenarios where both web mode and repo are specified.
2025-09-02 13:13:35 -06:00
Kynan Ware
93f7e9847f Add comment on web dashboard filtering limitation
Added a comment explaining that the web GUI does not currently support filtering by repo, so the agents dashboard is opened without arguments. Notes future improvement if repo filtering becomes available.
2025-09-02 13:11:10 -06:00
Kynan Ware
51aa033b2e Add test case for negative limit in list command
Introduces a test to verify that passing a negative value to the --limit flag in the agent-task list command returns the expected error message.
2025-09-02 13:09:12 -06:00
Kynan Ware
163eb7e7c8 Return NoResultsError when no agent tasks found
Replaces plain output with a NoResultsError in listRun when no agent tasks are found. Updates related tests to expect the error instead of output, improving error handling consistency.
2025-09-02 13:04:27 -06:00
Kynan Ware
227f0bd01d Add comment explaining error handling in listRun
Added a comment to clarify why the error from opts.BaseRepo() is ignored in listRun. This provides context for handling cases when the current working directory is not a repo and --repo is not set.
2025-09-02 12:55:03 -06:00
Kynan Ware
4a07cdf940 Simplify time calculation in listRun test
Replaces explicit duration parsing with direct multiplication for calculating a timestamp 6 hours ago in Test_listRun, improving code clarity.
2025-09-02 12:52:52 -06:00
Kynan Ware
97da7fc1d2 Simplify BaseRepo assignment in list command
Removes unnecessary nil check for Factory before assigning BaseRepo in the agent-task list command. This streamlines the code since Factory is always expected to be non-nil.
2025-09-02 12:50:15 -06:00
Babak K. Shandiz
7b4ace9f54
docs(issue pr): fix incorrect formatting
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-02 10:14:59 +01:00
Babak K. Shandiz
20e8b9e8ea
docs(issue list): fix incorrect formatting
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-02 10:14:32 +01:00
Babak K. Shandiz
87bd76c5aa
docs: add cleanup/future TODO marks for advanced issue search changes
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-01 13:55:49 +01:00
Babak K. Shandiz
33f1f6ea68
docs(pr list): explain use of advanced issue search syntax
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-01 13:40:46 +01:00
Babak K. Shandiz
5747297775
docs(issue list): explain use of advanced issue search syntax
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-01 13:40:20 +01:00
Babak K. Shandiz
b4213ac136
test(issue/pr list): assert integration with advanced issue search
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 21:11:55 +01:00
Babak K. Shandiz
8a8b67ebc3
test(pr shared): assert ListURLWithQuery works with advanced search syntax
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 18:50:32 +01:00
Babak K. Shandiz
6d148400a8
refactor(issue/pr list): support advanced issue search
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 18:29:24 +01:00
Benjamin Levesque
141518d8a3
Merge branch 'trunk' into auth-status-json-output-8635 2025-08-31 18:01:56 +02:00
Benjamin Levesque
45ecc5ece9
introduce AddJSONFlagsWithoutShorthand 2025-08-31 17:56:52 +02:00
Babak K. Shandiz
3573fdfbb0
docs(search prs): mention advanced issue search takeover
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 15:35:33 +01:00
Babak K. Shandiz
99daa74b00
docs(search issues): mention advanced issue search takeover
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 15:35:17 +01:00
Babak K. Shandiz
188098d592
test(search): provide feature detection dependency
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 12:25:43 +01:00
Babak K. Shandiz
257f143711
fix(search): add feature detection dependency
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 12:24:05 +01:00
Kynan Ware
61c8b5ef09
Merge branch 'kw/1003-gh-agent-task-list-respects--l--limit' into kw/1004-gh-agent-task-list-respects--w--web 2025-08-29 19:14:52 -06:00
Kynan Ware
ffc8792260
Merge branch 'kw/1002-gh-agent-task-list-respects-cwd-repo-and---repo-flag' into kw/1003-gh-agent-task-list-respects--l--limit 2025-08-29 19:14:37 -06:00
Kynan Ware
3197193e42 Handle repo resolution errors gracefully in agent-task list
Updated listRun to ignore errors from BaseRepo resolution and proceed when possible. Adjusted tests to reflect that repo resolution errors no longer surface, improving robustness when repo information is ambiguous.
2025-08-29 19:13:35 -06:00
Kynan Ware
a2d75d12f6 Add --web flag to agent-task list command
Introduces a --web flag to the agent-task list command, allowing users to open the agent tasks page in their browser. Updates tests to cover the new flag and browser interaction.
2025-08-29 18:21:47 -06:00
Kynan Ware
83c597ff53 Show default limit in agent-task list flag help
Updates the help text for the --limit flag in the agent-task list command to display the default value, improving clarity for users.
2025-08-29 17:56:04 -06:00
Kynan Ware
a49994defa Add limit flag to agent-task list command
Introduces a --limit flag to control the maximum number of agent tasks fetched. Validates that the limit is greater than zero and updates tests to cover custom and invalid limit scenarios.
2025-08-29 17:52:27 -06:00
Kynan Ware
e750e71288 Add repo-scoped agent session listing support
Introduces ListSessionsForRepo to CapiClient and CAPIClient, enabling listing agent sessions for a specific repository. Updates the list command and tests to support repo override and repo-scoped session queries, including error handling and test coverage for repo resolution.
2025-08-29 17:27:04 -06:00
Kynan Ware
4fd6ae6e3a Refactor session state color logic to shared package
Moved the session state color selection logic from list.go to a new shared/display.go file as ColorFuncForSessionState. This improves code reuse and maintainability by centralizing the color mapping for session states.
2025-08-29 15:23:40 -06:00
Kynan Ware
ea9dfae3bf Optimize session pull request hydration logic
Replaces linear search with a map for associating sessions with pull requests, improving performance and simplifying code in hydrateSessionPullRequests.
2025-08-29 14:23:43 -06:00
Kynan Ware
5281be467d Refactor error handling in generatePullRequestNodeID
Simplified error handling by inlining the encoder.Encode call and removing redundant comments for improved code clarity.
2025-08-29 14:20:12 -06:00
Kynan Ware
bc1d306c31 Update API query name for session PR fetch
Changed the API query from 'FetchPRs' to 'FetchPRsForAgentTaskSessions' in hydrateSessionPullRequests to match updated backend endpoint.
2025-08-29 14:18:45 -06:00
Kynan Ware
13c293f4cf Refactor variable names in ListSessionsForViewer
Renamed 'Sessions' to 'result' for clarity and consistency in the ListSessionsForViewer method when hydrating session pull requests.
2025-08-29 14:12:33 -06:00
Kynan Ware
48012063df Remove commented-out fields from sessionPullRequest
Cleaned up the sessionPullRequest struct by deleting unused commented-out fields related to Author and MergedBy.
2025-08-29 14:11:47 -06:00
Kynan Ware
7b71b5f21b Refactor agent-task list command client initialization
Moves CAPI client initialization to a deferred function in ListOptions, simplifying command setup and improving testability. Updates tests to use the new client initialization pattern and adds more comprehensive test cases for session listing.
2025-08-29 14:09:45 -06:00
Kynan Ware
0a5b78a510 Refactor session filtering in listRun function
Simplifies logic for filtering sessions to only include those with valid pull request and repository data. This reduces nested conditionals and improves code readability.
2025-08-29 08:25:00 -06:00
Kynan Ware
0de5cf24f0 Fix import alias for shared package in agent-task list
Renames the import of the shared package to 'prShared' and updates its usage in list.go to avoid naming conflicts and improve code clarity.
2025-08-29 08:19:37 -06:00
Kynan Ware
dd424d85fd Add agent task listing command and CAPI client
Introduces a new 'list' subcommand under agent-task for listing agent tasks. Implements a Copilot API client for fetching agent sessions and hydrating them with pull request data. Updates PullRequest and PRRepository types to support new fields. Adds dependencies for msgpack and tagparser.

Co-Authored-By: Babak K. Shandiz <babakks@github.com>
2025-08-28 22:00:35 -06:00
Babak K. Shandiz
08e4aa892e
test(cache delete): combine test cases for invalid/non-existent refs
Also note that the API never returns HTTP 422 for invalid refs.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 11:07:49 +01:00
Babak K. Shandiz
d1a404a060
test(cache delete): replace HTTP 204 with 200 to match API behaviour
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 11:06:58 +01:00
Babak K. Shandiz
02d50700b5
docs(cache delete): explain different API responses
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 11:05:28 +01:00
Babak K. Shandiz
d457a1bce0
test(cache delete): add test case for key arg and --all
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 10:12:19 +01:00