差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:opencode [2026/01/17 22:31] – [安裝 Oh My OpenCode] jonathantech:opencode [2026/05/11 16:55] (目前版本) – [安裝 OpenCode (Ubuntu 24.04)] jonathan
行 1: 行 1:
 ====== 安裝 OpenCode (Ubuntu 24.04) ====== ====== 安裝 OpenCode (Ubuntu 24.04) ======
  
 +<note tip>
 +  * 也可以參考我整合好的專案 \\  **[[https://github.com/tryweb/Codeforge]]** 
 +  * 用 docker compose 就可啟動使用
 +</note>
 ===== 安裝程序 ===== ===== 安裝程序 =====
   * <cli>curl -fsSL https://opencode.ai/install | bash</cli>   * <cli>curl -fsSL https://opencode.ai/install | bash</cli>
行 26: 行 30:
 For more information visit https://opencode.ai/docs For more information visit https://opencode.ai/docs
 </cli>++ </cli>++
 +<note> 
 +  * 預設啟動 opencode 就會自動檢查與更新至最新版本, 如果想固定在特定版本 Exp. 1.3.2 
 +  - 在 ~/.config/opencode/opencode.json 內加上 **"autoupdate": false**<file> 
 +
 +  "$schema": "https://opencode.ai/config.json", 
 +  "autoupdate": false 
 +
 +</file>  
 +  - 安裝特定版本執行檔 Exp. 1.3.2<cli> 
 +curl -fsSL https://opencode.ai/install | bash -s -- --version 1.3.2 
 +</cli> 
 +</note>
 ===== 使用方式 ===== ===== 使用方式 =====
   * 進入專案目錄執行<cli>opencode</cli>   * 進入專案目錄執行<cli>opencode</cli>
  
 ===== 安裝與選用 plugin / MCP / Skills ===== ===== 安裝與選用 plugin / MCP / Skills =====
-==== 安裝 Oh My OpenCode ==== +==== 安裝 Oh My OpenAgent ==== 
-  * Ref - https://github.com/code-yeongyu/oh-my-opencode <cli>+  * Ref - https://github.com/code-yeongyu/oh-my-openagent <cli>
 sudo snap remove bun-js sudo snap remove bun-js
 sudo apt install unzip sudo apt install unzip
行 38: 行 53:
 source ~/.bashrc source ~/.bashrc
 cp ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json.bak cp ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json.bak
-bunx oh-my-opencode install+bunx oh-my-openagent install
 </cli> </cli>
-  * Oh My OpenCode 內建配置熱門的 MCP Exp. context7(動態文檔), grep_app, websearch , 因此就不需要安裝這三個 MCP+  * Oh My OpenAgent 內建配置熱門的 MCP Exp. context7(動態文檔), grep_app, websearch , 因此就不需要安裝這三個 MCP
   * Serena MCP : OpenCode 原生就支援 [[https://opencode.ai/docs/lsp/|LSP]] 因此就不需要安裝 Serena MCP   * Serena MCP : OpenCode 原生就支援 [[https://opencode.ai/docs/lsp/|LSP]] 因此就不需要安裝 Serena MCP
   * ulw : UltraWork Mode -> 讓所有 Agent 可以儘可能最大極限合作執行 Exp. <cli>ulw 請優化後台 UI/UX 讓操作更簡易</cli>   * ulw : UltraWork Mode -> 讓所有 Agent 可以儘可能最大極限合作執行 Exp. <cli>ulw 請優化後台 UI/UX 讓操作更簡易</cli>
   * ralph-loop : 自主持續迭代 -> 讓 AI 持續不停優化 Exp. 搭配 ulw 使用<cli>ulw /ralph-loop "優化首頁載入時間 <1.5s(Lighthouse 分數 >95)" --max-iterations 25 --completion-promise "Lighthouse 性能分數 >95"</cli>   * ralph-loop : 自主持續迭代 -> 讓 AI 持續不停優化 Exp. 搭配 ulw 使用<cli>ulw /ralph-loop "優化首頁載入時間 <1.5s(Lighthouse 分數 >95)" --max-iterations 25 --completion-promise "Lighthouse 性能分數 >95"</cli>
 +  * mcp_tool 執行 playwrite 出現 JSON 異常問題 - 參考解法 - https://github.com/code-yeongyu/oh-my-opencode/issues/729
 ==== 安裝 Claude 官方提供的 Skills ==== ==== 安裝 Claude 官方提供的 Skills ====
   * Ref - https://github.com/anthropics/skills   * Ref - https://github.com/anthropics/skills
行 49: 行 65:
 ==== 安裝 ui-ux-pro-max-skill ==== ==== 安裝 ui-ux-pro-max-skill ====
   * Ref - https://github.com/nextlevelbuilder/ui-ux-pro-max-skill   * Ref - https://github.com/nextlevelbuilder/ui-ux-pro-max-skill
 +  * <cli>
 +# Install CLI globally
 +sudo npm install -g uipro-cli
  
 +# Go to your project
 +cd /path/to/your/project
 +# Install for your AI assistant
 +uipro init --ai opencode    # OpenCode
 +</cli>
 +  * 重新啟動 opencode 輸入 "Build a landing page for a SaaS product"
  
 +==== 安裝 openspec ====
 +  * Ref - https://github.com/Fission-AI/OpenSpec
 +  * Step 1.<cli>
 +sudo npm install -g @fission-ai/openspec@latest
 +jonathan@claude-code-194:~$ openspec --version
 +0.21.0
 +</cli>
 +  * Step 2.<cli>
 +cd my-project
 +openspec init
 +</cli>
 +    * ++看畫面|<cli>
 + ████   █████   ██████  ██  ██   █████  █████   ██████   █████
 +██  ██  ██  ██  ██      ███ ██  ██      ██  ██  ██      ██
 +██  ██  █████   █████   ██ ███   ████   █████   █████   ██
 +██  ██  ██      ██      ██  ██      ██  ██      ██      ██
 + ████   ██      ██████  ██  ██  █████   ██      ██████   █████
  
-===== 有訂閱 Google AI Pro 用戶進行認證登入 ===== +Welcome to OpenSpec! 
-  * 參考 - https://github.com/NoeFabris/opencode-antigravity-auth/tree/main + 
-  * 如果之後安裝或更新 oh-my-opencode 必須要將 ~/.config/opencode/opencode.json 進行手動修正, [[https://github.com/NoeFabris/opencode-antigravity-auth/tree/main?tab=readme-ov-file#known-plugin-interactions|參考說明]] +Step 3/3 
-  將會增加 Antigravity + Gemini CLI 所提供模型  + 
-  - 先將 opencode.json 進行備份 <cli>cp -a ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json.bak</cli> +Review selections 
-  - 編輯 opencode.json <cli>vi ~/.config/opencode/opencode.json</cli><file+Press Enter to confirm or Backspace to adjust. 
-{ + 
-  "plugin": ["opencode-antigravity-auth@beta"], +▌ Antigravity 
-  : +▌ OpenCode 
-  : +▌ OpenSpec structure created 
-} +▌ AI tools configured 
-</file+ 
-  進行 Google oAuth 認證<cli>opencode auth login</cli> +✔ OpenSpec initialized successfully! 
-    - 選擇 *Google**  + 
-    - 將產生的 URL 貼到瀏覽器, 進行 Google oAuth 認證 +Tool summary: 
-    - 如果是 ssh 登入遠端主機, 沒有進行 port redirect 認證成功後會找不到網頁, 可以將網址完整複製下來 Exp. <cli>http://localhost:51121/oauth-callback?state=eyJ2ZXJpZmllciI6IklW......nfigs%20openid&authuser=0&prompt=consent</cli>貼到 opencode 對話內就可完成 +▌ Root AGENTS.md stub refreshed for other assistants 
-  - 繼續修改 opencode.json 將需要的模型加入<cli>vi ~/.config/opencode/opencode.json</cli><file+▌ Created: Antigravity, and OpenCode 
-+▌ Skipped: Amazon Q Developer, Auggie, Claude Code, Cline, Codex, CodeBuddy Code, Continue (VS Code JetBrains Cli), CoStrict, Crush, Cursor, Factory Droid, Gemini CLI, GitHub Copilot, iFlow, Kilo Code, Qoder, Qwen Code, RooCode, and Windsurf 
-  "plugin":+ 
-    "oh-my-opencode", +Use `openspec update` to refresh shared OpenSpec instructions in the future. 
-    "opencode-antigravity-auth@beta" + 
-  ], +Important: Restart your IDE 
-  "provider": { +Slash commands are loaded at startup. Please restart your coding assistant 
-    "google": { +to ensure the new /openspec commands appear in your command palette. 
-      "name": "Google", + 
-      "models": { +Next steps Copy these prompts to Antigravity, and OpenCode: 
-        "antigravity-gemini-3-pro":+──────────────────────────────────────────────────────────── 
-          "name": "Gemini 3 Pro (Antigravity)", +1Populate your project context: 
-          "limit": { "context": 1048576, "output": 65535 }, +   "Please read openspec/project.md and help me fill it out 
-          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"}, +    with details about my projecttech stack, and conventions" 
-          "variants":+ 
-            "low": { "thinkingLevel": "low" }, +2. Create your first change proposal: 
-            "high": { "thinkingLevel": "high"+   "I want to add [YOUR FEATURE HERE]. Please create an 
-          } +    OpenSpec change proposal for this feature" 
-        }, + 
-        "antigravity-gemini-3-flash"{ +3. Learn the OpenSpec workflow: 
-          "name": "Gemini 3 Flash (Antigravity)", +   "Please explain the OpenSpec workflow from openspec/AGENTS.md 
-          "limit"{ "context": 1048576, "output": 65536 }, +    and how I should work with you on this project" 
-          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }, +──────────────────────────────────────────────────────────── 
-          "variants": { + 
-            "minimal": { "thinkingLevel": "minimal" }, +</cli>++ 
-            "low": { "thinkingLevel": "low" }, +    複製畫面看到這段<cli>1Populate your project context: 
-            "medium": { "thinkingLevel": "medium" }, +   "Please read openspec/project.md and help me fill it out 
-            "high": { "thinkingLevel": "high" } +    with details about my project, tech stack, and conventions" 
-          } + 
-        }, +2. Create your first change proposal: 
-        "antigravity-claude-sonnet-4-5": { +   "I want to add [YOUR FEATURE HERE]. Please create an 
-          "name": "Claude Sonnet 4.5 (Antigravity)", +    OpenSpec change proposal for this feature" 
-          "limit": { "context": 200000, "output": 64000 }, + 
-          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } +3. Learn the OpenSpec workflow: 
-        }, +   "Please explain the OpenSpec workflow from openspec/AGENTS.md 
-        "antigravity-claude-sonnet-4-5-thinking": { +    and how I should work with you on this project"</cli>等等貼到 opencode , **分析目前專案狀態產生 openspec/project.md (PRD 檔), 當然也可以使用原本的 PRD 檔案複製成 project.md** 
-          "name": "Claude Sonnet 4.5 Thinking (Antigravity)", +  * 進入 opencode 執行 /openspec 命令 
-          "limit": { "context": 200000, "output": 64000 }, +    - Draft the Proposal Exp. <cli>/openspec:proposal Add profile search filters</cli> 
-          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }, +    - Verify & Review <code
-          "variants":+$ openspec list                             # Confirm the change folder exists 
-            "low": { "thinkingConfig": { "thinkingBudget": 8192 } }, +$ openspec validate add-profile-filters     # Validate spec formatting 
-            "max": { "thinkingConfig": { "thinkingBudget": 32768 } } +$ openspec show add-profile-filters         # Review proposal, tasks, and spec delta 
-          } +</code
-        }, +    Refine the Specs <cli>請修正 xxx 功能, 將 abc 改成 zyx</cli> 
-        "antigravity-claude-opus-4-5-thinking": { +    - Implement the Change <cli>The specs look good. Let's implement this change.</cli> 
-          "name": "Claude Opus 4.5 Thinking (Antigravity)", +    - Archive the Completed Change <cli>$ openspec archive add-profile-filters --yes  # Archive the completed change without prompts</cli>   
-          "limit": { "context": 200000, "output": 64000 }, +  * 查看規格清單<cli>openspec list</cli> 
-          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }, +  * 更版方式 <cli
-          "variants": { +sudo npm install -g @fission-ai/openspec@latest 
-            "low": "thinkingConfig": "thinkingBudget"8192 } }, +cd myproject 
-            "max"{ "thinkingConfig": { "thinkingBudget": 32768 } } +openspec update 
-          } +</cli> 
-        }, + 
-+===== 使用 openchamber Web 操作介面 ===== 
-+<note tip>[[tech/openchamber]]</note> 
-        } +  * 參考網址 - - https://github.com/btriapitsyn/openchamber 
-      } +  * <cli> 
-    } +# Quick install (auto-detects your package manager
-  }, +curl -fsSL https://raw.githubusercontent.com/btriapitsyn/openchamber/main/scripts/install.sh | bash 
-  "$schema": "https://opencode.ai/config.json" + 
-+# Quick start daemon 
-</file>+openchamber --port 6001 --daemon 
 + 
 +# 其他參數 
 +openchamber                          # Start on port 3000 
 +openchamber --port 8080              # Custom port 
 +openchamber --daemon                 # Background mode 
 +openchamber --ui-password secret     # Password-protect UI 
 +openchamber --try-cf-tunnel          # Create a Cloudflare Quick Tunnel for remote access 
 +openchamber --try-cf-tunnel --tunnel-qr              # Show QR code for easy mobile access 
 +openchamber --try-cf-tunnel --tunnel-password-url   # Include password in URL for auto-login 
 +OPENCODE_PORT=4096 OPENCODE_SKIP_START=true openchamber  # Connect to external OpenCode server 
 +openchamber stop                     # Stop server 
 +openchamber update                   # Update to latest version 
 +</cli> 
 +  {{:tech:螢幕擷取畫面_2026-01-23_142619.png?1000|}}
  
 ===== 參考網址 ===== ===== 參考網址 =====
  • tech/opencode.1768660262.txt.gz
  • 上一次變更: 2026/01/17 22:31
  • jonathan