chirpie 1.0.39 → 1.0.41

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
@@ -37,6 +37,7 @@ export CHIRPIE_API_KEY=chirpie_sk_...
37
37
  | `chirpie posts delete <id>` | Delete a post. Deleting any post of a scheduled thread cancels the thread |
38
38
  | `chirpie accounts` | List connected accounts, active and inactive |
39
39
  | `chirpie accounts activate <id>` / `deactivate <id>` | Choose which accounts publish. Deactivating cancels that account's scheduled posts |
40
+ | `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 |
40
41
  | `chirpie accounts connect-x` | Start the X OAuth flow and print the URL |
41
42
  | `chirpie accounts connect-bluesky` | Connect Bluesky with an app password |
42
43
  | `chirpie accounts connect-linkedin` / `connect-mastodon` | Start that platform's OAuth flow |
package/dist/index.js CHANGED
@@ -475,6 +475,45 @@ accountsCommand.command("deactivate").argument("<id>", "Account ID (from `chirpi
475
475
  process.exit(1);
476
476
  }
477
477
  });
478
+ accountsCommand.command("disconnect").argument("<id>", "Account ID (from `chirpie accounts`)").description(
479
+ "Disconnect a connected account (stops publishing, frees a plan slot, cancels its scheduled posts)"
480
+ ).option("-y, --yes", "Skip the confirmation prompt").option("--json", "Output raw JSON").action(async (id, opts, cmd) => {
481
+ if (!opts.yes && !await confirm(`Disconnect account ${id}?`)) {
482
+ error("Cancelled");
483
+ process.exit(1);
484
+ }
485
+ const client = getClient();
486
+ try {
487
+ const result = await client.disconnectAccount(id);
488
+ if (wantsJson(opts, cmd)) {
489
+ json(result);
490
+ } else {
491
+ success(`Disconnected account ${id}`);
492
+ if (result.canceled_posts > 0) {
493
+ success(
494
+ `Cancelled ${result.canceled_posts} scheduled post${result.canceled_posts === 1 ? "" : "s"} and returned them to your monthly quota. They are not restored if you connect the account again.`
495
+ );
496
+ }
497
+ }
498
+ } catch (err) {
499
+ error(err instanceof Error ? err.message : "Failed to disconnect account");
500
+ process.exit(1);
501
+ }
502
+ });
503
+ async function confirm(question) {
504
+ if (!process.stdin.isTTY) return false;
505
+ const readline = await import("readline");
506
+ const rl = readline.createInterface({
507
+ input: process.stdin,
508
+ output: process.stderr
509
+ });
510
+ return new Promise((resolve) => {
511
+ rl.question(`${question} [y/N] `, (answer) => {
512
+ rl.close();
513
+ resolve(answer.trim().toLowerCase() === "y");
514
+ });
515
+ });
516
+ }
478
517
  accountsCommand.command("connect-x").description("Connect a new X/Twitter account via OAuth").option("--json", "Output raw JSON").action(async (opts, cmd) => {
479
518
  const client = getClient();
480
519
  try {
@@ -832,7 +871,7 @@ commentsCommand.command("hide").description("Hide a comment, or show it again wi
832
871
  }
833
872
  });
834
873
  commentsCommand.command("delete").description("Delete a comment from the platform").argument("<post_id>", "Post ID").argument("<comment_id>", "Comment ID from `chirpie comments list`").option("-y, --yes", "Skip the confirmation prompt").option("--json", "Output raw JSON").action(async (postId, commentId, opts, cmd) => {
835
- if (!opts.yes && !await confirm(`Delete comment ${commentId}?`)) {
874
+ if (!opts.yes && !await confirm2(`Delete comment ${commentId}?`)) {
836
875
  error("Cancelled");
837
876
  process.exit(1);
838
877
  }
@@ -849,7 +888,7 @@ commentsCommand.command("delete").description("Delete a comment from the platfor
849
888
  process.exit(1);
850
889
  }
851
890
  });
852
- async function confirm(question) {
891
+ async function confirm2(question) {
853
892
  if (!process.stdin.isTTY) return false;
854
893
  const readline = await import("readline");
855
894
  const rl = readline.createInterface({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chirpie",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
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.36",
47
+ "@chirpie/sdk": "^1.0.38",
48
48
  "commander": "^13"
49
49
  },
50
50
  "devDependencies": {