mcp-wordpress 2.4.2 → 2.5.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.
- package/README.md +114 -48
- package/dist/ajv-patch.js +34 -0
- 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/__tests__/HttpCacheWrapper.test.js +6 -5
- package/dist/cache/__tests__/HttpCacheWrapper.test.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 +50 -41
- 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.cjs +81 -0
- 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/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/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/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 +31 -31
- package/docs/integrations/cline.md +4 -4
- package/docs/integrations/vs-code.md +9 -8
- package/docs/user-guides/SMITHERY_SETUP.md +10 -10
- package/package.json +44 -25
- 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 +51 -47
- 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
|
@@ -7,6 +7,8 @@ import { CachedWordPressClient } from "../client/CachedWordPressClient.js";
|
|
|
7
7
|
import { MockWordPressClient } from "../client/MockWordPressClient.js";
|
|
8
8
|
import { WordPressClientConfig } from "../types/client.js";
|
|
9
9
|
import { getErrorMessage } from "../utils/error.js";
|
|
10
|
+
import { LoggerFactory } from "../utils/logger.js";
|
|
11
|
+
import { ConfigHelpers } from "./Config.js";
|
|
10
12
|
import {
|
|
11
13
|
ConfigurationValidator,
|
|
12
14
|
type SiteType as SiteConfig,
|
|
@@ -15,7 +17,7 @@ import {
|
|
|
15
17
|
} from "./ConfigurationSchema.js";
|
|
16
18
|
|
|
17
19
|
// Re-export types from schema for backward compatibility
|
|
18
|
-
export type { SiteConfig, MultiSiteConfig };
|
|
20
|
+
export type { SiteConfig, MultiSiteConfig, McpConfigType };
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Configuration loader for MCP WordPress Server
|
|
@@ -23,6 +25,7 @@ export type { SiteConfig, MultiSiteConfig };
|
|
|
23
25
|
*/
|
|
24
26
|
export class ServerConfiguration {
|
|
25
27
|
private static instance: ServerConfiguration;
|
|
28
|
+
private readonly logger = LoggerFactory.server();
|
|
26
29
|
private rootDir: string;
|
|
27
30
|
private envPath: string;
|
|
28
31
|
|
|
@@ -36,12 +39,12 @@ export class ServerConfiguration {
|
|
|
36
39
|
dotenv.config({ path: this.envPath });
|
|
37
40
|
|
|
38
41
|
// Debug output for DXT troubleshooting (reduced in DXT mode)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if (ConfigHelpers.shouldDebug()) {
|
|
43
|
+
this.logger.debug("ServerConfiguration initialized", {
|
|
44
|
+
rootDir: this.rootDir,
|
|
45
|
+
envPath: this.envPath,
|
|
46
|
+
envFileExists: fs.existsSync(this.envPath),
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -66,15 +69,15 @@ export class ServerConfiguration {
|
|
|
66
69
|
const configPath = path.resolve(this.rootDir, "mcp-wordpress.config.json");
|
|
67
70
|
|
|
68
71
|
if (fs.existsSync(configPath)) {
|
|
69
|
-
if (
|
|
70
|
-
|
|
72
|
+
if (ConfigHelpers.shouldLogInfo()) {
|
|
73
|
+
this.logger.info("Found multi-site configuration file", { configPath });
|
|
71
74
|
}
|
|
72
75
|
return this.loadMultiSiteConfig(configPath);
|
|
73
76
|
} else {
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
77
|
+
if (ConfigHelpers.shouldLogInfo()) {
|
|
78
|
+
this.logger.info("Multi-site config not found, using environment variables for single-site mode", {
|
|
79
|
+
configPath,
|
|
80
|
+
});
|
|
78
81
|
}
|
|
79
82
|
return this.loadSingleSiteFromEnv(mcpConfig);
|
|
80
83
|
}
|
|
@@ -108,21 +111,27 @@ export class ServerConfiguration {
|
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
// Use cached client for better performance
|
|
111
|
-
const client =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
: new CachedWordPressClient(clientConfig, site.id);
|
|
114
|
+
const client = ConfigHelpers.shouldUseCache()
|
|
115
|
+
? new CachedWordPressClient(clientConfig, site.id)
|
|
116
|
+
: new WordPressClient(clientConfig);
|
|
115
117
|
clients.set(site.id, client);
|
|
116
118
|
validConfigs.push(site);
|
|
117
119
|
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
+
if (ConfigHelpers.shouldLogInfo()) {
|
|
121
|
+
this.logger.info("Initialized site client", {
|
|
122
|
+
siteName: site.name,
|
|
123
|
+
siteId: site.id,
|
|
124
|
+
authMethod: site.config.WORDPRESS_AUTH_METHOD,
|
|
125
|
+
});
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
return { clients, configs: validConfigs };
|
|
124
130
|
} catch (error) {
|
|
125
|
-
|
|
131
|
+
this.logger.fatal("Failed to load multi-site configuration", {
|
|
132
|
+
configPath,
|
|
133
|
+
error: getErrorMessage(error),
|
|
134
|
+
});
|
|
126
135
|
process.exit(1);
|
|
127
136
|
}
|
|
128
137
|
}
|
|
@@ -131,14 +140,7 @@ export class ServerConfiguration {
|
|
|
131
140
|
* Check if we're in CI environment
|
|
132
141
|
*/
|
|
133
142
|
private isCIEnvironment(): boolean {
|
|
134
|
-
return (
|
|
135
|
-
process.env.CI === "true" ||
|
|
136
|
-
process.env.NODE_ENV === "ci" ||
|
|
137
|
-
process.env.NODE_ENV === "test" ||
|
|
138
|
-
process.env.GITHUB_ACTIONS === "true" ||
|
|
139
|
-
process.env.TRAVIS === "true" ||
|
|
140
|
-
process.env.CIRCLECI === "true"
|
|
141
|
-
);
|
|
143
|
+
return ConfigHelpers.isCI();
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
/**
|
|
@@ -175,7 +177,7 @@ export class ServerConfiguration {
|
|
|
175
177
|
config: mockConfig,
|
|
176
178
|
};
|
|
177
179
|
|
|
178
|
-
|
|
180
|
+
this.logger.info("Using mock configuration for CI environment");
|
|
179
181
|
return { clients, configs: [siteConfig] };
|
|
180
182
|
}
|
|
181
183
|
|
|
@@ -189,14 +191,14 @@ export class ServerConfiguration {
|
|
|
189
191
|
try {
|
|
190
192
|
// Debug output for DXT troubleshooting (reduced in DXT mode)
|
|
191
193
|
const isDXTMode = process.env.NODE_ENV === "dxt";
|
|
192
|
-
if (!isDXTMode) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
if (!isDXTMode && ConfigHelpers.shouldDebug()) {
|
|
195
|
+
this.logger.debug("Loading single-site configuration from environment", {
|
|
196
|
+
mcpConfigProvided: Boolean(mcpConfig),
|
|
197
|
+
siteUrl: process.env.WORDPRESS_SITE_URL || "NOT SET",
|
|
198
|
+
username: process.env.WORDPRESS_USERNAME || "NOT SET",
|
|
199
|
+
appPasswordSet: Boolean(process.env.WORDPRESS_APP_PASSWORD),
|
|
200
|
+
authMethod: process.env.WORDPRESS_AUTH_METHOD || "NOT SET",
|
|
201
|
+
});
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
// Check if we're in CI environment and credentials are missing
|
|
@@ -220,12 +222,13 @@ export class ServerConfiguration {
|
|
|
220
222
|
LOG_LEVEL: process.env.LOG_LEVEL,
|
|
221
223
|
};
|
|
222
224
|
|
|
223
|
-
if (!isDXTMode) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
if (!isDXTMode && ConfigHelpers.shouldDebug()) {
|
|
226
|
+
this.logger.debug("Final environment configuration for validation", {
|
|
227
|
+
siteUrl: envConfig.WORDPRESS_SITE_URL || "NOT SET",
|
|
228
|
+
username: envConfig.WORDPRESS_USERNAME || "NOT SET",
|
|
229
|
+
appPasswordSet: Boolean(envConfig.WORDPRESS_APP_PASSWORD),
|
|
230
|
+
authMethod: envConfig.WORDPRESS_AUTH_METHOD || "NOT SET",
|
|
231
|
+
});
|
|
229
232
|
}
|
|
230
233
|
|
|
231
234
|
// Validate environment configuration using Zod schema
|
|
@@ -260,14 +263,15 @@ export class ServerConfiguration {
|
|
|
260
263
|
};
|
|
261
264
|
|
|
262
265
|
if (!isDXTMode) {
|
|
263
|
-
|
|
266
|
+
this.logger.info("Initialized default site client in single-site mode");
|
|
264
267
|
}
|
|
265
268
|
|
|
266
269
|
return { clients, configs: [siteConfig] };
|
|
267
270
|
} catch (error) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
+
this.logger.error("Configuration validation failed for single-site mode", {
|
|
272
|
+
error: getErrorMessage(error),
|
|
273
|
+
suggestion: "Please check your environment variables or MCP configuration",
|
|
274
|
+
});
|
|
271
275
|
return { clients: new Map(), configs: [] };
|
|
272
276
|
}
|
|
273
277
|
}
|
|
@@ -7,6 +7,7 @@ import * as fs from "fs";
|
|
|
7
7
|
import * as path from "path";
|
|
8
8
|
import * as Tools from "../tools/index.js";
|
|
9
9
|
import type { ToolDefinition } from "../server/ToolRegistry.js";
|
|
10
|
+
import { LoggerFactory } from "../utils/logger.js";
|
|
10
11
|
|
|
11
12
|
export interface DocumentationConfig {
|
|
12
13
|
outputDir: string;
|
|
@@ -35,7 +36,7 @@ export interface ParameterDocumentation {
|
|
|
35
36
|
type: string;
|
|
36
37
|
required: boolean;
|
|
37
38
|
description: string;
|
|
38
|
-
defaultValue:
|
|
39
|
+
defaultValue: unknown;
|
|
39
40
|
allowedValues: string[] | undefined;
|
|
40
41
|
examples: string[];
|
|
41
42
|
}
|
|
@@ -44,11 +45,11 @@ export interface ExampleUsage {
|
|
|
44
45
|
title: string;
|
|
45
46
|
description: string;
|
|
46
47
|
command: string;
|
|
47
|
-
parameters: Record<string,
|
|
48
|
-
expectedResponse:
|
|
48
|
+
parameters: Record<string, unknown>;
|
|
49
|
+
expectedResponse: unknown;
|
|
49
50
|
errorExample?: {
|
|
50
51
|
scenario: string;
|
|
51
|
-
error:
|
|
52
|
+
error: unknown;
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -79,7 +80,7 @@ export interface TypeDocumentation {
|
|
|
79
80
|
name: string;
|
|
80
81
|
description: string;
|
|
81
82
|
properties: PropertyDocumentation[];
|
|
82
|
-
examples:
|
|
83
|
+
examples: unknown[];
|
|
83
84
|
wordpressSource?: string;
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -93,9 +94,9 @@ export interface PropertyDocumentation {
|
|
|
93
94
|
|
|
94
95
|
export interface OpenAPISpecification {
|
|
95
96
|
openapi: string;
|
|
96
|
-
info:
|
|
97
|
-
paths: Record<string,
|
|
98
|
-
components: Record<string,
|
|
97
|
+
info: Record<string, unknown>;
|
|
98
|
+
paths: Record<string, unknown>;
|
|
99
|
+
components: Record<string, unknown>;
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
export interface DocumentationSummary {
|
|
@@ -118,6 +119,7 @@ export class DocumentationGenerator {
|
|
|
118
119
|
private config: DocumentationConfig;
|
|
119
120
|
private toolCategories: Map<string, string[]> = new Map();
|
|
120
121
|
private wordpressEndpoints: Map<string, string> = new Map();
|
|
122
|
+
private logger = LoggerFactory.api();
|
|
121
123
|
|
|
122
124
|
constructor(config: Partial<DocumentationConfig> = {}) {
|
|
123
125
|
this.config = {
|
|
@@ -138,7 +140,7 @@ export class DocumentationGenerator {
|
|
|
138
140
|
* Generate complete documentation for all tools and types
|
|
139
141
|
*/
|
|
140
142
|
async generateFullDocumentation(): Promise<DocumentationOutput> {
|
|
141
|
-
|
|
143
|
+
this.logger.info("🚀 Starting API documentation generation...");
|
|
142
144
|
|
|
143
145
|
const tools = await this.extractAllToolDocumentation();
|
|
144
146
|
const categories = this.generateCategoryDocumentation(tools);
|
|
@@ -162,7 +164,7 @@ export class DocumentationGenerator {
|
|
|
162
164
|
// Write documentation to files
|
|
163
165
|
await this.writeDocumentationFiles(output);
|
|
164
166
|
|
|
165
|
-
|
|
167
|
+
this.logger.info(`✅ Documentation generation complete! ${tools.length} tools documented.`);
|
|
166
168
|
return output;
|
|
167
169
|
}
|
|
168
170
|
|
|
@@ -176,23 +178,23 @@ export class DocumentationGenerator {
|
|
|
176
178
|
for (const [className, ToolClass] of Object.entries(Tools)) {
|
|
177
179
|
try {
|
|
178
180
|
// Create tool instance
|
|
179
|
-
let toolInstance:
|
|
181
|
+
let toolInstance: { getTools(): unknown[] };
|
|
180
182
|
if (className === "CacheTools" || className === "PerformanceTools") {
|
|
181
183
|
// These tools need client map - use empty map for doc generation
|
|
182
184
|
toolInstance = new ToolClass(new Map());
|
|
183
185
|
} else {
|
|
184
|
-
toolInstance = new (ToolClass as new () =>
|
|
186
|
+
toolInstance = new (ToolClass as new () => { getTools(): unknown[] })();
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
const toolDefinitions = toolInstance.getTools();
|
|
188
190
|
const category = this.extractCategoryFromClassName(className);
|
|
189
191
|
|
|
190
192
|
for (const toolDef of toolDefinitions) {
|
|
191
|
-
const doc = await this.extractToolDocumentation(toolDef, category, className);
|
|
193
|
+
const doc = await this.extractToolDocumentation(toolDef as ToolDefinition, category, className);
|
|
192
194
|
toolDocs.push(doc);
|
|
193
195
|
}
|
|
194
196
|
} catch (error) {
|
|
195
|
-
|
|
197
|
+
this.logger.warn(`⚠️ Failed to extract documentation for ${className}:`, { error: String(error) });
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
|
|
@@ -231,7 +233,15 @@ export class DocumentationGenerator {
|
|
|
231
233
|
/**
|
|
232
234
|
* Extract parameter documentation
|
|
233
235
|
*/
|
|
234
|
-
private extractParameterDocumentation(
|
|
236
|
+
private extractParameterDocumentation(
|
|
237
|
+
parameters: Array<{
|
|
238
|
+
name: string;
|
|
239
|
+
type?: string;
|
|
240
|
+
description?: string;
|
|
241
|
+
required?: boolean;
|
|
242
|
+
[key: string]: unknown;
|
|
243
|
+
}>,
|
|
244
|
+
): ParameterDocumentation[] {
|
|
235
245
|
return parameters.map((param) => ({
|
|
236
246
|
name: param.name,
|
|
237
247
|
type: param.type || "string",
|
|
@@ -277,7 +287,7 @@ export class DocumentationGenerator {
|
|
|
277
287
|
*/
|
|
278
288
|
private generateBasicExample(toolDef: ToolDefinition, category: string): ExampleUsage | null {
|
|
279
289
|
const toolName = toolDef.name;
|
|
280
|
-
const basicParams: Record<string,
|
|
290
|
+
const basicParams: Record<string, unknown> = {};
|
|
281
291
|
|
|
282
292
|
// Add essential parameters
|
|
283
293
|
const requiredParams = (toolDef.parameters || []).filter((p) => p.required);
|
|
@@ -406,8 +416,8 @@ export class DocumentationGenerator {
|
|
|
406
416
|
* Generate OpenAPI specification
|
|
407
417
|
*/
|
|
408
418
|
private generateOpenAPISpecification(tools: ToolDocumentation[], types: TypeDocumentation[]): OpenAPISpecification {
|
|
409
|
-
const paths: Record<string,
|
|
410
|
-
const components: Record<string,
|
|
419
|
+
const paths: Record<string, unknown> = {};
|
|
420
|
+
const components: Record<string, unknown> = {
|
|
411
421
|
schemas: {},
|
|
412
422
|
parameters: {},
|
|
413
423
|
responses: {},
|
|
@@ -453,8 +463,9 @@ export class DocumentationGenerator {
|
|
|
453
463
|
}
|
|
454
464
|
|
|
455
465
|
// Add type schemas to components
|
|
466
|
+
const schemas = components.schemas as Record<string, unknown>;
|
|
456
467
|
for (const type of types) {
|
|
457
|
-
|
|
468
|
+
schemas[type.name] = this.convertTypeToJsonSchema(type);
|
|
458
469
|
}
|
|
459
470
|
|
|
460
471
|
return {
|
|
@@ -520,7 +531,7 @@ export class DocumentationGenerator {
|
|
|
520
531
|
// Write summary
|
|
521
532
|
await fs.promises.writeFile(path.join(outputDir, "summary.json"), JSON.stringify(output.summary, null, 2));
|
|
522
533
|
|
|
523
|
-
|
|
534
|
+
this.logger.info(`📁 Documentation written to ${outputDir}/`);
|
|
524
535
|
}
|
|
525
536
|
|
|
526
537
|
// Helper methods for specific documentation tasks...
|
|
@@ -582,8 +593,8 @@ export class DocumentationGenerator {
|
|
|
582
593
|
* Helper methods for documentation generation
|
|
583
594
|
*/
|
|
584
595
|
|
|
585
|
-
private getDefaultValue(param:
|
|
586
|
-
const defaults: Record<string,
|
|
596
|
+
private getDefaultValue(param: { [key: string]: unknown }): unknown {
|
|
597
|
+
const defaults: Record<string, unknown> = {
|
|
587
598
|
per_page: 10,
|
|
588
599
|
page: 1,
|
|
589
600
|
order: "desc",
|
|
@@ -594,10 +605,10 @@ export class DocumentationGenerator {
|
|
|
594
605
|
includeExamples: true,
|
|
595
606
|
includeTrends: true,
|
|
596
607
|
};
|
|
597
|
-
return defaults[param.name];
|
|
608
|
+
return defaults[String(param.name)];
|
|
598
609
|
}
|
|
599
610
|
|
|
600
|
-
private getAllowedValues(param:
|
|
611
|
+
private getAllowedValues(param: { [key: string]: unknown }): string[] | undefined {
|
|
601
612
|
const allowedValues: Record<string, string[]> = {
|
|
602
613
|
status: ["publish", "draft", "private", "pending", "future"],
|
|
603
614
|
order: ["asc", "desc"],
|
|
@@ -608,10 +619,10 @@ export class DocumentationGenerator {
|
|
|
608
619
|
priority: ["quick_wins", "medium_term", "long_term", "all"],
|
|
609
620
|
focus: ["speed", "reliability", "efficiency", "scaling"],
|
|
610
621
|
};
|
|
611
|
-
return allowedValues[param.name];
|
|
622
|
+
return allowedValues[String(param.name)];
|
|
612
623
|
}
|
|
613
624
|
|
|
614
|
-
private generateParameterExamples(param:
|
|
625
|
+
private generateParameterExamples(param: { name: string; type?: string; [key: string]: unknown }): string[] {
|
|
615
626
|
const examples: Record<string, string[]> = {
|
|
616
627
|
id: ["123", "456"],
|
|
617
628
|
title: ["My Blog Post", "Hello World"],
|
|
@@ -633,8 +644,8 @@ export class DocumentationGenerator {
|
|
|
633
644
|
return toolDef.parameters?.some((p) => p.name === "site") ?? true;
|
|
634
645
|
}
|
|
635
646
|
|
|
636
|
-
private generateExampleValue(param:
|
|
637
|
-
const exampleValues: Record<string,
|
|
647
|
+
private generateExampleValue(param: { name: string; type?: string; [key: string]: unknown }): unknown {
|
|
648
|
+
const exampleValues: Record<string, unknown> = {
|
|
638
649
|
id: 123,
|
|
639
650
|
title: "Example Post Title",
|
|
640
651
|
content: "This is example content for the post.",
|
|
@@ -656,7 +667,7 @@ export class DocumentationGenerator {
|
|
|
656
667
|
return exampleValues[param.name] || "example_value";
|
|
657
668
|
}
|
|
658
669
|
|
|
659
|
-
private generateExpectedResponse(toolName: string, category: string, type: string):
|
|
670
|
+
private generateExpectedResponse(toolName: string, category: string, type: string): unknown {
|
|
660
671
|
if (toolName.includes("list")) {
|
|
661
672
|
return {
|
|
662
673
|
success: true,
|
|
@@ -724,8 +735,8 @@ export class DocumentationGenerator {
|
|
|
724
735
|
};
|
|
725
736
|
}
|
|
726
737
|
|
|
727
|
-
private getExampleParameters(toolDef: ToolDefinition, type: string | number): Record<string,
|
|
728
|
-
const params: Record<string,
|
|
738
|
+
private getExampleParameters(toolDef: ToolDefinition, type: string | number): Record<string, unknown> {
|
|
739
|
+
const params: Record<string, unknown> = {};
|
|
729
740
|
const parameters = toolDef.parameters || [];
|
|
730
741
|
|
|
731
742
|
if (type === "all") {
|
|
@@ -795,7 +806,7 @@ export class DocumentationGenerator {
|
|
|
795
806
|
);
|
|
796
807
|
}
|
|
797
808
|
|
|
798
|
-
private generateWordPressPostExample():
|
|
809
|
+
private generateWordPressPostExample(): Record<string, unknown> {
|
|
799
810
|
return {
|
|
800
811
|
id: 123,
|
|
801
812
|
title: "Welcome to WordPress",
|
|
@@ -811,8 +822,8 @@ export class DocumentationGenerator {
|
|
|
811
822
|
};
|
|
812
823
|
}
|
|
813
824
|
|
|
814
|
-
private generateParameterSchema(parameters: ParameterDocumentation[]):
|
|
815
|
-
const properties: Record<string,
|
|
825
|
+
private generateParameterSchema(parameters: ParameterDocumentation[]): Record<string, unknown> {
|
|
826
|
+
const properties: Record<string, unknown> = {};
|
|
816
827
|
const required: string[] = [];
|
|
817
828
|
|
|
818
829
|
for (const param of parameters) {
|
|
@@ -822,11 +833,11 @@ export class DocumentationGenerator {
|
|
|
822
833
|
};
|
|
823
834
|
|
|
824
835
|
if (param.allowedValues) {
|
|
825
|
-
properties[param.name].enum = param.allowedValues;
|
|
836
|
+
(properties[param.name] as Record<string, unknown>).enum = param.allowedValues;
|
|
826
837
|
}
|
|
827
838
|
|
|
828
839
|
if (param.defaultValue !== undefined) {
|
|
829
|
-
properties[param.name].default = param.defaultValue;
|
|
840
|
+
(properties[param.name] as Record<string, unknown>).default = param.defaultValue;
|
|
830
841
|
}
|
|
831
842
|
|
|
832
843
|
if (param.required) {
|
|
@@ -841,8 +852,8 @@ export class DocumentationGenerator {
|
|
|
841
852
|
};
|
|
842
853
|
}
|
|
843
854
|
|
|
844
|
-
private convertTypeToJsonSchema(type: TypeDocumentation):
|
|
845
|
-
const properties: Record<string,
|
|
855
|
+
private convertTypeToJsonSchema(type: TypeDocumentation): Record<string, unknown> {
|
|
856
|
+
const properties: Record<string, unknown> = {};
|
|
846
857
|
const required: string[] = [];
|
|
847
858
|
|
|
848
859
|
for (const prop of type.properties) {
|
|
@@ -852,7 +863,7 @@ export class DocumentationGenerator {
|
|
|
852
863
|
};
|
|
853
864
|
|
|
854
865
|
if (prop.format) {
|
|
855
|
-
properties[prop.name].format = prop.format;
|
|
866
|
+
(properties[prop.name] as Record<string, unknown>).format = prop.format;
|
|
856
867
|
}
|
|
857
868
|
|
|
858
869
|
if (prop.required) {
|
|
@@ -256,25 +256,20 @@ ${type.examples.length > 1 ? this.generateAdditionalExamples(type.examples.slice
|
|
|
256
256
|
/**
|
|
257
257
|
* Generate parameters table
|
|
258
258
|
*/
|
|
259
|
-
private generateParametersTable(
|
|
260
|
-
parameters: ParameterDocumentation[],
|
|
261
|
-
): string {
|
|
259
|
+
private generateParametersTable(parameters: ParameterDocumentation[]): string {
|
|
262
260
|
if (parameters.length === 0) {
|
|
263
261
|
return "*No parameters required.*";
|
|
264
262
|
}
|
|
265
263
|
|
|
266
|
-
const headers =
|
|
267
|
-
|
|
268
|
-
const separator =
|
|
269
|
-
"|-----------|------|----------|-------------|---------|----------|";
|
|
264
|
+
const headers = "| Parameter | Type | Required | Description | Default | Examples |";
|
|
265
|
+
const separator = "|-----------|------|----------|-------------|---------|----------|";
|
|
270
266
|
|
|
271
267
|
const rows = parameters.map((param) => {
|
|
272
268
|
const examples = param.examples
|
|
273
269
|
.slice(0, 2)
|
|
274
270
|
.map((ex) => `\`${ex}\``)
|
|
275
271
|
.join(", ");
|
|
276
|
-
const defaultVal =
|
|
277
|
-
param.defaultValue !== undefined ? `\`${param.defaultValue}\`` : "-";
|
|
272
|
+
const defaultVal = param.defaultValue !== undefined ? `\`${param.defaultValue}\`` : "-";
|
|
278
273
|
const required = param.required ? "✅" : "❌";
|
|
279
274
|
|
|
280
275
|
return `| \`${param.name}\` | \`${param.type}\` | ${required} | ${param.description} | ${defaultVal} | ${examples || "-"} |`;
|
|
@@ -316,10 +311,7 @@ ${example.errorExample ? this.generateErrorExample(example.errorExample) : ""}
|
|
|
316
311
|
/**
|
|
317
312
|
* Generate error example
|
|
318
313
|
*/
|
|
319
|
-
private generateErrorExample(errorExample: {
|
|
320
|
-
scenario: string;
|
|
321
|
-
error: any;
|
|
322
|
-
}): string {
|
|
314
|
+
private generateErrorExample(errorExample: { scenario: string; error: unknown }): string {
|
|
323
315
|
return `**Error Example (${errorExample.scenario}):**
|
|
324
316
|
\`\`\`json
|
|
325
317
|
${JSON.stringify(errorExample.error, null, 2)}
|
|
@@ -378,7 +370,7 @@ ${permissions.map((perm) => `- \`${perm}\``).join("\n")}
|
|
|
378
370
|
/**
|
|
379
371
|
* Generate error documentation
|
|
380
372
|
*/
|
|
381
|
-
private generateErrorDocumentation(errorCodes:
|
|
373
|
+
private generateErrorDocumentation(errorCodes: unknown[]): string {
|
|
382
374
|
if (errorCodes.length === 0) {
|
|
383
375
|
return `### Common Errors
|
|
384
376
|
|
|
@@ -392,11 +384,11 @@ See [Error Handling Guide](../error-handling.md) for complete error reference.`;
|
|
|
392
384
|
|
|
393
385
|
return errorCodes
|
|
394
386
|
.map(
|
|
395
|
-
(error) => `### ${error.code}
|
|
387
|
+
(error) => `### ${(error as Record<string, unknown>).code}
|
|
396
388
|
|
|
397
|
-
**Message:** ${error.message}
|
|
398
|
-
**Description:** ${error.description}
|
|
399
|
-
**Resolution:** ${error.resolution}
|
|
389
|
+
**Message:** ${(error as Record<string, unknown>).message}
|
|
390
|
+
**Description:** ${(error as Record<string, unknown>).description}
|
|
391
|
+
**Resolution:** ${(error as Record<string, unknown>).resolution}
|
|
400
392
|
`,
|
|
401
393
|
)
|
|
402
394
|
.join("\n\n");
|
|
@@ -420,8 +412,7 @@ ${relatedTools.map((tool) => `- [\`${tool}\`](./${tool}.md)`).join("\n")}
|
|
|
420
412
|
const separator = "|----------|-------|-------------|";
|
|
421
413
|
|
|
422
414
|
const rows = categories.map(
|
|
423
|
-
(cat) =>
|
|
424
|
-
`| [${cat.name}](./categories/${cat.name.toLowerCase()}.md) | ${cat.toolCount} | ${cat.description} |`,
|
|
415
|
+
(cat) => `| [${cat.name}](./categories/${cat.name.toLowerCase()}.md) | ${cat.toolCount} | ${cat.description} |`,
|
|
425
416
|
);
|
|
426
417
|
|
|
427
418
|
return [headers, separator, ...rows].join("\n");
|
|
@@ -435,8 +426,7 @@ ${relatedTools.map((tool) => `- [\`${tool}\`](./${tool}.md)`).join("\n")}
|
|
|
435
426
|
const separator = "|------|----------|-------------|";
|
|
436
427
|
|
|
437
428
|
const rows = tools.map(
|
|
438
|
-
(tool) =>
|
|
439
|
-
`| [\`${tool.name}\`](./tools/${tool.name}.md) | ${tool.category} | ${tool.description} |`,
|
|
429
|
+
(tool) => `| [\`${tool.name}\`](./tools/${tool.name}.md) | ${tool.category} | ${tool.description} |`,
|
|
440
430
|
);
|
|
441
431
|
|
|
442
432
|
return [headers, separator, ...rows].join("\n");
|
|
@@ -445,13 +435,14 @@ ${relatedTools.map((tool) => `- [\`${tool}\`](./${tool}.md)`).join("\n")}
|
|
|
445
435
|
/**
|
|
446
436
|
* Generate type properties table
|
|
447
437
|
*/
|
|
448
|
-
private generateTypePropertiesTable(properties:
|
|
438
|
+
private generateTypePropertiesTable(properties: unknown[]): string {
|
|
449
439
|
const headers = "| Property | Type | Required | Description |";
|
|
450
440
|
const separator = "|----------|------|----------|-------------|";
|
|
451
441
|
|
|
452
442
|
const rows = properties.map((prop) => {
|
|
453
|
-
const
|
|
454
|
-
|
|
443
|
+
const propObj = prop as Record<string, unknown>;
|
|
444
|
+
const required = propObj.required ? "✅" : "❌";
|
|
445
|
+
return `| \`${propObj.name}\` | \`${propObj.type}\` | ${required} | ${propObj.description} |`;
|
|
455
446
|
});
|
|
456
447
|
|
|
457
448
|
return [headers, separator, ...rows].join("\n");
|
|
@@ -486,15 +477,14 @@ ${relatedTools.map((tool) => `- [\`${tool}\`](./${tool}.md)`).join("\n")}
|
|
|
486
477
|
performance: "brightgreen",
|
|
487
478
|
};
|
|
488
479
|
|
|
489
|
-
const color =
|
|
490
|
-
colors[category.toLowerCase() as keyof typeof colors] || "lightgrey";
|
|
480
|
+
const color = colors[category.toLowerCase() as keyof typeof colors] || "lightgrey";
|
|
491
481
|
return ``;
|
|
492
482
|
}
|
|
493
483
|
|
|
494
484
|
/**
|
|
495
485
|
* Format parameters for command examples
|
|
496
486
|
*/
|
|
497
|
-
private formatParameters(params: Record<string,
|
|
487
|
+
private formatParameters(params: Record<string, unknown>): string {
|
|
498
488
|
return Object.entries(params)
|
|
499
489
|
.map(([key, value]) => `--${key}="${value}"`)
|
|
500
490
|
.join(" ");
|
|
@@ -503,7 +493,7 @@ ${relatedTools.map((tool) => `- [\`${tool}\`](./${tool}.md)`).join("\n")}
|
|
|
503
493
|
/**
|
|
504
494
|
* Generate additional examples
|
|
505
495
|
*/
|
|
506
|
-
private generateAdditionalExamples(examples:
|
|
496
|
+
private generateAdditionalExamples(examples: unknown[]): string {
|
|
507
497
|
return `## Additional Examples
|
|
508
498
|
|
|
509
499
|
${examples
|