@curviate/cli 0.46.1 → 0.48.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/CHANGELOG.md +199 -1
- package/README.md +124 -77
- package/dist/{account-O5UX5UAH.js → account-WKQHMM7P.js} +41 -31
- package/dist/{chunk-BGZW6B7G.js → chunk-5I6JJJIV.js} +1 -0
- package/dist/{chunk-76E3O6HY.js → chunk-76SWLAZ6.js} +13 -0
- package/dist/chunk-AYKKXGTR.js +1141 -0
- package/dist/{chunk-TC4ZPUWI.js → chunk-CVMSQ3OF.js} +19 -80
- package/dist/{chunk-HOQ7EUHJ.js → chunk-FDJMAF7D.js} +1 -0
- package/dist/chunk-GQKC6E5K.js +36 -0
- package/dist/{chunk-FXF5FF3W.js → chunk-MKGVNDMJ.js} +10 -2
- package/dist/chunk-NNV2OYEF.js +23 -0
- package/dist/{chunk-UJOTQPL6.js → chunk-OHXYFICP.js} +47 -14
- package/dist/{chunk-2FECYCAC.js → chunk-Q63IIPL2.js} +3 -3
- package/dist/chunk-TSOIZBBU.js +41 -0
- package/dist/{chunk-DGIDAO2H.js → chunk-Y7K4UBFC.js} +1 -1
- package/dist/{chunk-LD6WPZZM.js → chunk-YFXLXION.js} +39 -34
- package/dist/chunk-ZYURL5VK.js +83 -0
- package/dist/cli.js +77 -97
- package/dist/{comment-BKGVJYS2.js → comment-7IQ6ZOJF.js} +30 -25
- package/dist/{company-F2AZTDPK.js → company-RD7RDGSA.js} +58 -53
- package/dist/{config-K4G3VSBA.js → config-EYBNYRGK.js} +13 -5
- package/dist/{connect-TX6PT7NV.js → connect-HVXT67A6.js} +42 -38
- package/dist/core-6XYGUNAY.js +46 -0
- package/dist/{doctor-USTZQ75D.js → doctor-HUXQERLQ.js} +9 -5
- package/dist/document-AUUCGST2.js +27 -0
- package/dist/draft-DFO22K6Q.js +463 -0
- package/dist/examples-64YT5V5K.js +53 -0
- package/dist/{exit-codes-TMAIV7EM.js → exit-codes-AW6KHDDN.js} +1 -1
- package/dist/{feed-ANBPRGFQ.js → feed-JWP6ANPI.js} +15 -11
- package/dist/{group-HFF7LDDQ.js → group-SIQFJEZV.js} +17 -13
- package/dist/{inbox-XQMGW6RT.js → inbox-MMIMCA5O.js} +23 -19
- package/dist/{inboxes-CILMIVVD.js → inboxes-RND3D4C7.js} +18 -14
- package/dist/{job-TOJDDJ2P.js → job-ACFKBLFK.js} +31 -27
- package/dist/{login-OHAHNBRW.js → login-ZOB5KVKQ.js} +10 -5
- package/dist/{message-WCBNBPAJ.js → message-OFK6UVXR.js} +10 -8
- package/dist/{notification-CJ3LEHFL.js → notification-KKGAZU7M.js} +19 -15
- package/dist/{post-OQWJRL4B.js → post-A5SBCFB2.js} +36 -31
- package/dist/{profile-GT6ZD37M.js → profile-4SOOQZ4K.js} +52 -48
- package/dist/{recruiter-ZKWG6QG3.js → recruiter-YN73STDP.js} +125 -122
- package/dist/{sales-nav-WV3YHYD6.js → sales-nav-JXF5RY2K.js} +41 -35
- package/dist/{search-VAZEQ2WJ.js → search-JAL242A2.js} +68 -58
- package/dist/{setup-GGXMHXAF.js → setup-WICWH4JG.js} +14 -9
- package/dist/{webhook-5M47UX6U.js → webhook-UGKVYWBC.js} +40 -42
- package/package.json +2 -2
- package/dist/chunk-KJ24DIAJ.js +0 -60
- package/dist/examples-IJL3A6SZ.js +0 -18
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/lib/stdin.ts
|
|
4
|
+
var STDIN_SENTINEL = "__curviate_stdin__";
|
|
5
|
+
async function defaultReadStdin() {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const chunks = [];
|
|
8
|
+
process.stdin.on("data", (chunk) => {
|
|
9
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
10
|
+
});
|
|
11
|
+
process.stdin.on("end", () => {
|
|
12
|
+
const full = Buffer.concat(chunks).toString("utf8");
|
|
13
|
+
resolve(full.replace(/\n+$/, ""));
|
|
14
|
+
});
|
|
15
|
+
process.stdin.on("error", reject);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function isStdinToken(value) {
|
|
19
|
+
return value === "-" || value === STDIN_SENTINEL;
|
|
20
|
+
}
|
|
21
|
+
function declaresStdinArg(def) {
|
|
22
|
+
return def?.stdinArg === true;
|
|
23
|
+
}
|
|
24
|
+
function restoreLiteralDashes(args, argsDef) {
|
|
25
|
+
const declaring = /* @__PURE__ */ new Set();
|
|
26
|
+
const positionalNames = [];
|
|
27
|
+
for (const [name, def] of Object.entries(argsDef)) {
|
|
28
|
+
if (def?.type === "positional") positionalNames.push(name);
|
|
29
|
+
if (!declaresStdinArg(def)) continue;
|
|
30
|
+
declaring.add(name);
|
|
31
|
+
const alias = def.alias;
|
|
32
|
+
if (typeof alias === "string") declaring.add(alias);
|
|
33
|
+
else if (Array.isArray(alias)) for (const a of alias) declaring.add(a);
|
|
34
|
+
}
|
|
35
|
+
const put = (value) => {
|
|
36
|
+
if (value === STDIN_SENTINEL) return "-";
|
|
37
|
+
if (Array.isArray(value)) return value.map((e) => e === STDIN_SENTINEL ? "-" : e);
|
|
38
|
+
return value;
|
|
39
|
+
};
|
|
40
|
+
for (const key of Object.keys(args)) {
|
|
41
|
+
if (key === "_" || declaring.has(key)) continue;
|
|
42
|
+
args[key] = put(args[key]);
|
|
43
|
+
}
|
|
44
|
+
const rest = args["_"];
|
|
45
|
+
if (Array.isArray(rest)) {
|
|
46
|
+
for (let i = 0; i < rest.length; i++) {
|
|
47
|
+
const name = positionalNames[i];
|
|
48
|
+
if (name !== void 0 && declaring.has(name)) continue;
|
|
49
|
+
if (rest[i] === STDIN_SENTINEL) rest[i] = "-";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function assertNoStdinPlaceholder(where, values) {
|
|
54
|
+
if (!values.some((v) => typeof v === "string" && v.includes(STDIN_SENTINEL))) return;
|
|
55
|
+
process.stderr.write(
|
|
56
|
+
`error: refusing to continue. ${where} contains "${STDIN_SENTINEL}", the internal placeholder the CLI substitutes for a bare "-" while it parses arguments.
|
|
57
|
+
`
|
|
58
|
+
);
|
|
59
|
+
process.stderr.write(
|
|
60
|
+
`hint: that placeholder means "read this value from stdin" and must never leave the process. Check the value you supplied, including environment variables such as CURVIATE_ACCOUNT and CURVIATE_API_KEY. If you did not supply it yourself, this is a bug in the CLI. Nothing was sent or written.
|
|
61
|
+
`
|
|
62
|
+
);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
async function resolveTextOrStdin(rawText, out, readStdin) {
|
|
66
|
+
if (!isStdinToken(rawText)) return rawText;
|
|
67
|
+
const reader = readStdin ?? defaultReadStdin;
|
|
68
|
+
const text = await reader();
|
|
69
|
+
if (!text) {
|
|
70
|
+
out.stderr.write("error: stdin: empty input\n");
|
|
71
|
+
process.exit(2);
|
|
72
|
+
}
|
|
73
|
+
return text;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
STDIN_SENTINEL,
|
|
78
|
+
defaultReadStdin,
|
|
79
|
+
isStdinToken,
|
|
80
|
+
restoreLiteralDashes,
|
|
81
|
+
assertNoStdinPlaceholder,
|
|
82
|
+
resolveTextOrStdin
|
|
83
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
intFlag
|
|
4
|
+
} from "./chunk-NNV2OYEF.js";
|
|
2
5
|
import {
|
|
3
6
|
SECRET_FLAGS
|
|
4
7
|
} from "./chunk-TCUYH5GO.js";
|
|
5
8
|
import {
|
|
6
9
|
GLOBAL_FLAGS,
|
|
7
|
-
|
|
10
|
+
STATE_WRITES,
|
|
8
11
|
parseBetaFlag,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
setBetaOverride,
|
|
13
|
+
setWriteKind
|
|
14
|
+
} from "./chunk-CVMSQ3OF.js";
|
|
15
|
+
import {
|
|
16
|
+
lazy
|
|
17
|
+
} from "./chunk-GQKC6E5K.js";
|
|
18
|
+
import {
|
|
19
|
+
editDistance
|
|
20
|
+
} from "./chunk-FDJMAF7D.js";
|
|
21
|
+
import {
|
|
22
|
+
STDIN_SENTINEL,
|
|
23
|
+
restoreLiteralDashes
|
|
24
|
+
} from "./chunk-ZYURL5VK.js";
|
|
12
25
|
|
|
13
26
|
// src/main.ts
|
|
14
27
|
import { defineCommand } from "citty";
|
|
@@ -22,39 +35,29 @@ var main = defineCommand({
|
|
|
22
35
|
meta: {
|
|
23
36
|
name: "curviate",
|
|
24
37
|
version: pkg.version,
|
|
25
|
-
description: "Official command-line interface for the Curviate API."
|
|
38
|
+
description: "Official command-line interface for the Curviate API.",
|
|
39
|
+
seeAlso: [
|
|
40
|
+
"Skill plugin (judgement, playbooks): https://github.com/curviate/curviate-plugin",
|
|
41
|
+
"Reference: https://docs.curviate.com/reference/cli"
|
|
42
|
+
]
|
|
26
43
|
},
|
|
27
44
|
// Subcommand registry, names and descriptions are static for help rendering;
|
|
28
45
|
// the handler implementation is loaded lazily on first invocation.
|
|
29
46
|
subCommands: {
|
|
30
|
-
setup: () => import("./setup-
|
|
31
|
-
doctor: () => import("./doctor-
|
|
32
|
-
login: () => import("./login-
|
|
33
|
-
config: () => import("./config-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
connect: () => import("./connect-TX6PT7NV.js").then((m) => m.connectCommand),
|
|
41
|
-
search: () => import("./search-VAZEQ2WJ.js").then((m) => m.searchCommand),
|
|
42
|
-
inbox: () => import("./inbox-XQMGW6RT.js").then((m) => m.inboxCommand),
|
|
43
|
-
inboxes: () => import("./inboxes-CILMIVVD.js").then((m) => m.inboxesCommand),
|
|
44
|
-
message: () => import("./message-WCBNBPAJ.js").then((m) => m.messageCommand),
|
|
45
|
-
post: () => import("./post-OQWJRL4B.js").then((m) => m.postCommand),
|
|
46
|
-
comment: () => import("./comment-BKGVJYS2.js").then((m) => m.commentCommand),
|
|
47
|
-
account: () => import("./account-O5UX5UAH.js").then((m) => m.accountCommand),
|
|
48
|
-
webhook: () => import("./webhook-5M47UX6U.js").then((m) => m.webhookCommand),
|
|
49
|
-
"sales-nav": () => import("./sales-nav-WV3YHYD6.js").then((m) => m.salesNavCommand),
|
|
50
|
-
recruiter: () => import("./recruiter-ZKWG6QG3.js").then((m) => m.recruiterCommand),
|
|
51
|
-
group: () => import("./group-HFF7LDDQ.js").then((m) => m.groupCommand),
|
|
52
|
-
feed: () => import("./feed-ANBPRGFQ.js").then((m) => m.feedCommand),
|
|
53
|
-
notification: () => import("./notification-CJ3LEHFL.js").then((m) => m.notificationCommand)
|
|
47
|
+
setup: lazy("setup", () => import("./setup-WICWH4JG.js").then((m) => m.setupCommand)),
|
|
48
|
+
doctor: lazy("doctor", () => import("./doctor-HUXQERLQ.js").then((m) => m.doctorCommand)),
|
|
49
|
+
login: lazy("login", () => import("./login-ZOB5KVKQ.js").then((m) => m.loginCommand)),
|
|
50
|
+
config: lazy("config", () => import("./config-EYBNYRGK.js").then((m) => m.configCommand)),
|
|
51
|
+
account: lazy("account", () => import("./account-WKQHMM7P.js").then((m) => m.accountCommand)),
|
|
52
|
+
webhook: lazy("webhook", () => import("./webhook-UGKVYWBC.js").then((m) => m.webhookCommand)),
|
|
53
|
+
// The LinkedIn building blocks. Reserved product groups
|
|
54
|
+
// (motion, contact, unibox, network, analytics, notification, team) land
|
|
55
|
+
// between `account` and `webhook` with their owning specs.
|
|
56
|
+
core: lazy("core", () => import("./core-6XYGUNAY.js").then((m) => m.coreCommand))
|
|
54
57
|
},
|
|
55
58
|
async run() {
|
|
56
|
-
const {
|
|
57
|
-
await
|
|
59
|
+
const { showHelp } = await import("./examples-64YT5V5K.js");
|
|
60
|
+
await showHelp(main, ["curviate"]);
|
|
58
61
|
}
|
|
59
62
|
});
|
|
60
63
|
|
|
@@ -92,46 +95,9 @@ function shownFlag(flag, index) {
|
|
|
92
95
|
const runsOn = !SECRET_FLAGS.includes(name) && SECRET_FLAGS.some((secret) => name.startsWith(secret));
|
|
93
96
|
return runsOn ? `at ${argumentAt(index)}` : `\`${flag}\``;
|
|
94
97
|
}
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
list: "`post list` was removed. Use `post user-posts <user_id>` (accepts `me`).",
|
|
98
|
-
comment: "post comments are their own group now. Use `comment add <post_id> <text>`.",
|
|
99
|
-
comments: "post comments are their own group now. Use `comment list <post_id>`."
|
|
100
|
-
},
|
|
101
|
-
connect: {
|
|
102
|
-
respond: "`connect respond` was split. Use `connect accept <id>` or `connect decline <id>`."
|
|
103
|
-
},
|
|
104
|
-
profile: {
|
|
105
|
-
connections: "`profile connections` was renamed. Use `profile relations`."
|
|
106
|
-
},
|
|
107
|
-
account: {
|
|
108
|
-
"connect-link": "`account connect-link` was removed. Use `account link [--account-id <id>]`.",
|
|
109
|
-
"reconnect-link": "`account reconnect-link` was removed. Use `account link [--account-id <id>]`.",
|
|
110
|
-
reconnect: "`account reconnect` was removed. Use `account link [--account-id <id>]`."
|
|
111
|
-
},
|
|
112
|
-
inbox: {
|
|
113
|
-
sync: "`inbox sync` was removed. History syncs automatically; just read `inbox messages <chat_id>`.",
|
|
114
|
-
"sync-chat": "`inbox sync-chat` was removed. History syncs automatically; just read `inbox messages <chat_id>`."
|
|
115
|
-
},
|
|
116
|
-
recruiter: {
|
|
117
|
-
"add-candidate": "`recruiter add-candidate` was renamed. Use `recruiter save-candidate <project_id> --stage-id <id> --candidate-id <id>`.",
|
|
118
|
-
"project-jobs": "`recruiter project-jobs` was renamed. Use `recruiter project-job get <project_id>`.",
|
|
119
|
-
sync: "`recruiter sync` was removed. Recruiter data syncs automatically now.",
|
|
120
|
-
"add-applicant": "`recruiter add-applicant` was removed with no replacement.",
|
|
121
|
-
"reject-applicant": "`recruiter reject-applicant` was removed with no replacement."
|
|
122
|
-
},
|
|
123
|
-
"sales-nav": {
|
|
124
|
-
sync: "`sales-nav sync` was removed. Sales Navigator data syncs automatically now."
|
|
125
|
-
},
|
|
126
|
-
webhook: {
|
|
127
|
-
"state-diff": "`webhook state-diff` was removed with no replacement."
|
|
128
|
-
}
|
|
98
|
+
var REFUSED_TOKENS = {
|
|
99
|
+
"curviate core connect": /* @__PURE__ */ new Set(["respond"])
|
|
129
100
|
};
|
|
130
|
-
function successorHint(group, token) {
|
|
131
|
-
const groupMap = REMOVED_COMMANDS[group];
|
|
132
|
-
if (!groupMap || !Object.prototype.hasOwnProperty.call(groupMap, token)) return null;
|
|
133
|
-
return groupMap[token] ?? null;
|
|
134
|
-
}
|
|
135
101
|
async function resolveValue(input) {
|
|
136
102
|
return typeof input === "function" ? input() : input;
|
|
137
103
|
}
|
|
@@ -249,10 +215,8 @@ async function assertLeafConsumesPositionals(leaf, leafArgs, path, siblings) {
|
|
|
249
215
|
const form = renderPath(path);
|
|
250
216
|
const arity = arityPhrase(await nodePositionalCount(leaf));
|
|
251
217
|
const hint = siblings && Object.prototype.hasOwnProperty.call(siblings, token) ? `Did you mean \`${renderPath([...path.slice(0, -1), token])}\`?` : void 0;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
hint
|
|
255
|
-
);
|
|
218
|
+
helpFor = form;
|
|
219
|
+
usageError(`unexpected ${shown} after \`${form}\`. \`${form}\` takes ${arity}.`, hint);
|
|
256
220
|
}
|
|
257
221
|
async function declaredArgNames(cmd) {
|
|
258
222
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -273,17 +237,22 @@ function dropFalsePreview(args, walk, declared) {
|
|
|
273
237
|
);
|
|
274
238
|
return drop.size ? args.filter((_, i) => !drop.has(i)) : args;
|
|
275
239
|
}
|
|
276
|
-
function findUnknownFlag(flags, declared, booleans) {
|
|
240
|
+
function findUnknownFlag(flags, declared, booleans, flagNames) {
|
|
277
241
|
for (const { token, name, index } of flags) {
|
|
278
242
|
const dashes = /^-*/.exec(token)[0].length;
|
|
279
243
|
if (dashes === 2 || dashes === 1 && name.length === 1) {
|
|
280
244
|
if (declared.has(name)) continue;
|
|
281
245
|
if (name.startsWith("no-") && booleans.has(name.slice(3))) continue;
|
|
282
246
|
}
|
|
283
|
-
|
|
247
|
+
const shown = shownFlag(token.split("=")[0], index);
|
|
248
|
+
return { shown, hint: shown.startsWith("`") ? nearestFlag(name.split("=")[0], flagNames) : null };
|
|
284
249
|
}
|
|
285
250
|
return null;
|
|
286
251
|
}
|
|
252
|
+
function nearestFlag(name, declared) {
|
|
253
|
+
const near = [...declared].filter((d) => d.length > 1 && editDistance(name, d) <= 2);
|
|
254
|
+
return near.length === 1 ? near[0] : null;
|
|
255
|
+
}
|
|
287
256
|
function hasEmptyFields(rawArgs) {
|
|
288
257
|
for (let i = 0; i < rawArgs.length; i++) {
|
|
289
258
|
const arg = rawArgs[i];
|
|
@@ -318,9 +287,12 @@ function usageError(message, hint) {
|
|
|
318
287
|
`);
|
|
319
288
|
if (hint) process.stderr.write(`hint: ${hint}
|
|
320
289
|
`);
|
|
321
|
-
process.stderr.write(
|
|
290
|
+
process.stderr.write(helpPointer());
|
|
322
291
|
process.exit(2);
|
|
323
292
|
}
|
|
293
|
+
var helpFor = "curviate";
|
|
294
|
+
var helpPointer = () => `Run \`${helpFor} --help\` for usage.
|
|
295
|
+
`;
|
|
324
296
|
async function resolveLeaf(cmd, rawArgs, descent) {
|
|
325
297
|
const here = descent ?? { path: [await nodeName(cmd)] };
|
|
326
298
|
const subCommands = await resolveValue(cmd.subCommands);
|
|
@@ -339,11 +311,8 @@ async function resolveLeaf(cmd, rawArgs, descent) {
|
|
|
339
311
|
siblings: subCommands
|
|
340
312
|
});
|
|
341
313
|
}
|
|
342
|
-
if (token !== void 0) {
|
|
343
|
-
|
|
344
|
-
if (hint) {
|
|
345
|
-
usageError(`unknown command at ${argumentAt(idx)}`, hint);
|
|
346
|
-
}
|
|
314
|
+
if (token !== void 0 && REFUSED_TOKENS[renderPath(here.path)]?.has(token)) {
|
|
315
|
+
usageError(`unknown command at ${argumentAt(idx)}`);
|
|
347
316
|
}
|
|
348
317
|
if (token !== void 0 && hasBarePositional) {
|
|
349
318
|
const extras = await extraPositionals(cmd, rawArgs);
|
|
@@ -357,27 +326,30 @@ async function resolveLeaf(cmd, rawArgs, descent) {
|
|
|
357
326
|
siblings: subCommands
|
|
358
327
|
});
|
|
359
328
|
}
|
|
360
|
-
const
|
|
329
|
+
const form = renderPath(here.path);
|
|
330
|
+
helpFor = form;
|
|
361
331
|
usageError(
|
|
362
|
-
`unexpected ${argumentAt(first.index)} after \`${
|
|
332
|
+
`unexpected ${argumentAt(first.index)} after \`${form}\`. It is neither a positional \`${form}\` accepts nor one of its subcommands.`
|
|
363
333
|
);
|
|
364
334
|
}
|
|
365
|
-
return { leaf: cmd, leafArgs: rawArgs };
|
|
335
|
+
return { leaf: cmd, leafArgs: rawArgs, path: here.path };
|
|
366
336
|
}
|
|
367
337
|
if (token !== void 0) {
|
|
368
338
|
usageError(`unknown command at ${argumentAt(idx)}`);
|
|
369
339
|
}
|
|
370
|
-
return { leaf: cmd, leafArgs: rawArgs };
|
|
340
|
+
return { leaf: cmd, leafArgs: rawArgs, path: here.path };
|
|
371
341
|
}
|
|
372
342
|
await assertLeafConsumesPositionals(cmd, rawArgs, here.path, here.siblings);
|
|
373
|
-
return { leaf: cmd, leafArgs: rawArgs };
|
|
343
|
+
return { leaf: cmd, leafArgs: rawArgs, path: here.path };
|
|
374
344
|
}
|
|
375
345
|
async function dispatch(root, rawArgs) {
|
|
346
|
+
helpFor = "curviate";
|
|
376
347
|
if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
|
|
377
|
-
const {
|
|
378
|
-
const {
|
|
379
|
-
await
|
|
380
|
-
|
|
348
|
+
const { leaf, path } = await resolveLeaf(root, rawArgs.filter((a) => a !== "--help" && a !== "-h"));
|
|
349
|
+
const { showHelp } = await import("./examples-64YT5V5K.js");
|
|
350
|
+
await showHelp(leaf, path);
|
|
351
|
+
await new Promise((done) => process.stdout.write("", () => done()));
|
|
352
|
+
process.exit(0);
|
|
381
353
|
}
|
|
382
354
|
const versionProbe = parseBetaFlag(rawArgs);
|
|
383
355
|
const versionArgs = versionProbe.ok ? versionProbe.rest : rawArgs;
|
|
@@ -396,20 +368,25 @@ async function dispatch(root, rawArgs) {
|
|
|
396
368
|
const argsAfterBeta = beta.ok ? beta.rest : rawArgs;
|
|
397
369
|
let hintLeaf;
|
|
398
370
|
try {
|
|
399
|
-
const { leaf, leafArgs: resolvedArgs } = await resolveLeaf(root, argsAfterBeta);
|
|
371
|
+
const { leaf, leafArgs: resolvedArgs, path: leafPath } = await resolveLeaf(root, argsAfterBeta);
|
|
400
372
|
hintLeaf = leaf;
|
|
373
|
+
helpFor = renderPath(leafPath);
|
|
401
374
|
if (hasEmptyFields(resolvedArgs)) {
|
|
402
375
|
usageError("--fields must not be empty.");
|
|
403
376
|
}
|
|
404
377
|
const booleanFlags = await booleanFlagNames(leaf);
|
|
405
378
|
const declared = await declaredArgNames(leaf);
|
|
379
|
+
const stateRecheck = STATE_WRITES[renderPath(leafPath)];
|
|
380
|
+
setWriteKind(stateRecheck ? "state" : declared.has("preview") ? "write" : "read", stateRecheck, renderPath(leafPath));
|
|
406
381
|
const leafArgs = dropFalsePreview(resolvedArgs, walkTokens(resolvedArgs, booleanFlags, declared), declared);
|
|
407
382
|
const walk = walkTokens(leafArgs, booleanFlags, declared);
|
|
408
|
-
const
|
|
383
|
+
const flagOnly = new Set(Object.entries(await resolveValue(leaf.args ?? {})).filter(([, d]) => d?.type !== "positional").map(([n]) => n));
|
|
384
|
+
const unknown = findUnknownFlag(walk.flags, declared, booleanFlags, flagOnly);
|
|
409
385
|
if (unknown !== null) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
386
|
+
if (unknown.shown === "`--preview`" && declared.has("beta")) {
|
|
387
|
+
usageError("--preview is only valid on write commands (mutations). Reads just run.");
|
|
388
|
+
}
|
|
389
|
+
usageError(`unknown flag ${unknown.shown}.`, unknown.hint ? `did you mean --${unknown.hint}?` : void 0);
|
|
413
390
|
}
|
|
414
391
|
const repeated = await repeatedFlag(leaf, walk.flags);
|
|
415
392
|
if (repeated !== null) {
|
|
@@ -428,6 +405,8 @@ async function dispatch(root, rawArgs) {
|
|
|
428
405
|
ctx.args,
|
|
429
406
|
leafArgsDef
|
|
430
407
|
);
|
|
408
|
+
const limit = ctx.args["limit"];
|
|
409
|
+
if (typeof limit === "string") intFlag("limit", limit);
|
|
431
410
|
return originalRun(ctx);
|
|
432
411
|
}
|
|
433
412
|
} : {}
|
|
@@ -445,9 +424,10 @@ async function dispatch(root, rawArgs) {
|
|
|
445
424
|
if (hint) process.stderr.write(`hint: --${missing}: ${hint}
|
|
446
425
|
`);
|
|
447
426
|
}
|
|
427
|
+
if (code === "EARG") process.stderr.write(helpPointer());
|
|
448
428
|
const { CurviateError } = await import("@curviate/sdk");
|
|
449
429
|
if (err instanceof CurviateError) {
|
|
450
|
-
const { getExitCode } = await import("./exit-codes-
|
|
430
|
+
const { getExitCode } = await import("./exit-codes-AW6KHDDN.js");
|
|
451
431
|
process.exit(getExitCode(err));
|
|
452
432
|
}
|
|
453
433
|
process.exit(code === "EARG" ? 2 : 1);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
resolveMemberOrMeProviderId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Y7K4UBFC.js";
|
|
5
5
|
import {
|
|
6
6
|
AttachError,
|
|
7
7
|
describeAttachment,
|
|
8
8
|
readAttachment,
|
|
9
9
|
toAttachmentPayload
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5I6JJJIV.js";
|
|
11
11
|
import "./chunk-UEAX6KUB.js";
|
|
12
12
|
import {
|
|
13
13
|
requireAccount
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Q63IIPL2.js";
|
|
15
15
|
import {
|
|
16
16
|
buildPreviewOutput
|
|
17
17
|
} from "./chunk-TCUYH5GO.js";
|
|
@@ -27,17 +27,22 @@ import {
|
|
|
27
27
|
resolveEffectiveConfig,
|
|
28
28
|
streamAll,
|
|
29
29
|
writeNdjsonItem
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-MKGVNDMJ.js";
|
|
31
|
+
import "./chunk-76SWLAZ6.js";
|
|
32
32
|
import {
|
|
33
33
|
createClient
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OHXYFICP.js";
|
|
35
35
|
import {
|
|
36
36
|
GLOBAL_FLAGS,
|
|
37
37
|
WRITE_SINGLE_FLAGS,
|
|
38
|
-
readOnly
|
|
38
|
+
readOnly
|
|
39
|
+
} from "./chunk-CVMSQ3OF.js";
|
|
40
|
+
import {
|
|
41
|
+
DESCRIPTIONS
|
|
42
|
+
} from "./chunk-GQKC6E5K.js";
|
|
43
|
+
import {
|
|
39
44
|
resolveTextOrStdin
|
|
40
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-ZYURL5VK.js";
|
|
41
46
|
|
|
42
47
|
// src/commands/comment.ts
|
|
43
48
|
import { defineCommand } from "citty";
|
|
@@ -66,7 +71,7 @@ function buildListQuery(flags, out) {
|
|
|
66
71
|
async function handleSdkError(err, outOpts, out) {
|
|
67
72
|
const { CurviateError } = await import("@curviate/sdk");
|
|
68
73
|
if (err instanceof CurviateError) {
|
|
69
|
-
const { getExitCode } = await import("./exit-codes-
|
|
74
|
+
const { getExitCode } = await import("./exit-codes-AW6KHDDN.js");
|
|
70
75
|
renderError(err, outOpts, out);
|
|
71
76
|
process.exit(getExitCode(err));
|
|
72
77
|
}
|
|
@@ -409,13 +414,13 @@ var commentListCommand = defineCommand({
|
|
|
409
414
|
name: "list",
|
|
410
415
|
description: "List the comments on a post. A very recent add/delete may take a few minutes to appear or clear here (LinkedIn-side indexing).",
|
|
411
416
|
examples: [
|
|
412
|
-
"curviate comment list 7290000000000000000",
|
|
413
|
-
"curviate comment list 7290000000000000000 --all"
|
|
417
|
+
"curviate core comment list 7290000000000000000",
|
|
418
|
+
"curviate core comment list 7290000000000000000 --all"
|
|
414
419
|
]
|
|
415
420
|
},
|
|
416
421
|
args: {
|
|
417
422
|
...readOnly(GLOBAL_FLAGS),
|
|
418
|
-
postId: { type: "positional", description: "Post to list comments for: the `id` from search posts or a post read, a bare numeric activity id, a urn:li:activity|ugcPost|share:N URN, or a full LinkedIn post URL." }
|
|
423
|
+
postId: { type: "positional", description: "Post to list comments for: the `id` from `curviate core search posts` or a post read, a bare numeric activity id, a urn:li:activity|ugcPost|share:N URN, or a full LinkedIn post URL." }
|
|
419
424
|
},
|
|
420
425
|
async run({ args }) {
|
|
421
426
|
await withClient(args, runCommentList);
|
|
@@ -426,8 +431,8 @@ var commentRepliesCommand = defineCommand({
|
|
|
426
431
|
name: "replies",
|
|
427
432
|
description: "List the replies to a comment.",
|
|
428
433
|
examples: [
|
|
429
|
-
"curviate comment replies 7290000000000000000 COMMENT_ID",
|
|
430
|
-
"curviate comment replies 7290000000000000000 COMMENT_ID --all"
|
|
434
|
+
"curviate core comment replies 7290000000000000000 COMMENT_ID",
|
|
435
|
+
"curviate core comment replies 7290000000000000000 COMMENT_ID --all"
|
|
431
436
|
]
|
|
432
437
|
},
|
|
433
438
|
args: {
|
|
@@ -444,7 +449,7 @@ var commentReactionsCommand = defineCommand({
|
|
|
444
449
|
name: "reactions",
|
|
445
450
|
description: "List the reactions on a comment.",
|
|
446
451
|
examples: [
|
|
447
|
-
"curviate comment reactions 7290000000000000000 COMMENT_ID"
|
|
452
|
+
"curviate core comment reactions 7290000000000000000 COMMENT_ID"
|
|
448
453
|
]
|
|
449
454
|
},
|
|
450
455
|
args: {
|
|
@@ -461,8 +466,8 @@ var commentUserCommand = defineCommand({
|
|
|
461
466
|
name: "user",
|
|
462
467
|
description: "List the comments authored by a user (accepts 'me').",
|
|
463
468
|
examples: [
|
|
464
|
-
"curviate comment user me",
|
|
465
|
-
"curviate comment user janesmith --limit 10"
|
|
469
|
+
"curviate core comment user me",
|
|
470
|
+
"curviate core comment user janesmith --limit 10"
|
|
466
471
|
]
|
|
467
472
|
},
|
|
468
473
|
args: {
|
|
@@ -478,7 +483,7 @@ var commentAddCommand = defineCommand({
|
|
|
478
483
|
name: "add",
|
|
479
484
|
description: "Publish a comment on a post.",
|
|
480
485
|
examples: [
|
|
481
|
-
'curviate comment add 7290000000000000000 "Useful breakdown, thanks for sharing."'
|
|
486
|
+
'curviate core comment add 7290000000000000000 "Useful breakdown, thanks for sharing."'
|
|
482
487
|
]
|
|
483
488
|
},
|
|
484
489
|
args: {
|
|
@@ -496,7 +501,7 @@ var commentReplyCommand = defineCommand({
|
|
|
496
501
|
name: "reply",
|
|
497
502
|
description: "Reply to a comment.",
|
|
498
503
|
examples: [
|
|
499
|
-
'curviate comment reply 7290000000000000000 COMMENT_ID "Agreed, that matches what we saw."'
|
|
504
|
+
'curviate core comment reply 7290000000000000000 COMMENT_ID "Agreed, that matches what we saw."'
|
|
500
505
|
]
|
|
501
506
|
},
|
|
502
507
|
args: {
|
|
@@ -515,7 +520,7 @@ var commentEditCommand = defineCommand({
|
|
|
515
520
|
name: "edit",
|
|
516
521
|
description: "Edit your own comment.",
|
|
517
522
|
examples: [
|
|
518
|
-
'curviate comment edit 7290000000000000000 COMMENT_ID "Useful breakdown, thanks for writing it up."'
|
|
523
|
+
'curviate core comment edit 7290000000000000000 COMMENT_ID "Useful breakdown, thanks for writing it up."'
|
|
519
524
|
]
|
|
520
525
|
},
|
|
521
526
|
args: {
|
|
@@ -533,7 +538,7 @@ var commentDeleteCommand = defineCommand({
|
|
|
533
538
|
name: "delete",
|
|
534
539
|
description: "Delete your own comment.",
|
|
535
540
|
examples: [
|
|
536
|
-
"curviate comment delete 7290000000000000000 COMMENT_ID"
|
|
541
|
+
"curviate core comment delete 7290000000000000000 COMMENT_ID"
|
|
537
542
|
]
|
|
538
543
|
},
|
|
539
544
|
args: {
|
|
@@ -550,7 +555,7 @@ var commentReactCommand = defineCommand({
|
|
|
550
555
|
name: "react",
|
|
551
556
|
description: "React to a comment (like|celebrate|support|love|insightful|funny).",
|
|
552
557
|
examples: [
|
|
553
|
-
"curviate comment react 7290000000000000000 COMMENT_ID insightful"
|
|
558
|
+
"curviate core comment react 7290000000000000000 COMMENT_ID insightful"
|
|
554
559
|
]
|
|
555
560
|
},
|
|
556
561
|
args: {
|
|
@@ -568,7 +573,7 @@ var commentUnreactCommand = defineCommand({
|
|
|
568
573
|
name: "unreact",
|
|
569
574
|
description: "Remove your reaction from a comment.",
|
|
570
575
|
examples: [
|
|
571
|
-
"curviate comment unreact 7290000000000000000 COMMENT_ID insightful"
|
|
576
|
+
"curviate core comment unreact 7290000000000000000 COMMENT_ID insightful"
|
|
572
577
|
]
|
|
573
578
|
},
|
|
574
579
|
args: {
|
|
@@ -582,7 +587,7 @@ var commentUnreactCommand = defineCommand({
|
|
|
582
587
|
}
|
|
583
588
|
});
|
|
584
589
|
var commentCommand = defineCommand({
|
|
585
|
-
meta: { name: "comment", description:
|
|
590
|
+
meta: { name: "comment", description: DESCRIPTIONS.comment },
|
|
586
591
|
args: { ...GLOBAL_FLAGS },
|
|
587
592
|
subCommands: {
|
|
588
593
|
list: commentListCommand,
|
|
@@ -598,7 +603,7 @@ var commentCommand = defineCommand({
|
|
|
598
603
|
},
|
|
599
604
|
async run() {
|
|
600
605
|
process.stderr.write(
|
|
601
|
-
"Usage: curviate comment list <post_id>\n curviate comment add <post_id> <text> [--attach <file>]\n curviate comment reply <post_id> <comment_id> <text>\n curviate comment edit <post_id> <comment_id> <text>\n curviate comment delete <post_id> <comment_id>\n curviate comment replies <post_id> <comment_id>\n curviate comment react <post_id> <comment_id> <reaction>\n curviate comment reactions <post_id> <comment_id>\n curviate comment unreact <post_id> <comment_id> <reaction>\n curviate comment user <user_id>\n"
|
|
606
|
+
"Usage: curviate core comment list <post_id>\n curviate core comment add <post_id> <text> [--attach <file>]\n curviate core comment reply <post_id> <comment_id> <text>\n curviate core comment edit <post_id> <comment_id> <text>\n curviate core comment delete <post_id> <comment_id>\n curviate core comment replies <post_id> <comment_id>\n curviate core comment react <post_id> <comment_id> <reaction>\n curviate core comment reactions <post_id> <comment_id>\n curviate core comment unreact <post_id> <comment_id> <reaction>\n curviate core comment user <user_id>\n"
|
|
602
607
|
);
|
|
603
608
|
}
|
|
604
609
|
});
|