Skip to content

Toolkit designed to parse complex source code and transform it into a rich, structured, and queryable knowledge graph

License

Notifications You must be signed in to change notification settings

Bevel-Software/code-to-knowledge-graph

Repository files navigation

Code-to-Knowledge-Graph Logo

Code-to-Knowledge-Graph ✨

Transform your codebase into a powerful, queryable knowledge graph!

License GitHub Stars


Code-to-Knowledge-Graph is a Kotlin/JVM toolkit that parses source code and creates rich, queryable knowledge graphs using VS Code's Language Server Protocol (LSP). Extract entities, relationships, and architecture insights from any codebase.

🔍 Understand Code Structure • 📈 Analyze Impact • 🏛️ Gain Architectural Insights • 🛠️ Build Custom Tools • 🤖 Augment AI & LLMs

🚀 Quick Start

Option 1: Use Pre-built VS Code Extensions (Recommended)

  1. Install Bevel Extension from VS Code marketplace
  2. Open your codebase and run Bevel: Re-/Analyze Project
  3. Explore with additional tools:

Option 2: Direct Integration

Gradle:

dependencies {
    implementation("software.bevel:code-to-knowledge-graph:1.1.3")
}

Basic Usage:

import software.bevel.code_to_knowledge_graph.FactoriesKt;

String projectPath = "/path/to/your/project";
Parser parser = FactoriesKt.createVsCodeParser(projectPath);
Graphlike graph = parser.parse(List.of(projectPath));

System.out.println("Nodes: " + graph.getNodes().size());
System.out.println("Connections: " + graph.getConnections().getAllConnections().size());

🎯 Ecosystem & Use Cases

Transform your knowledge graph into powerful developer tools:

🔍 Interactive Code Visualization

Neo4j Visualization Bevel Neo4j Visualization - Explore your codebase visually

🧪 AI-Assisted Test Generation

Testing Prompt Generator Bevel Test Generator - Generate comprehensive test prompts

📈 Sequence Diagrams & Documentation

Bevel Sequence Diagram Bevel Extension - Generate interactive diagrams

🚀 Custom Tool Development

Bevel APIs Build your own analysis tools using the knowledge graph API

✨ Key Features

  • 🎯 VS Code LSP Integration: Leverages VS Code's language servers for robust, multi-language parsing
  • 📊 Rich Graph Model: Comprehensive representation of code entities and relationships
  • 🔄 Incremental Updates: Support for real-time graph updates based on file changes
  • 📁 Smart File Discovery: Respects .gitignore patterns and project structures
  • 🔗 Similarity Detection: MinHashing for code similarity analysis
  • 🏗️ Extensible Architecture: Build custom analysis tools on top of the graph

🤝 Contributing

Contributions are welcome! Whether it's bug fixes, feature enhancements, or improvements to documentation, your help is appreciated.

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Make your changes. Adhere to Kotlin coding conventions.
  4. Add tests for any new functionality or bug fixes. Ensure all tests pass: ./gradlew test.
  5. Commit your changes with clear, descriptive messages.
  6. Push to your branch.
  7. Open a Pull Request against the main branch of the original repository.

Please ensure your PR description clearly explains the changes and their motivations.

📄 License

Mozilla Public License Version 2.0 - see LICENSE for details.


Unlock the hidden structure within your codebase! 🚀

About

Toolkit designed to parse complex source code and transform it into a rich, structured, and queryable knowledge graph

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •