@revturbine/cli 0.12.0 → 0.13.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 +22 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9032,7 +9032,7 @@ function formatDiff(diff) {
|
|
|
9032
9032
|
const parts = [];
|
|
9033
9033
|
if (d.added.length) parts.push(`+${d.added.length} added`);
|
|
9034
9034
|
if (d.changed.length) parts.push(`~${d.changed.length} changed`);
|
|
9035
|
-
if (d.removed.length) parts.push(`-${d.removed.length} only in tenant (
|
|
9035
|
+
if (d.removed.length) parts.push(`-${d.removed.length} only in tenant (pruned on launch unless --no-prune)`);
|
|
9036
9036
|
lines.push(` ${coll}: ${parts.join(", ")}`);
|
|
9037
9037
|
for (const k of d.added) lines.push(` + ${k}`);
|
|
9038
9038
|
for (const k of d.changed) lines.push(` ~ ${k}`);
|
|
@@ -9395,25 +9395,30 @@ var STARTER_PLAYBOOK = {
|
|
|
9395
9395
|
tenant_id: "local",
|
|
9396
9396
|
environment_id: "local",
|
|
9397
9397
|
plans: [
|
|
9398
|
-
{
|
|
9399
|
-
{
|
|
9398
|
+
{ unique_handle: "free", name: "Free", tier_position: 0, sort_order: 0 },
|
|
9399
|
+
{ unique_handle: "pro", name: "Pro", tier_position: 1, sort_order: 1 }
|
|
9400
9400
|
],
|
|
9401
9401
|
entitlements: [
|
|
9402
|
-
{
|
|
9402
|
+
{ unique_handle: "advanced_export", name: "Advanced Export", type: "feature" }
|
|
9403
9403
|
],
|
|
9404
|
+
// Rules reference entities by their HANDLE, never a synthetic id: the import
|
|
9405
|
+
// stores these references verbatim and the runtime resolves them by handle
|
|
9406
|
+
// (entitlement-check.ts matches rule.entitlement_id / plan targets against
|
|
9407
|
+
// unique_handle). Authoring `ent_*` / `plan_*` ids here would produce rules
|
|
9408
|
+
// that never link — the exact bug the plan-154 dogfood surfaced.
|
|
9404
9409
|
entitlement_rules: [
|
|
9405
9410
|
{
|
|
9406
9411
|
id: "er_advanced_export_free",
|
|
9407
|
-
entitlement_id: "
|
|
9408
|
-
targets: [{ kind: "plan", id: "
|
|
9412
|
+
entitlement_id: "advanced_export",
|
|
9413
|
+
targets: [{ kind: "plan", id: "free" }],
|
|
9409
9414
|
segment_ids: [],
|
|
9410
9415
|
enabled: false,
|
|
9411
9416
|
current_usage: 0
|
|
9412
9417
|
},
|
|
9413
9418
|
{
|
|
9414
9419
|
id: "er_advanced_export_pro",
|
|
9415
|
-
entitlement_id: "
|
|
9416
|
-
targets: [{ kind: "plan", id: "
|
|
9420
|
+
entitlement_id: "advanced_export",
|
|
9421
|
+
targets: [{ kind: "plan", id: "pro" }],
|
|
9417
9422
|
segment_ids: [],
|
|
9418
9423
|
enabled: true,
|
|
9419
9424
|
current_usage: 0
|
|
@@ -10409,7 +10414,7 @@ program.command("preview").description("The open draft's Runtime Impact summary
|
|
|
10409
10414
|
].join("\n");
|
|
10410
10415
|
emit(data, Boolean(opts.json), text);
|
|
10411
10416
|
});
|
|
10412
|
-
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
|
|
10417
|
+
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 surface slot (the getPlacement decision for that slot)").option("--surface-type <type>", "Disambiguate a slot that can render more than one surface (with --slot), or resolve by surface type alone").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(
|
|
10413
10418
|
async (opts) => {
|
|
10414
10419
|
const [sel] = requireSelectors(opts, [], { count: 1, allowed: ["draft", "live", "release"], command: "evaluate" });
|
|
10415
10420
|
const conn = connect(opts.url, opts.tenantId);
|
|
@@ -10422,13 +10427,18 @@ program.command("evaluate").description("Run placement/entitlement decisions for
|
|
|
10422
10427
|
}
|
|
10423
10428
|
const body = { ...ctx };
|
|
10424
10429
|
if (opts.planHandle) body.plan_handle = opts.planHandle;
|
|
10425
|
-
|
|
10430
|
+
const wantsSlot = Boolean(opts.slot || opts.surfaceType);
|
|
10431
|
+
if (opts.entitlement && wantsSlot) {
|
|
10432
|
+
fail(EXIT.USAGE, "pass exactly one of --entitlement or --slot/--surface-type (or neither for the ctx file lists).");
|
|
10433
|
+
}
|
|
10426
10434
|
if (opts.entitlement) {
|
|
10427
10435
|
body.entitlement_handles = [opts.entitlement];
|
|
10428
10436
|
body.placement_ids = [];
|
|
10429
10437
|
}
|
|
10430
|
-
if (
|
|
10431
|
-
body.
|
|
10438
|
+
if (wantsSlot) {
|
|
10439
|
+
if (opts.slot) body.slot_id = opts.slot;
|
|
10440
|
+
if (opts.surfaceType) body.surface_type = opts.surfaceType;
|
|
10441
|
+
body.placement_ids = [];
|
|
10432
10442
|
body.entitlement_handles = [];
|
|
10433
10443
|
}
|
|
10434
10444
|
if (sel.kind === "release") body.playbook_version_id = sel.id;
|
package/package.json
CHANGED