@anaella/cli 0.3.0 → 0.4.1

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 +18 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -104,7 +104,13 @@ var EXT_MIME = {
104
104
  ".gif": "image/gif",
105
105
  ".webp": "image/webp"
106
106
  };
107
- var cmdChannels = (client) => client.listChannels();
107
+ var cmdChannels = (client, o = {}) => client.listChannels(o.externalUser ? { externalUserId: o.externalUser } : {});
108
+ var cmdConnect = (client, platform, o) => client.createConnectSession({
109
+ platform,
110
+ externalUserId: o.externalUser,
111
+ returnUrl: o.returnUrl,
112
+ ...o.resource?.length ? { resources: o.resource } : {}
113
+ });
108
114
  function cmdPost(client, o) {
109
115
  return client.createPost({
110
116
  channels: o.channel,
@@ -317,8 +323,17 @@ program.command("logout").description("Remove the saved API key").action(() => {
317
323
  clearConfigFile(process.env);
318
324
  process.stdout.write("Logged out.\n");
319
325
  });
320
- program.command("channels").description("List connected channels").action(
321
- (_opts, command) => withClient(command, (c) => cmdChannels(c), ["id", "platform", "name", "active"])
326
+ program.command("channels").description("List connected channels").option("--external-user <id>", "only this end user's connections").action(
327
+ (opts, command) => withClient(command, (c) => cmdChannels(c, opts), [
328
+ "id",
329
+ "platform",
330
+ "name",
331
+ "status",
332
+ "externalUserId"
333
+ ])
334
+ );
335
+ 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(
336
+ (platform, opts, command) => withClient(command, (c) => cmdConnect(c, platform, opts))
322
337
  );
323
338
  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)));
324
339
  program.command("posts").description("List recent posts").option("--limit <n>", "max results (1-100)").option("--cursor <n>", "offset").action(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anaella/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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.2.0",
21
+ "@anaella/client": "^0.4.0",
22
22
  "commander": "^12.0.0"
23
23
  },
24
24
  "devDependencies": {