@bryophyte/analyser
v0.1.0
Published
Static analysis for react components
Readme
Bryophyte Analyser
Bryophyte Analyser is a CLI/TUI for React + TypeScript codebases that discovers exported components, records prop usage, and traces where components are used across packages.
Quick Start
Prerequisites
- Bun installed (
bun --version) - A project or monorepo with
package.jsonfiles
1) Install
Inside this repo:
bun install2) Initialize Bryophyte once at your workspace root
bunx bryophyte init .This creates .bryophyte/ and a central analyses folder at .bryophyte/analyses/.
3) Analyze one or more packages
bunx bryophyte analyse packages/ui
bunx bryophyte analyse packages/appEach analyzed package is written as a JSON file to .bryophyte/analyses/<package-name>.json.
4) Search component usage in a target package
bunx bryophyte search Button packages/app --svgThis prints a Mermaid graph and can optionally write .mmd/.svg output.
Command Reference
bryophyte init [rootPath]
Initialize (or reuse) a central .bryophyte folder.
bunx bryophyte init .bryophyte analyse <projectPath>
Analyze exported React components in a project.
bunx bryophyte analyse packages/uiWhat it records:
- component exports (default/named; function/arrow/class/variable)
- extracted prop definitions
- component usages and prop usage metadata (including snippets and context)
bryophyte search <componentName> <targetPath>
Search for usage flow of a previously analyzed component.
bunx bryophyte search Button packages/app -o button-usage.mmd --svgUseful flags:
-o, --out <file>write Mermaid graph to file--svg [file]render SVG graph--listchoose package when multiple packages export the same component--skip-intermediatecollapse intermediate chain nodes
Typical Workflow
# one-time setup
bunx bryophyte init .
# analyze source and target packages
bunx bryophyte analyse packages/ui
bunx bryophyte analyse packages/app
# trace one component into app routes
bunx bryophyte search Button packages/app --svgNotes
- Search relies on analysis files in
.bryophyte/analyses/; runanalysebeforesearch. - Route traversal stops when a path contains a
routessegment. - Path aliases and re-exports are supported with best-effort resolution.
