vibe-review
v1.0.0
Published
A TypeScript CLI tool that analyzes React codebases and generates interactive dependency tree visualizations
Maintainers
Readme
vibe-review
A powerful tool to analyze React codebases and visualize component dependencies in an interactive tree format. Easily understand your component relationships, props, and dependency chains.
✨ Features
- 🔍 Smart Analysis: Automatically detects React components, hooks, pages, and utilities
- 📊 Interactive Tree: Dynamic dependency tree with expand/collapse functionality
- 🏷️ Prop Extraction: Shows component props inline, including destructured parameters
- 🔗 Dependency Tracking: Visualizes component relationships and hook usage
- 🎯 Filtering: Filter by component type or search by name/file path
- 📁 Path Exclusion: Configurable exclusion of UI libraries and utility folders
- ⚡ Fast: Built with TypeScript AST parsing for reliable analysis
🚀 Quick Start
Using pnpm dlx (Recommended)
# Analyze your React project
pnpm dlx vibe-review
# View help
pnpm dlx vibe-review helpUsing npx
# Analyze your React project
npx vibe-review📖 Usage
1. Analyze Your Codebase
Run the analyzer in your React project root:
pnpm dlx vibe-reviewThis will:
- Scan all
.tsand.tsxfiles in your project - Extract component definitions, props, hooks, and dependencies
- Generate a
call-graph.jsonfile with the analysis results - Create a default
analyzer-config.jsonconfiguration file
2. View the Results
After analysis, you can view the generated call-graph.json file or open the visualize.html file in your browser to explore:
- Component Tree: Hierarchical view of your components with their dependencies
- Props Display: See component props inline (e.g.,
Button(children, variant, onClick)) - Dependency Types: Distinguish between "renders" and "uses" relationships
- Search & Filter: Find specific components or filter by type
- Component Details: Click any component to see detailed information
🛠️ Configuration
The tool creates a default analyzer-config.json file:
{
"excludePaths": [
"node_modules/",
"dist/",
"build/",
".next/",
"out/",
"coverage/"
]
}Configuration Options
excludePaths: Array of paths to exclude from analysis (relative to project root)
📊 Understanding the Visualization
Node Types
- 🟢 Green circles: React components
- 🔷 Blue diamonds: React hooks
- 🟠 Orange circles: Page components
- 🟣 Purple circles: Utility functions
Node Information
- Component Name: Shows the function/component name
- Props: Displayed inline, e.g.,
TaskRow(task, onUpdate, onDelete) - Dependencies: Click ▶ to expand and see what this component uses
- Dependency Types:
(renders)- Component renders another component(uses)- Component uses a hook or utility
Interactive Features
- Expand/Collapse: Click ▶ to expand component dependencies
- Search: Type to search components by name or file path
- Filter: Use dropdown to show only exported components, pages, etc.
- Details Panel: Click any component to see full details including:
- File path and export status
- All props and their names
- Hooks used
- Dependencies and dependents
🔧 Command Line Options
# Basic usage
pnpm dlx vibe-review [command] [options]
# Commands
analyze # Analyze components (default)
help # Show help message
# Options
--config # Path to config file (default: analyzer-config.json)
--output # Output file path (default: call-graph.json)
# Examples
pnpm dlx vibe-review analyze --output my-graph.json
pnpm dlx vibe-review --config custom-config.json🧪 Example Output
The analyzer will show components like this in the tree:
▶ App(children)
▶ TaskTable(tasks, onUpdate)
▶ TaskRow(task, onEdit, onDelete) (renders)
• useTaskState() (uses)
▶ Button(children, variant) (renders)
▶ DatePicker(value, onChange) (renders)📋 Requirements
- Node.js 16.0.0 or higher
- React/TypeScript project with
.tsor.tsxfiles
🏗️ How It Works
- AST Parsing: Uses TypeScript compiler API to parse your code
- Component Detection: Identifies React components, hooks, and utilities
- Prop Extraction: Handles both destructuring and inline prop definitions
- Dependency Analysis: Tracks JSX usage and hook calls
- Tree Generation: Creates interactive tree with dynamic expansion
🛠️ Development
Local Development Setup
- Clone and install dependencies:
git clone https://github.com/ruang-guru/vibe-review.git
cd vibe-review
pnpm install- Build the project:
pnpm run build- Test locally without publishing:
To test the tool in another project without publishing to npm:
# In the vibe-review directory
pnpm link --global
# In your React project directory
pnpm link --global vibe-review
# Now you can use it like the published version
vibe-reviewAlternative: Using pnpm dlx with local path
You can also test directly from the source directory:
# From any React project, point to your local development folder
pnpm dlx /path/to/vibe-review
# Or if you're in the analyzer project root, test on another project
pnpm dlx . --cwd /path/to/your/react/projectDevelopment Workflow
- Make changes to the TypeScript source files in
src/ - Run
pnpm run buildto compile - Test your changes using one of the methods above
- Run
pnpm run checkto ensure code quality
Available Scripts
pnpm run build- Compile TypeScript to JavaScriptpnpm run format- Format code with Biomepnpm run lint- Lint and fix issuespnpm run check- Format, lint, and organize imports
🤝 Contributing
Contributions are welcome! This tool helps developers understand their React codebases better.
📄 License
MIT License - feel free to use this tool in your projects!
Made with ❤️ for the React community
