@postonus/cli 0.1.51 → 0.1.53

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
@@ -8521,8 +8521,7 @@ var hasContentOrMedia = (data) => Boolean(data.content && data.content.trim().le
8521
8521
  var CreatePostRowSchema = object({
8522
8522
  content: ContentField,
8523
8523
  media: array(PostMediaInputSchema).optional(),
8524
- scheduledAt: InstantInput.optional(),
8525
- delivery: _enum(SCHEDULE_DELIVERY_VALUES).optional()
8524
+ scheduledAt: InstantInput.optional()
8526
8525
  }).refine(hasContentOrMedia, "Add some content or media to your post");
8527
8526
  var ThreadSchema = array(string2().trim().min(1).max(DRAFT_MAX_CHARS)).min(2).max(MAX_THREAD_SEGMENTS);
8528
8527
  var DryRunField = boolean2().optional();
@@ -12966,7 +12965,7 @@ function formatTable(headers, rows, isTty = process.stdout.isTTY) {
12966
12965
  }
12967
12966
 
12968
12967
  // src/version.ts
12969
- var CLI_VERSION = "0.1.51";
12968
+ var CLI_VERSION = "0.1.53";
12970
12969
 
12971
12970
  // src/client.ts
12972
12971
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
@@ -13354,7 +13353,7 @@ function LoginPrompt({ device, run }) {
13354
13353
  }
13355
13354
  async function login() {
13356
13355
  if (resolveApiKey()) {
13357
- printStatus("POSTONUS_API_KEY is set \u2014 it takes precedence, so there is nothing to log in to.");
13356
+ printStatus("POSTONUS_API_KEY is set. It takes precedence, so there is nothing to log in to.");
13358
13357
  return;
13359
13358
  }
13360
13359
  const existing = await readConfig();
@@ -13587,7 +13586,7 @@ async function connectChannel(options) {
13587
13586
  if (!added) {
13588
13587
  fail("Timed out waiting for the channel to appear. Check `postonus channels list`.");
13589
13588
  }
13590
- printSuccess(`Connected ${added.platform} \u2014 ${added.name} (${added.id})`);
13589
+ printSuccess(`Connected ${added.platform} \u2013 ${added.name} (${added.id})`);
13591
13590
  printStatus(
13592
13591
  `
13593
13592
  Next: schedule a post to this channel:
@@ -13798,6 +13797,11 @@ async function mcpServe() {
13798
13797
  import { createHash } from "crypto";
13799
13798
  import { open as openFile, stat as stat2 } from "fs/promises";
13800
13799
  import { basename, extname } from "path";
13800
+
13801
+ // src/empty-value.ts
13802
+ var EMPTY_VALUE = "\u2013";
13803
+
13804
+ // src/commands/media.ts
13801
13805
  var SCENARIO = "post_attachments";
13802
13806
  function contentTypeFor(path) {
13803
13807
  const extension = extname(path).toLowerCase();
@@ -13838,7 +13842,7 @@ async function uploadMedia(api, path) {
13838
13842
  if (!info.isFile()) fail(`Not a file: ${path}`);
13839
13843
  if (info.size === 0) fail(`File is empty: ${path}`);
13840
13844
  if (info.size > MAX_FILE_SIZE_BYTES) {
13841
- fail(`${basename(path)} is ${Math.round(info.size / 1024 / 1024)}MB \u2014 over the upload limit.`);
13845
+ fail(`${basename(path)} is ${Math.round(info.size / 1024 / 1024)}MB: over the upload limit.`);
13842
13846
  }
13843
13847
  const checksum = await sha256(path);
13844
13848
  const initiated = await api.upload.initiateUpload({
@@ -13921,7 +13925,7 @@ async function importCommand(url2) {
13921
13925
  printJson(imported);
13922
13926
  return;
13923
13927
  }
13924
- printLine(`${imported.type.toLowerCase()} ${imported.mediaId ?? "\u2014"} ${imported.publicUrl}`);
13928
+ printLine(`${imported.type.toLowerCase()} ${imported.mediaId ?? EMPTY_VALUE} ${imported.publicUrl}`);
13925
13929
  } catch (error2) {
13926
13930
  failApi(error2);
13927
13931
  }
@@ -13966,7 +13970,7 @@ async function openEditor(initial) {
13966
13970
  const result = spawnSync(editor, [path], { stdio: "inherit", shell: true });
13967
13971
  if (result.status !== 0) fail("Editor exited without saving.");
13968
13972
  const content = (await readFile2(path, "utf8")).trim();
13969
- if (!content) fail("Empty post \u2014 nothing was written.");
13973
+ if (!content) fail("Empty post, nothing was written.");
13970
13974
  return content;
13971
13975
  } finally {
13972
13976
  await rm2(directory, { recursive: true, force: true });
@@ -14039,7 +14043,7 @@ function printState(state, verb) {
14039
14043
  );
14040
14044
  for (const schedule of state.schedules) {
14041
14045
  printLine(
14042
- ` ${schedule.platform.toLowerCase().padEnd(10)} ${schedule.channelName.padEnd(18)} ${schedule.status.toLowerCase().padEnd(10)} ${schedule.scheduledAt ?? "\u2014"} ${schedule.scheduleId}`
14046
+ ` ${schedule.platform.toLowerCase().padEnd(10)} ${schedule.channelName.padEnd(18)} ${schedule.status.toLowerCase().padEnd(10)} ${schedule.scheduledAt ?? EMPTY_VALUE} ${schedule.scheduleId}`
14043
14047
  );
14044
14048
  }
14045
14049
  if (!state.dryRun) printStatus(`
@@ -14065,12 +14069,12 @@ async function post(text, options) {
14065
14069
  {
14066
14070
  content: thread ? thread.join("\n\n") : content,
14067
14071
  scheduledAt: "scheduledAt" in timing ? timing.scheduledAt : void 0,
14068
- media: media2.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId })),
14069
- delivery
14072
+ media: media2.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId }))
14070
14073
  }
14071
14074
  ],
14072
14075
  shared: {
14073
14076
  ...targets,
14077
+ delivery,
14074
14078
  thread,
14075
14079
  integrationContent: readCopy(options.copy),
14076
14080
  xLinkHandling,
@@ -14217,7 +14221,7 @@ function parseScheduleStatus(value2) {
14217
14221
  }
14218
14222
  var HEADERS2 = ["WHEN", "PLATFORM", "CHANNEL", "STATUS", "CONTENT", "SCHEDULE ID"];
14219
14223
  function formatWhen(scheduledAt) {
14220
- if (!scheduledAt) return "\u2014";
14224
+ if (!scheduledAt) return EMPTY_VALUE;
14221
14225
  return new Date(scheduledAt).toLocaleString(void 0, {
14222
14226
  month: "short",
14223
14227
  day: "numeric",
@@ -14277,7 +14281,7 @@ async function listQueue(options) {
14277
14281
  }
14278
14282
  const isTty = process.stdout.isTTY;
14279
14283
  const rows = schedules.map((schedule) => [
14280
- isTty ? formatWhen(schedule.scheduledAt) : schedule.scheduledAt ?? "\u2014",
14284
+ isTty ? formatWhen(schedule.scheduledAt) : schedule.scheduledAt ?? EMPTY_VALUE,
14281
14285
  schedule.integration.platform.toLowerCase(),
14282
14286
  schedule.integration.name,
14283
14287
  schedule.status.toLowerCase(),
@@ -14404,7 +14408,7 @@ Examples:
14404
14408
  MCP:
14405
14409
  Add this to an editor that spawns MCP servers (Cursor, Claude Desktop):
14406
14410
  "postonus": { "command": "postonus", "args": ["mcp"] }
14407
- It reuses this machine's stored login \u2014 the editor runs no OAuth of its own.`
14411
+ It reuses this machine's stored login. The editor runs no OAuth of its own.`
14408
14412
  ).hook("preAction", (command) => {
14409
14413
  const opts = command.opts();
14410
14414
  if (opts.input === false) opts.nonInteractive = true;