Description
After upgrading the OpenCode CLI from v1 to v2 (opencode v2.0.18), opening OpenCode from the VS Code extension (sst-dev.opencode v0.0.13, latest on the Marketplace as of 2025-12-28) fails immediately with:
ERROR
Unrecognized flag: --port in command opencode
Root cause
The v2 CLI dropped the --port / --hostname flags that existed in v1 (server binding is now handled through the background service/serve subcommand architecture instead of top-level flags). The VS Code extension's bundled dist/extension.js still constructs its CLI invocation using the v1-style --port <n> flag, which v2's argument parser rejects outright.
Steps to reproduce
- Install/upgrade to OpenCode CLI v2 (
curl -fsSL https://opencode.ai/v2/install | bash)
- Have
sst-dev.opencode v0.0.13 installed in VS Code
- Open a project in VS Code and launch OpenCode via the extension
- Observe the
Unrecognized flag: --port error at startup
Expected
The extension should either:
- Detect the CLI major version and adapt its launch invocation accordingly, or
- Drop
--port and use v2's service/serve connection model (e.g. --server <url> / background service) when talking to a v2 CLI.
Environment
- OS: macOS (darwin 27.0.0)
- OpenCode CLI: v2.0.18 (installed via curl installer)
- Extension: sst-dev.opencode 0.0.13 (VS Code Marketplace, last updated 2025-12-28)
Happy to provide more logs if useful.
Description
After upgrading the OpenCode CLI from v1 to v2 (
opencode v2.0.18), opening OpenCode from the VS Code extension (sst-dev.opencodev0.0.13, latest on the Marketplace as of 2025-12-28) fails immediately with:Root cause
The v2 CLI dropped the
--port/--hostnameflags that existed in v1 (server binding is now handled through the backgroundservice/servesubcommand architecture instead of top-level flags). The VS Code extension's bundleddist/extension.jsstill constructs its CLI invocation using the v1-style--port <n>flag, which v2's argument parser rejects outright.Steps to reproduce
curl -fsSL https://opencode.ai/v2/install | bash)sst-dev.opencodev0.0.13 installed in VS CodeUnrecognized flag: --porterror at startupExpected
The extension should either:
--portand use v2'sservice/serveconnection model (e.g.--server <url>/ background service) when talking to a v2 CLI.Environment
Happy to provide more logs if useful.