@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 @@
1
+ {"version":3,"file":"diff-signatures.js","sourceRoot":"","sources":["../../../src/prompts/analyze/diff-signatures.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IAiFnD;QACE,KAAK,EAAE,CAAC;QAjFV,SAAI,GAAG,wBAAwB,CAAC;QAChC,aAAQ,GAAG,SAAkB,CAAC;QAC9B,gBAAW,GAAG,mHAAmH,CAAC;QAElI,0EAA0E;QAC1E,eAAU,GAAG;YACX,yBAAyB;YACzB,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAiB;gBACvB,WAAW,EAAE,gDAAgD;gBAC7D,QAAQ,EAAE,KAAK;aAChB;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAiB;gBACvB,WAAW,EAAE,gCAAgC;gBAC7C,QAAQ,EAAE,KAAK;aAChB;YAED,0BAA0B;YAC1B,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,WAAW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ern v4.2 (Single Source of Truth)
3
+ *
4
+ * Universal template that intelligently handles both single-file and multi-file analysis
5
+ * Automatically detects analysis type based on provided parameters
6
+ *
7
+ * Copy this template for creating any new plugin - it adapts to your needs
8
+ */
9
+ import { BasePlugin } from '../../plugins/base-plugin.js';
10
+ import { IPromptPlugin } from '../shared/types.js';
11
+ import { PromptStages } from '../../types/prompt-stages.js';
12
+ export declare class PatternFinderPlugin extends BasePlugin implements IPromptPlugin {
13
+ name: string;
14
+ category: "analyze";
15
+ description: string;
16
+ parameters: {
17
+ code: {
18
+ type: "string";
19
+ description: string;
20
+ required: boolean;
21
+ };
22
+ filePath: {
23
+ type: "string";
24
+ description: string;
25
+ required: boolean;
26
+ };
27
+ projectPath: {
28
+ type: "string";
29
+ description: string;
30
+ required: boolean;
31
+ };
32
+ files: {
33
+ type: "array";
34
+ description: string;
35
+ required: boolean;
36
+ items: {
37
+ type: "string";
38
+ };
39
+ };
40
+ maxDepth: {
41
+ type: "number";
42
+ description: string;
43
+ required: boolean;
44
+ };
45
+ patterns: {
46
+ type: "array";
47
+ description: string;
48
+ required: boolean;
49
+ items: {
50
+ type: "string";
51
+ };
52
+ };
53
+ includeContext: {
54
+ type: "number";
55
+ description: string;
56
+ required: boolean;
57
+ default: number;
58
+ };
59
+ language: {
60
+ type: "string";
61
+ description: string;
62
+ required: boolean;
63
+ default: string;
64
+ };
65
+ analysisDepth: {
66
+ type: "string";
67
+ description: string;
68
+ enum: string[];
69
+ default: string;
70
+ required: boolean;
71
+ };
72
+ analysisType: {
73
+ type: "string";
74
+ description: string;
75
+ enum: string[];
76
+ default: string;
77
+ required: boolean;
78
+ };
79
+ };
80
+ private analysisCache;
81
+ private multiFileAnalysis;
82
+ constructor();
83
+ execute(params: any, llmClient: any): Promise<any>;
84
+ /**
85
+ * Auto-detect whether this is single-file or multi-file analysis
86
+ */
87
+ private detectAnalysisMode;
88
+ /**
89
+ * Validate parameters based on detected analysis mode
90
+ */
91
+ private validateParameters;
92
+ /**
93
+ * Execute single-file analysis
94
+ */
95
+ private executeSingleFileAnalysis;
96
+ /**
97
+ * Execute multi-file analysis
98
+ */
99
+ private executeMultiFileAnalysis;
100
+ /**
101
+ * Search patterns in single code block
102
+ */
103
+ private searchPatternsInCode;
104
+ /**
105
+ * Get context lines around a match
106
+ */
107
+ private getContextLines;
108
+ /**
109
+ * Single-file pattern analysis prompt
110
+ */
111
+ private getSingleFilePromptStages;
112
+ /**
113
+ * Multi-file pattern analysis prompt - optimized for comprehensive project analysis
114
+ */
115
+ private getMultiFilePromptStages;
116
+ /**
117
+ * Implement for backwards compatibility
118
+ * The system still expects this method, so we intelligently route to the appropriate stages
119
+ */
120
+ getPromptStages(params: any): PromptStages;
121
+ private discoverRelevantFiles;
122
+ private performMultiFileAnalysis;
123
+ private analyzeIndividualFile;
124
+ private getFileExtensions;
125
+ private generateCacheKey;
126
+ }
127
+ export default PatternFinderPlugin;
128
+ //# sourceMappingURL=find-patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-patterns.d.ts","sourceRoot":"","sources":["../../../src/prompts/analyze/find-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAY5D,qBAAa,mBAAoB,SAAQ,UAAW,YAAW,aAAa;IAC1E,IAAI,SAAwB;IAC5B,QAAQ,EAAG,SAAS,CAAU;IAC9B,WAAW,SAAoI;IAG/I,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkER;IAEF,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,iBAAiB,CAA2B;;IAO9C,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG;IAyBzC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;OAEG;YACW,yBAAyB;IA8CvC;;OAEG;YACW,wBAAwB;IA0CtC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA0C5B;;OAEG;IACH,OAAO,CAAC,eAAe;IAavB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA6EjC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmGhC;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,YAAY;YAW5B,qBAAqB;YASrB,wBAAwB;YA2CxB,qBAAqB;IAwBnC,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,gBAAgB;CAKzB;AAED,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,520 @@
1
+ /**
2
+ * Plugin Template - Modern v4.2 (Single Source of Truth)
3
+ *
4
+ * Universal template that intelligently handles both single-file and multi-file analysis
5
+ * Automatically detects analysis type based on provided parameters
6
+ *
7
+ * Copy this template for creating any new plugin - it adapts to your needs
8
+ */
9
+ import { BasePlugin } from '../../plugins/base-plugin.js';
10
+ import { ThreeStagePromptManager } from '../../core/ThreeStagePromptManager.js';
11
+ import { withSecurity } from '../../security/integration-helpers.js';
12
+ import { readFileContent } from '../shared/helpers.js';
13
+ import { ModelSetup, ResponseProcessor, ParameterValidator, ErrorHandler, MultiFileAnalysis } from '../../utils/plugin-utilities.js';
14
+ import { getAnalysisCache } from '../../cache/index.js';
15
+ export class PatternFinderPlugin extends BasePlugin {
16
+ constructor() {
17
+ super();
18
+ this.name = 'find_pattern_usage';
19
+ this.category = 'analyze';
20
+ this.description = 'Find usage of specific patterns across multiple files in a project. Supports regex patterns with intelligent context analysis.';
21
+ // Universal parameter set - supports both single and multi-file scenarios
22
+ this.parameters = {
23
+ // Single-file parameters
24
+ code: {
25
+ type: 'string',
26
+ description: 'The code to analyze (for single-file analysis)',
27
+ required: false
28
+ },
29
+ filePath: {
30
+ type: 'string',
31
+ description: 'Path to single file to analyze',
32
+ required: false
33
+ },
34
+ // Multi-file parameters
35
+ projectPath: {
36
+ type: 'string',
37
+ description: 'Absolute path to project root directory',
38
+ required: false
39
+ },
40
+ files: {
41
+ type: 'array',
42
+ description: 'Array of specific file paths (for multi-file analysis)',
43
+ required: false,
44
+ items: { type: 'string' }
45
+ },
46
+ maxDepth: {
47
+ type: 'number',
48
+ description: 'Maximum directory depth for multi-file discovery (1-5)',
49
+ required: false
50
+ },
51
+ // Pattern-specific parameters
52
+ patterns: {
53
+ type: 'array',
54
+ description: 'Patterns to search for (regex supported)',
55
+ required: true,
56
+ items: { type: 'string' }
57
+ },
58
+ includeContext: {
59
+ type: 'number',
60
+ description: 'Number of context lines to include (0-10)',
61
+ required: false,
62
+ default: 3
63
+ },
64
+ // Universal parameters
65
+ language: {
66
+ type: 'string',
67
+ description: 'Programming language',
68
+ required: false,
69
+ default: 'javascript'
70
+ },
71
+ analysisDepth: {
72
+ type: 'string',
73
+ description: 'Level of analysis detail',
74
+ enum: ['basic', 'detailed', 'comprehensive'],
75
+ default: 'detailed',
76
+ required: false
77
+ },
78
+ analysisType: {
79
+ type: 'string',
80
+ description: 'Type of analysis to perform',
81
+ enum: ['patterns', 'security', 'comprehensive'],
82
+ default: 'comprehensive',
83
+ required: false
84
+ }
85
+ };
86
+ this.analysisCache = getAnalysisCache();
87
+ this.multiFileAnalysis = new MultiFileAnalysis();
88
+ // Cache and analysis utilities are initialized above
89
+ }
90
+ async execute(params, llmClient) {
91
+ return await withSecurity(this, params, llmClient, async (secureParams) => {
92
+ try {
93
+ // 1. Auto-detect analysis mode based on parameters
94
+ const analysisMode = this.detectAnalysisMode(secureParams);
95
+ // 2. Validate parameters based on detected mode
96
+ this.validateParameters(secureParams, analysisMode);
97
+ // 3. Setup model
98
+ const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
99
+ // 4. Route to appropriate analysis method
100
+ if (analysisMode === 'single-file') {
101
+ return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
102
+ }
103
+ else {
104
+ return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
105
+ }
106
+ }
107
+ catch (error) {
108
+ return ErrorHandler.createExecutionError('find_pattern_usage', error);
109
+ }
110
+ });
111
+ }
112
+ /**
113
+ * Auto-detect whether this is single-file or multi-file analysis
114
+ */
115
+ detectAnalysisMode(params) {
116
+ // Single-file indicators take priority (avoids default parameter issues)
117
+ if (params.code || params.filePath) {
118
+ return 'single-file';
119
+ }
120
+ // Multi-file indicators
121
+ if (params.projectPath || params.files) {
122
+ return 'multi-file';
123
+ }
124
+ // Default to multi-file for pattern finding (usually project-wide)
125
+ return 'multi-file';
126
+ }
127
+ /**
128
+ * Validate parameters based on detected analysis mode
129
+ */
130
+ validateParameters(params, mode) {
131
+ // Validate patterns (required for both modes)
132
+ if (!params.patterns || !Array.isArray(params.patterns) || params.patterns.length === 0) {
133
+ throw new Error('patterns parameter is required and must be a non-empty array');
134
+ }
135
+ if (mode === 'single-file') {
136
+ ParameterValidator.validateCodeOrFile(params);
137
+ }
138
+ else {
139
+ ParameterValidator.validateProjectPath(params);
140
+ ParameterValidator.validateDepth(params, 1, 5);
141
+ }
142
+ // Universal validations
143
+ ParameterValidator.validateEnum(params, 'analysisType', ['patterns', 'security', 'comprehensive']);
144
+ ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
145
+ // Validate context lines
146
+ if (params.includeContext !== undefined) {
147
+ const context = parseInt(params.includeContext);
148
+ if (isNaN(context) || context < 0 || context > 10) {
149
+ throw new Error('includeContext must be a number between 0 and 10');
150
+ }
151
+ }
152
+ }
153
+ /**
154
+ * Execute single-file analysis
155
+ */
156
+ async executeSingleFileAnalysis(params, model, contextLength) {
157
+ // Process single file input
158
+ let codeToAnalyze = params.code;
159
+ if (params.filePath) {
160
+ codeToAnalyze = await readFileContent(params.filePath);
161
+ }
162
+ // Search patterns in the single file
163
+ const patternMatches = this.searchPatternsInCode(codeToAnalyze, params.patterns, params.includeContext || 3);
164
+ // Generate prompt stages for single file
165
+ const promptStages = this.getSingleFilePromptStages({
166
+ ...params,
167
+ code: codeToAnalyze,
168
+ patternMatches
169
+ });
170
+ // Execute with appropriate method
171
+ const promptManager = new ThreeStagePromptManager(contextLength);
172
+ const needsChunking = promptManager.needsChunking(promptStages);
173
+ if (needsChunking) {
174
+ const conversation = promptManager.createChunkedConversation(promptStages);
175
+ const messages = [
176
+ conversation.systemMessage,
177
+ ...conversation.dataMessages,
178
+ conversation.analysisMessage
179
+ ];
180
+ return await ResponseProcessor.executeChunked(messages, model, contextLength, 'find_pattern_usage', 'single');
181
+ }
182
+ else {
183
+ return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'find_pattern_usage');
184
+ }
185
+ }
186
+ /**
187
+ * Execute multi-file analysis
188
+ */
189
+ async executeMultiFileAnalysis(params, model, contextLength) {
190
+ // Discover files
191
+ let filesToAnalyze = params.files ||
192
+ await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.analysisType);
193
+ // Perform multi-file analysis with caching
194
+ const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
195
+ // Generate prompt stages for multi-file
196
+ const promptStages = this.getMultiFilePromptStages({
197
+ ...params,
198
+ analysisResult,
199
+ fileCount: filesToAnalyze.length
200
+ });
201
+ // Always use chunking for multi-file
202
+ const promptManager = new ThreeStagePromptManager(contextLength);
203
+ const conversation = promptManager.createChunkedConversation(promptStages);
204
+ const messages = [
205
+ conversation.systemMessage,
206
+ ...conversation.dataMessages,
207
+ conversation.analysisMessage
208
+ ];
209
+ return await ResponseProcessor.executeChunked(messages, model, contextLength, 'find_pattern_usage', 'multifile');
210
+ }
211
+ /**
212
+ * Search patterns in single code block
213
+ */
214
+ searchPatternsInCode(code, patterns, contextLines) {
215
+ const lines = code.split('\n');
216
+ const matches = [];
217
+ patterns.forEach(pattern => {
218
+ lines.forEach((line, lineIndex) => {
219
+ try {
220
+ // Try regex first
221
+ const regex = new RegExp(pattern, 'gi');
222
+ let match;
223
+ while ((match = regex.exec(line)) !== null) {
224
+ matches.push({
225
+ pattern,
226
+ line: lineIndex + 1,
227
+ column: match.index + 1,
228
+ match: match[0],
229
+ context: this.getContextLines(lines, lineIndex, contextLines)
230
+ });
231
+ }
232
+ }
233
+ catch {
234
+ // Fallback to literal search
235
+ const index = line.toLowerCase().indexOf(pattern.toLowerCase());
236
+ if (index !== -1) {
237
+ matches.push({
238
+ pattern,
239
+ line: lineIndex + 1,
240
+ column: index + 1,
241
+ match: pattern,
242
+ context: this.getContextLines(lines, lineIndex, contextLines)
243
+ });
244
+ }
245
+ }
246
+ });
247
+ });
248
+ return {
249
+ totalMatches: matches.length,
250
+ patterns: patterns,
251
+ matches
252
+ };
253
+ }
254
+ /**
255
+ * Get context lines around a match
256
+ */
257
+ getContextLines(lines, matchLineIndex, contextSize) {
258
+ const start = Math.max(0, matchLineIndex - contextSize);
259
+ const end = Math.min(lines.length - 1, matchLineIndex + contextSize);
260
+ const contextLines = [];
261
+ for (let i = start; i <= end; i++) {
262
+ const prefix = i === matchLineIndex ? '>>> ' : ' ';
263
+ contextLines.push(`${prefix}${i + 1}: ${lines[i]}`);
264
+ }
265
+ return contextLines;
266
+ }
267
+ /**
268
+ * Single-file pattern analysis prompt
269
+ */
270
+ getSingleFilePromptStages(params) {
271
+ const { patterns, patternMatches, analysisDepth, analysisType, filePath } = params;
272
+ const systemAndContext = `You are an expert code pattern analyst specializing in ${analysisDepth} ${analysisType} analysis.
273
+
274
+ **Your Expertise:**
275
+ - Advanced pattern recognition and usage analysis
276
+ - Code quality assessment and security implications
277
+ - Refactoring opportunities identification
278
+ - Best practices for pattern implementation
279
+
280
+ **Analysis Context:**
281
+ - File: ${filePath || 'Code block'}
282
+ - Patterns searched: ${patterns.length}
283
+ - Total matches found: ${patternMatches.totalMatches}
284
+ - Analysis depth: ${analysisDepth}
285
+ - Focus: ${analysisType} analysis
286
+
287
+ **Your Mission:**
288
+ Provide expert analysis of how the specified patterns are used in this code, identifying usage quality, potential issues, and improvement opportunities.`;
289
+ const dataPayload = `**PATTERN SEARCH RESULTS:**
290
+
291
+ Patterns searched: ${patterns.map((p) => `"${p}"`).join(', ')}
292
+ Total matches found: ${patternMatches.totalMatches}
293
+
294
+ ${patternMatches.matches.length === 0 ?
295
+ 'No matches found for the specified patterns.' :
296
+ patternMatches.matches.map((match, index) => `
297
+ **Match ${index + 1}:**
298
+ - Pattern: "${match.pattern}"
299
+ - Location: Line ${match.line}, Column ${match.column}
300
+ - Matched text: "${match.match}"
301
+
302
+ Context:
303
+ ${match.context.join('\n')}
304
+ `).join('\n')}`;
305
+ const outputInstructions = `**PROVIDE COMPREHENSIVE PATTERN ANALYSIS:**
306
+
307
+ ## Pattern Usage Summary
308
+ Brief overview of what patterns were found and their primary usage
309
+
310
+ ## Detailed Pattern Analysis
311
+ For each pattern found:
312
+ - **Pattern**: "${patterns[0]}" (example)
313
+ - **Occurrences**: [count]
314
+ - **Usage Context**: [how it's being used]
315
+ - **Quality Assessment**: [good/problematic/needs improvement]
316
+ - **Security Implications**: [if any]
317
+
318
+ ## Code Quality Findings
319
+ ### ✅ Good Practices Observed
320
+ - [List positive pattern usage]
321
+
322
+ ### ⚠️ Issues Identified
323
+ - [List problematic usage with severity]
324
+
325
+ ### 🔒 Security Considerations
326
+ - [Any security-related findings from pattern usage]
327
+
328
+ ## Improvement Recommendations
329
+ 1. **Immediate Actions**
330
+ - [High priority fixes or improvements]
331
+
332
+ 2. **Code Enhancement Suggestions**
333
+ - [Ways to improve pattern usage]
334
+
335
+ 3. **Best Practice Guidelines**
336
+ - [Recommendations for optimal pattern implementation]
337
+
338
+ ## Conclusion
339
+ Overall assessment and next steps for pattern optimization in this code.`;
340
+ return { systemAndContext, dataPayload, outputInstructions };
341
+ }
342
+ /**
343
+ * Multi-file pattern analysis prompt - optimized for comprehensive project analysis
344
+ */
345
+ getMultiFilePromptStages(params) {
346
+ const { patterns, analysisResult, analysisType, analysisDepth, fileCount } = params;
347
+ const systemAndContext = `You are a senior software architect and code quality expert specializing in ${analysisDepth} ${analysisType} pattern analysis across large codebases.
348
+
349
+ **Your Expert Capabilities:**
350
+ - Cross-file pattern usage analysis and architectural implications
351
+ - Security vulnerability identification through pattern analysis
352
+ - Code maintainability and refactoring opportunity assessment
353
+ - Team coding standards and consistency evaluation
354
+ - Performance implications of pattern distribution
355
+
356
+ **Project Analysis Context:**
357
+ - Project scope: ${fileCount} files analyzed
358
+ - Patterns searched: ${patterns.length} distinct patterns
359
+ - Analysis focus: ${analysisType} analysis
360
+ - Analysis depth: ${analysisDepth}
361
+
362
+ **Strategic Mission:**
363
+ Provide executive-level insights on pattern usage across the entire codebase, identifying architectural strengths, risks, and strategic improvement opportunities that will enhance code quality, security, and maintainability.`;
364
+ const dataPayload = `**COMPREHENSIVE PROJECT PATTERN ANALYSIS:**
365
+
366
+ ${JSON.stringify(analysisResult, null, 2)}`;
367
+ const outputInstructions = `**DELIVER STRATEGIC PATTERN ANALYSIS REPORT:**
368
+
369
+ # Executive Summary
370
+ ## Key Findings
371
+ - Most critical pattern usage issues discovered
372
+ - Primary architectural insights
373
+ - Strategic recommendations priority
374
+
375
+ ## Risk Assessment
376
+ - **High Risk**: [Critical issues requiring immediate attention]
377
+ - **Medium Risk**: [Important issues for next sprint]
378
+ - **Low Risk**: [Long-term improvements]
379
+
380
+ # Detailed Pattern Analysis
381
+
382
+ ## Pattern Distribution Map
383
+ For each pattern searched:
384
+ - **Pattern**: "${patterns[0]}" (example)
385
+ - **Total Occurrences**: [count across all files]
386
+ - **File Distribution**: [how spread across codebase]
387
+ - **Hotspots**: [files/modules with heavy usage]
388
+ - **Usage Consistency**: [consistent vs. varied implementations]
389
+
390
+ ## Architectural Insights
391
+ ### Code Organization Quality
392
+ - How patterns reveal architectural decisions
393
+ - Consistency of implementation approaches
394
+ - Module coupling implications
395
+
396
+ ### Design Pattern Assessment
397
+ - Appropriate use of design patterns
398
+ - Anti-patterns discovered
399
+ - Missing abstractions opportunities
400
+
401
+ ## Security & Quality Analysis
402
+ ### 🔒 Security Implications
403
+ - Pattern usage that creates vulnerabilities
404
+ - Input validation consistency
405
+ - Authentication/authorization pattern usage
406
+
407
+ ### 🏗️ Code Quality Impact
408
+ - Pattern usage affecting maintainability
409
+ - Technical debt indicators
410
+ - Testing implications of pattern choices
411
+
412
+ ## Strategic Recommendations
413
+
414
+ ### 1. Immediate Actions (This Sprint)
415
+ - [Critical fixes needed now]
416
+ - [Security vulnerabilities to address]
417
+
418
+ ### 2. Architectural Improvements (Next Quarter)
419
+ - [Refactoring opportunities for better pattern usage]
420
+ - [Consolidation of duplicate pattern implementations]
421
+
422
+ ### 3. Long-term Strategy (6-12 months)
423
+ - [Team training on proper pattern usage]
424
+ - [Code standards establishment]
425
+ - [Tooling to enforce pattern consistency]
426
+
427
+ ## Implementation Roadmap
428
+ 1. **Week 1-2**: Address critical security findings
429
+ 2. **Month 1**: Implement high-impact refactoring
430
+ 3. **Quarter 1**: Establish team standards and tooling
431
+ 4. **Ongoing**: Monitor pattern usage evolution
432
+
433
+ # Conclusion
434
+ **Bottom Line**: [Most important takeaway for technical leadership]
435
+ **Success Metrics**: [How to measure improvement]
436
+ **Next Steps**: [Specific actions to begin immediately]`;
437
+ return { systemAndContext, dataPayload, outputInstructions };
438
+ }
439
+ /**
440
+ * Implement for backwards compatibility
441
+ * The system still expects this method, so we intelligently route to the appropriate stages
442
+ */
443
+ getPromptStages(params) {
444
+ const mode = this.detectAnalysisMode(params);
445
+ if (mode === 'single-file') {
446
+ return this.getSingleFilePromptStages(params);
447
+ }
448
+ else {
449
+ return this.getMultiFilePromptStages(params);
450
+ }
451
+ }
452
+ // Multi-file helper methods
453
+ async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
454
+ const extensions = this.getFileExtensions(analysisType);
455
+ return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
456
+ }
457
+ async performMultiFileAnalysis(files, params, model, contextLength) {
458
+ const cacheKey = this.analysisCache.generateKey('find_pattern_usage', params, files);
459
+ const cached = await this.analysisCache.get(cacheKey);
460
+ if (cached)
461
+ return cached;
462
+ const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualFile(file, params, model), contextLength);
463
+ // Aggregate results into proper analysis result format
464
+ const aggregatedResult = {
465
+ summary: `Pattern analysis across ${files.length} files`,
466
+ patterns: params.patterns,
467
+ totalFiles: files.length,
468
+ findings: fileAnalysisResults,
469
+ statistics: {
470
+ filesWithMatches: fileAnalysisResults.filter((r) => r.matches && r.matches.length > 0).length,
471
+ totalMatches: fileAnalysisResults.reduce((sum, r) => sum + (r.matches?.length || 0), 0),
472
+ patternsFound: [...new Set(fileAnalysisResults.flatMap((r) => r.matches?.map((m) => m.pattern) || []))]
473
+ }
474
+ };
475
+ await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
476
+ modelUsed: model.identifier || 'unknown',
477
+ executionTime: Date.now() - Date.now(), // TODO: Track actual execution time
478
+ timestamp: new Date().toISOString()
479
+ });
480
+ return aggregatedResult;
481
+ }
482
+ async analyzeIndividualFile(file, params, model) {
483
+ try {
484
+ const content = await import('fs/promises').then(fs => fs.readFile(file, 'utf-8'));
485
+ const patternMatches = this.searchPatternsInCode(content, params.patterns, params.includeContext || 3);
486
+ return {
487
+ filePath: file,
488
+ size: content.length,
489
+ lines: content.split('\n').length,
490
+ matches: patternMatches.matches,
491
+ totalMatches: patternMatches.totalMatches
492
+ };
493
+ }
494
+ catch (error) {
495
+ return {
496
+ filePath: file,
497
+ size: 0,
498
+ lines: 0,
499
+ matches: [],
500
+ totalMatches: 0,
501
+ error: 'Could not read file'
502
+ };
503
+ }
504
+ }
505
+ getFileExtensions(analysisType) {
506
+ const extensionMap = {
507
+ 'patterns': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java', '.cs', '.cpp', '.c', '.h', '.rb', '.go', '.swift'],
508
+ 'security': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java', '.cs'], // Focus on web/app languages for security
509
+ 'comprehensive': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java', '.cs', '.cpp', '.c', '.h', '.rb', '.go', '.swift', '.kt', '.rs']
510
+ };
511
+ return extensionMap[analysisType] || extensionMap.comprehensive;
512
+ }
513
+ generateCacheKey(files, params) {
514
+ const fileHash = files.join('|');
515
+ const paramHash = JSON.stringify(params);
516
+ return `${fileHash}_${paramHash}`.substring(0, 64);
517
+ }
518
+ }
519
+ export default PatternFinderPlugin;
520
+ //# sourceMappingURL=find-patterns.js.map