Why
Setting up vitepress-plugin-openspec currently requires boilerplate that is error-prone: users must manually call generateOpenSpecPages() before defineConfig(), resolve __dirname for ESM modules, and repeat the same specDir/outDir options across three separate API calls. A single higher-level helper can eliminate all of this.
What Changes
- Introduce a
withOpenSpec(vitepressConfig, options?)wrapper function that handles the full integration in one call - The wrapper calls
generateOpenSpecPages()synchronously before returning the config - It auto-merges the Vite plugin, nav entry, and sidebar section into the provided config
specDirandsrcDirare resolved automatically relative toprocess.cwd()when not specified- Existing lower-level APIs (
generateOpenSpecPages,openspec,generateOpenSpecSidebar,openspecNav) remain unchanged and fully supported — no breaking changes
Capabilities
New Capabilities
simplified-config-api: AwithOpenSpec()helper that wraps a VitePressUserConfigobject, wires up all openspec integration (page generation, Vite plugin, sidebar, nav) in a single call, and returns the fully merged config.
Modified Capabilities
Impact
src/index.ts: export newwithOpenSpecfunctionsrc/plugin.ts: addwithOpenSpecimplementationsrc/types.ts: addWithOpenSpecOptionstype (extendsOpenSpecPluginOptionswith nav/sidebar merge options)- README.md: update usage example to show the simplified API alongside the existing verbose API