The database is the source of truth; the site is a view over it.
- packages/core/db/schema.sql: vendors, products, categories, the 8-dimension
instrument, assessments, scores, evidence, findings, off-ramp, plus the
derived v_product_score view the game reads.
- packages/core/db/build.mjs: rebuilds bigtech.db, absorbs the legacy 43-product
roster as unassessed, applies seeds, then verifies the instrument's own rules
(weights sum to 100, totals recompute, grades match bands, every score has a
rationale, no tier-4 evidence on a scored dimension, reproducible-build caps
actually enforced).
- packages/core/db/seed/0001-signal.sql: Signal Desktop 8.36.0-alpha.1 on linux,
75.9/100 grade B, weakest dimension local_data_exposure. Evidence points at
the re-runnable audit artifacts in the Servetus vault.
- packages/core/src/data/generated/catalog.{ts,json}: generated export.
Verified: 44 products, 1 assessed, all checks pass.
29 lines
No EOL
1,017 B
TypeScript
29 lines
No EOL
1,017 B
TypeScript
import { consolidatedMonthlyCost } from './data/config.js';
|
|
import { outlaws } from './data/outlaws.js';
|
|
import { computePersonalScore, computeProjectedScore } from './scoring.js';
|
|
import type { OffRampPayload, ScoreModel } from './types.js';
|
|
|
|
export function computeOffRamp(
|
|
selectedIds: string[],
|
|
scoreModel: ScoreModel = 'weighted_average',
|
|
): OffRampPayload {
|
|
const replaceableTools = selectedIds
|
|
.map((id) => outlaws.find((o) => o.id === id))
|
|
.filter((o) => o && !o.sovereign) as typeof outlaws;
|
|
|
|
const currentScore = computePersonalScore(selectedIds, scoreModel);
|
|
const projectedScore = computeProjectedScore(selectedIds, scoreModel);
|
|
|
|
const monthlyFragmented = replaceableTools.reduce(
|
|
(sum, o) => sum + (o.monthlyCost ?? o.bounty),
|
|
0,
|
|
);
|
|
|
|
return {
|
|
replaceableTools,
|
|
projectedScore,
|
|
projectedMonthlyCost: consolidatedMonthlyCost,
|
|
monthlySavings: Math.max(0, monthlyFragmented - consolidatedMonthlyCost),
|
|
sovereigntyGain: projectedScore - currentScore,
|
|
};
|
|
} |