Kynan Ware
ad41bb967d
Merge pull request #12807 from maxbeizer/agent-task-view-json
...
Add --json support to `gh agent-task view`
2026-03-02 13:36:06 -07:00
Max Beizer
d908af3484
Emit null for zero createdAt/updatedAt values
...
Consistent with completedAt handling. Addresses Copilot review feedback
from companion PR #12807 .
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 10:18:37 -06:00
Max Beizer
0d05a8acca
Address Copilot review feedback
...
- Prioritize --json output over --log/--follow so JSON is not silently ignored
- Emit null for zero createdAt/updatedAt values, consistent with completedAt
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 10:18:21 -06:00
Max Beizer
ceb8cf2561
Polish --json support for agent-task view
...
- Rename 'status' field to 'state' for consistency with struct and UI
- Add missing JSON fields: completedAt, user, pullRequestTitle, pullRequestState
- Add test for nil PullRequest with --json
- Expand existing JSON test to cover new fields
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 09:09:08 -06:00
Max Beizer
c5c107aa8b
Polish --json support for agent-task list
...
- Fix empty results returning error instead of [] when --json is used
- Rename 'status' field to 'state' for consistency with struct and UI
- Add missing JSON fields: completedAt, user, pullRequestTitle, pullRequestState
- Add test for empty results with --json
- Add test for nil PullRequest with --json
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 09:08:18 -06:00
Max Beizer
250d5a850a
Fix gofmt alignment in view_test.go
...
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 08:57:53 -06:00
Max Beizer
7241b42ecf
Add --json support to gh agent-task view
...
Add --json, --jq, and --template flags to `gh agent-task view`,
consistent with the pattern used by `gh pr view --json`,
`gh issue view --json`, etc.
This reuses the same ExportData interface and SessionFields defined
for list, applying them to the single-session view output.
Closes https://github.com/cli/cli/issues/12805 (partial)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 09:22:28 -06:00
Max Beizer
0d9e6af3da
Add --json support to gh agent-task list
...
Add --json, --jq, and --template flags to `gh agent-task list`,
consistent with the pattern used by `gh pr list --json`,
`gh issue list --json`, etc.
This implements the ExportData interface on capi.Session and defines
SessionFields for the available JSON fields:
id, name, status, repository, createdAt, updatedAt,
pullRequestNumber, pullRequestUrl.
Closes https://github.com/cli/cli/issues/12805 (partial)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 09:20:13 -06:00
Babak K. Shandiz
4681b40e70
fix(agent-task/capi): fix capi API version
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2026-02-20 18:04:12 +00:00
Andy Feller
e85877dd75
Remove extra flag default from help usage
...
Fixes #12153
2025-11-17 10:09:17 -05:00
William Martin
8a4154cfe7
Refactor cfg out of CAPI Client
2025-11-14 20:21:54 +01:00
Kynan Ware
44653c5aeb
Add example for --custom-agent usage
...
Added a usage example to the help text demonstrating how to create a task with a custom agent using the --custom-agent flag.
2025-10-31 16:18:10 -06:00
Kynan Ware
5d17666a69
Update error messages in job creation tests
2025-10-31 16:16:03 -06:00
Kynan Ware
591050a8d2
Update pkg/cmd/agent-task/capi/job.go
...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-31 16:06:37 -06:00
Kynan Ware
0dcb1d1e43
Add shorthand flag for custom-agent option
...
Introduces the '-a' shorthand for the --custom-agent flag in the agent-task create command, improving CLI usability.
2025-10-31 15:59:23 -06:00
Kynan Ware
24885040cb
Fix: do not swallow job creation error
...
Reads the response body before decoding to allow multiple decoding attempts. Enhances error reporting by including HTTP status and error messages from both Job and JobError structures when job creation fails.
2025-10-31 15:54:01 -06:00
Kynan Ware
64de314640
Clarify custom agent flag description
...
Updated the help text for the --custom-agent flag to provide an example usage, making it clearer how to specify a custom agent for the task.
2025-10-31 15:10:03 -06:00
Kynan Ware
17085d3c5e
Add custom agent support to job creation
...
Introduces a 'customAgent' parameter to the CreateJob API, CLI options, and related mocks and tests.
2025-10-31 14:57:48 -06:00
Kynan Ware
91c6bc609a
Add new displaying message to test expectation
...
Updated the Test_createRun test to expect a message indicating that session logs are being displayed for the job
2025-10-07 23:37:43 -06:00
Kynan Ware
a78bb5e899
Fix --follow not killing the progress indicator
...
Fixes --follow not stopping the progress indicator. Also includes a nice message to indicate what is happening because even after we create the agent task, there's a period of time where we poll and receive nothing as the task session starts. We want there to be some sort of feedback in that period of time to not make the user panic and think it has hanged.
2025-10-07 23:19:45 -06:00
Kynan Ware
8c75079bf2
Add math package import to sessions.go
...
Imported the math package in sessions.go
2025-09-23 09:33:26 -06:00
Kynan Ware
e673dfe61c
Add TODO for better integer handling in GetPullRequestDatabaseID
2025-09-23 09:28:08 -06:00
Babak K. Shandiz
6fc5742a68
fix(agent-task/capi): return proper error message when resp is not a JSON
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-22 12:59:51 +01:00
Babak K. Shandiz
002ba54683
Merge pull request #11763 from cli/babakks/display-session-error
...
`gh agent-task view`: display session error if any
2025-09-22 11:57:29 +01:00
Babak K. Shandiz
eb3c842818
test(agent-task view): populate Session.Name in all test cases
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 17:39:06 +01:00
Babak K. Shandiz
ecfbb67e99
fix(agent-task view): improve session overview
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 17:37:25 +01:00
Babak K. Shandiz
3e43a98814
refactor(agent-task view): merge empty println calls with next
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 16:47:40 +01:00
Babak K. Shandiz
3091c21320
fix(agent-task view): re-fetch session to get all pieces of data
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 16:45:42 +01:00
Babak K. Shandiz
597cdaf081
fix(agent-task/capi): remove fallback to viewer when user id is zero
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 15:37:46 +01:00
Babak K. Shandiz
eba31343a8
test(agent-tassk/capi): update ListSessionsByResourceID tests
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:31:03 +01:00
Babak K. Shandiz
2fe60d9105
docs(agent-task/capi): add TODO note for dropping local ID generation
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:30:29 +01:00
Babak K. Shandiz
a108b4ee95
fix(agent-task/capi): fetch viewer when resource session user id is zero
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:29:44 +01:00
Babak K. Shandiz
9148f41cc6
fix(agent-task/capi): handle unpopulated resource session LastUpdatedAt
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:28:46 +01:00
Babak K. Shandiz
546ab1cf4b
refactor(agent-task/capi): keep resource private
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-19 14:27:08 +01:00
Ariel Deitcher
185e36c60f
update agents resource route
2025-09-18 17:20:16 -07:00
Babak K. Shandiz
123c9eaba8
fix(agent-task view): improve session error
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 16:14:31 +01:00
Babak K. Shandiz
beba8f6387
fix(agent-task view): display session error
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 16:12:11 +01:00
Babak K. Shandiz
e5739cc545
fix(agent-task/capi): add WorkflowRunID field to Session
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 16:11:17 +01:00
Babak K. Shandiz
b6816ad89a
refactor(agent-task/capi): remove unused slice
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 15:05:28 +01:00
Babak K. Shandiz
3ed9034ff8
fix(agent-task/capi): add Error field to Session
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 15:04:06 +01:00
Babak K. Shandiz
863329b4c1
fix(agent-task create): block empty problem statement arg
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 14:14:59 +01:00
Babak K. Shandiz
c7a811e567
fix(agent-task create): use pager when following logs
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 13:55:37 +01:00
Babak K. Shandiz
cb9808fa6e
fix(agent-task create): avoid prompting when problem statement is provided
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 13:51:13 +01:00
Babak K. Shandiz
4a0c32ef9f
fix(agent-task list): show capitalised session state
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:34:27 +01:00
Babak K. Shandiz
764376836c
fix(agent-task/shared): fix session state value
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:33:47 +01:00
Babak K. Shandiz
7d163eaf27
docs(agent-task list): add "(preview)" note to cmd docs
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:20:34 +01:00
Babak K. Shandiz
169f45daf9
chore(agent-task/shared): regenerate LogRenderer mock
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:55 +01:00
Babak K. Shandiz
6235c33ff0
test(agent-task/capi): assert session with zero resource ID are kept
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:55 +01:00
Babak K. Shandiz
c68d1a31c0
fix(agent-task/capi): keep sessions with no resource attached
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:55 +01:00
Babak K. Shandiz
5f73d3b438
refactor(agent-task list): remove unused BaseRepo from ListOptions
...
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 12:00:54 +01:00