@houtini/lm 1.0.13 → 2.0.1

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 (264) hide show
  1. package/README.md +67 -237
  2. package/dist/index.d.ts +5 -3
  3. package/dist/index.js +149 -213
  4. package/dist/index.js.map +1 -1
  5. package/package.json +23 -32
  6. package/server.json +44 -0
  7. package/CHANGELOG.md +0 -282
  8. package/dist/cache/analysis-cache.d.ts +0 -33
  9. package/dist/cache/analysis-cache.d.ts.map +0 -1
  10. package/dist/cache/analysis-cache.js +0 -56
  11. package/dist/cache/analysis-cache.js.map +0 -1
  12. package/dist/cache/cache-manager.d.ts +0 -29
  13. package/dist/cache/cache-manager.d.ts.map +0 -1
  14. package/dist/cache/cache-manager.js +0 -85
  15. package/dist/cache/cache-manager.js.map +0 -1
  16. package/dist/cache/index.d.ts +0 -16
  17. package/dist/cache/index.d.ts.map +0 -1
  18. package/dist/cache/index.js +0 -17
  19. package/dist/cache/index.js.map +0 -1
  20. package/dist/cache/prompt-cache.d.ts +0 -33
  21. package/dist/cache/prompt-cache.d.ts.map +0 -1
  22. package/dist/cache/prompt-cache.js +0 -61
  23. package/dist/cache/prompt-cache.js.map +0 -1
  24. package/dist/config.d.ts +0 -41
  25. package/dist/config.d.ts.map +0 -1
  26. package/dist/config.js +0 -71
  27. package/dist/config.js.map +0 -1
  28. package/dist/core/ThreeStagePromptManager.d.ts +0 -23
  29. package/dist/core/ThreeStagePromptManager.d.ts.map +0 -1
  30. package/dist/core/ThreeStagePromptManager.js +0 -118
  31. package/dist/core/ThreeStagePromptManager.js.map +0 -1
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/plugins/base-plugin.d.ts +0 -55
  34. package/dist/plugins/base-plugin.d.ts.map +0 -1
  35. package/dist/plugins/base-plugin.js +0 -120
  36. package/dist/plugins/base-plugin.js.map +0 -1
  37. package/dist/plugins/index.d.ts +0 -58
  38. package/dist/plugins/index.d.ts.map +0 -1
  39. package/dist/plugins/index.js +0 -162
  40. package/dist/plugins/index.js.map +0 -1
  41. package/dist/plugins/types.d.ts +0 -5
  42. package/dist/plugins/types.d.ts.map +0 -1
  43. package/dist/plugins/types.js +0 -5
  44. package/dist/plugins/types.js.map +0 -1
  45. package/dist/prompts/analyze/code-quality.d.ts +0 -116
  46. package/dist/prompts/analyze/code-quality.d.ts.map +0 -1
  47. package/dist/prompts/analyze/code-quality.js +0 -437
  48. package/dist/prompts/analyze/code-quality.js.map +0 -1
  49. package/dist/prompts/analyze/compare-integration.d.ts +0 -130
  50. package/dist/prompts/analyze/compare-integration.d.ts.map +0 -1
  51. package/dist/prompts/analyze/compare-integration.js +0 -547
  52. package/dist/prompts/analyze/compare-integration.js.map +0 -1
  53. package/dist/prompts/analyze/count-files.d.ts +0 -109
  54. package/dist/prompts/analyze/count-files.d.ts.map +0 -1
  55. package/dist/prompts/analyze/count-files.js +0 -403
  56. package/dist/prompts/analyze/count-files.js.map +0 -1
  57. package/dist/prompts/analyze/database-queries.d.ts +0 -156
  58. package/dist/prompts/analyze/database-queries.d.ts.map +0 -1
  59. package/dist/prompts/analyze/database-queries.js +0 -763
  60. package/dist/prompts/analyze/database-queries.js.map +0 -1
  61. package/dist/prompts/analyze/dependencies.d.ts +0 -97
  62. package/dist/prompts/analyze/dependencies.d.ts.map +0 -1
  63. package/dist/prompts/analyze/dependencies.js +0 -337
  64. package/dist/prompts/analyze/dependencies.js.map +0 -1
  65. package/dist/prompts/analyze/diff-signatures.d.ts +0 -139
  66. package/dist/prompts/analyze/diff-signatures.d.ts.map +0 -1
  67. package/dist/prompts/analyze/diff-signatures.js +0 -708
  68. package/dist/prompts/analyze/diff-signatures.js.map +0 -1
  69. package/dist/prompts/analyze/find-patterns.d.ts +0 -128
  70. package/dist/prompts/analyze/find-patterns.d.ts.map +0 -1
  71. package/dist/prompts/analyze/find-patterns.js +0 -524
  72. package/dist/prompts/analyze/find-patterns.js.map +0 -1
  73. package/dist/prompts/analyze/find-unused-css.d.ts +0 -151
  74. package/dist/prompts/analyze/find-unused-css.d.ts.map +0 -1
  75. package/dist/prompts/analyze/find-unused-css.js +0 -760
  76. package/dist/prompts/analyze/find-unused-css.js.map +0 -1
  77. package/dist/prompts/analyze/n8n-workflow.d.ts +0 -137
  78. package/dist/prompts/analyze/n8n-workflow.d.ts.map +0 -1
  79. package/dist/prompts/analyze/n8n-workflow.js +0 -533
  80. package/dist/prompts/analyze/n8n-workflow.js.map +0 -1
  81. package/dist/prompts/analyze/project-structure.d.ts +0 -126
  82. package/dist/prompts/analyze/project-structure.d.ts.map +0 -1
  83. package/dist/prompts/analyze/project-structure.js +0 -573
  84. package/dist/prompts/analyze/project-structure.js.map +0 -1
  85. package/dist/prompts/analyze/security-audit.d.ts +0 -142
  86. package/dist/prompts/analyze/security-audit.d.ts.map +0 -1
  87. package/dist/prompts/analyze/security-audit.js +0 -641
  88. package/dist/prompts/analyze/security-audit.js.map +0 -1
  89. package/dist/prompts/analyze/single-file.d.ts +0 -162
  90. package/dist/prompts/analyze/single-file.d.ts.map +0 -1
  91. package/dist/prompts/analyze/single-file.js +0 -669
  92. package/dist/prompts/analyze/single-file.js.map +0 -1
  93. package/dist/prompts/analyze/trace-execution.d.ts +0 -126
  94. package/dist/prompts/analyze/trace-execution.d.ts.map +0 -1
  95. package/dist/prompts/analyze/trace-execution.js +0 -613
  96. package/dist/prompts/analyze/trace-execution.js.map +0 -1
  97. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +0 -116
  98. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +0 -1
  99. package/dist/prompts/analyze/wordpress-plugin-audit.js +0 -456
  100. package/dist/prompts/analyze/wordpress-plugin-audit.js.map +0 -1
  101. package/dist/prompts/analyze/wordpress-plugin-readiness.d.ts +0 -103
  102. package/dist/prompts/analyze/wordpress-plugin-readiness.d.ts.map +0 -1
  103. package/dist/prompts/analyze/wordpress-plugin-readiness.js +0 -506
  104. package/dist/prompts/analyze/wordpress-plugin-readiness.js.map +0 -1
  105. package/dist/prompts/analyze/wordpress-security.d.ts +0 -146
  106. package/dist/prompts/analyze/wordpress-security.d.ts.map +0 -1
  107. package/dist/prompts/analyze/wordpress-security.js +0 -702
  108. package/dist/prompts/analyze/wordpress-security.js.map +0 -1
  109. package/dist/prompts/analyze/wordpress-theme-audit.d.ts +0 -114
  110. package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +0 -1
  111. package/dist/prompts/analyze/wordpress-theme-audit.js +0 -540
  112. package/dist/prompts/analyze/wordpress-theme-audit.js.map +0 -1
  113. package/dist/prompts/custom/custom-prompt.d.ts +0 -135
  114. package/dist/prompts/custom/custom-prompt.d.ts.map +0 -1
  115. package/dist/prompts/custom/custom-prompt.js +0 -421
  116. package/dist/prompts/custom/custom-prompt.js.map +0 -1
  117. package/dist/prompts/fun/arcade-game.d.ts +0 -152
  118. package/dist/prompts/fun/arcade-game.d.ts.map +0 -1
  119. package/dist/prompts/fun/arcade-game.js +0 -657
  120. package/dist/prompts/fun/arcade-game.js.map +0 -1
  121. package/dist/prompts/fun/create_text_adventure.d.ts +0 -100
  122. package/dist/prompts/fun/create_text_adventure.d.ts.map +0 -1
  123. package/dist/prompts/fun/create_text_adventure.js +0 -401
  124. package/dist/prompts/fun/create_text_adventure.js.map +0 -1
  125. package/dist/prompts/fun/css-art-generator.d.ts +0 -168
  126. package/dist/prompts/fun/css-art-generator.d.ts.map +0 -1
  127. package/dist/prompts/fun/css-art-generator.js +0 -831
  128. package/dist/prompts/fun/css-art-generator.js.map +0 -1
  129. package/dist/prompts/generate/project-documentation.d.ts +0 -137
  130. package/dist/prompts/generate/project-documentation.d.ts.map +0 -1
  131. package/dist/prompts/generate/project-documentation.js +0 -670
  132. package/dist/prompts/generate/project-documentation.js.map +0 -1
  133. package/dist/prompts/generate/refactoring.d.ts +0 -164
  134. package/dist/prompts/generate/refactoring.d.ts.map +0 -1
  135. package/dist/prompts/generate/refactoring.js +0 -625
  136. package/dist/prompts/generate/refactoring.js.map +0 -1
  137. package/dist/prompts/generate/responsive-component.d.ts +0 -147
  138. package/dist/prompts/generate/responsive-component.d.ts.map +0 -1
  139. package/dist/prompts/generate/responsive-component.js +0 -957
  140. package/dist/prompts/generate/responsive-component.js.map +0 -1
  141. package/dist/prompts/generate/typescript-conversion.d.ts +0 -144
  142. package/dist/prompts/generate/typescript-conversion.d.ts.map +0 -1
  143. package/dist/prompts/generate/typescript-conversion.js +0 -531
  144. package/dist/prompts/generate/typescript-conversion.js.map +0 -1
  145. package/dist/prompts/generate/unit-tests.d.ts +0 -139
  146. package/dist/prompts/generate/unit-tests.d.ts.map +0 -1
  147. package/dist/prompts/generate/unit-tests.js +0 -582
  148. package/dist/prompts/generate/unit-tests.js.map +0 -1
  149. package/dist/prompts/generate/wordpress-plugin.d.ts +0 -179
  150. package/dist/prompts/generate/wordpress-plugin.d.ts.map +0 -1
  151. package/dist/prompts/generate/wordpress-plugin.js +0 -767
  152. package/dist/prompts/generate/wordpress-plugin.js.map +0 -1
  153. package/dist/prompts/generate/wordpress-theme-from-static.d.ts +0 -177
  154. package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +0 -1
  155. package/dist/prompts/generate/wordpress-theme-from-static.js +0 -699
  156. package/dist/prompts/generate/wordpress-theme-from-static.js.map +0 -1
  157. package/dist/prompts/shared/cache-manager.d.ts +0 -45
  158. package/dist/prompts/shared/cache-manager.d.ts.map +0 -1
  159. package/dist/prompts/shared/cache-manager.js +0 -129
  160. package/dist/prompts/shared/cache-manager.js.map +0 -1
  161. package/dist/prompts/shared/helpers.d.ts +0 -39
  162. package/dist/prompts/shared/helpers.d.ts.map +0 -1
  163. package/dist/prompts/shared/helpers.js +0 -151
  164. package/dist/prompts/shared/helpers.js.map +0 -1
  165. package/dist/prompts/shared/templates.d.ts +0 -35
  166. package/dist/prompts/shared/templates.d.ts.map +0 -1
  167. package/dist/prompts/shared/templates.js +0 -77
  168. package/dist/prompts/shared/templates.js.map +0 -1
  169. package/dist/prompts/shared/types.d.ts +0 -112
  170. package/dist/prompts/shared/types.d.ts.map +0 -1
  171. package/dist/prompts/shared/types.js +0 -5
  172. package/dist/prompts/shared/types.js.map +0 -1
  173. package/dist/prompts/system/find-unused-files.d.ts +0 -106
  174. package/dist/prompts/system/find-unused-files.d.ts.map +0 -1
  175. package/dist/prompts/system/find-unused-files.js +0 -357
  176. package/dist/prompts/system/find-unused-files.js.map +0 -1
  177. package/dist/security/index.d.ts +0 -39
  178. package/dist/security/index.d.ts.map +0 -1
  179. package/dist/security/index.js +0 -46
  180. package/dist/security/index.js.map +0 -1
  181. package/dist/security/integration-helpers.d.ts +0 -121
  182. package/dist/security/integration-helpers.d.ts.map +0 -1
  183. package/dist/security/integration-helpers.js +0 -190
  184. package/dist/security/integration-helpers.js.map +0 -1
  185. package/dist/security/output-encoder.d.ts +0 -94
  186. package/dist/security/output-encoder.d.ts.map +0 -1
  187. package/dist/security/output-encoder.js +0 -295
  188. package/dist/security/output-encoder.js.map +0 -1
  189. package/dist/security/prompt-injection-guard.d.ts +0 -59
  190. package/dist/security/prompt-injection-guard.d.ts.map +0 -1
  191. package/dist/security/prompt-injection-guard.js +0 -249
  192. package/dist/security/prompt-injection-guard.js.map +0 -1
  193. package/dist/security/sanitisation.d.ts +0 -67
  194. package/dist/security/sanitisation.d.ts.map +0 -1
  195. package/dist/security/sanitisation.js +0 -398
  196. package/dist/security/sanitisation.js.map +0 -1
  197. package/dist/security/security-service.d.ts +0 -103
  198. package/dist/security/security-service.d.ts.map +0 -1
  199. package/dist/security/security-service.js +0 -303
  200. package/dist/security/security-service.js.map +0 -1
  201. package/dist/security-config.d.ts +0 -45
  202. package/dist/security-config.d.ts.map +0 -1
  203. package/dist/security-config.js +0 -63
  204. package/dist/security-config.js.map +0 -1
  205. package/dist/system/function-list.d.ts +0 -61
  206. package/dist/system/function-list.d.ts.map +0 -1
  207. package/dist/system/function-list.js +0 -111
  208. package/dist/system/function-list.js.map +0 -1
  209. package/dist/system/function-registry.d.ts +0 -23
  210. package/dist/system/function-registry.d.ts.map +0 -1
  211. package/dist/system/function-registry.js +0 -136
  212. package/dist/system/function-registry.js.map +0 -1
  213. package/dist/system/health-check.d.ts +0 -33
  214. package/dist/system/health-check.d.ts.map +0 -1
  215. package/dist/system/health-check.js +0 -98
  216. package/dist/system/health-check.js.map +0 -1
  217. package/dist/system/path-resolver.d.ts +0 -55
  218. package/dist/system/path-resolver.d.ts.map +0 -1
  219. package/dist/system/path-resolver.js +0 -90
  220. package/dist/system/path-resolver.js.map +0 -1
  221. package/dist/templates/plugin-template.d.ts +0 -121
  222. package/dist/templates/plugin-template.d.ts.map +0 -1
  223. package/dist/templates/plugin-template.js +0 -454
  224. package/dist/templates/plugin-template.js.map +0 -1
  225. package/dist/types/chunking-types.d.ts +0 -88
  226. package/dist/types/chunking-types.d.ts.map +0 -1
  227. package/dist/types/chunking-types.js +0 -18
  228. package/dist/types/chunking-types.js.map +0 -1
  229. package/dist/types/prompt-stages.d.ts +0 -30
  230. package/dist/types/prompt-stages.d.ts.map +0 -1
  231. package/dist/types/prompt-stages.js +0 -6
  232. package/dist/types/prompt-stages.js.map +0 -1
  233. package/dist/types.d.ts +0 -45
  234. package/dist/types.d.ts.map +0 -1
  235. package/dist/types.js +0 -6
  236. package/dist/types.js.map +0 -1
  237. package/dist/utils/css-parser.d.ts +0 -26
  238. package/dist/utils/css-parser.d.ts.map +0 -1
  239. package/dist/utils/css-parser.js +0 -117
  240. package/dist/utils/css-parser.js.map +0 -1
  241. package/dist/utils/path-resolver.d.ts +0 -13
  242. package/dist/utils/path-resolver.d.ts.map +0 -1
  243. package/dist/utils/path-resolver.js +0 -78
  244. package/dist/utils/path-resolver.js.map +0 -1
  245. package/dist/utils/plugin-utilities.d.ts +0 -176
  246. package/dist/utils/plugin-utilities.d.ts.map +0 -1
  247. package/dist/utils/plugin-utilities.js +0 -269
  248. package/dist/utils/plugin-utilities.js.map +0 -1
  249. package/dist/utils/streamHandler.d.ts +0 -3
  250. package/dist/utils/streamHandler.d.ts.map +0 -1
  251. package/dist/utils/streamHandler.js +0 -137
  252. package/dist/utils/streamHandler.js.map +0 -1
  253. package/dist/validation/output-validator.d.ts +0 -136
  254. package/dist/validation/output-validator.d.ts.map +0 -1
  255. package/dist/validation/output-validator.js +0 -262
  256. package/dist/validation/output-validator.js.map +0 -1
  257. package/dist/validation/response-factory.d.ts +0 -44
  258. package/dist/validation/response-factory.d.ts.map +0 -1
  259. package/dist/validation/response-factory.js +0 -202
  260. package/dist/validation/response-factory.js.map +0 -1
  261. package/dist/validation/schemas.d.ts +0 -519
  262. package/dist/validation/schemas.d.ts.map +0 -1
  263. package/dist/validation/schemas.js +0 -6
  264. package/dist/validation/schemas.js.map +0 -1
@@ -1,454 +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
- * ⚠️ CRITICAL: OUTPUT INSTRUCTIONS MUST USE NATURAL LANGUAGE, NOT JSON SCHEMAS! ⚠️
10
- *
11
- * The ResponseFactory automatically handles all JSON formatting. If you put JSON schemas
12
- * in outputInstructions, you'll get double-processing and escaped content. Always use
13
- * natural language instructions that describe WHAT you want, not HOW to format it.
14
- *
15
- * ✅ GOOD: "Provide a comprehensive analysis including structure, quality metrics..."
16
- * ❌ BAD: '{ "summary": "...", "structure": {...} }' (causes escaping issues)
17
- */
18
- // TEMPLATE: Update these import paths based on where you place your plugin:
19
- // For analyze/ plugins: use '../../plugins/', '../shared/', '../../core/', etc.
20
- // For generate/ plugins: use '../../plugins/', '../shared/', '../../core/', etc.
21
- // For system/ plugins: use '../../plugins/', '../shared/', '../../core/', etc.
22
- // For custom/ plugins: use '../../plugins/', '../shared/', '../../core/', etc.
23
- // For fun/ plugins: use '../../plugins/', '../shared/', '../../core/', etc.
24
- // THESE ARE TEMPLATE INSTRUCTIONS - The actual imports below are correct for this template file
25
- import { BasePlugin } from '../plugins/base-plugin.js';
26
- import { ThreeStagePromptManager } from '../core/ThreeStagePromptManager.js';
27
- import { withSecurity } from '../security/integration-helpers.js';
28
- import { readFileContent } from '../prompts/shared/helpers.js';
29
- import { ModelSetup, TokenCalculator, ResponseProcessor, ParameterValidator, ErrorHandler, MultiFileAnalysis } from '../utils/plugin-utilities.js';
30
- import { getAnalysisCache } from '../cache/index.js';
31
- // Common Node.js modules - Use these instead of require()
32
- import { basename, extname, relative } from 'path';
33
- export class TEMPLATE_UniversalPlugin extends BasePlugin {
34
- constructor() {
35
- super();
36
- this.name = 'TEMPLATE_function_name';
37
- this.category = 'analyze'; // TEMPLATE: Change to 'analyze' | 'generate' | 'multifile' | 'system' | 'custom'
38
- this.description = 'TEMPLATE: Describe what this plugin does (handles both single and multi-file)';
39
- // Universal parameter set - supports both single and multi-file scenarios
40
- this.parameters = {
41
- // Single-file parameters
42
- code: {
43
- type: 'string',
44
- description: 'The code to analyze (for single-file analysis)',
45
- required: false
46
- },
47
- filePath: {
48
- type: 'string',
49
- description: 'Path to single file to analyze',
50
- required: false
51
- },
52
- // Multi-file parameters
53
- projectPath: {
54
- type: 'string',
55
- description: 'Path to project root (for multi-file analysis)',
56
- required: false
57
- },
58
- files: {
59
- type: 'array',
60
- description: 'Array of specific file paths (for multi-file analysis)',
61
- required: false,
62
- items: { type: 'string' }
63
- },
64
- maxDepth: {
65
- type: 'number',
66
- description: 'Maximum directory depth for multi-file discovery (1-5)',
67
- required: false,
68
- default: 3
69
- },
70
- // Universal parameters
71
- language: {
72
- type: 'string',
73
- description: 'Programming language',
74
- required: false,
75
- default: 'javascript'
76
- },
77
- analysisDepth: {
78
- type: 'string',
79
- description: 'Level of analysis detail',
80
- enum: ['basic', 'detailed', 'comprehensive'],
81
- default: 'detailed',
82
- required: false
83
- },
84
- analysisType: {
85
- type: 'string',
86
- description: 'Type of analysis to perform',
87
- enum: ['TEMPLATE_type1', 'TEMPLATE_type2', 'comprehensive'],
88
- default: 'comprehensive',
89
- required: false
90
- }
91
- };
92
- this.analysisCache = getAnalysisCache();
93
- this.multiFileAnalysis = new MultiFileAnalysis();
94
- // Cache and analysis utilities are initialized above
95
- }
96
- async execute(params, llmClient) {
97
- return await withSecurity(this, params, llmClient, async (secureParams) => {
98
- try {
99
- // 1. Auto-detect analysis mode based on parameters
100
- const analysisMode = this.detectAnalysisMode(secureParams);
101
- // 2. Validate parameters based on detected mode
102
- this.validateParameters(secureParams, analysisMode);
103
- // 3. Setup model
104
- const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
105
- // 4. Route to appropriate analysis method
106
- if (analysisMode === 'single-file') {
107
- return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
108
- }
109
- else {
110
- return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
111
- }
112
- }
113
- catch (error) {
114
- return ErrorHandler.createExecutionError('TEMPLATE_function_name', error);
115
- }
116
- });
117
- }
118
- /**
119
- * Auto-detect whether this is single-file or multi-file analysis
120
- *
121
- * DETECTION GUIDE:
122
- * Single-file: code, filePath provided → analyze individual file
123
- * Multi-file: projectPath, files, maxDepth provided → analyze project/multiple files
124
- * Default: Choose based on your plugin's primary use case
125
- */
126
- detectAnalysisMode(params) {
127
- // Single-file indicators take priority (avoids default parameter issues)
128
- if (params.code || params.filePath) {
129
- return 'single-file';
130
- }
131
- // Multi-file indicators
132
- if (params.projectPath || params.files) {
133
- return 'multi-file';
134
- }
135
- // TEMPLATE: Choose your default based on plugin purpose
136
- // For file-focused plugins: return 'single-file'
137
- // For project-focused plugins: return 'multi-file'
138
- return 'single-file';
139
- }
140
- /**
141
- * Validate parameters based on detected analysis mode
142
- */
143
- validateParameters(params, mode) {
144
- if (mode === 'single-file') {
145
- ParameterValidator.validateCodeOrFile(params);
146
- }
147
- else {
148
- ParameterValidator.validateProjectPath(params);
149
- ParameterValidator.validateDepth(params);
150
- }
151
- // Universal validations
152
- ParameterValidator.validateEnum(params, 'analysisType', ['TEMPLATE_type1', 'TEMPLATE_type2', 'comprehensive']);
153
- ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
154
- }
155
- /**
156
- * Execute single-file analysis
157
- */
158
- async executeSingleFileAnalysis(params, model, contextLength) {
159
- // Process single file input
160
- let codeToAnalyze = params.code;
161
- if (params.filePath) {
162
- codeToAnalyze = await readFileContent(params.filePath);
163
- }
164
- // Generate prompt stages for single file
165
- const promptStages = this.getSingleFilePromptStages({
166
- ...params,
167
- code: codeToAnalyze
168
- });
169
- // Execute with appropriate method
170
- const promptManager = new ThreeStagePromptManager();
171
- const needsChunking = TokenCalculator.needsChunking(promptStages, contextLength);
172
- if (needsChunking) {
173
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
174
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
175
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
176
- const messages = [
177
- conversation.systemMessage,
178
- ...conversation.dataMessages,
179
- conversation.analysisMessage
180
- ];
181
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'TEMPLATE_function_name', 'single');
182
- }
183
- else {
184
- return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'TEMPLATE_function_name');
185
- }
186
- }
187
- /**
188
- * Execute multi-file analysis
189
- */
190
- async executeMultiFileAnalysis(params, model, contextLength) {
191
- // Discover files
192
- let filesToAnalyze = params.files ||
193
- await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.analysisType);
194
- // Perform multi-file analysis with caching
195
- const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
196
- // Generate prompt stages for multi-file
197
- const promptStages = this.getMultiFilePromptStages({
198
- ...params,
199
- analysisResult,
200
- fileCount: filesToAnalyze.length
201
- });
202
- // Always use chunking for multi-file
203
- const promptManager = new ThreeStagePromptManager();
204
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
205
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
206
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
207
- const messages = [
208
- conversation.systemMessage,
209
- ...conversation.dataMessages,
210
- conversation.analysisMessage
211
- ];
212
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'TEMPLATE_function_name', 'multifile');
213
- }
214
- /**
215
- * TEMPLATE: Implement your single-file prompt stages
216
- */
217
- getSingleFilePromptStages(params) {
218
- const { code, language, analysisDepth, analysisType } = params;
219
- const systemAndContext = `You are an expert code analyst specializing in ${analysisDepth} ${analysisType} analysis.
220
-
221
- Analysis Context:
222
- - Language: ${language}
223
- - Analysis Depth: ${analysisDepth}
224
- - Analysis Type: ${analysisType}
225
- - Mode: Single File Analysis
226
-
227
- TEMPLATE: Add your specific single-file system instructions here.
228
-
229
- Your task is to provide actionable insights and recommendations for this individual file.`;
230
- const dataPayload = `Code to analyze:
231
-
232
- \`\`\`${language}
233
- ${code}
234
- \`\`\``;
235
- const outputInstructions = `TEMPLATE: Define your specific single-file output format here.
236
-
237
- **IMPORTANT: Use natural language instructions, NOT JSON schemas!**
238
- The ResponseFactory will handle all JSON formatting automatically.
239
-
240
- Example single-file analysis format:
241
-
242
- **File Overview:**
243
- Provide a brief summary of what this file does and its overall quality.
244
-
245
- **Structural Analysis:**
246
- - **Components**: List key classes, functions, and their purposes
247
- - **Dependencies**: Identify imports, exports, and external dependencies
248
- - **Architecture**: Describe the code's architectural approach
249
-
250
- **Quality Assessment:**
251
- - **Code Quality**: Rate maintainability, testability, and reusability
252
- - **Complexity**: Evaluate cyclomatic complexity and readability
253
- - **Standards**: Adherence to language and framework best practices
254
-
255
- **Issues & Recommendations:**
256
- For each finding, provide:
257
- - **Type**: Issue category (improvement, security, performance, etc.)
258
- - **Severity**: Priority level (critical, high, medium, low)
259
- - **Description**: Clear explanation of the problem or opportunity
260
- - **Location**: Specific line numbers where applicable
261
- - **Solution**: Actionable steps to address the issue
262
-
263
- **Implementation Guidance:**
264
- Organize recommendations by priority and provide specific, actionable steps that developers can implement immediately.
265
-
266
- Focus on being constructive, specific, and actionable while maintaining professional quality suitable for production use.`;
267
- return { systemAndContext, dataPayload, outputInstructions };
268
- }
269
- /**
270
- * TEMPLATE: Implement your multi-file prompt stages
271
- */
272
- getMultiFilePromptStages(params) {
273
- const { analysisResult, analysisType, analysisDepth, fileCount } = params;
274
- const systemAndContext = `You are an expert multi-file code analyst specializing in ${analysisDepth} ${analysisType} analysis.
275
-
276
- Analysis Context:
277
- - Analysis Type: ${analysisType}
278
- - Analysis Depth: ${analysisDepth}
279
- - Files Analyzed: ${fileCount}
280
- - Mode: Multi-File Analysis
281
-
282
- TEMPLATE: Add your specific multi-file system instructions here.
283
-
284
- Your task is to provide comprehensive cross-file insights and architectural recommendations.`;
285
- const dataPayload = `Multi-file analysis results:
286
-
287
- ${JSON.stringify(analysisResult, null, 2)}`;
288
- const outputInstructions = `TEMPLATE: Define your specific multi-file output format here.
289
-
290
- **IMPORTANT: Use natural language instructions, NOT JSON schemas!**
291
- The ResponseFactory will handle all JSON formatting automatically.
292
-
293
- Example multi-file analysis format:
294
-
295
- **Project Overview:**
296
- Provide a comprehensive summary of the project architecture and organization across all ${fileCount} analyzed files.
297
-
298
- **Cross-File Analysis:**
299
- - **Architecture Patterns**: Identify architectural patterns and their implementation
300
- - **Dependencies**: Map inter-file dependencies and coupling issues
301
- - **Consistency**: Assess coding style, naming conventions, and pattern consistency
302
- - **Duplication**: Identify code duplication and reuse opportunities
303
-
304
- **System-Wide Findings:**
305
- For each cross-file issue, provide:
306
- - **Issue Type**: Architecture, coupling, duplication, inconsistency, etc.
307
- - **Severity**: Impact on system maintainability and scalability
308
- - **Affected Files**: Specific files involved in the issue
309
- - **System Impact**: How this affects overall architecture
310
- - **Resolution Strategy**: Multi-file refactoring or improvement approach
311
-
312
- **Architectural Recommendations:**
313
- - **Immediate Actions**: Critical architectural fixes needed across files
314
- - **Structural Improvements**: Medium-term refactoring opportunities
315
- - **Long-term Enhancements**: Strategic architectural evolution suggestions
316
-
317
- **Implementation Roadmap:**
318
- Provide a prioritized plan for implementing cross-file improvements, considering dependencies between changes and minimizing disruption to existing functionality.
319
-
320
- Focus on systemic issues that affect multiple files and provide architectural insights that individual file analysis cannot reveal.`;
321
- return { systemAndContext, dataPayload, outputInstructions };
322
- }
323
- /**
324
- * TEMPLATE: Implement for backwards compatibility
325
- * The system still expects this method, so we intelligently route to the appropriate stages
326
- */
327
- getPromptStages(params) {
328
- const mode = this.detectAnalysisMode(params);
329
- if (mode === 'single-file') {
330
- return this.getSingleFilePromptStages(params);
331
- }
332
- else {
333
- return this.getMultiFilePromptStages(params);
334
- }
335
- }
336
- // Multi-file helper methods
337
- async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
338
- const extensions = this.getFileExtensions(analysisType);
339
- return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
340
- }
341
- async performMultiFileAnalysis(files, params, model, contextLength) {
342
- const cacheKey = this.analysisCache.generateKey('TEMPLATE_function_name', params, files);
343
- const cached = await this.analysisCache.get(cacheKey);
344
- if (cached)
345
- return cached;
346
- const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualFile(file, params, model), contextLength);
347
- // Aggregate results into proper analysis result format
348
- const aggregatedResult = {
349
- summary: `Multi-file analysis of ${files.length} files`,
350
- findings: fileAnalysisResults,
351
- data: {
352
- fileCount: files.length,
353
- totalSize: fileAnalysisResults.reduce((sum, result) => sum + (result.size || 0), 0),
354
- // TEMPLATE: Add your specific aggregation logic here
355
- }
356
- };
357
- await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
358
- modelUsed: model.identifier || 'unknown',
359
- executionTime: Date.now() - Date.now(), // TODO: Track actual execution time
360
- timestamp: new Date().toISOString()
361
- });
362
- return aggregatedResult;
363
- }
364
- async analyzeIndividualFile(file, params, model) {
365
- const content = await import('fs/promises').then(fs => fs.readFile(file, 'utf-8'));
366
- const stats = await import('fs/promises').then(fs => fs.stat(file));
367
- return {
368
- filePath: file,
369
- fileName: basename(file), // ✅ Use imported basename instead of require('path').basename
370
- size: content.length,
371
- lines: content.split('\n').length,
372
- extension: extname(file), // ✅ Use imported extname
373
- relativePath: relative(params.projectPath || '', file), // ✅ Use imported relative
374
- // TEMPLATE: Add your specific individual file analysis here
375
- };
376
- }
377
- getFileExtensions(analysisType) {
378
- // TEMPLATE: Update these extensions to match your analysis needs
379
- // Common extensions by category:
380
- // Code: ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs', '.php']
381
- // Config: ['.json', '.yaml', '.yml', '.xml', '.toml', '.ini']
382
- // Docs: ['.md', '.txt', '.rst', '.adoc']
383
- // All: [...code, ...config, ...docs]
384
- const extensionMap = {
385
- 'TEMPLATE_type1': ['.js', '.ts', '.jsx', '.tsx'],
386
- 'TEMPLATE_type2': ['.php', '.inc', '.module'],
387
- 'comprehensive': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java']
388
- };
389
- return extensionMap[analysisType] || extensionMap.comprehensive;
390
- }
391
- generateCacheKey(files, params) {
392
- const fileHash = files.join('|');
393
- const paramHash = JSON.stringify(params);
394
- return `${fileHash}_${paramHash}`.substring(0, 64);
395
- }
396
- }
397
- export default TEMPLATE_UniversalPlugin;
398
- /*
399
- PLUGIN TEMPLATE USAGE:
400
- 1. Copy this file to your plugin location (src/prompts/[category]/)
401
- 2. Replace all TEMPLATE_ placeholders:
402
- - TEMPLATE_UniversalPlugin → Your class name
403
- - TEMPLATE_function_name → Your MCP function name
404
- - TEMPLATE_category → Your plugin category
405
- - TEMPLATE_type1, TEMPLATE_type2 → Your analysis types
406
- 3. Choose your default mode in detectAnalysisMode():
407
- - File-focused plugins: return 'single-file' (e.g., code analysis, linting)
408
- - Project-focused plugins: return 'multi-file' (e.g., architecture, counting)
409
- 4. Implement getSingleFilePromptStages() for single-file logic
410
- 5. Implement getMultiFilePromptStages() for multi-file logic
411
- 6. Update individual file analysis logic if needed
412
- 7. Use provided Node.js imports (path, fs/promises) instead of require()
413
- 8. Build and restart Claude
414
-
415
- ⚠️ CRITICAL RULE: OUTPUT INSTRUCTIONS MUST BE NATURAL LANGUAGE ONLY! ⚠️
416
-
417
- ✅ DO: Use comprehensive natural language instructions describing what analysis to provide
418
- ❌ DON'T: Put JSON schemas in outputInstructions (causes double-processing & escaping)
419
-
420
- The ResponseFactory automatically converts natural language responses to clean JSON.
421
- If you specify JSON format in prompts, you get garbled, escaped content.
422
-
423
- AUTOMATIC DETECTION:
424
- ✅ Single-file: When code/filePath provided
425
- ✅ Multi-file: When projectPath/files/maxDepth provided
426
- ✅ Intelligent parameter validation based on detected mode
427
- ✅ Appropriate execution path (direct/chunked) chosen automatically
428
- ✅ Same utilities used for both modes
429
-
430
- BENEFITS:
431
- ✅ Single source of truth - one template for all scenarios
432
- ✅ Automatic mode detection - no need to choose
433
- ✅ Consistent behavior across single/multi-file
434
- ✅ Less maintenance - fix bugs once
435
- ✅ Flexible parameters - supports all use cases
436
- ✅ Code reuse - shared validation, processing, error handling
437
- ✅ Clean JSON responses - ResponseFactory handles all formatting
438
-
439
- UTILITIES PROVIDED:
440
- ✅ ModelSetup - Model loading and context detection
441
- ✅ ResponseProcessor - Token calculation and execution
442
- ✅ ParameterValidator - Common validation patterns
443
- ✅ ErrorHandler - Standardized error responses
444
- ✅ ResponseFactory - Universal JSON formatting (don't duplicate this!)
445
- ✅ Common Node.js imports - path, fs/promises (use these instead of require)
446
-
447
- COMMON MISTAKES TO AVOID:
448
- ❌ Don't use require() - use the provided ES module imports
449
- ❌ Don't hardcode single/multi-file - let detection handle it
450
- ❌ Don't duplicate template architecture - only replace designated areas
451
- ❌ Don't create custom utilities - use the provided ones
452
- ❌ DON'T PUT JSON SCHEMAS IN OUTPUT INSTRUCTIONS - use natural language only!
453
- */
454
- //# sourceMappingURL=plugin-template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-template.js","sourceRoot":"","sources":["../../src/templates/plugin-template.ts"],"names":[],"mappings":"A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ChD,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC;YAC7C,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC;SACxE,CAAC;QAEF,OAAO,YAAY,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,aAAa,CAAC;IAClE,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,wBAAwB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDE"}
@@ -1,88 +0,0 @@
1
- /**
2
- * TypeScript interfaces and types for Context Window Management and Chunking
3
- *
4
- * This file defines all the interfaces, types, and enums used by the
5
- * Context Window Manager and related components.
6
- */
7
- /**
8
- * Health check result structure from health_check function
9
- */
10
- export interface HealthCheckResult {
11
- status: 'healthy' | 'unhealthy';
12
- connection: 'established' | 'failed';
13
- lmStudioUrl: string;
14
- timestamp: string;
15
- contextLength?: number;
16
- details?: {
17
- loadedModels: Array<{
18
- path: string;
19
- identifier: string;
20
- architecture: string;
21
- contextLength?: number;
22
- }>;
23
- modelCount: number;
24
- hasActiveModel: boolean;
25
- contextLength?: number;
26
- serverInfo: {
27
- url: string;
28
- protocol: string;
29
- };
30
- activeModel?: {
31
- path: string;
32
- identifier: string;
33
- architecture: string;
34
- contextLength?: number;
35
- };
36
- };
37
- }
38
- /**
39
- * Context Window Manager configuration
40
- */
41
- export interface ContextWindowConfig {
42
- contextLimit: number;
43
- safetyMargin: number;
44
- notificationThreshold?: number;
45
- enableUserNotifications?: boolean;
46
- }
47
- /**
48
- * Chunking strategy types
49
- */
50
- export type ChunkingStrategyType = 'file-based' | 'token-based' | 'semantic' | 'sliding-window' | 'hierarchical';
51
- /**
52
- * Individual chunk of data for processing
53
- */
54
- export interface Chunk {
55
- id: string;
56
- data: any;
57
- metadata?: {
58
- [key: string]: any;
59
- };
60
- }
61
- /**
62
- * Plugin execution context for chunking operations
63
- */
64
- export interface PluginExecutionContext {
65
- pluginName: string;
66
- originalParams: any;
67
- estimatedTokens: number;
68
- chunkingStrategy: ChunkingStrategyType;
69
- chunks: Chunk[];
70
- }
71
- /**
72
- * Chunking-specific error class
73
- */
74
- export declare class ChunkingError extends Error {
75
- readonly code: 'CHUNKING_FAILED' | 'STRATEGY_NOT_FOUND' | 'CHUNK_PROCESSING_FAILED';
76
- readonly context?: any;
77
- constructor(message: string, code: 'CHUNKING_FAILED' | 'STRATEGY_NOT_FOUND' | 'CHUNK_PROCESSING_FAILED', context?: any);
78
- }
79
- /**
80
- * Token estimation configuration
81
- */
82
- export interface TokenEstimationConfig {
83
- averageTokensPerWord: number;
84
- averageCharsPerToken: number;
85
- estimationFactor: number;
86
- maxCacheSize: number;
87
- }
88
- //# sourceMappingURL=chunking-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunking-types.d.ts","sourceRoot":"","sources":["../../src/types/chunking-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;IAChC,UAAU,EAAE,aAAa,GAAG,QAAQ,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,YAAY,EAAE,KAAK,CAAC;YAClB,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,EAAE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;aAC1E,OAAO,CAAC,EAAE,GAAG;gBAF7B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,iBAAiB,GAAG,oBAAoB,GAAG,yBAAyB,EAC1E,OAAO,CAAC,EAAE,GAAG;CAKhC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB"}
@@ -1,18 +0,0 @@
1
- /**
2
- * TypeScript interfaces and types for Context Window Management and Chunking
3
- *
4
- * This file defines all the interfaces, types, and enums used by the
5
- * Context Window Manager and related components.
6
- */
7
- /**
8
- * Chunking-specific error class
9
- */
10
- export class ChunkingError extends Error {
11
- constructor(message, code, context) {
12
- super(message);
13
- this.code = code;
14
- this.context = context;
15
- this.name = 'ChunkingError';
16
- }
17
- }
18
- //# sourceMappingURL=chunking-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunking-types.js","sourceRoot":"","sources":["../../src/types/chunking-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4EH;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACC,IAA0E,EAC1E,OAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAsE;QAC1E,YAAO,GAAP,OAAO,CAAM;QAG7B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF"}
@@ -1,30 +0,0 @@
1
- /**
2
- * 3-Stage Prompt Architecture Types
3
- * Enables clean separation of system context, data payload, and output instructions
4
- */
5
- export interface PromptStages {
6
- /** Stage 1: System instructions and task context */
7
- systemAndContext: string;
8
- /** Stage 2: Data payload (gets chunked when needed) */
9
- dataPayload: string;
10
- /** Stage 3: Output format instructions and analysis tasks */
11
- outputInstructions: string;
12
- }
13
- export interface ChunkedConversation {
14
- /** System message with context */
15
- systemMessage: {
16
- role: 'system';
17
- content: string;
18
- };
19
- /** Data messages (one per chunk) */
20
- dataMessages: Array<{
21
- role: 'user';
22
- content: string;
23
- }>;
24
- /** Final analysis request */
25
- analysisMessage: {
26
- role: 'user';
27
- content: string;
28
- };
29
- }
30
- //# sourceMappingURL=prompt-stages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt-stages.d.ts","sourceRoot":"","sources":["../../src/types/prompt-stages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,CAAC;IAEzB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IAEpB,6DAA6D;IAC7D,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,oCAAoC;IACpC,YAAY,EAAE,KAAK,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IAEH,6BAA6B;IAC7B,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH"}
@@ -1,6 +0,0 @@
1
- /**
2
- * 3-Stage Prompt Architecture Types
3
- * Enables clean separation of system context, data payload, and output instructions
4
- */
5
- export {};
6
- //# sourceMappingURL=prompt-stages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt-stages.js","sourceRoot":"","sources":["../../src/types/prompt-stages.ts"],"names":[],"mappings":"AAAA;;;GAGG"}