oneie 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-director.md +902 -22
- package/.claude/agents/agent-onboard-example-output.md +600 -0
- package/.claude/agents/agent-onboard.md +576 -0
- package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
- package/.claude/commands/one.md +375 -5
- package/.claude/commands/release.md +64 -3
- package/CLAUDE.md +55 -69
- package/dist/commands/init.d.ts +5 -6
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +101 -101
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/installation-setup.d.ts +24 -1
- package/dist/utils/installation-setup.d.ts.map +1 -1
- package/dist/utils/installation-setup.js +85 -1
- package/dist/utils/installation-setup.js.map +1 -1
- package/dist/utils/launch-claude.d.ts +6 -0
- package/dist/utils/launch-claude.d.ts.map +1 -0
- package/dist/utils/launch-claude.js +51 -0
- package/dist/utils/launch-claude.js.map +1 -0
- package/dist/utils/validation.d.ts +48 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +73 -0
- package/dist/utils/validation.js.map +1 -0
- package/folders.yaml +1 -1
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/workspace.json +20 -20
- package/one/connections/workflow-onboarding.md +683 -0
- package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
- package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
- package/one/events/DEPLOYMENT.md +178 -0
- package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
- package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
- package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
- package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
- package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
- package/one/events/HANDOFF.md +313 -0
- package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
- package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
- package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
- package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
- package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
- package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
- package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
- package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
- package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
- package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
- package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
- package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
- package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
- package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
- package/one/events/SHOP-BUILD-STATUS.md +114 -0
- package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
- package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
- package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
- package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
- package/one/events/agent-director-enhancement-summary.md +386 -0
- package/one/events/agent-onboard-implementation-summary.md +457 -0
- package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
- package/one/events/landing-page-generator.md +458 -0
- package/one/events/onboarding-implementation-complete.md +505 -0
- package/one/events/release.md +254 -0
- package/one/events/separate-implementation-status.md +537 -0
- package/one/knowledge/100-inference-quick-reference.md +431 -0
- package/one/knowledge/agent-onboard-usage.md +612 -0
- package/one/knowledge/cli-claude-handoff.md +718 -0
- package/one/knowledge/ontology-blog.yaml +31 -0
- package/one/knowledge/ontology-cheatsheet.md +591 -0
- package/one/knowledge/ontology-community.yaml +42 -0
- package/one/knowledge/ontology-core-universal.md +722 -0
- package/one/knowledge/ontology-core.yaml +50 -0
- package/one/knowledge/ontology-courses.yaml +53 -0
- package/one/knowledge/ontology-creator.md +376 -0
- package/one/knowledge/ontology-developer-guide.md +789 -0
- package/one/knowledge/ontology-education.md +920 -0
- package/one/knowledge/ontology-index.md +354 -0
- package/one/knowledge/ontology-migration-guide.md +811 -0
- package/one/knowledge/ontology-minimal.yaml +1 -1
- package/one/knowledge/ontology-portfolio.yaml +31 -0
- package/one/knowledge/ontology-quickstart.md +576 -0
- package/one/knowledge/ontology-shop.yaml +121 -0
- package/one/knowledge/ontology-tokens.yaml +32 -0
- package/one/knowledge/ontology-tutorial.md +434 -0
- package/one/knowledge/ontology-video-script.md +890 -0
- package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
- package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
- package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
- package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
- package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
- package/one/things/docs/ecommerce/QUICK-START.md +368 -0
- package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
- package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
- package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
- package/one/things/docs/ecommerce/demo.astro +309 -0
- package/one/things/plans/agent-director-100-inference-plans.md +410 -0
- package/one/things/plans/dual-website-strategy.md +612 -0
- package/one/things/plans/feature-based-sites.md +821 -0
- package/one/things/plans/multi-ontology-architecture.md +836 -0
- package/one/things/plans/onboarding.md +32 -0
- package/one/things/plans/separate.md +15 -17
- package/one/things/plans/start-new.md +738 -0
- package/package.json +2 -2
- package/one/things/claude/hooks/agent-hook-manager.js +0 -525
- package/one/things/claude/hooks/agent-load-balancer.js +0 -271
- package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
- package/one/things/claude/hooks/cascade-feedback.js +0 -297
- package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
- package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
- package/one/things/claude/hooks/file-organization-engine.js +0 -427
- package/one/things/claude/hooks/file-organization-monitor.js +0 -269
- package/one/things/claude/hooks/hook-config-manager.js +0 -202
- package/one/things/claude/hooks/hook-orchestrator.js +0 -662
- package/one/things/claude/hooks/hook-performance-report.js +0 -120
- package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
- package/one/things/claude/hooks/memory-optimizer.js +0 -510
- package/one/things/claude/hooks/ontology-compliance.js +0 -394
- package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
- package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
- package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
- package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
- package/one/things/claude/hooks/simple-load-balancer.js +0 -238
- package/one/things/claude/hooks/startup-optimizer.js +0 -625
- package/one/things/claude/hooks/story-scoring-system.js +0 -445
- package/one/things/claude/hooks/story-validation-engine.js +0 -473
- package/one/things/claude/hooks/structure-synchronizer.js +0 -194
- package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
- package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
- package/one/things/claude/hooks/trinity-validation-system.js +0 -392
- package/one/things/plans/organizations-to-groups.md +0 -705
|
@@ -1,834 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Real-Time Quality Scoring Engine
|
|
5
|
-
* Implements continuous quality assessment for sub-agent outputs
|
|
6
|
-
* Integrates with R.O.C.K.E.T. framework and provides real-time scoring
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import fs from 'fs';
|
|
10
|
-
import path from 'path';
|
|
11
|
-
import { EventEmitter } from 'events';
|
|
12
|
-
|
|
13
|
-
// Quality scoring configuration
|
|
14
|
-
const SCORING_CONFIG = {
|
|
15
|
-
CONTENT_TYPES: {
|
|
16
|
-
'mission-plan': {
|
|
17
|
-
weight: 1.0,
|
|
18
|
-
scoringCriteria: {
|
|
19
|
-
strategicClarity: 0.3,
|
|
20
|
-
actionability: 0.25,
|
|
21
|
-
measurability: 0.2,
|
|
22
|
-
resourceAlignment: 0.15,
|
|
23
|
-
riskAssessment: 0.1
|
|
24
|
-
},
|
|
25
|
-
qualityThreshold: 7.5
|
|
26
|
-
},
|
|
27
|
-
'story-creation': {
|
|
28
|
-
weight: 1.0,
|
|
29
|
-
scoringCriteria: {
|
|
30
|
-
narrativeStructure: 0.25,
|
|
31
|
-
acceptanceCriteria: 0.3,
|
|
32
|
-
technicalFeasibility: 0.2,
|
|
33
|
-
businessValue: 0.15,
|
|
34
|
-
testability: 0.1
|
|
35
|
-
},
|
|
36
|
-
qualityThreshold: 7.0
|
|
37
|
-
},
|
|
38
|
-
'technical-specification': {
|
|
39
|
-
weight: 1.0,
|
|
40
|
-
scoringCriteria: {
|
|
41
|
-
technicalAccuracy: 0.35,
|
|
42
|
-
implementationClarity: 0.25,
|
|
43
|
-
architecturalSoundness: 0.2,
|
|
44
|
-
securityConsiderations: 0.15,
|
|
45
|
-
scalabilityPlanning: 0.05
|
|
46
|
-
},
|
|
47
|
-
qualityThreshold: 8.0
|
|
48
|
-
},
|
|
49
|
-
'marketing-content': {
|
|
50
|
-
weight: 1.0,
|
|
51
|
-
scoringCriteria: {
|
|
52
|
-
messageClarity: 0.25,
|
|
53
|
-
audienceAlignment: 0.25,
|
|
54
|
-
brandConsistency: 0.2,
|
|
55
|
-
engagementPotential: 0.2,
|
|
56
|
-
callToAction: 0.1
|
|
57
|
-
},
|
|
58
|
-
qualityThreshold: 7.0
|
|
59
|
-
},
|
|
60
|
-
'research-analysis': {
|
|
61
|
-
weight: 1.0,
|
|
62
|
-
scoringCriteria: {
|
|
63
|
-
dataAccuracy: 0.3,
|
|
64
|
-
analysisDepth: 0.25,
|
|
65
|
-
insightQuality: 0.2,
|
|
66
|
-
sourceCredibility: 0.15,
|
|
67
|
-
actionableFindings: 0.1
|
|
68
|
-
},
|
|
69
|
-
qualityThreshold: 8.0
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
AGENT_MULTIPLIERS: {
|
|
74
|
-
'marketing-director': 1.1, // Strategic content gets bonus
|
|
75
|
-
'engineering-director': 1.1, // Technical leadership bonus
|
|
76
|
-
'research-market-analyst': 1.05, // Research precision bonus
|
|
77
|
-
'marketing-viral-growth': 1.15, // Innovative content bonus
|
|
78
|
-
'crypto-community-analyst': 1.05 // Specialized domain bonus
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
QUALITY_BANDS: {
|
|
82
|
-
EXCELLENT: { min: 9.0, label: 'Excellent', color: 'green' },
|
|
83
|
-
GOOD: { min: 7.5, label: 'Good', color: 'blue' },
|
|
84
|
-
ACCEPTABLE: { min: 6.0, label: 'Acceptable', color: 'yellow' },
|
|
85
|
-
NEEDS_IMPROVEMENT: { min: 4.0, label: 'Needs Improvement', color: 'orange' },
|
|
86
|
-
POOR: { min: 0, label: 'Poor', color: 'red' }
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
class QualityScoringEngine extends EventEmitter {
|
|
91
|
-
constructor() {
|
|
92
|
-
super();
|
|
93
|
-
this.scores = new Map(); // outputId -> scoreData
|
|
94
|
-
this.trends = new Map(); // agentType -> trendData
|
|
95
|
-
this.alerts = [];
|
|
96
|
-
this.startTime = Date.now();
|
|
97
|
-
this.processedCount = 0;
|
|
98
|
-
|
|
99
|
-
// Initialize trend tracking
|
|
100
|
-
this.initializeTrendTracking();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
initializeTrendTracking() {
|
|
104
|
-
// Track quality trends over time for each agent type
|
|
105
|
-
setInterval(() => {
|
|
106
|
-
this.updateQualityTrends();
|
|
107
|
-
}, 60000); // Update trends every minute
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async scoreOutput(content, metadata = {}) {
|
|
111
|
-
try {
|
|
112
|
-
const outputId = this.generateOutputId(metadata);
|
|
113
|
-
const startTime = Date.now();
|
|
114
|
-
|
|
115
|
-
// Detect content type
|
|
116
|
-
const contentType = this.detectContentType(content, metadata);
|
|
117
|
-
|
|
118
|
-
// Get scoring configuration
|
|
119
|
-
const config = SCORING_CONFIG.CONTENT_TYPES[contentType] ||
|
|
120
|
-
SCORING_CONFIG.CONTENT_TYPES['story-creation'];
|
|
121
|
-
|
|
122
|
-
// Execute quality assessment
|
|
123
|
-
const qualityScores = await this.assessQuality(content, config, metadata);
|
|
124
|
-
|
|
125
|
-
// Calculate weighted final score
|
|
126
|
-
const finalScore = this.calculateWeightedScore(qualityScores, config);
|
|
127
|
-
|
|
128
|
-
// Apply agent multiplier if applicable
|
|
129
|
-
const adjustedScore = this.applyAgentMultiplier(finalScore, metadata.agentType);
|
|
130
|
-
|
|
131
|
-
// Determine quality band
|
|
132
|
-
const qualityBand = this.getQualityBand(adjustedScore);
|
|
133
|
-
|
|
134
|
-
// Create score record
|
|
135
|
-
const scoreData = {
|
|
136
|
-
outputId,
|
|
137
|
-
timestamp: new Date().toISOString(),
|
|
138
|
-
contentType,
|
|
139
|
-
agentType: metadata.agentType,
|
|
140
|
-
baseScore: finalScore,
|
|
141
|
-
adjustedScore,
|
|
142
|
-
qualityBand,
|
|
143
|
-
qualityScores,
|
|
144
|
-
metadata,
|
|
145
|
-
processingTime: Date.now() - startTime
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// Store score
|
|
149
|
-
this.scores.set(outputId, scoreData);
|
|
150
|
-
|
|
151
|
-
// Update trends
|
|
152
|
-
this.updateAgentTrend(metadata.agentType, adjustedScore);
|
|
153
|
-
|
|
154
|
-
// Check for alerts
|
|
155
|
-
this.checkQualityAlerts(scoreData);
|
|
156
|
-
|
|
157
|
-
// Emit scoring event
|
|
158
|
-
this.emit('scored', scoreData);
|
|
159
|
-
|
|
160
|
-
this.processedCount++;
|
|
161
|
-
return scoreData;
|
|
162
|
-
|
|
163
|
-
} catch (error) {
|
|
164
|
-
this.emit('error', error);
|
|
165
|
-
throw error;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
detectContentType(content, metadata) {
|
|
170
|
-
// Use metadata first
|
|
171
|
-
if (metadata.contentType && SCORING_CONFIG.CONTENT_TYPES[metadata.contentType]) {
|
|
172
|
-
return metadata.contentType;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Pattern-based detection
|
|
176
|
-
const typePatterns = {
|
|
177
|
-
'mission-plan': [
|
|
178
|
-
/mission.*objective/i,
|
|
179
|
-
/strategic.*plan/i,
|
|
180
|
-
/goals?.*objectives?/i,
|
|
181
|
-
/mission.*success/i
|
|
182
|
-
],
|
|
183
|
-
'story-creation': [
|
|
184
|
-
/user story/i,
|
|
185
|
-
/acceptance criteria/i,
|
|
186
|
-
/as a.*i want.*so that/i,
|
|
187
|
-
/story.*epic/i
|
|
188
|
-
],
|
|
189
|
-
'technical-specification': [
|
|
190
|
-
/architecture/i,
|
|
191
|
-
/technical.*design/i,
|
|
192
|
-
/implementation.*plan/i,
|
|
193
|
-
/api.*specification/i,
|
|
194
|
-
/system.*requirements/i
|
|
195
|
-
],
|
|
196
|
-
'marketing-content': [
|
|
197
|
-
/marketing.*strategy/i,
|
|
198
|
-
/campaign/i,
|
|
199
|
-
/brand.*messaging/i,
|
|
200
|
-
/audience.*targeting/i,
|
|
201
|
-
/conversion.*optimization/i
|
|
202
|
-
],
|
|
203
|
-
'research-analysis': [
|
|
204
|
-
/research.*findings/i,
|
|
205
|
-
/market.*analysis/i,
|
|
206
|
-
/data.*insights/i,
|
|
207
|
-
/competitive.*analysis/i,
|
|
208
|
-
/trend.*analysis/i
|
|
209
|
-
]
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
for (const [type, patterns] of Object.entries(typePatterns)) {
|
|
213
|
-
if (patterns.some(pattern => pattern.test(content))) {
|
|
214
|
-
return type;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Default to story creation
|
|
219
|
-
return 'story-creation';
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
async assessQuality(content, config, metadata) {
|
|
223
|
-
const qualityScores = {};
|
|
224
|
-
|
|
225
|
-
for (const [criterion, weight] of Object.entries(config.scoringCriteria)) {
|
|
226
|
-
const score = await this.evaluateCriterion(content, criterion, metadata);
|
|
227
|
-
qualityScores[criterion] = {
|
|
228
|
-
score: Math.min(10, Math.max(0, score)),
|
|
229
|
-
weight,
|
|
230
|
-
weightedScore: score * weight
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return qualityScores;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
async evaluateCriterion(content, criterion, metadata) {
|
|
238
|
-
const evaluatorMethod = `evaluate${this.capitalize(criterion)}`;
|
|
239
|
-
|
|
240
|
-
if (typeof this[evaluatorMethod] === 'function') {
|
|
241
|
-
return await this[evaluatorMethod](content, metadata);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Fallback evaluation
|
|
245
|
-
return this.fallbackEvaluation(content, criterion);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Quality Criterion Evaluators
|
|
249
|
-
async evaluateStrategicClarity(content, metadata) {
|
|
250
|
-
const clarityIndicators = [
|
|
251
|
-
/clear.*strategy/i,
|
|
252
|
-
/strategic.*direction/i,
|
|
253
|
-
/specific.*goals?/i,
|
|
254
|
-
/measurable.*objectives?/i,
|
|
255
|
-
/timeline/i,
|
|
256
|
-
/milestones?/i
|
|
257
|
-
];
|
|
258
|
-
|
|
259
|
-
const matches = clarityIndicators.filter(pattern => pattern.test(content)).length;
|
|
260
|
-
return Math.min(10, (matches / clarityIndicators.length) * 12);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
async evaluateActionability(content, metadata) {
|
|
264
|
-
const actionableElements = [
|
|
265
|
-
/action.*items?/i,
|
|
266
|
-
/next steps?/i,
|
|
267
|
-
/implementation/i,
|
|
268
|
-
/execute/i,
|
|
269
|
-
/deliver/i,
|
|
270
|
-
/checklist/i,
|
|
271
|
-
/tasks?/i
|
|
272
|
-
];
|
|
273
|
-
|
|
274
|
-
const matches = actionableElements.filter(pattern => pattern.test(content)).length;
|
|
275
|
-
const hasCheckboxes = (content.match(/- \[ \]/g) || []).length;
|
|
276
|
-
|
|
277
|
-
return Math.min(10, ((matches / actionableElements.length) * 8) + (hasCheckboxes * 0.2));
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
async evaluateMeasurability(content, metadata) {
|
|
281
|
-
const measurabilityPatterns = [
|
|
282
|
-
/metrics?/i,
|
|
283
|
-
/kpis?/i,
|
|
284
|
-
/measure/i,
|
|
285
|
-
/quantify/i,
|
|
286
|
-
/analytics/i,
|
|
287
|
-
/tracking/i,
|
|
288
|
-
/\d+%/,
|
|
289
|
-
/\$\d+/,
|
|
290
|
-
/\d+\s+(users?|customers?|conversions?)/i
|
|
291
|
-
];
|
|
292
|
-
|
|
293
|
-
const matches = measurabilityPatterns.filter(pattern => pattern.test(content)).length;
|
|
294
|
-
return Math.min(10, (matches / measurabilityPatterns.length) * 15);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
async evaluateResourceAlignment(content, metadata) {
|
|
298
|
-
const resourceElements = [
|
|
299
|
-
/budget/i,
|
|
300
|
-
/resources?/i,
|
|
301
|
-
/team/i,
|
|
302
|
-
/timeline/i,
|
|
303
|
-
/capacity/i,
|
|
304
|
-
/skills?/i,
|
|
305
|
-
/tools?/i
|
|
306
|
-
];
|
|
307
|
-
|
|
308
|
-
const matches = resourceElements.filter(pattern => pattern.test(content)).length;
|
|
309
|
-
return Math.min(10, (matches / resourceElements.length) * 10);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
async evaluateRiskAssessment(content, metadata) {
|
|
313
|
-
const riskElements = [
|
|
314
|
-
/risks?/i,
|
|
315
|
-
/challenges?/i,
|
|
316
|
-
/mitigation/i,
|
|
317
|
-
/contingency/i,
|
|
318
|
-
/obstacles?/i,
|
|
319
|
-
/assumptions?/i
|
|
320
|
-
];
|
|
321
|
-
|
|
322
|
-
const matches = riskElements.filter(pattern => pattern.test(content)).length;
|
|
323
|
-
return Math.min(10, (matches / riskElements.length) * 12);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
async evaluateNarrativeStructure(content, metadata) {
|
|
327
|
-
const structureElements = [
|
|
328
|
-
/##\s+/g, // Headers
|
|
329
|
-
/\*\*.*\*\*/g, // Bold text
|
|
330
|
-
/- \[ \]/g, // Checkboxes
|
|
331
|
-
/\d+\./g // Numbered lists
|
|
332
|
-
];
|
|
333
|
-
|
|
334
|
-
const structureScore = structureElements.reduce((score, pattern) => {
|
|
335
|
-
const matches = (content.match(pattern) || []).length;
|
|
336
|
-
return score + Math.min(2, matches * 0.5);
|
|
337
|
-
}, 0);
|
|
338
|
-
|
|
339
|
-
return Math.min(10, structureScore);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
async evaluateAcceptanceCriteria(content, metadata) {
|
|
343
|
-
const acPattern = /acceptance criteria/i;
|
|
344
|
-
const numberedCriteria = content.match(/\d+\.\s+/g) || [];
|
|
345
|
-
const testableLanguage = [
|
|
346
|
-
/should be able to/i,
|
|
347
|
-
/must/i,
|
|
348
|
-
/verify/i,
|
|
349
|
-
/validate/i,
|
|
350
|
-
/ensure/i
|
|
351
|
-
];
|
|
352
|
-
|
|
353
|
-
let score = 0;
|
|
354
|
-
if (acPattern.test(content)) score += 3;
|
|
355
|
-
score += Math.min(4, numberedCriteria.length * 0.5);
|
|
356
|
-
|
|
357
|
-
const testableMatches = testableLanguage.filter(pattern => pattern.test(content)).length;
|
|
358
|
-
score += Math.min(3, testableMatches);
|
|
359
|
-
|
|
360
|
-
return Math.min(10, score);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
async evaluateTechnicalFeasibility(content, metadata) {
|
|
364
|
-
const technicalElements = [
|
|
365
|
-
/implementation/i,
|
|
366
|
-
/technology/i,
|
|
367
|
-
/architecture/i,
|
|
368
|
-
/framework/i,
|
|
369
|
-
/api/i,
|
|
370
|
-
/database/i,
|
|
371
|
-
/scalability/i
|
|
372
|
-
];
|
|
373
|
-
|
|
374
|
-
const matches = technicalElements.filter(pattern => pattern.test(content)).length;
|
|
375
|
-
return Math.min(10, (matches / technicalElements.length) * 12);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
async evaluateBusinessValue(content, metadata) {
|
|
379
|
-
const valueElements = [
|
|
380
|
-
/business.*value/i,
|
|
381
|
-
/roi/i,
|
|
382
|
-
/revenue/i,
|
|
383
|
-
/cost.*savings?/i,
|
|
384
|
-
/efficiency/i,
|
|
385
|
-
/productivity/i,
|
|
386
|
-
/competitive.*advantage/i
|
|
387
|
-
];
|
|
388
|
-
|
|
389
|
-
const matches = valueElements.filter(pattern => pattern.test(content)).length;
|
|
390
|
-
return Math.min(10, (matches / valueElements.length) * 10);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
async evaluateTestability(content, metadata) {
|
|
394
|
-
const testElements = [
|
|
395
|
-
/test/i,
|
|
396
|
-
/validation/i,
|
|
397
|
-
/verification/i,
|
|
398
|
-
/qa/i,
|
|
399
|
-
/quality.*assurance/i,
|
|
400
|
-
/acceptance.*test/i
|
|
401
|
-
];
|
|
402
|
-
|
|
403
|
-
const matches = testElements.filter(pattern => pattern.test(content)).length;
|
|
404
|
-
return Math.min(10, (matches / testElements.length) * 10);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
async evaluateTechnicalAccuracy(content, metadata) {
|
|
408
|
-
// This would need domain-specific validation
|
|
409
|
-
// For now, check for technical terminology consistency
|
|
410
|
-
const score = 7.5; // Default good score
|
|
411
|
-
return score;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
async evaluateImplementationClarity(content, metadata) {
|
|
415
|
-
const clarityElements = [
|
|
416
|
-
/step.*by.*step/i,
|
|
417
|
-
/implementation.*plan/i,
|
|
418
|
-
/detailed.*approach/i,
|
|
419
|
-
/specific.*instructions/i
|
|
420
|
-
];
|
|
421
|
-
|
|
422
|
-
const matches = clarityElements.filter(pattern => pattern.test(content)).length;
|
|
423
|
-
return Math.min(10, 6 + (matches * 1.5));
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
async evaluateArchitecturalSoundness(content, metadata) {
|
|
427
|
-
const architectureElements = [
|
|
428
|
-
/architecture/i,
|
|
429
|
-
/design.*pattern/i,
|
|
430
|
-
/scalability/i,
|
|
431
|
-
/performance/i,
|
|
432
|
-
/security/i,
|
|
433
|
-
/maintainability/i
|
|
434
|
-
];
|
|
435
|
-
|
|
436
|
-
const matches = architectureElements.filter(pattern => pattern.test(content)).length;
|
|
437
|
-
return Math.min(10, (matches / architectureElements.length) * 12);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
async evaluateSecurityConsiderations(content, metadata) {
|
|
441
|
-
const securityElements = [
|
|
442
|
-
/security/i,
|
|
443
|
-
/authentication/i,
|
|
444
|
-
/authorization/i,
|
|
445
|
-
/encryption/i,
|
|
446
|
-
/validation/i,
|
|
447
|
-
/sanitization/i
|
|
448
|
-
];
|
|
449
|
-
|
|
450
|
-
const matches = securityElements.filter(pattern => pattern.test(content)).length;
|
|
451
|
-
return Math.min(10, (matches / securityElements.length) * 10);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
async evaluateScalabilityPlanning(content, metadata) {
|
|
455
|
-
const scalabilityElements = [
|
|
456
|
-
/scalability/i,
|
|
457
|
-
/scale/i,
|
|
458
|
-
/performance/i,
|
|
459
|
-
/load/i,
|
|
460
|
-
/capacity/i
|
|
461
|
-
];
|
|
462
|
-
|
|
463
|
-
const matches = scalabilityElements.filter(pattern => pattern.test(content)).length;
|
|
464
|
-
return Math.min(10, (matches / scalabilityElements.length) * 8);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
async evaluateMessageClarity(content, metadata) {
|
|
468
|
-
const clarityScore = content.length > 100 ?
|
|
469
|
-
Math.min(10, 6 + (content.split('.').length * 0.5)) :
|
|
470
|
-
4;
|
|
471
|
-
return clarityScore;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
async evaluateAudienceAlignment(content, metadata) {
|
|
475
|
-
const audienceElements = [
|
|
476
|
-
/target.*audience/i,
|
|
477
|
-
/customer/i,
|
|
478
|
-
/user/i,
|
|
479
|
-
/persona/i,
|
|
480
|
-
/demographic/i
|
|
481
|
-
];
|
|
482
|
-
|
|
483
|
-
const matches = audienceElements.filter(pattern => pattern.test(content)).length;
|
|
484
|
-
return Math.min(10, 5 + (matches * 1.5));
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
async evaluateBrandConsistency(content, metadata) {
|
|
488
|
-
// Check for brand elements and Irish personality
|
|
489
|
-
const brandElements = [
|
|
490
|
-
/brand/i,
|
|
491
|
-
/identity/i,
|
|
492
|
-
/personality/i,
|
|
493
|
-
/tone/i,
|
|
494
|
-
/voice/i
|
|
495
|
-
];
|
|
496
|
-
|
|
497
|
-
const irishElements = [
|
|
498
|
-
/\b[A-Z]['O][A-Z][a-z]+\b/, // Irish surnames
|
|
499
|
-
/céad míle fáilte/i,
|
|
500
|
-
/sláinte/i,
|
|
501
|
-
/grand/i
|
|
502
|
-
];
|
|
503
|
-
|
|
504
|
-
const brandMatches = brandElements.filter(pattern => pattern.test(content)).length;
|
|
505
|
-
const irishMatches = irishElements.filter(pattern => pattern.test(content)).length;
|
|
506
|
-
|
|
507
|
-
return Math.min(10, 5 + (brandMatches * 1) + (irishMatches * 0.5));
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
async evaluateEngagementPotential(content, metadata) {
|
|
511
|
-
const engagementElements = [
|
|
512
|
-
/engaging/i,
|
|
513
|
-
/compelling/i,
|
|
514
|
-
/interactive/i,
|
|
515
|
-
/call.*to.*action/i,
|
|
516
|
-
/cta/i,
|
|
517
|
-
/\?/g, // Questions
|
|
518
|
-
/!/g // Exclamations
|
|
519
|
-
];
|
|
520
|
-
|
|
521
|
-
let score = 5; // Base score
|
|
522
|
-
engagementElements.forEach(pattern => {
|
|
523
|
-
const matches = (content.match(pattern) || []).length;
|
|
524
|
-
score += Math.min(1, matches * 0.3);
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
return Math.min(10, score);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
async evaluateCallToAction(content, metadata) {
|
|
531
|
-
const ctaElements = [
|
|
532
|
-
/call.*to.*action/i,
|
|
533
|
-
/cta/i,
|
|
534
|
-
/click/i,
|
|
535
|
-
/sign.*up/i,
|
|
536
|
-
/subscribe/i,
|
|
537
|
-
/download/i,
|
|
538
|
-
/contact/i,
|
|
539
|
-
/learn.*more/i
|
|
540
|
-
];
|
|
541
|
-
|
|
542
|
-
const matches = ctaElements.filter(pattern => pattern.test(content)).length;
|
|
543
|
-
return Math.min(10, matches > 0 ? 8 : 4);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
async evaluateDataAccuracy(content, metadata) {
|
|
547
|
-
// Check for data sources and citations
|
|
548
|
-
const dataElements = [
|
|
549
|
-
/source/i,
|
|
550
|
-
/research/i,
|
|
551
|
-
/study/i,
|
|
552
|
-
/survey/i,
|
|
553
|
-
/data/i,
|
|
554
|
-
/statistics?/i,
|
|
555
|
-
/\d+%/g,
|
|
556
|
-
/citation/i
|
|
557
|
-
];
|
|
558
|
-
|
|
559
|
-
const matches = dataElements.filter(pattern => pattern.test(content)).length;
|
|
560
|
-
return Math.min(10, (matches / dataElements.length) * 12);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
async evaluateAnalysisDepth(content, metadata) {
|
|
564
|
-
const depthIndicators = [
|
|
565
|
-
/analysis/i,
|
|
566
|
-
/insight/i,
|
|
567
|
-
/conclusion/i,
|
|
568
|
-
/implications?/i,
|
|
569
|
-
/correlation/i,
|
|
570
|
-
/trend/i,
|
|
571
|
-
/pattern/i
|
|
572
|
-
];
|
|
573
|
-
|
|
574
|
-
const matches = depthIndicators.filter(pattern => pattern.test(content)).length;
|
|
575
|
-
const wordCount = content.split(/\s+/).length;
|
|
576
|
-
|
|
577
|
-
return Math.min(10, ((matches / depthIndicators.length) * 8) + (wordCount > 500 ? 2 : 0));
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
async evaluateInsightQuality(content, metadata) {
|
|
581
|
-
const insightElements = [
|
|
582
|
-
/insight/i,
|
|
583
|
-
/recommendation/i,
|
|
584
|
-
/implication/i,
|
|
585
|
-
/opportunity/i,
|
|
586
|
-
/actionable/i,
|
|
587
|
-
/strategic/i
|
|
588
|
-
];
|
|
589
|
-
|
|
590
|
-
const matches = insightElements.filter(pattern => pattern.test(content)).length;
|
|
591
|
-
return Math.min(10, (matches / insightElements.length) * 10);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
async evaluateSourceCredibility(content, metadata) {
|
|
595
|
-
const credibilityElements = [
|
|
596
|
-
/source/i,
|
|
597
|
-
/reference/i,
|
|
598
|
-
/study/i,
|
|
599
|
-
/research/i,
|
|
600
|
-
/published/i,
|
|
601
|
-
/peer.*review/i
|
|
602
|
-
];
|
|
603
|
-
|
|
604
|
-
const matches = credibilityElements.filter(pattern => pattern.test(content)).length;
|
|
605
|
-
return Math.min(10, 6 + (matches * 0.8));
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
async evaluateActionableFindings(content, metadata) {
|
|
609
|
-
const actionableElements = [
|
|
610
|
-
/recommend/i,
|
|
611
|
-
/suggest/i,
|
|
612
|
-
/action/i,
|
|
613
|
-
/next.*step/i,
|
|
614
|
-
/implement/i,
|
|
615
|
-
/strategy/i
|
|
616
|
-
];
|
|
617
|
-
|
|
618
|
-
const matches = actionableElements.filter(pattern => pattern.test(content)).length;
|
|
619
|
-
return Math.min(10, (matches / actionableElements.length) * 8);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
fallbackEvaluation(content, criterion) {
|
|
623
|
-
// Generic evaluation based on content length and structure
|
|
624
|
-
const wordCount = content.split(/\s+/).length;
|
|
625
|
-
const hasStructure = /##|###|\*\*/.test(content);
|
|
626
|
-
|
|
627
|
-
let score = 5; // Base score
|
|
628
|
-
if (wordCount > 100) score += 1;
|
|
629
|
-
if (wordCount > 300) score += 1;
|
|
630
|
-
if (hasStructure) score += 1;
|
|
631
|
-
|
|
632
|
-
return Math.min(10, score);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
calculateWeightedScore(qualityScores, config) {
|
|
636
|
-
let totalWeightedScore = 0;
|
|
637
|
-
let totalWeight = 0;
|
|
638
|
-
|
|
639
|
-
for (const [criterion, scoreData] of Object.entries(qualityScores)) {
|
|
640
|
-
totalWeightedScore += scoreData.weightedScore;
|
|
641
|
-
totalWeight += scoreData.weight;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
return totalWeightedScore; // Already weighted
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
applyAgentMultiplier(score, agentType) {
|
|
648
|
-
const multiplier = SCORING_CONFIG.AGENT_MULTIPLIERS[agentType] || 1.0;
|
|
649
|
-
return Math.min(10, score * multiplier);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
getQualityBand(score) {
|
|
653
|
-
for (const [band, config] of Object.entries(SCORING_CONFIG.QUALITY_BANDS)) {
|
|
654
|
-
if (score >= config.min) {
|
|
655
|
-
return { band, ...config };
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
return SCORING_CONFIG.QUALITY_BANDS.POOR;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
generateOutputId(metadata) {
|
|
662
|
-
const timestamp = Date.now();
|
|
663
|
-
const agentType = metadata.agentType || 'unknown';
|
|
664
|
-
const hash = Math.random().toString(36).substring(7);
|
|
665
|
-
return `${agentType}-${timestamp}-${hash}`;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
updateAgentTrend(agentType, score) {
|
|
669
|
-
if (!this.trends.has(agentType)) {
|
|
670
|
-
this.trends.set(agentType, {
|
|
671
|
-
scores: [],
|
|
672
|
-
average: 0,
|
|
673
|
-
trend: 'stable',
|
|
674
|
-
lastUpdate: Date.now()
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
const trendData = this.trends.get(agentType);
|
|
679
|
-
trendData.scores.push({ score, timestamp: Date.now() });
|
|
680
|
-
|
|
681
|
-
// Keep only last 20 scores
|
|
682
|
-
if (trendData.scores.length > 20) {
|
|
683
|
-
trendData.scores = trendData.scores.slice(-20);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
// Calculate average
|
|
687
|
-
trendData.average = trendData.scores.reduce((sum, s) => sum + s.score, 0) / trendData.scores.length;
|
|
688
|
-
|
|
689
|
-
// Determine trend
|
|
690
|
-
if (trendData.scores.length >= 5) {
|
|
691
|
-
const recent = trendData.scores.slice(-5).map(s => s.score);
|
|
692
|
-
const older = trendData.scores.slice(-10, -5).map(s => s.score);
|
|
693
|
-
|
|
694
|
-
if (older.length >= 5) {
|
|
695
|
-
const recentAvg = recent.reduce((sum, s) => sum + s, 0) / recent.length;
|
|
696
|
-
const olderAvg = older.reduce((sum, s) => sum + s, 0) / older.length;
|
|
697
|
-
|
|
698
|
-
if (recentAvg > olderAvg + 0.5) {
|
|
699
|
-
trendData.trend = 'improving';
|
|
700
|
-
} else if (recentAvg < olderAvg - 0.5) {
|
|
701
|
-
trendData.trend = 'declining';
|
|
702
|
-
} else {
|
|
703
|
-
trendData.trend = 'stable';
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
trendData.lastUpdate = Date.now();
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
updateQualityTrends() {
|
|
712
|
-
// Periodic trend analysis and alerting
|
|
713
|
-
for (const [agentType, trendData] of this.trends.entries()) {
|
|
714
|
-
if (trendData.trend === 'declining' && trendData.average < 6.0) {
|
|
715
|
-
this.alerts.push({
|
|
716
|
-
type: 'quality_decline',
|
|
717
|
-
agentType,
|
|
718
|
-
average: trendData.average,
|
|
719
|
-
timestamp: new Date().toISOString(),
|
|
720
|
-
message: `Quality declining for ${agentType}: ${trendData.average.toFixed(1)}/10`
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// Keep only recent alerts (last 100)
|
|
726
|
-
if (this.alerts.length > 100) {
|
|
727
|
-
this.alerts = this.alerts.slice(-100);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
checkQualityAlerts(scoreData) {
|
|
732
|
-
const config = SCORING_CONFIG.CONTENT_TYPES[scoreData.contentType];
|
|
733
|
-
|
|
734
|
-
if (scoreData.adjustedScore < config.qualityThreshold) {
|
|
735
|
-
this.alerts.push({
|
|
736
|
-
type: 'quality_threshold',
|
|
737
|
-
outputId: scoreData.outputId,
|
|
738
|
-
agentType: scoreData.agentType,
|
|
739
|
-
score: scoreData.adjustedScore,
|
|
740
|
-
threshold: config.qualityThreshold,
|
|
741
|
-
timestamp: scoreData.timestamp,
|
|
742
|
-
message: `Output below quality threshold: ${scoreData.adjustedScore.toFixed(1)} < ${config.qualityThreshold}`
|
|
743
|
-
});
|
|
744
|
-
|
|
745
|
-
this.emit('alert', this.alerts[this.alerts.length - 1]);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
getScoringSummary() {
|
|
750
|
-
const summary = {
|
|
751
|
-
totalProcessed: this.processedCount,
|
|
752
|
-
averageScore: 0,
|
|
753
|
-
qualityDistribution: {},
|
|
754
|
-
agentPerformance: {},
|
|
755
|
-
recentAlerts: this.alerts.slice(-10),
|
|
756
|
-
uptime: Date.now() - this.startTime
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
if (this.scores.size > 0) {
|
|
760
|
-
const allScores = Array.from(this.scores.values());
|
|
761
|
-
summary.averageScore = allScores.reduce((sum, s) => sum + s.adjustedScore, 0) / allScores.length;
|
|
762
|
-
|
|
763
|
-
// Quality distribution
|
|
764
|
-
for (const band of Object.keys(SCORING_CONFIG.QUALITY_BANDS)) {
|
|
765
|
-
summary.qualityDistribution[band] = 0;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
allScores.forEach(scoreData => {
|
|
769
|
-
summary.qualityDistribution[scoreData.qualityBand.band]++;
|
|
770
|
-
});
|
|
771
|
-
|
|
772
|
-
// Agent performance
|
|
773
|
-
for (const [agentType, trendData] of this.trends.entries()) {
|
|
774
|
-
summary.agentPerformance[agentType] = {
|
|
775
|
-
average: trendData.average,
|
|
776
|
-
trend: trendData.trend,
|
|
777
|
-
scoreCount: trendData.scores.length
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
return summary;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
capitalize(str) {
|
|
786
|
-
return str.charAt(0).toUpperCase() + str.slice(1).replace(/([A-Z])/g, (match, p1, offset) => {
|
|
787
|
-
return offset > 0 ? p1 : p1;
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// Main execution for CLI usage
|
|
793
|
-
async function main() {
|
|
794
|
-
const content = process.argv[2];
|
|
795
|
-
const agentType = process.argv[3];
|
|
796
|
-
const contentType = process.argv[4];
|
|
797
|
-
|
|
798
|
-
if (!content) {
|
|
799
|
-
console.error('Usage: quality-scoring-engine.js <content> [agent_type] [content_type]');
|
|
800
|
-
process.exit(1);
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
try {
|
|
804
|
-
const engine = new QualityScoringEngine();
|
|
805
|
-
const metadata = { agentType, contentType };
|
|
806
|
-
const result = await engine.scoreOutput(content, metadata);
|
|
807
|
-
|
|
808
|
-
console.log(`SCORE: ${result.adjustedScore.toFixed(1)}`);
|
|
809
|
-
console.log(`QUALITY_BAND: ${result.qualityBand.label}`);
|
|
810
|
-
console.log(`CONTENT_TYPE: ${result.contentType}`);
|
|
811
|
-
console.log(`AGENT_TYPE: ${result.agentType || 'unknown'}`);
|
|
812
|
-
|
|
813
|
-
// Output detailed scores
|
|
814
|
-
for (const [criterion, scoreData] of Object.entries(result.qualityScores)) {
|
|
815
|
-
console.log(`${criterion.toUpperCase()}: ${scoreData.score.toFixed(1)} (weight: ${scoreData.weight})`);
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
process.exit(0);
|
|
819
|
-
|
|
820
|
-
} catch (error) {
|
|
821
|
-
console.error('SCORING_ERROR:', error.message);
|
|
822
|
-
process.exit(1);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
// Check if this is the main module
|
|
827
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
828
|
-
main().catch(error => {
|
|
829
|
-
console.error('FATAL_ERROR:', error.message);
|
|
830
|
-
process.exit(1);
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
export default QualityScoringEngine;
|