sequoia-cli 0.3.1 → 0.3.2
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 +52 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -100125,6 +100125,43 @@ async function saveState(configDir, state) {
|
|
|
100125
100125
|
await fs5.writeFile(statePath, JSON.stringify(state, null, 2));
|
|
100126
100126
|
}
|
|
100127
100127
|
|
|
100128
|
+
// src/lib/credential-select.ts
|
|
100129
|
+
async function selectCredential(allCredentials) {
|
|
100130
|
+
const options = await Promise.all(allCredentials.map(async ({ id, type }) => {
|
|
100131
|
+
let label = id;
|
|
100132
|
+
if (type === "oauth") {
|
|
100133
|
+
const handle = await getOAuthHandle(id);
|
|
100134
|
+
label = handle ? `${handle} (${id})` : id;
|
|
100135
|
+
}
|
|
100136
|
+
return {
|
|
100137
|
+
value: { id, type },
|
|
100138
|
+
label: `${label} [${type}]`
|
|
100139
|
+
};
|
|
100140
|
+
}));
|
|
100141
|
+
const selected = exitOnCancel(await qt({
|
|
100142
|
+
message: "Multiple identities found. Select one:",
|
|
100143
|
+
options
|
|
100144
|
+
}));
|
|
100145
|
+
if (selected.type === "oauth") {
|
|
100146
|
+
const session = await getOAuthSession(selected.id);
|
|
100147
|
+
if (session) {
|
|
100148
|
+
const handle = await getOAuthHandle(selected.id);
|
|
100149
|
+
return {
|
|
100150
|
+
type: "oauth",
|
|
100151
|
+
did: selected.id,
|
|
100152
|
+
handle: handle || selected.id,
|
|
100153
|
+
pdsUrl: "https://bsky.social"
|
|
100154
|
+
};
|
|
100155
|
+
}
|
|
100156
|
+
} else {
|
|
100157
|
+
const creds = await getCredentials(selected.id);
|
|
100158
|
+
if (creds) {
|
|
100159
|
+
return creds;
|
|
100160
|
+
}
|
|
100161
|
+
}
|
|
100162
|
+
return null;
|
|
100163
|
+
}
|
|
100164
|
+
|
|
100128
100165
|
// src/commands/init.ts
|
|
100129
100166
|
async function fileExists5(filePath) {
|
|
100130
100167
|
try {
|
|
@@ -100253,10 +100290,21 @@ var initCommand = import_cmd_ts2.command({
|
|
|
100253
100290
|
onCancel();
|
|
100254
100291
|
}
|
|
100255
100292
|
let publicationUri;
|
|
100256
|
-
|
|
100293
|
+
let credentials = await loadCredentials();
|
|
100257
100294
|
if (publicationChoice === "create") {
|
|
100258
100295
|
if (!credentials) {
|
|
100259
|
-
|
|
100296
|
+
const allCredentials = await listAllCredentials();
|
|
100297
|
+
if (allCredentials.length > 1) {
|
|
100298
|
+
credentials = await selectCredential(allCredentials);
|
|
100299
|
+
} else if (allCredentials.length === 1) {
|
|
100300
|
+
credentials = await selectCredential(allCredentials);
|
|
100301
|
+
} else {
|
|
100302
|
+
R2.error("You must authenticate first. Run 'sequoia login' (recommended) or 'sequoia auth' before creating a publication.");
|
|
100303
|
+
process.exit(1);
|
|
100304
|
+
}
|
|
100305
|
+
}
|
|
100306
|
+
if (!credentials) {
|
|
100307
|
+
R2.error("Could not load credentials. Try running 'sequoia login' again to re-authenticate.");
|
|
100260
100308
|
process.exit(1);
|
|
100261
100309
|
}
|
|
100262
100310
|
const s = Ie();
|
|
@@ -100267,7 +100315,7 @@ var initCommand = import_cmd_ts2.command({
|
|
|
100267
100315
|
s.stop("Connected!");
|
|
100268
100316
|
} catch (_error) {
|
|
100269
100317
|
s.stop("Failed to connect");
|
|
100270
|
-
R2.error("Failed to connect.
|
|
100318
|
+
R2.error("Failed to connect. Try re-authenticating with 'sequoia login' or 'sequoia auth'.");
|
|
100271
100319
|
process.exit(1);
|
|
100272
100320
|
}
|
|
100273
100321
|
const publicationConfig = await Rt({
|
|
@@ -101606,7 +101654,7 @@ Publish evergreen content to the ATmosphere
|
|
|
101606
101654
|
|
|
101607
101655
|
> https://tangled.org/stevedylan.dev/sequoia
|
|
101608
101656
|
`,
|
|
101609
|
-
version: "0.3.
|
|
101657
|
+
version: "0.3.2",
|
|
101610
101658
|
cmds: {
|
|
101611
101659
|
auth: authCommand,
|
|
101612
101660
|
init: initCommand,
|