@pretense/cli 0.6.23 → 0.6.25
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.
|
@@ -17,7 +17,7 @@ function versionFromPackageJson() {
|
|
|
17
17
|
return void 0;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
var PRETENSE_VERSION = (true ? "0.6.
|
|
20
|
+
var PRETENSE_VERSION = (true ? "0.6.25" : void 0) ?? versionFromPackageJson() ?? "0.0.0-unknown";
|
|
21
21
|
|
|
22
22
|
export {
|
|
23
23
|
PRETENSE_VERSION
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
PRETENSE_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XYBJ63JG.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM,
|
|
@@ -16657,11 +16657,11 @@ function versionFromCliPackageJson() {
|
|
|
16657
16657
|
return void 0;
|
|
16658
16658
|
}
|
|
16659
16659
|
function productVersion() {
|
|
16660
|
-
return override ?? (true ? "0.6.
|
|
16660
|
+
return override ?? (true ? "0.6.25" : void 0) ?? versionFromCliPackageJson() ?? "0.0.0-unknown";
|
|
16661
16661
|
}
|
|
16662
16662
|
var UNKNOWN_COMMIT = "unknown";
|
|
16663
16663
|
function bakedCommitSha() {
|
|
16664
|
-
return "
|
|
16664
|
+
return "24595f8f691656d511f75ed2d8b59f98069779ac".length > 0 ? "24595f8f691656d511f75ed2d8b59f98069779ac" : UNKNOWN_COMMIT;
|
|
16665
16665
|
}
|
|
16666
16666
|
var FEATURE_TIERS = {
|
|
16667
16667
|
compliance_export: "pro",
|
|
@@ -18634,6 +18634,29 @@ function planToTier(plan) {
|
|
|
18634
18634
|
return null;
|
|
18635
18635
|
}
|
|
18636
18636
|
}
|
|
18637
|
+
var SUBSCRIPTION_STATUS_SHAPE = /^[A-Za-z][A-Za-z0-9_-]{0,31}$/;
|
|
18638
|
+
function parseSubscriptionStatus(raw2) {
|
|
18639
|
+
if (raw2 === null) return null;
|
|
18640
|
+
if (typeof raw2 !== "string") return void 0;
|
|
18641
|
+
const trimmed = raw2.trim();
|
|
18642
|
+
return SUBSCRIPTION_STATUS_SHAPE.test(trimmed) ? trimmed : void 0;
|
|
18643
|
+
}
|
|
18644
|
+
function parseEntitlement(body) {
|
|
18645
|
+
const raw2 = body["entitlement"];
|
|
18646
|
+
if (!raw2 || typeof raw2 !== "object") return void 0;
|
|
18647
|
+
const e = raw2;
|
|
18648
|
+
const effectivePlan = planToTier(e["effectivePlan"]);
|
|
18649
|
+
const planOnRecord = planToTier(e["planOnRecord"]);
|
|
18650
|
+
if (effectivePlan === null && planOnRecord === null) return void 0;
|
|
18651
|
+
const subscriptionStatus = parseSubscriptionStatus(e["subscriptionStatus"]);
|
|
18652
|
+
return {
|
|
18653
|
+
effectivePlan,
|
|
18654
|
+
planOnRecord,
|
|
18655
|
+
comped: e["comped"] === true,
|
|
18656
|
+
hasActiveSubscription: e["hasActiveSubscription"] === true,
|
|
18657
|
+
...subscriptionStatus !== void 0 ? { subscriptionStatus } : {}
|
|
18658
|
+
};
|
|
18659
|
+
}
|
|
18637
18660
|
async function tierFromBackend(apiKey) {
|
|
18638
18661
|
const url = `${getConfiguredApiRoot()}/api/cli/auth/validate`;
|
|
18639
18662
|
const controller = new AbortController();
|
|
@@ -18668,7 +18691,7 @@ async function tierFromBackend(apiKey) {
|
|
|
18668
18691
|
detail: "the plan service did not report a recognizable plan"
|
|
18669
18692
|
};
|
|
18670
18693
|
}
|
|
18671
|
-
return { tier, source: "backend" };
|
|
18694
|
+
return { tier, source: "backend", entitlement: parseEntitlement(body) };
|
|
18672
18695
|
} catch (err) {
|
|
18673
18696
|
const aborted = err?.name === "AbortError";
|
|
18674
18697
|
return {
|
|
@@ -18743,8 +18766,56 @@ function tierLabel(tier) {
|
|
|
18743
18766
|
if (tier === "free") return "Free";
|
|
18744
18767
|
return `${tierName(tier)} (${priceLabel(tier)})`;
|
|
18745
18768
|
}
|
|
18769
|
+
function entitlementMismatchLines(ent) {
|
|
18770
|
+
const paidOnRecord = ent.planOnRecord === "pro" || ent.planOnRecord === "enterprise";
|
|
18771
|
+
if (ent.effectivePlan !== "free" || !paidOnRecord) return [];
|
|
18772
|
+
const planName = ent.planOnRecord === "enterprise" ? "Enterprise" : "Pro";
|
|
18773
|
+
const status = ent.subscriptionStatus;
|
|
18774
|
+
if (status === void 0) {
|
|
18775
|
+
return [
|
|
18776
|
+
`${planName} plan on record, but this key resolves to Free.`,
|
|
18777
|
+
"This server did not report the reason \u2014 a paid org without an entitling",
|
|
18778
|
+
"subscription or comp resolves to Free; see pretense.ai/dashboard/settings."
|
|
18779
|
+
];
|
|
18780
|
+
}
|
|
18781
|
+
if (status === null) {
|
|
18782
|
+
if (ent.comped) {
|
|
18783
|
+
return [
|
|
18784
|
+
`${planName} plan on record and the org is comped with no subscription record,`,
|
|
18785
|
+
"yet this key resolves to Free \u2014 that combination is unexpected.",
|
|
18786
|
+
"Please contact support with this output \u2014 pretense.ai/dashboard/settings."
|
|
18787
|
+
];
|
|
18788
|
+
}
|
|
18789
|
+
return [
|
|
18790
|
+
`${planName} plan present, but no active subscription or comp \u2014 running as Free.`,
|
|
18791
|
+
"Attach a Stripe subscription or set the org comp flag \u2014 pretense.ai/dashboard/settings."
|
|
18792
|
+
];
|
|
18793
|
+
}
|
|
18794
|
+
if (ent.hasActiveSubscription) {
|
|
18795
|
+
return [
|
|
18796
|
+
`${planName} plan on record with a ${status} subscription the server reports as`,
|
|
18797
|
+
"active, yet this key resolves to Free \u2014 that combination is unexpected.",
|
|
18798
|
+
"Please contact support with this output \u2014 pretense.ai/dashboard/settings."
|
|
18799
|
+
];
|
|
18800
|
+
}
|
|
18801
|
+
if (ent.comped) {
|
|
18802
|
+
return [
|
|
18803
|
+
`${planName} plan on record and the org IS comped, but a ${status} subscription`,
|
|
18804
|
+
"record is overriding the comp \u2014 running as Free.",
|
|
18805
|
+
`Remove or replace that ${status} subscription record \u2014 pretense.ai/dashboard/settings.`
|
|
18806
|
+
];
|
|
18807
|
+
}
|
|
18808
|
+
return [
|
|
18809
|
+
`${planName} plan on record, but its subscription is ${status} \u2014 running as Free.`,
|
|
18810
|
+
"Replace it with a live subscription \u2014 pretense.ai/dashboard/settings."
|
|
18811
|
+
];
|
|
18812
|
+
}
|
|
18746
18813
|
function planMismatchHint(resolution) {
|
|
18747
|
-
if (resolution.
|
|
18814
|
+
if (resolution.source !== "backend") return [];
|
|
18815
|
+
if (resolution.entitlement) {
|
|
18816
|
+
return entitlementMismatchLines(resolution.entitlement);
|
|
18817
|
+
}
|
|
18818
|
+
if (resolution.tier !== "free") return [];
|
|
18748
18819
|
return [
|
|
18749
18820
|
"Not the plan you expected? An org flagged PRO without an active",
|
|
18750
18821
|
"subscription/comp resolves to Free \u2014 see pretense.ai/dashboard/settings or contact support."
|
|
@@ -20376,7 +20447,7 @@ async function verifyApiKey(apiKey) {
|
|
|
20376
20447
|
return { outcome: "rejected", url, detail: "the API reported the key as not valid" };
|
|
20377
20448
|
}
|
|
20378
20449
|
const plan = typeof body["plan"] === "string" ? body["plan"] : void 0;
|
|
20379
|
-
return { outcome: "valid", url, plan };
|
|
20450
|
+
return { outcome: "valid", url, plan, entitlement: parseEntitlement(body) };
|
|
20380
20451
|
} catch (err) {
|
|
20381
20452
|
const aborted = err?.name === "AbortError";
|
|
20382
20453
|
return {
|
|
@@ -20495,14 +20566,15 @@ function authCommand() {
|
|
|
20495
20566
|
};
|
|
20496
20567
|
writeCredentials(creds);
|
|
20497
20568
|
if (verified) {
|
|
20498
|
-
const
|
|
20569
|
+
const mismatchLines = verification.entitlement ? entitlementMismatchLines(verification.entitlement) : String(verification.plan ?? "").trim().toLowerCase() === "free" ? [
|
|
20570
|
+
"Not the plan you expected? A PRO-flagged org without an active",
|
|
20571
|
+
"subscription/comp resolves to Free \u2014 see pretense.ai/dashboard/settings."
|
|
20572
|
+
] : [];
|
|
20499
20573
|
console.log(
|
|
20500
20574
|
chalk10.green("\n Authenticated. The key was verified by the Pretense API.") + chalk10.dim(`
|
|
20501
20575
|
Key: ${maskApiKey(opts.apiKey)}`) + chalk10.dim(`
|
|
20502
20576
|
Server: ${verification.url}`) + (verification.plan ? chalk10.dim(`
|
|
20503
|
-
Plan: ${verification.plan}`) : "") + (
|
|
20504
|
-
"\n Not the plan you expected? A PRO-flagged org without an active\n subscription/comp resolves to Free \u2014 see pretense.ai/dashboard/settings."
|
|
20505
|
-
) : "") + "\n" + storageNotice()
|
|
20577
|
+
Plan: ${verification.plan}`) : "") + (mismatchLines.length > 0 ? chalk10.dim("\n " + mismatchLines.join("\n ")) : "") + "\n" + storageNotice()
|
|
20506
20578
|
);
|
|
20507
20579
|
return;
|
|
20508
20580
|
}
|
package/dist/postinstall.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pretense/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.25",
|
|
4
4
|
"description": "Local-first AI firewall that mutates proprietary code before sending to LLM APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"tsx": "^4.0.0",
|
|
24
24
|
"typescript": "^5.4.0",
|
|
25
25
|
"vitest": "^1.0.0",
|
|
26
|
-
"@pretense/
|
|
27
|
-
"@pretense/protocol": "0.1.0",
|
|
26
|
+
"@pretense/billing": "0.1.0",
|
|
28
27
|
"@pretense/learner": "0.2.0",
|
|
28
|
+
"@pretense/compliance-engine": "0.1.0",
|
|
29
29
|
"@pretense/mutator": "0.2.0",
|
|
30
30
|
"@pretense/proxy": "0.1.0",
|
|
31
31
|
"@pretense/scanner": "0.2.0",
|
|
32
32
|
"@pretense/scanner-rs": "0.2.0",
|
|
33
|
-
"@pretense/
|
|
34
|
-
"@pretense/
|
|
33
|
+
"@pretense/store": "0.2.0",
|
|
34
|
+
"@pretense/protocol": "0.1.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public",
|