@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,760 +0,0 @@
1
- import { BasePlugin } from '../../plugins/base-plugin.js';
2
- import { ThreeStagePromptManager } from '../../core/ThreeStagePromptManager.js';
3
- import { withSecurity } from '../../security/integration-helpers.js';
4
- import { readFileContent } from '../shared/helpers.js';
5
- import { ModelSetup, ResponseProcessor, ParameterValidator, ErrorHandler, MultiFileAnalysis, TokenCalculator } from '../../utils/plugin-utilities.js';
6
- import { getAnalysisCache } from '../../cache/index.js';
7
- import { CssParser } from '../../utils/css-parser.js';
8
- // Common Node.js modules
9
- import { basename, relative } from 'path';
10
- import { readFile } from 'fs/promises';
11
- export class FindUnusedCSSAnalyzer extends BasePlugin {
12
- constructor() {
13
- super();
14
- this.name = 'find_unused_css';
15
- this.category = 'analyze';
16
- this.description = 'Analyze CSS usage and identify unused selectors for performance optimization. Supports both URL analysis and local file analysis.';
17
- // Universal parameter set - supports both URL and local file scenarios
18
- this.parameters = {
19
- // URL analysis
20
- url: {
21
- type: 'string',
22
- description: 'URL to analyze for CSS usage (single page)',
23
- required: false
24
- },
25
- // Single-file parameters
26
- cssPath: {
27
- type: 'string',
28
- description: 'Path to CSS file to analyze',
29
- required: false
30
- },
31
- htmlPath: {
32
- type: 'string',
33
- description: 'Path to HTML file to check CSS usage against',
34
- required: false
35
- },
36
- code: {
37
- type: 'string',
38
- description: 'CSS code to analyze (for single-code analysis)',
39
- required: false
40
- },
41
- // Multi-file parameters
42
- projectPath: {
43
- type: 'string',
44
- description: 'Path to project directory containing HTML/CSS files',
45
- required: false
46
- },
47
- files: {
48
- type: 'array',
49
- description: 'Specific HTML/CSS file paths to analyze',
50
- required: false,
51
- items: { type: 'string' }
52
- },
53
- maxDepth: {
54
- type: 'number',
55
- description: 'Maximum directory depth for file discovery',
56
- required: false,
57
- default: 3
58
- },
59
- // Analysis options
60
- analysisDepth: {
61
- type: 'string',
62
- description: 'Level of analysis detail',
63
- enum: ['basic', 'detailed', 'comprehensive'],
64
- default: 'detailed',
65
- required: false
66
- },
67
- analysisType: {
68
- type: 'string',
69
- description: 'Type of CSS analysis to perform',
70
- enum: ['performance', 'usage', 'comprehensive'],
71
- default: 'comprehensive',
72
- required: false
73
- },
74
- includeMediaQueries: {
75
- type: 'boolean',
76
- description: 'Include media query analysis',
77
- default: true,
78
- required: false
79
- },
80
- ignorePseudoSelectors: {
81
- type: 'boolean',
82
- description: 'Ignore pseudo-selectors like :hover, :focus',
83
- default: false,
84
- required: false
85
- },
86
- // Compatibility
87
- language: {
88
- type: 'string',
89
- description: 'File language (css, html)',
90
- required: false,
91
- default: 'css'
92
- },
93
- filePath: {
94
- type: 'string',
95
- description: 'Path to CSS file to analyze',
96
- required: false
97
- }
98
- };
99
- this.analysisCache = getAnalysisCache();
100
- this.multiFileAnalysis = new MultiFileAnalysis();
101
- }
102
- async execute(params, llmClient) {
103
- return await withSecurity(this, params, llmClient, async (secureParams) => {
104
- try {
105
- // 1. Auto-detect analysis mode based on parameters
106
- const analysisMode = this.detectAnalysisMode(secureParams);
107
- // 2. Validate parameters based on detected mode
108
- this.validateParameters(secureParams, analysisMode);
109
- // 3. Setup model
110
- const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
111
- // 4. Route to appropriate analysis method
112
- if (analysisMode === 'url') {
113
- return await this.executeURLAnalysis(secureParams, model, contextLength);
114
- }
115
- else if (analysisMode === 'single-file') {
116
- return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
117
- }
118
- else {
119
- return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
120
- }
121
- }
122
- catch (error) {
123
- return ErrorHandler.createExecutionError('find_unused_css', error);
124
- }
125
- });
126
- }
127
- /**
128
- * Auto-detect whether this is URL, single-file or multi-file analysis
129
- */
130
- detectAnalysisMode(params) {
131
- // URL analysis takes priority
132
- if (params.url) {
133
- return 'url';
134
- }
135
- // Single-file indicators (CSS + optional HTML)
136
- if (params.code || params.cssPath || params.filePath) {
137
- return 'single-file';
138
- }
139
- // Multi-file indicators
140
- if (params.projectPath || params.files) {
141
- return 'multi-file';
142
- }
143
- // Default to single-file for CSS analysis
144
- return 'single-file';
145
- }
146
- /**
147
- * Validate parameters based on detected analysis mode
148
- */
149
- validateParameters(params, mode) {
150
- if (mode === 'url') {
151
- if (!params.url) {
152
- throw new Error('URL parameter is required for URL analysis');
153
- }
154
- }
155
- else if (mode === 'single-file') {
156
- if (!params.code && !params.cssPath && !params.filePath) {
157
- throw new Error('Either code, cssPath, or filePath is required for single-file analysis');
158
- }
159
- }
160
- else {
161
- ParameterValidator.validateProjectPath(params);
162
- ParameterValidator.validateDepth(params);
163
- }
164
- // Universal validations
165
- ParameterValidator.validateEnum(params, 'analysisType', ['performance', 'usage', 'comprehensive']);
166
- ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
167
- }
168
- /**
169
- * Execute URL analysis: Puppeteer -> CSS Parser -> Houtini LM
170
- */
171
- async executeURLAnalysis(params, model, contextLength) {
172
- // Step 1: Extract data from URL using Puppeteer
173
- const urlData = await this.extractURLDataWithPuppeteer(params.url);
174
- // Step 2: Process CSS with our utility
175
- const processedCSSData = this.processCSSData(urlData);
176
- // Step 3: Generate prompt stages for Houtini LM
177
- const promptStages = this.getURLAnalysisPromptStages({
178
- ...params,
179
- urlData: processedCSSData
180
- });
181
- // Step 4: Execute with proper chunking
182
- const promptManager = new ThreeStagePromptManager();
183
- const needsChunking = TokenCalculator.needsChunking(promptStages, contextLength);
184
- if (needsChunking) {
185
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
186
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
187
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
188
- const messages = [
189
- conversation.systemMessage,
190
- ...conversation.dataMessages,
191
- conversation.analysisMessage
192
- ];
193
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'find_unused_css', 'single');
194
- }
195
- else {
196
- return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'find_unused_css');
197
- }
198
- }
199
- /**
200
- * Execute single-file analysis: File -> CSS Parser -> Houtini LM
201
- */
202
- async executeSingleFileAnalysis(params, model, contextLength) {
203
- // Step 1: Process CSS input
204
- let cssContent = params.code;
205
- if (params.cssPath || params.filePath) {
206
- const filePath = params.cssPath || params.filePath;
207
- cssContent = await readFileContent(filePath);
208
- }
209
- // Step 2: Process optional HTML input
210
- let htmlContent = '';
211
- if (params.htmlPath) {
212
- htmlContent = await readFileContent(params.htmlPath);
213
- }
214
- // Step 3: Process with CSS Parser utility
215
- const processedData = this.processLocalCSSData(cssContent, htmlContent, params);
216
- // Step 4: Generate prompt stages
217
- const promptStages = this.getSingleFilePromptStages({
218
- ...params,
219
- processedData
220
- });
221
- // Step 5: Execute with proper chunking
222
- const promptManager = new ThreeStagePromptManager();
223
- const needsChunking = TokenCalculator.needsChunking(promptStages, contextLength);
224
- if (needsChunking) {
225
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
226
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
227
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
228
- const messages = [
229
- conversation.systemMessage,
230
- ...conversation.dataMessages,
231
- conversation.analysisMessage
232
- ];
233
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'find_unused_css', 'single');
234
- }
235
- else {
236
- return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'find_unused_css');
237
- }
238
- }
239
- /**
240
- * Execute multi-file analysis
241
- */
242
- async executeMultiFileAnalysis(params, model, contextLength) {
243
- // Discover files
244
- let filesToAnalyze = params.files ||
245
- await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.analysisType);
246
- // Perform multi-file analysis with caching
247
- const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
248
- const promptStages = this.getMultiFilePromptStages({
249
- ...params,
250
- analysisResult,
251
- fileCount: filesToAnalyze.length
252
- });
253
- // Always use chunking for multi-file
254
- const promptManager = new ThreeStagePromptManager();
255
- const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
256
- const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
257
- const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
258
- const messages = [
259
- conversation.systemMessage,
260
- ...conversation.dataMessages,
261
- conversation.analysisMessage
262
- ];
263
- return await ResponseProcessor.executeChunked(messages, model, contextLength, 'find_unused_css', 'multifile');
264
- }
265
- /**
266
- * Extract data from URL using Puppeteer (runs before LLM)
267
- */
268
- async extractURLDataWithPuppeteer(url) {
269
- const puppeteer = await import('puppeteer');
270
- const browser = await puppeteer.launch({
271
- headless: true,
272
- args: ['--no-sandbox', '--disable-setuid-sandbox']
273
- });
274
- try {
275
- const page = await browser.newPage();
276
- await page.goto(url, { waitUntil: 'networkidle0', timeout: 30000 });
277
- // Extract HTML content
278
- const htmlContent = await page.content();
279
- // Extract all CSS rules from stylesheets
280
- const cssData = await page.evaluate(() => {
281
- const cssRules = [];
282
- const usedSelectors = new Set();
283
- // Get all stylesheets - use any to bypass TypeScript DOM checks
284
- const stylesheets = Array.from(globalThis.document.styleSheets);
285
- stylesheets.forEach((stylesheet) => {
286
- try {
287
- const rules = Array.from(stylesheet.cssRules || []);
288
- rules.forEach((rule) => {
289
- if (rule.selectorText) {
290
- cssRules.push({
291
- selector: rule.selectorText,
292
- cssText: rule.cssText,
293
- sourceHref: stylesheet.href || 'inline',
294
- media: rule.media ? rule.media.mediaText : null
295
- });
296
- }
297
- });
298
- }
299
- catch (e) {
300
- // Skip CORS-protected stylesheets - note this limitation
301
- }
302
- });
303
- // Test each selector to see if it's used
304
- cssRules.forEach(rule => {
305
- try {
306
- const elements = globalThis.document.querySelectorAll(rule.selector);
307
- if (elements.length > 0) {
308
- usedSelectors.add(rule.selector);
309
- }
310
- }
311
- catch (e) {
312
- // Invalid selector - mark as potentially unused
313
- }
314
- });
315
- return {
316
- totalRules: cssRules.length,
317
- totalUsed: usedSelectors.size,
318
- rules: cssRules.map(rule => ({
319
- ...rule,
320
- isUsed: usedSelectors.has(rule.selector)
321
- })),
322
- pageTitle: globalThis.document.title,
323
- pageUrl: globalThis.window.location.href
324
- };
325
- });
326
- return {
327
- url,
328
- htmlContent,
329
- cssData,
330
- timestamp: new Date().toISOString()
331
- };
332
- }
333
- finally {
334
- await browser.close();
335
- }
336
- }
337
- /**
338
- * Process CSS data using our CSS parser utility
339
- */
340
- processCSSData(urlData) {
341
- const { cssData, htmlContent } = urlData;
342
- // Use our CSS parser to get additional analysis
343
- const frameworks = CssParser.detectBasicFrameworks(htmlContent);
344
- // Process each stylesheet's rules
345
- const processedRules = cssData.rules.map((rule) => {
346
- return {
347
- selector: rule.selector,
348
- isUsed: rule.isUsed,
349
- source: rule.sourceHref,
350
- media: rule.media,
351
- cssText: rule.cssText
352
- };
353
- });
354
- // Group by usage status
355
- const usedRules = processedRules.filter((rule) => rule.isUsed);
356
- const unusedRules = processedRules.filter((rule) => !rule.isUsed);
357
- return {
358
- summary: {
359
- totalRules: cssData.totalRules,
360
- usedRules: usedRules.length,
361
- unusedRules: unusedRules.length,
362
- unusedPercentage: Math.round((unusedRules.length / cssData.totalRules) * 100),
363
- detectedFrameworks: frameworks
364
- },
365
- usedRules,
366
- unusedRules,
367
- pageInfo: {
368
- title: cssData.pageTitle,
369
- url: cssData.pageUrl,
370
- timestamp: urlData.timestamp
371
- }
372
- };
373
- }
374
- /**
375
- * Process local CSS data using our parser utility
376
- */
377
- processLocalCSSData(cssContent, htmlContent, params) {
378
- // Extract selectors using our CSS parser
379
- const selectors = CssParser.extractSelectors(cssContent, params.cssPath || 'input');
380
- const frameworks = CssParser.detectBasicFrameworks(cssContent);
381
- const fileSizeKB = CssParser.getFileSizeKB(cssContent);
382
- // If we have HTML content, check usage
383
- let usedSelectors = [];
384
- let unusedSelectors = [...selectors];
385
- if (htmlContent) {
386
- // Simple check for selector usage in HTML
387
- selectors.forEach(sel => {
388
- const selectorText = sel.selector;
389
- // Basic usage detection (could be enhanced)
390
- if (this.isSelectorUsedInHTML(selectorText, htmlContent, params.ignorePseudoSelectors)) {
391
- usedSelectors.push(selectorText);
392
- unusedSelectors = unusedSelectors.filter(u => u.selector !== selectorText);
393
- }
394
- });
395
- }
396
- return {
397
- summary: {
398
- totalSelectors: selectors.length,
399
- usedSelectors: usedSelectors.length,
400
- unusedSelectors: unusedSelectors.length,
401
- unusedPercentage: htmlContent ? Math.round((unusedSelectors.length / selectors.length) * 100) : null,
402
- fileSizeKB,
403
- detectedFrameworks: frameworks,
404
- includeMediaQueries: params.includeMediaQueries
405
- },
406
- allSelectors: selectors,
407
- usedSelectors,
408
- unusedSelectors,
409
- hasHTML: !!htmlContent
410
- };
411
- }
412
- /**
413
- * Basic selector usage detection in HTML
414
- */
415
- isSelectorUsedInHTML(selector, html, ignorePseudo = false) {
416
- // Remove pseudo-selectors if requested
417
- if (ignorePseudo) {
418
- selector = selector.replace(/:(hover|focus|active|visited|link|first-child|last-child|nth-child\([^)]+\))/g, '');
419
- }
420
- // Extract class and ID selectors for basic matching
421
- const classMatches = selector.match(/\\.([a-zA-Z0-9_-]+)/g);
422
- const idMatches = selector.match(/#([a-zA-Z0-9_-]+)/g);
423
- const elementMatches = selector.match(/^[a-zA-Z][a-zA-Z0-9]*(?![.#])/);
424
- // Check for class usage
425
- if (classMatches) {
426
- for (const classMatch of classMatches) {
427
- const className = classMatch.substring(1); // Remove the dot
428
- if (html.includes(`class="${className}"`) || html.includes(`class='${className}'`) ||
429
- html.includes(`class="[^"]*${className}[^"]*"`) || html.includes(`class='[^']*${className}[^']*'`)) {
430
- return true;
431
- }
432
- }
433
- }
434
- // Check for ID usage
435
- if (idMatches) {
436
- for (const idMatch of idMatches) {
437
- const idName = idMatch.substring(1); // Remove the hash
438
- if (html.includes(`id="${idName}"`) || html.includes(`id='${idName}'`)) {
439
- return true;
440
- }
441
- }
442
- }
443
- // Check for element usage
444
- if (elementMatches) {
445
- const element = elementMatches[0];
446
- if (html.includes(`<${element}`) || html.includes(`</${element}`)) {
447
- return true;
448
- }
449
- }
450
- return false;
451
- }
452
- /**
453
- * URL analysis prompt stages
454
- */
455
- getURLAnalysisPromptStages(params) {
456
- const { urlData, analysisDepth, analysisType } = params;
457
- const systemAndContext = `You are an expert CSS performance analyst specializing in ${analysisDepth} ${analysisType} analysis of live websites.
458
-
459
- Analysis Context:
460
- - Analysis Type: ${analysisType}
461
- - Analysis Depth: ${analysisDepth}
462
- - Mode: Live URL Analysis
463
- - URL: ${urlData.pageInfo.url}
464
-
465
- Your Mission:
466
- Analyze CSS usage patterns from a live website to identify performance optimization opportunities. Focus on unused selectors, CSS bloat, and optimization recommendations.
467
-
468
- Your Expertise:
469
- - CSS performance optimization and unused code detection
470
- - Web performance analysis and Core Web Vitals impact
471
- - Framework CSS analysis and cleanup strategies
472
- - Cross-browser compatibility and selector efficiency
473
- - CSS architecture and maintainability best practices
474
-
475
- Analysis Methodology:
476
- 1. Examine the CSS usage data extracted from the live page
477
- 2. Identify genuinely unused selectors vs. dynamic/JS-dependent rules
478
- 3. Assess performance impact and optimization opportunities
479
- 4. Provide conservative recommendations that won't break functionality
480
- 5. Consider framework patterns and common CSS practices`;
481
- const dataPayload = `URL Analysis Data:
482
-
483
- Page Information:
484
- - Title: ${urlData.pageInfo.title}
485
- - URL: ${urlData.pageInfo.url}
486
- - Analysis Date: ${urlData.pageInfo.timestamp}
487
-
488
- CSS Usage Summary:
489
- - Total CSS Rules: ${urlData.summary.totalRules}
490
- - Used Rules: ${urlData.summary.usedRules}
491
- - Unused Rules: ${urlData.summary.unusedRules}
492
- - Unused Percentage: ${urlData.summary.unusedPercentage}%
493
- - Detected Frameworks: ${urlData.summary.detectedFrameworks.join(', ') || 'None detected'}
494
-
495
- Unused CSS Rules (Sample):
496
- ${JSON.stringify(urlData.unusedRules.slice(0, 20), null, 2)}
497
-
498
- Used CSS Rules (Sample):
499
- ${JSON.stringify(urlData.usedRules.slice(0, 10), null, 2)}
500
-
501
- Note: Analysis based on current page state. Dynamic content and JavaScript interactions may affect actual usage.`;
502
- const outputInstructions = `Provide comprehensive CSS usage analysis with the following structure:
503
-
504
- ## Executive Summary
505
- Provide an executive summary of CSS usage and optimization opportunities found during the analysis.
506
-
507
- ## Unused CSS Analysis
508
- - **Total Unused Rules**: Count and percentage of unused CSS rules
509
- - **Categories**:
510
- - **Safe to Remove**: Selectors that are definitely unused and can be safely removed
511
- - **Requires Investigation**: Selectors that might be used by JavaScript or dynamic content
512
- - **Framework Related**: Selectors from detected frameworks that may be conditionally used
513
-
514
- ## Performance Impact Assessment
515
- - **Estimated Savings**: Projected file size reduction from removing unused CSS
516
- - **Load Time Impact**: Expected performance improvement in page loading
517
- - **Core Web Vitals Impact**: How optimizations will affect CLS, LCP, and FID scores
518
-
519
- ## Optimization Recommendations
520
- For each recommendation, provide:
521
- - **Action**: Specific optimization action to take
522
- - **Impact Level**: High, medium, or low impact on performance
523
- - **Implementation Effort**: Low, medium, or high effort required
524
- - **Description**: Detailed explanation and implementation guidance
525
-
526
- ## Framework-Specific Insights
527
- - **Detected Frameworks**: List any CSS frameworks identified (Bootstrap, Tailwind, etc.)
528
- - **Framework Advice**: Specific guidance for optimizing framework-related CSS
529
-
530
- ## Important Warnings
531
- List any critical considerations or warnings before making changes, especially regarding:
532
- - Dynamic content that might use CSS classes at runtime
533
- - Third-party integrations that may depend on specific CSS
534
- - Mobile-specific or conditional styling
535
-
536
- ## Confidence Assessment
537
- Provide your confidence level in the analysis and any limitations of the static analysis approach.
538
-
539
- **Focus on actionable recommendations that safely improve CSS performance without breaking functionality.**`;
540
- return { systemAndContext, dataPayload, outputInstructions };
541
- }
542
- /**
543
- * Single-file analysis prompt stages
544
- */
545
- getSingleFilePromptStages(params) {
546
- const { processedData, analysisDepth, analysisType } = params;
547
- const systemAndContext = `You are an expert CSS code analyst specializing in ${analysisDepth} ${analysisType} analysis of CSS files.
548
-
549
- Analysis Context:
550
- - Analysis Type: ${analysisType}
551
- - Analysis Depth: ${analysisDepth}
552
- - Mode: Local File Analysis
553
- - Has HTML Reference: ${processedData.hasHTML}
554
-
555
- Your Mission:
556
- Analyze CSS file structure and usage patterns to identify optimization opportunities, unused selectors, and code quality issues.
557
-
558
- Your Expertise:
559
- - CSS architecture and organization best practices
560
- - Selector efficiency and performance optimization
561
- - CSS maintainability and code quality assessment
562
- - Framework detection and optimization strategies
563
- - Cross-file dependency analysis and cleanup
564
-
565
- Analysis Methodology:
566
- 1. Examine CSS structure and selector patterns
567
- 2. Identify potential unused or redundant selectors
568
- 3. Assess code organization and maintainability
569
- 4. Provide optimization recommendations
570
- 5. Consider framework patterns and modern CSS practices`;
571
- const dataPayload = `CSS File Analysis Data:
572
-
573
- Summary:
574
- - Total Selectors: ${processedData.summary.totalSelectors}
575
- - File Size: ${processedData.summary.fileSizeKB} KB
576
- - Detected Frameworks: ${processedData.summary.detectedFrameworks.join(', ') || 'None detected'}
577
- ${processedData.hasHTML ? `- Used Selectors: ${processedData.summary.usedSelectors}
578
- - Unused Selectors: ${processedData.summary.unusedSelectors}
579
- - Unused Percentage: ${processedData.summary.unusedPercentage}%` : '- HTML Reference: Not provided (usage analysis limited)'}
580
-
581
- All Selectors:
582
- ${JSON.stringify(processedData.allSelectors, null, 2)}
583
-
584
- ${processedData.hasHTML ? `
585
- Unused Selectors:
586
- ${JSON.stringify(processedData.unusedSelectors, null, 2)}
587
- ` : ''}`;
588
- const outputInstructions = `Provide comprehensive CSS file analysis with the following structure:
589
-
590
- **File Overview and Assessment**
591
- Provide a comprehensive overview of CSS file structure, quality assessment, and organizational patterns identified during analysis.
592
-
593
- **CSS File Structure Analysis**
594
- - Detailed evaluation of CSS organization, architecture patterns, and structural quality
595
- - Comprehensive assessment of code complexity, maintainability, and overall architectural approach
596
- - Framework detection results with analysis of any detected frameworks and their usage patterns throughout the file
597
-
598
- ${processedData.hasHTML ? `**CSS Usage Pattern Analysis**
599
- - Detailed analysis of unused selectors with count, categorization, and optimization potential assessment
600
- - Comprehensive evaluation of how selectors are used throughout the HTML with usage pattern insights
601
- - Estimated potential savings from cleanup operations including file size reduction and performance impact
602
-
603
- ` : ''}**Code Quality Issues and Findings**
604
- For each issue identified during analysis:
605
- - Clear categorization of the problem type with detailed classification
606
- - Severity level assessment ranging from high impact to low priority issues
607
- - Comprehensive detailed description explaining the nature and implications of each issue
608
- - Specific affected selectors or CSS rules involved in the problematic patterns
609
- - Step-by-step recommendation and implementation guidance for addressing each issue
610
-
611
- **CSS Optimization Opportunities**
612
- For each optimization suggestion discovered:
613
- - Specific area for improvement with clear identification and scope
614
- - Expected benefit analysis including what improvements can be realistically achieved
615
- - Detailed implementation guide explaining exactly how to implement each optimization safely
616
-
617
- **Priority Implementation Recommendations**
618
- Comprehensive list of the most important recommendations for improving the CSS, carefully ordered by priority, implementation impact, and development effort required.
619
-
620
- **Analysis Confidence and Limitations**
621
- Professional assessment of confidence level in the analysis with clear explanation of any limitations, assumptions, or constraints in the assessment approach.
622
-
623
- Focus on providing actionable insights that improve CSS maintainability, performance optimization, and overall code quality while ensuring recommendations are practical and implementable.`;
624
- return { systemAndContext, dataPayload, outputInstructions };
625
- }
626
- /**
627
- * Multi-file analysis prompt stages
628
- */
629
- getMultiFilePromptStages(params) {
630
- const { analysisResult, analysisType, analysisDepth, fileCount } = params;
631
- const systemAndContext = `You are an expert multi-file CSS analyst specializing in ${analysisDepth} ${analysisType} analysis across web projects.
632
-
633
- Analysis Context:
634
- - Analysis Type: ${analysisType}
635
- - Analysis Depth: ${analysisDepth}
636
- - Files Analyzed: ${fileCount}
637
- - Mode: Multi-File Project Analysis
638
-
639
- Your Mission:
640
- Analyze CSS usage patterns across an entire web project to identify cross-file optimization opportunities, architectural issues, and comprehensive cleanup strategies.
641
-
642
- Your Expertise:
643
- - Project-wide CSS architecture and organization
644
- - Cross-file CSS dependency analysis and optimization
645
- - Multi-file unused code detection and cleanup strategies
646
- - CSS performance optimization at project scale
647
- - Framework integration and optimization across files
648
-
649
- Analysis Methodology:
650
- 1. Examine cross-file CSS patterns and dependencies
651
- 2. Identify project-wide unused or redundant styles
652
- 3. Assess overall CSS architecture and organization
653
- 4. Provide comprehensive optimization strategy
654
- 5. Consider build process and deployment optimization`;
655
- const dataPayload = `Multi-File CSS Analysis Results:
656
-
657
- ${JSON.stringify(analysisResult, null, 2)}`;
658
- const outputInstructions = `Provide comprehensive multi-file CSS analysis with the following structure:
659
-
660
- ## Overall Summary
661
- Provide overall project CSS analysis and optimization potential across all analyzed files.
662
-
663
- ## Project Analysis
664
- - **Architecture Assessment**: Evaluation of project CSS organization and structure
665
- - **Total Size Impact**: Combined CSS file sizes and their impact
666
- - **Framework Detection**: List detected frameworks used across the project
667
- - **Duplicate Pattern Analysis**: Identification of duplicate or redundant CSS across files
668
-
669
- ## Cross-File Findings
670
- For each cross-file issue identified:
671
- - **Issue Type**: optimization, redundancy, or architecture concern
672
- - **Severity Level**: High, medium, or low impact
673
- - **Description**: Clear explanation of the cross-file issue
674
- - **Affected Files**: Specific CSS files involved in the issue
675
- - **Recommendation**: How to optimize or resolve across files
676
-
677
- ## Optimization Strategy
678
- - **Priority Order**: Recommended optimization sequence for maximum impact
679
- - **Estimated Savings**: Project-wide optimization potential and expected benefits
680
- - **Build Process Recommendations**: Suggestions for build-time optimizations
681
-
682
- ## Priority Recommendations
683
- List the most important project-wide recommendations for CSS optimization and cleanup.
684
-
685
- ## Confidence Assessment
686
- Provide confidence level in the cross-file analysis and note any limitations.
687
-
688
- **Focus on actionable insights that improve CSS architecture, reduce duplication, and optimize the entire project's CSS performance.**`;
689
- return { systemAndContext, dataPayload, outputInstructions };
690
- }
691
- /**
692
- * Multi-file helper methods
693
- */
694
- async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
695
- const extensions = this.getFileExtensions(analysisType);
696
- return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
697
- }
698
- async performMultiFileAnalysis(files, params, model, contextLength) {
699
- const cacheKey = this.analysisCache.generateKey('find_unused_css', params, files);
700
- const cached = await this.analysisCache.get(cacheKey);
701
- if (cached)
702
- return cached;
703
- const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualCSSFile(file, params, model), contextLength);
704
- // Aggregate results
705
- const aggregatedResult = {
706
- summary: `Multi-file CSS analysis of ${files.length} files`,
707
- files: fileAnalysisResults,
708
- totalSizeKB: fileAnalysisResults.reduce((sum, result) => sum + (result.sizeKB || 0), 0),
709
- totalSelectors: fileAnalysisResults.reduce((sum, result) => sum + (result.selectorCount || 0), 0),
710
- combinedFrameworks: [...new Set(fileAnalysisResults.flatMap((result) => result.frameworks || []))]
711
- };
712
- await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
713
- modelUsed: model.identifier || 'unknown',
714
- executionTime: Date.now(),
715
- timestamp: new Date().toISOString()
716
- });
717
- return aggregatedResult;
718
- }
719
- async analyzeIndividualCSSFile(file, params, model) {
720
- const content = await readFile(file, 'utf-8');
721
- const selectors = CssParser.extractSelectors(content, file);
722
- const frameworks = CssParser.detectBasicFrameworks(content);
723
- const sizeKB = CssParser.getFileSizeKB(content);
724
- return {
725
- filePath: file,
726
- fileName: basename(file),
727
- sizeKB,
728
- selectorCount: selectors.length,
729
- frameworks,
730
- relativePath: relative(params.projectPath || '', file),
731
- selectors: selectors.slice(0, 10) // Sample for analysis
732
- };
733
- }
734
- getFileExtensions(analysisType) {
735
- const extensionMap = {
736
- 'performance': ['.css', '.scss', '.sass', '.less'],
737
- 'usage': ['.css', '.html', '.htm', '.php', '.jsx', '.tsx', '.vue'],
738
- 'comprehensive': ['.css', '.scss', '.sass', '.less', '.html', '.htm', '.php', '.jsx', '.tsx', '.vue']
739
- };
740
- return extensionMap[analysisType] || extensionMap.comprehensive;
741
- }
742
- /**
743
- * For backwards compatibility
744
- */
745
- getPromptStages(params) {
746
- const mode = this.detectAnalysisMode(params);
747
- if (mode === 'url') {
748
- // This shouldn't be called for URL mode as it requires async processing
749
- throw new Error('URL analysis requires async processing - use execute method');
750
- }
751
- else if (mode === 'single-file') {
752
- return this.getSingleFilePromptStages(params);
753
- }
754
- else {
755
- return this.getMultiFilePromptStages(params);
756
- }
757
- }
758
- }
759
- export default FindUnusedCSSAnalyzer;
760
- //# sourceMappingURL=find-unused-css.js.map