WS Frappe Tree
A Visual Studio Code extension for analyzing and visualizing Frappe DocType dependencies.
Features
- 🔍 Analyze DocType Dependencies: Automatically scan all DocType JSON files in your Frappe workspace
- 📊 Visual Dependency Graph: Interactive force-directed graph showing relationships between DocTypes
- 🌳 Dependency Tree View: Hierarchical tree visualization for specific DocTypes
- 📤 Export to JSON: Export all dependency information to a structured JSON file
- 📈 Statistics: View detailed statistics about your DocType structure
Supported Field Types
The extension analyzes the following Frappe field types:
- Link: Direct reference to another DocType
- Dynamic Link: Dynamic reference based on another field
- Table: Child table (One-to-Many relationship)
- Table MultiSelect: Multiple selection from child table
Commands
Access these commands from the Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
Frappe: Analyze DocType Dependencies - Scan all DocTypes in workspace
Frappe: Show Dependency Tree - Display interactive dependency graph
Frappe: Export Dependencies to JSON - Export analysis to JSON file (choose between all DocTypes flat or specific DocType nested)
Frappe: Analyze Current DocType - Analyze the currently open DocType file
Frappe: Export Current DocType to Nested JSON - Export the current DocType with nested dependencies
Usage
1. Analyze Workspace
Open Command Palette and run:
Frappe: Analyze DocType Dependencies
This will scan all DocType JSON files in your workspace and show statistics.
2. Visualize Dependencies
After analyzing, run:
Frappe: Show Dependency Tree
This opens an interactive graph where you can:
- Zoom using mouse wheel
- Pan by dragging the background
- Drag nodes to rearrange them
- Hover over nodes to see details
- Toggle labels for cleaner view
3. Analyze Single DocType
Right-click on any DocType JSON file and select:
Frappe: Analyze Current DocType
Or open a DocType file and run the command from the palette.
This will show:
- Direct dependencies (DocTypes this one references)
- Reverse dependencies (DocTypes that reference this one)
- Interactive tree visualization
4. Export Data
To export dependency information, you have two options:
Option A: Export All DocTypes (Flat Structure)
Frappe: Export Dependencies to JSON → Select "All DocTypes (Flat)"
This exports all DocTypes with their direct dependencies in a flat structure:
{
"timestamp": "2025-10-26T...",
"workspace": "your-workspace",
"totalDocTypes": 150,
"docTypes": [
{
"name": "Sales Order",
"module": "Selling",
"dependencies": [...]
}
]
}
Option B: Export Specific DocType (Nested Structure)
Frappe: Export Dependencies to JSON → Select "Specific DocType (Nested)"
Or right-click on a DocType JSON file:
Frappe: Export Current DocType to Nested JSON
This exports a single DocType with nested dependency tree:
{
"timestamp": "2025-10-26T...",
"workspace": "your-workspace",
"rootDocType": "Sales Order",
"maxDepth": 3,
"tree": {
"name": "Sales Order",
"module": "Selling",
"dependencies": [
{
"name": "Customer",
"module": "CRM",
"connectionInfo": {
"fieldName": "customer",
"fieldType": "Link"
},
"dependencies": [
{
"name": "Territory",
"module": "Setup",
"connectionInfo": {
"fieldName": "territory",
"fieldType": "Link"
},
"dependencies": []
}
]
}
]
}
}
The nested export respects the maxDepth configuration setting.
Example Output
JSON Export Structure
{
"timestamp": "2025-10-26T...",
"workspace": "medis-frappe",
"totalDocTypes": 150,
"docTypes": [
{
"name": "Delivery Route",
"module": "Medis",
"filePath": "/path/to/delivery_route.json",
"dependenciesCount": 3,
"dependencies": [
{
"targetDocType": "Driver",
"fieldName": "driver",
"fieldType": "Link"
},
{
"targetDocType": "Delivery Route Item",
"fieldName": "delivery_route_item",
"fieldType": "Table"
}
]
}
]
}
Requirements
- Visual Studio Code 1.80.0 or higher
- Frappe workspace with DocType JSON files
Extension Settings
This extension contributes the following settings:
ws-frappe-tree.maxDepth: Maximum depth for dependency tree analysis (default: 3, range: 1-10). Higher values show deeper dependency chains but may affect performance.
To change this setting:
- Open VS Code Settings (
Cmd+, / Ctrl+,)
- Search for "Frappe Tree"
- Adjust the "Max Depth" value
Known Issues
- Large workspaces (1000+ DocTypes) may take some time to analyze
- Dynamic Link fields show the reference field name, not actual target DocTypes
Development
Building from Source
cd ws-frappe-tree
npm install
npm run compile
Running in Development
- Open the extension folder in VS Code
- Press
F5 to launch Extension Development Host
- Test the commands in the new window
Release Notes
0.0.1
Initial release of WS Frappe Tree
- DocType dependency analysis
- Interactive graph visualization
- Tree view for specific DocTypes
- JSON export functionality
- Statistics and reports
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
MIT
Enjoy analyzing your Frappe applications! 🚀