CONTENT-WP-0002-T01 adapts the pinned OnCo visual system under ui/ without the corpus, mark, or kind routes. Assistant: grok Assistant-Session: 01a1346c-fdff-7741-b1af-b7283661554b
27 lines
1,005 B
TypeScript
27 lines
1,005 B
TypeScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import type { RecordRow } from "./types";
|
|
|
|
type Snapshot = {
|
|
dataspace: { id: string; title: string; description: string };
|
|
kinds: { id: string; label: string; plural: string }[];
|
|
entities: { id: string; kindId: string; title: string; tldr: string }[];
|
|
};
|
|
|
|
export function loadSystemsThinking(): { title: string; description: string; rows: RecordRow[] } {
|
|
const path = join(process.cwd(), "../examples/dataspaces/systems-thinking/snapshot.json");
|
|
const snapshot = JSON.parse(readFileSync(path, "utf8")) as Snapshot;
|
|
const labels = new Map(snapshot.kinds.map((kind) => [kind.id, kind.label]));
|
|
const rows = snapshot.entities.map((entity) => ({
|
|
id: entity.id,
|
|
kindId: entity.kindId,
|
|
kindLabel: labels.get(entity.kindId) ?? entity.kindId,
|
|
title: entity.title,
|
|
tldr: entity.tldr,
|
|
}));
|
|
return {
|
|
title: snapshot.dataspace.title,
|
|
description: snapshot.dataspace.description,
|
|
rows,
|
|
};
|
|
}
|