@revturbine/cli 0.16.0 → 0.16.1
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/dist/cli.js +12 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9750,6 +9750,13 @@ function collectSelectors(opts, positionalFiles = []) {
|
|
|
9750
9750
|
if (opts.release) found.push({ kind: "release", id: opts.release });
|
|
9751
9751
|
return found;
|
|
9752
9752
|
}
|
|
9753
|
+
function orderDiffSelectors(sels) {
|
|
9754
|
+
if (sels.length !== 2) return sels;
|
|
9755
|
+
const [first, second] = sels;
|
|
9756
|
+
if (second.kind === "live" && first.kind !== "live") return [second, first];
|
|
9757
|
+
if (first.kind === "file" && second.kind !== "file") return [second, first];
|
|
9758
|
+
return sels;
|
|
9759
|
+
}
|
|
9753
9760
|
function describeSelector(sel) {
|
|
9754
9761
|
switch (sel.kind) {
|
|
9755
9762
|
case "file":
|
|
@@ -10469,12 +10476,13 @@ program.command("validate").description("Validate a Config File offline (schema)
|
|
|
10469
10476
|
}
|
|
10470
10477
|
diag("\u2713 No blocking findings.");
|
|
10471
10478
|
});
|
|
10472
|
-
program.command("diff").description("Compare two config versions (first \u2192 second). Dry-run, no writes.").argument("[file...]", "Local Config File path(s)").option("--draft", "The tenant's open draft").option("--live", "The current live Release").option("--release <id>", "A specific playbook version / Release").option("-u, --url <url>", "RevTurbine instance URL", DEFAULT_URL).option("-t, --tenant-id <id>", "x-tenant-id (defaults to the stored token tenant)").action(async (files, opts) => {
|
|
10479
|
+
program.command("diff").description("Compare two config versions (first \u2192 second; a file vs --draft/--live/--release previews the launch \u2014 the server side is the base). Dry-run, no writes.").argument("[file...]", "Local Config File path(s)").option("--draft", "The tenant's open draft").option("--live", "The current live Release").option("--release <id>", "A specific playbook version / Release").option("-u, --url <url>", "RevTurbine instance URL", DEFAULT_URL).option("-t, --tenant-id <id>", "x-tenant-id (defaults to the stored token tenant)").action(async (files, opts) => {
|
|
10473
10480
|
const sels = requireSelectors(opts, files, { count: 2, allowed: ["file", "draft", "live", "release"], command: "diff" });
|
|
10474
|
-
const
|
|
10481
|
+
const ordered = orderDiffSelectors(sels);
|
|
10482
|
+
const needsServer = ordered.some((s) => s.kind !== "file");
|
|
10475
10483
|
const conn = needsServer ? connect(opts.url, opts.tenantId) : null;
|
|
10476
|
-
const [a, b] = await Promise.all(
|
|
10477
|
-
diag(`Diff (${
|
|
10484
|
+
const [a, b] = await Promise.all(ordered.map((s) => loadVersion(conn, s)));
|
|
10485
|
+
diag(`Diff (${ordered.map((s) => s.kind === "file" ? s.path : s.kind === "release" ? `--release ${s.id}` : `--${s.kind}`).join(" \u2192 ")}):`);
|
|
10478
10486
|
process.stdout.write(`${formatDiff(diffExportedConfig(a, b))}
|
|
10479
10487
|
`);
|
|
10480
10488
|
});
|
package/package.json
CHANGED