mcp-wordpress 2.11.13 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +14 -29
  2. package/dist/cache/CacheInvalidation.js.map +1 -1
  3. package/dist/cache/CacheManager.d.ts +7 -0
  4. package/dist/cache/CacheManager.d.ts.map +1 -1
  5. package/dist/cache/CacheManager.js +21 -7
  6. package/dist/cache/CacheManager.js.map +1 -1
  7. package/dist/cache/HttpCacheWrapper.js.map +1 -1
  8. package/dist/cache/SEOCacheManager.d.ts.map +1 -1
  9. package/dist/cache/SEOCacheManager.js +6 -1
  10. package/dist/cache/SEOCacheManager.js.map +1 -1
  11. package/dist/cache/index.d.ts.map +1 -1
  12. package/dist/cache/index.js.map +1 -1
  13. package/dist/client/CachedWordPressClient.d.ts.map +1 -1
  14. package/dist/client/CachedWordPressClient.js.map +1 -1
  15. package/dist/client/MockWordPressClient.d.ts.map +1 -1
  16. package/dist/client/MockWordPressClient.js.map +1 -1
  17. package/dist/client/SEOWordPressClient.d.ts.map +1 -1
  18. package/dist/client/SEOWordPressClient.js.map +1 -1
  19. package/dist/client/api.d.ts +11 -26
  20. package/dist/client/api.d.ts.map +1 -1
  21. package/dist/client/api.js +111 -203
  22. package/dist/client/api.js.map +1 -1
  23. package/dist/client/auth.d.ts.map +1 -1
  24. package/dist/client/auth.js.map +1 -1
  25. package/dist/client/managers/AuthManager.d.ts.map +1 -1
  26. package/dist/client/managers/RequestManager.d.ts.map +1 -1
  27. package/dist/client/managers/RequestManager.js +6 -5
  28. package/dist/client/managers/RequestManager.js.map +1 -1
  29. package/dist/client/managers/composed/MigrationAdapter.d.ts +3 -3
  30. package/dist/client/managers/composed/MigrationAdapter.d.ts.map +1 -1
  31. package/dist/client/managers/composed/MigrationAdapter.js +2 -2
  32. package/dist/client/managers/composed/MigrationAdapter.js.map +1 -1
  33. package/dist/client/managers/composed/index.d.ts +7 -7
  34. package/dist/client/managers/composed/index.d.ts.map +1 -1
  35. package/dist/client/managers/composed/index.js +6 -6
  36. package/dist/client/managers/composed/index.js.map +1 -1
  37. package/dist/client/managers/implementations/ConfigurationProviderImpl.d.ts +1 -1
  38. package/dist/client/managers/implementations/ConfigurationProviderImpl.d.ts.map +1 -1
  39. package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts +1 -1
  40. package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts.map +1 -1
  41. package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts +1 -1
  42. package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts.map +1 -1
  43. package/dist/client/operations/comments.d.ts +58 -0
  44. package/dist/client/operations/comments.d.ts.map +1 -0
  45. package/dist/client/operations/comments.js +74 -0
  46. package/dist/client/operations/comments.js.map +1 -0
  47. package/dist/client/operations/index.d.ts +12 -0
  48. package/dist/client/operations/index.d.ts.map +1 -0
  49. package/dist/client/operations/index.js +12 -0
  50. package/dist/client/operations/index.js.map +1 -0
  51. package/dist/client/operations/media.d.ts +55 -0
  52. package/dist/client/operations/media.d.ts.map +1 -0
  53. package/dist/client/operations/media.js +132 -0
  54. package/dist/client/operations/media.js.map +1 -0
  55. package/dist/client/operations/pages.d.ts +50 -0
  56. package/dist/client/operations/pages.d.ts.map +1 -0
  57. package/dist/client/operations/pages.js +56 -0
  58. package/dist/client/operations/pages.js.map +1 -0
  59. package/dist/client/operations/posts.d.ts +50 -0
  60. package/dist/client/operations/posts.d.ts.map +1 -0
  61. package/dist/client/operations/posts.js +53 -0
  62. package/dist/client/operations/posts.js.map +1 -0
  63. package/dist/client/operations/site.d.ts +60 -0
  64. package/dist/client/operations/site.d.ts.map +1 -0
  65. package/dist/client/operations/site.js +83 -0
  66. package/dist/client/operations/site.js.map +1 -0
  67. package/dist/client/operations/taxonomies.d.ts +69 -0
  68. package/dist/client/operations/taxonomies.d.ts.map +1 -0
  69. package/dist/client/operations/taxonomies.js +87 -0
  70. package/dist/client/operations/taxonomies.js.map +1 -0
  71. package/dist/client/operations/users.d.ts +50 -0
  72. package/dist/client/operations/users.d.ts.map +1 -0
  73. package/dist/client/operations/users.js +57 -0
  74. package/dist/client/operations/users.js.map +1 -0
  75. package/dist/config/ServerConfiguration.d.ts.map +1 -1
  76. package/dist/config/ServerConfiguration.js.map +1 -1
  77. package/dist/docs/DocumentationGenerator.js.map +1 -1
  78. package/dist/performance/MetricsCollector.d.ts.map +1 -1
  79. package/dist/performance/MetricsCollector.js.map +1 -1
  80. package/dist/performance/PerformanceMonitor.js.map +1 -1
  81. package/dist/security/AISecurityScanner.d.ts.map +1 -1
  82. package/dist/security/AISecurityScanner.js +3 -2
  83. package/dist/security/AISecurityScanner.js.map +1 -1
  84. package/dist/security/AutomatedRemediation.js.map +1 -1
  85. package/dist/security/InputValidator.d.ts.map +1 -1
  86. package/dist/security/InputValidator.js +30 -18
  87. package/dist/security/InputValidator.js.map +1 -1
  88. package/dist/security/SecurityCIPipeline.d.ts +19 -196
  89. package/dist/security/SecurityCIPipeline.d.ts.map +1 -1
  90. package/dist/security/SecurityCIPipeline.js +95 -639
  91. package/dist/security/SecurityCIPipeline.js.map +1 -1
  92. package/dist/security/SecurityConfig.js.map +1 -1
  93. package/dist/security/SecurityConfigManager.js.map +1 -1
  94. package/dist/security/SecurityGateExecutor.d.ts +67 -0
  95. package/dist/security/SecurityGateExecutor.d.ts.map +1 -0
  96. package/dist/security/SecurityGateExecutor.js +363 -0
  97. package/dist/security/SecurityGateExecutor.js.map +1 -0
  98. package/dist/security/SecurityMonitoring.js.map +1 -1
  99. package/dist/security/SecurityReportGenerator.d.ts +65 -0
  100. package/dist/security/SecurityReportGenerator.d.ts.map +1 -0
  101. package/dist/security/SecurityReportGenerator.js +210 -0
  102. package/dist/security/SecurityReportGenerator.js.map +1 -0
  103. package/dist/security/SecurityReviewer.js.map +1 -1
  104. package/dist/security/SecurityTypes.d.ts +188 -0
  105. package/dist/security/SecurityTypes.d.ts.map +1 -0
  106. package/dist/security/SecurityTypes.js +6 -0
  107. package/dist/security/SecurityTypes.js.map +1 -0
  108. package/dist/security/index.d.ts +5 -28
  109. package/dist/security/index.d.ts.map +1 -1
  110. package/dist/security/index.js +4 -0
  111. package/dist/security/index.js.map +1 -1
  112. package/dist/server/ConnectionTester.d.ts.map +1 -1
  113. package/dist/server/ConnectionTester.js.map +1 -1
  114. package/dist/server/ToolRegistry.d.ts.map +1 -1
  115. package/dist/server/ToolRegistry.js.map +1 -1
  116. package/dist/tools/BaseToolManager.d.ts.map +1 -1
  117. package/dist/tools/BaseToolManager.js.map +1 -1
  118. package/dist/tools/auth.d.ts.map +1 -1
  119. package/dist/tools/auth.js.map +1 -1
  120. package/dist/tools/cache.d.ts.map +1 -1
  121. package/dist/tools/cache.js.map +1 -1
  122. package/dist/tools/comments.d.ts.map +1 -1
  123. package/dist/tools/comments.js.map +1 -1
  124. package/dist/tools/media.d.ts.map +1 -1
  125. package/dist/tools/media.js.map +1 -1
  126. package/dist/tools/pages.d.ts.map +1 -1
  127. package/dist/tools/pages.js.map +1 -1
  128. package/dist/tools/performance/PerformanceHelpers.d.ts +116 -0
  129. package/dist/tools/performance/PerformanceHelpers.d.ts.map +1 -0
  130. package/dist/tools/performance/PerformanceHelpers.js +298 -0
  131. package/dist/tools/performance/PerformanceHelpers.js.map +1 -0
  132. package/dist/tools/performance/PerformanceTools.d.ts +54 -0
  133. package/dist/tools/performance/PerformanceTools.d.ts.map +1 -0
  134. package/dist/tools/performance/PerformanceTools.js +687 -0
  135. package/dist/tools/performance/PerformanceTools.js.map +1 -0
  136. package/dist/tools/performance/index.d.ts +8 -0
  137. package/dist/tools/performance/index.d.ts.map +1 -0
  138. package/dist/tools/performance/index.js +8 -0
  139. package/dist/tools/performance/index.js.map +1 -0
  140. package/dist/tools/performance.d.ts +12 -69
  141. package/dist/tools/performance.d.ts.map +1 -1
  142. package/dist/tools/performance.js +12 -920
  143. package/dist/tools/performance.js.map +1 -1
  144. package/dist/tools/posts.d.ts.map +1 -1
  145. package/dist/tools/seo/analyzers/ContentAnalyzer.d.ts.map +1 -1
  146. package/dist/tools/seo/analyzers/ContentAnalyzer.js +14 -3
  147. package/dist/tools/seo/analyzers/ContentAnalyzer.js.map +1 -1
  148. package/dist/tools/seo/auditors/SiteAuditor.d.ts.map +1 -1
  149. package/dist/tools/seo/auditors/SiteAuditor.js +12 -3
  150. package/dist/tools/seo/auditors/SiteAuditor.js.map +1 -1
  151. package/dist/tools/seo/generators/MetaGenerator.d.ts.map +1 -1
  152. package/dist/tools/seo/generators/MetaGenerator.js +25 -8
  153. package/dist/tools/seo/generators/MetaGenerator.js.map +1 -1
  154. package/dist/tools/seo/generators/SchemaGenerator.d.ts.map +1 -1
  155. package/dist/tools/seo/generators/SchemaGenerator.js.map +1 -1
  156. package/dist/tools/seo/optimizers/InternalLinkingSuggester.d.ts.map +1 -1
  157. package/dist/tools/seo/optimizers/InternalLinkingSuggester.js.map +1 -1
  158. package/dist/tools/site.d.ts.map +1 -1
  159. package/dist/tools/site.js.map +1 -1
  160. package/dist/tools/taxonomies.d.ts.map +1 -1
  161. package/dist/tools/taxonomies.js.map +1 -1
  162. package/dist/tools/users.d.ts.map +1 -1
  163. package/dist/tools/users.js.map +1 -1
  164. package/dist/utils/CircuitBreaker.d.ts +243 -0
  165. package/dist/utils/CircuitBreaker.d.ts.map +1 -0
  166. package/dist/utils/CircuitBreaker.js +456 -0
  167. package/dist/utils/CircuitBreaker.js.map +1 -0
  168. package/dist/utils/debug.d.ts.map +1 -1
  169. package/dist/utils/debug.js.map +1 -1
  170. package/dist/utils/error.js.map +1 -1
  171. package/dist/utils/index.d.ts +1 -0
  172. package/dist/utils/index.d.ts.map +1 -1
  173. package/dist/utils/index.js +2 -0
  174. package/dist/utils/index.js.map +1 -1
  175. package/dist/utils/logger.js.map +1 -1
  176. package/dist/utils/toolWrapper.d.ts.map +1 -1
  177. package/docs/DEPRECATIONS.md +157 -0
  178. package/package.json +2 -3
  179. package/src/cache/CacheInvalidation.ts +1 -1
  180. package/src/cache/CacheManager.ts +25 -8
  181. package/src/cache/HttpCacheWrapper.ts +1 -1
  182. package/src/cache/SEOCacheManager.ts +9 -3
  183. package/src/cache/index.ts +1 -1
  184. package/src/client/CachedWordPressClient.ts +6 -6
  185. package/src/client/MockWordPressClient.ts +3 -3
  186. package/src/client/SEOWordPressClient.ts +6 -6
  187. package/src/client/api.ts +129 -215
  188. package/src/client/auth.ts +3 -3
  189. package/src/client/managers/AuthManager.ts +1 -1
  190. package/src/client/managers/RequestManager.ts +6 -7
  191. package/src/client/managers/composed/MigrationAdapter.ts +4 -4
  192. package/src/client/managers/composed/index.ts +7 -7
  193. package/src/client/managers/implementations/ConfigurationProviderImpl.ts +1 -1
  194. package/src/client/managers/implementations/ErrorHandlerImpl.ts +1 -1
  195. package/src/client/managers/implementations/ParameterValidatorImpl.ts +1 -1
  196. package/src/client/operations/comments.ts +96 -0
  197. package/src/client/operations/index.ts +12 -0
  198. package/src/client/operations/media.ts +162 -0
  199. package/src/client/operations/pages.ts +71 -0
  200. package/src/client/operations/posts.ts +68 -0
  201. package/src/client/operations/site.ts +106 -0
  202. package/src/client/operations/taxonomies.ts +115 -0
  203. package/src/client/operations/users.ts +72 -0
  204. package/src/config/ServerConfiguration.ts +6 -6
  205. package/src/docs/DocumentationGenerator.ts +3 -3
  206. package/src/performance/MetricsCollector.ts +4 -4
  207. package/src/performance/PerformanceMonitor.ts +1 -1
  208. package/src/security/AISecurityScanner.ts +4 -3
  209. package/src/security/AutomatedRemediation.ts +1 -1
  210. package/src/security/InputValidator.ts +36 -19
  211. package/src/security/SecurityCIPipeline.ts +130 -953
  212. package/src/security/SecurityConfig.ts +1 -1
  213. package/src/security/SecurityConfigManager.ts +1 -1
  214. package/src/security/SecurityGateExecutor.ts +485 -0
  215. package/src/security/SecurityMonitoring.ts +1 -1
  216. package/src/security/SecurityReportGenerator.ts +272 -0
  217. package/src/security/SecurityReviewer.ts +1 -1
  218. package/src/security/SecurityTypes.ts +199 -0
  219. package/src/security/index.ts +6 -1
  220. package/src/server/ConnectionTester.ts +4 -4
  221. package/src/server/ToolRegistry.ts +6 -6
  222. package/src/tools/BaseToolManager.ts +2 -2
  223. package/src/tools/auth.ts +3 -3
  224. package/src/tools/cache.ts +3 -3
  225. package/src/tools/comments.ts +3 -3
  226. package/src/tools/media.ts +3 -3
  227. package/src/tools/pages.ts +3 -3
  228. package/src/tools/performance/PerformanceHelpers.ts +330 -0
  229. package/src/tools/performance/PerformanceTools.ts +854 -0
  230. package/src/tools/performance/index.ts +8 -0
  231. package/src/tools/performance.ts +12 -1073
  232. package/src/tools/posts.ts +1 -1
  233. package/src/tools/seo/analyzers/ContentAnalyzer.ts +21 -7
  234. package/src/tools/seo/auditors/SiteAuditor.ts +18 -7
  235. package/src/tools/seo/generators/MetaGenerator.ts +33 -12
  236. package/src/tools/seo/generators/SchemaGenerator.ts +3 -3
  237. package/src/tools/seo/optimizers/InternalLinkingSuggester.ts +4 -4
  238. package/src/tools/site.ts +3 -3
  239. package/src/tools/taxonomies.ts +3 -3
  240. package/src/tools/users.ts +4 -4
  241. package/src/utils/CircuitBreaker.ts +572 -0
  242. package/src/utils/debug.ts +3 -3
  243. package/src/utils/error.ts +1 -1
  244. package/src/utils/index.ts +3 -0
  245. package/src/utils/logger.ts +1 -1
  246. package/src/utils/toolWrapper.ts +2 -2
  247. package/docs/BRANCH_PROTECTION.md +0 -0
@@ -0,0 +1,272 @@
1
+ /**
2
+ * Security Report Generator
3
+ * Handles generation of security reports and statistics
4
+ */
5
+
6
+ import type {
7
+ PipelineSecurityReport,
8
+ GateResult,
9
+ PipelineContext,
10
+ ReportSummary,
11
+ PipelineStatistics,
12
+ ReportFilterOptions,
13
+ } from "./SecurityTypes.js";
14
+
15
+ /**
16
+ * Security Report Generator
17
+ * Responsible for generating and managing security reports
18
+ */
19
+ export class SecurityReportGenerator {
20
+ private reports: PipelineSecurityReport[] = [];
21
+
22
+ /**
23
+ * Generate a pipeline security report
24
+ */
25
+ generateReport(
26
+ reportId: string,
27
+ stage: string,
28
+ startTime: number,
29
+ status: "passed" | "failed" | "warning",
30
+ gateResults: GateResult[],
31
+ context: PipelineContext,
32
+ ): PipelineSecurityReport {
33
+ const allFindings = gateResults.flatMap((gate) => gate.checks.flatMap((check) => check.findings));
34
+
35
+ const summary: ReportSummary = {
36
+ totalIssues: allFindings.length,
37
+ criticalIssues: allFindings.filter((f) => f.severity === "critical").length,
38
+ highIssues: allFindings.filter((f) => f.severity === "high").length,
39
+ mediumIssues: allFindings.filter((f) => f.severity === "medium").length,
40
+ lowIssues: allFindings.filter((f) => f.severity === "low").length,
41
+ securityScore: this.calculateOverallSecurityScore(gateResults),
42
+ compliance: status === "passed",
43
+ };
44
+
45
+ const recommendations = this.generateRecommendations(gateResults, summary);
46
+
47
+ const report: PipelineSecurityReport = {
48
+ reportId,
49
+ timestamp: new Date(),
50
+ stage,
51
+ status,
52
+ duration: Date.now() - startTime,
53
+ gates: gateResults,
54
+ summary,
55
+ recommendations,
56
+ artifacts: this.generateArtifacts(reportId, gateResults),
57
+ };
58
+
59
+ return report;
60
+ }
61
+
62
+ /**
63
+ * Create empty report for stages with no gates
64
+ */
65
+ createEmptyReport(reportId: string, stage: string, startTime: number): PipelineSecurityReport {
66
+ return {
67
+ reportId,
68
+ timestamp: new Date(),
69
+ stage,
70
+ status: "passed",
71
+ duration: Date.now() - startTime,
72
+ gates: [],
73
+ summary: {
74
+ totalIssues: 0,
75
+ criticalIssues: 0,
76
+ highIssues: 0,
77
+ mediumIssues: 0,
78
+ lowIssues: 0,
79
+ securityScore: 100,
80
+ compliance: true,
81
+ },
82
+ recommendations: [],
83
+ artifacts: [],
84
+ };
85
+ }
86
+
87
+ /**
88
+ * Store a report
89
+ */
90
+ storeReport(report: PipelineSecurityReport): void {
91
+ this.reports.push(report);
92
+ }
93
+
94
+ /**
95
+ * Get the latest report
96
+ */
97
+ getLatestReport(): PipelineSecurityReport | undefined {
98
+ return this.reports.length > 0 ? this.reports[this.reports.length - 1] : undefined;
99
+ }
100
+
101
+ /**
102
+ * Get all reports
103
+ */
104
+ getAllReports(): PipelineSecurityReport[] {
105
+ return [...this.reports];
106
+ }
107
+
108
+ /**
109
+ * Get filtered reports
110
+ */
111
+ getReports(options: ReportFilterOptions = {}): PipelineSecurityReport[] {
112
+ let reports = [...this.reports];
113
+
114
+ if (options.stage) {
115
+ reports = reports.filter((r) => r.stage === options.stage);
116
+ }
117
+
118
+ if (options.status) {
119
+ reports = reports.filter((r) => r.status === options.status);
120
+ }
121
+
122
+ if (options.since) {
123
+ reports = reports.filter((r) => r.timestamp >= options.since!);
124
+ }
125
+
126
+ // Sort by timestamp (newest first)
127
+ reports.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime());
128
+
129
+ if (options.limit) {
130
+ reports = reports.slice(0, options.limit);
131
+ }
132
+
133
+ return reports;
134
+ }
135
+
136
+ /**
137
+ * Export report in various formats
138
+ */
139
+ exportReport(report: PipelineSecurityReport, format: string): string {
140
+ if (format === "html") {
141
+ return `<html><body>${JSON.stringify(report)}</body></html>`;
142
+ }
143
+ if (format === "xml") {
144
+ return `<report>${JSON.stringify(report)}</report>`;
145
+ }
146
+ return JSON.stringify(report);
147
+ }
148
+
149
+ /**
150
+ * Calculate security metrics from a report
151
+ */
152
+ calculateSecurityMetrics(report: PipelineSecurityReport): {
153
+ overallScore: number;
154
+ riskLevel: string;
155
+ complianceStatus: boolean;
156
+ } {
157
+ const overallScore = report.summary.securityScore ?? 100;
158
+ const riskLevel = overallScore > 80 ? "low" : overallScore > 50 ? "medium" : "high";
159
+ return { overallScore, riskLevel, complianceStatus: report.summary.compliance };
160
+ }
161
+
162
+ /**
163
+ * Calculate overall security score from gate results
164
+ */
165
+ calculateOverallSecurityScore(gateResults: GateResult[]): number {
166
+ const allChecks = gateResults.flatMap((gate) => gate.checks);
167
+
168
+ if (allChecks.length === 0) {
169
+ return 100;
170
+ }
171
+
172
+ const totalScore = allChecks.reduce((sum, check) => sum + check.score, 0);
173
+ return totalScore / allChecks.length;
174
+ }
175
+
176
+ /**
177
+ * Generate recommendations based on results
178
+ */
179
+ generateRecommendations(
180
+ gateResults: GateResult[],
181
+ summary: ReportSummary,
182
+ ): string[] {
183
+ const recommendations: string[] = [];
184
+
185
+ if (summary.criticalIssues > 0) {
186
+ recommendations.push("Address critical security vulnerabilities immediately before deployment");
187
+ }
188
+
189
+ if (summary.highIssues > 5) {
190
+ recommendations.push("Review and remediate high-severity security issues");
191
+ }
192
+
193
+ if (summary.securityScore < 80) {
194
+ recommendations.push("Improve overall security posture through code review and security training");
195
+ }
196
+
197
+ const failedGates = gateResults.filter((gate) => gate.status === "failed");
198
+ if (failedGates.length > 0) {
199
+ recommendations.push(`Review failed security gates: ${failedGates.map((g) => g.gateName).join(", ")}`);
200
+ }
201
+
202
+ return recommendations;
203
+ }
204
+
205
+ /**
206
+ * Generate artifacts for the security report
207
+ */
208
+ generateArtifacts(reportId: string, gateResults: GateResult[]): string[] {
209
+ return [`security-report-${reportId}.json`, `security-findings-${reportId}.sarif`];
210
+ }
211
+
212
+ /**
213
+ * Get pipeline statistics
214
+ */
215
+ getStatistics(): PipelineStatistics {
216
+ const totalReports = this.reports.length;
217
+ const passedReports = this.reports.filter((r) => r.status === "passed").length;
218
+ const passRate = totalReports > 0 ? passedReports / totalReports : 1;
219
+
220
+ const averageSecurityScore =
221
+ totalReports > 0 ? this.reports.reduce((sum, r) => sum + r.summary.securityScore, 0) / totalReports : 100;
222
+
223
+ // Count issue types
224
+ const issueTypes: Record<string, number> = {};
225
+ this.reports.forEach((report) => {
226
+ report.gates.forEach((gate) => {
227
+ gate.checks.forEach((check) => {
228
+ check.findings.forEach((finding) => {
229
+ issueTypes[finding.type] = (issueTypes[finding.type] || 0) + 1;
230
+ });
231
+ });
232
+ });
233
+ });
234
+
235
+ const mostCommonIssues = Object.entries(issueTypes)
236
+ .map(([type, count]) => ({ type, count }))
237
+ .sort((a, b) => b.count - a.count)
238
+ .slice(0, 5);
239
+
240
+ // Calculate gate performance
241
+ const gateStats: Record<string, { total: number; passed: number; totalDuration: number }> = {};
242
+
243
+ this.reports.forEach((report) => {
244
+ report.gates.forEach((gate) => {
245
+ if (!gateStats[gate.gateId]) {
246
+ gateStats[gate.gateId] = { total: 0, passed: 0, totalDuration: 0 };
247
+ }
248
+
249
+ gateStats[gate.gateId].total++;
250
+ gateStats[gate.gateId].totalDuration += gate.duration;
251
+
252
+ if (gate.status === "passed") {
253
+ gateStats[gate.gateId].passed++;
254
+ }
255
+ });
256
+ });
257
+
258
+ const gatePerformance = Object.entries(gateStats).map(([gateId, stats]) => ({
259
+ gateId,
260
+ successRate: stats.total > 0 ? stats.passed / stats.total : 0,
261
+ averageDuration: stats.total > 0 ? stats.totalDuration / stats.total : 0,
262
+ }));
263
+
264
+ return {
265
+ totalReports,
266
+ passRate,
267
+ averageSecurityScore,
268
+ mostCommonIssues,
269
+ gatePerformance,
270
+ };
271
+ }
272
+ }
@@ -7,7 +7,7 @@ import * as fs from "fs/promises";
7
7
  import * as path from "path";
8
8
  import { SecurityUtils } from "./SecurityConfig.js";
9
9
  import { SecurityValidationError } from "./InputValidator.js";
10
- import { LoggerFactory } from "../utils/logger.js";
10
+ import { LoggerFactory } from "@/utils/logger.js";
11
11
 
12
12
  interface SecurityReviewRule {
13
13
  id: string;
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Security Types and Interfaces
3
+ * Shared type definitions for the security CI/CD pipeline
4
+ */
5
+
6
+ /**
7
+ * Security gate configuration
8
+ */
9
+ export interface SecurityGate {
10
+ id: string;
11
+ name: string;
12
+ stage: "pre-commit" | "pre-build" | "pre-deploy" | "post-deploy";
13
+ enabled: boolean;
14
+ blocking: boolean;
15
+ checks: SecurityCheck[];
16
+ thresholds: SecurityThresholds;
17
+ exceptions: string[];
18
+ }
19
+
20
+ /**
21
+ * Security thresholds for gate evaluation
22
+ */
23
+ export interface SecurityThresholds {
24
+ maxCritical: number;
25
+ maxHigh: number;
26
+ maxMedium: number;
27
+ minSecurityScore: number;
28
+ }
29
+
30
+ /**
31
+ * Security check configuration
32
+ */
33
+ export interface SecurityCheck {
34
+ id: string;
35
+ name: string;
36
+ type: SecurityCheckType;
37
+ enabled: boolean;
38
+ timeout: number;
39
+ retries: number;
40
+ parameters: Record<string, unknown>;
41
+ }
42
+
43
+ /**
44
+ * Types of security checks
45
+ */
46
+ export type SecurityCheckType = "scan" | "review" | "dependency" | "configuration" | "secrets" | "compliance";
47
+
48
+ /**
49
+ * Pipeline security report
50
+ */
51
+ export interface PipelineSecurityReport {
52
+ reportId: string;
53
+ timestamp: Date;
54
+ stage: string;
55
+ status: ReportStatus;
56
+ duration: number;
57
+ gates: GateResult[];
58
+ summary: ReportSummary;
59
+ recommendations: string[];
60
+ artifacts: string[];
61
+ }
62
+
63
+ /**
64
+ * Report status
65
+ */
66
+ export type ReportStatus = "passed" | "failed" | "warning";
67
+
68
+ /**
69
+ * Report summary
70
+ */
71
+ export interface ReportSummary {
72
+ totalIssues: number;
73
+ criticalIssues: number;
74
+ highIssues: number;
75
+ mediumIssues: number;
76
+ lowIssues: number;
77
+ securityScore: number;
78
+ compliance: boolean;
79
+ }
80
+
81
+ /**
82
+ * Gate execution result
83
+ */
84
+ export interface GateResult {
85
+ gateId: string;
86
+ gateName: string;
87
+ status: GateStatus;
88
+ duration: number;
89
+ checks: CheckResult[];
90
+ blocking: boolean;
91
+ message: string;
92
+ }
93
+
94
+ /**
95
+ * Gate status
96
+ */
97
+ export type GateStatus = "passed" | "failed" | "warning" | "skipped";
98
+
99
+ /**
100
+ * Check execution result
101
+ */
102
+ export interface CheckResult {
103
+ checkId: string;
104
+ checkName: string;
105
+ status: CheckStatus;
106
+ duration: number;
107
+ findings: SecurityFinding[];
108
+ details: string;
109
+ score: number;
110
+ }
111
+
112
+ /**
113
+ * Check status
114
+ */
115
+ export type CheckStatus = "passed" | "failed" | "warning" | "error";
116
+
117
+ /**
118
+ * Security finding
119
+ */
120
+ export interface SecurityFinding {
121
+ id: string;
122
+ severity: FindingSeverity;
123
+ type: string;
124
+ description: string;
125
+ file?: string | undefined;
126
+ line?: number | undefined;
127
+ remediation?: string | undefined;
128
+ }
129
+
130
+ /**
131
+ * Finding severity levels
132
+ */
133
+ export type FindingSeverity = "critical" | "high" | "medium" | "low" | "info";
134
+
135
+ /**
136
+ * Pipeline execution context
137
+ */
138
+ export interface PipelineContext {
139
+ repositoryUrl: string;
140
+ branch: string;
141
+ commit: string;
142
+ author: string;
143
+ pullRequest?: {
144
+ id: string;
145
+ title: string;
146
+ source: string;
147
+ target: string;
148
+ };
149
+ environment: string;
150
+ buildNumber: string;
151
+ artifacts: string[];
152
+ }
153
+
154
+ /**
155
+ * Gate execution options
156
+ */
157
+ export interface GateExecutionOptions {
158
+ skipNonBlocking?: boolean;
159
+ continueOnFailure?: boolean;
160
+ dryRun?: boolean;
161
+ }
162
+
163
+ /**
164
+ * Check execution result (internal)
165
+ */
166
+ export interface CheckExecutionResult {
167
+ findings: SecurityFinding[];
168
+ score: number;
169
+ details: string;
170
+ }
171
+
172
+ /**
173
+ * Gate status evaluation result
174
+ */
175
+ export interface GateStatusResult {
176
+ status: "passed" | "failed" | "warning";
177
+ message: string;
178
+ }
179
+
180
+ /**
181
+ * Pipeline statistics
182
+ */
183
+ export interface PipelineStatistics {
184
+ totalReports: number;
185
+ passRate: number;
186
+ averageSecurityScore: number;
187
+ mostCommonIssues: { type: string; count: number }[];
188
+ gatePerformance: { gateId: string; successRate: number; averageDuration: number }[];
189
+ }
190
+
191
+ /**
192
+ * Report filter options
193
+ */
194
+ export interface ReportFilterOptions {
195
+ stage?: string;
196
+ status?: string;
197
+ since?: Date;
198
+ limit?: number;
199
+ }
@@ -6,7 +6,7 @@
6
6
  // Core Security Components
7
7
  export { SecurityConfig, SecurityUtils, createSecureError, getEnvironmentSecurity } from "./SecurityConfig.js";
8
8
  import { SecurityValidationError } from "./InputValidator.js";
9
- import { LoggerFactory } from "../utils/logger.js";
9
+ import { LoggerFactory } from "@/utils/logger.js";
10
10
  export {
11
11
  InputSanitizer,
12
12
  SecuritySchemas,
@@ -41,6 +41,11 @@ export { SecurityMonitor, SecurityEvent } from "./SecurityMonitoring.js";
41
41
  import { SecurityCIPipeline, PipelineSecurityReport as _PipelineSecurityReport } from "./SecurityCIPipeline.js";
42
42
  export { SecurityCIPipeline, PipelineSecurityReport } from "./SecurityCIPipeline.js";
43
43
 
44
+ // Security Types (new modular exports)
45
+ export * from "./SecurityTypes.js";
46
+ export { SecurityGateExecutor } from "./SecurityGateExecutor.js";
47
+ export { SecurityReportGenerator } from "./SecurityReportGenerator.js";
48
+
44
49
  // Type definitions for external use
45
50
  export interface SecurityScanOptions {
46
51
  targets?: string[];
@@ -1,7 +1,7 @@
1
- import { WordPressClient } from "../client/api.js";
2
- import { getErrorMessage } from "../utils/error.js";
3
- import { LoggerFactory } from "../utils/logger.js";
4
- import { ConfigHelpers } from "../config/Config.js";
1
+ import { WordPressClient } from "@/client/api.js";
2
+ import { getErrorMessage } from "@/utils/error.js";
3
+ import { LoggerFactory } from "@/utils/logger.js";
4
+ import { ConfigHelpers } from "@/config/Config.js";
5
5
 
6
6
  interface ErrorWithResponse {
7
7
  response?: {
@@ -1,11 +1,11 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { WordPressClient } from "../client/api.js";
3
- import { getErrorMessage } from "../utils/error.js";
4
- import { EnhancedError, ErrorHandlers } from "../utils/enhancedError.js";
5
- import { config } from "../config/Config.js";
6
- import * as Tools from "../tools/index.js";
2
+ import { WordPressClient } from "@/client/api.js";
3
+ import { getErrorMessage } from "@/utils/error.js";
4
+ import { EnhancedError, ErrorHandlers } from "@/utils/enhancedError.js";
5
+ import { config } from "@/config/Config.js";
6
+ import * as Tools from "@/tools/index.js";
7
7
  import { z } from "zod";
8
- import type { MCPToolSchema, JSONSchemaProperty } from "../types/mcp.js";
8
+ import type { MCPToolSchema, JSONSchemaProperty } from "@/types/mcp.js";
9
9
 
10
10
  /**
11
11
  * Interface for tool definition
@@ -2,8 +2,8 @@
2
2
  * Base utility class for tool managers with enhanced type safety
3
3
  */
4
4
 
5
- import { getErrorMessage } from "../utils/error.js";
6
- import { WordPressId, createWordPressId, DeepReadonly, Result, createSuccess, createError } from "../types/enhanced.js";
5
+ import { getErrorMessage } from "@/utils/error.js";
6
+ import { WordPressId, createWordPressId, DeepReadonly, Result, createSuccess, createError } from "@/types/enhanced.js";
7
7
 
8
8
  interface EnhancedError extends Error {
9
9
  originalError?: unknown;
package/src/tools/auth.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { WordPressClient } from "../client/api.js";
2
- import { AuthMethod } from "../types/client.js";
3
- import { getErrorMessage } from "../utils/error.js";
1
+ import { WordPressClient } from "@/client/api.js";
2
+ import { AuthMethod } from "@/types/client.js";
3
+ import { getErrorMessage } from "@/utils/error.js";
4
4
 
5
5
  /**
6
6
  * Provides authentication-related tools for WordPress sites.
@@ -3,9 +3,9 @@
3
3
  * Provides cache inspection, clearing, and warming capabilities
4
4
  */
5
5
 
6
- import type { WordPressClient } from "../client/api.js";
7
- import { CachedWordPressClient } from "../client/CachedWordPressClient.js";
8
- import { toolWrapper } from "../utils/toolWrapper.js";
6
+ import type { WordPressClient } from "@/client/api.js";
7
+ import { CachedWordPressClient } from "@/client/CachedWordPressClient.js";
8
+ import { toolWrapper } from "@/utils/toolWrapper.js";
9
9
 
10
10
  /**
11
11
  * Cache management tools class
@@ -1,6 +1,6 @@
1
- import { WordPressClient } from "../client/api.js";
2
- import { CommentQueryParams, CreateCommentRequest, UpdateCommentRequest } from "../types/wordpress.js";
3
- import { getErrorMessage } from "../utils/error.js";
1
+ import { WordPressClient } from "@/client/api.js";
2
+ import { CommentQueryParams, CreateCommentRequest, UpdateCommentRequest } from "@/types/wordpress.js";
3
+ import { getErrorMessage } from "@/utils/error.js";
4
4
 
5
5
  /**
6
6
  * Provides tools for managing comments on a WordPress site.
@@ -1,7 +1,7 @@
1
1
  import * as fs from "fs";
2
- import { WordPressClient } from "../client/api.js";
3
- import { MediaQueryParams, UpdateMediaRequest, UploadMediaRequest } from "../types/wordpress.js";
4
- import { getErrorMessage } from "../utils/error.js";
2
+ import { WordPressClient } from "@/client/api.js";
3
+ import { MediaQueryParams, UpdateMediaRequest, UploadMediaRequest } from "@/types/wordpress.js";
4
+ import { getErrorMessage } from "@/utils/error.js";
5
5
 
6
6
  /**
7
7
  * Comprehensive media management tools for WordPress sites.
@@ -1,6 +1,6 @@
1
- import { WordPressClient } from "../client/api.js";
2
- import { CreatePageRequest, PostQueryParams as PageQueryParams, UpdatePageRequest } from "../types/wordpress.js";
3
- import { getErrorMessage } from "../utils/error.js";
1
+ import { WordPressClient } from "@/client/api.js";
2
+ import { CreatePageRequest, PostQueryParams as PageQueryParams, UpdatePageRequest } from "@/types/wordpress.js";
3
+ import { getErrorMessage } from "@/utils/error.js";
4
4
 
5
5
  /**
6
6
  * Provides tools for managing pages on a WordPress site.