chirpie 1.0.12 → 1.0.14

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 +12 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -27,6 +27,14 @@ function success(msg) {
27
27
  function error(msg) {
28
28
  console.error(`\x1B[31m\u2717\x1B[0m ${msg}`);
29
29
  }
30
+ function apiError(err, fallback) {
31
+ const maybe = err;
32
+ if (typeof maybe?.code === "string" && typeof maybe?.message === "string") {
33
+ error(`${maybe.code}: ${maybe.message}`);
34
+ return;
35
+ }
36
+ error(err instanceof Error ? err.message : fallback);
37
+ }
30
38
  function info(msg) {
31
39
  console.log(`\x1B[36m\u2139\x1B[0m ${msg}`);
32
40
  }
@@ -149,7 +157,7 @@ function getClient() {
149
157
  }
150
158
 
151
159
  // src/commands/post.ts
152
- var postCommand = new Command3("post").description("Create a post").argument("<text>", "Post text").option("-a, --account <id>", "Account ID").option("-m, --media <urls...>", "Media URLs. Per-platform caps: X/Bluesky/Mastodon 4, LinkedIn 9, Threads/Pinterest/YouTube/GBP/Snapchat/Reddit 1, Instagram/Facebook/Telegram 10, TikTok up to 35 photos.").option("-s, --schedule <datetime>", "Schedule for later (ISO 8601)").option("--json", "Output raw JSON").action(async (text, opts) => {
160
+ var postCommand = new Command3("post").description("Create a post").argument("<text>", "Post text").option("-a, --account <id>", "Account ID").option("-m, --media <urls...>", "Media URLs. Per-platform caps: X/Bluesky/Mastodon 4, LinkedIn 9, Threads/Pinterest/YouTube/GBP/Snapchat/Reddit 1, Instagram/Facebook/Telegram 10, TikTok up to 35 photos.").option("-s, --schedule <datetime>", "Schedule for later (ISO 8601, UTC). Posts publish within ~5 minutes of the scheduled time.").option("--json", "Output raw JSON").action(async (text, opts) => {
153
161
  const client = getClient();
154
162
  let accountId = opts.account;
155
163
  if (!accountId) {
@@ -181,7 +189,7 @@ var postCommand = new Command3("post").description("Create a post").argument("<t
181
189
  success(`Post created (${post.id})`);
182
190
  }
183
191
  } catch (err) {
184
- error(err instanceof Error ? err.message : "Failed to create post");
192
+ apiError(err, "Failed to create post");
185
193
  process.exit(1);
186
194
  }
187
195
  });
@@ -202,7 +210,7 @@ var threadCommand = new Command4("thread").description("Create a thread").argume
202
210
  ).option(
203
211
  "-f, --file <path>",
204
212
  "JSON file with a full thread payload: { posts: [{ text, media_urls? }, ...], schedule_at?: string }"
205
- ).option("-s, --schedule <datetime>", "Schedule for later (ISO 8601)").option("--json", "Output raw JSON").action(async (posts, opts) => {
213
+ ).option("-s, --schedule <datetime>", "Schedule for later (ISO 8601, UTC). Threads publish within ~5 minutes of the scheduled time.").option("--json", "Output raw JSON").action(async (posts, opts) => {
206
214
  const client = getClient();
207
215
  let accountId = opts.account;
208
216
  if (!accountId) {
@@ -264,7 +272,7 @@ var threadCommand = new Command4("thread").description("Create a thread").argume
264
272
  success(`Thread created with ${thread.posts.length} posts (${thread.id})`);
265
273
  }
266
274
  } catch (err) {
267
- error(err instanceof Error ? err.message : "Failed to create thread");
275
+ apiError(err, "Failed to create thread");
268
276
  process.exit(1);
269
277
  }
270
278
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chirpie",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Chirpie CLI — post to social media from the command line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  ],
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
- "@chirpie/sdk": "^1.0.10",
48
+ "@chirpie/sdk": "^1.0.12",
49
49
  "commander": "^13"
50
50
  },
51
51
  "devDependencies": {