diff --git a/packages/opencode/src/cli/cmd/cmd.ts b/packages/opencode/src/cli/cmd/cmd.ts index ee6da7b45fa..fe6d62d7b62 100644 --- a/packages/opencode/src/cli/cmd/cmd.ts +++ b/packages/opencode/src/cli/cmd/cmd.ts @@ -1,5 +1,7 @@ import type { CommandModule } from "yargs" -export function cmd(input: CommandModule) { +type WithDoubleDash = T & { "--"?: string[] } + +export function cmd(input: CommandModule>) { return input } diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts index b646f0b15b7..847b19adbfb 100644 --- a/packages/opencode/src/cli/cmd/run.ts +++ b/packages/opencode/src/cli/cmd/run.ts @@ -88,7 +88,7 @@ export const RunCommand = cmd({ }) }, handler: async (args) => { - let message = args.message.join(" ") + let message = [...args.message, ...(args["--"] || [])].join(" ") const fileParts: any[] = [] if (args.file) { diff --git a/packages/opencode/src/index.ts b/packages/opencode/src/index.ts index 38b6b5a3f0b..5fb6f966cfd 100644 --- a/packages/opencode/src/index.ts +++ b/packages/opencode/src/index.ts @@ -39,6 +39,7 @@ process.on("uncaughtException", (e) => { }) const cli = yargs(hideBin(process.argv)) + .parserConfiguration({ "populate--": true }) .scriptName("opencode") .help("help", "show help") .alias("help", "h")