0xray 2.1.2 → 2.1.4

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 (250) hide show
  1. package/.opencode/codex.codex +1 -1
  2. package/.opencode/commands/dependency-audit.md +3 -3
  3. package/.opencode/enforcer-config.json +2 -2
  4. package/AGENTS.md +2 -1
  5. package/README.md +12 -11
  6. package/dist/AGENTS.md +2 -1
  7. package/dist/CHANGELOG.md +38 -0
  8. package/dist/README.md +12 -11
  9. package/dist/agents/code-reviewer.js +1 -1
  10. package/dist/analytics/routing-refiner.js +1 -1
  11. package/dist/cli/index.js +11 -1
  12. package/dist/cli/server.js +3 -3
  13. package/dist/core/activity-logger.d.ts +2 -2
  14. package/dist/core/activity-logger.js +4 -4
  15. package/dist/core/boot-orchestrator.d.ts +1 -1
  16. package/dist/core/boot-orchestrator.js +13 -28
  17. package/dist/core/bridge.mjs +3 -3
  18. package/dist/core/codex-formatter.js +2 -2
  19. package/dist/core/codex-injector.d.ts +0 -1
  20. package/dist/core/codex-injector.js +2 -3
  21. package/dist/core/config-loader.d.ts +1 -1
  22. package/dist/core/config-loader.js +1 -1
  23. package/dist/core/config-paths.d.ts +0 -2
  24. package/dist/core/config-paths.js +7 -8
  25. package/dist/core/context-loader.d.ts +1 -1
  26. package/dist/core/context-loader.js +1 -1
  27. package/dist/core/errors.d.ts +3 -0
  28. package/dist/core/errors.js +10 -0
  29. package/dist/core/features-config.js +1 -1
  30. package/dist/core/framework-logger.d.ts +3 -3
  31. package/dist/core/framework-logger.js +17 -9
  32. package/dist/core/index.d.ts +2 -2
  33. package/dist/core/index.js +4 -2
  34. package/dist/core/logging-config.d.ts +2 -1
  35. package/dist/core/logging-config.js +7 -7
  36. package/dist/enforcement/loaders/codex-loader.js +1 -1
  37. package/dist/execution/opencode-cli-invoker.js +5 -5
  38. package/dist/governance/governance-service.js +1 -1
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +3 -3
  41. package/dist/inference/inference-cycle.d.ts +1 -1
  42. package/dist/inference/inference-cycle.js +10 -10
  43. package/dist/integrations/base/Integration.js +1 -1
  44. package/dist/integrations/base/registry.js +19 -19
  45. package/dist/integrations/grok/grok-cli.js +17 -17
  46. package/dist/integrations/grok/hooks/pre-tool-use.js +1 -1
  47. package/dist/integrations/hermes-agent/bridge.mjs +1 -1
  48. package/dist/integrations/openclaw/api-server.d.ts +0 -1
  49. package/dist/integrations/openclaw/api-server.js +7 -10
  50. package/dist/integrations/openclaw/client.d.ts +0 -1
  51. package/dist/integrations/openclaw/client.js +22 -24
  52. package/dist/integrations/openclaw/hooks/xray-hooks.d.ts +0 -1
  53. package/dist/integrations/openclaw/hooks/xray-hooks.js +17 -18
  54. package/dist/integrations/plugins/plugin-registry.js +5 -5
  55. package/dist/mcps/architect-tools.server.d.ts +2 -4
  56. package/dist/mcps/architect-tools.server.js +112 -195
  57. package/dist/mcps/auto-format.server.d.ts +2 -4
  58. package/dist/mcps/auto-format.server.js +49 -95
  59. package/dist/mcps/boot-orchestrator.server.d.ts +2 -4
  60. package/dist/mcps/boot-orchestrator.server.js +73 -105
  61. package/dist/mcps/config/server-config-registry.js +3 -3
  62. package/dist/mcps/enforcer-tools.server.d.ts +2 -4
  63. package/dist/mcps/enforcer-tools.server.js +202 -285
  64. package/dist/mcps/estimation.server.d.ts +2 -4
  65. package/dist/mcps/estimation.server.js +63 -107
  66. package/dist/mcps/framework-compliance-audit.server.d.ts +2 -4
  67. package/dist/mcps/framework-compliance-audit.server.js +53 -82
  68. package/dist/mcps/framework-help.server.d.ts +2 -4
  69. package/dist/mcps/framework-help.server.js +63 -101
  70. package/dist/mcps/governance.server.js +2 -2
  71. package/dist/mcps/knowledge-skills/api-design.server.d.ts +2 -4
  72. package/dist/mcps/knowledge-skills/api-design.server.js +35 -67
  73. package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -10
  74. package/dist/mcps/knowledge-skills/architecture-patterns.server.js +35 -74
  75. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.d.ts +2 -4
  76. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +143 -162
  77. package/dist/mcps/knowledge-skills/code-analyzer.server.d.ts +3 -4
  78. package/dist/mcps/knowledge-skills/code-analyzer.server.js +20 -45
  79. package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -4
  80. package/dist/mcps/knowledge-skills/code-review.server.js +109 -143
  81. package/dist/mcps/knowledge-skills/content-creator.server.d.ts +2 -4
  82. package/dist/mcps/knowledge-skills/content-creator.server.js +205 -226
  83. package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -4
  84. package/dist/mcps/knowledge-skills/database-design.server.js +117 -151
  85. package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -4
  86. package/dist/mcps/knowledge-skills/devops-deployment.server.js +71 -160
  87. package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -4
  88. package/dist/mcps/knowledge-skills/git-workflow.server.js +36 -68
  89. package/dist/mcps/knowledge-skills/growth-strategist.server.d.ts +2 -4
  90. package/dist/mcps/knowledge-skills/growth-strategist.server.js +303 -324
  91. package/dist/mcps/knowledge-skills/log-monitor.server.d.ts +2 -4
  92. package/dist/mcps/knowledge-skills/log-monitor.server.js +141 -160
  93. package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -4
  94. package/dist/mcps/knowledge-skills/mobile-development.server.js +92 -209
  95. package/dist/mcps/knowledge-skills/multimodal-looker.server.d.ts +2 -4
  96. package/dist/mcps/knowledge-skills/multimodal-looker.server.js +123 -159
  97. package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -5
  98. package/dist/mcps/knowledge-skills/performance-optimization.server.js +155 -296
  99. package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +2 -4
  100. package/dist/mcps/knowledge-skills/project-analysis.server.js +75 -226
  101. package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -4
  102. package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +63 -156
  103. package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -4
  104. package/dist/mcps/knowledge-skills/security-audit.server.js +102 -136
  105. package/dist/mcps/knowledge-skills/seo-consultant.server.d.ts +2 -4
  106. package/dist/mcps/knowledge-skills/seo-consultant.server.js +80 -203
  107. package/dist/mcps/knowledge-skills/session-management.server.d.ts +2 -4
  108. package/dist/mcps/knowledge-skills/session-management.server.js +50 -203
  109. package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +2 -4
  110. package/dist/mcps/knowledge-skills/skill-invocation.server.js +168 -347
  111. package/dist/mcps/knowledge-skills/strategist.server.d.ts +2 -11
  112. package/dist/mcps/knowledge-skills/strategist.server.js +72 -122
  113. package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -4
  114. package/dist/mcps/knowledge-skills/tech-writer.server.js +87 -300
  115. package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -4
  116. package/dist/mcps/knowledge-skills/testing-best-practices.server.js +147 -182
  117. package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -4
  118. package/dist/mcps/knowledge-skills/testing-strategy.server.js +78 -153
  119. package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -5
  120. package/dist/mcps/knowledge-skills/ui-ux-design.server.js +90 -399
  121. package/dist/mcps/lint.server.d.ts +2 -4
  122. package/dist/mcps/lint.server.js +51 -92
  123. package/dist/mcps/mcp-client.js +2 -2
  124. package/dist/mcps/model-health-check.server.d.ts +2 -4
  125. package/dist/mcps/model-health-check.server.js +32 -60
  126. package/dist/mcps/performance-analysis.server.d.ts +2 -4
  127. package/dist/mcps/performance-analysis.server.js +57 -88
  128. package/dist/mcps/processor-pipeline.server.d.ts +2 -4
  129. package/dist/mcps/processor-pipeline.server.js +69 -100
  130. package/dist/mcps/registry.json +1 -1
  131. package/dist/mcps/researcher.server.d.ts +3 -5
  132. package/dist/mcps/researcher.server.js +81 -154
  133. package/dist/mcps/security-scan.server.d.ts +2 -4
  134. package/dist/mcps/security-scan.server.js +54 -96
  135. package/dist/mcps/shared/knowledge-skill-base.d.ts +14 -0
  136. package/dist/mcps/shared/knowledge-skill-base.js +45 -0
  137. package/dist/{security → mcps/shared}/security-scanner.js +1 -1
  138. package/dist/mcps/state-manager.server.d.ts +2 -4
  139. package/dist/mcps/state-manager.server.js +115 -160
  140. package/dist/orchestrator/orchestrator.d.ts +1 -1
  141. package/dist/orchestrator/orchestrator.js +1 -1
  142. package/dist/orchestrator/universal-registry-bridge.js +1 -1
  143. package/dist/plugin/xray-codex-injection.d.ts +1 -1
  144. package/dist/plugin/xray-codex-injection.js +1 -1
  145. package/dist/postprocessor/PostProcessor.d.ts +4 -44
  146. package/dist/postprocessor/PostProcessor.js +39 -553
  147. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +11 -0
  148. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
  149. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.d.ts +11 -0
  150. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.js +356 -0
  151. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +44 -0
  152. package/dist/postprocessor/config/ProcessorConfigLoader.js +21 -0
  153. package/dist/postprocessor/reporting/PostProcessorReporter.d.ts +19 -0
  154. package/dist/postprocessor/reporting/PostProcessorReporter.js +96 -0
  155. package/dist/postprocessor/triggers/GitHookTrigger.js +11 -11
  156. package/dist/processors/implementations/refactoring-logging-processor-wrapper.d.ts +32 -0
  157. package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +95 -1
  158. package/dist/processors/processor-manager.js +346 -314
  159. package/dist/reporting/report-formatter.js +1 -1
  160. package/dist/security/security-hardener.d.ts +69 -2
  161. package/dist/security/security-hardener.js +129 -1
  162. package/dist/skills/registry.json +1 -1
  163. package/dist/state/index.d.ts +3 -5
  164. package/dist/state/index.js +1 -7
  165. package/dist/state/state-manager.d.ts +1 -1
  166. package/dist/state/state-manager.js +2 -3
  167. package/package.json +13 -10
  168. package/scripts/node/universal-version-manager.js +11 -11
  169. package/src/mcps/architect-tools.server.ts +112 -215
  170. package/src/mcps/auto-format.server.ts +50 -110
  171. package/src/mcps/boot-orchestrator.server.ts +75 -121
  172. package/src/mcps/config/__tests__/server-config-registry.test.ts +21 -12
  173. package/src/mcps/config/server-config-registry.ts +3 -3
  174. package/src/mcps/enforcer-tools.server.ts +212 -310
  175. package/src/mcps/estimation.server.ts +62 -122
  176. package/src/mcps/framework-compliance-audit.server.ts +52 -97
  177. package/src/mcps/framework-help.server.ts +64 -114
  178. package/src/mcps/governance.server.ts +2 -2
  179. package/src/mcps/knowledge-skills/api-design.server.ts +32 -77
  180. package/src/mcps/knowledge-skills/architecture-patterns.server.ts +31 -87
  181. package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +165 -193
  182. package/src/mcps/knowledge-skills/code-analyzer.server.ts +20 -55
  183. package/src/mcps/knowledge-skills/code-review.server.ts +114 -161
  184. package/src/mcps/knowledge-skills/content-creator.server.ts +218 -255
  185. package/src/mcps/knowledge-skills/database-design.server.ts +118 -165
  186. package/src/mcps/knowledge-skills/devops-deployment.server.ts +67 -172
  187. package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
  188. package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -361
  189. package/src/mcps/knowledge-skills/log-monitor.server.ts +160 -187
  190. package/src/mcps/knowledge-skills/mobile-development.server.ts +89 -223
  191. package/src/mcps/knowledge-skills/multimodal-looker.server.ts +128 -175
  192. package/src/mcps/knowledge-skills/performance-optimization.server.ts +156 -329
  193. package/src/mcps/knowledge-skills/project-analysis.server.ts +72 -248
  194. package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +59 -171
  195. package/src/mcps/knowledge-skills/security-audit.server.ts +104 -151
  196. package/src/mcps/knowledge-skills/seo-consultant.server.ts +80 -220
  197. package/src/mcps/knowledge-skills/session-management.server.ts +51 -232
  198. package/src/mcps/knowledge-skills/skill-invocation.server.ts +165 -372
  199. package/src/mcps/knowledge-skills/strategist.server.ts +72 -143
  200. package/src/mcps/knowledge-skills/tech-writer.server.ts +85 -350
  201. package/src/mcps/knowledge-skills/testing-best-practices.server.ts +146 -195
  202. package/src/mcps/knowledge-skills/testing-strategy.server.ts +75 -161
  203. package/src/mcps/knowledge-skills/ui-ux-design.server.ts +93 -487
  204. package/src/mcps/lint.server.ts +53 -107
  205. package/src/mcps/mcp-client.ts +2 -2
  206. package/src/mcps/model-health-check.server.ts +34 -71
  207. package/src/mcps/performance-analysis.server.ts +60 -104
  208. package/src/mcps/processor-pipeline.server.ts +72 -110
  209. package/src/mcps/registry.json +1 -1
  210. package/src/mcps/researcher.server.ts +88 -177
  211. package/src/mcps/security-scan.server.ts +55 -104
  212. package/src/mcps/shared/knowledge-skill-base.ts +62 -0
  213. package/src/mcps/shared/prompt-security-validator.ts +199 -0
  214. package/src/mcps/shared/security-scanner.ts +599 -0
  215. package/src/mcps/state-manager.server.ts +117 -175
  216. package/src/opencode/codex.codex +1 -1
  217. package/src/opencode/commands/dependency-audit.md +3 -3
  218. package/src/opencode/enforcer-config.json +2 -2
  219. package/src/skills/registry.json +1 -1
  220. package/xray/codex.json +1 -1
  221. package/xray/config.json +1 -1
  222. package/xray/features.json +1 -1
  223. package/xray/integrations.json +3 -3
  224. package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
  225. package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
  226. package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
  227. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
  228. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
  229. package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
  230. package/dist/integrations/hermes-agent/conftest.py +0 -14
  231. package/dist/integrations/hermes-agent/test_plugin.py +0 -1103
  232. package/dist/processors/implementations/refactoring-logging-processor.d.ts +0 -31
  233. package/dist/processors/implementations/refactoring-logging-processor.js +0 -96
  234. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  235. package/dist/processors/implementations/session-capture-processor.js +0 -37
  236. package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
  237. package/dist/scripts/activate-kernel-pipeline.js +0 -101
  238. package/dist/security/index.d.ts +0 -13
  239. package/dist/security/index.js +0 -13
  240. package/dist/security/security-agent-coordinator.d.ts +0 -72
  241. package/dist/security/security-agent-coordinator.js +0 -204
  242. package/dist/security/security-auditor.d.ts +0 -56
  243. package/dist/security/security-auditor.js +0 -584
  244. package/dist/security/security-hardening-system.d.ts +0 -239
  245. package/dist/security/security-hardening-system.js +0 -727
  246. package/dist/security/security-orchestration-layer.d.ts +0 -119
  247. package/dist/security/security-orchestration-layer.js +0 -496
  248. /package/dist/{security → mcps/shared}/prompt-security-validator.d.ts +0 -0
  249. /package/dist/{security → mcps/shared}/prompt-security-validator.js +0 -0
  250. /package/dist/{security → mcps/shared}/security-scanner.d.ts +0 -0
@@ -7,25 +7,25 @@
7
7
  * @version 1.0.0
8
8
  * @since 2026-01-13
9
9
  */
10
- import * as path from "path";
11
10
  import { frameworkLogger } from "../core/framework-logger.js";
12
- import { resolveConfigPath } from "../core/config-paths.js";
13
11
  import { GitHookTrigger } from "./triggers/GitHookTrigger.js";
14
12
  import { WebhookTrigger } from "./triggers/WebhookTrigger.js";
15
13
  import { APITrigger } from "./triggers/APITrigger.js";
16
14
  import { PostProcessorMonitoringEngine } from "./monitoring/MonitoringEngine.js";
17
15
  import { FailureAnalysisEngine } from "./analysis/FailureAnalysisEngine.js";
16
+ import { CodeChangeAnalyzer } from "./analysis/CodeChangeAnalyzer.js";
18
17
  import { AutoFixEngine } from "./autofix/AutoFixEngine.js";
19
18
  import { activity } from "../core/activity-logger.js";
20
19
  import { FixValidator } from "./autofix/FixValidator.js";
21
- import { mcpClientManager } from "../mcps/mcp-client.js";
22
20
  import { RedeployCoordinator } from "./redeploy/RedeployCoordinator.js";
23
21
  import { EscalationEngine } from "./escalation/EscalationEngine.js";
24
22
  import { SuccessHandler } from "./success/SuccessHandler.js";
25
23
  import { defaultConfig } from "./config.js";
26
- import { frameworkReportingSystem } from "../reporting/framework-reporting-system.js";
27
24
  import { ReportContentValidator } from "../validation/report-content-validator.js";
25
+ import { PostProcessorReporter } from "./reporting/PostProcessorReporter.js";
28
26
  import { RegressionAnalysisService } from "./services/RegressionAnalysisService.js";
27
+ import { ProcessorConfigLoader } from "./config/ProcessorConfigLoader.js";
28
+ import { ArchitecturalComplianceChecker } from "./compliance/ArchitecturalComplianceChecker.js";
29
29
  export class PostProcessor {
30
30
  stateManager;
31
31
  sessionMonitor;
@@ -35,11 +35,15 @@ export class PostProcessor {
35
35
  autoFixEngine;
36
36
  fixValidator;
37
37
  reportValidator;
38
+ reporter;
38
39
  regressionAnalysisService;
40
+ configLoader;
41
+ codeAnalyzer;
39
42
  redeployCoordinator;
40
43
  escalationEngine;
41
44
  successHandler;
42
45
  triggers;
46
+ complianceChecker;
43
47
  constructor(stateManager, sessionMonitor = null, config = {}) {
44
48
  this.stateManager = stateManager;
45
49
  this.sessionMonitor = sessionMonitor;
@@ -51,7 +55,10 @@ export class PostProcessor {
51
55
  this.autoFixEngine = new AutoFixEngine(this.config.autoFix.confidenceThreshold);
52
56
  this.fixValidator = new FixValidator();
53
57
  this.reportValidator = new ReportContentValidator();
58
+ this.reporter = new PostProcessorReporter(this.config, this.reportValidator);
54
59
  this.regressionAnalysisService = new RegressionAnalysisService();
60
+ this.configLoader = new ProcessorConfigLoader();
61
+ this.codeAnalyzer = new CodeChangeAnalyzer();
55
62
  // Initialize redeploy coordinator
56
63
  this.redeployCoordinator = new RedeployCoordinator(this.config.redeploy);
57
64
  // Initialize escalation and success handlers
@@ -63,169 +70,14 @@ export class PostProcessor {
63
70
  webhook: new WebhookTrigger(this),
64
71
  api: new APITrigger(this, {}), // Pass empty config object
65
72
  };
66
- }
67
- /**
68
- * Generate automated framework report if conditions are met
69
- */
70
- async generateFrameworkReport(complexityScore, context, sessionId) {
71
- if (!this.config.reporting.enabled || !this.config.reporting.autoGenerate) {
72
- return null;
73
- }
74
- // Only generate report if complexity score meets threshold
75
- if (complexityScore < this.config.reporting.reportThreshold) {
76
- await frameworkLogger.log("postprocessor", "report-skipped-low-complexity", "info", {
77
- complexityScore,
78
- threshold: this.config.reporting.reportThreshold,
79
- });
80
- return null;
81
- }
82
- try {
83
- await frameworkLogger.log("-post-processor", "-generating-automated-framework-report-", "info", { message: "📊 Generating automated framework report..." });
84
- const reportConfig = {
85
- type: "full-analysis",
86
- sessionId,
87
- outputFormat: "markdown",
88
- outputPath: path.join(this.config.reporting.reportDir, `framework-report-${context.commitSha}-${new Date().toISOString().split("T")[0]}.md`),
89
- detailedMetrics: true,
90
- timeRange: { lastHours: 24 },
91
- };
92
- await frameworkReportingSystem.generateReport(reportConfig);
93
- await frameworkLogger.log("-post-processor", "-framework-report-generated-reportconfig-outputpat", "success", {
94
- message: `✅ Framework report generated: ${reportConfig.outputPath}`,
95
- });
96
- // Clean up old reports
97
- await this.cleanupOldReports();
98
- return reportConfig.outputPath;
99
- }
100
- catch (error) {
101
- await frameworkLogger.log("postprocessor", "framework-report-generation-failed", "warning", { error: String(error) });
102
- return null;
103
- }
104
- }
105
- /**
106
- * Validate generated reports for hidden issues
107
- */
108
- async validateGeneratedReport(reportPath, reportType) {
109
- try {
110
- if (this.reportValidator) {
111
- const validation = await this.reportValidator.validateReportContent(reportPath, reportType);
112
- if (!validation.valid) {
113
- await frameworkLogger.log("postprocessor", "report-validation-failed", "warning", { reportPath, issues: validation.issues });
114
- if (validation.details.criticalErrors.length > 0) {
115
- await frameworkLogger.log("postprocessor", "critical-errors-in-report", "error", { reportPath, criticalErrors: validation.details.criticalErrors });
116
- }
117
- }
118
- else {
119
- await frameworkLogger.log("postprocessor", "report-validation-passed", "success", { reportPath });
120
- }
121
- }
122
- }
123
- catch (error) {
124
- await frameworkLogger.log("postprocessor", "report-validation-failed", "warning", { error: String(error) });
125
- }
126
- }
127
- /**
128
- * Clean up old reports based on retention policy
129
- */
130
- async cleanupOldReports() {
131
- try {
132
- const fs = await import("fs");
133
- const path = await import("path");
134
- const reportDir = this.config.reporting.reportDir;
135
- if (!fs.existsSync(reportDir))
136
- return;
137
- const files = fs.readdirSync(reportDir);
138
- const cutoffTime = Date.now() - this.config.reporting.retentionDays * 24 * 60 * 60 * 1000;
139
- for (const file of files) {
140
- const filePath = path.join(reportDir, file);
141
- const stats = fs.statSync(filePath);
142
- if (stats.mtime.getTime() < cutoffTime) {
143
- fs.unlinkSync(filePath);
144
- await frameworkLogger.log("postprocessor", "cleaned-up-old-report", "info", { file });
145
- }
146
- }
147
- }
148
- catch (error) {
149
- await frameworkLogger.log("postprocessor", "report-cleanup-failed", "warning", { error: String(error) });
150
- }
151
- }
152
- /**
153
- * Analyze code changes to provide meaningful context to processors
154
- * FIX: Issue #1 - Pass actual code analysis to processors
155
- */
156
- async analyzeCodeChanges(context) {
157
- const fs = await import("fs");
158
- const path = await import("path");
159
- const newCode = new Map();
160
- const existingCode = new Map();
161
- const tests = [];
162
- const dependencies = [];
163
- try {
164
- // Read new/changed files
165
- for (const file of context.files || []) {
166
- try {
167
- const fullPath = path.join(process.cwd(), file);
168
- if (fs.existsSync(fullPath)) {
169
- // Read new code
170
- const content = fs.readFileSync(fullPath, "utf-8");
171
- newCode.set(file, content);
172
- // Check for test files
173
- if (file.includes(".test.") || file.includes(".spec.")) {
174
- tests.push(file);
175
- }
176
- // Check for package.json or dependency files
177
- if (file.includes("package.json") || file.includes("requirements.txt") || file.includes("Cargo.toml")) {
178
- dependencies.push(file);
179
- }
180
- }
181
- }
182
- catch (error) {
183
- // Skip files that can't be read
184
- await frameworkLogger.log("-post-processor", "-code-analysis-file-error", "info", { message: `Could not analyze ${file}: ${error}` });
185
- }
186
- }
187
- await frameworkLogger.log("-post-processor", "-code-analysis-complete", "info", {
188
- message: `Analyzed ${newCode.size} files, ${tests.length} tests, ${dependencies.length} dependencies`,
189
- });
190
- }
191
- catch (error) {
192
- await frameworkLogger.log("-post-processor", "-code-analysis-failed", "error", { message: `Code analysis failed: ${error}` });
193
- }
194
- return {
195
- operation: "commit",
196
- files: context.files || [],
197
- newCode,
198
- existingCode,
199
- tests,
200
- dependencies,
201
- };
202
- }
203
- /**
204
- * Load processor configuration from features.json
205
- * FIX: Issue #2 - Make processor registration configurable
206
- */
207
- async loadProcessorConfig() {
208
- const fs = await import("fs");
209
- const path = await import("path");
210
- try {
211
- const configPath = resolveConfigPath("features.json") ?? path.join(process.cwd(), ".opencode", "xray", "features.json");
212
- if (fs.existsSync(configPath)) {
213
- const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
214
- return config.processors || {};
215
- }
216
- }
217
- catch (error) {
218
- frameworkLogger.log("postprocessor", "processor-config-load-failed", "info", {
219
- error: error instanceof Error ? error.message : String(error),
220
- });
221
- }
222
- return {};
73
+ // Initialize architectural compliance checker
74
+ this.complianceChecker = new ArchitecturalComplianceChecker();
223
75
  }
224
76
  /**
225
77
  * Initialize the post-processor system
226
78
  */
227
79
  async initialize() {
228
- await frameworkLogger.log("-post-processor", "-initializing-stringray-post-processor-", "info", { message: "🚀 Initializing 0xRay Post-Processor..." });
80
+ await frameworkLogger.log("postprocessor", "initialize", "info", { message: "🚀 Initializing 0xRay Post-Processor..." });
229
81
  // Initialize monitoring
230
82
  if (this.config.monitoring.enabled) {
231
83
  await this.monitoringEngine.initialize();
@@ -255,301 +107,7 @@ export class PostProcessor {
255
107
  message: "Memory monitor not available",
256
108
  });
257
109
  }
258
- await frameworkLogger.log("-post-processor", "-post-processor-initialization-complete-", "info", { message: "🎯 Post-Processor initialization complete" });
259
- }
260
- /**
261
- * Validate architectural compliance against codex rules
262
- */
263
- async validateArchitecturalCompliance(context) {
264
- try {
265
- await frameworkLogger.log("-post-processor", "-validating-architectural-compliance-", "info", { message: "🏗️ Validating architectural compliance..." });
266
- // Rule 46: System Integrity Cross-Check
267
- const integrityCheck = await this.checkSystemIntegrity(context);
268
- if (!integrityCheck.passed) {
269
- await frameworkLogger.log("-post-processor", "-system-integrity-violation-integritycheck-message", "error", {
270
- message: `❌ System integrity violation: ${integrityCheck.message}`,
271
- });
272
- // Call researcher agent to analyze system components
273
- const fixed = await this.callAgentForArchitecturalFix("checkSystemIntegrity", "researcher", "project-analysis", context, integrityCheck.message);
274
- if (!fixed) {
275
- return false; // Could not auto-fix
276
- }
277
- }
278
- // Rule 47: Integration Testing Mandate
279
- const integrationCheck = await this.checkIntegrationTesting(context);
280
- if (!integrationCheck.passed) {
281
- await frameworkLogger.log("-post-processor", "-integration-testing-violation-integrationcheck-me", "error", {
282
- message: `❌ Integration testing violation: ${integrationCheck.message}`,
283
- });
284
- // Call testing-lead agent for testing strategy
285
- const fixed = await this.callAgentForArchitecturalFix("checkIntegrationTesting", "testing-lead", "testing-strategy", context, integrationCheck.message);
286
- if (!fixed) {
287
- return false; // Could not auto-fix
288
- }
289
- }
290
- // Rule 48: Path Resolution Abstraction
291
- const pathCheck = await this.checkPathResolution(context);
292
- if (!pathCheck.passed) {
293
- await frameworkLogger.log("-post-processor", "-path-resolution-violation-pathcheck-message-", "error", { message: `❌ Path resolution violation: ${pathCheck.message}` });
294
- // Call researcher + refactorer for path analysis and fixes
295
- const fixed = await this.callAgentForArchitecturalFix("checkPathResolution", "researcher", "project-analysis", context, pathCheck.message);
296
- if (!fixed) {
297
- return false; // Could not auto-fix
298
- }
299
- }
300
- // Rule 49: Feature Completeness Validation
301
- const completenessCheck = await this.checkFeatureCompleteness(context);
302
- if (!completenessCheck.passed) {
303
- await frameworkLogger.log("-post-processor", "-feature-completeness-violation-completenesscheck-", "error", {
304
- message: `❌ Feature completeness violation: ${completenessCheck.message}`,
305
- });
306
- // Call architect agent for system design analysis
307
- const fixed = await this.callAgentForArchitecturalFix("checkFeatureCompleteness", "architect", "architecture-patterns", context, completenessCheck.message);
308
- if (!fixed) {
309
- return false; // Could not auto-fix
310
- }
311
- }
312
- // Rule 50: Path Analysis Guidelines Enforcement
313
- const pathGuidelinesCheck = await this.checkPathAnalysisGuidelines(context);
314
- if (!pathGuidelinesCheck.passed) {
315
- await frameworkLogger.log("-post-processor", "-path-analysis-guidelines-violation-pathguidelines", "error", {
316
- message: `❌ Path analysis guidelines violation: ${pathGuidelinesCheck.message}`,
317
- });
318
- // Call refactorer agent for code refactoring
319
- const fixed = await this.callAgentForArchitecturalFix("checkPathAnalysisGuidelines", "refactorer", "refactoring-strategies", context, pathGuidelinesCheck.message);
320
- if (!fixed) {
321
- return false; // Could not auto-fix
322
- }
323
- }
324
- await frameworkLogger.log("-post-processor", "-all-architectural-compliance-checks-passed-", "success", { message: "✅ All architectural compliance checks passed" });
325
- return true;
326
- }
327
- catch (error) {
328
- await frameworkLogger.log("-post-processor", "-architectural-compliance-validation-failed-error-", "error", {
329
- message: `❌ Architectural compliance validation failed: ${error instanceof Error ? error.message : String(error)}`,
330
- });
331
- return false;
332
- }
333
- }
334
- async checkSystemIntegrity(context) {
335
- // Check if all critical framework components are active
336
- const stateManager = globalThis.strRayStateManager;
337
- const postProcessor = globalThis.strRayPostProcessor;
338
- if (!stateManager) {
339
- try {
340
- const { StrRayStateManager } = await import("../state/state-manager.js");
341
- const tempStateManager = new StrRayStateManager();
342
- globalThis.strRayStateManager = tempStateManager;
343
- return {
344
- passed: true,
345
- message: "System integrity verified (graceful mode)",
346
- };
347
- }
348
- catch (e) {
349
- return {
350
- passed: true,
351
- message: "System integrity assumed OK (no full framework context)",
352
- };
353
- }
354
- }
355
- if (!postProcessor) {
356
- return {
357
- passed: true,
358
- message: "System integrity verified (state manager active)",
359
- };
360
- }
361
- return { passed: true, message: "System integrity verified" };
362
- }
363
- async checkIntegrationTesting(context) {
364
- // For now, we assume integration testing has been run as part of the CI/CD process
365
- // In a full implementation, this would check actual test results
366
- return {
367
- passed: true,
368
- message: "Integration testing assumed to be completed in CI/CD pipeline",
369
- };
370
- }
371
- async checkPathResolution(context) {
372
- // Check for path resolution issues in committed files
373
- // This would require reading the actual file contents from git
374
- // For now, we verify that the framework's path resolution is working
375
- const pathResolver = globalThis.strRayPathResolver;
376
- if (!pathResolver) {
377
- return {
378
- passed: true,
379
- message: "Path resolution check skipped (no full framework context)",
380
- };
381
- }
382
- // Test path resolution with a sample path
383
- try {
384
- const resolvedPath = pathResolver.resolveAgentPath("test-agent");
385
- if (resolvedPath.includes("../") || resolvedPath.includes("./dist")) {
386
- return {
387
- passed: false,
388
- message: "Path resolution returning hardcoded paths",
389
- };
390
- }
391
- return { passed: true, message: "Path resolution abstraction verified" };
392
- }
393
- catch (error) {
394
- return {
395
- passed: false,
396
- message: `Path resolution failed: ${error instanceof Error ? error.message : String(error)}`,
397
- };
398
- }
399
- }
400
- async checkFeatureCompleteness(context) {
401
- // This is a simplified check - in practice, we'd analyze the commit and PR data
402
- // For now, we assume completeness based on the context having required fields
403
- // Graceful degradation - assume OK if no full commit context
404
- if (!context.commitSha || !context.repository) {
405
- return {
406
- passed: true,
407
- message: "Feature completeness assumed OK (no full commit context)",
408
- };
409
- }
410
- return { passed: true, message: "Feature completeness verified" };
411
- }
412
- /**
413
- * Rule 50: Path Analysis Guidelines Enforcement
414
- * Ensures AIs follow path resolution guidelines for all write/edit operations
415
- * Covers all 3 types of path violations from PATH_RESOLUTION_ANALYSIS.md
416
- */
417
- async checkPathAnalysisGuidelines(context) {
418
- // Check if the current operation involves code changes that might introduce path issues
419
- if (!context.files || context.files.length === 0) {
420
- return { passed: true, message: "No files to check for path guidelines" };
421
- }
422
- // Check for TypeScript/JavaScript files that might contain imports
423
- const codeFiles = context.files.filter((file) => file.endsWith(".ts") ||
424
- file.endsWith(".js") ||
425
- file.endsWith(".tsx") ||
426
- file.endsWith(".jsx"));
427
- if (codeFiles.length === 0) {
428
- return {
429
- passed: true,
430
- message: "No code files to validate for path guidelines",
431
- };
432
- }
433
- // For write/edit operations, notify AIs about ALL THREE types of path violations
434
- const guidelinesMessage = `
435
- 🚨 CRITICAL: PATH ANALYSIS GUIDELINES ENFORCEMENT 🚨
436
-
437
- AI Operations Detected: ${context.trigger} trigger with ${codeFiles.length} code file(s)
438
- MANDATORY COMPLIANCE REQUIRED - VIOLATIONS WILL BLOCK COMMITS
439
-
440
- ═══════════════════════════════════════════════════════════════
441
- 🔴 TYPE 1: HARDCODED 'dist/' PATHS (17 files affected)
442
- ═══════════════════════════════════════════════════════════════
443
-
444
- ❌ NEVER use hardcoded 'dist/' paths in source code:
445
- \`\`\`typescript
446
- // WRONG - Breaks across environments (actual violations found)
447
- import { RuleEnforcer } from "../enforcement/rule-enforcer.js";
448
- // FIXED: Removed hardcoded dist/ path (was causing dist/dist corruption in builds)
449
- \`\`\`
450
-
451
- ✅ CORRECT - Use import resolver for environment awareness:
452
- \`\`\`typescript
453
- // Environment-aware imports (Solution C)
454
- const { importResolver } = await import('./utils/import-resolver.js');
455
- const { RuleEnforcer } = await importResolver.importModule('enforcement/rule-enforcer');
456
- \`\`\`
457
-
458
- ═══════════════════════════════════════════════════════════════
459
- 🟡 TYPE 2: PROBLEMATIC '../' IMPORTS (107 files affected)
460
- ═══════════════════════════════════════════════════════════════
461
-
462
- ❌ Directory structure assumptions that break across environments:
463
- \`\`\`typescript
464
- // WRONG - Assumes specific deployment structure
465
- import { AgentConfig } from "../agents/code-reviewer.js"; // May break if directories move
466
- import { Utils } from "../../../shared/utils.js"; // Fragile deep navigation
467
- \`\`\`
468
-
469
- ✅ CORRECT - Use stable relative imports within modules:
470
- \`\`\`typescript
471
- // Stable within src/ directory structure
472
- import { AgentConfig } from "../agents/code-reviewer.js"; // OK within same project
473
- import { Utils } from "../../shared/utils.js"; // Prefer shallower paths
474
- \`\`\`
475
-
476
- ═══════════════════════════════════════════════════════════════
477
- 🟠 TYPE 3: BRITTLE './' IMPORTS (151 files affected)
478
- ═══════════════════════════════════════════════════════════════
479
-
480
- ❌ Local file assumptions that break when files move:
481
- \`\`\`typescript
482
- // WRONG - Assumes file exists in specific location
483
- import { Config } from "./config.js"; // May not exist in built version
484
- import { Utils } from "./utils/helpers.js"; // Breaks if directory reorganized
485
- \`\`\`
486
-
487
- ✅ CORRECT - Use proper module resolution:
488
- \`\`\`typescript
489
- // Prefer named imports from index files
490
- import { Config } from "./config/index.js";
491
- import { helpers } from "./utils/index.js";
492
-
493
- // Or use full relative paths when necessary
494
- import { Config } from "./config/config.js";
495
- \`\`\`
496
-
497
- ═══════════════════════════════════════════════════════════════
498
- 🛠️ RECOMMENDED SOLUTIONS FROM PATH_RESOLUTION_ANALYSIS.md
499
- ═══════════════════════════════════════════════════════════════
500
-
501
- **Solution A: Environment Variables (Simple)**
502
- \`\`\`typescript
503
- const AGENTS_PATH = process.env.STRRAY_AGENTS_PATH || '../agents';
504
- import { AgentConfig } from \`\${AGENTS_PATH}/code-reviewer.js\`;
505
- \`\`\`
506
-
507
- **Solution B: Directory Structure Alignment (Architectural)**
508
- - Ensure build output matches source structure
509
- - Use aligned plugin/component directories
510
- - No code changes needed when structure is correct
511
-
512
- **Solution C: Import Resolver (Recommended)**
513
- \`\`\`typescript
514
- const { importResolver } = await import('./utils/import-resolver.js');
515
- const { Module } = await importResolver.importModule('path/to/module');
516
- \`\`\`
517
-
518
- ═══════════════════════════════════════════════════════════════
519
- ⚠️ ENFORCEMENT LEVELS
520
- ═══════════════════════════════════════════════════════════════
521
-
522
- 🔴 BLOCKING: Hardcoded dist/ paths in source files
523
- 🟡 WARNING: Problematic deep ../ navigation (>3 levels)
524
- 🟠 MONITOR: Brittle ./ imports (logged for review)
525
-
526
- AI MUST use appropriate solution based on context:
527
- - Development scripts → Solution A (Environment Variables)
528
- - Plugin components → Solution B (Directory Alignment)
529
- - Dynamic imports → Solution C (Import Resolver)
530
-
531
- ═══════════════════════════════════════════════════════════════
532
- 📖 REFERENCE: PATH_RESOLUTION_ANALYSIS.md
533
- ═══════════════════════════════════════════════════════════════
534
-
535
- Complete guidelines available in project documentation.
536
- All path violations will be automatically detected and blocked.
537
- `;
538
- // Log the comprehensive guidelines notification for AIs
539
- await frameworkLogger.log("-post-processor", "guidelinesmessage", "info", {
540
- message: guidelinesMessage,
541
- });
542
- // In a full implementation, we would:
543
- // 1. Scan actual file contents for violations
544
- // 2. Use git diff to check changed imports
545
- // 3. Validate against all three violation types
546
- // 4. Block commits with actual violations found
547
- // For now, we provide comprehensive guidance and assume compliance
548
- // Future enhancement: Implement actual file scanning and blocking
549
- return {
550
- passed: true,
551
- message: "Comprehensive path analysis guidelines notification sent to AI operations",
552
- };
110
+ await frameworkLogger.log("postprocessor", "initialize-complete", "info", { message: "🎯 Post-Processor initialization complete" });
553
111
  }
554
112
  /**
555
113
  * Execute the complete post-processor loop
@@ -558,13 +116,13 @@ All path violations will be automatically detected and blocked.
558
116
  const jobId = `post-processor-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
559
117
  const startTime = Date.now();
560
118
  const sessionId = `postprocessor-${context.commitSha}-${Date.now()}`;
561
- await frameworkLogger.log("-post-processor", "-starting-post-processor-loop-for-commit-context-c", "info", {
119
+ await frameworkLogger.log("postprocessor", "loop-start", "info", {
562
120
  message: `🔄 Starting post-processor loop for commit: ${context.commitSha}`,
563
121
  });
564
122
  // Validate architectural compliance before processing
565
- const compliancePassed = await this.validateArchitecturalCompliance(context);
123
+ const compliancePassed = await this.complianceChecker.validateArchitecturalCompliance(context);
566
124
  if (!compliancePassed) {
567
- await frameworkLogger.log("-post-processor", "-architectural-compliance-validation-failed-blocki", "error", {
125
+ await frameworkLogger.log("postprocessor", "compliance-validation-failed", "error", {
568
126
  message: "❌ Architectural compliance validation failed - blocking post-processing",
569
127
  });
570
128
  return {
@@ -577,12 +135,12 @@ All path violations will be automatically detected and blocked.
577
135
  }
578
136
  // Codex compliance validation: Use processor-manager for proper rule enforcement and agent delegation
579
137
  // IMPROVED: Analyze actual code changes and pass meaningful context to processors
580
- const processorContext = await this.analyzeCodeChanges(context);
138
+ const processorContext = await this.codeAnalyzer.analyzeCodeChanges(context);
581
139
  try {
582
140
  const { importResolver } = await import("../utils/import-resolver.js");
583
141
  const { ProcessorManager } = await importResolver.importModule("processors/processor-manager");
584
142
  const processorManager = new ProcessorManager(this.stateManager);
585
- const processorConfig = await this.loadProcessorConfig();
143
+ const processorConfig = await this.configLoader.loadProcessorConfig();
586
144
  const PRE_PROCESSOR_DEFAULTS = {
587
145
  preValidate: { type: "pre", priority: 10 },
588
146
  codexCompliance: { type: "pre", priority: 20 },
@@ -652,7 +210,7 @@ All path violations will be automatically detected and blocked.
652
210
  }
653
211
  catch (testError) {
654
212
  // Non-blocking - log but continue
655
- await frameworkLogger.log("-post-processor", "-test-auto-creation-failed", "info", {
213
+ await frameworkLogger.log("postprocessor", "test-auto-creation-failed", "info", {
656
214
  message: `Test auto-creation failed for ${filePath}: ${testError}`,
657
215
  });
658
216
  }
@@ -666,13 +224,13 @@ All path violations will be automatically detected and blocked.
666
224
  violations: complianceResult.violations,
667
225
  reason: "Codex compliance violations found - processor-manager attempted automated fixes",
668
226
  });
669
- await frameworkLogger.log("-post-processor", "-codex-compliance-violations-detected-processor-ma", "info", {
227
+ await frameworkLogger.log("postprocessor", "codex-compliance-violations-detected", "info", {
670
228
  message: "⚠️ Codex compliance violations detected - processor-manager handled automated fixes",
671
229
  });
672
230
  }
673
231
  }
674
232
  catch (error) {
675
- await frameworkLogger.log("-post-processor", "-codex-compliance-check-failed-continuing-with-com", "error", {
233
+ await frameworkLogger.log("postprocessor", "codex-compliance-check-failed", "error", {
676
234
  message: "⚠️ Codex compliance check failed - continuing with commit",
677
235
  });
678
236
  }
@@ -692,7 +250,7 @@ All path violations will be automatically detected and blocked.
692
250
  endTime: Date.now(),
693
251
  duration: Date.now() - startTime,
694
252
  });
695
- await frameworkLogger.log("-post-processor", "-post-processor-loop-completed-result-success-succ", "success", {
253
+ await frameworkLogger.log("postprocessor", "loop-completed", "success", {
696
254
  message: `✅ Post-processor loop completed: ${result.success ? "SUCCESS" : "FAILED"}`,
697
255
  });
698
256
  return result;
@@ -725,14 +283,14 @@ All path violations will be automatically detected and blocked.
725
283
  const monitoringResults = [];
726
284
  while (attempts < maxAttempts) {
727
285
  attempts++;
728
- await frameworkLogger.log("-post-processor", "-monitoring-attempt-attempts-maxattempts-for-conte", "info", {
286
+ await frameworkLogger.log("postprocessor", "monitoring-attempt", "info", {
729
287
  message: `🔍 Monitoring attempt ${attempts}/${maxAttempts} for ${context.commitSha}`,
730
288
  });
731
289
  // Monitor CI/CD status
732
290
  const monitoringResult = await this.monitoringEngine.monitorDeployment(context.commitSha);
733
291
  monitoringResults.push(monitoringResult);
734
292
  if (monitoringResult.overallStatus === "success") {
735
- await frameworkLogger.log("-post-processor", "-ci-cd-pipeline-successful-post-processor-complete", "success", { message: "✅ CI/CD pipeline successful - post-processor complete" });
293
+ await frameworkLogger.log("postprocessor", "pipeline-success", "success", { message: "✅ CI/CD pipeline successful - post-processor complete" });
736
294
  const result = {
737
295
  success: true,
738
296
  commitSha: context.commitSha,
@@ -791,7 +349,7 @@ All path violations will be automatically detected and blocked.
791
349
  const { importResolver: resolver } = await import("../utils/import-resolver.js");
792
350
  const { ProcessorManager: PM } = await resolver.importModule("processors/processor-manager");
793
351
  const pm = new PM(this.stateManager);
794
- const postProcessorConfig = await this.loadProcessorConfig();
352
+ const postProcessorConfig = await this.configLoader.loadProcessorConfig();
795
353
  const POST_MAP = {
796
354
  storytellingTrigger: { type: "post", priority: 5 },
797
355
  sessionSummary: { type: "post", priority: 15 },
@@ -829,28 +387,28 @@ All path violations will be automatically detected and blocked.
829
387
  }
830
388
  // Generate automated framework report if threshold met
831
389
  const complexityScore = this.calculateComplexityScore(monitoringResults, context);
832
- const reportPath = await this.generateFrameworkReport(complexityScore, context, sessionId);
390
+ const reportPath = await this.reporter.generateFrameworkReport(complexityScore, context, sessionId);
833
391
  // Validate the generated report for hidden issues
834
392
  if (reportPath) {
835
- await this.validateGeneratedReport(reportPath, "framework");
393
+ await this.reporter.validateGeneratedReport(reportPath, "framework");
836
394
  }
837
395
  return result;
838
396
  }
839
397
  // Pipeline failed - analyze and attempt fixes
840
398
  await frameworkLogger.log("postprocessor", "ci-cd-pipeline-failed", "error", { jobId, action: "analyzing-issues" });
841
399
  const analysis = await this.failureAnalysisEngine.analyzeFailure(monitoringResult);
842
- await frameworkLogger.log("-post-processor", "-analysis-complete-analysis-category-analysis-seve", "info", {
400
+ await frameworkLogger.log("postprocessor", "analysis-complete", "info", {
843
401
  message: `🔍 Analysis complete: ${analysis.category} (${analysis.severity}) - ${analysis.rootCause}`,
844
402
  });
845
403
  const fixResult = await this.autoFixEngine.applyFixes(analysis, context);
846
404
  if (fixResult.success && fixResult.appliedFixes.length > 0) {
847
- await frameworkLogger.log("-post-processor", "-fixresult-appliedfixes-length-fix-es-applied-succ", "success", {
405
+ await frameworkLogger.log("postprocessor", "fixes-applied", "success", {
848
406
  message: `🔧 ${fixResult.appliedFixes.length} fix(es) applied successfully`,
849
407
  });
850
408
  // Validate that fixes resolve the issue
851
409
  const validationPassed = await this.fixValidator.validateFixes(fixResult.appliedFixes, analysis, context);
852
410
  if (validationPassed) {
853
- await frameworkLogger.log("-post-processor", "-fix-validation-passed-redeploying-", "success", { message: "✅ Fix validation passed - redeploying..." });
411
+ await frameworkLogger.log("postprocessor", "fix-validation-passed", "success", { message: "✅ Fix validation passed - redeploying..." });
854
412
  await this.redeployWithFixes(context, fixResult, jobId);
855
413
  // Continue monitoring with next attempt
856
414
  continue;
@@ -863,8 +421,8 @@ All path violations will be automatically detected and blocked.
863
421
  // Check if escalation is needed before retry
864
422
  const escalationResult = await this.escalationEngine.evaluateEscalation(context, attempts, "CI/CD pipeline failure", monitoringResults);
865
423
  if (escalationResult) {
866
- await frameworkLogger.log("-post-processor", "-escalation-triggered-escalationresult-level-", "info", { message: `🚨 Escalation triggered: ${escalationResult.level}` });
867
- await frameworkLogger.log("-post-processor", "-reason-escalationresult-reason-", "info", { message: ` Reason: ${escalationResult.reason}` });
424
+ await frameworkLogger.log("postprocessor", "escalation-triggered", "info", { message: `🚨 Escalation triggered: ${escalationResult.level}` });
425
+ await frameworkLogger.log("postprocessor", "escalation-reason", "info", { message: ` Reason: ${escalationResult.reason}` });
868
426
  // For emergency/rollback levels, stop the loop
869
427
  if (escalationResult.level === "emergency" ||
870
428
  escalationResult.level === "rollback") {
@@ -898,10 +456,10 @@ All path violations will be automatically detected and blocked.
898
456
  * Redeploy after applying fixes using the RedeployCoordinator
899
457
  */
900
458
  async redeployWithFixes(context, fixResult, jobId) {
901
- await frameworkLogger.log("-post-processor", "-executing-redeployment-with-fixes-", "info", { message: "🔄 Executing redeployment with fixes..." });
459
+ await frameworkLogger.log("postprocessor", "redeploy-start", "info", { message: "🔄 Executing redeployment with fixes..." });
902
460
  const redeployResult = await this.redeployCoordinator.executeRedeploy(context, fixResult);
903
461
  if (redeployResult.success) {
904
- await frameworkLogger.log("-post-processor", "-redeployment-successful-redeployresult-deployment", "success", {
462
+ await frameworkLogger.log("postprocessor", "redeploy-success", "success", {
905
463
  message: `✅ Redeployment successful: ${redeployResult.deploymentId}`,
906
464
  });
907
465
  }
@@ -921,7 +479,7 @@ All path violations will be automatically detected and blocked.
921
479
  * Escalate to manual intervention
922
480
  */
923
481
  async escalateToManualIntervention(context, monitoringResult, attempts) {
924
- await frameworkLogger.log("-post-processor", "-escalating-to-manual-intervention-", "info", { message: "🚨 Escalating to manual intervention" });
482
+ await frameworkLogger.log("postprocessor", "escalate-manual", "info", { message: "🚨 Escalating to manual intervention" });
925
483
  // Create detailed incident report
926
484
  const report = {
927
485
  commitSha: context.commitSha,
@@ -938,7 +496,7 @@ All path violations will be automatically detected and blocked.
938
496
  // Store escalation details
939
497
  await this.stateManager.set(`escalation:${context.commitSha}`, report);
940
498
  // TODO: Send notifications to development team
941
- await frameworkLogger.log("-post-processor", "-escalation-report-created-report", "info", { message: "📋 Escalation report created:", report });
499
+ await frameworkLogger.log("postprocessor", "escalation-report-created", "info", { message: "📋 Escalation report created", report });
942
500
  }
943
501
  /**
944
502
  * Wait before retry with exponential backoff
@@ -946,7 +504,7 @@ All path violations will be automatically detected and blocked.
946
504
  async waitBeforeRetry(attempt) {
947
505
  const baseDelay = this.config.retryDelay || 30000; // 30 seconds
948
506
  const delay = baseDelay * Math.pow(2, attempt - 1);
949
- await frameworkLogger.log("-post-processor", "-waiting-delay-ms-before-retry-attempt-attempt-1-", "info", { message: `⏳ Waiting ${delay}ms before retry attempt ${attempt + 1}` });
507
+ await frameworkLogger.log("postprocessor", "wait-before-retry", "info", { message: `⏳ Waiting ${delay}ms before retry attempt ${attempt + 1}` });
950
508
  await new Promise((resolve) => setTimeout(resolve, delay));
951
509
  }
952
510
  /**
@@ -959,54 +517,6 @@ All path violations will be automatically detected and blocked.
959
517
  monitoringStatus: await this.monitoringEngine.getStatus(),
960
518
  };
961
519
  }
962
- /**
963
- * Call appropriate agent/skill to fix architectural compliance violations
964
- */
965
- async callAgentForArchitecturalFix(violationType, agentName, skillName, context, violationMessage) {
966
- try {
967
- await frameworkLogger.log("-post-processor", "-calling-agentname-skillname-to-fix-violationtype-", "info", {
968
- message: `🔧 Calling ${agentName} (${skillName}) to fix: ${violationType}`,
969
- });
970
- // Call the skill invocation MCP server to delegate to the appropriate agent/skill
971
- const result = await mcpClientManager.callServerTool("skill-invocation", "invoke-skill", {
972
- skillName: skillName,
973
- toolName: "analyze_code_quality", // Default tool for analysis
974
- args: {
975
- code: context.files || [],
976
- language: "typescript",
977
- context: {
978
- violationType,
979
- message: violationMessage,
980
- commitSha: context.commitSha,
981
- repository: context.repository,
982
- branch: context.branch,
983
- author: context.author,
984
- },
985
- },
986
- });
987
- await frameworkLogger.log("-post-processor", "-agent-agentname-completed-fix-attempt-for-violati", "success", {
988
- message: `✅ Agent ${agentName} completed fix attempt for ${violationType}`,
989
- });
990
- // Check if the fix was successful by re-running the validation
991
- const fixed = await this.revalidateAfterFix(violationType, context);
992
- if (fixed) {
993
- await frameworkLogger.log("-post-processor", "-violationtype-violation-fixed-by-agentname-", "info", { message: `🎉 ${violationType} violation fixed by ${agentName}` });
994
- return true;
995
- }
996
- else {
997
- await frameworkLogger.log("-post-processor", "-violationtype-violation-not-fixed-by-agentname-", "error", {
998
- message: `❌ ${violationType} violation not fixed by ${agentName}`,
999
- });
1000
- return false;
1001
- }
1002
- }
1003
- catch (error) {
1004
- await frameworkLogger.log("-post-processor", "-failed-to-call-agent-agentname-for-violationtype-", "error", {
1005
- message: `❌ Failed to call agent ${agentName} for ${violationType}: ${error instanceof Error ? error.message : String(error)}`,
1006
- });
1007
- return false;
1008
- }
1009
- }
1010
520
  /**
1011
521
  * Calculate complexity score for automated report triggering
1012
522
  */
@@ -1021,28 +531,4 @@ All path violations will be automatically detected and blocked.
1021
531
  // Total score (0-100)
1022
532
  return Math.min(fileScore + monitoringScore, 100);
1023
533
  }
1024
- /**
1025
- * Revalidate after agent fix attempt
1026
- */
1027
- async revalidateAfterFix(violationType, context) {
1028
- switch (violationType) {
1029
- case "checkSystemIntegrity":
1030
- const integrityCheck = await this.checkSystemIntegrity(context);
1031
- return integrityCheck.passed;
1032
- case "checkIntegrationTesting":
1033
- const integrationCheck = await this.checkIntegrationTesting(context);
1034
- return integrationCheck.passed;
1035
- case "checkPathResolution":
1036
- const pathCheck = await this.checkPathResolution(context);
1037
- return pathCheck.passed;
1038
- case "checkFeatureCompleteness":
1039
- const completenessCheck = await this.checkFeatureCompleteness(context);
1040
- return completenessCheck.passed;
1041
- case "checkPathAnalysisGuidelines":
1042
- const guidelinesCheck = await this.checkPathAnalysisGuidelines(context);
1043
- return guidelinesCheck.passed;
1044
- default:
1045
- return false;
1046
- }
1047
- }
1048
534
  }