@curviate/cli 0.32.0 → 0.34.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 (41) hide show
  1. package/CHANGELOG.md +264 -1
  2. package/README.md +13 -1
  3. package/dist/{account-JDSZC633.js → account-463D5EVY.js} +90 -47
  4. package/dist/{chunk-JRKM4OV2.js → chunk-6W7364S3.js} +1 -1
  5. package/dist/{chunk-KQXYEQAD.js → chunk-7JU4IXXG.js} +172 -8
  6. package/dist/{chunk-5EJDQ47B.js → chunk-BN7L7WSY.js} +16 -16
  7. package/dist/chunk-DCZR4M7G.js +327 -0
  8. package/dist/{chunk-V3PB4HSF.js → chunk-MNDXMGPX.js} +68 -24
  9. package/dist/chunk-TCUYH5GO.js +34 -0
  10. package/dist/{chunk-SKJNLN37.js → chunk-XDQHNUEU.js} +86 -2
  11. package/dist/{chunk-LJR4LJG6.js → chunk-XP2LN6F6.js} +53 -0
  12. package/dist/{chunk-EIEF2KFH.js → chunk-XZJQQJBE.js} +6 -4
  13. package/dist/{chunk-6P52Q2GK.js → chunk-ZJ7D3NFS.js} +5 -4
  14. package/dist/cli.js +104 -37
  15. package/dist/{comment-YOFNFQUE.js → comment-G6RB2PBZ.js} +32 -26
  16. package/dist/{company-6PKHDK6L.js → company-OWND3W3L.js} +53 -35
  17. package/dist/{config-FUHT23SX.js → config-RUBXWFQ3.js} +74 -29
  18. package/dist/{connect-DG2AVGVL.js → connect-3E7EC5ZM.js} +35 -32
  19. package/dist/{doctor-FK7B6754.js → doctor-Z6OSCGKT.js} +22 -16
  20. package/dist/{exit-codes-AAFTOAXF.js → exit-codes-YSFFFWMS.js} +1 -1
  21. package/dist/{feed-HXBKXKAQ.js → feed-VDTFIMKN.js} +18 -17
  22. package/dist/{group-UYX3KTX3.js → group-KDJHY2IM.js} +21 -18
  23. package/dist/{inbox-EVE2ZTHC.js → inbox-DQLX2LR7.js} +39 -23
  24. package/dist/{inboxes-JBB34WMQ.js → inboxes-WMNHOPY7.js} +18 -17
  25. package/dist/{job-GXUZANYN.js → job-ESKS2LDJ.js} +44 -30
  26. package/dist/{login-3OAUY7TG.js → login-YTVPIN27.js} +15 -3
  27. package/dist/{message-34AGROW2.js → message-5W2R3YHS.js} +7 -9
  28. package/dist/{notification-SKKZS2C5.js → notification-IGNUH2GR.js} +20 -19
  29. package/dist/{post-FIW522Q6.js → post-NLI76K74.js} +34 -26
  30. package/dist/{profile-SX6JOYMD.js → profile-TBKKIICM.js} +71 -90
  31. package/dist/{recruiter-H7ROBEVC.js → recruiter-AEJRHIX5.js} +42 -29
  32. package/dist/{sales-nav-7KCK562X.js → sales-nav-SW6WJVMD.js} +43 -29
  33. package/dist/{search-PASMDQEH.js → search-CS6VN5AG.js} +58 -44
  34. package/dist/{setup-YV5PVIU5.js → setup-ANHJZJ2S.js} +12 -8
  35. package/dist/{webhook-GPLFPC6N.js → webhook-NGMRJMQ5.js} +25 -22
  36. package/package.json +2 -2
  37. package/dist/chunk-LKF5MZIP.js +0 -90
  38. package/dist/chunk-PKSKQ3LN.js +0 -68
  39. package/dist/chunk-R3VLWLVV.js +0 -23
  40. package/dist/chunk-TD2ZIXFR.js +0 -67
  41. package/dist/chunk-TQJ77SL4.js +0 -147
package/CHANGELOG.md CHANGED
@@ -4,7 +4,270 @@ All notable changes to `@curviate/cli` are documented here.
4
4
 
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
  Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html):
7
- a new command or flag is a minor; a breaking command/flag/exit-code change is a major; a fix is a patch.
7
+ a new command or flag is a minor; a breaking command/flag/exit-code change is a major (before 1.0.0, a minor); a fix is a patch.
8
+
9
+ ## [0.34.0] - 2026-09-17
10
+
11
+ Three changes and two fixes. `--account` becomes optional when a workspace has
12
+ exactly one connected account, which turns an invocation that used to be a
13
+ usage error into one that runs, so it ships as a minor.
14
+
15
+ ### Changed
16
+
17
+ - **`--account` is optional when exactly one LinkedIn account is connected.**
18
+ Every account-scoped command, reads and writes, now looks up the connected
19
+ accounts when no account comes from `--account`, `CURVIATE_ACCOUNT` or the
20
+ profile, and uses the only one. `curviate profile me`, which `curviate login`
21
+ tells a new user to run, used to exit `2` with `--account is required` on a
22
+ fresh config. With no account connected the error says so; with several it
23
+ lists them. Both still exit `2` and send nothing else. An account given
24
+ explicitly is used as before, with no lookup. An empty or blank `--account`
25
+ or `CURVIATE_ACCOUNT` is a usage error (exit `2`), never a stand-in for
26
+ omitting it. `--preview` still requires `--account`, since it calls nothing.
27
+ - **`inbox messages` explains when `--mode cache_only` can be served.** The
28
+ store answers a message listing only for an unfiltered first page of a chat
29
+ whose whole message set fits in that one page (`--limit`, at most 25), and
30
+ only after a walk of the chat completed. Any fetched unfiltered first page
31
+ restarts that walk; `--all` walks to the end and closes it. The command's
32
+ help and the README's retrieval section now say so, and an exit `14` on an
33
+ unfiltered, uncursored `inbox messages` adds a `hint:` line. A read carrying
34
+ `--before`, `--after` or `--cursor` is never served from the store and gets
35
+ no hint, since `--all` would not help it. The exit code is unchanged.
36
+ - **Help for `post user-reactions` and `profile --reactions` says items carry
37
+ no time of the reaction.** `parent_post.created_at` is when the post was
38
+ created, and an old post can pick up a fresh reaction, so it is not a
39
+ recency signal and the listing cannot be filtered by date. Read a bounded
40
+ number of items instead: without `--all`, `--limit` caps the read at one
41
+ page.
42
+
43
+ ### Fixed
44
+
45
+ - **The published bundle no longer carries typographic characters from source
46
+ comments.** The bundler keeps some comments, and two in the exit-code table
47
+ shipped em dashes. They are rewritten, and the pre-publish scan of the built
48
+ bundle now blocks the same typographic characters the README and CHANGELOG
49
+ scan blocks.
50
+ - **`profile <id> --sections` and `profile me --sections` now show the
51
+ sections they fetch.** The default output dropped them, so the flag looked
52
+ like it did nothing. Each requested section is added under its own name
53
+ (`--sections education,skills` adds `education` and `skills`,
54
+ `linkedin_*` adds all nine), `null` when the response did not include it.
55
+ Sections that were not requested stay out, output without `--sections` is
56
+ unchanged, and `--verbose` still prints the full response.
57
+
58
+ ## [0.33.0] - 2026-09-14
59
+
60
+ One addition, one change and twelve fixes. Several refuse input that used to
61
+ be accepted or change an exit code, so it ships as a minor.
62
+
63
+ **Behavior changes a script may notice:**
64
+
65
+ - Passing an inert flag to a local command (`curviate login --cursor abc`
66
+ and the like) now exits `2` instead of being silently accepted. None of
67
+ those flags did anything.
68
+ - Repeating a non-repeatable flag, such as `--keywords x --keywords y`, used
69
+ to send an array (or crash, or for a boolean silently read as unset) and
70
+ now exits `2`.
71
+ - `---<flag>`, and `--no-<flag>` for a flag that is not a boolean, used to
72
+ be ignored and now exit `2`.
73
+ - A malformed base URL (including one carrying `user:pass@`) or an invalid
74
+ `--timeout` now exits `2` (was `1`, or `7` for a non-http scheme or
75
+ credentials in the URL).
76
+ - A request that gets no response, or a response that is not an API answer,
77
+ now exits `7` (was `1`, or `0` printing `{}` for a `200` whose body is not
78
+ JSON).
79
+ Download commands are the exception: they save any `2xx` body as the file.
80
+ - A malformed config file (a field of the wrong JSON type, a `null` top
81
+ level, a non-string `active`, a non-object `profiles`) now exits `2` when
82
+ the command takes a value from it (was `1`, or sent as-is), and so does a
83
+ file that is not valid JSON. `config list --json` shows a broken field as
84
+ `"<invalid>"` and drops unknown fields. `config set-account` and
85
+ `config set-base-url` replace a profile that is not an object.
86
+ - A list answer that is not a page now exits `7` on every path that reads
87
+ one, `setup`'s verifying call included (it reported success on most such
88
+ answers).
89
+ - `--all`, `--max-pages` and `--page-delay` on a command that does not
90
+ stream pages now exit `2` (they were accepted and ignored on some).
91
+ - Usage errors name a stray argument by its position
92
+ (`unexpected argument 2 after \`curviate login\``) instead of echoing it.
93
+
94
+ ### Added
95
+
96
+ - **`curviate account seats`.** Lists the workspace's live seats and whether
97
+ each is free or bound to an account (`seat_id`, `occupied`, `account_id`).
98
+ A free seat (`occupied:false`) is one `account link --seat-id` accepts
99
+ right now; an empty result can mean the workspace has no seats, or that
100
+ billing needs attention. Not paginated, `--all` is refused. Requires
101
+ `@curviate/sdk@0.32.0` (`accounts.listSeats()`), bumped below.
102
+
103
+ ### Changed
104
+
105
+ - **Local commands accept only the flags they act on.** These commands make
106
+ no API request, yet listed and accepted the full global set. The flags
107
+ below are now refused as unknown flags (exit `2`):
108
+ - `login`: `--limit`, `--cursor`, `--all`, `--max-pages`, `--page-delay`,
109
+ `--fields`, `--preview`, `--verbose`, `--timeout`.
110
+ - `config list`: the same nine, plus `--api-key`, `--base-url`,
111
+ `--profile` and `--account`.
112
+ - `config set-account`: the same nine, plus `--api-key` and `--base-url`.
113
+ - `config set-base-url` and `config reset`: the same nine, plus
114
+ `--api-key`, `--base-url` and `--account`.
115
+ - `webhook verify`: the same nine, plus `--api-key`, `--base-url`,
116
+ `--account` and `--profile`.
117
+
118
+ `--json` stays accepted on all of them. `--beta` is still tolerated
119
+ everywhere, because it is consumed before flags are checked; it persists
120
+ nothing and has no effect on these commands. `setup` and `doctor` already
121
+ declared only their own flags and are unchanged.
122
+
123
+ ### Fixed
124
+
125
+ - **`safety_warning` reaches the caller on every command.** A success body on
126
+ the warn posture carries `safety_warning` (the action went through, the
127
+ account is past a safety ceiling). Commands with a slim default, and
128
+ `--fields` on a single object, discarded it. It is now carried across both
129
+ projections like `notices`, and shown above list results in human mode.
130
+ Under `--all`, a page's `safety_warning` is written to stderr as one
131
+ `safety_warning: {...}` line per page, beside that page's notices.
132
+ - **`account link` without `--seat-id` says where a seat id comes from.** A
133
+ missing required flag now prints the first complete sentence of its help
134
+ description as a `hint:` line, and the `--seat-id` description names
135
+ `curviate account seats`, the new command below that lists seat ids. Exit
136
+ stays `2`. The help's exit-`12` note is now scoped to a call that already
137
+ has `--seat-id` and `--auth-method`.
138
+ - **An unknown flag's inline value is no longer echoed.** `--api-key=<key>`
139
+ on a command that does not declare `--api-key` printed the key in the
140
+ error line. The error now names the flag only.
141
+ - **The publish leak gate scans `.yml` and `.yaml` files**, including CI
142
+ workflow files, which it previously never opened.
143
+ - **A malformed base URL exits `2`.** `--base-url 'not a url'` (or
144
+ `http://`, `localhost:9`, `ftp://x`, the same value from
145
+ `CURVIATE_BASE_URL` or the profile) exited `1` with `Invalid URL`, or `7`
146
+ for a non-http scheme. Nothing was sent, so it is now a usage error on every
147
+ command, `doctor` included, whose report still prints. `login --base-url`
148
+ and `config set-base-url` refuse it before saving. A base URL carrying a
149
+ user name or password (`http://user:pass@host`) is refused the same way,
150
+ exit `2` with nothing sent (it exited `7`), and `doctor` and `config list`
151
+ never display the credentials.
152
+ - **A response that is not an API answer exits `7`.** A 5xx whose body is not
153
+ an error envelope (a gateway's HTML page, an empty body) decoded as
154
+ `INTERNAL`, exit `1`. A `2xx` whose non-empty body is not JSON exited `1`
155
+ when it claimed JSON (`doctor`: `3`), and otherwise (`text/html`,
156
+ `text/plain`, `application/octet-stream`, no content type) exited `0`
157
+ printing `{}`. All now surface as `PLATFORM_ERROR`, exit `7`. A 5xx that
158
+ carries an error envelope keeps its declared code. A `204` or any other
159
+ empty-bodied success still exits `0`, and an empty `200` labelled JSON,
160
+ which exited `7`, now does too. A list answer that is not a page (an object
161
+ with an `items` array, or `data` on the Recruiter lists), such as `null`,
162
+ `{}`, a non-array `items`, an array, a scalar or an empty body, exits `7`
163
+ wherever one is read: every `--all` stream, `job list`, the `--account`
164
+ name lookup, and the credential checks in `doctor` and `setup` (`setup`
165
+ reported success and `doctor` reported the credential valid). Depending on the path
166
+ it used to crash with exit `1`, or print an empty result or a usage error.
167
+ A company or member slug lookup whose answer carries no id exits `7` too,
168
+ instead of sending `undefined` in the next request's path (`company posts
169
+ acme` against `[]`). The download commands (`message
170
+ attachment`, `job applicant resume`, `recruiter applicant resume`) are
171
+ exempt: they save any `2xx` body byte-for-byte whatever its content type,
172
+ since the server passes the file's own type through. That includes a
173
+ JSON-labelled file, which used to be saved empty.
174
+ - **A plain (non-`--all`) list read now applies the same not-a-page guard the
175
+ `--all` streams already had.** `company posts <id>` (and every other list
176
+ read named on the streaming surface above) exited `0` on a `null` or
177
+ otherwise not-a-page body when read without `--all`; it now exits `7`,
178
+ matching the `--all` behavior exactly.
179
+ - **`--max-pages`/`--page-delay` without `--all`, on a command that does
180
+ stream, now exit `2` with nothing sent.** Both flags only mean anything as
181
+ part of an `--all` page walk; without it they were accepted and silently
182
+ did nothing, which an agent has no way to detect. This is distinct from
183
+ the `--all`-declared-nowhere case above (unknown flag, exit `2`): here the
184
+ command genuinely streams, `--all` is just missing. `job list --state ALL`
185
+ keeps its own inter-state `--page-delay` pacing without `--all`, since it
186
+ is not part of an `--all` walk either way; only `--max-pages` is refused
187
+ there without `--all`.
188
+ - **A request that gets no response exits `7` on every command.** A refused
189
+ connection, a DNS failure or a timeout arrived as `INTERNAL` and exited
190
+ `1`, while `doctor` already reported it as `7`. It is a transient platform
191
+ fault worth a retry, so every command now exits `7`. The `--json` envelope
192
+ is unchanged, and an `INTERNAL` the server sends still exits `1`.
193
+ - **`--fields` narrows each item of an `--all` stream.** `account list --all
194
+ --fields account_id` streamed full items. Every NDJSON line now carries only
195
+ the requested keys, plus `notices`, `safety_warning` and the provenance
196
+ keys when the item has them. Without `--fields` the stream is unchanged.
197
+ - **A repeated flag exits `2`.** `--account a --account b` crashed with
198
+ `account.trim is not a function`, and `--json --json` silently turned JSON
199
+ output off. Any flag given more than once, by name, alias (`-o x
200
+ --output y`) or negation (`--json --no-json`), and `--beta` given twice,
201
+ now exit `2` with `--<flag> was given more than once`. A flag still
202
+ accumulates where the command's help calls it repeatable: `--attach` on
203
+ `message`, `post create`, `company reply`, `sales-nav message new` and
204
+ `recruiter message new`, and `--invitee` on `company follow-invite`.
205
+ `comment add` and `comment reply` take at most one `--attach`, and used to
206
+ send every repeat.
207
+ - **Credential flags are handled strictly and never echoed.**
208
+ - A usage error never echoes a user-supplied token. A value after
209
+ `--api-key=` with a stray space, or after `--`, was printed as an
210
+ unexpected argument; it is now named by position. A flag written without
211
+ its `=` (`--api-key-<key>`) is named by position too, and an unknown flag
212
+ by its exact name without any value. `--beta=<value>` no longer echoes the
213
+ rejected value.
214
+ - `--preview` masks every secret flag's value as `••••`. `account
215
+ checkpoint solve --code <otp> --preview` printed the code. The mask
216
+ covers `--code`, `--password`, `--li-at`, `--li-a` and `--proxy-password`
217
+ wherever the value sits in the rendered request. `recruiter message new
218
+ --signature` is the message's sign-off line, not a credential, so its
219
+ preview shows it.
220
+ - `---api-key=X` and `--no-api-key=X` are unknown flags (exit `2`). They
221
+ were ignored. `--no-<flag>` stays valid for boolean flags.
222
+ - `config list` shows only the last 4 characters of a key (`••••1234`),
223
+ and none of a key shorter than 16 characters. It showed the first 8 and
224
+ last 4, most of a short key.
225
+ - `--timeout` must be a whole number of milliseconds from `1` to
226
+ `2147483647`, digits only. `abc`, `10abc`, `0`, `1.5`, `0x10`, `1e3`,
227
+ ` 5` or `2147483648` now exit `2`; they surfaced as an immediate timeout,
228
+ a silently truncated value, or an out-of-range timer.
229
+ - **A malformed config file exits `2`.** A hand-edited config whose profile
230
+ `apiKey` was an array, object or number crashed every command and
231
+ `config list` with exit `1`; a non-string `account` or `baseUrl` was sent
232
+ as-is; a `null` top level, a non-string `active` or a non-object `profiles`
233
+ crashed or was echoed back. Each is now a usage error, exit `2`, naming the
234
+ file, the profile and the field with the repair (`curviate config reset
235
+ --profile <name>`, or edit the file), never the value. A value is checked
236
+ only when the command actually takes it from the profile, so `--api-key`,
237
+ `--base-url`, `--timeout`, `--account` or the matching environment variable
238
+ still works around a broken field, and a root-scoped command such as
239
+ `account list` ignores a broken `account`. `null` on a field means unset.
240
+ `config list` never refuses: it lists every profile, shows a broken field
241
+ (or a broken `active`, `profiles` or profile) as `<invalid>`, and emits only
242
+ the known fields, where `--json` used to copy any stored field through.
243
+ A config file that is not valid JSON (empty, truncated, hand-mangled) exited
244
+ `1` printing the parser's error; every command now exits `2` with the
245
+ `curviate config reset` repair and no parser text, unless every value it
246
+ needs comes from flags or the environment; `config list` always exits `2`
247
+ on it. Config writers
248
+ (`login`, `config set-*`) refuse a broken top level, `active` or `profiles`
249
+ with exit `2`, and repair a profile that is not an object by replacing it
250
+ with a fresh one holding the written value: `config set-account` and
251
+ `config set-base-url` used to report success without writing (an array
252
+ profile) or crash printing the stored value (a string profile).
253
+ An `active` that is `null` or absent means `default` for writers as well
254
+ as readers; `config set-account` and `config set-base-url` reported
255
+ `Profile "null" not found`. When the API key and base URL both come from
256
+ flags or the environment, an unreadable config never blocks a command:
257
+ `timeout` falls back to its default, so env-only CI runs. A leading UTF-8
258
+ byte order mark is ignored.
259
+ - **`--all` is refused where nothing streams.** `--all`, `--max-pages` and
260
+ `--page-delay` are no longer declared on the commands listed below, which
261
+ never stream pages; there they are unknown flags, exit `2`, nothing sent.
262
+ `profile me` keeps the flags and refuses `--all` at run time (exit `2`). `webhook delete
263
+ <id> --all` sent the DELETE, and `recruiter applicants`, `recruiter search
264
+ parameters`, `sales-nav search parameters`, `webhook create`, `get`,
265
+ `update` and `profile endorse` accepted and ignored it. `company <id>`,
266
+ `company chat`, `company message`, `post get`, `search parameters`,
267
+ `search service-parameters` and `webhook events` already refused it and
268
+ no longer list the three flags in `--help`.
269
+ - **`@curviate/sdk` bumped to `0.32.0`**, for `accounts.listSeats()` behind
270
+ the new `account seats` command above.
8
271
 
9
272
  ## [0.32.0] - 2026-09-11
10
273
 
package/README.md CHANGED
@@ -5,6 +5,8 @@ Official command-line interface for the [Curviate API](https://docs.curviate.com
5
5
  Built for coding agents and power users: JSON output on pipes, structured exit codes,
6
6
  and shell-native composition with `jq`, `xargs`, and `curl`.
7
7
 
8
+ ![An agent using the Curviate CLI to triage a LinkedIn inbox: 18 threads unread, 7 profiles analyzed, 3 companies researched, 6 warm intros, 5 no action needed, 6 drafts waiting for approval](./assets/curviate-cli-hero.png)
9
+
8
10
  ## Install
9
11
 
10
12
  **Global install** (recommended for interactive use):
@@ -249,7 +251,7 @@ curviate job get "https://www.linkedin.com/jobs/view/4428113858" --account acc_1
249
251
  Company commands (`curviate company ...`) are Core-tier reads. `company <id>` accepts a public
250
252
  handle (the slug in `linkedin.com/company/<handle>`) or a numeric id; the four sub-resource
251
253
  commands require the company's **numeric provider id**, the `id` field `company <id>` returns.
252
- `--account` (or a configured default account) is required on all of them.
254
+ `--account` (or a configured default account) is required on all of them, unless exactly one account is connected.
253
255
 
254
256
  ### 1. Retrieve a company, then list its employees
255
257
 
@@ -538,6 +540,16 @@ this API simply holds no copy, so re-checking the id is the wrong move. It is
538
540
  not a failure either. The fix is another mode, and it is never worth retrying
539
541
  as sent, because the answer cannot change until you change the mode.
540
542
 
543
+ `inbox messages` is the strictest case. The store answers it only for an
544
+ unfiltered, uncursored first page, only after a walk of the whole chat reached
545
+ its end, and only when the chat's whole message set fits in that one page
546
+ (`--limit`, at most 25). Any unfiltered page fetched from LinkedIn (such as
547
+ `--mode live` without `--all`) restarts the walk, and
548
+ `inbox messages <chat_id> --all` walks to the end and closes it. A read
549
+ carrying `--before`, `--after` or `--cursor` is never served from the store and
550
+ `--all` does not change that, so a chat with more messages than one page holds
551
+ exits `14` under `--mode cache_only` however it is walked.
552
+
541
553
  ```bash
542
554
  # The default: a fresh stored copy if there is one, otherwise fetch
543
555
  curviate profile me --account acc_1 --json
@@ -6,34 +6,35 @@ import {
6
6
  slimAccountGet,
7
7
  slimAccountList,
8
8
  slimAccountListItem
9
- } from "./chunk-LJR4LJG6.js";
10
- import {
11
- pageDelayFromFlags,
12
- streamAll
13
- } from "./chunk-LKF5MZIP.js";
9
+ } from "./chunk-XP2LN6F6.js";
14
10
  import {
15
11
  buildPreviewOutput
16
- } from "./chunk-R3VLWLVV.js";
12
+ } from "./chunk-TCUYH5GO.js";
17
13
  import {
14
+ isJsonMode,
15
+ pageDelayFromFlags,
16
+ readablePage,
17
+ rejectPaginationModifiersWithoutAll,
18
18
  renderError,
19
+ renderNotices,
19
20
  renderSuccess,
20
- renderUnexpectedError
21
- } from "./chunk-KQXYEQAD.js";
22
- import {
23
- createClient,
24
- resolveEffectiveConfig
25
- } from "./chunk-TD2ZIXFR.js";
26
- import "./chunk-PKSKQ3LN.js";
21
+ renderUnexpectedError,
22
+ resolveEffectiveConfig,
23
+ streamAll,
24
+ writeNdjsonItem
25
+ } from "./chunk-7JU4IXXG.js";
27
26
  import {
28
27
  AUTH_NEEDED
29
- } from "./chunk-EIEF2KFH.js";
30
- import "./chunk-TQJ77SL4.js";
28
+ } from "./chunk-XZJQQJBE.js";
29
+ import {
30
+ createClient
31
+ } from "./chunk-DCZR4M7G.js";
31
32
  import {
32
33
  GLOBAL_FLAGS,
33
34
  READ_SINGLE_FLAGS,
34
35
  WRITE_SINGLE_FLAGS,
35
36
  defaultReadStdin
36
- } from "./chunk-SKJNLN37.js";
37
+ } from "./chunk-XDQHNUEU.js";
37
38
 
38
39
  // src/commands/account.ts
39
40
  import { defineCommand } from "citty";
@@ -115,29 +116,6 @@ function failConflict(out, message) {
115
116
  `);
116
117
  process.exit(2);
117
118
  }
118
- var SECRET_MASK = "\u2022\u2022\u2022\u2022";
119
- function isRecord(value) {
120
- return typeof value === "object" && value !== null && !Array.isArray(value);
121
- }
122
- function maskCredentialSecretsForPreview(body) {
123
- const masked = { ...body };
124
- const credentials = masked["credentials"];
125
- if (isRecord(credentials) && "password" in credentials) {
126
- masked["credentials"] = { ...credentials, password: SECRET_MASK };
127
- }
128
- const cookie = masked["cookie"];
129
- if (isRecord(cookie)) {
130
- const maskedCookie = { ...cookie };
131
- if ("li_at" in maskedCookie) maskedCookie["li_at"] = SECRET_MASK;
132
- if ("li_a" in maskedCookie) maskedCookie["li_a"] = SECRET_MASK;
133
- masked["cookie"] = maskedCookie;
134
- }
135
- const proxy = masked["proxy"];
136
- if (isRecord(proxy) && "password" in proxy) {
137
- masked["proxy"] = { ...proxy, password: SECRET_MASK };
138
- }
139
- return masked;
140
- }
141
119
 
142
120
  // src/lib/checkpoint-copy.ts
143
121
  var RESENDABLE_CHALLENGE_TYPES = /* @__PURE__ */ new Set([
@@ -223,15 +201,16 @@ function resolveOutputOpts(flags) {
223
201
  async function handleError(err, outOpts, out) {
224
202
  const { CurviateError } = await import("@curviate/sdk");
225
203
  if (err instanceof CurviateError) {
226
- const { getExitCode } = await import("./exit-codes-AAFTOAXF.js");
204
+ const { getExitCode } = await import("./exit-codes-YSFFFWMS.js");
227
205
  renderError(err, outOpts, out);
228
- process.exit(getExitCode(err.code));
206
+ process.exit(getExitCode(err));
229
207
  }
230
208
  renderUnexpectedError(err, out);
231
209
  process.exit(1);
232
210
  }
233
211
  async function runAccountList(client, flags, out) {
234
212
  rejectPreviewOnRead(flags.preview, out);
213
+ rejectPaginationModifiersWithoutAll(flags, out);
235
214
  const outOpts = resolveOutputOpts(flags);
236
215
  const all = flags.all ?? false;
237
216
  const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
@@ -249,10 +228,11 @@ async function runAccountList(client, flags, out) {
249
228
  pageDelayMs: pageDelayFromFlags(flags)
250
229
  })) {
251
230
  const projected = outOpts.verbose ? item : slimAccountListItem(item);
252
- out.stdout.write(JSON.stringify(projected) + "\n");
231
+ writeNdjsonItem(out, projected, outOpts.fields, item);
253
232
  }
254
233
  } else {
255
234
  const result = await client.accounts.list(params);
235
+ readablePage(result);
256
236
  renderSuccess(result, { ...outOpts, slim: slimAccountList }, out);
257
237
  }
258
238
  } catch (err) {
@@ -271,6 +251,44 @@ async function runAccountGet(client, flags, out) {
271
251
  await handleError(err, outOpts, out);
272
252
  }
273
253
  }
254
+ function renderSeatLineHuman(item) {
255
+ const seat = item;
256
+ const seatId = typeof seat.seat_id === "string" ? seat.seat_id : String(seat.seat_id ?? "");
257
+ if (seat.occupied === true) {
258
+ const accountId = typeof seat.account_id === "string" ? seat.account_id : "";
259
+ return `${seatId}: bound (${accountId})`;
260
+ }
261
+ return `${seatId}: free`;
262
+ }
263
+ async function runAccountSeats(client, flags, out) {
264
+ rejectPreviewOnRead(flags.preview, out);
265
+ const outOpts = resolveOutputOpts(flags);
266
+ let result;
267
+ try {
268
+ result = readablePage(await client.accounts.listSeats());
269
+ } catch (err) {
270
+ await handleError(err, outOpts, out);
271
+ return;
272
+ }
273
+ if (result.items.length === 0) {
274
+ out.stderr.write(
275
+ "note: no seats listed. This can mean the workspace has no seats, or that billing needs attention (an empty seat is listed here only while connecting to it would be accepted right now).\n"
276
+ );
277
+ }
278
+ if (isJsonMode(outOpts) || flags.fields) {
279
+ renderSuccess(result, outOpts, out);
280
+ return;
281
+ }
282
+ const notices = renderNotices(result.notices);
283
+ if (notices) out.stdout.write(notices + "\n");
284
+ let body = result.items.length === 0 ? "(no seats)" : result.items.map(renderSeatLineHuman).join("\n");
285
+ const safetyWarning = result.safety_warning;
286
+ if (typeof safetyWarning === "object" && safetyWarning !== null) {
287
+ body = `safety_warning: ${JSON.stringify(safetyWarning)}
288
+ ${body}`;
289
+ }
290
+ out.stdout.write(body + "\n");
291
+ }
274
292
  async function buildAuthBody(flags, ctx) {
275
293
  const body = {};
276
294
  if (flags["auth-method"]) body["auth_method"] = flags["auth-method"];
@@ -525,7 +543,7 @@ async function runAccountLink(client, flags, out, io = {}) {
525
543
  };
526
544
  const outOpts = resolveOutputOpts(flags);
527
545
  if (flags.preview) {
528
- const preview = buildPreviewOutput({ method: "auth.intent", args: {}, body: maskCredentialSecretsForPreview(body) });
546
+ const preview = buildPreviewOutput({ method: "auth.intent", args: {}, body });
529
547
  out.stdout.write(JSON.stringify(preview) + "\n");
530
548
  return;
531
549
  }
@@ -684,7 +702,7 @@ async function runAccountUpdate(client, flags, out) {
684
702
  const preview = buildPreviewOutput({
685
703
  method: "accounts.update",
686
704
  args: { accountId },
687
- body: maskCredentialSecretsForPreview(body)
705
+ body
688
706
  });
689
707
  out.stdout.write(JSON.stringify(preview) + "\n");
690
708
  return;
@@ -914,14 +932,37 @@ var accountGetCommand = defineCommand({
914
932
  await runAccountGet(client, flags, out);
915
933
  }
916
934
  });
935
+ var accountSeatsCommand = defineCommand({
936
+ meta: {
937
+ name: "seats",
938
+ description: "List the workspace's live seats and whether each is free or bound to an account. A seat with occupied:false (free) is a seat_id `curviate account link --seat-id` accepts right now. Not paginated (bounded by purchased seats), --all is not supported. An empty result can mean the workspace has no seats, or that billing needs attention."
939
+ },
940
+ args: { ...READ_SINGLE_FLAGS },
941
+ async run({ args }) {
942
+ const flags = args;
943
+ const cfg = await resolveEffectiveConfig({
944
+ apiKey: flags["api-key"],
945
+ baseUrl: flags["base-url"],
946
+ timeout: flags.timeout,
947
+ profile: flags.profile
948
+ });
949
+ if (!cfg.apiKey) {
950
+ process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
951
+ process.exit(3);
952
+ }
953
+ const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
954
+ const out = buildOutputStreams();
955
+ await runAccountSeats(client, flags, out);
956
+ }
957
+ });
917
958
  var accountLinkCommand = defineCommand({
918
959
  meta: {
919
960
  name: "link",
920
- description: "Connect a LinkedIn account to an empty seat. If LinkedIn requires verification you'll be prompted for the code interactively; in a non-interactive shell the command exits 12 and you finish with `curviate account checkpoint solve <account_id> --code`."
961
+ description: "Connect a LinkedIn account to an empty seat. If LinkedIn requires verification you'll be prompted for the code interactively. Given --seat-id and --auth-method, a non-interactive shell exits 12 at that step and you finish with `curviate account checkpoint solve <account_id> --code`."
921
962
  },
922
963
  args: {
923
964
  ...WRITE_SINGLE_FLAGS,
924
- "seat-id": { type: "string", description: "Empty seat to bind the account to.", required: true },
965
+ "seat-id": { type: "string", description: "Empty seat to bind the account to, listed by `curviate account seats` (a free seat there is one this call accepts right now).", required: true },
925
966
  "auth-method": { type: "string", description: "Authentication method: credentials | cookie.", required: true },
926
967
  email: { type: "string", description: "LinkedIn email (credentials method)." },
927
968
  password: { type: "string", description: `LinkedIn password (credentials method). ${PW_WARNING("--password-stdin", "CURVIATE_LINKEDIN_PASSWORD")}` },
@@ -1187,6 +1228,7 @@ var accountCommand = defineCommand({
1187
1228
  subCommands: {
1188
1229
  list: accountListCommand,
1189
1230
  get: accountGetCommand,
1231
+ seats: accountSeatsCommand,
1190
1232
  link: accountLinkCommand,
1191
1233
  "connect-session": accountConnectSessionCommand,
1192
1234
  update: accountUpdateCommand,
@@ -1195,7 +1237,7 @@ var accountCommand = defineCommand({
1195
1237
  },
1196
1238
  async run() {
1197
1239
  process.stderr.write(
1198
- "Usage: curviate account <subcommand>\n list | get | link | connect-session poll | update | disconnect | checkpoint\n"
1240
+ "Usage: curviate account <subcommand>\n list | get | seats | link | connect-session poll | update | disconnect | checkpoint\n"
1199
1241
  );
1200
1242
  }
1201
1243
  });
@@ -1209,5 +1251,6 @@ export {
1209
1251
  runAccountGet,
1210
1252
  runAccountLink,
1211
1253
  runAccountList,
1254
+ runAccountSeats,
1212
1255
  runAccountUpdate
1213
1256
  };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  isStdinToken
4
- } from "./chunk-SKJNLN37.js";
4
+ } from "./chunk-XDQHNUEU.js";
5
5
 
6
6
  // src/lib/search-filters.ts
7
7
  import { readFile } from "fs/promises";