@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/README.md CHANGED
@@ -110,10 +110,11 @@ shown-once credential.
110
110
  `--email <account>` or `ODLA_USER_EMAIL`; the matching existing account must
111
111
  sign in, review the exact code, and approve it. Opening the URL alone does
112
112
  not claim the request.
113
- In an interactive terminal it opens the approval page in your browser when
114
- the code is displayed. Pass `--open` to force browser launch from a
115
- non-interactive shell, or `--no-open` to suppress it. Browser launch is
116
- best-effort; the printed URL and code always remain the fallback.
113
+ When the code is displayed it opens the approval page in your browser
114
+ including from scripted and agent-driven shells; only CI, SSH sessions, and
115
+ display-less hosts skip the launch. Pass `--open` to force it anyway, or
116
+ `--no-open` to suppress it. Browser launch is best-effort; the printed URL
117
+ and code always remain the fallback.
117
118
  2. Creates the platform app if needed.
118
119
  3. Enables configured services in every configured environment. Calendar
119
120
  config is normalized per env and fixed to Google read-only access.
package/dist/bin.cjs CHANGED
@@ -237,12 +237,16 @@ function handshakeEmail(value, cached) {
237
237
  }
238
238
  return email;
239
239
  }
240
- function approvalBrowser(options) {
240
+ function approvalBrowser(options, host = {}) {
241
241
  if (options.open === true) return { open: true, mode: "forced" };
242
242
  if (options.open === false) return { open: false, reason: "disabled by --no-open" };
243
- if (import_node_process2.default.env.CI) return { open: false, reason: "CI environment" };
244
- const interactive = options.interactive ?? Boolean(import_node_process2.default.stdin.isTTY && import_node_process2.default.stdout.isTTY);
245
- if (!interactive) return { open: false, reason: "non-interactive shell; pass --open to force" };
243
+ const env = host.env ?? import_node_process2.default.env;
244
+ if (env.CI) return { open: false, reason: "CI environment" };
245
+ if (env.SSH_CONNECTION || env.SSH_TTY) return { open: false, reason: "SSH session; pass --open to force" };
246
+ const platform = host.platform ?? import_node_process2.default.platform;
247
+ if (platform !== "darwin" && platform !== "win32" && !env.DISPLAY && !env.WAYLAND_DISPLAY) {
248
+ return { open: false, reason: "no graphical display; pass --open to force" };
249
+ }
246
250
  return { open: true, mode: "auto" };
247
251
  }
248
252
  function handshakeUrl(platformUrl, userCode) {
@@ -339,8 +343,9 @@ async function scopedToken(platform, scope, options, doFetch, out) {
339
343
  onCode: async ({ userCode, expiresIn, verificationUriComplete }) => {
340
344
  const approvalUrl = verificationUriComplete ?? handshakeUrl(audience, userCode);
341
345
  out.log(`Review, then approve scoped request ${userCode} at ${approvalUrl} within ${Math.floor(expiresIn / 60)}m.`);
342
- const shouldOpen = options.open === true || options.open !== false && !import_node_process4.default.env.CI && Boolean(import_node_process4.default.stdin.isTTY && import_node_process4.default.stdout.isTTY);
343
- if (shouldOpen) await (options.openApprovalUrl ?? openUrl)(approvalUrl).catch(() => void 0);
346
+ if (approvalBrowser({ open: options.open }).open) {
347
+ await (options.openApprovalUrl ?? openUrl)(approvalUrl).catch(() => void 0);
348
+ }
344
349
  }
345
350
  });
346
351
  const tokens = cache?.platform === audience ? { ...cache.tokens ?? {} } : {};
@@ -1412,7 +1417,6 @@ async function lifecycleContext(options) {
1412
1417
  token: options.token,
1413
1418
  email: options.email,
1414
1419
  open: options.open,
1415
- interactive: options.interactive,
1416
1420
  openApprovalUrl: options.openConsentUrl
1417
1421
  },
1418
1422
  doFetch,
@@ -1421,7 +1425,7 @@ async function lifecycleContext(options) {
1421
1425
  return { cfg, ctx: { platform: cfg.platformUrl, appId: cfg.app.id, env, token, fetch: doFetch }, out };
1422
1426
  }
1423
1427
  function connectionOptions(options, out) {
1424
- const browser = approvalBrowser({ configPath: "odla.config.mjs", open: options.open, interactive: options.interactive });
1428
+ const browser = approvalBrowser({ open: options.open });
1425
1429
  return {
1426
1430
  out,
1427
1431
  open: browser.open,
@@ -1882,8 +1886,9 @@ Safety:
1882
1886
  Provision caches the approved developer token and service credentials under
1883
1887
  .odla/ with mode 0600, and init adds those paths to .gitignore. Secret push
1884
1888
  preflights Wrangler before any shown-once issuance or destructive rotation.
1885
- Provision opens the approval page automatically in interactive terminals;
1886
- use --open to force browser launch or --no-open to suppress it.
1889
+ Provision opens the approval page in your browser automatically whenever the
1890
+ machine can show one, including agent-driven runs; only CI, SSH, and
1891
+ display-less hosts skip it. Use --open to force or --no-open to suppress.
1887
1892
  A fresh device handshake requires --email <odla-account> or ODLA_USER_EMAIL.
1888
1893
  The email is a non-secret identity hint: never provide a password or session
1889
1894
  token. The matching account must already exist, be signed in, explicitly
@@ -2393,7 +2398,6 @@ ${env}: credentials are already saved; retry "odla-ai secrets push --env ${env}$
2393
2398
  { platform: cfg.platformUrl, appId: cfg.app.id, env, token, fetch: doFetch },
2394
2399
  {
2395
2400
  open: options.open,
2396
- interactive: options.interactive,
2397
2401
  openConsentUrl: options.openApprovalUrl,
2398
2402
  wait: options.calendarPollWait,
2399
2403
  pollTimeoutMs: options.calendarPollTimeoutMs,
@@ -3704,7 +3708,6 @@ async function smoke(options) {
3704
3708
  token: options.token,
3705
3709
  email: options.email,
3706
3710
  open: options.open,
3707
- interactive: options.interactive,
3708
3711
  openApprovalUrl: options.openApprovalUrl
3709
3712
  },
3710
3713
  doFetch,