@curviate/cli 0.19.0 → 0.21.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/dist/{account-EGJJNBXW.js → account-A3FOYUKC.js} +29 -29
  3. package/dist/{chunk-42VUUKQ3.js → chunk-56ORAZJO.js} +4 -1
  4. package/dist/{chunk-TMU3CSPR.js → chunk-CUTMZWL6.js} +5 -1
  5. package/dist/chunk-HOQ7EUHJ.js +50 -0
  6. package/dist/{chunk-M33MI53G.js → chunk-LMVDURUZ.js} +23 -1
  7. package/dist/{chunk-KVV6LZ7E.js → chunk-Q7XG2VIF.js} +60 -24
  8. package/dist/chunk-ZYURL5VK.js +83 -0
  9. package/dist/cli.js +51 -36
  10. package/dist/{comment-VT6PO4MN.js → comment-RPLZHFJQ.js} +9 -9
  11. package/dist/{company-XEEBBCRZ.js → company-DFJK2RHM.js} +23 -22
  12. package/dist/{config-P5CPF5WC.js → config-FPWWYG7G.js} +3 -2
  13. package/dist/{connect-6PU7QCOL.js → connect-ELSSMOIC.js} +37 -15
  14. package/dist/{feed-KAUDRE5K.js → feed-23Z7OQNL.js} +4 -3
  15. package/dist/{group-LPVVJ2JX.js → group-52MP24W3.js} +8 -7
  16. package/dist/{inbox-BXCWHGWP.js → inbox-G6KNWWLI.js} +10 -9
  17. package/dist/{inboxes-MTPWLP5F.js → inboxes-NTTYCQPM.js} +5 -4
  18. package/dist/{job-EIXBJXLW.js → job-WOPIAHOR.js} +8 -7
  19. package/dist/{login-GDLWR542.js → login-ZLDDIAFW.js} +14 -15
  20. package/dist/{message-UWMRE2SJ.js → message-KJXY5RCD.js} +7 -4
  21. package/dist/{notification-RYFDHM3G.js → notification-MNEABNVW.js} +6 -5
  22. package/dist/{post-HK6HHIKV.js → post-A7YZWBFG.js} +12 -12
  23. package/dist/{profile-PES67647.js → profile-XOMDIYSY.js} +14 -13
  24. package/dist/{recruiter-MVPSTH2V.js → recruiter-CCLG4PM4.js} +38 -35
  25. package/dist/{sales-nav-TMXWDKSE.js → sales-nav-5ZRE2UAQ.js} +20 -19
  26. package/dist/{search-O2LACGHE.js → search-NDESJC3Y.js} +16 -14
  27. package/dist/{webhook-QFSZN3P2.js → webhook-TNZF3FMN.js} +51 -19
  28. package/package.json +2 -2
  29. package/dist/chunk-U7Y4EXHT.js +0 -33
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- resolveTextOrStdin
4
- } from "./chunk-U7Y4EXHT.js";
3
+ looksLikeCommandWord,
4
+ nearestSubcommand
5
+ } from "./chunk-HOQ7EUHJ.js";
5
6
  import {
6
7
  AttachError,
7
8
  readAttachment,
@@ -24,11 +25,14 @@ import {
24
25
  renderSuccess,
25
26
  renderUnexpectedError,
26
27
  resolveEffectiveConfig
27
- } from "./chunk-M33MI53G.js";
28
+ } from "./chunk-LMVDURUZ.js";
28
29
  import {
29
30
  READ_SINGLE_FLAGS,
30
31
  WRITE_FLAGS
31
- } from "./chunk-TMU3CSPR.js";
32
+ } from "./chunk-CUTMZWL6.js";
33
+ import {
34
+ resolveTextOrStdin
35
+ } from "./chunk-ZYURL5VK.js";
32
36
 
33
37
  // src/commands/message.ts
34
38
  import { defineCommand } from "citty";
@@ -267,7 +271,7 @@ async function runMessageReact(client, flags, out) {
267
271
  const messageId = flags.messageId ?? "";
268
272
  const reaction = flags.emoji ?? flags.emojiAlias ?? "";
269
273
  if (!reaction) {
270
- out.stderr.write("error: a reaction is required \u2014 pass it as `message react <chat_id> <message_id> <emoji>` (or --emoji <e>).\n");
274
+ out.stderr.write("error: a reaction is required. Pass it as `message react <chat_id> <message_id> <emoji>` (or --emoji <e>).\n");
271
275
  process.exit(2);
272
276
  return;
273
277
  }
@@ -389,7 +393,7 @@ var messageNewCommand = defineCommand({
389
393
  description: "Recipient: LinkedIn profile URL (e.g. https://www.linkedin.com/in/some-slug), bare slug (e.g. some-slug), or provider ID (e.g. ACoAAA\u2026). URL and slug inputs resolve the provider ID automatically.",
390
394
  required: true
391
395
  },
392
- text: { type: "positional", description: "Opening message text. Pass - to read from stdin (e.g. via heredoc or pipe)." },
396
+ text: { type: "positional", stdinArg: true, description: "Opening message text. Pass - to read from stdin (e.g. via heredoc or pipe)." },
393
397
  attach: { type: "string", description: "File to attach (repeatable)." }
394
398
  },
395
399
  async run({ args }) {
@@ -402,7 +406,7 @@ var messageNewCommand = defineCommand({
402
406
  profile: flags.profile
403
407
  });
404
408
  if (!cfg.apiKey) {
405
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
409
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
406
410
  process.exit(3);
407
411
  }
408
412
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -428,7 +432,7 @@ var messageGetCommand = defineCommand({
428
432
  profile: flags.profile
429
433
  });
430
434
  if (!cfg.apiKey) {
431
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
435
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
432
436
  process.exit(3);
433
437
  }
434
438
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -443,7 +447,7 @@ var messageEditCommand = defineCommand({
443
447
  ...WRITE_FLAGS,
444
448
  chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
445
449
  messageId: { type: "positional", description: "Message ID." },
446
- text: { type: "positional", description: "Replacement text. Pass - to read from stdin." }
450
+ text: { type: "positional", stdinArg: true, description: "Replacement text. Pass - to read from stdin." }
447
451
  },
448
452
  async run({ args }) {
449
453
  const flags = args;
@@ -455,7 +459,7 @@ var messageEditCommand = defineCommand({
455
459
  profile: flags.profile
456
460
  });
457
461
  if (!cfg.apiKey) {
458
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
462
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
459
463
  process.exit(3);
460
464
  }
461
465
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -481,7 +485,7 @@ var messageDeleteCommand = defineCommand({
481
485
  profile: flags.profile
482
486
  });
483
487
  if (!cfg.apiKey) {
484
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
488
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
485
489
  process.exit(3);
486
490
  }
487
491
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -513,7 +517,7 @@ var messageReactCommand = defineCommand({
513
517
  profile: flags.profile
514
518
  });
515
519
  if (!cfg.apiKey) {
516
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
520
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
517
521
  process.exit(3);
518
522
  }
519
523
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -541,7 +545,7 @@ var messageAttachmentCommand = defineCommand({
541
545
  profile: flags.profile
542
546
  });
543
547
  if (!cfg.apiKey) {
544
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
548
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
545
549
  process.exit(3);
546
550
  }
547
551
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -565,7 +569,7 @@ var messageInMailCommand = defineCommand({
565
569
  required: true
566
570
  },
567
571
  subject: { type: "string", description: "InMail subject line.", required: true },
568
- text: { type: "positional", description: "InMail body text. Pass - to read from stdin." }
572
+ text: { type: "positional", stdinArg: true, description: "InMail body text. Pass - to read from stdin." }
569
573
  },
570
574
  async run({ args }) {
571
575
  const flags = args;
@@ -577,7 +581,7 @@ var messageInMailCommand = defineCommand({
577
581
  profile: flags.profile
578
582
  });
579
583
  if (!cfg.apiKey) {
580
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
584
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
581
585
  process.exit(3);
582
586
  }
583
587
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -597,7 +601,7 @@ var messageSendCommand = defineCommand({
597
601
  type: "positional",
598
602
  description: "Chat ID or LinkedIn messaging thread URL. A COMPANY_ chat id sends as the company page; any other chat id sends as the connected member."
599
603
  },
600
- text: { type: "positional", description: "Message text. Pass - to read from stdin (e.g. via heredoc or pipe)." },
604
+ text: { type: "positional", stdinArg: true, description: "Message text. Pass - to read from stdin (e.g. via heredoc or pipe)." },
601
605
  attach: { type: "string", description: "File to attach (repeatable)." }
602
606
  },
603
607
  async run({ args }) {
@@ -610,7 +614,7 @@ var messageSendCommand = defineCommand({
610
614
  profile: flags.profile
611
615
  });
612
616
  if (!cfg.apiKey) {
613
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
617
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
614
618
  process.exit(3);
615
619
  }
616
620
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -634,7 +638,7 @@ var messageInMailBalanceCommand = defineCommand({
634
638
  profile: flags.profile
635
639
  });
636
640
  if (!cfg.apiKey) {
637
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
641
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
638
642
  process.exit(3);
639
643
  }
640
644
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -642,6 +646,38 @@ var messageInMailBalanceCommand = defineCommand({
642
646
  await runMessageInMailBalance(client, { ...flags, account: flags.account ?? cfg.account }, out);
643
647
  }
644
648
  });
649
+ var MESSAGE_SUBCOMMANDS = [
650
+ "new",
651
+ "send",
652
+ "get",
653
+ "edit",
654
+ "delete",
655
+ "react",
656
+ "attachment",
657
+ "inmail",
658
+ "inmail-balance"
659
+ ];
660
+ var MESSAGE_USAGE = 'Usage: curviate message new --to <attendee> "<text>" [--attach <file>\u2026]\n curviate message send <chat_id> "<text>" [--attach <file>\u2026]\n curviate message <chat_id> "<text>" [--attach <file>\u2026]\n curviate message get <chat_id> <message_id>\n curviate message edit <chat_id> <message_id> "<text>"\n curviate message delete <chat_id> <message_id>\n curviate message react <chat_id> <message_id> <emoji>\n curviate message attachment <chat_id> <message_id> <attachment_id> [-o <file>]\n curviate message inmail --to <id> --subject <s> "<text>"\n curviate message inmail-balance\n';
661
+ function guardBareMessageForm(chatId, out) {
662
+ if (!looksLikeCommandWord(chatId)) return;
663
+ const suggestion = nearestSubcommand(chatId, [...MESSAGE_SUBCOMMANDS]);
664
+ out.stderr.write(
665
+ `error: \`${chatId}\` is not a curviate message subcommand, and it is not a chat id (a chat id looks like 2-\u2026 or COMPANY_\u2026, or a linkedin.com/messaging/thread/\u2026 URL).
666
+ `
667
+ );
668
+ if (suggestion) {
669
+ out.stderr.write(`hint: did you mean \`curviate message ${suggestion}\`?
670
+ `);
671
+ } else if (chatId === "search") {
672
+ out.stderr.write("hint: to search your messages, use `curviate inbox search`.\n");
673
+ }
674
+ out.stderr.write(
675
+ `hint: to send to a chat id this check does not recognise, name the action explicitly: curviate message send <chat_id> "<text>".
676
+ `
677
+ );
678
+ out.stderr.write(MESSAGE_USAGE);
679
+ process.exit(2);
680
+ }
645
681
  var messageCommand = defineCommand({
646
682
  meta: {
647
683
  name: "message",
@@ -655,7 +691,7 @@ var messageCommand = defineCommand({
655
691
  description: "Chat ID to send a message to. A COMPANY_ chat id sends as the company page.",
656
692
  required: false
657
693
  },
658
- text: { type: "positional", description: "Message text. Pass - to read from stdin.", required: false },
694
+ text: { type: "positional", stdinArg: true, description: "Message text. Pass - to read from stdin.", required: false },
659
695
  attach: { type: "string", description: "File to attach (repeatable)." }
660
696
  },
661
697
  subCommands: {
@@ -671,12 +707,12 @@ var messageCommand = defineCommand({
671
707
  },
672
708
  async run({ args }) {
673
709
  const flags = args;
710
+ const out = buildOutputStreams();
674
711
  if (!flags.chatId) {
675
- process.stderr.write(
676
- 'Usage: curviate message new --to <attendee> "<text>" [--attach <file>\u2026]\n curviate message <chat_id> "<text>" [--attach <file>\u2026]\n curviate message get <chat_id> <message_id>\n curviate message edit <chat_id> <message_id> "<text>"\n curviate message delete <chat_id> <message_id>\n curviate message react <chat_id> <message_id> <emoji>\n curviate message attachment <chat_id> <message_id> <attachment_id> [-o <file>]\n curviate message inmail --to <id> --subject <s> "<text>"\n curviate message inmail-balance\n'
677
- );
712
+ out.stderr.write(MESSAGE_USAGE);
678
713
  process.exit(2);
679
714
  }
715
+ guardBareMessageForm(normalizeChatId(flags.chatId), out);
680
716
  const cfg = await resolveEffectiveConfig({
681
717
  apiKey: flags["api-key"],
682
718
  baseUrl: flags["base-url"],
@@ -685,11 +721,10 @@ var messageCommand = defineCommand({
685
721
  profile: flags.profile
686
722
  });
687
723
  if (!cfg.apiKey) {
688
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
724
+ out.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
689
725
  process.exit(3);
690
726
  }
691
727
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
692
- const out = buildOutputStreams();
693
728
  await runMessageSend(client, { ...flags, account: flags.account ?? cfg.account }, out);
694
729
  }
695
730
  });
@@ -706,5 +741,6 @@ export {
706
741
  runMessageAttachment,
707
742
  runMessageInMail,
708
743
  runMessageInMailBalance,
744
+ guardBareMessageForm,
709
745
  messageCommand
710
746
  };
@@ -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,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- STDIN_SENTINEL
4
- } from "./chunk-U7Y4EXHT.js";
3
+ STDIN_SENTINEL,
4
+ restoreLiteralDashes
5
+ } from "./chunk-ZYURL5VK.js";
5
6
 
6
7
  // src/cli.ts
7
8
  import { defineCommand } from "citty";
@@ -11,34 +12,34 @@ import { createRequire } from "module";
11
12
  import { runCommand } from "citty";
12
13
  var REMOVED_COMMANDS = {
13
14
  post: {
14
- list: "`post list` was removed \u2014 use `post user-posts <user_id>` (accepts `me`).",
15
- comment: "post comments are their own group now \u2014 use `comment add <post_id> <text>`.",
16
- comments: "post comments are their own group now \u2014 use `comment list <post_id>`."
15
+ list: "`post list` was removed. Use `post user-posts <user_id>` (accepts `me`).",
16
+ comment: "post comments are their own group now. Use `comment add <post_id> <text>`.",
17
+ comments: "post comments are their own group now. Use `comment list <post_id>`."
17
18
  },
18
19
  connect: {
19
- respond: "`connect respond` was split \u2014 use `connect accept <id>` or `connect decline <id>`."
20
+ respond: "`connect respond` was split. Use `connect accept <id>` or `connect decline <id>`."
20
21
  },
21
22
  profile: {
22
- connections: "`profile connections` was renamed \u2014 use `profile relations`."
23
+ connections: "`profile connections` was renamed. Use `profile relations`."
23
24
  },
24
25
  account: {
25
- "connect-link": "`account connect-link` was removed \u2014 use `account link [--account-id <id>]`.",
26
- "reconnect-link": "`account reconnect-link` was removed \u2014 use `account link [--account-id <id>]`.",
27
- reconnect: "`account reconnect` was removed \u2014 use `account link [--account-id <id>]`."
26
+ "connect-link": "`account connect-link` was removed. Use `account link [--account-id <id>]`.",
27
+ "reconnect-link": "`account reconnect-link` was removed. Use `account link [--account-id <id>]`.",
28
+ reconnect: "`account reconnect` was removed. Use `account link [--account-id <id>]`."
28
29
  },
29
30
  inbox: {
30
- sync: "`inbox sync` was removed \u2014 history syncs automatically; just read `inbox messages <chat_id>`.",
31
- "sync-chat": "`inbox sync-chat` was removed \u2014 history syncs automatically; just read `inbox messages <chat_id>`."
31
+ sync: "`inbox sync` was removed. History syncs automatically; just read `inbox messages <chat_id>`.",
32
+ "sync-chat": "`inbox sync-chat` was removed. History syncs automatically; just read `inbox messages <chat_id>`."
32
33
  },
33
34
  recruiter: {
34
- "add-candidate": "`recruiter add-candidate` was renamed \u2014 use `recruiter save-candidate <project_id> --stage-id <id> --candidate-id <id>`.",
35
- "project-jobs": "`recruiter project-jobs` was renamed \u2014 use `recruiter project-job get <project_id>`.",
36
- sync: "`recruiter sync` was removed \u2014 Recruiter data syncs automatically now.",
35
+ "add-candidate": "`recruiter add-candidate` was renamed. Use `recruiter save-candidate <project_id> --stage-id <id> --candidate-id <id>`.",
36
+ "project-jobs": "`recruiter project-jobs` was renamed. Use `recruiter project-job get <project_id>`.",
37
+ sync: "`recruiter sync` was removed. Recruiter data syncs automatically now.",
37
38
  "add-applicant": "`recruiter add-applicant` was removed with no replacement.",
38
39
  "reject-applicant": "`recruiter reject-applicant` was removed with no replacement."
39
40
  },
40
41
  "sales-nav": {
41
- sync: "`sales-nav sync` was removed \u2014 Sales Navigator data syncs automatically now."
42
+ sync: "`sales-nav sync` was removed. Sales Navigator data syncs automatically now."
42
43
  },
43
44
  webhook: {
44
45
  "state-diff": "`webhook state-diff` was removed with no replacement."
@@ -221,7 +222,21 @@ async function dispatch(root, rawArgs) {
221
222
  usageError(`unknown flag \`${unknown}\`.`);
222
223
  }
223
224
  const processedLeafArgs = leafArgs.map((a) => a === "-" ? STDIN_SENTINEL : a);
224
- const leafToRun = { ...leaf, subCommands: void 0 };
225
+ const leafArgsDef = await resolveValue(leaf.args ?? {});
226
+ const originalRun = leaf.run;
227
+ const leafToRun = {
228
+ ...leaf,
229
+ subCommands: void 0,
230
+ ...originalRun ? {
231
+ run: (ctx) => {
232
+ restoreLiteralDashes(
233
+ ctx.args,
234
+ leafArgsDef
235
+ );
236
+ return originalRun(ctx);
237
+ }
238
+ } : {}
239
+ };
225
240
  await runCommand(leafToRun, { rawArgs: processedLeafArgs });
226
241
  } catch (err) {
227
242
  const message = err instanceof Error ? err.message : String(err);
@@ -247,28 +262,28 @@ var main = defineCommand({
247
262
  // Subcommand registry — names and descriptions are static for help rendering;
248
263
  // the handler implementation is loaded lazily on first invocation.
249
264
  subCommands: {
250
- login: () => import("./login-GDLWR542.js").then((m) => m.loginCommand),
251
- config: () => import("./config-P5CPF5WC.js").then((m) => m.configCommand),
265
+ login: () => import("./login-ZLDDIAFW.js").then((m) => m.loginCommand),
266
+ config: () => import("./config-FPWWYG7G.js").then((m) => m.configCommand),
252
267
  // ---------------------------------------------------------------------------
253
268
  // Noun groups — lazy-loaded on first invocation.
254
269
  // ---------------------------------------------------------------------------
255
- profile: () => import("./profile-PES67647.js").then((m) => m.profileCommand),
256
- company: () => import("./company-XEEBBCRZ.js").then((m) => m.companyCommand),
257
- job: () => import("./job-EIXBJXLW.js").then((m) => m.jobCommand),
258
- connect: () => import("./connect-6PU7QCOL.js").then((m) => m.connectCommand),
259
- search: () => import("./search-O2LACGHE.js").then((m) => m.searchCommand),
260
- inbox: () => import("./inbox-BXCWHGWP.js").then((m) => m.inboxCommand),
261
- inboxes: () => import("./inboxes-MTPWLP5F.js").then((m) => m.inboxesCommand),
262
- message: () => import("./message-UWMRE2SJ.js").then((m) => m.messageCommand),
263
- post: () => import("./post-HK6HHIKV.js").then((m) => m.postCommand),
264
- comment: () => import("./comment-VT6PO4MN.js").then((m) => m.commentCommand),
265
- account: () => import("./account-EGJJNBXW.js").then((m) => m.accountCommand),
266
- webhook: () => import("./webhook-QFSZN3P2.js").then((m) => m.webhookCommand),
267
- "sales-nav": () => import("./sales-nav-TMXWDKSE.js").then((m) => m.salesNavCommand),
268
- recruiter: () => import("./recruiter-MVPSTH2V.js").then((m) => m.recruiterCommand),
269
- group: () => import("./group-LPVVJ2JX.js").then((m) => m.groupCommand),
270
- feed: () => import("./feed-KAUDRE5K.js").then((m) => m.feedCommand),
271
- notification: () => import("./notification-RYFDHM3G.js").then((m) => m.notificationCommand)
270
+ profile: () => import("./profile-XOMDIYSY.js").then((m) => m.profileCommand),
271
+ company: () => import("./company-DFJK2RHM.js").then((m) => m.companyCommand),
272
+ job: () => import("./job-WOPIAHOR.js").then((m) => m.jobCommand),
273
+ connect: () => import("./connect-ELSSMOIC.js").then((m) => m.connectCommand),
274
+ search: () => import("./search-NDESJC3Y.js").then((m) => m.searchCommand),
275
+ inbox: () => import("./inbox-G6KNWWLI.js").then((m) => m.inboxCommand),
276
+ inboxes: () => import("./inboxes-NTTYCQPM.js").then((m) => m.inboxesCommand),
277
+ message: () => import("./message-KJXY5RCD.js").then((m) => m.messageCommand),
278
+ post: () => import("./post-A7YZWBFG.js").then((m) => m.postCommand),
279
+ comment: () => import("./comment-RPLZHFJQ.js").then((m) => m.commentCommand),
280
+ account: () => import("./account-A3FOYUKC.js").then((m) => m.accountCommand),
281
+ webhook: () => import("./webhook-TNZF3FMN.js").then((m) => m.webhookCommand),
282
+ "sales-nav": () => import("./sales-nav-5ZRE2UAQ.js").then((m) => m.salesNavCommand),
283
+ recruiter: () => import("./recruiter-CCLG4PM4.js").then((m) => m.recruiterCommand),
284
+ group: () => import("./group-52MP24W3.js").then((m) => m.groupCommand),
285
+ feed: () => import("./feed-23Z7OQNL.js").then((m) => m.feedCommand),
286
+ notification: () => import("./notification-MNEABNVW.js").then((m) => m.notificationCommand)
272
287
  },
273
288
  async run() {
274
289
  const { runMain } = await import("citty");
@@ -2,9 +2,6 @@
2
2
  import {
3
3
  resolveMemberOrMeProviderId
4
4
  } from "./chunk-QJZ3LWOX.js";
5
- import {
6
- resolveTextOrStdin
7
- } from "./chunk-U7Y4EXHT.js";
8
5
  import {
9
6
  AttachError,
10
7
  describeAttachment,
@@ -25,11 +22,14 @@ import {
25
22
  renderSuccess,
26
23
  renderUnexpectedError,
27
24
  resolveEffectiveConfig
28
- } from "./chunk-M33MI53G.js";
25
+ } from "./chunk-LMVDURUZ.js";
29
26
  import {
30
27
  GLOBAL_FLAGS,
31
28
  WRITE_SINGLE_FLAGS
32
- } from "./chunk-TMU3CSPR.js";
29
+ } from "./chunk-CUTMZWL6.js";
30
+ import {
31
+ resolveTextOrStdin
32
+ } from "./chunk-ZYURL5VK.js";
33
33
 
34
34
  // src/commands/comment.ts
35
35
  import { defineCommand } from "citty";
@@ -398,7 +398,7 @@ async function withClient(flags, fn) {
398
398
  profile: flags.profile
399
399
  });
400
400
  if (!cfg.apiKey) {
401
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
401
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
402
402
  process.exit(3);
403
403
  }
404
404
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
@@ -452,7 +452,7 @@ var commentAddCommand = defineCommand({
452
452
  args: {
453
453
  ...WRITE_SINGLE_FLAGS,
454
454
  postId: { type: "positional", description: "Post id to comment on." },
455
- text: { type: "positional", description: "Comment text. Pass - to read from stdin." },
455
+ text: { type: "positional", stdinArg: true, description: "Comment text. Pass - to read from stdin." },
456
456
  attach: { type: "string", description: "Image file to attach (at most one)." }
457
457
  },
458
458
  async run({ args }) {
@@ -465,7 +465,7 @@ var commentReplyCommand = defineCommand({
465
465
  ...WRITE_SINGLE_FLAGS,
466
466
  postId: { type: "positional", description: "Post id the comment belongs to." },
467
467
  commentId: { type: "positional", description: "Comment id to reply to." },
468
- text: { type: "positional", description: "Reply text. Pass - to read from stdin." },
468
+ text: { type: "positional", stdinArg: true, description: "Reply text. Pass - to read from stdin." },
469
469
  attach: { type: "string", description: "Image file to attach (at most one)." }
470
470
  },
471
471
  async run({ args }) {
@@ -478,7 +478,7 @@ var commentEditCommand = defineCommand({
478
478
  ...WRITE_SINGLE_FLAGS,
479
479
  postId: { type: "positional", description: "Post id the comment belongs to." },
480
480
  commentId: { type: "positional", description: "Comment id to edit." },
481
- text: { type: "positional", description: "Updated comment text. Pass - to read from stdin." }
481
+ text: { type: "positional", stdinArg: true, description: "Updated comment text. Pass - to read from stdin." }
482
482
  },
483
483
  async run({ args }) {
484
484
  await withClient(args, (c, f, o) => runCommentEdit(c, f, o, void 0));