====== 安裝 OpenCode (Ubuntu 24.04) ====== * 也可以參考我整合好的專案 \\ **[[https://github.com/tryweb/Codeforge]]** * 用 docker compose 就可啟動使用 ===== 安裝程序 ===== * curl -fsSL https://opencode.ai/install | bash * 之後如果要更新也是執行 curl -fsSL https://opencode.ai/install | bash * ++看畫面| jonathan@claude-code-194:~$ opencode --version 1.1.19 jonathan@claude-code-194:~$ curl -fsSL https://opencode.ai/install | bash Installed version: 1.1.19. Installing opencode version: 1.1.21 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100%   ▄ █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀ ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ OpenCode includes free models, to start: cd # Open directory opencode # Run command For more information visit https://opencode.ai/docs ++ * 預設啟動 opencode 就會自動檢查與更新至最新版本, 如果想固定在特定版本 Exp. 1.3.2 - 在 ~/.config/opencode/opencode.json 內加上 **"autoupdate": false** { "$schema": "https://opencode.ai/config.json", "autoupdate": false } - 安裝特定版本執行檔 Exp. 1.3.2 curl -fsSL https://opencode.ai/install | bash -s -- --version 1.3.2 ===== 使用方式 ===== * 進入專案目錄執行opencode ===== 安裝與選用 plugin / MCP / Skills ===== ==== 安裝 Oh My OpenAgent ==== * Ref - https://github.com/code-yeongyu/oh-my-openagent sudo snap remove bun-js sudo apt install unzip curl -fsSL https://bun.sh/install | bash source ~/.bashrc cp ~/.config/opencode/opencode.json ~/.config/opencode/opencode.json.bak bunx oh-my-openagent install * Oh My OpenAgent 內建配置熱門的 MCP Exp. context7(動態文檔), grep_app, websearch , 因此就不需要安裝這三個 MCP * Serena MCP : OpenCode 原生就支援 [[https://opencode.ai/docs/lsp/|LSP]] 因此就不需要安裝 Serena MCP * ulw : UltraWork Mode -> 讓所有 Agent 可以儘可能最大極限合作執行 Exp. ulw 請優化後台 UI/UX 讓操作更簡易 * ralph-loop : 自主持續迭代 -> 讓 AI 持續不停優化 Exp. 搭配 ulw 使用ulw /ralph-loop "優化首頁載入時間 <1.5s(Lighthouse 分數 >95)" --max-iterations 25 --completion-promise "Lighthouse 性能分數 >95" * mcp_tool 執行 playwrite 出現 JSON 異常問題 - 參考解法 - https://github.com/code-yeongyu/oh-my-opencode/issues/729 ==== 安裝 Claude 官方提供的 Skills ==== * Ref - https://github.com/anthropics/skills ==== 安裝 ui-ux-pro-max-skill ==== * Ref - https://github.com/nextlevelbuilder/ui-ux-pro-max-skill * # 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 * 重新啟動 opencode 輸入 "Build a landing page for a SaaS product" ==== 安裝 openspec ==== * Ref - https://github.com/Fission-AI/OpenSpec * Step 1. sudo npm install -g @fission-ai/openspec@latest jonathan@claude-code-194:~$ openspec --version 0.21.0 * Step 2. cd my-project openspec init * ++看畫面| ████ █████ ██████ ██ ██ █████ █████ ██████ █████ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ █████ █████ ██ ███ ████ █████ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██████ ██ ██ █████ ██ ██████ █████ Welcome to OpenSpec! Step 3/3 Review selections Press Enter to confirm or Backspace to adjust. ▌ Antigravity ▌ OpenCode ▌ OpenSpec structure created ▌ AI tools configured ✔ OpenSpec initialized successfully! Tool summary: ▌ Root AGENTS.md stub refreshed for other assistants ▌ 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 Use `openspec update` to refresh shared OpenSpec instructions in the future. Important: Restart your IDE Slash commands are loaded at startup. Please restart your coding assistant to ensure the new /openspec commands appear in your command palette. Next steps - Copy these prompts to Antigravity, and OpenCode: ──────────────────────────────────────────────────────────── 1. Populate your project context: "Please read openspec/project.md and help me fill it out with details about my project, tech stack, and conventions" 2. Create your first change proposal: "I want to add [YOUR FEATURE HERE]. Please create an OpenSpec change proposal for this feature" 3. Learn the OpenSpec workflow: "Please explain the OpenSpec workflow from openspec/AGENTS.md and how I should work with you on this project" ──────────────────────────────────────────────────────────── ++ * 複製畫面看到的這段1. Populate your project context: "Please read openspec/project.md and help me fill it out with details about my project, tech stack, and conventions" 2. Create your first change proposal: "I want to add [YOUR FEATURE HERE]. Please create an OpenSpec change proposal for this feature" 3. Learn the OpenSpec workflow: "Please explain the OpenSpec workflow from openspec/AGENTS.md and how I should work with you on this project"等等貼到 opencode , **分析目前專案狀態產生 openspec/project.md (PRD 檔), 當然也可以使用原本的 PRD 檔案複製成 project.md** * 進入 opencode 執行 /openspec 命令 - Draft the Proposal Exp. /openspec:proposal Add profile search filters - Verify & Review $ openspec list # Confirm the change folder exists $ openspec validate add-profile-filters # Validate spec formatting $ openspec show add-profile-filters # Review proposal, tasks, and spec delta - Refine the Specs 請修正 xxx 功能, 將 abc 改成 zyx - Implement the Change The specs look good. Let's implement this change. - Archive the Completed Change $ openspec archive add-profile-filters --yes # Archive the completed change without prompts * 查看規格清單openspec list * 更版方式 sudo npm install -g @fission-ai/openspec@latest cd myproject openspec update ===== 使用 openchamber Web 操作介面 ===== [[tech/openchamber]] * 參考網址 - - https://github.com/btriapitsyn/openchamber * # Quick install (auto-detects your package manager) curl -fsSL https://raw.githubusercontent.com/btriapitsyn/openchamber/main/scripts/install.sh | bash # Quick start daemon 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 * {{:tech:螢幕擷取畫面_2026-01-23_142619.png?1000|}} ===== 參考網址 ===== * https://opencode.ai/ * https://www.youtube.com/watch?v=GMeLDL1CIz4 * https://github.com/NoeFabris/opencode-antigravity-auth * https://www.cnblogs.com/gyc567/p/19483739 {{tag>ai_coding}}