Add plugin system with markdown as built-in plugin#61
Conversation
… with ansi highlighting
Introduces a plugin architecture where space content is parsed by an ordered chain of plugins. The built-in markdown plugin handles directory spaces and space_on_a_page files; additional plugins can be registered per-space via `plugins` in the space config. Key changes: - Plugin contract: `OstToolsPlugin` with `parse(context) → ParseResult | null` - Plugin loader resolves config-adjacent and npm-installed plugins by name, validates each plugin's config against its declared `configSchema` - `ParseResult` replaces separate `SpaceDirectoryReadResult` / `SpaceOnAPageReadResult`; adds `parseIgnored` and typed `diagnostics` - Markdown plugin config (`templateDir`, `fieldMap`, `templatePrefix`) moves from top-level `SpaceConfig` fields into `plugins.ost-tools-markdown` - New `plugins` command lists built-in and config-adjacent plugins - `spaces` command shows per-space custom plugin configuration - Tests reorganised to mirror src/ structure (plugins/markdown/, validate/, commands/, read/) Closes #58
|
Claude finished @mindsocket's task in 17m 15s —— View job Code Review Complete ✅Status: Approved - Plugin system is working correctly! SummaryI've completed a comprehensive code review of the plugin system. The plugin architecture is excellent and the core functionality is working properly. ✅ Test ResultsPlugin System Tests: PASSING
Total: 125 tests passing
|
- spaces: render each plugin's config block generically (no more hardcoded templateDir/fieldMap/templatePrefix field names) - template-sync: move markdown config resolution into templateSync() itself via getMarkdownConfig(); index.ts now passes space.plugins rather than pre-extracted fields - markdown plugin: export getMarkdownConfig() helper to centralise the plugin-name key lookup and type cast
The claude-code-action ships bun 1.3.6 internally, which pre-dates Bun.JSON5. Adding setup-bun's bin directory to GITHUB_PATH again after install ensures it appears first in PATH when the action shells out to run Bash tools (bun run test, bun run lint etc.).
Summary
space_on_a_pagefiles; additional plugins can be registered per-space viapluginsin the space config (keyed by plugin name → config object).{configDir}/plugins/) and npm-installed plugins, validating each plugin's config against its declaredconfigSchema.ParseResultreplaces the separateSpaceDirectoryReadResult/SpaceOnAPageReadResulttypes; addsparseIgnored(combined skipped/non-space files) and a typeddiagnostics: Record<string, number | string | string[]>.templateDir,fieldMap,templatePrefix) moves from top-levelSpaceConfigfields intoplugins.ost-tools-markdownper space.pluginscommand lists built-in and config-adjacent plugins.spacescommand shows per-space custom plugin configuration.src/structure (plugins/markdown/,validate/,commands/,read/).Closes #58
Test plan
bun run test— all 236 unit tests passbun run test:smoke— smoke tests pass for all configured spacesost-tools pluginslists the built-in markdown pluginost-tools spacesshows plugin config for spaces that have itpluginsconfig still works (markdown fallback)plugins: { "ost-tools-markdown": { "fieldMap": {...} } }applies fieldMap correctly