92 lines
2.7 KiB
Bash
Executable file
92 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Script de démonstration de la commande ! dans MagicCode
|
|
# Ce script teste les fonctionnalités d'exécution de commandes shell
|
|
|
|
echo "🚀 Test de la commande shell ! dans MagicCode"
|
|
echo "================================================"
|
|
echo ""
|
|
|
|
# Test 1 : Vérification que les tests passent
|
|
echo "✅ Test 1 : Vérification des tests unitaires"
|
|
cd /home/arnaud/Téléchargements/MagicCode/magiccode
|
|
pnpm test shell-commands --silent 2>&1 | grep "Test Files"
|
|
echo ""
|
|
|
|
# Test 2 : Vérification du TypeCheck
|
|
echo "✅ Test 2 : Vérification TypeScript"
|
|
pnpm typecheck --silent 2>&1 | tail -1
|
|
echo ""
|
|
|
|
# Test 3 : Test de findShellCommands
|
|
echo "✅ Test 3 : Détection de commandes dans le texte"
|
|
cat > /tmp/test-shell-cmd.mjs << 'EOF'
|
|
import { findShellCommands } from './packages/ext-claudecode/src/shell-commands.js';
|
|
|
|
const text = "Utilisateur: !whoami\nDossier: !pwd\nFichiers: !`ls -la`";
|
|
const matches = findShellCommands(text);
|
|
|
|
console.log(`Trouvé ${matches.length} commandes:`);
|
|
matches.forEach((m, i) => {
|
|
console.log(` ${i+1}. "${m.match}" → commande: ${m.command}`);
|
|
});
|
|
EOF
|
|
|
|
# Note: Ce test nécessiterait une compilation préalable
|
|
# echo "Commandes détectées dans un texte exemple"
|
|
echo " (Voir les tests unitaires pour validation)"
|
|
echo ""
|
|
|
|
# Test 4 : Vérification de l'exemple de commande
|
|
echo "✅ Test 4 : Commande d'exemple créée"
|
|
if [ -f ".claude/commands/sysinfo.md" ]; then
|
|
echo " ✓ .claude/commands/sysinfo.md existe"
|
|
echo " Contenu:"
|
|
head -5 .claude/commands/sysinfo.md | sed 's/^/ /'
|
|
else
|
|
echo " ✗ Fichier non trouvé"
|
|
fi
|
|
echo ""
|
|
|
|
# Test 5 : Vérification de la documentation
|
|
echo "✅ Test 5 : Documentation créée"
|
|
docs=(
|
|
"packages/ext-claudecode/SHELL_COMMANDS.md"
|
|
"CHANGELOG_SHELL_COMMANDS.md"
|
|
"IMPLEMENTATION_SUMMARY.md"
|
|
"FILES_CHANGES.md"
|
|
)
|
|
for doc in "${docs[@]}"; do
|
|
if [ -f "$doc" ]; then
|
|
echo " ✓ $doc"
|
|
else
|
|
echo " ✗ $doc manquant"
|
|
fi
|
|
done
|
|
echo ""
|
|
|
|
# Test 6 : Build
|
|
echo "✅ Test 6 : Vérification du build"
|
|
pnpm build --silent 2>&1 | grep -q "Build success" && echo " ✓ Build réussi" || echo " ✗ Build échoué"
|
|
echo ""
|
|
|
|
# Test 7 : Simulation d'utilisation
|
|
echo "✅ Test 7 : Simulation d'exécution de commande shell"
|
|
echo " Exemple: !pwd → $(pwd)"
|
|
echo " Exemple: !whoami → $(whoami)"
|
|
echo " Exemple: !`echo hello` → hello"
|
|
echo ""
|
|
|
|
# Résumé
|
|
echo "================================================"
|
|
echo "🎉 Implémentation de la commande ! terminée"
|
|
echo ""
|
|
echo "Pour tester en conditions réelles:"
|
|
echo " 1. pnpm dev"
|
|
echo " 2. Taper: Liste des fichiers : !`ls -la`"
|
|
echo " 3. Ou utiliser: /sysinfo"
|
|
echo ""
|
|
echo "Documentation:"
|
|
echo " - Guide: packages/ext-claudecode/SHELL_COMMANDS.md"
|
|
echo " - API: IMPLEMENTATION_SUMMARY.md"
|
|
echo ""
|