@wirecat/cli-core 0.743.0 → 0.744.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
5
5
  minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
6
6
  shape of this file.
7
7
 
8
+ ## 0.744.0 — 24.11.2026
9
+
10
+ ### Fixed
11
+
12
+ - **`people` and `organizations` `create` and `update` offer only the flags the CRM's write takes.** A CRM CLI made
13
+ from a manifest offered `--owner`, `--position`, `--email`, `--phone` and `--field` on every contact and company
14
+ write, though the manifest may write none of them: Attio's people take no owner, so `--owner` was first refused by
15
+ `crm.assign-others` and then by the writer. `CrmWriteCapabilities.fields` names the fields each kind takes, and
16
+ `crmManifestWriteCapabilities` fills it. A writer that leaves it out keeps every flag.
17
+
8
18
  ## 0.743.0 — 24.11.2026
9
19
 
10
20
  ### Added
@@ -382,26 +382,33 @@ const addRecordWrites = (group, noun, { within, example, writes }) => {
382
382
  if (!writes?.kinds.includes(noun.kind))
383
383
  return;
384
384
  const person = noun.kind === "person";
385
+ const written = writes.fields?.[noun.kind];
386
+ const takes = (field) => !written || written.includes(field);
385
387
  const fields = (command) => {
386
388
  command.option("--name <name>", person ? "the whole name" : "the company's name");
387
- if (person)
389
+ if (person) {
388
390
  command
389
391
  .option("--first-name <name>", "the first name; empty clears it")
390
- .option("--last-name <name>", "the last name; empty clears it")
391
- .option("--position <title>", "the job title; empty clears it");
392
+ .option("--last-name <name>", "the last name; empty clears it");
393
+ if (takes("position"))
394
+ command.option("--position <title>", "the job title; empty clears it");
395
+ }
392
396
  const repeated = (value, previous = []) => [...previous, value];
393
- command
394
- .option("--email <address>", "an e-mail address to give it; repeat it for more; replaces its list, and an empty one clears it", repeated)
395
- .option("--phone <phone>", "a phone number to give it, in international form starting with +; repeat it for more; replaces its list, " +
396
- "and an empty one clears it", repeated)
397
- .option("--owner <user>", "the CRM user it is assigned to; anyone but the sign-in's own user checks crm.assign-others")
398
- .option("--field <key=value>", "one of the CRM's own fields, by its code or label as `fields list` prints them, and its value; a list " +
399
- "field takes its option's label or id; repeat it for more fields, or for each value of a multiple field; " +
400
- "an empty value clears it", (value, previous = []) => {
401
- if (value.indexOf("=") < 1)
402
- throw new CliError("validation_error", "--field takes <key>=<value>");
403
- return [...previous, value];
404
- }, []);
397
+ if (takes("emails"))
398
+ command.option("--email <address>", "an e-mail address to give it; repeat it for more; replaces its list, and an empty one clears it", repeated);
399
+ if (takes("phones"))
400
+ command.option("--phone <phone>", "a phone number to give it, in international form starting with +; repeat it for more; replaces its list, " +
401
+ "and an empty one clears it", repeated);
402
+ if (takes("owner"))
403
+ command.option("--owner <user>", "the CRM user it is assigned to; anyone but the sign-in's own user checks crm.assign-others");
404
+ if (takes("custom"))
405
+ command.option("--field <key=value>", "one of the CRM's own fields, by its code or label as `fields list` prints them, and its value; a list " +
406
+ "field takes its option's label or id; repeat it for more fields, or for each value of a multiple field; " +
407
+ "an empty value clears it", (value, previous = []) => {
408
+ if (value.indexOf("=") < 1)
409
+ throw new CliError("validation_error", "--field takes <key>=<value>");
410
+ return [...previous, value];
411
+ }, []);
405
412
  if (writes.idempotent)
406
413
  command.option("--operation-id <id>", "the operation_id a write that ended in outcome_unknown named: the CRM answers the repeat from its record");
407
414
  return command;
@@ -33,6 +33,7 @@ const capabilitiesOf = (manifest) => {
33
33
  verbs: CRM_VERBS.filter((verb) => written.some(({ kind, one }) => takes(kind, one, verb))),
34
34
  // No slot sends the operation id, so a repeated write would be made again.
35
35
  idempotent: false,
36
+ fields: Object.fromEntries(written.map(({ kind, one }) => [kind, [...Object.keys(one.fields), ...(one.custom ? ["custom"] : [])]])),
36
37
  };
37
38
  };
38
39
  /** What the manifest's writes take, for `addCrmCommands({ writes })`; none when it describes no writes. */
@@ -22,6 +22,13 @@ export interface CrmWriteCapabilities {
22
22
  * Left out, the CLI gets neither, and the writer needs no `createActivity` or `completeActivity`.
23
23
  */
24
24
  activities?: readonly CrmActivityWrite[];
25
+ /**
26
+ * The fields a write of each kind takes, in `CrmWriteFields`' names and `custom` for the account's own: the commands
27
+ * offer no flag for another. Left out for a kind, every flag is offered.
28
+ */
29
+ fields?: {
30
+ readonly [K in CrmKind]?: readonly string[];
31
+ };
25
32
  }
26
33
  /**
27
34
  * A deal's or lead's fields in `CrmItem`'s names, each the CRM's own id; `null` clears one. `custom` holds the CRM's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.743.0",
3
+ "version": "0.744.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",