mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-08 17:59:09 +00:00
wip(docs): i18n (#12681)
This commit is contained in:
195
packages/web/src/content/docs/fr/gitlab.mdx
Normal file
195
packages/web/src/content/docs/fr/gitlab.mdx
Normal file
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: GitLab
|
||||
description: Utilisez OpenCode dans les problèmes GitLab et les demandes de fusion.
|
||||
---
|
||||
|
||||
OpenCode s'intègre à votre flux de travail GitLab via votre pipeline CI/CD GitLab ou avec GitLab Duo.
|
||||
|
||||
Dans les deux cas, OpenCode fonctionnera sur vos coureurs GitLab.
|
||||
|
||||
---
|
||||
|
||||
## GitLab CI
|
||||
|
||||
OpenCode fonctionne dans un pipeline GitLab régulier. Vous pouvez l'intégrer dans un pipeline en tant que [composant CI](https://docs.gitlab.com/ee/ci/components/)
|
||||
|
||||
Ici, nous utilisons un composant CI/CD créé par la communauté pour OpenCode — [nagyv/gitlab-opencode](https://gitlab.com/nagyv/gitlab-opencode).
|
||||
|
||||
---
|
||||
|
||||
### Caractéristiques
|
||||
|
||||
- **Utiliser une configuration personnalisée par tâche** : configurez OpenCode avec un répertoire de configuration personnalisé, par exemple `./config/#custom-directory` pour activer ou désactiver la fonctionnalité par appel OpenCode.
|
||||
- **Configuration minimale** : le composant CI configure OpenCode en arrière-plan, il vous suffit de créer la configuration OpenCode et l'invite initiale.
|
||||
- **Flexible** : le composant CI prend en charge plusieurs entrées pour personnaliser son comportement
|
||||
|
||||
---
|
||||
|
||||
### Installation
|
||||
|
||||
1. Stockez votre authentification OpenCode JSON en tant que variables d'environnement CI de type fichier sous **Paramètres** > **CI/CD** > **Variables**. Assurez-vous de les marquer comme « Masqués et cachés ».
|
||||
2. Ajoutez ce qui suit à votre fichier `.gitlab-ci.yml`.
|
||||
|
||||
```yaml title=".gitlab-ci.yml"
|
||||
include:
|
||||
- component: $CI_SERVER_FQDN/nagyv/gitlab-opencode/opencode@2
|
||||
inputs:
|
||||
config_dir: ${CI_PROJECT_DIR}/opencode-config
|
||||
auth_json: $OPENCODE_AUTH_JSON # The variable name for your OpenCode authentication JSON
|
||||
command: optional-custom-command
|
||||
message: "Your prompt here"
|
||||
```
|
||||
|
||||
Pour plus d'entrées et de cas d'utilisation [consultez la docs](https://gitlab.com/explore/catalog/nagyv/gitlab-opencode) pour ce composant.
|
||||
|
||||
---
|
||||
|
||||
## GitLab Duo
|
||||
|
||||
OpenCode s'intègre à votre flux de travail GitLab.
|
||||
Mentionnez `@opencode` dans un commentaire et OpenCode exécutera les tâches au sein de votre pipeline CI GitLab.
|
||||
|
||||
---
|
||||
|
||||
### Caractéristiques
|
||||
|
||||
- **Problèmes de triage** : demandez à OpenCode d'examiner un problème et de vous l'expliquer.
|
||||
- **Réparer et implémenter** : demandez à OpenCode de résoudre un problème ou d'implémenter une fonctionnalité.
|
||||
Cela créera une nouvelle branche et déclenchera une demande de fusion avec les modifications.
|
||||
- **Sécurisé** : OpenCode fonctionne sur vos coureurs GitLab.
|
||||
|
||||
---
|
||||
|
||||
### Installation
|
||||
|
||||
OpenCode s'exécute dans votre pipeline CI/CD GitLab. Voici ce dont vous aurez besoin pour le configurer :
|
||||
|
||||
:::tip
|
||||
Consultez les [**GitLab docs**](https://docs.gitlab.com/user/duo_agent_platform/agent_assistant/) pour obtenir des instructions à jour.
|
||||
:::
|
||||
|
||||
1. Configurez votre environnement GitLab
|
||||
2. Configurer CI/CD
|
||||
3. Obtenez la clé API d'un fournisseur de modèles d'IA
|
||||
4. Créer un compte de service
|
||||
5. Configurer les variables CI/CD
|
||||
6. Créez un fichier de configuration de flux, voici un exemple :
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Configuration du flux</summary>
|
||||
|
||||
```yaml
|
||||
image: node:22-slim
|
||||
commands:
|
||||
- echo "Installing opencode"
|
||||
- npm install --global opencode-ai
|
||||
- echo "Installing glab"
|
||||
- export GITLAB_TOKEN=$GITLAB_TOKEN_OPENCODE
|
||||
- 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 OpenCode auth configuration"
|
||||
- mkdir --parents ~/.local/share/opencode
|
||||
- |
|
||||
cat > ~/.local/share/opencode/auth.json << EOF
|
||||
{
|
||||
"anthropic": {
|
||||
"type": "api",
|
||||
"key": "$ANTHROPIC_API_KEY"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
- echo "Configuring git"
|
||||
- git config --global user.email "opencode@gitlab.com"
|
||||
- git config --global user.name "OpenCode"
|
||||
- echo "Testing glab"
|
||||
- glab issue list
|
||||
- echo "Running OpenCode"
|
||||
- |
|
||||
opencode run "
|
||||
You are an AI assistant helping with GitLab operations.
|
||||
|
||||
Context: $AI_FLOW_CONTEXT
|
||||
Task: $AI_FLOW_INPUT
|
||||
Event: $AI_FLOW_EVENT
|
||||
|
||||
Please 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)" ]; then
|
||||
echo "Git changes detected, adding and pushing..."
|
||||
git add .
|
||||
if git diff --cached --quiet; then
|
||||
echo "No staged changes to commit"
|
||||
else
|
||||
echo "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_REF
|
||||
echo "Changes successfully pushed"
|
||||
fi
|
||||
else
|
||||
echo "No git changes detected, skipping push"
|
||||
fi
|
||||
variables:
|
||||
- ANTHROPIC_API_KEY
|
||||
- GITLAB_TOKEN_OPENCODE
|
||||
- GITLAB_HOST
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Vous pouvez vous référer aux [GitLab CLI agents docs](https://docs.gitlab.com/user/duo_agent_platform/agent_assistant/) pour des instructions détaillées.
|
||||
|
||||
---
|
||||
|
||||
### Exemples
|
||||
|
||||
Voici quelques exemples de la façon dont vous pouvez utiliser OpenCode dans GitLab.
|
||||
|
||||
:::tip
|
||||
Vous pouvez configurer pour utiliser une phrase de déclenchement différente de `@opencode`.
|
||||
:::
|
||||
|
||||
- **Expliquez un problème**
|
||||
|
||||
Ajoutez ce commentaire dans un numéro GitLab.
|
||||
|
||||
```
|
||||
@opencode explain this issue
|
||||
```
|
||||
|
||||
OpenCode lira le problème et répondra avec une explication claire.
|
||||
|
||||
- **Résoudre un problème**
|
||||
|
||||
Dans un numéro GitLab, dites :
|
||||
|
||||
```
|
||||
@opencode fix this
|
||||
```
|
||||
|
||||
OpenCode créera une nouvelle branche, mettra en œuvre les modifications et ouvrira une demande de fusion avec les modifications.
|
||||
|
||||
- **Examiner les demandes de fusion**
|
||||
|
||||
Laissez le commentaire suivant sur une demande de fusion GitLab.
|
||||
|
||||
```
|
||||
@opencode review this merge request
|
||||
```
|
||||
|
||||
OpenCode examinera la demande de fusion et fournira des commentaires.
|
||||
Reference in New Issue
Block a user