Add dynamic brain bundle viewer - #1
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a Vite/React-based “brain bundle” viewer for browsing OKF concepts locally, while also restructuring the Python OKF tooling into a top-level okf_tools/ package with deterministic index generation and stricter bundle validation. It also migrates the starter bundle location to brain/ and updates repository docs and hooks accordingly.
Changes:
- Add a Vite + React viewer (graph + sidebar + detail + theming) that loads Markdown concepts directly from
brain/. - Add/reshape Python tooling: bundle validation, deterministic index generation, CLI wiring, and packaging changes.
- Remove the previous Python-generated single-file HTML viewer (templates/static assets + CLI
visualizecommand) and update docs/tests accordingly.
Reviewed changes
Copilot reviewed 30 out of 44 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vite.config.js | Adds Vite/Vitest configuration for viewer tests. |
| viewer/theme.js | Adds theme persistence and prefers-color-scheme detection. |
| viewer/styles.css | Introduces viewer UI styling and responsive layout. |
| viewer/Sidebar.jsx | Implements searchable, filter-aware concept navigation sidebar. |
| viewer/navigation.test.js | Adds unit tests for sidebar tree building and concept filtering. |
| viewer/navigation.js | Adds folder tree construction and concept filtering logic. |
| viewer/main.jsx | Boots the React app and initializes document title/theme. |
| viewer/Graph.jsx | Adds Cytoscape-based graph rendering + selection/zoom controls. |
| viewer/Detail.jsx | Adds Markdown-based concept detail rendering with backlinks. |
| viewer/brain.test.js | Adds tests for bundle parsing, link resolution, staleness, trust signals. |
| viewer/brain.js | Implements client-side bundle building/parsing/linking utilities. |
| viewer/brain-files.js | Loads Markdown sources from /brain/** using Vite glob import. |
| viewer/App.jsx | Wires sidebar, graph, detail, filtering, layout, and theme state. |
| tests/test_viewer.py | Removes tests for the old Python-generated HTML viewer. |
| tests/test_starter_bundle.py | Updates starter bundle path from bundles/second-brain to brain/. |
| tests/test_cli.py | Removes CLI coverage for the removed visualize command. |
| src/okf_tools/viewer/templates/viz.html | Deletes legacy HTML template for Python viewer generation. |
| src/okf_tools/viewer/static/viz.js | Deletes legacy JS bundle for Python viewer generation. |
| src/okf_tools/viewer/static/viz.css | Deletes legacy CSS for Python viewer generation. |
| src/okf_tools/viewer/generator.py | Deletes legacy Python viewer generator implementation. |
| src/okf_tools/viewer/init.py | Deletes legacy viewer module export. |
| README.md | Updates repo layout, workflows, and adds viewer dev/build instructions. |
| pyproject.toml | Switches packaging layout to top-level okf_tools/ and adjusts pytest pathing. |
| package.json | Adds Node/Vite/React dependencies and scripts for the viewer. |
| okf_tools/validation.py | Adds bundle validation rules and reporting. |
| okf_tools/cli.py | Updates CLI to validate/index/check (and removes visualize). |
| okf_tools/bundle/paths.py | Adds bundle path resolution utilities with traversal protection. |
| okf_tools/bundle/index.py | Adds deterministic index generation + drift detection. |
| okf_tools/bundle/document.py | Adds OKF document parser preserving timestamp text + helpers. |
| okf_tools/bundle/init.py | Exposes bundle helpers from the new package layout. |
| okf_tools/main.py | Adds python -m okf_tools entrypoint. |
| okf_tools/init.py | Adds package version marker. |
| MEMORY_WORKFLOW.md | Updates workflow references from bundles/second-brain to brain/. |
| index.html | Adds Vite entry HTML for the React viewer. |
| CONTRIBUTING.md | Updates contributor workflow commands for the new bundle location. |
| CODE_OF_CONDUCT.md | Removes the Code of Conduct document. |
| brain/projects/second-brain.md | Adds starter project concept. |
| brain/projects/index.md | Adds generated index for projects directory. |
| brain/index.md | Adds bundle root index with OKF version. |
| brain/decisions/use-okf.md | Adds starter decision concept. |
| brain/decisions/index.md | Adds generated index for decisions directory. |
| .pre-commit-config.yaml | Updates hook to run okf_tools check brain. |
| .gitignore | Adds node_modules/ ignore and removes old viewer output ignore. |
Suppressed comments (1)
okf_tools/cli.py:51
- PR description mentions "Python viewer generation" and "CLI integration", but this change set removes the
visualizeCLI subcommand and deletes the Python viewer generator/template/static assets and related tests. Either update the PR description to match the new approach (Vite/React-only viewer) or reintroduce the Python/CLI viewer functionality if it is still a requirement.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+37
to
+42
| const delimiterIndex = endIndex + 1; | ||
| let frontmatter; | ||
| try { | ||
| frontmatter = parseYaml(lines.slice(1, delimiterIndex).join("\n"), { schema: "core" }) ?? {}; | ||
| } catch (error) { | ||
| throw new Error(`Invalid YAML in frontmatter: ${error.message}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing