File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ const dim = (value: string) => UI.Style.TEXT_DIM + value + UI.Style.TEXT_NORMAL
1515
1616const activeSuffix = ( isActive : boolean ) => ( isActive ? dim ( " (active)" ) : "" )
1717
18+ export const defaultConsoleUrl = "https://console.opencode.ai"
19+
1820export const formatAccountLabel = ( account : { email : string ; url : string } , isActive : boolean ) =>
1921 `${ account . email } ${ dim ( account . url ) } ${ activeSuffix ( isActive ) } `
2022
@@ -173,18 +175,17 @@ const openEffect = Effect.fn("open")(function* () {
173175} )
174176
175177export const LoginCommand = effectCmd ( {
176- command : "login < url> " ,
178+ command : "login [ url] " ,
177179 describe : false ,
178180 instance : false ,
179181 builder : ( yargs ) =>
180182 yargs . positional ( "url" , {
181183 describe : "server URL" ,
182184 type : "string" ,
183- demandOption : true ,
184185 } ) ,
185186 handler : Effect . fn ( "Cli.account.login" ) ( function * ( args ) {
186187 UI . empty ( )
187- yield * Effect . orDie ( loginEffect ( args . url ) )
188+ yield * Effect . orDie ( loginEffect ( args . url ?? defaultConsoleUrl ) )
188189 } ) ,
189190} )
190191
Original file line number Diff line number Diff line change 11import { describe , expect , test } from "bun:test"
22import stripAnsi from "strip-ansi"
33
4- import { formatAccountLabel , formatOrgLine } from "../../src/cli/cmd/account"
4+ import { defaultConsoleUrl , formatAccountLabel , formatOrgLine } from "../../src/cli/cmd/account"
55
66describe ( "console account display" , ( ) => {
7+ test ( "uses console.opencode.ai as the default login URL" , ( ) => {
8+ expect ( defaultConsoleUrl ) . toBe ( "https://console.opencode.ai" )
9+ } )
10+
711 test ( "includes the account url in account labels" , ( ) => {
812 expect ( stripAnsi ( formatAccountLabel ( { email : "one@example.com" , url : "https://one.example.com" } , false ) ) ) . toBe (
913 "one@example.com https://one.example.com" ,
You can’t perform that action at this time.
0 commit comments