Commit graph

42 commits

Author SHA1 Message Date
William Martin
8a4154cfe7 Refactor cfg out of CAPI Client 2025-11-14 20:21:54 +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
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
151b971933
Merge pull request #11755 from cli/babakks/polish-agent-task-view
`gh agent-task view`: polish and fix some issues
2025-09-18 10:38:15 +01:00
Babak K. Shandiz
6927d642f6
fix(agent-task/shared): make capitalised status names consistent
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-18 10:16:00 +01:00
Kynan Ware
25c0d0cf90 Refactor comments in stripDiffFormat function
Simplified and clarified comments in the stripDiffFormat function to improve readability and maintainability. No functional changes were made to the code.
2025-09-17 12:16:04 -06:00
Kynan Ware
f6b49858a2 Remove obsolete log-3 test data files
Deleted log-3-input.txt and log-3-want.txt from testdata as they are no longer needed for current tests.
2025-09-17 12:09:51 -06:00
Babak K. Shandiz
87b310a881
fix(agent-task view): display completed sessions as "Ready for review"
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-17 11:58:04 +01:00
Kynan Ware
b3401ffd74 Refactor stripDiffFormat guard clause logic
Rearranged the guard clause in stripDiffFormat to return early if no hunk header is found, improving code clarity and reducing nesting.
2025-09-16 17:46:43 -06:00
Kynan Ware
c0a2648436 Use filepath.Ext to detect file extension in markdown renderer
Replaces manual string splitting with filepath.Ext for determining the file extension in renderFileContentAsMarkdown. This improves accuracy, especially for files with multiple dots in their names.
2025-09-16 17:34:57 -06:00
Kynan Ware
65b45adbd8 Improve log rendering error handling and test coverage
Refactors log rendering to print errors to stderr and continue processing on JSON parse or rendering failures, instead of returning early. Updates tests to check both stdout and stderr outputs, and adds new test cases and testdata for tolerant parsing and error scenarios.
2025-09-16 17:21:01 -06:00
Kynan Ware
97d3253aaf Prefix rendered shell commands with '$ ' in logs
Shell commands in log output are now prefixed with '$ ' for improved readability and consistency with common shell output conventions. Updated related test data and test helper comments to reflect this change.
2025-09-16 11:58:58 -06:00
Kynan Ware
d636f4c213 Clarify comment on CRLF normalization in tests
Updated comments in log_test.go to clarify that CRLF is normalized to LF for OS-agnostic test behavior, improving code readability.
2025-09-16 11:47:48 -06:00
Kynan Ware
37d8e0a438 Refactor generic tool call titles map to package scope
Moved the genericToolCallNamesToTitles map from inside the renderGenericToolCall function to a package-level variable for improved readability and potential reuse. This change also updates the function signature order for consistency.
2025-09-16 11:46:16 -06:00
Kynan Ware
f779a3d16c Add TODO for bash-related tool call details
Inserted a TODO comment to consider including more details for bash-related tool calls in the log rendering function.
2025-09-15 14:23:12 -06:00
Kynan Ware
77509fcfb3 Update comment for reasoning text formatting
Clarifies that reasoning text should be formatted as a normal 'thought' message without a heading, improving code documentation.
2025-09-15 14:19:31 -06:00
Kynan Ware
887e842717 Enable Bash session tool handling in log rendering
Uncomments and activates support for Bash session tool calls (write_bash, read_bash, stop_bash, async_bash, read_async_bash, stop_async_bash) in the renderLogEntry function. Also defines the corresponding argument structs, enabling proper handling and display of these tool calls in the log output.
2025-09-15 14:18:42 -06:00
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
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
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
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
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
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
922843301d
docs(agent-task/shared): add godoc to SessionStateString
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-09 10:57:51 +01:00
Babak K. Shandiz
e68e28ddf3
fix(agent-task/shared): add SessionSymbol func
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 17:02:45 +01:00
Babak K. Shandiz
09e1f2532d
test(agent-task/shared): add test for IsSessionID
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 17:02:15 +01:00
Babak K. Shandiz
5f6189be09
fix(agent-task/shared): add IsSessionID
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 16:58:25 +01:00
Babak K. Shandiz
92c7a56b82
feat(agent-task view): add view command
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-09-05 12:45:51 +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
4fd6ae6e3a Refactor session state color logic to shared package
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.
2025-08-29 15:23:40 -06:00