// Node.js Script zum Ausführen von Git-Befehlen
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');

const projectRoot = __dirname;

try {
  console.log('📦 Staging aller Änderungen...');
  execSync('git add .', { cwd: projectRoot, stdio: 'inherit' });
  
  console.log('💾 Erstelle Commit...');
  const commitMessage = `fix: TypeScript errors & build fixes for Control Panel Redesign

- Fix unused imports (Trash, Filter, Bell, CategoryAdvanced)
- Fix undefined checks for cleanup settings
- Fix cleanupPreview undefined checks
- Fix useTheme unused parameter
- Fix companyLabels type safety
- Build erfolgreich durchgeführt`;
  
  execSync(`git commit -m "${commitMessage.replace(/"/g, '\\"')}"`, { cwd: projectRoot, stdio: 'inherit' });
  
  console.log('🚀 Pushe Änderungen...');
  execSync('git push', { cwd: projectRoot, stdio: 'inherit' });
  
  console.log('\n✅ Erfolgreich committed und gepusht!');
} catch (error) {
  console.error('❌ Fehler:', error.message);
  process.exit(1);
}
