### Install development tools Source: https://github.com/helixml/kodit/blob/main/CLAUDE.md Run this command to install necessary dependencies like golangci-lint and oapi-codegen. ```bash make tools # Install golangci-lint, goimports, swag, oapi-codegen, openapi-spec-converter ``` -------------------------------- ### Install and Use Kodit Go HTTP Client Source: https://github.com/helixml/kodit/blob/main/README.md Shows how to install the Go HTTP client and use it to list repositories and perform searches against a remote server. ```sh go get github.com/helixml/kodit/clients/go ``` ```go import koditclient "github.com/helixml/kodit/clients/go" client, err := koditclient.NewClient("https://kodit.example.com") // List repositories resp, err := client.GetRepositories(ctx, nil) // Search text := "create a deployment" resp, err := client.PostSearch(ctx, koditclient.PostSearchJSONRequestBody{ Data: &koditclient.DtoSearchData{ Attributes: &koditclient.DtoSearchAttributes{ Text: &text, }, }, }) ``` -------------------------------- ### Start Kodit with environment file Source: https://github.com/helixml/kodit/blob/main/README.md Use the --env-file flag to load configuration variables from a specific file when starting the server. ```sh kodit serve --env-file .env ``` -------------------------------- ### Build Kodit from Source Source: https://github.com/helixml/kodit/blob/main/README.md Commands to clone the repository, install dependencies, download models, and build the binary. ```sh git clone https://github.com/helixml/kodit.git cd kodit make tools # Install development tools make download-model # Download the built-in embedding model make build # Build the binary ./bin/kodit version ./bin/kodit serve ``` -------------------------------- ### Run Kodit with Docker Source: https://github.com/helixml/kodit/blob/main/README.md Starts the Kodit service using SQLite and a built-in embedding model. ```sh docker run -p 8080:8080 registry.helix.ml/helix/kodit:latest ``` -------------------------------- ### Configure Enrichment Provider Environment Variables Source: https://github.com/helixml/kodit/blob/main/README.md Example configurations for connecting to OpenAI, Ollama, and Helix LLM providers via environment variables. ```sh # OpenAI ENRICHMENT_ENDPOINT_BASE_URL=https://api.openai.com/v1 ENRICHMENT_ENDPOINT_MODEL=gpt-4o-mini ENRICHMENT_ENDPOINT_API_KEY=sk-proj-xxxx # Ollama (local) ENRICHMENT_ENDPOINT_BASE_URL=http://localhost:11434 ENRICHMENT_ENDPOINT_MODEL=ollama/qwen3:1.7b # Helix (private cloud) ENRICHMENT_ENDPOINT_BASE_URL=https://app.helix.ml/v1 ENRICHMENT_ENDPOINT_MODEL=Qwen/Qwen3-8B ENRICHMENT_ENDPOINT_API_KEY=your-helix-key ``` -------------------------------- ### GET /api/v1/repositories Source: https://github.com/helixml/kodit/blob/main/README.md Retrieves a list of all currently indexed repositories. ```APIDOC ## GET /api/v1/repositories ### Description List indexed repositories. ### Method GET ### Endpoint /api/v1/repositories ``` -------------------------------- ### GET /api/v1/search/visual Source: https://github.com/helixml/kodit/blob/main/README.md Performs a visual search on document pages. ```APIDOC ## GET /api/v1/search/visual ### Description Visual search on document pages. ### Method GET ### Endpoint /api/v1/search/visual ``` -------------------------------- ### GET /api/v1/search/ls Source: https://github.com/helixml/kodit/blob/main/README.md Lists files matching a specific glob pattern. ```APIDOC ## GET /api/v1/search/ls ### Description List files by glob. ### Method GET ### Endpoint /api/v1/search/ls ``` -------------------------------- ### GET /api/v1/search/semantic Source: https://github.com/helixml/kodit/blob/main/README.md Performs a semantic search across indexed content. ```APIDOC ## GET /api/v1/search/semantic ### Description Semantic search only. ### Method GET ### Endpoint /api/v1/search/semantic ``` -------------------------------- ### GET /api/v1/repositories/{id}/status Source: https://github.com/helixml/kodit/blob/main/README.md Checks the current indexing progress for a specific repository. ```APIDOC ## GET /api/v1/repositories/{id}/status ### Description Indexing progress. ### Method GET ### Endpoint /api/v1/repositories/{id}/status ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the repository. ``` -------------------------------- ### GET /api/v1/search/grep Source: https://github.com/helixml/kodit/blob/main/README.md Performs a regex pattern search across indexed files. ```APIDOC ## GET /api/v1/search/grep ### Description Regex pattern search. ### Method GET ### Endpoint /api/v1/search/grep ``` -------------------------------- ### GET /api/v1/search/keyword Source: https://github.com/helixml/kodit/blob/main/README.md Performs a keyword-based search across indexed content. ```APIDOC ## GET /api/v1/search/keyword ### Description Keyword search only. ### Method GET ### Endpoint /api/v1/search/keyword ``` -------------------------------- ### Initialize and Use Kodit Go Library Source: https://github.com/helixml/kodit/blob/main/README.md Demonstrates initializing the Kodit client with SQLite storage, indexing a repository, and performing a semantic search. ```go import "github.com/helixml/kodit" client, err := kodit.New( kodit.WithSQLite(".kodit/data.db"), ) if err != nil { log.Fatal(err) } defer client.Close() // Index a repository _, _, err = client.Repositories.Add(ctx, &service.RepositoryAddParams{ URL: "https://github.com/kubernetes/kubernetes", }) // Search results, err := client.Search.Query(ctx, "create a deployment", service.WithLimit(10), ) for _, result := range results.Enrichments() { fmt.Println(result.Subtype(), result.Content()) } ``` -------------------------------- ### Implement a Repository Store Source: https://github.com/helixml/kodit/blob/main/CLAUDE.md Embed the base database.Repository and initialize it using the repository constructor. ```go type CommitStore struct { database.Repository[repository.Commit, CommitModel] } func NewCommitStore(db database.Database) CommitStore { return CommitStore{ Repository: database.NewRepository[repository.Commit, CommitModel](db, CommitMapper{}, "commit"), } } ``` -------------------------------- ### kodit.New Source: https://github.com/helixml/kodit/blob/main/README.md Initializes a new Kodit client instance with specified configuration options. ```APIDOC ## func kodit.New ### Description Initializes a new Kodit client instance. This is the entry point for using the Go library. ### Parameters - **options** (variadic) - Required - Configuration options such as WithSQLite, WithPostgresVectorchord, etc. ``` -------------------------------- ### Run Kodit from Binary Source: https://github.com/helixml/kodit/blob/main/README.md Executes the Kodit server after setting appropriate permissions. ```sh chmod +x kodit ./kodit serve ``` -------------------------------- ### Initialize test databases with testdb Source: https://github.com/helixml/kodit/blob/main/CLAUDE.md Use these helpers for database testing. Note that internal/database package tests cannot use these due to import cycles. ```go db := testdb.New(t) // Migrated in-memory database db := testdb.NewPlain(t) // Plain in-memory (no migrations) db := testdb.WithSchema(t, "...") // Plain with custom schema ``` -------------------------------- ### Build and test commands Source: https://github.com/helixml/kodit/blob/main/CLAUDE.md Use these Makefile targets instead of raw go commands to ensure proper build tags and environment variables are applied. ```bash make build # Build the binary make test # Run all tests make test PKG=./internal/foo/... # Test a specific package make check # Format, vet, lint, and test make check PKG=./internal/foo/... # Check a specific package make test-smoke # Run smoke tests (needs running Docker env) ``` -------------------------------- ### Define and Use Repository Options Source: https://github.com/helixml/kodit/blob/main/CLAUDE.md Define custom query options using repository.WithCondition and utilize generic store methods for database operations. ```go func WithSHA(sha string) Option { return WithCondition("commit_sha", sha) } commits, err := store.Find(ctx, repository.WithRepoID(id), repository.WithSHA(sha)) one, err := store.FindOne(ctx, repository.WithID(id)) count, err := store.Count(ctx, repository.WithRepoID(id)) exists, err := store.Exists(ctx, repository.WithSHA(sha)) err := store.DeleteBy(ctx, repository.WithRepoID(id)) saved, err := store.Save(ctx, commit) ``` -------------------------------- ### koditclient.NewClient Source: https://github.com/helixml/kodit/blob/main/README.md Initializes a new HTTP client for a remote Kodit server. ```APIDOC ## func koditclient.NewClient ### Description Creates a client to interact with a remote Kodit server via HTTP. ### Parameters - **url** (string) - Required - The base URL of the Kodit server ``` -------------------------------- ### Kodit System Prompt Source: https://github.com/helixml/kodit/blob/main/README.md Instruction to enforce Kodit tool usage in AI assistants. ```text For every request that involves writing or modifying code, the assistant's first action must be to call the kodit search MCP tools. Only produce or edit code after the tool call returns results. ``` -------------------------------- ### client.Repositories.Add Source: https://github.com/helixml/kodit/blob/main/README.md Adds a new repository to the Kodit index. ```APIDOC ## func client.Repositories.Add ### Description Indexes a new repository by its URL. ### Parameters - **ctx** (context.Context) - Required - Execution context - **params** (*service.RepositoryAddParams) - Required - Repository configuration including URL ``` -------------------------------- ### POST /api/v1/repositories Source: https://github.com/helixml/kodit/blob/main/README.md Adds a new Git repository to the Kodit instance for indexing. ```APIDOC ## POST /api/v1/repositories ### Description Adds a repository for indexing. ### Method POST ### Endpoint /api/v1/repositories ``` -------------------------------- ### Run Kodit Tests Source: https://github.com/helixml/kodit/blob/main/README.md Commands to execute the test suite, specific packages, or full project checks. ```sh make test # All tests make test PKG=./internal/foo/... # Specific package make check # Format, vet, lint, and test ``` -------------------------------- ### Query PostgreSQL via Docker Source: https://github.com/helixml/kodit/blob/main/CLAUDE.md Execute SQL queries directly against the kodit-vectorchord container. ```bash docker exec kodit-vectorchord psql -U postgres -d kodit -c "SELECT * FROM repositories LIMIT 5;" ``` -------------------------------- ### Deploy Kodit with Docker Compose Source: https://github.com/helixml/kodit/blob/main/README.md Use this configuration to run Kodit and VectorChord as a multi-container service. Ensure the environment variables are configured for your specific LLM and embedding providers. ```yaml services: kodit: image: registry.helix.ml/helix/kodit:latest ports: - "8080:8080" command: ["serve"] restart: unless-stopped depends_on: - vectorchord environment: DATA_DIR: /data DB_URL: postgresql://postgres:mysecretpassword@vectorchord:5432/kodit # Enrichment LLM (optional, enables AI-generated docs) ENRICHMENT_ENDPOINT_BASE_URL: http://ollama:11434 ENRICHMENT_ENDPOINT_MODEL: ollama/qwen3:1.7b # External embedding provider (optional, replaces built-in model) # EMBEDDING_ENDPOINT_API_KEY: sk-proj-xxxx # EMBEDDING_ENDPOINT_MODEL: openai/text-embedding-3-small LOG_LEVEL: INFO API_KEYS: ${KODIT_API_KEYS:-} volumes: - kodit-data:/data vectorchord: image: tensorchord/vchord-suite:pg17-20250601 environment: POSTGRES_DB: kodit POSTGRES_PASSWORD: mysecretpassword volumes: - vectorchord-data:/var/lib/postgresql/data restart: unless-stopped volumes: kodit-data: vectorchord-data: ``` -------------------------------- ### Deploy Kodit on Kubernetes Source: https://github.com/helixml/kodit/blob/main/README.md Standard Kubernetes manifests for deploying the VectorChord database and the Kodit application service. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: vectorchord spec: replicas: 1 selector: matchLabels: app: vectorchord template: metadata: labels: app: vectorchord spec: containers: - name: vectorchord image: tensorchord/vchord-suite:pg17-20250601 env: - name: POSTGRES_DB value: kodit - name: POSTGRES_PASSWORD value: mysecretpassword ports: - containerPort: 5432 --- apiVersion: v1 kind: Service metadata: name: vectorchord spec: selector: app: vectorchord ports: - port: 5432 --- apiVersion: apps/v1 kind: Deployment metadata: name: kodit spec: replicas: 1 selector: matchLabels: app: kodit template: metadata: labels: app: kodit spec: containers: - name: kodit image: registry.helix.ml/helix/kodit:latest # pin to a specific version args: ["serve"] env: [] # see Configuration Reference for environment variables ports: - containerPort: 8080 readinessProbe: httpGet: path: / port: 8080 initialDelaySeconds: 10 periodSeconds: 5 --- apiVersion: v1 kind: Service metadata: name: kodit spec: type: LoadBalancer selector: app: kodit ports: - port: 8080 ``` -------------------------------- ### Configure Cursor MCP Source: https://github.com/helixml/kodit/blob/main/README.md Configuration snippet for the Cursor MCP settings file. ```json { "mcpServers": { "kodit": { "url": "http://localhost:8080/mcp" } } } ``` -------------------------------- ### Interact with Kodit API Source: https://github.com/helixml/kodit/blob/main/README.md Commands to index a repository, check status, and perform a search query. ```sh # Index a repository curl http://localhost:8080/api/v1/repositories \ -X POST -H "Content-Type: application/json" \ -d '{ "data": { "type": "repository", "attributes": { "remote_uri": "https://gist.github.com/philwinder/7aa38185e20433c04c533f2b28f4e217.git" } } }' # Check indexing progress curl http://localhost:8080/api/v1/repositories/1/status # Search (once indexing is complete) curl http://localhost:8080/api/v1/search \ -X POST -H "Content-Type: application/json" \ -d '{ "data": { "type": "search", "attributes": { "keywords": ["orders"], "text": "code to get all orders" } } }' ``` -------------------------------- ### Connect Claude Code to Kodit Source: https://github.com/helixml/kodit/blob/main/README.md Adds the Kodit MCP server to Claude Code. ```sh claude mcp add --transport http kodit http://localhost:8080/mcp ``` -------------------------------- ### POST /api/v1/repositories/{id}/sync Source: https://github.com/helixml/kodit/blob/main/README.md Manually triggers a synchronization process for a specific repository. ```APIDOC ## POST /api/v1/repositories/{id}/sync ### Description Trigger a sync. ### Method POST ### Endpoint /api/v1/repositories/{id}/sync ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the repository. ``` -------------------------------- ### Configure Private Repository Access Source: https://github.com/helixml/kodit/blob/main/README.md Use these URL formats to authenticate private Git repositories via HTTPS tokens or SSH keys. ```sh # HTTPS with token https://username:token@github.com/username/repo.git # SSH (ensure your SSH key is configured) git@github.com:username/repo.git ``` -------------------------------- ### Configure Kilo Code MCP Source: https://github.com/helixml/kodit/blob/main/README.md Configuration snippet for Kilo Code MCP settings. ```json { "mcpServers": { "kodit": { "type": "streamable-http", "url": "http://localhost:8080/mcp", "alwaysAllow": [], "disabled": false } } } ``` -------------------------------- ### Configure Cline MCP Source: https://github.com/helixml/kodit/blob/main/README.md Configuration snippet for Cline remote MCP servers. ```json { "mcpServers": { "kodit": { "autoApprove": [], "disabled": false, "timeout": 60, "type": "streamableHttp", "url": "http://localhost:8080/mcp" } } } ``` -------------------------------- ### client.Search.Query Source: https://github.com/helixml/kodit/blob/main/README.md Performs a search query across indexed repositories. ```APIDOC ## func client.Search.Query ### Description Executes a search query with optional filters and limits. ### Parameters - **ctx** (context.Context) - Required - Execution context - **query** (string) - Required - The search string - **options** (variadic) - Optional - Search options like WithLimit ``` -------------------------------- ### DELETE /api/v1/repositories/{id} Source: https://github.com/helixml/kodit/blob/main/README.md Removes a repository from the Kodit instance. ```APIDOC ## DELETE /api/v1/repositories/{id} ### Description Remove a repository. ### Method DELETE ### Endpoint /api/v1/repositories/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the repository. ``` -------------------------------- ### POST /api/v1/search Source: https://github.com/helixml/kodit/blob/main/README.md Performs a combined search using both keyword and semantic analysis. ```APIDOC ## POST /api/v1/search ### Description Combined search (keyword + semantic). ### Method POST ### Endpoint /api/v1/search ``` -------------------------------- ### Disable Telemetry Collection Source: https://github.com/helixml/kodit/blob/main/README.md Set this environment variable to opt out of anonymous usage metadata collection. ```sh DISABLE_TELEMETRY=true ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.