@intercom/cli 0.12.0 → 0.14.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
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  View it from the CLI with `intercom changelog`.
9
9
 
10
+ ## [0.14.0] - 2026-09-02
11
+
12
+ ### Added
13
+
14
+ - `intercom fin workflows upload --verify` compares the workflow the server saved against the file just uploaded and exits non-zero listing any field that did not survive the round-trip, matching `fin procedures upload --verify`.
15
+
16
+ ### Fixed
17
+
18
+ - `--verify` combined with `--dry-run` on a `fin procedures upload` no longer fails: dry-run sends no request, so there is nothing saved to compare against and the verification step is skipped.
19
+
20
+ ## [0.13.0] - 2026-09-01
21
+
22
+ ### Changed
23
+
24
+ - Workspaces created with `intercom auth signup` are now opted into the narrower `public-fin-cli` capability instead of the broad internal Fin SDK one. New workspaces get exactly the endpoints the CLI uses; existing workspaces are unaffected.
25
+
10
26
  ## [0.12.0] - 2026-08-26
11
27
 
12
28
  ### Added
package/dist/index.js CHANGED
@@ -964,7 +964,7 @@ async function signup(options) {
964
964
  email_submission: {},
965
965
  sign_up_locale: "en",
966
966
  new_app_feature_flags: [
967
- "fin-sdk",
967
+ "public-fin-cli",
968
968
  "messenger-public-api"
969
969
  ]
970
970
  };
@@ -3075,7 +3075,7 @@ back missing or changed is reported.`
3075
3075
  }
3076
3076
  const result = await client.postFormData("/fin-sdk/upload", formData);
3077
3077
  render(result, opts, () => formatJson(result));
3078
- if (opts.verify) {
3078
+ if (opts.verify && !isDryRun()) {
3079
3079
  verifySaved(filePath, fileContent.toString("utf8"), result);
3080
3080
  }
3081
3081
  });
@@ -3570,17 +3570,23 @@ shows which version that is).`
3570
3570
  console.log(text.replace(/\n+$/, ""));
3571
3571
  }
3572
3572
  });
3573
- workflows.command("upload <file>").description('Upload a workflow YAML file (creates if id is "new", updates if numeric)').option("--json", "Output as JSON").option("--jq <expr>", "Filter JSON output with jq expression").option("--verbose", "Show HTTP request/response details").addHelpText(
3573
+ workflows.command("upload <file>").description('Upload a workflow YAML file (creates if id is "new", updates if numeric)').option("--verify", "Fail if the saved workflow differs from the file uploaded").option("--json", "Output as JSON").option("--jq <expr>", "Filter JSON output with jq expression").option("--verbose", "Show HTTP request/response details").addHelpText(
3574
3574
  "after",
3575
3575
  `
3576
3576
  Examples:
3577
3577
  $ intercom fin workflows upload ./welcome.yaml
3578
3578
  $ intercom fin workflows get wf-42 > local.yaml; vim local.yaml; intercom fin workflows upload local.yaml
3579
3579
  $ intercom fin workflows upload ./new.yaml --json | jq .visual_builder_url
3580
+ $ intercom fin workflows upload ./welcome.yaml --verify
3580
3581
 
3581
3582
  The YAML file's id field determines whether this creates or updates:
3582
3583
  id: "new" \u2192 creates a new workflow
3583
- id: <int> \u2192 updates the existing workflow with that id`
3584
+ id: <int> \u2192 updates the existing workflow with that id
3585
+
3586
+ --verify compares the workflow the server saved against the file just uploaded
3587
+ and exits non-zero listing any field that did not survive the round-trip. Fields
3588
+ the server adds (ids, defaults) are ignored; only content that was sent and came
3589
+ back missing or changed is reported.`
3584
3590
  ).action(async function(filePath) {
3585
3591
  const opts = this.optsWithGlobals();
3586
3592
  const client = await resolveClient(opts);
@@ -3600,6 +3606,9 @@ The YAML file's id field determines whether this creates or updates:
3600
3606
  "Visual Builder URL": result.visual_builder_url != null ? String(result.visual_builder_url) : void 0
3601
3607
  })
3602
3608
  );
3609
+ if (opts.verify && !isDryRun()) {
3610
+ verifySaved2(filePath, fileContent, result);
3611
+ }
3603
3612
  });
3604
3613
  workflows.command("enable <id>").description("Set a workflow's state to live").option("--json", "Output as JSON").option("--jq <expr>", "Filter JSON output with jq expression").option("--verbose", "Show HTTP request/response details").addHelpText(
3605
3614
  "after",
@@ -3715,6 +3724,37 @@ async function getVersionYaml2(client, id, versionId) {
3715
3724
  }
3716
3725
  return typeof content === "string" ? content : stringifyYaml3(content);
3717
3726
  }
3727
+ function withoutExpectedChanges(sent) {
3728
+ if (sent == null || typeof sent !== "object" || Array.isArray(sent)) {
3729
+ return sent;
3730
+ }
3731
+ const rest = { ...sent };
3732
+ delete rest.type;
3733
+ delete rest.version;
3734
+ if (String(rest.id ?? "").toLowerCase() === "new") {
3735
+ delete rest.id;
3736
+ }
3737
+ return rest;
3738
+ }
3739
+ function verifySaved2(filePath, sentYaml, result) {
3740
+ if (typeof result.new_file_content !== "string") {
3741
+ throw new CLIError("Cannot verify: the server did not return the saved workflow");
3742
+ }
3743
+ const drift = findDrift(
3744
+ withoutExpectedChanges(parseYaml3(sentYaml)),
3745
+ parseYaml3(result.new_file_content)
3746
+ );
3747
+ if (drift.length === 0) {
3748
+ console.error(`Verified: the saved workflow matches ${filePath}`);
3749
+ return;
3750
+ }
3751
+ for (const path of drift) {
3752
+ console.error(` ${path}`);
3753
+ }
3754
+ throw new CLIError(
3755
+ `${drift.length} field(s) did not survive the upload (listed above). Compare with \`intercom fin workflows get ${result.id ?? "<id>"}\`.`
3756
+ );
3757
+ }
3718
3758
 
3719
3759
  // src/commands/fin/simulations.ts
3720
3760
  import { readFile as readFile5 } from "fs/promises";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intercom/cli",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "CLI tool for managing Intercom workspaces",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.23.0",