1. Types
- [x] 1.1 Add
WithOpenSpecOptionsinterface tosrc/types.ts(extendsOpenSpecPluginOptionswithnav?: booleanandsidebar?: boolean) - [x] 1.2 Export
WithOpenSpecOptionsfromsrc/index.ts
2. Implementation
- [x] 2.1 Implement
withOpenSpec(config, options?)insrc/plugin.ts - [x] 2.2 Merge Vite plugin into
config.vite.plugins(preserving existing plugins) - [x] 2.3 Prepend nav entry to
config.themeConfig.navwhennav !== falseand themeConfig exists - [x] 2.4 Inject sidebar section under
/${outDir}/key whensidebar !== falseand sidebar is an object - [x] 2.5 Export
withOpenSpecfromsrc/index.ts
3. Tests
- [x] 3.1 Test:
withOpenSpec({})callsgenerateOpenSpecPagesand returns config with Vite plugin - [x] 3.2 Test: nav entry is prepended when
themeConfig.navexists - [x] 3.3 Test: sidebar section is injected under the correct key
- [x] 3.4 Test:
nav: falseskips nav injection - [x] 3.5 Test:
sidebar: falseskips sidebar injection - [x] 3.6 Test: existing Vite plugins are preserved
4. Documentation
- [x] 4.1 Update README to show
withOpenSpecas the primary usage example - [x] 4.2 Move existing verbose API to a "Advanced / manual setup" section
- [x] 4.3 Update JSDoc on
withOpenSpecwith example snippet showing other plugins alongside openspec - [x] 4.4 Add usage note to README: "other Vite plugins go into
vite.pluginsas usual —withOpenSpecappends to the array without replacing it"