Exemples d'utilisation

Exemples pratiques montrant comment utiliser Bob Shell pour le débogage, l'amélioration de code, la création de fichiers, la génération de documentation et l'apprentissage de nouveaux concepts.

Corriger des erreurs dans les commandes shell

Quand tu rencontres des erreurs dans tes commandes shell, Bob Shell peut t'aider à les diagnostiquer et les corriger :

# Navigue vers ton répertoire de projet
cd your-project/

# Démarre Bob Shell
bob chat

# Passe en mode shell
> !

# Tape la commande qui provoque une erreur
> make build

# Quand tu vois un message d'erreur comme 'No rule to make target `xxx', needed by `yyy'.'

# Appuie sur ESC ou tape '!' à nouveau pour quitter le mode shell

# Demande l'aide de Bob Shell
> Help me to fix the error

Explication et amélioration de code

Bob Shell peut t'aider à comprendre et améliorer du code existant :

# Démarre Bob Shell dans ton répertoire de projet
bob chat

# Demande une explication d'un fichier spécifique
> Explain what @src/utils.js does and how it works

# Demande des améliorations de ton code
> Review @src/api.js and suggest improvements for error handling

Créer de nouveaux fichiers et fonctionnalités

Utilise Bob Shell pour t'aider à créer de nouveaux composants ou fonctionnalités :

# Démarre Bob Shell dans ton répertoire de projet
bob chat

# Demande de l'aide pour créer un nouveau composant
> Create a React component for a user profile page that displays name, email, and avatar

# Génère une fonction utilitaire
> Write a utility function that formats dates in YYYY-MM-DD format

Aide au débogage

Bob Shell peut t'aider à déboguer des problèmes dans ton code :

# Démarre Bob Shell dans ton répertoire de projet
bob chat

# Partage les logs d'erreur avec Bob Shell
> I'm getting this error when running my app: "TypeError: Cannot read property 'map' of undefined". Here's the relevant code: @src/components/List.js

# Ou redirige la sortie d'erreur directement vers Bob Shell
# Dans ton terminal (pas dans Bob Shell)
npm run start 2>&1 | bob run "Help me understand and fix this error"

Génération de documentation

Génère de la documentation pour ton code en utilisant Bob Shell :

# Démarre Bob Shell dans ton répertoire de projet
bob chat

# Génère de la documentation pour un fichier spécifique
> Create JSDoc comments for all functions in @src/helpers.js

# Génère un README pour ton projet
> Create a README.md file for my project based on the code in @src/index.js

Apprendre de nouveaux concepts

Utilise Bob Shell pour apprendre de nouvelles technologies ou concepts :

# Démarre Bob Shell
bob chat

# Pose des questions sur une technologie spécifique
> Explain how React hooks work and give me examples of useState and useEffect

# Apprends les design patterns
> Explain the Observer pattern and how I might implement it in JavaScript
Comment trouvez-vous ce sujet ?