feat: mode flag in cli run command

This commit is contained in:
adamdottv 2025-07-10 10:13:15 -05:00
parent d3e5f3f3a8
commit 5dc1920a4c
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
2 changed files with 10 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import { Flag } from "../../flag/flag"
import { Config } from "../../config/config"
import { bootstrap } from "../bootstrap"
import { MessageV2 } from "../../session/message-v2"
import { Mode } from "../../session/mode"
const TOOL: Record<string, [string, string]> = {
todowrite: ["Todo", UI.Style.TEXT_WARNING_BOLD],
@ -52,6 +53,10 @@ export const RunCommand = cmd({
alias: ["m"],
describe: "model to use in the format of provider/model",
})
.option("mode", {
type: "string",
describe: "mode to use",
})
},
handler: async (args) => {
let message = args.message.join(" ")
@ -139,10 +144,14 @@ export const RunCommand = cmd({
UI.error(err)
})
// TODO: dax, should this impact model selection as well?
const mode = args.mode ? await Mode.get(args.mode) : await Mode.list().then((x) => x[0])
const result = await Session.chat({
sessionID: session.id,
providerID,
modelID,
mode: mode.name,
parts: [
{
type: "text",

View file

@ -284,7 +284,7 @@ export namespace Session {
sessionID: string
providerID: string
modelID: string
mode: string
mode?: string
parts: MessageV2.UserPart[]
}) {
const l = log.clone().tag("session", input.sessionID)