@postonus/cli 0.1.42 → 0.1.44

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/dist/index.js CHANGED
@@ -25,7 +25,7 @@ var PLAN_CONFIGS = {
25
25
  ownedWorkspaces: 1,
26
26
  defaultMonthlyPosts: 300,
27
27
  maxDrafts: UNLIMITED,
28
- perPlatformMonthlyPosts: { TWITTER: 100 },
28
+ perPlatformMonthlyPosts: { TWITTER: 50 },
29
29
  mediaStorageGb: 10,
30
30
  vaCredits: 60,
31
31
  requestsPerMinute: 600,
@@ -53,7 +53,7 @@ var PLAN_CONFIGS = {
53
53
  ownedWorkspaces: 3,
54
54
  defaultMonthlyPosts: UNLIMITED,
55
55
  maxDrafts: UNLIMITED,
56
- perPlatformMonthlyPosts: { TWITTER: 500 },
56
+ perPlatformMonthlyPosts: { TWITTER: 200 },
57
57
  mediaStorageGb: 50,
58
58
  vaCredits: 300,
59
59
  requestsPerMinute: 1800,
@@ -78,7 +78,7 @@ var PLAN_CONFIGS = {
78
78
  ownedWorkspaces: UNLIMITED,
79
79
  defaultMonthlyPosts: UNLIMITED,
80
80
  maxDrafts: UNLIMITED,
81
- perPlatformMonthlyPosts: { TWITTER: 2e3 },
81
+ perPlatformMonthlyPosts: { TWITTER: 1e3 },
82
82
  mediaStorageGb: UNLIMITED,
83
83
  vaCredits: UNLIMITED,
84
84
  // Finite on purpose — see the `requestsPerMinute` doc comment.
@@ -8430,6 +8430,8 @@ var SharedPostFields = {
8430
8430
  integrationContent: record(string2(), string2()).optional(),
8431
8431
  integrationFirstComment: record(string2(), string2()).optional(),
8432
8432
  integrationSettings: IntegrationSettingsInputSchema.optional(),
8433
+ subreddit: string2().trim().min(1).optional(),
8434
+ xLinkHandling: _enum(["first_reply", "plain_text", "keep_live"]).optional(),
8433
8435
  /**
8434
8436
  * Which of the post's media each channel publishes, in publish order, by url.
8435
8437
  * Omit a channel to send it as much of the post's media as its platform can
@@ -8708,6 +8710,7 @@ var postDomainErrors = {
8708
8710
  CONTENT_TOO_LONG: { status: 400, message: "Content exceeds the platform limit.", data: ErrorDataSchema },
8709
8711
  MEDIA_RULE_VIOLATED: { status: 400, message: "Media does not satisfy the platform rules.", data: ErrorDataSchema },
8710
8712
  VIDEO_TOO_LONG: { status: 400, message: "Video exceeds the platform duration limit.", data: ErrorDataSchema },
8713
+ REDDIT_SUBREDDIT_REQUIRED: { status: 400, message: "Reddit subreddit is required in platform settings." },
8711
8714
  SCHEDULE_IN_PAST: { status: 400, message: "Scheduled time must be in the future." },
8712
8715
  THREAD_NOT_ALLOWED: { status: 400, message: "Thread segments require explicit opt-in." },
8713
8716
  INVALID_INTEGRATIONS: { status: 400, message: "Some integrations are invalid or do not belong to you." },
@@ -12870,7 +12873,7 @@ function formatTable(headers, rows, isTty = process.stdout.isTTY) {
12870
12873
  }
12871
12874
 
12872
12875
  // src/version.ts
12873
- var CLI_VERSION = "0.1.42";
12876
+ var CLI_VERSION = "0.1.44";
12874
12877
 
12875
12878
  // src/client.ts
12876
12879
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
@@ -13895,6 +13898,13 @@ function readCopy(pairs) {
13895
13898
  })
13896
13899
  );
13897
13900
  }
13901
+ function readXLinkHandling(value2) {
13902
+ if (!value2) return void 0;
13903
+ if (value2 === "first_reply" || value2 === "plain_text" || value2 === "keep_live") {
13904
+ return value2;
13905
+ }
13906
+ return failUsage("--x-link-handling must be 'first_reply', 'plain_text', or 'keep_live'.");
13907
+ }
13898
13908
  function readTiming(options) {
13899
13909
  const chosen = [options.at, options.optimal, options.now, options.draft].filter(Boolean);
13900
13910
  if (chosen.length > 1) failUsage("Use one of --at, --optimal, --now or --draft.");
@@ -13939,6 +13949,7 @@ async function post(text, options) {
13939
13949
  const timing = readTiming(options);
13940
13950
  const project = await readProjectConfig();
13941
13951
  const targets = readTargets(options, project?.defaultPlatforms);
13952
+ const xLinkHandling = readXLinkHandling(options.xLinkHandling);
13942
13953
  if (timing.postAction !== "DRAFT" && !targets.platforms && !targets.selectedIntegrations) {
13943
13954
  failUsage("Say where to post: --to x,linkedin or --channel <id> (or use --draft).");
13944
13955
  }
@@ -13953,7 +13964,13 @@ async function post(text, options) {
13953
13964
  media: media2.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId }))
13954
13965
  }
13955
13966
  ],
13956
- shared: { ...targets, thread, integrationContent: readCopy(options.copy) },
13967
+ shared: {
13968
+ ...targets,
13969
+ thread,
13970
+ integrationContent: readCopy(options.copy),
13971
+ xLinkHandling,
13972
+ subreddit: options.subreddit
13973
+ },
13957
13974
  postAction: timing.postAction,
13958
13975
  dryRun: options.dryRun
13959
13976
  });
@@ -13979,8 +13996,11 @@ async function editPost(postId, text, options) {
13979
13996
  const targets = readTargets(options);
13980
13997
  const integrationContent = readCopy(options.copy);
13981
13998
  const scheduledAt = options.at ? parseInstant(options.at, "--at") : void 0;
13982
- if (!thread && content === void 0 && !targets.platforms && !targets.selectedIntegrations && !integrationContent && !scheduledAt && !options.media?.length) {
13983
- failUsage("Nothing to change. Pass new text, --thread-file, --at, --to, --channel, --copy or --media.");
13999
+ const xLinkHandling = readXLinkHandling(options.xLinkHandling);
14000
+ if (!thread && content === void 0 && !targets.platforms && !targets.selectedIntegrations && !integrationContent && !scheduledAt && !options.media?.length && !options.subreddit && !xLinkHandling) {
14001
+ failUsage(
14002
+ "Nothing to change. Pass new text, --thread-file, --at, --to, --channel, --copy, --subreddit, --x-link-handling or --media."
14003
+ );
13984
14004
  }
13985
14005
  const { api } = await getApi();
13986
14006
  const media2 = options.media?.length ? await uploadAll(api, options.media) : void 0;
@@ -13992,6 +14012,8 @@ async function editPost(postId, text, options) {
13992
14012
  scheduledAt,
13993
14013
  ...targets,
13994
14014
  integrationContent,
14015
+ subreddit: options.subreddit,
14016
+ xLinkHandling,
13995
14017
  media: media2?.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId })),
13996
14018
  dryRun: options.dryRun
13997
14019
  });
@@ -14284,8 +14306,11 @@ channels.command("connect").description("connect a new channel via OAuth").optio
14284
14306
  program.command("link").description("link current directory to a Postonus workspace").option("-w, --workspace <id>", "workspace to link to").action(linkWorkspace);
14285
14307
  program.command("unlink").description("unlink current directory from its Postonus workspace").action(unlinkWorkspace);
14286
14308
  var collect = (value2, previous = []) => [...previous, value2];
14287
- var postCommand = program.command("post").alias("posts").description("create a post: scheduled, now, at the next optimal time, or as a draft").argument("[text]", "post content; also accepts piped stdin").option("-t, --to <platforms>", "comma-separated platforms, e.g. x,linkedin").option("-c, --channel <id>", "a channel id from `postonus channels list`; repeatable", collect).option("--channels <ids>", "channel ids; comma-separated or repeatable", collect).option("-a, --at <time>", "RFC 3339 time with an offset").option("-o, --optimal", "the next recommended window").option("--now", "publish as soon as the queue picks it up").option("-d, --draft", "save as a draft without scheduling").option("-f, --file <path>", "read content from a file").option("--thread-file <path>", "read a thread: segments separated by a line of ---").option("-e, --editor", "compose in $EDITOR").option("-m, --media <path...>", "attach local image or video files").option("--copy <channelId=text>", "text that replaces the body on one channel; repeatable", collect).option("--dry-run", "run every server check and show the result without saving").action(post);
14288
- postCommand.command("edit").description("change a post; only the flags given change").argument("<postId>", "post id from `postonus queue list`").argument("[text]", "new content").option("-t, --to <platforms>", "replace the channels with these platforms").option("-c, --channel <id>", "replace the channels with these ids; repeatable", collect).option("--channels <ids>", "alias for --channel", collect).option("-a, --at <time>", "move every channel to this RFC 3339 time").option("-f, --file <path>", "read new content from a file").option("--thread-file <path>", "replace the body with a thread file").option("-m, --media <path...>", "replace the media with these files").option("--copy <channelId=text>", "replace one channel's copy; repeatable", collect).option("--dry-run", "run every server check and show the result without saving").action(editPost);
14309
+ var postCommand = program.command("post").alias("posts").description("create a post: scheduled, now, at the next optimal time, or as a draft").argument("[text]", "post content; also accepts piped stdin").option("-t, --to <platforms>", "comma-separated platforms, e.g. x,linkedin").option("-c, --channel <id>", "a channel id from `postonus channels list`; repeatable", collect).option("--channels <ids>", "channel ids; comma-separated or repeatable", collect).option("-a, --at <time>", "RFC 3339 time with an offset").option("-o, --optimal", "the next recommended window").option("--now", "publish as soon as the queue picks it up").option("-d, --draft", "save as a draft without scheduling").option("-f, --file <path>", "read content from a file").option("--thread-file <path>", "read a thread: segments separated by a line of ---").option("-e, --editor", "compose in $EDITOR").option("-m, --media <path...>", "attach local image or video files").option("--copy <channelId=text>", "text that replaces the body on one channel; repeatable", collect).option("--subreddit <name>", "target subreddit for Reddit posts (e.g. programming or r/programming)").option(
14310
+ "--x-link-handling <handling>",
14311
+ "how to handle links in X posts: 'first_reply' (default), 'plain_text', or 'keep_live'"
14312
+ ).option("--dry-run", "run every server check and show the result without saving").action(post);
14313
+ postCommand.command("edit").description("change a post; only the flags given change").argument("<postId>", "post id from `postonus queue list`").argument("[text]", "new content").option("-t, --to <platforms>", "replace the channels with these platforms").option("-c, --channel <id>", "replace the channels with these ids; repeatable", collect).option("--channels <ids>", "alias for --channel", collect).option("-a, --at <time>", "move every channel to this RFC 3339 time").option("-f, --file <path>", "read new content from a file").option("--thread-file <path>", "replace the body with a thread file").option("-m, --media <path...>", "replace the media with these files").option("--copy <channelId=text>", "replace one channel's copy; repeatable", collect).option("--subreddit <name>", "target subreddit for Reddit posts (e.g. programming or r/programming)").option("--x-link-handling <handling>", "how to handle links in X posts: 'first_reply', 'plain_text', or 'keep_live'").option("--dry-run", "run every server check and show the result without saving").action(editPost);
14289
14314
  postCommand.command("delete").alias("rm").alias("del").description("delete a post and every schedule on it").argument("<postId>", "post id from `postonus queue list`").option("--remote", "also delete published copies on their platforms").option("-y, --yes", "skip confirmation prompt").action(deletePost);
14290
14315
  postCommand.command("retry").description("queue a failed schedule to publish again").argument("<scheduleId>", "schedule id from `postonus queue list --status failed`").option("--content <text>", "replacement copy for this channel only").action(retrySchedule);
14291
14316
  program.command("best-times").description("recommended posting windows for the given platforms").requiredOption("-t, --to <platforms>", "comma-separated platforms, e.g. x,linkedin").option("-n, --limit <count>", "how many times to list (1-20)", "5").option("--count <count>", "alias for --limit (deprecated)").action(bestTimes);