### Greptile Configuration File Example Source: https://www.greptile.com/docs/code-review/greptile-config-reference A complete example of a .greptile/config.json file, demonstrating various configuration options like strictness, ignore patterns, context repositories, and rule definitions. ```json { "strictness": 2, "commentTypes": ["logic", "syntax"], "triggerOnUpdates": true, "ignorePatterns": "**/*.generated.*\ndist/**\nnode_modules/**", "summarySection": { "included": true, "collapsible": true, "defaultOpen": false }, "context": { "repos": ["acme/shared-types", "acme/payment-sdk"] }, "instructions": "This is a TypeScript monorepo using pnpm workspaces. We use Prisma for database access and zod for validation.", "rules": [ { "id": "no-console", "rule": "Do not use console.log in production code. Use the logger service instead.", "scope": ["src/**"], "severity": "medium" }, { "rule": "All async functions must have error handling.", "severity": "high" } ], "disabledRules": [] } ``` -------------------------------- ### Full greptile.json Configuration Example Source: https://www.greptile.com/docs/code-review/custom-standards A comprehensive example of a greptile.json file, including review behavior settings, custom standards for rules and files, pattern repositories, and ignore patterns. ```json { // Review behavior "strictness": 2, "commentTypes": ["logic", "syntax", "style", "info"], // Custom standards "customContext": { "rules": [ { "rule": "No direct database queries in controllers", "scope": ["src/controllers/**/*.ts"] } ], "files": [ { "path": "docs/architecture.md", "description": "System architecture guidelines" } ] }, // Pattern repositories (cross-repo context) "patternRepositories": ["company/shared-standards"], // Ignore patterns (newline-separated string) "ignorePatterns": "*.generated.*\n**/vendor/**\n**/__snapshots__/**" } ``` -------------------------------- ### Configure Environment Variables Source: https://www.greptile.com/docs/docker-compose/manual-setup Copy the example environment file and edit it with your specific configuration values. ```bash cp .env.example .env ``` -------------------------------- ### Install Hatchet Workflow Orchestration System Source: https://www.greptile.com/docs/kubernetes-new Install Hatchet, the workflow orchestration system, before deploying Greptile. After installation, port-forward the service to access the admin portal and generate an API token. ```bash helm repo add hatchet https://hatchet-dev.github.io/hatchet-charts helm install hatchet-stack hatchet/hatchet-stack -f hatchet-values.yaml ``` ```bash kubectl port-forward svc/caddy 8080:8080 ``` -------------------------------- ### Start Greptile Service Source: https://www.greptile.com/docs/docker-compose/manual-setup Launch the main Greptile service using the Docker Compose configuration. ```bash ./bin/start-greptile.sh ``` -------------------------------- ### Troubleshoot Pods Not Starting Source: https://www.greptile.com/docs/kubernetes-new Commands to diagnose why pods are not starting, including describing a specific pod and viewing recent events. Also includes a table of common symptoms, causes, and fixes. ```bash kubectl describe pod kubectl get events --sort-by='.lastTimestamp' | head -20 ``` -------------------------------- ### Scope Structure Example Source: https://www.greptile.com/docs/mcp-v2/tools Example of a scope structure for applying patterns to specific file paths. ```json { "AND": [ { "operator": "MATCHES", "field": "filepath", "value": "**/api/**" } ] } ``` -------------------------------- ### Create Terraform Configuration File Source: https://www.greptile.com/docs/docker-compose/aws-terraform Copy the example Terraform variables file to create your own configuration. ```bash cp terraform.tfvars.example terraform.tfvars ``` -------------------------------- ### Configure Caddy Reverse Proxy Source: https://www.greptile.com/docs/docker-compose/manual-setup Copy the example Caddyfile and edit it to configure reverse proxy settings for your domain. This setup includes TLS certificate management via Let's Encrypt. ```bash cp Caddyfile.example Caddyfile ``` ```plaintext greptile.yourcompany.com { reverse_proxy greptile-web:3000 } greptile.yourcompany.com:3007 { reverse_proxy greptile-webhook:3007 } ``` -------------------------------- ### Reference Existing Style Guides Source: https://www.greptile.com/docs/code-review/custom-standards Point to existing documentation files within your repository to be used as style guides. Supported formats include Markdown, plain text, YAML, and JSON. ```text docs/style-guide.md ./CONTRIBUTING.md ``` -------------------------------- ### Initialize and Apply Terraform for AWS EKS Source: https://www.greptile.com/docs/kubernetes-new Navigate to the AWS Terraform directory, copy the example variables file, and then initialize and apply the Terraform configuration. ```bash cd kubernetes/terraform/aws cp terraform.tfvars.example terraform.tfvars ``` ```bash terraform init terraform apply ``` -------------------------------- ### Clone Repository and Navigate Source: https://www.greptile.com/docs/docker-compose/aws-terraform Clone the Greptile repository and navigate to the AWS EC2 Terraform stack directory to begin the setup process. ```bash git clone https://github.com/greptileai/akupara.git cd akupara/terraform/stacks/aws-ec2 ``` -------------------------------- ### Clone Greptile Repository Source: https://www.greptile.com/docs/docker-compose/manual-setup Clone the akupara repository and navigate to the docker directory to begin the setup process. ```bash git clone https://github.com/greptileai/akupara.git cd akupara/docker ``` -------------------------------- ### Custom Rules Configuration Example Source: https://www.greptile.com/docs/code-review/custom-standards An example of configuring custom rules within the 'customContext' section of greptile.json. Rules can be targeted to specific file paths using glob patterns. ```json { "customContext": { "rules": [ { "rule": "Use dependency injection for all services", "scope": ["src/services/**/*.ts"] }, { "rule": "API endpoints must have rate limiting", "scope": ["**/api/**/*.ts"] }, { "rule": "Test files must use .test.ts extension", "scope": ["src/**/*"] } ] } } ``` -------------------------------- ### Install and Enable Systemd Services Source: https://www.greptile.com/docs/docker-compose/manual-setup Copy systemd service and timer files to the system directory, reload the daemon, and enable/start the Greptile services for automatic startup on boot. ```bash sudo cp systemd/*.service /etc/systemd/system/ sudo cp systemd/*.timer /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable greptile-hatchet greptile-app sudo systemctl start greptile-hatchet greptile-app ``` -------------------------------- ### Troubleshoot Service Startup Issues Source: https://www.greptile.com/docs/docker-compose/aws-terraform When services fail to start, SSH into the EC2 instance and check system journal logs and Docker Compose status. ```bash sudo journalctl -u greptile-app -f docker compose ps docker compose logs ``` -------------------------------- ### Greptile Rules Markdown Example Source: https://www.greptile.com/docs/code-review/greptile-config-reference An example of a .greptile/rules.md file, showcasing how to use markdown to define code review rules, including error handling, SQL injection prevention, and input validation. ```markdown # Code Review Rules ## Error Handling All async functions must use try-catch blocks. Never swallow errors silently. At minimum, log the error with context: ​```typescript try { await operation(); } catch (error) { logger.error('Operation failed', { error, context }); throw error; } ​``` ## SQL Injection Prevention Always use parameterized queries. Never interpolate user input into SQL strings. - Use prepared statements - Validate input types before queries - Use Prisma's query builder instead of raw SQL where possible ## API Input Validation Validate all API inputs using zod schemas before processing. Define the schema next to the route handler. ``` -------------------------------- ### Start Hatchet Service Source: https://www.greptile.com/docs/docker-compose/manual-setup Initiate the Hatchet service and allow approximately 30 seconds for it to become healthy. ```bash ./bin/start-hatchet.sh ``` -------------------------------- ### Install Greptile Bridge CLI Source: https://www.greptile.com/docs/integrations/fix-in-x Install the Greptile Bridge CLI globally using npm. This tool routes fix requests from GitHub to your local coding agent. ```bash npm install -g greptile ``` -------------------------------- ### Cascading Configuration Example Source: https://www.greptile.com/docs/code-review/greptile-config Greptile collects .greptile/ folders from the repository root down to the file's directory to merge configurations, enabling hierarchical overrides and inheritance. ```tree /.greptile/ → repo-wide defaults /packages/.greptile/ → shared package settings (if it exists) /packages/api/.greptile/ → API-specific overrides ``` -------------------------------- ### Verify Greptile MCP Server Installation via Claude Code CLI Source: https://www.greptile.com/docs/mcp-v2/setup Run this command to list all configured MCP servers and verify that Greptile is connected. ```bash claude mcp list ``` -------------------------------- ### Examples of Team Learning Patterns Source: https://www.greptile.com/docs/how-greptile-works/memory-and-learning Illustrates how Greptile infers team preferences from common comments and code review feedback. ```text Team consistently comments: "Add error handling" → Greptile learns: Error handling is important to this team ``` ```text Team often says: "This should be async" → Greptile learns: Team prefers async patterns ``` ```text Team flags: "Move this to a service layer" → Greptile learns: Team follows layered architecture ``` -------------------------------- ### Clone Greptile Akupara Repository Source: https://www.greptile.com/docs/kubernetes-new Clone the repository to access the Helm charts for Greptile deployment. Navigate into the greptile-helm directory to proceed with the setup. ```bash git clone https://github.com/greptileai/akupara.git cd akupara/greptile-helm ``` -------------------------------- ### Verify Greptile MCP Server Installation (Codex CLI) Source: https://www.greptile.com/docs/mcp-v2/setup Run the codex mcp list command to confirm that the Greptile server has been successfully added and is configured correctly. ```bash codex mcp list ``` -------------------------------- ### Configure External Database Environment Variables Source: https://www.greptile.com/docs/docker-compose/manual-setup Use these variables to connect to an external PostgreSQL database. Ensure PostgreSQL 15+ with the pgvector extension is installed and configured. ```bash DB_HOST='your-database-endpoint' DB_PORT='5432' DB_USER='greptile' DB_PASSWORD='xxx' DB_NAME='greptile' DB_SSL_DISABLE='false' ``` -------------------------------- ### TypeScript: Real-time Graph Query Example Source: https://www.greptile.com/docs/how-greptile-works/graph-based-codebase-context Illustrates the immediate insights Greptile provides during a code review by querying the codebase graph for dependencies, calls, and related patterns. ```typescript // When reviewing this change: function updateUserProfile(userId: string, data: UserData) { // New code being reviewed } // Greptile instantly knows: // 📍 Import dependencies: UserData interface, validation utils // 📍 Function calls: database.update(), validateUserData() // 📍 Callers: ProfileController.update(), AdminPanel.updateUser() // 📍 Similar patterns: updateUserEmail(), updateUserSettings() ``` -------------------------------- ### Deploy Greptile with Helm Source: https://www.greptile.com/docs/kubernetes-new Deploy Greptile using Helm after updating dependencies and configuring the values.yaml file. This command installs the Greptile chart with your specified configurations. ```bash helm dependency update helm install greptile . -f values.yaml ``` -------------------------------- ### Include Custom Context Files Source: https://www.greptile.com/docs/code-review/greptile-json-reference Reference specific files to be included in the custom context for code reviews. This is useful for providing style guides or other relevant documentation. ```json { "customContext": { "files": [ { "path": "docs/style-guide.md", "description": "Company style guide", "scope": ["src/**"] } ] } } ``` -------------------------------- ### Retrieve Deployment URL Source: https://www.greptile.com/docs/docker-compose/aws-terraform After deployment, use this command to get the Greptile URL. Update your GitHub App webhook with this URL. ```bash terraform output greptile_url ``` -------------------------------- ### Configure PR Filters with Glob Patterns Source: https://www.greptile.com/docs/code-review/greptile-json-reference Use glob patterns to specify which branches to include or exclude, and which labels to disable. This example demonstrates filtering for main and release branches, excluding dependabot branches, and disabling WIP labels. It also shows how to exclude specific bot authors. ```json { "includeBranches": ["main", "release/*"], "excludeBranches": ["dependabot/**"], "disabledLabels": ["wip-*"], "excludeAuthors": ["*-bot", "*@dependabot.com", "dependabot[bot]"] } ``` -------------------------------- ### Mermaid Sequence Diagram Example Source: https://www.greptile.com/docs/code-review/first-pr-review This Mermaid syntax generates a sequence diagram to visualize multi-service interactions and API flows. Ensure the `theme` attribute is configured if needed. ```mermaid sequenceDiagram participant Client participant API participant Database Client->>API: Request API->>Database: Query Database-->>API: Result API-->>Client: Response ``` -------------------------------- ### Review Draft PR Locally Source: https://www.greptile.com/docs/code-review/tips-recipes Use this command to get Greptile's feedback on a draft PR before making it official. This is a workaround until full local review is available. ```text @greptileai review this draft before I make it official ``` -------------------------------- ### Verify Greptile MCP Connection with Curl Source: https://www.greptile.com/docs/mcp-v2/setup Use this curl command to test your Greptile MCP setup and ensure a successful connection. Replace YOUR_GREPTILE_API_KEY with your actual API key. ```bash curl -X POST https://api.greptile.com/mcp \ -H "Authorization: Bearer YOUR_GREPTILE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"ping"}' ``` -------------------------------- ### Specific Rule with Examples Source: https://www.greptile.com/docs/code-review/custom-standards Define a specific rule with clear criteria and include examples for better results. This rule enforces a structure for API error responses. ```json { "rule": "API error responses must include: status (number), message (string), timestamp (ISO 8601), requestId (UUID)", "scope": ["**/api/**"] } ``` -------------------------------- ### Get PR Status Source: https://www.greptile.com/docs/mcp-v2/reports Query the review status for a specific Pull Request. ```text What's the review status for PR #5 in owner/repo? ``` -------------------------------- ### Initialize, Plan, and Apply Terraform Source: https://www.greptile.com/docs/docker-compose/aws-terraform Initialize the Terraform working directory, review the planned infrastructure changes, and apply them to deploy the AWS resources. This process typically takes 10-15 minutes. ```bash terraform init terraform plan # Review what will be created terraform apply # Type 'yes' to confirm ``` -------------------------------- ### Learning from Dismissive Developer Responses Source: https://www.greptile.com/docs/how-greptile-works/memory-and-learning Illustrates how Greptile learns that documentation requirements can vary based on the type of code, such as internal utilities versus public APIs. ```text Greptile: "Consider adding JSDoc comments" Developer: "We don't document internal utilities" → Greptile learns: Documentation rules vary by code type ``` -------------------------------- ### Greptile Context Files Configuration Source: https://www.greptile.com/docs/code-review/greptile-config Specify context files in `files.json` that Greptile should reference during reviews. Include a path and a brief description for each file. ```json { "files": [ { "path": "docs/architecture.md", "description": "System architecture overview" } ] } ``` -------------------------------- ### Get Custom Context Details Source: https://www.greptile.com/docs/mcp-v2/tools Retrieve details for a specific custom context using its unique ID. ```json { "customContext": { "id": "9c29e7ed-2d3f-45bd-846d-a61a59f10dd9", "type": "CUSTOM_INSTRUCTION", "body": "Use async/await over promises", "status": "ACTIVE", "metadata": { "subtype": "style_guide", "includeUris": [...] }, "scopes": {}, "createdAt": "2025-11-04T07:26:36.339Z", "linkedComments": [] } } ``` -------------------------------- ### Create a Custom Context Source: https://www.greptile.com/docs/mcp-v2/custom-context Define and create a new coding pattern. Specify the rule text and the files it should apply to. ```text Create a coding pattern: "All React components must have TypeScript interfaces for props" Apply it to .tsx files only. ``` -------------------------------- ### Greploop Success Output Source: https://www.greptile.com/docs/mcp-v2/skills Example output when the 'greploop' skill successfully resolves all issues and achieves a 5/5 confidence score. ```text Greploop complete. Iterations: 2 Confidence: 5/5 Resolved: 7 comments Remaining: 0 ``` -------------------------------- ### Initialize and Apply Terraform for GCP GKE Source: https://www.greptile.com/docs/kubernetes-new Navigate to the GCP Terraform directory and initialize and apply the Terraform configuration after setting up the terraform.tfvars file. ```bash cd kubernetes/terraform/gcp terraform init terraform apply ``` -------------------------------- ### Get Greptile Comments for Specific File Source: https://www.greptile.com/docs/mcp-v2/auto-fix Filter Greptile comments to display only those associated with a particular file path using the `filePath` field. ```text Show Greptile comments for src/auth/login.ts ``` -------------------------------- ### Learning from Positive Developer Responses Source: https://www.greptile.com/docs/how-greptile-works/memory-and-learning Shows how Greptile learns that code organization suggestions are valued based on positive developer feedback. ```text Greptile: "Consider extracting this logic into a utility function" Developer: "Good catch! Will refactor this." → Greptile learns: Code organization suggestions are valued ``` -------------------------------- ### Get PR Comments with Filters Source: https://www.greptile.com/docs/mcp-v2/tools Retrieve comments for a specific pull request, with options to filter by Greptile-generated comments, addressed status, and creation date. ```json { "comments": [ { "id": "152718338", "commentId": "IC_kwDOQI_wgM7S0QWt", "body": "

Greptile Overview

...", "authorLogin": "greptile-apps[bot]", "filePath": null, "lineStart": null, "lineEnd": null, "isGreptileComment": true, "addressed": false, "createdAt": "2025-11-15T21:24:33.643Z", "hasSuggestion": false, "suggestedCode": null, "linkedMemory": null }, { "id": "152718337", "commentId": "PRRC_kwDOQI_wgM6Wzw2_", "body": "**logic:** API token exposed...\n\n```suggestion\n\"Authorization\": \"Bearer ${process.env.TOKEN}\"\n```", "authorLogin": "greptile-apps", "filePath": ".mcp.json", "lineStart": null, "lineEnd": null, "isGreptileComment": true, "addressed": false, "createdAt": "2025-11-15T21:24:33.623Z", "hasSuggestion": true, "suggestedCode": "\"Authorization\": \"Bearer ${process.env.TOKEN}\"", "linkedMemory": null } ], "repository": "owner/repo", "prNumber": 5, "total": 2 } ``` -------------------------------- ### Get Code Review Details Source: https://www.greptile.com/docs/mcp-v2/reports Fetch detailed information for a specific code review, including strictness, file counts, and full PR information. ```text Get details for code review 1382118 ``` -------------------------------- ### Get Custom Context Details Source: https://www.greptile.com/docs/mcp-v2/custom-context Retrieve detailed information about a specific coding pattern using its ID. This includes linked comments where the pattern was applied. ```text Show details for pattern 9c29e7ed-2d3f-45bd-846d-a61a59f10dd9 ``` -------------------------------- ### Greptile Learning from Reactions Source: https://www.greptile.com/docs/how-greptile-works/nitpicks Demonstrates how Greptile learns from developer feedback using thumbs up/down reactions on suggestions. Use thumbs up for valuable suggestions and thumbs down for ignored ones. ```text Greptile: "Consider adding error handling here" Developer: 👍 (implements the suggestion) → Greptile learns: "Error handling suggestions are valuable" ``` ```text Greptile: "Add semicolon at end of line" Developer: 👎 (ignores consistently) → Greptile learns: "This team doesn't care about semicolons" ``` -------------------------------- ### Required Greptile Configuration Source: https://www.greptile.com/docs/docker-compose/manual-setup Set essential environment variables for container registry details and the server's public IP address. ```bash # Container registry (from Greptile) REGISTRY_PROVIDER='dockerhub' # or 'ecr' CONTAINER_REGISTRY='xxx' GREPTILE_TAG='xxx' # Server IP (for webhook callbacks) IP_ADDRESS='your.server.public.ip' ``` -------------------------------- ### Mermaid: Greptile Indexing Process Flow Source: https://www.greptile.com/docs/how-greptile-works/graph-based-codebase-context Depicts the step-by-step process Greptile follows to build and store the codebase graph, from scanning to querying. ```mermaid graph TD A[New Repository] --> B[Parse All Files] B --> C[Extract Entities] C --> D[Map Relationships] D --> E[Build Graph] E --> F[Store Graph] G[Code Review] --> H[Query Graph] H --> I[Analyze Context] I --> J[Surface Bugs/Antipatterns] ``` -------------------------------- ### Greploop Iteration Limit Output Source: https://www.greptile.com/docs/mcp-v2/skills Example output when the 'greploop' skill reaches its maximum iteration limit before resolving all issues. It lists the remaining unresolved comments. ```text Greploop stopped after 5 iterations. Confidence: 4/5 Resolved: 12 comments Remaining: 2 Remaining issues: - src/auth.ts:45 — "Consider rate limiting this endpoint" - src/db.ts:112 — "Missing index on user_id column" ``` -------------------------------- ### Learning from Context-Setting Developer Responses Source: https://www.greptile.com/docs/how-greptile-works/memory-and-learning Demonstrates how Greptile learns that general rules, like function length, may not apply to specific code contexts, such as domain logic. ```text Greptile: "This function is quite long" Developer: "In our domain layer, we prefer detailed functions for clarity" → Greptile learns: Length rules don't apply to domain logic ``` -------------------------------- ### Request Code Explanation Source: https://www.greptile.com/docs/code-review/developer-essentials Use this prompt to ask Greptile to explain the code within a file. This is useful for understanding complex logic or unfamiliar codebases. ```text @greptileai can you explain the code in this file? ``` -------------------------------- ### get_merge_request Source: https://www.greptile.com/docs/mcp-v2/tools Get detailed Pull Request (PR) information including review analysis. Repository parameters (name, remote, defaultBranch) must be provided together. ```APIDOC ## get_merge_request ### Description Get detailed PR information including review analysis. ### Parameters #### Path Parameters - **name** (string, Required) - Repository name (`owner/repo`) - **remote** (string, Required) - `github`, `gitlab`, `azure`, `bitbucket` - **defaultBranch** (string, Required) - Default branch - **prNumber** (number, Required) - PR number ### Response #### Success Response (200) - **mergeRequest** (object) - **number** (number) - **title** (string) - **description** (string) - **state** (string) - **isDraft** (boolean) - **authorLogin** (string) - **branches** (object) - **source** (string) - **target** (string) - **stats** (object) - **changedFiles** (number) - **additions** (number) - **deletions** (number) - **labels** (array) - **comments** (object) - **greptile** (array) - **human** (array) - **codeReviews** (array) - **id** (string) - **status** (string) - **createdAt** (string) - **completedAt** (string) - **reviewAnalysis** (object) - **totalGreptileComments** (number) - **totalHumanComments** (number) - **addressedComments** (array) - **unaddressedComments** (array) - **commitsSinceLastReview** (array) - **lastReviewDate** (string) - **reviewCompleteness** (string) - **hasNewCommitsSinceReview** (boolean) **Key fields:** * `comments.greptile[]` - Greptile-generated comments * `comments.human[]` - Human comments * `reviewAnalysis.reviewCompleteness` - Human-readable progress * `reviewAnalysis.hasNewCommitsSinceReview` - Needs re-review? ### Response Example ```json { "mergeRequest": { "number": 5, "title": "Fix config test logic", "description": "Fixes the configuration issue.", "state": "open", "isDraft": false, "authorLogin": "developer", "branches": { "source": "fix-config-test", "target": "develop" }, "stats": { "changedFiles": 2, "additions": 10, "deletions": 1 }, "labels": [], "comments": { "greptile": [...], "human": [...] }, "codeReviews": [ { "id": "1382118", "status": "COMPLETED", "createdAt": "2025-11-15T21:22:08.333Z", "completedAt": "2025-11-15T21:24:33.848Z" } ], "reviewAnalysis": { "totalGreptileComments": 2, "totalHumanComments": 0, "addressedComments": [], "unaddressedComments": [...], "commitsSinceLastReview": [], "lastReviewDate": "2025-11-15T21:24:33.643Z", "reviewCompleteness": "0/2 Greptile comments addressed", "hasNewCommitsSinceReview": false } } } ``` ``` -------------------------------- ### Explain Preferences Concisely Source: https://www.greptile.com/docs/code-review/training-the-learning-system When providing feedback via comments, be specific and keep explanations short. Avoid lengthy historical context and focus on the immediate reason for the preference. ```text ✅ "We avoid wildcard imports because they hide dependencies" ``` ```text ✅ "Webhooks must be synchronous - provider requires immediate response" ``` -------------------------------- ### Specify Files to Ignore Source: https://www.greptile.com/docs/code-review/greptile-json-reference Define newline-separated file patterns to be ignored by Greptile, following .gitignore syntax. This example excludes generated files, the dist directory, and node_modules. ```json { "ignorePatterns": "**/*.generated.*\ndist/**\nnode_modules/**" } ``` -------------------------------- ### Reference Context Files in files.json Source: https://www.greptile.com/docs/code-review/custom-standards Specify existing files in your repository that Greptile should read as context. Include paths and optional descriptions, with the ability to scope their relevance. ```json { "files": [ { "path": "docs/architecture.md", "description": "System architecture guidelines" }, { "path": "prisma/schema.prisma", "description": "Database schema — reference for model relationships", "scope": ["src/db/**"] } ] } ``` -------------------------------- ### Reference Documentation Files in greptile.json Source: https://www.greptile.com/docs/code-review/custom-standards Point Greptile to existing documentation files within your repository to be used as context. You can optionally provide a description and scope for each file. ```json "files": [ { "path": "docs/style-guide.md", // Path to file in your repo "description": "Company coding standards", // Optional description "scope": ["src/**"] // Optional: where to apply this file's rules } ] ``` -------------------------------- ### Configure Multi-Repo Context in Greptile Source: https://www.greptile.com/docs/changelog Add a `context.repos` field to your `.greptile/config.json` or `greptile.json` to provide Greptile with read-only access to related repositories for better code understanding. ```json { "context": { "repos": ["acme/shared-types", "acme/payment-sdk"] } } ``` -------------------------------- ### GCP GKE Terraform Variables Source: https://www.greptile.com/docs/kubernetes-new Example of a terraform.tfvars file for GCP GKE deployment, including project details, database credentials, API keys, and GitHub App configuration. ```hcl project_id = "your-gcp-project" region = "us-central1" db_username = "greptile" db_password = "your-secure-password" # LLM keys openai_api_key = "sk-..." anthropic_api_key = "sk-ant-..." # GitHub App github_client_id = "Iv1.xxx" github_client_secret = "xxx" github_webhook_secret = "xxx" github_private_key = "-----BEGIN RSA PRIVATE KEY-----..." # Secrets (generate with: openssl rand -hex 32) jwt_secret = "xxx" ``` -------------------------------- ### Document Rules with Prose in rules.md Source: https://www.greptile.com/docs/code-review/custom-standards Use Markdown files to provide prose-based rules, examples, and code blocks for clarity. The content is scoped to the directory containing the .greptile/ folder. ```markdown ## Error Handling All async functions must use try-catch blocks. Never swallow errors silently — at minimum, log them with the error context. ## Naming Conventions Use camelCase for variables and functions, PascalCase for classes and types. ``` -------------------------------- ### Mermaid: Function Dependency Analysis Source: https://www.greptile.com/docs/how-greptile-works/graph-based-codebase-context Illustrates how Greptile analyzes a function by mapping its direct calls, imported modules, and accessed variables. ```mermaid graph LR A[foo function] --> B[Direct calls] A --> C[Imports used] A --> D[Variables accessed] B --> E[validateInput] B --> F[database.save] C --> G[lodash] C --> H[./utils] D --> I[CONFIG.timeout] style A stroke:#3b82f6,stroke-width:3px style B stroke:#10b981,stroke-width:2px style C stroke:#f59e0b,stroke-width:2px style D stroke:#8b5cf6,stroke-width:2px ``` -------------------------------- ### View Custom Contexts Source: https://www.greptile.com/docs/mcp-v2/custom-context Use this query to list all coding patterns your organization has defined. This helps in understanding the existing standards. ```text What coding patterns does my organization have? ``` -------------------------------- ### Diff Suggested Fix Example Source: https://www.greptile.com/docs/code-review/first-pr-review This diff format shows a suggested code change. It's often used for applying quick fixes to issues identified by code analysis tools. ```diff - const data = fetchData() + const data = await fetchData() ``` -------------------------------- ### Get Code Review Details Source: https://www.greptile.com/docs/mcp-v2/tools Retrieve detailed information about a specific code review using its ID. The response includes review status, timestamps, and associated merge request details. ```json { "codeReview": { "id": "1382118", "body": "2 files reviewed, 1 comment...", "status": "COMPLETED", "createdAt": "2025-11-15T21:22:08.333Z", "completedAt": "2025-11-15T21:24:33.848Z", "metadata": { "strictness": 2, "totalFiles": 2, "correlationId": "6ab3bbc7-141a-4403-978d-1152501bf9be", "completedFiles": 2 }, "mergeRequest": { "id": "15384680", "prNumber": 5, "title": "Fix config test logic", "sourceRepoUrl": "https://github.com/owner/repo", "description": "Fixes the configuration issue.", "authorLogin": "developer", "repository": { "id": "557313", "name": "owner/repo", "remote": "github" } } } } ``` -------------------------------- ### Verify Custom Context Activation Source: https://www.greptile.com/docs/mcp-v2/custom-context List your custom contexts to confirm that a newly created pattern is active and correctly configured. ```text List my custom contexts and confirm the new pattern is ACTIVE ``` -------------------------------- ### Configure GitHub Cloud Environment Variables Source: https://www.greptile.com/docs/docker-compose/manual-setup Set these environment variables to enable GitHub Cloud integration. Ensure all required secrets and IDs are correctly provided. ```bash GITHUB_ENABLED='true' GITHUB_ENTERPRISE_ENABLED='false' GITHUB_APP_ID='123456' GITHUB_CLIENT_ID='Iv1.xxx' GITHUB_CLIENT_SECRET='xxx' GITHUB_PRIVATE_KEY='-----BEGIN RSA PRIVATE KEY-----...' WEBHOOK_SECRET='xxx' ``` -------------------------------- ### Tracking Learning Data for Comment Types Source: https://www.greptile.com/docs/how-greptile-works/memory-and-learning This TypeScript example shows how Greptile tracks metrics like 'made', 'addressed', and 'reactions' for different comment types to dynamically adjust its suggestion strategy. ```typescript // Greptile tracks patterns like: const learningData = { semicolonComments: { made: 10, addressed: 0, reactions: -3 }, securityComments: { made: 5, addressed: 5, reactions: +4 }, performanceComments: { made: 8, addressed: 6, reactions: +2 } }; // Result: Stop semicolon comments, prioritize security ``` -------------------------------- ### Configure mcp.json for Cursor IDE Source: https://www.greptile.com/docs/mcp-v2/setup Add this configuration to your mcp.json file in Cursor to connect to the Greptile MCP server. Replace YOUR_GREPTILE_API_KEY with your actual API key. ```json { "mcpServers": { "greptile": { "type": "http", "url": "https://api.greptile.com/mcp", "headers": { "Authorization": "Bearer YOUR_GREPTILE_API_KEY" } } } } ``` -------------------------------- ### Corrected Scope Pattern Syntax Source: https://www.greptile.com/docs/code-review/custom-standards This example shows the correct way to define multiple scope patterns using an array. The incorrect version uses a comma-separated string, which will cause a syntax error. ```json { "scope": ["**/*.cpp", "**/*.hpp"] } ``` -------------------------------- ### Ask Specific Questions to Greptile Source: https://www.greptile.com/docs/code-review/developer-essentials Ask Greptile specific questions to get targeted feedback on code. This can include checking for issues like memory leaks or reviewing specific code sections. ```text @greptileai check for memory leaks ``` ```text @greptileai review the database queries ``` ```text @greptileai is this thread-safe? ``` -------------------------------- ### Scope Targeting with Glob Patterns Source: https://www.greptile.com/docs/code-review-bot/greptile-json Apply context settings to specific files using glob patterns within the `scope` array. Examples include targeting TypeScript/JavaScript files, Python files in a specific directory, or all files within a tests directory. ```json "scope": ["*.ts", "*.js"] ``` ```json "scope": ["src/**/*.py"] ``` ```json "scope": ["tests/**/*"] ``` ```json "scope": ["*.md", "docs/**/*"] ``` -------------------------------- ### Configure Greptile MCP Server in VS Code Source: https://www.greptile.com/docs/mcp-v2/setup Add the Greptile MCP server configuration to your VS Code settings. Replace YOUR_GREPTILE_API_KEY with your actual API key. ```json { "servers": { "greptile": { "url": "https://api.greptile.com/mcp", "type": "http", "headers": { "Authorization": "Bearer YOUR_GREPTILE_API_KEY" } } } } ```