ReadonlydescriptionHuman-readable description of this tool, shown to the LLM.
ReadonlyidThe unique identifier of this tool. Must not be shellExecute.
Protected ReadonlyparametersProtected ReadonlyrunningMaps tool call ids to the execution ids of their in-flight shell commands.
Protected ReadonlyscmProtected ReadonlyshellProtected ReadonlytimeoutTimeout for the underlying shell execution, in milliseconds.
Protected ReadonlytruncationA diff is only useful as a whole, so the shellExecute budget of 50 head plus 50 tail
lines is far too tight. The head is favoured over the tail because the leading hunks
describe the change; the backend caps stdout at 1MB regardless.
Protected ReadonlyworkspaceProtectedavailableProtectedbuildBuild the exact shell command to execute from the parsed arguments.
ProtectedcombineOptionaloptions: OutputTruncationOptionsProtectedexecuteOptionalctx: ToolInvocationContextProtectedfindMatches the repository argument against the known repositories by label or path. The
folder name alone is only used when nothing matches by label or path. Falls back to the
selected repository when the argument is absent. More than one result means the argument
is ambiguous.
ProtectedfindThe repository identified by the repository argument, or undefined if it is unknown or ambiguous.
ProtectedfirstThe first workspace root, or undefined when no workspace is open. Only a sensible
resolveWorkspaceRoot implementation for commands that produce the same output regardless
of cwd. In a multi-root workspace the first root is arbitrary.
Runs the diff for the given repository and returns it. Used directly by the commit-message generator, which already knows its repository and must not go through tool confirmation.
Returns an empty string when the execution was canceled.
OptionalcancellationToken: CancellationTokenProtectedhandleOptionalctx: ToolInvocationContextProtectednormalizePath separators and case differ across platforms and between user phrasings.
ProtectedrepositoryIdentifies a repository by the path of its root relative to the workspace, so that the label
is usable as the repository argument of a follow-up call. Workspace roots sharing a folder
name produce identical labels, which findRepositories reports as ambiguous.
ProtectedrequestedProtectedresolveResolves the working directory for the shell command, given the same parsed arguments that buildCommand receives, so a tool can let the caller pick the folder it runs in.
Deliberately abstract: the cwd materially affects most predefined commands (anything talking to a specific repository, build script, or per-folder tool), and silently defaulting to an arbitrary workspace root produces results that look plausible but describe the wrong folder.
Subclasses that genuinely do not care about the cwd can return
firstWorkspaceRoot or undefined.
ProtectedrunRuns execution and maps the raw server result onto the tool result shape.
Returns
git diff --cachedfor one of the workspace's git repositories.git diff --cachedis a plain, operator-free command that behaves the same on POSIX shells and Windowscmd.exe, and it renders staged additions of new files as complete addition diffs, so untracked files need no separate handling.The
repositoryargument is matched against the repositories the SCM service actually knows about, and the command then runs in that repository's root. The argument never reaches the shell, so a repository name cannot inject a command. An unknown or ambiguous name is answered with the list of valid ones rather than a silent fallback, so the model cannot mistake one repository's diff for another's.