Commit graph

5685 commits

Author SHA1 Message Date
Kynan Ware
21ccabc832 Simplify error handling in CreateJob response
Refactored the CreateJob method to decode the response body into the Job struct before checking for error status codes. Error messages are now extracted directly from the Job struct, removing redundant error parsing logic.
2025-09-03 13:01:40 -06:00
Kynan Ware
44e81b021c Simplify stdout assertion in createRun test
Removed unnecessary conditional check for wantStdout in Test_createRun. Now always asserts equality between wantStdout and actual stdout output, improving test clarity.
2025-09-03 12:36:12 -06:00
Kynan Ware
32bf9159ea Improve job error handling and update tests
Normalizes job API error messages to include status code and text, ensures errors from job polling are surfaced to stderr without halting execution, and updates tests to verify error output and remove outdated fallback behavior.
2025-09-03 12:34:13 -06:00
Kynan Ware
5472fcffe9 Use Job struct in request
Refactored CreateJob to use the Job struct as the payload instead of a map, improving consistency and maintainability.
2025-09-03 11:28:16 -06:00
Kynan Ware
9ec10a4d31 Escape URL path parameters in GetJob request
Uses url.PathEscape for owner, repo, and jobID in the GetJob API request to ensure proper encoding and prevent issues with special characters.
2025-09-03 10:49:35 -06:00
Kynan Ware
b890f880c0 Escape owner and repo in job creation URL
Uses url.PathEscape for owner and repo when constructing the job creation URL to ensure proper encoding and prevent issues with special characters.
2025-09-03 10:48:24 -06:00
Kynan Ware
33d1196645 Escape URL path segments in agent session links
Uses url.PathEscape for repo owner, repo name, and session ID when constructing agent session URLs to ensure proper encoding and prevent issues with special characters.
2025-09-03 10:40:00 -06:00
Kynan Ware
c3bbd374aa Remove nil check for job in agentSessionWebURL
Simplifies the agentSessionWebURL function by removing the redundant nil check for the job parameter, assuming it is always non-nil when called.
2025-09-03 10:33:31 -06:00
Kynan Ware
3d8d5f3e31 Update test to expect 500 error response
Changed the mocked API response status from 400 to 500 in Test_createRun to better reflect the expected error scenario.
2025-09-03 10:29:38 -06:00
Kynan Ware
2bec2bcf65 Update error message in createRun test
Removed 'error:' prefix from expected error message in the 'missing repo returns error' test case for consistency with actual output.
2025-09-03 10:28:39 -06:00
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
a9cc63b8a3
refactor without VisitAll 2025-08-31 18:09:46 +02: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
04cce6b35e
docs(search): improve Searcher.URL method docs
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 15:36:31 +01: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
8ab6e722e2
docs(search): improve docs for Query.String and Query.AdvancedIssueSearchString methods
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 15:34:27 +01:00
Babak K. Shandiz
f0a130dd4e
refactor(search): improve special qualifier grouping
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 15:19:42 +01:00
Babak K. Shandiz
89b39e2df0
test(search): test advanced search support
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 13:59:45 +01:00
Babak K. Shandiz
1b2e2a24b6
fix(search): use advanced issue search when available
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 13:58:59 +01:00
Babak K. Shandiz
3086b6fc8a
refactor(search): sort qualifiers in query
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 13:54:52 +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
Babak K. Shandiz
cb249e6cbb
test(search): explain why is: and in: qualifiers used in test case
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 02:02:25 +01:00
Babak K. Shandiz
bf242ae2f4
fix(search): sort qualifiers in advacned issue search syntax
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 02:00:27 +01:00
Babak K. Shandiz
392c286db3
test(search): add tests for AdvancedIssueSearchString method
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 01:49:00 +01:00
Babak K. Shandiz
fd38b14898
fix(search): add AdvancedIssueSearchString method
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-31 01:48:13 +01:00