File tree Expand file tree Collapse file tree
packages/opencode/src/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export const AcpCommand = effectCmd({
2222 } ,
2323 handler : Effect . fn ( "Cli.acp" ) ( function * ( args ) {
2424 process . env . OPENCODE_CLIENT = "acp"
25- const opts = yield * Effect . promise ( ( ) => resolveNetworkOptions ( args ) )
25+ const opts = yield * resolveNetworkOptions ( args )
2626 const server = yield * Effect . promise ( ( ) => Server . listen ( opts ) )
2727
2828 const sdk = createOpencodeClient ( {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const ServeCommand = effectCmd({
1515 if ( ! Flag . OPENCODE_SERVER_PASSWORD ) {
1616 console . log ( "Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured." )
1717 }
18- const opts = yield * Effect . promise ( ( ) => resolveNetworkOptions ( args ) )
18+ const opts = yield * resolveNetworkOptions ( args )
1919 const server = yield * Effect . promise ( ( ) => Server . listen ( opts ) )
2020 console . log ( `opencode server listening on http://${ server . hostname } :${ server . port } ` )
2121
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export const WebCommand = effectCmd({
4040 if ( ! Flag . OPENCODE_SERVER_PASSWORD ) {
4141 UI . println ( UI . Style . TEXT_WARNING_BOLD + "! OPENCODE_SERVER_PASSWORD is not set; server is unsecured." )
4242 }
43- const opts = yield * Effect . promise ( ( ) => resolveNetworkOptions ( args ) )
43+ const opts = yield * resolveNetworkOptions ( args )
4444 const server = yield * Effect . promise ( ( ) => Server . listen ( opts ) )
4545 UI . empty ( )
4646 UI . println ( UI . logo ( " " ) )
@@ -72,7 +72,7 @@ export const WebCommand = effectCmd({
7272 }
7373
7474 // Open localhost in browser
75- open ( localhostUrl . toString ( ) ) . catch ( ( ) => { } )
75+ open ( localhostUrl ) . catch ( ( ) => { } )
7676 } else {
7777 const displayUrl = server . url . toString ( )
7878 UI . println ( UI . Style . TEXT_INFO_BOLD + " Web interface: " , UI . Style . TEXT_NORMAL , displayUrl )
Original file line number Diff line number Diff line change 11import type { Argv , InferredOptionTypes } from "yargs"
22import { Config } from "@/config/config"
3- import { AppRuntime } from "@/ effect/app-runtime "
3+ import { Effect } from "effect"
44
55const options = {
66 port : {
@@ -36,10 +36,10 @@ export type NetworkOptions = InferredOptionTypes<typeof options>
3636export function withNetworkOptions < T > ( yargs : Argv < T > ) {
3737 return yargs . options ( options )
3838}
39- export async function resolveNetworkOptions ( args : NetworkOptions ) {
40- const config = await AppRuntime . runPromise ( Config . Service . use ( ( cfg ) => cfg . getGlobal ( ) ) )
39+ export const resolveNetworkOptions = Effect . fn ( "Cli. resolveNetworkOptions" ) ( function * ( args : NetworkOptions ) {
40+ const config = yield * Config . Service . use ( ( cfg ) => cfg . getGlobal ( ) )
4141 return resolveNetworkOptionsNoConfig ( args , config )
42- }
42+ } )
4343
4444export function resolveNetworkOptionsNoConfig ( args : NetworkOptions , config ?: Config . Info ) {
4545 const portExplicitlySet = process . argv . includes ( "--port" )
You can’t perform that action at this time.
0 commit comments