-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add cli agent choice #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e61aa19
182d59f
ef5ac75
8db9c38
8d96540
8ce6f54
0b9b43e
ea15a74
533912e
e8f7fc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||
| /** | ||||||
| * Claude CLI adapter | ||||||
| * | ||||||
| * Supports the Anthropic Claude CLI tool | ||||||
| * https://github.com/anthropics/claude-cli | ||||||
| */ | ||||||
|
|
||||||
| import type { CliAdapter, CliAdapterOptions, CliCommandConfig } from './types'; | ||||||
|
|
||||||
| const DEFAULT_MODEL = 'claude-opus-4-20250514'; | ||||||
|
||||||
| const DEFAULT_MODEL = 'claude-opus-4-20250514'; | |
| export const DEFAULT_MODEL = 'claude-opus-4-20250514'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not applicable any more.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /** | ||
| * Copilot CLI adapter | ||
| * | ||
| * Supports the GitHub Copilot CLI tool | ||
| */ | ||
|
|
||
| import type { CliAdapter, CliAdapterOptions, CliCommandConfig } from './types'; | ||
|
|
||
| // Default model for the GitHub Copilot CLI; can be overridden via options.model | ||
| const DEFAULT_MODEL = 'gpt-4o'; | ||
|
|
||
| export const copilotAdapter: CliAdapter = { | ||
| name: 'copilot', | ||
|
|
||
| buildCommand(options: CliAdapterOptions): CliCommandConfig { | ||
| const model = options.model ?? DEFAULT_MODEL; | ||
|
|
||
| return { | ||
| command: 'copilot', | ||
| args: [ | ||
| // Note: copilot does not use -p flag | ||
| '--model', model, | ||
| '--allow-all-tools', | ||
| ], | ||
| }; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /** | ||
| * CLI Adapter factory | ||
| * | ||
| * Registry and factory for CLI adapters | ||
| */ | ||
|
|
||
| import type { CliAdapter } from './types'; | ||
| import { claudeAdapter } from './claude'; | ||
| import { copilotAdapter } from './copilot'; | ||
|
|
||
| // Re-export types | ||
| export type { CliAdapter, CliAdapterOptions, CliCommandConfig } from './types'; | ||
|
|
||
| /** | ||
| * Registry of available CLI adapters | ||
| */ | ||
| const adapters: Map<string, CliAdapter> = new Map([ | ||
| ['claude', claudeAdapter], | ||
| ['copilot', copilotAdapter], | ||
| ]); | ||
|
|
||
| /** | ||
| * List of available CLI tool names (for help text and validation) | ||
| */ | ||
| export const AVAILABLE_CLI_TOOLS = Array.from(adapters.keys()); | ||
|
|
||
| /** | ||
| * Default CLI tool to use | ||
| */ | ||
| export const DEFAULT_CLI_TOOL = 'claude'; | ||
|
|
||
| /** | ||
| * Get a CLI adapter by name | ||
| * | ||
| * @param name - The name of the CLI tool (e.g., 'claude', 'copilot') | ||
| * @returns The CLI adapter | ||
| * @throws Error if the adapter is not found | ||
| */ | ||
| export function getCliAdapter(name: string): CliAdapter { | ||
| const adapter = adapters.get(name); | ||
|
|
||
| if (!adapter) { | ||
| const available = AVAILABLE_CLI_TOOLS.join(', '); | ||
| throw new Error(`Unknown CLI tool: '${name}'. Available tools: ${available}`); | ||
| } | ||
|
|
||
| return adapter; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** | ||
| * CLI Adapter types for supporting multiple AI CLI tools | ||
| */ | ||
|
|
||
| /** | ||
| * Options passed to the adapter when building the command | ||
| */ | ||
| export interface CliAdapterOptions { | ||
| model?: string; | ||
| } | ||
|
|
||
| /** | ||
| * The command configuration returned by an adapter | ||
| */ | ||
| export interface CliCommandConfig { | ||
| command: string; | ||
| args: string[]; | ||
| } | ||
|
|
||
| /** | ||
| * Interface that all CLI adapters must implement | ||
| */ | ||
| export interface CliAdapter { | ||
| /** Unique identifier for this CLI tool */ | ||
| name: string; | ||
|
|
||
| /** Build the command and arguments for executing the CLI */ | ||
| buildCommand(options: CliAdapterOptions): CliCommandConfig; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help text states 'defaults to CLI tool's default model', but doesn't indicate what those defaults are. Consider mentioning that Claude defaults to 'claude-opus-4-20250514' and Copilot to 'gpt-4o', or link to documentation where users can find this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can assume folks know how to find the model for their given CLI.