1. 簡介
在本程式碼研究室中,您將瞭解 Antigravity CLI,這是 Antigravity 的輕量級終端機使用者介面 (TUI) 表面。這項工具可直接在終端機中提供與 Antigravity 2.0 相同的核心代理功能,例如多步驟推理、多檔案編輯、工具呼叫和對話記錄。
課程內容
- 安裝及設定 Antigrabity CLI
- 瞭解 Antigravity CLI 的基本用法
- 透過 Antigravity CLI 探索幾種用途
軟硬體需求
您需要下列項目:
- Chrome 網路瀏覽器
- Gmail 帳戶
本程式碼研究室適合各種程度的使用者和開發人員 (包括初學者) 參加。程式碼研究室中的應用實例已分類為開發人員和非開發人員工作。開發人員用途範例會示範如何使用 Antigravity CLI 產生程式碼,以及如何使用 GitHub 存放區執行常見的開發工作,例如程式碼說明/解讀、產生說明文件、修正問題等。建議您在程式碼研究室中完成這些用途。最後還有一個選用章節,涵蓋多項非開發人員的日常工作。
2. 事前準備
建立專案
- 在 Google Cloud 控制台的專案選取器頁面中,選取或建立 Google Cloud 專案。
- 確認 Cloud 專案已啟用計費功能。瞭解如何檢查專案是否已啟用計費功能。
- 您將使用 Cloud Shell,這是 Google Cloud 中執行的指令列環境,預先載入了 bq。按一下 Google Cloud 控制台頂端的「啟用 Cloud Shell」。

- 連至 Cloud Shell 後,請使用下列指令確認驗證已完成,專案也已設為獲派的專案 ID:
gcloud auth list
- 在 Cloud Shell 中執行下列指令,確認 gcloud 指令已瞭解您的專案。
gcloud config list project
- 如果未設定專案,請使用下列指令設定:
gcloud config set project <YOUR_PROJECT_ID>
3. 安裝
設定及執行 Antigravity CLI 前,請先建立一個資料夾,做為所有專案的主資料夾,您可以在其中建立各項專案。雖然 Antigravity CLI 也會視需要參照系統中的特定其他資料夾,但這個資料夾是它的工作起點。
請繼續建立範例資料夾 (agy-cli-projects),然後透過下列指令前往該資料夾。如要使用其他資料夾名稱,請自行變更。
mkdir agy-cli-projects
前往該資料夾:
cd agy-cli-projects
安裝程序簡單明瞭,且主要作業系統皆提供二進位檔。我已直接從安裝文件取得要在終端機中執行的指令:
macOS | Linux
curl -fsSL https://antigravity.google/cli/install.sh | bash
Windows PowerShell
irm https://antigravity.google/cli/install.ps1 | iex
Windows CMD
curl -fsSL https://antigravity.google/cli/install.cmd -o install.cmd && install.cmd && del install.cmd
理想情況下,這應該會在系統和路徑中設定及安裝 Antigravity CLI (agy)。
在某些情況下,如果安裝程式無法將二進位檔 ( agy 至 PATH) 新增至 PATH,就會顯示相關訊息。舉例來說,以下是電腦上的輸出範例,安裝程式無法將二進位檔新增至 PATH,並建議您採取行動。
% curl -fsSL https://antigravity.google/cli/install.sh | bash
⠋ Detecting system environment...
✓ Platform detected: darwin_arm64
⠋ Querying release repository...
✓ Latest available version: 1.0.1
⠋ Downloading release package...
✓ Download complete and checksum verified.
⠋ Extracting binary from archive...
⠋ Configuring shell environment...
I0523 11:44:14.012088 76528 installer.go:27] Running Antigravity CLI setup...
Warning: /Users/neilirani/.local/bin is not present in your active PATH.
To use the 'agy' CLI globally, please manually add it to your shell profile:
echo 'export PATH="/Users/yourusername/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
✅ Antigravity CLI binary placed successfully at /Users/yourusername/.local/bin/agy
Note: The binary is installed, but it is not in your active PATH. Please follow the instructions above to add it, then restart your terminal session.
只要透過下列指令查看 Antigravity CLI 版本即可 (顯示的版本是撰寫本程式碼研究室時的版本):
$ agy --version
1.0.5
首次啟動 Antigravity CLI 時,系統會要求您登入。啟動 agy,畫面應如下所示:
▄▀▀▄
▀▀▀▀▀▀
▀▀▀▀▀▀▀▀
▄▀▀ ▀▀▄
▄▀▀ ▀▀▄
Welcome to the Antigravity CLI. You are currently not signed in.
Select login method:
> 1. Google OAuth
2. Use a Google Cloud project
[Use arrow keys to navigate, Enter to select]
請暫時使用個人帳戶。選擇「1. Google OAuth,然後按下 Enter 鍵。系統會啟動瀏覽器,你可以使用 Google 帳戶登入。驗證和授權成功後,系統會要求您複製代碼。請返回 Antigravity CLI 終端機並貼上授權碼。
登入成功後,系統會執行下列動作:
- 首先,系統會詢問您要為 Antigravity CLI 選擇的色彩主題,如下所示。請選擇您喜歡的主題。
- 接著,請接受幾項服務條款。接受這些要求。
最後,最重要的就是授予資料夾信任權限,如下所示:
Accessing workspace:
/Users/yourusername/agy-cli-projects
Do you trust the contents of this project?
Antigravity CLI requires permission to read, edit, and execute files here.
> Yes, I trust this folder
No, exit
↑/↓ Navigate · enter Confirm
通常在啟動 Antigravity CLI 的任何新資料夾中,都會看到這個選項。我們會在後續系列課程中進一步說明,但現在請先選取「Yes, I trust this folder」。
恭喜!現在一切就緒,Antigravity CLI 等待您的提示。
4. 首次與 Antigravity CLI 互動
開始使用 Antigravity CLI,並輸入第一個查詢,如下所示:
Give me a famous quote on Artificial Intelligence and who said that?
預期的回覆如下:
● WebSearch(famous quotes on Artificial Intelligence) (ctrl+o to expand)
Here is one of the most famous quotes on Artificial Intelligence:
│ "AI is the new electricity."
│ — Andrew Ng (Co-founder of Coursera and Google Brain, Adjunct Professor at Stanford University)
Another widely cited perspective on the potential risks of AI is:
│ "The development of full artificial intelligence could spell the end of the human race. It would take off on its
│ own, and re-design itself at an ever-increasing rate."
│ — Stephen Hawking
您應該會發現 Antigravity 使用了其中一項內部工具 WebSearch 來取得引文。
除了在這裡提供提示,Antigravity CLI 還支援哪些指令?只要輸入 /help (正斜線),即可查看各種指令和鍵盤快速鍵。撰寫本文時,部分指令如下所示:
Antigravity CLI general commands shortcuts (←/→ or tab to cycle)
Available Commands
> /add-dir Add a directory to the workspace
/agents List available custom agents
/artifact View and review artifacts
/btw Ask a side question without interrupting the current task
/changelog Show release notes and changes
/clear (new) Clear conversation and start a new one
/config (settings) Open settings panel
/context Visualize current context usage
/copy Copy the last planner response to the clipboard (may require allowing clipboard ac...
/credits Show remaining G1 credits and purchase link
/diff View uncommitted changes and per-turn diffs
/exit (quit) Exit the CLI
/fast Agent will execute tasks directly. Use for simple tasks that can be completed faster
/feedback Submit qualitative feedback to improve the agent
/fork (branch) Create a branch of the current conversation at this point
/help Show available commands and keybindings
/hooks Manage hook configurations for tool events
/keybindings Set custom keybindings
/logout Log out
/mcp Manage MCP servers
/model Set a model
/open Open a file or view opened/edited files
/permissions Manage tool permissions
/planning Agent can plan before executing tasks. Use for deep research, complex tasks, or co...
<MORE_COMMANDS>
現在先結束 Antigravity CLI。你可以透過 /quit 指令執行這項操作,也可以在互動式 Antgiravity CLI 終端機工作階段中按兩次 ctrl+d。
5. Antigravity CLI - 幾個管理指令
請確認 Antigravity CLI 已啟動,並等待您的指令。
請注意模型使用的名稱,該名稱會顯示在右下角。首先,您最好瞭解大部分的自訂項目和設定,都可以透過 /config 或 /settings 指令完成。
設定
請繼續叫用 /config 指令。這會顯示 Antigravity 的各個區域,您可以根據偏好設定自訂這些區域,包括色彩配置、工具權限、遙測設定等。
Settings
Search:
────────────────────
> Animation Speed medium
Artifact Review asks for review
Color Scheme dark
Editor auto ($EDITOR)
Enable Telemetry on
Non-Workspace Access off
Notifications off
Rendering Mode native terminal (inline)
Sandbox Mode off
Show Feedback Survey on
Show Tips on
Tool Permission request-review
Use AI Credits off
Verbosity high
舉例來說,「色彩配置」會顯示下列選項,我可以從中選擇偏好的色彩配置:
Color Scheme ╭─────────────────────────────────────────────────────────────╮
terminal │
light │
solarized light │
colorblind-friendly light │
> dark (current) │
solarized dark │
colorblind-friendly dark │
tokyo night
settings.json
設定需要儲存在某處,對吧?所有這些項目都會儲存在 ~/.gemini/antigravity-cli/settings.json 檔案中。下方顯示範例 :
{
"colorScheme": "dark",
"model": "Gemini 3.5 Flash (High)",
"statusLine": {
"type": "",
"command": "",
"enabled": true
},
"trustedWorkspaces": [
"/Users/romin/antigravity-cli-projects",
"/Users/romin/agy-cli-projects"
]
}
您會發現我已選取 colorScheme、模型,以及我啟動 Antigravity CLI 並同意信任資料夾的各種資料夾。
附註:您也可以直接修改 settings.json,並重新啟動 Antigravity CLI,這是查看變更的最佳做法。但請務必確認設定,否則啟動時會顯示錯誤。如果不習慣直接修改檔案,建議在 Antigravity CLI 中使用 /settings 或 /config 指令處理這個檔案。
工具權限
請務必瞭解工具權限這項重要設定。這項設定可控管是否要先經過核准,才能執行終端機指令。您可以使用 /config 指令存取這項功能。
Tool Permission
> request-review (current)
proceed-in-sandbox
always-proceed
strict
預設值為 request-review。讓我們進一步瞭解。在 Antigravity 中,工具權限設定可控管安全性 (保護主機系統免於非預期的變更) 和速度 (代理程式自主運作的程度,無需暫停等待您輸入內容) 之間的平衡。以下是可用的選項:
request-review (目前預設)
在這個模式下,代理程式會視為協作夥伴,在執行任何可能影響系統或專案檔案的操作前,都會先進行檢查,確保操作不會超出預先核准的範圍。每當代理程式嘗試執行終端機指令、執行檔案作業 (例如寫入/刪除),或呼叫未預先核准權限的外部服務時,執行作業就會暫停。系統會提示使用者核准或拒絕特定動作。
proceed-in-sandbox
這個模式可讓代理程式自動執行終端機指令,但會限制在安全的獨立容器中。Agent 可以執行指令,不必提示您,但這些指令會在虛擬沙箱 (例如輕量型容器) 中執行。他們無法修改實際主機的檔案系統,也無法存取您的區域網路。
always-proceed
這是完全自主模式,可讓代理程式發揮最大速度和能力。代理程式可直接在主機上執行指令及寫入檔案,且不會要求您確認。
strict
這是零信任的高安全性模式。代理程式只能執行讀取工具,所有非讀取工具都會要求使用者採取行動。
6. Antigravity CLI - 指令參數
啟動 Antigravity CLI 時,可以提供幾個指令列參數。如要取得完整選項清單,可以使用 --help,如下所示。
agy --help
這時畫面會顯示所有可用的選項。範例如下所示:
$ agy --help
Usage of agy:
--add-dir Add a directory to the workspace (repeatable) (default [])
-c Short alias for --continue
--continue Continue the most recent conversation
--conversation Resume a previous conversation by ID
--dangerously-skip-permissions Auto-approve all tool permission requests without prompting
-i Short alias for --prompt-interactive
--log-file Override CLI log file path
--model Model for the current CLI session
-p Short alias for --print
--print Run a single prompt non-interactively and print the response
--print-timeout Timeout for print mode wait (default 5m0s)
--prompt Alias for --print
--prompt-interactive Run an initial prompt interactively and continue the session
--sandbox Run in a sandbox with terminal restrictions enabled
Available subcommands:
changelog Show changelog and release notes
help Show help for subcommands
install Configure environment paths and shell settings
models List available models
plugin Manage plugins (install, uninstall, list, enable, disable)
plugins Alias for plugin
update Update CLI
讓我們來看看其中幾項。
非互動模式 (自主)
Antigravity CLI 還有個有趣的用法,就是以非互動模式執行。這表示您可以直接提供提示詞,Antigravity CLI 會回覆您,但不會開啟互動式終端機。如果您打算在指令碼或任何其他自動化程序中,以自動化的方式使用 Antigravity CLI,這項功能便可派上用場。
您可以使用 -p 參數,將提示提供給 Antigravity CLI,如下所示:
agy -p "What is the gcloud command to deploy to Cloud Run"
這或許是快速取得答案的好方法,但請注意,你無法透過追問來延續對話。
選擇特定模型
第一種方式是要求 Antigravity CLI 使用特定 Gemini 模式。您可以使用 --model 參數,要求 Antigravity CLI 僅在工作階段期間使用特定模型。這對於上一節提到的非互動模式非常實用,您可以在其中啟動多個 agy 工作階段,並針對特定工作使用特定模型。
但首先,您需要瞭解 Antigravity CLI 適用的模型。您可以透過 models 子指令執行這項操作,如下所示:
$ agy models
Gemini 3.5 Flash (Medium)
Gemini 3.5 Flash (High)
Gemini 3.5 Flash (Low)
Gemini 3.1 Pro (Low)
Gemini 3.1 Pro (High)
Claude Sonnet 4.6 (Thinking)
Claude Opus 4.6 (Thinking)
您可以使用任一模型名稱,指定要在工作階段中使用的模型。您可以透過下列 --model 指令執行這項操作:
$ agy --model "Claude Opus 4.6 (Thinking)"
Antigravity CLI 啟動後,您可以透過 /model 指令,查看您要求使用的特定模型,也可以查看右下角顯示的會話模型。
Living dangerously
如果您喜歡冒險,可以尋找名為 --dangerously-skip-permissions 的參數。這個參數會自動核准所有工具權限,不會出現權限要求提示,因此請謹慎使用。
執行下列指令啟動 Antigravity CLI:
agy --dangerously-skip-permissions
然後輸入下列提示詞。確認該應用程式未要求任何檔案寫入權限。
> get the latest news and write it in a file called news.txt. Then create another file that contains the summary of that file.
● ListDir(/Users/romin/agy-cli-projects)
● WebSearch(latest world news May 24 2026 news headlines) (ctrl+o to expand)
▸ Thought for 2s, 95 tokens
Processing News Information
● Create(/Users/romin/agy-cli-projects/news.txt)
● Create(/Users/romin/agy-cli-projects/summary.txt) (ctrl+o to expand)
I have fetched the latest world news headlines and created the requested files in your workspace:
1. news.txt: Contains the detailed news headlines for today (May 24, 2026), including topics on geopolitics (U.S.-Iran negotiations, Ukraine conflict), U.S.
security incidents, the Ebola outbreak in Central Africa, and the passing of NASCAR champion Kyle Busch.
2. summary.txt: Contains a concise, structured summary of the major categories covered in the news file.
如果情況屬於本機且可控管,但仍可能發生意外,這個模式就非常實用,但請謹慎使用。
7. Antigravity CLI - Shell 模式
現在是瞭解如何直接在 Antigravity CLI 中使用殼層的好時機。在訊息方塊中按下 ! 即可進入殼層模式。如要返回,請再次按下 ! 或 ESC 鍵。
進入殼層模式後,提示詞開頭便會顯示 !,如下所示:

您可以直接使用標準指令 (例如 pwd 和 ls) 進行檢查,如下所示。請注意,這些指令是以 Linux 類型的作業系統為前提。如果您使用其他作業系統 (Windows),請使用對應的指令,例如 (cd、dir 和 type)。
8. 可嘗試的用途
Antigravity CLI 適用於各種用途,開發人員和非開發人員都能使用。以下列出幾種情境,您可以根據感興趣的領域,嘗試其中任何或所有情境。
在這些情況下,系統會提供提示。您可以在 Antigravity CLI 互動模式中試用,進一步瞭解 Antigravity CLI 如何執行工作。
使用 Antigravity CLI 進行直覺式程式開發
我們將使用 Antigravity CLI,透過直覺式程式開發打造應用程式。在這項工作中,您會要求 Antigravity CLI 生成應用程式,然後將初始版本推送至 GitHub 存放區。
必要條件
如要執行本節中的工作,請先完成下列必要條件:
- Git
- Antigravity CLI
- Python 3 環境
- 設定
gh( GitHub CLI 工具)。 - 熟悉 Git 基礎知識,並具備一些程式設計知識
我們假設您已在所選的特定資料夾中啟動 Antigravity CLI。在我們的案例中,我們已從初始主資料夾啟動 Antigravity CLI:agy-cli-projects,以及其中的另一個資料夾 bq-releases-notes。
從初始提示開始。您可以將其視為應用程式的規格。請隨意修改。請注意,在與 Antigravity CLI 的工作階段中,系統會要求您提供建立檔案等項目的權限。請授予必要權限。
Please build a web application for me using Python Flask and plain vanilla HTML, JavaScript and CSS that fetches the BigQuery Release notes from (https://docs.cloud.google.com/feeds/bigquery-release-notes.xml) and shows them to me.
A simple refresh button with a spinner is good enough, anytime I'd like to refresh the details.
I would also like the ability to take any specific update, select it and then Tweet about it.
接下來呈現的幾個提示詞和回覆是我們觀察到的流程,只是參考範例。Antigravity CLI 會提出方案,並要求您確認 / 說明或繼續操作。請按照指示操作。以下是我的對話串範例:
I will start by exploring the workspace to see if there is an existing structure or if this is a brand new project.
● ListDir(/Users/romin/agy-cli-projects/bq-release-notes) (ctrl+o to expand)
I will read the BigQuery release notes XML feed to understand its structure (Atom/RSS elements, entry/item elements, namespaces, dates, titles, content) so that we can parse it
correctly in the Python Flask backend.
● ReadURL(https://docs.cloud.google.com/feeds/bigquery-release-notes.xml) (ctrl+o to expand)
I will view the fetched feed content saved locally to understand its format and structure.
● Read(/Users/romin/.gemini/antigravity-cli/brain/116191af-e6ea-4ba5-aa23-62f995bd068a/.system_generated/steps/6/content.md) (ctrl+o to expand)
▸ Thought for 2s, 2.3k tokens
Analyzing XML Feed Structure
I will write the implementation plan detailing the architecture, design aesthetic, components, and verification steps for the BigQuery Release Notes Web Application. This plan will be
written to the artifacts directory.
● Create(/Users/romin/.gemini/antigravity-cli/brain/116191af-e6ea-4ba5-aa23-62f995bd068a/implementation_plan.md) (ctrl+o to expand)
I have created the implementation_plan.md to outline the design and architecture of the BigQuery Release Notes Web Application.
Please review the plan, especially the approach for the Twitter Composer & Preview Card, and let me know if you approve or if there are any adjustments you'd like to make!
1 artifact · /artifact to review
現在要瞭解 Antigravity 中的構件。Antigravity CLI 會透過構件,隨時向我們回報實作計畫、正在處理的工作清單、可驗證的輸出內容等。這些檔案是 Antigravity 執行的工作、計畫、工作清單等的記錄。
完成後,系統會顯示「I have created the implementation_plan.md to outline the design and architecture of the BigQuery Release Notes Web Application. 請詳閱這項計畫,特別是 Twitter 撰寫工具和預覽資訊卡的方法,並告訴我是否核准,或是否需要進行任何調整!」
您可以看到右下角也提到「有 1 個構件待審查」,在本例中,該構件是 implementation_plan.md。
輸入 /artifact 指令,系統會顯示生成的構件 implementation_plan.md,您可以使用方向鍵開啟、核准、拒絕等。只要按下 Esc 鍵返回提示,即可視需要核准。
在本範例中,我們將採用系統生成的內容並核准。這會啟動下一組步驟,開始實作 (即建立檔案、執行幾個指令等)。系統會提示您視需要核准並授予執行權限。
在本例中,我們已授權該工具建立 Python 虛擬環境、透過 requirements.txt 安裝依附元件等。
在背景中,系統也會根據實作計畫建立 task.md 檔案,並在完成個別工作時勾選。完成後,系統會通知您,您可以在瀏覽器中檢查應用程式。以下是系統為我們產生的內容:

我們現在可以暫停。目的是要展示並瞭解在簡單需求下,這項功能可以做什麼。
(選用) 將變更推送至 GitHub 存放區
如果不想將我們建立的活動網站推送至 GitHub,可以忽略這個部分,直接前往下一個部分。
首先,請建立 .gitignore 檔案,您可以運用 Antigravity CLI 輔助。
Create a .gitignore file for this project.
下一步,您將指示 Antigravity CLI 透過 GitHub 帳戶推送這個存放區,這項操作應會使用 GitHub 輔助程式 (gh),該程式預期會在您的電腦上提供及設定 / 安裝。GitHub MCP 伺服器工具。
輸入類似下方的提示:
Great! I would now like to push all of this to a new repository in my GitHub account. I would like to name this repository <Your-Name>-event-talks-app
此時會執行一連串指令:
- 建立存放區。
- 這項作業會使用多個 Git 指令 (init、add、commit) 管理本機 Git 存放區。
- 然後設定 Git 遠端並執行推送作業
如果一切順利,應該就會成功建立 GitHub 存放區。您可以前往 GitHub 存放區頁面。以下是範例螢幕截圖:

請注意,您尚未為這個專案產生 README.md,這很適合在下一節練習,我們現在要使用您剛建立的存放區。
使用 Antigravity CLI 處理程式碼存放區
在本應用情境中,您將使用 Antigravity CLI 處理程式碼存放區。您將執行多項工作,包括:
- 瞭解程式碼集
- 正在生成文件
- 實作新功能
這應該能為您奠定良好基礎,以便處理存放區,並將 Antigravity CLI 當成這些開發人員專屬工作的助理。
必要條件
如要執行本節中的工作,您需要:
- Antigravity CLI
- 您應該已完成上一節,並備妥產生的程式碼,我們在該節中建立了 BigQuery 版本資訊讀取器。
請繼續使用您產生 BigQuery 版本資訊應用程式時所用的資料夾/目錄中的 Antigravity CLI。
請嘗試使用下列提示:
瞭解程式碼集
- 我想詳細瞭解這個專案。請協助我瞭解主要功能,然後分成伺服器端和用戶端。請提供範例流程,並說明要求和回應的運作方式。請注意,這會建立新檔案 (構件),您可以透過 **
/artifact** 指令查看所有構件或特定構件。 - 說明
@app.py
產生 README 檔案
- 為這項專案生成
README檔案。
實作新功能
- 請實作兩項簡單的實用功能:每張資訊卡上的「複製到剪貼簿」按鈕,以及「匯出為 CSV」按鈕。
- 請在標題中實作簡單的切換開關,藉由覆寫 CSS 根變數,將頁面的色彩配置從深色模式切換為淺色模式。
這時應該會提供方案,您可以核准。核准後,Antigravity CLI 就會進行這些變更。請測試變更,如果出現錯誤 (很可能),請要求 Antigravity CLI 修正。
根據建議功能生成問題
我們來試試有趣的功能。您要詢問 Antigravity CLI,如何改善這個應用程式的使用者體驗。
請嘗試使用下列提示:
- 請從使用者體驗的角度評估應用程式,包括易用性、回應速度、實用訊息等。請列出可改善之處,並以清單形式提供給我。
接著,您可以選取先前生成的問題,要求 Antigravity CLI 解決並實作。
(選用) 日常工作
以下用途是您可能經常執行的工作。包括將檔案整理到資料夾、從網路上擷取及摘要內容、處理圖像檔案並從中擷取內容、處理資料庫等等。
歡迎探索任何您喜歡的用途。
整理檔案/資料夾
您可以視需要使用 Antigravity CLI,依類型將檔案整理到不同資料夾。前往電腦上含有多個檔案的資料夾,例如 .txt、.png、.jpg、.pdf、.mp4 等。這可能是指桌面或「下載」資料夾。
前往該資料夾並啟動 Antigravity CLI。您將要求 Antigravity CLI 先建立一些資料夾:Images、Documents、Videos,然後要求 Antigravity CLI 整理這些資料夾中的檔案。
執行指令前,Antigravity CLI 通常會提示您授予權限,尤其是修改檔案系統的指令 (例如寫入、移動或刪除檔案)。請務必仔細查看這些提示,再授予權限。這是您的安全網。
Create the following folders "Images","Documents","Videos"
然後輸入下列提示:
Go through all the files in this folder and then organize them by moving all the files ending with .jpg, .jpeg, .gif into the "Images" folder. Move all ".txt" files into the "Documents" folder. Move all the ".mp4" files in the "Videos" folder.
以下是在我們機器上執行的範例:
I have completed organizing your files into their respective folders. Here is a summary of the files moved:
• Images: Moved 95 files ending in .jpg or .jpeg (no .gif files were present).
• Documents: Moved 1 file ending in .txt ( 12March_Live_chat_transcript.txt ).
• Videos: Moved 26 files ending in .mp4 .
其他幾種整理情境 (提示會顯示在每個情境旁):
- 摘要:針對「Documents」資料夾中的每個文件,在同一個資料夾中建立名為「summary_ORIGINAL_FILENAME.txt」的 txt 檔案,其中包含文件重點的 3 句摘要。
- 依類型分類:掃描這個目錄中的所有 PDF 和 DOCX 檔案。將名稱或內容含有「invoice」的所有檔案移至「Financial/Invoices」資料夾。將含有「receipt」的檔案移至「Financial/Receipts」。其他 .docx 檔案則移至「Reports」。
- 擷取重要資訊 (並「標記」):讀取「Financial/Invoices」資料夾中每個 PDF 檔案的內容。如果找到日期,請重新命名檔案,並以 YYYY-MM-DD 格式加入該日期,例如「invoice_2025-07-26_original_name.pdf」。
摘要文章 (本機檔案或網頁)
在下列每種情境中,您可以視需要變更網址、感興趣的主題和本機檔案名稱。提供的檔案名稱為範例,您可以將其替換為系統中的檔案名稱。
請嘗試下列任一情境 (提示詞位於各情境旁):
- 摘要網頁文章 (單一網址):前往 https://medium.com/google-cloud/antigravity-cli-tutorial-series-12b46cfe3bf2,並摘要這篇新聞文章的前 3 個重點。
- 重點摘要多篇網頁文章 (例如搜尋結果):使用 Google 搜尋尋找有關「Antigravity CLI」的最新新聞報導。針對前 5 篇相關的文章,每篇以 2 到 3 句話摘要,並列出網址。
- 重點摘要本機文字檔:重點摘要「my_research_paper.txt」文章的重點,並著重於方法和結論。
- 生成本機 PDF 的摘要:讀取「financial_report_Q2_2025.pdf」。請提供財務績效摘要,並說明提及的主要挑戰。
擷取特定資訊 (本機檔案或網頁)
在下列每種情境中,您可以視需要變更網址、感興趣的主題和本機檔案名稱。提供的檔案名稱為範例,您可以將其替換為系統中的檔案名稱。
請嘗試下列任一情境 (提示詞位於各情境旁):
- 從本機文章中擷取實體:從「biography.txt」列出所有具名人士,以及與他們相關的重要日期。
- 從 PDF 中的表格擷取資料:在「quarterly_sales.pdf」中,從第 3 頁的「Product Sales by Region」(各區域的產品銷售量) 表格擷取資料,並以 Markdown 表格格式呈現。
- 從新聞網站擷取新聞標題和來源:前往「https://news.google.com/」(或類似的新聞網站)。從首頁擷取主要新聞標題和對應的新聞來源,並以項目符號清單呈現。
- 從電子商務頁面尋找產品規格:瀏覽至「https://www.amazon.in/Google-Cloud-Certified-Associate-Engineer/dp/1119871441」(書籍範例)。擷取書名、作者和其他詳細資料,並以結構化 JSON 格式呈現。
- 從影片中擷取時長,並採用特定格式 (例如「2h37m42s」)。
根據內容回答問題 (類似 RAG 的行為)
在下列每種情境中,您可以視需要變更網址、感興趣的主題和本機檔案名稱。提供的檔案名稱為範例,您可以將其替換為系統中的檔案名稱。
請嘗試下列任一情境 (提示詞位於各情境旁):
- 針對本機文件進行問答:我附加了「user_manual.pdf」。如何排解網路連線問題?
- 網頁問答:根據「https://www.who.int/news-room/fact-sheets/detail/climate-change-and-health」的內容,世界衛生組織 (WHO) 認為氣候變遷會帶來哪些主要健康風險?
- 比較多個來源的資訊:我有兩篇新聞報導:「article1.txt」和「article2.txt」,兩者都在討論近期的經濟政策變革。比較並對照他們對小型企業潛在影響的看法。
根據擷取的資訊生成內容
在下列每種情境中,您可以視需要變更網址、感興趣的主題和本機檔案名稱。
請嘗試下列任一情境 (提示詞位於各情境旁):
- 根據文章生成新聞簡報:閱讀 @tech_innovation_article.txt,撰寫簡短有趣的新聞簡報 (約 150 字),適合用於公司電子報,重點在於新技術及其潛力。
- 草擬電子郵件,摘要說明會議轉錄稿內容:這是會議轉錄稿檔案:@meeting_transcript.txt。請草擬電子郵件給團隊,摘要說明會議中做出的重要決策和指派的待辦事項,包括各事項的負責人。
Antigravity CLI 多模態支援
Antigraity CLI 透過 Gemini 支援多種模型,您可以要求處理不同內容格式的檔案。
您將使用 Antigravity CLI 處理大量發票圖片,並從中擷取重要資訊。請按照下列步驟操作:
- 在電腦上建立資料夾,並從下列 GitHub 存放區下載一些發票。
- 從該資料夾啟動 Antigravity CLI
輸入下列提示,以表格形式從月結單中擷取資訊。
The current folder contains a list of invoice files in Image format. Go through all the files in this folder and extract the following invoice information in the form of a table: Invoice No, Invoice Date, Invoice Sent By, Due Date, Due Amount.
輸出內容應如下所示:

以下是另一個情境,您可以要求提供其他衍生欄。假設您想為所有過期的應付憑據顯示紅色叉號表情符號,你可以輸入下列提示:
list all files with .png extension in this folder. Extract the invoice information from it by reading them locally and display it in a table format containing the following column headers: : Invoice No, Invoice Date, Invoice Sent By, Due Date, Due Amount. Add a column at the end of the table that shows a red cross emoji in case the due date is in the past.
這會產生下列輸出內容:

這項功能適用於您擁有的任何非文字格式檔案。
使用 Antigravity CLI 生成資料
您可以提示 Antigravity CLI 以各種資料格式產生資料,包括內容片段和 JSON 資料 (您可能需要模擬)。我們將著重於適用於開發人員/測試人員的情境。
以下是一些可嘗試的提示:
產生顧客評論樣本的 JSON 資料
Generate a JSON array of 3 synthetic customer reviews for a new smartphone. Each review should have 'reviewId' (string, UUID-like), 'productId' (string, e.g., 'SMARTPHONE_X'), 'rating' (integer, 1-5), 'reviewText' (string, 20-50 words), and 'reviewDate' (string, YYYY-MM-DD format).
產生模擬 API 回應 (JSON)
Generate a JSON array representing 7 daily sales records for a mock API endpoint. Each record should include 'date' (YYYY-MM-DD, chronologically increasing), 'revenue' (float, between 5000.00 and 20000.00), 'unitsSold' (integer, between 100 and 500), and 'region' (string, either 'North', 'South', 'East', 'West').
產生範例資料庫插入陳述式 (SQL)
Generate 5 SQL INSERT statements for a table named 'users' with columns: 'id' (INTEGER, primary key), 'username' (VARCHAR(50), unique), 'email' (VARCHAR(100)), 'password_hash' (VARCHAR(255)), 'created_at' (DATETIME, current timestamp). Ensure the password_hash is a placeholder string like 'hashed_password_X'.
產生 CSV 資料,用於載入/分析資料
Generate 10 lines of CSV data, including a header row, for customer transactions. Columns should be: 'TransactionID' (unique string), 'CustomerID' (integer), 'ItemPurchased' (string, e.g., 'Laptop', 'Monitor', 'Keyboard'), 'Quantity' (integer, 1-3), 'UnitPrice' (float, between 100.00 and 1500.00), 'TransactionDate' (YYYY-MM-DD).
產生設定檔 (YAML)
Generate a sample YAML configuration for a 'user_service'. Include sections for 'database' with 'host', 'port', 'username', 'password', 'database_name'. Also include a 'api_keys' section with 'payment_gateway' and 'email_service' placeholders. Use realistic default values.
生成極端情況/驗證的測試資料
Generate a JSON array of 8 email addresses for testing purposes. Include a mix of: 2 valid standard emails, 2 with missing '@', 2 with invalid domains (e.g., '.com1'), and 2 with special characters in the local part that are usually invalid (e.g., spaces or multiple dots).
9. 恭喜
恭喜!您已成功探索 Antigravity CLI、瞭解其功能,並在特定情境下實際應用。