Import the remade decks on stable ids and recommend one card per job, so a saved draft still loads after a chip is renamed.
The real-group profiles stay as a test, so a change that moves a pick fails. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
96ca15d8e3
commit
bcbc6f30d9
89 files changed
+36555
-2828
No files matched your search
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* The 92 real-group profiles from product/real-group-profiles.md, read as setup answers,
|
||||
* and the one-member founders added to the test set on 27 Oct.
|
||||
* The real-group fixture is copied unchanged. Two readings are made here, both stated
|
||||
* in the README. The first kind listed is the main kind, as the review read its worked
|
||||
* examples. An alsoPlausible kind is read as another kind that fits.
|
||||
*/
|
||||
import type { GroupAnswers, Kind, Scale, SizeBand, Stage, TraitKey } from "./deckTypes";
|
||||
|
||||
export interface ReviewProfile {
|
||||
id: string;
|
||||
size: string | null;
|
||||
kinds: string[];
|
||||
scale: string | null;
|
||||
stage: string | null;
|
||||
answers: Record<TraitKey, boolean>;
|
||||
alsoPlausible?: { size?: string[]; kinds?: string[]; scale?: string[]; stage?: string[] };
|
||||
}
|
||||
|
||||
const KIND: Record<string, Kind> = {
|
||||
"worker co-op": "workersCoop",
|
||||
"mutual aid": "mutualAid",
|
||||
nonprofit: "nonprofit",
|
||||
"for-profit": "forProfit",
|
||||
"open source": "openSource",
|
||||
dao: "dao",
|
||||
};
|
||||
const SIZE: Record<string, SizeBand> = {
|
||||
"1": "oneMember",
|
||||
"2-5": "twoToFive",
|
||||
"6-12": "sixToTwelve",
|
||||
"13-100": "thirteenToOneHundred",
|
||||
"100+": "oneHundredToOneHundredK",
|
||||
};
|
||||
const STAGE: Record<string, Stage> = {
|
||||
early: "earlyStage",
|
||||
growth: "growthStage",
|
||||
established: "established",
|
||||
enterprise: "enterprise",
|
||||
};
|
||||
|
||||
function kind(k: string): Kind {
|
||||
const v = KIND[k];
|
||||
if (!v) throw new Error(`Unknown kind ${k}`);
|
||||
return v;
|
||||
}
|
||||
|
||||
export function toAnswers(p: ReviewProfile): GroupAnswers {
|
||||
const kinds = p.kinds.map(kind);
|
||||
return {
|
||||
size: p.size ? SIZE[p.size] : null,
|
||||
mainKind: kinds[0] ?? null,
|
||||
otherKinds: kinds.slice(1),
|
||||
scale: p.scale ? [p.scale as Scale] : [],
|
||||
stage: p.stage ? STAGE[p.stage] : null,
|
||||
traits: { ...p.answers },
|
||||
};
|
||||
}
|
||||
|
||||
export interface ProfileVariant {
|
||||
profile: string;
|
||||
variant: string;
|
||||
answers: GroupAnswers;
|
||||
}
|
||||
|
||||
/** The profile as given, then once per alsoPlausible answer swapped in. */
|
||||
export function variantsOf(p: ReviewProfile): ProfileVariant[] {
|
||||
const base = toAnswers(p);
|
||||
const out: ProfileVariant[] = [{ profile: p.id, variant: "base", answers: base }];
|
||||
for (const s of p.alsoPlausible?.size ?? []) {
|
||||
out.push({ profile: p.id, variant: `size ${s}`, answers: { ...base, size: SIZE[s] } });
|
||||
}
|
||||
for (const k of p.alsoPlausible?.kinds ?? []) {
|
||||
out.push({
|
||||
profile: p.id,
|
||||
variant: `also ${k}`,
|
||||
answers: { ...base, otherKinds: [...(base.otherKinds ?? []), kind(k)] },
|
||||
});
|
||||
}
|
||||
for (const s of p.alsoPlausible?.scale ?? []) {
|
||||
out.push({ profile: p.id, variant: `scale ${s}`, answers: { ...base, scale: [s as Scale] } });
|
||||
}
|
||||
for (const s of p.alsoPlausible?.stage ?? []) {
|
||||
out.push({ profile: p.id, variant: `stage ${s}`, answers: { ...base, stage: STAGE[s] } });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Reference in new issue
Block a user