@revturbine/cli 0.7.0 → 0.7.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 +14 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6671,12 +6671,23 @@ program.command("history").description("The Release Version Log: recent Releases
|
|
|
6671
6671
|
)
|
|
6672
6672
|
);
|
|
6673
6673
|
});
|
|
6674
|
-
program.command("preview").description("The open draft's
|
|
6674
|
+
program.command("preview").description("The open draft's Runtime Impact summary (objects affected, billing impact) + field-level changes.").option("-u, --url <url>", "RevTurbine instance URL", DEFAULT_URL).option("-t, --tenant-id <id>", "x-tenant-id (defaults to the stored token tenant)").option("--json", "Machine-readable output").action(async (opts) => {
|
|
6675
6675
|
const conn = connect(opts.url, opts.tenantId);
|
|
6676
6676
|
const playbookVersionId = await requireOpenDraft(conn);
|
|
6677
|
-
const { res, json } = await getJson(conn, `/api/
|
|
6677
|
+
const { res, json } = await getJson(conn, `/api/optimization/drafts/${playbookVersionId}/changes`);
|
|
6678
6678
|
if (!res.ok) httpFail(conn, "preview", res.status, json);
|
|
6679
|
-
|
|
6679
|
+
const impact = json?.impact ?? {};
|
|
6680
|
+
const changes = Array.isArray(json?.changes) ? json.changes : [];
|
|
6681
|
+
const data = { playbook_version_id: playbookVersionId, impact, changes };
|
|
6682
|
+
const billingObjects = impact.billing?.objects ?? [];
|
|
6683
|
+
const text = [
|
|
6684
|
+
`Runtime impact (draft ${playbookVersionId}):`,
|
|
6685
|
+
table((impact.byCategory ?? []).map((c) => [c.label, `${c.count}`])),
|
|
6686
|
+
`Billing impact: ${billingObjects.length === 0 ? "(none)" : billingObjects.join(", ")}`,
|
|
6687
|
+
`Changes (${changes.length}):`,
|
|
6688
|
+
table(changes.map((c) => [String(c.action ?? ""), String(c.objectType ?? ""), String(c.objectName ?? ""), String(c.summary ?? "")]))
|
|
6689
|
+
].join("\n");
|
|
6690
|
+
emit(data, Boolean(opts.json), text);
|
|
6680
6691
|
});
|
|
6681
6692
|
program.command("evaluate").description("Run placement/entitlement decisions for a user context against a config version. Requires --live, --draft, or --release <id>.").option("--live", "Evaluate the live configuration").option("--draft", "Evaluate the tenant's open draft (clean-room: no suppression/cap history)").option("--release <id>", "Evaluate a past release (from its frozen snapshot)").option("--entitlement <handle>", "Check one entitlement (the checkEntitlement result)").option("--slot <id>", "Evaluate one placement/slot (the getPlacement decision)").option("--plan-handle <handle>", "Evaluate as if the user were on this plan (overrides the ctx file)").option("-u, --url <url>", "RevTurbine instance URL", DEFAULT_URL).requiredOption("--user <file>", "JSON file: { user_id, customer_id?, plan_handle?, traits?, now_iso? }").option("-t, --tenant-id <id>", "x-tenant-id (defaults to the stored token tenant)").action(
|
|
6682
6693
|
async (opts) => {
|
package/package.json
CHANGED