@odla-ai/cli 0.11.0 → 0.11.1

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/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-KUQCJ6KA.js";
4
+ } from "./chunk-DC4MIB4X.js";
5
5
 
6
6
  // src/bin.ts
7
7
  runCli().catch((err) => {
@@ -210,12 +210,16 @@ function handshakeEmail(value, cached) {
210
210
  }
211
211
  return email;
212
212
  }
213
- function approvalBrowser(options) {
213
+ function approvalBrowser(options, host = {}) {
214
214
  if (options.open === true) return { open: true, mode: "forced" };
215
215
  if (options.open === false) return { open: false, reason: "disabled by --no-open" };
216
- if (process3.env.CI) return { open: false, reason: "CI environment" };
217
- const interactive = options.interactive ?? Boolean(process3.stdin.isTTY && process3.stdout.isTTY);
218
- if (!interactive) return { open: false, reason: "non-interactive shell; pass --open to force" };
216
+ const env = host.env ?? process3.env;
217
+ if (env.CI) return { open: false, reason: "CI environment" };
218
+ if (env.SSH_CONNECTION || env.SSH_TTY) return { open: false, reason: "SSH session; pass --open to force" };
219
+ const platform = host.platform ?? process3.platform;
220
+ if (platform !== "darwin" && platform !== "win32" && !env.DISPLAY && !env.WAYLAND_DISPLAY) {
221
+ return { open: false, reason: "no graphical display; pass --open to force" };
222
+ }
219
223
  return { open: true, mode: "auto" };
220
224
  }
221
225
  function handshakeUrl(platformUrl, userCode) {
@@ -286,8 +290,9 @@ async function scopedToken(platform, scope, options, doFetch, out) {
286
290
  onCode: async ({ userCode, expiresIn, verificationUriComplete }) => {
287
291
  const approvalUrl = verificationUriComplete ?? handshakeUrl(audience, userCode);
288
292
  out.log(`Review, then approve scoped request ${userCode} at ${approvalUrl} within ${Math.floor(expiresIn / 60)}m.`);
289
- const shouldOpen = options.open === true || options.open !== false && !process4.env.CI && Boolean(process4.stdin.isTTY && process4.stdout.isTTY);
290
- if (shouldOpen) await (options.openApprovalUrl ?? openUrl)(approvalUrl).catch(() => void 0);
293
+ if (approvalBrowser({ open: options.open }).open) {
294
+ await (options.openApprovalUrl ?? openUrl)(approvalUrl).catch(() => void 0);
295
+ }
291
296
  }
292
297
  });
293
298
  const tokens = cache?.platform === audience ? { ...cache.tokens ?? {} } : {};
@@ -1249,7 +1254,6 @@ async function lifecycleContext(options) {
1249
1254
  token: options.token,
1250
1255
  email: options.email,
1251
1256
  open: options.open,
1252
- interactive: options.interactive,
1253
1257
  openApprovalUrl: options.openConsentUrl
1254
1258
  },
1255
1259
  doFetch,
@@ -1258,7 +1262,7 @@ async function lifecycleContext(options) {
1258
1262
  return { cfg, ctx: { platform: cfg.platformUrl, appId: cfg.app.id, env, token, fetch: doFetch }, out };
1259
1263
  }
1260
1264
  function connectionOptions(options, out) {
1261
- const browser = approvalBrowser({ configPath: "odla.config.mjs", open: options.open, interactive: options.interactive });
1265
+ const browser = approvalBrowser({ open: options.open });
1262
1266
  return {
1263
1267
  out,
1264
1268
  open: browser.open,
@@ -2125,7 +2129,6 @@ ${env}: credentials are already saved; retry "odla-ai secrets push --env ${env}$
2125
2129
  { platform: cfg.platformUrl, appId: cfg.app.id, env, token, fetch: doFetch },
2126
2130
  {
2127
2131
  open: options.open,
2128
- interactive: options.interactive,
2129
2132
  openConsentUrl: options.openApprovalUrl,
2130
2133
  wait: options.calendarPollWait,
2131
2134
  pollTimeoutMs: options.calendarPollTimeoutMs,
@@ -3019,7 +3022,6 @@ async function smoke(options) {
3019
3022
  token: options.token,
3020
3023
  email: options.email,
3021
3024
  open: options.open,
3022
- interactive: options.interactive,
3023
3025
  openApprovalUrl: options.openApprovalUrl
3024
3026
  },
3025
3027
  doFetch,
@@ -3307,8 +3309,9 @@ Safety:
3307
3309
  Provision caches the approved developer token and service credentials under
3308
3310
  .odla/ with mode 0600, and init adds those paths to .gitignore. Secret push
3309
3311
  preflights Wrangler before any shown-once issuance or destructive rotation.
3310
- Provision opens the approval page automatically in interactive terminals;
3311
- use --open to force browser launch or --no-open to suppress it.
3312
+ Provision opens the approval page in your browser automatically whenever the
3313
+ machine can show one, including agent-driven runs; only CI, SSH, and
3314
+ display-less hosts skip it. Use --open to force or --no-open to suppress.
3312
3315
  A fresh device handshake requires --email <odla-account> or ODLA_USER_EMAIL.
3313
3316
  The email is a non-secret identity hint: never provide a password or session
3314
3317
  token. The matching account must already exist, be signed in, explicitly
@@ -4014,4 +4017,4 @@ export {
4014
4017
  smoke,
4015
4018
  runCli
4016
4019
  };
4017
- //# sourceMappingURL=chunk-KUQCJ6KA.js.map
4020
+ //# sourceMappingURL=chunk-DC4MIB4X.js.map