Commit graph

11279 commits

Author SHA1 Message Date
Babak K. Shandiz
004be9da20
test(agent-task create): quote file paths to pass CI on Windows
To keep the backslashes in Windows file paths and stop `shlex.Split`
from interpreting them as escape characters, we need to quote the paths.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 09:28:52 +01:00
Babak K. Shandiz
7824b43f8a
refactor(agent-task list): simplify cmd initialisation
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 21:06:38 +01:00
Babak K. Shandiz
844c0ab56e
refactor(agent-task create): remove redundant if
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 21:06:15 +01:00
Babak K. Shandiz
07ec8c629d
test(agent-task create): use CapiClientMock
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 21:01:56 +01:00
Babak K. Shandiz
28bb0f62bb
fix(agent-task create): simplify command initialisation
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:59:33 +01:00
Babak K. Shandiz
d17fdb3e8c
test(agent-task list): update TestNewCmdCreate
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:19:35 +01:00
Babak K. Shandiz
b0ac06e4f4
fix(agent-task create): allow no positional arg
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:17:43 +01:00
Babak K. Shandiz
3762d97894
test(agent-task list): apply test args anyway
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:57 +01:00
Babak K. Shandiz
c708e58f69
test(agent-task list): use CapiClientMock
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:57 +01:00
Babak K. Shandiz
27d9a0d5fc
test(agent-task list): update TestNewCmdList
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:57 +01:00
Babak K. Shandiz
19e17c54fd
refactor(agent-task/capi): drop embedding of unexported struct
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:56 +01:00
Babak K. Shandiz
585b639273
test(agent-task/capi): add CapiClientMock
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:56 +01:00
Babak K. Shandiz
ab99ee530a
test(agent-task/capi): add go:generate directive to gen mock
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:56 +01:00
Babak K. Shandiz
be8e6f6491
test(agent-task/capi): add tests for job-related methods
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:55 +01:00
Babak K. Shandiz
79602d3334
test(agent-task/capi): add tests for session-related methods
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:55 +01:00
Babak K. Shandiz
0f5fd6ece0
fix(agent-task/capi): handle non-JSON error response
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:54 +01:00
Babak K. Shandiz
77bb72c2d4
fix(agent-task/capi): improve returned errs
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:54 +01:00
Babak K. Shandiz
0138bf3dab
refactor(agent-task/capi): improve pagination
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:54 +01:00
Babak K. Shandiz
f3c3797d5c
refactor(agent-task list): use shared CapiClientFunc
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:53 +01:00
Babak K. Shandiz
107edc3dd6
fix(agent-task/shared): add CapiClientFunc helper
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-04 20:12:50 +01:00
Kynan Ware
ad79b90671
Merge pull request #11665 from cli/kw/11657-11658-pr-feedback
`gh agent-task create`: Implement feedback from #11657 and #11658
2025-09-04 11:22:05 -06:00
Kynan Ware
aecbf992ee
Merge pull request #11662 from cli/dependabot/github_actions/actions/setup-go-6
chore(deps): bump actions/setup-go from 5 to 6
2025-09-04 11:17:16 -06:00
Kynan Ware
2afdc73a3c
Merge pull request #11663 from cli/dependabot/github_actions/actions/stale-10
chore(deps): bump actions/stale from 9 to 10
2025-09-04 11:16:16 -06:00
Kynan Ware
28a7daee40 Improve agent-task create command help text
Expanded usage examples in the command help to clarify reading from stdin and selecting a base branch. Updated flag descriptions for --from-file and --base to provide clearer guidance to users.
2025-09-04 11:13:21 -06:00
dependabot[bot]
615b3ccb6c
chore(deps): bump actions/stale from 9 to 10
Bumps [actions/stale](https://github.com/actions/stale) from 9 to 10.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v9...v10)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-04 14:52:56 +00:00
dependabot[bot]
4f37579efa
chore(deps): bump actions/setup-go from 5 to 6
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5 to 6.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-04 14:48:13 +00:00
Babak K. Shandiz
90cb805c4a
Merge pull request #11657 from cli/kw/1015-gh-agent-task-create-respects--f--from-file
`gh agent-task create`: support providing task description from a file using `-F`/`--from-file`
2025-09-04 14:25:53 +01:00
Babak K. Shandiz
fdc74cd6f1
Merge pull request #11658 from cli/kw/1016-gh-agent-task-create-respects--b--base
`gh agent-task create`: support selecting base branch with `--base`/`-b`
2025-09-04 14:24:21 +01:00
Kynan Ware
3c3b5669f1 Refactor test case struct in create_test.go
Replaces custom 'tc' type with an inline struct for test cases in TestNewCmdCreate_Args, simplifying the test code structure.
2025-09-03 17:35:17 -06:00
Kynan Ware
b2f506fd50 Add base branch option to agent task creation
Introduces a BaseBranch field to CreateOptions and updates the job creation flow to include the base branch in the payload if specified. The CapiClient and related methods are updated to accept and handle the baseBranch parameter, and tests are added to verify correct behavior when a base branch is provided.
2025-09-03 17:33:38 -06:00
Kynan Ware
8af1787b31 Support reading task description from stdin
Refactored file reading in agent-task create command to use cmdutil.ReadFile, allowing input from stdin. Updated tests to cover reading file content from stdin and improved test setup for file and stdin input cases.
2025-09-03 15:52:45 -06:00
Kynan Ware
9dfe89fe50 Increase backoff timing for agent task creation
Extended the max elapsed time and max interval for the exponential backoff strategy in agent task creation to improve reliability during retries.
2025-09-03 15:29:47 -06:00
Kynan Ware
b94ffe90c4 Add file input support to agent-task create command
The agent-task create command now accepts a task description from a file using the -F/--from-file flag, with mutual exclusivity enforced between inline and file input. Tests were updated to cover new input scenarios and error cases, and usage examples were added to the command help.
2025-09-03 15:29:47 -06:00
Kynan Ware
6a50ecb880
Merge pull request #11653 from cli/1013-gh-agent-task-create-creates-a-new-agent-task-and-responds-with-pr-url
Introduce `gh agent-task create`
2025-09-03 14:33:17 -06:00
Kynan Ware
a821b408d4 Update error messages and test repo handling in agent-task create
Replaces 'problem statement' with 'task description' in error messages for clarity. Refactors tests to use a BaseRepo function instead of direct repo objects, and adds a test for missing task description error.
2025-09-03 14:25:38 -06:00
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
Kynan Ware
e40170b263
Merge pull request #11654 from cli/kw/bump-rekor
Bump sigstore/rekor to v1.4.1
2025-09-03 09:49:43 -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