sequoia-cli 0.3.2 → 0.3.3

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.
Files changed (2) hide show
  1. package/dist/index.js +54 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -99758,8 +99758,7 @@ async function tryLoadOAuthCredentials(profile) {
99758
99758
  return {
99759
99759
  type: "oauth",
99760
99760
  did: profile,
99761
- handle: handle || profile,
99762
- pdsUrl: "https://bsky.social"
99761
+ handle: handle || profile
99763
99762
  };
99764
99763
  }
99765
99764
  }
@@ -99769,8 +99768,7 @@ async function tryLoadOAuthCredentials(profile) {
99769
99768
  return {
99770
99769
  type: "oauth",
99771
99770
  did: match2.did,
99772
- handle: match2.handle || match2.did,
99773
- pdsUrl: "https://bsky.social"
99771
+ handle: match2.handle || match2.did
99774
99772
  };
99775
99773
  }
99776
99774
  return null;
@@ -99821,8 +99819,7 @@ async function loadCredentials(projectIdentity) {
99821
99819
  return {
99822
99820
  type: "oauth",
99823
99821
  did: oauthDids[0],
99824
- handle: handle || oauthDids[0],
99825
- pdsUrl: "https://bsky.social"
99822
+ handle: handle || oauthDids[0]
99826
99823
  };
99827
99824
  }
99828
99825
  }
@@ -100149,8 +100146,7 @@ async function selectCredential(allCredentials) {
100149
100146
  return {
100150
100147
  type: "oauth",
100151
100148
  did: selected.id,
100152
- handle: handle || selected.id,
100153
- pdsUrl: "https://bsky.social"
100149
+ handle: handle || selected.id
100154
100150
  };
100155
100151
  }
100156
100152
  } else {
@@ -100401,7 +100397,7 @@ var initCommand = import_cmd_ts2.command({
100401
100397
  ...maxAgeDays !== 7 && { maxAgeDays }
100402
100398
  };
100403
100399
  }
100404
- const pdsUrl = credentials?.pdsUrl;
100400
+ const pdsUrl = credentials?.type === "app-password" ? credentials.pdsUrl : undefined;
100405
100401
  const configContent = generateConfigTemplate({
100406
100402
  siteUrl: siteConfig.siteUrl,
100407
100403
  contentDir: siteConfig.contentDir || "./content",
@@ -100857,8 +100853,7 @@ var publishCommand = import_cmd_ts5.command({
100857
100853
  credentials = {
100858
100854
  type: "oauth",
100859
100855
  did: selected,
100860
- handle: handle || selected,
100861
- pdsUrl: "https://bsky.social"
100856
+ handle: handle || selected
100862
100857
  };
100863
100858
  }
100864
100859
  } else {
@@ -100956,7 +100951,8 @@ Bluesky posting: enabled (max age: ${maxAgeDays} days)`);
100956
100951
  Dry run complete. No changes made.`);
100957
100952
  return;
100958
100953
  }
100959
- s.start(`Connecting to ${credentials.pdsUrl}...`);
100954
+ const connectingTo = credentials.type === "oauth" ? credentials.handle : credentials.pdsUrl;
100955
+ s.start(`Connecting as ${connectingTo}...`);
100960
100956
  let agent;
100961
100957
  try {
100962
100958
  agent = await createAgent(credentials);
@@ -101126,8 +101122,7 @@ var syncCommand = import_cmd_ts6.command({
101126
101122
  credentials = {
101127
101123
  type: "oauth",
101128
101124
  did: selected,
101129
- handle: handle || selected,
101130
- pdsUrl: "https://bsky.social"
101125
+ handle: handle || selected
101131
101126
  };
101132
101127
  }
101133
101128
  } else {
@@ -101139,7 +101134,8 @@ var syncCommand = import_cmd_ts6.command({
101139
101134
  }
101140
101135
  }
101141
101136
  const s = Ie();
101142
- s.start(`Connecting to ${credentials.pdsUrl}...`);
101137
+ const connectingTo = credentials.type === "oauth" ? credentials.handle : credentials.pdsUrl;
101138
+ s.start(`Connecting as ${connectingTo}...`);
101143
101139
  let agent;
101144
101140
  try {
101145
101141
  agent = await createAgent(credentials);
@@ -101534,10 +101530,49 @@ async function editBluesky(config) {
101534
101530
  };
101535
101531
  }
101536
101532
  async function updatePublicationFlow(config) {
101537
- const credentials = await loadCredentials(config.identity);
101533
+ let credentials = await loadCredentials(config.identity);
101538
101534
  if (!credentials) {
101539
- R2.error("No credentials found. Run 'sequoia auth' or 'sequoia login' first.");
101540
- process.exit(1);
101535
+ const identities = await listAllCredentials();
101536
+ if (identities.length === 0) {
101537
+ R2.error("No credentials found. Run 'sequoia login' or 'sequoia auth' first.");
101538
+ process.exit(1);
101539
+ }
101540
+ const options = await Promise.all(identities.map(async (cred) => {
101541
+ if (cred.type === "oauth") {
101542
+ const handle = await getOAuthHandle(cred.id);
101543
+ return {
101544
+ value: cred.id,
101545
+ label: `${handle || cred.id} (OAuth)`
101546
+ };
101547
+ }
101548
+ return {
101549
+ value: cred.id,
101550
+ label: `${cred.id} (App Password)`
101551
+ };
101552
+ }));
101553
+ R2.info("Multiple identities found. Select one to use:");
101554
+ const selected = exitOnCancel(await qt({
101555
+ message: "Identity:",
101556
+ options
101557
+ }));
101558
+ const selectedCred = identities.find((c) => c.id === selected);
101559
+ if (selectedCred?.type === "oauth") {
101560
+ const session = await getOAuthSession(selected);
101561
+ if (session) {
101562
+ const handle = await getOAuthHandle(selected);
101563
+ credentials = {
101564
+ type: "oauth",
101565
+ did: selected,
101566
+ handle: handle || selected
101567
+ };
101568
+ }
101569
+ } else {
101570
+ credentials = await getCredentials(selected);
101571
+ }
101572
+ if (!credentials) {
101573
+ R2.error("Failed to load selected credentials.");
101574
+ process.exit(1);
101575
+ }
101541
101576
  }
101542
101577
  const s = Ie();
101543
101578
  s.start("Connecting to ATProto...");
@@ -101654,7 +101689,7 @@ Publish evergreen content to the ATmosphere
101654
101689
 
101655
101690
  > https://tangled.org/stevedylan.dev/sequoia
101656
101691
  `,
101657
- version: "0.3.2",
101692
+ version: "0.3.3",
101658
101693
  cmds: {
101659
101694
  auth: authCommand,
101660
101695
  init: initCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sequoia-cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "sequoia": "dist/index.js"