AgentSkillsCN

Plugin Depgraph

插件 Depgraph

SKILL.md

@sbt/plugin-depgraph

Purpose

Visualizes all backend dependency relationships in Supabase as both an interactive HTML graph and Mermaid diagrams. Covers tables, RLS policies, functions, triggers, FK constraints, and enum/type usage.

Data Sources

  • docs/backend-atlas-data.json — generated by sbt generate-atlas
  • supabase/current/types/ — snapshot type SQL files for FK/column type info
  • src/integrations/supabase/types.ts — Supabase TypeScript types with FK relationships and enum usage

No running database is required.

Commands

code
sbt depgraph              Generate both HTML and Mermaid dependency graphs
sbt depgraph --html       Generate only the interactive HTML graph
sbt depgraph --mermaid    Generate only the Mermaid flowchart
sbt depgraph --json       Output raw graph data as JSON
sbt depgraph -h/--help    Show help

Output Files

  • docs/dependency-graph.html — Self-contained interactive HTML with force-directed graph layout, node filtering, search, zoom/pan, and click-to-highlight
  • docs/dependency-graph.md — Mermaid flowchart with styled subgraphs per node type

Relationship Types Detected

Edge LabelSourceTargetDetection Method
fires ontriggertabletrigger.table field
callstriggerfunctiontrigger.function_name field
guardspolicytablepolicy.table field
referencesfunctiontableParse function SQL body for table references
reads fromviewtableParse view SQL for FROM/JOIN table references
uses enumtableenumParse TypeScript types for enum column types
calls in checkpolicyfunctionParse policy.using and policy.with_check
FK totabletableParse TypeScript types for FK relationships

Atlas Integration

When sbt generate-atlas runs, this plugin contributes:

  • A "Dependency Graph" section with summary stat cards (total nodes, edges, relationship counts)
  • A link to open the full interactive graph
  • Relationship detail cards expandable in the Atlas HTML

Configuration

No configuration fields needed. Add to supabase-tools.config.json:

json
{
  "path": "node_modules/@sbt/plugin-depgraph",
  "config": {}
}