@mitsein-ai/cli 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "type": "module",
49
- "version": "0.2.0"
49
+ "version": "0.2.2"
50
50
  }
@@ -15,7 +15,7 @@ function firstQuery(q: ParsedUrlQuery, key: string): string | undefined {
15
15
 
16
16
  export async function loginBrowserFlow(
17
17
  endpoint: string,
18
- provider: string,
18
+ provider: string | undefined,
19
19
  profile: string,
20
20
  jsonOutput: boolean
21
21
  ): Promise<void> {
@@ -92,7 +92,12 @@ export async function loginBrowserFlow(
92
92
  timer = setTimeout(() => finish(), 300_000);
93
93
 
94
94
  server.listen(LOCALHOST_PORT, '127.0.0.1', () => {
95
- const loginUrl = `${endpoint}/api/auth/cognito/login?provider=${encodeURIComponent(provider)}`;
95
+ const redirectUri = `http://127.0.0.1:${LOCALHOST_PORT}/callback`;
96
+ const params = new URLSearchParams({ redirect_uri: redirectUri });
97
+ if (provider) {
98
+ params.set('provider', provider);
99
+ }
100
+ const loginUrl = `${endpoint}/api/auth/cognito/login?${params.toString()}`;
96
101
  if (!jsonOutput) {
97
102
  consola.log('\nOpening browser for login...');
98
103
  consola.log(`If browser does not open, visit: ${loginUrl}\n`);
@@ -16,7 +16,7 @@ export function registerAuth(program: Command): void {
16
16
  .command('login')
17
17
  .description('Log in (browser callback on localhost, or --device-code)')
18
18
  .option('--device-code', 'Device code flow', false)
19
- .option('--provider <name>', 'OAuth provider: google or msa', 'google')
19
+ .option('--provider <name>', 'OAuth provider (e.g. google, msa). Omit to let the server show a chooser')
20
20
  .option('--endpoint <url>', 'API base URL')
21
21
  .option('--profile <name>', 'Profile to save credentials', 'default')
22
22
  .action(
@@ -33,7 +33,7 @@ export function registerAuth(program: Command): void {
33
33
  if (opts.deviceCode) {
34
34
  await loginDeviceCodeFlow(ep, opts.profile ?? 'default', Boolean(g.json));
35
35
  } else {
36
- await loginBrowserFlow(ep, opts.provider ?? 'google', opts.profile ?? 'default', Boolean(g.json));
36
+ await loginBrowserFlow(ep, opts.provider, opts.profile ?? 'default', Boolean(g.json));
37
37
  }
38
38
  })
39
39
  );
@@ -6,7 +6,7 @@ import { join } from 'node:path';
6
6
  export const DEFAULT_ENDPOINT = 'http://localhost:8000';
7
7
 
8
8
  /** Default OAuth / profile name. */
9
- export const DEFAULT_PROFILE = 'e2e';
9
+ export const DEFAULT_PROFILE = 'default';
10
10
 
11
11
  /** Base config directory: `~/.mitsein`. */
12
12
  export const CONFIG_DIR = join(homedir(), '.mitsein');
@@ -145,7 +145,7 @@ function loadDevToken(
145
145
  * 4. scripts/dev-token.sh (localhost only)
146
146
  */
147
147
  export function resolveCredentials(options: ResolveCredentialsOptions = {}): Credentials {
148
- const profile = options.profile ?? 'e2e';
148
+ const profile = options.profile ?? 'default';
149
149
  const spawnFn = options.spawnDevToken ?? runDevTokenScript;
150
150
 
151
151
  const explicit = loadExplicit(options.token, options.endpoint);