mcp-wordpress 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +503 -0
  2. package/dist/client/api.d.ts +90 -0
  3. package/dist/client/api.d.ts.map +1 -1
  4. package/dist/client/api.js +90 -0
  5. package/dist/client/api.js.map +1 -1
  6. package/dist/security/AISecurityScanner.d.ts +175 -0
  7. package/dist/security/AISecurityScanner.d.ts.map +1 -0
  8. package/dist/security/AISecurityScanner.js +645 -0
  9. package/dist/security/AISecurityScanner.js.map +1 -0
  10. package/dist/security/AutomatedRemediation.d.ts +145 -0
  11. package/dist/security/AutomatedRemediation.d.ts.map +1 -0
  12. package/dist/security/AutomatedRemediation.js +535 -0
  13. package/dist/security/AutomatedRemediation.js.map +1 -0
  14. package/dist/security/SecurityCIPipeline.d.ts +213 -0
  15. package/dist/security/SecurityCIPipeline.d.ts.map +1 -0
  16. package/dist/security/SecurityCIPipeline.js +684 -0
  17. package/dist/security/SecurityCIPipeline.js.map +1 -0
  18. package/dist/security/SecurityConfigManager.d.ts +294 -0
  19. package/dist/security/SecurityConfigManager.d.ts.map +1 -0
  20. package/dist/security/SecurityConfigManager.js +553 -0
  21. package/dist/security/SecurityConfigManager.js.map +1 -0
  22. package/dist/security/SecurityMonitoring.d.ts +245 -0
  23. package/dist/security/SecurityMonitoring.d.ts.map +1 -0
  24. package/dist/security/SecurityMonitoring.js +596 -0
  25. package/dist/security/SecurityMonitoring.js.map +1 -0
  26. package/dist/security/SecurityReviewer.d.ts +168 -0
  27. package/dist/security/SecurityReviewer.d.ts.map +1 -0
  28. package/dist/security/SecurityReviewer.js +683 -0
  29. package/dist/security/SecurityReviewer.js.map +1 -0
  30. package/dist/security/index.d.ts +182 -0
  31. package/dist/security/index.d.ts.map +1 -0
  32. package/dist/security/index.js +189 -0
  33. package/dist/security/index.js.map +1 -0
  34. package/dist/tools/media.d.ts +43 -4
  35. package/dist/tools/media.d.ts.map +1 -1
  36. package/dist/tools/media.js +43 -4
  37. package/dist/tools/media.js.map +1 -1
  38. package/dist/tools/posts.d.ts +225 -4
  39. package/dist/tools/posts.d.ts.map +1 -1
  40. package/dist/tools/posts.js +225 -4
  41. package/dist/tools/posts.js.map +1 -1
  42. package/docs/DOCKER_PUBLISHING_TROUBLESHOOTING.md +233 -0
  43. package/docs/PUBLISHING-TROUBLESHOOTING.md +227 -0
  44. package/docs/api/README.md +53 -11
  45. package/docs/api/openapi.json +10 -10
  46. package/docs/api/summary.json +1 -1
  47. package/docs/api/tools/wp_create_post.md +9 -3
  48. package/docs/api/tools/wp_delete_post.md +2 -3
  49. package/docs/api/tools/wp_get_current_user.md +7 -1
  50. package/docs/api/tools/wp_get_post.md +2 -3
  51. package/docs/api/tools/wp_get_post_revisions.md +1 -1
  52. package/docs/api/tools/wp_list_posts.md +10 -3
  53. package/docs/api/tools/wp_list_users.md +8 -1
  54. package/docs/api/tools/wp_search_site.md +8 -1
  55. package/docs/api/tools/wp_test_auth.md +8 -1
  56. package/docs/api/tools/wp_update_post.md +2 -3
  57. package/docs/examples/docker-production.md +801 -0
  58. package/docs/examples/multi-site-setup.md +575 -0
  59. package/docs/examples/single-site-setup.md +390 -0
  60. package/docs/examples/use-case-workflows.md +469 -0
  61. package/package.json +11 -3
  62. package/src/client/api.ts +90 -0
  63. package/src/security/AISecurityScanner.ts +780 -0
  64. package/src/security/AutomatedRemediation.ts +665 -0
  65. package/src/security/SecurityCIPipeline.ts +969 -0
  66. package/src/security/SecurityConfigManager.ts +829 -0
  67. package/src/security/SecurityMonitoring.ts +841 -0
  68. package/src/security/SecurityReviewer.ts +855 -0
  69. package/src/security/index.ts +249 -0
  70. package/src/tools/media.ts +43 -4
  71. package/src/tools/posts.ts +225 -4
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Security System Index
3
+ * Central export for all security components
4
+ */
5
+
6
+ // Core Security Components
7
+ export { SecurityConfig, SecurityUtils, createSecureError, getEnvironmentSecurity } from "./SecurityConfig";
8
+ import { SecurityValidationError } from "./InputValidator";
9
+ export {
10
+ InputSanitizer,
11
+ SecuritySchemas,
12
+ SecurityLimiter,
13
+ SecurityValidationError,
14
+ validateSecurity,
15
+ ToolSchemas,
16
+ } from "./InputValidator";
17
+
18
+ // AI-Powered Security Scanner
19
+ import { AISecurityScanner } from "./AISecurityScanner";
20
+ export { AISecurityScanner } from "./AISecurityScanner";
21
+
22
+ // Automated Remediation System
23
+ import { AutomatedRemediation, RemediationResult as _RemediationResult } from "./AutomatedRemediation";
24
+ export { AutomatedRemediation, RemediationResult } from "./AutomatedRemediation";
25
+
26
+ // Security Code Reviewer
27
+ import { SecurityReviewer, CodeReviewResult as _CodeReviewResult } from "./SecurityReviewer";
28
+ export { SecurityReviewer, CodeReviewResult } from "./SecurityReviewer";
29
+
30
+ // Security Configuration Manager
31
+ import { SecurityConfigManager } from "./SecurityConfigManager";
32
+ export { SecurityConfigManager } from "./SecurityConfigManager";
33
+
34
+ // Security Monitoring and Alerting
35
+ import { SecurityMonitor, SecurityEvent as _SecurityEvent } from "./SecurityMonitoring";
36
+ export { SecurityMonitor, SecurityEvent } from "./SecurityMonitoring";
37
+
38
+ // CI/CD Pipeline Integration
39
+ import { SecurityCIPipeline, PipelineSecurityReport as _PipelineSecurityReport } from "./SecurityCIPipeline";
40
+ export { SecurityCIPipeline, PipelineSecurityReport } from "./SecurityCIPipeline";
41
+
42
+ // Type definitions for external use
43
+ export interface SecurityScanOptions {
44
+ targets?: string[];
45
+ depth?: "shallow" | "deep" | "comprehensive";
46
+ includeFileSystem?: boolean;
47
+ includeRuntime?: boolean;
48
+ }
49
+
50
+ export interface SecurityReviewOptions {
51
+ rules?: string[];
52
+ excludeRules?: string[];
53
+ aiAnalysis?: boolean;
54
+ recursive?: boolean;
55
+ }
56
+
57
+ export interface SecurityGateOptions {
58
+ skipNonBlocking?: boolean;
59
+ continueOnFailure?: boolean;
60
+ dryRun?: boolean;
61
+ }
62
+
63
+ /**
64
+ * Security System Manager
65
+ * Orchestrates all security components
66
+ */
67
+ export class SecuritySystem {
68
+ private scanner: AISecurityScanner;
69
+ private remediation: AutomatedRemediation;
70
+ private reviewer: SecurityReviewer;
71
+ private configManager: SecurityConfigManager;
72
+ private monitor: SecurityMonitor;
73
+ private pipeline: SecurityCIPipeline;
74
+ private initialized = false;
75
+
76
+ constructor() {
77
+ this.scanner = new AISecurityScanner();
78
+ this.remediation = new AutomatedRemediation();
79
+ this.reviewer = new SecurityReviewer();
80
+ this.configManager = new SecurityConfigManager();
81
+ this.monitor = new SecurityMonitor();
82
+ this.pipeline = new SecurityCIPipeline();
83
+ }
84
+
85
+ /**
86
+ * Initialize the security system
87
+ */
88
+ async initialize(): Promise<void> {
89
+ if (this.initialized) {
90
+ console.log("[Security System] Already initialized");
91
+ return;
92
+ }
93
+
94
+ console.log("[Security System] Initializing comprehensive security system...");
95
+
96
+ try {
97
+ // Initialize all components
98
+ await this.configManager.initialize();
99
+ await this.pipeline.initialize();
100
+
101
+ // Start monitoring
102
+ this.monitor.start();
103
+
104
+ this.initialized = true;
105
+ console.log("[Security System] Security system initialized successfully");
106
+ } catch (error) {
107
+ console.error("[Security System] Initialization failed:", error);
108
+ throw new SecurityValidationError("Security system initialization failed", [{ message: String(error) }]);
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Perform comprehensive security scan
114
+ */
115
+ async scan(options?: SecurityScanOptions) {
116
+ this.ensureInitialized();
117
+ return await this.scanner.performScan(options);
118
+ }
119
+
120
+ /**
121
+ * Perform security code review
122
+ */
123
+ async review(filePath: string, options?: SecurityReviewOptions): Promise<_CodeReviewResult> {
124
+ this.ensureInitialized();
125
+ return await this.reviewer.reviewFile(filePath, options);
126
+ }
127
+
128
+ /**
129
+ * Create and execute remediation plan
130
+ */
131
+ async remediate(scanResult: any, dryRun = false): Promise<_RemediationResult[]> {
132
+ this.ensureInitialized();
133
+ const plan = await this.remediation.createRemediationPlan(scanResult);
134
+ return await this.remediation.executeRemediationPlan(plan, { dryRun });
135
+ }
136
+
137
+ /**
138
+ * Execute security gates for CI/CD
139
+ */
140
+ async executeGates(stage: string, context: any, options?: SecurityGateOptions): Promise<_PipelineSecurityReport> {
141
+ this.ensureInitialized();
142
+ return await this.pipeline.executeSecurityGates(stage as any, context, options);
143
+ }
144
+
145
+ /**
146
+ * Log security event
147
+ */
148
+ async logEvent(eventData: any): Promise<_SecurityEvent> {
149
+ this.ensureInitialized();
150
+ return await this.monitor.logSecurityEvent(eventData);
151
+ }
152
+
153
+ /**
154
+ * Get security status
155
+ */
156
+ getStatus() {
157
+ this.ensureInitialized();
158
+ return {
159
+ system: this.initialized,
160
+ monitoring: this.monitor.getStatus(),
161
+ scanner: this.scanner.getLatestScan(),
162
+ pipeline: this.pipeline.getStatistics(),
163
+ };
164
+ }
165
+
166
+ /**
167
+ * Shutdown security system
168
+ */
169
+ shutdown(): void {
170
+ if (!this.initialized) {
171
+ return;
172
+ }
173
+
174
+ console.log("[Security System] Shutting down security system...");
175
+
176
+ this.monitor.stop();
177
+ this.initialized = false;
178
+
179
+ console.log("[Security System] Security system shutdown complete");
180
+ }
181
+
182
+ /**
183
+ * Ensure system is initialized
184
+ */
185
+ private ensureInitialized(): void {
186
+ if (!this.initialized) {
187
+ throw new SecurityValidationError("Security system not initialized", [{ message: "Call initialize() first" }]);
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Get individual components for advanced usage
193
+ */
194
+ getComponents() {
195
+ return {
196
+ scanner: this.scanner,
197
+ remediation: this.remediation,
198
+ reviewer: this.reviewer,
199
+ configManager: this.configManager,
200
+ monitor: this.monitor,
201
+ pipeline: this.pipeline,
202
+ };
203
+ }
204
+ }
205
+
206
+ /**
207
+ * Default security system instance
208
+ */
209
+ export const securitySystem = new SecuritySystem();
210
+
211
+ /**
212
+ * Convenience functions for common operations
213
+ */
214
+ export const security = {
215
+ /**
216
+ * Quick security scan
217
+ */
218
+ scan: (options?: SecurityScanOptions) => securitySystem.scan(options),
219
+
220
+ /**
221
+ * Quick security review
222
+ */
223
+ review: (filePath: string, options?: SecurityReviewOptions) => securitySystem.review(filePath, options),
224
+
225
+ /**
226
+ * Quick remediation
227
+ */
228
+ remediate: (scanResult: any, dryRun = true) => securitySystem.remediate(scanResult, dryRun),
229
+
230
+ /**
231
+ * Log security event
232
+ */
233
+ logEvent: (eventData: any) => securitySystem.logEvent(eventData),
234
+
235
+ /**
236
+ * Get security status
237
+ */
238
+ status: () => securitySystem.getStatus(),
239
+
240
+ /**
241
+ * Initialize security system
242
+ */
243
+ init: () => securitySystem.initialize(),
244
+
245
+ /**
246
+ * Shutdown security system
247
+ */
248
+ shutdown: () => securitySystem.shutdown(),
249
+ };
@@ -8,13 +8,52 @@ import {
8
8
  import { getErrorMessage } from "../utils/error.js";
9
9
 
10
10
  /**
11
- * Provides tools for managing media on a WordPress site.
12
- * This class encapsulates tool definitions and their corresponding handlers.
11
+ * Comprehensive media management tools for WordPress sites.
12
+ *
13
+ * This class provides complete media library functionality including:
14
+ * - Listing media items with advanced filtering and search
15
+ * - Uploading new media files with validation and optimization
16
+ * - Retrieving detailed media information and metadata
17
+ * - Updating media properties like title, description, and alt text
18
+ * - Deleting media items with safety checks
19
+ *
20
+ * Supports all WordPress media types including images, videos, audio files,
21
+ * and documents with proper MIME type validation and security checks.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const mediaTools = new MediaTools();
26
+ * const tools = mediaTools.getTools();
27
+ *
28
+ * // Upload an image
29
+ * const client = new WordPressClient(config);
30
+ * const result = await mediaTools.handleUploadMedia(client, {
31
+ * file_path: "/path/to/image.jpg",
32
+ * title: "My Image",
33
+ * alt_text: "Description of the image"
34
+ * });
35
+ * ```
36
+ *
37
+ * @since 1.0.0
38
+ * @author MCP WordPress Team
13
39
  */
14
40
  export class MediaTools {
15
41
  /**
16
- * Retrieves the list of media management tools.
17
- * @returns An array of MCPTool definitions.
42
+ * Retrieves the complete list of media management tools available for MCP.
43
+ *
44
+ * Returns an array of tool definitions for comprehensive media library management.
45
+ * Each tool includes parameter validation, security checks, and detailed error handling.
46
+ *
47
+ * @returns {Array<MCPTool>} Array of MCPTool definitions for media management
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const mediaTools = new MediaTools();
52
+ * const tools = mediaTools.getTools();
53
+ * console.log(tools.length); // 5 tools: list, get, upload, update, delete
54
+ * ```
55
+ *
56
+ * @since 1.0.0
18
57
  */
19
58
  public getTools(): any[] {
20
59
  return [
@@ -6,13 +6,45 @@ import { validateId, validatePaginationParams, validatePostParams } from "../uti
6
6
  import { WordPressDataStreamer, StreamingUtils, StreamingResult } from "../utils/streaming.js";
7
7
 
8
8
  /**
9
- * Provides tools for managing posts on a WordPress site.
10
- * This class encapsulates tool definitions and their corresponding handlers.
9
+ * Provides comprehensive tools for managing WordPress posts.
10
+ *
11
+ * This class encapsulates tool definitions and their corresponding handlers for:
12
+ * - Listing posts with advanced filtering and search capabilities
13
+ * - Creating new posts with full metadata support
14
+ * - Updating existing posts with validation
15
+ * - Deleting posts with trash/permanent options
16
+ * - Retrieving individual posts with detailed information
17
+ * - Managing post revisions and history
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const postTools = new PostTools();
22
+ * const tools = postTools.getTools();
23
+ *
24
+ * // Use with a WordPress client
25
+ * const client = new WordPressClient(config);
26
+ * const result = await postTools.handleListPosts(client, { per_page: 10 });
27
+ * ```
28
+ *
29
+ * @since 1.0.0
30
+ * @author MCP WordPress Team
11
31
  */
12
32
  export class PostTools {
13
33
  /**
14
- * Retrieves the list of post management tools.
15
- * @returns An array of MCPTool definitions.
34
+ * Retrieves the complete list of post management tools available for MCP.
35
+ *
36
+ * Returns an array of tool definitions that can be registered with an MCP server.
37
+ * Each tool includes comprehensive parameter validation, error handling, and
38
+ * detailed documentation with usage examples.
39
+ *
40
+ * @returns {Array<MCPTool>} An array of MCPTool definitions for post management
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const postTools = new PostTools();
45
+ * const tools = postTools.getTools();
46
+ * console.log(tools.length); // 6 tools: list, get, create, update, delete, revisions
47
+ * ```
16
48
  */
17
49
  public getTools(): any[] {
18
50
  return [
@@ -184,6 +216,42 @@ export class PostTools {
184
216
  ];
185
217
  }
186
218
 
219
+ /**
220
+ * Handles listing posts from a WordPress site with comprehensive filtering options.
221
+ *
222
+ * This method provides advanced search capabilities, status filtering, pagination,
223
+ * and category/tag filtering. Results include enhanced metadata and author information.
224
+ * For large result sets (>50 posts), it automatically uses streaming for better performance.
225
+ *
226
+ * @param {WordPressClient} client - The WordPress client instance for API communication
227
+ * @param {PostQueryParams} params - Query parameters for filtering and pagination
228
+ * @param {number} [params.per_page=10] - Number of posts to return per page (max 100)
229
+ * @param {string} [params.search] - Search term to filter posts by title/content
230
+ * @param {string|string[]} [params.status] - Post status filter (publish, draft, etc.)
231
+ * @param {number[]} [params.categories] - Array of category IDs to filter by
232
+ * @param {number[]} [params.tags] - Array of tag IDs to filter by
233
+ * @param {number} [params.page=1] - Page number for pagination
234
+ *
235
+ * @returns {Promise<string>} Formatted list of posts with metadata and context
236
+ *
237
+ * @throws {EnhancedError} When validation fails or API request encounters an error
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * // Basic listing
242
+ * const result = await handleListPosts(client, {});
243
+ *
244
+ * // Advanced filtering
245
+ * const filtered = await handleListPosts(client, {
246
+ * search: "WordPress tips",
247
+ * status: "publish",
248
+ * categories: [1, 2],
249
+ * per_page: 20
250
+ * });
251
+ * ```
252
+ *
253
+ * @since 1.0.0
254
+ */
187
255
  public async handleListPosts(client: WordPressClient, params: PostQueryParams): Promise<any> {
188
256
  try {
189
257
  // Enhanced input validation and sanitization
@@ -381,6 +449,28 @@ export class PostTools {
381
449
  }
382
450
  }
383
451
 
452
+ /**
453
+ * Retrieves a single WordPress post by ID with complete details and metadata.
454
+ *
455
+ * This method fetches a specific post and returns comprehensive information including
456
+ * content, metadata, author details, categories, tags, and publication status.
457
+ *
458
+ * @param {WordPressClient} client - The WordPress client instance for API communication
459
+ * @param {Object} params - Parameters for post retrieval
460
+ * @param {number} params.id - The unique ID of the post to retrieve
461
+ *
462
+ * @returns {Promise<string>} Detailed post information formatted for display
463
+ *
464
+ * @throws {EnhancedError} When post ID is invalid or post is not found
465
+ *
466
+ * @example
467
+ * ```typescript
468
+ * // Get a specific post
469
+ * const post = await handleGetPost(client, { id: 123 });
470
+ * ```
471
+ *
472
+ * @since 1.0.0
473
+ */
384
474
  public async handleGetPost(client: WordPressClient, params: { id: number }): Promise<any> {
385
475
  try {
386
476
  // Input validation
@@ -495,6 +585,47 @@ export class PostTools {
495
585
  }
496
586
  }
497
587
 
588
+ /**
589
+ * Creates a new WordPress post with comprehensive validation and metadata support.
590
+ *
591
+ * This method handles the creation of new posts with full support for content,
592
+ * metadata, categories, tags, and publishing options. Includes automatic validation
593
+ * and sanitization of all input parameters.
594
+ *
595
+ * @param {WordPressClient} client - The WordPress client instance for API communication
596
+ * @param {CreatePostRequest} params - Post creation parameters
597
+ * @param {string} params.title - The post title
598
+ * @param {string} params.content - The post content in HTML format
599
+ * @param {string} [params.status="draft"] - Post status (publish, draft, pending, private)
600
+ * @param {string} [params.excerpt] - Post excerpt/summary
601
+ * @param {number[]} [params.categories] - Array of category IDs to assign
602
+ * @param {number[]} [params.tags] - Array of tag IDs to assign
603
+ *
604
+ * @returns {Promise<string>} Success message with the new post ID and details
605
+ *
606
+ * @throws {EnhancedError} When validation fails or post creation encounters an error
607
+ *
608
+ * @example
609
+ * ```typescript
610
+ * // Create a basic post
611
+ * const result = await handleCreatePost(client, {
612
+ * title: "My New Post",
613
+ * content: "<p>This is the post content.</p>",
614
+ * status: "publish"
615
+ * });
616
+ *
617
+ * // Create post with categories and tags
618
+ * const detailed = await handleCreatePost(client, {
619
+ * title: "WordPress Tips",
620
+ * content: "<p>Detailed WordPress tips...</p>",
621
+ * categories: [1, 2],
622
+ * tags: [5, 6],
623
+ * excerpt: "Learn essential WordPress tips"
624
+ * });
625
+ * ```
626
+ *
627
+ * @since 1.0.0
628
+ */
498
629
  public async handleCreatePost(client: WordPressClient, params: CreatePostRequest): Promise<any> {
499
630
  try {
500
631
  // Enhanced input validation using new validation utilities
@@ -522,6 +653,45 @@ export class PostTools {
522
653
  }
523
654
  }
524
655
 
656
+ /**
657
+ * Updates an existing WordPress post with validation and detailed confirmation.
658
+ *
659
+ * This method allows updating any aspect of a post including title, content, status,
660
+ * categories, and tags. Only provided fields are updated, leaving others unchanged.
661
+ *
662
+ * @param {WordPressClient} client - The WordPress client instance for API communication
663
+ * @param {UpdatePostRequest & {id: number}} params - Update parameters
664
+ * @param {number} params.id - The ID of the post to update
665
+ * @param {string} [params.title] - New post title
666
+ * @param {string} [params.content] - New post content in HTML format
667
+ * @param {string} [params.status] - New post status (publish, draft, pending, private)
668
+ * @param {string} [params.excerpt] - New post excerpt
669
+ * @param {number[]} [params.categories] - New category IDs to assign
670
+ * @param {number[]} [params.tags] - New tag IDs to assign
671
+ *
672
+ * @returns {Promise<string>} Success message confirming the update
673
+ *
674
+ * @throws {EnhancedError} When post ID is invalid or update fails
675
+ *
676
+ * @example
677
+ * ```typescript
678
+ * // Update post title and status
679
+ * const result = await handleUpdatePost(client, {
680
+ * id: 123,
681
+ * title: "Updated Post Title",
682
+ * status: "publish"
683
+ * });
684
+ *
685
+ * // Update content and categories
686
+ * const updated = await handleUpdatePost(client, {
687
+ * id: 123,
688
+ * content: "<p>New content here...</p>",
689
+ * categories: [1, 3, 5]
690
+ * });
691
+ * ```
692
+ *
693
+ * @since 1.0.0
694
+ */
525
695
  public async handleUpdatePost(client: WordPressClient, params: UpdatePostRequest & { id: number }): Promise<any> {
526
696
  try {
527
697
  const post = await client.updatePost(params);
@@ -531,6 +701,35 @@ export class PostTools {
531
701
  }
532
702
  }
533
703
 
704
+ /**
705
+ * Deletes a WordPress post with options for trash or permanent deletion.
706
+ *
707
+ * This method provides safe deletion with trash option (default) or permanent
708
+ * deletion when force is specified. Includes confirmation of the deletion action.
709
+ *
710
+ * @param {WordPressClient} client - The WordPress client instance for API communication
711
+ * @param {Object} params - Deletion parameters
712
+ * @param {number} params.id - The ID of the post to delete
713
+ * @param {boolean} [params.force=false] - Whether to permanently delete (true) or move to trash (false)
714
+ *
715
+ * @returns {Promise<string>} Confirmation message of the deletion action
716
+ *
717
+ * @throws {EnhancedError} When post ID is invalid or deletion fails
718
+ *
719
+ * @example
720
+ * ```typescript
721
+ * // Move post to trash (safe deletion)
722
+ * const result = await handleDeletePost(client, { id: 123 });
723
+ *
724
+ * // Permanently delete post (cannot be undone)
725
+ * const permanent = await handleDeletePost(client, {
726
+ * id: 123,
727
+ * force: true
728
+ * });
729
+ * ```
730
+ *
731
+ * @since 1.0.0
732
+ */
534
733
  public async handleDeletePost(client: WordPressClient, params: { id: number; force?: boolean }): Promise<any> {
535
734
  try {
536
735
  await client.deletePost(params.id, params.force);
@@ -541,6 +740,28 @@ export class PostTools {
541
740
  }
542
741
  }
543
742
 
743
+ /**
744
+ * Retrieves revision history for a specific WordPress post.
745
+ *
746
+ * This method fetches all available revisions for a post, providing a complete
747
+ * history of changes including dates, authors, and modification details.
748
+ *
749
+ * @param {WordPressClient} client - The WordPress client instance for API communication
750
+ * @param {Object} params - Parameters for revision retrieval
751
+ * @param {number} params.id - The ID of the post to get revisions for
752
+ *
753
+ * @returns {Promise<string>} Formatted list of post revisions with details
754
+ *
755
+ * @throws {EnhancedError} When post ID is invalid or revisions cannot be retrieved
756
+ *
757
+ * @example
758
+ * ```typescript
759
+ * // Get all revisions for a post
760
+ * const revisions = await handleGetPostRevisions(client, { id: 123 });
761
+ * ```
762
+ *
763
+ * @since 1.0.0
764
+ */
544
765
  public async handleGetPostRevisions(client: WordPressClient, params: { id: number }): Promise<any> {
545
766
  try {
546
767
  const revisions = await client.getPostRevisions(params.id);