@fluid-app/fluid-cli 0.1.808 → 0.1.810

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { A as confirmMfa, B as validateToken, E as resolveCredentialSource, F as pollAgentAccess, I as redeemIdentityLink, L as sendMfa, M as fetchUserCompanies, N as getFluidApiBase, O as FLUID_API_ERROR, P as isInsecureRemoteBase, R as signup, T as readFdToken, _ as describeCredentialSource, b as getActiveProfile, c as inputsModeActive, et as filterCatalog, g as adoptIdentityProfile, it as walkCommands, j as fetchCompanyShops, l as registerInputsHook, nt as visibleOptions, rt as visibleSubcommands, s as exitOnInputsError, tt as rootCommand, u as createInputsReader, v as findIdentityFallbackCandidates, x as getAuthToken, y as findIdentityFallbackProfile, z as switchCompany } from "../hook-CeUgW5IS.mjs";
3
- import { A as createSwitchAdoptRequest, B as withConfigLock, C as primeClientProfile, D as isStalePendingAdopt, E as resolveIdentityUrl, F as readStoredConfig, G as isIdentityProfile, I as updateConfig, L as writeConfig, O as parseAdoptMarker, P as readConfig, R as isStrictConfig, V as getConfigDir, W as isClientProfile, a as describeIdentityError, d as revokeStoredAdoption, f as sessionFacts, g as ADOPT_CLEANUP_TIMEOUT_MS, h as KeyringRefusedError, i as deleteStoredAdoption, j as tradeLegacyToken, k as serializeAdoptMarker, l as primeIdentityProfile, m as signOutIdentity, n as adoptionStorageAvailable, o as identityToken, p as signInWithBrowser, r as createAdoptionSession, t as endUnusedSessions, u as profileAccessToken, y as clientAccessToken, z as configLockTimings } from "../profiles-BxQg0jB_.mjs";
2
+ import { B as switchCompany, E as resolveCredentialSource, F as isInsecureRemoteBase, I as pollAgentAccess, L as redeemIdentityLink, M as fetchCompanyShops, N as fetchUserCompanies, P as getFluidApiBase, R as sendMfa, T as readFdToken, V as validateToken, _ as describeCredentialSource, at as walkCommands, b as getActiveProfile, c as inputsModeActive, g as adoptIdentityProfile, it as visibleSubcommands, j as confirmMfa, k as FLUID_API_ERROR, l as registerInputsHook, nt as rootCommand, rt as visibleOptions, s as exitOnInputsError, tt as filterCatalog, u as createInputsReader, v as findIdentityFallbackCandidates, x as getAuthToken, y as findIdentityFallbackProfile, z as signup } from "../hook-C37dIffA.mjs";
3
+ import { B as updateConfig, C as ADOPT_CLEANUP_TIMEOUT_MS, F as SessionError, G as getConfigDir, H as isStrictConfig, J as isClientProfile, M as createCodeChallenge, N as createCodeVerifier, O as primeClientProfile, R as readConfig, S as KeyringRefusedError, U as configLockTimings, V as writeConfig, W as withConfigLock, Y as isIdentityProfile, _ as profileAccessToken, b as signInWithBrowser, c as deleteStoredAdoption, d as identityToken, f as isIdentitySessionEnded, g as primeIdentityProfile, i as endUnusedSessions, j as resolveIdentityUrl, l as describeIdentityError, m as markIdentityFailureReported, o as adoptionStorageAvailable, s as createAdoptionSession, v as revokeStoredAdoption, w as clientAccessToken, x as signOutIdentity, y as sessionFacts, z as readStoredConfig } from "../client-B1TfaVpZ.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -13,7 +13,7 @@ import { text } from "node:stream/consumers";
13
13
  import chalk from "chalk";
14
14
  import prompts from "prompts";
15
15
  import ora from "ora";
16
- //#region src/update/notifier.ts
16
+ // src/update/notifier.ts
17
17
  /**
18
18
  * Tell a person at a terminal, or a coding agent running the CLI for one,
19
19
  * that a newer fluid CLI, or a newer Sites plugin beside it, is on npm. npm
@@ -437,8 +437,7 @@ function startUpdateCheck(options) {
437
437
  ...cache?.sitesPluginLatest ? { sitesPluginLatest: cache.sitesPluginLatest } : {}
438
438
  })) (options.refresh ?? spawnRefresh)(options.entryPath);
439
439
  }
440
- //#endregion
441
- //#region src/plugins/discovery.ts
440
+ // src/plugins/discovery.ts
442
441
  /**
443
442
  * Auto-discover @fluid-app CLI plugins.
444
443
  *
@@ -478,7 +477,8 @@ function discoverFromNodeModules(basePath) {
478
477
  const name = `${PLUGIN_SCOPE}/${entry.name}`;
479
478
  const entryDir = join(scopeDir, entry.name);
480
479
  try {
481
- const distEntry = join(realpathSync(entryDir), "dist", "index.mjs");
480
+ const realDir = realpathSync(entryDir);
481
+ const distEntry = join(realDir, "dist", "index.mjs");
482
482
  if (existsSync(distEntry)) return {
483
483
  name,
484
484
  importSpecifier: pathToFileURL(distEntry).href
@@ -600,7 +600,8 @@ function discoverPlugins(basePath, searchFrom, options = {}) {
600
600
  });
601
601
  const validated = (plugin) => {
602
602
  try {
603
- const real = realpathSync(plugin.importSpecifier.startsWith("file:") ? fileURLToPath(plugin.importSpecifier) : fileURLToPath(resolveBare(plugin.name)));
603
+ const file = plugin.importSpecifier.startsWith("file:") ? fileURLToPath(plugin.importSpecifier) : fileURLToPath(resolveBare(plugin.name));
604
+ const real = realpathSync(file);
604
605
  return inside(real) ? {
605
606
  name: plugin.name,
606
607
  importSpecifier: pathToFileURL(real).href
@@ -639,8 +640,7 @@ async function importPlugin(specifier) {
639
640
  const mod = await import(specifier);
640
641
  return mod["default"] ?? mod;
641
642
  }
642
- //#endregion
643
- //#region src/plugins/prefer-installation.ts
643
+ // src/plugins/prefer-installation.ts
644
644
  /**
645
645
  * Whether a host that owns this CLI run, such as Mist, asked for the plugins
646
646
  * installed beside the CLI over a project's own (FLUID_CLI_PREFER_INSTALLATION_PLUGINS=1).
@@ -648,12 +648,11 @@ async function importPlugin(specifier) {
648
648
  function prefersInstallationPlugins(env = process.env) {
649
649
  return env["FLUID_CLI_PREFER_INSTALLATION_PLUGINS"] === "1";
650
650
  }
651
- //#endregion
652
- //#region src/plugins/missing-plugin.ts
651
+ // src/plugins/missing-plugin.ts
653
652
  /** How a Mist dev build builds the plugins its workspace CLI loads. */
654
653
  const MIST_RUNTIME_BUILD = "pnpm --filter mist-desktop build:runtime-deps, then restart Mist";
655
654
  /** The Sites plugin's top-level commands: core can't ask an unloaded plugin. */
656
- const SITES_COMMANDS = new Set([
655
+ const SITES_COMMANDS = /* @__PURE__ */ new Set([
657
656
  "sites",
658
657
  "deploy",
659
658
  "member-site",
@@ -689,8 +688,7 @@ function missingPluginHint(program, args, options = {}) {
689
688
  const step = pluginStep(options.entryPath ?? realpathSync(fileURLToPath(import.meta.url)), options.workspaceRoot === void 0 ? cliWorkspaceRoot() : options.workspaceRoot, options.preferInstallation ?? prefersInstallationPlugins());
690
689
  return `fluid ${name} comes from the Sites plugin, ${enabledPlugins !== null && !enabledPlugins.includes("@fluid-app/fluid-cli-member-site") ? `which enabledPlugins in your Fluid config leaves out. Add ${SITES_PLUGIN_NAME} to it, and if it still isn't loaded, ${step}` : `which is not loaded. To load it, ${step}`}.`;
691
690
  }
692
- //#endregion
693
- //#region src/commands/commands.ts
691
+ // src/commands/commands.ts
694
692
  /**
695
693
  * fluid commands — list every installed command, or print the catalog as
696
694
  * JSON for agents and documentation generators.
@@ -734,8 +732,7 @@ const commandsCommand = new Command("commands").description("List installed comm
734
732
  }
735
733
  process.stdout.write(formatCatalogText(entries) + "\n");
736
734
  });
737
- //#endregion
738
- //#region src/completion/complete.ts
735
+ // src/completion/complete.ts
739
736
  const SHELLS = [
740
737
  "bash",
741
738
  "zsh",
@@ -908,8 +905,7 @@ complete -c fluid -f -a '(__fluid_complete)'
908
905
  `;
909
906
  }
910
907
  }
911
- //#endregion
912
- //#region src/commands/completion.ts
908
+ // src/commands/completion.ts
913
909
  /**
914
910
  * fluid completion <shell> — print a shell completion script.
915
911
  * fluid __complete — the hidden command that script pipes the typed words
@@ -927,8 +923,282 @@ const completeCommand = new Command("__complete").description("Print completions
927
923
  const typed = parseCompletionInput(readFileSync(0, "utf8"));
928
924
  process.stdout.write(formatCandidates(completeWords(rootCommand(command), typed), opts.shell));
929
925
  });
930
- //#endregion
931
- //#region src/auth/identity/sign-in-path.ts
926
+ // ../../platform/auth/src/native/trade-legacy-token.ts
927
+ /**
928
+ * Trades a legacy Fluid token for a native identity session with no browser
929
+ * hop (RFC 004 S3.4g): Rails mints a PKCE-bound adopt code for the legacy
930
+ * bearer, and the session redeems it at the identity service's `/token`.
931
+ * The legacy token is never altered here; the caller removes it only after
932
+ * an `adopted` result.
933
+ */
934
+ const REQUEST_TIMEOUT_MS = 15e3;
935
+ function record(value) {
936
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
937
+ }
938
+ function idText(value) {
939
+ if (typeof value === "number" && Number.isFinite(value)) return String(value);
940
+ return typeof value === "string" && value.trim() ? value.trim() : null;
941
+ }
942
+ function meIdentityOf(raw) {
943
+ const outer = record(raw);
944
+ if (!outer) return null;
945
+ const root = record(outer["data"]) ?? outer;
946
+ const wrapped = record(root["me"]) ?? record(root["user"]);
947
+ const user = record(wrapped?.["user"]) ?? wrapped ?? root;
948
+ const company = record(wrapped?.["company"]) ?? record(root["company"]);
949
+ const userId = idText(user["legacy_id"] ?? user["id"]);
950
+ const companyId = company ? idText(company["legacy_id"] ?? company["id"]) : null;
951
+ return userId && companyId ? {
952
+ userId,
953
+ companyId
954
+ } : null;
955
+ }
956
+ async function readMe(doFetch, apiBase, token, timeoutMs) {
957
+ let response;
958
+ const abort = new AbortController();
959
+ const timer = setTimeout(() => abort.abort(), timeoutMs);
960
+ try {
961
+ response = await doFetch(`${apiBase}/api/v2026-10/me?include=company,legacy_ids`, {
962
+ headers: {
963
+ Authorization: `Bearer ${token}`,
964
+ Accept: "application/json"
965
+ },
966
+ signal: abort.signal
967
+ });
968
+ } catch {
969
+ clearTimeout(timer);
970
+ return { kind: "unavailable" };
971
+ }
972
+ if (response.status >= 500 || response.status === 429) {
973
+ clearTimeout(timer);
974
+ return { kind: "unavailable" };
975
+ }
976
+ if (!response.ok) {
977
+ clearTimeout(timer);
978
+ return { kind: "refused" };
979
+ }
980
+ try {
981
+ const me = meIdentityOf(await response.json());
982
+ return me ? {
983
+ kind: "ok",
984
+ me
985
+ } : { kind: "refused" };
986
+ } catch {
987
+ return abort.signal.aborted ? { kind: "unavailable" } : { kind: "refused" };
988
+ } finally {
989
+ clearTimeout(timer);
990
+ }
991
+ }
992
+ async function mintAdoptCode(doFetch, apiBase, legacyToken, challenge, timeoutMs) {
993
+ let response;
994
+ const abort = new AbortController();
995
+ const timer = setTimeout(() => abort.abort(), timeoutMs);
996
+ try {
997
+ response = await doFetch(`${apiBase}/api/identity/adopt_code`, {
998
+ method: "POST",
999
+ headers: {
1000
+ Authorization: `Bearer ${legacyToken}`,
1001
+ "Content-Type": "application/json",
1002
+ Accept: "application/json"
1003
+ },
1004
+ body: JSON.stringify({
1005
+ code_challenge: challenge,
1006
+ code_challenge_method: "S256"
1007
+ }),
1008
+ signal: abort.signal
1009
+ });
1010
+ } catch {
1011
+ clearTimeout(timer);
1012
+ return { kind: "unavailable" };
1013
+ }
1014
+ if (response.status === 404) {
1015
+ clearTimeout(timer);
1016
+ return { kind: "not_targeted" };
1017
+ }
1018
+ if (response.status >= 500 || response.status === 429) {
1019
+ clearTimeout(timer);
1020
+ return { kind: "unavailable" };
1021
+ }
1022
+ if (!response.ok) {
1023
+ clearTimeout(timer);
1024
+ return { kind: "refused" };
1025
+ }
1026
+ try {
1027
+ const code = record(await response.json())?.["code"];
1028
+ return typeof code === "string" && code ? {
1029
+ kind: "ok",
1030
+ code
1031
+ } : { kind: "refused" };
1032
+ } catch {
1033
+ return abort.signal.aborted ? { kind: "unavailable" } : { kind: "refused" };
1034
+ } finally {
1035
+ clearTimeout(timer);
1036
+ }
1037
+ }
1038
+ /**
1039
+ * Trades `legacyToken` for an identity session held by `session`.
1040
+ *
1041
+ * Returns `adopted` once the session is stored and its user and company match
1042
+ * the legacy token's, as `/api/me` answers for each. A session that lands on
1043
+ * another user or company is signed out again and the trade is `refused`.
1044
+ * `not_targeted` means Rails does not offer adoption to this company;
1045
+ * `unavailable` means a network or server failure worth retrying later.
1046
+ */
1047
+ async function tradeLegacyToken(options) {
1048
+ const doFetch = options.fetch ?? ((...args) => fetch(...args));
1049
+ const finish = (result) => {
1050
+ options.log?.(result.outcome === "refused" ? `adopt outcome: refused (${result.reason})` : `adopt outcome: ${result.outcome}`);
1051
+ return result;
1052
+ };
1053
+ if (options.session.facts() !== null) return finish({ outcome: "unavailable" });
1054
+ const timeoutMs = options.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
1055
+ const epoch = options.session.epoch();
1056
+ const verifier = createCodeVerifier(options.crypto);
1057
+ const challenge = await createCodeChallenge(verifier, options.crypto);
1058
+ const minted = await mintAdoptCode(doFetch, options.apiBase, options.legacyToken, challenge, timeoutMs);
1059
+ if (minted.kind === "not_targeted") return finish({ outcome: "not_targeted" });
1060
+ if (minted.kind === "unavailable") return finish({ outcome: "unavailable" });
1061
+ if (minted.kind === "refused") return finish({
1062
+ outcome: "refused",
1063
+ reason: "mint_refused"
1064
+ });
1065
+ try {
1066
+ await options.beforeRedeem?.();
1067
+ } catch {
1068
+ return finish({ outcome: "unavailable" });
1069
+ }
1070
+ return landAdoptCode({
1071
+ session: options.session,
1072
+ doFetch,
1073
+ apiBase: options.apiBase,
1074
+ legacyToken: options.legacyToken,
1075
+ code: minted.code,
1076
+ verifier,
1077
+ epoch,
1078
+ timeoutMs,
1079
+ finish,
1080
+ expectedCompanyId: null,
1081
+ beforeDiscard: options.beforeDiscard
1082
+ });
1083
+ }
1084
+ async function landAdoptCode(options) {
1085
+ const { session, doFetch, apiBase, legacyToken, timeoutMs, finish } = options;
1086
+ let adoptedSession;
1087
+ try {
1088
+ adoptedSession = await session.redeemAdopt({
1089
+ adoptCode: options.code,
1090
+ codeVerifier: options.verifier,
1091
+ epoch: options.epoch
1092
+ });
1093
+ } catch (error) {
1094
+ if (error instanceof SessionError && error.code !== "temporarily_unavailable" && error.code !== "not_signed_in") return finish({
1095
+ outcome: "refused",
1096
+ reason: "grant_refused"
1097
+ });
1098
+ return finish({ outcome: "unavailable" });
1099
+ }
1100
+ const discard = async (result) => {
1101
+ try {
1102
+ options.beforeDiscard?.();
1103
+ } catch {}
1104
+ await adoptedSession.discard().catch(() => void 0);
1105
+ return finish(result);
1106
+ };
1107
+ const [legacy, adopted] = await Promise.all([readMe(doFetch, apiBase, legacyToken, timeoutMs), session.getAccessToken().then((token) => readMe(doFetch, apiBase, token, timeoutMs)).catch(() => ({ kind: "unavailable" }))]);
1108
+ if (!adoptedSession.isCurrent()) return finish({ outcome: "unavailable" });
1109
+ if (legacy.kind === "unavailable" || adopted.kind === "unavailable") return discard({ outcome: "unavailable" });
1110
+ if (legacy.kind !== "ok" || adopted.kind !== "ok") return discard({
1111
+ outcome: "refused",
1112
+ reason: "landing_unverifiable"
1113
+ });
1114
+ const wantedCompany = options.expectedCompanyId ?? legacy.me.companyId;
1115
+ if (legacy.me.userId !== adopted.me.userId || wantedCompany !== adopted.me.companyId) return discard({
1116
+ outcome: "refused",
1117
+ reason: "landing_mismatch"
1118
+ });
1119
+ return finish({
1120
+ outcome: "adopted",
1121
+ facts: adoptedSession.facts,
1122
+ isCurrent: () => adoptedSession.isCurrent(),
1123
+ discard: () => adoptedSession.discard()
1124
+ });
1125
+ }
1126
+ /**
1127
+ * Prepares the PKCE challenge a company switch sends as `adopt`, and the
1128
+ * redeem that lands the answered code. `redeem` reports `adopted` only when
1129
+ * the session names the legacy bearer's user in the target company; any other
1130
+ * landing is signed out again and `refused`.
1131
+ */
1132
+ async function createSwitchAdoptRequest(session, crypto) {
1133
+ const epoch = session.epoch();
1134
+ const verifier = createCodeVerifier(crypto);
1135
+ return {
1136
+ codeChallenge: await createCodeChallenge(verifier, crypto),
1137
+ codeChallengeMethod: "S256",
1138
+ redeem: async (options) => {
1139
+ const finish = (result) => {
1140
+ options.log?.(result.outcome === "refused" ? `switch adopt outcome: refused (${result.reason})` : `switch adopt outcome: ${result.outcome}`);
1141
+ return result;
1142
+ };
1143
+ if (session.facts() !== null) return finish({ outcome: "unavailable" });
1144
+ return landAdoptCode({
1145
+ session,
1146
+ doFetch: options.fetch ?? ((...args) => fetch(...args)),
1147
+ apiBase: options.apiBase,
1148
+ legacyToken: options.legacyToken,
1149
+ code: options.code,
1150
+ verifier,
1151
+ epoch,
1152
+ timeoutMs: options.requestTimeoutMs ?? REQUEST_TIMEOUT_MS,
1153
+ finish,
1154
+ expectedCompanyId: String(options.targetCompanyId)
1155
+ });
1156
+ }
1157
+ };
1158
+ }
1159
+ // ../../platform/auth/src/native/adopt-marker.ts
1160
+ /**
1161
+ * A pending-adopt marker: written once a legacy trade has minted an adopt
1162
+ * code and before it is redeemed, so a crash after the redeem leaves a
1163
+ * record that something may need revoking. It names the credential slot,
1164
+ * never a token.
1165
+ */
1166
+ const ADOPT_MARKER_GRACE_MS = 3e4;
1167
+ /** The marker as the text a file holds. */
1168
+ function serializeAdoptMarker(marker) {
1169
+ return JSON.stringify({
1170
+ storageKey: marker.storageKey,
1171
+ ...marker.identityUrl ? { identityUrl: marker.identityUrl } : {},
1172
+ startedAt: marker.startedAt,
1173
+ ...marker.attemptCount ? { attemptCount: marker.attemptCount } : {}
1174
+ });
1175
+ }
1176
+ /** The marker `text` holds, or null when it is not one. */
1177
+ function parseAdoptMarker(text) {
1178
+ try {
1179
+ const raw = JSON.parse(text);
1180
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
1181
+ const { storageKey, identityUrl, startedAt, attemptCount } = raw;
1182
+ if (typeof storageKey !== "string" || !storageKey) return null;
1183
+ if (typeof startedAt !== "number" || !Number.isFinite(startedAt)) return null;
1184
+ return {
1185
+ storageKey,
1186
+ startedAt,
1187
+ ...typeof attemptCount === "number" && attemptCount > 0 ? { attemptCount } : {},
1188
+ ...typeof identityUrl === "string" && identityUrl ? { identityUrl } : {}
1189
+ };
1190
+ } catch {
1191
+ return null;
1192
+ }
1193
+ }
1194
+ /**
1195
+ * Whether `marker` is old enough that no live attempt can still own it.
1196
+ * The grace must outlast the attempt's deadline plus its cleanup.
1197
+ */
1198
+ function isStalePendingAdopt(marker, now, graceMs = ADOPT_MARKER_GRACE_MS) {
1199
+ return now - marker.startedAt >= graceMs;
1200
+ }
1201
+ // src/auth/identity/sign-in-path.ts
932
1202
  /**
933
1203
  * The path a confirmed code puts the person on. A confirmation that kept any
934
1204
  * company's legacy token stays on the legacy path: those companies are not
@@ -937,8 +1207,7 @@ const completeCommand = new Command("__complete").description("Print completions
937
1207
  function signInPathFor(confirmation) {
938
1208
  return confirmation.signInPath === "identity" ? "identity" : "legacy";
939
1209
  }
940
- //#endregion
941
- //#region src/auth/pending-login.ts
1210
+ // src/auth/pending-login.ts
942
1211
  /**
943
1212
  * Email sign-ins started with `fluid login --send-code` and not finished yet.
944
1213
  *
@@ -951,7 +1220,7 @@ function signInPathFor(confirmation) {
951
1220
  * under the config dir (`~/.fluid/pending-logins/`), each named by a hash of
952
1221
  * the address so the file names do not list who is signing in.
953
1222
  */
954
- const STALE_AFTER_MS = 3600 * 1e3;
1223
+ const STALE_AFTER_MS = 36e5;
955
1224
  /** The server compares addresses trimmed and lowercased; so does the store. */
956
1225
  function normaliseEmail(email) {
957
1226
  return email.trim().toLowerCase();
@@ -1024,8 +1293,7 @@ function createPendingLoginStore(dir) {
1024
1293
  }
1025
1294
  };
1026
1295
  }
1027
- //#endregion
1028
- //#region src/auth/profiles.ts
1296
+ // src/auth/profiles.ts
1029
1297
  function createFluidProfile({ name, token, companyName, baseUrl, storedAt }) {
1030
1298
  return {
1031
1299
  name,
@@ -1048,8 +1316,7 @@ function createIdentityProfile({ name, companyName, baseUrl, auth, storedAt }) {
1048
1316
  auth
1049
1317
  };
1050
1318
  }
1051
- //#endregion
1052
- //#region src/utils/shell.ts
1319
+ // src/utils/shell.ts
1053
1320
  const SHELL_SAFE = /^[\w@+][\w.@+-]*$/;
1054
1321
  /**
1055
1322
  * The value for a printed command, or the placeholder when it holds
@@ -1058,8 +1325,7 @@ const SHELL_SAFE = /^[\w@+][\w.@+-]*$/;
1058
1325
  function shellSafe(value, placeholder) {
1059
1326
  return SHELL_SAFE.test(value) ? value : placeholder;
1060
1327
  }
1061
- //#endregion
1062
- //#region src/commands/login-identity.ts
1328
+ // src/commands/login-identity.ts
1063
1329
  /**
1064
1330
  * `fluid login` for a company on the identity sign-in path: the browser,
1065
1331
  * a loopback redirect, and a session in the operating system credential
@@ -1073,7 +1339,7 @@ function shellSafe(value, placeholder) {
1073
1339
  /** The query parameter Rails puts the sign-in link's token in. */
1074
1340
  const IDENTITY_LINK_PARAM = "identityLink";
1075
1341
  /** The roles the CLI's commands accept, as with a legacy `rep` session. */
1076
- const STAFF_ROLES = new Set([
1342
+ const STAFF_ROLES = /* @__PURE__ */ new Set([
1077
1343
  "admin",
1078
1344
  "rep",
1079
1345
  "root_admin"
@@ -1230,8 +1496,7 @@ async function loginWithIdentityLink(token, context) {
1230
1496
  ...pinnedIdentity(redemption.value.companyUuid)
1231
1497
  });
1232
1498
  }
1233
- //#endregion
1234
- //#region src/commands/login.ts
1499
+ // src/commands/login.ts
1235
1500
  /**
1236
1501
  * fluid login — authenticate via email MFA or API token
1237
1502
  *
@@ -1772,8 +2037,7 @@ function buildLoginCommand(run = (opts) => runLogin(opts)) {
1772
2037
  });
1773
2038
  }
1774
2039
  const loginCommand = buildLoginCommand();
1775
- //#endregion
1776
- //#region src/commands/signup.ts
2040
+ // src/commands/signup.ts
1777
2041
  /**
1778
2042
  * fluid signup — create a Fluid company with the public signup endpoint
1779
2043
  *
@@ -1786,7 +2050,7 @@ const AGENT_NAME_MAX = 100;
1786
2050
  const DEFAULT_AGENT_NAME = "Fluid CLI agent";
1787
2051
  const MIN_POLL_SECONDS = 5;
1788
2052
  const MAX_BACKOFF_SECONDS = 60;
1789
- const ISSUING_GRACE_MS = 1200 * 1e3;
2053
+ const ISSUING_GRACE_MS = 12e5;
1790
2054
  const defaultSignupDeps = {
1791
2055
  api: { signup },
1792
2056
  prompt: (question) => prompts(question),
@@ -1796,7 +2060,7 @@ const defaultSignupDeps = {
1796
2060
  isInteractive: () => Boolean(process.stdin.isTTY),
1797
2061
  agent: {
1798
2062
  poll: pollAgentAccess,
1799
- saveProfile: async (name, input, options) => (await import("../client-Bg2zc4QQ.mjs")).saveClientProfile(name, input, options),
2063
+ saveProfile: async (name, input, options) => (await import("../client-CqGzBXXg.mjs")).saveClientProfile(name, input, options),
1800
2064
  strictConfig: isStrictConfig,
1801
2065
  stashRecovery: writeRecoveryFile,
1802
2066
  stderrIsTty: () => Boolean(process.stderr.isTTY),
@@ -2155,8 +2419,7 @@ function buildSignupCommand(run = (opts) => runSignup(opts)) {
2155
2419
  });
2156
2420
  }
2157
2421
  const signupCommand = buildSignupCommand();
2158
- //#endregion
2159
- //#region src/commands/logout.ts
2422
+ // src/commands/logout.ts
2160
2423
  /**
2161
2424
  * fluid logout — remove stored auth profile(s)
2162
2425
  *
@@ -2200,8 +2463,7 @@ const logoutCommand = new Command("logout").description("Remove stored authentic
2200
2463
  console.log(chalk.green(`Logged out of profile ${chalk.bold(before.activeProfile)}.`));
2201
2464
  if (after.activeProfile) console.log(chalk.dim(`Switched to profile ${after.activeProfile}.`));
2202
2465
  });
2203
- //#endregion
2204
- //#region src/commands/profiles.ts
2466
+ // src/commands/profiles.ts
2205
2467
  /**
2206
2468
  * fluid profiles — list stored auth profiles. Never prints a secret: a
2207
2469
  * client profile shows its client id and company, and the secret stays in the
@@ -2228,8 +2490,7 @@ const profilesCommand = new Command("profiles").description("List stored profile
2228
2490
  }
2229
2491
  }
2230
2492
  });
2231
- //#endregion
2232
- //#region src/commands/whoami.ts
2493
+ // src/commands/whoami.ts
2233
2494
  /**
2234
2495
  * fluid whoami — show current auth profile and validate against API
2235
2496
  *
@@ -2354,8 +2615,7 @@ const whoamiCommand = new Command("whoami").description("Show the current authen
2354
2615
  console.log(` Company: ${chalk.bold(result.value.name)}`);
2355
2616
  console.log(` Stored: ${chalk.dim(profile.storedAt)}`);
2356
2617
  });
2357
- //#endregion
2358
- //#region src/auth/identity/adopt-pending.ts
2618
+ // src/auth/identity/adopt-pending.ts
2359
2619
  const ADOPT_DEADLINE_MS$1 = 15e3;
2360
2620
  const ADOPT_RECOVERY_TIMEOUT_MS = 4e3;
2361
2621
  const ADOPT_RECOVERY_MAX_ATTEMPTS = 5;
@@ -2447,17 +2707,18 @@ async function recoverPendingAdopts(options = {}) {
2447
2707
  continue;
2448
2708
  }
2449
2709
  const attempts = (marker.attemptCount ?? 0) + 1;
2450
- if (attempts >= ADOPT_RECOVERY_MAX_ATTEMPTS) if (await deleteStoredAdoption(auth, Math.max(budgetEndsAt - Date.now(), 500)).then(() => true, () => false)) {
2451
- remove(name);
2452
- log("adopt recovery: gave up; the stored credential was deleted");
2710
+ if (attempts >= ADOPT_RECOVERY_MAX_ATTEMPTS) {
2711
+ if (await deleteStoredAdoption(auth, Math.max(budgetEndsAt - Date.now(), 500)).then(() => true, () => false)) {
2712
+ remove(name);
2713
+ log("adopt recovery: gave up; the stored credential was deleted");
2714
+ } else {
2715
+ store(name, {
2716
+ ...marker,
2717
+ attemptCount: attempts
2718
+ });
2719
+ log("adopt recovery: could not delete the stored credential");
2720
+ }
2453
2721
  } else {
2454
- store(name, {
2455
- ...marker,
2456
- attemptCount: attempts
2457
- });
2458
- log("adopt recovery: could not delete the stored credential");
2459
- }
2460
- else {
2461
2722
  store(name, {
2462
2723
  ...marker,
2463
2724
  attemptCount: attempts
@@ -2469,8 +2730,7 @@ async function recoverPendingAdopts(options = {}) {
2469
2730
  log("adopt recovery: skipped");
2470
2731
  }
2471
2732
  }
2472
- //#endregion
2473
- //#region src/auth/identity/switch-adopt.ts
2733
+ // src/auth/identity/switch-adopt.ts
2474
2734
  function identityUrlFor(apiBase) {
2475
2735
  try {
2476
2736
  return resolveIdentityUrl(apiBase);
@@ -2524,7 +2784,7 @@ async function land(request, held, deadline, identityUrl, legacyToken, apiBase,
2524
2784
  })
2525
2785
  });
2526
2786
  if (result.outcome !== "adopted") {
2527
- clearPendingAdopt(storageKey);
2787
+ if (result.outcome !== "unavailable") clearPendingAdopt(storageKey);
2528
2788
  return null;
2529
2789
  }
2530
2790
  let persistAttempted = false;
@@ -2560,14 +2820,12 @@ async function land(request, held, deadline, identityUrl, legacyToken, apiBase,
2560
2820
  return null;
2561
2821
  }
2562
2822
  } catch {
2563
- if (deadline.signal.aborted) clearPendingAdopt(storageKey);
2564
2823
  return null;
2565
2824
  } finally {
2566
2825
  clearTimeout(timer);
2567
2826
  }
2568
2827
  }
2569
- //#endregion
2570
- //#region src/commands/switch.ts
2828
+ // src/commands/switch.ts
2571
2829
  /**
2572
2830
  * fluid switch — switch between companies (fetched from API, with local fallback)
2573
2831
  *
@@ -2575,7 +2833,124 @@ async function land(request, held, deadline, identityUrl, legacyToken, apiBase,
2575
2833
  * session it signed in with stays as it is, and the new company's profile
2576
2834
  * remembers the company to exchange into. Nothing secret is written.
2577
2835
  */
2578
- async function localSwitch(profileArg) {
2836
+ function signInCommand(profile) {
2837
+ const shop = profile.fluidShop?.toLowerCase().replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/\.fluid\.app$/, "");
2838
+ return shop ? `fluid login --shop ${shop}` : "fluid login";
2839
+ }
2840
+ function hasCustomBase(profile) {
2841
+ return Boolean(profile.baseUrl && profile.baseUrl !== "https://api.fluid.app");
2842
+ }
2843
+ function signInAgainHint(profile, platform = process.platform) {
2844
+ const login = signInCommand(profile);
2845
+ if (!hasCustomBase(profile)) return login;
2846
+ return platform === "win32" ? `$env:FLUID_API_BASE="${profile.baseUrl}"; ${login}` : `FLUID_API_BASE=${profile.baseUrl} ${login}`;
2847
+ }
2848
+ function signInAgainInstruction(profile, platform = process.platform) {
2849
+ const hint = signInAgainHint(profile, platform);
2850
+ if (platform !== "win32" || !hasCustomBase(profile)) return `run \`${hint}\``;
2851
+ return `run \`${hint}\` in PowerShell or \`${`set "FLUID_API_BASE=${profile.baseUrl}" && ${signInCommand(profile)}`}\` in cmd.exe`;
2852
+ }
2853
+ /**
2854
+ * The auth for a profile in `org`'s company on the live session `profile`
2855
+ * holds, after proving the session can reach it by exchange.
2856
+ */
2857
+ async function authForCompany(profile, org) {
2858
+ const target = org === (await sessionFacts(profile.auth)).companyId ? void 0 : org;
2859
+ await identityToken(profile.auth, target ?? null);
2860
+ const { org: _previous, ...session } = profile.auth;
2861
+ return target ? {
2862
+ ...session,
2863
+ org: target
2864
+ } : session;
2865
+ }
2866
+ /**
2867
+ * Makes `name` the active profile, writing `replacement` over it first when
2868
+ * given, only if the stored profile is still the one stamped `storedAt`.
2869
+ * The check runs inside the config lock, on the config as it is now, so a
2870
+ * profile another process removed or rewrote during the restore is never
2871
+ * activated.
2872
+ */
2873
+ function activateUnchanged(name, storedAt, replacement) {
2874
+ let outcome = { kind: "removed" };
2875
+ updateConfig((config) => {
2876
+ const current = config.profiles[name];
2877
+ if (!current) {
2878
+ outcome = { kind: "removed" };
2879
+ return config;
2880
+ }
2881
+ if (current.storedAt !== storedAt) {
2882
+ outcome = { kind: "replaced" };
2883
+ return config;
2884
+ }
2885
+ const after = {
2886
+ ...config,
2887
+ activeProfile: name,
2888
+ profiles: replacement ? {
2889
+ ...config.profiles,
2890
+ [name]: replacement
2891
+ } : config.profiles
2892
+ };
2893
+ outcome = {
2894
+ kind: "activated",
2895
+ before: config,
2896
+ after
2897
+ };
2898
+ return after;
2899
+ });
2900
+ return outcome;
2901
+ }
2902
+ function reportNotActivated(name, kind) {
2903
+ console.log(chalk.red(kind === "removed" ? `Profile ${name} was removed while switching.` : `Profile ${name} was changed while switching; run \`fluid switch ${name}\` again.`));
2904
+ process.exitCode = 1;
2905
+ }
2906
+ async function activateStoredProfile(name, active, baseUrl) {
2907
+ const target = readConfig().profiles[name];
2908
+ if (!target) {
2909
+ reportNotActivated(name, "removed");
2910
+ return;
2911
+ }
2912
+ let replacement;
2913
+ if (isIdentityProfile(target)) try {
2914
+ await identityToken(target.auth);
2915
+ } catch (error) {
2916
+ if (!isIdentitySessionEnded(error)) {
2917
+ console.log(chalk.red(describeIdentityError(error)));
2918
+ process.exitCode = 1;
2919
+ return;
2920
+ }
2921
+ const org = target.auth.org;
2922
+ const sameEnvironment = active !== null && target.auth.identityUrl === active.auth.identityUrl && (target.baseUrl ?? getFluidApiBase()) === baseUrl;
2923
+ if (!active || !org || !sameEnvironment) {
2924
+ console.log(chalk.red(`Your sign-in for ${name} has ended; ${signInAgainInstruction(target)}.`));
2925
+ process.exitCode = 1;
2926
+ return;
2927
+ }
2928
+ try {
2929
+ replacement = {
2930
+ ...createIdentityProfile({
2931
+ name,
2932
+ companyName: target.companyName,
2933
+ baseUrl: target.baseUrl ?? baseUrl,
2934
+ auth: await authForCompany(active, org)
2935
+ }),
2936
+ ...target.fluidShop ? { fluidShop: target.fluidShop } : {}
2937
+ };
2938
+ } catch (recoveryError) {
2939
+ const described = describeIdentityError(recoveryError);
2940
+ console.log(chalk.red(recoveryError instanceof SessionError && recoveryError.code === "access_denied" ? `${described} Sign in again: ${signInAgainInstruction(target)}.` : described));
2941
+ process.exitCode = 1;
2942
+ return;
2943
+ }
2944
+ }
2945
+ const result = activateUnchanged(name, target.storedAt, replacement);
2946
+ if (result.kind !== "activated") {
2947
+ reportNotActivated(name, result.kind);
2948
+ return;
2949
+ }
2950
+ console.log(chalk.green(`Switched to profile ${chalk.bold(name)}.`));
2951
+ if (replacement) for (const problem of await endUnusedSessions(result.before, result.after)) console.log(chalk.yellow(problem));
2952
+ }
2953
+ async function localSwitch(profileArg, active = null, baseUrl = getFluidApiBase()) {
2579
2954
  const config = readConfig();
2580
2955
  const profileNames = Object.keys(config.profiles);
2581
2956
  if (profileNames.length === 0) {
@@ -2585,14 +2960,15 @@ async function localSwitch(profileArg) {
2585
2960
  }
2586
2961
  let targetProfile = profileArg;
2587
2962
  if (!targetProfile) {
2963
+ const profileChoices = profileNames.map((name) => ({
2964
+ title: name === config.activeProfile ? `${name} (active)` : name,
2965
+ value: name
2966
+ }));
2588
2967
  targetProfile = (await prompts({
2589
2968
  type: "autocomplete",
2590
2969
  name: "profile",
2591
2970
  message: "Select a profile (type to search)",
2592
- choices: profileNames.map((name) => ({
2593
- title: name === config.activeProfile ? `${name} (active)` : name,
2594
- value: name
2595
- })),
2971
+ choices: profileChoices,
2596
2972
  suggest: (input, choices) => Promise.resolve(input ? choices.filter((c) => c.value.toLowerCase().includes(input.toLowerCase())) : choices)
2597
2973
  }))["profile"];
2598
2974
  if (!targetProfile) {
@@ -2606,21 +2982,18 @@ async function localSwitch(profileArg) {
2606
2982
  process.exitCode = 1;
2607
2983
  return;
2608
2984
  }
2609
- updateConfig((c) => ({
2610
- ...c,
2611
- activeProfile: targetProfile
2612
- }));
2613
- console.log(chalk.green(`Switched to profile ${chalk.bold(targetProfile)}.`));
2985
+ await activateStoredProfile(targetProfile, active, baseUrl);
2614
2986
  }
2615
2987
  async function selectCompany(companies, activeCompanyName) {
2988
+ const companyChoices = companies.map((c) => ({
2989
+ title: c.name === activeCompanyName ? `${c.name} ${chalk.dim("(active)")}` : c.name,
2990
+ value: c.id
2991
+ }));
2616
2992
  const companyId = (await prompts({
2617
2993
  type: "autocomplete",
2618
2994
  name: "companyId",
2619
2995
  message: "Select a company (type to search)",
2620
- choices: companies.map((c) => ({
2621
- title: c.name === activeCompanyName ? `${c.name} ${chalk.dim("(active)")}` : c.name,
2622
- value: c.id
2623
- })),
2996
+ choices: companyChoices,
2624
2997
  suggest: (input, choices) => Promise.resolve(input ? choices.filter((c) => c.title.toLowerCase().includes(input.toLowerCase())) : choices)
2625
2998
  }))["companyId"];
2626
2999
  if (companyId === void 0) return void 0;
@@ -2681,18 +3054,16 @@ async function performIdentitySwitch(profile, company, baseUrl) {
2681
3054
  process.exitCode = 1;
2682
3055
  return;
2683
3056
  }
2684
- let org;
3057
+ let auth;
2685
3058
  try {
2686
- const home = (await sessionFacts(profile.auth)).companyId;
2687
- org = company.uuidV7 === home ? void 0 : company.uuidV7;
2688
- await identityToken(profile.auth, org ?? null);
3059
+ auth = await authForCompany(profile, company.uuidV7);
2689
3060
  } catch (error) {
2690
3061
  spinner.fail(chalk.red(describeIdentityError(error)));
2691
3062
  process.exitCode = 1;
2692
3063
  return;
2693
3064
  }
2694
- const { org: _previous, ...session } = profile.auth;
2695
- const problems = await endUnusedSessions(readConfig(), updateConfig((config) => ({
3065
+ const before = readConfig();
3066
+ const after = updateConfig((config) => ({
2696
3067
  ...config,
2697
3068
  activeProfile: company.name,
2698
3069
  profiles: {
@@ -2701,13 +3072,11 @@ async function performIdentitySwitch(profile, company, baseUrl) {
2701
3072
  name: company.name,
2702
3073
  companyName: company.name,
2703
3074
  baseUrl,
2704
- auth: org ? {
2705
- ...session,
2706
- org
2707
- } : session
3075
+ auth
2708
3076
  })
2709
3077
  }
2710
- })));
3078
+ }));
3079
+ const problems = await endUnusedSessions(before, after);
2711
3080
  spinner.succeed(chalk.green(`Switched to ${chalk.bold(company.name)} (profile: ${chalk.bold(company.name)})`));
2712
3081
  for (const problem of problems) console.log(chalk.yellow(problem));
2713
3082
  }
@@ -2743,7 +3112,7 @@ const switchCommand = new Command("switch").description("Switch between companie
2743
3112
  }
2744
3113
  spinner.warn(chalk.yellow(`Could not fetch companies from API: ${result.error.message}`));
2745
3114
  console.log(chalk.dim("Falling back to locally stored profiles."));
2746
- await localSwitch(profileArg);
3115
+ await localSwitch(profileArg, identity, activeBaseUrl);
2747
3116
  return;
2748
3117
  }
2749
3118
  const companies = result.value;
@@ -2760,11 +3129,7 @@ const switchCommand = new Command("switch").description("Switch between companie
2760
3129
  return;
2761
3130
  }
2762
3131
  if (readConfig().profiles[profileArg]) {
2763
- updateConfig((c) => ({
2764
- ...c,
2765
- activeProfile: profileArg
2766
- }));
2767
- console.log(chalk.green(`Switched to profile ${chalk.bold(profileArg)}.`));
3132
+ await activateStoredProfile(profileArg, identity, activeBaseUrl);
2768
3133
  return;
2769
3134
  }
2770
3135
  console.log(chalk.red(`Company or profile "${profileArg}" not found.`));
@@ -2778,8 +3143,7 @@ const switchCommand = new Command("switch").description("Switch between companie
2778
3143
  }
2779
3144
  await (identity ? performIdentitySwitch(identity, selected, activeBaseUrl) : performSwitch(token, selected, activeBaseUrl));
2780
3145
  });
2781
- //#endregion
2782
- //#region src/plugins/format-load-line.ts
3146
+ // src/plugins/format-load-line.ts
2783
3147
  /**
2784
3148
  * Format one-line diagnostics naming a CLI plugin build and where it was
2785
3149
  * resolved from. The resolved path is the load-bearing detail: a workspace
@@ -2809,8 +3173,7 @@ function formatPluginLoadLine(info) {
2809
3173
  function formatPluginLoadFailure(info) {
2810
3174
  return `Failed to load plugin ${info.name} from ${displaySource(info.importSpecifier)} [${modeLabel(info.preferInstallation)}]: ${info.message}`;
2811
3175
  }
2812
- //#endregion
2813
- //#region src/plugins/resolve-load-path.ts
3176
+ // src/plugins/resolve-load-path.ts
2814
3177
  const defaultResolver = (specifier) => import.meta.resolve(specifier);
2815
3178
  /**
2816
3179
  * Return a `file://` URL for `importSpecifier`. `file://` specifiers (already
@@ -2826,8 +3189,7 @@ function resolveLoadPath(importSpecifier, resolve = defaultResolver) {
2826
3189
  return importSpecifier;
2827
3190
  }
2828
3191
  }
2829
- //#endregion
2830
- //#region src/plugins/should-log-plugin-loads.ts
3192
+ // src/plugins/should-log-plugin-loads.ts
2831
3193
  /**
2832
3194
  * Decide whether to print the per-plugin "Loaded plugin …" diagnostics.
2833
3195
  *
@@ -2844,8 +3206,7 @@ function shouldLogPluginLoads(argv = process.argv, env = process.env) {
2844
3206
  if (argv.includes("--verbose")) return true;
2845
3207
  return isTruthyFlag(env["FLUID_CLI_DEBUG"] ?? env["FLUID_CLI_VERBOSE"]);
2846
3208
  }
2847
- //#endregion
2848
- //#region src/plugins/loader.ts
3209
+ // src/plugins/loader.ts
2849
3210
  function isFluidPlugin(value) {
2850
3211
  if (typeof value !== "object" || value === null) return false;
2851
3212
  const obj = value;
@@ -2907,8 +3268,7 @@ async function loadPlugins(program, basePath) {
2907
3268
  }
2908
3269
  }
2909
3270
  }
2910
- //#endregion
2911
- //#region src/commands/version.ts
3271
+ // src/commands/version.ts
2912
3272
  /**
2913
3273
  * `fluid version`: the CLI's and each loaded plugin's version, npm's latest,
2914
3274
  * and the command that updates each. A person or a coding agent runs it to
@@ -2985,10 +3345,9 @@ const versionCommand = new Command("version").description("Show the CLI's and pl
2985
3345
  });
2986
3346
  process.stdout.write(opts.json ? JSON.stringify({ packages }, null, 2) + "\n" : formatVersionReport(packages) + "\n");
2987
3347
  });
2988
- //#endregion
2989
- //#region src/auth/identity/adopt-legacy.ts
2990
- const ADOPT_BACKOFF_MS = 1440 * 60 * 1e3;
2991
- const ADOPT_UNAVAILABLE_BACKOFF_MS = 900 * 1e3;
3348
+ // src/auth/identity/adopt-legacy.ts
3349
+ const ADOPT_BACKOFF_MS = 864e5;
3350
+ const ADOPT_UNAVAILABLE_BACKOFF_MS = 9e5;
2992
3351
  const ADOPT_TIMEOUT_MS = 5e3;
2993
3352
  const ADOPT_DEADLINE_MS = 6e3;
2994
3353
  const MIN_LOCK_WAIT_MS = 250;
@@ -3144,8 +3503,7 @@ async function trade(profile, signal, expired, remainingMs) {
3144
3503
  auth: held.auth
3145
3504
  };
3146
3505
  }
3147
- //#endregion
3148
- //#region src/auth/identity/prime.ts
3506
+ // src/auth/identity/prime.ts
3149
3507
  /**
3150
3508
  * Restores an identity-mode profile's session before a command runs, so the
3151
3509
  * synchronous `getAuthToken()` that plugins call finds a current access
@@ -3179,7 +3537,9 @@ async function primeCommandCredential(options) {
3179
3537
  if (isIdentityProfile(profile)) await primeIdentityProfile(profile);
3180
3538
  else if (isClientProfile(profile)) await primeClientProfile(profile);
3181
3539
  } catch (error) {
3182
- process.stderr.write(`${chalk.yellow(describeIdentityError(error))}\n`);
3540
+ const message = describeIdentityError(error);
3541
+ process.stderr.write(`${chalk.yellow(message)}\n`);
3542
+ markIdentityFailureReported(message);
3183
3543
  }
3184
3544
  }
3185
3545
  const normalizeShop = (shop) => shop.toLowerCase().replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/\.fluid\.app$/, "");
@@ -3213,8 +3573,7 @@ async function adoptFallbackForDeadToken(profile) {
3213
3573
  adoptIdentityProfile(identity, profile.name);
3214
3574
  process.stderr.write(`${chalk.yellow(`The token from profile "${profile.name}" was rejected (401); using identity profile "${identity.name}" instead.`)}\n`);
3215
3575
  }
3216
- //#endregion
3217
- //#region src/bin/fluid.ts
3576
+ // src/bin/fluid.ts
3218
3577
  const { version } = createRequire(import.meta.url)("../../package.json");
3219
3578
  if (process.argv[2] === "__refresh-update-check") {
3220
3579
  await refreshUpdateCache(getConfigDir());
@@ -3252,7 +3611,7 @@ const selfAuthenticating = new Set([
3252
3611
  completeCommand
3253
3612
  ].map((command) => command.name()));
3254
3613
  registerInputsHook(program);
3255
- const quietNoticeCommands = new Set([completeCommand, versionCommand]);
3614
+ const quietNoticeCommands = /* @__PURE__ */ new Set([completeCommand, versionCommand]);
3256
3615
  let quietFor = [];
3257
3616
  program.hook("preAction", async (_program, actionCommand) => {
3258
3617
  const opts = actionCommand.optsWithGlobals();
@@ -3285,7 +3644,6 @@ try {
3285
3644
  exitOnInputsError(error);
3286
3645
  throw error;
3287
3646
  }
3288
- //#endregion
3289
3647
  export {};
3290
3648
 
3291
3649
  //# sourceMappingURL=fluid.mjs.map