@postonus/cli 0.1.1 → 0.1.3
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 +24 -24
- package/dist/index.js +151 -24
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# postonus
|
|
1
|
+
# @postonus/cli
|
|
2
2
|
|
|
3
3
|
Schedule and publish social posts from your terminal.
|
|
4
4
|
|
|
@@ -8,6 +8,10 @@ postonus login
|
|
|
8
8
|
postonus post "shipping today" --to x,linkedin --optimal
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Requires Node.js 22.12 or newer. Needs a [Postonus](https://postonus.com) account.
|
|
12
|
+
|
|
13
|
+
Run without installing: `npx @postonus/cli whoami`
|
|
14
|
+
|
|
11
15
|
## Commands
|
|
12
16
|
|
|
13
17
|
| Command | What it does |
|
|
@@ -19,10 +23,24 @@ postonus post "shipping today" --to x,linkedin --optimal
|
|
|
19
23
|
| `queue list` | Upcoming scheduled posts |
|
|
20
24
|
| `queue move <scheduleId> --at` | Reschedule one queued post |
|
|
21
25
|
| `media upload <path…>` | Upload images or video for use in posts |
|
|
22
|
-
| `best-times --to <platforms>` | Recommended posting windows
|
|
26
|
+
| `best-times --to <platforms>` | Recommended posting windows |
|
|
23
27
|
|
|
24
28
|
`postonus <command> --help` for the flags on any of them.
|
|
25
29
|
|
|
30
|
+
### Scheduling a post
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
postonus post "shipping today" --to x,linkedin --optimal
|
|
34
|
+
postonus post --file draft.md --to linkedin --at 2026-08-01T09:30:00Z
|
|
35
|
+
postonus post --editor --to x --draft
|
|
36
|
+
postonus post "with a video" --to x --media ./demo.mp4 --optimal
|
|
37
|
+
cat draft.md | postonus post --to x --optimal
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`post` always schedules; it never publishes on the spot. Pick a time with
|
|
41
|
+
`--at <ISO timestamp>` or `--optimal` for the next recommended window, or use
|
|
42
|
+
`--draft` to save without a time. `--dry-run` shows what would happen and stops.
|
|
43
|
+
|
|
26
44
|
## Scripting
|
|
27
45
|
|
|
28
46
|
Every command takes `--json`, which prints machine-readable JSON on stdout and
|
|
@@ -38,8 +56,6 @@ codes are `0` success, `1` failure, `2` usage error. With no TTY the CLI never
|
|
|
38
56
|
prompts — pass the flags instead, and use `--no-input` to make a missing one an
|
|
39
57
|
error rather than a wait.
|
|
40
58
|
|
|
41
|
-
Content can also be piped: `cat draft.md | postonus post --to x --optimal`.
|
|
42
|
-
|
|
43
59
|
### CI
|
|
44
60
|
|
|
45
61
|
Set `POSTONUS_API_KEY` to an API key from the dashboard. It takes precedence over
|
|
@@ -61,25 +77,9 @@ a stored session, so no `login` step is needed:
|
|
|
61
77
|
| `NO_COLOR` | Disable coloured output |
|
|
62
78
|
| `XDG_CONFIG_HOME` | Where the session is stored; defaults to `~/.config` |
|
|
63
79
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
pnpm --filter postonus build # bundle to dist/
|
|
68
|
-
pnpm --filter postonus dev # rebuild on change
|
|
69
|
-
pnpm --filter postonus test
|
|
70
|
-
POSTONUS_API_URL=http://localhost:5174 node dist/index.js whoami
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
The CLI calls the public REST API at `/api/v1` through `@orpc/client`'s
|
|
74
|
-
`OpenAPILink`, typed from `@postonus/api-contract` — the same contract the
|
|
75
|
-
dashboard's own browser client uses (ADR-0006). End-to-end types cost nothing,
|
|
76
|
-
because they come from a shared package rather than a type import into another
|
|
77
|
-
app's internals.
|
|
80
|
+
`postonus logout` removes the stored credentials.
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
mount prefix, so an old CLI gets a normal typed error from the operation it
|
|
81
|
-
actually calls. The CLI still sends `x-postonus-cli-version` on every request;
|
|
82
|
-
nothing reads it today.
|
|
82
|
+
## Links
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
- [postonus.com](https://postonus.com)
|
|
85
|
+
- [Report an issue](https://github.com/udayvunnam/experiments/issues)
|
package/dist/index.js
CHANGED
|
@@ -6426,6 +6426,13 @@ var SharedPostFields = {
|
|
|
6426
6426
|
integrationContent: record(string2(), string2()).optional(),
|
|
6427
6427
|
integrationFirstComment: record(string2(), string2()).optional(),
|
|
6428
6428
|
integrationSettings: IntegrationSettingsInputSchema.optional(),
|
|
6429
|
+
/**
|
|
6430
|
+
* Which of the post's media each channel publishes, in publish order, by url.
|
|
6431
|
+
* Omit a channel to send it as much of the post's media as its platform can
|
|
6432
|
+
* carry — the caps live in `@postonus/integrations`, so the API never asks the
|
|
6433
|
+
* caller to know them.
|
|
6434
|
+
*/
|
|
6435
|
+
integrationMedia: record(string2(), array(string2())).optional(),
|
|
6429
6436
|
integrationTimeOffsets: record(string2(), number2().int().min(-12).max(12)).optional(),
|
|
6430
6437
|
...ThreadFields
|
|
6431
6438
|
};
|
|
@@ -6530,6 +6537,8 @@ var PostScheduleSchema = object({
|
|
|
6530
6537
|
scheduledContent: string2().nullable(),
|
|
6531
6538
|
firstComment: string2().nullable(),
|
|
6532
6539
|
settings: record(string2(), unknown()).nullable(),
|
|
6540
|
+
/** Null means this channel publishes every attachment the post has. */
|
|
6541
|
+
attachmentMediaUrls: array(string2()).nullable().optional(),
|
|
6533
6542
|
platformPostId: string2().nullable(),
|
|
6534
6543
|
releaseUrl: string2().nullable(),
|
|
6535
6544
|
retryCount: number2(),
|
|
@@ -7330,8 +7339,12 @@ var ListSchedulesInputSchema = object({
|
|
|
7330
7339
|
limit: coerce_exports.number().int().min(10).max(100).default(20),
|
|
7331
7340
|
cursor: ScheduleListCursorInputSchema.optional(),
|
|
7332
7341
|
direction: _enum(["forward", "backward"]).default("forward"),
|
|
7333
|
-
|
|
7334
|
-
|
|
7342
|
+
// Enums, not free strings. Both reach a Postgres enum column, so a value
|
|
7343
|
+
// outside the set is not a typed refusal but a query that throws — the
|
|
7344
|
+
// endpoint answered 500 for `statuses[]=PENDING`, a status that has never
|
|
7345
|
+
// existed. `posts.ts` already types the equivalent filters this way.
|
|
7346
|
+
platforms: array(PlatformSchema).optional(),
|
|
7347
|
+
statuses: array(_enum(SCHEDULE_STATUS_VALUES)).optional(),
|
|
7335
7348
|
integrationIds: array(string2()).optional()
|
|
7336
7349
|
});
|
|
7337
7350
|
var GetScheduleByIdInputSchema = object({ id: Uuid, postId: Uuid });
|
|
@@ -10360,7 +10373,7 @@ function formatTable(headers, rows) {
|
|
|
10360
10373
|
}
|
|
10361
10374
|
|
|
10362
10375
|
// src/version.ts
|
|
10363
|
-
var CLI_VERSION = "0.1.
|
|
10376
|
+
var CLI_VERSION = "0.1.3";
|
|
10364
10377
|
|
|
10365
10378
|
// src/client.ts
|
|
10366
10379
|
var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
@@ -10407,6 +10420,19 @@ function createOAuthFetch(apiUrl, oauth, onRefreshed) {
|
|
|
10407
10420
|
return fetch(request.url, { method, headers, body: bodyForRetry });
|
|
10408
10421
|
};
|
|
10409
10422
|
}
|
|
10423
|
+
function persistRefreshedTokens(apiUrl, oauth) {
|
|
10424
|
+
return async (refreshed) => {
|
|
10425
|
+
const current = await readConfig();
|
|
10426
|
+
await writeConfig({
|
|
10427
|
+
...current,
|
|
10428
|
+
accessToken: refreshed.accessToken,
|
|
10429
|
+
refreshToken: refreshed.refreshToken,
|
|
10430
|
+
accessTokenExpiresAt: refreshed.expiresAt,
|
|
10431
|
+
clientId: oauth.clientId,
|
|
10432
|
+
apiUrl
|
|
10433
|
+
});
|
|
10434
|
+
};
|
|
10435
|
+
}
|
|
10410
10436
|
function buildClient(apiUrl, auth) {
|
|
10411
10437
|
const oauth = auth.kind === "oauth" ? { accessToken: auth.accessToken, refreshToken: auth.refreshToken, clientId: auth.clientId } : null;
|
|
10412
10438
|
const link = new OpenAPILink(contract, {
|
|
@@ -10415,17 +10441,7 @@ function buildClient(apiUrl, auth) {
|
|
|
10415
10441
|
[CLI_VERSION_HEADER]: CLI_VERSION,
|
|
10416
10442
|
...auth.kind === "api-key" ? { "x-api-key": auth.apiKey } : { authorization: `Bearer ${oauth?.accessToken}` }
|
|
10417
10443
|
}),
|
|
10418
|
-
fetch: oauth ? createOAuthFetch(apiUrl, oauth,
|
|
10419
|
-
const current = await readConfig();
|
|
10420
|
-
await writeConfig({
|
|
10421
|
-
...current,
|
|
10422
|
-
accessToken: refreshed.accessToken,
|
|
10423
|
-
refreshToken: refreshed.refreshToken,
|
|
10424
|
-
accessTokenExpiresAt: refreshed.expiresAt,
|
|
10425
|
-
clientId: oauth.clientId,
|
|
10426
|
-
apiUrl
|
|
10427
|
-
});
|
|
10428
|
-
}) : (request, init) => fetch(request, init)
|
|
10444
|
+
fetch: oauth ? createOAuthFetch(apiUrl, oauth, persistRefreshedTokens(apiUrl, oauth)) : (request, init) => fetch(request, init)
|
|
10429
10445
|
});
|
|
10430
10446
|
return createORPCClient(link);
|
|
10431
10447
|
}
|
|
@@ -10460,7 +10476,7 @@ async function getApi() {
|
|
|
10460
10476
|
function describeError(error2) {
|
|
10461
10477
|
if (error2 instanceof ORPCError3) {
|
|
10462
10478
|
if (error2.code === "UNAUTHORIZED") {
|
|
10463
|
-
return "
|
|
10479
|
+
return error2.message || "Sign-in expired or not valid. Run `postonus login` again.";
|
|
10464
10480
|
}
|
|
10465
10481
|
if (error2.code === "RATE_LIMITED") {
|
|
10466
10482
|
return `Rate limit reached. ${error2.message}`;
|
|
@@ -10569,6 +10585,9 @@ var DeviceCodeError = class extends Error {
|
|
|
10569
10585
|
}
|
|
10570
10586
|
code;
|
|
10571
10587
|
};
|
|
10588
|
+
function cliAudiences(apiUrl) {
|
|
10589
|
+
return [`${apiUrl}/api/v1`, `${apiUrl}/api/mcp`];
|
|
10590
|
+
}
|
|
10572
10591
|
async function registerClient(apiUrl) {
|
|
10573
10592
|
const response = await fetch(`${apiUrl}/api/auth/oauth2/register`, {
|
|
10574
10593
|
method: "POST",
|
|
@@ -10580,8 +10599,8 @@ async function registerClient(apiUrl) {
|
|
|
10580
10599
|
grant_types: [DEVICE_CODE_GRANT_TYPE, "refresh_token"],
|
|
10581
10600
|
scope: CLI_OAUTH_SCOPE,
|
|
10582
10601
|
// Self-registered clients default to the MCP resource; the CLI talks to
|
|
10583
|
-
// `/api/v1
|
|
10584
|
-
resources:
|
|
10602
|
+
// `/api/v1` as well, so it must ask for that audience explicitly here.
|
|
10603
|
+
resources: cliAudiences(apiUrl)
|
|
10585
10604
|
})
|
|
10586
10605
|
});
|
|
10587
10606
|
if (!response.ok) {
|
|
@@ -10596,7 +10615,7 @@ async function requestDeviceCode(apiUrl, clientId) {
|
|
|
10596
10615
|
const response = await fetch(`${apiUrl}/api/auth/device/code`, {
|
|
10597
10616
|
method: "POST",
|
|
10598
10617
|
headers: { "content-type": "application/json" },
|
|
10599
|
-
body: JSON.stringify({ client_id: clientId, scope: CLI_OAUTH_SCOPE, resource:
|
|
10618
|
+
body: JSON.stringify({ client_id: clientId, scope: CLI_OAUTH_SCOPE, resource: cliAudiences(apiUrl) })
|
|
10600
10619
|
});
|
|
10601
10620
|
if (response.ok) return await response.json();
|
|
10602
10621
|
const body = await response.json().catch(() => null);
|
|
@@ -10962,7 +10981,7 @@ async function uploadMedia(api, path) {
|
|
|
10962
10981
|
});
|
|
10963
10982
|
const completed2 = await api.upload.completeUpload({ uploadId: initiated.uploadId, checksum });
|
|
10964
10983
|
if (!completed2.mediaId) throw new Error("Upload completed but no media record was created");
|
|
10965
|
-
return { mediaId: completed2.mediaId, url: completed2.publicUrl, type: mediaTypeFor(contentType) };
|
|
10984
|
+
return { mediaId: completed2.mediaId, uploadId: initiated.uploadId, url: completed2.publicUrl, type: mediaTypeFor(contentType) };
|
|
10966
10985
|
}
|
|
10967
10986
|
const { parts, partSize } = initiated;
|
|
10968
10987
|
if (!parts?.length || !partSize) throw new Error("Server returned an incomplete multipart plan");
|
|
@@ -10982,7 +11001,7 @@ async function uploadMedia(api, path) {
|
|
|
10982
11001
|
multipartParts
|
|
10983
11002
|
});
|
|
10984
11003
|
if (!completed.mediaId) throw new Error("Upload completed but no media record was created");
|
|
10985
|
-
return { mediaId: completed.mediaId, url: completed.publicUrl, type: mediaTypeFor(contentType) };
|
|
11004
|
+
return { mediaId: completed.mediaId, uploadId: initiated.uploadId, url: completed.publicUrl, type: mediaTypeFor(contentType) };
|
|
10986
11005
|
} finally {
|
|
10987
11006
|
await handle.close();
|
|
10988
11007
|
}
|
|
@@ -11007,6 +11026,98 @@ async function uploadCommand(paths) {
|
|
|
11007
11026
|
}
|
|
11008
11027
|
}
|
|
11009
11028
|
|
|
11029
|
+
// src/commands/mcp.ts
|
|
11030
|
+
import { createInterface } from "readline";
|
|
11031
|
+
function decodeMessages(contentType, body) {
|
|
11032
|
+
if (!contentType?.includes("text/event-stream")) {
|
|
11033
|
+
const trimmed = body.trim();
|
|
11034
|
+
return trimmed.length > 0 ? [trimmed] : [];
|
|
11035
|
+
}
|
|
11036
|
+
return body.split(/\r?\n\r?\n/).map(
|
|
11037
|
+
(event) => event.split(/\r?\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice("data:".length).trimStart()).join("\n")
|
|
11038
|
+
).filter((data) => data.length > 0);
|
|
11039
|
+
}
|
|
11040
|
+
function tokenAudiences(accessToken) {
|
|
11041
|
+
const payload = accessToken.split(".")[1];
|
|
11042
|
+
if (!payload) return [];
|
|
11043
|
+
try {
|
|
11044
|
+
const claims = JSON.parse(Buffer.from(payload, "base64url").toString());
|
|
11045
|
+
return claims.aud === void 0 ? [] : [claims.aud].flat();
|
|
11046
|
+
} catch {
|
|
11047
|
+
return [];
|
|
11048
|
+
}
|
|
11049
|
+
}
|
|
11050
|
+
function parseIncoming(message) {
|
|
11051
|
+
try {
|
|
11052
|
+
return JSON.parse(message);
|
|
11053
|
+
} catch {
|
|
11054
|
+
return {};
|
|
11055
|
+
}
|
|
11056
|
+
}
|
|
11057
|
+
async function mcpServe() {
|
|
11058
|
+
const { apiUrl, auth } = await getApi();
|
|
11059
|
+
const endpoint = `${apiUrl}/api/mcp`;
|
|
11060
|
+
if (auth.kind === "oauth" && !tokenAudiences(auth.accessToken).includes(endpoint)) {
|
|
11061
|
+
fail("This sign-in does not cover the MCP endpoint. Run `postonus login` again to grant it.");
|
|
11062
|
+
}
|
|
11063
|
+
const oauth = auth.kind === "oauth" ? { accessToken: auth.accessToken, refreshToken: auth.refreshToken, clientId: auth.clientId } : null;
|
|
11064
|
+
const send = oauth ? createOAuthFetch(apiUrl, oauth, persistRefreshedTokens(apiUrl, oauth)) : (request, init) => fetch(request, init);
|
|
11065
|
+
let protocolVersion;
|
|
11066
|
+
let sessionId;
|
|
11067
|
+
const write = (message) => process.stdout.write(`${message}
|
|
11068
|
+
`);
|
|
11069
|
+
const headersFor = (currentAuth) => new Headers({
|
|
11070
|
+
"content-type": "application/json",
|
|
11071
|
+
// Both, because the endpoint may answer either way and refuses a request
|
|
11072
|
+
// that accepts only one.
|
|
11073
|
+
accept: "application/json, text/event-stream",
|
|
11074
|
+
[CLI_VERSION_HEADER]: CLI_VERSION,
|
|
11075
|
+
...currentAuth.kind === "api-key" ? { "x-api-key": currentAuth.apiKey } : { authorization: `Bearer ${oauth?.accessToken}` },
|
|
11076
|
+
...protocolVersion ? { "mcp-protocol-version": protocolVersion } : {},
|
|
11077
|
+
...sessionId ? { "mcp-session-id": sessionId } : {}
|
|
11078
|
+
});
|
|
11079
|
+
async function forward(message) {
|
|
11080
|
+
const response = await send(
|
|
11081
|
+
new Request(endpoint, { method: "POST", headers: headersFor(auth), body: message }),
|
|
11082
|
+
{}
|
|
11083
|
+
);
|
|
11084
|
+
const returnedSession = response.headers.get("mcp-session-id");
|
|
11085
|
+
if (returnedSession) sessionId = returnedSession;
|
|
11086
|
+
if (response.status === 202 || response.status === 204) return;
|
|
11087
|
+
const body = await response.text();
|
|
11088
|
+
if (!response.ok) {
|
|
11089
|
+
throw new Error(`${endpoint} answered ${response.status}: ${body.slice(0, 400)}`);
|
|
11090
|
+
}
|
|
11091
|
+
for (const frame of decodeMessages(response.headers.get("content-type"), body)) {
|
|
11092
|
+
write(frame);
|
|
11093
|
+
try {
|
|
11094
|
+
const parsed = JSON.parse(frame);
|
|
11095
|
+
if (typeof parsed.result?.protocolVersion === "string") protocolVersion = parsed.result.protocolVersion;
|
|
11096
|
+
} catch {
|
|
11097
|
+
}
|
|
11098
|
+
}
|
|
11099
|
+
}
|
|
11100
|
+
const lines = createInterface({ input: process.stdin });
|
|
11101
|
+
const inFlight = /* @__PURE__ */ new Set();
|
|
11102
|
+
for await (const line of lines) {
|
|
11103
|
+
if (line.trim().length === 0) continue;
|
|
11104
|
+
const incoming = parseIncoming(line);
|
|
11105
|
+
const pending = forward(line).catch((error2) => {
|
|
11106
|
+
const id = incoming.id ?? null;
|
|
11107
|
+
const detail = error2 instanceof Error ? error2.message : String(error2);
|
|
11108
|
+
if (id === null) {
|
|
11109
|
+
process.stderr.write(`postonus mcp: ${detail}
|
|
11110
|
+
`);
|
|
11111
|
+
return;
|
|
11112
|
+
}
|
|
11113
|
+
write(JSON.stringify({ jsonrpc: "2.0", id, error: { code: -32603, message: detail } }));
|
|
11114
|
+
}).finally(() => inFlight.delete(pending));
|
|
11115
|
+
inFlight.add(pending);
|
|
11116
|
+
if (incoming.method === "initialize") await pending;
|
|
11117
|
+
}
|
|
11118
|
+
await Promise.allSettled([...inFlight]);
|
|
11119
|
+
}
|
|
11120
|
+
|
|
11010
11121
|
// src/commands/post.ts
|
|
11011
11122
|
import { spawnSync } from "child_process";
|
|
11012
11123
|
import { mkdtemp, readFile as readFile2, rm as rm2, writeFile as writeFile2 } from "fs/promises";
|
|
@@ -11122,7 +11233,7 @@ async function post(text, options) {
|
|
|
11122
11233
|
{
|
|
11123
11234
|
content,
|
|
11124
11235
|
scheduledAt,
|
|
11125
|
-
media: media2.map((item) => ({ url: item.url, type: item.type,
|
|
11236
|
+
media: media2.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId }))
|
|
11126
11237
|
}
|
|
11127
11238
|
],
|
|
11128
11239
|
shared: { selectedIntegrations: integrationIds },
|
|
@@ -11168,6 +11279,14 @@ var DAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
|
11168
11279
|
|
|
11169
11280
|
// src/commands/queue.tsx
|
|
11170
11281
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
11282
|
+
function parseScheduleStatus(value2) {
|
|
11283
|
+
const normalised = value2.trim().toUpperCase();
|
|
11284
|
+
const match = SCHEDULE_STATUS_VALUES.find((status) => status === normalised);
|
|
11285
|
+
if (!match) {
|
|
11286
|
+
failUsage(`Unknown status "${value2}". Supported: ${SCHEDULE_STATUS_VALUES.join(", ").toLowerCase()}`);
|
|
11287
|
+
}
|
|
11288
|
+
return match;
|
|
11289
|
+
}
|
|
11171
11290
|
var HEADERS2 = ["WHEN", "PLATFORM", "CHANNEL", "STATUS", "CONTENT", "SCHEDULE ID"];
|
|
11172
11291
|
function formatWhen(scheduledAt) {
|
|
11173
11292
|
if (!scheduledAt) return "\u2014";
|
|
@@ -11188,7 +11307,7 @@ async function listQueue(options) {
|
|
|
11188
11307
|
failUsage("--limit must be between 10 and 100.");
|
|
11189
11308
|
}
|
|
11190
11309
|
const platforms = (options.to ?? "").split(",").map((value2) => value2.trim()).filter(Boolean).map(parsePlatform);
|
|
11191
|
-
const statuses = (options.status ?? "").split(",").map((value2) => value2.trim()
|
|
11310
|
+
const statuses = (options.status ?? "").split(",").map((value2) => value2.trim()).filter(Boolean).map(parseScheduleStatus);
|
|
11192
11311
|
const { api } = await getApi();
|
|
11193
11312
|
let schedules;
|
|
11194
11313
|
try {
|
|
@@ -11198,7 +11317,9 @@ async function listQueue(options) {
|
|
|
11198
11317
|
direction: "forward",
|
|
11199
11318
|
platforms: platforms.length > 0 ? platforms : void 0,
|
|
11200
11319
|
// Default to what "queue" means to a user: not-yet-published work.
|
|
11201
|
-
|
|
11320
|
+
// `PENDING` is not one of them — no such schedule status has ever
|
|
11321
|
+
// existed, and asking for it made every default `queue list` a 500.
|
|
11322
|
+
statuses: statuses.length > 0 ? statuses : ["SCHEDULED", "PUBLISHING"]
|
|
11202
11323
|
});
|
|
11203
11324
|
schedules = result.schedules;
|
|
11204
11325
|
} catch (error2) {
|
|
@@ -11274,7 +11395,12 @@ Examples:
|
|
|
11274
11395
|
$ postonus post "shipping today" --to x,linkedin --optimal
|
|
11275
11396
|
$ postonus post --file notes.md --to linkedin --at 2026-08-01T09:30:00Z
|
|
11276
11397
|
$ postonus queue list --json | jq '.queue[].scheduledAt'
|
|
11277
|
-
$ postonus media upload ./demo.mp4
|
|
11398
|
+
$ postonus media upload ./demo.mp4
|
|
11399
|
+
|
|
11400
|
+
MCP:
|
|
11401
|
+
Add this to an editor that spawns MCP servers (Cursor, Claude Desktop):
|
|
11402
|
+
"postonus": { "command": "postonus", "args": ["mcp"] }
|
|
11403
|
+
It reuses this machine's stored login \u2014 the editor runs no OAuth of its own.`
|
|
11278
11404
|
).hook("preAction", (command) => {
|
|
11279
11405
|
setGlobalOptions(command.opts());
|
|
11280
11406
|
});
|
|
@@ -11291,6 +11417,7 @@ queue.command("list").alias("ls").description("list upcoming scheduled posts").a
|
|
|
11291
11417
|
queue.command("move").description("reschedule one queued post").argument("<scheduleId>", "schedule id from `postonus queue list`").requiredOption("-a, --at <time>", "new ISO timestamp").action(moveQueueItem);
|
|
11292
11418
|
var media = program.command("media").description("upload media for use in posts");
|
|
11293
11419
|
media.command("upload").description("upload one or more local files").argument("<paths...>", "local image or video paths").action(uploadCommand);
|
|
11420
|
+
program.command("mcp").description("serve the Postonus MCP tools over stdio for an editor").action(mcpServe);
|
|
11294
11421
|
try {
|
|
11295
11422
|
await program.parseAsync(process.argv);
|
|
11296
11423
|
} catch (error2) {
|