ask-bridge 0.2.1 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +43 -18
- package/README.md +52 -17
- package/package.json +3 -2
package/README.en.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# Ask Bridge 🦀
|
|
2
2
|
|
|
3
|
-
`ask-bridge` is a powerful, lightweight command-line tool written in **Rust** that automates ChatGPT or
|
|
3
|
+
`ask-bridge` is a powerful, lightweight command-line tool written in **Rust** that automates ChatGPT, Gemini or Claude directly in your real Chrome browser. It uses the **Model Context Protocol (MCP)** and **Chrome DevTools Protocol (CDP)** via the embedded `doggy8088/mcp-cli` Rust library dependency and `chrome-devtools-mcp` to control Chrome, input prompts, click submit, and print the response back to your terminal. ChatGPT is the default when no global provider is configured; use `--provider gemini`, `--provider claude`, or the global config file to switch providers.
|
|
4
4
|
|
|
5
5
|
## Design Intent
|
|
6
6
|
|
|
7
|
-
The core purpose of `ask-bridge` is not to replace ChatGPT, Gemini, or any Coding Agent. It is to bridge them together. During software development, many AI-assisted tasks are exploratory: researching background information, summarizing documents, comparing options, digesting error messages, analyzing code snippets, drafting text, or clarifying uncertain technical questions. These tasks do not always need to be handled directly by the primary Coding Agent, and they do not always justify using the same agent budget that should be reserved for code editing, testing, refactoring, and integration work.
|
|
7
|
+
The core purpose of `ask-bridge` is not to replace ChatGPT, Gemini, Claude, or any Coding Agent. It is to bridge them together. During software development, many AI-assisted tasks are exploratory: researching background information, summarizing documents, comparing options, digesting error messages, analyzing code snippets, drafting text, or clarifying uncertain technical questions. These tasks do not always need to be handled directly by the primary Coding Agent, and they do not always justify using the same agent budget that should be reserved for code editing, testing, refactoring, and integration work.
|
|
8
8
|
|
|
9
|
-
With `ask-bridge`, a Coding Agent can delegate low-risk, exploratory, and research-oriented tasks to the ChatGPT or
|
|
9
|
+
With `ask-bridge`, a Coding Agent can delegate low-risk, exploratory, and research-oriented tasks to the ChatGPT, Gemini, or Claude websites, then bring the website response back into the terminal or the next step of the local workflow. Because ChatGPT, Gemini, and Claude website usage quotas are typically separate from Coding Agent execution quotas, `ask-bridge` gives developers a more flexible way to allocate AI resources: the primary agent can focus on understanding the repository, modifying code, running tests, and integrating results, while website-based AI handles background research, text processing, and candidate solution generation.
|
|
10
10
|
|
|
11
|
-
In other words, `ask-bridge` is an external research bridge for AI Agents. It turns the manual workflow of switching to a browser, pasting a prompt, waiting for a response, and copying the result back into a command-line-driven automation capability. This lets an agent request help from ChatGPT or
|
|
11
|
+
In other words, `ask-bridge` is an external research bridge for AI Agents. It turns the manual workflow of switching to a browser, pasting a prompt, waiting for a response, and copying the result back into a command-line-driven automation capability. This lets an agent request help from ChatGPT, Gemini, or Claude without leaving the local development workflow, then use the response as supporting context for its own judgment.
|
|
12
12
|
|
|
13
13
|
This tool is especially useful for:
|
|
14
14
|
|
|
15
15
|
- Sending large documents, error messages, or code snippets to a website-based AI for summarization, comparison, or first-pass analysis.
|
|
16
16
|
- Letting a Coding Agent outsource background research, alternative analysis, or checklist generation before implementation.
|
|
17
17
|
- Moving AI tasks that do not directly modify project files out of the primary agent workflow.
|
|
18
|
-
- Reusing existing ChatGPT or
|
|
18
|
+
- Reusing existing ChatGPT, Gemini, or Claude web accounts for interactive website features outside an API workflow.
|
|
19
19
|
|
|
20
20
|
`ask-bridge` does not guarantee that provider output is correct, and it should not replace local tests, official documentation checks, or human review. Its role is to reduce the operational cost of exploratory AI work and let the primary Coding Agent obtain external AI assistance with less friction.
|
|
21
21
|
|
|
@@ -29,7 +29,7 @@ Unlike typical API clients, `ask-bridge` operates inside a real Chrome browser w
|
|
|
29
29
|
## 🌟 Key Features
|
|
30
30
|
|
|
31
31
|
- **🦀 100% Rust Core**: Extremely fast, lightweight, and compile-once, run-anywhere binary.
|
|
32
|
-
- **Multi-provider support**: Choose ChatGPT or
|
|
32
|
+
- **Multi-provider support**: Choose ChatGPT, Gemini, or Claude with `--provider chatgpt|gemini|claude`.
|
|
33
33
|
- **Global provider config**: Set the default provider in `~/.config/ask-bridge/config.json`; CLI `--provider` overrides the config file.
|
|
34
34
|
- **🌐 Real Browser Automation**: Directly interacts with Chrome on port `9223` (isolated debug profile).
|
|
35
35
|
- **🔒 Persistent Login**: Uses a dedicated local profile directory (`~/.config/ask-bridge/chrome-profile`) so you never lose your login state.
|
|
@@ -37,8 +37,9 @@ Unlike typical API clients, `ask-bridge` operates inside a real Chrome browser w
|
|
|
37
37
|
- **🌀 TUI Thinking Animation**: Displays a rotating spinner while waiting for the provider to reply, then clears it once output starts.
|
|
38
38
|
- **🧠 Intelligent Tab Management**: Reuses existing provider tabs if open, focuses them, or opens new ones, avoiding tab clutter.
|
|
39
39
|
- **🖥️ Pipe & Stdin Support**: Supports piping prompts via `stdin` (e.g. `cat report.txt | ask-bridge "summarize this"`).
|
|
40
|
-
- **📎 Image & File Attachments**: Attach local images
|
|
41
|
-
- **🔀 Model Switching**: Use `--model` to switch the provider model before the prompt is sent, such as ChatGPT `GPT-5.4
|
|
40
|
+
- **📎 Image & File Attachments**: Attach local images with `--image` (supported on ChatGPT and Claude), or documents (PDF, Word, Excel, plain text, Markdown, JSON, etc.) with `--file`; Gemini currently supports `--file` and rejects `--image`.
|
|
41
|
+
- **🔀 Model Switching**: Use `--model` to switch the provider model before the prompt is sent, such as ChatGPT `GPT-5.4`, Gemini `3.5 Flash`, or Claude `Sonnet`.
|
|
42
|
+
- **Response Timeout**: Use `--timeout <seconds>` to control how long to wait for a provider response, defaulting to `300` seconds.
|
|
42
43
|
- **🔍 Quiet by Default & Verbose Mode**: Quiet and clean output by default (displaying only the generated response), with an optional `--verbose` flag to display full browser state logs if needed.
|
|
43
44
|
- **Version Info**: Use `-v` or `--version` to print the current version number.
|
|
44
45
|
|
|
@@ -112,7 +113,7 @@ The compiled binary will be located at `target/release/ask-bridge`.
|
|
|
112
113
|
|
|
113
114
|
### 4. Install the Agent Skill
|
|
114
115
|
|
|
115
|
-
This repository provides an `ask-bridge` Agent Skill so Skills-compatible Coding Agents can use `ask-bridge` to delegate exploratory research, summarization, document analysis, or option comparison tasks to the ChatGPT or
|
|
116
|
+
This repository provides an `ask-bridge` Agent Skill so Skills-compatible Coding Agents can use `ask-bridge` to delegate exploratory research, summarization, document analysis, or option comparison tasks to the ChatGPT, Gemini, or Claude websites.
|
|
116
117
|
|
|
117
118
|
Install it with `npx skills`; you do not need to copy the `skills/` directory manually:
|
|
118
119
|
|
|
@@ -138,23 +139,25 @@ Before sending prompts, you need to log in to the selected provider. ChatGPT is
|
|
|
138
139
|
ask-bridge login
|
|
139
140
|
```
|
|
140
141
|
|
|
141
|
-
For Gemini:
|
|
142
|
+
For Gemini or Claude:
|
|
142
143
|
|
|
143
144
|
```bash
|
|
144
145
|
ask-bridge --provider gemini login
|
|
146
|
+
ask-bridge --provider claude login
|
|
145
147
|
```
|
|
146
148
|
|
|
147
149
|
- This will automatically launch Google Chrome with a dedicated, persistent debug profile.
|
|
148
|
-
- Log in manually to the selected provider page, such as `https://chatgpt.com
|
|
149
|
-
-
|
|
150
|
-
-
|
|
150
|
+
- Log in manually to the selected provider page, such as `https://chatgpt.com/`, `https://gemini.google.com/app`, or `https://claude.ai/new`.
|
|
151
|
+
- The tool now checks login status every second automatically, so you can stay on the browser and it will return immediately after login is detected.
|
|
152
|
+
- If login is not detected within `--timeout` seconds (default: 300), it will warn you to verify the result and retry.
|
|
151
153
|
|
|
152
154
|
#### Global Provider Config
|
|
153
155
|
|
|
154
|
-
To use Gemini by default when `--provider` is not specified:
|
|
156
|
+
To use Gemini or Claude by default when `--provider` is not specified:
|
|
155
157
|
|
|
156
158
|
```bash
|
|
157
159
|
ask-bridge config --provider gemini
|
|
160
|
+
ask-bridge config --provider claude
|
|
158
161
|
```
|
|
159
162
|
|
|
160
163
|
To switch the default back to ChatGPT:
|
|
@@ -182,6 +185,7 @@ Simply pass your prompt as an argument:
|
|
|
182
185
|
```bash
|
|
183
186
|
ask-bridge "What is the difference between a struct and a tuple in Rust?"
|
|
184
187
|
ask-bridge --provider gemini "What is the difference between a struct and a tuple in Rust?"
|
|
188
|
+
ask-bridge --provider claude "What is the difference between a struct and a tuple in Rust?"
|
|
185
189
|
```
|
|
186
190
|
|
|
187
191
|
- Chrome will open or focus on your selected provider tab.
|
|
@@ -230,7 +234,23 @@ This will print every stage of the browser automation:
|
|
|
230
234
|
- Submitting...
|
|
231
235
|
- Waiting for provider response...
|
|
232
236
|
|
|
233
|
-
### 6.
|
|
237
|
+
### 6. Response Timeout (`--timeout`)
|
|
238
|
+
|
|
239
|
+
The default wait time is 300 seconds. If a provider takes longer, increase (or decrease) the timeout:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
ask-bridge "Please summarize this report" --timeout 600
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
You can also set a shorter timeout:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
ask-bridge "Short answer" --timeout 60
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
If the response does not complete within the configured seconds, `ask-bridge` will stop waiting and print a timeout warning.
|
|
252
|
+
|
|
253
|
+
### 7. Version Info
|
|
234
254
|
|
|
235
255
|
Use `-v` or `--version` to print the current version number:
|
|
236
256
|
|
|
@@ -238,7 +258,7 @@ Use `-v` or `--version` to print the current version number:
|
|
|
238
258
|
ask-bridge -v
|
|
239
259
|
```
|
|
240
260
|
|
|
241
|
-
###
|
|
261
|
+
### 8. Piping & Stdin Support
|
|
242
262
|
|
|
243
263
|
You can pipe text or files directly into `ask-bridge`:
|
|
244
264
|
|
|
@@ -264,18 +284,19 @@ Instead of piping file contents into the prompt, you can upload local files as a
|
|
|
264
284
|
|
|
265
285
|
#### Attach images
|
|
266
286
|
|
|
267
|
-
Use `--image` (repeatable) to attach one or more local images. This currently supports ChatGPT; Gemini image input is not enabled and exits with an explicit error when used with `--provider gemini`.
|
|
287
|
+
Use `--image` (repeatable) to attach one or more local images. This currently supports ChatGPT and Claude; Gemini image input is not enabled and exits with an explicit error when used with `--provider gemini`.
|
|
268
288
|
|
|
269
289
|
```bash
|
|
270
290
|
ask-bridge "Describe this image." --image screenshot.png
|
|
271
291
|
ask-bridge "Compare these two images." --image v1.png --image v2.png
|
|
292
|
+
ask-bridge --provider claude "Describe this image." --image screenshot.png
|
|
272
293
|
```
|
|
273
294
|
|
|
274
295
|
Supported formats include PNG, JPEG, GIF, WebP, SVG, BMP, and more.
|
|
275
296
|
|
|
276
297
|
#### Attach documents
|
|
277
298
|
|
|
278
|
-
Use `--file` (repeatable) to attach documents such as PDF, Word, Excel, PowerPoint, plain text, Markdown, CSV, JSON, or source code. This flow supports
|
|
299
|
+
Use `--file` (repeatable) to attach documents such as PDF, Word, Excel, PowerPoint, plain text, Markdown, CSV, JSON, or source code. This flow supports ChatGPT, Gemini, and Claude.
|
|
279
300
|
|
|
280
301
|
```bash
|
|
281
302
|
ask-bridge "Summarize this PDF." --file report.pdf
|
|
@@ -299,6 +320,8 @@ ask-bridge "Prove this math problem." --model o3
|
|
|
299
320
|
ask-bridge "Quickly translate this." --model 即時
|
|
300
321
|
ask-bridge --provider gemini "Introduce Rust in a few sentences." --model "3.5 Flash"
|
|
301
322
|
ask-bridge --provider gemini "Introduce Rust in a few sentences." --model "3.1 Pro"
|
|
323
|
+
ask-bridge --provider claude "Introduce Rust in a few sentences." --model Sonnet
|
|
324
|
+
ask-bridge --provider claude "Prove this math problem." --model Opus
|
|
302
325
|
```
|
|
303
326
|
|
|
304
327
|
Available model names (depending on your account entitlements and provider UI):
|
|
@@ -306,6 +329,7 @@ Available model names (depending on your account entitlements and provider UI):
|
|
|
306
329
|
- **ChatGPT models**: `GPT-5.5`, `GPT-5.4`, `GPT-5.3`, `o3`
|
|
307
330
|
- **ChatGPT thinking levels**: `智慧`, `即時`, `中等`, `高`, `超高`, `專業`
|
|
308
331
|
- **Gemini modes**: `3.5 Flash`, `3.1 Flash-Lite`, `3.1 Pro`
|
|
332
|
+
- **Claude models**: `Sonnet`, `Opus`, `Haiku` (actual names depend on the claude.ai menu and your plan)
|
|
309
333
|
|
|
310
334
|
> If the requested name is not found in the menu, `ask-bridge` reports `Model switch failed: error: model not found in menu` and aborts without submitting the prompt.
|
|
311
335
|
|
|
@@ -316,6 +340,7 @@ To quickly launch the browser and open the selected provider without sending any
|
|
|
316
340
|
```bash
|
|
317
341
|
ask-bridge open
|
|
318
342
|
ask-bridge --provider gemini open
|
|
343
|
+
ask-bridge --provider claude open
|
|
319
344
|
```
|
|
320
345
|
|
|
321
346
|
### 11. Close the Browser Instance
|
package/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# Ask Bridge 🦀
|
|
2
2
|
|
|
3
|
-
`ask-bridge` 是以 Rust 撰寫的輕量命令列工具,可透過真實 Chrome 瀏覽器自動操作 ChatGPT 與
|
|
3
|
+
`ask-bridge` 是以 Rust 撰寫的輕量命令列工具,可透過真實 Chrome 瀏覽器自動操作 ChatGPT、Gemini 與 Claude。它使用 Model Context Protocol MCP 與 Chrome DevTools Protocol CDP,並透過內建的 `doggy8088/mcp-cli` Rust library dependency 搭配 `chrome-devtools-mcp` 控制 Chrome、輸入 prompt、送出訊息,並將回覆輸出到終端機。未設定全域 provider 時預設使用 ChatGPT,可用 `--provider gemini`、`--provider claude` 或全域設定檔切換 provider。
|
|
4
4
|
|
|
5
5
|
## 設計意圖
|
|
6
6
|
|
|
7
|
-
`ask-bridge` 的核心目的不是取代 ChatGPT、Gemini 或任何 Coding Agent,而是把它們橋接在一起。開發過程中常會出現大量探索性的 AI 需求,例如查資料、整理文件、比較方案、摘要錯誤訊息、分析程式片段、產生初稿或協助釐清不確定的技術問題。這類任務通常不一定需要由主要 Coding Agent 親自完成,也不一定值得消耗與程式碼編輯、測試、重構等高價值工作相同的 agent 額度。
|
|
7
|
+
`ask-bridge` 的核心目的不是取代 ChatGPT、Gemini、Claude 或任何 Coding Agent,而是把它們橋接在一起。開發過程中常會出現大量探索性的 AI 需求,例如查資料、整理文件、比較方案、摘要錯誤訊息、分析程式片段、產生初稿或協助釐清不確定的技術問題。這類任務通常不一定需要由主要 Coding Agent 親自完成,也不一定值得消耗與程式碼編輯、測試、重構等高價值工作相同的 agent 額度。
|
|
8
8
|
|
|
9
|
-
透過 `ask-bridge`,Coding Agent 可以把這些低風險、探索性、可委派的研究工作轉交給 ChatGPT 或
|
|
9
|
+
透過 `ask-bridge`,Coding Agent 可以把這些低風險、探索性、可委派的研究工作轉交給 ChatGPT、Gemini 或 Claude 網站處理,再把網站回覆取回終端機或後續工作流程中。由於 ChatGPT、Gemini、Claude 網站的使用額度與 Coding Agent 的執行額度通常分開計算,`ask-bridge` 可以讓開發者更有彈性地分配 AI 資源:主要 agent 專注在理解專案、修改程式、執行測試與整合結果;網站型 AI 則負責背景研究、文字處理與候選方案產出。
|
|
10
10
|
|
|
11
|
-
換句話說,`ask-bridge` 是一個給 AI Agent 使用的外部研究橋接器:它把原本需要人類切換瀏覽器、貼上 prompt、等待回覆、再複製結果的流程,包裝成可由命令列驅動的自動化能力。這讓 agent 可以在不離開本機工作流程的情況下,自主向 ChatGPT 或
|
|
11
|
+
換句話說,`ask-bridge` 是一個給 AI Agent 使用的外部研究橋接器:它把原本需要人類切換瀏覽器、貼上 prompt、等待回覆、再複製結果的流程,包裝成可由命令列驅動的自動化能力。這讓 agent 可以在不離開本機工作流程的情況下,自主向 ChatGPT、Gemini 或 Claude 發出請求,取得輔助資訊,並將其納入後續判斷。
|
|
12
12
|
|
|
13
13
|
此工具特別適合:
|
|
14
14
|
|
|
15
15
|
- 將大型文件、錯誤訊息或程式片段交給網站型 AI 做摘要、比對或初步分析。
|
|
16
16
|
- 讓 Coding Agent 在實作前先委外蒐集背景資料、整理替代方案或產生檢查清單。
|
|
17
17
|
- 把不需要直接修改專案檔案的 AI 任務移出主要 agent 執行流程。
|
|
18
|
-
- 利用既有 ChatGPT 或
|
|
18
|
+
- 利用既有 ChatGPT、Gemini 或 Claude 網頁帳號的能力,處理 API 以外的互動式網站功能。
|
|
19
19
|
|
|
20
20
|
`ask-bridge` 不保證網站 provider 的輸出一定正確,也不應取代本機測試、官方文件查證或人工審查。它的定位是降低探索性 AI 工作的操作成本,讓主要 Coding Agent 能以更低摩擦取得外部 AI 協助。
|
|
21
21
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
## 主要功能
|
|
29
29
|
|
|
30
30
|
- **100% Rust 核心**:快速、輕量,編譯後即可執行。
|
|
31
|
-
- **多 provider 支援**:使用 `--provider chatgpt|gemini` 選擇 ChatGPT 或
|
|
31
|
+
- **多 provider 支援**:使用 `--provider chatgpt|gemini|claude` 選擇 ChatGPT、Gemini 或 Claude。
|
|
32
32
|
- **全域 provider 設定**:可在 `~/.config/ask-bridge/config.json` 指定預設 provider,CLI 的 `--provider` 會覆蓋設定檔。
|
|
33
33
|
- **真實瀏覽器自動化**:直接控制監聽 `9223` port 的 Chrome debug profile。
|
|
34
34
|
- **持久登入狀態**:使用專屬本機 profile 目錄 `~/.config/ask-bridge/chrome-profile`,避免重複登入。
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
- **思考動畫**:等待 provider 回覆時,在終端機顯示旋轉 spinner,開始輸出內容後自動清除。
|
|
37
37
|
- **智慧分頁管理**:可重用既有 provider 分頁、聚焦分頁,或開啟新分頁,避免分頁過度增加。
|
|
38
38
|
- **Pipe 與 stdin 支援**:支援透過 standard input 傳入 prompt,例如 `cat report.txt | ask-bridge "summarize this"`。
|
|
39
|
-
- **圖片與文件上傳**:可透過 `--image`
|
|
40
|
-
- **模型切換**:使用 `--model` 在送出 prompt 前自動切換 provider 模型(如 ChatGPT 的 `GPT-5.4`、`o3
|
|
39
|
+
- **圖片與文件上傳**:可透過 `--image` 附上圖片(支援 ChatGPT 與 Claude),或透過 `--file` 附上文件(PDF、Word、Excel、純文字、Markdown、JSON 等皆可),一次可指定多個檔案;Gemini 目前支援 `--file`,不支援 `--image` 圖片輸入。
|
|
40
|
+
- **模型切換**:使用 `--model` 在送出 prompt 前自動切換 provider 模型(如 ChatGPT 的 `GPT-5.4`、`o3`,Gemini 的 `3.5 Flash`、`3.1 Pro`,或 Claude 的 `Sonnet`、`Opus`)。
|
|
41
|
+
- **回應超時**:使用 `--timeout <秒數>` 設定等待回應上限,預設為 `300` 秒。
|
|
41
42
|
- **預設安靜模式與 verbose 模式**:預設只輸出最終回覆;加上 `--verbose` 可顯示背景瀏覽器控制流程。
|
|
42
43
|
- **版本資訊**:使用 `-v` 或 `--version` 顯示目前版本號。
|
|
43
44
|
|
|
@@ -107,7 +108,7 @@ cargo build --release
|
|
|
107
108
|
|
|
108
109
|
### 4. 安裝 Agent Skill
|
|
109
110
|
|
|
110
|
-
本專案提供 `ask-bridge` Agent Skill,讓支援 Skills 的 Coding Agent 可以在適合的情境下,自主使用 `ask-bridge` 將探索性研究、摘要、文件分析或方案比較等工作委派給 ChatGPT 或
|
|
111
|
+
本專案提供 `ask-bridge` Agent Skill,讓支援 Skills 的 Coding Agent 可以在適合的情境下,自主使用 `ask-bridge` 將探索性研究、摘要、文件分析或方案比較等工作委派給 ChatGPT、Gemini 或 Claude 網站。
|
|
111
112
|
|
|
112
113
|
請使用 `npx skills` 安裝,不需要手動複製 `skills/` 目錄:
|
|
113
114
|
|
|
@@ -131,27 +132,29 @@ npx skills add doggy8088/ask-bridge --skill ask-bridge --agent codex --global
|
|
|
131
132
|
ask-bridge login
|
|
132
133
|
```
|
|
133
134
|
|
|
134
|
-
若要登入 Gemini:
|
|
135
|
+
若要登入 Gemini 或 Claude:
|
|
135
136
|
|
|
136
137
|
```bash
|
|
137
138
|
ask-bridge --provider gemini login
|
|
139
|
+
ask-bridge --provider claude login
|
|
138
140
|
```
|
|
139
141
|
|
|
140
142
|
此命令會:
|
|
141
143
|
|
|
142
144
|
- 使用專屬且持久化的 debug profile 啟動 Google Chrome。
|
|
143
|
-
- 開啟所選 provider 頁面,例如 `https://chatgpt.com
|
|
145
|
+
- 開啟所選 provider 頁面,例如 `https://chatgpt.com/`、`https://gemini.google.com/app` 或 `https://claude.ai/new`。
|
|
144
146
|
- 等待你手動登入帳號。
|
|
145
|
-
-
|
|
147
|
+
- 本工具會每秒自動偵測登入狀態,不需要你回到終端機按 Enter;若超過 `--timeout`(預設 300 秒)仍未偵測到登入完成,會提醒你再確認一次。
|
|
146
148
|
|
|
147
149
|
此流程通常只需要執行一次。
|
|
148
150
|
|
|
149
151
|
#### 全域 provider 設定
|
|
150
152
|
|
|
151
|
-
若希望未指定 `--provider` 時預設使用 Gemini,可用 `ask-bridge config` 指定:
|
|
153
|
+
若希望未指定 `--provider` 時預設使用 Gemini 或 Claude,可用 `ask-bridge config` 指定:
|
|
152
154
|
|
|
153
155
|
```bash
|
|
154
156
|
ask-bridge config --provider gemini
|
|
157
|
+
ask-bridge config --provider claude
|
|
155
158
|
```
|
|
156
159
|
|
|
157
160
|
若要改回 ChatGPT:
|
|
@@ -179,6 +182,7 @@ ask-bridge --provider chatgpt "請摘要這段內容。"
|
|
|
179
182
|
```bash
|
|
180
183
|
ask-bridge "Rust struct 和 tuple 有什麼差異?"
|
|
181
184
|
ask-bridge --provider gemini "Rust struct 和 tuple 有什麼差異?"
|
|
185
|
+
ask-bridge --provider claude "Rust struct 和 tuple 有什麼差異?"
|
|
182
186
|
```
|
|
183
187
|
|
|
184
188
|
執行後:
|
|
@@ -229,7 +233,23 @@ Verbose 模式會顯示類似以下流程:
|
|
|
229
233
|
- 送出訊息。
|
|
230
234
|
- 等待 provider 回覆。
|
|
231
235
|
|
|
232
|
-
### 6.
|
|
236
|
+
### 6. 回應超時(`--timeout`)
|
|
237
|
+
|
|
238
|
+
回答等待預設 300 秒,若 provider 回應時間較長可提高(或降低)等待上限:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
ask-bridge "請幫我整理這份報告" --timeout 600
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
你也可以明確設定較短時間:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
ask-bridge "簡短回覆" --timeout 60
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
超過設定秒數仍未完成時,會輸出超時警告並直接結束回應等待流程。
|
|
251
|
+
|
|
252
|
+
### 7. 顯示版本
|
|
233
253
|
|
|
234
254
|
使用 `-v` 或 `--version` 顯示目前版本號:
|
|
235
255
|
|
|
@@ -237,7 +257,7 @@ Verbose 模式會顯示類似以下流程:
|
|
|
237
257
|
ask-bridge -v
|
|
238
258
|
```
|
|
239
259
|
|
|
240
|
-
###
|
|
260
|
+
### 8. Pipe 與 stdin
|
|
241
261
|
|
|
242
262
|
可透過 pipe 將文字或檔案內容傳入 `ask-bridge`:
|
|
243
263
|
|
|
@@ -263,18 +283,19 @@ cat src/main.rs | ask-bridge "這段 Rust code 有記憶體洩漏風險嗎?"
|
|
|
263
283
|
|
|
264
284
|
#### 附上圖片
|
|
265
285
|
|
|
266
|
-
使用 `--image` 附上一或多張本機圖片(可重複指定)。此功能目前支援 ChatGPT;Gemini 圖片輸入尚未支援,搭配 `--provider gemini` 使用會立即回報錯誤。
|
|
286
|
+
使用 `--image` 附上一或多張本機圖片(可重複指定)。此功能目前支援 ChatGPT 與 Claude;Gemini 圖片輸入尚未支援,搭配 `--provider gemini` 使用會立即回報錯誤。
|
|
267
287
|
|
|
268
288
|
```bash
|
|
269
289
|
ask-bridge "請描述這張圖片的內容。" --image screenshot.png
|
|
270
290
|
ask-bridge "比較這兩張圖的差異。" --image v1.png --image v2.png
|
|
291
|
+
ask-bridge --provider claude "請描述這張圖片的內容。" --image screenshot.png
|
|
271
292
|
```
|
|
272
293
|
|
|
273
294
|
支援的格式包含 PNG、JPEG、GIF、WebP、SVG、BMP 等。
|
|
274
295
|
|
|
275
296
|
#### 附上文件
|
|
276
297
|
|
|
277
|
-
使用 `--file` 附上一或多份本機文件(可重複指定),例如 PDF、Word、Excel、PowerPoint、純文字、Markdown、CSV、JSON、程式碼等。ChatGPT 與
|
|
298
|
+
使用 `--file` 附上一或多份本機文件(可重複指定),例如 PDF、Word、Excel、PowerPoint、純文字、Markdown、CSV、JSON、程式碼等。ChatGPT、Gemini 與 Claude 都支援此流程。
|
|
278
299
|
|
|
279
300
|
```bash
|
|
280
301
|
ask-bridge "請摘要這份 PDF 的重點。" --file report.pdf
|
|
@@ -302,6 +323,8 @@ ask-bridge "證明這個數學問題。" --model o3
|
|
|
302
323
|
ask-bridge "快速翻譯這段話。" --model 即時
|
|
303
324
|
ask-bridge --provider gemini "用幾句話介紹 Rust。" --model "3.5 Flash"
|
|
304
325
|
ask-bridge --provider gemini "用幾句話介紹 Rust。" --model "3.1 Pro"
|
|
326
|
+
ask-bridge --provider claude "用幾句話介紹 Rust。" --model Sonnet
|
|
327
|
+
ask-bridge --provider claude "證明這個數學問題。" --model Opus
|
|
305
328
|
```
|
|
306
329
|
|
|
307
330
|
可用的模型名稱(視帳號權限與 provider UI 而定):
|
|
@@ -309,6 +332,7 @@ ask-bridge --provider gemini "用幾句話介紹 Rust。" --model "3.1 Pro"
|
|
|
309
332
|
- **ChatGPT 模型**:`GPT-5.5`、`GPT-5.4`、`GPT-5.3`、`o3`
|
|
310
333
|
- **ChatGPT 思考強度**:`智慧`、`即時`、`中等`、`高`、`超高`、`專業`
|
|
311
334
|
- **Gemini 模式**:`3.5 Flash`、`3.1 Flash-Lite`、`3.1 Pro`
|
|
335
|
+
- **Claude 模型**:`Sonnet`、`Opus`、`Haiku`(實際名稱依 claude.ai 選單與帳號方案而定)
|
|
312
336
|
|
|
313
337
|
> 若指定的名稱在選單中找不到,`ask-bridge` 會回報 `Model switch failed: error: model not found in menu` 並中止,不會送出 prompt。
|
|
314
338
|
|
|
@@ -319,6 +343,7 @@ ask-bridge --provider gemini "用幾句話介紹 Rust。" --model "3.1 Pro"
|
|
|
319
343
|
```bash
|
|
320
344
|
ask-bridge open
|
|
321
345
|
ask-bridge --provider gemini open
|
|
346
|
+
ask-bridge --provider claude open
|
|
322
347
|
```
|
|
323
348
|
|
|
324
349
|
### 11. 關閉瀏覽器 instance
|
|
@@ -331,6 +356,16 @@ ask-bridge close
|
|
|
331
356
|
|
|
332
357
|
`close` 只會關閉使用 `~/.config/ask-bridge/chrome-profile` 且監聽 debug port `9223` 的 `ask-bridge` Chrome instance;若該 port 被非 `ask-bridge` Chrome 程序占用,會回報錯誤而不會關閉它。
|
|
333
358
|
|
|
359
|
+
### 12. 更新 ask-bridge
|
|
360
|
+
|
|
361
|
+
若要直接自動更新目前安裝的 `ask-bridge`,可直接執行:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
ask-bridge update
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
此命令會依作業系統重新執行 README 建議的官方安裝命令(macOS / Linux 或 Windows)。
|
|
368
|
+
|
|
334
369
|
## 運作原理
|
|
335
370
|
|
|
336
371
|
1. **瀏覽器初始化**:`ask-bridge` 會檢查 Chrome 是否正在監聽 debug port `9223`。若沒有,會以專屬 profile 目錄 `~/.config/ask-bridge/chrome-profile` 啟動 Google Chrome。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ask-bridge",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Automate ChatGPT or
|
|
3
|
+
"version": "0.2.9",
|
|
4
|
+
"description": "Automate ChatGPT, Gemini or Claude from the command line through Chrome.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ask-bridge": "npm/cli.cjs",
|
|
7
7
|
"ask": "npm/cli.cjs"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"keywords": [
|
|
26
26
|
"chatgpt",
|
|
27
27
|
"gemini",
|
|
28
|
+
"claude",
|
|
28
29
|
"chrome",
|
|
29
30
|
"rust",
|
|
30
31
|
"cli"
|