chirpie 1.0.41 → 1.0.42
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/README.md +1 -0
- package/dist/index.js +42 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ export CHIRPIE_API_KEY=chirpie_sk_...
|
|
|
34
34
|
| `chirpie thread <post> <post> ...` | Create a 2 to 25 post thread. `-f` takes a JSON payload file |
|
|
35
35
|
| `chirpie posts` | List posts. `--status`, `--account`, `--limit` |
|
|
36
36
|
| `chirpie posts get <id>` | Fetch one post |
|
|
37
|
+
| `chirpie posts update <id>` | Edit a post that has not published yet. `--text`, `--media`, `--clear-media`, `--schedule-at`. Leaving `--schedule-at` out keeps the time it already has |
|
|
37
38
|
| `chirpie posts delete <id>` | Delete a post. Deleting any post of a scheduled thread cancels the thread |
|
|
38
39
|
| `chirpie accounts` | List connected accounts, active and inactive |
|
|
39
40
|
| `chirpie accounts activate <id>` / `deactivate <id>` | Choose which accounts publish. Deactivating cancels that account's scheduled posts |
|
package/dist/index.js
CHANGED
|
@@ -287,7 +287,7 @@ function wantsJson(opts, cmd) {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
// src/commands/posts.ts
|
|
290
|
-
var postsCommand = new Command5("posts").description("List, get, or delete posts").option("--status <status>", "Filter by status").option("--account <id>", "Filter by account").option("--limit <n>", "Limit results", "20").option("--json", "Output raw JSON").action(async (opts, cmd) => {
|
|
290
|
+
var postsCommand = new Command5("posts").description("List, get, update, or delete posts").option("--status <status>", "Filter by status").option("--account <id>", "Filter by account").option("--limit <n>", "Limit results", "20").option("--json", "Output raw JSON").action(async (opts, cmd) => {
|
|
291
291
|
const client = getClient();
|
|
292
292
|
try {
|
|
293
293
|
const posts = await client.listPosts({
|
|
@@ -332,6 +332,47 @@ postsCommand.command("get <id>").description("Get a post by ID").option("--json"
|
|
|
332
332
|
process.exit(1);
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
|
+
postsCommand.command("update <id>").description(
|
|
336
|
+
"Edit a post that has not published yet. Leaving --schedule-at out keeps the time it already has"
|
|
337
|
+
).option("-t, --text <text>", "Replacement post text").option(
|
|
338
|
+
"-m, --media <urls...>",
|
|
339
|
+
"Replacement image or video URLs, following the same per-platform rules as creating a post. Pass --clear-media to remove the media instead."
|
|
340
|
+
).option("--clear-media", "Remove the media from the post").option(
|
|
341
|
+
"-s, --schedule-at <datetime>",
|
|
342
|
+
"New publish time. Any ISO 8601 timestamp with a timezone (2027-04-01T14:00:00Z or 2027-04-01T16:00:00+02:00). Omit it to keep the time the post already has. Rescheduling one part of a thread moves the whole thread."
|
|
343
|
+
).option("--json", "Output raw JSON").action(async (id, opts, cmd) => {
|
|
344
|
+
if (opts.media && opts.clearMedia) {
|
|
345
|
+
error("Pass either --media or --clear-media, not both");
|
|
346
|
+
process.exit(1);
|
|
347
|
+
}
|
|
348
|
+
if (!opts.text && !opts.media && !opts.clearMedia && !opts.scheduleAt) {
|
|
349
|
+
error("Nothing to change. Pass --text, --media, --clear-media or --schedule-at");
|
|
350
|
+
process.exit(1);
|
|
351
|
+
}
|
|
352
|
+
const client = getClient();
|
|
353
|
+
try {
|
|
354
|
+
const post = await client.updatePost(id, {
|
|
355
|
+
...opts.text !== void 0 ? { text: opts.text } : {},
|
|
356
|
+
...opts.clearMedia ? { media_urls: [] } : {},
|
|
357
|
+
...opts.media ? { media_urls: opts.media } : {},
|
|
358
|
+
...opts.scheduleAt ? { schedule_at: opts.scheduleAt } : {}
|
|
359
|
+
});
|
|
360
|
+
if (wantsJson(opts, cmd)) {
|
|
361
|
+
json(post);
|
|
362
|
+
} else {
|
|
363
|
+
const moved = post.rescheduled_post_ids ?? [];
|
|
364
|
+
success(`Post ${post.id} updated`);
|
|
365
|
+
if (opts.scheduleAt) {
|
|
366
|
+
success(
|
|
367
|
+
moved.length > 1 ? `Thread rescheduled for ${post.scheduled_at} (${moved.length} posts)` : `Scheduled for ${post.scheduled_at}`
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
} catch (err) {
|
|
372
|
+
apiError(err, "Failed to update post");
|
|
373
|
+
process.exit(1);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
335
376
|
postsCommand.command("delete <id>").description(
|
|
336
377
|
"Delete a post (deleting any post of a scheduled thread cancels the thread)"
|
|
337
378
|
).option("--json", "Output raw JSON").action(async (id, opts, cmd) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chirpie",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
4
4
|
"description": "Chirpie CLI: post to social media from the command line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@chirpie/sdk": "^1.0.
|
|
47
|
+
"@chirpie/sdk": "^1.0.39",
|
|
48
48
|
"commander": "^13"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|