From 555abbc0d6e8b22cefbd66b313032c8a2d96e368 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 13 Dec 2025 12:13:50 +0900 Subject: [PATCH] fix(google-auth): integrate into main package via config option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #30. OpenCode's plugin loader treats subpath exports like "oh-my-opencode/google-auth" as separate npm packages, causing BunInstallFailedError. Solution: Enable Google auth via `google_auth: true` in oh-my-opencode.json instead of a separate subpath plugin. ๐Ÿค– GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- README.ko.md | 9 +++------ README.md | 9 +++------ src/config/schema.ts | 1 + src/index.ts | 7 +++++++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.ko.md b/README.ko.md index b15c728..4c73845 100644 --- a/README.ko.md +++ b/README.ko.md @@ -43,7 +43,7 @@ OpenCode ๊ฐ€ ๋‚ญ๋งŒ์ด ์‚ฌ๋ผ์ง„๊ฒƒ๊ฐ™์€ ์˜ค๋Š˜๋‚ ์˜ ์‹œ๋Œ€์—, ๋‹น์‹ ์—๊ฒŒ - ์ด ํ”Œ๋Ÿฌ๊ทธ์ธ์€ [OpenCode Zen](https://opencode.ai/docs/zen/), Google, OpenAI, Anthropic ์˜ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. - Anthropic ๋ชจ๋ธ๋“ค์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด [OpenCode ์˜ ๋‚ด์žฅ Claude Code Max Plan ๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ](https://opencode.ai/docs/providers/#anthropic)์„ ์‚ฌ์šฉํ•˜์„ธ์š”. - OpenAI ๋ชจ๋ธ (ChatGPT Plus/Pro)์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด [OpenCode-OpenAI-Codex-Auth ํ”Œ๋Ÿฌ๊ทธ์ธ](https://github.com/numman-ali/opencode-openai-codex-auth)์„ ์„ค์น˜ํ•˜์„ธ์š”. - - Google Gemini ๋ชจ๋ธ์„ ์œ„ํ•ด `oh-my-opencode/google-auth` ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์ถ”๊ฐ€ํ•˜์„ธ์š” (**๋‚ด์žฅ Antigravity OAuth**). + - Google Gemini ๋ชจ๋ธ์„ ์œ„ํ•ด `oh-my-opencode.json`์—์„œ `google_auth: true`๋ฅผ ํ™œ์„ฑํ™”ํ•˜์„ธ์š” (**๋‚ด์žฅ Antigravity OAuth**). - ๋‹ค๋ฅธ ํ”„๋กœ๋ฐ”์ด๋”๋ฅผ ์œ„ํ•ด [VibeProxy (macOS Only)](https://github.com/automazeio/vibeproxy) ๋˜๋Š” [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)๋ฅผ ๋Œ€์•ˆ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. - **์‚ฌ์‹ค ๋ฐ‘์˜ ๋‚ด์šฉ์€ ์ฝ์ง€ ์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ƒฅ ์„ค์น˜ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๋ชจ๋ธ ์„ค์ •ํ•˜๊ณ ๋‚˜๋ฉด ์ถ”๊ฐ€๋กœ ๊ณต๋ถ€ํ•˜๊ฑฐ๋‚˜ ์•Œ ํ•„์š”๊ฐ€ ์—†๊ณ , ์„ค์น˜ํ•˜๊ณ  ๋‚˜๋ฉด ๊ทธ๋ƒฅ ๋” ์ข‹์•„์ง‘๋‹ˆ๋‹ค.** - **์ด ๋ฌธ์„œ๋„ ๊ทธ๋ƒฅ Claude Code, OpenCode, Cursor์— ๋ถ™์—ฌ๋„ฃ๊ณ , ์„ค์น˜ํ•˜๊ณ , ์‚ฌ์šฉ์ž์˜ ๊ฐœ์ž…์ด ํ•„์š”ํ•  ๋•Œ ์•Œ๋ ค๋‹ฌ๋ผ๊ณ  ํ”„๋กฌํ”„ํŒ…ํ•˜์„ธ์š”. ๊ทธ๋Ÿผ ๊ทธ๋ƒฅ ๊น”๋ฆฝ๋‹ˆ๋‹ค.** @@ -123,14 +123,11 @@ opencode auth login #### 4.2 Google Gemini (๋‚ด์žฅ Antigravity OAuth) -๋จผ์ € google-auth ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์ถ”๊ฐ€: +๋จผ์ € `~/.config/opencode/oh-my-opencode.json` (๋˜๋Š” ํ”„๋กœ์ ํŠธ ๋ ˆ๋ฒจ์˜ `.opencode/oh-my-opencode.json`)์—์„œ Google auth๋ฅผ ํ™œ์„ฑํ™”: ```json { - "plugin": [ - "oh-my-opencode", - "oh-my-opencode/google-auth" - ] + "google_auth": true } ``` diff --git a/README.md b/README.md index 482db72..da8253f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Even if you don't, invest a little time. Boost your skills and productivity by m - This plugin utilizes models from [OpenCode Zen](https://opencode.ai/docs/zen/), Google, OpenAI, and Anthropic. - For Anthropic models, use [OpenCode's built-in Claude Code Max Plan login](https://opencode.ai/docs/providers/#anthropic). - For OpenAI models (ChatGPT Plus/Pro), install the [OpenCode-OpenAI-Codex-Auth plugin](https://github.com/numman-ali/opencode-openai-codex-auth). - - For Google Gemini models, add `oh-my-opencode/google-auth` plugin for **built-in Antigravity OAuth**. + - For Google Gemini models, enable `google_auth: true` in `oh-my-opencode.json` for **built-in Antigravity OAuth**. - For other providers, [VibeProxy (macOS Only)](https://github.com/automazeio/vibeproxy) or [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) remain available as alternatives. - **Truth be told, the rest is optional. Just install it. Once set up, no further learning is required. It simply evolves.** - **Paste this document into Claude Code, OpenCode, or Cursor, instruct it to install, and ask for assistance if needed. It just installs.** @@ -122,14 +122,11 @@ opencode auth login #### 4.2 Google Gemini (Built-in Antigravity OAuth) -First, add the google-auth plugin: +First, enable Google auth in `~/.config/opencode/oh-my-opencode.json` (or `.opencode/oh-my-opencode.json` for project-level): ```json { - "plugin": [ - "oh-my-opencode", - "oh-my-opencode/google-auth" - ] + "google_auth": true } ``` diff --git a/src/config/schema.ts b/src/config/schema.ts index 04bc9a0..7255741 100644 --- a/src/config/schema.ts +++ b/src/config/schema.ts @@ -64,6 +64,7 @@ export const OhMyOpenCodeConfigSchema = z.object({ disabled_agents: z.array(AgentNameSchema).optional(), agents: AgentOverridesSchema.optional(), claude_code: ClaudeCodeConfigSchema.optional(), + google_auth: z.boolean().optional(), }) export type OhMyOpenCodeConfig = z.infer diff --git a/src/index.ts b/src/index.ts index 97b0b4a..b41493c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,6 +16,7 @@ import { createBackgroundNotificationHook, createAutoUpdateCheckerHook, } from "./hooks"; +import { createGoogleAntigravityAuthPlugin } from "./auth/antigravity"; import { loadUserCommands, loadProjectCommands, @@ -173,7 +174,13 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { const callOmoAgent = createCallOmoAgent(ctx, backgroundManager); + const googleAuthHooks = pluginConfig.google_auth + ? await createGoogleAntigravityAuthPlugin(ctx) + : null; + return { + ...(googleAuthHooks ? { auth: googleAuthHooks.auth } : {}), + tool: { ...builtinTools, ...backgroundTools,