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 brew install github/copilot/copilot
``` ```
Or use the `gh copilot` extension:
```bash
gh extension install github/gh-copilot
```
Verify installation: Verify installation:
```bash ```bash
copilot --help copilot --help
# or
gh copilot --help
``` ```
## Quick start ## Quick start

View File

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

View File

@ -445,7 +445,11 @@ export function buildCliArgs(params: {
} }
} }
if (params.promptArg !== undefined) { 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; return args;
} }

View File

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

View File

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