linkedin-relay-mcp 3.3.0 → 3.4.0
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/.claude/skills/linkedin-relay/SKILL.md +4 -1
- package/dist/cli.js +195 -60
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +1 -1
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
|
@@ -187,7 +187,7 @@ Writes are **not on the MCP surface**. They exist only as CLI commands:
|
|
|
187
187
|
|
|
188
188
|
| command | does |
|
|
189
189
|
|---|---|
|
|
190
|
-
| `lnrelay share "<text>" [--image <path> ... [--alt "
|
|
190
|
+
| `lnrelay share "<text>" [--image <path> ... [--alt "…" ...] \| --video <path> \| --document <pdf> --title "…"] [--at "YYYY-MM-DD HH:MM"]` | post to their own feed — up to 20 images, one video, or one PDF; `--at` schedules it and LinkedIn publishes it then |
|
|
191
191
|
| `lnrelay comment <activity-urn> "<text>"` | comment on a post |
|
|
192
192
|
| `lnrelay reply <comment-urn> "<text>"` | reply, nested under that comment |
|
|
193
193
|
| `lnrelay edit <comment-urn> "<text>"` | change the text of their own comment |
|
|
@@ -225,6 +225,9 @@ Things worth telling a user who asks:
|
|
|
225
225
|
needed at all: `docs/DECISION-writes.md`.
|
|
226
226
|
- `--image` / `--video` upload over the private API only; `--via oauth` with media is refused. A
|
|
227
227
|
video post comes back as a `urn:li:ugcPost:` rather than `urn:li:share:`.
|
|
228
|
+
- A scheduled post gets its urn immediately; `lnrelay delete <urn>` cancels it before it publishes.
|
|
229
|
+
`--at` without an offset is the machine's local time — say the time back to the user in the
|
|
230
|
+
preview's own words, which name the timezone.
|
|
228
231
|
- **Deleting a comment also deletes every reply under it**, including other people's. Verified live.
|
|
229
232
|
|
|
230
233
|
Connecting and messaging do not exist at all, in any surface. They are the actions where the
|
package/dist/cli.js
CHANGED
|
@@ -2154,7 +2154,9 @@ var TYPES = {
|
|
|
2154
2154
|
gif: { kind: "IMAGE", contentType: "image/gif" },
|
|
2155
2155
|
webp: { kind: "IMAGE", contentType: "image/webp" },
|
|
2156
2156
|
mp4: { kind: "VIDEO", contentType: "video/mp4" },
|
|
2157
|
-
mov: { kind: "VIDEO", contentType: "video/quicktime" }
|
|
2157
|
+
mov: { kind: "VIDEO", contentType: "video/quicktime" },
|
|
2158
|
+
// LinkedIn also takes ppt/pptx/doc/docx; only pdf has been verified here.
|
|
2159
|
+
pdf: { kind: "DOCUMENT", contentType: "application/pdf" }
|
|
2158
2160
|
};
|
|
2159
2161
|
function mediaKindOf(filename) {
|
|
2160
2162
|
const ext = /\.([a-z0-9]+)$/i.exec(filename)?.[1]?.toLowerCase();
|
|
@@ -2162,7 +2164,7 @@ function mediaKindOf(filename) {
|
|
|
2162
2164
|
}
|
|
2163
2165
|
function registerPayload(kind, fileSize, filename) {
|
|
2164
2166
|
return {
|
|
2165
|
-
mediaUploadType: kind
|
|
2167
|
+
mediaUploadType: `${kind}_SHARING`,
|
|
2166
2168
|
fileSize,
|
|
2167
2169
|
filename
|
|
2168
2170
|
};
|
|
@@ -2231,20 +2233,27 @@ async function uploadMedia(file, client) {
|
|
|
2231
2233
|
// src/engine/voyager-write.ts
|
|
2232
2234
|
var VOYAGER2 = "https://www.linkedin.com/voyager/api";
|
|
2233
2235
|
var SHARE_URL = `${VOYAGER2}/contentcreation/normShares`;
|
|
2234
|
-
|
|
2236
|
+
var CATEGORY = {
|
|
2237
|
+
IMAGE: "IMAGE",
|
|
2238
|
+
VIDEO: "VIDEO",
|
|
2239
|
+
DOCUMENT: "NATIVE_DOCUMENT"
|
|
2240
|
+
};
|
|
2241
|
+
function sharePayload(text2, visibility, media = [], scheduledAt) {
|
|
2242
|
+
const schedule = scheduledAt === void 0 ? { postState: "PUBLISHED" } : { postState: "SCHEDULED", scheduledAt };
|
|
2235
2243
|
return {
|
|
2236
2244
|
visibleToConnectionsOnly: visibility === "CONNECTIONS",
|
|
2237
2245
|
externalAudienceProviders: [],
|
|
2238
2246
|
commentaryV2: { text: text2, attributes: [] },
|
|
2239
2247
|
origin: "FEED",
|
|
2240
2248
|
allowedCommentersScope: "ALL",
|
|
2241
|
-
|
|
2249
|
+
...schedule,
|
|
2242
2250
|
// altText only when given, so a post without it keeps the body verified in 2026-08.
|
|
2243
2251
|
media: media.map((m) => ({
|
|
2244
|
-
category: m.category,
|
|
2252
|
+
category: CATEGORY[m.category],
|
|
2245
2253
|
mediaUrn: m.urn,
|
|
2246
2254
|
tapTargets: [],
|
|
2247
|
-
...m.alt === void 0 ? {} : { altText: m.alt }
|
|
2255
|
+
...m.alt === void 0 ? {} : { altText: m.alt },
|
|
2256
|
+
...m.title === void 0 ? {} : { title: { text: m.title } }
|
|
2248
2257
|
}))
|
|
2249
2258
|
};
|
|
2250
2259
|
}
|
|
@@ -2311,10 +2320,16 @@ async function share(confirmed, client, bytes) {
|
|
|
2311
2320
|
media.push({
|
|
2312
2321
|
category: a.kind,
|
|
2313
2322
|
urn: uploaded.urn,
|
|
2314
|
-
...a.alt === void 0 ? {} : { alt: a.alt }
|
|
2323
|
+
...a.alt === void 0 ? {} : { alt: a.alt },
|
|
2324
|
+
...a.title === void 0 ? {} : { title: a.title }
|
|
2315
2325
|
});
|
|
2316
2326
|
}
|
|
2317
|
-
const body = sharePayload(
|
|
2327
|
+
const body = sharePayload(
|
|
2328
|
+
confirmed.payload.text,
|
|
2329
|
+
confirmed.payload.visibility,
|
|
2330
|
+
media,
|
|
2331
|
+
confirmed.payload.scheduledAt
|
|
2332
|
+
);
|
|
2318
2333
|
const result = await client.request({
|
|
2319
2334
|
url: SHARE_URL,
|
|
2320
2335
|
method: "POST",
|
|
@@ -2427,7 +2442,8 @@ function previewLines2(post) {
|
|
|
2427
2442
|
if (post === void 0) {
|
|
2428
2443
|
return [
|
|
2429
2444
|
"content COULD NOT READ THIS POST.",
|
|
2430
|
-
" It is not among your recent posts. That
|
|
2445
|
+
" It is not among your recent published posts. That is expected for a",
|
|
2446
|
+
" scheduled post (deleting one cancels it), and may also mean it is older",
|
|
2431
2447
|
" than the page fetched \u2014 but nothing here has verified what you are",
|
|
2432
2448
|
" about to delete, or that it is yours."
|
|
2433
2449
|
];
|
|
@@ -3325,7 +3341,7 @@ var COMMANDS = [
|
|
|
3325
3341
|
name: "share",
|
|
3326
3342
|
cost: "1 call \u2014 write",
|
|
3327
3343
|
summary: "Post to your own feed. Prefers LinkedIn's official OAuth scope, falls back to the private API when no token exists \u2014 the prompt always names which.",
|
|
3328
|
-
usage: 'lnrelay share "<text>" [--image <path> ... | --video <path>
|
|
3344
|
+
usage: 'lnrelay share "<text>" [--image <path> ... [--alt "<text>" ...] | --video <path>\n | --document <pdf> --title "<title>"] [--at "YYYY-MM-DD HH:MM"]\n [--visibility public|connections] [--via oauth|voyager] [--plan | --confirm <token>]\n Approval follows `lnrelay approval`: --plan previews and returns a token without\n sending; --confirm <token> sends it in agent mode. In interactive mode it asks at a\n terminal. --image repeats for up to 20, --alt pairs with it by position (--alt ""\n skips one). --at schedules it (local time, or ISO 8601 with an offset; at least 10\n minutes out); LinkedIn publishes it then, and `lnrelay delete <urn>` cancels it.\n Files, documents and scheduling go over the private API only.',
|
|
3329
3345
|
audience: ["cli"],
|
|
3330
3346
|
risk: "write",
|
|
3331
3347
|
implemented: true
|
|
@@ -3956,20 +3972,53 @@ async function gate(command, plan, ctx, deps) {
|
|
|
3956
3972
|
if ("ok" in gated) return gated;
|
|
3957
3973
|
return { confirmed: gated.confirmed };
|
|
3958
3974
|
}
|
|
3975
|
+
var FLAG_KIND = {
|
|
3976
|
+
image: "IMAGE",
|
|
3977
|
+
video: "VIDEO",
|
|
3978
|
+
document: "DOCUMENT"
|
|
3979
|
+
};
|
|
3980
|
+
var KIND_FLAG = {
|
|
3981
|
+
IMAGE: "--image",
|
|
3982
|
+
VIDEO: "--video",
|
|
3983
|
+
DOCUMENT: "--document"
|
|
3984
|
+
};
|
|
3985
|
+
var KIND_WORD = {
|
|
3986
|
+
IMAGE: "image ",
|
|
3987
|
+
VIDEO: "video ",
|
|
3988
|
+
DOCUMENT: "document"
|
|
3989
|
+
};
|
|
3959
3990
|
function mediaLines(media) {
|
|
3960
|
-
return media.flatMap(({ filename, kind, size, sha256, alt }) => [
|
|
3961
|
-
`${kind
|
|
3962
|
-
...alt === void 0 ? [] : [` alt "${alt}"`]
|
|
3991
|
+
return media.flatMap(({ filename, kind, size, sha256, alt, title }) => [
|
|
3992
|
+
`${KIND_WORD[kind]} ${filename} (${Math.ceil(size / 1024)} KB, sha256 ${sha256.slice(0, 12)})`,
|
|
3993
|
+
...alt === void 0 ? [] : [` alt "${alt}"`],
|
|
3994
|
+
...title === void 0 ? [] : [` title "${title}"`]
|
|
3963
3995
|
]);
|
|
3964
3996
|
}
|
|
3965
3997
|
var MAX_IMAGES = 20;
|
|
3966
|
-
function
|
|
3998
|
+
function mediaRequestError(media) {
|
|
3967
3999
|
const alts = media.alts ?? [];
|
|
3968
|
-
|
|
3969
|
-
|
|
4000
|
+
const single = media.flag !== "image";
|
|
4001
|
+
if (single && media.paths.length > 1) {
|
|
4002
|
+
return err(
|
|
4003
|
+
"share",
|
|
4004
|
+
"INVALID_INPUT",
|
|
4005
|
+
`a post carries one ${media.flag}`,
|
|
4006
|
+
`pass a single --${media.flag}`
|
|
4007
|
+
);
|
|
3970
4008
|
}
|
|
3971
|
-
if (media.flag
|
|
3972
|
-
return err("share", "INVALID_INPUT",
|
|
4009
|
+
if (media.flag !== "image" && alts.length > 0) {
|
|
4010
|
+
return err("share", "INVALID_INPUT", `--alt applies to images, not a ${media.flag}`);
|
|
4011
|
+
}
|
|
4012
|
+
if (media.flag === "document" && (media.title ?? "").trim() === "") {
|
|
4013
|
+
return err(
|
|
4014
|
+
"share",
|
|
4015
|
+
"INVALID_INPUT",
|
|
4016
|
+
"a document needs a title",
|
|
4017
|
+
'pass --title "<what readers see above the document>"'
|
|
4018
|
+
);
|
|
4019
|
+
}
|
|
4020
|
+
if (media.flag !== "document" && media.title !== void 0) {
|
|
4021
|
+
return err("share", "INVALID_INPUT", "--title applies to a --document");
|
|
3973
4022
|
}
|
|
3974
4023
|
if (media.paths.length > MAX_IMAGES) {
|
|
3975
4024
|
return err("share", "INVALID_INPUT", `a post carries at most ${MAX_IMAGES} images`);
|
|
@@ -3982,48 +4031,54 @@ function loadAllMedia(media) {
|
|
|
3982
4031
|
'give one --alt per --image, in the same order; pass --alt "" for an image without one'
|
|
3983
4032
|
);
|
|
3984
4033
|
}
|
|
4034
|
+
return null;
|
|
4035
|
+
}
|
|
4036
|
+
function loadAllMedia(media) {
|
|
4037
|
+
const refused = mediaRequestError(media);
|
|
4038
|
+
if (refused !== null) return refused;
|
|
4039
|
+
const alts = media.alts ?? [];
|
|
3985
4040
|
const approved = [];
|
|
3986
4041
|
const bytes = [];
|
|
3987
4042
|
for (const [i, path] of media.paths.entries()) {
|
|
3988
|
-
const one = loadMedia(
|
|
4043
|
+
const one = loadMedia(media.flag, path);
|
|
3989
4044
|
if ("ok" in one) return one;
|
|
3990
4045
|
const alt = alts[i];
|
|
3991
|
-
|
|
4046
|
+
let a = alt === void 0 || alt === "" ? one.approved : { ...one.approved, alt };
|
|
4047
|
+
if (media.flag === "document") a = { ...a, title: (media.title ?? "").trim() };
|
|
4048
|
+
approved.push(a);
|
|
3992
4049
|
bytes.push(one.bytes);
|
|
3993
4050
|
}
|
|
3994
4051
|
return { approved, bytes };
|
|
3995
4052
|
}
|
|
3996
|
-
function loadMedia(
|
|
3997
|
-
const kind = mediaKindOf(
|
|
4053
|
+
function loadMedia(flag, path) {
|
|
4054
|
+
const kind = mediaKindOf(path);
|
|
3998
4055
|
if (kind === null) {
|
|
3999
4056
|
return err(
|
|
4000
4057
|
"share",
|
|
4001
4058
|
"INVALID_INPUT",
|
|
4002
|
-
`unsupported file type: ${basename(
|
|
4003
|
-
"images: png, jpg, jpeg, gif, webp. videos: mp4, mov."
|
|
4059
|
+
`unsupported file type: ${basename(path)}`,
|
|
4060
|
+
"images: png, jpg, jpeg, gif, webp. videos: mp4, mov. documents: pdf."
|
|
4004
4061
|
);
|
|
4005
4062
|
}
|
|
4006
|
-
|
|
4007
|
-
if (kind.kind !== expected) {
|
|
4008
|
-
const right = kind.kind === "IMAGE" ? "--image" : "--video";
|
|
4063
|
+
if (kind.kind !== FLAG_KIND[flag]) {
|
|
4009
4064
|
return err(
|
|
4010
4065
|
"share",
|
|
4011
4066
|
"INVALID_INPUT",
|
|
4012
|
-
`${basename(
|
|
4013
|
-
`pass it with ${
|
|
4067
|
+
`${basename(path)} is not ${flag === "image" ? "an image" : `a ${flag}`}`,
|
|
4068
|
+
`pass it with ${KIND_FLAG[kind.kind]}`
|
|
4014
4069
|
);
|
|
4015
4070
|
}
|
|
4016
4071
|
let bytes;
|
|
4017
4072
|
try {
|
|
4018
|
-
if (!statSync(
|
|
4019
|
-
bytes = new Uint8Array(readFileSync2(
|
|
4073
|
+
if (!statSync(path).isFile()) throw new Error("not a file");
|
|
4074
|
+
bytes = new Uint8Array(readFileSync2(path));
|
|
4020
4075
|
} catch {
|
|
4021
|
-
return err("share", "INVALID_INPUT", `cannot read ${
|
|
4076
|
+
return err("share", "INVALID_INPUT", `cannot read ${path}`);
|
|
4022
4077
|
}
|
|
4023
4078
|
return {
|
|
4024
4079
|
bytes,
|
|
4025
4080
|
approved: {
|
|
4026
|
-
filename: basename(
|
|
4081
|
+
filename: basename(path),
|
|
4027
4082
|
kind: kind.kind,
|
|
4028
4083
|
contentType: kind.contentType,
|
|
4029
4084
|
size: bytes.byteLength,
|
|
@@ -4031,14 +4086,25 @@ function loadMedia(media) {
|
|
|
4031
4086
|
}
|
|
4032
4087
|
};
|
|
4033
4088
|
}
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
if (
|
|
4089
|
+
function parseScheduleTime(input) {
|
|
4090
|
+
const iso = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
4091
|
+
if (iso.test(input)) {
|
|
4092
|
+
const t = Date.parse(input);
|
|
4093
|
+
return Number.isNaN(t) ? null : t;
|
|
4094
|
+
}
|
|
4095
|
+
const local = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2})$/.exec(input);
|
|
4096
|
+
if (local === null) return null;
|
|
4097
|
+
const [y, mo, d, h, mi] = local.slice(1).map(Number);
|
|
4098
|
+
const date = new Date(y, mo - 1, d, h, mi);
|
|
4099
|
+
const same = date.getFullYear() === y && date.getMonth() === mo - 1 && date.getDate() === d && date.getHours() === h && date.getMinutes() === mi;
|
|
4100
|
+
return same ? date.getTime() : null;
|
|
4101
|
+
}
|
|
4102
|
+
var MIN_LEAD_MS = 10 * 6e4;
|
|
4103
|
+
function mediaFrom(media, via2) {
|
|
4104
|
+
if (media === void 0 || media.paths.length === 0) return void 0;
|
|
4105
|
+
const loaded = loadAllMedia(media);
|
|
4106
|
+
if ("ok" in loaded) return loaded;
|
|
4107
|
+
if (via2 === "oauth") {
|
|
4042
4108
|
return err(
|
|
4043
4109
|
"share",
|
|
4044
4110
|
"NOT_IMPLEMENTED",
|
|
@@ -4046,22 +4112,83 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
|
|
|
4046
4112
|
"drop --via oauth, or pass --via voyager"
|
|
4047
4113
|
);
|
|
4048
4114
|
}
|
|
4049
|
-
|
|
4115
|
+
return loaded;
|
|
4116
|
+
}
|
|
4117
|
+
function scheduleFrom(at, now, via2) {
|
|
4118
|
+
if (at === void 0) return void 0;
|
|
4119
|
+
const t = parseScheduleTime(at);
|
|
4120
|
+
if (t === null) {
|
|
4121
|
+
return err(
|
|
4122
|
+
"share",
|
|
4123
|
+
"INVALID_INPUT",
|
|
4124
|
+
`cannot read --at '${at}'`,
|
|
4125
|
+
'use "YYYY-MM-DD HH:MM" (local time) or ISO 8601 with an offset, e.g. 2026-10-20T14:00+02:00'
|
|
4126
|
+
);
|
|
4127
|
+
}
|
|
4128
|
+
if (t < now + MIN_LEAD_MS) {
|
|
4129
|
+
return err(
|
|
4130
|
+
"share",
|
|
4131
|
+
"INVALID_INPUT",
|
|
4132
|
+
"--at must be at least 10 minutes from now",
|
|
4133
|
+
"to post right away, leave --at out"
|
|
4134
|
+
);
|
|
4135
|
+
}
|
|
4136
|
+
if (via2 === "oauth") {
|
|
4137
|
+
return err(
|
|
4138
|
+
"share",
|
|
4139
|
+
"NOT_IMPLEMENTED",
|
|
4140
|
+
"scheduling is only implemented over the private API",
|
|
4141
|
+
"drop --via oauth, or pass --via voyager"
|
|
4142
|
+
);
|
|
4143
|
+
}
|
|
4144
|
+
return t;
|
|
4145
|
+
}
|
|
4146
|
+
function whenLine(at, now) {
|
|
4147
|
+
const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
4148
|
+
const local = new Date(at).toLocaleString("en-US", {
|
|
4149
|
+
weekday: "short",
|
|
4150
|
+
month: "short",
|
|
4151
|
+
day: "numeric",
|
|
4152
|
+
year: "numeric",
|
|
4153
|
+
hour: "2-digit",
|
|
4154
|
+
minute: "2-digit",
|
|
4155
|
+
hour12: false
|
|
4156
|
+
});
|
|
4157
|
+
const hours = Math.round((at - now) / 36e5);
|
|
4158
|
+
const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
|
|
4159
|
+
return `when ${local} (${zone}) \u2014 ${away}`;
|
|
4160
|
+
}
|
|
4161
|
+
async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at) {
|
|
4162
|
+
if (text2 === void 0 || text2.trim() === "") {
|
|
4163
|
+
return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
|
|
4164
|
+
}
|
|
4165
|
+
const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
|
|
4166
|
+
const scheduled = scheduleFrom(at, now, via2);
|
|
4167
|
+
if (typeof scheduled === "object") return scheduled;
|
|
4168
|
+
const scheduledAt = scheduled;
|
|
4169
|
+
const loaded = mediaFrom(media, via2);
|
|
4170
|
+
if (loaded !== void 0 && "ok" in loaded) return loaded;
|
|
4171
|
+
const voyagerOnly = loaded !== void 0 || scheduledAt !== void 0;
|
|
4172
|
+
const ctx = prepare(
|
|
4173
|
+
"share",
|
|
4174
|
+
now,
|
|
4175
|
+
voyagerOnly ? "voyager" : via2,
|
|
4176
|
+
2 * (loaded?.approved.length ?? 0) + 1
|
|
4177
|
+
);
|
|
4050
4178
|
if ("ok" in ctx) return ctx;
|
|
4051
|
-
const payload = {
|
|
4052
|
-
|
|
4053
|
-
visibility: vis
|
|
4054
|
-
};
|
|
4179
|
+
const payload = { text: text2, visibility: vis };
|
|
4180
|
+
if (scheduledAt !== void 0) payload.scheduledAt = scheduledAt;
|
|
4055
4181
|
const summary = [authorLine(ctx.transport), `content "${text2}"`, `audience ${vis}`];
|
|
4182
|
+
if (scheduledAt !== void 0) summary.push(whenLine(scheduledAt, now));
|
|
4056
4183
|
if (loaded !== void 0) {
|
|
4057
4184
|
payload.media = loaded.approved;
|
|
4058
4185
|
summary.push(...mediaLines(loaded.approved));
|
|
4059
4186
|
}
|
|
4060
4187
|
const plan = {
|
|
4061
|
-
action: "post to your feed",
|
|
4188
|
+
action: scheduledAt === void 0 ? "post to your feed" : "schedule a post",
|
|
4062
4189
|
payload,
|
|
4063
4190
|
summary,
|
|
4064
|
-
reversibility: "deletable with `lnrelay delete <urn>`, but it is public under your name the moment it lands and anyone who saw it cannot un-see it",
|
|
4191
|
+
reversibility: scheduledAt === void 0 ? "deletable with `lnrelay delete <urn>`, but it is public under your name the moment it lands and anyone who saw it cannot un-see it" : "cancel any time before it publishes with `lnrelay delete <urn>`; after that it is public under your name like any post",
|
|
4065
4192
|
transport: ctx.transport.kind
|
|
4066
4193
|
};
|
|
4067
4194
|
const gated = await gate("share", plan, ctx, deps);
|
|
@@ -4074,6 +4201,7 @@ async function runShare(text2, visibility, now = Date.now(), deps = terminalDeps
|
|
|
4074
4201
|
return ok("share", {
|
|
4075
4202
|
id: result.id ?? null,
|
|
4076
4203
|
transport: ctx.transport.kind,
|
|
4204
|
+
scheduledFor: scheduledAt === void 0 ? void 0 : new Date(scheduledAt).toISOString(),
|
|
4077
4205
|
url: "url" in result ? result.url : void 0,
|
|
4078
4206
|
note: "note" in result ? result.note : ctx.note
|
|
4079
4207
|
});
|
|
@@ -4512,27 +4640,33 @@ function share3(args, now, deps) {
|
|
|
4512
4640
|
"one of: oauth, voyager. Omit it to prefer OAuth and fall back to Voyager."
|
|
4513
4641
|
);
|
|
4514
4642
|
}
|
|
4515
|
-
for (const flag of ["image", "video", "alt"]) {
|
|
4643
|
+
for (const flag of ["image", "video", "document", "alt", "title", "at"]) {
|
|
4516
4644
|
if (args.flags[flag] === true) {
|
|
4517
|
-
return err("share", "INVALID_INPUT", `--${flag} needs a
|
|
4645
|
+
return err("share", "INVALID_INPUT", `--${flag} needs a value`);
|
|
4518
4646
|
}
|
|
4519
4647
|
}
|
|
4520
|
-
const
|
|
4521
|
-
|
|
4522
|
-
if (images.length > 0 && videos.length > 0) {
|
|
4648
|
+
const kinds = ["image", "video", "document"].map((flag) => ({ flag, paths: list(args, flag) })).filter((k) => k.paths.length > 0);
|
|
4649
|
+
if (kinds.length > 1) {
|
|
4523
4650
|
return err(
|
|
4524
4651
|
"share",
|
|
4525
4652
|
"INVALID_INPUT",
|
|
4526
|
-
|
|
4527
|
-
"pass --image <path> (repeatable) or a single --video <path>"
|
|
4653
|
+
`a post carries ${kinds.map((k) => `${k.flag}s`).join(" or ")}, not both`,
|
|
4654
|
+
"pass --image <path> (repeatable), or a single --video <path>, or a single --document <path>"
|
|
4528
4655
|
);
|
|
4529
4656
|
}
|
|
4530
4657
|
const alts = list(args, "alt");
|
|
4658
|
+
const title = str(args, "title");
|
|
4659
|
+
const chosen = kinds[0];
|
|
4531
4660
|
let media;
|
|
4532
|
-
if (
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4661
|
+
if (chosen !== void 0) {
|
|
4662
|
+
media = { flag: chosen.flag, paths: chosen.paths, alts };
|
|
4663
|
+
if (title !== void 0) media.title = title;
|
|
4664
|
+
} else if (alts.length > 0 || title !== void 0) {
|
|
4665
|
+
return err(
|
|
4666
|
+
"share",
|
|
4667
|
+
"INVALID_INPUT",
|
|
4668
|
+
"--alt and --title describe an attached file, and none was given"
|
|
4669
|
+
);
|
|
4536
4670
|
}
|
|
4537
4671
|
return runShare(
|
|
4538
4672
|
args.positionals[0],
|
|
@@ -4540,7 +4674,8 @@ function share3(args, now, deps) {
|
|
|
4540
4674
|
now,
|
|
4541
4675
|
deps,
|
|
4542
4676
|
surface,
|
|
4543
|
-
media
|
|
4677
|
+
media,
|
|
4678
|
+
str(args, "at")
|
|
4544
4679
|
);
|
|
4545
4680
|
}
|
|
4546
4681
|
export {
|