stage: Create
group: Code Creation
info: Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/ee/development/development_processes.html#development-guidelines-review.
Code Suggestions development guidelines
Code Suggestions development setup
The recommended setup for locally developing and debugging Code Suggestions is to have all 3 different components running:
- IDE Extension (e.g. VS Code Extension)
- Main application configured correctly
- AI Gateway
This should enable everyone to see locally any change in an IDE being sent to the main application transformed to a prompt which is then sent to the respective model.
Setup instructions
- Install and run locally the VSCode Extension
- Add the
"gitlab.debug": true,
info to the Code Suggestions development config- In VS Code navigate to the Extensions page and find "GitLab Workflow" in the list
- Open the extension settings by clicking a small cog icon and select "Extension Settings" option
- Check a "GitLab: Debug" checkbox.
- Add the
- Main Application
- Enable Feature Flag
code_suggestions_tokens_api
- In your terminal, navigate to a
gitlab
inside yourgitlab-development-kit
directory - Run
bundle exec rails c
to start a Rails console - Call
Feature.enable(:code_suggestions_tokens_api)
from the console
- In your terminal, navigate to a
- Run the GDK with
export CODE_SUGGESTIONS_BASE_URL=http://localhost:5052
- Enable Feature Flag
-
Setup AI Gateway
- Build tree sitter libraries
poetry run scripts/build-tree-sitter-lib.py
- Extra .env changes for all debugging insights
AIGW_LOGGING__LEVEL=DEBUG
AIGW_LOGGING__FORMAT_JSON=false
AIGW_LOGGING__TO_FILE=true
- Watch the new log file
modelgateway_debug.log
, e.g.tail -f modelgateway_debug.log | fblog -a prefix -a suffix -a current_file_name -a suggestion -a language -a input -a parameters -a score -a exception
- Build tree sitter libraries
Setup instructions to use staging AI Gateway
When testing interactions with the AI Gateway, you might want to integrate your local GDK with the deployed staging AI Gateway. To do this:
-
You need a cloud staging license that has the Code Suggestions add-on, because add-ons are enabled on staging. Drop a note in the
#s_fulfillment
internal Slack channel to request an add-on to your license. See this handbook page for how to request a license for local development. -
Set environment variables to point customers-dot to staging, and the AI Gateway to staging:
export GITLAB_LICENSE_MODE=test export CUSTOMER_PORTAL_URL=https://customers.staging.gitlab.com export CODE_SUGGESTIONS_BASE_URL=https://codesuggestions.staging.gitlab.com
-
Restart the GDK.
-
Ensure you followed the necessary steps to enable the Code Suggestions feature.
-
Test out the Code Suggestions feature by opening the Web IDE for a project.