Skip to main content

building-java-knowledge-graph

Analyzes JVM projects (Java/Kotlin/Scala/Groovy) and generates knowledge graphs with tree-sitter parsing. Requires Python 3 on the host and a JVM project with Maven/Gradle/Ant/Ivy build files. Skips gracefully if either prerequisite is missing. Triggers when asked to "build knowledge graph", "analyze project structure", "parse Java codebase", or "generate dependency graph".

소스 정보

저장소
microsoft/github-copilot-modernization
최근 소스 활동
2026년 5월 14일 05:11
감지된 SKILL.md 언어
영어
스타
49
포크
14

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
6 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
building-java-knowledge-graph
description
Analyzes JVM projects (Java/Kotlin/Scala/Groovy) and generates knowledge graphs with tree-sitter parsing. Requires Python 3 on the host and a JVM project with Maven/Gradle/Ant/Ivy build files. Skips gracefully if either prerequisite is missing. Triggers when asked to "build knowledge graph", "analyze project structure", "parse Java codebase", or "generate dependency graph".
## Prerequisites **Step 1 — Verify JVM project:** ```bash find "$PROJECT_ROOT" -maxdepth 5 -type f \( -name "*.java" -o -name "*.kt" -o -name "*.scala" -o -name "*.groovy" \) | head -1 ``` > If no JVM files found: skip this skill. Set `knowledge_graph_dir` to `null` in `setup_artifacts`. Non-fatal — downstream agents fall back to direct source analysis. **Step 2 — Verify Python:** ```bash python3 --version 2>/dev/null || python --version 2>/dev/null ``` > If unavailable: skip this skill with same fallback as above. ## Quick Start ```bash # First-time setup (~1 minute) pip3 install --user 'tree-sitter<0.21' python3 scripts/install_grammars.py # Optional: SVG generation brew install graphviz # macOS # Analyze project python3 scripts/build_knowledge_graph.py /path/to/project output-dir ``` ⚠️ **DESTRUCTIVE OUTPUT**: The script wipes ALL files in `output-dir` before writing. **NEVER** point it at a shared directory like `{{BASE_PATH}}/` or `{{BASE_PATH}}/artifacts/`. Use a dedicated subdirectory: ``` # ✅ SAFE — dedicated subdirectory python3 scripts/build_knowledge_graph.py /path/to/project {{BASE_PATH}}/artifacts/kg_output # ❌ DANGER — will delete constitution.md, board.md, other artifacts! python3 scripts/build_knowledge_graph.py /path/to/project {{BASE_PATH}} ``` After the script finishes, copy `knowledge-graph.json` to `{{BASE_PATH}}/` for other agents to consume. ## What It Detects - **Build systems**: Maven (pom.xml), Gradle (build.gradle*), Ant (build.xml), Ivy (ivy.xml) - **Languages**: Java, Kotlin, Scala, Groovy via tree-sitter AST - **Structure**: Modules, packages, classes, interfaces, enums, annotations - **Relationships**: Inheritance, implementations, module dependencies - **Patterns**: Architecture layers (controller/service/repository/model/config/util) - **Config**: `application*.properties`, `application*.yaml/yml` - **Gradle subprojects**: `settings.gradle` parsing ## Output All outputs are written under **the provided artifact path** (pass as 2nd argument to the script). ``` knowledge-graph.json ← complete graph (nodes + edges) module-dependencies.{dot,svg} ← module dependency diagram module-{name}.{dot,svg} ← per-module class diagrams project-{name}.{dot,svg} ← complete project diagram ``` ## Resources - `references/schema.md` — node/edge types, ID patterns, fields, visualization colors - `references/querying.md` — jq and Python query examples - `scripts/build_knowledge_graph.py` — main analyzer - `scripts/install_grammars.py` — grammar installer
GitHub에서 보기