mcp-wordpress 2.4.2 → 2.5.1
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/README.md +124 -54
- package/bin/status.js +1 -1
- package/dist/cache/CacheInvalidation.d.ts +3 -1
- package/dist/cache/CacheInvalidation.d.ts.map +1 -1
- package/dist/cache/CacheInvalidation.js +10 -4
- package/dist/cache/CacheInvalidation.js.map +1 -1
- package/dist/cache/CacheManager.d.ts +3 -2
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.js +11 -3
- package/dist/cache/CacheManager.js.map +1 -1
- package/dist/cache/HttpCacheWrapper.d.ts +7 -6
- package/dist/cache/HttpCacheWrapper.d.ts.map +1 -1
- package/dist/cache/HttpCacheWrapper.js +8 -5
- package/dist/cache/HttpCacheWrapper.js.map +1 -1
- package/dist/cache/index.d.ts +3 -3
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/client/CachedWordPressClient.d.ts +23 -9
- package/dist/client/CachedWordPressClient.d.ts.map +1 -1
- package/dist/client/CachedWordPressClient.js +4 -1
- package/dist/client/CachedWordPressClient.js.map +1 -1
- package/dist/client/MockWordPressClient.d.ts +2 -1
- package/dist/client/MockWordPressClient.d.ts.map +1 -1
- package/dist/client/MockWordPressClient.js +3 -1
- package/dist/client/MockWordPressClient.js.map +1 -1
- package/dist/client/api.d.ts +17 -13
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +135 -30
- package/dist/client/api.js.map +1 -1
- package/dist/client/auth.d.ts.map +1 -1
- package/dist/client/auth.js +2 -3
- package/dist/client/auth.js.map +1 -1
- package/dist/client/managers/AuthenticationManager.d.ts +55 -2
- package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
- package/dist/client/managers/AuthenticationManager.js +269 -71
- package/dist/client/managers/AuthenticationManager.js.map +1 -1
- package/dist/client/managers/BaseManager.d.ts +3 -3
- package/dist/client/managers/BaseManager.d.ts.map +1 -1
- package/dist/client/managers/BaseManager.js +11 -5
- package/dist/client/managers/BaseManager.js.map +1 -1
- package/dist/client/managers/RequestManager.d.ts +2 -2
- package/dist/client/managers/RequestManager.d.ts.map +1 -1
- package/dist/client/managers/RequestManager.js +25 -12
- package/dist/client/managers/RequestManager.js.map +1 -1
- package/dist/config/Config.d.ts +155 -0
- package/dist/config/Config.d.ts.map +1 -0
- package/dist/config/Config.js +215 -0
- package/dist/config/Config.js.map +1 -0
- package/dist/config/ConfigurationSchema.d.ts +21 -21
- package/dist/config/ConfigurationSchema.d.ts.map +1 -1
- package/dist/config/ConfigurationSchema.js +19 -2
- package/dist/config/ConfigurationSchema.js.map +1 -1
- package/dist/config/ServerConfiguration.d.ts +2 -1
- package/dist/config/ServerConfiguration.d.ts.map +1 -1
- package/dist/config/ServerConfiguration.js +73 -43
- package/dist/config/ServerConfiguration.js.map +1 -1
- package/dist/docs/DocumentationGenerator.d.ts +9 -8
- package/dist/docs/DocumentationGenerator.d.ts.map +1 -1
- package/dist/docs/DocumentationGenerator.js +10 -7
- package/dist/docs/DocumentationGenerator.js.map +1 -1
- package/dist/docs/MarkdownFormatter.d.ts.map +1 -1
- package/dist/docs/MarkdownFormatter.js +3 -2
- package/dist/docs/MarkdownFormatter.js.map +1 -1
- package/dist/dxt-entry.js +15 -14
- package/dist/dxt-entry.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -21
- package/dist/index.js.map +1 -1
- package/dist/performance/MetricsCollector.d.ts +13 -7
- package/dist/performance/MetricsCollector.d.ts.map +1 -1
- package/dist/performance/MetricsCollector.js +69 -27
- package/dist/performance/MetricsCollector.js.map +1 -1
- package/dist/performance/PerformanceAnalytics.d.ts +8 -2
- package/dist/performance/PerformanceAnalytics.d.ts.map +1 -1
- package/dist/performance/PerformanceAnalytics.js +17 -47
- package/dist/performance/PerformanceAnalytics.js.map +1 -1
- package/dist/performance/PerformanceMonitor.d.ts +2 -1
- package/dist/performance/PerformanceMonitor.d.ts.map +1 -1
- package/dist/performance/PerformanceMonitor.js +12 -13
- package/dist/performance/PerformanceMonitor.js.map +1 -1
- package/dist/performance/index.d.ts +2 -2
- package/dist/performance/index.d.ts.map +1 -1
- package/dist/security/AISecurityScanner.d.ts +1 -0
- package/dist/security/AISecurityScanner.d.ts.map +1 -1
- package/dist/security/AISecurityScanner.js +22 -12
- package/dist/security/AISecurityScanner.js.map +1 -1
- package/dist/security/AutomatedRemediation.d.ts +4 -3
- package/dist/security/AutomatedRemediation.d.ts.map +1 -1
- package/dist/security/AutomatedRemediation.js +46 -15
- package/dist/security/AutomatedRemediation.js.map +1 -1
- package/dist/security/InputValidator.d.ts +13 -9
- package/dist/security/InputValidator.d.ts.map +1 -1
- package/dist/security/InputValidator.js +4 -2
- package/dist/security/InputValidator.js.map +1 -1
- package/dist/security/SecurityCIPipeline.d.ts +1 -1
- package/dist/security/SecurityCIPipeline.d.ts.map +1 -1
- package/dist/security/SecurityCIPipeline.js +38 -29
- package/dist/security/SecurityCIPipeline.js.map +1 -1
- package/dist/security/SecurityConfig.d.ts +3 -3
- package/dist/security/SecurityConfig.d.ts.map +1 -1
- package/dist/security/SecurityConfig.js +13 -9
- package/dist/security/SecurityConfig.js.map +1 -1
- package/dist/security/SecurityConfigManager.d.ts +2 -2
- package/dist/security/SecurityConfigManager.d.ts.map +1 -1
- package/dist/security/SecurityConfigManager.js +20 -15
- package/dist/security/SecurityConfigManager.js.map +1 -1
- package/dist/security/SecurityMonitoring.d.ts +2 -2
- package/dist/security/SecurityMonitoring.d.ts.map +1 -1
- package/dist/security/SecurityMonitoring.js +19 -17
- package/dist/security/SecurityMonitoring.js.map +1 -1
- package/dist/security/SecurityReviewer.d.ts.map +1 -1
- package/dist/security/SecurityReviewer.js +10 -7
- package/dist/security/SecurityReviewer.js.map +1 -1
- package/dist/security/index.d.ts +24 -23
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +52 -23
- package/dist/security/index.js.map +1 -1
- package/dist/server/ConnectionTester.d.ts +12 -4
- package/dist/server/ConnectionTester.d.ts.map +1 -1
- package/dist/server/ConnectionTester.js +96 -22
- package/dist/server/ConnectionTester.js.map +1 -1
- package/dist/server/ToolRegistry.d.ts +2 -2
- package/dist/server/ToolRegistry.d.ts.map +1 -1
- package/dist/server/ToolRegistry.js +10 -5
- package/dist/server/ToolRegistry.js.map +1 -1
- package/dist/src/cache/CacheInvalidation.d.ts +120 -0
- package/dist/src/cache/CacheInvalidation.d.ts.map +1 -0
- package/dist/src/cache/CacheInvalidation.js +355 -0
- package/dist/src/cache/CacheInvalidation.js.map +1 -0
- package/dist/src/cache/CacheManager.d.ts +149 -0
- package/dist/src/cache/CacheManager.d.ts.map +1 -0
- package/dist/src/cache/CacheManager.js +326 -0
- package/dist/src/cache/CacheManager.js.map +1 -0
- package/dist/src/cache/HttpCacheWrapper.d.ts +122 -0
- package/dist/src/cache/HttpCacheWrapper.d.ts.map +1 -0
- package/dist/src/cache/HttpCacheWrapper.js +283 -0
- package/dist/src/cache/HttpCacheWrapper.js.map +1 -0
- package/dist/src/cache/index.d.ts +12 -0
- package/dist/src/cache/index.d.ts.map +1 -0
- package/dist/src/cache/index.js +9 -0
- package/dist/src/cache/index.js.map +1 -0
- package/dist/src/client/CachedWordPressClient.d.ts +174 -0
- package/dist/src/client/CachedWordPressClient.d.ts.map +1 -0
- package/dist/src/client/CachedWordPressClient.js +345 -0
- package/dist/src/client/CachedWordPressClient.js.map +1 -0
- package/dist/src/client/MockWordPressClient.d.ts +56 -0
- package/dist/src/client/MockWordPressClient.d.ts.map +1 -0
- package/dist/src/client/MockWordPressClient.js +371 -0
- package/dist/src/client/MockWordPressClient.js.map +1 -0
- package/dist/src/client/api.d.ts +235 -0
- package/dist/src/client/api.d.ts.map +1 -0
- package/dist/src/client/api.js +896 -0
- package/dist/src/client/api.js.map +1 -0
- package/dist/src/client/auth.d.ts +121 -0
- package/dist/src/client/auth.d.ts.map +1 -0
- package/dist/src/client/auth.js +429 -0
- package/dist/src/client/auth.js.map +1 -0
- package/dist/src/client/managers/AuthenticationManager.d.ts +92 -0
- package/dist/src/client/managers/AuthenticationManager.d.ts.map +1 -0
- package/dist/src/client/managers/AuthenticationManager.js +369 -0
- package/dist/src/client/managers/AuthenticationManager.js.map +1 -0
- package/dist/src/client/managers/BaseManager.d.ts +22 -0
- package/dist/src/client/managers/BaseManager.d.ts.map +1 -0
- package/dist/src/client/managers/BaseManager.js +53 -0
- package/dist/src/client/managers/BaseManager.js.map +1 -0
- package/dist/src/client/managers/RequestManager.d.ts +47 -0
- package/dist/src/client/managers/RequestManager.d.ts.map +1 -0
- package/dist/src/client/managers/RequestManager.js +193 -0
- package/dist/src/client/managers/RequestManager.js.map +1 -0
- package/dist/src/client/managers/index.d.ts +8 -0
- package/dist/src/client/managers/index.d.ts.map +1 -0
- package/dist/src/client/managers/index.js +8 -0
- package/dist/src/client/managers/index.js.map +1 -0
- package/dist/src/config/Config.d.ts +155 -0
- package/dist/src/config/Config.d.ts.map +1 -0
- package/dist/src/config/Config.js +215 -0
- package/dist/src/config/Config.js.map +1 -0
- package/dist/src/config/ConfigurationSchema.d.ts +281 -0
- package/dist/src/config/ConfigurationSchema.d.ts.map +1 -0
- package/dist/src/config/ConfigurationSchema.js +205 -0
- package/dist/src/config/ConfigurationSchema.js.map +1 -0
- package/dist/src/config/ServerConfiguration.d.ts +47 -0
- package/dist/src/config/ServerConfiguration.d.ts.map +1 -0
- package/dist/src/config/ServerConfiguration.js +255 -0
- package/dist/src/config/ServerConfiguration.js.map +1 -0
- package/dist/src/docs/DocumentationGenerator.d.ts +185 -0
- package/dist/src/docs/DocumentationGenerator.d.ts.map +1 -0
- package/dist/src/docs/DocumentationGenerator.js +777 -0
- package/dist/src/docs/DocumentationGenerator.js.map +1 -0
- package/dist/src/docs/MarkdownFormatter.d.ts +84 -0
- package/dist/src/docs/MarkdownFormatter.d.ts.map +1 -0
- package/dist/src/docs/MarkdownFormatter.js +458 -0
- package/dist/src/docs/MarkdownFormatter.js.map +1 -0
- package/dist/src/docs/index.d.ts +8 -0
- package/dist/src/docs/index.d.ts.map +1 -0
- package/dist/src/docs/index.js +7 -0
- package/dist/src/docs/index.js.map +1 -0
- package/dist/src/dxt-entry.d.ts +6 -0
- package/dist/src/dxt-entry.d.ts.map +1 -0
- package/dist/src/dxt-entry.js +39 -0
- package/dist/src/dxt-entry.js.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +143 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/performance/MetricsCollector.d.ts +145 -0
- package/dist/src/performance/MetricsCollector.d.ts.map +1 -0
- package/dist/src/performance/MetricsCollector.js +368 -0
- package/dist/src/performance/MetricsCollector.js.map +1 -0
- package/dist/src/performance/PerformanceAnalytics.d.ts +168 -0
- package/dist/src/performance/PerformanceAnalytics.d.ts.map +1 -0
- package/dist/src/performance/PerformanceAnalytics.js +570 -0
- package/dist/src/performance/PerformanceAnalytics.js.map +1 -0
- package/dist/src/performance/PerformanceMonitor.d.ts +203 -0
- package/dist/src/performance/PerformanceMonitor.d.ts.map +1 -0
- package/dist/src/performance/PerformanceMonitor.js +478 -0
- package/dist/src/performance/PerformanceMonitor.js.map +1 -0
- package/dist/src/performance/index.d.ts +11 -0
- package/dist/src/performance/index.d.ts.map +1 -0
- package/dist/src/performance/index.js +8 -0
- package/dist/src/performance/index.js.map +1 -0
- package/dist/src/security/AISecurityScanner.d.ts +176 -0
- package/dist/src/security/AISecurityScanner.d.ts.map +1 -0
- package/dist/src/security/AISecurityScanner.js +655 -0
- package/dist/src/security/AISecurityScanner.js.map +1 -0
- package/dist/src/security/AutomatedRemediation.d.ts +146 -0
- package/dist/src/security/AutomatedRemediation.d.ts.map +1 -0
- package/dist/src/security/AutomatedRemediation.js +566 -0
- package/dist/src/security/AutomatedRemediation.js.map +1 -0
- package/dist/src/security/InputValidator.d.ts +219 -0
- package/dist/src/security/InputValidator.d.ts.map +1 -0
- package/dist/src/security/InputValidator.js +295 -0
- package/dist/src/security/InputValidator.js.map +1 -0
- package/dist/src/security/SecurityCIPipeline.d.ts +213 -0
- package/dist/src/security/SecurityCIPipeline.d.ts.map +1 -0
- package/dist/src/security/SecurityCIPipeline.js +693 -0
- package/dist/src/security/SecurityCIPipeline.js.map +1 -0
- package/dist/src/security/SecurityConfig.d.ts +129 -0
- package/dist/src/security/SecurityConfig.d.ts.map +1 -0
- package/dist/src/security/SecurityConfig.js +266 -0
- package/dist/src/security/SecurityConfig.js.map +1 -0
- package/dist/src/security/SecurityConfigManager.d.ts +294 -0
- package/dist/src/security/SecurityConfigManager.d.ts.map +1 -0
- package/dist/src/security/SecurityConfigManager.js +558 -0
- package/dist/src/security/SecurityConfigManager.js.map +1 -0
- package/dist/src/security/SecurityMonitoring.d.ts +245 -0
- package/dist/src/security/SecurityMonitoring.d.ts.map +1 -0
- package/dist/src/security/SecurityMonitoring.js +598 -0
- package/dist/src/security/SecurityMonitoring.js.map +1 -0
- package/dist/src/security/SecurityReviewer.d.ts +168 -0
- package/dist/src/security/SecurityReviewer.d.ts.map +1 -0
- package/dist/src/security/SecurityReviewer.js +686 -0
- package/dist/src/security/SecurityReviewer.js.map +1 -0
- package/dist/src/security/index.d.ts +183 -0
- package/dist/src/security/index.d.ts.map +1 -0
- package/dist/src/security/index.js +218 -0
- package/dist/src/security/index.js.map +1 -0
- package/dist/src/server/ConnectionTester.d.ts +32 -0
- package/dist/src/server/ConnectionTester.d.ts.map +1 -0
- package/dist/src/server/ConnectionTester.js +135 -0
- package/dist/src/server/ConnectionTester.js.map +1 -0
- package/dist/src/server/ToolRegistry.d.ts +50 -0
- package/dist/src/server/ToolRegistry.d.ts.map +1 -0
- package/dist/src/server/ToolRegistry.js +219 -0
- package/dist/src/server/ToolRegistry.js.map +1 -0
- package/dist/src/server.d.ts +7 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +7 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tools/BaseToolManager.d.ts +62 -0
- package/dist/src/tools/BaseToolManager.d.ts.map +1 -0
- package/dist/src/tools/BaseToolManager.js +195 -0
- package/dist/src/tools/BaseToolManager.js.map +1 -0
- package/dist/src/tools/auth.d.ts +50 -0
- package/dist/src/tools/auth.d.ts.map +1 -0
- package/dist/src/tools/auth.js +133 -0
- package/dist/src/tools/auth.js.map +1 -0
- package/dist/src/tools/cache.d.ts +260 -0
- package/dist/src/tools/cache.d.ts.map +1 -0
- package/dist/src/tools/cache.js +232 -0
- package/dist/src/tools/cache.js.map +1 -0
- package/dist/src/tools/comments.d.ts +33 -0
- package/dist/src/tools/comments.d.ts.map +1 -0
- package/dist/src/tools/comments.js +235 -0
- package/dist/src/tools/comments.js.map +1 -0
- package/dist/src/tools/index.d.ts +11 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +11 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/media.d.ts +70 -0
- package/dist/src/tools/media.d.ts.map +1 -0
- package/dist/src/tools/media.js +248 -0
- package/dist/src/tools/media.js.map +1 -0
- package/dist/src/tools/pages.d.ts +32 -0
- package/dist/src/tools/pages.d.ts.map +1 -0
- package/dist/src/tools/pages.js +215 -0
- package/dist/src/tools/pages.js.map +1 -0
- package/dist/src/tools/performance.d.ts +73 -0
- package/dist/src/tools/performance.d.ts.map +1 -0
- package/dist/src/tools/performance.js +922 -0
- package/dist/src/tools/performance.js.map +1 -0
- package/dist/src/tools/posts/PostHandlers.d.ts +46 -0
- package/dist/src/tools/posts/PostHandlers.d.ts.map +1 -0
- package/dist/src/tools/posts/PostHandlers.js +400 -0
- package/dist/src/tools/posts/PostHandlers.js.map +1 -0
- package/dist/src/tools/posts/PostToolDefinitions.d.ts +37 -0
- package/dist/src/tools/posts/PostToolDefinitions.d.ts.map +1 -0
- package/dist/src/tools/posts/PostToolDefinitions.js +236 -0
- package/dist/src/tools/posts/PostToolDefinitions.js.map +1 -0
- package/dist/src/tools/posts/index.d.ts +138 -0
- package/dist/src/tools/posts/index.d.ts.map +1 -0
- package/dist/src/tools/posts/index.js +163 -0
- package/dist/src/tools/posts/index.js.map +1 -0
- package/dist/src/tools/posts.d.ts +15 -0
- package/dist/src/tools/posts.d.ts.map +1 -0
- package/dist/src/tools/posts.js +16 -0
- package/dist/src/tools/posts.js.map +1 -0
- package/dist/src/tools/site.d.ts +32 -0
- package/dist/src/tools/site.d.ts.map +1 -0
- package/dist/src/tools/site.js +234 -0
- package/dist/src/tools/site.js.map +1 -0
- package/dist/src/tools/taxonomies.d.ts +36 -0
- package/dist/src/tools/taxonomies.d.ts.map +1 -0
- package/dist/src/tools/taxonomies.js +286 -0
- package/dist/src/tools/taxonomies.js.map +1 -0
- package/dist/src/tools/users.d.ts +33 -0
- package/dist/src/tools/users.d.ts.map +1 -0
- package/dist/src/tools/users.js +308 -0
- package/dist/src/tools/users.js.map +1 -0
- package/dist/src/types/client.d.ts +223 -0
- package/dist/src/types/client.d.ts.map +1 -0
- package/dist/src/types/client.js +97 -0
- package/dist/src/types/client.js.map +1 -0
- package/dist/src/types/enhanced.d.ts +237 -0
- package/dist/src/types/enhanced.d.ts.map +1 -0
- package/dist/src/types/enhanced.js +49 -0
- package/dist/src/types/enhanced.js.map +1 -0
- package/dist/src/types/index.d.ts +160 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +14 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/mcp.d.ts +178 -0
- package/dist/src/types/mcp.d.ts.map +1 -0
- package/dist/src/types/mcp.js +7 -0
- package/dist/src/types/mcp.js.map +1 -0
- package/dist/src/types/requests.d.ts +322 -0
- package/dist/src/types/requests.d.ts.map +1 -0
- package/dist/src/types/requests.js +8 -0
- package/dist/src/types/requests.js.map +1 -0
- package/dist/src/types/tools.d.ts +506 -0
- package/dist/src/types/tools.d.ts.map +1 -0
- package/dist/src/types/tools.js +8 -0
- package/dist/src/types/tools.js.map +1 -0
- package/dist/src/types/wordpress.d.ts +471 -0
- package/dist/src/types/wordpress.d.ts.map +1 -0
- package/dist/src/types/wordpress.js +14 -0
- package/dist/src/types/wordpress.js.map +1 -0
- package/dist/src/utils/debug.d.ts +71 -0
- package/dist/src/utils/debug.d.ts.map +1 -0
- package/dist/src/utils/debug.js +235 -0
- package/dist/src/utils/debug.js.map +1 -0
- package/dist/src/utils/enhancedError.d.ts +61 -0
- package/dist/src/utils/enhancedError.d.ts.map +1 -0
- package/dist/src/utils/enhancedError.js +221 -0
- package/dist/src/utils/enhancedError.js.map +1 -0
- package/dist/src/utils/error.d.ts +17 -0
- package/dist/src/utils/error.d.ts.map +1 -0
- package/dist/src/utils/error.js +108 -0
- package/dist/src/utils/error.js.map +1 -0
- package/dist/src/utils/logger.d.ts +106 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +280 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/streaming.d.ts +104 -0
- package/dist/src/utils/streaming.d.ts.map +1 -0
- package/dist/src/utils/streaming.js +331 -0
- package/dist/src/utils/streaming.js.map +1 -0
- package/dist/src/utils/toolWrapper.d.ts +42 -0
- package/dist/src/utils/toolWrapper.d.ts.map +1 -0
- package/dist/src/utils/toolWrapper.js +101 -0
- package/dist/src/utils/toolWrapper.js.map +1 -0
- package/dist/src/utils/validation/core.d.ts +21 -0
- package/dist/src/utils/validation/core.d.ts.map +1 -0
- package/dist/src/utils/validation/core.js +71 -0
- package/dist/src/utils/validation/core.js.map +1 -0
- package/dist/src/utils/validation/index.d.ts +25 -0
- package/dist/src/utils/validation/index.d.ts.map +1 -0
- package/dist/src/utils/validation/index.js +29 -0
- package/dist/src/utils/validation/index.js.map +1 -0
- package/dist/src/utils/validation/network.d.ts +19 -0
- package/dist/src/utils/validation/network.d.ts.map +1 -0
- package/dist/src/utils/validation/network.js +93 -0
- package/dist/src/utils/validation/network.js.map +1 -0
- package/dist/src/utils/validation/rateLimit.d.ts +21 -0
- package/dist/src/utils/validation/rateLimit.d.ts.map +1 -0
- package/dist/src/utils/validation/rateLimit.js +43 -0
- package/dist/src/utils/validation/rateLimit.js.map +1 -0
- package/dist/src/utils/validation/security.d.ts +29 -0
- package/dist/src/utils/validation/security.d.ts.map +1 -0
- package/dist/src/utils/validation/security.js +327 -0
- package/dist/src/utils/validation/security.js.map +1 -0
- package/dist/src/utils/validation/wordpress.d.ts +31 -0
- package/dist/src/utils/validation/wordpress.d.ts.map +1 -0
- package/dist/src/utils/validation/wordpress.js +146 -0
- package/dist/src/utils/validation/wordpress.js.map +1 -0
- package/dist/src/utils/validation.d.ts +15 -0
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/src/utils/validation.js +27 -0
- package/dist/src/utils/validation.js.map +1 -0
- package/dist/tests/vitest.setup.d.ts +6 -0
- package/dist/tests/vitest.setup.d.ts.map +1 -0
- package/dist/tests/vitest.setup.js +39 -0
- package/dist/tests/vitest.setup.js.map +1 -0
- package/dist/tools/BaseToolManager.d.ts +47 -11
- package/dist/tools/BaseToolManager.d.ts.map +1 -1
- package/dist/tools/BaseToolManager.js +168 -29
- package/dist/tools/BaseToolManager.js.map +1 -1
- package/dist/tools/auth.d.ts +16 -10
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +3 -2
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/cache.d.ts +30 -30
- package/dist/tools/cache.d.ts.map +1 -1
- package/dist/tools/cache.js +1 -6
- package/dist/tools/cache.js.map +1 -1
- package/dist/tools/comments.d.ts +20 -20
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +16 -9
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/media.d.ts +18 -16
- package/dist/tools/media.d.ts.map +1 -1
- package/dist/tools/media.js +16 -15
- package/dist/tools/media.js.map +1 -1
- package/dist/tools/pages.d.ts +19 -17
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +16 -12
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/performance.d.ts +11 -1
- package/dist/tools/performance.d.ts.map +1 -1
- package/dist/tools/performance.js +67 -34
- package/dist/tools/performance.js.map +1 -1
- package/dist/tools/posts/PostHandlers.d.ts +46 -0
- package/dist/tools/posts/PostHandlers.d.ts.map +1 -0
- package/dist/tools/posts/PostHandlers.js +400 -0
- package/dist/tools/posts/PostHandlers.js.map +1 -0
- package/dist/tools/posts/PostToolDefinitions.d.ts +37 -0
- package/dist/tools/posts/PostToolDefinitions.d.ts.map +1 -0
- package/dist/tools/posts/PostToolDefinitions.js +236 -0
- package/dist/tools/posts/PostToolDefinitions.js.map +1 -0
- package/dist/tools/posts/index.d.ts +138 -0
- package/dist/tools/posts/index.d.ts.map +1 -0
- package/dist/tools/posts/index.js +163 -0
- package/dist/tools/posts/index.js.map +1 -0
- package/dist/tools/posts.d.ts +10 -246
- package/dist/tools/posts.d.ts.map +1 -1
- package/dist/tools/posts.js +11 -723
- package/dist/tools/posts.js.map +1 -1
- package/dist/tools/site.d.ts +19 -18
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +14 -10
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/taxonomies.d.ts +23 -24
- package/dist/tools/taxonomies.d.ts.map +1 -1
- package/dist/tools/taxonomies.js +24 -18
- package/dist/tools/taxonomies.js.map +1 -1
- package/dist/tools/users.d.ts +20 -15
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +12 -8
- package/dist/tools/users.js.map +1 -1
- package/dist/types/client.d.ts +48 -41
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.js +30 -5
- package/dist/types/client.js.map +1 -1
- package/dist/types/enhanced.d.ts +237 -0
- package/dist/types/enhanced.d.ts.map +1 -0
- package/dist/types/enhanced.js +49 -0
- package/dist/types/enhanced.js.map +1 -0
- package/dist/types/index.d.ts +15 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/mcp.d.ts +12 -12
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/requests.d.ts +322 -0
- package/dist/types/requests.d.ts.map +1 -0
- package/dist/types/requests.js +8 -0
- package/dist/types/requests.js.map +1 -0
- package/dist/types/tools.d.ts +506 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +8 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/wordpress.d.ts +43 -15
- package/dist/types/wordpress.d.ts.map +1 -1
- package/dist/types/wordpress.js +8 -1
- package/dist/types/wordpress.js.map +1 -1
- package/dist/utils/debug.d.ts +19 -11
- package/dist/utils/debug.d.ts.map +1 -1
- package/dist/utils/debug.js +46 -10
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/enhancedError.d.ts +8 -8
- package/dist/utils/enhancedError.d.ts.map +1 -1
- package/dist/utils/enhancedError.js.map +1 -1
- package/dist/utils/error.d.ts +2 -4
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js +42 -5
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/logger.d.ts +106 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +280 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/streaming.d.ts +9 -9
- package/dist/utils/streaming.d.ts.map +1 -1
- package/dist/utils/streaming.js +71 -52
- package/dist/utils/streaming.js.map +1 -1
- package/dist/utils/toolWrapper.d.ts +9 -7
- package/dist/utils/toolWrapper.d.ts.map +1 -1
- package/dist/utils/toolWrapper.js.map +1 -1
- package/dist/utils/validation/core.d.ts +21 -0
- package/dist/utils/validation/core.d.ts.map +1 -0
- package/dist/utils/validation/core.js +71 -0
- package/dist/utils/validation/core.js.map +1 -0
- package/dist/utils/validation/index.d.ts +25 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +29 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/network.d.ts +19 -0
- package/dist/utils/validation/network.d.ts.map +1 -0
- package/dist/utils/validation/network.js +93 -0
- package/dist/utils/validation/network.js.map +1 -0
- package/dist/utils/validation/rateLimit.d.ts +21 -0
- package/dist/utils/validation/rateLimit.d.ts.map +1 -0
- package/dist/utils/validation/rateLimit.js +43 -0
- package/dist/utils/validation/rateLimit.js.map +1 -0
- package/dist/utils/validation/security.d.ts +29 -0
- package/dist/utils/validation/security.d.ts.map +1 -0
- package/dist/utils/validation/security.js +327 -0
- package/dist/utils/validation/security.js.map +1 -0
- package/dist/utils/validation/wordpress.d.ts +31 -0
- package/dist/utils/validation/wordpress.d.ts.map +1 -0
- package/dist/utils/validation/wordpress.js +146 -0
- package/dist/utils/validation/wordpress.js.map +1 -0
- package/dist/utils/validation.d.ts +13 -82
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +25 -343
- package/dist/utils/validation.js.map +1 -1
- package/docs/BADGE_UPDATES.md +132 -0
- package/docs/CI_CD_IMPROVEMENTS.md +191 -0
- package/docs/INCREMENTAL_COVERAGE.md +183 -0
- package/docs/INSTALLATION.md +4 -2
- package/docs/TROUBLESHOOTING.md +2 -1
- package/docs/api/README.md +3 -1
- package/docs/api/openapi.json +5 -1
- package/docs/api/summary.json +1 -1
- package/docs/api/tools/wp_create_post.md +12 -14
- package/docs/developer/TESTING.md +24 -19
- package/docs/examples/claude-desktop-config.md +1 -1
- package/docs/examples/docker-production.md +100 -93
- package/docs/examples/multi-site-setup.md +5 -4
- package/docs/examples/single-site-setup.md +3 -4
- package/docs/examples/use-case-workflows.md +4 -5
- package/docs/integrations/claude-desktop.md +39 -34
- package/docs/integrations/cline.md +4 -4
- package/docs/integrations/vs-code.md +9 -8
- package/docs/user-guides/DXT_INSTALLATION.md +2 -1
- package/docs/user-guides/SMITHERY_SETUP.md +10 -10
- package/package.json +57 -39
- package/src/cache/CacheInvalidation.ts +12 -5
- package/src/cache/CacheManager.ts +18 -15
- package/src/cache/HttpCacheWrapper.ts +30 -59
- package/src/cache/__tests__/HttpCacheWrapper.test.ts +6 -5
- package/src/cache/index.ts +3 -14
- package/src/client/CachedWordPressClient.ts +32 -30
- package/src/client/MockWordPressClient.ts +4 -2
- package/src/client/api.ts +186 -64
- package/src/client/auth.ts +15 -40
- package/src/client/managers/AuthenticationManager.ts +337 -77
- package/src/client/managers/BaseManager.ts +18 -30
- package/src/client/managers/RequestManager.ts +39 -44
- package/src/config/Config.ts +308 -0
- package/src/config/ConfigurationSchema.ts +23 -2
- package/src/config/ServerConfiguration.ts +73 -49
- package/src/docs/DocumentationGenerator.ts +50 -39
- package/src/docs/MarkdownFormatter.ts +19 -29
- package/src/dxt-entry.cjs +26 -16
- package/src/dxt-entry.ts +17 -27
- package/src/index.ts +42 -28
- package/src/performance/MetricsCollector.ts +108 -86
- package/src/performance/PerformanceAnalytics.ts +69 -164
- package/src/performance/PerformanceMonitor.ts +32 -47
- package/src/performance/index.ts +2 -10
- package/src/security/AISecurityScanner.ts +22 -12
- package/src/security/AutomatedRemediation.ts +49 -18
- package/src/security/InputValidator.ts +9 -6
- package/src/security/SecurityCIPipeline.ts +53 -37
- package/src/security/SecurityConfig.ts +22 -22
- package/src/security/SecurityConfigManager.ts +23 -19
- package/src/security/SecurityMonitoring.ts +24 -21
- package/src/security/SecurityReviewer.ts +10 -7
- package/src/security/index.ts +64 -29
- package/src/server/ConnectionTester.ts +120 -31
- package/src/server/ToolRegistry.ts +31 -21
- package/src/tools/BaseToolManager.ts +286 -33
- package/src/tools/auth.ts +20 -8
- package/src/tools/cache.ts +5 -15
- package/src/tools/comments.ts +34 -48
- package/src/tools/media.ts +41 -53
- package/src/tools/pages.ts +32 -54
- package/src/tools/performance.ts +141 -176
- package/src/tools/posts/PostHandlers.ts +474 -0
- package/src/tools/posts/PostToolDefinitions.ts +250 -0
- package/src/tools/posts/index.ts +192 -0
- package/src/tools/posts.ts +24 -780
- package/src/tools/site.ts +34 -19
- package/src/tools/taxonomies.ts +41 -57
- package/src/tools/users.ts +28 -16
- package/src/types/client.ts +114 -138
- package/src/types/enhanced.ts +318 -0
- package/src/types/index.ts +51 -30
- package/src/types/mcp.ts +20 -42
- package/src/types/requests.ts +378 -0
- package/src/types/tools.ts +608 -0
- package/src/types/wordpress.ts +56 -34
- package/src/utils/debug.ts +77 -59
- package/src/utils/enhancedError.ts +8 -8
- package/src/utils/error.ts +53 -31
- package/src/utils/logger.ts +351 -0
- package/src/utils/streaming.ts +86 -68
- package/src/utils/toolWrapper.ts +10 -12
- package/src/utils/validation/core.ts +108 -0
- package/src/utils/validation/index.ts +36 -0
- package/src/utils/validation/network.ts +132 -0
- package/src/utils/validation/rateLimit.ts +54 -0
- package/src/utils/validation/security.ts +361 -0
- package/src/utils/validation/wordpress.ts +180 -0
- package/src/utils/validation.ts +47 -470
- package/dist/cache/__tests__/CacheInvalidation.test.d.ts +0 -5
- package/dist/cache/__tests__/CacheInvalidation.test.d.ts.map +0 -1
- package/dist/cache/__tests__/CacheInvalidation.test.js +0 -238
- package/dist/cache/__tests__/CacheInvalidation.test.js.map +0 -1
- package/dist/cache/__tests__/CacheManager.test.d.ts +0 -5
- package/dist/cache/__tests__/CacheManager.test.d.ts.map +0 -1
- package/dist/cache/__tests__/CacheManager.test.js +0 -233
- package/dist/cache/__tests__/CacheManager.test.js.map +0 -1
- package/dist/cache/__tests__/CachedWordPressClient.test.d.ts +0 -5
- package/dist/cache/__tests__/CachedWordPressClient.test.d.ts.map +0 -1
- package/dist/cache/__tests__/CachedWordPressClient.test.js +0 -231
- package/dist/cache/__tests__/CachedWordPressClient.test.js.map +0 -1
- package/dist/cache/__tests__/HttpCacheWrapper.test.d.ts +0 -5
- package/dist/cache/__tests__/HttpCacheWrapper.test.d.ts.map +0 -1
- package/dist/cache/__tests__/HttpCacheWrapper.test.js +0 -299
- package/dist/cache/__tests__/HttpCacheWrapper.test.js.map +0 -1
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive API Documentation Auto-Generation System
|
|
3
|
+
* Extracts documentation from tool classes, types, and WordPress mappings
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
import * as Tools from "../tools/index.js";
|
|
8
|
+
import { LoggerFactory } from "../utils/logger.js";
|
|
9
|
+
/**
|
|
10
|
+
* Main Documentation Generator
|
|
11
|
+
*/
|
|
12
|
+
export class DocumentationGenerator {
|
|
13
|
+
config;
|
|
14
|
+
toolCategories = new Map();
|
|
15
|
+
wordpressEndpoints = new Map();
|
|
16
|
+
logger = LoggerFactory.api();
|
|
17
|
+
constructor(config = {}) {
|
|
18
|
+
this.config = {
|
|
19
|
+
outputDir: "docs/api",
|
|
20
|
+
includeExamples: true,
|
|
21
|
+
includeWordPressMapping: true,
|
|
22
|
+
generateOpenAPI: true,
|
|
23
|
+
generateInteractiveHtml: true,
|
|
24
|
+
validateExamples: false,
|
|
25
|
+
...config,
|
|
26
|
+
};
|
|
27
|
+
this.initializeWordPressMapping();
|
|
28
|
+
this.initializeToolCategories();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generate complete documentation for all tools and types
|
|
32
|
+
*/
|
|
33
|
+
async generateFullDocumentation() {
|
|
34
|
+
this.logger.info("🚀 Starting API documentation generation...");
|
|
35
|
+
const tools = await this.extractAllToolDocumentation();
|
|
36
|
+
const categories = this.generateCategoryDocumentation(tools);
|
|
37
|
+
const types = await this.extractTypeDocumentation();
|
|
38
|
+
let openApiSpec = undefined;
|
|
39
|
+
if (this.config.generateOpenAPI) {
|
|
40
|
+
openApiSpec = this.generateOpenAPISpecification(tools, types);
|
|
41
|
+
}
|
|
42
|
+
const summary = this.generateDocumentationSummary(tools, categories, types);
|
|
43
|
+
const output = {
|
|
44
|
+
tools,
|
|
45
|
+
categories,
|
|
46
|
+
types,
|
|
47
|
+
openApiSpec,
|
|
48
|
+
summary,
|
|
49
|
+
};
|
|
50
|
+
// Write documentation to files
|
|
51
|
+
await this.writeDocumentationFiles(output);
|
|
52
|
+
this.logger.info(`✅ Documentation generation complete! ${tools.length} tools documented.`);
|
|
53
|
+
return output;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Extract documentation from all tool classes
|
|
57
|
+
*/
|
|
58
|
+
async extractAllToolDocumentation() {
|
|
59
|
+
const toolDocs = [];
|
|
60
|
+
// Iterate through all tool classes
|
|
61
|
+
for (const [className, ToolClass] of Object.entries(Tools)) {
|
|
62
|
+
try {
|
|
63
|
+
// Create tool instance
|
|
64
|
+
let toolInstance;
|
|
65
|
+
if (className === "CacheTools" || className === "PerformanceTools") {
|
|
66
|
+
// These tools need client map - use empty map for doc generation
|
|
67
|
+
toolInstance = new ToolClass(new Map());
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
toolInstance = new ToolClass();
|
|
71
|
+
}
|
|
72
|
+
const toolDefinitions = toolInstance.getTools();
|
|
73
|
+
const category = this.extractCategoryFromClassName(className);
|
|
74
|
+
for (const toolDef of toolDefinitions) {
|
|
75
|
+
const doc = await this.extractToolDocumentation(toolDef, category, className);
|
|
76
|
+
toolDocs.push(doc);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.logger.warn(`⚠️ Failed to extract documentation for ${className}:`, { error: String(error) });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return toolDocs.sort((a, b) => a.name.localeCompare(b.name));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Extract documentation for a single tool
|
|
87
|
+
*/
|
|
88
|
+
async extractToolDocumentation(toolDef, category, className) {
|
|
89
|
+
const parameters = this.extractParameterDocumentation(toolDef.parameters || []);
|
|
90
|
+
const examples = this.generateToolExamples(toolDef, category);
|
|
91
|
+
const wordpressEndpoint = this.wordpressEndpoints.get(toolDef.name);
|
|
92
|
+
const returnType = this.inferReturnType(toolDef.name, category);
|
|
93
|
+
const errorCodes = this.generateErrorDocumentation(toolDef.name);
|
|
94
|
+
const relatedTools = this.findRelatedTools(toolDef.name, category);
|
|
95
|
+
return {
|
|
96
|
+
name: toolDef.name,
|
|
97
|
+
category,
|
|
98
|
+
description: toolDef.description || `${category} tool: ${toolDef.name}`,
|
|
99
|
+
parameters,
|
|
100
|
+
examples,
|
|
101
|
+
wordpressEndpoint,
|
|
102
|
+
requiredPermissions: this.getRequiredPermissions(toolDef.name),
|
|
103
|
+
returnType,
|
|
104
|
+
errorCodes,
|
|
105
|
+
relatedTools,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Extract parameter documentation
|
|
110
|
+
*/
|
|
111
|
+
extractParameterDocumentation(parameters) {
|
|
112
|
+
return parameters.map((param) => ({
|
|
113
|
+
name: param.name,
|
|
114
|
+
type: param.type || "string",
|
|
115
|
+
required: param.required || false,
|
|
116
|
+
description: param.description || `${param.name} parameter`,
|
|
117
|
+
defaultValue: this.getDefaultValue(param),
|
|
118
|
+
allowedValues: this.getAllowedValues(param) || undefined,
|
|
119
|
+
examples: this.generateParameterExamples(param),
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Generate usage examples for tools
|
|
124
|
+
*/
|
|
125
|
+
generateToolExamples(toolDef, category) {
|
|
126
|
+
const examples = [];
|
|
127
|
+
// Basic usage example
|
|
128
|
+
const basicExample = this.generateBasicExample(toolDef, category);
|
|
129
|
+
if (basicExample) {
|
|
130
|
+
examples.push(basicExample);
|
|
131
|
+
}
|
|
132
|
+
// Multi-site example (if applicable)
|
|
133
|
+
if (this.supportsMultiSite(toolDef)) {
|
|
134
|
+
const multiSiteExample = this.generateMultiSiteExample(toolDef, category);
|
|
135
|
+
if (multiSiteExample) {
|
|
136
|
+
examples.push(multiSiteExample);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Advanced example with all parameters
|
|
140
|
+
const advancedExample = this.generateAdvancedExample(toolDef, category);
|
|
141
|
+
if (advancedExample) {
|
|
142
|
+
examples.push(advancedExample);
|
|
143
|
+
}
|
|
144
|
+
return examples;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Generate basic usage example
|
|
148
|
+
*/
|
|
149
|
+
generateBasicExample(toolDef, category) {
|
|
150
|
+
const toolName = toolDef.name;
|
|
151
|
+
const basicParams = {};
|
|
152
|
+
// Add essential parameters
|
|
153
|
+
const requiredParams = (toolDef.parameters || []).filter((p) => p.required);
|
|
154
|
+
for (const param of requiredParams.slice(0, 2)) {
|
|
155
|
+
// Limit to 2 for basic example
|
|
156
|
+
basicParams[param.name] = this.generateExampleValue(param);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
title: `Basic ${category} Usage`,
|
|
160
|
+
description: `Simple example of using ${toolName}`,
|
|
161
|
+
command: toolName,
|
|
162
|
+
parameters: basicParams,
|
|
163
|
+
expectedResponse: this.generateExpectedResponse(toolName, category, "basic"),
|
|
164
|
+
errorExample: {
|
|
165
|
+
scenario: "Authentication failure",
|
|
166
|
+
error: {
|
|
167
|
+
error: "Authentication failed",
|
|
168
|
+
message: "Invalid credentials or insufficient permissions",
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Generate multi-site example
|
|
175
|
+
*/
|
|
176
|
+
generateMultiSiteExample(toolDef, category) {
|
|
177
|
+
const params = { site: "site1", ...this.getExampleParameters(toolDef, 1) };
|
|
178
|
+
return {
|
|
179
|
+
title: `Multi-Site ${category} Usage`,
|
|
180
|
+
description: `Using ${toolDef.name} with specific site targeting`,
|
|
181
|
+
command: toolDef.name,
|
|
182
|
+
parameters: params,
|
|
183
|
+
expectedResponse: this.generateExpectedResponse(toolDef.name, category, "multisite"),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Generate advanced example with all parameters
|
|
188
|
+
*/
|
|
189
|
+
generateAdvancedExample(toolDef, category) {
|
|
190
|
+
const allParams = this.getExampleParameters(toolDef, "all");
|
|
191
|
+
if (Object.keys(allParams).length <= 2) {
|
|
192
|
+
return null; // Skip if not enough parameters for advanced example
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
title: `Advanced ${category} Configuration`,
|
|
196
|
+
description: "Comprehensive example using all available parameters",
|
|
197
|
+
command: toolDef.name,
|
|
198
|
+
parameters: allParams,
|
|
199
|
+
expectedResponse: this.generateExpectedResponse(toolDef.name, category, "advanced"),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Generate category documentation
|
|
204
|
+
*/
|
|
205
|
+
generateCategoryDocumentation(tools) {
|
|
206
|
+
const categories = new Map();
|
|
207
|
+
// Group tools by category
|
|
208
|
+
for (const tool of tools) {
|
|
209
|
+
if (!categories.has(tool.category)) {
|
|
210
|
+
categories.set(tool.category, []);
|
|
211
|
+
}
|
|
212
|
+
categories.get(tool.category).push(tool);
|
|
213
|
+
}
|
|
214
|
+
return Array.from(categories.entries()).map(([categoryName, categoryTools]) => ({
|
|
215
|
+
name: categoryName,
|
|
216
|
+
description: this.getCategoryDescription(categoryName),
|
|
217
|
+
toolCount: categoryTools.length,
|
|
218
|
+
tools: categoryTools.map((t) => t.name).sort(),
|
|
219
|
+
usagePatterns: this.generateUsagePatterns(categoryName, categoryTools),
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Extract type documentation from TypeScript definitions
|
|
224
|
+
*/
|
|
225
|
+
async extractTypeDocumentation() {
|
|
226
|
+
// This would analyze TypeScript files to extract type information
|
|
227
|
+
// For now, we'll provide key WordPress and MCP types
|
|
228
|
+
return [
|
|
229
|
+
{
|
|
230
|
+
name: "WordPressPost",
|
|
231
|
+
description: "WordPress blog post object",
|
|
232
|
+
properties: [
|
|
233
|
+
{
|
|
234
|
+
name: "id",
|
|
235
|
+
type: "number",
|
|
236
|
+
required: true,
|
|
237
|
+
description: "Unique identifier",
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: "title",
|
|
241
|
+
type: "string",
|
|
242
|
+
required: true,
|
|
243
|
+
description: "Post title",
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "content",
|
|
247
|
+
type: "string",
|
|
248
|
+
required: true,
|
|
249
|
+
description: "Post content",
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: "status",
|
|
253
|
+
type: "string",
|
|
254
|
+
required: true,
|
|
255
|
+
description: "Publication status",
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
examples: [this.generateWordPressPostExample()],
|
|
259
|
+
wordpressSource: "/wp-json/wp/v2/posts",
|
|
260
|
+
},
|
|
261
|
+
// Add more types as needed
|
|
262
|
+
];
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Generate OpenAPI specification
|
|
266
|
+
*/
|
|
267
|
+
generateOpenAPISpecification(tools, types) {
|
|
268
|
+
const paths = {};
|
|
269
|
+
const components = {
|
|
270
|
+
schemas: {},
|
|
271
|
+
parameters: {},
|
|
272
|
+
responses: {},
|
|
273
|
+
};
|
|
274
|
+
// Convert tools to OpenAPI paths
|
|
275
|
+
for (const tool of tools) {
|
|
276
|
+
const path = `/tools/${tool.name}`;
|
|
277
|
+
paths[path] = {
|
|
278
|
+
post: {
|
|
279
|
+
summary: tool.description,
|
|
280
|
+
description: `Execute ${tool.name} MCP tool`,
|
|
281
|
+
tags: [tool.category],
|
|
282
|
+
requestBody: {
|
|
283
|
+
required: true,
|
|
284
|
+
content: {
|
|
285
|
+
"application/json": {
|
|
286
|
+
schema: this.generateParameterSchema(tool.parameters),
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
responses: {
|
|
291
|
+
"200": {
|
|
292
|
+
description: "Successful response",
|
|
293
|
+
content: {
|
|
294
|
+
"application/json": {
|
|
295
|
+
schema: { type: "object" },
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
"400": {
|
|
300
|
+
description: "Bad request - invalid parameters",
|
|
301
|
+
},
|
|
302
|
+
"401": {
|
|
303
|
+
description: "Authentication failed",
|
|
304
|
+
},
|
|
305
|
+
"500": {
|
|
306
|
+
description: "Internal server error",
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
// Add type schemas to components
|
|
313
|
+
const schemas = components.schemas;
|
|
314
|
+
for (const type of types) {
|
|
315
|
+
schemas[type.name] = this.convertTypeToJsonSchema(type);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
openapi: "3.0.3",
|
|
319
|
+
info: {
|
|
320
|
+
title: "WordPress MCP Server API",
|
|
321
|
+
description: "Model Context Protocol server for WordPress management",
|
|
322
|
+
version: "1.2.0",
|
|
323
|
+
contact: {
|
|
324
|
+
name: "MCP WordPress",
|
|
325
|
+
url: "https://github.com/docdyhr/mcp-wordpress",
|
|
326
|
+
},
|
|
327
|
+
license: {
|
|
328
|
+
name: "MIT",
|
|
329
|
+
url: "https://opensource.org/licenses/MIT",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
paths,
|
|
333
|
+
components,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Write all documentation files
|
|
338
|
+
*/
|
|
339
|
+
async writeDocumentationFiles(output) {
|
|
340
|
+
const outputDir = this.config.outputDir;
|
|
341
|
+
// Ensure output directory exists
|
|
342
|
+
await fs.promises.mkdir(outputDir, { recursive: true });
|
|
343
|
+
await fs.promises.mkdir(path.join(outputDir, "tools"), { recursive: true });
|
|
344
|
+
await fs.promises.mkdir(path.join(outputDir, "types"), { recursive: true });
|
|
345
|
+
await fs.promises.mkdir(path.join(outputDir, "examples"), {
|
|
346
|
+
recursive: true,
|
|
347
|
+
});
|
|
348
|
+
await fs.promises.mkdir(path.join(outputDir, "categories"), {
|
|
349
|
+
recursive: true,
|
|
350
|
+
});
|
|
351
|
+
// Write main API documentation
|
|
352
|
+
await this.writeApiOverview(output);
|
|
353
|
+
// Write individual tool documentation
|
|
354
|
+
for (const tool of output.tools) {
|
|
355
|
+
await this.writeToolDocumentation(tool);
|
|
356
|
+
}
|
|
357
|
+
// Write category documentation
|
|
358
|
+
for (const category of output.categories) {
|
|
359
|
+
await this.writeCategoryDocumentation(category);
|
|
360
|
+
}
|
|
361
|
+
// Write type documentation
|
|
362
|
+
for (const type of output.types) {
|
|
363
|
+
await this.writeTypeDocumentation(type);
|
|
364
|
+
}
|
|
365
|
+
// Write OpenAPI specification
|
|
366
|
+
if (output.openApiSpec) {
|
|
367
|
+
await fs.promises.writeFile(path.join(outputDir, "openapi.json"), JSON.stringify(output.openApiSpec, null, 2));
|
|
368
|
+
}
|
|
369
|
+
// Write summary
|
|
370
|
+
await fs.promises.writeFile(path.join(outputDir, "summary.json"), JSON.stringify(output.summary, null, 2));
|
|
371
|
+
this.logger.info(`📁 Documentation written to ${outputDir}/`);
|
|
372
|
+
}
|
|
373
|
+
// Helper methods for specific documentation tasks...
|
|
374
|
+
extractCategoryFromClassName(className) {
|
|
375
|
+
return className.replace("Tools", "").toLowerCase();
|
|
376
|
+
}
|
|
377
|
+
initializeWordPressMapping() {
|
|
378
|
+
// Map MCP tools to WordPress REST API endpoints
|
|
379
|
+
this.wordpressEndpoints.set("wp_list_posts", "/wp-json/wp/v2/posts");
|
|
380
|
+
this.wordpressEndpoints.set("wp_get_post", "/wp-json/wp/v2/posts/{id}");
|
|
381
|
+
this.wordpressEndpoints.set("wp_create_post", "/wp-json/wp/v2/posts");
|
|
382
|
+
this.wordpressEndpoints.set("wp_update_post", "/wp-json/wp/v2/posts/{id}");
|
|
383
|
+
this.wordpressEndpoints.set("wp_delete_post", "/wp-json/wp/v2/posts/{id}");
|
|
384
|
+
// Add more mappings...
|
|
385
|
+
}
|
|
386
|
+
initializeToolCategories() {
|
|
387
|
+
this.toolCategories.set("Posts", [
|
|
388
|
+
"wp_list_posts",
|
|
389
|
+
"wp_get_post",
|
|
390
|
+
"wp_create_post",
|
|
391
|
+
"wp_update_post",
|
|
392
|
+
"wp_delete_post",
|
|
393
|
+
"wp_search_posts",
|
|
394
|
+
]);
|
|
395
|
+
this.toolCategories.set("Pages", [
|
|
396
|
+
"wp_list_pages",
|
|
397
|
+
"wp_get_page",
|
|
398
|
+
"wp_create_page",
|
|
399
|
+
"wp_update_page",
|
|
400
|
+
"wp_delete_page",
|
|
401
|
+
"wp_search_pages",
|
|
402
|
+
]);
|
|
403
|
+
// Add more categories...
|
|
404
|
+
}
|
|
405
|
+
generateDocumentationSummary(tools, categories, types) {
|
|
406
|
+
return {
|
|
407
|
+
totalTools: tools.length,
|
|
408
|
+
totalCategories: categories.length,
|
|
409
|
+
totalTypes: types.length,
|
|
410
|
+
lastUpdated: new Date().toISOString(),
|
|
411
|
+
version: "1.2.0",
|
|
412
|
+
coverage: {
|
|
413
|
+
toolsWithExamples: tools.filter((t) => t.examples.length > 0).length,
|
|
414
|
+
toolsWithWordPressMapping: tools.filter((t) => t.wordpressEndpoint).length,
|
|
415
|
+
typesDocumented: types.length,
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Helper methods for documentation generation
|
|
421
|
+
*/
|
|
422
|
+
getDefaultValue(param) {
|
|
423
|
+
const defaults = {
|
|
424
|
+
per_page: 10,
|
|
425
|
+
page: 1,
|
|
426
|
+
order: "desc",
|
|
427
|
+
orderby: "date",
|
|
428
|
+
status: "publish",
|
|
429
|
+
format: "summary",
|
|
430
|
+
category: "all",
|
|
431
|
+
includeExamples: true,
|
|
432
|
+
includeTrends: true,
|
|
433
|
+
};
|
|
434
|
+
return defaults[String(param.name)];
|
|
435
|
+
}
|
|
436
|
+
getAllowedValues(param) {
|
|
437
|
+
const allowedValues = {
|
|
438
|
+
status: ["publish", "draft", "private", "pending", "future"],
|
|
439
|
+
order: ["asc", "desc"],
|
|
440
|
+
orderby: ["date", "title", "author", "modified"],
|
|
441
|
+
format: ["summary", "detailed", "raw"],
|
|
442
|
+
category: ["overview", "requests", "cache", "system", "tools", "all"],
|
|
443
|
+
timeframe: ["1h", "6h", "12h", "24h", "7d", "30d"],
|
|
444
|
+
priority: ["quick_wins", "medium_term", "long_term", "all"],
|
|
445
|
+
focus: ["speed", "reliability", "efficiency", "scaling"],
|
|
446
|
+
};
|
|
447
|
+
return allowedValues[String(param.name)];
|
|
448
|
+
}
|
|
449
|
+
generateParameterExamples(param) {
|
|
450
|
+
const examples = {
|
|
451
|
+
id: ["123", "456"],
|
|
452
|
+
title: ["My Blog Post", "Hello World"],
|
|
453
|
+
content: ["<p>Post content here</p>", "This is my post content"],
|
|
454
|
+
site: ["site1", "production", "staging"],
|
|
455
|
+
per_page: ["10", "20", "50"],
|
|
456
|
+
search: ["wordpress", "tutorial"],
|
|
457
|
+
author: ["1", "2"],
|
|
458
|
+
email: ["user@example.com", "admin@site.com"],
|
|
459
|
+
username: ["john_doe", "admin"],
|
|
460
|
+
limit: ["10", "20", "50"],
|
|
461
|
+
timeframe: ["24h", "7d", "1h"],
|
|
462
|
+
};
|
|
463
|
+
return examples[param.name] || ["example"];
|
|
464
|
+
}
|
|
465
|
+
supportsMultiSite(toolDef) {
|
|
466
|
+
// All tools support multi-site via the site parameter
|
|
467
|
+
return toolDef.parameters?.some((p) => p.name === "site") ?? true;
|
|
468
|
+
}
|
|
469
|
+
generateExampleValue(param) {
|
|
470
|
+
const exampleValues = {
|
|
471
|
+
id: 123,
|
|
472
|
+
title: "Example Post Title",
|
|
473
|
+
content: "This is example content for the post.",
|
|
474
|
+
site: "site1",
|
|
475
|
+
per_page: 10,
|
|
476
|
+
page: 1,
|
|
477
|
+
search: "wordpress",
|
|
478
|
+
author: 1,
|
|
479
|
+
email: "user@example.com",
|
|
480
|
+
username: "john_doe",
|
|
481
|
+
status: "publish",
|
|
482
|
+
order: "desc",
|
|
483
|
+
orderby: "date",
|
|
484
|
+
limit: 20,
|
|
485
|
+
timeframe: "24h",
|
|
486
|
+
format: "summary",
|
|
487
|
+
category: "overview",
|
|
488
|
+
};
|
|
489
|
+
return exampleValues[param.name] || "example_value";
|
|
490
|
+
}
|
|
491
|
+
generateExpectedResponse(toolName, category, type) {
|
|
492
|
+
if (toolName.includes("list")) {
|
|
493
|
+
return {
|
|
494
|
+
success: true,
|
|
495
|
+
data: [
|
|
496
|
+
{ id: 1, title: `Example ${category} 1`, status: "publish" },
|
|
497
|
+
{ id: 2, title: `Example ${category} 2`, status: "draft" },
|
|
498
|
+
],
|
|
499
|
+
total: 2,
|
|
500
|
+
pages: 1,
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
if (toolName.includes("get")) {
|
|
504
|
+
return {
|
|
505
|
+
success: true,
|
|
506
|
+
data: {
|
|
507
|
+
id: 123,
|
|
508
|
+
title: `Example ${category}`,
|
|
509
|
+
content: "Example content",
|
|
510
|
+
status: "publish",
|
|
511
|
+
date: "2024-01-01T00:00:00Z",
|
|
512
|
+
},
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
if (toolName.includes("create") || toolName.includes("update")) {
|
|
516
|
+
return {
|
|
517
|
+
success: true,
|
|
518
|
+
data: {
|
|
519
|
+
id: 123,
|
|
520
|
+
title: "Created/Updated successfully",
|
|
521
|
+
status: "publish",
|
|
522
|
+
},
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
if (toolName.includes("delete")) {
|
|
526
|
+
return {
|
|
527
|
+
success: true,
|
|
528
|
+
data: {
|
|
529
|
+
deleted: true,
|
|
530
|
+
id: 123,
|
|
531
|
+
},
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
if (toolName.includes("performance")) {
|
|
535
|
+
return {
|
|
536
|
+
success: true,
|
|
537
|
+
data: {
|
|
538
|
+
overview: {
|
|
539
|
+
overallHealth: "Good",
|
|
540
|
+
performanceScore: 85,
|
|
541
|
+
averageResponseTime: "245ms",
|
|
542
|
+
cacheHitRate: "87.5%",
|
|
543
|
+
},
|
|
544
|
+
},
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
success: true,
|
|
549
|
+
data: {},
|
|
550
|
+
message: `${toolName} executed successfully`,
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
getExampleParameters(toolDef, type) {
|
|
554
|
+
const params = {};
|
|
555
|
+
const parameters = toolDef.parameters || [];
|
|
556
|
+
if (type === "all") {
|
|
557
|
+
// Include all parameters
|
|
558
|
+
for (const param of parameters) {
|
|
559
|
+
params[param.name] = this.generateExampleValue(param);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
else if (typeof type === "number") {
|
|
563
|
+
// Include limited number of parameters
|
|
564
|
+
for (const param of parameters.slice(0, type)) {
|
|
565
|
+
params[param.name] = this.generateExampleValue(param);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return params;
|
|
569
|
+
}
|
|
570
|
+
getCategoryDescription(categoryName) {
|
|
571
|
+
const descriptions = {
|
|
572
|
+
posts: "Blog post creation, editing, and management tools",
|
|
573
|
+
pages: "Static page creation and management tools",
|
|
574
|
+
media: "File upload, management, and media library tools",
|
|
575
|
+
users: "User account management and authentication tools",
|
|
576
|
+
comments: "Comment moderation and management tools",
|
|
577
|
+
taxonomies: "Category and tag management tools",
|
|
578
|
+
site: "Site settings and configuration tools",
|
|
579
|
+
auth: "Authentication testing and management tools",
|
|
580
|
+
cache: "Performance caching and optimization tools",
|
|
581
|
+
performance: "Performance monitoring and analytics tools",
|
|
582
|
+
};
|
|
583
|
+
return descriptions[categoryName.toLowerCase()] || `${categoryName} management tools`;
|
|
584
|
+
}
|
|
585
|
+
generateUsagePatterns(categoryName, tools) {
|
|
586
|
+
const patterns = {
|
|
587
|
+
posts: [
|
|
588
|
+
"Create and publish blog posts",
|
|
589
|
+
"Bulk edit multiple posts",
|
|
590
|
+
"Search and filter posts by criteria",
|
|
591
|
+
"Schedule posts for future publication",
|
|
592
|
+
],
|
|
593
|
+
media: [
|
|
594
|
+
"Upload images and files",
|
|
595
|
+
"Organize media library",
|
|
596
|
+
"Generate thumbnails and variants",
|
|
597
|
+
"Bulk media operations",
|
|
598
|
+
],
|
|
599
|
+
users: [
|
|
600
|
+
"Manage user accounts and roles",
|
|
601
|
+
"User authentication and permissions",
|
|
602
|
+
"Bulk user operations",
|
|
603
|
+
"User profile management",
|
|
604
|
+
],
|
|
605
|
+
performance: [
|
|
606
|
+
"Monitor real-time performance metrics",
|
|
607
|
+
"Analyze historical performance trends",
|
|
608
|
+
"Generate optimization recommendations",
|
|
609
|
+
"Export performance reports",
|
|
610
|
+
],
|
|
611
|
+
};
|
|
612
|
+
return (patterns[categoryName.toLowerCase()] || [
|
|
613
|
+
`Manage ${categoryName.toLowerCase()} efficiently`,
|
|
614
|
+
`Bulk ${categoryName.toLowerCase()} operations`,
|
|
615
|
+
`Search and filter ${categoryName.toLowerCase()}`,
|
|
616
|
+
]);
|
|
617
|
+
}
|
|
618
|
+
generateWordPressPostExample() {
|
|
619
|
+
return {
|
|
620
|
+
id: 123,
|
|
621
|
+
title: "Welcome to WordPress",
|
|
622
|
+
content: "<p>This is your first post. Edit or delete it to get started!</p>",
|
|
623
|
+
status: "publish",
|
|
624
|
+
date: "2024-01-01T00:00:00Z",
|
|
625
|
+
author: 1,
|
|
626
|
+
categories: [1],
|
|
627
|
+
tags: [1, 2],
|
|
628
|
+
featured_media: 0,
|
|
629
|
+
excerpt: "A sample WordPress post",
|
|
630
|
+
slug: "welcome-to-wordpress",
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
generateParameterSchema(parameters) {
|
|
634
|
+
const properties = {};
|
|
635
|
+
const required = [];
|
|
636
|
+
for (const param of parameters) {
|
|
637
|
+
properties[param.name] = {
|
|
638
|
+
type: param.type,
|
|
639
|
+
description: param.description,
|
|
640
|
+
};
|
|
641
|
+
if (param.allowedValues) {
|
|
642
|
+
properties[param.name].enum = param.allowedValues;
|
|
643
|
+
}
|
|
644
|
+
if (param.defaultValue !== undefined) {
|
|
645
|
+
properties[param.name].default = param.defaultValue;
|
|
646
|
+
}
|
|
647
|
+
if (param.required) {
|
|
648
|
+
required.push(param.name);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
type: "object",
|
|
653
|
+
properties,
|
|
654
|
+
required: required.length > 0 ? required : undefined,
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
convertTypeToJsonSchema(type) {
|
|
658
|
+
const properties = {};
|
|
659
|
+
const required = [];
|
|
660
|
+
for (const prop of type.properties) {
|
|
661
|
+
properties[prop.name] = {
|
|
662
|
+
type: prop.type,
|
|
663
|
+
description: prop.description,
|
|
664
|
+
};
|
|
665
|
+
if (prop.format) {
|
|
666
|
+
properties[prop.name].format = prop.format;
|
|
667
|
+
}
|
|
668
|
+
if (prop.required) {
|
|
669
|
+
required.push(prop.name);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return {
|
|
673
|
+
type: "object",
|
|
674
|
+
description: type.description,
|
|
675
|
+
properties,
|
|
676
|
+
required: required.length > 0 ? required : undefined,
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
inferReturnType(toolName, category) {
|
|
680
|
+
if (toolName.includes("list"))
|
|
681
|
+
return `${category}[]`;
|
|
682
|
+
if (toolName.includes("get"))
|
|
683
|
+
return category;
|
|
684
|
+
if (toolName.includes("create"))
|
|
685
|
+
return category;
|
|
686
|
+
if (toolName.includes("update"))
|
|
687
|
+
return category;
|
|
688
|
+
if (toolName.includes("delete"))
|
|
689
|
+
return "DeleteResult";
|
|
690
|
+
if (toolName.includes("search"))
|
|
691
|
+
return `${category}[]`;
|
|
692
|
+
if (toolName.includes("performance"))
|
|
693
|
+
return "PerformanceMetrics";
|
|
694
|
+
if (toolName.includes("cache"))
|
|
695
|
+
return "CacheStats";
|
|
696
|
+
return "object";
|
|
697
|
+
}
|
|
698
|
+
generateErrorDocumentation(toolName) {
|
|
699
|
+
return [
|
|
700
|
+
{
|
|
701
|
+
code: "AUTHENTICATION_FAILED",
|
|
702
|
+
message: "Authentication failed",
|
|
703
|
+
description: "Invalid credentials or insufficient permissions",
|
|
704
|
+
resolution: "Check your authentication credentials and user permissions",
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
code: "VALIDATION_ERROR",
|
|
708
|
+
message: "Parameter validation failed",
|
|
709
|
+
description: "One or more required parameters are missing or invalid",
|
|
710
|
+
resolution: "Review the required parameters and their formats",
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
code: "NOT_FOUND",
|
|
714
|
+
message: "Resource not found",
|
|
715
|
+
description: "The requested resource does not exist",
|
|
716
|
+
resolution: "Verify the resource ID and ensure it exists",
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
code: "PERMISSION_DENIED",
|
|
720
|
+
message: "Insufficient permissions",
|
|
721
|
+
description: "The user does not have permission to perform this action",
|
|
722
|
+
resolution: "Contact an administrator to grant the necessary permissions",
|
|
723
|
+
},
|
|
724
|
+
];
|
|
725
|
+
}
|
|
726
|
+
findRelatedTools(toolName, category) {
|
|
727
|
+
// Find tools in the same category
|
|
728
|
+
const categoryTools = this.toolCategories.get(category) || [];
|
|
729
|
+
return categoryTools.filter((tool) => tool !== toolName).slice(0, 3);
|
|
730
|
+
}
|
|
731
|
+
getRequiredPermissions(toolName) {
|
|
732
|
+
const permissions = {
|
|
733
|
+
wp_create_post: ["publish_posts", "edit_posts"],
|
|
734
|
+
wp_update_post: ["edit_posts"],
|
|
735
|
+
wp_delete_post: ["delete_posts"],
|
|
736
|
+
wp_create_page: ["publish_pages", "edit_pages"],
|
|
737
|
+
wp_update_page: ["edit_pages"],
|
|
738
|
+
wp_delete_page: ["delete_pages"],
|
|
739
|
+
wp_upload_media: ["upload_files"],
|
|
740
|
+
wp_delete_media: ["delete_files"],
|
|
741
|
+
wp_create_user: ["create_users"],
|
|
742
|
+
wp_update_user: ["edit_users"],
|
|
743
|
+
wp_delete_user: ["delete_users"],
|
|
744
|
+
wp_moderate_comment: ["moderate_comments"],
|
|
745
|
+
wp_get_site_settings: ["manage_options"],
|
|
746
|
+
};
|
|
747
|
+
return permissions[toolName];
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* File writing implementations
|
|
751
|
+
*/
|
|
752
|
+
async writeApiOverview(output) {
|
|
753
|
+
const { MarkdownFormatter } = await import("./MarkdownFormatter.js");
|
|
754
|
+
const formatter = new MarkdownFormatter();
|
|
755
|
+
const content = formatter.generateApiOverview(output);
|
|
756
|
+
await fs.promises.writeFile(path.join(this.config.outputDir, "README.md"), content);
|
|
757
|
+
}
|
|
758
|
+
async writeToolDocumentation(tool) {
|
|
759
|
+
const { MarkdownFormatter } = await import("./MarkdownFormatter.js");
|
|
760
|
+
const formatter = new MarkdownFormatter();
|
|
761
|
+
const content = formatter.generateToolDocumentation(tool);
|
|
762
|
+
await fs.promises.writeFile(path.join(this.config.outputDir, "tools", `${tool.name}.md`), content);
|
|
763
|
+
}
|
|
764
|
+
async writeCategoryDocumentation(category) {
|
|
765
|
+
const { MarkdownFormatter } = await import("./MarkdownFormatter.js");
|
|
766
|
+
const formatter = new MarkdownFormatter();
|
|
767
|
+
const content = formatter.generateCategoryDocumentation(category);
|
|
768
|
+
await fs.promises.writeFile(path.join(this.config.outputDir, "categories", `${category.name.toLowerCase()}.md`), content);
|
|
769
|
+
}
|
|
770
|
+
async writeTypeDocumentation(type) {
|
|
771
|
+
const { MarkdownFormatter } = await import("./MarkdownFormatter.js");
|
|
772
|
+
const formatter = new MarkdownFormatter();
|
|
773
|
+
const content = formatter.generateTypeDocumentation(type);
|
|
774
|
+
await fs.promises.writeFile(path.join(this.config.outputDir, "types", `${type.name}.md`), content);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
//# sourceMappingURL=DocumentationGenerator.js.map
|