mcpField
B
baoyu-gemini-web

baoyu-gemini-web

github.com/zsygggクリエイティブ・メディア1.4k95 回インストール22 週間前に更新
リポジトリ

baoyu-gemini-web について

baoyu-gemini-web は、Gemini のウェブクライアントでテキストや画像を生成するスキルです。CLI やプログラムからの利用に対応し、複数ターンの会話や参照画像入力、実験的な動画生成機能を備えています。

主な機能

  1. 01テキストと画像の生成
  2. 02視覚タスク用の参照画像アップロード
  3. 03セッション ID による会話の継続
  4. 04実験的な動画生成機能
  5. 05CLI と Executor API に対応

活用シーン

  1. 01CLI から Gemini のテキスト応答を取得
  2. 02プロンプトから画像を生成して保存
  3. 03複数ターンの会話で文脈を維持
  4. 04視覚タスクに画像を入力

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/zsyggg/paper-craft-skills --skill baoyu-gemini-web

インストール後、Claude Code で/baoyu-gemini-webを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

scripts/
index.ts
get-cookie.ts
paths.ts
types.ts
main.ts
chrome-auth.ts
executor.ts
session-store.ts
client.ts
cookie-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?: boolean Gemini の 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 件、更新日時順)
--jsonJSON として出力します
--loginCookie のみを更新して終了します
--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_PATHCookie ファイルのパス
GEMINI_WEB_CHROME_PROFILE_DIRChrome プロファイルのディレクトリ
GEMINI_WEB_CHROME_PATHChrome 実行ファイルのパス

使用例

テキスト応答を生成する
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:セッション ID
  • metadata:会話を継続するための Gemini チャットメタデータ
  • messages:{role, content, timestamp, error?} の配列
  • createdAt、updatedAt:タイムスタンプ

コメント