MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / costBlock

Function costBlock

graph-ui/src/twin/render-model.ts:952–981  ·  view source on GitHub ↗

* One cost block, built from sections that are already there. * * `undefined` when the lens behind it is off, which is how a facet keeps * subtracting on this level too. An empty block is not the same thing: a lens * that is on and found nothing renders its heading and the sentence saying so.

(
    sections: readonly TwinSection[],
    name: string,
    title: string,
    lead: string,
    emptyText: string,
    from: readonly string[]
)

Source from the content-addressed store, hash-verified

950 * that is on and found nothing renders its heading and the sentence saying so.
951 */
952function costBlock(
953 sections: readonly TwinSection[],
954 name: string,
955 title: string,
956 lead: string,
957 emptyText: string,
958 from: readonly string[]
959): TwinReaderBlock | undefined {
960 const used = from
961 .map((sectionName) => sections.find((section) => section.name === sectionName))
962 .filter((section): section is TwinSection => section !== undefined);
963 if (used.length === 0) {
964 return undefined;
965 }
966 // Rows from more than one family keep the family name as their group, so a
967 // reader can see that "what moves" is three questions answered together.
968 const rows: TwinRow[] = used.flatMap((section) => section.rows.map((row) => ({
969 ...row,
970 id: `${section.name}-${row.id}`,
971 group: used.length > 1 ? section.title : row.group
972 })));
973 return {
974 name,
975 title,
976 lead,
977 rows,
978 emptyText,
979 ...(rows.length > 0 ? { weight: costWeight(rows.length) } : {})
980 };
981}
982
983function senior(ir: SemanticIR, presentation: ResolvedPresentation): TwinViewModel {
984 const sections = visibleSections(ir, presentation);

Callers 1

seniorFunction · 0.85

Calls 1

costWeightFunction · 0.90

Tested by

no test coverage detected