@nebulr-group/bridge-cli 0.6.0-beta.7 → 0.6.0-beta.8
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/commands/check.command.d.ts +10 -0
- package/dist/commands/check.command.d.ts.map +1 -0
- package/dist/commands/check.command.js +95 -0
- package/dist/commands/check.command.js.map +1 -0
- package/dist/commands/plan.command.d.ts +19 -5
- package/dist/commands/plan.command.d.ts.map +1 -1
- package/dist/commands/plan.command.js +40 -26
- package/dist/commands/plan.command.js.map +1 -1
- package/dist/gate-rules.d.ts +51 -0
- package/dist/gate-rules.d.ts.map +1 -0
- package/dist/gate-rules.js +171 -0
- package/dist/gate-rules.js.map +1 -0
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +3 -0
- package/dist/program.js.map +1 -1
- package/dist/prompts/auth-master-integration-prompt.md +4 -1
- package/dist/prompts/billing/master.md +5 -2
- package/dist/prompts/decisions/feature-control.md +6 -1
- package/dist/prompts/decisions/payments.md +9 -4
- package/dist/prompts/decisions/roles.md +2 -2
- package/dist/prompts/decisions/teams.md +4 -3
- package/dist/prompts/fit-together.md +22 -4
- package/dist/prompts/flags/master.md +3 -0
- package/dist/prompts/mechanisms.md +9 -5
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type GateFinding } from '../gate-rules.js';
|
|
3
|
+
export declare function projectSourceFiles(root: string): string[];
|
|
4
|
+
export declare function checkGates(root: string): {
|
|
5
|
+
scanned: number;
|
|
6
|
+
findings: GateFinding[];
|
|
7
|
+
};
|
|
8
|
+
export declare function formatGateReport(scanned: number, findings: GateFinding[]): string;
|
|
9
|
+
export declare function registerCheckCommands(program: Command): void;
|
|
10
|
+
//# sourceMappingURL=check.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.command.d.ts","sourceRoot":"","sources":["../../src/commands/check.command.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBzD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAIrF;AAUD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAwBjF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqB5D"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// TBP-705 — `bridge check gates`: the last step of every integration guide.
|
|
2
|
+
//
|
|
3
|
+
// The owner's rule (2026-09-29) is that every gate in app code is a flag. An
|
|
4
|
+
// agent in the owner's own test run still wrote `canManageTeam` from a list of
|
|
5
|
+
// role names and wrapped analytics in `<Entitled>`, because nothing checked the
|
|
6
|
+
// result. This command lists each direct role, privilege, plan or plan-feature
|
|
7
|
+
// check in the project with the flag to use instead, and exits 1 while any is
|
|
8
|
+
// left, so "done" is something the agent can verify rather than assert.
|
|
9
|
+
//
|
|
10
|
+
// Local and read-only: it reads the developer's sources and calls nothing.
|
|
11
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
12
|
+
import { join, relative, resolve } from 'node:path';
|
|
13
|
+
import { outputError, outputPrompt, outputSuccess } from '../output.js';
|
|
14
|
+
import { GATE_EXCEPTION_MARKER, SKIPPED_DIRS, codeGateFindings, isScannedSource, } from '../gate-rules.js';
|
|
15
|
+
export function projectSourceFiles(root) {
|
|
16
|
+
const out = [];
|
|
17
|
+
const walk = (dir) => {
|
|
18
|
+
for (const name of readdirSync(dir)) {
|
|
19
|
+
const path = join(dir, name);
|
|
20
|
+
let stat;
|
|
21
|
+
try {
|
|
22
|
+
stat = statSync(path);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (stat.isDirectory()) {
|
|
28
|
+
if (!SKIPPED_DIRS.has(name) && !name.startsWith('.'))
|
|
29
|
+
walk(path);
|
|
30
|
+
}
|
|
31
|
+
else if (isScannedSource(name)) {
|
|
32
|
+
out.push(path);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
walk(root);
|
|
37
|
+
return out.sort();
|
|
38
|
+
}
|
|
39
|
+
export function checkGates(root) {
|
|
40
|
+
const files = projectSourceFiles(root);
|
|
41
|
+
const findings = files.flatMap((file) => codeGateFindings(readFileSync(file, 'utf-8'), relative(root, file)));
|
|
42
|
+
return { scanned: files.length, findings };
|
|
43
|
+
}
|
|
44
|
+
const KIND_LABEL = {
|
|
45
|
+
role: 'role check',
|
|
46
|
+
privilege: 'privilege check',
|
|
47
|
+
'plan-feature': 'plan-feature check',
|
|
48
|
+
'plan-name': 'plan-name check',
|
|
49
|
+
'removed-api': 'removed API',
|
|
50
|
+
};
|
|
51
|
+
export function formatGateReport(scanned, findings) {
|
|
52
|
+
if (findings.length === 0) {
|
|
53
|
+
return `bridge check gates: ${scanned} files checked, no direct role, privilege, plan or plan-feature checks. Every gate goes through a flag.\n`;
|
|
54
|
+
}
|
|
55
|
+
const lines = [
|
|
56
|
+
`bridge check gates: ${findings.length} direct check${findings.length === 1 ? '' : 's'} in ${scanned} files.`,
|
|
57
|
+
'',
|
|
58
|
+
'Every gate in app code is a flag: its rule says why (a privilege, a plan feature, a rollout).',
|
|
59
|
+
'Replace each check below, then run this again until it is clean. The flag rules themselves are set with',
|
|
60
|
+
'`bridge flag` / the MCP flag tools; read the app\'s roles first with `bridge role list`.',
|
|
61
|
+
'',
|
|
62
|
+
];
|
|
63
|
+
for (const f of findings) {
|
|
64
|
+
lines.push(`${f.file}:${f.line} ${KIND_LABEL[f.kind]}`);
|
|
65
|
+
lines.push(` ${f.text}`);
|
|
66
|
+
lines.push(` instead: ${f.instead}`);
|
|
67
|
+
lines.push('');
|
|
68
|
+
}
|
|
69
|
+
lines.push('Not gates, and fine as they are: plan limits (`<QuotaGate>`, `useQuota`, `@RequireQuota`) and permission on one', `specific record ("only the author edits their post"). A direct check the developer explicitly asked for stays with a`, `\`// ${GATE_EXCEPTION_MARKER}: <reason>\` comment on the line or the line above.`);
|
|
70
|
+
return lines.join('\n') + '\n';
|
|
71
|
+
}
|
|
72
|
+
export function registerCheckCommands(program) {
|
|
73
|
+
const check = program.command('check').description('Check the project against Bridge\'s rules (local, read-only)');
|
|
74
|
+
check
|
|
75
|
+
.command('gates')
|
|
76
|
+
.description('List every direct role, privilege, plan or plan-feature check in the project, with the flag to use instead. Exits 1 while any is left.')
|
|
77
|
+
.option('--cwd <path>', 'Project directory (defaults to current)', process.cwd())
|
|
78
|
+
.option('--json', 'Print the findings as JSON')
|
|
79
|
+
.action((opts) => {
|
|
80
|
+
try {
|
|
81
|
+
const root = resolve(opts.cwd);
|
|
82
|
+
const { scanned, findings } = checkGates(root);
|
|
83
|
+
if (opts.json)
|
|
84
|
+
outputSuccess({ scanned, findings });
|
|
85
|
+
else
|
|
86
|
+
outputPrompt(formatGateReport(scanned, findings));
|
|
87
|
+
if (findings.length > 0)
|
|
88
|
+
process.exitCode = 1;
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
outputError(error);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=check.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.command.js","sourceRoot":"","sources":["../../src/commands/check.command.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,wEAAwE;AACx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. */
|
|
21
21
|
kind?: QuotaKind;
|
|
22
|
+
/**
|
|
23
|
+
* TBP-763 — `membership`: Bridge counts the workspace's active members.
|
|
24
|
+
* Gauge only. `null` asks the server to remove a stored source (an omitted
|
|
25
|
+
* one is kept).
|
|
26
|
+
*/
|
|
27
|
+
source?: QuotaSource | null;
|
|
22
28
|
/** Required for `metered`, forbidden for `hard`. */
|
|
23
29
|
pricing?: QuotaPricing;
|
|
24
30
|
}
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
/**
|
|
32
|
+
* TBP-763 — where a gauge's value comes from when the app does not set it.
|
|
33
|
+
* `membership`: Bridge answers with the workspace's active members, pending
|
|
34
|
+
* invites included. How an app limits seats, under the name it picks.
|
|
35
|
+
*/
|
|
36
|
+
export type QuotaSource = 'membership';
|
|
37
|
+
/** The kind a quota resolves to — same rule as the server. No metric name is special. */
|
|
28
38
|
export declare function quotaKindOf(quota: {
|
|
29
39
|
metric: string;
|
|
30
40
|
kind?: string;
|
|
@@ -33,11 +43,12 @@ export interface MetricSummary {
|
|
|
33
43
|
metric: string;
|
|
34
44
|
/** `mixed` when the plans disagree on the metric's kind. */
|
|
35
45
|
kind: QuotaKind | 'mixed';
|
|
36
|
-
/** TBP-
|
|
37
|
-
|
|
46
|
+
/** TBP-763 — `membership` when Bridge counts it from the workspace's members; `mixed` when plans disagree. */
|
|
47
|
+
source?: QuotaSource | 'mixed';
|
|
38
48
|
plans: Array<{
|
|
39
49
|
planKey: string;
|
|
40
50
|
kind: QuotaKind;
|
|
51
|
+
source?: QuotaSource;
|
|
41
52
|
limit: number;
|
|
42
53
|
policy: QuotaPolicy;
|
|
43
54
|
}>;
|
|
@@ -55,6 +66,8 @@ export declare function validateQuotaEntry(entry: {
|
|
|
55
66
|
limit?: number;
|
|
56
67
|
policy?: string;
|
|
57
68
|
kind?: string;
|
|
69
|
+
/** TBP-763 — `membership`, or `none` / null to leave the quota without one. */
|
|
70
|
+
source?: string | null;
|
|
58
71
|
priceAmount?: number;
|
|
59
72
|
currency?: string;
|
|
60
73
|
}): Quota;
|
|
@@ -159,6 +172,7 @@ export interface PlanSpec {
|
|
|
159
172
|
limit: number;
|
|
160
173
|
policy: string;
|
|
161
174
|
kind?: string;
|
|
175
|
+
source?: string | null;
|
|
162
176
|
priceAmount?: number;
|
|
163
177
|
priceCurrency?: string;
|
|
164
178
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.command.d.ts","sourceRoot":"","sources":["../../src/commands/plan.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQjG,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oDAAoD;IACpD,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"plan.command.d.ts","sourceRoot":"","sources":["../../src/commands/plan.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQjG,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QA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AAZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAInD;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAYnD;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACpC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAiIrD"}
|
|
@@ -5,12 +5,9 @@ import { shapePlan } from '../shape.js';
|
|
|
5
5
|
import { DecisionNeededError, decisionField } from '../product-decisions.js';
|
|
6
6
|
const QUOTA_POLICIES = ['hard', 'metered'];
|
|
7
7
|
const QUOTA_KINDS = ['counter', 'gauge'];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** The kind a quota resolves to — same rule as the server. */
|
|
8
|
+
const QUOTA_SOURCES = ['membership'];
|
|
9
|
+
/** The kind a quota resolves to — same rule as the server. No metric name is special. */
|
|
11
10
|
export function quotaKindOf(quota) {
|
|
12
|
-
if (quota.metric === SEATS_METRIC)
|
|
13
|
-
return 'gauge';
|
|
14
11
|
return quota.kind === 'gauge' ? 'gauge' : 'counter';
|
|
15
12
|
}
|
|
16
13
|
/**
|
|
@@ -22,20 +19,16 @@ export function listMetrics(plans) {
|
|
|
22
19
|
for (const plan of plans) {
|
|
23
20
|
for (const q of plan.quotas ?? []) {
|
|
24
21
|
const kind = quotaKindOf(q);
|
|
25
|
-
const
|
|
22
|
+
const source = kind === 'gauge' && q.source === 'membership' ? 'membership' : undefined;
|
|
23
|
+
const entry = byMetric.get(q.metric) ?? { metric: q.metric, kind, ...(source ? { source } : {}), plans: [] };
|
|
26
24
|
if (entry.kind !== kind)
|
|
27
25
|
entry.kind = 'mixed';
|
|
28
|
-
|
|
26
|
+
else if (entry.source !== source)
|
|
27
|
+
entry.source = 'mixed';
|
|
28
|
+
entry.plans.push({ planKey: String(plan.key), kind, ...(source ? { source } : {}), limit: q.limit, policy: q.policy });
|
|
29
29
|
byMetric.set(q.metric, entry);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
// TBP-709 — the built-in seats gauge is a metric every app may use, even
|
|
33
|
-
// before any plan limits it, so it is always listed (as MCP list_plan_quotas).
|
|
34
|
-
const seats = byMetric.get(SEATS_METRIC);
|
|
35
|
-
if (seats)
|
|
36
|
-
seats.builtIn = true;
|
|
37
|
-
else
|
|
38
|
-
byMetric.set(SEATS_METRIC, { metric: SEATS_METRIC, kind: 'gauge', builtIn: true, plans: [] });
|
|
39
32
|
return [...byMetric.values()].sort((a, b) => a.metric.localeCompare(b.metric));
|
|
40
33
|
}
|
|
41
34
|
export function validateQuotaEntry(entry) {
|
|
@@ -53,8 +46,8 @@ export function validateQuotaEntry(entry) {
|
|
|
53
46
|
if (!QUOTA_POLICIES.includes(policy)) {
|
|
54
47
|
throw new Error(`--policy must be one of ${QUOTA_POLICIES.join(', ')}, got "${entry.policy}".`);
|
|
55
48
|
}
|
|
56
|
-
// TBP-699 — counter vs gauge. Only sent when given
|
|
57
|
-
//
|
|
49
|
+
// TBP-699 — counter vs gauge. Only sent when given, so an omitted kind
|
|
50
|
+
// leaves the server's default/stored kind in charge.
|
|
58
51
|
let kind;
|
|
59
52
|
if (entry.kind !== undefined) {
|
|
60
53
|
if (!QUOTA_KINDS.includes(entry.kind)) {
|
|
@@ -62,16 +55,28 @@ export function validateQuotaEntry(entry) {
|
|
|
62
55
|
}
|
|
63
56
|
kind = entry.kind;
|
|
64
57
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
// TBP-763 — `membership`: Bridge counts the workspace's active members
|
|
59
|
+
// (seats). Only a hard gauge can have it.
|
|
60
|
+
let source;
|
|
61
|
+
if (entry.source === null || entry.source === 'none') {
|
|
62
|
+
source = null;
|
|
63
|
+
}
|
|
64
|
+
else if (entry.source !== undefined) {
|
|
65
|
+
if (!QUOTA_SOURCES.includes(entry.source)) {
|
|
66
|
+
throw new Error(`--source must be membership (or none), got "${entry.source}".`);
|
|
67
|
+
}
|
|
68
|
+
source = entry.source;
|
|
69
|
+
if (kind !== 'gauge') {
|
|
70
|
+
throw new Error(`"${metric}" has --source membership, which only a gauge can have (Bridge answers it with the workspace's active members). Add --kind gauge, or drop --source for a counter the app reports.`);
|
|
71
|
+
}
|
|
72
|
+
if (policy === 'metered') {
|
|
73
|
+
throw new Error(`"${metric}" has --source membership and cannot be metered. Use --policy hard.`);
|
|
68
74
|
}
|
|
69
|
-
kind = 'gauge';
|
|
70
75
|
}
|
|
71
76
|
if (policy === 'metered' && kind === 'gauge') {
|
|
72
77
|
throw new Error(`"${metric}" is a gauge and a gauge cannot be metered: metered billing charges for usage that happened during a period, which only a counter records. Use --policy hard, or --kind counter.`);
|
|
73
78
|
}
|
|
74
|
-
const withKind = kind ? { kind } : {};
|
|
79
|
+
const withKind = { ...(kind ? { kind } : {}), ...(source !== undefined ? { source } : {}) };
|
|
75
80
|
// TBP-275 — metered quotas carry a per-unit price; hard quotas must not.
|
|
76
81
|
if (policy === 'metered') {
|
|
77
82
|
const amount = entry.priceAmount;
|
|
@@ -368,7 +373,7 @@ export function registerPlanCommands(program) {
|
|
|
368
373
|
plan.command('apply')
|
|
369
374
|
.description('Set up or reshape one plan in a single write: name, trial, prices and quotas together (creates it when the key is new)')
|
|
370
375
|
.requiredOption('--spec <json>', 'The plan as JSON, or @file.json: { key, name?, description?, trial?, trialDays?, ' +
|
|
371
|
-
'prices?: [{ amount, interval, currency? }], quotas?: [{ metric, limit, policy, kind?, priceAmount?, priceCurrency? }], ' +
|
|
376
|
+
'prices?: [{ amount, interval, currency? }], quotas?: [{ metric, limit, policy, kind?, source?, priceAmount?, priceCurrency? }], ' +
|
|
372
377
|
'features?: [{ key, name? }], removePrices?: [{ interval, currency? }], removeQuotas?: [metric], removeFeatures?: [key] }. ' +
|
|
373
378
|
'Same shape as the MCP apply_plan tool. Prices, quotas and features are upserted; anything not mentioned is kept')
|
|
374
379
|
.action(async (opts) => {
|
|
@@ -470,14 +475,16 @@ export function planApplyWrite(spec, plans) {
|
|
|
470
475
|
}
|
|
471
476
|
const currencies = [...new Set(prices.map((p) => p.currency.toUpperCase()))];
|
|
472
477
|
for (const q of spec.quotas ?? []) {
|
|
473
|
-
const
|
|
478
|
+
const existing = quotas.find((e) => e.metric === String(q.metric ?? '').trim());
|
|
479
|
+
const kind = q.kind ?? existing?.kind;
|
|
474
480
|
let entry;
|
|
475
481
|
try {
|
|
476
482
|
entry = validateQuotaEntry({
|
|
477
483
|
metric: q.metric,
|
|
478
484
|
limit: q.limit,
|
|
479
485
|
policy: q.policy,
|
|
480
|
-
kind
|
|
486
|
+
kind,
|
|
487
|
+
source: q.source !== undefined ? q.source : kind === 'gauge' ? existing?.source : undefined,
|
|
481
488
|
priceAmount: q.priceAmount,
|
|
482
489
|
currency: q.priceCurrency ?? (currencies.length === 1 ? currencies[0] : undefined),
|
|
483
490
|
});
|
|
@@ -619,6 +626,10 @@ function registerQuotaCommands(plan) {
|
|
|
619
626
|
.option('--kind <kind>', `${QUOTA_KINDS.join(' | ')}. counter (default) = summed per billing period; gauge = absolute value your app sets, never reset. ` +
|
|
620
627
|
"If deleting it frees room, it's a gauge and your app counts it; if it happened, it's a counter and Bridge counts it. " +
|
|
621
628
|
'Omit to keep an existing quota\'s kind')
|
|
629
|
+
.option('--source <source>', "membership = Bridge counts the workspace's active members, pending invites included (needs --kind gauge, --policy hard). " +
|
|
630
|
+
'Seats: name the limit (e.g. seats), --kind gauge --source membership; enforce it where invites happen ' +
|
|
631
|
+
'(the team page seat-limit setting, or @RequireQuota on your own invite handler), never with a flag or an entitlement. ' +
|
|
632
|
+
'Omit to keep an existing gauge\'s source; none removes it')
|
|
622
633
|
.option('--price-amount <n>', 'Per-unit price for metered quotas (required with --policy metered)', parseFloat)
|
|
623
634
|
.option('--price-currency <currency>', 'Currency for the metered price (defaults to the plan\'s price currency when unambiguous)')
|
|
624
635
|
.action(async (key, opts) => {
|
|
@@ -632,12 +643,15 @@ function registerQuotaCommands(plan) {
|
|
|
632
643
|
const currency = opts.priceCurrency?.toUpperCase() ??
|
|
633
644
|
(planCurrencies.length === 1 ? planCurrencies[0] : undefined);
|
|
634
645
|
// TBP-699 — an omitted --kind keeps the existing quota's kind.
|
|
635
|
-
const
|
|
646
|
+
const existing = quotas.find((q) => q.metric === String(opts.metric ?? '').trim());
|
|
647
|
+
const kind = opts.kind ?? existing?.kind;
|
|
648
|
+
// TBP-763 — an omitted --source keeps an existing gauge's source.
|
|
636
649
|
const entry = validateQuotaEntry({
|
|
637
650
|
metric: opts.metric,
|
|
638
651
|
limit: opts.limit,
|
|
639
652
|
policy: opts.policy,
|
|
640
|
-
kind
|
|
653
|
+
kind,
|
|
654
|
+
source: opts.source ?? (kind === 'gauge' ? existing?.source : undefined),
|
|
641
655
|
priceAmount: opts.priceAmount,
|
|
642
656
|
currency,
|
|
643
657
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.command.js","sourceRoot":"","sources":["../../src/commands/plan.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAsB,MAAM,yBAAyB,CAAC;AAkCjG,MAAM,cAAc,GAA+B,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACvE,MAAM,WAAW,GAA6B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAEnE,sFAAsF;AACtF,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,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,EAAE,IAAI,EAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QACzH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;SACtB,WAAW,CAAC,8BAA8B,CAAC;SAC3C,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;SACjC,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC;SACjD,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,UAAkB,EAAE,EAAE;QACpD,IAAI,CAAC;YACH,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5C,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YAC1D,aAAa,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,mBAAmB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QACzH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TBP-705 — the owner's rule for app code (2026-09-29): every gate in app code
|
|
3
|
+
* is a flag. Its rule says why (a privilege, a plan feature, a rollout); app
|
|
4
|
+
* code never reads a role, a privilege list, the plan or a plan feature to
|
|
5
|
+
* decide what someone may see or do. Numbers (plan limits) and permission on
|
|
6
|
+
* one specific record are not gates.
|
|
7
|
+
*
|
|
8
|
+
* Two checks live here, from one list of what a direct check looks like:
|
|
9
|
+
* - `codeGateFindings`: `bridge check gates`, run by the agent as the last
|
|
10
|
+
* step of every integration, over the developer's own sources;
|
|
11
|
+
* - `docGateViolations`: the currency test over the guides we serve, so no
|
|
12
|
+
* guide teaches the thing the command then flags.
|
|
13
|
+
*
|
|
14
|
+
* bridge-svelte and bridge-nestjs carry a copy of the doc pattern list in
|
|
15
|
+
* their own currency tests. This file is the source; keep them the same.
|
|
16
|
+
*/
|
|
17
|
+
export type GateKind = 'role' | 'privilege' | 'plan-feature' | 'plan-name' | 'removed-api';
|
|
18
|
+
export type GateFinding = {
|
|
19
|
+
file: string;
|
|
20
|
+
line: number;
|
|
21
|
+
kind: GateKind;
|
|
22
|
+
text: string;
|
|
23
|
+
/** What to use instead, in words an agent can act on. */
|
|
24
|
+
instead: string;
|
|
25
|
+
};
|
|
26
|
+
/** Written on the line, or the line above, to mark a direct check the developer asked for. */
|
|
27
|
+
export declare const GATE_EXCEPTION_MARKER = "bridge-gate-exception";
|
|
28
|
+
type CodeCheck = {
|
|
29
|
+
kind: GateKind;
|
|
30
|
+
pattern: RegExp;
|
|
31
|
+
instead: (match: RegExpExecArray) => string;
|
|
32
|
+
};
|
|
33
|
+
export declare const CODE_CHECKS: CodeCheck[];
|
|
34
|
+
/** Every direct gate check in one source file. */
|
|
35
|
+
export declare function codeGateFindings(source: string, file: string): GateFinding[];
|
|
36
|
+
export declare const SOURCE_EXTENSIONS: string[];
|
|
37
|
+
export declare const SKIPPED_DIRS: Set<string>;
|
|
38
|
+
export declare function isScannedSource(name: string): boolean;
|
|
39
|
+
export declare const DOC_FORBIDDEN: Array<[string, RegExp]>;
|
|
40
|
+
export type DocViolation = {
|
|
41
|
+
line: number;
|
|
42
|
+
rule: string;
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Every sentence in a guide that teaches a direct check, outside the one
|
|
47
|
+
* section a guide may have whose heading says "Exceptions".
|
|
48
|
+
*/
|
|
49
|
+
export declare function docGateViolations(markdown: string): DocViolation[];
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=gate-rules.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AM,GAAG,YAAY,EAAE,CAsBlE"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TBP-705 — the owner's rule for app code (2026-09-29): every gate in app code
|
|
3
|
+
* is a flag. Its rule says why (a privilege, a plan feature, a rollout); app
|
|
4
|
+
* code never reads a role, a privilege list, the plan or a plan feature to
|
|
5
|
+
* decide what someone may see or do. Numbers (plan limits) and permission on
|
|
6
|
+
* one specific record are not gates.
|
|
7
|
+
*
|
|
8
|
+
* Two checks live here, from one list of what a direct check looks like:
|
|
9
|
+
* - `codeGateFindings`: `bridge check gates`, run by the agent as the last
|
|
10
|
+
* step of every integration, over the developer's own sources;
|
|
11
|
+
* - `docGateViolations`: the currency test over the guides we serve, so no
|
|
12
|
+
* guide teaches the thing the command then flags.
|
|
13
|
+
*
|
|
14
|
+
* bridge-svelte and bridge-nestjs carry a copy of the doc pattern list in
|
|
15
|
+
* their own currency tests. This file is the source; keep them the same.
|
|
16
|
+
*/
|
|
17
|
+
/** Written on the line, or the line above, to mark a direct check the developer asked for. */
|
|
18
|
+
export const GATE_EXCEPTION_MARKER = 'bridge-gate-exception';
|
|
19
|
+
const ROLE_INSTEAD = 'A flag ruled on the privilege this role stands for (`bridge role list` shows which privileges each role holds), ' +
|
|
20
|
+
'e.g. `privileges contains "USER_WRITE"`. Then `<FeatureFlag key="…">` or a route rule with `featureFlag` in SvelteKit, ' +
|
|
21
|
+
'`@RequireFeatureFlag(\'…\')` in NestJS. A role rule (`user.role eq "ADMIN"`) only when the developer means the role itself.';
|
|
22
|
+
const PLAN_NAME_INSTEAD = 'List the feature on the plans that sell it (`bridge plan feature add <plan> <feature>`) and gate with a flag ruled ' +
|
|
23
|
+
'`bridge:billing.entitlement.<feature> eq true`. Never compare plan names in code.';
|
|
24
|
+
function planFeatureInstead(key) {
|
|
25
|
+
const k = key ?? '<feature>';
|
|
26
|
+
return (`A flag \`${k}\` ruled \`bridge:billing.entitlement.${k} eq true\` ` +
|
|
27
|
+
'(SvelteKit `<FeatureFlag key>` / route rule `featureFlag`, NestJS `@RequireFeatureFlag`). ' +
|
|
28
|
+
`A direct plan-feature check is the documented exception: keep it only if the developer asked for no flag, and mark the line \`// ${GATE_EXCEPTION_MARKER}: <reason>\`.`);
|
|
29
|
+
}
|
|
30
|
+
function privilegeInstead(key) {
|
|
31
|
+
return (`A flag ruled \`privileges contains "${key ?? '<PRIVILEGE>'}"\`, read with \`<FeatureFlag key>\` / a route rule ` +
|
|
32
|
+
'`featureFlag` (SvelteKit) or `@RequireFeatureFlag` (NestJS).');
|
|
33
|
+
}
|
|
34
|
+
const firstLiteral = (s) => /['"`]([\w.:-]+)['"`]/.exec(s ?? '')?.[1];
|
|
35
|
+
const leadingLiteral = (s) => /^\s*\{?\s*['"`]([\w.:-]+)['"`]/.exec(s ?? '')?.[1];
|
|
36
|
+
export const CODE_CHECKS = [
|
|
37
|
+
// Roles
|
|
38
|
+
{ kind: 'role', pattern: /\.role\s*(?:===|!==|==|!=)|(?:===|!==|==|!=)\s*[\w$.?]*\.role\b/, instead: () => ROLE_INSTEAD },
|
|
39
|
+
{ kind: 'role', pattern: /\brole\s*(?:===|!==|==|!=)\s*['"`]/i, instead: () => ROLE_INSTEAD },
|
|
40
|
+
{ kind: 'role', pattern: /\.includes\(\s*[\w$.?]*\brole\b/i, instead: () => ROLE_INSTEAD },
|
|
41
|
+
{ kind: 'role', pattern: /\bhasRole\s*\(/, instead: () => ROLE_INSTEAD },
|
|
42
|
+
{ kind: 'role', pattern: /\bcase\s+['"`](?:OWNER|ADMIN|MEMBER)['"`]\s*:/, instead: () => ROLE_INSTEAD },
|
|
43
|
+
{
|
|
44
|
+
kind: 'removed-api',
|
|
45
|
+
pattern: /@RequireRole\s*\(/,
|
|
46
|
+
instead: () => `\`@RequireRole\` is gone. ${ROLE_INSTEAD}`,
|
|
47
|
+
},
|
|
48
|
+
// Privileges read in app code (`@RequirePrivilege` is an API-token scope, not a gate on a person)
|
|
49
|
+
{
|
|
50
|
+
kind: 'privilege',
|
|
51
|
+
pattern: /\bprivileges\s*\??\.\s*(?:includes|some|indexOf|has|find)\s*\(([^)]*)/,
|
|
52
|
+
instead: (m) => privilegeInstead(firstLiteral(m[1])),
|
|
53
|
+
},
|
|
54
|
+
// Plan features read directly. The key is named only when it is written as a literal.
|
|
55
|
+
{ kind: 'plan-feature', pattern: /<Entitled\b[^>]*?\bto=(.*)/, instead: (m) => planFeatureInstead(leadingLiteral(m[1])) },
|
|
56
|
+
{ kind: 'plan-feature', pattern: /\bentitlements\s*\??\.\s*can\s*\((.*)/, instead: (m) => planFeatureInstead(leadingLiteral(m[1])) },
|
|
57
|
+
{ kind: 'plan-feature', pattern: /@RequireEntitlement\s*\((.*)/, instead: (m) => planFeatureInstead(leadingLiteral(m[1])) },
|
|
58
|
+
// Plan names compared
|
|
59
|
+
{ kind: 'plan-name', pattern: /\bplan(?:Key|Name|Slug|Id)?\s*(?:===|!==|==|!=)\s*['"`]/i, instead: () => PLAN_NAME_INSTEAD },
|
|
60
|
+
{ kind: 'plan-name', pattern: /\.plan(?:\??\.(?:key|slug|name|id))?\s*(?:===|!==|==|!=)\s*['"`]/, instead: () => PLAN_NAME_INSTEAD },
|
|
61
|
+
{ kind: 'plan-name', pattern: /\bis(?:Pro|Free|Enterprise|Team|Business|Premium)(?:Plan|User)?\b\s*[(=]/, instead: () => PLAN_NAME_INSTEAD },
|
|
62
|
+
{
|
|
63
|
+
kind: 'removed-api',
|
|
64
|
+
pattern: /\bplans\s*:\s*\[/,
|
|
65
|
+
instead: () => `Route rules no longer take \`plans\`. ${PLAN_NAME_INSTEAD}`,
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
const COMMENT_LINE = /^\s*(?:\/\/|\*|\/\*|<!--)/;
|
|
69
|
+
/** Every direct gate check in one source file. */
|
|
70
|
+
export function codeGateFindings(source, file) {
|
|
71
|
+
const lines = source.split('\n');
|
|
72
|
+
const out = [];
|
|
73
|
+
lines.forEach((line, i) => {
|
|
74
|
+
if (COMMENT_LINE.test(line))
|
|
75
|
+
return;
|
|
76
|
+
if (line.includes(GATE_EXCEPTION_MARKER) || (i > 0 && lines[i - 1].includes(GATE_EXCEPTION_MARKER)))
|
|
77
|
+
return;
|
|
78
|
+
const seen = new Set();
|
|
79
|
+
for (const check of CODE_CHECKS) {
|
|
80
|
+
if (seen.has(check.kind))
|
|
81
|
+
continue;
|
|
82
|
+
const m = check.pattern.exec(line);
|
|
83
|
+
if (!m)
|
|
84
|
+
continue;
|
|
85
|
+
seen.add(check.kind);
|
|
86
|
+
out.push({ file, line: i + 1, kind: check.kind, text: line.trim(), instead: check.instead(m) });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
export const SOURCE_EXTENSIONS = ['.svelte', '.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.vue'];
|
|
92
|
+
export const SKIPPED_DIRS = new Set([
|
|
93
|
+
'node_modules', '.git', 'dist', 'build', '.svelte-kit', '.next', '.nuxt', '.output', 'coverage', '.turbo', '.vercel',
|
|
94
|
+
'__tests__', 'e2e', 'tests',
|
|
95
|
+
]);
|
|
96
|
+
export function isScannedSource(name) {
|
|
97
|
+
if (name.endsWith('.d.ts'))
|
|
98
|
+
return false;
|
|
99
|
+
if (/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(name))
|
|
100
|
+
return false;
|
|
101
|
+
return SOURCE_EXTENSIONS.some((ext) => name.endsWith(ext));
|
|
102
|
+
}
|
|
103
|
+
// ── Docs: what no guide may teach ───────────────────────────────────────────
|
|
104
|
+
export const DOC_FORBIDDEN = [
|
|
105
|
+
['a role compared in code', /\b(?:user|session|claims|token|me|currentUser|profile|locals\.user|req\.user|\$user|\$profile)\??\.role\s*(?:===|!==|==|!=)/],
|
|
106
|
+
['a role compared in code', /\brole\s*(?:===|!==|==|!=)\s*['"`]/i],
|
|
107
|
+
['a role list checked in code', /\[\s*['"][A-Z_]+['"](?:\s*,\s*['"][A-Z_]+['"])*\s*\]\s*\.includes\(/],
|
|
108
|
+
['a role checked in code', /\bhasRole\s*\(/],
|
|
109
|
+
['a role decorator on a handler', /@RequireRole\s*\(/],
|
|
110
|
+
['a role check on the page', /\brole check\b[^.\n]{0,30}\b(?:in|on) (?:the |your )?(?:page|component|code|handler|layout|controller)/i],
|
|
111
|
+
['a role check on the page', /\bcheck\w*\b[^.\n]{0,30}\brole\b[^.\n]{0,30}\b(?:in|on) (?:the |your )?(?:page|component|code|layout)\b/i],
|
|
112
|
+
['"target a role instead"', /target a role instead/i],
|
|
113
|
+
['privileges read in code', /\bprivileges\s*\??\.\s*(?:includes|some|indexOf|has)\s*\(/],
|
|
114
|
+
['a direct plan-feature check', /<Entitled\b/],
|
|
115
|
+
['a direct plan-feature check', /\bentitlements\s*\??\.\s*can\s*\(/],
|
|
116
|
+
['a direct plan-feature check', /@RequireEntitlement\s*\(/],
|
|
117
|
+
['a plan name compared in code', /\.plan(?:Key|Name|Slug)?\s*(?:===|!==|==|!=)\s*['"`]/],
|
|
118
|
+
['a plan name compared in code', /\bplan(?:Key|Name|Slug)?\s*(?:===|!==|==|!=)\s*['"`]/i],
|
|
119
|
+
['a plan-name helper', /\bis(?:Pro|Free|Enterprise|Team|Business)(?:Plan|User)?\b\s*[(=]/],
|
|
120
|
+
['a route rule on plans', /\bplans\s*:\s*\[/],
|
|
121
|
+
['a route rule on a role', /\{[^}\n]*\b(?:match|path)\s*:[^}\n]*\brole\s*:\s*['"`]/],
|
|
122
|
+
['a route rule on a privilege', /\bprivilege\s*:\s*['"`](?!ANONYMOUS|AUTHENTICATED)[A-Z_]+['"`]/],
|
|
123
|
+
['a flag rule that names plans', /"attribute"\s*:\s*"(?:tenant\.plan|bridge:billing\.plan)"/],
|
|
124
|
+
['browser counting called demo-grade', /demo[- ]grade/i],
|
|
125
|
+
['browser counting called display only', /display,? not enforcement/i],
|
|
126
|
+
['browser counting said unable to refuse', /only (?:a|the|your) backend can (?:refuse|enforce|stop)/i],
|
|
127
|
+
[
|
|
128
|
+
'browser counting said not to work',
|
|
129
|
+
/\b(?:browser|frontend|client)(?:[- ](?:only|side))?\b[^.\n]{0,40}\b(?:won't|will not|does not|doesn't|cannot|can't|can not) (?:work|enforce|be trusted)/i,
|
|
130
|
+
],
|
|
131
|
+
['browser counting said not production-ready', /\b(?:browser|frontend|client)\b[^.\n]{0,60}\bnot (?:production|prod)[- ](?:ready|grade)/i],
|
|
132
|
+
// TBP-757: `contains` on privileges is exact membership; advice written around the old substring match is stale.
|
|
133
|
+
['privileges said to match as text', /\b(?:matched|matches|match) (?:privilege keys )?as text\b|\bno other (?:privilege )?key contains\b/i],
|
|
134
|
+
];
|
|
135
|
+
/** A sentence that tells the reader NOT to do the forbidden thing. */
|
|
136
|
+
const NEGATED = /\b(?:never|instead of|rather than|do not|don't|not a|is gone|no longer)\b/i;
|
|
137
|
+
const HEADING = /^(#{1,6})\s+(.*)$/;
|
|
138
|
+
/**
|
|
139
|
+
* Every sentence in a guide that teaches a direct check, outside the one
|
|
140
|
+
* section a guide may have whose heading says "Exceptions".
|
|
141
|
+
*/
|
|
142
|
+
export function docGateViolations(markdown) {
|
|
143
|
+
const out = [];
|
|
144
|
+
let exceptionLevel = 0; // heading depth of the Exceptions section we are in, 0 = none
|
|
145
|
+
let inFence = false;
|
|
146
|
+
markdown.split('\n').forEach((line, i) => {
|
|
147
|
+
if (/^\s*(?:```|~~~)/.test(line))
|
|
148
|
+
inFence = !inFence;
|
|
149
|
+
const heading = inFence ? null : HEADING.exec(line);
|
|
150
|
+
if (heading) {
|
|
151
|
+
const level = heading[1].length;
|
|
152
|
+
if (exceptionLevel && level <= exceptionLevel)
|
|
153
|
+
exceptionLevel = 0;
|
|
154
|
+
if (/exception/i.test(heading[2]))
|
|
155
|
+
exceptionLevel = level;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (exceptionLevel)
|
|
159
|
+
return;
|
|
160
|
+
for (const sentence of line.split(/(?<=[.!?])\s+/)) {
|
|
161
|
+
if (NEGATED.test(sentence))
|
|
162
|
+
continue;
|
|
163
|
+
for (const [rule, pattern] of DOC_FORBIDDEN) {
|
|
164
|
+
if (pattern.test(sentence))
|
|
165
|
+
out.push({ line: i + 1, rule, text: sentence.trim() });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
return out;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=gate-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-rules.js","sourceRoot":"","sources":["../src/gate-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAeH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D,MAAM,YAAY,GAChB,kHAAkH;IAClH,yHAAyH;IACzH,6HAA6H,CAAC;AAEhI,MAAM,iBAAiB,GACrB,qHAAqH;IACrH,mFAAmF,CAAC;AAEtF,SAAS,kBAAkB,CAAC,GAAuB;IACjD,MAAM,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC;IAC7B,OAAO,CACL,YAAY,CAAC,yCAAyC,CAAC,aAAa;QACpE,4FAA4F;QAC5F,oIAAoI,qBAAqB,eAAe,CACzK,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAuB;IAC/C,OAAO,CACL,uCAAuC,GAAG,IAAI,aAAa,sDAAsD;QACjH,8DAA8D,CAC/D,CAAC;AACJ,CAAC;AAQD,MAAM,YAAY,GAAG,CAAC,CAAqB,EAAE,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1F,MAAM,cAAc,GAAG,CAAC,CAAqB,EAAE,EAAE,CAAC,gCAAgC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtG,MAAM,CAAC,MAAM,WA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C,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/program.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoBzC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqBvD"}
|
package/dist/program.js
CHANGED
|
@@ -15,6 +15,7 @@ import { registerGuideCommands } from './commands/guide.command.js';
|
|
|
15
15
|
import { registerOpsCommands } from './commands/ops.command.js';
|
|
16
16
|
import { registerStripeCommands } from './commands/stripe.command.js';
|
|
17
17
|
import { registerIntegrationCommands } from './commands/integration.command.js';
|
|
18
|
+
import { registerCheckCommands } from './commands/check.command.js';
|
|
18
19
|
/**
|
|
19
20
|
* Every command group the CLI has, registered on `program`.
|
|
20
21
|
*
|
|
@@ -41,5 +42,7 @@ export function registerCommands(program) {
|
|
|
41
42
|
registerStripeCommands(program);
|
|
42
43
|
// After setup + event: adds `setup status` and `event auth-attempts` to those groups (TBP-541).
|
|
43
44
|
registerIntegrationCommands(program);
|
|
45
|
+
// TBP-705 — `bridge check gates`, the last verification step of every guide.
|
|
46
|
+
registerCheckCommands(program);
|
|
44
47
|
}
|
|
45
48
|
//# sourceMappingURL=program.js.map
|
package/dist/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC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AC;IAC7B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,gGAAgG;IAChG,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACrC,6EAA6E;IAC7E,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
You are integrating **Bridge Authentication** (auth, tenant management, RBAC) into a user's application. Your job is to detect the project structure, identify the technologies, and apply the right per-framework integration for each.
|
|
4
4
|
|
|
5
|
+
> **The one rule for app code: every gate is a flag.** A link, a page, a button, an endpoint: if some people get it and others do not, the code asks a flag, and the flag's rule says why (a privilege, a plan feature, a rollout). App code never reads a role, a privilege list, the plan or a plan feature to decide what someone may see or do. Numbers are plan limits, and permission on one specific record stays in app code. `bridge guide fit-together` has the whole rule; the last verification step runs `npx @nebulr-group/bridge-cli check gates`.
|
|
6
|
+
|
|
5
7
|
This prompt is framework-agnostic. It orchestrates discovery, confirmation, and verification — the actual install commands, file shapes, and code snippets live in the per-framework guides fetched in Step 4.
|
|
6
8
|
|
|
7
9
|
> **Related master prompts** — if the user asked for flags or billing specifically (not auth), stop here and route them:
|
|
@@ -238,8 +240,9 @@ For each integrated project:
|
|
|
238
240
|
1. **Build check** — run the project's build command (from `package.json` scripts)
|
|
239
241
|
2. **Config check** — confirm the `appId` environment variable is set
|
|
240
242
|
3. **Route check** — confirm protected routes have guards and public routes are accessible
|
|
243
|
+
4. **Gate check** — run `npx @nebulr-group/bridge-cli check gates` in each project. Every gate in app code is a flag: it lists each direct role, privilege, plan or plan-feature check with the flag to use instead. Fix every one and run it again until it is clean. Only a check the developer explicitly asked to keep stays, marked `// bridge-gate-exception: <reason>`
|
|
241
244
|
|
|
242
|
-
If anything fails, diagnose and fix before moving on. Once the checks pass, move on to the summary in Step 6b — do NOT just dump a list of changed files at the user.
|
|
245
|
+
If anything fails, including the gate check, diagnose and fix before moving on. Once the checks pass, move on to the summary in Step 6b — do NOT just dump a list of changed files at the user.
|
|
243
246
|
|
|
244
247
|
## Step 6b — Tell the developer what they just got
|
|
245
248
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
You are integrating **Bridge Billing** into a user's application — plan selection, Stripe Checkout, subscription state, lifecycle notices (trial / dunning / cancel), and usage quota counters.
|
|
4
4
|
|
|
5
|
+
> **The one rule for app code: every gate is a flag.** A link, a page, a button, an endpoint: if some people get it and others do not, the code asks a flag, and the flag's rule says why (a privilege, a plan feature, a rollout). App code never reads a role, a privilege list, the plan or a plan feature to decide what someone may see or do. Numbers are plan limits, and permission on one specific record stays in app code. `bridge guide fit-together` has the whole rule; the last verification step runs `npx @nebulr-group/bridge-cli check gates`.
|
|
6
|
+
|
|
5
7
|
This prompt is framework-agnostic. It orchestrates discovery, pricing model setup, and verification — the actual install commands and code snippets live in the per-framework guides fetched in Step 4.
|
|
6
8
|
|
|
7
9
|
> **Related master prompts** — if the user hasn't set up auth yet, stop here and route them:
|
|
@@ -117,7 +119,7 @@ From their answer, map everything to confirmation tables before creating anythin
|
|
|
117
119
|
|
|
118
120
|
Use `hard` when overage should be blocked. Use `metered` when overage should bill via Stripe.
|
|
119
121
|
|
|
120
|
-
**Counter or gauge?** If deleting it frees room, it's a gauge and your app counts it; if it happened, it's a counter and Bridge counts it. AI completions, exports and API calls are counters (reset each period); projects, tickets and seats
|
|
122
|
+
**Counter or gauge?** If deleting it frees room, it's a gauge and your app counts it; if it happened, it's a counter and Bridge counts it. AI completions, exports and API calls are counters (reset each period); projects, tickets and seats are gauges (never reset). Seats are a gauge the app names (e.g. `seats`) with source `membership`: Bridge counts the workspace's active members itself, pending invites included, and the app never reports them. The developer decides the metric list; you decide the kind from that sentence and say why in one line.
|
|
121
123
|
|
|
122
124
|
**Entitlements** (features on for some plans, off for others):
|
|
123
125
|
|
|
@@ -199,7 +201,7 @@ bridge plan feature add <plan> <feature_key> --name "<Display name>"
|
|
|
199
201
|
on the plan; every `hard` quota is also an entitlement of the same name.)
|
|
200
202
|
Check the result with `bridge plan quota list`, which lists every metric with its kind.
|
|
201
203
|
|
|
202
|
-
**Where the limit is counted.** Once, where the action happens. Ask the developer whether the action calls their server. If it does, the plan-limit decorator on the handler that creates the thing (NestJS `@RequireQuota`) refuses at the cap and records the use after a successful request — a POST increments the limit, nothing else to wire — and the frontend only shows that decision. If it happens in the browser only, the frontend reports it (`bridge.usage.report` / `bridge.usage.set`) and `<QuotaGate>` stops the button at the cap: a first-class setup
|
|
204
|
+
**Where the limit is counted.** Once, where the action happens. Ask the developer whether the action calls their server. If it does, the plan-limit decorator on the handler that creates the thing (NestJS `@RequireQuota`) refuses at the cap and records the use after a successful request — a POST increments the limit, nothing else to wire — and the frontend only shows that decision. If it happens in the browser only, the frontend reports it (`bridge.usage.report` / `bridge.usage.set`) and `<QuotaGate>` stops the button at the cap: a complete, first-class setup. Never both for one metric. `bridge guide mechanisms` has the whole model; `bridge guide fit-together` shows where limits sit next to plans, roles and flags.
|
|
203
205
|
|
|
204
206
|
## Step 4 — Fetch and apply the per-framework guide
|
|
205
207
|
|
|
@@ -259,6 +261,7 @@ For each integrated project, the agent verifies — do not hand this to the deve
|
|
|
259
261
|
6. Cancel a payment — redirected back to the subscription page
|
|
260
262
|
7. Paywall (unless opted out): sign in as a new tenant with no plan — you land on the paywall page (or `/welcome` if the developer chose one) and can't reach the app until a plan is chosen
|
|
261
263
|
8. Plan limit (when a backend was wired): at the cap, the decorated request answers `402 QUOTA_EXCEEDED` — send it with curl, not only through the UI — and in the app the upgrade dialog opens naming the metric
|
|
264
|
+
9. **Gate check** — `npx @nebulr-group/bridge-cli check gates` in the project: every direct role, privilege, plan or plan-feature check it lists becomes a flag. Run it again until it is clean
|
|
262
265
|
|
|
263
266
|
If anything fails, diagnose and fix before moving on.
|
|
264
267
|
|
|
@@ -14,7 +14,7 @@ Features should be controlled with feature flags. A flag can switch a route, an
|
|
|
14
14
|
- **How much do they get? A plan limit.** Numbers are not flags: see the **payments** guide.
|
|
15
15
|
- **May they change this one record? The app's own code.** Only the app knows who owns what.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
**Every gate in app code is a flag.** App code never reads a role, a privilege list, the plan or a plan feature to decide what someone may see or do; before calling the work done, `npx @nebulr-group/bridge-cli check gates` lists any that are left.
|
|
18
18
|
|
|
19
19
|
## Start from what is there
|
|
20
20
|
|
|
@@ -117,6 +117,11 @@ A rule for "people who may see reports":
|
|
|
117
117
|
1. `evaluate_feature_flag` / `bridge flag eval` with a context that should get the feature, then one that should not: the answers differ as the developer intended.
|
|
118
118
|
2. `list_feature_flags` / `bridge flag list` shows no warnings on the flag.
|
|
119
119
|
3. In the app, as a test user on each side of the rule.
|
|
120
|
+
4. `npx @nebulr-group/bridge-cli check gates` in the project: no direct role, privilege, plan or plan-feature check left.
|
|
121
|
+
|
|
122
|
+
## Exceptions
|
|
123
|
+
|
|
124
|
+
Checking a plan feature without a flag (`@RequireEntitlement` on the backend, `<Entitled>` or `$entitlements.can` in the UI) exists for the rare case where the developer explicitly asks for no flag. It prints a one-time note in development; mark the line `// bridge-gate-exception: <reason>` so `check gates` leaves it.
|
|
120
125
|
|
|
121
126
|
## Where this connects
|
|
122
127
|
|
|
@@ -23,6 +23,7 @@ Product questions. Ask, wait, never guess. Then show the answer back as tables (
|
|
|
23
23
|
4. **What does each plan limit, and how much?** In their words: "2 tickets on Free, 100 on Pro", "10 seats", "1,000 exports a month".
|
|
24
24
|
5. **For each limit: at the limit, block, or keep going and charge per extra unit?** If they charge, how much per unit?
|
|
25
25
|
6. **For each limit: does the action call your server?** ("Does clicking Export send a request to your backend?") The answer decides where it is counted; see below.
|
|
26
|
+
For a seat limit, ask instead: **do invites go through Bridge's built-in team page, or through your own invite handler?** The answer decides where the seat limit is checked; see below.
|
|
26
27
|
7. **Which features does each plan sell?** ("Analytics on Pro only.") They go on the plans' features lists.
|
|
27
28
|
8. **Do they want a welcome page for new customers** where they choose a plan? Offer it; create it only if they say yes.
|
|
28
29
|
|
|
@@ -36,7 +37,7 @@ Product questions. Ask, wait, never guess. Then show the answer back as tables (
|
|
|
36
37
|
- **Monthly and yearly prices of one tier are one plan with two prices,** never `pro-monthly` and `pro-yearly`. Reason: the subscription page then shows one plan with a monthly/yearly switch.
|
|
37
38
|
- **A free plan gets a price of 0.** Reason: a plan with no price cannot be assigned to a workspace.
|
|
38
39
|
- **Counter or gauge?** If deleting it frees room, it's a gauge and your app counts it; if it happened, it's a counter and Bridge counts it. Exports, AI completions and emails are counters (reset each billing period). Tickets, projects and stored files are gauges (never reset). Decide from that sentence and say which you chose.
|
|
39
|
-
- **Seats are the
|
|
40
|
+
- **Seats are a plan limit the app names, counted from membership:** metric `seats`, kind `gauge`, source `membership` (`set_plan_quota` / `bridge plan quota set pro --metric seats --limit 10 --policy hard --kind gauge --source membership`). Reason: Bridge then counts the workspace's active members itself, pending invites included, so the app never reports a seat. No metric name is built in.
|
|
40
41
|
- **Reuse metric names the app already has** (`list_plan_quotas`) before inventing new ones. Reason: two names for one thing split the count.
|
|
41
42
|
- **Connect Stripe with test keys first; live keys only when going live.** Reason: nobody is charged while you build. Use `setup_payments` / `bridge setup payments`: it stores the keys and switches payments on in one step.
|
|
42
43
|
- **Connect Stripe before adding paid prices.** Reason: each price is created in Stripe as it is saved.
|
|
@@ -50,11 +51,11 @@ Tell the developer this plainly; it is where integrations go wrong.
|
|
|
50
51
|
1. **The plan holds the number.** A limit is a quota on the plan: metric, limit, `hard`, and `counter` or `gauge`.
|
|
51
52
|
2. **It is counted once, where the action happens.** Ask whether the action calls the developer's server, then follow the answer. When it does, the backend counts and enforces it: in NestJS one decorator on the handler that creates the thing, `@RequireQuota('exports')`. Before the handler runs, a workspace at its limit gets `402` with `{ code: 'QUOTA_EXCEEDED', metric, used, limit, fix }` and the handler never runs. After a `2xx` answer, Bridge records one use. Nothing else to wire: no usage call, no counter table. If Bridge cannot answer, the request is refused with `503`, never let through.
|
|
52
53
|
3. **Gauges send the app's own count.** `@RequireQuota('tickets', { current })` on create and `@SyncQuota('tickets', { current })` on delete, where `current` returns the app's count from its own database. There is no decrement.
|
|
53
|
-
4. **Seats need no count at all.** `@RequireQuota('
|
|
54
|
+
4. **Seats need no count at all; they are checked where invites happen.** Bridge counts the workspace's active members, pending invites included, and the count drops when someone is removed or suspended. Invites through the built-in team page: give it the seat limit's name, `<TeamManagementPanel seatsMetric="seats" />`, and Invite stops at the limit with the upgrade dialog. Invites through the app's own handler: `@RequireQuota('seats')` on that handler. Bridge's invite API does not refuse at the limit by itself, so one of the two is always needed. Never gate seats with a flag or an entitlement.
|
|
54
55
|
5. **With a backend, the frontend only shows the count and explains the refusal.** It does not report the same metric. With no code at all, the upgrade dialog opens on a `402`, names the limit, and links to the subscription page. A member who cannot manage billing is told to ask the owner. Disabling a button before the click (`<QuotaGate>`) or showing "8 of 10" (`useQuota`) is optional.
|
|
55
|
-
6. **When the action happens in the browser, the browser counts it.** For an app whose action never reaches a server of its own (local-first, data on the device), `bridge.usage.report('exports')` records something that happened and `bridge.usage.set('projects', n)` how many exist, and `<QuotaGate metric="exports">` around the button stops it at the limit. This is a first-class way to run limits
|
|
56
|
+
6. **When the action happens in the browser, the browser counts it.** For an app whose action never reaches a server of its own (local-first, data on the device), `bridge.usage.report('exports')` records something that happened and `bridge.usage.set('projects', n)` how many exist, and `<QuotaGate metric="exports">` around the button stops it at the limit. This is a complete, first-class way to run limits. Never count one metric in both places.
|
|
56
57
|
7. **`metered` never blocks.** Past the included amount it bills per unit through Stripe.
|
|
57
|
-
8. **A feature a plan sells goes in the plan's features list, and a flag controls it.** `analytics` on `pro` makes `bridge:billing.entitlement.analytics` true on Pro and false elsewhere; the flag that controls the feature has the rule `bridge:billing.entitlement.analytics eq true`, so the rule never names a plan
|
|
58
|
+
8. **A feature a plan sells goes in the plan's features list, and a flag controls it.** `analytics` on `pro` makes `bridge:billing.entitlement.analytics` true on Pro and false elsewhere; the flag that controls the feature has the rule `bridge:billing.entitlement.analytics eq true`, so the rule never names a plan; checking the plan feature directly is the exception at the end of this guide. No upgrade dialog opens by itself: it opens when someone opens a gated route, clicks something gated, or the backend answers `402`. A hard quota with limit 1 still works the same way; it is the older way. Never put `@RequireEntitlement` and `@RequireQuota` on the same name: at the cap the entitlement answers `403` first and the upgrade dialog never opens.
|
|
58
59
|
9. **The plan-choice page** (`/subscription/plan`) appears only when the app has plans and "customers must pick a plan" is on. Turn it off with `update_app` (`paymentsAutoRedirect: false`) / `bridge app update --payments-auto-redirect false`.
|
|
59
60
|
|
|
60
61
|
The flag and its rule are set up in the **feature-control** guide.
|
|
@@ -79,6 +80,10 @@ The flag and its rule are set up in the **feature-control** guide.
|
|
|
79
80
|
3. At the limit, send the decorated request with curl: it answers `402 QUOTA_EXCEEDED`. In the app, the upgrade dialog opens and names the limit.
|
|
80
81
|
4. A paid plan opens Stripe Checkout and returns to the subscription page with the new plan.
|
|
81
82
|
|
|
83
|
+
## Exceptions
|
|
84
|
+
|
|
85
|
+
Checking a plan feature without a flag (`@RequireEntitlement` on the backend, `<Entitled>` or `$entitlements.can` in the UI) exists for the rare case where the developer explicitly asks for no flag. It prints a one-time note in development; mark the line `// bridge-gate-exception: <reason>` so `check gates` leaves it.
|
|
86
|
+
|
|
82
87
|
## Where this connects
|
|
83
88
|
|
|
84
89
|
- **Fit together:** plans, limits, roles and flags side by side (`bridge guide fit-together`).
|
|
@@ -45,7 +45,7 @@ Product questions. Ask, wait, never guess.
|
|
|
45
45
|
- **Keep Owner as the one role with everything.** Never strip it: in the default setup it is the only role that can delete, and every workspace needs someone who can.
|
|
46
46
|
- **Make the lowest sensible role the default**, by creating it with the default setting on or with `set_default_role` / `bridge role set-default <key>` for a role that exists. Reason: a forgotten role on an invitation then gives too little, not too much.
|
|
47
47
|
- **When changing a role's privileges, send the full list.** Reason: the update replaces the list, and anything left out is revoked.
|
|
48
|
-
- **When the action calls the backend, put the same flag on the endpoint** (NestJS `@
|
|
48
|
+
- **When the action calls the backend, put the same flag on the endpoint** (NestJS `@RequireFeatureFlag`). Reason: the backend reads the same rule, and anyone can call the API directly.
|
|
49
49
|
|
|
50
50
|
## Do it
|
|
51
51
|
|
|
@@ -60,7 +60,7 @@ Product questions. Ask, wait, never guess.
|
|
|
60
60
|
| Gate a route, endpoint or feature on a privilege | `create_feature_flag` (rule on `privileges`) | `bridge flag create --key reports --state on-with-rule --rule '<json>'` |
|
|
61
61
|
| Code for the framework | `get_integration_guide` (topic `feature-flags` or `team`) | `bridge guide flags --framework nestjs`, `bridge guide svelte team` |
|
|
62
62
|
|
|
63
|
-
On the NestJS backend the flag goes on the handler: `@
|
|
63
|
+
On the NestJS backend the flag goes on the handler: `@RequireFeatureFlag('reports')`, whose rule is `privileges contains "REPORTS_VIEW"`. A person without it gets `403 FEATURE_NOT_PERMITTED`. `@RequirePrivilege` is for API tokens only (a machine calling with `x-api-key`), never for a person, and a hard-coded role check is never the answer.
|
|
64
64
|
|
|
65
65
|
Setting the default on one role clears it from the previous default.
|
|
66
66
|
|
|
@@ -20,7 +20,7 @@ Product questions. Ask, wait, never guess.
|
|
|
20
20
|
1. **Is the app for single people or for teams?** With teams, a customer invites colleagues into a shared workspace. For single people, each person simply has a workspace of their own and never sees the word.
|
|
21
21
|
2. **How does someone get in the first time?** Either they sign up and get a new workspace of their own, or they can only join by invitation from someone already inside.
|
|
22
22
|
3. **When someone is invited, which role should they get?** Read the app's real roles with `list_roles` first and offer those. See the **roles** guide: in the default setup a new app's default role is Member, while older apps often still default to Owner.
|
|
23
|
-
4. **Does the number of people per workspace depend on the plan?** ("1 user on Free, 10 on Pro.") If yes, that is a seat limit: see the **payments** guide.
|
|
23
|
+
4. **Does the number of people per workspace depend on the plan?** ("1 user on Free, 10 on Pro.") If yes, that is a seat limit: see the **payments** guide. Then ask: **do invites go through Bridge's built-in team page, or through your own invite handler?**
|
|
24
24
|
5. **Can one person belong to several workspaces?** Bridge supports it and shows a workspace picker at sign-in; the question is whether the developer wants to offer it in their product.
|
|
25
25
|
|
|
26
26
|
**The tools will not guess these.** Called without one, a tool changes nothing and answers `DECISION_NEEDED` with the question to ask; the matching bridge command stops the same way: `invite_user` (`role`). It offers the app's role keys and names the default one.
|
|
@@ -31,7 +31,8 @@ Product questions. Ask, wait, never guess.
|
|
|
31
31
|
|
|
32
32
|
- **Self-signup on for a product people try on their own; off for invitation-only products.** Take it from the answer to question 2 and set `tenantSelfSignup` to match. Reason: with it off, a stranger who signs up has nowhere to land.
|
|
33
33
|
- **Use Bridge's team panel for inviting and managing people** (`TeamManagementPanel` in SvelteKit) rather than a page of your own. Reason: it already handles invitations, role changes and removal against the right permissions.
|
|
34
|
-
- **
|
|
34
|
+
- **Gate the team link and the team page with a flag ruled on a privilege**, for example a flag `team-admin` with `privileges contains "USER_WRITE"` after reading `list_roles`, used as `<FeatureFlag key="team-admin">` around the link and a route rule with `featureFlag: 'team-admin'` on the page. Never a list of role names in code. Reason: every gate in app code is a flag, and a privilege rule survives renamed roles.
|
|
35
|
+
- **Seats are a plan limit you name (`seats`), a gauge counted from membership.** Reason: Bridge counts the workspace's active members itself, pending invites included, so there is nothing for the app to count or report. Check it where invites happen: `<TeamManagementPanel seatsMetric="seats" />` on the built-in team page, or `@RequireQuota('seats')` on the app's own invite handler. Bridge's invite API does not refuse at the limit by itself. Never a flag or an entitlement.
|
|
35
36
|
- **Never create workspaces from the app's own code for sign-ups.** Reason: Bridge creates one at signup when self-signup is on; creating them elsewhere makes duplicates.
|
|
36
37
|
- **Create workspaces by hand only for setup and support** (an existing customer you are migrating, or a demo).
|
|
37
38
|
|
|
@@ -43,7 +44,7 @@ Product questions. Ask, wait, never guess.
|
|
|
43
44
|
| Create a workspace by hand | `create_tenant` | `bridge tenant create --name … --owner-email …` |
|
|
44
45
|
| Invite someone into a workspace | `invite_user` | `bridge user invite --email … --role … --tenant-id …` |
|
|
45
46
|
| Change someone's role | `update_user` | `bridge user update --email … --role … --tenant-id …` |
|
|
46
|
-
| Limit seats per plan | `set_plan_quota` (metric `
|
|
47
|
+
| Limit seats per plan | `set_plan_quota` (metric `seats`, kind `gauge`, source `membership`) | `bridge plan quota set pro --metric seats --limit 10 --policy hard --kind gauge --source membership` |
|
|
47
48
|
| Code for the framework | `get_integration_guide` (topic `team`) | `bridge guide svelte team` |
|
|
48
49
|
|
|
49
50
|
Pass the role key the developer chose on every invitation you make on their behalf; without one, `invite_user` and `bridge user invite` invite nobody and ask which role.
|
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Read this before any decision guide that touches who gets what. Every other guide builds on it. MCP: resource `bridge://guides/fit-together`. CLI: `bridge guide fit-together`.
|
|
4
4
|
|
|
5
|
-
## The rule
|
|
5
|
+
## The one rule for app code
|
|
6
|
+
|
|
7
|
+
**Every gate in app code is a flag.** A link, a page, a button, an endpoint: if some people get it and others do not, the code asks a flag, and the flag's rule says why: a privilege (`privileges contains "USER_WRITE"`), a plan feature (`bridge:billing.entitlement.analytics eq true`) or a rollout. App code never reads a role, a privilege list, the plan or a plan feature to decide what someone may see or do.
|
|
8
|
+
|
|
9
|
+
Two things are not gates and are not flags: **numbers** are plan limits (`<QuotaGate>` in the browser, `@RequireQuota` on the backend), and **permission on one specific record** stays in app code ("only the author edits their post").
|
|
10
|
+
|
|
11
|
+
Before calling the work done, run `npx @nebulr-group/bridge-cli check gates` in the project. It lists every direct role, privilege, plan or plan-feature check with the flag to use instead. Fix each one.
|
|
12
|
+
|
|
13
|
+
- **SvelteKit:** a piece of UI or a nav link is `<FeatureFlag key="…">`; a page is a route rule `{ match: '/admin/*', featureFlag: 'admin-area', redirectTo: '/' }`.
|
|
14
|
+
- **NestJS:** an endpoint is `@RequireFeatureFlag('…')` on the handler.
|
|
15
|
+
|
|
16
|
+
## Why a flag
|
|
6
17
|
|
|
7
18
|
Features should be controlled with feature flags. A flag can switch a route, an API endpoint, a feature or a single piece of code; its rules change without a release and update live when someone's role or plan changes. If a plan sells the feature, include it on the plan as well. This is valuable because the plan is where the customer sees what they are buying: the pricing table, the upgrade dialog and the "not on your plan" reason all read the plan's list, and the flag's rule points at that same list, so changing what Pro includes is one edit in one place.
|
|
8
19
|
|
|
@@ -13,6 +24,7 @@ Features should be controlled with feature flags. A flag can switch a route, an
|
|
|
13
24
|
| Is this route, API endpoint, feature or piece of code on for them? | a **flag** | The code asks for the flag by key; the flag's rule decides |
|
|
14
25
|
| Does their plan sell it? | the plan's **features list**, read by the flag's rule | `bridge plan feature add pro analytics`, then the rule `bridge:billing.entitlement.analytics eq true` |
|
|
15
26
|
| How many do they get (projects, exports, seats)? | a **plan limit** | `bridge plan quota set pro --metric exports --limit 100 --policy hard` |
|
|
27
|
+
| How many people fit in a workspace? | a **plan limit** counted from membership (seats) | `bridge plan quota set pro --metric seats --limit 10 --policy hard --kind gauge --source membership` |
|
|
16
28
|
| Who is this person, and may they do this kind of thing? | a flag rule on a **privilege** (preferred) or a **role** | `privileges contains "REPORTS_VIEW"`, or `user.role eq "ADMIN"` |
|
|
17
29
|
| May this person change this one record? | the app's own code | "Only the author edits their post" |
|
|
18
30
|
|
|
@@ -21,8 +33,8 @@ The flag's rule never names plans. It points at `bridge:billing.entitlement.<fea
|
|
|
21
33
|
## Where a flag is not the tool
|
|
22
34
|
|
|
23
35
|
- **Numbers are plan limits.** "100 exports a month" or "10 projects" is a quota on the plan, not a flag. Bridge refuses at the limit and the upgrade dialog explains it.
|
|
36
|
+
- **Seats are a plan limit too, counted from membership.** Bridge counts the workspace's active members; the check sits where invites happen (the team page's seat-limit setting, or `@RequireQuota('seats')` on the app's own invite handler), never in a flag or an entitlement.
|
|
24
37
|
- **Permission on one specific record stays in app code.** Whether this person may edit *this* invoice depends on data only the app has (who wrote it, which team owns it). The flag decides whether invoice editing exists for them at all; the app decides the record.
|
|
25
|
-
- **Checking a plan feature without a flag is the exception.** `@RequireEntitlement('analytics')` on the backend and `<Entitled to="analytics">` or `$entitlements.can('analytics')` in the UI read the plan's list directly. They work, and they are for the rare case where the developer asks for no flag. Use a flag by default: it can also carry a rollout, a trial group or a one-customer exception later, without a code change.
|
|
26
38
|
|
|
27
39
|
## Access by who someone is
|
|
28
40
|
|
|
@@ -30,7 +42,8 @@ Control it with a flag rule, never with a role check written into the app's code
|
|
|
30
42
|
|
|
31
43
|
- **Prefer a privilege rule** (`privileges contains "REPORTS_VIEW"`) over a role rule (`user.role eq "ADMIN"`). A privilege rule keeps working when roles are renamed or reshuffled. `contains` on `privileges` means the person holds exactly that key: `REPORTS_VIEW` does not match `REPORTS_VIEW_ALL`.
|
|
32
44
|
- **A role rule is fine when the developer means the role itself.** Use the role key exactly as `list_roles` shows it; `ADMIN` and `admin` are different.
|
|
33
|
-
- **An admin-only page is a flag route rule, not a check on the page.** In SvelteKit: `{ match: '/admin/*', featureFlag: 'admin-area', redirectTo: '/' }`, with the flag `admin-area` ruled on a privilege. On the NestJS backend: `@
|
|
45
|
+
- **An admin-only page is a flag route rule, not a check on the page.** In SvelteKit: `{ match: '/admin/*', featureFlag: 'admin-area', redirectTo: '/' }`, with the flag `admin-area` ruled on a privilege. On the NestJS backend: `@RequireFeatureFlag('admin-area')` on the handler. Both read the same rule.
|
|
46
|
+
- **The team page is the same.** The team link and the team route are gated by a flag ruled on the privilege that manages people (for example `privileges contains "USER_WRITE"`, after `bridge role list`), never by a list of role names.
|
|
34
47
|
- **Roles are the app's own.** What a role can do is only ever "in the default setup". Read the app's real roles and privileges with `list_roles` / `bridge role list` before writing any rule, and never assume what a role grants from its name. In the default setup a new app has Owner, Admin and Member, and Member is the default for everyone after the first person in a workspace.
|
|
35
48
|
|
|
36
49
|
## The backend sees the same rule
|
|
@@ -42,7 +55,7 @@ A flag rule on a role, a privilege, the plan or a plan feature gives the same an
|
|
|
42
55
|
Ask the developer first: **"Does this action call your server?"** Then:
|
|
43
56
|
|
|
44
57
|
- **Yes, it calls the backend:** the backend counts it. One decorator on the handler (`@RequireQuota('exports')` in NestJS) refuses at the limit with `402` and records the use after a successful request. The frontend only shows the count and the upgrade dialog; it does not report the same metric.
|
|
45
|
-
- **No, it happens in the browser** (local-first, data on the device, no server of the developer's own): the browser counts it. `bridge.usage.report('exports')` for something that happened, `bridge.usage.set('projects', n)` for how many exist now, and `<QuotaGate metric="exports">` around the button so it stops at the limit. This is a first-class way to run limits.
|
|
58
|
+
- **No, it happens in the browser** (local-first, data on the device, no server of the developer's own): the browser counts it. `bridge.usage.report('exports')` for something that happened, `bridge.usage.set('projects', n)` for how many exist now, and `<QuotaGate metric="exports">` around the button so it stops at the limit. This is a complete, first-class way to run limits.
|
|
46
59
|
|
|
47
60
|
Never count one metric in both places: it is counted twice. Never describe browser counting as a lesser or temporary option; ask the question above and follow the answer.
|
|
48
61
|
|
|
@@ -67,6 +80,11 @@ No upgrade dialog opens by itself. It opens when someone opens a gated route, cl
|
|
|
67
80
|
1. `bridge plan feature add pro analytics --name "Analytics"`, and a flag `analytics` with the rule `bridge:billing.entitlement.analytics eq true`.
|
|
68
81
|
2. `bridge role list` first. Then a flag `workspace-settings` with a privilege rule, e.g. `privileges contains "TENANT_WRITE"` if that is the privilege the app's roles use for it, and a route rule on `/settings/*`.
|
|
69
82
|
3. Ask whether exporting calls the developer's server. If it does: `bridge plan quota set pro --metric exports --limit 100 --policy hard` and `@RequireQuota('exports')` on the export handler. If it does not: the same quota, `bridge.usage.report('exports')` in the browser and `<QuotaGate metric="exports">` around the button.
|
|
83
|
+
4. `npx @nebulr-group/bridge-cli check gates`: nothing left that reads a role, a privilege, the plan or a plan feature directly.
|
|
84
|
+
|
|
85
|
+
## Exceptions
|
|
86
|
+
|
|
87
|
+
**Checking a plan feature without a flag is the exception.** `@RequireEntitlement('analytics')` on the backend and `<Entitled to="analytics">` or `$entitlements.can('analytics')` in the UI read the plan's list directly. They are for the rare case where the developer explicitly asks for no flag, and they print a one-time note in development. Mark each such line `// bridge-gate-exception: <reason>` so `check gates` leaves it. Use a flag by default: it can also carry a rollout, a trial group or a one-customer exception later, without a code change.
|
|
70
88
|
|
|
71
89
|
## Where each piece is decided
|
|
72
90
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
You are integrating **Bridge Feature Flags** into a user's application — the flags-only path. No auth scaffolding, no billing components. If the user also wants auth or billing, run `bridge guide` (auth master) or `bridge guide billing` afterwards.
|
|
4
4
|
|
|
5
|
+
> **The one rule for app code: every gate is a flag.** A link, a page, a button, an endpoint: if some people get it and others do not, the code asks a flag, and the flag's rule says why (a privilege, a plan feature, a rollout). App code never reads a role, a privilege list, the plan or a plan feature to decide what someone may see or do. Numbers are plan limits, and permission on one specific record stays in app code. `bridge guide fit-together` has the whole rule; the last verification step runs `npx @nebulr-group/bridge-cli check gates`.
|
|
6
|
+
|
|
5
7
|
Flags are the standard way to control a route, an API endpoint, a feature or a piece of code. A feature a plan sells is listed on the plan and the flag's rule points at `bridge:billing.entitlement.<feature>`, never at plan names; access by who someone is is a rule on a privilege (preferred) or a role, never a role check in code. `bridge guide fit-together` has the whole rule; `bridge guide decision feature-control` has the questions to ask.
|
|
6
8
|
|
|
7
9
|
This master prompt orchestrates discovery, confirmation, and verification. The **actual install commands, provider shapes, and runnable code snippets live in the per-framework prompts** that ship in each plugin repo's `mcp/` folder. This master does the planning; the per-framework prompts do the wiring.
|
|
@@ -195,6 +197,7 @@ For each integrated project:
|
|
|
195
197
|
1. **Build check** — run the project's build command (from `package.json` scripts)
|
|
196
198
|
2. **Eval check** — read one flag (existing or freshly created) and confirm it returns the expected value
|
|
197
199
|
3. **Context check** — confirm `identity` is set when the project uses any rolled-out rule
|
|
200
|
+
4. **Gate check** — `npx @nebulr-group/bridge-cli check gates` in the project: every direct role, privilege, plan or plan-feature check it lists becomes a flag. Run it again until it is clean
|
|
198
201
|
|
|
199
202
|
If anything fails, diagnose and fix before moving on.
|
|
200
203
|
|
|
@@ -104,7 +104,7 @@ export class ExportsController {
|
|
|
104
104
|
|
|
105
105
|
Ask the developer first: **does this action call your server?**
|
|
106
106
|
|
|
107
|
-
- **It calls your backend:** the
|
|
107
|
+
- **It calls your backend:** the backend handler counts it and refuses at the limit, because that is where the action happens. The frontend shows the count and the upgrade dialog, and does not count the same metric again.
|
|
108
108
|
- **It happens in the browser** and never reaches a server of yours (local-first, data on the device): the browser counts it and gates the button (section 5). That is a first-class setup.
|
|
109
109
|
|
|
110
110
|
Never both for one metric: it would be counted twice.
|
|
@@ -149,13 +149,13 @@ remove() { /* … */ }
|
|
|
149
149
|
|
|
150
150
|
`current` returns your own count, and that count is what the limit is compared against, so Bridge's copy heals itself if it ever missed an update. There is no decrement and no reservation: every create and delete sends the whole count.
|
|
151
151
|
|
|
152
|
-
**Seats** (`
|
|
152
|
+
**Seats** are a gauge the app names (e.g. `seats`) and marks as counted from membership: `bridge plan quota set <plan> --metric seats --limit 10 --policy hard --kind gauge --source membership`. Bridge answers it with the workspace's active members, pending invites included, read fresh each time; the app never reports it. Check it where invites happen: on the built-in team page with `<TeamManagementPanel seatsMetric="seats" />`, or with `@RequireQuota('seats')` on your own invite handler (it checks and writes nothing). Bridge's invite API does not refuse at the limit by itself. Never gate seats with a flag or an entitlement.
|
|
153
153
|
|
|
154
154
|
`bridge plan quota list` shows every metric the app's plans limit, with its kind.
|
|
155
155
|
|
|
156
156
|
**Every hard quota is also an entitlement** with the same name, true while there is room. So never pair `@RequireEntitlement('exports')` with `@RequireQuota('exports')`: at the cap the entitlement answers `403` before the quota can answer the `402` the frontend knows how to upsell. `@RequireQuota` is for a *limit*; `@RequireEntitlement` checks a plan *feature* (`analytics`, `sso`) without a flag, which is the exception (next paragraph).
|
|
157
157
|
|
|
158
|
-
**A plan feature goes in the plan's features list.** `bridge plan feature add pro analytics --name "Analytics"` makes `analytics` true on `pro`, and false on every other plan. The pricing table and the upgrade dialog name it from the same list. Control the feature with a flag whose rule is `bridge:billing.entitlement.analytics eq true`, so changing what Pro sells is one edit on the plan and no flag rule has to follow. Checking it directly, without a flag, is the exception
|
|
158
|
+
**A plan feature goes in the plan's features list.** `bridge plan feature add pro analytics --name "Analytics"` makes `analytics` true on `pro`, and false on every other plan. The pricing table and the upgrade dialog name it from the same list. Control the feature with a flag whose rule is `bridge:billing.entitlement.analytics eq true`, so changing what Pro sells is one edit on the plan and no flag rule has to follow. Checking it directly, without a flag, is the exception (section Exceptions, at the end). A hard quota with limit 1 that nothing counts still works the same way; it is the older way to do this. `app_active` is always there: true while the workspace's subscription is active, trialing, past due or cancelling at period end.
|
|
159
159
|
|
|
160
160
|
## 4. Three ways to handle a limit in the UI
|
|
161
161
|
|
|
@@ -165,7 +165,7 @@ Pick the lowest level that does the job. Each is optional; level 0 is on without
|
|
|
165
165
|
|---|---|---|
|
|
166
166
|
| **0 — nothing** | a plain button calling your API | Your backend refuses at the cap (`402`), and `<BridgeBootstrap>` opens an **upgrade dialog** naming the metric, linking to the subscription page. A workspace member who cannot manage billing is told to ask the owner instead |
|
|
167
167
|
| **1 — one component** | `<QuotaGate metric="tickets">…</QuotaGate>` around the button; `<FeatureFlag key="analytics" upgrade>…</FeatureFlag>` around a paid feature | The button is disabled at a known hard cap with an upgrade line beside it; the paid feature shows on a plan that includes it, and elsewhere an "Upgrade to use this" button that opens the dialog when clicked |
|
|
168
|
-
| **2 — your own UI** | `useQuota('tickets')
|
|
168
|
+
| **2 — your own UI** | `useQuota('tickets')`, and `<FeatureFlag key="analytics">` around what the plan sells | Whatever you build from the live numbers |
|
|
169
169
|
|
|
170
170
|
```svelte
|
|
171
171
|
<script lang="ts">
|
|
@@ -211,7 +211,7 @@ await bridge.usage.set('projects', projects.length); // a gauge: how many exis
|
|
|
211
211
|
|
|
212
212
|
Put `<QuotaGate metric="exports">` around the button (section 4, level 1) so it stops at the limit, and the upgrade line sells the next plan.
|
|
213
213
|
|
|
214
|
-
This is a first-class way to run limits.
|
|
214
|
+
This is a complete, first-class way to run limits. When the action does call your backend, count it there instead (section 2), never in both places.
|
|
215
215
|
|
|
216
216
|
## 6. Four levels of customising Bridge's pages
|
|
217
217
|
|
|
@@ -292,3 +292,7 @@ All default rules use `:where()`, so any selector of yours wins without `!import
|
|
|
292
292
|
| Backend sign-in and route protection | `bridge guide nestjs` |
|
|
293
293
|
| Feature flags | `bridge guide flags` |
|
|
294
294
|
| Proving sign-in works | `bridge test-user create`, then `bridge test-user verify` |
|
|
295
|
+
|
|
296
|
+
## Exceptions
|
|
297
|
+
|
|
298
|
+
Every gate in app code is a flag (`bridge guide fit-together`). Checking a plan feature without a flag (`@RequireEntitlement` on the backend, `<Entitled>` or `$entitlements.can` in the UI) exists for the rare case where the developer explicitly asks for no flag. It prints a one-time note in development; mark the line `// bridge-gate-exception: <reason>` so `check gates` leaves it.
|