GitLab
SlopCode s’intègre à votre flux de travail GitLab via votre pipeline CI/CD GitLab ou avec GitLab Duo.
Dans les deux cas, SlopCode fonctionnera sur vos runners GitLab.
GitLab CI
SlopCode fonctionne dans un pipeline GitLab régulier. Vous pouvez l’intégrer dans un pipeline en tant que composant CI
Ici, nous utilisons un composant CI/CD créé par la communauté pour SlopCode — nagyv/gitlab-slopcode.
Fonctionnalités
- Utiliser une configuration personnalisée par tâche : configurez SlopCode avec un répertoire de configuration personnalisé, par exemple
./config/#custom-directorypour activer ou désactiver la fonctionnalité pour chaque appel d’SlopCode. - Configuration minimale : le composant CI configure SlopCode en arrière-plan, il vous suffit de créer la configuration SlopCode et le prompt initial.
- Flexible : le composant CI prend en charge plusieurs entrées pour personnaliser son comportement
Installation
-
Stockez votre authentification SlopCode JSON en tant que variables d’environnement CI de type fichier sous Paramètres > CI/CD > Variables. Assurez-vous de les marquer comme « Masquées et protégées ».
-
Ajoutez ce qui suit à votre fichier
.gitlab-ci.yml..gitlab-ci.yml include:- component: $CI_SERVER_FQDN/nagyv/gitlab-slopcode/slopcode@2inputs:config_dir: ${CI_PROJECT_DIR}/slopcode-configauth_json: $SLOPCODE_AUTH_JSON # The variable name for your SlopCode authentication JSONcommand: optional-custom-commandmessage: "Your prompt here"
Pour plus d’entrées et de cas d’utilisation consultez la doc pour ce composant.
GitLab Duo
SlopCode s’intègre à votre flux de travail GitLab.
Mentionnez @slopcode dans un commentaire et SlopCode exécutera les tâches au sein de votre pipeline CI GitLab.
Fonctionnalités
- Triage d’issues : demandez à SlopCode d’examiner une issue et de vous l’expliquer.
- Correction et implémentation : demandez à SlopCode de résoudre une issue ou d’implémenter une fonctionnalité. Cela créera une nouvelle branche et déclenchera une merge request avec les modifications.
- Sécurisé : SlopCode fonctionne sur vos runners GitLab.
Installation
SlopCode s’exécute dans votre pipeline CI/CD GitLab. Voici ce dont vous aurez besoin pour le configurer :
-
Configurez votre environnement GitLab
-
Configurer CI/CD
-
Obtenez la clé API d’un fournisseur de modèles d’IA
-
Créer un compte de service
-
Configurer les variables CI/CD
-
Créez un fichier de configuration de flux, voici un exemple :
Configuration du flux
image: node:22-slimcommands:- echo "Installing slopcode"- npm install --global slopcode- echo "Installing glab"- export GITLAB_TOKEN=$GITLAB_TOKEN_SLOPCODE- apt-get update --quiet && apt-get install --yes curl wget gpg git && rm --recursive --force /var/lib/apt/lists/*- curl --silent --show-error --location "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | bash- apt-get install --yes glab- echo "Configuring glab"- echo $GITLAB_HOST- echo "Creating SlopCode auth configuration"- mkdir --parents ~/.local/share/slopcode- |cat > ~/.local/share/slopcode/auth.json << EOF{"anthropic": {"type": "api","key": "$ANTHROPIC_API_KEY"}}EOF- echo "Configuring git"- git config --global user.email "slopcode@gitlab.com"- git config --global user.name "SlopCode"- echo "Testing glab"- glab issue list- echo "Running SlopCode"- |slopcode run "You are an AI assistant helping with GitLab operations.Context: $AI_FLOW_CONTEXTTask: $AI_FLOW_INPUTEvent: $AI_FLOW_EVENTPlease execute the requested task using the available GitLab tools.Be thorough in your analysis and provide clear explanations.<important>Please use the glab CLI to access data from GitLab. The glab CLI has already been authenticated. You can run the corresponding commands.If you are asked to summarize an MR or issue or asked to provide more information then please post back a note to the MR/Issue so that the user can see it.You don't need to commit or push up changes, those will be done automatically based on the file changes you make.</important>"- git checkout --branch $CI_WORKLOAD_REF origin/$CI_WORKLOAD_REF- echo "Checking for git changes and pushing if any exist"- |if ! git diff --quiet || ! git diff --cached --quiet || [ --not --zero "$(git ls-files --others --exclude-standard)" ]; thenecho "Git changes detected, adding and pushing..."git add .if git diff --cached --quiet; thenecho "No staged changes to commit"elseecho "Committing changes to branch: $CI_WORKLOAD_REF"git commit --message "Codex changes"echo "Pushing changes up to $CI_WORKLOAD_REF"git push https://gitlab-ci-token:$GITLAB_TOKEN@$GITLAB_HOST/gl-demo-ultimate-dev-ai-epic-17570/test-java-project.git $CI_WORKLOAD_REFecho "Changes successfully pushed"fielseecho "No git changes detected, skipping push"fivariables:- ANTHROPIC_API_KEY- GITLAB_TOKEN_SLOPCODE- GITLAB_HOST
Vous pouvez vous référer aux GitLab CLI agents docs pour des instructions détaillées.
Exemples
Voici quelques exemples de la façon dont vous pouvez utiliser SlopCode dans GitLab.
- Expliquer une issue
Ajoutez ce commentaire dans une issue GitLab.
@slopcode explain this issueSlopCode lira l’issue et répondra avec une explication claire.
- Résoudre une issue
Dans une issue GitLab, dites :
@slopcode fix thisSlopCode créera une nouvelle branche, mettra en œuvre les modifications et ouvrira une merge request avec les modifications.
- Revue de merge request
Laissez le commentaire suivant sur une merge request GitLab.
@slopcode review this merge requestSlopCode examinera la merge request et fournira des commentaires.