Skip to content

Conversation

@thiencode
Copy link

Summary

This PR adds support for selecting a diagram syntax during knowns init.

Users can choose between mermaid, plantuml, or none. The selected option is stored in .knowns/config.json and used by AI agents when generating diagrams, while remaining optional and CLI-first.

Why

Previously, Knowns only supported plain-text diagrams. This change improves clarity and flexibility without adding mandatory complexity, while keeping files as the source of truth.

What changed

  • Add diagramTool field to Project model with three options: mermaid, plantuml, none
  • Integrate diagram tool selection into knowns init wizard with detailed descriptions
  • Implement knowns config get/set diagramTool with validation
  • Create MermaidRenderer component with dark/light theme support
  • Create PlantUMLRenderer component with deflate+base64 encoding
  • Integrate diagram renderers into markdown rendering pipeline (MDRender, MarkdownRenderer)
  • Update AI agent guidelines (CLI, MCP) to check project diagram preference
  • Add comprehensive diagram tool documentation to docs/configuration.md
  • Install dependencies: mermaid@^11.4.1, pako@^2.1.0, @types/pako@^2.0.3
  • Export new renderer components from atoms/index.ts
  • Add diagram-specific CSS styles for rendering

Testing:

  • All 78 existing tests pass
  • Manual testing: wizard selection, config get/set, theme switching
  • Linter checks pass
  • Tested all three diagram options (mermaid, plantuml, none)
  • Verified validation for invalid diagramTool values

Breaking changes: None
Backward compatible: Existing projects default to 'mermaid'

…tUML rendering

- Add diagramTool field to Project model with three options: mermaid, plantuml, none
- Integrate diagram tool selection into knowns init wizard with detailed descriptions
- Implement knowns config get/set diagramTool with validation
- Create MermaidRenderer component with dark/light theme support
- Create PlantUMLRenderer component with deflate+base64 encoding
- Integrate diagram renderers into markdown rendering pipeline (MDRender, MarkdownRenderer)
- Update AI agent guidelines (CLI, MCP) to check project diagram preference
- Add comprehensive diagram tool documentation to docs/configuration.md
- Install dependencies: mermaid@^11.4.1, pako@^2.1.0, @types/pako@^2.0.3
- Export new renderer components from atoms/index.ts
- Add diagram-specific CSS styles for rendering

Testing:
- All 78 existing tests pass
- Manual testing: wizard selection, config get/set, theme switching
- Linter checks pass
- Tested all three diagram options (mermaid, plantuml, none)
- Verified validation for invalid diagramTool values

Breaking changes: None
Backward compatible: Existing projects default to 'mermaid'
@howznguyen
Copy link
Contributor

Thanks for this comprehensive PR! The diagram tool selection feature looks solid.

Important update: In v0.5.0, we've switched from our previous markdown rendering approach to BlockNote as the primary editor. This is a significant architectural change that affects how content is rendered and edited.
The following files/components may need adjustment:

  • MermaidRenderer and PlantUMLRenderer - need to work as BlockNote custom blocks
  • Integration with MDRender/MarkdownRenderer - these are being replaced by BlockNote's rendering system
    Consider adding diagram blocks to BlockNote's slash menu or block type selector

Would you be able to adapt the diagram rendering to work with BlockNote? Happy to provide more context on the new editor architecture if needed.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

This pull request has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Please update your PR or let us know if you need help.

@github-actions github-actions bot added the stale label Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants