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.
Removed unnecessary conditional check for wantStdout in Test_createRun. Now always asserts equality between wantStdout and actual stdout output, improving test clarity.
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.
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.
Simplifies the error message when a repository is missing by removing the unnecessary 'error:' prefix, making the output clearer and more user-friendly.
Changed the command usage string from 'create <problem statement>' to 'create "<task description>"' for improved clarity in the agent task creation command.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Replaces linear search with a map for associating sessions with pull requests, improving performance and simplifying code in hydrateSessionPullRequests.
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.
Simplifies logic for filtering sessions to only include those with valid pull request and repository data. This reduces nested conditionals and improves code readability.
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>
Consolidates multiple individual test functions into a single table-driven test, improving maintainability and readability. This change makes it easier to add new test cases and ensures consistent test structure for agent task command authentication scenarios.
Changed the RunE function of the agent-task command to display help output instead of returning nil, improving user guidance when the command is run without arguments.
Introduces a new `agent-task` command under pkg/cmd/agent with strict OAuth (device flow) token validation. Includes comprehensive tests for token source and host validation, and registers the command in the root command set.
* feat: add ability to copy one-time OAuth code while authenticating
Signed-off-by: Andrey <andrekabatareika@gmail.com>
* fix(docs): wrong example for gh auth refresh
* chore(authflow): update message to include one-time code to it
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
* chore(authflow): improve message when copied one-time code
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
* chore(authflow): don't early return error when could not copy OAuth code
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
* refactor(authflow): make code for working with OAuth code more readable
* Adjust language in `gh auth` help for clipboard
---------
Signed-off-by: Andrey <andrekabatareika@gmail.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
* docs(release create): distinguish difference between '--generate-notes' and '--notes-from-tag'
Signed-off-by: Andrey <andrekabatareika@gmail.com>
* Clarify release notes behavior for unannotated tags
Updated help text to specify that if a git tag is not annotated, the release notes will use the commit message instead of the tag annotation.
---------
Signed-off-by: Andrey <andrekabatareika@gmail.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
* feat: add --force flag to run cancel command
Signed-off-by: Andrey <andrekabatareika@gmail.com>
* docs: use less prescriptive docs for --force flag
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
* chore: remove short flag
Signed-off-by: Andrey <andrekabatareika@gmail.com>
---------
Signed-off-by: Andrey <andrekabatareika@gmail.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>