Commit graph

11279 commits

Author SHA1 Message Date
Kynan Ware
2c68168611 Rename testdata log files for clarity
Renamed sample log input and expected output files in testdata to use a consistent 'log-*-input.txt' and 'log-*-want.txt' naming scheme. Updated references in log_test.go to match the new file names for improved clarity and maintainability.
2025-09-15 13:52:14 -06:00
Kynan Ware
f33ef4227a Normalize line endings in log testdata files too 2025-09-15 13:43:12 -06:00
Kynan Ware
62d7a7541a Fix line ending conversion in tests 2025-09-15 13:41:19 -06:00
Kynan Ware
87d8d835f7 Add note for updating testdata files in log tests
A comment was added to TestFollow with instructions on how to update the .want testdata files when test outputs change. This helps maintainers regenerate expected output files more easily.
2025-09-15 13:36:35 -06:00
Kynan Ware
0b5a0491ca Make log tests OS-agnostic by normalizing line endings
Updated TestFollow to normalize line endings in test log files, ensuring consistent behavior across different operating systems, especially Windows.
2025-09-15 13:27:01 -06:00
Kynan Ware
ab796c80ef Fix comment for GetSessionLogs method 2025-09-15 13:07:00 -06:00
Kynan Ware
e5e7bc8ad6 Add and improve function documentation in log.go
Added and expanded Go doc comments for multiple functions in pkg/cmd/agent-task/shared/log.go to clarify their purpose and usage. Also refactored renderToolCallTitle and related logic for improved naming consistency and robustness.
2025-09-15 13:05:47 -06:00
Kynan Ware
6bbb5c43c5 Update log test expectation files 2025-09-15 12:46:08 -06:00
Kynan Ware
282a25f466 Rename renderToolCall to renderToolCallTitle
Refactors the function renderToolCall to renderToolCallTitle and updates all its usages for clarity. This improves function naming to better reflect its purpose of rendering tool call titles.
2025-09-15 12:41:46 -06:00
Kynan Ware
3829cff8da Rename relativePath to relativeFilePath in log rendering
Refactored the function name from relativePath to relativeFilePath for clarity and updated all usages accordingly in log rendering functions. Also improved comments in stripDiffFormat for better context.
2025-09-15 12:41:17 -06:00
Kynan Ware
718c462454 Refactor markdown rendering helper function names
Renamed renderMarkdownWithPadding to renderMarkdownWithFormat and related variables for clarity. Updated comments and TODOs for better context on GUI support and code behavior.
2025-09-15 12:34:44 -06:00
Kynan Ware
ec3fce0dfb Improve log rendering and tool call handling
Enhances log rendering by stripping diff formatting from viewed file content and improving JSON rendering with optional labels. Expands the list of recognized tool calls with descriptive titles, especially for Playwright and GitHub MCP server tools. Refactors related helper functions for clarity and robustness.
2025-09-15 10:13:55 -06:00
Kynan Ware
9e16a82e5e Refactor JSON content rendering in log entries
Extracted JSON content rendering into a new helper function renderContentAsJSONMarkdown for reuse. Updated 'report_progress' and 'create' tool call handling to use this helper, improving code clarity and reducing duplication. Also added support for rendering PR descriptions in 'report_progress' tool calls.
2025-09-15 10:13:55 -06:00
Kynan Ware
0fb10fca7d Various log rendering improvements
Updated the LogRenderer interface and implementations to accept *iostreams.IOStreams instead of *iostreams.ColorScheme, enabling access to terminal theme and width for improved markdown rendering. Refactored related code, tests, and mocks to support this change, and enhanced log rendering to better handle markdown and code output for various tool calls.
2025-09-15 10:13:55 -06:00
Babak K. Shandiz
1155e83070 feat(agent-task view): add --log and --follow flags
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-15 10:13:55 -06:00
Babak K. Shandiz
1ccbb0af83 feat(agent-task view): add --log and --follow flags
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-15 10:13:55 -06:00
Babak K. Shandiz
05e609c5b3 fix(agent-task/shared): add log renderer
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-15 10:13:55 -06:00
Babak K. Shandiz
fbcdeed41f feat(agent-task/capi): add GetSessionLogs method
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-15 10:13:55 -06:00
Benjamin Levesque
e2df8ac1cc
address copilot comment on parameter order 2025-09-13 22:33:27 +02:00
Benjamin Levesque
5ae0410bd2
add examples 2025-09-13 22:25:20 +02:00
Benjamin Levesque
a69f7a6b53
simplify exporter usage 2025-09-13 22:14:59 +02:00
Benjamin Levesque
5abb467e69
remove includeScope 2025-09-13 21:50:06 +02:00
Benjamin Levesque
54bf8432f6
do not mutate opts.ShowToken 2025-09-13 21:35:02 +02:00
Benjamin Levesque
60088e0e7d
move displayToken to String method 2025-09-13 21:30:20 +02:00
Benjamin Levesque
b38e12ef61
move flag validation to RunE 2025-09-13 21:30:19 +02:00
Kynan Ware
48cf448622
Merge pull request #11708 from cli/kw/edit-file-and-prompt-for-confirmation-interactively
`gh agent task create`: Allow interactively editing task description file and add confirmation prompt
2025-09-11 11:44:39 -06:00
Kynan Ware
3831380d13 Add error type assertion to createRun tests
Introduces a new 'wantErrIs' field to test cases in Test_createRun to assert specific error types using require.ErrorIs. This enhances test coverage by verifying not only error messages but also error types.
2025-09-11 11:23:18 -06:00
Kynan Ware
1dbb694790 Add test for non-interactive problem statement input
Adds a test case to ensure that when a problem statement is provided as an argument non-interactively, the command does not prompt or return an error, and the correct job is created.
2025-09-11 09:24:42 -06:00
Kynan Ware
f22dc9271b Update test to use edited task description
Modified the test in create_test.go to return and expect 'edited task description' instead of concatenating the prompt string. This clarifies the test's intent and expected behavior for the MarkdownEditorFunc and CreateJobFunc.
2025-09-11 09:22:27 -06:00
Kynan Ware
666f5574e4 Remove unused stdin field from create command tests
The 'stdin' field and related code were removed from TestNewCmdCreate as they were no longer used. This simplifies the test structure and eliminates unnecessary code.
2025-09-11 09:20:48 -06:00
Kynan Ware
872cf495c2 Refactor create command tests and add base branch case
Removed redundant test cases for file input and stdin in TestNewCmdCreate, and added a new test to verify that the base branch argument sets the BaseBranch field correctly.
2025-09-11 09:19:52 -06:00
Babak K. Shandiz
bfa0975caf
Merge pull request #11707 from cli/babakks/accept-agent-sessions-url-in-view-cmd
`gh agent-task view`: accept `/agent-sessions/*` URL as argument
2025-09-11 09:16:13 +01:00
Babak K. Shandiz
10e4abc515
refactor(pr/shared): rename rest to tail
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-11 09:04:17 +01:00
Babak K. Shandiz
1c37ab9453
refactor(agent-task/shared): enhance symbol names
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-11 09:03:36 +01:00
Kynan Ware
deee0c61ed Update command examples for agent-task create
Improves the help text for the 'gh agent-task create' command by clarifying the editor usage example and adding an example for using a file as a template.
2025-09-10 18:39:35 -06:00
Kynan Ware
c0a5b9aced Refactor agent-task create to improve file input handling
Moves file reading for the problem statement from argument parsing to execution, storing the file path in CreateOptions. Updates error handling and user prompts to better distinguish between interactive and non-interactive modes. Refactors and expands tests to match the new logic and improve coverage for file and prompt scenarios.
2025-09-10 18:19:12 -06:00
Babak K. Shandiz
2311a04688
fix(pr/shared): ensure ParseURL regexp is backward-compatible
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 19:07:52 +01:00
Babak K. Shandiz
b079ea82e5
refactor(agent-task/shared): extract uuid pattern
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 19:07:03 +01:00
Babak K. Shandiz
6b872923ea
refactor(agent-task view): rename resourceID to prID
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 18:57:58 +01:00
Babak K. Shandiz
3798d98969
feat(agent-task view): support PR /agent-sessions/* URL as argument
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 18:57:58 +01:00
Babak K. Shandiz
7e21837f3d
fix(agent-task/shared): add ParsePullRequestAgentSessionURL
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 18:57:57 +01:00
Babak K. Shandiz
78b09e55e5
fix(pr/shared): add rest return value to ParseURL
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 18:57:57 +01:00
Kynan Ware
20c89043bb
Merge pull request #11704 from cli/babakks/add-web-flag-to-view-cmd
`gh agent-task view`: add `--web` flag
2025-09-10 11:54:59 -06:00
Kynan Ware
7763060ba2
Merge pull request #11700 from cli/kw/1017-gh-agent-task-create-prompts-for-task-description-via-editor
`gh agent-task create`: prompt for task description using editor
2025-09-10 11:16:27 -06:00
Babak K. Shandiz
6a5481368f
docs(agent-task view): improve --help docs
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 13:53:45 +01:00
Babak K. Shandiz
4cebd35791
refactor(agent-task create): assign Config at instantiation
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 12:48:31 +01:00
Babak K. Shandiz
b463395d48
fix(agent-task create): only prompt for problem statement if not provided
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 12:45:34 +01:00
Babak K. Shandiz
88e2d0d7d9
fix(agent-task view): stop progress indicator before opening browser
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 11:41:49 +01:00
Babak K. Shandiz
b3b8697cf3
test(agent-task view): enhance naming and stubs
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 11:05:29 +01:00
Babak K. Shandiz
ecbad7ecb9
test(agent-task view): add --web mode tests
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-10 11:05:29 +01:00