@postonus/cli 0.1.52 → 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 +15 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12965,7 +12965,7 @@ function formatTable(headers, rows, isTty = process.stdout.isTTY) {
|
|
|
12965
12965
|
}
|
|
12966
12966
|
|
|
12967
12967
|
// src/version.ts
|
|
12968
|
-
var CLI_VERSION = "0.1.
|
|
12968
|
+
var CLI_VERSION = "0.1.53";
|
|
12969
12969
|
|
|
12970
12970
|
// src/client.ts
|
|
12971
12971
|
var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
@@ -13353,7 +13353,7 @@ function LoginPrompt({ device, run }) {
|
|
|
13353
13353
|
}
|
|
13354
13354
|
async function login() {
|
|
13355
13355
|
if (resolveApiKey()) {
|
|
13356
|
-
printStatus("POSTONUS_API_KEY is set
|
|
13356
|
+
printStatus("POSTONUS_API_KEY is set. It takes precedence, so there is nothing to log in to.");
|
|
13357
13357
|
return;
|
|
13358
13358
|
}
|
|
13359
13359
|
const existing = await readConfig();
|
|
@@ -13586,7 +13586,7 @@ async function connectChannel(options) {
|
|
|
13586
13586
|
if (!added) {
|
|
13587
13587
|
fail("Timed out waiting for the channel to appear. Check `postonus channels list`.");
|
|
13588
13588
|
}
|
|
13589
|
-
printSuccess(`Connected ${added.platform} \
|
|
13589
|
+
printSuccess(`Connected ${added.platform} \u2013 ${added.name} (${added.id})`);
|
|
13590
13590
|
printStatus(
|
|
13591
13591
|
`
|
|
13592
13592
|
Next: schedule a post to this channel:
|
|
@@ -13797,6 +13797,11 @@ async function mcpServe() {
|
|
|
13797
13797
|
import { createHash } from "crypto";
|
|
13798
13798
|
import { open as openFile, stat as stat2 } from "fs/promises";
|
|
13799
13799
|
import { basename, extname } from "path";
|
|
13800
|
+
|
|
13801
|
+
// src/empty-value.ts
|
|
13802
|
+
var EMPTY_VALUE = "\u2013";
|
|
13803
|
+
|
|
13804
|
+
// src/commands/media.ts
|
|
13800
13805
|
var SCENARIO = "post_attachments";
|
|
13801
13806
|
function contentTypeFor(path) {
|
|
13802
13807
|
const extension = extname(path).toLowerCase();
|
|
@@ -13837,7 +13842,7 @@ async function uploadMedia(api, path) {
|
|
|
13837
13842
|
if (!info.isFile()) fail(`Not a file: ${path}`);
|
|
13838
13843
|
if (info.size === 0) fail(`File is empty: ${path}`);
|
|
13839
13844
|
if (info.size > MAX_FILE_SIZE_BYTES) {
|
|
13840
|
-
fail(`${basename(path)} is ${Math.round(info.size / 1024 / 1024)}MB
|
|
13845
|
+
fail(`${basename(path)} is ${Math.round(info.size / 1024 / 1024)}MB: over the upload limit.`);
|
|
13841
13846
|
}
|
|
13842
13847
|
const checksum = await sha256(path);
|
|
13843
13848
|
const initiated = await api.upload.initiateUpload({
|
|
@@ -13920,7 +13925,7 @@ async function importCommand(url2) {
|
|
|
13920
13925
|
printJson(imported);
|
|
13921
13926
|
return;
|
|
13922
13927
|
}
|
|
13923
|
-
printLine(`${imported.type.toLowerCase()} ${imported.mediaId ??
|
|
13928
|
+
printLine(`${imported.type.toLowerCase()} ${imported.mediaId ?? EMPTY_VALUE} ${imported.publicUrl}`);
|
|
13924
13929
|
} catch (error2) {
|
|
13925
13930
|
failApi(error2);
|
|
13926
13931
|
}
|
|
@@ -13965,7 +13970,7 @@ async function openEditor(initial) {
|
|
|
13965
13970
|
const result = spawnSync(editor, [path], { stdio: "inherit", shell: true });
|
|
13966
13971
|
if (result.status !== 0) fail("Editor exited without saving.");
|
|
13967
13972
|
const content = (await readFile2(path, "utf8")).trim();
|
|
13968
|
-
if (!content) fail("Empty post
|
|
13973
|
+
if (!content) fail("Empty post, nothing was written.");
|
|
13969
13974
|
return content;
|
|
13970
13975
|
} finally {
|
|
13971
13976
|
await rm2(directory, { recursive: true, force: true });
|
|
@@ -14038,7 +14043,7 @@ function printState(state, verb) {
|
|
|
14038
14043
|
);
|
|
14039
14044
|
for (const schedule of state.schedules) {
|
|
14040
14045
|
printLine(
|
|
14041
|
-
` ${schedule.platform.toLowerCase().padEnd(10)} ${schedule.channelName.padEnd(18)} ${schedule.status.toLowerCase().padEnd(10)} ${schedule.scheduledAt ??
|
|
14046
|
+
` ${schedule.platform.toLowerCase().padEnd(10)} ${schedule.channelName.padEnd(18)} ${schedule.status.toLowerCase().padEnd(10)} ${schedule.scheduledAt ?? EMPTY_VALUE} ${schedule.scheduleId}`
|
|
14042
14047
|
);
|
|
14043
14048
|
}
|
|
14044
14049
|
if (!state.dryRun) printStatus(`
|
|
@@ -14216,7 +14221,7 @@ function parseScheduleStatus(value2) {
|
|
|
14216
14221
|
}
|
|
14217
14222
|
var HEADERS2 = ["WHEN", "PLATFORM", "CHANNEL", "STATUS", "CONTENT", "SCHEDULE ID"];
|
|
14218
14223
|
function formatWhen(scheduledAt) {
|
|
14219
|
-
if (!scheduledAt) return
|
|
14224
|
+
if (!scheduledAt) return EMPTY_VALUE;
|
|
14220
14225
|
return new Date(scheduledAt).toLocaleString(void 0, {
|
|
14221
14226
|
month: "short",
|
|
14222
14227
|
day: "numeric",
|
|
@@ -14276,7 +14281,7 @@ async function listQueue(options) {
|
|
|
14276
14281
|
}
|
|
14277
14282
|
const isTty = process.stdout.isTTY;
|
|
14278
14283
|
const rows = schedules.map((schedule) => [
|
|
14279
|
-
isTty ? formatWhen(schedule.scheduledAt) : schedule.scheduledAt ??
|
|
14284
|
+
isTty ? formatWhen(schedule.scheduledAt) : schedule.scheduledAt ?? EMPTY_VALUE,
|
|
14280
14285
|
schedule.integration.platform.toLowerCase(),
|
|
14281
14286
|
schedule.integration.name,
|
|
14282
14287
|
schedule.status.toLowerCase(),
|
|
@@ -14403,7 +14408,7 @@ Examples:
|
|
|
14403
14408
|
MCP:
|
|
14404
14409
|
Add this to an editor that spawns MCP servers (Cursor, Claude Desktop):
|
|
14405
14410
|
"postonus": { "command": "postonus", "args": ["mcp"] }
|
|
14406
|
-
It reuses this machine's stored login
|
|
14411
|
+
It reuses this machine's stored login. The editor runs no OAuth of its own.`
|
|
14407
14412
|
).hook("preAction", (command) => {
|
|
14408
14413
|
const opts = command.opts();
|
|
14409
14414
|
if (opts.input === false) opts.nonInteractive = true;
|