This plugin provides a WebAssembly-based integration with the Greptile API, allowing for repository indexing, querying, and searching operations. It's designed to be used with the Extism runtime.
- Repository indexing
- Repository querying
- Code searching
- Seamless integration with Greptile API
- WebAssembly-based for portability and security
- Go 1.16 or later
- TinyGo
- Extism CLI
- Greptile API key and GitHub token
-
Clone this repository:
git clone https://github.com/OpenAgentsInc/plugin-greptile.git cd plugin-greptile
-
Install dependencies:
go mod tidy
-
Build the WebAssembly module:
make build
Create a .env
file in the project root with your Greptile API key and GitHub token:
GREPTILE_API_KEY=your_greptile_api_key_here
GITHUB_TOKEN=your_github_token_here
The plugin supports three main operations: index, query, and search. You can test each operation using the provided Makefile targets.
make test-index
This will index the specified repository in Greptile.
make test-query
This will send a query to Greptile about the specified repository.
make test-search
This will perform a code search in the specified repository.
You can customize the input for each operation by modifying the JSON in the Makefile. Here's an example of the structure for each operation:
{
"operation": "index",
"repository": "username/repo",
"remote": "github",
"branch": "main",
"api_key": "your_api_key",
"github_token": "your_github_token"
}
{
"operation": "query",
"repository": "username/repo",
"remote": "github",
"branch": "main",
"api_key": "your_api_key",
"github_token": "your_github_token",
"messages": [
{
"id": "1",
"content": "What is this repository about?",
"role": "user"
}
],
"session_id": "test-session",
"stream": false,
"genius": true
}
{
"operation": "search",
"repository": "username/repo",
"remote": "github",
"branch": "main",
"api_key": "your_api_key",
"github_token": "your_github_token",
"query": "Functions that use recursion",
"session_id": "test-session",
"stream": false
}
To integrate this plugin into your own projects, you can use the Extism runtime to call the run
function with the appropriate JSON input for the desired operation.
Contributions are welcome! Please feel free to submit a Pull Request.
Public domain.