Skip to content

Add dynamic brain bundle viewer - #1

Merged
emilio-balda merged 8 commits into
mainfrom
feat/dynamic-viewer
Sep 1, 2026
Merged

emilio-balda merged 8 commits into
mainfrom
feat/dynamic-viewer

Conversation

@emilio-balda

Copy link
Copy Markdown
Collaborator

Summary

  • Add a Vite/React viewer for navigating brain bundles dynamically
  • Implement graph, detail, sidebar, navigation, and theme components
  • Add Python viewer generation, bundle validation, and CLI integration
  • Document the OKF workflow and starter brain structure
  • Add unit tests for CLI, bundles, viewer generation, navigation, and graph behavior

Testing

  • Not run (not requested)

Copilot AI lite review requested due to automatic review settings September 1, 2026 14:59
@emilio-balda
emilio-balda merged commit 82348d0 into main Sep 1, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 visualize command) 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 visualize CLI 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 thread viewer/brain.js
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}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants