chirpie 1.0.46 → 1.0.47

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 CHANGED
@@ -32,11 +32,12 @@ export CHIRPIE_API_KEY=chirpie_sk_...
32
32
  | `chirpie login` / `logout` / `auth` / `whoami` | Manage credentials |
33
33
  | `chirpie post <text>` | Create a post. `-a` account (repeat it for several accounts), `-m` media files or URLs, `--alt` descriptions, `--config` per-account overrides, `-s` schedule, `--draft` save without sending |
34
34
  | `chirpie thread <post> <post> ...` | Create a 2 to 25 post thread, or 1 to 25 with `--draft`. `-a` is repeatable, `--config` takes per-account posts, `-f` takes a JSON payload file |
35
- | `chirpie posts` | List posts. `--status`, `--account`, `--group`, `--limit` |
35
+ | `chirpie posts` | List posts. `--status`, `--account`, `--group`, `--limit`, `--include-hidden` |
36
36
  | `chirpie posts get <id>` | Fetch one post |
37
37
  | `chirpie posts update <id>` | Edit a post that has not published yet, or finish a draft. `--text`, `--media`, `--alt`, `--clear-media`, `--schedule-at`, `--keep-draft`. Leaving `--schedule-at` out keeps the time it already has |
38
38
  | `chirpie posts publish <id>` | Send a saved draft now. `-t` sets the final text first |
39
- | `chirpie posts delete <id>` | Delete a post. Deleting any post of a scheduled thread cancels the thread |
39
+ | `chirpie posts delete <id>` | Take a post down from the platform. Chirpie keeps it, marked deleted. Deleting any post of a scheduled thread cancels the thread. Instagram and TikTok offer no delete API and refuse with `delete_unsupported` |
40
+ | `chirpie posts hide <id>` / `unhide <id>` | Hide a post from your Chirpie listings, or show it again. Nothing reaches the platform |
40
41
  | `chirpie accounts` | List connected accounts, active and inactive |
41
42
  | `chirpie accounts activate <id>` / `deactivate <id>` | Choose which accounts publish. Deactivating cancels that account's scheduled posts |
42
43
  | `chirpie accounts disconnect <id>` | End a connection. Cancels that account's scheduled posts, frees a plan slot, and removes the stored credential, so reconnecting means authorizing again. Asks first; `-y` skips the prompt |
package/dist/index.js CHANGED
@@ -31,10 +31,22 @@ function apiError(err, fallback) {
31
31
  const maybe = err;
32
32
  if (typeof maybe?.code === "string" && typeof maybe?.message === "string") {
33
33
  error(`${maybe.code}: ${maybe.message}`);
34
+ printThreadRollback(err);
34
35
  return;
35
36
  }
36
37
  error(err instanceof Error ? err.message : fallback);
37
38
  }
39
+ function printThreadRollback(err) {
40
+ const rollback = err?.details?.thread_rollback;
41
+ const live = rollback?.still_live ?? [];
42
+ if (live.length === 0) return;
43
+ error("Still live on the platform, delete these yourself:");
44
+ for (const part of live) {
45
+ error(
46
+ ` post ${part.thread_order + 1}: ${part.platform_post_url ?? part.platform_post_id}`
47
+ );
48
+ }
49
+ }
38
50
  function info(msg) {
39
51
  console.log(`\x1B[36m\u2139\x1B[0m ${msg}`);
40
52
  }
@@ -503,20 +515,21 @@ function wantsJson(opts, cmd) {
503
515
  }
504
516
 
505
517
  // src/commands/posts.ts
506
- var postsCommand = new Command5("posts").description("List, get, update, or delete posts").option(
518
+ var postsCommand = new Command5("posts").description("List, get, update, delete, hide or unhide posts").option(
507
519
  "--status <status>",
508
520
  "Filter by status: draft, scheduled, publishing, published, failed, deleted"
509
521
  ).option("--account <id>", "Filter by account").option(
510
522
  "--group <id>",
511
523
  "Only the posts of one fan-out, from the group ID a multi-account post returned"
512
- ).option("--limit <n>", "Limit results", "20").option("--json", "Output raw JSON").action(async (opts, cmd) => {
524
+ ).option("--limit <n>", "Limit results", "20").option("--include-hidden", "Include posts you have hidden").option("--json", "Output raw JSON").action(async (opts, cmd) => {
513
525
  const client = getClient();
514
526
  try {
515
527
  const posts = await client.listPosts({
516
528
  status: opts.status,
517
529
  account_id: opts.account,
518
530
  group_id: opts.group,
519
- limit: parseInt(opts.limit)
531
+ limit: parseInt(opts.limit),
532
+ include_hidden: opts.includeHidden
520
533
  });
521
534
  if (wantsJson(opts, cmd)) {
522
535
  json(posts);
@@ -527,6 +540,7 @@ var postsCommand = new Command5("posts").description("List, get, update, or dele
527
540
  status: p.status,
528
541
  text: p.text.length > 50 ? p.text.slice(0, 50) + "..." : p.text,
529
542
  created: p.created_at.slice(0, 10),
543
+ hidden: p.hidden ? "yes" : "",
530
544
  // Why a post is not where you expected it. Empty for the ones
531
545
  // that are exactly where you left them.
532
546
  issue: postFailureReason(p) ?? ""
@@ -630,7 +644,7 @@ postsCommand.command("publish <id>").description("Publish a draft now. Every rul
630
644
  }
631
645
  });
632
646
  postsCommand.command("delete <id>").description(
633
- "Delete a post (deleting any post of a scheduled thread cancels the thread)"
647
+ "Delete a post from the platform (a scheduled thread is cancelled whole; the post stays in Chirpie marked deleted)"
634
648
  ).option("--json", "Output raw JSON").action(async (id, opts, cmd) => {
635
649
  const client = getClient();
636
650
  try {
@@ -650,6 +664,42 @@ postsCommand.command("delete <id>").description(
650
664
  process.exit(1);
651
665
  }
652
666
  });
667
+ postsCommand.command("hide <id>").description(
668
+ "Hide a post from your Chirpie listings (nothing reaches the platform)"
669
+ ).option("--json", "Output raw JSON").action(async (id, opts, cmd) => {
670
+ const client = getClient();
671
+ try {
672
+ const result = await client.hidePost(id);
673
+ if (wantsJson(opts, cmd)) {
674
+ json(result);
675
+ } else {
676
+ const n = result.hidden_ids.length;
677
+ success(
678
+ n > 1 ? `Hidden from Chirpie (${n} posts): ${result.hidden_ids.join(", ")}` : `Post ${id} hidden from Chirpie. It is unchanged on the platform.`
679
+ );
680
+ }
681
+ } catch (err) {
682
+ error(err instanceof Error ? err.message : "Failed to hide post");
683
+ process.exit(1);
684
+ }
685
+ });
686
+ postsCommand.command("unhide <id>").description("Put a hidden post back in your Chirpie listings").option("--json", "Output raw JSON").action(async (id, opts, cmd) => {
687
+ const client = getClient();
688
+ try {
689
+ const result = await client.unhidePost(id);
690
+ if (wantsJson(opts, cmd)) {
691
+ json(result);
692
+ } else {
693
+ const n = result.hidden_ids.length;
694
+ success(
695
+ n > 1 ? `Showing again (${n} posts): ${result.hidden_ids.join(", ")}` : `Post ${id} is showing again`
696
+ );
697
+ }
698
+ } catch (err) {
699
+ error(err instanceof Error ? err.message : "Failed to unhide post");
700
+ process.exit(1);
701
+ }
702
+ });
653
703
 
654
704
  // src/commands/accounts.ts
655
705
  import { Command as Command6 } from "commander";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chirpie",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
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.43",
47
+ "@chirpie/sdk": "^1.0.44",
48
48
  "commander": "^13"
49
49
  },
50
50
  "devDependencies": {