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.
- package/.opencode/codex.codex +1 -1
- package/.opencode/commands/dependency-audit.md +3 -3
- package/.opencode/enforcer-config.json +2 -2
- package/AGENTS.md +2 -1
- package/README.md +12 -11
- package/dist/AGENTS.md +2 -1
- package/dist/CHANGELOG.md +38 -0
- package/dist/README.md +12 -11
- package/dist/agents/code-reviewer.js +1 -1
- package/dist/analytics/routing-refiner.js +1 -1
- package/dist/cli/index.js +11 -1
- package/dist/cli/server.js +3 -3
- package/dist/core/activity-logger.d.ts +2 -2
- package/dist/core/activity-logger.js +4 -4
- package/dist/core/boot-orchestrator.d.ts +1 -1
- package/dist/core/boot-orchestrator.js +13 -28
- package/dist/core/bridge.mjs +3 -3
- package/dist/core/codex-formatter.js +2 -2
- package/dist/core/codex-injector.d.ts +0 -1
- package/dist/core/codex-injector.js +2 -3
- package/dist/core/config-loader.d.ts +1 -1
- package/dist/core/config-loader.js +1 -1
- package/dist/core/config-paths.d.ts +0 -2
- package/dist/core/config-paths.js +7 -8
- package/dist/core/context-loader.d.ts +1 -1
- package/dist/core/context-loader.js +1 -1
- package/dist/core/errors.d.ts +3 -0
- package/dist/core/errors.js +10 -0
- package/dist/core/features-config.js +1 -1
- package/dist/core/framework-logger.d.ts +3 -3
- package/dist/core/framework-logger.js +17 -9
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +4 -2
- package/dist/core/logging-config.d.ts +2 -1
- package/dist/core/logging-config.js +7 -7
- package/dist/enforcement/loaders/codex-loader.js +1 -1
- package/dist/execution/opencode-cli-invoker.js +5 -5
- package/dist/governance/governance-service.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/inference/inference-cycle.d.ts +1 -1
- package/dist/inference/inference-cycle.js +10 -10
- package/dist/integrations/base/Integration.js +1 -1
- package/dist/integrations/base/registry.js +19 -19
- package/dist/integrations/grok/grok-cli.js +17 -17
- package/dist/integrations/grok/hooks/pre-tool-use.js +1 -1
- package/dist/integrations/hermes-agent/bridge.mjs +1 -1
- package/dist/integrations/openclaw/api-server.d.ts +0 -1
- package/dist/integrations/openclaw/api-server.js +7 -10
- package/dist/integrations/openclaw/client.d.ts +0 -1
- package/dist/integrations/openclaw/client.js +22 -24
- package/dist/integrations/openclaw/hooks/xray-hooks.d.ts +0 -1
- package/dist/integrations/openclaw/hooks/xray-hooks.js +17 -18
- package/dist/integrations/plugins/plugin-registry.js +5 -5
- package/dist/mcps/architect-tools.server.d.ts +2 -4
- package/dist/mcps/architect-tools.server.js +112 -195
- package/dist/mcps/auto-format.server.d.ts +2 -4
- package/dist/mcps/auto-format.server.js +49 -95
- package/dist/mcps/boot-orchestrator.server.d.ts +2 -4
- package/dist/mcps/boot-orchestrator.server.js +73 -105
- package/dist/mcps/config/server-config-registry.js +3 -3
- package/dist/mcps/enforcer-tools.server.d.ts +2 -4
- package/dist/mcps/enforcer-tools.server.js +202 -285
- package/dist/mcps/estimation.server.d.ts +2 -4
- package/dist/mcps/estimation.server.js +63 -107
- package/dist/mcps/framework-compliance-audit.server.d.ts +2 -4
- package/dist/mcps/framework-compliance-audit.server.js +53 -82
- package/dist/mcps/framework-help.server.d.ts +2 -4
- package/dist/mcps/framework-help.server.js +63 -101
- package/dist/mcps/governance.server.js +2 -2
- package/dist/mcps/knowledge-skills/api-design.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/api-design.server.js +35 -67
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -10
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +35 -74
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +143 -162
- package/dist/mcps/knowledge-skills/code-analyzer.server.d.ts +3 -4
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +20 -45
- package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/code-review.server.js +109 -143
- package/dist/mcps/knowledge-skills/content-creator.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/content-creator.server.js +205 -226
- package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/database-design.server.js +117 -151
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +71 -160
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/git-workflow.server.js +36 -68
- package/dist/mcps/knowledge-skills/growth-strategist.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +303 -324
- package/dist/mcps/knowledge-skills/log-monitor.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/log-monitor.server.js +141 -160
- package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/mobile-development.server.js +92 -209
- package/dist/mcps/knowledge-skills/multimodal-looker.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +123 -159
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -5
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +155 -296
- package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/project-analysis.server.js +75 -226
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +63 -156
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/security-audit.server.js +102 -136
- package/dist/mcps/knowledge-skills/seo-consultant.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +80 -203
- package/dist/mcps/knowledge-skills/session-management.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/session-management.server.js +50 -203
- package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +168 -347
- package/dist/mcps/knowledge-skills/strategist.server.d.ts +2 -11
- package/dist/mcps/knowledge-skills/strategist.server.js +72 -122
- package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/tech-writer.server.js +87 -300
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +147 -182
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -4
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +78 -153
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -5
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +90 -399
- package/dist/mcps/lint.server.d.ts +2 -4
- package/dist/mcps/lint.server.js +51 -92
- package/dist/mcps/mcp-client.js +2 -2
- package/dist/mcps/model-health-check.server.d.ts +2 -4
- package/dist/mcps/model-health-check.server.js +32 -60
- package/dist/mcps/performance-analysis.server.d.ts +2 -4
- package/dist/mcps/performance-analysis.server.js +57 -88
- package/dist/mcps/processor-pipeline.server.d.ts +2 -4
- package/dist/mcps/processor-pipeline.server.js +69 -100
- package/dist/mcps/registry.json +1 -1
- package/dist/mcps/researcher.server.d.ts +3 -5
- package/dist/mcps/researcher.server.js +81 -154
- package/dist/mcps/security-scan.server.d.ts +2 -4
- package/dist/mcps/security-scan.server.js +54 -96
- package/dist/mcps/shared/knowledge-skill-base.d.ts +14 -0
- package/dist/mcps/shared/knowledge-skill-base.js +45 -0
- package/dist/{security → mcps/shared}/security-scanner.js +1 -1
- package/dist/mcps/state-manager.server.d.ts +2 -4
- package/dist/mcps/state-manager.server.js +115 -160
- package/dist/orchestrator/orchestrator.d.ts +1 -1
- package/dist/orchestrator/orchestrator.js +1 -1
- package/dist/orchestrator/universal-registry-bridge.js +1 -1
- package/dist/plugin/xray-codex-injection.d.ts +1 -1
- package/dist/plugin/xray-codex-injection.js +1 -1
- package/dist/postprocessor/PostProcessor.d.ts +4 -44
- package/dist/postprocessor/PostProcessor.js +39 -553
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +11 -0
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
- package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.d.ts +11 -0
- package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.js +356 -0
- package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +44 -0
- package/dist/postprocessor/config/ProcessorConfigLoader.js +21 -0
- package/dist/postprocessor/reporting/PostProcessorReporter.d.ts +19 -0
- package/dist/postprocessor/reporting/PostProcessorReporter.js +96 -0
- package/dist/postprocessor/triggers/GitHookTrigger.js +11 -11
- package/dist/processors/implementations/refactoring-logging-processor-wrapper.d.ts +32 -0
- package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +95 -1
- package/dist/processors/processor-manager.js +346 -314
- package/dist/reporting/report-formatter.js +1 -1
- package/dist/security/security-hardener.d.ts +69 -2
- package/dist/security/security-hardener.js +129 -1
- package/dist/skills/registry.json +1 -1
- package/dist/state/index.d.ts +3 -5
- package/dist/state/index.js +1 -7
- package/dist/state/state-manager.d.ts +1 -1
- package/dist/state/state-manager.js +2 -3
- package/package.json +13 -10
- package/scripts/node/universal-version-manager.js +11 -11
- package/src/mcps/architect-tools.server.ts +112 -215
- package/src/mcps/auto-format.server.ts +50 -110
- package/src/mcps/boot-orchestrator.server.ts +75 -121
- package/src/mcps/config/__tests__/server-config-registry.test.ts +21 -12
- package/src/mcps/config/server-config-registry.ts +3 -3
- package/src/mcps/enforcer-tools.server.ts +212 -310
- package/src/mcps/estimation.server.ts +62 -122
- package/src/mcps/framework-compliance-audit.server.ts +52 -97
- package/src/mcps/framework-help.server.ts +64 -114
- package/src/mcps/governance.server.ts +2 -2
- package/src/mcps/knowledge-skills/api-design.server.ts +32 -77
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +31 -87
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +165 -193
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +20 -55
- package/src/mcps/knowledge-skills/code-review.server.ts +114 -161
- package/src/mcps/knowledge-skills/content-creator.server.ts +218 -255
- package/src/mcps/knowledge-skills/database-design.server.ts +118 -165
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +67 -172
- package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -361
- package/src/mcps/knowledge-skills/log-monitor.server.ts +160 -187
- package/src/mcps/knowledge-skills/mobile-development.server.ts +89 -223
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +128 -175
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +156 -329
- package/src/mcps/knowledge-skills/project-analysis.server.ts +72 -248
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +59 -171
- package/src/mcps/knowledge-skills/security-audit.server.ts +104 -151
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +80 -220
- package/src/mcps/knowledge-skills/session-management.server.ts +51 -232
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +165 -372
- package/src/mcps/knowledge-skills/strategist.server.ts +72 -143
- package/src/mcps/knowledge-skills/tech-writer.server.ts +85 -350
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +146 -195
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +75 -161
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +93 -487
- package/src/mcps/lint.server.ts +53 -107
- package/src/mcps/mcp-client.ts +2 -2
- package/src/mcps/model-health-check.server.ts +34 -71
- package/src/mcps/performance-analysis.server.ts +60 -104
- package/src/mcps/processor-pipeline.server.ts +72 -110
- package/src/mcps/registry.json +1 -1
- package/src/mcps/researcher.server.ts +88 -177
- package/src/mcps/security-scan.server.ts +55 -104
- package/src/mcps/shared/knowledge-skill-base.ts +62 -0
- package/src/mcps/shared/prompt-security-validator.ts +199 -0
- package/src/mcps/shared/security-scanner.ts +599 -0
- package/src/mcps/state-manager.server.ts +117 -175
- package/src/opencode/codex.codex +1 -1
- package/src/opencode/commands/dependency-audit.md +3 -3
- package/src/opencode/enforcer-config.json +2 -2
- package/src/skills/registry.json +1 -1
- package/xray/codex.json +1 -1
- package/xray/config.json +1 -1
- package/xray/features.json +1 -1
- package/xray/integrations.json +3 -3
- package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/conftest.py +0 -14
- package/dist/integrations/hermes-agent/test_plugin.py +0 -1103
- package/dist/processors/implementations/refactoring-logging-processor.d.ts +0 -31
- package/dist/processors/implementations/refactoring-logging-processor.js +0 -96
- package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
- package/dist/processors/implementations/session-capture-processor.js +0 -37
- package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
- package/dist/scripts/activate-kernel-pipeline.js +0 -101
- package/dist/security/index.d.ts +0 -13
- package/dist/security/index.js +0 -13
- package/dist/security/security-agent-coordinator.d.ts +0 -72
- package/dist/security/security-agent-coordinator.js +0 -204
- package/dist/security/security-auditor.d.ts +0 -56
- package/dist/security/security-auditor.js +0 -584
- package/dist/security/security-hardening-system.d.ts +0 -239
- package/dist/security/security-hardening-system.js +0 -727
- package/dist/security/security-orchestration-layer.d.ts +0 -119
- package/dist/security/security-orchestration-layer.js +0 -496
- /package/dist/{security → mcps/shared}/prompt-security-validator.d.ts +0 -0
- /package/dist/{security → mcps/shared}/prompt-security-validator.js +0 -0
- /package/dist/{security → mcps/shared}/security-scanner.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PostProcessorContext } from "../types.js";
|
|
2
|
+
export declare class CodeChangeAnalyzer {
|
|
3
|
+
analyzeCodeChanges(context: PostProcessorContext): Promise<{
|
|
4
|
+
operation: "commit";
|
|
5
|
+
files: string[];
|
|
6
|
+
newCode: Map<string, string>;
|
|
7
|
+
existingCode: Map<string, string>;
|
|
8
|
+
tests: string[];
|
|
9
|
+
dependencies: string[];
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { frameworkLogger } from "../../core/framework-logger.js";
|
|
2
|
+
export class CodeChangeAnalyzer {
|
|
3
|
+
async analyzeCodeChanges(context) {
|
|
4
|
+
const fs = await import("fs");
|
|
5
|
+
const path = await import("path");
|
|
6
|
+
const newCode = new Map();
|
|
7
|
+
const existingCode = new Map();
|
|
8
|
+
const tests = [];
|
|
9
|
+
const dependencies = [];
|
|
10
|
+
try {
|
|
11
|
+
// Read new/changed files
|
|
12
|
+
for (const file of context.files || []) {
|
|
13
|
+
try {
|
|
14
|
+
const fullPath = path.join(process.cwd(), file);
|
|
15
|
+
if (fs.existsSync(fullPath)) {
|
|
16
|
+
// Read new code
|
|
17
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
18
|
+
newCode.set(file, content);
|
|
19
|
+
// Check for test files
|
|
20
|
+
if (file.includes(".test.") || file.includes(".spec.")) {
|
|
21
|
+
tests.push(file);
|
|
22
|
+
}
|
|
23
|
+
// Check for package.json or dependency files
|
|
24
|
+
if (file.includes("package.json") || file.includes("requirements.txt") || file.includes("Cargo.toml")) {
|
|
25
|
+
dependencies.push(file);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
// Skip files that can't be read
|
|
31
|
+
await frameworkLogger.log("-post-processor", "-code-analysis-file-error", "info", { message: `Could not analyze ${file}: ${error}` });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
await frameworkLogger.log("-post-processor", "-code-analysis-complete", "info", {
|
|
35
|
+
message: `Analyzed ${newCode.size} files, ${tests.length} tests, ${dependencies.length} dependencies`,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
await frameworkLogger.log("-post-processor", "-code-analysis-failed", "error", { message: `Code analysis failed: ${error}` });
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
operation: "commit",
|
|
43
|
+
files: context.files || [],
|
|
44
|
+
newCode,
|
|
45
|
+
existingCode,
|
|
46
|
+
tests,
|
|
47
|
+
dependencies,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PostProcessorContext } from "../types.js";
|
|
2
|
+
export declare class ArchitecturalComplianceChecker {
|
|
3
|
+
validateArchitecturalCompliance(context: PostProcessorContext): Promise<boolean>;
|
|
4
|
+
private checkSystemIntegrity;
|
|
5
|
+
private checkIntegrationTesting;
|
|
6
|
+
private checkPathResolution;
|
|
7
|
+
private checkFeatureCompleteness;
|
|
8
|
+
private checkPathAnalysisGuidelines;
|
|
9
|
+
private callAgentForArchitecturalFix;
|
|
10
|
+
private revalidateAfterFix;
|
|
11
|
+
}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { frameworkLogger } from "../../core/framework-logger.js";
|
|
2
|
+
import { mcpClientManager } from "../../mcps/mcp-client.js";
|
|
3
|
+
export class ArchitecturalComplianceChecker {
|
|
4
|
+
async validateArchitecturalCompliance(context) {
|
|
5
|
+
try {
|
|
6
|
+
await frameworkLogger.log("postprocessor", "compliance-validate", "info", { message: "🏗️ Validating architectural compliance..." });
|
|
7
|
+
// Rule 46: System Integrity Cross-Check
|
|
8
|
+
const integrityCheck = await this.checkSystemIntegrity(context);
|
|
9
|
+
if (!integrityCheck.passed) {
|
|
10
|
+
await frameworkLogger.log("postprocessor", "system-integrity-violation", "error", {
|
|
11
|
+
message: `❌ System integrity violation: ${integrityCheck.message}`,
|
|
12
|
+
});
|
|
13
|
+
// Call researcher agent to analyze system components
|
|
14
|
+
const fixed = await this.callAgentForArchitecturalFix("checkSystemIntegrity", "researcher", "project-analysis", context, integrityCheck.message);
|
|
15
|
+
if (!fixed) {
|
|
16
|
+
return false; // Could not auto-fix
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Rule 47: Integration Testing Mandate
|
|
20
|
+
const integrationCheck = await this.checkIntegrationTesting(context);
|
|
21
|
+
if (!integrationCheck.passed) {
|
|
22
|
+
await frameworkLogger.log("postprocessor", "integration-testing-violation", "error", {
|
|
23
|
+
message: `❌ Integration testing violation: ${integrationCheck.message}`,
|
|
24
|
+
});
|
|
25
|
+
// Call testing-lead agent for testing strategy
|
|
26
|
+
const fixed = await this.callAgentForArchitecturalFix("checkIntegrationTesting", "testing-lead", "testing-strategy", context, integrationCheck.message);
|
|
27
|
+
if (!fixed) {
|
|
28
|
+
return false; // Could not auto-fix
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Rule 48: Path Resolution Abstraction
|
|
32
|
+
const pathCheck = await this.checkPathResolution(context);
|
|
33
|
+
if (!pathCheck.passed) {
|
|
34
|
+
await frameworkLogger.log("postprocessor", "path-resolution-violation", "error", { message: `❌ Path resolution violation: ${pathCheck.message}` });
|
|
35
|
+
// Call researcher + refactorer for path analysis and fixes
|
|
36
|
+
const fixed = await this.callAgentForArchitecturalFix("checkPathResolution", "researcher", "project-analysis", context, pathCheck.message);
|
|
37
|
+
if (!fixed) {
|
|
38
|
+
return false; // Could not auto-fix
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Rule 49: Feature Completeness Validation
|
|
42
|
+
const completenessCheck = await this.checkFeatureCompleteness(context);
|
|
43
|
+
if (!completenessCheck.passed) {
|
|
44
|
+
await frameworkLogger.log("postprocessor", "feature-completeness-violation", "error", {
|
|
45
|
+
message: `❌ Feature completeness violation: ${completenessCheck.message}`,
|
|
46
|
+
});
|
|
47
|
+
// Call architect agent for system design analysis
|
|
48
|
+
const fixed = await this.callAgentForArchitecturalFix("checkFeatureCompleteness", "architect", "architecture-patterns", context, completenessCheck.message);
|
|
49
|
+
if (!fixed) {
|
|
50
|
+
return false; // Could not auto-fix
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Rule 50: Path Analysis Guidelines Enforcement
|
|
54
|
+
const pathGuidelinesCheck = await this.checkPathAnalysisGuidelines(context);
|
|
55
|
+
if (!pathGuidelinesCheck.passed) {
|
|
56
|
+
await frameworkLogger.log("postprocessor", "path-analysis-guidelines-violation", "error", {
|
|
57
|
+
message: `❌ Path analysis guidelines violation: ${pathGuidelinesCheck.message}`,
|
|
58
|
+
});
|
|
59
|
+
// Call refactorer agent for code refactoring
|
|
60
|
+
const fixed = await this.callAgentForArchitecturalFix("checkPathAnalysisGuidelines", "refactorer", "refactoring-strategies", context, pathGuidelinesCheck.message);
|
|
61
|
+
if (!fixed) {
|
|
62
|
+
return false; // Could not auto-fix
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
await frameworkLogger.log("postprocessor", "compliance-all-passed", "success", { message: "✅ All architectural compliance checks passed" });
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
await frameworkLogger.log("postprocessor", "compliance-validation-failed", "error", {
|
|
70
|
+
message: `❌ Architectural compliance validation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
71
|
+
});
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async checkSystemIntegrity(context) {
|
|
76
|
+
// Check if all critical framework components are active
|
|
77
|
+
const stateManager = globalThis.strRayStateManager;
|
|
78
|
+
const postProcessor = globalThis.strRayPostProcessor;
|
|
79
|
+
if (!stateManager) {
|
|
80
|
+
try {
|
|
81
|
+
const { StrRayStateManager } = await import("../../state/state-manager.js");
|
|
82
|
+
const tempStateManager = new StrRayStateManager();
|
|
83
|
+
globalThis.strRayStateManager = tempStateManager;
|
|
84
|
+
return {
|
|
85
|
+
passed: true,
|
|
86
|
+
message: "System integrity verified (graceful mode)",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
return {
|
|
91
|
+
passed: true,
|
|
92
|
+
message: "System integrity assumed OK (no full framework context)",
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!postProcessor) {
|
|
97
|
+
return {
|
|
98
|
+
passed: true,
|
|
99
|
+
message: "System integrity verified (state manager active)",
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return { passed: true, message: "System integrity verified" };
|
|
103
|
+
}
|
|
104
|
+
async checkIntegrationTesting(context) {
|
|
105
|
+
// For now, we assume integration testing has been run as part of the CI/CD process
|
|
106
|
+
// In a full implementation, this would check actual test results
|
|
107
|
+
return {
|
|
108
|
+
passed: true,
|
|
109
|
+
message: "Integration testing assumed to be completed in CI/CD pipeline",
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async checkPathResolution(context) {
|
|
113
|
+
// Check for path resolution issues in committed files
|
|
114
|
+
// This would require reading the actual file contents from git
|
|
115
|
+
// For now, we verify that the framework's path resolution is working
|
|
116
|
+
const pathResolver = globalThis.strRayPathResolver;
|
|
117
|
+
if (!pathResolver) {
|
|
118
|
+
return {
|
|
119
|
+
passed: true,
|
|
120
|
+
message: "Path resolution check skipped (no full framework context)",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// Test path resolution with a sample path
|
|
124
|
+
try {
|
|
125
|
+
const resolvedPath = pathResolver.resolveAgentPath("test-agent");
|
|
126
|
+
if (resolvedPath.includes("../") || resolvedPath.includes("./dist")) {
|
|
127
|
+
return {
|
|
128
|
+
passed: false,
|
|
129
|
+
message: "Path resolution returning hardcoded paths",
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return { passed: true, message: "Path resolution abstraction verified" };
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
return {
|
|
136
|
+
passed: false,
|
|
137
|
+
message: `Path resolution failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async checkFeatureCompleteness(context) {
|
|
142
|
+
// This is a simplified check - in practice, we'd analyze the commit and PR data
|
|
143
|
+
// For now, we assume completeness based on the context having required fields
|
|
144
|
+
// Graceful degradation - assume OK if no full commit context
|
|
145
|
+
if (!context.commitSha || !context.repository) {
|
|
146
|
+
return {
|
|
147
|
+
passed: true,
|
|
148
|
+
message: "Feature completeness assumed OK (no full commit context)",
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return { passed: true, message: "Feature completeness verified" };
|
|
152
|
+
}
|
|
153
|
+
async checkPathAnalysisGuidelines(context) {
|
|
154
|
+
// Check if the current operation involves code changes that might introduce path issues
|
|
155
|
+
if (!context.files || context.files.length === 0) {
|
|
156
|
+
return { passed: true, message: "No files to check for path guidelines" };
|
|
157
|
+
}
|
|
158
|
+
// Check for TypeScript/JavaScript files that might contain imports
|
|
159
|
+
const codeFiles = context.files.filter((file) => file.endsWith(".ts") ||
|
|
160
|
+
file.endsWith(".js") ||
|
|
161
|
+
file.endsWith(".tsx") ||
|
|
162
|
+
file.endsWith(".jsx"));
|
|
163
|
+
if (codeFiles.length === 0) {
|
|
164
|
+
return {
|
|
165
|
+
passed: true,
|
|
166
|
+
message: "No code files to validate for path guidelines",
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// For write/edit operations, notify AIs about ALL THREE types of path violations
|
|
170
|
+
const guidelinesMessage = `
|
|
171
|
+
🚨 CRITICAL: PATH ANALYSIS GUIDELINES ENFORCEMENT 🚨
|
|
172
|
+
|
|
173
|
+
AI Operations Detected: ${context.trigger} trigger with ${codeFiles.length} code file(s)
|
|
174
|
+
MANDATORY COMPLIANCE REQUIRED - VIOLATIONS WILL BLOCK COMMITS
|
|
175
|
+
|
|
176
|
+
═══════════════════════════════════════════════════════════════
|
|
177
|
+
🔴 TYPE 1: HARDCODED 'dist/' PATHS (17 files affected)
|
|
178
|
+
═══════════════════════════════════════════════════════════════
|
|
179
|
+
|
|
180
|
+
❌ NEVER use hardcoded 'dist/' paths in source code:
|
|
181
|
+
\`\`\`typescript
|
|
182
|
+
// WRONG - Breaks across environments (actual violations found)
|
|
183
|
+
import { RuleEnforcer } from "../enforcement/rule-enforcer.js";
|
|
184
|
+
// FIXED: Removed hardcoded dist/ path (was causing dist/dist corruption in builds)
|
|
185
|
+
\`\`\`
|
|
186
|
+
|
|
187
|
+
✅ CORRECT - Use import resolver for environment awareness:
|
|
188
|
+
\`\`\`typescript
|
|
189
|
+
// Environment-aware imports (Solution C)
|
|
190
|
+
const { importResolver } = await import('./utils/import-resolver.js');
|
|
191
|
+
const { RuleEnforcer } = await importResolver.importModule('enforcement/rule-enforcer');
|
|
192
|
+
\`\`\`
|
|
193
|
+
|
|
194
|
+
═══════════════════════════════════════════════════════════════
|
|
195
|
+
🟡 TYPE 2: PROBLEMATIC '../' IMPORTS (107 files affected)
|
|
196
|
+
═══════════════════════════════════════════════════════════════
|
|
197
|
+
|
|
198
|
+
❌ Directory structure assumptions that break across environments:
|
|
199
|
+
\`\`\`typescript
|
|
200
|
+
// WRONG - Assumes specific deployment structure
|
|
201
|
+
import { AgentConfig } from "../agents/code-reviewer.js"; // May break if directories move
|
|
202
|
+
import { Utils } from "../../../shared/utils.js"; // Fragile deep navigation
|
|
203
|
+
\`\`\`
|
|
204
|
+
|
|
205
|
+
✅ CORRECT - Use stable relative imports within modules:
|
|
206
|
+
\`\`\`typescript
|
|
207
|
+
// Stable within src/ directory structure
|
|
208
|
+
import { AgentConfig } from "../agents/code-reviewer.js"; // OK within same project
|
|
209
|
+
import { Utils } from "../../shared/utils.js"; // Prefer shallower paths
|
|
210
|
+
\`\`\`
|
|
211
|
+
|
|
212
|
+
═══════════════════════════════════════════════════════════════
|
|
213
|
+
🟠 TYPE 3: BRITTLE './' IMPORTS (151 files affected)
|
|
214
|
+
═══════════════════════════════════════════════════════════════
|
|
215
|
+
|
|
216
|
+
❌ Local file assumptions that break when files move:
|
|
217
|
+
\`\`\`typescript
|
|
218
|
+
// WRONG - Assumes file exists in specific location
|
|
219
|
+
import { Config } from "./config.js"; // May not exist in built version
|
|
220
|
+
import { Utils } from "./utils/helpers.js"; // Breaks if directory reorganized
|
|
221
|
+
\`\`\`
|
|
222
|
+
|
|
223
|
+
✅ CORRECT - Use proper module resolution:
|
|
224
|
+
\`\`\`typescript
|
|
225
|
+
// Prefer named imports from index files
|
|
226
|
+
import { Config } from "./config/index.js";
|
|
227
|
+
import { helpers } from "./utils/index.js";
|
|
228
|
+
|
|
229
|
+
// Or use full relative paths when necessary
|
|
230
|
+
import { Config } from "./config/config.js";
|
|
231
|
+
\`\`\`
|
|
232
|
+
|
|
233
|
+
═══════════════════════════════════════════════════════════════
|
|
234
|
+
🛠️ RECOMMENDED SOLUTIONS FROM PATH_RESOLUTION_ANALYSIS.md
|
|
235
|
+
═══════════════════════════════════════════════════════════════
|
|
236
|
+
|
|
237
|
+
**Solution A: Environment Variables (Simple)**
|
|
238
|
+
\`\`\`typescript
|
|
239
|
+
const AGENTS_PATH = process.env.XRAY_AGENTS_PATH || '../agents';
|
|
240
|
+
import { AgentConfig } from \`\${AGENTS_PATH}/code-reviewer.js\`;
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
**Solution B: Directory Structure Alignment (Architectural)**
|
|
244
|
+
- Ensure build output matches source structure
|
|
245
|
+
- Use aligned plugin/component directories
|
|
246
|
+
- No code changes needed when structure is correct
|
|
247
|
+
|
|
248
|
+
**Solution C: Import Resolver (Recommended)**
|
|
249
|
+
\`\`\`typescript
|
|
250
|
+
const { importResolver } = await import('./utils/import-resolver.js');
|
|
251
|
+
const { Module } = await importResolver.importModule('path/to/module');
|
|
252
|
+
\`\`\`
|
|
253
|
+
|
|
254
|
+
═══════════════════════════════════════════════════════════════
|
|
255
|
+
⚠️ ENFORCEMENT LEVELS
|
|
256
|
+
═══════════════════════════════════════════════════════════════
|
|
257
|
+
|
|
258
|
+
🔴 BLOCKING: Hardcoded dist/ paths in source files
|
|
259
|
+
🟡 WARNING: Problematic deep ../ navigation (>3 levels)
|
|
260
|
+
🟠 MONITOR: Brittle ./ imports (logged for review)
|
|
261
|
+
|
|
262
|
+
AI MUST use appropriate solution based on context:
|
|
263
|
+
- Development scripts → Solution A (Environment Variables)
|
|
264
|
+
- Plugin components → Solution B (Directory Alignment)
|
|
265
|
+
- Dynamic imports → Solution C (Import Resolver)
|
|
266
|
+
|
|
267
|
+
═══════════════════════════════════════════════════════════════
|
|
268
|
+
📖 REFERENCE: PATH_RESOLUTION_ANALYSIS.md
|
|
269
|
+
═══════════════════════════════════════════════════════════════
|
|
270
|
+
|
|
271
|
+
Complete guidelines available in project documentation.
|
|
272
|
+
All path violations will be automatically detected and blocked.
|
|
273
|
+
`;
|
|
274
|
+
// Log the comprehensive guidelines notification for AIs
|
|
275
|
+
await frameworkLogger.log("postprocessor", "guidelines-message", "info", {
|
|
276
|
+
message: guidelinesMessage,
|
|
277
|
+
});
|
|
278
|
+
// In a full implementation, we would:
|
|
279
|
+
// 1. Scan actual file contents for violations
|
|
280
|
+
// 2. Use git diff to check changed imports
|
|
281
|
+
// 3. Validate against all three violation types
|
|
282
|
+
// 4. Block commits with actual violations found
|
|
283
|
+
// For now, we provide comprehensive guidance and assume compliance
|
|
284
|
+
// Future enhancement: Implement actual file scanning and blocking
|
|
285
|
+
return {
|
|
286
|
+
passed: true,
|
|
287
|
+
message: "Comprehensive path analysis guidelines notification sent to AI operations",
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
async callAgentForArchitecturalFix(violationType, agentName, skillName, context, violationMessage) {
|
|
291
|
+
try {
|
|
292
|
+
await frameworkLogger.log("postprocessor", "calling-agent-for-fix", "info", {
|
|
293
|
+
message: `🔧 Calling ${agentName} (${skillName}) to fix: ${violationType}`,
|
|
294
|
+
});
|
|
295
|
+
// Call the skill invocation MCP server to delegate to the appropriate agent/skill
|
|
296
|
+
const result = await mcpClientManager.callServerTool("skill-invocation", "invoke-skill", {
|
|
297
|
+
skillName: skillName,
|
|
298
|
+
toolName: "analyze_code_quality", // Default tool for analysis
|
|
299
|
+
args: {
|
|
300
|
+
code: context.files || [],
|
|
301
|
+
language: "typescript",
|
|
302
|
+
context: {
|
|
303
|
+
violationType,
|
|
304
|
+
message: violationMessage,
|
|
305
|
+
commitSha: context.commitSha,
|
|
306
|
+
repository: context.repository,
|
|
307
|
+
branch: context.branch,
|
|
308
|
+
author: context.author,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
await frameworkLogger.log("postprocessor", "agent-fix-attempt-complete", "success", {
|
|
313
|
+
message: `✅ Agent ${agentName} completed fix attempt for ${violationType}`,
|
|
314
|
+
});
|
|
315
|
+
// Check if the fix was successful by re-running the validation
|
|
316
|
+
const fixed = await this.revalidateAfterFix(violationType, context);
|
|
317
|
+
if (fixed) {
|
|
318
|
+
await frameworkLogger.log("postprocessor", "violation-fixed", "info", { message: `🎉 ${violationType} violation fixed by ${agentName}` });
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
await frameworkLogger.log("postprocessor", "violation-not-fixed", "error", {
|
|
323
|
+
message: `❌ ${violationType} violation not fixed by ${agentName}`,
|
|
324
|
+
});
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
catch (error) {
|
|
329
|
+
await frameworkLogger.log("postprocessor", "agent-call-failed", "error", {
|
|
330
|
+
message: `❌ Failed to call agent ${agentName} for ${violationType}: ${error instanceof Error ? error.message : String(error)}`,
|
|
331
|
+
});
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
async revalidateAfterFix(violationType, context) {
|
|
336
|
+
switch (violationType) {
|
|
337
|
+
case "checkSystemIntegrity":
|
|
338
|
+
const integrityCheck = await this.checkSystemIntegrity(context);
|
|
339
|
+
return integrityCheck.passed;
|
|
340
|
+
case "checkIntegrationTesting":
|
|
341
|
+
const integrationCheck = await this.checkIntegrationTesting(context);
|
|
342
|
+
return integrationCheck.passed;
|
|
343
|
+
case "checkPathResolution":
|
|
344
|
+
const pathCheck = await this.checkPathResolution(context);
|
|
345
|
+
return pathCheck.passed;
|
|
346
|
+
case "checkFeatureCompleteness":
|
|
347
|
+
const completenessCheck = await this.checkFeatureCompleteness(context);
|
|
348
|
+
return completenessCheck.passed;
|
|
349
|
+
case "checkPathAnalysisGuidelines":
|
|
350
|
+
const guidelinesCheck = await this.checkPathAnalysisGuidelines(context);
|
|
351
|
+
return guidelinesCheck.passed;
|
|
352
|
+
default:
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare class ProcessorConfigLoader {
|
|
2
|
+
loadProcessorConfig(): Promise<{
|
|
3
|
+
preValidate?: {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
codexCompliance?: {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
testAutoCreation?: {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
versionCompliance?: {
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
errorBoundary?: {
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
agentsMdValidation?: {
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
};
|
|
21
|
+
stateValidation?: {
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
post_processors?: {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
priority_order?: string[];
|
|
27
|
+
};
|
|
28
|
+
storytellingTrigger?: {
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
};
|
|
31
|
+
sessionSummary?: {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
};
|
|
34
|
+
testExecution?: {
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
};
|
|
37
|
+
regressionTesting?: {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
};
|
|
40
|
+
inferenceImprovement?: {
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { frameworkLogger } from "../../core/framework-logger.js";
|
|
2
|
+
import { resolveConfigPath } from "../../core/config-paths.js";
|
|
3
|
+
export class ProcessorConfigLoader {
|
|
4
|
+
async loadProcessorConfig() {
|
|
5
|
+
const fs = await import("fs");
|
|
6
|
+
const path = await import("path");
|
|
7
|
+
try {
|
|
8
|
+
const configPath = resolveConfigPath("features.json") ?? path.join(process.cwd(), "xray", "features.json");
|
|
9
|
+
if (fs.existsSync(configPath)) {
|
|
10
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
11
|
+
return config.processors || {};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
frameworkLogger.log("postprocessor", "processor-config-load-failed", "info", {
|
|
16
|
+
error: error instanceof Error ? error.message : String(error),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReportContentValidator } from "../../validation/report-content-validator.js";
|
|
2
|
+
import { PostProcessorConfig, PostProcessorContext } from "../types.js";
|
|
3
|
+
export declare class PostProcessorReporter {
|
|
4
|
+
private config;
|
|
5
|
+
private reportValidator;
|
|
6
|
+
constructor(config: PostProcessorConfig, reportValidator: ReportContentValidator);
|
|
7
|
+
/**
|
|
8
|
+
* Generate automated framework report if conditions are met
|
|
9
|
+
*/
|
|
10
|
+
generateFrameworkReport(complexityScore: number, context: PostProcessorContext, sessionId: string): Promise<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Validate generated reports for hidden issues
|
|
13
|
+
*/
|
|
14
|
+
validateGeneratedReport(reportPath: string, reportType: string): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Clean up old reports based on retention policy
|
|
17
|
+
*/
|
|
18
|
+
cleanupOldReports(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import { frameworkLogger } from "../../core/framework-logger.js";
|
|
3
|
+
import { frameworkReportingSystem } from "../../reporting/framework-reporting-system.js";
|
|
4
|
+
export class PostProcessorReporter {
|
|
5
|
+
config;
|
|
6
|
+
reportValidator;
|
|
7
|
+
constructor(config, reportValidator) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
this.reportValidator = reportValidator;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generate automated framework report if conditions are met
|
|
13
|
+
*/
|
|
14
|
+
async generateFrameworkReport(complexityScore, context, sessionId) {
|
|
15
|
+
if (!this.config.reporting.enabled || !this.config.reporting.autoGenerate) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
// Only generate report if complexity score meets threshold
|
|
19
|
+
if (complexityScore < this.config.reporting.reportThreshold) {
|
|
20
|
+
await frameworkLogger.log("postprocessor", "report-skipped-low-complexity", "info", {
|
|
21
|
+
complexityScore,
|
|
22
|
+
threshold: this.config.reporting.reportThreshold,
|
|
23
|
+
});
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
await frameworkLogger.log("-post-processor", "-generating-automated-framework-report-", "info", { message: "📊 Generating automated framework report..." });
|
|
28
|
+
const reportConfig = {
|
|
29
|
+
type: "full-analysis",
|
|
30
|
+
sessionId,
|
|
31
|
+
outputFormat: "markdown",
|
|
32
|
+
outputPath: path.join(this.config.reporting.reportDir, `framework-report-${context.commitSha}-${new Date().toISOString().split("T")[0]}.md`),
|
|
33
|
+
detailedMetrics: true,
|
|
34
|
+
timeRange: { lastHours: 24 },
|
|
35
|
+
};
|
|
36
|
+
await frameworkReportingSystem.generateReport(reportConfig);
|
|
37
|
+
await frameworkLogger.log("-post-processor", "-framework-report-generated-reportconfig-outputpat", "success", {
|
|
38
|
+
message: `✅ Framework report generated: ${reportConfig.outputPath}`,
|
|
39
|
+
});
|
|
40
|
+
// Clean up old reports
|
|
41
|
+
await this.cleanupOldReports();
|
|
42
|
+
return reportConfig.outputPath;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
await frameworkLogger.log("postprocessor", "framework-report-generation-failed", "warning", { error: String(error) });
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate generated reports for hidden issues
|
|
51
|
+
*/
|
|
52
|
+
async validateGeneratedReport(reportPath, reportType) {
|
|
53
|
+
try {
|
|
54
|
+
if (this.reportValidator) {
|
|
55
|
+
const validation = await this.reportValidator.validateReportContent(reportPath, reportType);
|
|
56
|
+
if (!validation.valid) {
|
|
57
|
+
await frameworkLogger.log("postprocessor", "report-validation-failed", "warning", { reportPath, issues: validation.issues });
|
|
58
|
+
if (validation.details.criticalErrors.length > 0) {
|
|
59
|
+
await frameworkLogger.log("postprocessor", "critical-errors-in-report", "error", { reportPath, criticalErrors: validation.details.criticalErrors });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
await frameworkLogger.log("postprocessor", "report-validation-passed", "success", { reportPath });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
await frameworkLogger.log("postprocessor", "report-validation-failed", "warning", { error: String(error) });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Clean up old reports based on retention policy
|
|
73
|
+
*/
|
|
74
|
+
async cleanupOldReports() {
|
|
75
|
+
try {
|
|
76
|
+
const fs = await import("fs");
|
|
77
|
+
const path = await import("path");
|
|
78
|
+
const reportDir = this.config.reporting.reportDir;
|
|
79
|
+
if (!fs.existsSync(reportDir))
|
|
80
|
+
return;
|
|
81
|
+
const files = fs.readdirSync(reportDir);
|
|
82
|
+
const cutoffTime = Date.now() - this.config.reporting.retentionDays * 24 * 60 * 60 * 1000;
|
|
83
|
+
for (const file of files) {
|
|
84
|
+
const filePath = path.join(reportDir, file);
|
|
85
|
+
const stats = fs.statSync(filePath);
|
|
86
|
+
if (stats.mtime.getTime() < cutoffTime) {
|
|
87
|
+
fs.unlinkSync(filePath);
|
|
88
|
+
await frameworkLogger.log("postprocessor", "cleaned-up-old-report", "info", { file });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
await frameworkLogger.log("postprocessor", "report-cleanup-failed", "warning", { error: String(error) });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|