Getting Started
Welcome to Speculator! This guide will help you get up and running with the core packages.
Installation
Section titled “Installation”You can install the core packages using your favorite package manager.
pnpm add @openuji/speculatorBasic Usage
Section titled “Basic Usage”To start using Speculator, you’ll typically use the speculate function to process a document with a set of plugins.
import { speculate, corePlugins } from "@openuji/speculator";
const result = await speculate({ entry: "path/to/spec.md", plugins: corePlugins,});
console.log(result.workspace);Workspaces
Section titled “Workspaces”For managing multiple isolated specifications, Speculator provides a workspace building utility. This allows you to process multiple documents at once, keeping their namespaces and references isolated.
const result = await buildWorkspaces({ entryMap: { docs: [{ entry: "spec/core/index.md" }, { entry: "spec/api/index.html" }], },});
if (result.errors.length > 0) { console.error("Errors encountered:", result.errors);}
// Access built workspace 'docs' ASTconsole.log(result.workspaces.docs);Next Steps
Section titled “Next Steps”Check out the Configuration guide to learn how to structure your specs, or the API Reference for more detailed information.