test(cli): batch 82 (10 files)
This commit is contained in:
+52
-16
@@ -1,4 +1,4 @@
|
||||
import { Command } from "commander"
|
||||
import { Command, Option } from "commander"
|
||||
import { install } from "./install"
|
||||
import { run } from "./run"
|
||||
import { getLocalVersion } from "./get-local-version"
|
||||
@@ -6,6 +6,7 @@ import { doctor } from "./doctor"
|
||||
import { refreshModelCapabilities } from "./refresh-model-capabilities"
|
||||
import { createMcpOAuthCommand } from "./mcp-oauth"
|
||||
import { boulder } from "./boulder"
|
||||
import { isLazycodexPublishingEnabled } from "./lazycodex-feature-flag"
|
||||
import type { InstallArgs } from "./types"
|
||||
import type { RunOptions } from "./run"
|
||||
import type { GetLocalVersionOptions } from "./get-local-version/types"
|
||||
@@ -16,6 +17,48 @@ const VERSION = packageJson.version
|
||||
|
||||
const program = new Command()
|
||||
|
||||
type InstallCommandOptions = {
|
||||
readonly tui?: boolean
|
||||
readonly claude?: InstallArgs["claude"]
|
||||
readonly openai?: InstallArgs["openai"]
|
||||
readonly gemini?: InstallArgs["gemini"]
|
||||
readonly copilot?: InstallArgs["copilot"]
|
||||
readonly platform?: InstallArgs["platform"]
|
||||
readonly opencodeZen?: InstallArgs["opencodeZen"]
|
||||
readonly zaiCodingPlan?: InstallArgs["zaiCodingPlan"]
|
||||
readonly kimiForCoding?: InstallArgs["kimiForCoding"]
|
||||
readonly opencodeGo?: InstallArgs["opencodeGo"]
|
||||
readonly vercelAiGateway?: InstallArgs["vercelAiGateway"]
|
||||
readonly codexAutonomous?: InstallArgs["codexAutonomous"]
|
||||
readonly skipAuth?: boolean
|
||||
}
|
||||
|
||||
type Environment = Readonly<Record<string, string | undefined>>
|
||||
|
||||
export function resolveInstallArgs(
|
||||
options: InstallCommandOptions,
|
||||
invocationName: string | undefined = process.env.OMO_INVOCATION_NAME,
|
||||
env: Environment = process.env,
|
||||
): InstallArgs {
|
||||
const defaultPlatform = invocationName === "lazycodex" && isLazycodexPublishingEnabled(env) ? "codex" : undefined
|
||||
|
||||
return {
|
||||
tui: options.tui !== false,
|
||||
claude: options.claude,
|
||||
openai: options.openai,
|
||||
gemini: options.gemini,
|
||||
copilot: options.copilot,
|
||||
platform: options.platform ?? defaultPlatform,
|
||||
opencodeZen: options.opencodeZen,
|
||||
zaiCodingPlan: options.zaiCodingPlan,
|
||||
kimiForCoding: options.kimiForCoding,
|
||||
opencodeGo: options.opencodeGo,
|
||||
vercelAiGateway: options.vercelAiGateway,
|
||||
codexAutonomous: options.codexAutonomous,
|
||||
skipAuth: options.skipAuth ?? false,
|
||||
}
|
||||
}
|
||||
|
||||
program
|
||||
.name("oh-my-opencode")
|
||||
.description("The ultimate OpenCode plugin - multi-model orchestration, LSP tools, and more")
|
||||
@@ -32,16 +75,21 @@ program
|
||||
.option("--openai <value>", "OpenAI/ChatGPT subscription: no, yes (default: no)")
|
||||
.option("--gemini <value>", "Gemini integration: no, yes")
|
||||
.option("--copilot <value>", "GitHub Copilot subscription: no, yes")
|
||||
.addOption(new Option("--platform <platform>", "Install target platform: opencode, codex, both").choices(["opencode", "codex", "both"]))
|
||||
.option("--opencode-zen <value>", "OpenCode Zen access: no, yes (default: no)")
|
||||
.option("--zai-coding-plan <value>", "Z.ai Coding Plan subscription: no, yes (default: no)")
|
||||
.option("--kimi-for-coding <value>", "Kimi For Coding subscription: no, yes (default: no)")
|
||||
.option("--opencode-go <value>", "OpenCode Go subscription: no, yes (default: no)")
|
||||
.option("--vercel-ai-gateway <value>", "Vercel AI Gateway: no, yes (default: no)")
|
||||
.option("--codex-autonomous", "Configure Codex with approval never, full filesystem access, and network enabled")
|
||||
.option("--no-codex-autonomous", "Leave existing Codex permission settings unchanged")
|
||||
.option("--skip-auth", "Skip authentication setup hints")
|
||||
.addHelpText("after", `
|
||||
.addHelpText("after", `
|
||||
Examples:
|
||||
$ bunx oh-my-opencode install
|
||||
$ bunx oh-my-opencode install --no-tui --claude=max20 --openai=yes --gemini=yes --copilot=no
|
||||
$ bunx lazycodex install --no-tui
|
||||
$ bunx oh-my-opencode install --no-tui --platform=both --claude=max20 --openai=yes --gemini=yes --copilot=no
|
||||
$ omo install --platform=codex --codex-autonomous
|
||||
$ bunx oh-my-opencode install --no-tui --claude=no --gemini=no --copilot=yes --opencode-zen=yes
|
||||
|
||||
Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi > Vercel):
|
||||
@@ -55,19 +103,7 @@ Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi > Verce
|
||||
Vercel vercel/ models (universal proxy, always last fallback)
|
||||
`)
|
||||
.action(async (options) => {
|
||||
const args: InstallArgs = {
|
||||
tui: options.tui !== false,
|
||||
claude: options.claude,
|
||||
openai: options.openai,
|
||||
gemini: options.gemini,
|
||||
copilot: options.copilot,
|
||||
opencodeZen: options.opencodeZen,
|
||||
zaiCodingPlan: options.zaiCodingPlan,
|
||||
kimiForCoding: options.kimiForCoding,
|
||||
opencodeGo: options.opencodeGo,
|
||||
vercelAiGateway: options.vercelAiGateway,
|
||||
skipAuth: options.skipAuth ?? false,
|
||||
}
|
||||
const args = resolveInstallArgs(options)
|
||||
const exitCode = await install(args)
|
||||
process.exit(exitCode)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user