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

    Locates the executable of the GitHub Copilot CLI on the machine running the backend.

    The CLI is a native executable that GitHub ships in a platform-specific package. It is looked up rather than bundled, because it is a large proprietary binary that an application does not necessarily carry: a packaged application (for example an AppImage) cannot execute a binary from inside its archive, and an installation may deliberately not ship it at all. Users install the CLI themselves, the same way as for the Claude Code integration.

    The native executable is resolved rather than the index.js entry point of the same package, so that it can be spawned directly. Spawning the JavaScript entry point would require a Node.js executable, which the backend does not have at hand: process.execPath is the Electron binary in an Electron application, and starting that would start a second application instead of the CLI.

    Index

    Constructors

    Properties

    configuredPath: undefined | string
    logger: ILogger
    resolution: undefined | Promise<string>

    Methods

    • The executable of a platform package that was installed alongside this application, if any.

      Both the module paths of this file and those of the Copilot SDK are searched, so that the package is found whether the installation hoisted it or nested it below the SDK.

      Returns Promise<string[]>

    • The location given in the environment, resolved the same way as a configured one.

      The variable is documented as doing what the preference does, so a directory or a launcher is accepted here as well. A value that leads nowhere is reported and then left behind rather than turned into an error, so that the remaining sources still get their chance.

      Returns Promise<string[]>

    • The names a CLI can go by in a directory that is on the PATH or that a user configured: the executable itself, and on Windows in addition the shim a global npm installation writes, since that is the only entry it puts there.

      Returns string[]

    • The executable of a globally installed CLI, for the case that the global binary directory is not on the PATH of the backend process. That is common when the application was started from a desktop launcher rather than from a shell.

      Returns Promise<string[]>

    • Whether the given path is something that starts the CLI rather than the CLI itself, which is either its JavaScript entry point or a shim of a global installation.

      Parameters

      • path: string

      Returns boolean

    • The executables a module directory can hold the CLI in.

      A global installation nests the platform package below the launcher rather than hoisting it, so the launcher is used to resolve from, and the hoisted layout is tried as well.

      Parameters

      • modules: string

      Returns string[]

    • The executable of a CLI that is on the PATH of the backend process.

      A global npm installation does not put the executable itself there but a launcher: a link to the JavaScript entry point on Linux and macOS, and a .cmd shim on Windows. Such a hit is therefore mapped to the platform package it belongs to, see toCandidatesOnPath.

      Returns Promise<string[]>

    • Accepts the configured location either as the executable itself or as the directory holding it, so that both what a user has on their PATH and what a package manager installed can be given.

      A configured launcher is followed to the executable it would start, because that is what which or whereis report for a global installation. Starting the launcher would work as well, but only for as long as a Node.js is on the PATH of the backend, which is nothing to rely on.

      Parameters

      • configured: string

      Returns Promise<undefined | string>

    • The executable of a platform package as Node.js resolves it from the given file.

      This is how the launcher of the CLI finds its own executable, and it is the only lookup that covers every layout: an installation hoists the platform package next to the launcher, while a global installation nests it below the launcher instead. The package points its main entry at the executable, so the directory of what was resolved is the directory holding it.

      Parameters

      • anchor: string

      Returns string[]

    • Sets the location the user configured, which takes precedence over every other source. A changed value discards what was resolved before.

      Parameters

      • path: undefined | string

      Returns void

    • Interprets what a copilot on the PATH points at: a launcher of a global npm installation is mapped to the executable of the platform package it would start, anything else is taken to be the executable itself.

      Parameters

      • target: string

      Returns string[]