(ir: SemanticIR, presentation: ResolvedPresentation)
| 1168 | } |
| 1169 | |
| 1170 | function architect(ir: SemanticIR, presentation: ResolvedPresentation): TwinViewModel { |
| 1171 | const facets = presentation.facets; |
| 1172 | const sections = visibleSections(ir, presentation); |
| 1173 | const blocks: TwinReaderBlock[] = []; |
| 1174 | if (facets.has(Facet.Logic) || facets.has(Facet.Calls)) { |
| 1175 | const rows = groundRows(ir); |
| 1176 | blocks.push({ |
| 1177 | name: 'sits-on', |
| 1178 | title: GROUND_TITLE_SITS_ON, |
| 1179 | lead: GROUND_LEAD_SITS_ON, |
| 1180 | rows, |
| 1181 | emptyText: GROUND_EMPTY_SITS_ON, |
| 1182 | ...(rows.length > 0 ? { weight: rowCountLabel(rows.length) } : {}) |
| 1183 | }); |
| 1184 | } |
| 1185 | if (facets.has(Facet.Calls)) { |
| 1186 | const rows = carrierRows(ir, sections); |
| 1187 | blocks.push({ |
| 1188 | name: 'carried-by', |
| 1189 | title: GROUND_TITLE_CARRIED, |
| 1190 | lead: GROUND_LEAD_CARRIED, |
| 1191 | rows, |
| 1192 | emptyText: GROUND_EMPTY_CARRIED, |
| 1193 | ...(rows.length > 0 ? { weight: rowCountLabel(rows.length) } : {}) |
| 1194 | }); |
| 1195 | } |
| 1196 | if (facets.has(Facet.Logic) || facets.has(Facet.Errors)) { |
| 1197 | const rows = debtRows(ir, sections); |
| 1198 | blocks.push({ |
| 1199 | name: 'debts', |
| 1200 | title: GROUND_TITLE_DEBTS, |
| 1201 | lead: GROUND_LEAD_DEBTS, |
| 1202 | rows, |
| 1203 | emptyText: GROUND_EMPTY_DEBTS, |
| 1204 | ...(rows.length > 0 ? { weight: rowCountLabel(rows.length) } : {}) |
| 1205 | }); |
| 1206 | } |
| 1207 | const limits = indexLimits(ir, facets); |
| 1208 | return { |
| 1209 | ...emptyModel(ir, presentation, 'ground'), |
| 1210 | blocks, |
| 1211 | limits, |
| 1212 | rewritable: readerLines([ |
| 1213 | ...blocks.flatMap((block) => [ |
| 1214 | { id: `block-${block.name}-lead`, text: block.lead }, |
| 1215 | { id: `block-${block.name}-empty`, text: block.rows.length === 0 ? block.emptyText : '' } |
| 1216 | ]), |
| 1217 | { id: 'limits-lead', text: GROUND_LEAD_LIMITS }, |
| 1218 | ...limits.map((limit) => ({ id: limit.id, text: limit.text })) |
| 1219 | ]) |
| 1220 | }; |
| 1221 | } |
| 1222 | |
| 1223 | // --------------------------------------------------------------------------- |
| 1224 | // level 0, vibe coder: prose, counts, and the handful of names worth clicking |
no test coverage detected