Repository X-Ray

  • Tier: Premium, Ultimate
  • Add-on: GitLab Duo Pro or Enterprise
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Repository X-Ray automatically enriches:

To do this, Repository X-Ray gives the code assistant more insight into the project’s codebase and dependencies by:

  • Searching for dependency manager configuration files (for example, Gemfile.lock, package.json, go.mod).
  • Extracting a list of libraries from their content.
  • Providing the extracted list as additional context to be used by GitLab Duo Code Suggestions in code generation, refactor code, fix code, and write test requests.

By understanding the libraries and other dependencies in use, Repository X-Ray helps the code assistant tailor suggestions to match the coding patterns, styles, and technologies used in the project. This results in code suggestions that integrate more seamlessly and follow best practices for the given stack.

Repository X-Ray only enhances code generation requests and not code completion requests.

How Repository X-Ray works

When you push a new commit to your project’s default branch, Repository X-Ray triggers a background job. This job scans and parses the applicable configuration files in your repository.

Typically, only one scanning job runs at a time in each project. If a second scan is triggered while a scan is already in progress, that second scan waits until the first scan is complete before executing. This could result in a small delay before the latest configuration file data is parsed and updated in the database.

When a code generation request is made, a maximum of 300 libraries from the parsed data is included in the prompt as additional context.

Enable Repository X-Ray

The Repository X-Ray service is automatically enabled if your project has access to GitLab Duo Code Suggestions.

Supported languages and dependency managers

The Repository X-Ray searches a maximum of two directory levels from the repository’s root. For example, it supports Gemfile.lock, api/Gemfile.lock, or api/client/Gemfile.lock, but not api/v1/client/Gemfile.lock. For each language, only the first matching dependency manager is processed. Where available, lock files take precedence over their non-lock file counterparts.

LanguageDependency managerConfiguration fileGitLab version
C/C++Conanconanfile.py17.5 or later
C/C++Conanconanfile.txt17.5 or later
C/C++vcpkgvcpkg.json17.5 or later
C#NuGet*.csproj17.5 or later
GoGo Modulesgo.mod17.4 or later
JavaGradlebuild.gradle17.4 or later
JavaMavenpom.xml17.4 or later
JavaScriptNPMpackage-lock.json, package.json17.5 or later
KotlinGradlebuild.gradle.kts17.5 or later
PHPComposercomposer.lock, composer.json17.5 or later
PythonCondaenvironment.yml17.5 or later
PythonPip*requirements*.txt 117.5 or later
PythonPoetrypoetry.lock, pyproject.toml17.5 or later
RubyRubyGemsGemfile.lock17.4 or later

Footnotes:

  1. For Python Pip, all configuration files matching the *requirements*.txt glob pattern are processed.