Skip to content

copilot/gemini adapters fail when CLI is installed globally; cursor/opencode auth check too strict #5

Open

Description

@kpritam

copilot and gemini: `checkInstalled` fails for globally-installed CLIs

The `copilot` and `gemini` adapters use `resolvePackageBin` to locate `@github/copilot` and `@google/gemini-cli` respectively. This resolution walks the local `node_modules` chain from where spawn-agent itself is installed. When a user has the CLI installed globally (e.g. via `npm install -g` or a system package manager), the package is outside that chain and `checkInstalled` returns `false`, causing `resolve` to throw `AdapterNotFoundError`.

The other native-binary adapters (`cursor`, `opencode`, `droid`, `pi`) check for the binary using `runCommand(bin, ["--version"])` — a simple PATH lookup that works regardless of how the CLI was installed. The copilot and gemini adapters don't follow this pattern.

Observed:

  • `copilot` or `gemini` is on `PATH` and works fine when invoked directly
  • `SpawnAgent.connect("copilot", ...)` throws `AdapterNotFoundError: Adapter package not resolvable: @github/copilot`

Expected:

  • `checkInstalled` uses binary detection (like cursor/opencode do), so a globally-installed CLI is found

cursor: wrong auth subcommand — `agent auth whoami` does not exist

The cursor adapter's `checkAuthenticated` and `resolve` both call `agent auth whoami`. The Cursor agent CLI has no `auth` subcommand. The listed subcommands are `login`, `logout`, `status|whoami`, `mcp`, `models`, etc. — there is no `auth`.

When `agent auth whoami` is run, the CLI treats `auth whoami` as a prompt to the agent process rather than a subcommand. Without credentials the process exits 1 immediately with an error; with credentials it starts an interactive session. Either way it never exits 0 with non-empty stdout on the auth-check path.

The correct command for checking authentication status is `agent whoami` (or equivalently `agent status`), which exits 0 and prints the logged-in account to stdout when authenticated.

Observed:

  • `agent --help` lists `status|whoami` as the auth subcommand, not `auth whoami`
  • `agent auth whoami` exits 1 (treated as a prompt, no auth)
  • `agent whoami` exits 0 with non-empty stdout when authenticated
  • `checkAuthenticated("cursor")` always returns `false` even when the CLI is ready to run

Expected:

  • Auth check calls `agent whoami` (or `agent status`), which correctly reflects authentication state

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions