oneie 3.4.2 → 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.
Files changed (143) hide show
  1. package/.claude/agents/agent-director.md +902 -22
  2. package/.claude/agents/agent-onboard-example-output.md +600 -0
  3. package/.claude/agents/agent-onboard.md +576 -0
  4. package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
  5. package/.claude/commands/one.md +411 -10
  6. package/.claude/commands/release.md +64 -3
  7. package/CLAUDE.md +55 -69
  8. package/dist/commands/init.d.ts +5 -6
  9. package/dist/commands/init.d.ts.map +1 -1
  10. package/dist/commands/init.js +101 -101
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/index.js +6 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/utils/installation-setup.d.ts +24 -1
  15. package/dist/utils/installation-setup.d.ts.map +1 -1
  16. package/dist/utils/installation-setup.js +85 -1
  17. package/dist/utils/installation-setup.js.map +1 -1
  18. package/dist/utils/launch-claude.d.ts +6 -0
  19. package/dist/utils/launch-claude.d.ts.map +1 -0
  20. package/dist/utils/launch-claude.js +51 -0
  21. package/dist/utils/launch-claude.js.map +1 -0
  22. package/dist/utils/validation.d.ts +48 -0
  23. package/dist/utils/validation.d.ts.map +1 -0
  24. package/dist/utils/validation.js +73 -0
  25. package/dist/utils/validation.js.map +1 -0
  26. package/folders.yaml +1 -1
  27. package/one/.obsidian/app.json +8 -0
  28. package/one/.obsidian/appearance.json +1 -0
  29. package/one/.obsidian/community-plugins.json +3 -0
  30. package/one/.obsidian/core-plugins.json +33 -0
  31. package/one/.obsidian/plugins/easy-bake/main.js +361 -0
  32. package/one/.obsidian/plugins/easy-bake/manifest.json +11 -0
  33. package/one/.obsidian/plugins/easy-bake/styles.css +10 -0
  34. package/one/.obsidian/workspace.json +240 -0
  35. package/one/connections/workflow-onboarding.md +683 -0
  36. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
  37. package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
  38. package/one/events/DEPLOYMENT.md +178 -0
  39. package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
  40. package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
  41. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
  42. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
  43. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
  44. package/one/events/HANDOFF.md +313 -0
  45. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
  46. package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
  47. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
  48. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
  49. package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
  50. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
  51. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
  52. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
  53. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
  54. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
  55. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
  56. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
  57. package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
  58. package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
  59. package/one/events/SHOP-BUILD-STATUS.md +114 -0
  60. package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
  61. package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
  62. package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
  63. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
  64. package/one/events/agent-director-enhancement-summary.md +386 -0
  65. package/one/events/agent-onboard-implementation-summary.md +457 -0
  66. package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
  67. package/one/events/landing-page-generator.md +458 -0
  68. package/one/events/onboarding-implementation-complete.md +505 -0
  69. package/one/events/release.md +254 -0
  70. package/one/events/separate-implementation-status.md +537 -0
  71. package/one/groups/nine-padle-contents.baked.md +1252 -0
  72. package/one/groups/nine-padle-contents.md +6 -0
  73. package/one/knowledge/100-inference-quick-reference.md +431 -0
  74. package/one/knowledge/agent-onboard-usage.md +612 -0
  75. package/one/knowledge/cli-claude-handoff.md +718 -0
  76. package/one/knowledge/installation-folders.md +45 -1
  77. package/one/knowledge/ontology-blog.yaml +31 -0
  78. package/one/knowledge/ontology-cheatsheet.md +591 -0
  79. package/one/knowledge/ontology-community.yaml +42 -0
  80. package/one/knowledge/ontology-core-universal.md +722 -0
  81. package/one/knowledge/ontology-core.yaml +50 -0
  82. package/one/knowledge/ontology-courses.yaml +53 -0
  83. package/one/knowledge/ontology-creator.md +376 -0
  84. package/one/knowledge/ontology-developer-guide.md +789 -0
  85. package/one/knowledge/ontology-education.md +920 -0
  86. package/one/knowledge/ontology-index.md +354 -0
  87. package/one/knowledge/ontology-migration-guide.md +811 -0
  88. package/one/knowledge/ontology-minimal.yaml +1 -1
  89. package/one/knowledge/ontology-portfolio.yaml +31 -0
  90. package/one/knowledge/ontology-quickstart.md +576 -0
  91. package/one/knowledge/ontology-shop.yaml +121 -0
  92. package/one/knowledge/ontology-tokens.yaml +32 -0
  93. package/one/knowledge/ontology-tutorial.md +434 -0
  94. package/one/knowledge/ontology-video-script.md +890 -0
  95. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
  96. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
  97. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
  98. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
  99. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
  100. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
  101. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
  102. package/one/things/docs/ecommerce/QUICK-START.md +368 -0
  103. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
  104. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
  105. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
  106. package/one/things/docs/ecommerce/demo.astro +309 -0
  107. package/one/things/plans/agent-director-100-inference-plans.md +410 -0
  108. package/one/things/plans/dual-website-strategy.md +612 -0
  109. package/one/things/plans/feature-based-sites.md +821 -0
  110. package/one/things/plans/multi-ontology-architecture.md +836 -0
  111. package/one/things/plans/onboarding.md +32 -0
  112. package/one/things/plans/separate.md +15 -17
  113. package/one/things/plans/start-new.md +738 -0
  114. package/one/things/templates.md +254 -0
  115. package/one/things/todo.md +23 -5
  116. package/package.json +2 -2
  117. package/one/things/claude/hooks/agent-hook-manager.js +0 -525
  118. package/one/things/claude/hooks/agent-load-balancer.js +0 -271
  119. package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
  120. package/one/things/claude/hooks/cascade-feedback.js +0 -297
  121. package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
  122. package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
  123. package/one/things/claude/hooks/file-organization-engine.js +0 -427
  124. package/one/things/claude/hooks/file-organization-monitor.js +0 -269
  125. package/one/things/claude/hooks/hook-config-manager.js +0 -202
  126. package/one/things/claude/hooks/hook-orchestrator.js +0 -662
  127. package/one/things/claude/hooks/hook-performance-report.js +0 -120
  128. package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
  129. package/one/things/claude/hooks/memory-optimizer.js +0 -510
  130. package/one/things/claude/hooks/ontology-compliance.js +0 -394
  131. package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
  132. package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
  133. package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
  134. package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
  135. package/one/things/claude/hooks/simple-load-balancer.js +0 -238
  136. package/one/things/claude/hooks/startup-optimizer.js +0 -625
  137. package/one/things/claude/hooks/story-scoring-system.js +0 -445
  138. package/one/things/claude/hooks/story-validation-engine.js +0 -473
  139. package/one/things/claude/hooks/structure-synchronizer.js +0 -194
  140. package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
  141. package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
  142. package/one/things/claude/hooks/trinity-validation-system.js +0 -392
  143. package/one/things/plans/organizations-to-groups.md +0 -705
@@ -1,647 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Sub-Agent Output Validation System
5
- * Implements agent-specific validation with R.O.C.K.E.T. framework integration
6
- * Validates outputs from Claude Code sub-agents based on agent type and specialization
7
- */
8
-
9
- import fs from 'fs';
10
- import path from 'path';
11
-
12
- // Agent-specific validation configurations
13
- const AGENT_CONFIGS = {
14
- // Marketing Team Agents
15
- 'marketing-director': {
16
- framework: 'strategic-marketing',
17
- requiredElements: ['strategy', 'objectives', 'metrics'],
18
- qualityGate: 7.5,
19
- validationRules: {
20
- strategyDepth: { weight: 0.3, threshold: 0.7 },
21
- objectiveClarity: { weight: 0.25, threshold: 0.8 },
22
- metricsAlignment: { weight: 0.25, threshold: 0.7 },
23
- irishPersonality: { weight: 0.2, threshold: 0.6 }
24
- }
25
- },
26
- 'marketing-content-hooks': {
27
- framework: 'content-quality',
28
- requiredElements: ['hook', 'value-proposition', 'cta'],
29
- qualityGate: 7.0,
30
- validationRules: {
31
- hookEffectiveness: { weight: 0.4, threshold: 0.8 },
32
- valueClarity: { weight: 0.3, threshold: 0.7 },
33
- ctaStrength: { weight: 0.2, threshold: 0.7 },
34
- irishPersonality: { weight: 0.1, threshold: 0.6 }
35
- }
36
- },
37
- 'marketing-viral-growth': {
38
- framework: 'viral-mechanics',
39
- requiredElements: ['k-factor', 'sharing-mechanics', 'network-effects'],
40
- qualityGate: 8.0,
41
- validationRules: {
42
- viralPotential: { weight: 0.4, threshold: 0.8 },
43
- networkAnalysis: { weight: 0.3, threshold: 0.7 },
44
- sharingOptimization: { weight: 0.2, threshold: 0.7 },
45
- irishPersonality: { weight: 0.1, threshold: 0.6 }
46
- }
47
- },
48
-
49
- // Engineering Team Agents
50
- 'engineering-director': {
51
- framework: 'technical-architecture',
52
- requiredElements: ['architecture', 'implementation', 'quality-gates'],
53
- qualityGate: 8.0,
54
- validationRules: {
55
- architecturalSoundness: { weight: 0.4, threshold: 0.8 },
56
- implementationClarity: { weight: 0.3, threshold: 0.8 },
57
- qualityStandards: { weight: 0.2, threshold: 0.7 },
58
- irishPersonality: { weight: 0.1, threshold: 0.6 }
59
- }
60
- },
61
- 'engineering-developer': {
62
- framework: 'code-quality',
63
- requiredElements: ['implementation', 'testing', 'documentation'],
64
- qualityGate: 7.5,
65
- validationRules: {
66
- codeQuality: { weight: 0.4, threshold: 0.8 },
67
- testCoverage: { weight: 0.3, threshold: 0.7 },
68
- documentation: { weight: 0.2, threshold: 0.7 },
69
- irishPersonality: { weight: 0.1, threshold: 0.6 }
70
- }
71
- },
72
-
73
- // Content Team Agents
74
- 'content-playbook-writer': {
75
- framework: 'content-depth',
76
- requiredElements: ['structure', 'actionable-content', 'examples'],
77
- qualityGate: 7.5,
78
- validationRules: {
79
- contentDepth: { weight: 0.4, threshold: 0.8 },
80
- actionability: { weight: 0.3, threshold: 0.8 },
81
- exampleQuality: { weight: 0.2, threshold: 0.7 },
82
- irishPersonality: { weight: 0.1, threshold: 0.6 }
83
- }
84
- },
85
-
86
- // Research Team Agents
87
- 'research-market-analyst': {
88
- framework: 'research-rigor',
89
- requiredElements: ['data-sources', 'analysis', 'insights'],
90
- qualityGate: 8.0,
91
- validationRules: {
92
- dataQuality: { weight: 0.4, threshold: 0.8 },
93
- analysisDepth: { weight: 0.3, threshold: 0.8 },
94
- insightValue: { weight: 0.2, threshold: 0.7 },
95
- irishPersonality: { weight: 0.1, threshold: 0.6 }
96
- }
97
- },
98
-
99
- // Crypto Domain Agents
100
- 'crypto-community-analyst': {
101
- framework: 'crypto-community',
102
- requiredElements: ['community-metrics', 'sentiment-analysis', 'growth-patterns'],
103
- qualityGate: 7.5,
104
- validationRules: {
105
- communityInsight: { weight: 0.4, threshold: 0.8 },
106
- sentimentAccuracy: { weight: 0.3, threshold: 0.7 },
107
- growthAnalysis: { weight: 0.2, threshold: 0.7 },
108
- irishPersonality: { weight: 0.1, threshold: 0.6 }
109
- }
110
- }
111
- };
112
-
113
- // R.O.C.K.E.T. Framework Components
114
- const ROCKET_FRAMEWORK = {
115
- Role: {
116
- weight: 0.2,
117
- validators: [
118
- 'validateAgentIdentity',
119
- 'validateExpertiseAlignment',
120
- 'validatePersonalityIntegration'
121
- ]
122
- },
123
- Objective: {
124
- weight: 0.2,
125
- validators: [
126
- 'validateObjectiveClarity',
127
- 'validateGoalAlignment',
128
- 'validateOutcomeDefinition'
129
- ]
130
- },
131
- Context: {
132
- weight: 0.15,
133
- validators: [
134
- 'validateContextAwareness',
135
- 'validateInformationUsage',
136
- 'validateRelevance'
137
- ]
138
- },
139
- KeyInstructions: {
140
- weight: 0.2,
141
- validators: [
142
- 'validateInstructionCompliance',
143
- 'validateRequirementFulfillment',
144
- 'validateStandardsAdherence'
145
- ]
146
- },
147
- Examples: {
148
- weight: 0.15,
149
- validators: [
150
- 'validateExampleQuality',
151
- 'validateBenchmarking',
152
- 'validateBestPractices'
153
- ]
154
- },
155
- Tone: {
156
- weight: 0.1,
157
- validators: [
158
- 'validateTonalConsistency',
159
- 'validateProfessionalism',
160
- 'validateIrishPersonality'
161
- ]
162
- }
163
- };
164
-
165
- class SubAgentOutputValidator {
166
- constructor() {
167
- this.validationResults = {
168
- score: 0,
169
- status: 'PENDING',
170
- agentType: null,
171
- rocketScore: {},
172
- issues: {
173
- critical: [],
174
- shouldFix: [],
175
- niceToHave: []
176
- },
177
- recommendations: []
178
- };
179
- }
180
-
181
- async validateOutput(outputContent, agentType, context = {}) {
182
- try {
183
- this.validationResults.agentType = agentType;
184
-
185
- // Get agent-specific configuration
186
- const config = AGENT_CONFIGS[agentType] || this.getDefaultConfig();
187
-
188
- // Execute R.O.C.K.E.T. framework validation
189
- await this.executeRocketValidation(outputContent, config, context);
190
-
191
- // Execute agent-specific validation
192
- await this.executeAgentSpecificValidation(outputContent, config, context);
193
-
194
- // Calculate final score and status
195
- this.calculateFinalScore(config);
196
-
197
- return this.validationResults;
198
- } catch (error) {
199
- return this.generateErrorResult(error);
200
- }
201
- }
202
-
203
- getDefaultConfig() {
204
- return {
205
- framework: 'general-quality',
206
- requiredElements: ['content', 'structure', 'quality'],
207
- qualityGate: 7.0,
208
- validationRules: {
209
- contentQuality: { weight: 0.4, threshold: 0.7 },
210
- structureClarity: { weight: 0.3, threshold: 0.7 },
211
- valueDelivery: { weight: 0.2, threshold: 0.6 },
212
- irishPersonality: { weight: 0.1, threshold: 0.6 }
213
- }
214
- };
215
- }
216
-
217
- async executeRocketValidation(content, config, context) {
218
- for (const [component, settings] of Object.entries(ROCKET_FRAMEWORK)) {
219
- let componentScore = 0;
220
- const componentIssues = [];
221
-
222
- for (const validator of settings.validators) {
223
- try {
224
- const result = await this[validator](content, config, context);
225
- componentScore += result.score;
226
- if (result.issues) {
227
- componentIssues.push(...result.issues);
228
- }
229
- } catch (error) {
230
- componentIssues.push(`${validator} failed: ${error.message}`);
231
- }
232
- }
233
-
234
- // Average score for component
235
- componentScore = componentScore / settings.validators.length;
236
- this.validationResults.rocketScore[component] = {
237
- score: componentScore,
238
- weight: settings.weight,
239
- issues: componentIssues
240
- };
241
-
242
- // Add issues to appropriate categories
243
- if (componentScore < 0.6) {
244
- this.validationResults.issues.critical.push(`${component}: Below minimum quality threshold`);
245
- } else if (componentScore < 0.7) {
246
- this.validationResults.issues.shouldFix.push(`${component}: Could be improved`);
247
- } else if (componentScore < 0.8) {
248
- this.validationResults.issues.niceToHave.push(`${component}: Minor optimization opportunity`);
249
- }
250
- }
251
- }
252
-
253
- async executeAgentSpecificValidation(content, config, context) {
254
- // Validate required elements are present
255
- const missingElements = [];
256
- for (const element of config.requiredElements) {
257
- if (!this.elementPresent(content, element)) {
258
- missingElements.push(element);
259
- }
260
- }
261
-
262
- if (missingElements.length > 0) {
263
- this.validationResults.issues.critical.push(`Missing required elements: ${missingElements.join(', ')}`);
264
- }
265
-
266
- // Execute agent-specific validation rules
267
- for (const [rule, settings] of Object.entries(config.validationRules)) {
268
- const result = await this.executeValidationRule(content, rule, settings, context);
269
- if (result.score < settings.threshold) {
270
- const severity = result.score < 0.5 ? 'critical' : result.score < 0.7 ? 'shouldFix' : 'niceToHave';
271
- this.validationResults.issues[severity].push(`${rule}: ${result.message || 'Below threshold'}`);
272
- }
273
- }
274
- }
275
-
276
- async executeValidationRule(content, rule, settings, context) {
277
- // Default implementation - can be overridden for specific rules
278
- const methodName = `validate${rule.charAt(0).toUpperCase() + rule.slice(1)}`;
279
-
280
- if (typeof this[methodName] === 'function') {
281
- return await this[methodName](content, settings, context);
282
- }
283
-
284
- // Fallback validation based on keywords and patterns
285
- return this.fallbackValidation(content, rule, settings);
286
- }
287
-
288
- elementPresent(content, element) {
289
- const patterns = {
290
- 'strategy': /strategy|strategic|approach|plan/i,
291
- 'objectives': /objective|goal|target|aim/i,
292
- 'metrics': /metric|measure|kpi|analytics/i,
293
- 'hook': /hook|headline|attention|opening/i,
294
- 'value-proposition': /value|benefit|advantage|proposition/i,
295
- 'cta': /call.to.action|cta|click|action/i,
296
- 'k-factor': /k.factor|viral|coefficient|sharing/i,
297
- 'sharing-mechanics': /share|sharing|viral|spread/i,
298
- 'network-effects': /network|viral|exponential|growth/i,
299
- 'architecture': /architecture|design|structure|system/i,
300
- 'implementation': /implement|code|build|develop/i,
301
- 'quality-gates': /quality|standard|gate|check/i,
302
- 'testing': /test|testing|qa|validation/i,
303
- 'documentation': /document|documentation|readme|guide/i,
304
- 'structure': /structure|organization|layout|format/i,
305
- 'actionable-content': /actionable|practical|step|action/i,
306
- 'examples': /example|sample|case.study|demo/i,
307
- 'data-sources': /data|source|research|study/i,
308
- 'analysis': /analysis|analyze|evaluation|assessment/i,
309
- 'insights': /insight|finding|conclusion|recommendation/i,
310
- 'community-metrics': /community|member|engagement|activity/i,
311
- 'sentiment-analysis': /sentiment|mood|opinion|feeling/i,
312
- 'growth-patterns': /growth|pattern|trend|trajectory/i
313
- };
314
-
315
- const pattern = patterns[element] || new RegExp(element.replace(/-/g, '\\s+'), 'i');
316
- return pattern.test(content);
317
- }
318
-
319
- // R.O.C.K.E.T. Framework Validators
320
- async validateAgentIdentity(content, config, context) {
321
- const irishNamePattern = /\b[A-Z][a-z]+\s+[A-Z]['a-zA-Z]+\b/;
322
- const agentIntroPattern = /I'm\s+\w+.*specialist|expert|manager/i;
323
-
324
- let score = 0;
325
- const issues = [];
326
-
327
- if (irishNamePattern.test(content)) score += 0.4;
328
- else issues.push('Irish name not clearly present');
329
-
330
- if (agentIntroPattern.test(content)) score += 0.4;
331
- else issues.push('Agent introduction not clear');
332
-
333
- if (/\byears?\b.*experience/i.test(content)) score += 0.2;
334
- else issues.push('Experience not mentioned');
335
-
336
- return { score, issues };
337
- }
338
-
339
- async validateExpertiseAlignment(content, config, context) {
340
- const expertiseKeywords = this.getExpertiseKeywords(config.framework);
341
- let matchCount = 0;
342
-
343
- for (const keyword of expertiseKeywords) {
344
- if (new RegExp(keyword, 'i').test(content)) {
345
- matchCount++;
346
- }
347
- }
348
-
349
- const score = Math.min(1.0, matchCount / expertiseKeywords.length * 1.5);
350
- const issues = score < 0.7 ? ['Expertise alignment could be stronger'] : [];
351
-
352
- return { score, issues };
353
- }
354
-
355
- async validatePersonalityIntegration(content, config, context) {
356
- const irishElements = [
357
- /\b(sláinte|céad míle fáilte|craic|grand|fair play)\b/i,
358
- /\b[A-Z]['O][A-Z][a-z]+\b/, // Irish surnames
359
- /\"[^"]*\"/ // Irish sayings in quotes
360
- ];
361
-
362
- let score = 0;
363
- const issues = [];
364
-
365
- // Check for Irish cultural elements
366
- const irishMatches = irishElements.filter(pattern => pattern.test(content)).length;
367
- score += Math.min(0.5, irishMatches * 0.2);
368
-
369
- // Check for professional balance
370
- if (/professional|expertise|experience/i.test(content)) {
371
- score += 0.3;
372
- } else {
373
- issues.push('Professional credibility needs emphasis');
374
- }
375
-
376
- // Check for warmth and approachability
377
- if (/ready|help|guide|support/i.test(content)) {
378
- score += 0.2;
379
- }
380
-
381
- return { score, issues };
382
- }
383
-
384
- async validateObjectiveClarity(content, config, context) {
385
- const objectivePatterns = [
386
- /objective|goal|aim|purpose/i,
387
- /achieve|accomplish|deliver|create/i,
388
- /outcome|result|success|impact/i
389
- ];
390
-
391
- const matches = objectivePatterns.filter(pattern => pattern.test(content)).length;
392
- const score = Math.min(1.0, matches / objectivePatterns.length * 1.2);
393
-
394
- const issues = score < 0.7 ? ['Objective clarity needs improvement'] : [];
395
- return { score, issues };
396
- }
397
-
398
- async validateGoalAlignment(content, config, context) {
399
- // Check if content aligns with stated goals
400
- const score = 0.8; // Default high score - override in specific implementations
401
- return { score, issues: [] };
402
- }
403
-
404
- async validateOutcomeDefinition(content, config, context) {
405
- const outcomePatterns = [
406
- /measure|metric|kpi/i,
407
- /success|achievement|completion/i,
408
- /deliverable|output|result/i
409
- ];
410
-
411
- const matches = outcomePatterns.filter(pattern => pattern.test(content)).length;
412
- const score = Math.min(1.0, matches / outcomePatterns.length);
413
-
414
- return { score, issues: [] };
415
- }
416
-
417
- async validateContextAwareness(content, config, context) {
418
- // Check if content shows awareness of provided context
419
- const contextElements = Object.keys(context).length;
420
- const score = contextElements > 0 ? 0.8 : 0.6;
421
-
422
- return { score, issues: contextElements === 0 ? ['Limited context utilization'] : [] };
423
- }
424
-
425
- async validateInformationUsage(content, config, context) {
426
- // Check if available information is properly utilized
427
- const score = 0.7; // Default score
428
- return { score, issues: [] };
429
- }
430
-
431
- async validateRelevance(content, config, context) {
432
- // Check content relevance to the task
433
- const score = 0.8; // Default high relevance
434
- return { score, issues: [] };
435
- }
436
-
437
- async validateInstructionCompliance(content, config, context) {
438
- // Check compliance with key instructions
439
- const complianceScore = this.checkInstructionCompliance(content, config);
440
- return { score: complianceScore, issues: complianceScore < 0.7 ? ['Instruction compliance needs improvement'] : [] };
441
- }
442
-
443
- async validateRequirementFulfillment(content, config, context) {
444
- const fulfilledElements = config.requiredElements.filter(element =>
445
- this.elementPresent(content, element)
446
- ).length;
447
-
448
- const score = fulfilledElements / config.requiredElements.length;
449
- const issues = score < 0.8 ? ['Some requirements not fully addressed'] : [];
450
-
451
- return { score, issues };
452
- }
453
-
454
- async validateStandardsAdherence(content, config, context) {
455
- // Check adherence to quality standards
456
- const score = 0.75; // Default score
457
- return { score, issues: [] };
458
- }
459
-
460
- async validateExampleQuality(content, config, context) {
461
- const examplePatterns = [
462
- /example|for instance|such as/i,
463
- /case study|use case|scenario/i,
464
- /demo|demonstration|illustration/i
465
- ];
466
-
467
- const matches = examplePatterns.filter(pattern => pattern.test(content)).length;
468
- const score = Math.min(1.0, matches * 0.3);
469
-
470
- return { score, issues: score < 0.5 ? ['More examples would improve clarity'] : [] };
471
- }
472
-
473
- async validateBenchmarking(content, config, context) {
474
- // Check for benchmarking against best practices
475
- const score = /best practice|benchmark|standard|industry/i.test(content) ? 0.8 : 0.5;
476
- return { score, issues: [] };
477
- }
478
-
479
- async validateBestPractices(content, config, context) {
480
- // Validate incorporation of best practices
481
- const score = 0.7; // Default score
482
- return { score, issues: [] };
483
- }
484
-
485
- async validateTonalConsistency(content, config, context) {
486
- // Check consistency of tone throughout content
487
- const score = 0.8; // Default high consistency
488
- return { score, issues: [] };
489
- }
490
-
491
- async validateProfessionalism(content, config, context) {
492
- const professionalElements = [
493
- /expertise|experience|professional/i,
494
- /strategy|approach|methodology/i,
495
- /quality|excellence|standard/i
496
- ];
497
-
498
- const matches = professionalElements.filter(pattern => pattern.test(content)).length;
499
- const score = Math.min(1.0, matches / professionalElements.length);
500
-
501
- return { score, issues: score < 0.7 ? ['Professional tone could be enhanced'] : [] };
502
- }
503
-
504
- async validateIrishPersonality(content, config, context) {
505
- // Check for appropriate Irish personality integration
506
- const irishElementsScore = await this.validatePersonalityIntegration(content, config, context);
507
- return irishElementsScore;
508
- }
509
-
510
- getExpertiseKeywords(framework) {
511
- const keywordMap = {
512
- 'strategic-marketing': ['strategy', 'marketing', 'brand', 'campaign', 'growth', 'metrics'],
513
- 'content-quality': ['content', 'engagement', 'hooks', 'value', 'conversion', 'audience'],
514
- 'viral-mechanics': ['viral', 'k-factor', 'sharing', 'network', 'exponential', 'growth'],
515
- 'technical-architecture': ['architecture', 'system', 'design', 'scalability', 'performance'],
516
- 'code-quality': ['code', 'development', 'testing', 'standards', 'best practices'],
517
- 'content-depth': ['content', 'structure', 'actionable', 'comprehensive', 'value'],
518
- 'research-rigor': ['research', 'data', 'analysis', 'insights', 'methodology'],
519
- 'crypto-community': ['community', 'crypto', 'blockchain', 'sentiment', 'engagement']
520
- };
521
-
522
- return keywordMap[framework] || ['quality', 'expertise', 'professional', 'excellence'];
523
- }
524
-
525
- checkInstructionCompliance(content, config) {
526
- // Basic compliance check - can be enhanced for specific instructions
527
- const hasStructure = /##|###|\*\*/.test(content);
528
- const hasContent = content.length > 100;
529
- const hasConclusion = /ready|available|help|support/i.test(content);
530
-
531
- let score = 0;
532
- if (hasStructure) score += 0.4;
533
- if (hasContent) score += 0.4;
534
- if (hasConclusion) score += 0.2;
535
-
536
- return score;
537
- }
538
-
539
- fallbackValidation(content, rule, settings) {
540
- // Fallback validation for unimplemented specific rules
541
- const score = content.length > 50 ? 0.6 : 0.3;
542
- return {
543
- score,
544
- message: `${rule} validation needs specific implementation`
545
- };
546
- }
547
-
548
- calculateFinalScore(config) {
549
- let totalScore = 0;
550
- let totalWeight = 0;
551
-
552
- // Calculate weighted R.O.C.K.E.T. score
553
- for (const [component, result] of Object.entries(this.validationResults.rocketScore)) {
554
- totalScore += result.score * result.weight;
555
- totalWeight += result.weight;
556
- }
557
-
558
- // Normalize to 10-point scale
559
- const finalScore = (totalScore / totalWeight) * 10;
560
-
561
- this.validationResults.score = Math.min(10, Math.max(0, finalScore));
562
- this.validationResults.status = this.validationResults.score >= config.qualityGate ? 'PASS' : 'FAIL';
563
-
564
- // Generate recommendations
565
- this.generateRecommendations(config);
566
- }
567
-
568
- generateRecommendations(config) {
569
- const recommendations = [];
570
-
571
- if (this.validationResults.score < config.qualityGate) {
572
- recommendations.push(`Score ${this.validationResults.score.toFixed(1)} is below quality gate ${config.qualityGate}`);
573
- }
574
-
575
- // Add component-specific recommendations
576
- for (const [component, result] of Object.entries(this.validationResults.rocketScore)) {
577
- if (result.score < 0.7) {
578
- recommendations.push(`Improve ${component}: ${result.issues.join(', ')}`);
579
- }
580
- }
581
-
582
- this.validationResults.recommendations = recommendations;
583
- }
584
-
585
- generateErrorResult(error) {
586
- return {
587
- score: 0,
588
- status: 'ERROR',
589
- agentType: null,
590
- error: error.message,
591
- issues: {
592
- critical: [error.message],
593
- shouldFix: [],
594
- niceToHave: []
595
- },
596
- recommendations: ['Fix validation error and retry']
597
- };
598
- }
599
- }
600
-
601
- // Main execution for CLI usage
602
- async function main() {
603
- const outputContent = process.argv[2];
604
- const agentType = process.argv[3];
605
- const contextStr = process.argv[4] || '{}';
606
-
607
- if (!outputContent || !agentType) {
608
- console.error('Usage: sub-agent-output-validator.js <output_content> <agent_type> [context_json]');
609
- process.exit(1);
610
- }
611
-
612
- try {
613
- const context = JSON.parse(contextStr);
614
- const validator = new SubAgentOutputValidator();
615
- const result = await validator.validateOutput(outputContent, agentType, context);
616
-
617
- // Output results
618
- console.log(`SCORE: ${result.score.toFixed(1)}`);
619
- console.log(`STATUS: ${result.status}`);
620
- console.log(`AGENT_TYPE: ${result.agentType}`);
621
-
622
- if (result.issues.critical.length > 0) {
623
- console.log(`CRITICAL: ${result.issues.critical.join('; ')}`);
624
- }
625
- if (result.issues.shouldFix.length > 0) {
626
- console.log(`SHOULD_FIX: ${result.issues.shouldFix.join('; ')}`);
627
- }
628
- if (result.recommendations.length > 0) {
629
- console.log(`RECOMMENDATIONS: ${result.recommendations.join('; ')}`);
630
- }
631
-
632
- process.exit(result.status === 'PASS' ? 0 : 1);
633
- } catch (error) {
634
- console.error('VALIDATION_ERROR:', error.message);
635
- process.exit(1);
636
- }
637
- }
638
-
639
- // Check if this is the main module
640
- if (import.meta.url === `file://${process.argv[1]}`) {
641
- main().catch(error => {
642
- console.error('FATAL_ERROR:', error.message);
643
- process.exit(1);
644
- });
645
- }
646
-
647
- export default SubAgentOutputValidator;