@tabbio-technologies/cli 1.2.8 → 1.3.0

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.
@@ -744,7 +744,7 @@ function warn(message, hint) {
744
744
  // src/core/version.ts
745
745
  import { readFileSync as readFileSync2 } from "node:fs";
746
746
  import { join as join3 } from "node:path";
747
- var CLI_VERSION = true ? "1.2.8" : readPackageField("version") ?? "0.0.0-dev";
747
+ var CLI_VERSION = true ? "1.3.0" : readPackageField("version") ?? "0.0.0-dev";
748
748
  var CLI_PACKAGE_NAME = true ? "@tabbio-technologies/cli" : readPackageField("name") ?? "@tabbio-technologies/cli";
749
749
  function userAgent() {
750
750
  return `tabbio-cli/${CLI_VERSION} node/${process.versions.node} ${process.platform}-${process.arch}`;
@@ -1653,23 +1653,58 @@ function paletteCss() {
1653
1653
  function escapeHtml(value) {
1654
1654
  return value.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
1655
1655
  }
1656
+ var NEXT_STEPS = [
1657
+ ["tabbio", "home: chat, tools, approvals"],
1658
+ ["tabbio chat", "talk to Tabbio in the terminal"],
1659
+ ["/logout", "sign out again, from inside the app"]
1660
+ ];
1661
+ var RETRY_STEPS = [
1662
+ ["/login", "try again from the app (tabbio)"],
1663
+ ["tabbio login --email you@example.com", "sign in with a code instead"]
1664
+ ];
1656
1665
  function renderLoopbackPage(kind, message) {
1657
- const title = kind === "success" ? "Tabbio CLI connected" : "Tabbio CLI sign-in";
1658
- const heading2 = kind === "success" ? "You are signed in to the Tabbio CLI" : "Sign-in did not finish";
1659
- const mark = kind === "success" ? "&#10003;" : "!";
1666
+ const ok = kind === "success";
1667
+ const title = ok ? "Tabbio CLI connected" : "Tabbio CLI sign-in";
1668
+ const heading2 = ok ? "Connected." : "Not signed in.";
1669
+ const lead = ok ? "This computer is signed in to Tabbio." : "The terminal is still waiting, or the sign-in was stopped.";
1670
+ const list = ok ? NEXT_STEPS : RETRY_STEPS;
1671
+ const stacked = list.some(([command]) => command.length > 20);
1672
+ const steps = list.map(([command, what]) => `<dt><code>${escapeHtml(command)}</code></dt><dd>${escapeHtml(what)}</dd>`).join("");
1660
1673
  return `<!doctype html>
1661
1674
  <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
1662
- <meta name="referrer" content="no-referrer"><title>${title}</title>
1675
+ <meta name="referrer" content="no-referrer"><meta name="color-scheme" content="light dark"><title>${title}</title>
1663
1676
  <style>
1664
1677
  ${paletteCss()}
1665
- *{box-sizing:border-box}body{margin:0;min-height:100vh;display:grid;place-items:center;background:var(--bg);color:var(--fg);
1666
- font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;padding:24px}
1667
- main{max-width:420px;width:100%;background:var(--card);border:1px solid var(--line);border-radius:16px;padding:32px;text-align:start}
1668
- .mark{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:var(--accent);color:var(--on-accent);font-weight:700;margin-bottom:16px}
1669
- h1{font-size:20px;margin:0 0 8px}p{margin:0;color:var(--muted)}.brand{font-weight:600;color:var(--accent);margin-bottom:24px;font-size:14px}
1678
+ *{box-sizing:border-box}
1679
+ html{background:var(--bg)}
1680
+ body{margin:0;min-height:100vh;background:var(--bg);color:var(--fg);-webkit-font-smoothing:antialiased;
1681
+ font:16px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
1682
+ main{max-width:600px;padding-block:min(14vh,120px) 48px;padding-inline:clamp(20px,6vw,56px)}
1683
+ code,.tag{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}
1684
+ .tag{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted);letter-spacing:.02em}
1685
+ .dot{width:8px;height:8px;border-radius:50%;background:${ok ? "var(--accent)" : "transparent"};box-shadow:inset 0 0 0 1.5px ${ok ? "var(--accent)" : "var(--muted)"}}
1686
+ h1{font-size:clamp(34px,6vw,44px);line-height:1.1;letter-spacing:-.025em;font-weight:650;margin:40px 0 14px}
1687
+ .lead{font-size:18px;margin:0 0 6px}
1688
+ .note{color:var(--muted);margin:0}
1689
+ hr{border:0;border-top:1px solid var(--line);margin:36px 0 22px}
1690
+ h2{font:500 12px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin:0 0 14px}
1691
+ dl{display:grid;grid-template-columns:max-content 1fr;gap:10px 24px;margin:0}
1692
+ dt{margin:0}dd{margin:0;color:var(--muted)}
1693
+ dt code{font-size:14px;color:var(--fg)}
1694
+ footer{margin-top:44px;font-size:13px;color:var(--muted)}
1695
+ dl.stack{grid-template-columns:1fr;gap:2px}dl.stack dd{margin-bottom:14px}
1696
+ @media (max-width:480px){dl{grid-template-columns:1fr;gap:2px}dd{margin-bottom:12px}}
1670
1697
  </style></head>
1671
- <body><main><div class="brand">tabbio</div><div class="mark">${mark}</div><h1>${escapeHtml(heading2)}</h1>
1672
- <p dir="auto">${escapeHtml(message)}</p></main></body></html>`;
1698
+ <body><main>
1699
+ <div class="tag"><span class="dot" aria-hidden="true"></span>tabbio cli</div>
1700
+ <h1>${escapeHtml(heading2)}</h1>
1701
+ <p class="lead">${escapeHtml(lead)}</p>
1702
+ <p class="note" dir="auto">${escapeHtml(message)}</p>
1703
+ <hr>
1704
+ <h2>${ok ? "Next, in your terminal" : "In your terminal"}</h2>
1705
+ <dl${stacked ? ' class="stack"' : ""}>${steps}</dl>
1706
+ <footer>This page was served by the tabbio CLI on this computer (127.0.0.1).</footer>
1707
+ </main></body></html>`;
1673
1708
  }
1674
1709
  function send(res, status, html) {
1675
1710
  res.writeHead(status, {
@@ -1950,6 +1985,48 @@ async function logoutProfile(profile, creds, opts = {}) {
1950
1985
  return { warnings, revokedSession };
1951
1986
  }
1952
1987
 
1988
+ // src/core/context.ts
1989
+ function readGlobalOptions(cmd) {
1990
+ const raw = cmd ? cmd.optsWithGlobals() : {};
1991
+ const current = getGlobalOptions();
1992
+ return setGlobalOptions({
1993
+ profile: raw.profile ?? current.profile,
1994
+ apiUrl: raw.apiUrl ?? current.apiUrl,
1995
+ appUrl: raw.appUrl ?? current.appUrl,
1996
+ json: Boolean(raw.json ?? current.json),
1997
+ color: raw.color ?? current.color,
1998
+ debug: Boolean(raw.debug ?? current.debug),
1999
+ yes: Boolean(raw.yes ?? current.yes),
2000
+ quiet: Boolean(raw.quiet ?? current.quiet)
2001
+ });
2002
+ }
2003
+ function createCommandContext(cmd) {
2004
+ const globals2 = readGlobalOptions(cmd);
2005
+ const { profile, sources } = resolveProfileWithSources({
2006
+ profile: globals2.profile,
2007
+ apiUrl: globals2.apiUrl,
2008
+ appUrl: globals2.appUrl
2009
+ });
2010
+ const credentials = loadCredentials(profile.name);
2011
+ const api = new ApiClient(profile, credentials);
2012
+ let session = null;
2013
+ return {
2014
+ globals: globals2,
2015
+ profile,
2016
+ sources,
2017
+ credentials,
2018
+ api,
2019
+ interactive: isInteractive() && !globals2.json,
2020
+ mcp() {
2021
+ session ??= McpSession.connect(profile, api.credentials ?? credentials, { api });
2022
+ return session;
2023
+ },
2024
+ async close() {
2025
+ if (session) await (await session.catch(() => null))?.close();
2026
+ }
2027
+ };
2028
+ }
2029
+
1953
2030
  export {
1954
2031
  ExitCode,
1955
2032
  EXIT_CODE_DOCS,
@@ -1967,6 +2044,7 @@ export {
1967
2044
  heading,
1968
2045
  relativeTime,
1969
2046
  DEFAULT_PROFILE,
2047
+ PRODUCTION_APP_URL,
1970
2048
  PROFILE_PRESETS,
1971
2049
  configPaths,
1972
2050
  loadConfig,
@@ -1994,6 +2072,7 @@ export {
1994
2072
  CLI_PACKAGE_NAME,
1995
2073
  checkForUpdate,
1996
2074
  readRequestId,
2075
+ combineSignals,
1997
2076
  ApiClient,
1998
2077
  parseJsonResponse,
1999
2078
  PRIMARY_AGENT_KEY,
@@ -2014,6 +2093,8 @@ export {
2014
2093
  getMcpAccessState,
2015
2094
  revokeSession,
2016
2095
  credentialsFromLogin,
2017
- logoutProfile
2096
+ logoutProfile,
2097
+ readGlobalOptions,
2098
+ createCommandContext
2018
2099
  };
2019
- //# sourceMappingURL=chunk-7LNC3FIV.js.map
2100
+ //# sourceMappingURL=chunk-XR6APSWD.js.map