@anaella/cli 0.4.1 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +17 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -130,6 +130,20 @@ var cmdPosts = (client, o) => client.listPosts({
130
130
  limit: o.limit === void 0 ? void 0 : Number(o.limit),
131
131
  cursor: o.cursor === void 0 ? void 0 : Number(o.cursor)
132
132
  });
133
+ function cmdUpdate(client, id, o) {
134
+ return client.updatePost(id, {
135
+ channels: o.channel?.length ? o.channel : void 0,
136
+ text: o.text,
137
+ when: o.when,
138
+ media: o.media?.length ? o.media.map((url) => ({ url })) : void 0,
139
+ firstComment: o.firstComment,
140
+ title: o.title,
141
+ markdown: o.markdown,
142
+ excerpt: o.excerpt,
143
+ tags: o.tag?.length ? o.tag : void 0,
144
+ canonicalUrl: o.canonicalUrl
145
+ });
146
+ }
133
147
  var cmdGet = (client, id) => client.getPost(id);
134
148
  var cmdDelete = (client, id) => client.deletePost(id);
135
149
  var cmdAnalytics = (client, o) => o.post ? client.getPostAnalytics(o.post, { period: o.period }) : client.getAnalytics({ period: o.period });
@@ -336,6 +350,9 @@ program.command("connect <platform>").description("Create a connect link for an
336
350
  (platform, opts, command) => withClient(command, (c) => cmdConnect(c, platform, opts))
337
351
  );
338
352
  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)));
353
+ 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(
354
+ (id, opts, command) => withClient(command, (c) => cmdUpdate(c, id, opts))
355
+ );
339
356
  program.command("posts").description("List recent posts").option("--limit <n>", "max results (1-100)").option("--cursor <n>", "offset").action(
340
357
  (opts, command) => withClient(command, (c) => cmdPosts(c, opts), ["id", "type", "status", "scheduledAt"])
341
358
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anaella/cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.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.4.0",
21
+ "@anaella/client": "^0.5.0",
22
22
  "commander": "^12.0.0"
23
23
  },
24
24
  "devDependencies": {