@okforest/okf
v0.4.0
Published
Read an Open Knowledge Format (OKF) v0.2 tree into a model: concepts, frontmatter, links, backlinks, trust tiers, staleness, and a metadata inventory. No SDKs or frameworks; runs in Node, browsers, and Workers.
Maintainers
Readme
@okforest/okf
Read an Open Knowledge Format (OKF)
v0.2 tree into a model: concepts (path, concept ID, frontmatter, body as
mdast), reserved index.md and
log.md files, links in both absolute and relative forms, backlinks, and the
v0.2 fields with their derived values: trust tier, lifecycle status, and
staleness. Also builds the metadata inventory: every type, tag, and
frontmatter key in use, with near-duplicates.
No SDKs or frameworks: the core is pure and runs in Node, browsers, and Workers. Reading from disk is a separate entry point.
import { buildInventory } from "@okforest/okf"
import { readTree } from "@okforest/okf/node"
const tree = await readTree("./sales-okf")
const orders = tree.concept("tables/orders")
orders?.trustTier // "unverified" | "machine-confirmed" | "human-reviewed"
orders?.isStale() // now >= stale_after
tree.backlinks("tables/orders") // links from other concepts
buildInventory(tree).nearDuplicates // e.g. e-commerce ~ ecommerceWithout a file system, pass the files yourself:
import { parseTree } from "@okforest/okf"
const tree = parseTree([
{ path: "index.md", text: '---\nokf_version: "0.2"\n---\n# Tables\n' },
{ path: "tables/orders.md", text: "---\ntype: BigQuery Table\n---\n# Schema\n" },
])Parsing never throws on malformed content: problems are recorded on each file
(frontmatterError) for @okforest/validate
to report.
Part of the OKForest CLI · Apache-2.0 · © Preneur LLC
