core: remove default server URL, require login URL argument

This commit is contained in:
Kit Langton
2026-03-10 11:06:15 -04:00
parent cf40bf0f1b
commit 1568d73fb0
2 changed files with 6 additions and 6 deletions

View File

@@ -80,7 +80,6 @@ const DeviceTokenRequest = Schema.Struct({
client_id: Schema.String,
})
const serverDefault = "https://web-14275-d60e67f5-pyqs0590.onporter.run"
const clientId = "opencode-cli"
const toAccountServiceError = (message: string, cause?: unknown) => new AccountServiceError({ message, cause })
@@ -108,7 +107,7 @@ export class AccountService extends ServiceMap.Service<
orgID: OrgID,
) => Effect.Effect<Option.Option<Record<string, unknown>>, AccountError>
readonly token: (accountID: AccountID) => Effect.Effect<Option.Option<AccessToken>, AccountError>
readonly login: (url?: string) => Effect.Effect<Login, AccountError>
readonly login: (url: string) => Effect.Effect<Login, AccountError>
readonly poll: (input: Login) => Effect.Effect<PollResult, AccountError>
}
>()("@opencode/Account") {
@@ -249,8 +248,8 @@ export class AccountService extends ServiceMap.Service<
return Option.some(parsed.config)
})
const login = Effect.fn("AccountService.login")(function* (url?: string) {
const server = url ?? serverDefault
const login = Effect.fn("AccountService.login")(function* (url: string) {
const server = url
const response = yield* executeEffect(
"login",

View File

@@ -11,7 +11,7 @@ const openBrowser = (url: string) => Effect.promise(() => open(url).catch(() =>
const println = (msg: string) => Effect.sync(() => UI.println(msg))
const loginEffect = Effect.fn("login")(function* (url?: string) {
const loginEffect = Effect.fn("login")(function* (url: string) {
const service = yield* AccountService
yield* Prompt.intro("Log in")
@@ -149,12 +149,13 @@ const orgsEffect = Effect.fn("orgs")(function* () {
})
export const LoginCommand = cmd({
command: "login [url]",
command: "login <url>",
describe: false,
builder: (yargs) =>
yargs.positional("url", {
describe: "server URL",
type: "string",
demandOption: true,
}),
async handler(args) {
UI.empty()