Theia API Documentation v1.76.0
    Preparing search index...

    Returns git diff --cached for one of the workspace's git repositories.

    git diff --cached is a plain, operator-free command that behaves the same on POSIX shells and Windows cmd.exe, and it renders staged additions of new files as complete addition diffs, so untracked files need no separate handling.

    The repository argument 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.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    description: string = ...

    Human-readable description of this tool, shown to the LLM.

    id: "getGitChanges" = GET_GIT_CHANGES_FUNCTION_ID

    The unique identifier of this tool. Must not be shellExecute.

    parameters: ToolRequestParameters = ...
    runningExecutions: Map<string, string>

    Maps tool call ids to the execution ids of their in-flight shell commands.

    scmService: ScmService
    timeout: number

    Timeout for the underlying shell execution, in milliseconds.

    truncation: OutputTruncationOptions = ...

    A 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.

    workspaceService: WorkspaceService

    Methods

    • Parameters

      • toolCallId: string

      Returns Promise<boolean>

    • Matches 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.

      Parameters

      • args: Record<string, unknown>

      Returns ScmRepository[]

    • The 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.

      Returns undefined | string

    • 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.

      Parameters

      Returns Promise<string>

      if the git command fails, so a fatal: ... message is never mistaken for a diff.

    • Parameters

      • toolCallId: string

      Returns boolean

    • Resolves 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.

      Parameters

      • args: Record<string, unknown>

      Returns string