baoyu-gemini-web について
baoyu-gemini-web は、Gemini のウェブクライアントでテキストや画像を生成するスキルです。CLI やプログラムからの利用に対応し、複数ターンの会話や参照画像入力、実験的な動画生成機能を備えています。
主な機能
- 01テキストと画像の生成
- 02視覚タスク用の参照画像アップロード
- 03セッション ID による会話の継続
- 04実験的な動画生成機能
- 05CLI と Executor API に対応
活用シーン
- 01CLI から Gemini のテキスト応答を取得
- 02プロンプトから画像を生成して保存
- 03複数ターンの会話で文脈を維持
- 04視覚タスクに画像を入力
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ zsyggg/ paper-craft-skills --skill baoyu-gemini-webインストール後、Claude Code で/baoyu-gemini-webを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
scripts/index.tsget-cookie.tspaths.tstypes.tsmain.tschrome-auth.tsexecutor.tssession-store.tsclient.tscookie-store.ts詳細
Gemini Web Client
以下をサポートしています:
- テキスト生成
- 画像生成(ダウンロードと保存)
- 参照画像のアップロード(ビジョンタスク用に画像を添付)
- 同じエグゼキューターインスタンス内での複数ターンの会話(
keepSession) - 実験的な動画生成(
generateVideo)— Gemini が非同期のプレースホルダーを返す場合があります。ダウンロードには Gemini Web UI が必要なことがあります。
クイックスタート
npx -y bun scripts/main.ts "Hello, Gemini"
npx -y bun scripts/main.ts --prompt "Explain quantum computing"
npx -y bun scripts/main.ts --prompt "A cute cat" --image cat.png
npx -y bun scripts/main.ts --promptfiles system.md content.md --image out.png
# Multi-turn conversation (agent generates unique sessionId)
npx -y bun scripts/main.ts "Remember this: 42" --sessionId my-unique-id-123
npx -y bun scripts/main.ts "What number?" --sessionId my-unique-id-123
エグゼキューターのオプション(プログラムから利用する場合)
このスキルは通常、createGeminiWebExecutor(geminiOptions) 経由で利用します(scripts/executor.ts を参照)。
GeminiWebOptions の主なオプション:
referenceImages?: string | string[]ローカル画像を参照画像としてアップロードします(ビジョン入力)。keepSession?: booleanGemini のchatMetadataを再利用し、呼び出し間で同じ会話を継続します(複数のメッセージで参照画像を保持する場合に必要です)。generateVideo?: string動画を生成し、指定したパスに(可能な範囲で)ダウンロードします。Gemini がvideo_gen_chip(非同期)を返す場合は、結果をダウンロードするために Gemini Web UI を開く必要があります。
注意:
generateVideoはgenerateImage/editImageと併用できません。keepSession=trueかつreferenceImagesが設定されている場合、参照画像はエグゼキューターインスタンスごとに一度だけアップロードされます。
コマンド
テキスト生成
# Simple prompt (positional)
npx -y bun scripts/main.ts "Your prompt here"
# Explicit prompt flag
npx -y bun scripts/main.ts --prompt "Your prompt here"
npx -y bun scripts/main.ts -p "Your prompt here"
# With model selection
npx -y bun scripts/main.ts -p "Hello" -m gemini-2.5-pro
# Pipe from stdin
echo "Summarize this" | npx -y bun scripts/main.ts
画像生成
# Generate image with default path (./generated.png)
npx -y bun scripts/main.ts --prompt "A sunset over mountains" --image
# Generate image with custom path
npx -y bun scripts/main.ts --prompt "A cute robot" --image robot.png
# Shorthand
npx -y bun scripts/main.ts "A dragon" --image=dragon.png
出力形式
# Plain text (default)
npx -y bun scripts/main.ts "Hello"
# JSON output
npx -y bun scripts/main.ts "Hello" --json
オプション
| オプション | 説明 |
|---|---|
--prompt <text>, -p | プロンプトのテキスト |
--promptfiles <files...> | ファイルからプロンプトを読み込みます(順番に連結) |
--model <id>, -m | モデル:gemini-3-pro(デフォルト)、gemini-2.5-pro、gemini-2.5-flash |
--image [path] | 画像を生成し、パスに保存します(デフォルト:generated.png) |
--sessionId <id> | 複数ターンの会話用セッション ID(エージェントが一意の ID を生成します) |
--list-sessions | 保存済みセッションを一覧表示します(最大 100 件、更新日時順) |
--json | JSON として出力します |
--login | Cookie のみを更新して終了します |
--cookie-path <path> | カスタム Cookie ファイルのパス |
--profile-dir <path> | Chrome プロファイルのディレクトリ |
--help, -h | ヘルプを表示します |
CLI に関する注意:scripts/main.ts は、テキスト生成、画像生成、および --sessionId による複数ターンの会話をサポートしています。参照画像と動画生成はエグゼキューター API 経由で利用できます。
モデル
gemini-3-pro- デフォルトの最新モデルgemini-2.5-pro- 前世代の Pro モデルgemini-2.5-flash- 高速で軽量
認証
初回実行時に Chrome が開き、Google による認証が行われます。Cookie は以降の実行用にキャッシュされます。
# Force cookie refresh
npx -y bun scripts/main.ts --login
環境変数
| 変数 | 説明 |
|---|---|
GEMINI_WEB_DATA_DIR | データディレクトリ |
GEMINI_WEB_COOKIE_PATH | Cookie ファイルのパス |
GEMINI_WEB_CHROME_PROFILE_DIR | Chrome プロファイルのディレクトリ |
GEMINI_WEB_CHROME_PATH | Chrome 実行ファイルのパス |
使用例
テキスト応答を生成する
npx -y bun scripts/main.ts "What is the capital of France?"
画像を生成する
npx -y bun scripts/main.ts "A photorealistic image of a golden retriever puppy" --image puppy.png
解析用に JSON 出力を取得する
npx -y bun scripts/main.ts "Hello" --json | jq '.text'
プロンプトファイルから画像を生成する
# Concatenate system.md + content.md as prompt
npx -y bun scripts/main.ts --promptfiles system.md content.md --image output.png
複数ターンの会話
# Start a session with unique ID (agent generates this)
npx -y bun scripts/main.ts "You are a helpful math tutor." --sessionId task-abc123
# Continue the conversation (remembers context)
npx -y bun scripts/main.ts "What is 2+2?" --sessionId task-abc123
npx -y bun scripts/main.ts "Now multiply that by 10" --sessionId task-abc123
# List recent sessions (max 100, sorted by update time)
npx -y bun scripts/main.ts --list-sessions
セッションファイルは ~/Library/Application Support/baoyu-skills/gemini-web/sessions/<id>.json に保存され、以下の内容が含まれます:
id:セッション IDmetadata:会話を継続するための Gemini チャットメタデータmessages:{role, content, timestamp, error?}の配列createdAt、updatedAt:タイムスタンプ
コメント
Markdown 対応