Synthèse automatique
Guide d’ingénierie pour intervenir dans le dépôt gcx, un outil CLI Go de compilation croisée, publication et déploiement.
Points forts
- Cartographie précise de l’architecture interne et des responsabilités de chaque paquet.
- Procédures concrètes pour ajouter des commandes CLI, des champs de configuration et des fournisseurs de publication ou déploiement.
- Rappelle les conventions du projet en matière de validation, de templates et de factories.
Limites
- Très spécifique au dépôt gcx et à ses API internes.
- Suppose une bonne connaissance de Go, de urfave/cli/v3 et des interfaces du projet.
- Ne détaille pas la configuration opérationnelle réelle des cibles S3 ou SSH.
À utiliser dès qu’une tâche modifie le code, la configuration ou les tests du dépôt gcx.
À éviter pour développer un autre outil Go de compilation croisée ou pour une simple utilisation en ligne de commande de gcx sans modification du code.
Analyse de sécurité
SûrThe skill is a documentation and development guide for the gcx codebase. It contains no executable commands that would harm the user's environment, no data exfiltration, no obfuscated payloads, and no instructions to disable safety. References to SSH, S3 publishing, and hook execution are descriptive of existing project architecture, not directives for the agent to perform risky actions. Since no tools are declared and the skill is non-invocable, there is no meaningful execution risk.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
In the gcx codebase, add a new publish provider for an S3-compatible service. Implement the Publisher interface, add BlobConfig fields and validation, register it in the factory, and update examples/gcx.yaml.In gcx, add an ArchiveConfig option to control whether zip archives are created, including the YAML tag, validation, and an updated example config.Help me trace why the gcx build command is not passing the correct version template into archive creation; inspect the relevant internal/build and internal/tmpl code paths and suggest a fix.name: gcx description: > Go cross-compilation, build, publish, and deploy CLI tool (github.com/sxwebdev/gcx). Use this skill whenever working in the gcx codebase — editing build/publish/deploy logic, CLI commands, config structs, archive creation, SSH/S3 publishing, deployment alerts, or tests. Also triggers when code imports "sxwebdev/gcx", references gcx.yaml configuration, or when the user mentions: gcx CLI, Go cross-compilation tool, gcx build, gcx publish, gcx deploy, gcx release changelog, gcx config init, BlobConfig, BuildConfig, DeployConfig, ArchiveConfig, HooksConfig, Publisher, Deployer, Archiver, AlertData, shoutrrr alerts, or GoReleaser alternative. user-invocable: false
gcx — Go Cross-Compilation & Deploy Tool
Overview
gcx is a lightweight CLI tool for cross-compiling Go binaries and publishing them to S3 or SSH servers. It reads YAML configuration (gcx.yaml), manages secrets via .env files, uses git tags for versioning, and supports deployment with notifications.
The codebase follows a clean package architecture with each concern separated into its own package under internal/.
Architecture
See references/architecture.md for the full codebase map including file layout, key packages, and data flow.
Key packages:
cmd/gcx/main.go— thin CLI layer (~200 lines): command definitions, flag wiring, package orchestrationinternal/config/— all config structs, YAML loading, comprehensive validationinternal/build/— build orchestration, BuildArtifact struct, archive creationinternal/archive/— Archiver interface with tar.gz and zip implementationsinternal/publish/— Publisher interface with S3 and SSH implementationsinternal/deploy/— Deployer interface with SSH implementationinternal/notify/— notification sending via shoutrrrinternal/git/— git operations (tag, changelog, commit hash)internal/sshutil/— shared SSH client factory, known hosts managementinternal/tmpl/— shared template processing utilityinternal/hook/— hook execution viash -cinternal/shellutil/— shell escaping utilitiesinternal/helpers/— path expansion utility
Configuration Schema
See references/config-schema.md for the complete config schema with all fields, types, defaults, and template variables.
Instructions
Adding a new CLI command
- Define the command in
cmd/gcx/main.goinside thecli.Commandtree - Use
urfave/cli/v3patterns —cli.CommandwithName,Usage,Flags, andAction - The action handler receives
context.Context— pass it to all package functions - Access config via
config.Load(cmd.String("config"))when the command needs configuration
Modifying config structs
- Add the new field to the appropriate struct in
internal/config/config.go - Include the
yaml:"field_name,omitempty"tag - Add validation in the struct's
Validate()method - Update
examples/gcx.yamlto document the new field
Adding a new publish provider
- Create a new file
internal/publish/{provider}.go - Implement the
Publisherinterface:Name() stringandPublish(ctx, artifactsDir, version) error - Add provider-specific fields to
config.BlobConfigwithyaml:"...,omitempty"tags - Add validation in
BlobConfig.Validate()for the new provider - Register the provider in
publish.NewPublisher()factory - Use
tmpl.Process()for directory template processing - Use
sshutil.NewClient()if the provider needs SSH (eliminates code duplication)
Adding a new deploy provider
- Create a new file
internal/deploy/{provider}.go - Implement the
Deployerinterface:Name() stringandDeploy(ctx) error - Add provider-specific fields to
config.DeployConfig - Add validation in
DeployConfig.Validate() - Register in
deploy.NewDeployer()factory
Working with templates
gcx uses internal/tmpl.Process() — a wrapper around Go's text/template:
result, err := tmpl.Process("name", templateStr, data)
Template data for builds:
{{.Version}}— git tag{{.Commit}}— short commit hash{{.Date}}— RFC3339 build timestamp{{.Env.VAR_NAME}}— environment variable (security-filtered)
For archive naming (ArchiveTemplateData): {{.Binary}}, {{.Version}}, {{.Os}}, {{.Arch}}
Adding deployment alerts
Alerts use the shoutrrr library via internal/notify/.
notify.Send(urls, notify.AlertData{
AppName: "myapp",
Version: "v1.0.0",
Status: "Success",
})
Error handling patterns
- Wrap errors with context:
fmt.Errorf("doing X: %w", err) - All config structs have
Validate()methods - Alert failures are logged but don't block deployment
- Hook failures stop execution immediately
- Git command failures return sensible defaults ("0.0.0" for tag, "none" for commit)
Building and testing
make build # builds to ./bin/gcx
go test ./... # run all tests
make docker-build # build Docker image
make install # go install
Key principles
-
Clean package architecture: Each concern is in its own package.
cmd/gcx/main.gois a thin CLI layer that wires packages together. -
Interfaces for providers:
Publisher,Deployer, andArchiverinterfaces enable testability and easy extension via factory functions. -
Shared SSH client factory:
sshutil.NewClient()eliminates SSH client code duplication between publish and deploy. -
Shell safety: Hooks run via
sh -c(not naivestrings.Fieldsparsing). SSH remote commands useshellutil.Quote()for shell escaping. -
Context propagation: All operations accept
context.Contextfor cancellation support. -
Template safety: Environment variables are selectively exposed — only vars explicitly referenced in
{{.Env.X}}patterns are loaded. -
Structured artifact metadata:
build.Artifactcarries binary name, version, OS, arch as structured data — no fragile filename parsing. -
Parallel builds:
errgroupwith configurable concurrency limit handles concurrent compilation and archiving.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/download' --output '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md.part' && mv '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md.part' '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md' && test -s '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gcx' && cp -R '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x' '.claude/skills/gcx'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x'openskills read 'gcx-go-cross-compilation-deploy-tool-mrzxuq5x'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.