@mp-lb/forum-cli 0.1.2 → 0.1.5

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/index.js CHANGED
@@ -1764,7 +1764,7 @@ import {
1764
1764
  rm as rm4,
1765
1765
  writeFile as writeFile6
1766
1766
  } from "fs/promises";
1767
- import { createInterface } from "readline/promises";
1767
+ import { createInterface as createInterface2 } from "readline/promises";
1768
1768
  import { pathToFileURL } from "url";
1769
1769
  import { parse as parseYaml } from "yaml";
1770
1770
 
@@ -18345,7 +18345,9 @@ var listSearchReconciliationStoresInputSchema = external_exports.object({
18345
18345
  limit: external_exports.number().int().min(1).max(500).default(100),
18346
18346
  touchedAfter: external_exports.string().datetime()
18347
18347
  });
18348
- var listOwnStoresInputSchema = external_exports.object({});
18348
+ var listOwnStoresInputSchema = external_exports.object({
18349
+ workspaceId: external_exports.string().trim().min(1).optional()
18350
+ });
18349
18351
  var readStoreMetadataInputSchema = external_exports.object({
18350
18352
  workspaceId: storeWorkspaceIdSchema,
18351
18353
  storeId: storeIdSchema
@@ -23449,9 +23451,21 @@ var storeRootPathFromId2 = (storeId) => {
23449
23451
  return `/${normalizeStoreId2(storeId)}`;
23450
23452
  };
23451
23453
 
23452
- // src/auth.ts
23454
+ // src/openInBrowser.ts
23453
23455
  import { execFile } from "child_process";
23454
23456
  import { promisify } from "util";
23457
+ var execFileAsync = promisify(execFile);
23458
+ var openInBrowser = async (url2) => {
23459
+ if (process.platform === "darwin") {
23460
+ await execFileAsync("open", [url2]);
23461
+ return;
23462
+ }
23463
+ if (process.platform === "win32") {
23464
+ await execFileAsync("cmd", ["/c", "start", "", url2]);
23465
+ return;
23466
+ }
23467
+ await execFileAsync("xdg-open", [url2]);
23468
+ };
23455
23469
 
23456
23470
  // src/render.ts
23457
23471
  var options = {
@@ -23775,19 +23789,28 @@ var withActivity = async (label, run) => {
23775
23789
  }
23776
23790
  };
23777
23791
 
23792
+ // src/waitForLoginBrowser.ts
23793
+ import { createInterface } from "readline";
23794
+ var waitForLoginBrowser = () => new Promise((resolve, reject) => {
23795
+ const prompt = createInterface({
23796
+ input: process.stdin,
23797
+ output: process.stderr
23798
+ });
23799
+ const cancel = () => {
23800
+ reject(new Error("Login cancelled. Run `fm auth login` again."));
23801
+ prompt.close();
23802
+ };
23803
+ prompt.once("SIGINT", cancel);
23804
+ prompt.once("close", cancel);
23805
+ prompt.question("Press Enter to open the browser... ", () => {
23806
+ prompt.removeListener("close", cancel);
23807
+ prompt.removeListener("SIGINT", cancel);
23808
+ prompt.close();
23809
+ resolve();
23810
+ });
23811
+ });
23812
+
23778
23813
  // src/auth.ts
23779
- var execFileAsync = promisify(execFile);
23780
- var openInBrowser = async (url2) => {
23781
- if (process.platform === "darwin") {
23782
- await execFileAsync("open", [url2]);
23783
- return;
23784
- }
23785
- if (process.platform === "win32") {
23786
- await execFileAsync("cmd", ["/c", "start", "", url2]);
23787
- return;
23788
- }
23789
- await execFileAsync("xdg-open", [url2]);
23790
- };
23791
23814
  var interactiveLogin = async ({
23792
23815
  apiBaseUrl,
23793
23816
  timeoutMs = 2 * 60 * 1e3,
@@ -23806,10 +23829,11 @@ var interactiveLogin = async ({
23806
23829
  throw new Error(`Failed to start auth flow: ${message}`);
23807
23830
  }
23808
23831
  const session = await startResponse.json();
23809
- renderOutput(`Open this URL: ${session.verificationUrl}`);
23810
- renderOutput(`Enter this code: ${session.userCode}`);
23832
+ renderOutput(`First, copy this code: ${session.userCode}`);
23833
+ renderOutput(`Open this URL and enter the code: ${session.verificationUrl}`);
23811
23834
  renderOutput(`This code expires at: ${session.expiresAt}`);
23812
- if (openBrowser) {
23835
+ if (openBrowser && process.stdin.isTTY && process.stderr.isTTY) {
23836
+ await waitForLoginBrowser();
23813
23837
  void openInBrowser(session.verificationUrl).catch(() => {
23814
23838
  renderOutput(
23815
23839
  "Could not open browser automatically. Open the URL manually."
@@ -25404,6 +25428,77 @@ var atomicWriteTextFile = async (filePath, text, isExecutable = false) => {
25404
25428
  }
25405
25429
  };
25406
25430
 
25431
+ // src/markdownStoreLinks.ts
25432
+ var markdownExtensions = /* @__PURE__ */ new Set([".md", ".markdown", ".mdx"]);
25433
+ var inlineLinkDestinationPattern = /(\]\()([^)\s]+)(\))/g;
25434
+ var normalizeStorePath2 = (value) => {
25435
+ const withoutFragment = value.split("#", 1)[0] ?? value;
25436
+ const withoutQuery = withoutFragment.split("?", 1)[0] ?? withoutFragment;
25437
+ return withoutQuery.startsWith("/") ? withoutQuery : `/${withoutQuery}`;
25438
+ };
25439
+ var normalizeFileExtension = (pathValue) => {
25440
+ const basename3 = pathValue.split("/").at(-1) ?? pathValue;
25441
+ const dotIndex = basename3.lastIndexOf(".");
25442
+ return dotIndex >= 0 ? basename3.slice(dotIndex).toLowerCase() : "";
25443
+ };
25444
+ var isMarkdownStorePath = (pathValue) => markdownExtensions.has(normalizeFileExtension(pathValue));
25445
+ var encodeRawFileUrl = (baseUrl, fileId) => `${baseUrl.replace(/\/+$/, "")}/raw-file/${encodeURIComponent(fileId)}`;
25446
+ var decodeRawFileId = (href) => {
25447
+ let url2;
25448
+ try {
25449
+ url2 = new URL(href);
25450
+ } catch {
25451
+ return null;
25452
+ }
25453
+ const segments2 = url2.pathname.split("/").filter(Boolean);
25454
+ if (segments2.length !== 2 || segments2[0] !== "raw-file") {
25455
+ return null;
25456
+ }
25457
+ try {
25458
+ return decodeURIComponent(segments2[1] ?? "");
25459
+ } catch {
25460
+ return null;
25461
+ }
25462
+ };
25463
+ var rewriteMarkdownLinkDestinations = (markdown, rewriteDestination) => markdown.replace(
25464
+ inlineLinkDestinationPattern,
25465
+ (_match, prefix, destination, suffix) => `${prefix}${rewriteDestination(destination)}${suffix}`
25466
+ );
25467
+ var rewriteStorePathLinksToRawUrls = ({
25468
+ rawFileBaseUrl: rawFileBaseUrl2,
25469
+ targets,
25470
+ text
25471
+ }) => {
25472
+ const targetByStorePath = new Map(
25473
+ targets.map((target) => [normalizeStorePath2(target.storePath), target])
25474
+ );
25475
+ return rewriteMarkdownLinkDestinations(text, (destination) => {
25476
+ if (!destination.startsWith("/") || destination.startsWith("//")) {
25477
+ return destination;
25478
+ }
25479
+ const target = targetByStorePath.get(normalizeStorePath2(destination));
25480
+ return target ? encodeRawFileUrl(rawFileBaseUrl2, target.fileId) : destination;
25481
+ });
25482
+ };
25483
+ var rewriteRawUrlsToStorePathLinks = ({
25484
+ targets,
25485
+ text
25486
+ }) => {
25487
+ const storePathByFileId = new Map(
25488
+ targets.map((target) => [
25489
+ target.fileId,
25490
+ normalizeStorePath2(target.storePath)
25491
+ ])
25492
+ );
25493
+ return rewriteMarkdownLinkDestinations(text, (destination) => {
25494
+ const fileId = decodeRawFileId(destination);
25495
+ if (!fileId) {
25496
+ return destination;
25497
+ }
25498
+ return storePathByFileId.get(fileId) ?? destination;
25499
+ });
25500
+ };
25501
+
25407
25502
  // src/checkout.ts
25408
25503
  var reservedRootFiles = new Set(projectConfigFilenames);
25409
25504
  var reservedRootFileNames = [...reservedRootFiles];
@@ -25542,6 +25637,41 @@ var checkoutEchoSuppressionPathsForWorkerValue = (value) => {
25542
25637
  };
25543
25638
  var compareRelativePath3 = (left, right) => left < right ? -1 : left > right ? 1 : 0;
25544
25639
  var remoteEntrySource = (entry) => entry.__forumSource;
25640
+ var remoteEntryStorePath = (entry) => entry.__forumStorePath ?? entry.path;
25641
+ var markdownLinkTargetsFromEntries = (entries) => entries.map(
25642
+ ({ entry }) => entry.id ? {
25643
+ fileId: entry.id,
25644
+ storePath: remoteEntryStorePath(entry)
25645
+ } : null
25646
+ ).filter((target) => Boolean(target));
25647
+ var markdownLinkTargetsFromManifest = (manifest) => Object.values(manifest.files).map(
25648
+ (entry) => entry.remoteFileId && entry.remotePath ? {
25649
+ fileId: entry.remoteFileId,
25650
+ storePath: entry.remotePath
25651
+ } : null
25652
+ ).filter((target) => Boolean(target));
25653
+ var rawFileBaseUrl = (client) => {
25654
+ const probeId = "__forum_probe__";
25655
+ return client.createRawFileUrl(probeId).replace(new RegExp(`/raw-file/${probeId}$`), "");
25656
+ };
25657
+ var rewriteMarkdownForLocalCheckout = ({
25658
+ client,
25659
+ relativePath,
25660
+ targets,
25661
+ text
25662
+ }) => isMarkdownStorePath(relativePath) && text.includes("](/") ? rewriteStorePathLinksToRawUrls({
25663
+ rawFileBaseUrl: rawFileBaseUrl(client),
25664
+ targets,
25665
+ text
25666
+ }) : text;
25667
+ var rewriteMarkdownForRemoteStore = ({
25668
+ manifest,
25669
+ relativePath,
25670
+ text
25671
+ }) => isMarkdownStorePath(relativePath) ? rewriteRawUrlsToStorePathLinks({
25672
+ targets: markdownLinkTargetsFromManifest(manifest),
25673
+ text
25674
+ }) : text;
25545
25675
  var isReservedCheckoutFile = (relativePath) => {
25546
25676
  const filename = relativePath.split("/").at(-1) ?? relativePath;
25547
25677
  return reservedRootFiles.has(filename);
@@ -25708,6 +25838,7 @@ var createSyncRuleClient = (client, rule) => {
25708
25838
  };
25709
25839
  const mapListingEntries = (entries, remoteRoot) => entries.map((entry) => ({
25710
25840
  ...entry,
25841
+ __forumStorePath: entry.path,
25711
25842
  ...remoteRoot.displayStore ? {
25712
25843
  __forumRemoteRef: {
25713
25844
  ...remoteRoot.displayStore,
@@ -25928,6 +26059,7 @@ var createSyncRuleFileClient = (client, rule) => {
25928
26059
  ...listing,
25929
26060
  entries: listing.entries.filter((entry) => entry.path === remotePath).map((entry) => ({
25930
26061
  ...entry,
26062
+ __forumStorePath: entry.path,
25931
26063
  path: localPathForEntry
25932
26064
  }))
25933
26065
  };
@@ -25945,6 +26077,7 @@ var createSyncRuleFileClient = (client, rule) => {
25945
26077
  ...listing,
25946
26078
  entries: listing.entries.filter((entry) => entry.path === remotePath).map((entry) => ({
25947
26079
  ...entry,
26080
+ __forumStorePath: entry.path,
25948
26081
  path: localPathForEntry
25949
26082
  }))
25950
26083
  };
@@ -27662,6 +27795,7 @@ var pullCheckout = async ({
27662
27795
  const files = remoteEntries.filter(
27663
27796
  (file2) => isCheckoutPathIncluded2(file2.relativePath, false, includePaths)
27664
27797
  );
27798
+ const markdownLinkTargets = markdownLinkTargetsFromEntries(files);
27665
27799
  const remotePaths = new Set(files.map((file2) => file2.relativePath));
27666
27800
  const remoteRenameConflictDetails = dryRun ? [] : await reconcileRemoteRenamesBeforePull({
27667
27801
  dryRun,
@@ -27827,14 +27961,20 @@ var pullCheckout = async ({
27827
27961
  if (!remoteFile?.content || !("text" in remoteFile.content)) {
27828
27962
  throw new Error("remote file did not include text content");
27829
27963
  }
27964
+ const localText = rewriteMarkdownForLocalCheckout({
27965
+ client,
27966
+ relativePath,
27967
+ targets: markdownLinkTargets,
27968
+ text: remoteFile.content.text
27969
+ });
27830
27970
  await atomicWriteTextFile(
27831
27971
  path7.join(localPath, relativePath),
27832
- remoteFile.content.text,
27972
+ localText,
27833
27973
  remoteFile.isExecutable === true
27834
27974
  );
27835
27975
  updateFileManifestEntry({
27836
27976
  storageClass: "text",
27837
- hash: hashText(remoteFile.content.text),
27977
+ hash: hashText(localText),
27838
27978
  manifest,
27839
27979
  path: relativePath,
27840
27980
  remoteFile,
@@ -27980,6 +28120,7 @@ var pullStoreFiles = async ({
27980
28120
  }
27981
28121
  const downloadProgress = withCheckoutProgressDirection(progress, "download");
27982
28122
  downloadProgress?.onTotal?.(files.length + missingRemoteDetails.length);
28123
+ const markdownLinkTargets = markdownLinkTargetsFromEntries(files);
27983
28124
  return runInParallel(
27984
28125
  files,
27985
28126
  (file2) => file2.relativePath,
@@ -28017,9 +28158,15 @@ var pullStoreFiles = async ({
28017
28158
  if (!remoteFile.content || !("text" in remoteFile.content)) {
28018
28159
  throw new Error("remote file did not include text content");
28019
28160
  }
28161
+ const localText = rewriteMarkdownForLocalCheckout({
28162
+ client,
28163
+ relativePath,
28164
+ targets: markdownLinkTargets,
28165
+ text: remoteFile.content.text
28166
+ });
28020
28167
  await atomicWriteTextFile(
28021
28168
  destinationPath,
28022
- remoteFile.content.text,
28169
+ localText,
28023
28170
  remoteFile.isExecutable === true
28024
28171
  );
28025
28172
  return { changeType, status: "succeeded" };
@@ -28273,7 +28420,11 @@ var pushCheckout = async ({
28273
28420
  relativePath: file2.relativePath,
28274
28421
  remoteRevisionNumber: manifestEntry?.remoteRevisionNumber,
28275
28422
  storeRef,
28276
- text: file2.text
28423
+ text: rewriteMarkdownForRemoteStore({
28424
+ manifest,
28425
+ relativePath: file2.relativePath,
28426
+ text: file2.text
28427
+ })
28277
28428
  });
28278
28429
  const pushed = await client.writeTextFileByRef(writeInput);
28279
28430
  updateFileManifestEntry({
@@ -28400,14 +28551,20 @@ var pullRemoteFileIntoCheckout = async ({
28400
28551
  if (!remoteFile.content || !("text" in remoteFile.content)) {
28401
28552
  throw new Error("remote file did not include text content");
28402
28553
  }
28554
+ const localText = rewriteMarkdownForLocalCheckout({
28555
+ client,
28556
+ relativePath,
28557
+ targets: markdownLinkTargetsFromManifest(manifest),
28558
+ text: remoteFile.content.text
28559
+ });
28403
28560
  await atomicWriteTextFile(
28404
28561
  path7.join(localPath, relativePath),
28405
- remoteFile.content.text,
28562
+ localText,
28406
28563
  remoteFile.isExecutable === true
28407
28564
  );
28408
28565
  updateFileManifestEntry({
28409
28566
  storageClass: "text",
28410
- hash: hashText(remoteFile.content.text),
28567
+ hash: hashText(localText),
28411
28568
  manifest,
28412
28569
  path: relativePath,
28413
28570
  remoteFile,
@@ -28448,7 +28605,11 @@ var pushLocalFileFromCheckout = async ({
28448
28605
  relativePath: file2.relativePath,
28449
28606
  remoteRevisionNumber: manifestEntry?.remoteRevisionNumber,
28450
28607
  storeRef,
28451
- text: file2.text
28608
+ text: rewriteMarkdownForRemoteStore({
28609
+ manifest,
28610
+ relativePath: file2.relativePath,
28611
+ text: file2.text
28612
+ })
28452
28613
  })
28453
28614
  );
28454
28615
  updateFileManifestEntry({
@@ -30936,6 +31097,7 @@ var createStoreClient = ({
30936
31097
  { retryDelayMs: transientRetryDelayMs }
30937
31098
  );
30938
31099
  return {
31100
+ createRawFileUrl: (fileId) => `${apiBaseUrl.replace(/\/+$/, "")}/raw-file/${encodeURIComponent(fileId)}`,
30939
31101
  listStores: () => call("stores.list", () => trpc.stores.list.query({})),
30940
31102
  createStore: (input) => call("stores.create", () => trpc.stores.create.mutate(input)),
30941
31103
  deleteStore: (input) => call("stores.delete", () => trpc.stores.delete.mutate(input)),
@@ -31708,12 +31870,13 @@ var openInEditor = async (currentText, { extension = "" } = {}) => {
31708
31870
  try {
31709
31871
  await writeFile5(tempPath, currentText, "utf8");
31710
31872
  const exitCode = await new Promise((resolve, reject) => {
31711
- const child = spawn(editor, [tempPath], {
31712
- stdio: "inherit",
31713
- shell: true
31714
- });
31873
+ const child = spawn(
31874
+ "/bin/sh",
31875
+ ["-c", `exec ${editor} "$1"`, "fm-editor", tempPath],
31876
+ { stdio: "inherit" }
31877
+ );
31715
31878
  child.on("error", reject);
31716
- child.on("exit", (code) => resolve(code ?? 0));
31879
+ child.on("exit", (code) => resolve(code ?? 1));
31717
31880
  });
31718
31881
  if (exitCode !== 0) {
31719
31882
  return null;
@@ -31725,6 +31888,56 @@ var openInEditor = async (currentText, { extension = "" } = {}) => {
31725
31888
  }
31726
31889
  };
31727
31890
 
31891
+ // src/readHiddenLine.ts
31892
+ var readHiddenLine = async (prompt) => {
31893
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
31894
+ throw new Error(
31895
+ "Missing encryption password. Provide --password or DOCTRINE_ENCRYPTION_PASSWORD."
31896
+ );
31897
+ }
31898
+ return new Promise((resolve, reject) => {
31899
+ const stdin = process.stdin;
31900
+ const stdout = process.stdout;
31901
+ const wasRaw = stdin.isRaw;
31902
+ let value = "";
31903
+ const cleanup = () => {
31904
+ stdin.off("data", readChunk);
31905
+ stdin.pause();
31906
+ stdin.setRawMode(wasRaw);
31907
+ stdout.write("\n");
31908
+ };
31909
+ const finish = () => {
31910
+ cleanup();
31911
+ resolve(value);
31912
+ };
31913
+ const cancel = () => {
31914
+ cleanup();
31915
+ reject(new Error("Encryption password prompt cancelled."));
31916
+ };
31917
+ const readChunk = (chunk) => {
31918
+ for (const byte of chunk) {
31919
+ if (byte === 3) {
31920
+ cancel();
31921
+ return;
31922
+ }
31923
+ if (byte === 13 || byte === 10) {
31924
+ finish();
31925
+ return;
31926
+ }
31927
+ if (byte === 127) {
31928
+ value = value.slice(0, -1);
31929
+ continue;
31930
+ }
31931
+ value += String.fromCharCode(byte);
31932
+ }
31933
+ };
31934
+ stdin.setRawMode(true);
31935
+ stdin.on("data", readChunk);
31936
+ stdin.resume();
31937
+ stdout.write(prompt);
31938
+ });
31939
+ };
31940
+
31728
31941
  // src/resolveDecryptAuthMode.ts
31729
31942
  var resolveDecryptAuthMode = ({
31730
31943
  encryptionPassword,
@@ -32730,7 +32943,7 @@ var confirmYesNo = async ({
32730
32943
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
32731
32944
  throw new Error(nonInteractiveMessage);
32732
32945
  }
32733
- const readline = createInterface({
32946
+ const readline = createInterface2({
32734
32947
  input: process.stdin,
32735
32948
  output: process.stdout
32736
32949
  });
@@ -33533,53 +33746,6 @@ var readCommandTextInput = async (inlineText, inputFilePath) => {
33533
33746
  }
33534
33747
  return null;
33535
33748
  };
33536
- var readHiddenLine = async (prompt) => {
33537
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
33538
- throw new Error(
33539
- "Missing encryption password. Provide --password or DOCTRINE_ENCRYPTION_PASSWORD."
33540
- );
33541
- }
33542
- return new Promise((resolve, reject) => {
33543
- const stdin = process.stdin;
33544
- const stdout = process.stdout;
33545
- const wasRaw = stdin.isRaw;
33546
- let value = "";
33547
- const cleanup = () => {
33548
- stdin.off("data", readChunk);
33549
- stdin.setRawMode(wasRaw);
33550
- stdout.write("\n");
33551
- };
33552
- const finish = () => {
33553
- cleanup();
33554
- resolve(value);
33555
- };
33556
- const cancel = () => {
33557
- cleanup();
33558
- reject(new Error("Encryption password prompt cancelled."));
33559
- };
33560
- const readChunk = (chunk) => {
33561
- for (const byte of chunk) {
33562
- if (byte === 3) {
33563
- cancel();
33564
- return;
33565
- }
33566
- if (byte === 13 || byte === 10) {
33567
- finish();
33568
- return;
33569
- }
33570
- if (byte === 127) {
33571
- value = value.slice(0, -1);
33572
- continue;
33573
- }
33574
- value += String.fromCharCode(byte);
33575
- }
33576
- };
33577
- stdout.write(prompt);
33578
- stdin.setRawMode(true);
33579
- stdin.resume();
33580
- stdin.on("data", readChunk);
33581
- });
33582
- };
33583
33749
  var readEncryptionPassword = async (parsed) => {
33584
33750
  const password = parsed.encryptionPassword ?? process.env.DOCTRINE_ENCRYPTION_PASSWORD;
33585
33751
  if (password) {
@@ -33753,7 +33919,7 @@ var confirmEncryptionMigration = async ({
33753
33919
  "Refusing to migrate encryption without interactive confirmation. Rerun with --yes to confirm in a non-interactive shell."
33754
33920
  );
33755
33921
  }
33756
- const readline = createInterface({
33922
+ const readline = createInterface2({
33757
33923
  input: process.stdin,
33758
33924
  output: process.stdout
33759
33925
  });
@@ -34680,12 +34846,6 @@ var unsetConfigValue = async (parsed, key) => {
34680
34846
  });
34681
34847
  renderOutput(`Reset poll-interval-ms to ${DEFAULT_POLL_INTERVAL_MS}`);
34682
34848
  };
34683
- var ensureToken = (token) => {
34684
- if (!token) {
34685
- throw new Error("Missing auth token. Provide --token or DOCTRINE_TOKEN.");
34686
- }
34687
- return token;
34688
- };
34689
34849
  var parseRootStorePath = (storePathInput) => {
34690
34850
  const storeId = normalizeStoreId2(storePathInput);
34691
34851
  return {
@@ -35777,7 +35937,7 @@ var analyzeLocalIgnore = async (checkout) => {
35777
35937
  });
35778
35938
  };
35779
35939
  var promptIgnoreAction = async () => {
35780
- const readline = createInterface({
35940
+ const readline = createInterface2({
35781
35941
  input: process.stdin,
35782
35942
  output: process.stdout
35783
35943
  });
@@ -36516,7 +36676,7 @@ var confirmGitMetadataDeletion = async (localPath, assumeYes) => {
36516
36676
  renderWarning(
36517
36677
  "Only continue if the repository history is backed up or you are certain you no longer need it here."
36518
36678
  );
36519
- const readline = createInterface({
36679
+ const readline = createInterface2({
36520
36680
  input: process.stdin,
36521
36681
  output: process.stdout
36522
36682
  });
@@ -36641,7 +36801,7 @@ var main = async (argv = process.argv.slice(2)) => {
36641
36801
  const config3 = await resolveConfig(parsed);
36642
36802
  if (subcommand === "login") {
36643
36803
  const apiBaseUrl2 = ensureApiBaseUrl(config3.apiBaseUrl);
36644
- const token2 = await withActivity(
36804
+ const token = await withActivity(
36645
36805
  "Starting login",
36646
36806
  () => interactiveLogin({
36647
36807
  apiBaseUrl: apiBaseUrl2,
@@ -36649,7 +36809,7 @@ var main = async (argv = process.argv.slice(2)) => {
36649
36809
  })
36650
36810
  );
36651
36811
  await writeConfig(parsed.stateDir, {
36652
- token: token2,
36812
+ token,
36653
36813
  pollIntervalMs: config3.pollIntervalMs,
36654
36814
  forceWrites: config3.forceWrites
36655
36815
  });
@@ -36746,8 +36906,7 @@ var main = async (argv = process.argv.slice(2)) => {
36746
36906
  }
36747
36907
  }
36748
36908
  const apiBaseUrl = ensureApiBaseUrl(config2.apiBaseUrl);
36749
- const token = ensureToken(config2.token);
36750
- const client = createClient({ ...config2, apiBaseUrl, token });
36909
+ const client = createClient({ ...config2, apiBaseUrl });
36751
36910
  if (command === "encrypt") {
36752
36911
  await runEncryptCommand(rest, parsed, client);
36753
36912
  return;