Loading...
Loading...
Analyzes file-level import dependencies and generates interactive vis-network HTML report. Use when visualizing dependency graphs, analyzing import structure, checking circular dependencies, or understanding module relationships.
npx skill4agent add ssiumha/dots dep-graph/dep-graph # 현재 디렉토리 전체
/dep-graph --scope=src/ # 특정 디렉토리만
/dep-graph --depth=2 # import 깊이 제한
/dep-graph --exclude="**/*.test.*" # 테스트 파일 제외python3 {SKILL_DIR}/scripts/build-graph.py \
--root {PROJECT_ROOT} \
--template {SKILL_DIR}/templates/report.html \
--output dep-graph.html \
[--scope {scope}] [--depth {depth}] [--exclude {pattern}]{SKILL_DIR}{PROJECT_ROOT}--scope--depth--exclude# scope 인자 해석
--scope=<path> → 해당 경로 하위
(없으면) → 현재 작업 디렉토리 전체**/*.{ts,tsx,js,jsx,mjs,cjs} → TypeScript/JavaScript
**/*.java → Java
**/*.py → Python
**/*.go → Go
**/*.rs → Rust--excludenode_modules/vendor/build/dist/.git/**/*.test.***/*.spec.***/__tests__/**--depth=Nwhich ast-grep# ast-grep으로 import문 검색
ast-grep --pattern '<PATTERN>' --json <file>resources/patterns/typescript.mdresources/patterns/java.md# TypeScript/JavaScript
grep -nE "^import .+ from ['\"]|require\(['\"]" <file>
# Java
grep -nE "^import (static )?[a-zA-Z]" <file>
# Python
grep -nE "^(from .+ import|import )" <file>
# Go
grep -nE "\"[a-zA-Z0-9_/.-]+\"" <file> # import block 내부| 유형 | 처리 |
|---|---|
상대 경로 ( | 현재 파일 기준 resolve, 확장자 탐색 |
| 별칭 (alias) | tsconfig.json |
| 패키지/외부 | |
배럴 ( | 디렉토리 import 시 |
.ts.tsx.js.jsx/index.ts/index.tsx/index.jsconst GRAPH_DATA = {
nodes: [
{ id: "src/api/user.ts", label: "user.ts", group: "api", title: "src/api/user.ts\nImports: 3\nImported by: 5" }
],
edges: [
{ from: "src/api/user.ts", to: "src/models/User.ts", arrows: "to" }
],
groups: {
"api": { color: "#4FC3F7" },
"models": { color: "#81C784" }
},
stats: {
totalFiles: 42,
totalEdges: 87,
avgDependencies: 2.07,
maxFanOut: { file: "src/index.ts", count: 12 },
maxFanIn: { file: "src/utils/helpers.ts", count: 15 },
circular: [["src/a.ts", "src/b.ts", "src/a.ts"]],
externalDeps: ["react", "lodash"]
}
};idlabelgrouptitlesizeconst PALETTE = [
"#4FC3F7", "#81C784", "#FFB74D", "#E57373",
"#BA68C8", "#4DD0E1", "#FFD54F", "#A1887F",
"#90A4AE", "#F06292", "#AED581", "#7986CB"
];stats.circulartemplates/report.html{{GRAPH_DATA}}</script>const jsonStr = JSON.stringify(GRAPH_DATA)
.replace(/</g, '\\u003c')
.replace(/>/g, '\\u003e');
template.replace('{{GRAPH_DATA}}', jsonStr);dep-graph.html # 프로젝트 루트에 생성## Dependency Graph Report
- 파일: `dep-graph.html`
- 노드: {totalFiles}개 파일
- 엣지: {totalEdges}개 의존성
- 평균 의존성: {avgDependencies}
- 최대 Fan-out: {maxFanOut.file} ({maxFanOut.count})
- 최대 Fan-in: {maxFanIn.file} ({maxFanIn.count})
- 순환 참조: {circular.length}개 발견
- 외부 패키지: {externalDeps.length}개
브라우저에서 `dep-graph.html`을 열어 확인하세요.dep-graph.htmlprefers-color-schemescripts/build-graph.py**/src/main/javacompilerOptions.paths--json