-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-agent-enhancements.cjs
More file actions
executable file
·147 lines (131 loc) · 4.25 KB
/
test-agent-enhancements.cjs
File metadata and controls
executable file
·147 lines (131 loc) · 4.25 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env node
/**
* Test Agent Enhancements
* Validates that all 5 workflow agents have correct workflow-first structure
*/
const agents = require('./backend/data/agents.json');
console.log('🧪 Testing Agent Enhancements\n');
const tests = [];
// Test 1: All agents load
tests.push({
name: 'Agent Loading',
test: () => agents.length === 8,
message: `Expected 8 agents, got ${agents.length}`
});
// Test 2: Workflow agents have workflow-first
const workflowAgents = ['governor', 'seo', 'visionary', 'marketing', 'finance'];
workflowAgents.forEach(id => {
const agent = agents.find(a => a.id === id);
tests.push({
name: `@${id} has Workflow-First`,
test: () => agent && agent.system.toLowerCase().includes('workflow-first'),
message: `@${id} missing Workflow-First methodology`
});
});
// Test 3: Tool agents are concise (unchanged)
const toolAgents = ['jina', 'infranodus', 'scraper'];
toolAgents.forEach(id => {
const agent = agents.find(a => a.id === id);
tests.push({
name: `@${id} is concise (tool agent)`,
test: () => agent && agent.system.length < 2000,
message: `@${id} prompt too long for tool agent: ${agent?.system.length} chars`
});
});
// Test 4: @marketing has templates
tests.push({
name: '@marketing has 10 templates',
test: () => {
const marketing = agents.find(a => a.id === 'marketing');
const templates = marketing.system.match(/T\d\.\d/g) || [];
return templates.length >= 8; // At least 8 templates
},
message: '@marketing missing templates'
});
// Test 5: @finance has templates
tests.push({
name: '@finance has 10 templates',
test: () => {
const finance = agents.find(a => a.id === 'finance');
const templates = finance.system.match(/T\d\.\d/g) || [];
return templates.length >= 10; // At least 10 templates
},
message: '@finance missing templates'
});
// Test 6: @governor has orchestration templates
tests.push({
name: '@governor has orchestration templates',
test: () => {
const governor = agents.find(a => a.id === 'governor');
return governor.system.includes('O1:') &&
governor.system.includes('O2:') &&
governor.system.includes('Parallel');
},
message: '@governor missing orchestration templates'
});
// Test 7: @seo has prioritization formula
tests.push({
name: '@seo has prioritization formula',
test: () => {
const seo = agents.find(a => a.id === 'seo');
return seo.system.includes('Priority') &&
seo.system.includes('Volume') &&
seo.system.includes('Competition');
},
message: '@seo missing prioritization formula'
});
// Test 8: @visionary has idea scoring
tests.push({
name: '@visionary has idea scoring',
test: () => {
const visionary = agents.find(a => a.id === 'visionary');
return visionary.system.includes('Novelty') &&
visionary.system.includes('Feasibility') &&
visionary.system.includes('DIVERGE');
},
message: '@visionary missing idea scoring framework'
});
// Test 9: All workflow agents have time savings examples
workflowAgents.forEach(id => {
const agent = agents.find(a => a.id === id);
tests.push({
name: `@${id} has time savings example`,
test: () => agent && (
agent.system.includes('Before') ||
agent.system.includes('After') ||
agent.system.includes('Time Savings') ||
agent.system.includes('% reduction') ||
agent.system.includes('92%') ||
agent.system.includes('91%') ||
agent.system.includes('86%')
),
message: `@${id} missing time savings example`
});
});
// Run all tests
let passed = 0;
let failed = 0;
tests.forEach((test, i) => {
try {
if (test.test()) {
console.log(`✅ Test ${i + 1}: ${test.name}`);
passed++;
} else {
console.log(`❌ Test ${i + 1}: ${test.name}`);
console.log(` ${test.message}`);
failed++;
}
} catch (err) {
console.log(`❌ Test ${i + 1}: ${test.name}`);
console.log(` Error: ${err.message}`);
failed++;
}
});
console.log(`\n📊 Results: ${passed} passed, ${failed} failed (${tests.length} total)`);
if (failed === 0) {
console.log('\n🎉 All tests passed! Agents ready for production.');
process.exit(0);
} else {
console.log('\n⚠️ Some tests failed. Review agent enhancements.');
process.exit(1);
}