@curviate/cli 0.22.0 → 0.23.1
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 +85 -1
- package/README.md +65 -23
- package/dist/{account-QRGWUQXF.js → account-NZZLUI4E.js} +11 -12
- package/dist/{chunk-H6XD3F66.js → chunk-766W25QS.js} +1 -1
- package/dist/{chunk-ZYURL5VK.js → chunk-AHYUM2XQ.js} +93 -1
- package/dist/{chunk-56ORAZJO.js → chunk-LCIUD7S2.js} +1 -1
- package/dist/chunk-LCLYFE54.js +182 -0
- package/dist/{chunk-QJZ3LWOX.js → chunk-RJTG5YWE.js} +1 -1
- package/dist/{chunk-T5LPGAGJ.js → chunk-S6VAMUCC.js} +16 -22
- package/dist/{chunk-CUTMZWL6.js → chunk-SYRFLZ4D.js} +2 -94
- package/dist/{chunk-JA3NNST6.js → chunk-TKWW6BV6.js} +2 -2
- package/dist/{chunk-DMQZEPQE.js → chunk-UEAX6KUB.js} +10 -0
- package/dist/cli.js +107 -68
- package/dist/{comment-MCGXFMN4.js → comment-SXYTJPXI.js} +21 -25
- package/dist/{company-WDDLWP7E.js → company-GZ2QR2CZ.js} +26 -30
- package/dist/{config-FPWWYG7G.js → config-YKQ4QEBI.js} +4 -3
- package/dist/{connect-5OROSY5C.js → connect-3LTKVRGM.js} +15 -18
- package/dist/{feed-SFVYEAYP.js → feed-ZY27EY52.js} +9 -12
- package/dist/{group-HSZY2IJU.js → group-DBE25EID.js} +16 -16
- package/dist/{inbox-L6JBGZIB.js → inbox-E6ME3ROZ.js} +14 -17
- package/dist/{inboxes-UIO74C5Q.js → inboxes-JRX3J32A.js} +10 -13
- package/dist/{job-75ML7R7I.js → job-U5YIJ7KB.js} +19 -22
- package/dist/{login-ZLDDIAFW.js → login-ERQVI27Q.js} +3 -3
- package/dist/{message-DAQHRBSJ.js → message-NPX7UX46.js} +7 -5
- package/dist/{notification-DYJN4ZHN.js → notification-XSSA5QOJ.js} +11 -14
- package/dist/{post-RGDOCGC4.js → post-OSM7JH65.js} +22 -26
- package/dist/{profile-TJS2YAZD.js → profile-LQXOC7HY.js} +25 -28
- package/dist/{recruiter-NSM33IEK.js → recruiter-ZUTWJHO5.js} +34 -38
- package/dist/{sales-nav-5O7FR57S.js → sales-nav-LSUBIJWZ.js} +22 -25
- package/dist/{search-TDSLK2MB.js → search-FEHXVTQ3.js} +30 -33
- package/dist/{webhook-7ESDSIRU.js → webhook-C43C5BK7.js} +5 -10
- package/package.json +2 -2
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
normalizeChatId,
|
|
17
17
|
resolveIdentifier
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-UEAX6KUB.js";
|
|
19
|
+
import {
|
|
20
|
+
requireAccount
|
|
21
|
+
} from "./chunk-LCLYFE54.js";
|
|
19
22
|
import {
|
|
20
23
|
buildPreviewOutput
|
|
21
24
|
} from "./chunk-R3VLWLVV.js";
|
|
@@ -25,14 +28,12 @@ import {
|
|
|
25
28
|
renderSuccess,
|
|
26
29
|
renderUnexpectedError,
|
|
27
30
|
resolveEffectiveConfig
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-TKWW6BV6.js";
|
|
29
32
|
import {
|
|
30
33
|
READ_SINGLE_FLAGS,
|
|
31
|
-
WRITE_FLAGS
|
|
32
|
-
} from "./chunk-CUTMZWL6.js";
|
|
33
|
-
import {
|
|
34
|
+
WRITE_FLAGS,
|
|
34
35
|
resolveTextOrStdin
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-AHYUM2XQ.js";
|
|
36
37
|
|
|
37
38
|
// src/commands/message.ts
|
|
38
39
|
import { defineCommand } from "citty";
|
|
@@ -42,13 +43,6 @@ function buildOutputStreams() {
|
|
|
42
43
|
stderr: { write: (s) => process.stderr.write(s) }
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
|
-
function requireAccount(account, out) {
|
|
46
|
-
if (!account) {
|
|
47
|
-
out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
|
|
48
|
-
process.exit(2);
|
|
49
|
-
}
|
|
50
|
-
return account;
|
|
51
|
-
}
|
|
52
46
|
function rejectPreviewOnRead(preview, out) {
|
|
53
47
|
if (preview) {
|
|
54
48
|
out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
|
|
@@ -95,7 +89,7 @@ function willSendAsNotice(chatId) {
|
|
|
95
89
|
return chatId.startsWith("COMPANY_") ? "Will send as a company page\n" : null;
|
|
96
90
|
}
|
|
97
91
|
async function runMessageNew(client, flags, out, _readStdin) {
|
|
98
|
-
const accountId = requireAccount(flags
|
|
92
|
+
const accountId = await requireAccount(client, flags, out);
|
|
99
93
|
const rawTo = flags.to ?? "";
|
|
100
94
|
const rawText = flags.text ?? "";
|
|
101
95
|
const attachPaths = normalizeAttachPaths(flags.attach);
|
|
@@ -154,7 +148,7 @@ async function runMessageNew(client, flags, out, _readStdin) {
|
|
|
154
148
|
}
|
|
155
149
|
}
|
|
156
150
|
async function runMessageSend(client, flags, out, _readStdin) {
|
|
157
|
-
const accountId = requireAccount(flags
|
|
151
|
+
const accountId = await requireAccount(client, flags, out);
|
|
158
152
|
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
159
153
|
const rawText = flags.text ?? "";
|
|
160
154
|
const attachPaths = normalizeAttachPaths(flags.attach);
|
|
@@ -205,7 +199,7 @@ async function runMessageSend(client, flags, out, _readStdin) {
|
|
|
205
199
|
async function runMessageGet(client, flags, out) {
|
|
206
200
|
rejectPreviewOnRead(flags.preview, out);
|
|
207
201
|
rejectAllOnNonPaginated(flags.all, out);
|
|
208
|
-
const accountId = requireAccount(flags
|
|
202
|
+
const accountId = await requireAccount(client, flags, out);
|
|
209
203
|
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
210
204
|
const messageId = flags.messageId ?? "";
|
|
211
205
|
const ns = client.account(accountId);
|
|
@@ -218,7 +212,7 @@ async function runMessageGet(client, flags, out) {
|
|
|
218
212
|
}
|
|
219
213
|
}
|
|
220
214
|
async function runMessageEdit(client, flags, out, _readStdin) {
|
|
221
|
-
const accountId = requireAccount(flags
|
|
215
|
+
const accountId = await requireAccount(client, flags, out);
|
|
222
216
|
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
223
217
|
const messageId = flags.messageId ?? "";
|
|
224
218
|
const rawText = flags.text ?? "";
|
|
@@ -243,7 +237,7 @@ async function runMessageEdit(client, flags, out, _readStdin) {
|
|
|
243
237
|
}
|
|
244
238
|
}
|
|
245
239
|
async function runMessageDelete(client, flags, out) {
|
|
246
|
-
const accountId = requireAccount(flags
|
|
240
|
+
const accountId = await requireAccount(client, flags, out);
|
|
247
241
|
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
248
242
|
const messageId = flags.messageId ?? "";
|
|
249
243
|
if (flags.preview) {
|
|
@@ -266,7 +260,7 @@ async function runMessageDelete(client, flags, out) {
|
|
|
266
260
|
}
|
|
267
261
|
}
|
|
268
262
|
async function runMessageReact(client, flags, out) {
|
|
269
|
-
const accountId = requireAccount(flags
|
|
263
|
+
const accountId = await requireAccount(client, flags, out);
|
|
270
264
|
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
271
265
|
const messageId = flags.messageId ?? "";
|
|
272
266
|
const reaction = flags.emoji ?? flags.emojiAlias ?? "";
|
|
@@ -296,7 +290,7 @@ async function runMessageReact(client, flags, out) {
|
|
|
296
290
|
}
|
|
297
291
|
async function runMessageAttachment(client, flags, out, isTTY) {
|
|
298
292
|
rejectPreviewOnRead(flags.preview, out);
|
|
299
|
-
const accountId = requireAccount(flags
|
|
293
|
+
const accountId = await requireAccount(client, flags, out);
|
|
300
294
|
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
301
295
|
const messageId = flags.messageId ?? "";
|
|
302
296
|
const attachmentId = flags.attachmentId ?? "";
|
|
@@ -319,7 +313,7 @@ async function runMessageAttachment(client, flags, out, isTTY) {
|
|
|
319
313
|
}
|
|
320
314
|
}
|
|
321
315
|
async function runMessageInMail(client, flags, out, _readStdin) {
|
|
322
|
-
const accountId = requireAccount(flags
|
|
316
|
+
const accountId = await requireAccount(client, flags, out);
|
|
323
317
|
const rawTo = flags.to ?? "";
|
|
324
318
|
if (!rawTo) {
|
|
325
319
|
out.stderr.write(
|
|
@@ -373,7 +367,7 @@ async function runMessageInMail(client, flags, out, _readStdin) {
|
|
|
373
367
|
async function runMessageInMailBalance(client, flags, out) {
|
|
374
368
|
rejectPreviewOnRead(flags.preview, out);
|
|
375
369
|
rejectAllOnNonPaginated(flags.all, out);
|
|
376
|
-
const accountId = requireAccount(flags
|
|
370
|
+
const accountId = await requireAccount(client, flags, out);
|
|
377
371
|
const ns = client.account(accountId);
|
|
378
372
|
const outOpts = resolveOutputOpts(flags);
|
|
379
373
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
assertNoStdinPlaceholder
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AHYUM2XQ.js";
|
|
5
5
|
|
|
6
6
|
// src/lib/config.ts
|
|
7
7
|
import {
|
|
@@ -130,94 +130,6 @@ async function updateProfileField(profileName, field, value) {
|
|
|
130
130
|
await writeConfig(cfg);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
// src/lib/global-flags.ts
|
|
134
|
-
var GLOBAL_FLAGS = {
|
|
135
|
-
// Auth / config
|
|
136
|
-
"api-key": {
|
|
137
|
-
type: "string",
|
|
138
|
-
description: "API key (overrides env and profile). Note: a key passed on the command line is visible to other processes via `ps` and is saved in shell history; prefer the CURVIATE_API_KEY env var or `curviate login`."
|
|
139
|
-
},
|
|
140
|
-
profile: {
|
|
141
|
-
type: "string",
|
|
142
|
-
description: "Named profile to use from the config file."
|
|
143
|
-
},
|
|
144
|
-
account: {
|
|
145
|
-
type: "string",
|
|
146
|
-
description: "Account id for account-scoped commands."
|
|
147
|
-
},
|
|
148
|
-
"base-url": {
|
|
149
|
-
type: "string",
|
|
150
|
-
description: "Override the API base URL."
|
|
151
|
-
},
|
|
152
|
-
timeout: {
|
|
153
|
-
type: "string",
|
|
154
|
-
description: "Request timeout in milliseconds."
|
|
155
|
-
},
|
|
156
|
-
// Output
|
|
157
|
-
json: {
|
|
158
|
-
type: "boolean",
|
|
159
|
-
description: "Emit JSON output (default when stdout is not a TTY).",
|
|
160
|
-
default: false
|
|
161
|
-
},
|
|
162
|
-
fields: {
|
|
163
|
-
type: "string",
|
|
164
|
-
description: "Comma-separated dot-path field projection (e.g. id,name)."
|
|
165
|
-
},
|
|
166
|
-
limit: {
|
|
167
|
-
type: "string",
|
|
168
|
-
description: "Maximum items per page."
|
|
169
|
-
},
|
|
170
|
-
cursor: {
|
|
171
|
-
type: "string",
|
|
172
|
-
description: "Pagination cursor (opaque token from a previous response)."
|
|
173
|
-
},
|
|
174
|
-
all: {
|
|
175
|
-
type: "boolean",
|
|
176
|
-
description: "Stream all pages as NDJSON.",
|
|
177
|
-
default: false
|
|
178
|
-
},
|
|
179
|
-
"max-pages": {
|
|
180
|
-
type: "string",
|
|
181
|
-
description: "Maximum number of pages to fetch when --all is used."
|
|
182
|
-
},
|
|
183
|
-
"page-delay": {
|
|
184
|
-
type: "string",
|
|
185
|
-
description: "Milliseconds to pause between pages when --all is used (default 400; pass 0 to disable). A modest delay keeps a long stream under the platform rate gate."
|
|
186
|
-
},
|
|
187
|
-
preview: {
|
|
188
|
-
type: "boolean",
|
|
189
|
-
description: "Render the request that would be sent without calling the API.",
|
|
190
|
-
default: false
|
|
191
|
-
},
|
|
192
|
-
verbose: {
|
|
193
|
-
type: "boolean",
|
|
194
|
-
description: "Output the full SDK response instead of the slim default.",
|
|
195
|
-
default: false
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
var WRITE_FLAGS = {
|
|
199
|
-
"api-key": GLOBAL_FLAGS["api-key"],
|
|
200
|
-
profile: GLOBAL_FLAGS.profile,
|
|
201
|
-
account: GLOBAL_FLAGS.account,
|
|
202
|
-
"base-url": GLOBAL_FLAGS["base-url"],
|
|
203
|
-
timeout: GLOBAL_FLAGS.timeout,
|
|
204
|
-
json: GLOBAL_FLAGS.json,
|
|
205
|
-
preview: GLOBAL_FLAGS.preview,
|
|
206
|
-
verbose: GLOBAL_FLAGS.verbose
|
|
207
|
-
};
|
|
208
|
-
var READ_SINGLE_FLAGS = {
|
|
209
|
-
"api-key": GLOBAL_FLAGS["api-key"],
|
|
210
|
-
profile: GLOBAL_FLAGS.profile,
|
|
211
|
-
account: GLOBAL_FLAGS.account,
|
|
212
|
-
"base-url": GLOBAL_FLAGS["base-url"],
|
|
213
|
-
timeout: GLOBAL_FLAGS.timeout,
|
|
214
|
-
json: GLOBAL_FLAGS.json,
|
|
215
|
-
fields: GLOBAL_FLAGS.fields,
|
|
216
|
-
preview: GLOBAL_FLAGS.preview,
|
|
217
|
-
verbose: GLOBAL_FLAGS.verbose
|
|
218
|
-
};
|
|
219
|
-
var WRITE_SINGLE_FLAGS = READ_SINGLE_FLAGS;
|
|
220
|
-
|
|
221
133
|
export {
|
|
222
134
|
getConfigPath,
|
|
223
135
|
readConfig,
|
|
@@ -225,9 +137,5 @@ export {
|
|
|
225
137
|
setActiveProfile,
|
|
226
138
|
renameProfile,
|
|
227
139
|
removeProfile,
|
|
228
|
-
updateProfileField
|
|
229
|
-
GLOBAL_FLAGS,
|
|
230
|
-
WRITE_FLAGS,
|
|
231
|
-
READ_SINGLE_FLAGS,
|
|
232
|
-
WRITE_SINGLE_FLAGS
|
|
140
|
+
updateProfileField
|
|
233
141
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SYRFLZ4D.js";
|
|
5
5
|
import {
|
|
6
6
|
assertNoStdinPlaceholder
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AHYUM2XQ.js";
|
|
8
8
|
|
|
9
9
|
// src/lib/resolve.ts
|
|
10
10
|
var DEFAULT_BASE_URL = "https://api.curviate.com";
|
|
@@ -33,6 +33,15 @@ function normalizeChatId(raw) {
|
|
|
33
33
|
if (match?.[1]) return match[1];
|
|
34
34
|
return raw;
|
|
35
35
|
}
|
|
36
|
+
var GROUP_URL_RE = /^https?:\/\/(?:[a-z0-9-]+\.)?linkedin\.com\/groups\/([^/?#]+)/i;
|
|
37
|
+
var GROUP_PATH_RE = /^\/groups\/([^/?#]+)\/?$/;
|
|
38
|
+
function normalizeGroupId(raw) {
|
|
39
|
+
const urlMatch = GROUP_URL_RE.exec(raw);
|
|
40
|
+
if (urlMatch?.[1]) return urlMatch[1];
|
|
41
|
+
const pathMatch = GROUP_PATH_RE.exec(raw);
|
|
42
|
+
if (pathMatch?.[1]) return pathMatch[1];
|
|
43
|
+
return raw;
|
|
44
|
+
}
|
|
36
45
|
var JOB_URL_RE = /\/jobs\/view\/(\d+)/;
|
|
37
46
|
function resolveJobIdentifier(raw) {
|
|
38
47
|
const match = JOB_URL_RE.exec(raw);
|
|
@@ -43,5 +52,6 @@ function resolveJobIdentifier(raw) {
|
|
|
43
52
|
export {
|
|
44
53
|
resolveIdentifier,
|
|
45
54
|
normalizeChatId,
|
|
55
|
+
normalizeGroupId,
|
|
46
56
|
resolveJobIdentifier
|
|
47
57
|
};
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
GLOBAL_FLAGS,
|
|
3
4
|
STDIN_SENTINEL,
|
|
4
5
|
restoreLiteralDashes
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AHYUM2XQ.js";
|
|
6
7
|
|
|
7
8
|
// src/cli.ts
|
|
8
9
|
import { defineCommand } from "citty";
|
|
@@ -10,6 +11,10 @@ import { createRequire } from "module";
|
|
|
10
11
|
|
|
11
12
|
// src/dispatch.ts
|
|
12
13
|
import { runCommand } from "citty";
|
|
14
|
+
var GLOBAL_FLAG_NAMES = new Set(Object.keys(GLOBAL_FLAGS));
|
|
15
|
+
var GLOBAL_BOOLEAN_FLAG_NAMES = new Set(
|
|
16
|
+
Object.entries(GLOBAL_FLAGS).filter(([, def]) => def.type === "boolean").map(([name]) => name)
|
|
17
|
+
);
|
|
13
18
|
var REMOVED_COMMANDS = {
|
|
14
19
|
post: {
|
|
15
20
|
list: "`post list` was removed. Use `post user-posts <user_id>` (accepts `me`).",
|
|
@@ -51,8 +56,71 @@ function successorHint(group, token) {
|
|
|
51
56
|
async function resolveValue(input) {
|
|
52
57
|
return typeof input === "function" ? input() : input;
|
|
53
58
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
59
|
+
function stripFlagName(token) {
|
|
60
|
+
if (!token.startsWith("-") || token === "-") return null;
|
|
61
|
+
const body = token.replace(/^-+/, "");
|
|
62
|
+
const eq = body.indexOf("=");
|
|
63
|
+
const name = eq === -1 ? body : body.slice(0, eq);
|
|
64
|
+
return name === "" ? null : name;
|
|
65
|
+
}
|
|
66
|
+
function isDeclaredFlagToken(token, declared) {
|
|
67
|
+
const name = stripFlagName(token);
|
|
68
|
+
if (name === null) return false;
|
|
69
|
+
return declared.has(name) || name.startsWith("no-") && declared.has(name.slice(3));
|
|
70
|
+
}
|
|
71
|
+
function walkTokens(rawArgs, booleanFlags, declaredFlags) {
|
|
72
|
+
const positionals = [];
|
|
73
|
+
const flags = [];
|
|
74
|
+
const merges = [];
|
|
75
|
+
let afterDoubleDash = false;
|
|
76
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
77
|
+
const arg = rawArgs[i];
|
|
78
|
+
if (afterDoubleDash) {
|
|
79
|
+
positionals.push({ token: arg, index: i });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (arg === "--") {
|
|
83
|
+
afterDoubleDash = true;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const name = stripFlagName(arg);
|
|
87
|
+
if (name === null) {
|
|
88
|
+
positionals.push({ token: arg, index: i });
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
flags.push({ token: arg, index: i, name });
|
|
92
|
+
if (arg.replace(/^-+/, "").includes("=")) continue;
|
|
93
|
+
const isBoolean = booleanFlags.has(name) || name.startsWith("no-") && booleanFlags.has(name.slice(3));
|
|
94
|
+
if (isBoolean) continue;
|
|
95
|
+
const next = rawArgs[i + 1];
|
|
96
|
+
if (next === void 0 || next === "--") continue;
|
|
97
|
+
const isDeclared = declaredFlags.has(name) || name.startsWith("no-") && declaredFlags.has(name.slice(3));
|
|
98
|
+
const nextIsDashValue = next.startsWith("-") && next !== "-";
|
|
99
|
+
const consume = isDeclared ? !isDeclaredFlagToken(next, declaredFlags) : !nextIsDashValue;
|
|
100
|
+
if (consume) {
|
|
101
|
+
if (isDeclared && nextIsDashValue) merges.push({ flagIndex: i, valueIndex: i + 1 });
|
|
102
|
+
i++;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return { positionals, flags, merges };
|
|
106
|
+
}
|
|
107
|
+
async function routingBooleanFlagNames(cmd) {
|
|
108
|
+
return /* @__PURE__ */ new Set([...await booleanFlagNames(cmd), ...GLOBAL_BOOLEAN_FLAG_NAMES]);
|
|
109
|
+
}
|
|
110
|
+
async function routingDeclaredFlagNames(cmd) {
|
|
111
|
+
return /* @__PURE__ */ new Set([...await declaredArgNames(cmd), ...GLOBAL_FLAG_NAMES]);
|
|
112
|
+
}
|
|
113
|
+
function mergeDashPrefixedValues(rawArgs, merges) {
|
|
114
|
+
if (merges.length === 0) return rawArgs;
|
|
115
|
+
const valueIndexOfFlag = new Map(merges.map((m) => [m.flagIndex, m.valueIndex]));
|
|
116
|
+
const consumedValueIndices = new Set(merges.map((m) => m.valueIndex));
|
|
117
|
+
const out = [];
|
|
118
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
119
|
+
if (consumedValueIndices.has(i)) continue;
|
|
120
|
+
const valueIndex = valueIndexOfFlag.get(i);
|
|
121
|
+
out.push(valueIndex === void 0 ? rawArgs[i] : `${rawArgs[i]}=${rawArgs[valueIndex]}`);
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
56
124
|
}
|
|
57
125
|
async function nodeHasPositional(cmd) {
|
|
58
126
|
const argsDef = await resolveValue(cmd.args ?? {});
|
|
@@ -87,35 +155,10 @@ function arityPhrase(count) {
|
|
|
87
155
|
if (count === 1) return "1 positional argument";
|
|
88
156
|
return `${count} positional arguments`;
|
|
89
157
|
}
|
|
90
|
-
function positionalTokens(rawArgs, booleanFlags) {
|
|
91
|
-
const out = [];
|
|
92
|
-
let afterDoubleDash = false;
|
|
93
|
-
for (let i = 0; i < rawArgs.length; i++) {
|
|
94
|
-
const arg = rawArgs[i];
|
|
95
|
-
if (afterDoubleDash) {
|
|
96
|
-
out.push({ token: arg, index: i });
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (arg === "--") {
|
|
100
|
-
afterDoubleDash = true;
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
if (arg.startsWith("-") && arg !== "-") {
|
|
104
|
-
const body = arg.replace(/^-+/, "");
|
|
105
|
-
if (body.includes("=")) continue;
|
|
106
|
-
const isBoolean = booleanFlags.has(body) || body.startsWith("no-") && booleanFlags.has(body.slice(3));
|
|
107
|
-
if (isBoolean) continue;
|
|
108
|
-
const next = rawArgs[i + 1];
|
|
109
|
-
if (next !== void 0 && !(next.startsWith("-") && next !== "-")) i++;
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
out.push({ token: arg, index: i });
|
|
113
|
-
}
|
|
114
|
-
return out;
|
|
115
|
-
}
|
|
116
158
|
async function extraPositionals(cmd, rawArgs) {
|
|
117
|
-
const booleanFlags = await
|
|
118
|
-
const
|
|
159
|
+
const booleanFlags = await routingBooleanFlagNames(cmd);
|
|
160
|
+
const declaredFlags = await routingDeclaredFlagNames(cmd);
|
|
161
|
+
const { positionals } = walkTokens(rawArgs, booleanFlags, declaredFlags);
|
|
119
162
|
const declaredCount = await nodePositionalCount(cmd);
|
|
120
163
|
return positionals.slice(declaredCount);
|
|
121
164
|
}
|
|
@@ -142,22 +185,11 @@ async function declaredArgNames(cmd) {
|
|
|
142
185
|
}
|
|
143
186
|
return names;
|
|
144
187
|
}
|
|
145
|
-
function findUnknownFlag(
|
|
146
|
-
|
|
147
|
-
for (const arg of rawArgs) {
|
|
148
|
-
if (afterDoubleDash) continue;
|
|
149
|
-
if (arg === "--") {
|
|
150
|
-
afterDoubleDash = true;
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
if (!arg.startsWith("-")) continue;
|
|
154
|
-
let name = arg.replace(/^-+/, "");
|
|
155
|
-
const eq = name.indexOf("=");
|
|
156
|
-
if (eq !== -1) name = name.slice(0, eq);
|
|
157
|
-
if (name === "") continue;
|
|
188
|
+
function findUnknownFlag(flags, declared) {
|
|
189
|
+
for (const { token, name } of flags) {
|
|
158
190
|
if (declared.has(name)) continue;
|
|
159
191
|
if (name.startsWith("no-") && declared.has(name.slice(3))) continue;
|
|
160
|
-
return
|
|
192
|
+
return token;
|
|
161
193
|
}
|
|
162
194
|
return null;
|
|
163
195
|
}
|
|
@@ -186,12 +218,16 @@ async function resolveLeaf(cmd, rawArgs, descent) {
|
|
|
186
218
|
const here = descent ?? { path: [await nodeName(cmd)] };
|
|
187
219
|
const subCommands = await resolveValue(cmd.subCommands);
|
|
188
220
|
if (subCommands && Object.keys(subCommands).length > 0) {
|
|
189
|
-
const
|
|
221
|
+
const booleanFlags = await routingBooleanFlagNames(cmd);
|
|
222
|
+
const declaredFlags = await routingDeclaredFlagNames(cmd);
|
|
223
|
+
const { positionals } = walkTokens(rawArgs, booleanFlags, declaredFlags);
|
|
224
|
+
const idx = positionals.length > 0 ? positionals[0].index : -1;
|
|
190
225
|
const token = idx === -1 ? void 0 : rawArgs[idx];
|
|
191
226
|
const hasBarePositional = await nodeHasPositional(cmd);
|
|
192
227
|
if (token !== void 0 && subCommands[token]) {
|
|
193
228
|
const sub = await resolveValue(subCommands[token]);
|
|
194
|
-
|
|
229
|
+
const remaining = [...rawArgs.slice(0, idx), ...rawArgs.slice(idx + 1)];
|
|
230
|
+
return resolveLeaf(sub, remaining, {
|
|
195
231
|
path: [...here.path, token],
|
|
196
232
|
siblings: subCommands
|
|
197
233
|
});
|
|
@@ -248,12 +284,15 @@ async function dispatch(root, rawArgs) {
|
|
|
248
284
|
if (hasEmptyFields(leafArgs)) {
|
|
249
285
|
usageError("--fields must not be empty.");
|
|
250
286
|
}
|
|
287
|
+
const booleanFlags = await booleanFlagNames(leaf);
|
|
251
288
|
const declared = await declaredArgNames(leaf);
|
|
252
|
-
const
|
|
289
|
+
const walk = walkTokens(leafArgs, booleanFlags, declared);
|
|
290
|
+
const unknown = findUnknownFlag(walk.flags, declared);
|
|
253
291
|
if (unknown !== null) {
|
|
254
292
|
usageError(`unknown flag \`${unknown}\`.`);
|
|
255
293
|
}
|
|
256
|
-
const
|
|
294
|
+
const mergedLeafArgs = mergeDashPrefixedValues(leafArgs, walk.merges);
|
|
295
|
+
const processedLeafArgs = mergedLeafArgs.map((a) => a === "-" ? STDIN_SENTINEL : a);
|
|
257
296
|
const leafArgsDef = await resolveValue(leaf.args ?? {});
|
|
258
297
|
const originalRun = leaf.run;
|
|
259
298
|
const leafToRun = {
|
|
@@ -294,28 +333,28 @@ var main = defineCommand({
|
|
|
294
333
|
// Subcommand registry, names and descriptions are static for help rendering;
|
|
295
334
|
// the handler implementation is loaded lazily on first invocation.
|
|
296
335
|
subCommands: {
|
|
297
|
-
login: () => import("./login-
|
|
298
|
-
config: () => import("./config-
|
|
336
|
+
login: () => import("./login-ERQVI27Q.js").then((m) => m.loginCommand),
|
|
337
|
+
config: () => import("./config-YKQ4QEBI.js").then((m) => m.configCommand),
|
|
299
338
|
// ---------------------------------------------------------------------------
|
|
300
339
|
// Noun groups, lazy-loaded on first invocation.
|
|
301
340
|
// ---------------------------------------------------------------------------
|
|
302
|
-
profile: () => import("./profile-
|
|
303
|
-
company: () => import("./company-
|
|
304
|
-
job: () => import("./job-
|
|
305
|
-
connect: () => import("./connect-
|
|
306
|
-
search: () => import("./search-
|
|
307
|
-
inbox: () => import("./inbox-
|
|
308
|
-
inboxes: () => import("./inboxes-
|
|
309
|
-
message: () => import("./message-
|
|
310
|
-
post: () => import("./post-
|
|
311
|
-
comment: () => import("./comment-
|
|
312
|
-
account: () => import("./account-
|
|
313
|
-
webhook: () => import("./webhook-
|
|
314
|
-
"sales-nav": () => import("./sales-nav-
|
|
315
|
-
recruiter: () => import("./recruiter-
|
|
316
|
-
group: () => import("./group-
|
|
317
|
-
feed: () => import("./feed-
|
|
318
|
-
notification: () => import("./notification-
|
|
341
|
+
profile: () => import("./profile-LQXOC7HY.js").then((m) => m.profileCommand),
|
|
342
|
+
company: () => import("./company-GZ2QR2CZ.js").then((m) => m.companyCommand),
|
|
343
|
+
job: () => import("./job-U5YIJ7KB.js").then((m) => m.jobCommand),
|
|
344
|
+
connect: () => import("./connect-3LTKVRGM.js").then((m) => m.connectCommand),
|
|
345
|
+
search: () => import("./search-FEHXVTQ3.js").then((m) => m.searchCommand),
|
|
346
|
+
inbox: () => import("./inbox-E6ME3ROZ.js").then((m) => m.inboxCommand),
|
|
347
|
+
inboxes: () => import("./inboxes-JRX3J32A.js").then((m) => m.inboxesCommand),
|
|
348
|
+
message: () => import("./message-NPX7UX46.js").then((m) => m.messageCommand),
|
|
349
|
+
post: () => import("./post-OSM7JH65.js").then((m) => m.postCommand),
|
|
350
|
+
comment: () => import("./comment-SXYTJPXI.js").then((m) => m.commentCommand),
|
|
351
|
+
account: () => import("./account-NZZLUI4E.js").then((m) => m.accountCommand),
|
|
352
|
+
webhook: () => import("./webhook-C43C5BK7.js").then((m) => m.webhookCommand),
|
|
353
|
+
"sales-nav": () => import("./sales-nav-LSUBIJWZ.js").then((m) => m.salesNavCommand),
|
|
354
|
+
recruiter: () => import("./recruiter-ZUTWJHO5.js").then((m) => m.recruiterCommand),
|
|
355
|
+
group: () => import("./group-DBE25EID.js").then((m) => m.groupCommand),
|
|
356
|
+
feed: () => import("./feed-ZY27EY52.js").then((m) => m.feedCommand),
|
|
357
|
+
notification: () => import("./notification-XSSA5QOJ.js").then((m) => m.notificationCommand)
|
|
319
358
|
},
|
|
320
359
|
async run() {
|
|
321
360
|
const { runMain } = await import("citty");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
resolveMemberOrMeProviderId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RJTG5YWE.js";
|
|
5
5
|
import {
|
|
6
6
|
AttachError,
|
|
7
7
|
describeAttachment,
|
|
@@ -11,8 +11,11 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
pageDelayFromFlags,
|
|
13
13
|
streamAll
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-766W25QS.js";
|
|
15
|
+
import "./chunk-UEAX6KUB.js";
|
|
16
|
+
import {
|
|
17
|
+
requireAccount
|
|
18
|
+
} from "./chunk-LCLYFE54.js";
|
|
16
19
|
import {
|
|
17
20
|
buildPreviewOutput
|
|
18
21
|
} from "./chunk-R3VLWLVV.js";
|
|
@@ -22,14 +25,14 @@ import {
|
|
|
22
25
|
renderSuccess,
|
|
23
26
|
renderUnexpectedError,
|
|
24
27
|
resolveEffectiveConfig
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TKWW6BV6.js";
|
|
29
|
+
import "./chunk-SYRFLZ4D.js";
|
|
26
30
|
import {
|
|
27
31
|
GLOBAL_FLAGS,
|
|
28
|
-
WRITE_SINGLE_FLAGS
|
|
29
|
-
} from "./chunk-CUTMZWL6.js";
|
|
30
|
-
import {
|
|
32
|
+
WRITE_SINGLE_FLAGS,
|
|
31
33
|
resolveTextOrStdin
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-AHYUM2XQ.js";
|
|
35
|
+
import "./chunk-PMRQXBCP.js";
|
|
33
36
|
|
|
34
37
|
// src/commands/comment.ts
|
|
35
38
|
import { defineCommand } from "citty";
|
|
@@ -40,13 +43,6 @@ function buildOutputStreams() {
|
|
|
40
43
|
stderr: { write: (s) => process.stderr.write(s) }
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
|
-
function requireAccount(account, out) {
|
|
44
|
-
if (!account) {
|
|
45
|
-
out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
|
|
46
|
-
process.exit(2);
|
|
47
|
-
}
|
|
48
|
-
return account;
|
|
49
|
-
}
|
|
50
46
|
function rejectPreviewOnRead(preview, out) {
|
|
51
47
|
if (preview) {
|
|
52
48
|
out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
|
|
@@ -92,7 +88,7 @@ function assertReaction(reaction, out) {
|
|
|
92
88
|
}
|
|
93
89
|
async function runCommentList(client, flags, out) {
|
|
94
90
|
rejectPreviewOnRead(flags.preview, out);
|
|
95
|
-
const accountId = requireAccount(flags
|
|
91
|
+
const accountId = await requireAccount(client, flags, out);
|
|
96
92
|
const postId = flags.postId ?? "";
|
|
97
93
|
const ns = client.account(accountId);
|
|
98
94
|
const outOpts = resolveOutputOpts(flags);
|
|
@@ -119,7 +115,7 @@ async function runCommentList(client, flags, out) {
|
|
|
119
115
|
}
|
|
120
116
|
async function runCommentReplies(client, flags, out) {
|
|
121
117
|
rejectPreviewOnRead(flags.preview, out);
|
|
122
|
-
const accountId = requireAccount(flags
|
|
118
|
+
const accountId = await requireAccount(client, flags, out);
|
|
123
119
|
const postId = flags.postId ?? "";
|
|
124
120
|
const commentId = flags.commentId ?? "";
|
|
125
121
|
const ns = client.account(accountId);
|
|
@@ -147,7 +143,7 @@ async function runCommentReplies(client, flags, out) {
|
|
|
147
143
|
}
|
|
148
144
|
async function runCommentReactions(client, flags, out) {
|
|
149
145
|
rejectPreviewOnRead(flags.preview, out);
|
|
150
|
-
const accountId = requireAccount(flags
|
|
146
|
+
const accountId = await requireAccount(client, flags, out);
|
|
151
147
|
const postId = flags.postId ?? "";
|
|
152
148
|
const commentId = flags.commentId ?? "";
|
|
153
149
|
const ns = client.account(accountId);
|
|
@@ -175,7 +171,7 @@ async function runCommentReactions(client, flags, out) {
|
|
|
175
171
|
}
|
|
176
172
|
async function runCommentUser(client, flags, out) {
|
|
177
173
|
rejectPreviewOnRead(flags.preview, out);
|
|
178
|
-
const accountId = requireAccount(flags
|
|
174
|
+
const accountId = await requireAccount(client, flags, out);
|
|
179
175
|
const ns = client.account(accountId);
|
|
180
176
|
const outOpts = resolveOutputOpts(flags);
|
|
181
177
|
let userId;
|
|
@@ -207,7 +203,7 @@ async function runCommentUser(client, flags, out) {
|
|
|
207
203
|
}
|
|
208
204
|
}
|
|
209
205
|
async function runCommentAdd(client, flags, out, readStdin) {
|
|
210
|
-
const accountId = requireAccount(flags
|
|
206
|
+
const accountId = await requireAccount(client, flags, out);
|
|
211
207
|
const postId = flags.postId ?? "";
|
|
212
208
|
const attachPaths = normalizeAttachPaths(flags.attach);
|
|
213
209
|
let attachBuffers = [];
|
|
@@ -248,7 +244,7 @@ async function runCommentAdd(client, flags, out, readStdin) {
|
|
|
248
244
|
}
|
|
249
245
|
}
|
|
250
246
|
async function runCommentReply(client, flags, out, readStdin) {
|
|
251
|
-
const accountId = requireAccount(flags
|
|
247
|
+
const accountId = await requireAccount(client, flags, out);
|
|
252
248
|
const postId = flags.postId ?? "";
|
|
253
249
|
const commentId = flags.commentId ?? "";
|
|
254
250
|
const attachPaths = normalizeAttachPaths(flags.attach);
|
|
@@ -290,7 +286,7 @@ async function runCommentReply(client, flags, out, readStdin) {
|
|
|
290
286
|
}
|
|
291
287
|
}
|
|
292
288
|
async function runCommentEdit(client, flags, out, readStdin) {
|
|
293
|
-
const accountId = requireAccount(flags
|
|
289
|
+
const accountId = await requireAccount(client, flags, out);
|
|
294
290
|
const postId = flags.postId ?? "";
|
|
295
291
|
const commentId = flags.commentId ?? "";
|
|
296
292
|
const text = await resolveTextOrStdin(flags.text ?? "", out, readStdin);
|
|
@@ -315,7 +311,7 @@ async function runCommentEdit(client, flags, out, readStdin) {
|
|
|
315
311
|
}
|
|
316
312
|
}
|
|
317
313
|
async function runCommentDelete(client, flags, out) {
|
|
318
|
-
const accountId = requireAccount(flags
|
|
314
|
+
const accountId = await requireAccount(client, flags, out);
|
|
319
315
|
const postId = flags.postId ?? "";
|
|
320
316
|
const commentId = flags.commentId ?? "";
|
|
321
317
|
if (flags.preview) {
|
|
@@ -338,7 +334,7 @@ async function runCommentDelete(client, flags, out) {
|
|
|
338
334
|
}
|
|
339
335
|
}
|
|
340
336
|
async function runCommentReact(client, flags, out) {
|
|
341
|
-
const accountId = requireAccount(flags
|
|
337
|
+
const accountId = await requireAccount(client, flags, out);
|
|
342
338
|
const postId = flags.postId ?? "";
|
|
343
339
|
const commentId = flags.commentId ?? "";
|
|
344
340
|
const reaction = flags.reaction ?? "";
|
|
@@ -364,7 +360,7 @@ async function runCommentReact(client, flags, out) {
|
|
|
364
360
|
}
|
|
365
361
|
}
|
|
366
362
|
async function runCommentUnreact(client, flags, out) {
|
|
367
|
-
const accountId = requireAccount(flags
|
|
363
|
+
const accountId = await requireAccount(client, flags, out);
|
|
368
364
|
const postId = flags.postId ?? "";
|
|
369
365
|
const commentId = flags.commentId ?? "";
|
|
370
366
|
const reaction = flags.reaction ?? "";
|