Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/opencode/src/cli/cmd/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ function getNetworkIPs() {

export const WebCommand = effectCmd({
command: "web",
builder: (yargs) => withNetworkOptions(yargs),
builder: (yargs) =>
withNetworkOptions(yargs)
.boolean('no-open')
.describe('no-open', 'Do not automatically open the web interface in a browser'),
describe: "start opencode server and open web interface",
// Server loads instances per-request via x-opencode-directory header — no
// ambient project InstanceContext needed at startup.
Expand Down Expand Up @@ -71,12 +74,17 @@ export const WebCommand = effectCmd({
)
}

// Open localhost in browser
open(localhostUrl).catch(() => {})
// Open localhost in browser unless --no-open is set
if (!args['no-open']) {
open(localhostUrl).catch(() => {})
}
} else {
const displayUrl = server.url.toString()
UI.println(UI.Style.TEXT_INFO_BOLD + " Web interface: ", UI.Style.TEXT_NORMAL, displayUrl)
open(displayUrl).catch(() => {})
// Open display URL in browser unless --no-open is set
if (!args['no-open']) {
open(displayUrl).catch(() => {})
}
}

yield* Effect.never
Expand Down
Loading