Track 3: Antigravity CLI & 終端機 💻🐚

專業方案 (3,999 NTD) — 專為 12 到 14 歲青少年與家長設計,體驗專業軟體工程師的標準開發流程 (CLI + Git)。

開始指南

🐚 步驟 1:家長與青少年設定 (CLI 引擎)

  1. 設定 API 金鑰:確保 Gemini API 金鑰已設定在環境變數中(例如在終端機 shell profile 中加入 export GEMINI_API_KEY="your-key")。
  2. 驗證 Antigravity CLI:
    開啟終端機並驗證 CLI 是否已安裝並成功執行:
    agy --version
  3. 準備本地端工作區:在標準編輯器(如 VS Code 或 Cursor)中開啟程式碼庫。

💻 步驟 2:透過 CLI 參數下達提示詞

在專業方案中,我們不使用視覺化的聊天視窗。相反地,我們直接透過命令列參數 (Command-line arguments) 指示 Agent。這能教會孩子們如何傳遞 (pipe) 指令與協調多個檔案。

1. 帶有目標的提示詞 (Context Engineering)

永遠將 CLI 直接指向您想要檢查的檔案,這是上下文工程 (Context Engineering) 的核心:

agy prompt "Inspect the typescript interface in packages/shared/src/contracts/index.ts and output the definition of TimesTableContentItem."

2. 指示修改檔案

若要編輯檔案,請告訴 Agent 鎖定哪個檔案以及要做什麼事:

agy edit --file apps/web/public/data/times-table-content.json "Add a custom question contentId times-custom-1 with payload details"

3. 在終端機中檢閱 Diffs

當 CLI Agent 處理完成後,它會在終端機中印出 Git Diff:

你必須檢閱這個 Diff,檢查語法是否正確,然後按下 Y 儲存變更,或按下 N 拒絕變更。

🕒 步驟 3:Git 版本控制 (程式碼時光機)

每位專業的開發者都會使用 Git 來儲存他們的進度。我們將教孩子們三個簡單的指令來提交他們的作品。

[編輯程式碼] --> [git add .] --> [git commit -m] --> [git push] --> [GitHub Repository]

提交 (Commit) 四步任務:

  1. 檢查狀態 (Status):查看哪些檔案被修改了。
    git status
  2. 暫存檔案 (Stage):告訴 Git 將所有修改過的檔案打包。
    git add .
  3. 封裝包裹 (Commit):為你的變更貼上標籤,描述你做了什麼。
    git commit -m "feat: added custom space trivia questions in knowledge.json"
  4. 發布上線 (Push):將你封裝好的包裹推送到你的 GitHub 分支。
    git push origin main

📝 家庭作業與練習

家庭作業 1:將編譯錯誤傳遞給 Agent

刻意製造一個 TypeScript 型別不符的錯誤(例如編輯 play-scene.ts,傳遞一個字串給只接受數字的函式)。執行 build 指令,並將錯誤日誌 (log) 直接 pipe 給 Agent:

pnpm build | agy "Explain this compile failure and output a diff to fix the source file."

目標:檢閱產生的 diff,核准變更,並確認後續的編譯成功完成。

家庭作業 2:分支協作與發布

與你的家長一起建立一個名為 dino-theme 的全新 Git 分支 (Branch):

git checkout -b dino-theme

使用 CLI 實作一個新主題。將變更 add、寫上乾淨的 commit 訊息並 push 到 GitHub 上。在 GitHub 建立一個 Pull Request (PR) 來展示你的成果!