@anaella/cli 0.5.2 → 0.6.0
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 +19 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { AnaellaClient } from "@anaella/client";
|
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
|
|
8
8
|
// package.json
|
|
9
|
-
var version = "0.
|
|
9
|
+
var version = "0.6.0";
|
|
10
10
|
|
|
11
11
|
// src/browser-login.ts
|
|
12
12
|
import { spawn } from "child_process";
|
|
@@ -114,6 +114,19 @@ var cmdConnect = (client, platform, o) => client.createConnectSession({
|
|
|
114
114
|
returnUrl: o.returnUrl,
|
|
115
115
|
...o.resource?.length ? { resources: o.resource } : {}
|
|
116
116
|
});
|
|
117
|
+
function cmdConnectAccount(client, platform, o) {
|
|
118
|
+
const credentials = {};
|
|
119
|
+
for (const pair of o.field) {
|
|
120
|
+
const i = pair.indexOf("=");
|
|
121
|
+
if (i < 1) throw new Error(`--field expects key=value, got "${pair}"`);
|
|
122
|
+
credentials[pair.slice(0, i)] = pair.slice(i + 1);
|
|
123
|
+
}
|
|
124
|
+
return client.connectWithCredentials({
|
|
125
|
+
platform,
|
|
126
|
+
credentials,
|
|
127
|
+
...o.externalUser ? { externalUserId: o.externalUser } : {}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
117
130
|
function cmdPost(client, o) {
|
|
118
131
|
return client.createPost({
|
|
119
132
|
channels: o.channel,
|
|
@@ -355,6 +368,11 @@ program.command("channels").description("List connected channels").option("--ext
|
|
|
355
368
|
program.command("connect <platform>").description("Create a connect link for an end user's account (e.g. google-search-console)").requiredOption("--external-user <id>", "your id for this person").requiredOption("--return-url <url>", "where to send them back (allowed origin)").option("--resource <id>", "connect this resource without the picker (repeatable)", collect, []).action(
|
|
356
369
|
(platform, opts, command) => withClient(command, (c) => cmdConnect(c, platform, opts))
|
|
357
370
|
);
|
|
371
|
+
program.command("connect-account <platform>").description(
|
|
372
|
+
"Connect an account that signs in with a form: imap (any mailbox), bluesky, telegram, inkwire. E.g. anaella connect-account imap -f email=me@co.com -f password=... -f imapHost=imap.co.com -f smtpHost=smtp.co.com"
|
|
373
|
+
).requiredOption("-f, --field <key=value>", "a sign-in field (repeatable)", collect, []).option("--external-user <id>", "an end user's id; omit for the organization's own account").action(
|
|
374
|
+
(platform, opts, command) => withClient(command, (c) => cmdConnectAccount(c, platform, opts))
|
|
375
|
+
);
|
|
358
376
|
program.command("post").description("Create/schedule/publish a post").requiredOption("-c, --channel <id>", "channel id (repeatable)", collect, []).option("-t, --text <text>", "post text").option("-w, --when <when>", '"now" | "draft" | ISO-8601', "draft").option("-m, --media <url>", "public media URL (repeatable)", collect, []).option("--type <type>", "post | reel | thread | story | article").option("--first-comment <text>", "first comment").option("--title <title>", "article title (--type article)").option("--markdown <md>", 'article body in Markdown, e.g. "$(cat post.md)" (--type article)').option("--excerpt <text>", "article excerpt (--type article)").option("--tag <tag>", "article tag (repeatable, --type article)", collect, []).option("--canonical-url <url>", "article canonical URL (--type article)").action((opts, command) => withClient(command, (c) => cmdPost(c, opts)));
|
|
359
377
|
program.command("update <id>").description("Edit a draft or scheduled post (only the options given change)").option("-c, --channel <id>", "channel id (repeatable; replaces the channel list)", collect, []).option("-t, --text <text>", "post text").option("-w, --when <when>", '"now" | "draft" | ISO-8601 (omit: keep the schedule)').option("-m, --media <url>", "public media URL (repeatable; replaces the media)", collect, []).option("--first-comment <text>", "first comment").option("--title <title>", "article title").option("--markdown <md>", "article body in Markdown").option("--excerpt <text>", "article excerpt").option("--tag <tag>", "article tag (repeatable; replaces the tags)", collect, []).option("--canonical-url <url>", "article canonical URL").action(
|
|
360
378
|
(id, opts, command) => withClient(command, (c) => cmdUpdate(c, id, opts))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anaella/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Command-line tool for anaella.com — schedule and publish social posts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"test": "bun test"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@anaella/client": "^0.
|
|
21
|
+
"@anaella/client": "^0.6.0",
|
|
22
22
|
"commander": "^12.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|