@intercom/cli 0.10.0 → 0.11.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 +6 -0
- package/dist/index.js +48 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ 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.11.0] - 2026-08-17
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `fin workflows versions <id>` lists a workflow's server-side version history, showing which version is live, which is draft, and who saved it. `fin workflows get <id> --version <version_id>` downloads any of those versions as re-uploadable YAML, so a local file can be diffed against what Fin is actually running.
|
|
15
|
+
|
|
10
16
|
## [0.10.0] - 2026-08-17
|
|
11
17
|
|
|
12
18
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -3183,20 +3183,26 @@ function registerWorkflowsCommand(fin) {
|
|
|
3183
3183
|
return table({ columns: ["ID", "TITLE", "STATE", "TRIGGER"], rows });
|
|
3184
3184
|
}, items);
|
|
3185
3185
|
});
|
|
3186
|
-
workflows.command("get <id> [output]").description("Get a workflow by ID as YAML (writes to [output] file, or stdout)").option("--json", "Output as parsed JSON instead of YAML").option("--jq <expr>", "Filter parsed-JSON output with a jq expression").option("--verbose", "Show HTTP request/response details").addHelpText(
|
|
3186
|
+
workflows.command("get <id> [output]").description("Get a workflow by ID as YAML (writes to [output] file, or stdout)").option("--json", "Output as parsed JSON instead of YAML").option("--jq <expr>", "Filter parsed-JSON output with a jq expression").option("--version <version_id>", "Download a historical version instead of the current one").option("--verbose", "Show HTTP request/response details").addHelpText(
|
|
3187
3187
|
"after",
|
|
3188
3188
|
`
|
|
3189
3189
|
Examples:
|
|
3190
3190
|
$ intercom fin workflows get 42 workflow.yaml # write YAML to a file
|
|
3191
3191
|
$ intercom fin workflows get 42 > workflow.yaml # or redirect stdout
|
|
3192
3192
|
$ intercom fin workflows get 42 --json | jq .state
|
|
3193
|
+
$ intercom fin workflows versions 42 # find a version ID
|
|
3194
|
+
$ intercom fin workflows get 42 --version 4821 # print that version's YAML
|
|
3193
3195
|
|
|
3194
3196
|
The YAML it prints is ready to edit and re-upload with
|
|
3195
|
-
\`intercom fin workflows upload
|
|
3197
|
+
\`intercom fin workflows upload\`.
|
|
3198
|
+
|
|
3199
|
+
--version downloads the re-uploadable YAML of a historical version, so you can
|
|
3200
|
+
diff a local file against what is live (\`intercom fin workflows versions <id>\`
|
|
3201
|
+
shows which version that is).`
|
|
3196
3202
|
).action(async function(id, output) {
|
|
3197
3203
|
const opts = this.optsWithGlobals();
|
|
3198
3204
|
const client = await resolveClient(opts);
|
|
3199
|
-
const text = await client.getText(`/fin-sdk/workflows/${id}`);
|
|
3205
|
+
const text = opts.version ? await getVersionYaml2(client, id, opts.version) : await client.getText(`/fin-sdk/workflows/${id}`);
|
|
3200
3206
|
if (opts.json || opts.jq || opts.agent) {
|
|
3201
3207
|
const parsed = parseYaml3(text);
|
|
3202
3208
|
render(parsed, opts, () => formatJson(parsed));
|
|
@@ -3314,6 +3320,45 @@ overwritten (the server does not expose a concurrency token).`
|
|
|
3314
3320
|
})
|
|
3315
3321
|
);
|
|
3316
3322
|
});
|
|
3323
|
+
workflows.command("versions <id>").description("List a workflow's server-side version history (which one is live)").option("--json", "Output as JSON").option("--jq <expr>", "Filter JSON output with jq expression").option("--verbose", "Show HTTP request/response details").addHelpText(
|
|
3324
|
+
"after",
|
|
3325
|
+
`
|
|
3326
|
+
Examples:
|
|
3327
|
+
$ intercom fin workflows versions 42
|
|
3328
|
+
$ intercom fin workflows versions 42 --jq '.entity_version_id'
|
|
3329
|
+
|
|
3330
|
+
STATUS is the server's own vocabulary: live is what Fin is running now, draft is
|
|
3331
|
+
unpublished, previously_live is superseded. Download any of them with
|
|
3332
|
+
\`intercom fin workflows get <id> --version <VERSION>\`.`
|
|
3333
|
+
).action(async function(id) {
|
|
3334
|
+
const opts = this.optsWithGlobals();
|
|
3335
|
+
const client = await resolveClient(opts);
|
|
3336
|
+
const result = await client.get(`/fin-sdk/workflows/${id}/versions`);
|
|
3337
|
+
const items = result.versions ?? [];
|
|
3338
|
+
render(items, opts, () => {
|
|
3339
|
+
if (items.length === 0) {
|
|
3340
|
+
return "No versions found.";
|
|
3341
|
+
}
|
|
3342
|
+
const rows = items.map((v) => ({
|
|
3343
|
+
VERSION: String(v.entity_version_id ?? ""),
|
|
3344
|
+
STATUS: String(v.status ?? ""),
|
|
3345
|
+
CREATED: String(v.created_at ?? ""),
|
|
3346
|
+
AUTHOR: String(v.author?.name ?? ""),
|
|
3347
|
+
NOTE: String(v.note ?? "")
|
|
3348
|
+
}));
|
|
3349
|
+
return table({ columns: ["VERSION", "STATUS", "CREATED", "AUTHOR", "NOTE"], rows });
|
|
3350
|
+
}, items);
|
|
3351
|
+
});
|
|
3352
|
+
}
|
|
3353
|
+
async function getVersionYaml2(client, id, versionId) {
|
|
3354
|
+
const result = await client.get(
|
|
3355
|
+
`/fin-sdk/workflows/${id}/versions/${versionId}`
|
|
3356
|
+
);
|
|
3357
|
+
const content = result.content;
|
|
3358
|
+
if (content == null) {
|
|
3359
|
+
throw new CLIError(`Workflow version ${versionId} returned no content`);
|
|
3360
|
+
}
|
|
3361
|
+
return typeof content === "string" ? content : stringifyYaml3(content);
|
|
3317
3362
|
}
|
|
3318
3363
|
|
|
3319
3364
|
// src/commands/fin/simulations.ts
|