From 8f449fbd324608e1a612da37ce08642902c11f0e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 06:17:49 +0000 Subject: [PATCH 1/2] Initial plan From 79b3a846b7038f957ffb3ec77b4a0fecf24fca43 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 06:26:30 +0000 Subject: [PATCH 2/2] Add comprehensive JSDoc comments to copilotcliTools.ts Co-authored-by: DonJayamanne <1948812+DonJayamanne@users.noreply.github.com> --- .../copilotcli/common/copilotcliTools.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/extension/agents/copilotcli/common/copilotcliTools.ts b/src/extension/agents/copilotcli/common/copilotcliTools.ts index d17f1fab2d..206acdd667 100644 --- a/src/extension/agents/copilotcli/common/copilotcliTools.ts +++ b/src/extension/agents/copilotcli/common/copilotcliTools.ts @@ -5,11 +5,26 @@ import { URI } from '../../../../util/vs/base/common/uri'; +/** + * Arguments for the Copilot CLI str_replace_editor tool. + * This tool is used by Copilot CLI to perform file editing operations. + */ interface StrReplaceEditorArgs { + /** The edit command to execute */ command: 'view' | 'str_replace' | 'insert' | 'create' | 'undo_edit'; + /** The file path to operate on */ path: string; } +/** + * Type guard to check if a tool call is a Copilot CLI edit operation. + * This function validates that the tool is the str_replace_editor and that it's + * performing an actual edit operation (not just viewing). + * + * @param toolName - The name of the tool being invoked + * @param toolArgs - The arguments passed to the tool + * @returns true if this is a Copilot CLI edit tool call (excludes 'view' commands) + */ export function isCopilotCliEditToolCall(toolName: string, toolArgs: unknown): toolArgs is StrReplaceEditorArgs { return toolName === 'str_replace_editor' && typeof toolArgs === 'object' @@ -18,6 +33,15 @@ export function isCopilotCliEditToolCall(toolName: string, toolArgs: unknown): t && toolArgs.command !== 'view'; } +/** + * Extracts the list of file URIs that will be affected by a Copilot CLI edit tool call. + * This is used to track which files are being modified during a Copilot CLI session. + * + * @param toolName - The name of the tool being invoked + * @param toolArgs - The arguments passed to the tool + * @returns An array of URIs for files that will be affected by the edit operation. + * Returns an empty array if the tool is not an edit operation or has no path. + */ export function getAffectedUrisForEditTool(toolName: string, toolArgs: unknown): URI[] { if (isCopilotCliEditToolCall(toolName, toolArgs) && toolArgs.path) { return [URI.file(toolArgs.path)];