fix: copilot-cli integration

This commit is contained in:
Hector Flores 2026-01-28 16:57:57 -06:00
parent c4876ce0dc
commit 053839938b
5 changed files with 11 additions and 11 deletions

View File

@ -32,18 +32,10 @@ Or via Homebrew:
brew install github/copilot/copilot
```
Or use the `gh copilot` extension:
```bash
gh extension install github/gh-copilot
```
Verify installation:
```bash
copilot --help
# or
gh copilot --help
```
## Quick start

View File

@ -85,10 +85,11 @@ const DEFAULT_CODEX_BACKEND: CliBackendConfig = {
const DEFAULT_COPILOT_CLI_BACKEND: CliBackendConfig = {
command: "copilot",
args: ["-p"],
resumeArgs: ["-p", "--resume", "{sessionId}"],
args: ["--allow-all-tools"],
resumeArgs: ["--allow-all-tools", "--resume", "{sessionId}"],
output: "text",
input: "arg",
promptArg: "-p",
modelArg: "--model",
modelAliases: COPILOT_CLI_MODEL_ALIASES,
sessionIdFields: ["session_id", "sessionId"],

View File

@ -445,7 +445,11 @@ export function buildCliArgs(params: {
}
}
if (params.promptArg !== undefined) {
args.push(params.promptArg);
if (params.backend.promptArg) {
args.push(params.backend.promptArg, params.promptArg);
} else {
args.push(params.promptArg);
}
}
return args;
}

View File

@ -36,6 +36,7 @@ export function isCliProvider(provider: string, cfg?: MoltbotConfig): boolean {
const normalized = normalizeProviderId(provider);
if (normalized === "claude-cli") return true;
if (normalized === "codex-cli") return true;
if (normalized === "copilot-cli") return true;
const backends = cfg?.agents?.defaults?.cliBackends ?? {};
return Object.keys(backends).some((key) => normalizeProviderId(key) === normalized);
}

View File

@ -87,6 +87,8 @@ export type CliBackendConfig = {
imageArg?: string;
/** How to pass multiple images. */
imageMode?: "repeat" | "list";
/** Flag used to pass the prompt (e.g. -p, --prompt). */
promptArg?: string;
/** Serialize runs for this CLI. */
serialize?: boolean;
};