conduyt 1.50.0 → 1.52.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 (2) hide show
  1. package/dist/index.js +80 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -607,6 +607,59 @@ pipelines
607
607
  assertStagesShape(body.stages);
608
608
  return client.post("/api/v1/pipelines", body);
609
609
  }));
610
+ // (system stages 2026-09-24) tri-surface parity: the stage flags the API takes on PATCH /pipelines/:id/stages/:stageId,
611
+ // isSystem included (a system holding stage automations route deals through; hidden from rep pickers, never won or lost)
612
+ pipelines
613
+ .command("update-stage <pipelineId> <stageId>")
614
+ .description("Update one stage (PATCH — only the fields you pass change). --is-system marks a system holding stage: automations route deals through it, reps never see it in a picker, and it can never be won or lost")
615
+ .option("--name <name>", "stage name")
616
+ .option("--color <hex>", "stage colour")
617
+ .option("--is-won <bool>", "true|false — entering this stage closes the deal as won")
618
+ .option("--is-lost <bool>", "true|false — entering this stage closes the deal as lost")
619
+ .option("--is-system <bool>", "true|false — a system holding stage (cannot also be won or lost)")
620
+ .option("--sort-order <n>", "position in the pipeline (integer)")
621
+ .option("--json <json>", "full JSON body, merged over the flags")
622
+ .action(run(async (client, pipelineId, stageId, opts) => {
623
+ assertUuid(pipelineId, "pipeline id");
624
+ assertUuid(stageId, "stage id");
625
+ const body = {};
626
+ if (opts.name !== undefined)
627
+ body.name = opts.name;
628
+ if (opts.color !== undefined)
629
+ body.color = opts.color;
630
+ const flag = (raw, name) => {
631
+ if (raw === undefined)
632
+ return undefined;
633
+ const v = raw.trim().toLowerCase();
634
+ if (v === "true")
635
+ return true;
636
+ if (v === "false")
637
+ return false;
638
+ throw new Error(`${name} must be true or false.`);
639
+ };
640
+ const isWon = flag(opts.isWon, "--is-won"), isLost = flag(opts.isLost, "--is-lost"), isSystem = flag(opts.isSystem, "--is-system");
641
+ if (isWon !== undefined)
642
+ body.isWon = isWon;
643
+ if (isLost !== undefined)
644
+ body.isLost = isLost;
645
+ if (isSystem !== undefined)
646
+ body.isSystem = isSystem;
647
+ if (opts.sortOrder !== undefined) {
648
+ const n = Number(opts.sortOrder.trim());
649
+ if (opts.sortOrder.trim() === "" || !Number.isInteger(n))
650
+ throw new Error("--sort-order must be an integer.");
651
+ body.sortOrder = n;
652
+ }
653
+ if (opts.json !== undefined)
654
+ Object.assign(body, jsonArg(opts.json, "--json"));
655
+ // mirror the API rule (system stages: pipeline_stages_system_never_terminal) so the CLI fails locally, not with a 400
656
+ if (body.isSystem === true && (body.isWon === true || body.isLost === true)) {
657
+ throw new Error("A system holding stage cannot be marked won or lost. Drop --is-won/--is-lost or --is-system.");
658
+ }
659
+ if (Object.keys(body).length === 0)
660
+ throw new Error("Nothing to update. Pass at least one field flag or --json.");
661
+ return client.patch(`/api/v1/pipelines/${encodeURIComponent(pipelineId)}/stages/${encodeURIComponent(stageId)}`, body);
662
+ }));
610
663
  // ---- search ----
611
664
  program
612
665
  .command("search <query>")
@@ -1277,6 +1330,33 @@ appointments
1277
1330
  throw new Error("Nothing to update. Pass at least one field flag or --json.");
1278
1331
  return client.patch(`/api/v1/appointments/${encodeURIComponent(id)}`, body);
1279
1332
  }));
1333
+ appointments
1334
+ .command("outcome <id>")
1335
+ .description("Record the outcome (completed | no_show | cancelled | rescheduled): sets the status (rescheduled keeps it) and moves the contact's open deal to the stage mapped in Pipeline settings (POST /appointments/:id/outcome)")
1336
+ .requiredOption("--outcome <outcome>", "completed, no_show, cancelled or rescheduled")
1337
+ .option("--start <iso>", "rescheduled only: new start, ISO-8601 with tz offset")
1338
+ .option("--end <iso>", "rescheduled only: new end, ISO-8601 with tz offset")
1339
+ .action(run(async (client, id, opts) => {
1340
+ assertUuid(id, "appointment id");
1341
+ if (!["completed", "no_show", "cancelled", "rescheduled"].includes(opts.outcome)) {
1342
+ throw new Error("--outcome must be completed, no_show, cancelled or rescheduled");
1343
+ }
1344
+ if (opts.outcome === "rescheduled" && (!opts.start || !opts.end))
1345
+ throw new Error("--outcome rescheduled needs --start and --end");
1346
+ const body = { outcome: opts.outcome };
1347
+ if (opts.start)
1348
+ body.startTime = opts.start;
1349
+ if (opts.end)
1350
+ body.endTime = opts.end;
1351
+ return client.post(`/api/v1/appointments/${encodeURIComponent(id)}/outcome`, body);
1352
+ }));
1353
+ appointments
1354
+ .command("outcome-undo <id>")
1355
+ .description("Undo the last recorded outcome: status back to what it was, deal back to its previous stage when nobody moved it since (POST /appointments/:id/outcome/undo)")
1356
+ .action(run(async (client, id) => {
1357
+ assertUuid(id, "appointment id");
1358
+ return client.post(`/api/v1/appointments/${encodeURIComponent(id)}/outcome/undo`, {});
1359
+ }));
1280
1360
  appointments
1281
1361
  .command("cancel <id>")
1282
1362
  .description("Cancel an appointment (soft-cancel; sets status=cancelled)")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt",
3
- "version": "1.50.0",
3
+ "version": "1.52.0",
4
4
  "description": "Command-line interface for Conduyt CRM — manage contacts, deals, pipelines, and run insight queries from your terminal.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",