For those of you who like to use Graql for source code related mischief, I’d like to introduce you to a new multilingual source code query command line interface powered by Grakn. This CLI is called GitSocratic and GitSocratic is able to use Docker to automatically setup the entire environment necessary to parse, store, and query source code of various languages. GitSocratic is able to use Grakn’s powerful knowledge graph to answer complex queries related to the structure and semantic meaning of source code. With GitSocratic you can combine repositories of different languages and query them individually or together. GitSocratic’s goal is to facilitate the ability for anyone to create intelligent multilingual source code bots and more!
Project source code: https://github.com/CodeBrig/GitSocratic
Release distribution (v0.1-alpha): https://github.com/CodeBrig/GitSocratic/releases/tag/v0.1-alpha
Notes: This is an alpha release. It’s going to break on you. Please create an issue showing the code it failed on and I’ll provide a fix.
Find all for statements (language-agnostic)
$ ./gitsocratic query graql 'match $x isa FOR_STATEMENT; aggregate count;' # Query: match $x isa FOR_STATEMENT; aggregate count; # Result: 3
Find all Go methods named “main”
$ ./gitsocratic question "how many go methods are named main" # Question: how many [language] methods are named [name] # Result: 1
I understand this
question idea isn’t very fleshed out. I liked the idea of being able to ask source code questions which led to the idea of having a FAQ command which would return results for commonly asked questions. This line of thinking also leads to the idea of having a dialog with source code about itself (meta. meta. meta), which would essentially be intelligent source code bots. So if the idea of AI-based pair programming interests you please let me know. I’m working on a project that brings this project together with IDE integration and would love to hear your ideas/opinions on this type of software.