require('dotenv').config();
const { createClient } = require('@supabase/supabase-js');
const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_KEY);

async function fixMysteryTasks() {
  // Find mystery tasks marked as remote
  const { data: tasks } = await supabase
    .from('tasks')
    .select('id, title, is_local, category')
    .eq('category', 'mystery');
  
  console.log('Mystery tasks:', tasks);
  
  // Fix them
  const { data, error } = await supabase
    .from('tasks')
    .update({ is_local: true })
    .eq('category', 'mystery')
    .eq('is_local', false);
  
  console.log('Fixed:', error ? error : 'Success');
  process.exit(0);
}

fixMysteryTasks();
