@houtini/lm 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/CHANGELOG.md +273 -0
  2. package/LICENSE +21 -0
  3. package/README.md +203 -0
  4. package/dist/cache/analysis-cache.d.ts +33 -0
  5. package/dist/cache/analysis-cache.d.ts.map +1 -0
  6. package/dist/cache/analysis-cache.js +56 -0
  7. package/dist/cache/analysis-cache.js.map +1 -0
  8. package/dist/cache/cache-manager.d.ts +29 -0
  9. package/dist/cache/cache-manager.d.ts.map +1 -0
  10. package/dist/cache/cache-manager.js +85 -0
  11. package/dist/cache/cache-manager.js.map +1 -0
  12. package/dist/cache/index.d.ts +16 -0
  13. package/dist/cache/index.d.ts.map +1 -0
  14. package/dist/cache/index.js +17 -0
  15. package/dist/cache/index.js.map +1 -0
  16. package/dist/cache/prompt-cache.d.ts +33 -0
  17. package/dist/cache/prompt-cache.d.ts.map +1 -0
  18. package/dist/cache/prompt-cache.js +61 -0
  19. package/dist/cache/prompt-cache.js.map +1 -0
  20. package/dist/config.d.ts +43 -0
  21. package/dist/config.d.ts.map +1 -0
  22. package/dist/config.js +70 -0
  23. package/dist/config.js.map +1 -0
  24. package/dist/core/ThreeStagePromptManager.d.ts +39 -0
  25. package/dist/core/ThreeStagePromptManager.d.ts.map +1 -0
  26. package/dist/core/ThreeStagePromptManager.js +176 -0
  27. package/dist/core/ThreeStagePromptManager.js.map +1 -0
  28. package/dist/index.d.ts +6 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +230 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/plugins/base-plugin.d.ts +47 -0
  33. package/dist/plugins/base-plugin.d.ts.map +1 -0
  34. package/dist/plugins/base-plugin.js +90 -0
  35. package/dist/plugins/base-plugin.js.map +1 -0
  36. package/dist/plugins/index.d.ts +58 -0
  37. package/dist/plugins/index.d.ts.map +1 -0
  38. package/dist/plugins/index.js +161 -0
  39. package/dist/plugins/index.js.map +1 -0
  40. package/dist/plugins/types.d.ts +5 -0
  41. package/dist/plugins/types.d.ts.map +1 -0
  42. package/dist/plugins/types.js +5 -0
  43. package/dist/plugins/types.js.map +1 -0
  44. package/dist/prompts/analyze/code-quality.d.ts +116 -0
  45. package/dist/prompts/analyze/code-quality.d.ts.map +1 -0
  46. package/dist/prompts/analyze/code-quality.js +433 -0
  47. package/dist/prompts/analyze/code-quality.js.map +1 -0
  48. package/dist/prompts/analyze/compare-integration.d.ts +130 -0
  49. package/dist/prompts/analyze/compare-integration.d.ts.map +1 -0
  50. package/dist/prompts/analyze/compare-integration.js +543 -0
  51. package/dist/prompts/analyze/compare-integration.js.map +1 -0
  52. package/dist/prompts/analyze/count-files.d.ts +109 -0
  53. package/dist/prompts/analyze/count-files.d.ts.map +1 -0
  54. package/dist/prompts/analyze/count-files.js +399 -0
  55. package/dist/prompts/analyze/count-files.js.map +1 -0
  56. package/dist/prompts/analyze/database-queries.d.ts +156 -0
  57. package/dist/prompts/analyze/database-queries.d.ts.map +1 -0
  58. package/dist/prompts/analyze/database-queries.js +759 -0
  59. package/dist/prompts/analyze/database-queries.js.map +1 -0
  60. package/dist/prompts/analyze/dependencies.d.ts +97 -0
  61. package/dist/prompts/analyze/dependencies.d.ts.map +1 -0
  62. package/dist/prompts/analyze/dependencies.js +333 -0
  63. package/dist/prompts/analyze/dependencies.js.map +1 -0
  64. package/dist/prompts/analyze/diff-signatures.d.ts +139 -0
  65. package/dist/prompts/analyze/diff-signatures.d.ts.map +1 -0
  66. package/dist/prompts/analyze/diff-signatures.js +702 -0
  67. package/dist/prompts/analyze/diff-signatures.js.map +1 -0
  68. package/dist/prompts/analyze/find-patterns.d.ts +128 -0
  69. package/dist/prompts/analyze/find-patterns.d.ts.map +1 -0
  70. package/dist/prompts/analyze/find-patterns.js +520 -0
  71. package/dist/prompts/analyze/find-patterns.js.map +1 -0
  72. package/dist/prompts/analyze/find-unused-css.d.ts +151 -0
  73. package/dist/prompts/analyze/find-unused-css.d.ts.map +1 -0
  74. package/dist/prompts/analyze/find-unused-css.js +754 -0
  75. package/dist/prompts/analyze/find-unused-css.js.map +1 -0
  76. package/dist/prompts/analyze/n8n-workflow.d.ts +137 -0
  77. package/dist/prompts/analyze/n8n-workflow.d.ts.map +1 -0
  78. package/dist/prompts/analyze/n8n-workflow.js +529 -0
  79. package/dist/prompts/analyze/n8n-workflow.js.map +1 -0
  80. package/dist/prompts/analyze/project-structure.d.ts +126 -0
  81. package/dist/prompts/analyze/project-structure.d.ts.map +1 -0
  82. package/dist/prompts/analyze/project-structure.js +569 -0
  83. package/dist/prompts/analyze/project-structure.js.map +1 -0
  84. package/dist/prompts/analyze/security-audit.d.ts +142 -0
  85. package/dist/prompts/analyze/security-audit.d.ts.map +1 -0
  86. package/dist/prompts/analyze/security-audit.js +637 -0
  87. package/dist/prompts/analyze/security-audit.js.map +1 -0
  88. package/dist/prompts/analyze/single-file.d.ts +162 -0
  89. package/dist/prompts/analyze/single-file.d.ts.map +1 -0
  90. package/dist/prompts/analyze/single-file.js +665 -0
  91. package/dist/prompts/analyze/single-file.js.map +1 -0
  92. package/dist/prompts/analyze/trace-execution.d.ts +126 -0
  93. package/dist/prompts/analyze/trace-execution.d.ts.map +1 -0
  94. package/dist/prompts/analyze/trace-execution.js +609 -0
  95. package/dist/prompts/analyze/trace-execution.js.map +1 -0
  96. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +116 -0
  97. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +1 -0
  98. package/dist/prompts/analyze/wordpress-plugin-audit.js +454 -0
  99. package/dist/prompts/analyze/wordpress-plugin-audit.js.map +1 -0
  100. package/dist/prompts/analyze/wordpress-security.d.ts +146 -0
  101. package/dist/prompts/analyze/wordpress-security.d.ts.map +1 -0
  102. package/dist/prompts/analyze/wordpress-security.js +698 -0
  103. package/dist/prompts/analyze/wordpress-security.js.map +1 -0
  104. package/dist/prompts/analyze/wordpress-theme-audit.d.ts +114 -0
  105. package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +1 -0
  106. package/dist/prompts/analyze/wordpress-theme-audit.js +538 -0
  107. package/dist/prompts/analyze/wordpress-theme-audit.js.map +1 -0
  108. package/dist/prompts/custom/custom-prompt.d.ts +135 -0
  109. package/dist/prompts/custom/custom-prompt.d.ts.map +1 -0
  110. package/dist/prompts/custom/custom-prompt.js +419 -0
  111. package/dist/prompts/custom/custom-prompt.js.map +1 -0
  112. package/dist/prompts/fun/arcade-game.d.ts +152 -0
  113. package/dist/prompts/fun/arcade-game.d.ts.map +1 -0
  114. package/dist/prompts/fun/arcade-game.js +653 -0
  115. package/dist/prompts/fun/arcade-game.js.map +1 -0
  116. package/dist/prompts/fun/create_text_adventure.d.ts +100 -0
  117. package/dist/prompts/fun/create_text_adventure.d.ts.map +1 -0
  118. package/dist/prompts/fun/create_text_adventure.js +397 -0
  119. package/dist/prompts/fun/create_text_adventure.js.map +1 -0
  120. package/dist/prompts/fun/css-art-generator.d.ts +168 -0
  121. package/dist/prompts/fun/css-art-generator.d.ts.map +1 -0
  122. package/dist/prompts/fun/css-art-generator.js +827 -0
  123. package/dist/prompts/fun/css-art-generator.js.map +1 -0
  124. package/dist/prompts/generate/project-documentation.d.ts +137 -0
  125. package/dist/prompts/generate/project-documentation.d.ts.map +1 -0
  126. package/dist/prompts/generate/project-documentation.js +666 -0
  127. package/dist/prompts/generate/project-documentation.js.map +1 -0
  128. package/dist/prompts/generate/refactoring.d.ts +164 -0
  129. package/dist/prompts/generate/refactoring.d.ts.map +1 -0
  130. package/dist/prompts/generate/refactoring.js +621 -0
  131. package/dist/prompts/generate/refactoring.js.map +1 -0
  132. package/dist/prompts/generate/responsive-component.d.ts +147 -0
  133. package/dist/prompts/generate/responsive-component.d.ts.map +1 -0
  134. package/dist/prompts/generate/responsive-component.js +955 -0
  135. package/dist/prompts/generate/responsive-component.js.map +1 -0
  136. package/dist/prompts/generate/typescript-conversion.d.ts +144 -0
  137. package/dist/prompts/generate/typescript-conversion.d.ts.map +1 -0
  138. package/dist/prompts/generate/typescript-conversion.js +527 -0
  139. package/dist/prompts/generate/typescript-conversion.js.map +1 -0
  140. package/dist/prompts/generate/unit-tests.d.ts +139 -0
  141. package/dist/prompts/generate/unit-tests.d.ts.map +1 -0
  142. package/dist/prompts/generate/unit-tests.js +578 -0
  143. package/dist/prompts/generate/unit-tests.js.map +1 -0
  144. package/dist/prompts/generate/wordpress-plugin.d.ts +179 -0
  145. package/dist/prompts/generate/wordpress-plugin.d.ts.map +1 -0
  146. package/dist/prompts/generate/wordpress-plugin.js +763 -0
  147. package/dist/prompts/generate/wordpress-plugin.js.map +1 -0
  148. package/dist/prompts/generate/wordpress-theme-from-static.d.ts +177 -0
  149. package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +1 -0
  150. package/dist/prompts/generate/wordpress-theme-from-static.js +695 -0
  151. package/dist/prompts/generate/wordpress-theme-from-static.js.map +1 -0
  152. package/dist/prompts/shared/cache-manager.d.ts +45 -0
  153. package/dist/prompts/shared/cache-manager.d.ts.map +1 -0
  154. package/dist/prompts/shared/cache-manager.js +129 -0
  155. package/dist/prompts/shared/cache-manager.js.map +1 -0
  156. package/dist/prompts/shared/helpers.d.ts +39 -0
  157. package/dist/prompts/shared/helpers.d.ts.map +1 -0
  158. package/dist/prompts/shared/helpers.js +151 -0
  159. package/dist/prompts/shared/helpers.js.map +1 -0
  160. package/dist/prompts/shared/templates.d.ts +35 -0
  161. package/dist/prompts/shared/templates.d.ts.map +1 -0
  162. package/dist/prompts/shared/templates.js +77 -0
  163. package/dist/prompts/shared/templates.js.map +1 -0
  164. package/dist/prompts/shared/types.d.ts +112 -0
  165. package/dist/prompts/shared/types.d.ts.map +1 -0
  166. package/dist/prompts/shared/types.js +5 -0
  167. package/dist/prompts/shared/types.js.map +1 -0
  168. package/dist/prompts/system/find-unused-files.d.ts +106 -0
  169. package/dist/prompts/system/find-unused-files.d.ts.map +1 -0
  170. package/dist/prompts/system/find-unused-files.js +353 -0
  171. package/dist/prompts/system/find-unused-files.js.map +1 -0
  172. package/dist/security/index.d.ts +39 -0
  173. package/dist/security/index.d.ts.map +1 -0
  174. package/dist/security/index.js +46 -0
  175. package/dist/security/index.js.map +1 -0
  176. package/dist/security/integration-helpers.d.ts +121 -0
  177. package/dist/security/integration-helpers.d.ts.map +1 -0
  178. package/dist/security/integration-helpers.js +190 -0
  179. package/dist/security/integration-helpers.js.map +1 -0
  180. package/dist/security/output-encoder.d.ts +94 -0
  181. package/dist/security/output-encoder.d.ts.map +1 -0
  182. package/dist/security/output-encoder.js +295 -0
  183. package/dist/security/output-encoder.js.map +1 -0
  184. package/dist/security/prompt-injection-guard.d.ts +59 -0
  185. package/dist/security/prompt-injection-guard.d.ts.map +1 -0
  186. package/dist/security/prompt-injection-guard.js +249 -0
  187. package/dist/security/prompt-injection-guard.js.map +1 -0
  188. package/dist/security/sanitisation.d.ts +67 -0
  189. package/dist/security/sanitisation.d.ts.map +1 -0
  190. package/dist/security/sanitisation.js +398 -0
  191. package/dist/security/sanitisation.js.map +1 -0
  192. package/dist/security/security-service.d.ts +103 -0
  193. package/dist/security/security-service.d.ts.map +1 -0
  194. package/dist/security/security-service.js +303 -0
  195. package/dist/security/security-service.js.map +1 -0
  196. package/dist/security-config.d.ts +45 -0
  197. package/dist/security-config.d.ts.map +1 -0
  198. package/dist/security-config.js +63 -0
  199. package/dist/security-config.js.map +1 -0
  200. package/dist/system/function-list.d.ts +61 -0
  201. package/dist/system/function-list.d.ts.map +1 -0
  202. package/dist/system/function-list.js +111 -0
  203. package/dist/system/function-list.js.map +1 -0
  204. package/dist/system/function-registry.d.ts +23 -0
  205. package/dist/system/function-registry.d.ts.map +1 -0
  206. package/dist/system/function-registry.js +136 -0
  207. package/dist/system/function-registry.js.map +1 -0
  208. package/dist/system/health-check.d.ts +33 -0
  209. package/dist/system/health-check.d.ts.map +1 -0
  210. package/dist/system/health-check.js +98 -0
  211. package/dist/system/health-check.js.map +1 -0
  212. package/dist/system/path-resolver.d.ts +55 -0
  213. package/dist/system/path-resolver.d.ts.map +1 -0
  214. package/dist/system/path-resolver.js +90 -0
  215. package/dist/system/path-resolver.js.map +1 -0
  216. package/dist/templates/plugin-template.d.ts +121 -0
  217. package/dist/templates/plugin-template.d.ts.map +1 -0
  218. package/dist/templates/plugin-template.js +450 -0
  219. package/dist/templates/plugin-template.js.map +1 -0
  220. package/dist/types/chunking-types.d.ts +88 -0
  221. package/dist/types/chunking-types.d.ts.map +1 -0
  222. package/dist/types/chunking-types.js +18 -0
  223. package/dist/types/chunking-types.js.map +1 -0
  224. package/dist/types/prompt-stages.d.ts +42 -0
  225. package/dist/types/prompt-stages.d.ts.map +1 -0
  226. package/dist/types/prompt-stages.js +6 -0
  227. package/dist/types/prompt-stages.js.map +1 -0
  228. package/dist/types.d.ts +46 -0
  229. package/dist/types.d.ts.map +1 -0
  230. package/dist/types.js +6 -0
  231. package/dist/types.js.map +1 -0
  232. package/dist/utils/css-parser.d.ts +26 -0
  233. package/dist/utils/css-parser.d.ts.map +1 -0
  234. package/dist/utils/css-parser.js +117 -0
  235. package/dist/utils/css-parser.js.map +1 -0
  236. package/dist/utils/path-resolver.d.ts +13 -0
  237. package/dist/utils/path-resolver.d.ts.map +1 -0
  238. package/dist/utils/path-resolver.js +78 -0
  239. package/dist/utils/path-resolver.js.map +1 -0
  240. package/dist/utils/plugin-utilities.d.ts +171 -0
  241. package/dist/utils/plugin-utilities.d.ts.map +1 -0
  242. package/dist/utils/plugin-utilities.js +221 -0
  243. package/dist/utils/plugin-utilities.js.map +1 -0
  244. package/dist/utils/streamHandler.d.ts +3 -0
  245. package/dist/utils/streamHandler.d.ts.map +1 -0
  246. package/dist/utils/streamHandler.js +137 -0
  247. package/dist/utils/streamHandler.js.map +1 -0
  248. package/dist/validation/output-validator.d.ts +136 -0
  249. package/dist/validation/output-validator.d.ts.map +1 -0
  250. package/dist/validation/output-validator.js +262 -0
  251. package/dist/validation/output-validator.js.map +1 -0
  252. package/dist/validation/response-factory.d.ts +44 -0
  253. package/dist/validation/response-factory.d.ts.map +1 -0
  254. package/dist/validation/response-factory.js +202 -0
  255. package/dist/validation/response-factory.js.map +1 -0
  256. package/dist/validation/schemas.d.ts +519 -0
  257. package/dist/validation/schemas.d.ts.map +1 -0
  258. package/dist/validation/schemas.js +6 -0
  259. package/dist/validation/schemas.js.map +1 -0
  260. package/package.json +72 -0
@@ -0,0 +1,763 @@
1
+ /**
2
+ * WordPress Plugin Generator - Modern v4.3 Universal Template
3
+ *
4
+ * Generates complete WordPress plugin structures with all necessary files and best practices
5
+ * Intelligently handles plugin requirements and generates production-ready code
6
+ */
7
+ import { BasePlugin } from '../../plugins/base-plugin.js';
8
+ import { ThreeStagePromptManager } from '../../core/ThreeStagePromptManager.js';
9
+ import { withSecurity } from '../../security/integration-helpers.js';
10
+ import { readFileContent } from '../shared/helpers.js';
11
+ import { ModelSetup, ResponseProcessor, ParameterValidator, ErrorHandler, MultiFileAnalysis } from '../../utils/plugin-utilities.js';
12
+ import { getAnalysisCache } from '../../cache/index.js';
13
+ // Common Node.js modules - Use these instead of require()
14
+ import { basename, extname, relative } from 'path';
15
+ export class WordPressPluginGenerator extends BasePlugin {
16
+ constructor() {
17
+ super();
18
+ this.name = 'generate_wordpress_plugin';
19
+ this.category = 'generate';
20
+ this.description = 'Generate a complete WordPress plugin structure with all necessary files and best practices';
21
+ // Universal parameter set - supports both single and multi-file scenarios
22
+ this.parameters = {
23
+ // WordPress plugin specific parameters
24
+ name: {
25
+ type: 'string',
26
+ description: 'Plugin name',
27
+ required: true
28
+ },
29
+ description: {
30
+ type: 'string',
31
+ description: 'Plugin description',
32
+ required: true
33
+ },
34
+ features: {
35
+ type: 'array',
36
+ description: 'List of features to include',
37
+ required: true,
38
+ items: { type: 'string' }
39
+ },
40
+ prefix: {
41
+ type: 'string',
42
+ description: 'Plugin prefix for functions and classes (e.g., "wp_my_plugin")',
43
+ required: true
44
+ },
45
+ // Optional WordPress parameters
46
+ wpVersion: {
47
+ type: 'string',
48
+ description: 'Minimum WordPress version',
49
+ required: false,
50
+ default: '6.0'
51
+ },
52
+ phpVersion: {
53
+ type: 'string',
54
+ description: 'Minimum PHP version',
55
+ required: false,
56
+ default: '7.4'
57
+ },
58
+ textDomain: {
59
+ type: 'string',
60
+ description: 'Text domain for internationalization',
61
+ required: false
62
+ },
63
+ // Feature flags
64
+ includeAdmin: {
65
+ type: 'boolean',
66
+ description: 'Include admin interface',
67
+ required: false,
68
+ default: true
69
+ },
70
+ includeDatabase: {
71
+ type: 'boolean',
72
+ description: 'Include database tables',
73
+ required: false,
74
+ default: false
75
+ },
76
+ includeAjax: {
77
+ type: 'boolean',
78
+ description: 'Include AJAX handlers',
79
+ required: false,
80
+ default: false
81
+ },
82
+ includeRest: {
83
+ type: 'boolean',
84
+ description: 'Include REST API endpoints',
85
+ required: false,
86
+ default: false
87
+ },
88
+ includeGutenberg: {
89
+ type: 'boolean',
90
+ description: 'Include Gutenberg blocks',
91
+ required: false,
92
+ default: false
93
+ },
94
+ // Template compatibility parameters (for future flexibility)
95
+ code: {
96
+ type: 'string',
97
+ description: 'Existing plugin code to analyze (for single-file analysis)',
98
+ required: false
99
+ },
100
+ filePath: {
101
+ type: 'string',
102
+ description: 'Path to existing plugin file to analyze',
103
+ required: false
104
+ },
105
+ projectPath: {
106
+ type: 'string',
107
+ description: 'Path to existing plugin project root (for multi-file analysis)',
108
+ required: false
109
+ },
110
+ files: {
111
+ type: 'array',
112
+ description: 'Array of specific plugin files to analyze (for multi-file analysis)',
113
+ required: false,
114
+ items: { type: 'string' }
115
+ },
116
+ maxDepth: {
117
+ type: 'number',
118
+ description: 'Maximum directory depth for plugin analysis (1-5)',
119
+ required: false,
120
+ default: 3
121
+ },
122
+ // Universal parameters
123
+ language: {
124
+ type: 'string',
125
+ description: 'Programming language (PHP for WordPress)',
126
+ required: false,
127
+ default: 'php'
128
+ },
129
+ analysisDepth: {
130
+ type: 'string',
131
+ description: 'Level of plugin generation detail',
132
+ enum: ['basic', 'detailed', 'comprehensive'],
133
+ default: 'comprehensive',
134
+ required: false
135
+ },
136
+ analysisType: {
137
+ type: 'string',
138
+ description: 'Type of plugin generation to perform',
139
+ enum: ['simple', 'advanced', 'comprehensive'],
140
+ default: 'comprehensive',
141
+ required: false
142
+ }
143
+ };
144
+ this.analysisCache = getAnalysisCache();
145
+ this.multiFileAnalysis = new MultiFileAnalysis();
146
+ // Cache and analysis utilities are initialized above
147
+ }
148
+ async execute(params, llmClient) {
149
+ return await withSecurity(this, params, llmClient, async (secureParams) => {
150
+ try {
151
+ // 1. Auto-detect analysis mode based on parameters
152
+ const analysisMode = this.detectAnalysisMode(secureParams);
153
+ // 2. Validate parameters based on detected mode
154
+ this.validateParameters(secureParams, analysisMode);
155
+ // 3. Setup model
156
+ const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
157
+ // 4. Route to appropriate analysis method
158
+ if (analysisMode === 'single-file') {
159
+ return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
160
+ }
161
+ else {
162
+ return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
163
+ }
164
+ }
165
+ catch (error) {
166
+ return ErrorHandler.createExecutionError('generate_wordpress_plugin', error);
167
+ }
168
+ });
169
+ }
170
+ /**
171
+ * Auto-detect whether this is plugin generation or plugin analysis
172
+ *
173
+ * For WordPress plugins, we default to generation (single-file mode) unless
174
+ * existing plugin files are provided for analysis
175
+ */
176
+ detectAnalysisMode(params) {
177
+ // Multi-file mode: when analyzing existing plugin projects
178
+ if (params.projectPath || params.files) {
179
+ return 'multi-file';
180
+ }
181
+ // Single-file mode: when analyzing individual plugin files or generating new plugins
182
+ if (params.code || params.filePath) {
183
+ return 'single-file';
184
+ }
185
+ // Default to single-file for plugin generation (most common use case)
186
+ return 'single-file';
187
+ }
188
+ /**
189
+ * Validate parameters based on detected analysis mode
190
+ */
191
+ validateParameters(params, mode) {
192
+ if (mode === 'single-file') {
193
+ // For plugin generation, require plugin-specific parameters
194
+ if (!params.code && !params.filePath) {
195
+ // This is plugin generation - validate required fields
196
+ if (!params.name || !params.description || !params.features || !params.prefix) {
197
+ throw new Error('For plugin generation: name, description, features, and prefix are required');
198
+ }
199
+ }
200
+ else {
201
+ // This is plugin analysis - use standard validation
202
+ ParameterValidator.validateCodeOrFile(params);
203
+ }
204
+ }
205
+ else {
206
+ ParameterValidator.validateProjectPath(params);
207
+ ParameterValidator.validateDepth(params);
208
+ }
209
+ // Universal validations
210
+ ParameterValidator.validateEnum(params, 'analysisType', ['simple', 'advanced', 'comprehensive']);
211
+ ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
212
+ }
213
+ /**
214
+ * Execute single-file analysis (plugin generation or single file analysis)
215
+ */
216
+ async executeSingleFileAnalysis(params, model, contextLength) {
217
+ // Process single file input if provided, otherwise this is plugin generation
218
+ let codeToAnalyze = params.code;
219
+ if (params.filePath) {
220
+ codeToAnalyze = await readFileContent(params.filePath);
221
+ }
222
+ // Generate prompt stages for single file (generation or analysis)
223
+ const promptStages = this.getSingleFilePromptStages({
224
+ ...params,
225
+ code: codeToAnalyze
226
+ });
227
+ // Execute with appropriate method
228
+ const promptManager = new ThreeStagePromptManager(contextLength);
229
+ const needsChunking = promptManager.needsChunking(promptStages);
230
+ if (needsChunking) {
231
+ const conversation = promptManager.createChunkedConversation(promptStages);
232
+ const messages = [
233
+ conversation.systemMessage,
234
+ ...conversation.dataMessages,
235
+ conversation.analysisMessage
236
+ ];
237
+ return await ResponseProcessor.executeChunked(messages, model, contextLength, 'generate_wordpress_plugin', 'single');
238
+ }
239
+ else {
240
+ return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'generate_wordpress_plugin');
241
+ }
242
+ }
243
+ /**
244
+ * Execute multi-file analysis (existing plugin project analysis)
245
+ */
246
+ async executeMultiFileAnalysis(params, model, contextLength) {
247
+ // Discover files
248
+ let filesToAnalyze = params.files ||
249
+ await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.analysisType);
250
+ // Perform multi-file analysis with caching
251
+ const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
252
+ // Generate prompt stages for multi-file
253
+ const promptStages = this.getMultiFilePromptStages({
254
+ ...params,
255
+ analysisResult,
256
+ fileCount: filesToAnalyze.length
257
+ });
258
+ // Always use chunking for multi-file
259
+ const promptManager = new ThreeStagePromptManager(contextLength);
260
+ const conversation = promptManager.createChunkedConversation(promptStages);
261
+ const messages = [
262
+ conversation.systemMessage,
263
+ ...conversation.dataMessages,
264
+ conversation.analysisMessage
265
+ ];
266
+ return await ResponseProcessor.executeChunked(messages, model, contextLength, 'generate_wordpress_plugin', 'multifile');
267
+ }
268
+ /**
269
+ * Single-file prompt stages - WordPress plugin generation or single file analysis
270
+ */
271
+ getSingleFilePromptStages(params) {
272
+ const { code, analysisDepth, analysisType, name, description, features, prefix } = params;
273
+ // Determine if this is generation or analysis
274
+ const isGeneration = !code && name && description && features && prefix;
275
+ let systemAndContext;
276
+ let dataPayload;
277
+ let outputInstructions;
278
+ if (isGeneration) {
279
+ // Plugin Generation Mode
280
+ systemAndContext = `You are an expert WordPress plugin developer specializing in ${analysisDepth} ${analysisType} plugin development.
281
+
282
+ WordPress Plugin Development Expertise:
283
+ - WordPress Standards: Follow WordPress Coding Standards (WPCS) meticulously
284
+ - Security Best Practices: Implement proper nonces, capabilities, escaping, and sanitization
285
+ - Modern PHP Architecture: Use namespaces, dependency injection, and design patterns
286
+ - Compatibility: WordPress ${params.wpVersion || '6.0'}+ and PHP ${params.phpVersion || '7.4'}+
287
+ - Internationalization: Ready for translation with proper text domains
288
+ - Performance: Optimize for speed, lazy loading, and minimal footprint
289
+ - Accessibility: WCAG compliant admin interfaces
290
+ - Code Quality: Clean, maintainable, well-documented code
291
+
292
+ Generation Context:
293
+ - Plugin Generation Mode: Creating complete, production-ready plugin structure
294
+ - Analysis Depth: ${analysisDepth}
295
+ - Plugin Complexity: ${analysisType}
296
+
297
+ Your task is to generate a complete, professional WordPress plugin that developers can immediately use in production.`;
298
+ dataPayload = `WordPress Plugin Requirements:
299
+
300
+ **Core Details:**
301
+ - Plugin Name: ${name}
302
+ - Description: ${description}
303
+ - Features Required: ${features.join(', ')}
304
+ - Function Prefix: ${prefix}
305
+ - Text Domain: ${params.textDomain || prefix}
306
+
307
+ **Technical Requirements:**
308
+ - Minimum WordPress Version: ${params.wpVersion || '6.0'}
309
+ - Minimum PHP Version: ${params.phpVersion || '7.4'}
310
+ - Include Admin Interface: ${params.includeAdmin !== false}
311
+ - Include Database Tables: ${params.includeDatabase || false}
312
+ - Include AJAX Handlers: ${params.includeAjax || false}
313
+ - Include REST API Endpoints: ${params.includeRest || false}
314
+ - Include Gutenberg Blocks: ${params.includeGutenberg || false}
315
+
316
+ **Quality Standards Required:**
317
+ - WordPress Coding Standards (WPCS) compliance
318
+ - Security-first approach with proper sanitization
319
+ - Internationalization ready
320
+ - Performance optimized
321
+ - Accessibility compliant admin interfaces
322
+ - Comprehensive documentation`;
323
+ outputInstructions = `Generate a complete WordPress plugin structure with production-ready code, comprehensive QA analysis, and deployment package preparation:
324
+
325
+ ## Part 1: Complete Plugin Architecture
326
+
327
+ ### 1. Main Plugin File (${prefix}.php)
328
+ - Complete plugin header with all metadata
329
+ - Namespace: ${prefix.charAt(0).toUpperCase() + prefix.slice(1)}
330
+ - Main plugin class with singleton pattern
331
+ - Proper activation/deactivation hooks with error handling
332
+ - Security checks and early exits
333
+ - **CRITICAL**: Include activation safety checks to prevent fatal errors
334
+
335
+ ### 2. Core Plugin Structure
336
+ - **Includes Directory**: Core functionality classes
337
+ - Main plugin class (${prefix}-core.php)
338
+ - Activation/deactivation handlers with rollback capability
339
+ - Security and validation utilities
340
+
341
+ ${params.includeAdmin !== false ? `
342
+ ### 3. Admin Interface (admin/)
343
+ - Admin menu registration with proper capabilities
344
+ - Settings API implementation with sections and fields
345
+ - Form handling with nonces and validation
346
+ - Admin notices system with dismissible functionality
347
+ - Dashboard widgets (if relevant)` : ''}
348
+
349
+ ${params.includeDatabase ? `
350
+ ### 4. Database Layer (includes/database/)
351
+ - Custom table schema with proper indexes and rollback
352
+ - Database abstraction layer with $wpdb
353
+ - Migration system with version checking
354
+ - Data validation and sanitization layers with error recovery` : ''}
355
+
356
+ ${params.includeAjax ? `
357
+ ### 5. AJAX System (includes/ajax/)
358
+ - Nonce verification for all AJAX calls
359
+ - Capability checks and user permissions
360
+ - Structured response formatting with error codes
361
+ - Error handling and logging with graceful degradation` : ''}
362
+
363
+ ${params.includeRest ? `
364
+ ### 6. REST API (includes/rest/)
365
+ - Custom endpoint registration with permission callbacks
366
+ - Authentication and authorization layers
367
+ - Request/response schema definitions with validation
368
+ - API versioning and backward compatibility` : ''}
369
+
370
+ ${params.includeGutenberg ? `
371
+ ### 7. Gutenberg Integration (blocks/)
372
+ - Block registration with fallback for older WordPress
373
+ - JavaScript/CSS asset management with dependency checking
374
+ - Block attributes and server-side rendering
375
+ - Editor and frontend styles with theme compatibility` : ''}
376
+
377
+ ## Part 2: Essential WordPress Standards Implementation
378
+
379
+ ### Security Requirements (MANDATORY):
380
+ - Nonce verification: wp_verify_nonce() for ALL forms and AJAX
381
+ - Capability checks: current_user_can() for ALL admin functions
382
+ - Data escaping: esc_html(), esc_attr(), esc_url() for ALL output
383
+ - Input sanitization: sanitize_text_field(), sanitize_email(), etc.
384
+ - SQL injection prevention: $wpdb prepared statements ONLY
385
+ - File inclusion security: Absolute paths and existence checks
386
+
387
+ ### Activation Safety Requirements (CRITICAL):
388
+ - PHP version compatibility checks before class definitions
389
+ - WordPress version compatibility verification
390
+ - Required function/class existence checks
391
+ - Database connection verification (if database features used)
392
+ - Write permission checks for required directories
393
+ - Memory limit and execution time considerations
394
+ - Graceful failure with informative error messages
395
+
396
+ ### Code Quality Requirements:
397
+ - WordPress hooks: Properly registered actions and filters
398
+ - Error handling: Try-catch blocks with wp_die() for user-facing errors
399
+ - Logging: error_log() for debugging with conditional logging
400
+ - Documentation: PHPDoc blocks for ALL functions and classes
401
+ - Coding standards: WordPress-VIP-Go standards compliance
402
+
403
+ ### Performance Requirements:
404
+ - Lazy loading: Load heavy resources only when needed
405
+ - Caching: Implement transients with expiration and cleanup
406
+ - Database optimization: Proper indexes and optimized queries
407
+ - Asset optimization: Minification and concatenation strategies
408
+
409
+ ## Part 3: QA Analysis and Validation
410
+
411
+ ### Pre-Activation Checklist Analysis:
412
+ Provide a comprehensive QA analysis covering:
413
+
414
+ 1. **Fatal Error Prevention:**
415
+ - All class names unique and properly namespaced
416
+ - All function names prefixed to avoid conflicts
417
+ - All required files exist and are properly included
418
+ - All WordPress functions have availability checks
419
+ - All third-party dependencies properly loaded
420
+
421
+ 2. **Security Vulnerability Assessment:**
422
+ - All user inputs properly sanitized
423
+ - All outputs properly escaped
424
+ - All nonces implemented correctly
425
+ - All capability checks in place
426
+ - All SQL queries use prepared statements
427
+
428
+ 3. **WordPress Compatibility Verification:**
429
+ - Minimum WordPress version requirements met
430
+ - Hooks and filters properly registered
431
+ - Admin interfaces follow WordPress UI guidelines
432
+ - Internationalization properly implemented
433
+ - Settings API correctly utilized
434
+
435
+ 4. **Performance Impact Assessment:**
436
+ - Database queries optimized and indexed
437
+ - Assets properly enqueued with dependencies
438
+ - Caching implemented where beneficial
439
+ - Memory usage considerations addressed
440
+
441
+ ## Part 4: Deployment Package Preparation
442
+
443
+ ### ZIP Package Instructions:
444
+ 1. **File Structure for ZIP**: Complete directory listing for packaging
445
+ 2. **README.txt Creation**: WordPress.org standard readme with installation steps
446
+ 3. **Version Management**: Clear version numbering and changelog
447
+ 4. **Asset Optimization**: Minified CSS/JS for production
448
+ 5. **Permission Settings**: Correct file permissions (644 for files, 755 for directories)
449
+
450
+ ### Installation Testing Checklist:
451
+ 1. **Upload Test**: ZIP file uploads successfully via WordPress admin
452
+ 2. **Activation Test**: Plugin activates without fatal errors
453
+ 3. **Functionality Test**: All features work as expected
454
+ 4. **Deactivation Test**: Plugin deactivates cleanly without orphaned data
455
+ 5. **Reactivation Test**: Plugin reactivates properly with saved settings
456
+
457
+ ## Part 5: Output Format Requirements
458
+
459
+ Provide your response in exactly this structure:
460
+
461
+ ### A. Complete Plugin Code
462
+ [All plugin files with full, production-ready code]
463
+
464
+ ### B. QA Analysis Report
465
+ \`\`\`
466
+ # Plugin QA Analysis Report
467
+
468
+ ## Fatal Error Prevention: ✅ PASS / ⚠️ WARNING / ❌ FAIL
469
+ - Class naming conflicts: [assessment]
470
+ - Function naming conflicts: [assessment]
471
+ - File inclusion safety: [assessment]
472
+ - WordPress function availability: [assessment]
473
+
474
+ ## Security Assessment: ✅ PASS / ⚠️ WARNING / ❌ FAIL
475
+ - Input sanitization: [assessment]
476
+ - Output escaping: [assessment]
477
+ - Nonce implementation: [assessment]
478
+ - Capability checks: [assessment]
479
+ - SQL injection prevention: [assessment]
480
+
481
+ ## WordPress Compatibility: ✅ PASS / ⚠️ WARNING / ❌ FAIL
482
+ - Version requirements: [assessment]
483
+ - Hook implementation: [assessment]
484
+ - Admin UI compliance: [assessment]
485
+ - Internationalization: [assessment]
486
+
487
+ ## Performance Assessment: ✅ PASS / ⚠️ WARNING / ❌ FAIL
488
+ - Database optimization: [assessment]
489
+ - Asset management: [assessment]
490
+ - Caching implementation: [assessment]
491
+ - Memory usage: [assessment]
492
+
493
+ ## Overall Plugin Grade: A / B / C / D / F
494
+ [Summary of plugin quality and readiness]
495
+ \`\`\`
496
+
497
+ ### C. ZIP Package Creation Guide
498
+ \`\`\`
499
+ # Plugin ZIP Package Instructions
500
+
501
+ 1. **Create ZIP Structure:**
502
+ - Include all plugin files in folder named: ${prefix}
503
+ - Maintain exact directory structure shown above
504
+ - Include README.txt with WordPress.org format
505
+
506
+ 2. **File Permissions:**
507
+ - PHP files: 644
508
+ - CSS/JS files: 644
509
+ - Directories: 755
510
+
511
+ 3. **ZIP Creation Command:**
512
+ [Provide command-line or manual ZIP creation steps]
513
+
514
+ 4. **Upload Instructions:**
515
+ - Navigate to WordPress Admin → Plugins → Add New → Upload Plugin
516
+ - Select the created ZIP file
517
+ - Click "Install Now"
518
+ - Activate the plugin
519
+ \`\`\`
520
+
521
+ ### D. Testing Checklist
522
+ \`\`\`
523
+ # Pre-Deployment Testing
524
+
525
+ □ ZIP file uploads successfully
526
+ □ Plugin activates without errors
527
+ □ Admin menu appears correctly
528
+ □ Settings page functions properly
529
+ □ All features work as designed
530
+ □ No PHP errors in debug log
531
+ □ Plugin deactivates cleanly
532
+ □ Reactivation works properly
533
+ □ No database orphans after deactivation
534
+ \`\`\`
535
+
536
+ Provide complete, functional, production-ready code that has been thoroughly analyzed for activation safety, security vulnerabilities, and WordPress compatibility. Include comprehensive QA analysis, deployment preparation, and testing procedures.`;
537
+ }
538
+ else {
539
+ // Plugin Analysis Mode
540
+ systemAndContext = `You are an expert WordPress plugin analyst specializing in ${analysisDepth} ${analysisType} analysis.
541
+
542
+ Analysis Context:
543
+ - Language: PHP (WordPress)
544
+ - Analysis Depth: ${analysisDepth}
545
+ - Analysis Type: ${analysisType}
546
+ - Mode: Single WordPress Plugin File Analysis
547
+
548
+ Your task is to provide actionable insights and recommendations for this individual WordPress plugin file.`;
549
+ dataPayload = `WordPress plugin code to analyze:
550
+
551
+ \`\`\`php
552
+ ${code}
553
+ \`\`\``;
554
+ outputInstructions = `Provide comprehensive WordPress plugin analysis in the following structured format:
555
+
556
+ {
557
+ "summary": "Brief overview of this plugin file's purpose and functionality",
558
+ "analysis": {
559
+ "wordpressCompliance": {
560
+ "codingStandards": "assessment of WPCS compliance",
561
+ "hooksUsage": "evaluation of actions and filters usage",
562
+ "apiUsage": "assessment of WordPress API usage"
563
+ },
564
+ "security": {
565
+ "nonceUsage": "evaluation of nonce implementation",
566
+ "sanitization": "input sanitization assessment",
567
+ "escaping": "output escaping assessment",
568
+ "capabilities": "user capability checks assessment"
569
+ },
570
+ "functionality": {
571
+ "coreFeatures": ["list of main features identified"],
572
+ "integrations": ["WordPress integrations detected"],
573
+ "dependencies": ["external dependencies identified"]
574
+ },
575
+ "codeQuality": {
576
+ "structure": "code organization assessment",
577
+ "documentation": "code documentation quality",
578
+ "errorHandling": "error handling implementation"
579
+ }
580
+ },
581
+ "recommendations": [
582
+ "specific WordPress-focused recommendations for improvement"
583
+ ],
584
+ "securityConcerns": [
585
+ "identified security issues with suggested fixes"
586
+ ],
587
+ "confidence": 0.85
588
+ }`;
589
+ }
590
+ return { systemAndContext, dataPayload, outputInstructions };
591
+ }
592
+ /**
593
+ * Multi-file prompt stages - WordPress plugin project analysis
594
+ */
595
+ getMultiFilePromptStages(params) {
596
+ const { analysisResult, analysisType, analysisDepth, fileCount } = params;
597
+ const systemAndContext = `You are an expert WordPress plugin architect specializing in ${analysisDepth} ${analysisType} analysis.
598
+
599
+ WordPress Plugin Project Analysis Context:
600
+ - Analysis Type: ${analysisType}
601
+ - Analysis Depth: ${analysisDepth}
602
+ - Files Analyzed: ${fileCount}
603
+ - Mode: Multi-File WordPress Plugin Project Analysis
604
+
605
+ Your task is to provide comprehensive architectural insights and recommendations for this WordPress plugin project.`;
606
+ const dataPayload = `WordPress plugin project analysis results:
607
+
608
+ ${JSON.stringify(analysisResult, null, 2)}`;
609
+ const outputInstructions = `Provide comprehensive WordPress plugin project analysis in the following structured format:
610
+
611
+ {
612
+ "summary": "Overall WordPress plugin project assessment",
613
+ "architecture": {
614
+ "pluginStructure": "evaluation of plugin organization and structure",
615
+ "namespacing": "assessment of PHP namespacing and class organization",
616
+ "hookSystem": "evaluation of WordPress hooks implementation across files"
617
+ },
618
+ "crossFileFindings": [
619
+ {
620
+ "type": "security|performance|compatibility|standards",
621
+ "severity": "high|medium|low",
622
+ "description": "Cross-file issue description in WordPress context",
623
+ "affectedFiles": ["file1.php", "file2.php"],
624
+ "recommendation": "WordPress-specific fix recommendation"
625
+ }
626
+ ],
627
+ "wordpressCompliance": {
628
+ "codingStandards": "overall WPCS compliance assessment",
629
+ "securityImplementation": "security best practices implementation",
630
+ "performanceOptimization": "performance optimization assessment",
631
+ "accessibilityCompliance": "accessibility standards compliance"
632
+ },
633
+ "recommendations": [
634
+ "project-wide WordPress plugin improvement recommendations"
635
+ ],
636
+ "migrationPath": "suggestions for modernizing the plugin architecture"
637
+ }`;
638
+ return { systemAndContext, dataPayload, outputInstructions };
639
+ }
640
+ /**
641
+ * Backwards compatibility method
642
+ */
643
+ getPromptStages(params) {
644
+ const mode = this.detectAnalysisMode(params);
645
+ if (mode === 'single-file') {
646
+ return this.getSingleFilePromptStages(params);
647
+ }
648
+ else {
649
+ return this.getMultiFilePromptStages(params);
650
+ }
651
+ }
652
+ // Multi-file helper methods
653
+ async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
654
+ const extensions = this.getFileExtensions(analysisType);
655
+ return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
656
+ }
657
+ async performMultiFileAnalysis(files, params, model, contextLength) {
658
+ const cacheKey = this.analysisCache.generateKey('generate_wordpress_plugin', params, files);
659
+ const cached = await this.analysisCache.get(cacheKey);
660
+ if (cached)
661
+ return cached;
662
+ const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualFile(file, params, model), contextLength);
663
+ // Aggregate results into proper analysis result format
664
+ const aggregatedResult = {
665
+ summary: `WordPress plugin project analysis of ${files.length} files`,
666
+ findings: fileAnalysisResults,
667
+ data: {
668
+ fileCount: files.length,
669
+ totalSize: fileAnalysisResults.reduce((sum, result) => sum + (result.size || 0), 0),
670
+ pluginStructure: this.analyzePluginStructure(fileAnalysisResults),
671
+ phpFiles: fileAnalysisResults.filter(f => f.extension === '.php').length,
672
+ jsFiles: fileAnalysisResults.filter(f => f.extension === '.js').length,
673
+ cssFiles: fileAnalysisResults.filter(f => f.extension === '.css').length
674
+ }
675
+ };
676
+ await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
677
+ modelUsed: model.identifier || 'unknown',
678
+ executionTime: Date.now() - Date.now(), // TODO: Track actual execution time
679
+ timestamp: new Date().toISOString()
680
+ });
681
+ return aggregatedResult;
682
+ }
683
+ async analyzeIndividualFile(file, params, model) {
684
+ const content = await import('fs/promises').then(fs => fs.readFile(file, 'utf-8'));
685
+ const stats = await import('fs/promises').then(fs => fs.stat(file));
686
+ // WordPress-specific file analysis
687
+ const isMainPluginFile = basename(file).endsWith('.php') && content.includes('Plugin Name:');
688
+ const hasWordPressHooks = content.includes('add_action') || content.includes('add_filter');
689
+ const hasSecurityChecks = content.includes('wp_verify_nonce') || content.includes('current_user_can');
690
+ return {
691
+ filePath: file,
692
+ fileName: basename(file),
693
+ size: content.length,
694
+ lines: content.split('\n').length,
695
+ extension: extname(file),
696
+ relativePath: relative(params.projectPath || '', file),
697
+ isMainPluginFile,
698
+ hasWordPressHooks,
699
+ hasSecurityChecks,
700
+ fileType: this.categorizeWordPressFile(file, content)
701
+ };
702
+ }
703
+ categorizeWordPressFile(filePath, content) {
704
+ const fileName = basename(filePath).toLowerCase();
705
+ const fileContent = content.toLowerCase();
706
+ if (fileName.endsWith('.php')) {
707
+ if (fileContent.includes('plugin name:'))
708
+ return 'main-plugin-file';
709
+ if (fileName.includes('admin'))
710
+ return 'admin-file';
711
+ if (fileName.includes('ajax'))
712
+ return 'ajax-handler';
713
+ if (fileName.includes('rest') || fileName.includes('api'))
714
+ return 'rest-api';
715
+ if (fileName.includes('block'))
716
+ return 'gutenberg-block';
717
+ if (fileName.includes('widget'))
718
+ return 'widget';
719
+ if (fileName.includes('shortcode'))
720
+ return 'shortcode';
721
+ return 'php-file';
722
+ }
723
+ if (fileName.endsWith('.js')) {
724
+ if (fileContent.includes('wp.blocks'))
725
+ return 'gutenberg-script';
726
+ if (fileContent.includes('jquery'))
727
+ return 'jquery-script';
728
+ return 'javascript-file';
729
+ }
730
+ if (fileName.endsWith('.css')) {
731
+ if (fileName.includes('admin'))
732
+ return 'admin-styles';
733
+ return 'stylesheet';
734
+ }
735
+ return 'other-file';
736
+ }
737
+ analyzePluginStructure(fileResults) {
738
+ const structure = {
739
+ hasMainFile: fileResults.some(f => f.isMainPluginFile),
740
+ hasAdminInterface: fileResults.some(f => f.fileType === 'admin-file'),
741
+ hasAjaxHandlers: fileResults.some(f => f.fileType === 'ajax-handler'),
742
+ hasRestAPI: fileResults.some(f => f.fileType === 'rest-api'),
743
+ hasGutenbergBlocks: fileResults.some(f => f.fileType === 'gutenberg-block' || f.fileType === 'gutenberg-script'),
744
+ securityImplementation: fileResults.filter(f => f.hasSecurityChecks).length / fileResults.length
745
+ };
746
+ return structure;
747
+ }
748
+ getFileExtensions(analysisType) {
749
+ const extensionMap = {
750
+ 'simple': ['.php', '.js', '.css'],
751
+ 'advanced': ['.php', '.js', '.css', '.json', '.md', '.txt'],
752
+ 'comprehensive': ['.php', '.js', '.css', '.json', '.md', '.txt', '.xml', '.yml', '.yaml', '.po', '.pot']
753
+ };
754
+ return extensionMap[analysisType] || extensionMap.comprehensive;
755
+ }
756
+ generateCacheKey(files, params) {
757
+ const fileHash = files.join('|');
758
+ const paramHash = JSON.stringify(params);
759
+ return `${fileHash}_${paramHash}`.substring(0, 64);
760
+ }
761
+ }
762
+ export default WordPressPluginGenerator;
763
+ //# sourceMappingURL=wordpress-plugin.js.map