feat: render plugin hook and SpaceGraph#67
feat: render plugin hook and SpaceGraph#67mindsocket wants to merge 4 commits intofeat/filteringfrom
Conversation
|
Claude finished @mindsocket's task in 5m 16s —— View job Code ReviewTasks:
SummaryThis is a well-structured PR that introduces a clean, extensible render plugin system with the Strengths
Issues & Suggestions1. Misleading "DEPRECATED" CommentFile: The comment marks /**
* DEPRECATED - likely not needed after migration to render plugin and SpaceGraph
* Build a depth map from hierarchy levels.
*/
function buildDepthMap(hierarchyLevels: HierarchyLevel[]): Map<string, number> {Suggestion: Either remove this function if truly deprecated, or update the comment to clarify its current status. Fix this → 2. Unsafe Type Assertion in Mermaid RendererFile: const status = node.schemaData.status as string;This assumes every node has a Suggestion: Provide a fallback or use optional chaining: const status = (node.schemaData.status as string | undefined) ?? 'active';3. Hardcoded Type Styles in Mermaid OutputFile: The Mermaid renderer outputs hardcoded styles for specific types ( mmd += ' classDef vision fill:#ff9999,stroke:#ff0000,stroke-width:2px\n';
mmd += ' classDef mission fill:#99ccff,stroke:#0066cc,stroke-width:2px\n';
// ...Suggestion: Consider making this configurable or deriving styles dynamically from the hierarchy levels. For now, this may be acceptable as a Markdown plugin-specific implementation detail. 4. Blocking File Write in Render CommandFile: writeFileSync(options.output, result);The command is Suggestion: Use await fs.promises.writeFile(options.output, result);5. Silent Error Continuation in FilterFile: try {
const result = await expr.evaluate(input);
if (result) matched.push(node);
} catch (error) {
console.warn(`Warning: Error evaluating filter expression for node "${node.title}":`, error);
}When filter evaluation fails for a node, it's silently skipped. This could lead to unexpected results where some nodes match the filter but fail evaluation and are excluded. Suggestion: Consider if this should be an error, or at least document this behavior clearly. Minor Observations
Test Plan Verification
ConclusionThis PR is ready to merge with minor optional improvements. The core architecture is sound, tests are comprehensive, and the implementation follows the project's patterns well. The issues identified above are relatively minor and don't block the merge — they can be addressed in follow-up commits if desired. |
9ef7f07 to
bd6f472
Compare
|
Claude finished @mindsocket's task in 1m 21s —— View job Updated Code Review
|
Add a `render` plugin hook to the ost-tools plugin contract, providing a centralised pipeline for rendering SpaceNode[] into output formats: Pipeline: parse → validate (AJV) → filter → classify → render hook Key changes: - New `RenderFormat`, `RenderInput`, `RenderHook` types in plugins/util.ts - `buildFormatRegistry()` in src/render/registry.ts collects formats from all loaded plugins (additive, unlike the first-responder parse/templateSync hooks) - `executeRender()` in src/render/render.ts drives the full pipeline - `ost-tools render <space> <format>` command with `--filter` and `-o` options - `ost-tools render list [space]` lists available formats Markdown plugin provides two formats: - `markdown.bullets` — indented bullet list (replaces show command logic) - `markdown.mermaid` — Mermaid graph TD diagram (replaces diagram command logic) `show` and `diagram` kept as convenience aliases that delegate to the render pipeline. `diagram` gains `--filter` support as a free side-effect. `show` gains schema validation filtering it previously lacked. Follow-up issues: #64 (extract mermaid plugin), #65 (migrate miro-sync)
…k convention - Flatten src/graph/space-graph.ts → src/space-graph.ts; remove graph/ dir - Remove unused `categories` map from SpaceGraph - Align render hook signature with parse/templateSync convention: render(context: PluginContext, graph: SpaceGraph, options: RenderOptions) - Replace RenderInput with RenderOptions; plugin-api exports RenderOptions - Internal render implementations (renderBullets, renderMermaid) take only what they use — context is not threaded into them - Update all call sites, tests, and plugin-api exports accordingly
bd6f472 to
89305ed
Compare
|
Claude finished @mindsocket's task in 1m 8s —— View job Updated Code ReviewTasks:
SummaryThis review examines the current state of the PR at commit ✅ Overall AssessmentThis is a well-architected PR that introduces a clean, extensible render plugin system with the
|
|
Merged manually |

Summary
rendercommand that dispatches to plugin-provided render formats (e.g.markdown.bullets,markdown.mermaid)SpaceGraph— a navigable, indexed graph built fromSpaceNode[]— used by render and filter consumershook(context: PluginContext, ...data, options)— render hooks now receivePluginContextfor consistency with parse/templateSyncRenderInputwithRenderOptions;plugin-apiexports updated accordinglylefthookfor pre-commit lint/format enforcementsrc/graph/space-graph.ts→src/space-graph.ts; removes unusedcategoriesfromSpaceGraphTest plan
bun test tests/render/— render unit tests passbun test tests/space-graph.test.ts— SpaceGraph tests passost-tools render <space> markdown.bulletsoutputs an indented bullet treeost-tools render <space> markdown.mermaidoutputs a Mermaidgraph TDdiagramost-tools render <space> markdown.bullets --filter "opportunity"respects filter