@arbidocs/cli 0.3.17 → 0.3.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.3.18
4
+
5
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.17...HEAD)
6
+
7
+ ### 🚀 Enhancements
8
+
9
+ - **sdk:** Add SSO device-flow login for CLI ([f6379f35](https://github.com/arbicity/ARBI-frontend/commit/f6379f35))
10
+
11
+ ### 🩹 Fixes
12
+
13
+ - **ci:** Fix sed pattern for backend frontend image bump ([8059cd94](https://github.com/arbicity/ARBI-frontend/commit/8059cd94))
14
+
3
15
  ## v0.3.17
4
16
 
5
17
  [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.16...HEAD)
package/dist/index.js CHANGED
@@ -3636,7 +3636,7 @@ function getLatestVersion(skipCache = false) {
3636
3636
  }
3637
3637
  }
3638
3638
  function getCurrentVersion() {
3639
- return "0.3.17";
3639
+ return "0.3.18";
3640
3640
  }
3641
3641
  function readChangelog(fromVersion, toVersion) {
3642
3642
  try {
@@ -3689,17 +3689,17 @@ function showChangelog(fromVersion, toVersion) {
3689
3689
  async function checkForUpdates(autoUpdate) {
3690
3690
  try {
3691
3691
  const latest = getLatestVersion();
3692
- if (!latest || latest === "0.3.17") return;
3692
+ if (!latest || latest === "0.3.18") return;
3693
3693
  if (autoUpdate) {
3694
3694
  warn(`
3695
- Your arbi version is out of date (${"0.3.17"} \u2192 ${latest}). Updating...`);
3695
+ Your arbi version is out of date (${"0.3.18"} \u2192 ${latest}). Updating...`);
3696
3696
  child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
3697
- showChangelog("0.3.17", latest);
3697
+ showChangelog("0.3.18", latest);
3698
3698
  console.log(`Updated to ${latest}.`);
3699
3699
  } else {
3700
3700
  warn(
3701
3701
  `
3702
- Your arbi version is out of date (${"0.3.17"} \u2192 ${latest}).
3702
+ Your arbi version is out of date (${"0.3.18"} \u2192 ${latest}).
3703
3703
  Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3704
3704
  );
3705
3705
  }
@@ -3709,9 +3709,9 @@ Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3709
3709
  function hintUpdateOnError() {
3710
3710
  try {
3711
3711
  const cached = readCache();
3712
- if (cached && cached.latest !== "0.3.17") {
3712
+ if (cached && cached.latest !== "0.3.18") {
3713
3713
  warn(
3714
- `Your arbi version is out of date (${"0.3.17"} \u2192 ${cached.latest}). Run "arbi update".`
3714
+ `Your arbi version is out of date (${"0.3.18"} \u2192 ${cached.latest}). Run "arbi update".`
3715
3715
  );
3716
3716
  }
3717
3717
  } catch {
@@ -3924,18 +3924,39 @@ function parseJsonArg(input2, example) {
3924
3924
 
3925
3925
  // src/commands/login.ts
3926
3926
  function registerLoginCommand(program2) {
3927
- program2.command("login").description("Log in to ARBI").option("-e, --email <email>", "Email address (or ARBI_EMAIL env var)").option("-p, --password <password>", "Password (or ARBI_PASSWORD env var)").option("-w, --workspace <id>", "Workspace ID to select after login").action(
3927
+ program2.command("login").description("Log in to ARBI").option("-e, --email <email>", "Email address (or ARBI_EMAIL env var)").option("-p, --password <password>", "Password (or ARBI_PASSWORD env var)").option("-w, --workspace <id>", "Workspace ID to select after login").option("--sso", "Log in with Auth0 SSO (device flow)").action(
3928
3928
  (opts) => runAction(async () => {
3929
3929
  const config = store.requireConfig();
3930
3930
  const email = opts.email || process.env.ARBI_EMAIL || await promptInput("Email");
3931
3931
  const pw = opts.password || process.env.ARBI_PASSWORD || await promptPassword("Password");
3932
3932
  try {
3933
- const { arbi } = await sdk.performPasswordLogin(config, email, pw, store);
3933
+ let ssoPolling = false;
3934
+ const { arbi } = opts.sso ? await (async () => {
3935
+ const result = await sdk.performSsoDeviceFlowLogin(config, email, pw, store, {
3936
+ onUserCode: (userCode, verificationUri) => {
3937
+ console.log(`
3938
+ Open this URL in your browser:
3939
+ ${verificationUri}
3940
+ `);
3941
+ console.log(`And enter code: ${userCode}
3942
+ `);
3943
+ console.log("Waiting for authorization...");
3944
+ ssoPolling = true;
3945
+ },
3946
+ onPoll: () => {
3947
+ process.stdout.write(".");
3948
+ }
3949
+ });
3950
+ if (ssoPolling) console.log("\n");
3951
+ return result;
3952
+ })() : await sdk.performPasswordLogin(config, email, pw, store);
3934
3953
  clearChatSession();
3935
3954
  const { data: workspaces3 } = await arbi.fetch.GET("/v1/user/workspaces");
3936
3955
  const wsList = workspaces3 || [];
3937
3956
  updateCompletionCache(wsList);
3938
- const memberWorkspaces = wsList.filter((ws2) => ws2.users?.some((u) => u.email === email));
3957
+ const memberWorkspaces = wsList.filter(
3958
+ (ws2) => ws2.users?.some((u) => u.user.email === email)
3959
+ );
3939
3960
  if (memberWorkspaces.length === 0) {
3940
3961
  console.log("No workspaces found. Create one with: arbi workspace create <name>");
3941
3962
  return;
@@ -6331,7 +6352,7 @@ console.info = (...args) => {
6331
6352
  _origInfo(...args);
6332
6353
  };
6333
6354
  var program = new commander.Command();
6334
- program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.17");
6355
+ program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.18");
6335
6356
  registerConfigCommand(program);
6336
6357
  registerLoginCommand(program);
6337
6358
  registerRegisterCommand(program);