-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_agents_status.cjs
More file actions
45 lines (36 loc) · 1.35 KB
/
check_agents_status.cjs
File metadata and controls
45 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const { createClient } = require('@supabase/supabase-js');
const fs = require('fs');
const path = require('path');
const envPath = 'c:\\Users\\PureTrek\\Desktop\\DevGruGold\\suite\\.env';
const envContent = fs.readFileSync(envPath, 'utf8');
const env = {};
envContent.split('\n').forEach(line => {
const [key, value] = line.split('=');
if (key && value) {
let cleanValue = value.trim();
if (cleanValue.startsWith('"') && cleanValue.endsWith('"')) {
cleanValue = cleanValue.slice(1, -1);
}
env[key.trim()] = cleanValue;
}
});
const supabaseUrl = env['SUPABASE_URL'] || env['VITE_SUPABASE_URL'];
const supabaseKey = env['SUPABASE_SERVICE_ROLE_KEY'] || env['VITE_SUPABASE_PUBLISHABLE_KEY'];
if (!supabaseUrl || !supabaseKey) {
console.error('Missing VITE_SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY');
process.exit(1);
}
const supabase = createClient(supabaseUrl, supabaseKey);
async function checkAgents() {
console.log('Checking agents status...');
const { data: agents, error } = await supabase
.from('agents')
.select('id, name, status, role');
if (error) {
console.error('Error fetching agents:', error);
return;
}
console.log('Total agents found:', agents.length);
console.table(agents);
}
checkAgents();