RDF/XML serialization is deferred.
{
"@context": {
"schema": "https://schema.org/",
"wiki": "https://wazootech.github.io/wiki/",
"foaf": "http://xmlns.com/foaf/0.1/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"owl": "http://www.w3.org/2002/07/owl#",
"dc": "http://purl.org/dc/elements/1.1/",
"dcterms": "http://purl.org/dc/terms/",
"sh": "http://www.w3.org/ns/shacl#",
"wazoo": "https://schema.wazoo.dev/"
},
"@id": "wiki:Wiki_Programmatic_API",
"@type": "schema:TechArticle",
"schema:articleBody": "# Wiki Programmatic API\n\nThe Deno/TypeScript engine is the single Wiki implementation. Use its in-process API for Deno and TypeScript applications. The npm package exposes a runtime/bootstrap API that locates the Deno runtime and builds the `wiki` command; it does not export a `Wiki` class. The `wiki` CLI remains the primary user surface.\n\nSee [Design Philosophies](Design_Philosophies.md) for the CLI/library boundary. RDF/XML input remains supported; RDF/XML output is explicitly deferred from the Deno cutover.\n\n## Native Deno library\n\nThe Deno library is published as [`@wazoo/wiki` on JSR](https://jsr.io/@wazoo/wiki), with `src/wiki/mod.ts` as its public entrypoint.\n\n```ts\nimport { Wiki } from \"jsr:@wazoo/wiki\";\n\nconst wiki = Wiki.load(\"docs/wiki.yml\");\n```\n\n`Wiki.load` accepts a config path or a directory containing `wiki.yml` / `wiki.yaml`. The optional `wikiInputs` setting overrides `wiki.input`; installed, read-only sources are then included as part of the corpus.\n\n### Validation reports\n\n`Wiki.check` and `Wiki.lint` are asynchronous and return `Promise<AuditReport>` values. Each report has `ok`, `errors`, and `warnings`; `applyStrict()` promotes warnings to errors. When enabled, `lint.heading_levels` uses the in-process ESLint Markdown rule engine; route-aware links, CURIE resolution, and the remaining Wiki policies stay in Wiki.\n\n```ts\nconst lintReport = await wiki.lint(undefined, { strict: true });\nconst report = await wiki.check(undefined, { strict: true });\nconst [lintErrors, lintWarnings] = lintReport.messages();\nconst [errors, warnings] = report.messages();\nif (!lintReport.ok || !report.ok) {\n console.error(\n [...lintErrors, ...lintWarnings, ...errors, ...warnings].join(\"\\n\"),\n );\n}\n```\n\nPass a list of document paths as the first argument to scope an operation:\n\n```ts\nconst report = await wiki.check([\"docs/wiki/Getting_Started.md\"]);\n```\n\n### Guarded edits\n\n`Wiki.edit()` validates a batch of page changes against the wiki's shapes, routes, and links and, with `apply`, writes every file or none. Conflicts and rejections come back in the report rather than as exceptions, so a caller can re-read, repair, and retry; a malformed edit throws `EditUsageError`. `Wiki.show()` returns one page as the engine reads it, including the `hash` an op passes as `expect`, and `Wiki.refs()` lists the pages linking to and from it. See [wiki edit](wiki_edit.md) for the edit format, validation scope, and report.\n\n```ts\nconst page = await wiki.show(\"wiki/Budget_Ledger.md\");\nconst report = await wiki.edit({\n ops: [{\n op: \"patch\",\n path: \"wiki/Budget_Ledger.md\",\n expect: page.hash,\n target: { heading: \"Change log\" },\n mode: \"append\",\n content: \"- 2026-10-10 — Added the Neon plan.\",\n }],\n}, { apply: true });\nif (report.status === \"conflict\") {\n // Someone changed the page since `show`: re-read and rebuild the edit.\n}\n```\n\n### Query and graph access\n\n```ts\nconst results = await wiki.query(\n \"SELECT ?name WHERE { ?person <https://schema.org/name> ?name }\",\n { format: \"json\" },\n);\n\nconst graph = await wiki.graph();\nconst dataset = await wiki.dataset();\n```\n\n`query` returns the chosen result format as a string. `graph()` returns the inferred union graph by default; `dataset()` exposes named graphs for source provenance. Options support inference, reload, and disk-cache control.\n\n### Build and export\n\n```ts\nconst built = await wiki.build(\"_site\", {\n baseUrl: \"/wiki\",\n urlStyle: \"dir\",\n});\nif (!built.ok) throw new Error(built.error_message ?? \"Build failed\");\n\nconst exported = await wiki.export(undefined, { format: \"json-ld\" });\nif (!exported.ok) {\n throw new Error(exported.error_message ?? \"Export failed\");\n}\n```\n\nThe library also exposes formatting, inline SPARQL rendering, link analysis and repair, source management, local serving, and project scaffolding. Its generated TSDoc reference is on [JSR](https://jsr.io/@wazoo/wiki).\n\n## The `wazootech-wiki` npm package: command only\n\nThe npm package publishes the `wiki` command and nothing else. It bundles the Deno runtime, so npm users need neither system Python nor a separate Deno installation; Node.js 18 or newer is the only requirement.\n\n```bash\nnpm install -g wazootech-wiki\n```\n\n```bash\nwiki -c docs/wiki.yml check --strict\n```\n\n### Why there is no npm `Wiki` class\n\nThis package previously exported a `Wiki` SDK whose every method spawned the CLI and returned an exit code plus captured output strings. That was a second, weaker path to work the library already does in process: a subprocess boundary discards the typed reports that make embedding worthwhile, and it forced TS and Node users to treat the library as a program to be invoked rather than code to be called.\n\nTypeScript callers embed the library (above). Callers in languages that cannot embed JavaScript use the command, and a generated client for those languages is planned work.\n\n## Deferred RDF/XML output\n\nThe engine parses RDF/XML from `.rdf` and `.xml` wiki inputs. RDF/XML serialization is deferred from the initial Deno cutover: `export -f xml` returns an explicit unsupported-format error, and an RDF/XML `Accept` request to the SPARQL service returns `406 Not Acceptable`. The engine never substitutes a different serialization.\n\n## Related\n\n- [Deno API Reference](Deno_API_Reference.md)\n- [TypeScript API Reference](TypeScript_API_Reference.md)\n- [Python API Reference](Python_API_Reference.md)\n- [Wiki CLI](wiki.md)\n- [Wiki Configuration](Wiki_Configuration.md)",
"schema:dateCreated": {
"@type": "xsd:dateTime",
"@value": "2026-10-31T23:19:03Z"
},
"schema:dateModified": {
"@type": "xsd:dateTime",
"@value": "2026-10-31T23:19:03Z"
},
"schema:description": "Stable Deno/TypeScript and npm entry points for validating, building, and querying a wiki.",
"schema:headline": "Wiki Programmatic API"
}
@prefix schema: <https://schema.org/>.
@prefix wiki: <https://wazootech.github.io/wiki/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix wazoo: <https://schema.wazoo.dev/>.
wiki:Wiki_Programmatic_API a schema:TechArticle;
schema:description "Stable Deno/TypeScript and npm entry points for validating, building, and querying a wiki.";
schema:articleBody "# Wiki Programmatic API\n\nThe Deno/TypeScript engine is the single Wiki implementation. Use its in-process API for Deno and TypeScript applications. The npm package exposes a runtime/bootstrap API that locates the Deno runtime and builds the `wiki` command; it does not export a `Wiki` class. The `wiki` CLI remains the primary user surface.\n\nSee [Design Philosophies](Design_Philosophies.md) for the CLI/library boundary. RDF/XML input remains supported; RDF/XML output is explicitly deferred from the Deno cutover.\n\n## Native Deno library\n\nThe Deno library is published as [`@wazoo/wiki` on JSR](https://jsr.io/@wazoo/wiki), with `src/wiki/mod.ts` as its public entrypoint.\n\n```ts\nimport { Wiki } from \"jsr:@wazoo/wiki\";\n\nconst wiki = Wiki.load(\"docs/wiki.yml\");\n```\n\n`Wiki.load` accepts a config path or a directory containing `wiki.yml` / `wiki.yaml`. The optional `wikiInputs` setting overrides `wiki.input`; installed, read-only sources are then included as part of the corpus.\n\n### Validation reports\n\n`Wiki.check` and `Wiki.lint` are asynchronous and return `Promise<AuditReport>` values. Each report has `ok`, `errors`, and `warnings`; `applyStrict()` promotes warnings to errors. When enabled, `lint.heading_levels` uses the in-process ESLint Markdown rule engine; route-aware links, CURIE resolution, and the remaining Wiki policies stay in Wiki.\n\n```ts\nconst lintReport = await wiki.lint(undefined, { strict: true });\nconst report = await wiki.check(undefined, { strict: true });\nconst [lintErrors, lintWarnings] = lintReport.messages();\nconst [errors, warnings] = report.messages();\nif (!lintReport.ok || !report.ok) {\n console.error(\n [...lintErrors, ...lintWarnings, ...errors, ...warnings].join(\"\\n\"),\n );\n}\n```\n\nPass a list of document paths as the first argument to scope an operation:\n\n```ts\nconst report = await wiki.check([\"docs/wiki/Getting_Started.md\"]);\n```\n\n### Guarded edits\n\n`Wiki.edit()` validates a batch of page changes against the wiki's shapes, routes, and links and, with `apply`, writes every file or none. Conflicts and rejections come back in the report rather than as exceptions, so a caller can re-read, repair, and retry; a malformed edit throws `EditUsageError`. `Wiki.show()` returns one page as the engine reads it, including the `hash` an op passes as `expect`, and `Wiki.refs()` lists the pages linking to and from it. See [wiki edit](wiki_edit.md) for the edit format, validation scope, and report.\n\n```ts\nconst page = await wiki.show(\"wiki/Budget_Ledger.md\");\nconst report = await wiki.edit({\n ops: [{\n op: \"patch\",\n path: \"wiki/Budget_Ledger.md\",\n expect: page.hash,\n target: { heading: \"Change log\" },\n mode: \"append\",\n content: \"- 2026-10-10 — Added the Neon plan.\",\n }],\n}, { apply: true });\nif (report.status === \"conflict\") {\n // Someone changed the page since `show`: re-read and rebuild the edit.\n}\n```\n\n### Query and graph access\n\n```ts\nconst results = await wiki.query(\n \"SELECT ?name WHERE { ?person <https://schema.org/name> ?name }\",\n { format: \"json\" },\n);\n\nconst graph = await wiki.graph();\nconst dataset = await wiki.dataset();\n```\n\n`query` returns the chosen result format as a string. `graph()` returns the inferred union graph by default; `dataset()` exposes named graphs for source provenance. Options support inference, reload, and disk-cache control.\n\n### Build and export\n\n```ts\nconst built = await wiki.build(\"_site\", {\n baseUrl: \"/wiki\",\n urlStyle: \"dir\",\n});\nif (!built.ok) throw new Error(built.error_message ?? \"Build failed\");\n\nconst exported = await wiki.export(undefined, { format: \"json-ld\" });\nif (!exported.ok) {\n throw new Error(exported.error_message ?? \"Export failed\");\n}\n```\n\nThe library also exposes formatting, inline SPARQL rendering, link analysis and repair, source management, local serving, and project scaffolding. Its generated TSDoc reference is on [JSR](https://jsr.io/@wazoo/wiki).\n\n## The `wazootech-wiki` npm package: command only\n\nThe npm package publishes the `wiki` command and nothing else. It bundles the Deno runtime, so npm users need neither system Python nor a separate Deno installation; Node.js 18 or newer is the only requirement.\n\n```bash\nnpm install -g wazootech-wiki\n```\n\n```bash\nwiki -c docs/wiki.yml check --strict\n```\n\n### Why there is no npm `Wiki` class\n\nThis package previously exported a `Wiki` SDK whose every method spawned the CLI and returned an exit code plus captured output strings. That was a second, weaker path to work the library already does in process: a subprocess boundary discards the typed reports that make embedding worthwhile, and it forced TS and Node users to treat the library as a program to be invoked rather than code to be called.\n\nTypeScript callers embed the library (above). Callers in languages that cannot embed JavaScript use the command, and a generated client for those languages is planned work.\n\n## Deferred RDF/XML output\n\nThe engine parses RDF/XML from `.rdf` and `.xml` wiki inputs. RDF/XML serialization is deferred from the initial Deno cutover: `export -f xml` returns an explicit unsupported-format error, and an RDF/XML `Accept` request to the SPARQL service returns `406 Not Acceptable`. The engine never substitutes a different serialization.\n\n## Related\n\n- [Deno API Reference](Deno_API_Reference.md)\n- [TypeScript API Reference](TypeScript_API_Reference.md)\n- [Python API Reference](Python_API_Reference.md)\n- [Wiki CLI](wiki.md)\n- [Wiki Configuration](Wiki_Configuration.md)";
schema:headline "Wiki Programmatic API";
schema:dateCreated "2026-10-31T23:19:03Z"^^xsd:dateTime;
schema:dateModified "2026-10-31T23:19:03Z"^^xsd:dateTime.
@prefix schema: <https://schema.org/>.
@prefix wiki: <https://wazootech.github.io/wiki/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix wazoo: <https://schema.wazoo.dev/>.
wiki:Wiki_Programmatic_API a schema:TechArticle;
schema:description "Stable Deno/TypeScript and npm entry points for validating, building, and querying a wiki.";
schema:articleBody "# Wiki Programmatic API\n\nThe Deno/TypeScript engine is the single Wiki implementation. Use its in-process API for Deno and TypeScript applications. The npm package exposes a runtime/bootstrap API that locates the Deno runtime and builds the `wiki` command; it does not export a `Wiki` class. The `wiki` CLI remains the primary user surface.\n\nSee [Design Philosophies](Design_Philosophies.md) for the CLI/library boundary. RDF/XML input remains supported; RDF/XML output is explicitly deferred from the Deno cutover.\n\n## Native Deno library\n\nThe Deno library is published as [`@wazoo/wiki` on JSR](https://jsr.io/@wazoo/wiki), with `src/wiki/mod.ts` as its public entrypoint.\n\n```ts\nimport { Wiki } from \"jsr:@wazoo/wiki\";\n\nconst wiki = Wiki.load(\"docs/wiki.yml\");\n```\n\n`Wiki.load` accepts a config path or a directory containing `wiki.yml` / `wiki.yaml`. The optional `wikiInputs` setting overrides `wiki.input`; installed, read-only sources are then included as part of the corpus.\n\n### Validation reports\n\n`Wiki.check` and `Wiki.lint` are asynchronous and return `Promise<AuditReport>` values. Each report has `ok`, `errors`, and `warnings`; `applyStrict()` promotes warnings to errors. When enabled, `lint.heading_levels` uses the in-process ESLint Markdown rule engine; route-aware links, CURIE resolution, and the remaining Wiki policies stay in Wiki.\n\n```ts\nconst lintReport = await wiki.lint(undefined, { strict: true });\nconst report = await wiki.check(undefined, { strict: true });\nconst [lintErrors, lintWarnings] = lintReport.messages();\nconst [errors, warnings] = report.messages();\nif (!lintReport.ok || !report.ok) {\n console.error(\n [...lintErrors, ...lintWarnings, ...errors, ...warnings].join(\"\\n\"),\n );\n}\n```\n\nPass a list of document paths as the first argument to scope an operation:\n\n```ts\nconst report = await wiki.check([\"docs/wiki/Getting_Started.md\"]);\n```\n\n### Guarded edits\n\n`Wiki.edit()` validates a batch of page changes against the wiki's shapes, routes, and links and, with `apply`, writes every file or none. Conflicts and rejections come back in the report rather than as exceptions, so a caller can re-read, repair, and retry; a malformed edit throws `EditUsageError`. `Wiki.show()` returns one page as the engine reads it, including the `hash` an op passes as `expect`, and `Wiki.refs()` lists the pages linking to and from it. See [wiki edit](wiki_edit.md) for the edit format, validation scope, and report.\n\n```ts\nconst page = await wiki.show(\"wiki/Budget_Ledger.md\");\nconst report = await wiki.edit({\n ops: [{\n op: \"patch\",\n path: \"wiki/Budget_Ledger.md\",\n expect: page.hash,\n target: { heading: \"Change log\" },\n mode: \"append\",\n content: \"- 2026-10-10 — Added the Neon plan.\",\n }],\n}, { apply: true });\nif (report.status === \"conflict\") {\n // Someone changed the page since `show`: re-read and rebuild the edit.\n}\n```\n\n### Query and graph access\n\n```ts\nconst results = await wiki.query(\n \"SELECT ?name WHERE { ?person <https://schema.org/name> ?name }\",\n { format: \"json\" },\n);\n\nconst graph = await wiki.graph();\nconst dataset = await wiki.dataset();\n```\n\n`query` returns the chosen result format as a string. `graph()` returns the inferred union graph by default; `dataset()` exposes named graphs for source provenance. Options support inference, reload, and disk-cache control.\n\n### Build and export\n\n```ts\nconst built = await wiki.build(\"_site\", {\n baseUrl: \"/wiki\",\n urlStyle: \"dir\",\n});\nif (!built.ok) throw new Error(built.error_message ?? \"Build failed\");\n\nconst exported = await wiki.export(undefined, { format: \"json-ld\" });\nif (!exported.ok) {\n throw new Error(exported.error_message ?? \"Export failed\");\n}\n```\n\nThe library also exposes formatting, inline SPARQL rendering, link analysis and repair, source management, local serving, and project scaffolding. Its generated TSDoc reference is on [JSR](https://jsr.io/@wazoo/wiki).\n\n## The `wazootech-wiki` npm package: command only\n\nThe npm package publishes the `wiki` command and nothing else. It bundles the Deno runtime, so npm users need neither system Python nor a separate Deno installation; Node.js 18 or newer is the only requirement.\n\n```bash\nnpm install -g wazootech-wiki\n```\n\n```bash\nwiki -c docs/wiki.yml check --strict\n```\n\n### Why there is no npm `Wiki` class\n\nThis package previously exported a `Wiki` SDK whose every method spawned the CLI and returned an exit code plus captured output strings. That was a second, weaker path to work the library already does in process: a subprocess boundary discards the typed reports that make embedding worthwhile, and it forced TS and Node users to treat the library as a program to be invoked rather than code to be called.\n\nTypeScript callers embed the library (above). Callers in languages that cannot embed JavaScript use the command, and a generated client for those languages is planned work.\n\n## Deferred RDF/XML output\n\nThe engine parses RDF/XML from `.rdf` and `.xml` wiki inputs. RDF/XML serialization is deferred from the initial Deno cutover: `export -f xml` returns an explicit unsupported-format error, and an RDF/XML `Accept` request to the SPARQL service returns `406 Not Acceptable`. The engine never substitutes a different serialization.\n\n## Related\n\n- [Deno API Reference](Deno_API_Reference.md)\n- [TypeScript API Reference](TypeScript_API_Reference.md)\n- [Python API Reference](Python_API_Reference.md)\n- [Wiki CLI](wiki.md)\n- [Wiki Configuration](Wiki_Configuration.md)";
schema:headline "Wiki Programmatic API";
schema:dateCreated "2026-10-31T23:19:03Z"^^xsd:dateTime;
schema:dateModified "2026-10-31T23:19:03Z"^^xsd:dateTime.
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org/TechArticle> .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/description> "Stable Deno/TypeScript and npm entry points for validating, building, and querying a wiki." .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/articleBody> "# Wiki Programmatic API\n\nThe Deno/TypeScript engine is the single Wiki implementation. Use its in-process API for Deno and TypeScript applications. The npm package exposes a runtime/bootstrap API that locates the Deno runtime and builds the `wiki` command; it does not export a `Wiki` class. The `wiki` CLI remains the primary user surface.\n\nSee [Design Philosophies](Design_Philosophies.md) for the CLI/library boundary. RDF/XML input remains supported; RDF/XML output is explicitly deferred from the Deno cutover.\n\n## Native Deno library\n\nThe Deno library is published as [`@wazoo/wiki` on JSR](https://jsr.io/@wazoo/wiki), with `src/wiki/mod.ts` as its public entrypoint.\n\n```ts\nimport { Wiki } from \"jsr:@wazoo/wiki\";\n\nconst wiki = Wiki.load(\"docs/wiki.yml\");\n```\n\n`Wiki.load` accepts a config path or a directory containing `wiki.yml` / `wiki.yaml`. The optional `wikiInputs` setting overrides `wiki.input`; installed, read-only sources are then included as part of the corpus.\n\n### Validation reports\n\n`Wiki.check` and `Wiki.lint` are asynchronous and return `Promise<AuditReport>` values. Each report has `ok`, `errors`, and `warnings`; `applyStrict()` promotes warnings to errors. When enabled, `lint.heading_levels` uses the in-process ESLint Markdown rule engine; route-aware links, CURIE resolution, and the remaining Wiki policies stay in Wiki.\n\n```ts\nconst lintReport = await wiki.lint(undefined, { strict: true });\nconst report = await wiki.check(undefined, { strict: true });\nconst [lintErrors, lintWarnings] = lintReport.messages();\nconst [errors, warnings] = report.messages();\nif (!lintReport.ok || !report.ok) {\n console.error(\n [...lintErrors, ...lintWarnings, ...errors, ...warnings].join(\"\\n\"),\n );\n}\n```\n\nPass a list of document paths as the first argument to scope an operation:\n\n```ts\nconst report = await wiki.check([\"docs/wiki/Getting_Started.md\"]);\n```\n\n### Guarded edits\n\n`Wiki.edit()` validates a batch of page changes against the wiki's shapes, routes, and links and, with `apply`, writes every file or none. Conflicts and rejections come back in the report rather than as exceptions, so a caller can re-read, repair, and retry; a malformed edit throws `EditUsageError`. `Wiki.show()` returns one page as the engine reads it, including the `hash` an op passes as `expect`, and `Wiki.refs()` lists the pages linking to and from it. See [wiki edit](wiki_edit.md) for the edit format, validation scope, and report.\n\n```ts\nconst page = await wiki.show(\"wiki/Budget_Ledger.md\");\nconst report = await wiki.edit({\n ops: [{\n op: \"patch\",\n path: \"wiki/Budget_Ledger.md\",\n expect: page.hash,\n target: { heading: \"Change log\" },\n mode: \"append\",\n content: \"- 2026-10-10 — Added the Neon plan.\",\n }],\n}, { apply: true });\nif (report.status === \"conflict\") {\n // Someone changed the page since `show`: re-read and rebuild the edit.\n}\n```\n\n### Query and graph access\n\n```ts\nconst results = await wiki.query(\n \"SELECT ?name WHERE { ?person <https://schema.org/name> ?name }\",\n { format: \"json\" },\n);\n\nconst graph = await wiki.graph();\nconst dataset = await wiki.dataset();\n```\n\n`query` returns the chosen result format as a string. `graph()` returns the inferred union graph by default; `dataset()` exposes named graphs for source provenance. Options support inference, reload, and disk-cache control.\n\n### Build and export\n\n```ts\nconst built = await wiki.build(\"_site\", {\n baseUrl: \"/wiki\",\n urlStyle: \"dir\",\n});\nif (!built.ok) throw new Error(built.error_message ?? \"Build failed\");\n\nconst exported = await wiki.export(undefined, { format: \"json-ld\" });\nif (!exported.ok) {\n throw new Error(exported.error_message ?? \"Export failed\");\n}\n```\n\nThe library also exposes formatting, inline SPARQL rendering, link analysis and repair, source management, local serving, and project scaffolding. Its generated TSDoc reference is on [JSR](https://jsr.io/@wazoo/wiki).\n\n## The `wazootech-wiki` npm package: command only\n\nThe npm package publishes the `wiki` command and nothing else. It bundles the Deno runtime, so npm users need neither system Python nor a separate Deno installation; Node.js 18 or newer is the only requirement.\n\n```bash\nnpm install -g wazootech-wiki\n```\n\n```bash\nwiki -c docs/wiki.yml check --strict\n```\n\n### Why there is no npm `Wiki` class\n\nThis package previously exported a `Wiki` SDK whose every method spawned the CLI and returned an exit code plus captured output strings. That was a second, weaker path to work the library already does in process: a subprocess boundary discards the typed reports that make embedding worthwhile, and it forced TS and Node users to treat the library as a program to be invoked rather than code to be called.\n\nTypeScript callers embed the library (above). Callers in languages that cannot embed JavaScript use the command, and a generated client for those languages is planned work.\n\n## Deferred RDF/XML output\n\nThe engine parses RDF/XML from `.rdf` and `.xml` wiki inputs. RDF/XML serialization is deferred from the initial Deno cutover: `export -f xml` returns an explicit unsupported-format error, and an RDF/XML `Accept` request to the SPARQL service returns `406 Not Acceptable`. The engine never substitutes a different serialization.\n\n## Related\n\n- [Deno API Reference](Deno_API_Reference.md)\n- [TypeScript API Reference](TypeScript_API_Reference.md)\n- [Python API Reference](Python_API_Reference.md)\n- [Wiki CLI](wiki.md)\n- [Wiki Configuration](Wiki_Configuration.md)" .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/headline> "Wiki Programmatic API" .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/dateCreated> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/dateModified> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
@prefix schema: <https://schema.org/>.
@prefix wiki: <https://wazootech.github.io/wiki/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix wazoo: <https://schema.wazoo.dev/>.
wiki:Wiki_Programmatic_API a schema:TechArticle;
schema:description "Stable Deno/TypeScript and npm entry points for validating, building, and querying a wiki.";
schema:articleBody "# Wiki Programmatic API\n\nThe Deno/TypeScript engine is the single Wiki implementation. Use its in-process API for Deno and TypeScript applications. The npm package exposes a runtime/bootstrap API that locates the Deno runtime and builds the `wiki` command; it does not export a `Wiki` class. The `wiki` CLI remains the primary user surface.\n\nSee [Design Philosophies](Design_Philosophies.md) for the CLI/library boundary. RDF/XML input remains supported; RDF/XML output is explicitly deferred from the Deno cutover.\n\n## Native Deno library\n\nThe Deno library is published as [`@wazoo/wiki` on JSR](https://jsr.io/@wazoo/wiki), with `src/wiki/mod.ts` as its public entrypoint.\n\n```ts\nimport { Wiki } from \"jsr:@wazoo/wiki\";\n\nconst wiki = Wiki.load(\"docs/wiki.yml\");\n```\n\n`Wiki.load` accepts a config path or a directory containing `wiki.yml` / `wiki.yaml`. The optional `wikiInputs` setting overrides `wiki.input`; installed, read-only sources are then included as part of the corpus.\n\n### Validation reports\n\n`Wiki.check` and `Wiki.lint` are asynchronous and return `Promise<AuditReport>` values. Each report has `ok`, `errors`, and `warnings`; `applyStrict()` promotes warnings to errors. When enabled, `lint.heading_levels` uses the in-process ESLint Markdown rule engine; route-aware links, CURIE resolution, and the remaining Wiki policies stay in Wiki.\n\n```ts\nconst lintReport = await wiki.lint(undefined, { strict: true });\nconst report = await wiki.check(undefined, { strict: true });\nconst [lintErrors, lintWarnings] = lintReport.messages();\nconst [errors, warnings] = report.messages();\nif (!lintReport.ok || !report.ok) {\n console.error(\n [...lintErrors, ...lintWarnings, ...errors, ...warnings].join(\"\\n\"),\n );\n}\n```\n\nPass a list of document paths as the first argument to scope an operation:\n\n```ts\nconst report = await wiki.check([\"docs/wiki/Getting_Started.md\"]);\n```\n\n### Guarded edits\n\n`Wiki.edit()` validates a batch of page changes against the wiki's shapes, routes, and links and, with `apply`, writes every file or none. Conflicts and rejections come back in the report rather than as exceptions, so a caller can re-read, repair, and retry; a malformed edit throws `EditUsageError`. `Wiki.show()` returns one page as the engine reads it, including the `hash` an op passes as `expect`, and `Wiki.refs()` lists the pages linking to and from it. See [wiki edit](wiki_edit.md) for the edit format, validation scope, and report.\n\n```ts\nconst page = await wiki.show(\"wiki/Budget_Ledger.md\");\nconst report = await wiki.edit({\n ops: [{\n op: \"patch\",\n path: \"wiki/Budget_Ledger.md\",\n expect: page.hash,\n target: { heading: \"Change log\" },\n mode: \"append\",\n content: \"- 2026-10-10 — Added the Neon plan.\",\n }],\n}, { apply: true });\nif (report.status === \"conflict\") {\n // Someone changed the page since `show`: re-read and rebuild the edit.\n}\n```\n\n### Query and graph access\n\n```ts\nconst results = await wiki.query(\n \"SELECT ?name WHERE { ?person <https://schema.org/name> ?name }\",\n { format: \"json\" },\n);\n\nconst graph = await wiki.graph();\nconst dataset = await wiki.dataset();\n```\n\n`query` returns the chosen result format as a string. `graph()` returns the inferred union graph by default; `dataset()` exposes named graphs for source provenance. Options support inference, reload, and disk-cache control.\n\n### Build and export\n\n```ts\nconst built = await wiki.build(\"_site\", {\n baseUrl: \"/wiki\",\n urlStyle: \"dir\",\n});\nif (!built.ok) throw new Error(built.error_message ?? \"Build failed\");\n\nconst exported = await wiki.export(undefined, { format: \"json-ld\" });\nif (!exported.ok) {\n throw new Error(exported.error_message ?? \"Export failed\");\n}\n```\n\nThe library also exposes formatting, inline SPARQL rendering, link analysis and repair, source management, local serving, and project scaffolding. Its generated TSDoc reference is on [JSR](https://jsr.io/@wazoo/wiki).\n\n## The `wazootech-wiki` npm package: command only\n\nThe npm package publishes the `wiki` command and nothing else. It bundles the Deno runtime, so npm users need neither system Python nor a separate Deno installation; Node.js 18 or newer is the only requirement.\n\n```bash\nnpm install -g wazootech-wiki\n```\n\n```bash\nwiki -c docs/wiki.yml check --strict\n```\n\n### Why there is no npm `Wiki` class\n\nThis package previously exported a `Wiki` SDK whose every method spawned the CLI and returned an exit code plus captured output strings. That was a second, weaker path to work the library already does in process: a subprocess boundary discards the typed reports that make embedding worthwhile, and it forced TS and Node users to treat the library as a program to be invoked rather than code to be called.\n\nTypeScript callers embed the library (above). Callers in languages that cannot embed JavaScript use the command, and a generated client for those languages is planned work.\n\n## Deferred RDF/XML output\n\nThe engine parses RDF/XML from `.rdf` and `.xml` wiki inputs. RDF/XML serialization is deferred from the initial Deno cutover: `export -f xml` returns an explicit unsupported-format error, and an RDF/XML `Accept` request to the SPARQL service returns `406 Not Acceptable`. The engine never substitutes a different serialization.\n\n## Related\n\n- [Deno API Reference](Deno_API_Reference.md)\n- [TypeScript API Reference](TypeScript_API_Reference.md)\n- [Python API Reference](Python_API_Reference.md)\n- [Wiki CLI](wiki.md)\n- [Wiki Configuration](Wiki_Configuration.md)";
schema:headline "Wiki Programmatic API";
schema:dateCreated "2026-10-31T23:19:03Z"^^xsd:dateTime;
schema:dateModified "2026-10-31T23:19:03Z"^^xsd:dateTime.
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org/TechArticle> .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/description> "Stable Deno/TypeScript and npm entry points for validating, building, and querying a wiki." .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/articleBody> """# Wiki Programmatic API
The Deno/TypeScript engine is the single Wiki implementation. Use its in-process API for Deno and TypeScript applications. The npm package exposes a runtime/bootstrap API that locates the Deno runtime and builds the `wiki` command; it does not export a `Wiki` class. The `wiki` CLI remains the primary user surface.
See [Design Philosophies](Design_Philosophies.md) for the CLI/library boundary. RDF/XML input remains supported; RDF/XML output is explicitly deferred from the Deno cutover.
## Native Deno library
The Deno library is published as [`@wazoo/wiki` on JSR](https://jsr.io/@wazoo/wiki), with `src/wiki/mod.ts` as its public entrypoint.
```ts
import { Wiki } from "jsr:@wazoo/wiki";
const wiki = Wiki.load("docs/wiki.yml");
```
`Wiki.load` accepts a config path or a directory containing `wiki.yml` / `wiki.yaml`. The optional `wikiInputs` setting overrides `wiki.input`; installed, read-only sources are then included as part of the corpus.
### Validation reports
`Wiki.check` and `Wiki.lint` are asynchronous and return `Promise<AuditReport>` values. Each report has `ok`, `errors`, and `warnings`; `applyStrict()` promotes warnings to errors. When enabled, `lint.heading_levels` uses the in-process ESLint Markdown rule engine; route-aware links, CURIE resolution, and the remaining Wiki policies stay in Wiki.
```ts
const lintReport = await wiki.lint(undefined, { strict: true });
const report = await wiki.check(undefined, { strict: true });
const [lintErrors, lintWarnings] = lintReport.messages();
const [errors, warnings] = report.messages();
if (!lintReport.ok || !report.ok) {
console.error(
[...lintErrors, ...lintWarnings, ...errors, ...warnings].join("\\n"),
);
}
```
Pass a list of document paths as the first argument to scope an operation:
```ts
const report = await wiki.check(["docs/wiki/Getting_Started.md"]);
```
### Guarded edits
`Wiki.edit()` validates a batch of page changes against the wiki's shapes, routes, and links and, with `apply`, writes every file or none. Conflicts and rejections come back in the report rather than as exceptions, so a caller can re-read, repair, and retry; a malformed edit throws `EditUsageError`. `Wiki.show()` returns one page as the engine reads it, including the `hash` an op passes as `expect`, and `Wiki.refs()` lists the pages linking to and from it. See [wiki edit](wiki_edit.md) for the edit format, validation scope, and report.
```ts
const page = await wiki.show("wiki/Budget_Ledger.md");
const report = await wiki.edit({
ops: [{
op: "patch",
path: "wiki/Budget_Ledger.md",
expect: page.hash,
target: { heading: "Change log" },
mode: "append",
content: "- 2026-10-10 — Added the Neon plan.",
}],
}, { apply: true });
if (report.status === "conflict") {
// Someone changed the page since `show`: re-read and rebuild the edit.
}
```
### Query and graph access
```ts
const results = await wiki.query(
"SELECT ?name WHERE { ?person <https://schema.org/name> ?name }",
{ format: "json" },
);
const graph = await wiki.graph();
const dataset = await wiki.dataset();
```
`query` returns the chosen result format as a string. `graph()` returns the inferred union graph by default; `dataset()` exposes named graphs for source provenance. Options support inference, reload, and disk-cache control.
### Build and export
```ts
const built = await wiki.build("_site", {
baseUrl: "/wiki",
urlStyle: "dir",
});
if (!built.ok) throw new Error(built.error_message ?? "Build failed");
const exported = await wiki.export(undefined, { format: "json-ld" });
if (!exported.ok) {
throw new Error(exported.error_message ?? "Export failed");
}
```
The library also exposes formatting, inline SPARQL rendering, link analysis and repair, source management, local serving, and project scaffolding. Its generated TSDoc reference is on [JSR](https://jsr.io/@wazoo/wiki).
## The `wazootech-wiki` npm package: command only
The npm package publishes the `wiki` command and nothing else. It bundles the Deno runtime, so npm users need neither system Python nor a separate Deno installation; Node.js 18 or newer is the only requirement.
```bash
npm install -g wazootech-wiki
```
```bash
wiki -c docs/wiki.yml check --strict
```
### Why there is no npm `Wiki` class
This package previously exported a `Wiki` SDK whose every method spawned the CLI and returned an exit code plus captured output strings. That was a second, weaker path to work the library already does in process: a subprocess boundary discards the typed reports that make embedding worthwhile, and it forced TS and Node users to treat the library as a program to be invoked rather than code to be called.
TypeScript callers embed the library (above). Callers in languages that cannot embed JavaScript use the command, and a generated client for those languages is planned work.
## Deferred RDF/XML output
The engine parses RDF/XML from `.rdf` and `.xml` wiki inputs. RDF/XML serialization is deferred from the initial Deno cutover: `export -f xml` returns an explicit unsupported-format error, and an RDF/XML `Accept` request to the SPARQL service returns `406 Not Acceptable`. The engine never substitutes a different serialization.
## Related
- [Deno API Reference](Deno_API_Reference.md)
- [TypeScript API Reference](TypeScript_API_Reference.md)
- [Python API Reference](Python_API_Reference.md)
- [Wiki CLI](wiki.md)
- [Wiki Configuration](Wiki_Configuration.md)""" .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/headline> "Wiki Programmatic API" .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/dateCreated> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://wazootech.github.io/wiki/Wiki_Programmatic_API> <https://schema.org/dateModified> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .