Repository X-Ray

Repository analysis and metadata extraction for enhanced code suggestions context

Overview

Repository X-Ray is a feature that analyzes your repository to extract metadata and contextual information. This information is then used as additional context for code generation requests, helping AI models understand your project’s coding patterns.

How it Works

Repository X-Ray automatically analyzes repositories and extracts external dependencies and libraries used in the project

This extracted metadata is stored in the database and included in code generation requests to provide more accurate and contextually relevant suggestions.

Technical Implementation

Repository X-Ray reports are generated automatically when changes are committed to a project’s default branch:

sequenceDiagram
   actor USR as User
   participant GIT as Gitaly
   participant GLR as GitLab Rails
   participant PG as GitLab PostgreSQL DB

   USR->>GLR: commits a change to the project's default branch
   GLR->>+GLR: triggers Repository X-Ray background job
   GLR->>GIT: fetches relevant files on default branch
   GIT->>GLR: file blobs
   GLR->>GLR: processes file blobs
   GLR->>-PG: upserts records to xray_reports

Components pictured on diagram are as follows:

  1. Gitaly - an application that provides high-level RPC access to Git repositories.
  2. GitLab PostgreSQL DB - relational database engine storing GitLab operational data.

The generated reports are then automatically included in code generation requests to enhance the AI model’s understanding of the project context.

Dashboards and Monitoring

Documentation

Last modified August 21, 2025: Rework the Code Creation Handbook Page (b3713bba)