# Interface ICliAdapter

CLI adapter interface. Abstracts CLI integration with transport-agnostic execution. (Source: cli-project_plan.md v2.1.0, Phase 2)

interface ICliAdapter {
name: "claude" | "gemini" | "codex" | "opencode";
transport: CliTransport;
capabilities: CliCapabilityProfile;
execute(
task: CliTask,
options?: CliExecutionOptions,
): Promise<Result<CliResponse, CliError>>;
healthCheck(): Promise<HealthStatus>;
getCapacity(): Promise<CapacityStatus>;
getVersion(): Promise<string>;
getModelInfo(): CliModelInfo;
initialize(): Promise<void>;
dispose(): Promise<void>;
listModels?(): Promise<readonly CliModelInfo[]>;
}

#### Implemented by

- BaseCliAdapter

- Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:108

##### Index

### Properties

name
transport
capabilities

### Methods

execute
healthCheck
getCapacity
getVersion
getModelInfo
initialize
dispose
listModels?

## Properties

### `Readonly` name

name: "claude" | "gemini" | "codex" | "opencode"

CLI name

- Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:110

### `Readonly` transport

transport: CliTransport

Transport type

- Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:112

### `Readonly` capabilities

capabilities: CliCapabilityProfile

Capability profile

- Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:114

## Methods

### execute

- execute(
  task: CliTask,
  options?: CliExecutionOptions,
  ): Promise<Result<CliResponse, CliError>>

  Executes a task on the CLI.

  #### Parameters

  - task: CliTask

    Task to execute

  - `Optional` options: CliExecutionOptions

    Execution options

  #### Returns Promise<Result<CliResponse, CliError>>

  Result with response or error

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:123

### healthCheck

- healthCheck(): Promise<HealthStatus>

  Performs a health check on the CLI.

  #### Returns Promise<HealthStatus>

  Health status including version compatibility

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:130

### getCapacity

- getCapacity(): Promise<CapacityStatus>

  Gets current capacity/rate limit status.

  #### Returns Promise<CapacityStatus>

  Capacity status

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:137

### getVersion

- getVersion(): Promise<string>

  Gets CLI version.

  #### Returns Promise<string>

  Version string

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:144

### getModelInfo

- getModelInfo(): CliModelInfo

  Gets model information.

  #### Returns CliModelInfo

  Model info

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:151

### initialize

- initialize(): Promise<void>

  Initializes the adapter (e.g., MCP connection). Called before first use.

  #### Returns Promise<void>

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:157

### dispose

- dispose(): Promise<void>

  Cleans up resources (e.g., subprocess, MCP connection). Called on shutdown.

  #### Returns Promise<void>

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:163

### `Optional` listModels

- listModels?(): Promise<readonly CliModelInfo[]>

  (#2540) Optional: list models the underlying CLI installation/runtime has available. Implementations should cache for ~5 min and throw on failure so the caller can fall back. Adapters whose CLIs have no native list surface (claude, codex, gemini) leave this undefined.

  #### Returns Promise<readonly CliModelInfo[]>

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:171