@curviate/cli 0.32.0 → 0.33.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 (40) hide show
  1. package/CHANGELOG.md +215 -1
  2. package/README.md +2 -0
  3. package/dist/{account-JDSZC633.js → account-IPAW6YRD.js} +89 -46
  4. package/dist/{chunk-V3PB4HSF.js → chunk-27E2M2PS.js} +9 -6
  5. package/dist/chunk-4EH6EWFW.js +327 -0
  6. package/dist/{chunk-SKJNLN37.js → chunk-4GXO42ZH.js} +85 -1
  7. package/dist/{chunk-KQXYEQAD.js → chunk-4IPHFPLO.js} +172 -8
  8. package/dist/{chunk-5EJDQ47B.js → chunk-5SHLELR7.js} +16 -16
  9. package/dist/{chunk-JRKM4OV2.js → chunk-REO2BCEX.js} +1 -1
  10. package/dist/{chunk-6P52Q2GK.js → chunk-REVD4GXL.js} +5 -4
  11. package/dist/chunk-TCUYH5GO.js +34 -0
  12. package/dist/{chunk-EIEF2KFH.js → chunk-YCLU5VSN.js} +4 -2
  13. package/dist/cli.js +104 -37
  14. package/dist/{comment-YOFNFQUE.js → comment-F2O4UOSD.js} +32 -26
  15. package/dist/{company-6PKHDK6L.js → company-ANZGO2HT.js} +52 -34
  16. package/dist/{config-FUHT23SX.js → config-ZD3Y5MWP.js} +74 -29
  17. package/dist/{connect-DG2AVGVL.js → connect-HYJCGYFO.js} +34 -31
  18. package/dist/{doctor-FK7B6754.js → doctor-VPGGB5CW.js} +22 -16
  19. package/dist/{exit-codes-AAFTOAXF.js → exit-codes-ZFWQJYOY.js} +1 -1
  20. package/dist/{feed-HXBKXKAQ.js → feed-IZZYSYYI.js} +18 -17
  21. package/dist/{group-UYX3KTX3.js → group-ETDDF2PJ.js} +21 -18
  22. package/dist/{inbox-EVE2ZTHC.js → inbox-XQQ4YRRO.js} +27 -22
  23. package/dist/{inboxes-JBB34WMQ.js → inboxes-6KHXXEBC.js} +18 -17
  24. package/dist/{job-GXUZANYN.js → job-PBTJ5DWL.js} +43 -29
  25. package/dist/{login-3OAUY7TG.js → login-HP5URYD6.js} +15 -3
  26. package/dist/{message-34AGROW2.js → message-DQQPMRFU.js} +7 -9
  27. package/dist/{notification-SKKZS2C5.js → notification-CXIRJB57.js} +20 -19
  28. package/dist/{post-FIW522Q6.js → post-2S7FYMZO.js} +33 -25
  29. package/dist/{profile-SX6JOYMD.js → profile-UCERD6RR.js} +61 -43
  30. package/dist/{recruiter-H7ROBEVC.js → recruiter-PJFUM2ZZ.js} +41 -28
  31. package/dist/{sales-nav-7KCK562X.js → sales-nav-7XNJGVIX.js} +43 -29
  32. package/dist/{search-PASMDQEH.js → search-DYGIIODT.js} +57 -43
  33. package/dist/{setup-YV5PVIU5.js → setup-BRULZH53.js} +12 -8
  34. package/dist/{webhook-GPLFPC6N.js → webhook-2TKWOXYK.js} +25 -22
  35. package/package.json +2 -2
  36. package/dist/chunk-LKF5MZIP.js +0 -90
  37. package/dist/chunk-PKSKQ3LN.js +0 -68
  38. package/dist/chunk-R3VLWLVV.js +0 -23
  39. package/dist/chunk-TD2ZIXFR.js +0 -67
  40. package/dist/chunk-TQJ77SL4.js +0 -147
@@ -8,13 +8,9 @@ import {
8
8
  slimSearchPeople,
9
9
  slimSearchPosts
10
10
  } from "./chunk-LJR4LJG6.js";
11
- import {
12
- pageDelayFromFlags,
13
- streamAll
14
- } from "./chunk-LKF5MZIP.js";
15
11
  import {
16
12
  sentAsNotice
17
- } from "./chunk-5EJDQ47B.js";
13
+ } from "./chunk-5SHLELR7.js";
18
14
  import "./chunk-UWO2D4HW.js";
19
15
  import "./chunk-HOQ7EUHJ.js";
20
16
  import {
@@ -25,29 +21,34 @@ import {
25
21
  import {
26
22
  resolveIdentifier
27
23
  } from "./chunk-UEAX6KUB.js";
28
- import {
29
- buildPreviewOutput
30
- } from "./chunk-R3VLWLVV.js";
31
24
  import {
32
25
  requireAccount
33
- } from "./chunk-V3PB4HSF.js";
26
+ } from "./chunk-27E2M2PS.js";
27
+ import {
28
+ buildPreviewOutput
29
+ } from "./chunk-TCUYH5GO.js";
34
30
  import {
31
+ pageDelayFromFlags,
32
+ readableId,
33
+ readablePage,
34
+ rejectPaginationModifiersWithoutAll,
35
35
  renderError,
36
36
  renderSuccess,
37
- renderUnexpectedError
38
- } from "./chunk-KQXYEQAD.js";
37
+ renderUnexpectedError,
38
+ resolveEffectiveConfig,
39
+ streamAll,
40
+ writeNdjsonItem
41
+ } from "./chunk-4IPHFPLO.js";
42
+ import "./chunk-YCLU5VSN.js";
39
43
  import {
40
- createClient,
41
- resolveEffectiveConfig
42
- } from "./chunk-TD2ZIXFR.js";
43
- import "./chunk-PKSKQ3LN.js";
44
- import "./chunk-EIEF2KFH.js";
45
- import "./chunk-TQJ77SL4.js";
44
+ createClient
45
+ } from "./chunk-4EH6EWFW.js";
46
46
  import {
47
47
  GLOBAL_FLAGS,
48
+ NON_STREAM_FLAGS,
48
49
  WRITE_FLAGS,
49
50
  resolveTextOrStdin
50
- } from "./chunk-SKJNLN37.js";
51
+ } from "./chunk-4GXO42ZH.js";
51
52
 
52
53
  // src/commands/company.ts
53
54
  import { defineCommand } from "citty";
@@ -82,15 +83,14 @@ function normalizeAttachPaths(attach) {
82
83
  async function resolveCompanyId(ns, raw) {
83
84
  const normalized = resolveIdentifier(raw);
84
85
  if (/^\d+$/.test(normalized)) return normalized;
85
- const company = await ns.companies.get(normalized);
86
- return String(company.id);
86
+ return readableId(await ns.companies.get(normalized));
87
87
  }
88
88
  async function handleSdkError(err, outOpts, out) {
89
89
  const { CurviateError } = await import("@curviate/sdk");
90
90
  if (err instanceof CurviateError) {
91
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
91
+ const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
92
92
  renderError(err, outOpts, out);
93
- process.exit(getExitCode(err.code));
93
+ process.exit(getExitCode(err));
94
94
  }
95
95
  renderUnexpectedError(err, out);
96
96
  process.exit(1);
@@ -118,6 +118,7 @@ async function runCompanyGet(client, flags, out) {
118
118
  }
119
119
  async function runCompanyEmployees(client, flags, out) {
120
120
  rejectPreviewOnRead(flags.preview, out);
121
+ rejectPaginationModifiersWithoutAll(flags, out);
121
122
  const accountId = await requireAccount(client, flags, out);
122
123
  const ns = client.account(accountId);
123
124
  const outOpts = resolveOutputOpts(flags);
@@ -136,11 +137,12 @@ async function runCompanyEmployees(client, flags, out) {
136
137
  out,
137
138
  pageDelayMs: pageDelayFromFlags(flags)
138
139
  })) {
139
- out.stdout.write(JSON.stringify(item) + "\n");
140
+ writeNdjsonItem(out, item, outOpts.fields);
140
141
  }
141
142
  return;
142
143
  }
143
144
  const result = await ns.companies.employees(identifier, params);
145
+ readablePage(result);
144
146
  renderSuccess(result, { ...outOpts, slim: slimSearchPeople }, out);
145
147
  } catch (err) {
146
148
  await handleSdkError(err, outOpts, out);
@@ -148,6 +150,7 @@ async function runCompanyEmployees(client, flags, out) {
148
150
  }
149
151
  async function runCompanyPosts(client, flags, out) {
150
152
  rejectPreviewOnRead(flags.preview, out);
153
+ rejectPaginationModifiersWithoutAll(flags, out);
151
154
  const accountId = await requireAccount(client, flags, out);
152
155
  const ns = client.account(accountId);
153
156
  const outOpts = resolveOutputOpts(flags);
@@ -164,11 +167,12 @@ async function runCompanyPosts(client, flags, out) {
164
167
  out,
165
168
  pageDelayMs: pageDelayFromFlags(flags)
166
169
  })) {
167
- out.stdout.write(JSON.stringify(item) + "\n");
170
+ writeNdjsonItem(out, item, outOpts.fields);
168
171
  }
169
172
  return;
170
173
  }
171
174
  const result = await ns.companies.posts(identifier, params);
175
+ readablePage(result);
172
176
  renderSuccess(result, { ...outOpts, slim: slimSearchPosts }, out);
173
177
  } catch (err) {
174
178
  await handleSdkError(err, outOpts, out);
@@ -176,6 +180,7 @@ async function runCompanyPosts(client, flags, out) {
176
180
  }
177
181
  async function runCompanyJobs(client, flags, out) {
178
182
  rejectPreviewOnRead(flags.preview, out);
183
+ rejectPaginationModifiersWithoutAll(flags, out);
179
184
  const accountId = await requireAccount(client, flags, out);
180
185
  const ns = client.account(accountId);
181
186
  const outOpts = resolveOutputOpts(flags);
@@ -193,11 +198,12 @@ async function runCompanyJobs(client, flags, out) {
193
198
  out,
194
199
  pageDelayMs: pageDelayFromFlags(flags)
195
200
  })) {
196
- out.stdout.write(JSON.stringify(item) + "\n");
201
+ writeNdjsonItem(out, item, outOpts.fields);
197
202
  }
198
203
  return;
199
204
  }
200
205
  const result = await ns.companies.jobs(identifier, params);
206
+ readablePage(result);
201
207
  renderSuccess(result, { ...outOpts, slim: slimSearchJobs }, out);
202
208
  } catch (err) {
203
209
  await handleSdkError(err, outOpts, out);
@@ -205,6 +211,7 @@ async function runCompanyJobs(client, flags, out) {
205
211
  }
206
212
  async function runCompanyInvitableFollowers(client, flags, out) {
207
213
  rejectPreviewOnRead(flags.preview, out);
214
+ rejectPaginationModifiersWithoutAll(flags, out);
208
215
  const accountId = await requireAccount(client, flags, out);
209
216
  const ns = client.account(accountId);
210
217
  const outOpts = resolveOutputOpts(flags);
@@ -221,11 +228,12 @@ async function runCompanyInvitableFollowers(client, flags, out) {
221
228
  out,
222
229
  pageDelayMs: pageDelayFromFlags(flags)
223
230
  })) {
224
- out.stdout.write(JSON.stringify(reencodeInviteTokenItem(item)) + "\n");
231
+ writeNdjsonItem(out, reencodeInviteTokenItem(item), outOpts.fields);
225
232
  }
226
233
  return;
227
234
  }
228
235
  const result = await ns.companies.invitableFollowers(identifier, params);
236
+ readablePage(result);
229
237
  const safeResult = reencodeInvitableFollowers(result);
230
238
  renderSuccess(safeResult, { ...outOpts, slim: slimCompanyInvitableFollowers }, out);
231
239
  } catch (err) {
@@ -263,6 +271,7 @@ async function runCompanyFollowInvite(client, flags, out) {
263
271
  }
264
272
  async function runCompanyManaged(client, flags, out) {
265
273
  rejectPreviewOnRead(flags.preview, out);
274
+ rejectPaginationModifiersWithoutAll(flags, out);
266
275
  const accountId = await requireAccount(client, flags, out);
267
276
  const ns = client.account(accountId);
268
277
  const outOpts = resolveOutputOpts(flags);
@@ -278,11 +287,12 @@ async function runCompanyManaged(client, flags, out) {
278
287
  out,
279
288
  pageDelayMs: pageDelayFromFlags(flags)
280
289
  })) {
281
- out.stdout.write(JSON.stringify(item) + "\n");
290
+ writeNdjsonItem(out, item, outOpts.fields);
282
291
  }
283
292
  return;
284
293
  }
285
294
  const result = await ns.companies.managed(params);
295
+ readablePage(result);
286
296
  renderSuccess(result, outOpts, out);
287
297
  } catch (err) {
288
298
  await handleSdkError(err, outOpts, out);
@@ -290,6 +300,7 @@ async function runCompanyManaged(client, flags, out) {
290
300
  }
291
301
  async function runCompanyFollowers(client, flags, out) {
292
302
  rejectPreviewOnRead(flags.preview, out);
303
+ rejectPaginationModifiersWithoutAll(flags, out);
293
304
  const accountId = await requireAccount(client, flags, out);
294
305
  const ns = client.account(accountId);
295
306
  const outOpts = resolveOutputOpts(flags);
@@ -306,11 +317,12 @@ async function runCompanyFollowers(client, flags, out) {
306
317
  out,
307
318
  pageDelayMs: pageDelayFromFlags(flags)
308
319
  })) {
309
- out.stdout.write(JSON.stringify(item) + "\n");
320
+ writeNdjsonItem(out, item, outOpts.fields);
310
321
  }
311
322
  return;
312
323
  }
313
324
  const result = await ns.companies.followers(identifier, params);
325
+ readablePage(result);
314
326
  renderSuccess(result, outOpts, out);
315
327
  } catch (err) {
316
328
  await handleSdkError(err, outOpts, out);
@@ -318,6 +330,7 @@ async function runCompanyFollowers(client, flags, out) {
318
330
  }
319
331
  async function runCompanyChats(client, flags, out) {
320
332
  rejectPreviewOnRead(flags.preview, out);
333
+ rejectPaginationModifiersWithoutAll(flags, out);
321
334
  const accountId = await requireAccount(client, flags, out);
322
335
  const ns = client.account(accountId);
323
336
  const outOpts = resolveOutputOpts(flags);
@@ -334,11 +347,12 @@ async function runCompanyChats(client, flags, out) {
334
347
  out,
335
348
  pageDelayMs: pageDelayFromFlags(flags)
336
349
  })) {
337
- out.stdout.write(JSON.stringify(item) + "\n");
350
+ writeNdjsonItem(out, item, outOpts.fields);
338
351
  }
339
352
  return;
340
353
  }
341
354
  const result = await ns.companies.chats(identifier, params);
355
+ readablePage(result);
342
356
  renderSuccess(result, outOpts, out);
343
357
  } catch (err) {
344
358
  await handleSdkError(err, outOpts, out);
@@ -364,6 +378,7 @@ async function runCompanyChat(client, flags, out) {
364
378
  }
365
379
  async function runCompanyMessages(client, flags, out) {
366
380
  rejectPreviewOnRead(flags.preview, out);
381
+ rejectPaginationModifiersWithoutAll(flags, out);
367
382
  const accountId = await requireAccount(client, flags, out);
368
383
  const ns = client.account(accountId);
369
384
  const outOpts = resolveOutputOpts(flags);
@@ -381,11 +396,12 @@ async function runCompanyMessages(client, flags, out) {
381
396
  out,
382
397
  pageDelayMs: pageDelayFromFlags(flags)
383
398
  })) {
384
- out.stdout.write(JSON.stringify(item) + "\n");
399
+ writeNdjsonItem(out, item, outOpts.fields);
385
400
  }
386
401
  return;
387
402
  }
388
403
  const result = await ns.companies.messages(identifier, chatId, params);
404
+ readablePage(result);
389
405
  renderSuccess(result, outOpts, out);
390
406
  } catch (err) {
391
407
  await handleSdkError(err, outOpts, out);
@@ -412,6 +428,7 @@ async function runCompanyMessage(client, flags, out) {
412
428
  }
413
429
  async function runCompanySearchChats(client, flags, out) {
414
430
  rejectPreviewOnRead(flags.preview, out);
431
+ rejectPaginationModifiersWithoutAll(flags, out);
415
432
  const accountId = await requireAccount(client, flags, out);
416
433
  const ns = client.account(accountId);
417
434
  const outOpts = resolveOutputOpts(flags);
@@ -431,11 +448,12 @@ async function runCompanySearchChats(client, flags, out) {
431
448
  out,
432
449
  pageDelayMs: pageDelayFromFlags(flags)
433
450
  })) {
434
- out.stdout.write(JSON.stringify(item) + "\n");
451
+ writeNdjsonItem(out, item, outOpts.fields);
435
452
  }
436
453
  return;
437
454
  }
438
455
  const result = await ns.companies.searchChats(identifier, params);
456
+ readablePage(result);
439
457
  renderSuccess(result, outOpts, out);
440
458
  } catch (err) {
441
459
  await handleSdkError(err, outOpts, out);
@@ -702,7 +720,7 @@ var companyChatCommand = defineCommand({
702
720
  description: "Retrieve one conversation from a company page's admin inbox. Admin-gated."
703
721
  },
704
722
  args: {
705
- ...GLOBAL_FLAGS,
723
+ ...NON_STREAM_FLAGS,
706
724
  id: { type: "positional", description: "Company identifier (URL, slug, or numeric id), a slug/URL is resolved to the numeric id first." },
707
725
  chatId: { type: "positional", description: "The 2-... chat id from `company chats`, passed through verbatim." }
708
726
  },
@@ -758,7 +776,7 @@ var companyMessageCommand = defineCommand({
758
776
  description: "Retrieve one message from a company-inbox conversation. Admin-gated. See also: `company reply` (send)."
759
777
  },
760
778
  args: {
761
- ...GLOBAL_FLAGS,
779
+ ...NON_STREAM_FLAGS,
762
780
  id: { type: "positional", description: "Company identifier (URL, slug, or numeric id), a slug/URL is resolved to the numeric id first." },
763
781
  chatId: { type: "positional", description: "The 2-... chat id from `company chats`, passed through verbatim." },
764
782
  messageId: { type: "positional", description: "The message id from `company messages`, passed through verbatim." }
@@ -847,7 +865,7 @@ var companyReplyCommand = defineCommand({
847
865
  var companyCommand = defineCommand({
848
866
  meta: { name: "company", description: "Fetch a company profile by URL, slug, or numeric id, and its sub-resources." },
849
867
  args: {
850
- ...GLOBAL_FLAGS,
868
+ ...NON_STREAM_FLAGS,
851
869
  id: { type: "positional", description: "Company identifier (URL, slug, or native id)." },
852
870
  sections: { type: "string", description: "Not supported on company commands; a usage error (exit 2) if supplied." }
853
871
  },
@@ -1,23 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ PROFILE_FIELD_TYPES,
4
+ assertStructure,
5
+ baseUrlProblem,
3
6
  getConfigPath,
7
+ isPlainObject,
4
8
  readConfig,
9
+ readConfigFile,
5
10
  removeProfile,
6
11
  renameProfile,
7
12
  setActiveProfile,
8
- updateProfileField
9
- } from "./chunk-TQJ77SL4.js";
13
+ updateProfileField,
14
+ withoutUserinfo
15
+ } from "./chunk-4EH6EWFW.js";
10
16
  import {
11
17
  GLOBAL_FLAGS
12
- } from "./chunk-SKJNLN37.js";
18
+ } from "./chunk-4GXO42ZH.js";
13
19
 
14
20
  // src/commands/config.ts
15
21
  import { defineCommand } from "citty";
16
- function redactKey(key) {
22
+
23
+ // src/lib/config-display.ts
24
+ function redactKeyForDisplay(key) {
17
25
  if (!key) return "<unset>";
18
- if (key.length <= 8) return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
19
- return key.slice(0, 8) + "\u2022\u2022\u2022\u2022" + key.slice(-4);
26
+ if (key.length < 16) return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
27
+ return "\u2022\u2022\u2022\u2022" + key.slice(-4);
20
28
  }
29
+
30
+ // src/commands/config.ts
21
31
  var configCommand = defineCommand({
22
32
  meta: {
23
33
  name: "config",
@@ -26,39 +36,66 @@ var configCommand = defineCommand({
26
36
  subCommands: {
27
37
  list: defineCommand({
28
38
  meta: { name: "list", description: "List all profiles (keys redacted)." },
29
- args: { ...GLOBAL_FLAGS },
39
+ args: { json: GLOBAL_FLAGS.json },
30
40
  async run({ args }) {
31
- const cfg = await readConfig();
32
- if (!cfg) {
41
+ const file = await readConfigFile();
42
+ if (!file) {
33
43
  process.stderr.write("No config file found. Run `curviate login` to create one.\n");
34
44
  return;
35
45
  }
46
+ if (file.unparseable) assertStructure(file, false);
47
+ const INVALID = "<invalid>";
48
+ const root = isPlainObject(file.root) ? file.root : void 0;
49
+ const rawActive = root?.["active"];
50
+ const active = rawActive === void 0 || rawActive === null ? void 0 : typeof rawActive === "string" ? rawActive : INVALID;
51
+ const rawProfiles = root === void 0 ? INVALID : root["profiles"] ?? {};
52
+ const profiles = isPlainObject(rawProfiles) ? rawProfiles : void 0;
53
+ const display = (profile) => {
54
+ if (!isPlainObject(profile)) return INVALID;
55
+ const out = {};
56
+ for (const [field, want] of Object.entries(PROFILE_FIELD_TYPES)) {
57
+ const value = profile[field];
58
+ if (typeof value !== want) {
59
+ if (value !== void 0 && value !== null) out[field] = INVALID;
60
+ } else {
61
+ out[field] = field === "apiKey" ? redactKeyForDisplay(value) : field === "baseUrl" ? withoutUserinfo(value) : value;
62
+ }
63
+ }
64
+ if (out["apiKey"] === void 0) out["apiKey"] = redactKeyForDisplay(void 0);
65
+ return out;
66
+ };
36
67
  const json = args.json ?? !process.stdout.isTTY;
68
+ const entries = Object.entries(profiles ?? {}).filter(([, profile]) => profile !== void 0 && profile !== null);
37
69
  if (json) {
38
- const redacted = /* @__PURE__ */ Object.create(null);
39
- for (const [name, profile] of Object.entries(cfg.profiles)) {
40
- if (!profile) continue;
41
- redacted[name] = {
42
- ...profile,
43
- apiKey: redactKey(profile.apiKey),
44
- ...name === cfg.active ? { active: true } : {}
45
- };
70
+ const shown = /* @__PURE__ */ Object.create(null);
71
+ for (const [name, profile] of entries) {
72
+ const d = display(profile);
73
+ shown[name] = typeof d === "string" ? d : { ...d, ...name === active ? { active: true } : {} };
46
74
  }
47
- process.stdout.write(JSON.stringify({ active: cfg.active, profiles: redacted }) + "\n");
75
+ process.stdout.write(
76
+ JSON.stringify({ ...active !== void 0 ? { active } : {}, profiles: profiles ? shown : INVALID }) + "\n"
77
+ );
48
78
  } else {
49
- for (const [name, profile] of Object.entries(cfg.profiles)) {
50
- if (!profile) continue;
51
- const marker = name === cfg.active ? " (active)" : "";
52
- process.stdout.write(`${name}${marker}
79
+ if (active === INVALID) process.stdout.write(`active: ${INVALID}
80
+ `);
81
+ if (!profiles) process.stdout.write(`profiles: ${INVALID}
53
82
  `);
54
- process.stdout.write(` apiKey: ${redactKey(profile.apiKey)}
83
+ for (const [name, profile] of entries) {
84
+ const marker = name === active ? " (active)" : "";
85
+ process.stdout.write(`${name}${marker}
55
86
  `);
56
- if (profile.account) process.stdout.write(` account: ${profile.account}
87
+ const d = display(profile);
88
+ if (typeof d === "string") {
89
+ process.stdout.write(` ${d}
57
90
  `);
58
- if (profile.baseUrl) process.stdout.write(` baseUrl: ${profile.baseUrl}
91
+ continue;
92
+ }
93
+ process.stdout.write(` apiKey: ${d["apiKey"]}
59
94
  `);
60
- if (profile.timeout) process.stdout.write(` timeout: ${profile.timeout}
95
+ for (const field of ["account", "baseUrl", "timeout"]) {
96
+ if (d[field]) process.stdout.write(` ${field}: ${d[field]}
61
97
  `);
98
+ }
62
99
  }
63
100
  }
64
101
  }
@@ -117,7 +154,8 @@ var configCommand = defineCommand({
117
154
  description: "Set the default account on a profile."
118
155
  },
119
156
  args: {
120
- ...GLOBAL_FLAGS,
157
+ profile: GLOBAL_FLAGS.profile,
158
+ json: GLOBAL_FLAGS.json,
121
159
  account: {
122
160
  type: "positional",
123
161
  description: "Account id to set as default."
@@ -150,7 +188,8 @@ var configCommand = defineCommand({
150
188
  description: "Set or clear the base URL on a profile."
151
189
  },
152
190
  args: {
153
- ...GLOBAL_FLAGS,
191
+ profile: GLOBAL_FLAGS.profile,
192
+ json: GLOBAL_FLAGS.json,
154
193
  url: {
155
194
  type: "positional",
156
195
  description: 'Base URL to set, or "" to clear.',
@@ -171,6 +210,12 @@ var configCommand = defineCommand({
171
210
  const profileName = args.profile ?? cfg.active;
172
211
  const reset = args.reset;
173
212
  const url = reset ? void 0 : args.url ?? "";
213
+ const badUrl = url ? baseUrlProblem(url) : null;
214
+ if (badUrl) {
215
+ process.stderr.write(`error: ${badUrl}
216
+ `);
217
+ process.exit(2);
218
+ }
174
219
  try {
175
220
  await updateProfileField(
176
221
  profileName,
@@ -203,7 +248,7 @@ var configCommand = defineCommand({
203
248
  description: "Remove the config file (or a single profile)."
204
249
  },
205
250
  args: {
206
- ...GLOBAL_FLAGS,
251
+ json: GLOBAL_FLAGS.json,
207
252
  profile: {
208
253
  type: "string",
209
254
  description: "Remove only this profile instead of the whole file."
@@ -5,38 +5,37 @@ import {
5
5
  slimInviteSent,
6
6
  slimInviteSentItem
7
7
  } from "./chunk-LJR4LJG6.js";
8
- import {
9
- pageDelayFromFlags,
10
- streamAll
11
- } from "./chunk-LKF5MZIP.js";
12
8
  import {
13
9
  nearestSubcommand
14
10
  } from "./chunk-HOQ7EUHJ.js";
15
11
  import {
16
12
  resolveIdentifier
17
13
  } from "./chunk-UEAX6KUB.js";
18
- import {
19
- buildPreviewOutput
20
- } from "./chunk-R3VLWLVV.js";
21
14
  import {
22
15
  requireAccount
23
- } from "./chunk-V3PB4HSF.js";
16
+ } from "./chunk-27E2M2PS.js";
24
17
  import {
18
+ buildPreviewOutput
19
+ } from "./chunk-TCUYH5GO.js";
20
+ import {
21
+ pageDelayFromFlags,
22
+ readablePage,
23
+ rejectPaginationModifiersWithoutAll,
25
24
  renderError,
26
25
  renderSuccess,
27
- renderUnexpectedError
28
- } from "./chunk-KQXYEQAD.js";
26
+ renderUnexpectedError,
27
+ resolveEffectiveConfig,
28
+ streamAll,
29
+ writeNdjsonItem
30
+ } from "./chunk-4IPHFPLO.js";
31
+ import "./chunk-YCLU5VSN.js";
29
32
  import {
30
- createClient,
31
- resolveEffectiveConfig
32
- } from "./chunk-TD2ZIXFR.js";
33
- import "./chunk-PKSKQ3LN.js";
34
- import "./chunk-EIEF2KFH.js";
35
- import "./chunk-TQJ77SL4.js";
33
+ createClient
34
+ } from "./chunk-4EH6EWFW.js";
36
35
  import {
37
36
  GLOBAL_FLAGS,
38
37
  WRITE_FLAGS
39
- } from "./chunk-SKJNLN37.js";
38
+ } from "./chunk-4GXO42ZH.js";
40
39
 
41
40
  // src/commands/connect.ts
42
41
  import { defineCommand } from "citty";
@@ -86,9 +85,9 @@ async function runConnectSend(client, flags, out) {
86
85
  } catch (err) {
87
86
  const { CurviateError } = await import("@curviate/sdk");
88
87
  if (err instanceof CurviateError) {
89
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
88
+ const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
90
89
  renderError(err, outOpts, out);
91
- process.exit(getExitCode(err.code));
90
+ process.exit(getExitCode(err));
92
91
  }
93
92
  renderUnexpectedError(err, out);
94
93
  process.exit(1);
@@ -96,6 +95,7 @@ async function runConnectSend(client, flags, out) {
96
95
  }
97
96
  async function runConnectSent(client, flags, out) {
98
97
  rejectPreviewOnRead(flags.preview, out);
98
+ rejectPaginationModifiersWithoutAll(flags, out);
99
99
  const accountId = await requireAccount(client, flags, out);
100
100
  const ns = client.account(accountId);
101
101
  const outOpts = resolveOutputOpts(flags);
@@ -115,18 +115,19 @@ async function runConnectSent(client, flags, out) {
115
115
  pageDelayMs: pageDelayFromFlags(flags)
116
116
  })) {
117
117
  const projected = !flags.verbose ? slimInviteSentItem(item) : item;
118
- out.stdout.write(JSON.stringify(projected) + "\n");
118
+ writeNdjsonItem(out, projected, outOpts.fields, item);
119
119
  }
120
120
  } else {
121
121
  const result = await ns.invites.listSent(params);
122
+ readablePage(result);
122
123
  renderSuccess(result, { ...outOpts, slim: slimInviteSent }, out);
123
124
  }
124
125
  } catch (err) {
125
126
  const { CurviateError } = await import("@curviate/sdk");
126
127
  if (err instanceof CurviateError) {
127
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
128
+ const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
128
129
  renderError(err, outOpts, out);
129
- process.exit(getExitCode(err.code));
130
+ process.exit(getExitCode(err));
130
131
  }
131
132
  renderUnexpectedError(err, out);
132
133
  process.exit(1);
@@ -134,6 +135,7 @@ async function runConnectSent(client, flags, out) {
134
135
  }
135
136
  async function runConnectReceived(client, flags, out) {
136
137
  rejectPreviewOnRead(flags.preview, out);
138
+ rejectPaginationModifiersWithoutAll(flags, out);
137
139
  const accountId = await requireAccount(client, flags, out);
138
140
  const ns = client.account(accountId);
139
141
  const outOpts = resolveOutputOpts(flags);
@@ -153,18 +155,19 @@ async function runConnectReceived(client, flags, out) {
153
155
  pageDelayMs: pageDelayFromFlags(flags)
154
156
  })) {
155
157
  const projected = !flags.verbose ? slimInviteReceivedItem(item) : item;
156
- out.stdout.write(JSON.stringify(projected) + "\n");
158
+ writeNdjsonItem(out, projected, outOpts.fields, item);
157
159
  }
158
160
  } else {
159
161
  const result = await ns.invites.listReceived(params);
162
+ readablePage(result);
160
163
  renderSuccess(result, { ...outOpts, slim: slimInviteReceived }, out);
161
164
  }
162
165
  } catch (err) {
163
166
  const { CurviateError } = await import("@curviate/sdk");
164
167
  if (err instanceof CurviateError) {
165
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
168
+ const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
166
169
  renderError(err, outOpts, out);
167
- process.exit(getExitCode(err.code));
170
+ process.exit(getExitCode(err));
168
171
  }
169
172
  renderUnexpectedError(err, out);
170
173
  process.exit(1);
@@ -191,9 +194,9 @@ async function runConnectAccept(client, flags, out) {
191
194
  } catch (err) {
192
195
  const { CurviateError } = await import("@curviate/sdk");
193
196
  if (err instanceof CurviateError) {
194
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
197
+ const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
195
198
  renderError(err, outOpts, out);
196
- process.exit(getExitCode(err.code));
199
+ process.exit(getExitCode(err));
197
200
  }
198
201
  renderUnexpectedError(err, out);
199
202
  process.exit(1);
@@ -220,9 +223,9 @@ async function runConnectDecline(client, flags, out) {
220
223
  } catch (err) {
221
224
  const { CurviateError } = await import("@curviate/sdk");
222
225
  if (err instanceof CurviateError) {
223
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
226
+ const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
224
227
  renderError(err, outOpts, out);
225
- process.exit(getExitCode(err.code));
228
+ process.exit(getExitCode(err));
226
229
  }
227
230
  renderUnexpectedError(err, out);
228
231
  process.exit(1);
@@ -249,9 +252,9 @@ async function runConnectCancel(client, flags, out) {
249
252
  } catch (err) {
250
253
  const { CurviateError } = await import("@curviate/sdk");
251
254
  if (err instanceof CurviateError) {
252
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
255
+ const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
253
256
  renderError(err, outOpts, out);
254
- process.exit(getExitCode(err.code));
257
+ process.exit(getExitCode(err));
255
258
  }
256
259
  renderUnexpectedError(err, out);
257
260
  process.exit(1);