@houtini/lm 1.0.12 → 2.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 (263) hide show
  1. package/README.md +5 -6
  2. package/dist/index.d.ts +5 -3
  3. package/dist/index.js +142 -213
  4. package/dist/index.js.map +1 -1
  5. package/package.json +10 -33
  6. package/CHANGELOG.md +0 -282
  7. package/dist/cache/analysis-cache.d.ts +0 -33
  8. package/dist/cache/analysis-cache.d.ts.map +0 -1
  9. package/dist/cache/analysis-cache.js +0 -56
  10. package/dist/cache/analysis-cache.js.map +0 -1
  11. package/dist/cache/cache-manager.d.ts +0 -29
  12. package/dist/cache/cache-manager.d.ts.map +0 -1
  13. package/dist/cache/cache-manager.js +0 -85
  14. package/dist/cache/cache-manager.js.map +0 -1
  15. package/dist/cache/index.d.ts +0 -16
  16. package/dist/cache/index.d.ts.map +0 -1
  17. package/dist/cache/index.js +0 -17
  18. package/dist/cache/index.js.map +0 -1
  19. package/dist/cache/prompt-cache.d.ts +0 -33
  20. package/dist/cache/prompt-cache.d.ts.map +0 -1
  21. package/dist/cache/prompt-cache.js +0 -61
  22. package/dist/cache/prompt-cache.js.map +0 -1
  23. package/dist/config.d.ts +0 -41
  24. package/dist/config.d.ts.map +0 -1
  25. package/dist/config.js +0 -71
  26. package/dist/config.js.map +0 -1
  27. package/dist/core/ThreeStagePromptManager.d.ts +0 -23
  28. package/dist/core/ThreeStagePromptManager.d.ts.map +0 -1
  29. package/dist/core/ThreeStagePromptManager.js +0 -118
  30. package/dist/core/ThreeStagePromptManager.js.map +0 -1
  31. package/dist/index.d.ts.map +0 -1
  32. package/dist/plugins/base-plugin.d.ts +0 -55
  33. package/dist/plugins/base-plugin.d.ts.map +0 -1
  34. package/dist/plugins/base-plugin.js +0 -120
  35. package/dist/plugins/base-plugin.js.map +0 -1
  36. package/dist/plugins/index.d.ts +0 -58
  37. package/dist/plugins/index.d.ts.map +0 -1
  38. package/dist/plugins/index.js +0 -162
  39. package/dist/plugins/index.js.map +0 -1
  40. package/dist/plugins/types.d.ts +0 -5
  41. package/dist/plugins/types.d.ts.map +0 -1
  42. package/dist/plugins/types.js +0 -5
  43. package/dist/plugins/types.js.map +0 -1
  44. package/dist/prompts/analyze/code-quality.d.ts +0 -116
  45. package/dist/prompts/analyze/code-quality.d.ts.map +0 -1
  46. package/dist/prompts/analyze/code-quality.js +0 -437
  47. package/dist/prompts/analyze/code-quality.js.map +0 -1
  48. package/dist/prompts/analyze/compare-integration.d.ts +0 -130
  49. package/dist/prompts/analyze/compare-integration.d.ts.map +0 -1
  50. package/dist/prompts/analyze/compare-integration.js +0 -547
  51. package/dist/prompts/analyze/compare-integration.js.map +0 -1
  52. package/dist/prompts/analyze/count-files.d.ts +0 -109
  53. package/dist/prompts/analyze/count-files.d.ts.map +0 -1
  54. package/dist/prompts/analyze/count-files.js +0 -403
  55. package/dist/prompts/analyze/count-files.js.map +0 -1
  56. package/dist/prompts/analyze/database-queries.d.ts +0 -156
  57. package/dist/prompts/analyze/database-queries.d.ts.map +0 -1
  58. package/dist/prompts/analyze/database-queries.js +0 -763
  59. package/dist/prompts/analyze/database-queries.js.map +0 -1
  60. package/dist/prompts/analyze/dependencies.d.ts +0 -97
  61. package/dist/prompts/analyze/dependencies.d.ts.map +0 -1
  62. package/dist/prompts/analyze/dependencies.js +0 -337
  63. package/dist/prompts/analyze/dependencies.js.map +0 -1
  64. package/dist/prompts/analyze/diff-signatures.d.ts +0 -139
  65. package/dist/prompts/analyze/diff-signatures.d.ts.map +0 -1
  66. package/dist/prompts/analyze/diff-signatures.js +0 -708
  67. package/dist/prompts/analyze/diff-signatures.js.map +0 -1
  68. package/dist/prompts/analyze/find-patterns.d.ts +0 -128
  69. package/dist/prompts/analyze/find-patterns.d.ts.map +0 -1
  70. package/dist/prompts/analyze/find-patterns.js +0 -524
  71. package/dist/prompts/analyze/find-patterns.js.map +0 -1
  72. package/dist/prompts/analyze/find-unused-css.d.ts +0 -151
  73. package/dist/prompts/analyze/find-unused-css.d.ts.map +0 -1
  74. package/dist/prompts/analyze/find-unused-css.js +0 -760
  75. package/dist/prompts/analyze/find-unused-css.js.map +0 -1
  76. package/dist/prompts/analyze/n8n-workflow.d.ts +0 -137
  77. package/dist/prompts/analyze/n8n-workflow.d.ts.map +0 -1
  78. package/dist/prompts/analyze/n8n-workflow.js +0 -533
  79. package/dist/prompts/analyze/n8n-workflow.js.map +0 -1
  80. package/dist/prompts/analyze/project-structure.d.ts +0 -126
  81. package/dist/prompts/analyze/project-structure.d.ts.map +0 -1
  82. package/dist/prompts/analyze/project-structure.js +0 -573
  83. package/dist/prompts/analyze/project-structure.js.map +0 -1
  84. package/dist/prompts/analyze/security-audit.d.ts +0 -142
  85. package/dist/prompts/analyze/security-audit.d.ts.map +0 -1
  86. package/dist/prompts/analyze/security-audit.js +0 -641
  87. package/dist/prompts/analyze/security-audit.js.map +0 -1
  88. package/dist/prompts/analyze/single-file.d.ts +0 -162
  89. package/dist/prompts/analyze/single-file.d.ts.map +0 -1
  90. package/dist/prompts/analyze/single-file.js +0 -669
  91. package/dist/prompts/analyze/single-file.js.map +0 -1
  92. package/dist/prompts/analyze/trace-execution.d.ts +0 -126
  93. package/dist/prompts/analyze/trace-execution.d.ts.map +0 -1
  94. package/dist/prompts/analyze/trace-execution.js +0 -613
  95. package/dist/prompts/analyze/trace-execution.js.map +0 -1
  96. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +0 -116
  97. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +0 -1
  98. package/dist/prompts/analyze/wordpress-plugin-audit.js +0 -456
  99. package/dist/prompts/analyze/wordpress-plugin-audit.js.map +0 -1
  100. package/dist/prompts/analyze/wordpress-plugin-readiness.d.ts +0 -103
  101. package/dist/prompts/analyze/wordpress-plugin-readiness.d.ts.map +0 -1
  102. package/dist/prompts/analyze/wordpress-plugin-readiness.js +0 -506
  103. package/dist/prompts/analyze/wordpress-plugin-readiness.js.map +0 -1
  104. package/dist/prompts/analyze/wordpress-security.d.ts +0 -146
  105. package/dist/prompts/analyze/wordpress-security.d.ts.map +0 -1
  106. package/dist/prompts/analyze/wordpress-security.js +0 -702
  107. package/dist/prompts/analyze/wordpress-security.js.map +0 -1
  108. package/dist/prompts/analyze/wordpress-theme-audit.d.ts +0 -114
  109. package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +0 -1
  110. package/dist/prompts/analyze/wordpress-theme-audit.js +0 -540
  111. package/dist/prompts/analyze/wordpress-theme-audit.js.map +0 -1
  112. package/dist/prompts/custom/custom-prompt.d.ts +0 -135
  113. package/dist/prompts/custom/custom-prompt.d.ts.map +0 -1
  114. package/dist/prompts/custom/custom-prompt.js +0 -421
  115. package/dist/prompts/custom/custom-prompt.js.map +0 -1
  116. package/dist/prompts/fun/arcade-game.d.ts +0 -152
  117. package/dist/prompts/fun/arcade-game.d.ts.map +0 -1
  118. package/dist/prompts/fun/arcade-game.js +0 -657
  119. package/dist/prompts/fun/arcade-game.js.map +0 -1
  120. package/dist/prompts/fun/create_text_adventure.d.ts +0 -100
  121. package/dist/prompts/fun/create_text_adventure.d.ts.map +0 -1
  122. package/dist/prompts/fun/create_text_adventure.js +0 -401
  123. package/dist/prompts/fun/create_text_adventure.js.map +0 -1
  124. package/dist/prompts/fun/css-art-generator.d.ts +0 -168
  125. package/dist/prompts/fun/css-art-generator.d.ts.map +0 -1
  126. package/dist/prompts/fun/css-art-generator.js +0 -831
  127. package/dist/prompts/fun/css-art-generator.js.map +0 -1
  128. package/dist/prompts/generate/project-documentation.d.ts +0 -137
  129. package/dist/prompts/generate/project-documentation.d.ts.map +0 -1
  130. package/dist/prompts/generate/project-documentation.js +0 -670
  131. package/dist/prompts/generate/project-documentation.js.map +0 -1
  132. package/dist/prompts/generate/refactoring.d.ts +0 -164
  133. package/dist/prompts/generate/refactoring.d.ts.map +0 -1
  134. package/dist/prompts/generate/refactoring.js +0 -625
  135. package/dist/prompts/generate/refactoring.js.map +0 -1
  136. package/dist/prompts/generate/responsive-component.d.ts +0 -147
  137. package/dist/prompts/generate/responsive-component.d.ts.map +0 -1
  138. package/dist/prompts/generate/responsive-component.js +0 -957
  139. package/dist/prompts/generate/responsive-component.js.map +0 -1
  140. package/dist/prompts/generate/typescript-conversion.d.ts +0 -144
  141. package/dist/prompts/generate/typescript-conversion.d.ts.map +0 -1
  142. package/dist/prompts/generate/typescript-conversion.js +0 -531
  143. package/dist/prompts/generate/typescript-conversion.js.map +0 -1
  144. package/dist/prompts/generate/unit-tests.d.ts +0 -139
  145. package/dist/prompts/generate/unit-tests.d.ts.map +0 -1
  146. package/dist/prompts/generate/unit-tests.js +0 -582
  147. package/dist/prompts/generate/unit-tests.js.map +0 -1
  148. package/dist/prompts/generate/wordpress-plugin.d.ts +0 -179
  149. package/dist/prompts/generate/wordpress-plugin.d.ts.map +0 -1
  150. package/dist/prompts/generate/wordpress-plugin.js +0 -767
  151. package/dist/prompts/generate/wordpress-plugin.js.map +0 -1
  152. package/dist/prompts/generate/wordpress-theme-from-static.d.ts +0 -177
  153. package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +0 -1
  154. package/dist/prompts/generate/wordpress-theme-from-static.js +0 -699
  155. package/dist/prompts/generate/wordpress-theme-from-static.js.map +0 -1
  156. package/dist/prompts/shared/cache-manager.d.ts +0 -45
  157. package/dist/prompts/shared/cache-manager.d.ts.map +0 -1
  158. package/dist/prompts/shared/cache-manager.js +0 -129
  159. package/dist/prompts/shared/cache-manager.js.map +0 -1
  160. package/dist/prompts/shared/helpers.d.ts +0 -39
  161. package/dist/prompts/shared/helpers.d.ts.map +0 -1
  162. package/dist/prompts/shared/helpers.js +0 -151
  163. package/dist/prompts/shared/helpers.js.map +0 -1
  164. package/dist/prompts/shared/templates.d.ts +0 -35
  165. package/dist/prompts/shared/templates.d.ts.map +0 -1
  166. package/dist/prompts/shared/templates.js +0 -77
  167. package/dist/prompts/shared/templates.js.map +0 -1
  168. package/dist/prompts/shared/types.d.ts +0 -112
  169. package/dist/prompts/shared/types.d.ts.map +0 -1
  170. package/dist/prompts/shared/types.js +0 -5
  171. package/dist/prompts/shared/types.js.map +0 -1
  172. package/dist/prompts/system/find-unused-files.d.ts +0 -106
  173. package/dist/prompts/system/find-unused-files.d.ts.map +0 -1
  174. package/dist/prompts/system/find-unused-files.js +0 -357
  175. package/dist/prompts/system/find-unused-files.js.map +0 -1
  176. package/dist/security/index.d.ts +0 -39
  177. package/dist/security/index.d.ts.map +0 -1
  178. package/dist/security/index.js +0 -46
  179. package/dist/security/index.js.map +0 -1
  180. package/dist/security/integration-helpers.d.ts +0 -121
  181. package/dist/security/integration-helpers.d.ts.map +0 -1
  182. package/dist/security/integration-helpers.js +0 -190
  183. package/dist/security/integration-helpers.js.map +0 -1
  184. package/dist/security/output-encoder.d.ts +0 -94
  185. package/dist/security/output-encoder.d.ts.map +0 -1
  186. package/dist/security/output-encoder.js +0 -295
  187. package/dist/security/output-encoder.js.map +0 -1
  188. package/dist/security/prompt-injection-guard.d.ts +0 -59
  189. package/dist/security/prompt-injection-guard.d.ts.map +0 -1
  190. package/dist/security/prompt-injection-guard.js +0 -249
  191. package/dist/security/prompt-injection-guard.js.map +0 -1
  192. package/dist/security/sanitisation.d.ts +0 -67
  193. package/dist/security/sanitisation.d.ts.map +0 -1
  194. package/dist/security/sanitisation.js +0 -398
  195. package/dist/security/sanitisation.js.map +0 -1
  196. package/dist/security/security-service.d.ts +0 -103
  197. package/dist/security/security-service.d.ts.map +0 -1
  198. package/dist/security/security-service.js +0 -303
  199. package/dist/security/security-service.js.map +0 -1
  200. package/dist/security-config.d.ts +0 -45
  201. package/dist/security-config.d.ts.map +0 -1
  202. package/dist/security-config.js +0 -63
  203. package/dist/security-config.js.map +0 -1
  204. package/dist/system/function-list.d.ts +0 -61
  205. package/dist/system/function-list.d.ts.map +0 -1
  206. package/dist/system/function-list.js +0 -111
  207. package/dist/system/function-list.js.map +0 -1
  208. package/dist/system/function-registry.d.ts +0 -23
  209. package/dist/system/function-registry.d.ts.map +0 -1
  210. package/dist/system/function-registry.js +0 -136
  211. package/dist/system/function-registry.js.map +0 -1
  212. package/dist/system/health-check.d.ts +0 -33
  213. package/dist/system/health-check.d.ts.map +0 -1
  214. package/dist/system/health-check.js +0 -98
  215. package/dist/system/health-check.js.map +0 -1
  216. package/dist/system/path-resolver.d.ts +0 -55
  217. package/dist/system/path-resolver.d.ts.map +0 -1
  218. package/dist/system/path-resolver.js +0 -90
  219. package/dist/system/path-resolver.js.map +0 -1
  220. package/dist/templates/plugin-template.d.ts +0 -121
  221. package/dist/templates/plugin-template.d.ts.map +0 -1
  222. package/dist/templates/plugin-template.js +0 -454
  223. package/dist/templates/plugin-template.js.map +0 -1
  224. package/dist/types/chunking-types.d.ts +0 -88
  225. package/dist/types/chunking-types.d.ts.map +0 -1
  226. package/dist/types/chunking-types.js +0 -18
  227. package/dist/types/chunking-types.js.map +0 -1
  228. package/dist/types/prompt-stages.d.ts +0 -30
  229. package/dist/types/prompt-stages.d.ts.map +0 -1
  230. package/dist/types/prompt-stages.js +0 -6
  231. package/dist/types/prompt-stages.js.map +0 -1
  232. package/dist/types.d.ts +0 -45
  233. package/dist/types.d.ts.map +0 -1
  234. package/dist/types.js +0 -6
  235. package/dist/types.js.map +0 -1
  236. package/dist/utils/css-parser.d.ts +0 -26
  237. package/dist/utils/css-parser.d.ts.map +0 -1
  238. package/dist/utils/css-parser.js +0 -117
  239. package/dist/utils/css-parser.js.map +0 -1
  240. package/dist/utils/path-resolver.d.ts +0 -13
  241. package/dist/utils/path-resolver.d.ts.map +0 -1
  242. package/dist/utils/path-resolver.js +0 -78
  243. package/dist/utils/path-resolver.js.map +0 -1
  244. package/dist/utils/plugin-utilities.d.ts +0 -176
  245. package/dist/utils/plugin-utilities.d.ts.map +0 -1
  246. package/dist/utils/plugin-utilities.js +0 -269
  247. package/dist/utils/plugin-utilities.js.map +0 -1
  248. package/dist/utils/streamHandler.d.ts +0 -3
  249. package/dist/utils/streamHandler.d.ts.map +0 -1
  250. package/dist/utils/streamHandler.js +0 -137
  251. package/dist/utils/streamHandler.js.map +0 -1
  252. package/dist/validation/output-validator.d.ts +0 -136
  253. package/dist/validation/output-validator.d.ts.map +0 -1
  254. package/dist/validation/output-validator.js +0 -262
  255. package/dist/validation/output-validator.js.map +0 -1
  256. package/dist/validation/response-factory.d.ts +0 -44
  257. package/dist/validation/response-factory.d.ts.map +0 -1
  258. package/dist/validation/response-factory.js +0 -202
  259. package/dist/validation/response-factory.js.map +0 -1
  260. package/dist/validation/schemas.d.ts +0 -519
  261. package/dist/validation/schemas.d.ts.map +0 -1
  262. package/dist/validation/schemas.js +0 -6
  263. package/dist/validation/schemas.js.map +0 -1
@@ -1,437 +0,0 @@
1
- /**
2
- * Plugin Template - Modern v4.3 (Improved)
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, TokenCalculator } from '../../utils/plugin-utilities.js';
14
- import { getAnalysisCache } from '../../cache/index.js';
15
- // Common Node.js modules - Use these instead of require()
16
- import { basename, extname, relative } from 'path';
17
- export class CodeQualityAnalyzer extends BasePlugin {
18
- constructor() {
19
- super();
20
- this.name = 'analyze_code_quality';
21
- this.category = 'analyze';
22
- this.description = 'Analyze code quality including complexity, maintainability, and best practices adherence';
23
- // Universal parameter set - supports both single and multi-file scenarios
24
- this.parameters = {
25
- // Single-file parameters
26
- code: {
27
- type: 'string',
28
- description: 'The code to analyze (for single-file analysis)',
29
- required: false
30
- },
31
- filePath: {
32
- type: 'string',
33
- description: 'Path to single file to analyze',
34
- required: false
35
- },
36
- // Multi-file parameters
37
- projectPath: {
38
- type: 'string',
39
- description: 'Path to project root (for multi-file analysis)',
40
- required: false
41
- },
42
- files: {
43
- type: 'array',
44
- description: 'Array of specific file paths (for multi-file analysis)',
45
- required: false,
46
- items: { type: 'string' }
47
- },
48
- maxDepth: {
49
- type: 'number',
50
- description: 'Maximum directory depth for multi-file discovery (1-5)',
51
- required: false,
52
- default: 3
53
- },
54
- // Universal parameters
55
- language: {
56
- type: 'string',
57
- description: 'Programming language',
58
- required: false,
59
- default: 'javascript'
60
- },
61
- analysisDepth: {
62
- type: 'string',
63
- description: 'Level of analysis detail',
64
- enum: ['basic', 'detailed', 'comprehensive'],
65
- default: 'detailed',
66
- required: false
67
- },
68
- analysisType: {
69
- type: 'string',
70
- description: 'Type of analysis to perform',
71
- enum: ['complexity', 'maintainability', 'comprehensive'],
72
- default: 'comprehensive',
73
- required: false
74
- }
75
- };
76
- this.analysisCache = getAnalysisCache();
77
- this.multiFileAnalysis = new MultiFileAnalysis();
78
- // Cache and analysis utilities are initialized above
79
- }
80
- async execute(params, llmClient) {
81
- return await withSecurity(this, params, llmClient, async (secureParams) => {
82
- try {
83
- // 1. Auto-detect analysis mode based on parameters
84
- const analysisMode = this.detectAnalysisMode(secureParams);
85
- // 2. Validate parameters based on detected mode
86
- this.validateParameters(secureParams, analysisMode);
87
- // 3. Setup model
88
- const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
89
- // 4. Route to appropriate analysis method
90
- if (analysisMode === 'single-file') {
91
- return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
92
- }
93
- else {
94
- return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
95
- }
96
- }
97
- catch (error) {
98
- return ErrorHandler.createExecutionError('analyze_code_quality', error);
99
- }
100
- });
101
- }
102
- /**
103
- * Auto-detect whether this is single-file or multi-file analysis
104
- *
105
- * DETECTION GUIDE:
106
- * Single-file: code, filePath provided → analyze individual file
107
- * Multi-file: projectPath, files, maxDepth provided → analyze project/multiple files
108
- * Default: Choose based on your plugin's primary use case
109
- */
110
- detectAnalysisMode(params) {
111
- // Single-file indicators take priority
112
- if (params.code || params.filePath) {
113
- return 'single-file';
114
- }
115
- // Multi-file indicators
116
- if (params.projectPath || params.files) {
117
- return 'multi-file';
118
- }
119
- // For code quality, default to single-file (analyze individual files)
120
- return 'single-file';
121
- }
122
- /**
123
- * Validate parameters based on detected analysis mode
124
- */
125
- validateParameters(params, mode) {
126
- if (mode === 'single-file') {
127
- ParameterValidator.validateCodeOrFile(params);
128
- }
129
- else {
130
- ParameterValidator.validateProjectPath(params);
131
- ParameterValidator.validateDepth(params);
132
- }
133
- // Universal validations
134
- ParameterValidator.validateEnum(params, 'analysisType', ['complexity', 'maintainability', 'comprehensive']);
135
- ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
136
- }
137
- /**
138
- * Execute single-file analysis
139
- */
140
- async executeSingleFileAnalysis(params, model, contextLength) {
141
- // Process single file input
142
- let codeToAnalyze = params.code;
143
- if (params.filePath) {
144
- codeToAnalyze = await readFileContent(params.filePath);
145
- }
146
- // Generate prompt stages for single file
147
- const promptStages = this.getSingleFilePromptStages({
148
- ...params,
149
- code: codeToAnalyze
150
- });
151
- // Execute with appropriate method
152
- const promptManager = new ThreeStagePromptManager();
153
- const needsChunking = TokenCalculator.needsChunking(promptStages, contextLength);
154
- if (needsChunking) {
155
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
156
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
157
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
158
- const messages = [
159
- conversation.systemMessage,
160
- ...conversation.dataMessages,
161
- conversation.analysisMessage
162
- ];
163
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'analyze_code_quality', 'single');
164
- }
165
- else {
166
- return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'analyze_code_quality');
167
- }
168
- }
169
- /**
170
- * Execute multi-file analysis
171
- */
172
- async executeMultiFileAnalysis(params, model, contextLength) {
173
- // Discover files
174
- let filesToAnalyze = params.files ||
175
- await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.analysisType);
176
- // Perform multi-file analysis with caching
177
- const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
178
- // Generate prompt stages for multi-file
179
- const promptStages = this.getMultiFilePromptStages({
180
- ...params,
181
- analysisResult,
182
- fileCount: filesToAnalyze.length
183
- });
184
- // Always use chunking for multi-file
185
- const promptManager = new ThreeStagePromptManager();
186
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
187
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
188
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
189
- const messages = [
190
- conversation.systemMessage,
191
- ...conversation.dataMessages,
192
- conversation.analysisMessage
193
- ];
194
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'analyze_code_quality', 'multifile');
195
- }
196
- /**
197
- * Single-file code quality analysis
198
- */
199
- getSingleFilePromptStages(params) {
200
- const { code, language, analysisDepth, analysisType } = params;
201
- const systemAndContext = `You are an expert code quality analyst specializing in ${analysisDepth} ${analysisType} analysis.
202
-
203
- Analysis Context:
204
- - Language: ${language}
205
- - Analysis Depth: ${analysisDepth}
206
- - Analysis Type: ${analysisType}
207
- - Mode: Single File Quality Analysis
208
-
209
- Your task is to analyze code quality metrics including complexity, maintainability, readability, and adherence to best practices for this individual file.`;
210
- const dataPayload = `Code to analyze:
211
-
212
- \`\`\`${language}
213
- ${code}
214
- \`\`\``;
215
- const outputInstructions = `Provide comprehensive code quality analysis including:
216
-
217
- **Quality Assessment Overview**
218
- - Overall quality evaluation with numerical scoring out of 10
219
- - Complexity assessment focusing on cyclomatic complexity and maintainability
220
- - Readability evaluation covering naming conventions, code organization, and clarity
221
- - Maintainability score considering future modification ease
222
-
223
- **Detailed Quality Analysis**
224
- - Cyclomatic complexity assessment with specific complexity hotspots
225
- - Function and method length analysis identifying overly complex functions
226
- - Variable naming consistency and clarity evaluation
227
- - Code organization patterns and structural assessment
228
- - Documentation quality and inline comment effectiveness
229
-
230
- **Best Practices Adherence Evaluation**
231
- - SOLID principles compliance with specific examples and scoring
232
- - DRY principle adherence identifying code duplication patterns
233
- - Error handling consistency and robustness assessment
234
- - Language-specific best practices and idiom usage
235
- - Performance considerations and optimization opportunities
236
-
237
- **Quality Issues and Recommendations**
238
- - Critical quality issues requiring immediate attention with specific line references
239
- - Important improvements for maintainability and readability enhancement
240
- - Minor refinements and polish opportunities for code excellence
241
- - Prioritized recommendation list focusing on highest impact improvements first
242
-
243
- **Implementation Guidance**
244
- - Specific actionable steps for addressing identified quality issues
245
- - Code refactoring suggestions with examples where applicable
246
- - Long-term quality improvement strategies and practices
247
- - Confidence assessment of the analysis accuracy and completeness
248
-
249
- Focus on providing actionable insights that developers can implement immediately to improve code quality, maintainability, and team productivity.`;
250
- return { systemAndContext, dataPayload, outputInstructions };
251
- }
252
- /**
253
- * Multi-file project quality analysis
254
- */
255
- getMultiFilePromptStages(params) {
256
- const { analysisResult, analysisType, analysisDepth, fileCount } = params;
257
- const systemAndContext = `You are an expert project code quality analyst specializing in ${analysisDepth} ${analysisType} analysis.
258
-
259
- Analysis Context:
260
- - Analysis Type: ${analysisType}
261
- - Analysis Depth: ${analysisDepth}
262
- - Files Analyzed: ${fileCount}
263
- - Mode: Project-wide Quality Analysis
264
-
265
- Your task is to provide comprehensive code quality assessment across the entire project, identifying patterns, consistency issues, and quality metrics.`;
266
- const dataPayload = `Project quality analysis results:
267
-
268
- ${JSON.stringify(analysisResult, null, 2)}`;
269
- const outputInstructions = `Provide comprehensive project-wide code quality analysis including:
270
-
271
- **Project Quality Overview**
272
- - Overall project quality assessment with numerical scoring and quality maturity evaluation
273
- - Quality consistency analysis across the entire codebase identifying patterns and variations
274
- - Project maintainability assessment focusing on long-term sustainability and evolution capability
275
-
276
- **Quality Distribution Analysis**
277
- - Quality variance across files identifying high-performing and problematic areas
278
- - Consistency patterns in coding standards, naming conventions, and structural approaches
279
- - Quality hotspots requiring immediate attention and areas of excellence to replicate
280
-
281
- **Cross-File Quality Patterns**
282
- - Consistent quality patterns and practices implemented well across multiple files
283
- - Inconsistent areas showing quality variations that impact team productivity
284
- - Systematic quality issues affecting multiple components or architectural layers
285
- - Code quality trends and evolution patterns throughout the project structure
286
-
287
- **Strategic Quality Issues**
288
- - Critical systemic problems affecting multiple files requiring architectural attention
289
- - Quality consistency issues creating maintenance burden and reducing team velocity
290
- - Technical debt accumulation patterns and their impact on project sustainability
291
- - Cross-cutting concerns and quality patterns that span multiple modules or components
292
-
293
- **Project Quality Recommendations**
294
- - Immediate action items for addressing urgent quality problems across the project
295
- - Quality standards and coding guidelines recommendations for team adoption
296
- - Tooling and automation suggestions for maintaining consistent quality levels
297
- - Refactoring prioritization strategy focusing on highest impact quality improvements
298
- - Long-term quality improvement roadmap and architectural evolution guidance
299
-
300
- **Implementation Strategy**
301
- - Phase-based approach to implementing quality improvements across the project
302
- - Team adoption strategies for quality standards and best practices
303
- - Measurement and monitoring approaches for tracking quality improvements over time
304
- - Project quality maturity assessment and growth pathway recommendations
305
-
306
- Focus on providing strategic, actionable insights that improve overall project quality, team productivity, and long-term maintainability across the entire codebase.`;
307
- return { systemAndContext, dataPayload, outputInstructions };
308
- }
309
- /**
310
- * Backwards compatibility method
311
- */
312
- getPromptStages(params) {
313
- const mode = this.detectAnalysisMode(params);
314
- if (mode === 'single-file') {
315
- return this.getSingleFilePromptStages(params);
316
- }
317
- else {
318
- return this.getMultiFilePromptStages(params);
319
- }
320
- }
321
- // Multi-file helper methods
322
- async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
323
- const extensions = this.getFileExtensions(analysisType);
324
- return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
325
- }
326
- async performMultiFileAnalysis(files, params, model, contextLength) {
327
- const cacheKey = this.analysisCache.generateKey('analyze_code_quality', params, files);
328
- const cached = await this.analysisCache.get(cacheKey);
329
- if (cached)
330
- return cached;
331
- const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualFile(file, params, model), contextLength);
332
- // Aggregate results for quality analysis
333
- const aggregatedResult = {
334
- summary: `Code quality analysis of ${files.length} files`,
335
- findings: fileAnalysisResults,
336
- qualityMetrics: {
337
- totalFiles: files.length,
338
- averageComplexity: this.calculateAverageComplexity(fileAnalysisResults),
339
- qualityDistribution: this.analyzeQualityDistribution(fileAnalysisResults),
340
- commonIssues: this.identifyCommonIssues(fileAnalysisResults)
341
- }
342
- };
343
- await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
344
- modelUsed: model.identifier || 'unknown',
345
- executionTime: Date.now() - Date.now(),
346
- timestamp: new Date().toISOString()
347
- });
348
- return aggregatedResult;
349
- }
350
- async analyzeIndividualFile(file, params, model) {
351
- const content = await import('fs/promises').then(fs => fs.readFile(file, 'utf-8'));
352
- const stats = await import('fs/promises').then(fs => fs.stat(file));
353
- return {
354
- filePath: file,
355
- fileName: basename(file), // ✅ Use imported basename instead of require('path').basename
356
- size: content.length,
357
- lines: content.split('\n').length,
358
- extension: extname(file), // ✅ Use imported extname
359
- relativePath: relative(params.projectPath || '', file), // ✅ Use imported relative
360
- complexity: this.estimateComplexity(content),
361
- qualityScore: this.estimateQualityScore(content)
362
- };
363
- }
364
- getFileExtensions(analysisType) {
365
- // Updated extensions for code quality analysis
366
- const extensionMap = {
367
- 'complexity': ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs'],
368
- 'maintainability': ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs', '.php'],
369
- 'comprehensive': ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs', '.php', '.rb', '.go']
370
- };
371
- return extensionMap[analysisType] || extensionMap.comprehensive;
372
- }
373
- // Quality analysis helper methods
374
- estimateComplexity(content) {
375
- const complexityPatterns = [
376
- /if\s*\(/g, /else/g, /while\s*\(/g, /for\s*\(/g,
377
- /switch\s*\(/g, /case\s+/g, /catch\s*\(/g, /\?\s*:/g
378
- ];
379
- let complexity = 1;
380
- complexityPatterns.forEach(pattern => {
381
- const matches = content.match(pattern);
382
- if (matches) {
383
- complexity += matches.length;
384
- }
385
- });
386
- return complexity;
387
- }
388
- estimateQualityScore(content) {
389
- let score = 10; // Start with perfect score
390
- // Deduct points for quality issues
391
- if (content.includes('console.log'))
392
- score -= 1; // Debug statements
393
- if (content.includes('TODO') || content.includes('FIXME'))
394
- score -= 1; // Incomplete code
395
- if (content.length > 1000 && !content.includes('\n\n'))
396
- score -= 1; // Lack of spacing
397
- if (!/\/\*\*|\*\/|\/\//.test(content))
398
- score -= 2; // No comments
399
- return Math.max(0, score);
400
- }
401
- calculateAverageComplexity(results) {
402
- const totalComplexity = results.reduce((sum, result) => sum + (result.complexity || 0), 0);
403
- return results.length > 0 ? totalComplexity / results.length : 0;
404
- }
405
- analyzeQualityDistribution(results) {
406
- const distribution = { high: 0, medium: 0, low: 0 };
407
- results.forEach(result => {
408
- const score = result.qualityScore || 0;
409
- if (score >= 8)
410
- distribution.high++;
411
- else if (score >= 6)
412
- distribution.medium++;
413
- else
414
- distribution.low++;
415
- });
416
- return distribution;
417
- }
418
- identifyCommonIssues(results) {
419
- const issues = [];
420
- const highComplexityFiles = results.filter(r => (r.complexity || 0) > 10).length;
421
- if (highComplexityFiles > results.length * 0.2) {
422
- issues.push('High complexity in multiple files');
423
- }
424
- const lowQualityFiles = results.filter(r => (r.qualityScore || 0) < 6).length;
425
- if (lowQualityFiles > results.length * 0.1) {
426
- issues.push('Quality issues across multiple files');
427
- }
428
- return issues;
429
- }
430
- generateCacheKey(files, params) {
431
- const fileHash = files.join('|');
432
- const paramHash = JSON.stringify(params);
433
- return `${fileHash}_${paramHash}`.substring(0, 64);
434
- }
435
- }
436
- export default CodeQualityAnalyzer;
437
- //# sourceMappingURL=code-quality.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-quality.js","sourceRoot":"","sources":["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AAG,GAAG,EAAE,CAAC;YAC/C,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9E,IAAI,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,gBAAgB,CAAC,KAAe,EAAE,MAAW;QACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACzC,OAAO,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;CACF;AAED,eAAe,mBAAmB,CAAC"}
@@ -1,130 +0,0 @@
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 { IPromptPlugin } from '../shared/types.js';
11
- import { PromptStages } from '../../types/prompt-stages.js';
12
- export declare class IntegrationComparator 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
- default: number;
45
- };
46
- language: {
47
- type: "string";
48
- description: string;
49
- required: boolean;
50
- default: string;
51
- };
52
- analysisDepth: {
53
- type: "string";
54
- description: string;
55
- enum: string[];
56
- default: string;
57
- required: boolean;
58
- };
59
- analysisType: {
60
- type: "string";
61
- description: string;
62
- enum: string[];
63
- default: string;
64
- required: boolean;
65
- };
66
- focus: {
67
- type: "array";
68
- description: string;
69
- required: boolean;
70
- default: any[];
71
- items: {
72
- type: "string";
73
- };
74
- };
75
- };
76
- private analysisCache;
77
- private multiFileAnalysis;
78
- constructor();
79
- execute(params: any, llmClient: any): Promise<any>;
80
- /**
81
- * Auto-detect whether this is single-file or multi-file analysis
82
- * Integration comparison is primarily a multi-file operation
83
- */
84
- private detectAnalysisMode;
85
- /**
86
- * Validate parameters based on detected analysis mode
87
- */
88
- private validateParameters;
89
- /**
90
- * Execute single-file analysis for integration patterns
91
- */
92
- private executeSingleFileAnalysis;
93
- /**
94
- * Execute multi-file analysis for cross-file integration
95
- */
96
- private executeMultiFileAnalysis;
97
- /**
98
- * Single-file integration pattern analysis
99
- */
100
- private getSingleFilePromptStages;
101
- /**
102
- * Multi-file cross-integration analysis
103
- */
104
- private getMultiFilePromptStages;
105
- /**
106
- * Backwards compatibility method
107
- */
108
- getPromptStages(params: any): PromptStages;
109
- private discoverRelevantFiles;
110
- private performMultiFileAnalysis;
111
- private analyzeIndividualFile;
112
- private countExports;
113
- private countImports;
114
- private countMethods;
115
- private countInterfaces;
116
- private identifyIntegrationPatterns;
117
- private identifyPotentialIssues;
118
- private extractExports;
119
- private extractImports;
120
- private extractMethods;
121
- private extractInterfaces;
122
- private extractFileImports;
123
- private extractFileExports;
124
- private extractFileMethods;
125
- private extractFileInterfaces;
126
- private getFileExtensions;
127
- private generateCacheKey;
128
- }
129
- export default IntegrationComparator;
130
- //# sourceMappingURL=compare-integration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compare-integration.d.ts","sourceRoot":"","sources":["../../../src/prompts/analyze/compare-integration.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;AAa5D,qBAAa,qBAAsB,SAAQ,UAAW,YAAW,aAAa;IAC5E,IAAI,SAAyB;IAC7B,QAAQ,EAAG,SAAS,CAAU;IAC9B,WAAW,SAA+J;IAG1K,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4DR;IAEF,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,iBAAiB,CAA2B;;IAO9C,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG;IAyBzC;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAmB1B;;OAEG;YACW,yBAAyB;IA4CvC;;OAEG;YACW,wBAAwB;IA4CtC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAwDjC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmGhC;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,YAAY;YAW5B,qBAAqB;YASrB,wBAAwB;YAsDxB,qBAAqB;IA2BnC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,2BAA2B;IAenC,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,iBAAiB;IAKz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