@loxia-labs/loxia-autopilot-one 1.0.1 → 1.0.4

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 (120) hide show
  1. package/README.md +44 -54
  2. package/bin/cli.js +1 -115
  3. package/bin/loxia-terminal-v2.js +3 -0
  4. package/bin/loxia-terminal.js +3 -0
  5. package/bin/start-with-terminal.js +3 -0
  6. package/package.json +15 -15
  7. package/scripts/install-scanners.js +1 -235
  8. package/src/analyzers/CSSAnalyzer.js +1 -297
  9. package/src/analyzers/ConfigValidator.js +1 -690
  10. package/src/analyzers/ESLintAnalyzer.js +1 -320
  11. package/src/analyzers/JavaScriptAnalyzer.js +1 -261
  12. package/src/analyzers/PrettierFormatter.js +1 -247
  13. package/src/analyzers/PythonAnalyzer.js +1 -266
  14. package/src/analyzers/SecurityAnalyzer.js +1 -729
  15. package/src/analyzers/TypeScriptAnalyzer.js +1 -247
  16. package/src/analyzers/codeCloneDetector/analyzer.js +1 -344
  17. package/src/analyzers/codeCloneDetector/detector.js +1 -203
  18. package/src/analyzers/codeCloneDetector/index.js +1 -160
  19. package/src/analyzers/codeCloneDetector/parser.js +1 -199
  20. package/src/analyzers/codeCloneDetector/reporter.js +1 -148
  21. package/src/analyzers/codeCloneDetector/scanner.js +1 -59
  22. package/src/core/agentPool.js +1 -1474
  23. package/src/core/agentScheduler.js +1 -2147
  24. package/src/core/contextManager.js +1 -709
  25. package/src/core/messageProcessor.js +1 -732
  26. package/src/core/orchestrator.js +1 -548
  27. package/src/core/stateManager.js +1 -877
  28. package/src/index.js +1 -631
  29. package/src/interfaces/cli.js +1 -549
  30. package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +1 -0
  31. package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +1 -0
  32. package/src/interfaces/terminal/__tests__/smoke/agents.test.js +1 -0
  33. package/src/interfaces/terminal/__tests__/smoke/components.test.js +1 -0
  34. package/src/interfaces/terminal/__tests__/smoke/connection.test.js +1 -0
  35. package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +1 -0
  36. package/src/interfaces/terminal/__tests__/smoke/imports.test.js +1 -0
  37. package/src/interfaces/terminal/__tests__/smoke/messages.test.js +1 -0
  38. package/src/interfaces/terminal/__tests__/smoke/tools.test.js +1 -0
  39. package/src/interfaces/terminal/api/apiClient.js +1 -0
  40. package/src/interfaces/terminal/api/messageRouter.js +1 -0
  41. package/src/interfaces/terminal/api/session.js +1 -0
  42. package/src/interfaces/terminal/api/websocket.js +1 -0
  43. package/src/interfaces/terminal/components/AgentCreator.js +1 -0
  44. package/src/interfaces/terminal/components/AgentEditor.js +1 -0
  45. package/src/interfaces/terminal/components/AgentSwitcher.js +1 -0
  46. package/src/interfaces/terminal/components/ErrorBoundary.js +1 -0
  47. package/src/interfaces/terminal/components/ErrorPanel.js +1 -0
  48. package/src/interfaces/terminal/components/Header.js +1 -0
  49. package/src/interfaces/terminal/components/HelpPanel.js +1 -0
  50. package/src/interfaces/terminal/components/InputBox.js +1 -0
  51. package/src/interfaces/terminal/components/Layout.js +1 -0
  52. package/src/interfaces/terminal/components/LoadingSpinner.js +1 -0
  53. package/src/interfaces/terminal/components/MessageList.js +1 -0
  54. package/src/interfaces/terminal/components/MultilineTextInput.js +1 -0
  55. package/src/interfaces/terminal/components/SearchPanel.js +1 -0
  56. package/src/interfaces/terminal/components/SettingsPanel.js +1 -0
  57. package/src/interfaces/terminal/components/StatusBar.js +1 -0
  58. package/src/interfaces/terminal/components/TextInput.js +1 -0
  59. package/src/interfaces/terminal/config/agentEditorConstants.js +1 -0
  60. package/src/interfaces/terminal/config/constants.js +1 -0
  61. package/src/interfaces/terminal/index.js +1 -0
  62. package/src/interfaces/terminal/state/useAgentControl.js +1 -0
  63. package/src/interfaces/terminal/state/useAgents.js +1 -0
  64. package/src/interfaces/terminal/state/useConnection.js +1 -0
  65. package/src/interfaces/terminal/state/useMessages.js +1 -0
  66. package/src/interfaces/terminal/state/useTools.js +1 -0
  67. package/src/interfaces/terminal/utils/debugLogger.js +1 -0
  68. package/src/interfaces/terminal/utils/settingsStorage.js +1 -0
  69. package/src/interfaces/terminal/utils/theme.js +1 -0
  70. package/src/interfaces/webServer.js +1 -2162
  71. package/src/modules/fileExplorer/controller.js +1 -280
  72. package/src/modules/fileExplorer/index.js +1 -37
  73. package/src/modules/fileExplorer/middleware.js +1 -92
  74. package/src/modules/fileExplorer/routes.js +1 -125
  75. package/src/modules/fileExplorer/types.js +1 -44
  76. package/src/services/aiService.js +1 -1232
  77. package/src/services/apiKeyManager.js +1 -164
  78. package/src/services/benchmarkService.js +1 -366
  79. package/src/services/budgetService.js +1 -539
  80. package/src/services/contextInjectionService.js +1 -247
  81. package/src/services/conversationCompactionService.js +1 -637
  82. package/src/services/errorHandler.js +1 -810
  83. package/src/services/fileAttachmentService.js +1 -544
  84. package/src/services/modelRouterService.js +1 -366
  85. package/src/services/modelsService.js +1 -322
  86. package/src/services/qualityInspector.js +1 -796
  87. package/src/services/tokenCountingService.js +1 -536
  88. package/src/tools/agentCommunicationTool.js +1 -1344
  89. package/src/tools/agentDelayTool.js +1 -485
  90. package/src/tools/asyncToolManager.js +1 -604
  91. package/src/tools/baseTool.js +1 -800
  92. package/src/tools/browserTool.js +1 -920
  93. package/src/tools/cloneDetectionTool.js +1 -621
  94. package/src/tools/dependencyResolverTool.js +1 -1215
  95. package/src/tools/fileContentReplaceTool.js +1 -875
  96. package/src/tools/fileSystemTool.js +1 -1107
  97. package/src/tools/fileTreeTool.js +1 -853
  98. package/src/tools/imageTool.js +1 -901
  99. package/src/tools/importAnalyzerTool.js +1 -1060
  100. package/src/tools/jobDoneTool.js +1 -248
  101. package/src/tools/seekTool.js +1 -956
  102. package/src/tools/staticAnalysisTool.js +1 -1778
  103. package/src/tools/taskManagerTool.js +1 -2873
  104. package/src/tools/terminalTool.js +1 -2304
  105. package/src/tools/webTool.js +1 -1430
  106. package/src/types/agent.js +1 -519
  107. package/src/types/contextReference.js +1 -972
  108. package/src/types/conversation.js +1 -730
  109. package/src/types/toolCommand.js +1 -747
  110. package/src/utilities/attachmentValidator.js +1 -292
  111. package/src/utilities/configManager.js +1 -582
  112. package/src/utilities/constants.js +1 -722
  113. package/src/utilities/directoryAccessManager.js +1 -535
  114. package/src/utilities/fileProcessor.js +1 -307
  115. package/src/utilities/logger.js +1 -436
  116. package/src/utilities/tagParser.js +1 -1246
  117. package/src/utilities/toolConstants.js +1 -317
  118. package/web-ui/build/index.html +2 -2
  119. package/web-ui/build/static/{index-Dy2bYbOa.css → index-CClD1090.css} +1 -1
  120. package/web-ui/build/static/{index-CjkkcnFA.js → index-lCBai6dX.js} +66 -67
@@ -1,1778 +1 @@
1
- /**
2
- * StaticAnalysisTool - Static code analysis for finding errors without execution
3
- *
4
- * Purpose:
5
- * - Analyze code files for syntax, type, and import errors
6
- * - Detect programming languages and frameworks
7
- * - Provide actionable error references with line numbers
8
- * - Support single file, multiple files, and project-wide analysis
9
- * - Use official language parsers for accurate results
10
- */
11
-
12
- import { BaseTool } from './baseTool.js';
13
- import TagParser from '../utilities/tagParser.js';
14
- import DirectoryAccessManager from '../utilities/directoryAccessManager.js';
15
- import fs from 'fs/promises';
16
- import path from 'path';
17
- import crypto from 'crypto';
18
-
19
- import {
20
- STATIC_ANALYSIS,
21
- TOOL_STATUS,
22
- SYSTEM_DEFAULTS
23
- } from '../utilities/constants.js';
24
-
25
- class StaticAnalysisTool extends BaseTool {
26
- constructor(config = {}, logger = null) {
27
- super(config, logger);
28
-
29
- // Tool metadata
30
- this.requiresProject = true;
31
- this.isAsync = false;
32
- this.timeout = config.timeout || STATIC_ANALYSIS.ANALYSIS_TIMEOUT;
33
- this.maxConcurrentOperations = config.maxConcurrentOperations || 1;
34
-
35
- // Analysis settings
36
- this.maxFileSize = config.maxFileSize || STATIC_ANALYSIS.MAX_FILE_SIZE_FOR_ANALYSIS;
37
- this.maxFilesPerBatch = config.maxFilesPerBatch || STATIC_ANALYSIS.MAX_FILES_PER_BATCH;
38
- this.enableCache = config.enableCache !== false && STATIC_ANALYSIS.ENABLE_CACHE;
39
-
40
- // Cache for analysis results
41
- this.analysisCache = new Map();
42
- this.cacheExpiry = STATIC_ANALYSIS.CACHE_DURATION;
43
-
44
- // Performance optimization settings
45
- this.parallelAnalysis = config.parallelAnalysis !== false;
46
- this.maxParallelFiles = config.maxParallelFiles || 10;
47
- this.useContentHash = config.useContentHash !== false;
48
-
49
- // Performance metrics
50
- this.metrics = {
51
- totalAnalyses: 0,
52
- cacheHits: 0,
53
- cacheMisses: 0,
54
- totalAnalysisTime: 0,
55
- filesAnalyzed: 0,
56
- parallelBatches: 0
57
- };
58
-
59
- // Directory access manager
60
- this.directoryAccessManager = new DirectoryAccessManager(config, logger);
61
-
62
- // Analyzers will be initialized lazily when needed
63
- this.analyzers = {
64
- javascript: null,
65
- typescript: null,
66
- python: null,
67
- css: null,
68
- scss: null,
69
- less: null,
70
- eslint: null,
71
- security: null,
72
- config: null
73
- };
74
-
75
- // Formatters will be initialized lazily when needed
76
- this.formatters = {
77
- prettier: null
78
- };
79
- }
80
-
81
- /**
82
- * Get tool description for LLM consumption
83
- * @returns {string} Tool description
84
- */
85
- getDescription() {
86
- return `
87
- Static Code Analysis Tool: Analyze code files for errors without execution
88
-
89
- This tool performs static analysis on code files to find syntax errors, type errors, import issues, and other problems without running the code. It uses official language parsers for accurate results.
90
-
91
- SUPPORTED LANGUAGES:
92
- - JavaScript (.js, .jsx, .mjs, .cjs)
93
- - TypeScript (.ts, .tsx)
94
- - Python (.py)
95
- - CSS (.css)
96
- - SCSS (.scss, .sass)
97
- - LESS (.less)
98
-
99
- USAGE - XML FORMAT:
100
-
101
- Single File Analysis:
102
- [tool id="staticanalysis"]
103
- <analyze file-path="src/index.js" />
104
- [/tool]
105
-
106
- Multiple Files Analysis:
107
- [tool id="staticanalysis"]
108
- <analyze file-path="src/index.js" />
109
- <analyze file-path="src/utils.js" />
110
- <analyze file-path="src/components/Button.jsx" />
111
- [/tool]
112
-
113
- Project-Wide Analysis:
114
- [tool id="staticanalysis"]
115
- <analyze-project directory="src" pattern="**/*.js" />
116
- [/tool]
117
-
118
- Auto-Fix Code Issues:
119
- [tool id="staticanalysis"]
120
- <fix file-path="src/app.js" />
121
- [/tool]
122
-
123
- Format Code:
124
- [tool id="staticanalysis"]
125
- <format file-path="src/app.js" />
126
- [/tool]
127
-
128
- USAGE - JSON FORMAT:
129
-
130
- \`\`\`json
131
- {
132
- "toolId": "staticanalysis",
133
- "actions": [
134
- {
135
- "type": "analyze",
136
- "filePath": "src/index.js"
137
- },
138
- {
139
- "type": "analyze-project",
140
- "directory": "src",
141
- "pattern": "**/*.{js,ts,py}"
142
- }
143
- ]
144
- }
145
- \`\`\`
146
-
147
- PARAMETERS:
148
- - file-path: Path to file to analyze (for single file)
149
- - directory: Directory to analyze (for project-wide)
150
- - pattern: Glob pattern for files to include (optional, defaults to language-specific patterns)
151
- - include-warnings: Include warnings in results (true/false, default: true)
152
- - max-errors: Maximum number of errors to return (default: all)
153
-
154
- OUTPUT FORMAT:
155
- Returns structured error information:
156
- - file: File path
157
- - line: Line number
158
- - column: Column number
159
- - severity: critical | error | warning | info
160
- - rule: Rule identifier
161
- - message: Human-readable description
162
- - category: syntax | type | import | style | security | performance | best_practice
163
- - fixable: Whether error can be auto-fixed
164
- - suggestion: Fix suggestion (if applicable)
165
- - remediation: Security remediation advice (for security issues)
166
-
167
- DETECTION:
168
- - Language: Automatically detected from file extension
169
- - Framework: Detected from package.json, requirements.txt, etc.
170
- - Context: Project structure analyzed for better accuracy
171
-
172
- EXAMPLES:
173
-
174
- Find all errors in a JavaScript file:
175
- [tool id="staticanalysis"]
176
- <analyze file-path="src/app.js" />
177
- [/tool]
178
-
179
- Analyze TypeScript with type checking:
180
- [tool id="staticanalysis"]
181
- <analyze file-path="src/types.ts" />
182
- [/tool]
183
-
184
- Check all Python files in a directory:
185
- [tool id="staticanalysis"]
186
- <analyze-project directory="backend" pattern="**/*.py" />
187
- [/tool]
188
-
189
- LIMITATIONS:
190
- - File size limit: ${Math.round(this.maxFileSize / 1024 / 1024)}MB per file
191
- - Batch limit: ${this.maxFilesPerBatch} files per operation
192
- - Analysis timeout: ${this.timeout / 1000} seconds
193
- - Only supports languages with built-in analyzers
194
- `;
195
- }
196
-
197
- /**
198
- * Parse parameters from tool command content
199
- * @param {string} content - Raw tool command content
200
- * @returns {Object} Parsed parameters
201
- */
202
- parseParameters(content) {
203
- try {
204
- const params = {};
205
- const actions = [];
206
-
207
- this.logger?.debug('StaticAnalysis tool parsing parameters', {
208
- contentLength: content.length,
209
- contentPreview: content.substring(0, 200)
210
- });
211
-
212
- // Extract self-closing <analyze> tags
213
- // Pattern: <analyze ...attributes... />
214
- // We need to capture everything between 'analyze' and '/>' which includes file paths with /
215
- const analyzePattern = /<analyze\s+(.+?)\/>/g;
216
- let match;
217
-
218
- while ((match = analyzePattern.exec(content)) !== null) {
219
- const attributeString = match[1].trim();
220
- const parser = new TagParser();
221
- const attributes = parser.parseAttributes(attributeString);
222
-
223
- const action = {
224
- type: 'analyze',
225
- ...attributes
226
- };
227
-
228
- // Normalize attribute names
229
- if (action['file-path']) {
230
- action.filePath = action['file-path'];
231
- delete action['file-path'];
232
- }
233
- if (action['include-warnings']) {
234
- action.includeWarnings = action['include-warnings'] === 'true';
235
- delete action['include-warnings'];
236
- }
237
- if (action['max-errors']) {
238
- action.maxErrors = parseInt(action['max-errors'], 10);
239
- delete action['max-errors'];
240
- }
241
-
242
- actions.push(action);
243
- }
244
-
245
- // Extract self-closing <analyze-project> tags
246
- const projectPattern = /<analyze-project\s+(.+?)\/>/g;
247
-
248
- while ((match = projectPattern.exec(content)) !== null) {
249
- const attributeString = match[1].trim();
250
- const parser = new TagParser();
251
- const attributes = parser.parseAttributes(attributeString);
252
-
253
- const action = {
254
- type: 'analyze-project',
255
- ...attributes
256
- };
257
-
258
- // Normalize attribute names
259
- if (action['include-warnings']) {
260
- action.includeWarnings = action['include-warnings'] === 'true';
261
- delete action['include-warnings'];
262
- }
263
- if (action['max-errors']) {
264
- action.maxErrors = parseInt(action['max-errors'], 10);
265
- delete action['max-errors'];
266
- }
267
-
268
- actions.push(action);
269
- }
270
-
271
- // Extract self-closing <fix> tags
272
- const fixPattern = /<fix\s+(.+?)\/>/g;
273
-
274
- while ((match = fixPattern.exec(content)) !== null) {
275
- const attributeString = match[1].trim();
276
- const parser = new TagParser();
277
- const attributes = parser.parseAttributes(attributeString);
278
-
279
- const action = {
280
- type: 'fix',
281
- ...attributes
282
- };
283
-
284
- // Normalize attribute names
285
- if (action['file-path']) {
286
- action.filePath = action['file-path'];
287
- delete action['file-path'];
288
- }
289
- if (action['write-file']) {
290
- action.writeFile = action['write-file'] === 'true';
291
- delete action['write-file'];
292
- }
293
-
294
- actions.push(action);
295
- }
296
-
297
- // Extract self-closing <format> tags
298
- const formatPattern = /<format\s+(.+?)\/>/g;
299
-
300
- while ((match = formatPattern.exec(content)) !== null) {
301
- const attributeString = match[1].trim();
302
- const parser = new TagParser();
303
- const attributes = parser.parseAttributes(attributeString);
304
-
305
- const action = {
306
- type: 'format',
307
- ...attributes
308
- };
309
-
310
- // Normalize attribute names
311
- if (action['file-path']) {
312
- action.filePath = action['file-path'];
313
- delete action['file-path'];
314
- }
315
- if (action['write-file']) {
316
- action.writeFile = action['write-file'] === 'true';
317
- delete action['write-file'];
318
- }
319
-
320
- actions.push(action);
321
- }
322
-
323
- // Extract self-closing <security-scan> tags
324
- const securityScanPattern = /<security-scan\s+(.+?)\/>/g;
325
-
326
- while ((match = securityScanPattern.exec(content)) !== null) {
327
- const attributeString = match[1].trim();
328
- const parser = new TagParser();
329
- const attributes = parser.parseAttributes(attributeString);
330
-
331
- const action = {
332
- type: 'security-scan',
333
- ...attributes
334
- };
335
-
336
- // Normalize attribute names
337
- if (action['file-path']) {
338
- action.filePath = action['file-path'];
339
- delete action['file-path'];
340
- }
341
- if (action['skip-test-files']) {
342
- action.skipTestFiles = action['skip-test-files'] === 'true';
343
- delete action['skip-test-files'];
344
- }
345
-
346
- actions.push(action);
347
- }
348
-
349
- // Extract self-closing <security-scan-project> tags
350
- const securityScanProjectPattern = /<security-scan-project\s+(.+?)\/>/g;
351
-
352
- while ((match = securityScanProjectPattern.exec(content)) !== null) {
353
- const attributeString = match[1].trim();
354
- const parser = new TagParser();
355
- const attributes = parser.parseAttributes(attributeString);
356
-
357
- const action = {
358
- type: 'security-scan-project',
359
- ...attributes
360
- };
361
-
362
- // Normalize attribute names
363
- if (action['skip-test-files']) {
364
- action.skipTestFiles = action['skip-test-files'] === 'true';
365
- delete action['skip-test-files'];
366
- }
367
-
368
- actions.push(action);
369
- }
370
-
371
- // Extract self-closing <validate-config> tags
372
- const validateConfigPattern = /<validate-config\s+(.+?)\/>/g;
373
-
374
- while ((match = validateConfigPattern.exec(content)) !== null) {
375
- const attributeString = match[1].trim();
376
- const parser = new TagParser();
377
- const attributes = parser.parseAttributes(attributeString);
378
-
379
- const action = {
380
- type: 'validate-config',
381
- ...attributes
382
- };
383
-
384
- // Normalize attribute names
385
- if (action['file-path']) {
386
- action.filePath = action['file-path'];
387
- delete action['file-path'];
388
- }
389
-
390
- actions.push(action);
391
- }
392
-
393
- // Extract self-closing <validate-config-directory> tags
394
- const validateConfigDirPattern = /<validate-config-directory\s+(.+?)\/>/g;
395
-
396
- while ((match = validateConfigDirPattern.exec(content)) !== null) {
397
- const attributeString = match[1].trim();
398
- const parser = new TagParser();
399
- const attributes = parser.parseAttributes(attributeString);
400
-
401
- const action = {
402
- type: 'validate-config-directory',
403
- ...attributes
404
- };
405
-
406
- // Normalize attribute names (none specific yet)
407
-
408
- actions.push(action);
409
- }
410
-
411
- params.actions = actions;
412
- params.rawContent = content.trim();
413
-
414
- this.logger?.debug('Parsed StaticAnalysis tool parameters', {
415
- totalActions: actions.length,
416
- actionTypes: actions.map(a => a.type)
417
- });
418
-
419
- return params;
420
-
421
- } catch (error) {
422
- throw new Error(`Failed to parse static analysis parameters: ${error.message}`);
423
- }
424
- }
425
-
426
- /**
427
- * Get required parameters
428
- * @returns {Array<string>} Array of required parameter names
429
- */
430
- getRequiredParameters() {
431
- return ['actions'];
432
- }
433
-
434
- /**
435
- * Custom parameter validation
436
- * @param {Object} params - Parameters to validate
437
- * @returns {Object} Validation result
438
- */
439
- customValidateParameters(params) {
440
- const errors = [];
441
-
442
- if (!params.actions || !Array.isArray(params.actions) || params.actions.length === 0) {
443
- errors.push('At least one action is required');
444
- } else {
445
- // Validate each action
446
- for (const [index, action] of params.actions.entries()) {
447
- if (!action.type) {
448
- errors.push(`Action ${index + 1}: type is required`);
449
- continue;
450
- }
451
-
452
- switch (action.type) {
453
- case 'analyze':
454
- if (!action.filePath) {
455
- errors.push(`Action ${index + 1}: file-path is required for analyze`);
456
- }
457
- break;
458
-
459
- case 'analyze-project':
460
- if (!action.directory) {
461
- errors.push(`Action ${index + 1}: directory is required for analyze-project`);
462
- }
463
- break;
464
-
465
- case 'fix':
466
- if (!action.filePath) {
467
- errors.push(`Action ${index + 1}: file-path is required for fix`);
468
- }
469
- break;
470
-
471
- case 'format':
472
- if (!action.filePath) {
473
- errors.push(`Action ${index + 1}: file-path is required for format`);
474
- }
475
- break;
476
-
477
- case 'security-scan':
478
- if (!action.filePath) {
479
- errors.push(`Action ${index + 1}: file-path is required for security-scan`);
480
- }
481
- break;
482
-
483
- case 'security-scan-project':
484
- if (!action.directory) {
485
- errors.push(`Action ${index + 1}: directory is required for security-scan-project`);
486
- }
487
- break;
488
-
489
- case 'validate-config':
490
- if (!action.filePath) {
491
- errors.push(`Action ${index + 1}: file-path is required for validate-config`);
492
- }
493
- break;
494
-
495
- case 'validate-config-directory':
496
- if (!action.directory) {
497
- errors.push(`Action ${index + 1}: directory is required for validate-config-directory`);
498
- }
499
- break;
500
-
501
- default:
502
- errors.push(`Action ${index + 1}: unknown action type: ${action.type}`);
503
- }
504
- }
505
-
506
- // Check batch size limit
507
- if (params.actions.length > this.maxFilesPerBatch) {
508
- errors.push(`Too many actions: ${params.actions.length} (max ${this.maxFilesPerBatch})`);
509
- }
510
- }
511
-
512
- return {
513
- valid: errors.length === 0,
514
- errors
515
- };
516
- }
517
-
518
- /**
519
- * Execute tool with parsed parameters
520
- * @param {Object} params - Parsed parameters
521
- * @param {Object} context - Execution context
522
- * @returns {Promise<Object>} Execution result
523
- */
524
- async execute(params, context) {
525
- const { actions } = params;
526
- const { projectDir, agentId, directoryAccess } = context;
527
-
528
- // Get directory access configuration
529
- const accessConfig = directoryAccess ||
530
- this.directoryAccessManager.createDirectoryAccess({
531
- workingDirectory: projectDir || process.cwd(),
532
- writeEnabledDirectories: [projectDir || process.cwd()],
533
- restrictToProject: true
534
- });
535
-
536
- const workingDir = this.directoryAccessManager.getWorkingDirectory(accessConfig);
537
- const results = {
538
- files: [],
539
- summary: {
540
- totalFiles: 0,
541
- totalErrors: 0,
542
- totalWarnings: 0,
543
- totalInfo: 0,
544
- errorsByCategory: {},
545
- filesByLanguage: {},
546
- filesWithErrors: 0
547
- }
548
- };
549
-
550
- for (const action of actions) {
551
- try {
552
- let actionResult;
553
-
554
- switch (action.type) {
555
- case 'analyze':
556
- actionResult = await this.analyzeFile(action.filePath, workingDir, accessConfig, action);
557
- if (actionResult) {
558
- results.files.push(actionResult);
559
- this.updateSummary(results.summary, actionResult);
560
- }
561
- break;
562
-
563
- case 'analyze-project':
564
- const projectFiles = await this.analyzeProject(action.directory, action.pattern, workingDir, accessConfig, action);
565
- results.files.push(...projectFiles);
566
- for (const fileResult of projectFiles) {
567
- this.updateSummary(results.summary, fileResult);
568
- }
569
- break;
570
-
571
- case 'fix':
572
- actionResult = await this.fixFile(action.filePath, workingDir, accessConfig, action);
573
- if (actionResult) {
574
- results.files.push(actionResult);
575
- }
576
- break;
577
-
578
- case 'format':
579
- actionResult = await this.formatFile(action.filePath, workingDir, accessConfig, action);
580
- if (actionResult) {
581
- results.files.push(actionResult);
582
- }
583
- break;
584
-
585
- case 'security-scan':
586
- actionResult = await this.securityScanFile(action.filePath, workingDir, accessConfig, action);
587
- if (actionResult) {
588
- results.files.push(actionResult);
589
- this.updateSummary(results.summary, actionResult);
590
- }
591
- break;
592
-
593
- case 'security-scan-project':
594
- const securityProjectFiles = await this.securityScanProject(action.directory, action.pattern, workingDir, accessConfig, action);
595
- results.files.push(...securityProjectFiles);
596
- for (const fileResult of securityProjectFiles) {
597
- this.updateSummary(results.summary, fileResult);
598
- }
599
- break;
600
-
601
- case 'validate-config':
602
- actionResult = await this.validateConfigFile(action.filePath, workingDir, accessConfig, action);
603
- if (actionResult) {
604
- results.files.push(actionResult);
605
- this.updateSummary(results.summary, actionResult);
606
- }
607
- break;
608
-
609
- case 'validate-config-directory':
610
- const configFiles = await this.validateConfigDirectory(action.directory, workingDir, accessConfig, action);
611
- results.files.push(...configFiles);
612
- for (const fileResult of configFiles) {
613
- this.updateSummary(results.summary, fileResult);
614
- }
615
- break;
616
-
617
- default:
618
- throw new Error(`Unknown action type: ${action.type}`);
619
- }
620
-
621
- } catch (error) {
622
- this.logger?.error('Static analysis action failed', {
623
- action: action.type,
624
- error: error.message
625
- });
626
-
627
- results.files.push({
628
- file: action.filePath || action.directory,
629
- error: error.message,
630
- success: false
631
- });
632
- }
633
- }
634
-
635
- return {
636
- success: true,
637
- results,
638
- toolUsed: 'staticanalysis',
639
- performance: this.getPerformanceMetrics()
640
- };
641
- }
642
-
643
- /**
644
- * Analyze a single file
645
- * @private
646
- */
647
- async analyzeFile(filePath, workingDir, accessConfig, options = {}) {
648
- const fullPath = path.isAbsolute(filePath)
649
- ? path.normalize(filePath)
650
- : path.resolve(workingDir, filePath);
651
-
652
- // Validate read access
653
- const accessResult = this.directoryAccessManager.validateReadAccess(fullPath, accessConfig);
654
- if (!accessResult.allowed) {
655
- throw new Error(`Read access denied: ${accessResult.reason}`);
656
- }
657
-
658
- // Check file exists
659
- try {
660
- const stats = await fs.stat(fullPath);
661
-
662
- if (stats.size > this.maxFileSize) {
663
- throw new Error(`File too large: ${stats.size} bytes (max ${this.maxFileSize})`);
664
- }
665
-
666
- // Detect language from file extension
667
- const language = this.detectLanguage(fullPath);
668
-
669
- if (!language) {
670
- return {
671
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
672
- fullPath,
673
- language: 'unknown',
674
- errors: [],
675
- warnings: [],
676
- info: [],
677
- skipped: true,
678
- skipReason: 'Unsupported file type'
679
- };
680
- }
681
-
682
- // Read file content
683
- const content = await fs.readFile(fullPath, 'utf-8');
684
-
685
- // Check cache (use content hash for more accurate caching)
686
- const contentHash = this.useContentHash ? this.computeContentHash(content) : null;
687
- const cacheKey = this.useContentHash
688
- ? `${fullPath}:${contentHash}`
689
- : `${fullPath}:${stats.mtime.getTime()}`;
690
-
691
- if (this.enableCache && this.analysisCache.has(cacheKey)) {
692
- const cached = this.analysisCache.get(cacheKey);
693
- if (Date.now() - cached.timestamp < this.cacheExpiry) {
694
- this.logger?.debug('Using cached analysis result', { file: fullPath });
695
- this.metrics.cacheHits++;
696
- this.metrics.totalAnalyses++;
697
- return cached.result;
698
- }
699
- }
700
-
701
- this.metrics.cacheMisses++;
702
- this.metrics.totalAnalyses++;
703
-
704
- // Get analyzer for language
705
- const analyzer = await this.getAnalyzer(language);
706
-
707
- if (!analyzer) {
708
- return {
709
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
710
- fullPath,
711
- language,
712
- errors: [],
713
- warnings: [],
714
- info: [],
715
- skipped: true,
716
- skipReason: `No analyzer available for ${language}`
717
- };
718
- }
719
-
720
- // Perform analysis with timing
721
- const analysisStart = Date.now();
722
- const diagnostics = await analyzer.analyze(fullPath, content, {
723
- workingDir,
724
- accessConfig,
725
- framework: await this.detectFramework(workingDir, language)
726
- });
727
- const analysisTime = Date.now() - analysisStart;
728
-
729
- this.metrics.totalAnalysisTime += analysisTime;
730
- this.metrics.filesAnalyzed++;
731
-
732
- // Format results
733
- const result = {
734
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
735
- fullPath,
736
- language,
737
- framework: await this.detectFramework(workingDir, language),
738
- errors: diagnostics.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.ERROR),
739
- warnings: options.includeWarnings !== false
740
- ? diagnostics.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.WARNING)
741
- : [],
742
- info: diagnostics.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.INFO),
743
- totalIssues: diagnostics.length,
744
- analyzed: true,
745
- timestamp: new Date().toISOString()
746
- };
747
-
748
- // Apply max errors limit
749
- if (options.maxErrors && result.errors.length > options.maxErrors) {
750
- result.errors = result.errors.slice(0, options.maxErrors);
751
- result.truncated = true;
752
- }
753
-
754
- // Cache result
755
- if (this.enableCache) {
756
- this.analysisCache.set(cacheKey, {
757
- result,
758
- timestamp: Date.now()
759
- });
760
- }
761
-
762
- return result;
763
-
764
- } catch (error) {
765
- throw new Error(`Failed to analyze ${filePath}: ${error.message}`);
766
- }
767
- }
768
-
769
- /**
770
- * Analyze project directory
771
- * @private
772
- */
773
- async analyzeProject(directory, pattern, workingDir, accessConfig, options = {}) {
774
- const fullDir = path.isAbsolute(directory)
775
- ? path.normalize(directory)
776
- : path.resolve(workingDir, directory);
777
-
778
- // Validate read access
779
- const accessResult = this.directoryAccessManager.validateReadAccess(fullDir, accessConfig);
780
- if (!accessResult.allowed) {
781
- throw new Error(`Read access denied: ${accessResult.reason}`);
782
- }
783
-
784
- // Find all matching files
785
- const files = await this.findFiles(fullDir, pattern);
786
-
787
- if (files.length > this.maxFilesPerBatch) {
788
- throw new Error(`Too many files: ${files.length} (max ${this.maxFilesPerBatch})`);
789
- }
790
-
791
- // Analyze files (parallel or sequential based on configuration)
792
- const results = [];
793
-
794
- if (this.parallelAnalysis && files.length > 1) {
795
- // Parallel analysis in batches
796
- this.logger?.debug('Using parallel analysis', {
797
- totalFiles: files.length,
798
- batchSize: this.maxParallelFiles
799
- });
800
-
801
- for (let i = 0; i < files.length; i += this.maxParallelFiles) {
802
- const batch = files.slice(i, i + this.maxParallelFiles);
803
- this.metrics.parallelBatches++;
804
-
805
- // Report progress
806
- const progress = {
807
- completed: i,
808
- total: files.length,
809
- percentage: Math.round((i / files.length) * 100)
810
- };
811
-
812
- if (options.onProgress) {
813
- options.onProgress(progress);
814
- }
815
-
816
- this.logger?.debug('Analyzing batch', {
817
- batch: Math.floor(i / this.maxParallelFiles) + 1,
818
- filesInBatch: batch.length,
819
- progress: `${progress.completed}/${progress.total}`
820
- });
821
-
822
- // Analyze batch in parallel
823
- const batchPromises = batch.map(async (file) => {
824
- try {
825
- const result = await this.analyzeFile(file, workingDir, accessConfig, options);
826
- return result;
827
- } catch (error) {
828
- this.logger?.warn('Failed to analyze file in project', {
829
- file,
830
- error: error.message
831
- });
832
-
833
- return {
834
- file: this.directoryAccessManager.createRelativePath(file, accessConfig),
835
- fullPath: file,
836
- error: error.message,
837
- success: false
838
- };
839
- }
840
- });
841
-
842
- const batchResults = await Promise.all(batchPromises);
843
- results.push(...batchResults.filter(r => r !== null));
844
- }
845
-
846
- // Final progress report
847
- if (options.onProgress) {
848
- options.onProgress({
849
- completed: files.length,
850
- total: files.length,
851
- percentage: 100
852
- });
853
- }
854
-
855
- } else {
856
- // Sequential analysis
857
- for (const file of files) {
858
- try {
859
- const result = await this.analyzeFile(file, workingDir, accessConfig, options);
860
- if (result) {
861
- results.push(result);
862
- }
863
- } catch (error) {
864
- this.logger?.warn('Failed to analyze file in project', {
865
- file,
866
- error: error.message
867
- });
868
-
869
- results.push({
870
- file: this.directoryAccessManager.createRelativePath(file, accessConfig),
871
- fullPath: file,
872
- error: error.message,
873
- success: false
874
- });
875
- }
876
- }
877
- }
878
-
879
- return results;
880
- }
881
-
882
- /**
883
- * Fix code issues in a file
884
- * @private
885
- */
886
- async fixFile(filePath, workingDir, accessConfig, options = {}) {
887
- const fullPath = path.isAbsolute(filePath)
888
- ? path.normalize(filePath)
889
- : path.resolve(workingDir, filePath);
890
-
891
- // Validate read access
892
- const readResult = this.directoryAccessManager.validateReadAccess(fullPath, accessConfig);
893
- if (!readResult.allowed) {
894
- throw new Error(`Read access denied: ${readResult.reason}`);
895
- }
896
-
897
- // Validate write access if writeFile is true
898
- if (options.writeFile) {
899
- const writeResult = this.directoryAccessManager.validateWriteAccess(fullPath, accessConfig);
900
- if (!writeResult.allowed) {
901
- throw new Error(`Write access denied: ${writeResult.reason}`);
902
- }
903
- }
904
-
905
- try {
906
- // Read file
907
- const content = await fs.readFile(fullPath, 'utf-8');
908
-
909
- // Get ESLint analyzer
910
- const eslintAnalyzer = await this.getESLintAnalyzer();
911
-
912
- // Fix the code
913
- const fixResult = await eslintAnalyzer.fix(fullPath, content, {
914
- workingDir,
915
- accessConfig,
916
- framework: await this.detectFramework(workingDir, this.detectLanguage(fullPath))
917
- });
918
-
919
- // Write file if requested and changes were made
920
- if (options.writeFile && fixResult.fixed) {
921
- await fs.writeFile(fullPath, fixResult.content, 'utf-8');
922
- this.logger?.info('File fixed and written', { file: fullPath });
923
- }
924
-
925
- return {
926
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
927
- fullPath,
928
- action: 'fix',
929
- fixed: fixResult.fixed,
930
- fixedCount: fixResult.fixedCount,
931
- remainingErrors: fixResult.remainingErrors,
932
- remainingWarnings: fixResult.remainingWarnings,
933
- changes: fixResult.changes,
934
- written: !!(options.writeFile && fixResult.fixed),
935
- preview: !options.writeFile && fixResult.fixed ? fixResult.content : undefined
936
- };
937
-
938
- } catch (error) {
939
- throw new Error(`Failed to fix ${filePath}: ${error.message}`);
940
- }
941
- }
942
-
943
- /**
944
- * Format code in a file
945
- * @private
946
- */
947
- async formatFile(filePath, workingDir, accessConfig, options = {}) {
948
- const fullPath = path.isAbsolute(filePath)
949
- ? path.normalize(filePath)
950
- : path.resolve(workingDir, filePath);
951
-
952
- // Validate read access
953
- const readResult = this.directoryAccessManager.validateReadAccess(fullPath, accessConfig);
954
- if (!readResult.allowed) {
955
- throw new Error(`Read access denied: ${readResult.reason}`);
956
- }
957
-
958
- // Validate write access if writeFile is true
959
- if (options.writeFile) {
960
- const writeResult = this.directoryAccessManager.validateWriteAccess(fullPath, accessConfig);
961
- if (!writeResult.allowed) {
962
- throw new Error(`Write access denied: ${writeResult.reason}`);
963
- }
964
- }
965
-
966
- try {
967
- // Read file
968
- const content = await fs.readFile(fullPath, 'utf-8');
969
-
970
- // Get Prettier formatter
971
- const prettierFormatter = await this.getPrettierFormatter();
972
-
973
- // Check if file type is supported
974
- if (!prettierFormatter.isSupported(fullPath)) {
975
- return {
976
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
977
- fullPath,
978
- action: 'format',
979
- formatted: false,
980
- skipped: true,
981
- skipReason: 'File type not supported by Prettier'
982
- };
983
- }
984
-
985
- // Format the code
986
- const formatResult = await prettierFormatter.format(fullPath, content, {
987
- workingDir,
988
- accessConfig
989
- });
990
-
991
- // Write file if requested and changes were made
992
- if (options.writeFile && formatResult.formatted) {
993
- await fs.writeFile(fullPath, formatResult.content, 'utf-8');
994
- this.logger?.info('File formatted and written', { file: fullPath });
995
- }
996
-
997
- return {
998
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
999
- fullPath,
1000
- action: 'format',
1001
- formatted: formatResult.formatted,
1002
- linesChanged: formatResult.linesChanged,
1003
- changes: formatResult.changes,
1004
- written: !!(options.writeFile && formatResult.formatted),
1005
- preview: !options.writeFile && formatResult.formatted ? formatResult.content : undefined
1006
- };
1007
-
1008
- } catch (error) {
1009
- throw new Error(`Failed to format ${filePath}: ${error.message}`);
1010
- }
1011
- }
1012
-
1013
- /**
1014
- * Security scan a single file
1015
- * @private
1016
- */
1017
- async securityScanFile(filePath, workingDir, accessConfig, options = {}) {
1018
- const fullPath = path.isAbsolute(filePath)
1019
- ? path.normalize(filePath)
1020
- : path.resolve(workingDir, filePath);
1021
-
1022
- // Validate read access
1023
- const accessResult = this.directoryAccessManager.validateReadAccess(fullPath, accessConfig);
1024
- if (!accessResult.allowed) {
1025
- throw new Error(`Read access denied: ${accessResult.reason}`);
1026
- }
1027
-
1028
- try {
1029
- const stats = await fs.stat(fullPath);
1030
-
1031
- if (stats.size > this.maxFileSize) {
1032
- throw new Error(`File too large: ${stats.size} bytes (max ${this.maxFileSize})`);
1033
- }
1034
-
1035
- // Detect language
1036
- const language = this.detectLanguage(fullPath);
1037
-
1038
- // Security analyzer only supports JS/TS/Python
1039
- if (!language || !['javascript', 'typescript', 'python'].includes(language)) {
1040
- return {
1041
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
1042
- fullPath,
1043
- language: language || 'unknown',
1044
- issues: [],
1045
- skipped: true,
1046
- skipReason: 'Security scanning only supports JavaScript, TypeScript, and Python files'
1047
- };
1048
- }
1049
-
1050
- // Read file content
1051
- const content = await fs.readFile(fullPath, 'utf-8');
1052
-
1053
- // Get security analyzer
1054
- const securityAnalyzer = await this.getSecurityAnalyzer();
1055
-
1056
- // Perform security scan
1057
- const issues = await securityAnalyzer.analyze(fullPath, content, {
1058
- skipTestFiles: options.skipTestFiles !== false
1059
- });
1060
-
1061
- // Categorize issues by severity
1062
- const result = {
1063
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
1064
- fullPath,
1065
- language,
1066
- action: 'security-scan',
1067
- critical: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.CRITICAL),
1068
- errors: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.ERROR),
1069
- warnings: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.WARNING),
1070
- info: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.INFO),
1071
- totalIssues: issues.length,
1072
- analyzed: true,
1073
- scannersUsed: issues.map(i => i.scanner).filter((v, i, a) => a.indexOf(v) === i),
1074
- timestamp: new Date().toISOString()
1075
- };
1076
-
1077
- return result;
1078
-
1079
- } catch (error) {
1080
- throw new Error(`Failed to security scan ${filePath}: ${error.message}`);
1081
- }
1082
- }
1083
-
1084
- /**
1085
- * Security scan project directory
1086
- * @private
1087
- */
1088
- async securityScanProject(directory, pattern, workingDir, accessConfig, options = {}) {
1089
- const fullDir = path.isAbsolute(directory)
1090
- ? path.normalize(directory)
1091
- : path.resolve(workingDir, directory);
1092
-
1093
- // Validate read access
1094
- const accessResult = this.directoryAccessManager.validateReadAccess(fullDir, accessConfig);
1095
- if (!accessResult.allowed) {
1096
- throw new Error(`Read access denied: ${accessResult.reason}`);
1097
- }
1098
-
1099
- // Get security analyzer for dependency scanning
1100
- const securityAnalyzer = await this.getSecurityAnalyzer();
1101
-
1102
- // Run dependency scans at project level
1103
- const dependencyIssues = await securityAnalyzer.analyzeProject(fullDir, 'javascript', options);
1104
-
1105
- // Find all matching files (only JS/TS/Python for security scanning)
1106
- const searchPattern = pattern || '**/*.{js,jsx,mjs,cjs,ts,tsx,py}';
1107
- const files = await this.findFiles(fullDir, searchPattern);
1108
-
1109
- if (files.length > this.maxFilesPerBatch) {
1110
- throw new Error(`Too many files: ${files.length} (max ${this.maxFilesPerBatch})`);
1111
- }
1112
-
1113
- // Scan files (parallel or sequential)
1114
- const results = [];
1115
-
1116
- if (this.parallelAnalysis && files.length > 1) {
1117
- // Parallel scanning in batches
1118
- this.logger?.debug('Using parallel security scanning', {
1119
- totalFiles: files.length,
1120
- batchSize: this.maxParallelFiles
1121
- });
1122
-
1123
- for (let i = 0; i < files.length; i += this.maxParallelFiles) {
1124
- const batch = files.slice(i, i + this.maxParallelFiles);
1125
-
1126
- if (options.onProgress) {
1127
- options.onProgress({
1128
- completed: i,
1129
- total: files.length,
1130
- percentage: Math.round((i / files.length) * 100)
1131
- });
1132
- }
1133
-
1134
- const batchPromises = batch.map(async (file) => {
1135
- try {
1136
- return await this.securityScanFile(file, workingDir, accessConfig, options);
1137
- } catch (error) {
1138
- this.logger?.warn('Failed to security scan file in project', {
1139
- file,
1140
- error: error.message
1141
- });
1142
-
1143
- return {
1144
- file: this.directoryAccessManager.createRelativePath(file, accessConfig),
1145
- fullPath: file,
1146
- error: error.message,
1147
- success: false
1148
- };
1149
- }
1150
- });
1151
-
1152
- const batchResults = await Promise.all(batchPromises);
1153
- results.push(...batchResults.filter(r => r !== null));
1154
- }
1155
-
1156
- if (options.onProgress) {
1157
- options.onProgress({
1158
- completed: files.length,
1159
- total: files.length,
1160
- percentage: 100
1161
- });
1162
- }
1163
-
1164
- } else {
1165
- // Sequential scanning
1166
- for (const file of files) {
1167
- try {
1168
- const result = await this.securityScanFile(file, workingDir, accessConfig, options);
1169
- if (result) {
1170
- results.push(result);
1171
- }
1172
- } catch (error) {
1173
- this.logger?.warn('Failed to security scan file in project', {
1174
- file,
1175
- error: error.message
1176
- });
1177
-
1178
- results.push({
1179
- file: this.directoryAccessManager.createRelativePath(file, accessConfig),
1180
- fullPath: file,
1181
- error: error.message,
1182
- success: false
1183
- });
1184
- }
1185
- }
1186
- }
1187
-
1188
- // Add dependency scan results if any
1189
- if (dependencyIssues.length > 0) {
1190
- results.push({
1191
- file: path.join(fullDir, 'package.json'),
1192
- fullPath: path.join(fullDir, 'package.json'),
1193
- action: 'dependency-scan',
1194
- critical: dependencyIssues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.CRITICAL),
1195
- errors: dependencyIssues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.ERROR),
1196
- warnings: dependencyIssues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.WARNING),
1197
- info: dependencyIssues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.INFO),
1198
- totalIssues: dependencyIssues.length,
1199
- analyzed: true,
1200
- scannersUsed: ['npm-audit'],
1201
- timestamp: new Date().toISOString()
1202
- });
1203
- }
1204
-
1205
- return results;
1206
- }
1207
-
1208
- /**
1209
- * Validate a configuration file
1210
- * @private
1211
- */
1212
- async validateConfigFile(filePath, workingDir, accessConfig, options = {}) {
1213
- const fullPath = path.isAbsolute(filePath)
1214
- ? path.normalize(filePath)
1215
- : path.resolve(workingDir, filePath);
1216
-
1217
- // Validate read access
1218
- const accessResult = this.directoryAccessManager.validateReadAccess(fullPath, accessConfig);
1219
- if (!accessResult.allowed) {
1220
- throw new Error(`Read access denied: ${accessResult.reason}`);
1221
- }
1222
-
1223
- try {
1224
- const stats = await fs.stat(fullPath);
1225
-
1226
- if (stats.size > this.maxFileSize) {
1227
- throw new Error(`File too large: ${stats.size} bytes (max ${this.maxFileSize})`);
1228
- }
1229
-
1230
- // Get config validator
1231
- const configValidator = await this.getConfigValidator();
1232
-
1233
- // Perform validation
1234
- const issues = await configValidator.validate(fullPath, options);
1235
-
1236
- // Categorize issues by severity
1237
- const result = {
1238
- file: this.directoryAccessManager.createRelativePath(fullPath, accessConfig),
1239
- fullPath,
1240
- action: 'validate-config',
1241
- critical: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.CRITICAL),
1242
- errors: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.ERROR),
1243
- warnings: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.WARNING),
1244
- info: issues.filter(d => d.severity === STATIC_ANALYSIS.SEVERITY.INFO),
1245
- totalIssues: issues.length,
1246
- analyzed: true,
1247
- validatorsUsed: issues.map(i => i.validator).filter((v, i, a) => a.indexOf(v) === i),
1248
- timestamp: new Date().toISOString()
1249
- };
1250
-
1251
- return result;
1252
-
1253
- } catch (error) {
1254
- throw new Error(`Failed to validate config ${filePath}: ${error.message}`);
1255
- }
1256
- }
1257
-
1258
- /**
1259
- * Validate configuration files in a directory
1260
- * @private
1261
- */
1262
- async validateConfigDirectory(directory, workingDir, accessConfig, options = {}) {
1263
- const fullDir = path.isAbsolute(directory)
1264
- ? path.normalize(directory)
1265
- : path.resolve(workingDir, directory);
1266
-
1267
- // Validate read access
1268
- const accessResult = this.directoryAccessManager.validateReadAccess(fullDir, accessConfig);
1269
- if (!accessResult.allowed) {
1270
- throw new Error(`Read access denied: ${accessResult.reason}`);
1271
- }
1272
-
1273
- // Find common config files
1274
- const configFiles = await this.findConfigFiles(fullDir);
1275
-
1276
- if (configFiles.length > this.maxFilesPerBatch) {
1277
- throw new Error(`Too many config files: ${configFiles.length} (max ${this.maxFilesPerBatch})`);
1278
- }
1279
-
1280
- // Validate files
1281
- const results = [];
1282
-
1283
- for (const file of configFiles) {
1284
- try {
1285
- const result = await this.validateConfigFile(file, workingDir, accessConfig, options);
1286
- if (result) {
1287
- results.push(result);
1288
- }
1289
- } catch (error) {
1290
- this.logger?.warn('Failed to validate config file', {
1291
- file,
1292
- error: error.message
1293
- });
1294
-
1295
- results.push({
1296
- file: this.directoryAccessManager.createRelativePath(file, accessConfig),
1297
- fullPath: file,
1298
- error: error.message,
1299
- success: false
1300
- });
1301
- }
1302
- }
1303
-
1304
- return results;
1305
- }
1306
-
1307
- /**
1308
- * Find common configuration files in directory
1309
- * @private
1310
- */
1311
- async findConfigFiles(directory) {
1312
- const files = [];
1313
- const configFileNames = [
1314
- 'package.json',
1315
- 'tsconfig.json',
1316
- 'Dockerfile',
1317
- 'docker-compose.yml',
1318
- 'docker-compose.yaml',
1319
- '.env',
1320
- '.env.example',
1321
- '.eslintrc.js',
1322
- '.eslintrc.json',
1323
- '.prettierrc',
1324
- '.prettierrc.json'
1325
- ];
1326
-
1327
- const configExtensions = ['.yml', '.yaml', '.json', '.tf', '.tfvars'];
1328
-
1329
- const walk = async (dir) => {
1330
- const entries = await fs.readdir(dir, { withFileTypes: true });
1331
-
1332
- for (const entry of entries) {
1333
- const fullPath = path.join(dir, entry.name);
1334
-
1335
- if (entry.isDirectory()) {
1336
- // Check specific directories for config files
1337
- if (entry.name === '.github' || entry.name === 'kubernetes' || entry.name === 'k8s' || entry.name === 'terraform') {
1338
- await walk(fullPath);
1339
- } else if (!['node_modules', '.git', 'dist', 'build'].includes(entry.name)) {
1340
- // Don't recurse into all subdirectories, only known config dirs
1341
- // Check this level only
1342
- continue;
1343
- }
1344
- } else if (entry.isFile()) {
1345
- // Check if it's a known config file
1346
- if (configFileNames.includes(entry.name)) {
1347
- files.push(fullPath);
1348
- } else {
1349
- // Check if it's in a config directory with config extension
1350
- const ext = path.extname(entry.name).toLowerCase();
1351
- if (configExtensions.includes(ext)) {
1352
- const dirname = path.basename(path.dirname(fullPath));
1353
- if (dirname === 'kubernetes' || dirname === 'k8s' || dirname === 'terraform' || dirname === 'workflows') {
1354
- files.push(fullPath);
1355
- }
1356
- }
1357
- }
1358
- }
1359
- }
1360
- };
1361
-
1362
- await walk(directory);
1363
- return files;
1364
- }
1365
-
1366
- /**
1367
- * Detect programming language from file extension
1368
- * @private
1369
- */
1370
- detectLanguage(filePath) {
1371
- const ext = path.extname(filePath).toLowerCase();
1372
- return STATIC_ANALYSIS.EXTENSION_TO_LANGUAGE[ext] || null;
1373
- }
1374
-
1375
- /**
1376
- * Detect framework from project directory
1377
- * @private
1378
- */
1379
- async detectFramework(projectDir, language) {
1380
- try {
1381
- if (language === STATIC_ANALYSIS.LANGUAGE.JAVASCRIPT ||
1382
- language === STATIC_ANALYSIS.LANGUAGE.TYPESCRIPT) {
1383
- return await this.detectJSFramework(projectDir);
1384
- }
1385
-
1386
- if (language === STATIC_ANALYSIS.LANGUAGE.PYTHON) {
1387
- return await this.detectPythonFramework(projectDir);
1388
- }
1389
-
1390
- return null;
1391
- } catch (error) {
1392
- this.logger?.debug('Framework detection failed', { error: error.message });
1393
- return null;
1394
- }
1395
- }
1396
-
1397
- /**
1398
- * Detect JavaScript/TypeScript framework
1399
- * @private
1400
- */
1401
- async detectJSFramework(projectDir) {
1402
- try {
1403
- const pkgPath = path.join(projectDir, STATIC_ANALYSIS.FRAMEWORK_MANIFESTS.JAVASCRIPT);
1404
- const pkgContent = await fs.readFile(pkgPath, 'utf-8');
1405
- const pkg = JSON.parse(pkgContent);
1406
-
1407
- const deps = {
1408
- ...pkg.dependencies,
1409
- ...pkg.devDependencies
1410
- };
1411
-
1412
- // Check for frameworks in priority order
1413
- for (const [name, identifier] of Object.entries(STATIC_ANALYSIS.JS_FRAMEWORKS)) {
1414
- if (deps[identifier]) {
1415
- return name.toLowerCase();
1416
- }
1417
- }
1418
-
1419
- return null;
1420
- } catch (error) {
1421
- return null;
1422
- }
1423
- }
1424
-
1425
- /**
1426
- * Detect Python framework
1427
- * @private
1428
- */
1429
- async detectPythonFramework(projectDir) {
1430
- try {
1431
- // Try requirements.txt
1432
- const reqPath = path.join(projectDir, STATIC_ANALYSIS.FRAMEWORK_MANIFESTS.PYTHON);
1433
- const reqContent = await fs.readFile(reqPath, 'utf-8');
1434
-
1435
- // Check for frameworks
1436
- for (const [name, identifier] of Object.entries(STATIC_ANALYSIS.PYTHON_FRAMEWORKS)) {
1437
- if (reqContent.toLowerCase().includes(identifier)) {
1438
- return name.toLowerCase();
1439
- }
1440
- }
1441
-
1442
- return null;
1443
- } catch (error) {
1444
- // Try pyproject.toml
1445
- try {
1446
- const tomlPath = path.join(projectDir, STATIC_ANALYSIS.FRAMEWORK_MANIFESTS.PYTHON_POETRY);
1447
- const tomlContent = await fs.readFile(tomlPath, 'utf-8');
1448
-
1449
- for (const [name, identifier] of Object.entries(STATIC_ANALYSIS.PYTHON_FRAMEWORKS)) {
1450
- if (tomlContent.toLowerCase().includes(identifier)) {
1451
- return name.toLowerCase();
1452
- }
1453
- }
1454
- } catch {
1455
- // No framework detected
1456
- }
1457
-
1458
- return null;
1459
- }
1460
- }
1461
-
1462
- /**
1463
- * Find files matching pattern in directory
1464
- * @private
1465
- */
1466
- async findFiles(directory, pattern) {
1467
- const files = [];
1468
-
1469
- // Default patterns by language if not specified
1470
- const searchPattern = pattern || '**/*.{js,jsx,mjs,cjs,ts,tsx,py,css,scss,sass,less}';
1471
-
1472
- // Parse pattern to extract extensions
1473
- // Supports patterns like "**/*.ts", "**/*.{js,ts}", "*.js", etc.
1474
- const getExtensionsFromPattern = (pat) => {
1475
- const exts = [];
1476
-
1477
- // Match patterns like *.{js,ts,tsx} or *.js
1478
- const bracesMatch = pat.match(/\*\.\{([^}]+)\}/);
1479
- if (bracesMatch) {
1480
- // Multiple extensions: *.{js,ts,tsx}
1481
- const extList = bracesMatch[1].split(',').map(e => e.trim());
1482
- extList.forEach(ext => exts.push(ext.startsWith('.') ? ext : '.' + ext));
1483
- } else {
1484
- // Single extension: *.js or **/*.ts
1485
- const singleMatch = pat.match(/\*\.([a-z]+)$/i);
1486
- if (singleMatch) {
1487
- const ext = singleMatch[1];
1488
- exts.push(ext.startsWith('.') ? ext : '.' + ext);
1489
- }
1490
- }
1491
-
1492
- // If no pattern found, allow all supported extensions
1493
- if (exts.length === 0) {
1494
- return null; // null means "all supported extensions"
1495
- }
1496
-
1497
- return exts;
1498
- };
1499
-
1500
- const allowedExtensions = getExtensionsFromPattern(searchPattern);
1501
-
1502
- // Simple recursive file search
1503
- const walk = async (dir) => {
1504
- const entries = await fs.readdir(dir, { withFileTypes: true });
1505
-
1506
- for (const entry of entries) {
1507
- const fullPath = path.join(dir, entry.name);
1508
-
1509
- if (entry.isDirectory()) {
1510
- // Skip common ignore directories
1511
- if (!['node_modules', '.git', 'dist', 'build', '__pycache__', '.venv', 'venv'].includes(entry.name)) {
1512
- await walk(fullPath);
1513
- }
1514
- } else if (entry.isFile()) {
1515
- const ext = path.extname(entry.name).toLowerCase();
1516
-
1517
- // Check if file extension is supported
1518
- if (STATIC_ANALYSIS.EXTENSION_TO_LANGUAGE[ext]) {
1519
- // If pattern specified, check if extension matches
1520
- if (allowedExtensions === null || allowedExtensions.includes(ext)) {
1521
- files.push(fullPath);
1522
- }
1523
- }
1524
- }
1525
- }
1526
- };
1527
-
1528
- await walk(directory);
1529
- return files;
1530
- }
1531
-
1532
- /**
1533
- * Get analyzer for language (lazy initialization)
1534
- * @private
1535
- */
1536
- async getAnalyzer(language) {
1537
- try {
1538
- // Lazy load analyzers
1539
- if (language === STATIC_ANALYSIS.LANGUAGE.JAVASCRIPT) {
1540
- if (!this.analyzers.javascript) {
1541
- const { default: JavaScriptAnalyzer } = await import('../analyzers/JavaScriptAnalyzer.js');
1542
- this.analyzers.javascript = new JavaScriptAnalyzer(this.logger);
1543
- }
1544
- return this.analyzers.javascript;
1545
- }
1546
-
1547
- if (language === STATIC_ANALYSIS.LANGUAGE.TYPESCRIPT) {
1548
- if (!this.analyzers.typescript) {
1549
- const { default: TypeScriptAnalyzer } = await import('../analyzers/TypeScriptAnalyzer.js');
1550
- this.analyzers.typescript = new TypeScriptAnalyzer(this.logger);
1551
- }
1552
- return this.analyzers.typescript;
1553
- }
1554
-
1555
- // Python analyzer
1556
- if (language === STATIC_ANALYSIS.LANGUAGE.PYTHON) {
1557
- if (!this.analyzers.python) {
1558
- const { default: PythonAnalyzer } = await import('../analyzers/PythonAnalyzer.js');
1559
- this.analyzers.python = new PythonAnalyzer(this.logger);
1560
- }
1561
- return this.analyzers.python;
1562
- }
1563
-
1564
- // CSS analyzer (handles CSS, SCSS, LESS)
1565
- if (language === STATIC_ANALYSIS.LANGUAGE.CSS ||
1566
- language === STATIC_ANALYSIS.LANGUAGE.SCSS ||
1567
- language === STATIC_ANALYSIS.LANGUAGE.LESS) {
1568
- if (!this.analyzers.css) {
1569
- const { default: CSSAnalyzer } = await import('../analyzers/CSSAnalyzer.js');
1570
- this.analyzers.css = new CSSAnalyzer(this.logger);
1571
- }
1572
- return this.analyzers.css;
1573
- }
1574
-
1575
- return null;
1576
- } catch (error) {
1577
- this.logger?.error('Failed to load analyzer', {
1578
- language,
1579
- error: error.message
1580
- });
1581
- return null;
1582
- }
1583
- }
1584
-
1585
- /**
1586
- * Get ESLint analyzer (lazy initialization)
1587
- * @private
1588
- */
1589
- async getESLintAnalyzer() {
1590
- if (!this.analyzers.eslint) {
1591
- const { default: ESLintAnalyzer } = await import('../analyzers/ESLintAnalyzer.js');
1592
- this.analyzers.eslint = new ESLintAnalyzer(this.logger);
1593
- }
1594
- return this.analyzers.eslint;
1595
- }
1596
-
1597
- /**
1598
- * Get Prettier formatter (lazy initialization)
1599
- * @private
1600
- */
1601
- async getPrettierFormatter() {
1602
- if (!this.formatters.prettier) {
1603
- const { default: PrettierFormatter } = await import('../analyzers/PrettierFormatter.js');
1604
- this.formatters.prettier = new PrettierFormatter(this.logger);
1605
- }
1606
- return this.formatters.prettier;
1607
- }
1608
-
1609
- /**
1610
- * Get Security analyzer (lazy initialization)
1611
- * @private
1612
- */
1613
- async getSecurityAnalyzer() {
1614
- if (!this.analyzers.security) {
1615
- const { default: SecurityAnalyzer } = await import('../analyzers/SecurityAnalyzer.js');
1616
- this.analyzers.security = new SecurityAnalyzer(this.logger);
1617
- }
1618
- return this.analyzers.security;
1619
- }
1620
-
1621
- /**
1622
- * Get Config validator (lazy initialization)
1623
- * @private
1624
- */
1625
- async getConfigValidator() {
1626
- if (!this.analyzers.config) {
1627
- const { default: ConfigValidator } = await import('../analyzers/ConfigValidator.js');
1628
- this.analyzers.config = new ConfigValidator(this.logger);
1629
- }
1630
- return this.analyzers.config;
1631
- }
1632
-
1633
- /**
1634
- * Update summary statistics
1635
- * @private
1636
- */
1637
- updateSummary(summary, fileResult) {
1638
- if (fileResult.analyzed) {
1639
- summary.totalFiles++;
1640
-
1641
- const criticalCount = fileResult.critical?.length || 0;
1642
- const errorCount = fileResult.errors?.length || 0;
1643
- const warningCount = fileResult.warnings?.length || 0;
1644
- const infoCount = fileResult.info?.length || 0;
1645
-
1646
- // Initialize totalCritical if not exists (for backward compatibility)
1647
- if (summary.totalCritical === undefined) {
1648
- summary.totalCritical = 0;
1649
- }
1650
-
1651
- summary.totalCritical += criticalCount;
1652
- summary.totalErrors += errorCount;
1653
- summary.totalWarnings += warningCount;
1654
- summary.totalInfo += infoCount;
1655
-
1656
- if (criticalCount > 0 || errorCount > 0) {
1657
- summary.filesWithErrors++;
1658
- }
1659
-
1660
- // Count by language
1661
- if (fileResult.language) {
1662
- summary.filesByLanguage[fileResult.language] =
1663
- (summary.filesByLanguage[fileResult.language] || 0) + 1;
1664
- }
1665
-
1666
- // Count by category (include critical issues)
1667
- const allIssues = [
1668
- ...(fileResult.critical || []),
1669
- ...(fileResult.errors || []),
1670
- ...(fileResult.warnings || [])
1671
- ];
1672
-
1673
- for (const issue of allIssues) {
1674
- if (issue.category) {
1675
- summary.errorsByCategory[issue.category] =
1676
- (summary.errorsByCategory[issue.category] || 0) + 1;
1677
- }
1678
- }
1679
- }
1680
- }
1681
-
1682
- /**
1683
- * Compute content hash for caching
1684
- * @private
1685
- */
1686
- computeContentHash(content) {
1687
- return crypto
1688
- .createHash('sha256')
1689
- .update(content)
1690
- .digest('hex')
1691
- .substring(0, 16); // Use first 16 chars for shorter cache keys
1692
- }
1693
-
1694
- /**
1695
- * Get performance metrics
1696
- * @returns {Object} Performance metrics
1697
- */
1698
- getPerformanceMetrics() {
1699
- const cacheHitRate = this.metrics.totalAnalyses > 0
1700
- ? (this.metrics.cacheHits / this.metrics.totalAnalyses) * 100
1701
- : 0;
1702
-
1703
- const avgAnalysisTime = this.metrics.filesAnalyzed > 0
1704
- ? this.metrics.totalAnalysisTime / this.metrics.filesAnalyzed
1705
- : 0;
1706
-
1707
- return {
1708
- ...this.metrics,
1709
- cacheHitRate: Math.round(cacheHitRate * 10) / 10, // Round to 1 decimal
1710
- averageAnalysisTime: Math.round(avgAnalysisTime),
1711
- cacheSize: this.analysisCache.size
1712
- };
1713
- }
1714
-
1715
- /**
1716
- * Reset performance metrics
1717
- */
1718
- resetPerformanceMetrics() {
1719
- this.metrics = {
1720
- totalAnalyses: 0,
1721
- cacheHits: 0,
1722
- cacheMisses: 0,
1723
- totalAnalysisTime: 0,
1724
- filesAnalyzed: 0,
1725
- parallelBatches: 0
1726
- };
1727
- }
1728
-
1729
- /**
1730
- * Clear analysis cache
1731
- */
1732
- clearCache() {
1733
- this.analysisCache.clear();
1734
- this.logger?.debug('Analysis cache cleared');
1735
- }
1736
-
1737
- /**
1738
- * Get supported actions for this tool
1739
- * @returns {Array<string>} Array of supported action names
1740
- */
1741
- getSupportedActions() {
1742
- return ['analyze', 'analyze-project', 'fix', 'format', 'security-scan', 'security-scan-project', 'validate-config', 'validate-config-directory'];
1743
- }
1744
-
1745
- /**
1746
- * Get parameter schema for validation
1747
- * @returns {Object} Parameter schema
1748
- */
1749
- getParameterSchema() {
1750
- return {
1751
- type: 'object',
1752
- properties: {
1753
- actions: {
1754
- type: 'array',
1755
- minItems: 1,
1756
- items: {
1757
- type: 'object',
1758
- properties: {
1759
- type: {
1760
- type: 'string',
1761
- enum: this.getSupportedActions()
1762
- },
1763
- filePath: { type: 'string' },
1764
- directory: { type: 'string' },
1765
- pattern: { type: 'string' },
1766
- includeWarnings: { type: 'boolean' },
1767
- maxErrors: { type: 'number' }
1768
- },
1769
- required: ['type']
1770
- }
1771
- }
1772
- },
1773
- required: ['actions']
1774
- };
1775
- }
1776
- }
1777
-
1778
- export default StaticAnalysisTool;
1
+ const a0_0x19f3ef=a0_0x4f45;(function(_0x3c66a8,_0x3882a5){const _0x35f33e=a0_0x4f45,_0x19cffe=_0x3c66a8();while(!![]){try{const _0x17bf6d=parseInt(_0x35f33e(0x133))/0x1+parseInt(_0x35f33e(0x164))/0x2*(-parseInt(_0x35f33e(0x12c))/0x3)+parseInt(_0x35f33e(0x109))/0x4+parseInt(_0x35f33e(0x14f))/0x5*(-parseInt(_0x35f33e(0x15e))/0x6)+parseInt(_0x35f33e(0x195))/0x7*(-parseInt(_0x35f33e(0x17a))/0x8)+parseInt(_0x35f33e(0x101))/0x9+parseInt(_0x35f33e(0x17c))/0xa*(parseInt(_0x35f33e(0x141))/0xb);if(_0x17bf6d===_0x3882a5)break;else _0x19cffe['push'](_0x19cffe['shift']());}catch(_0x1bcddd){_0x19cffe['push'](_0x19cffe['shift']());}}}(a0_0x41c6,0x6693b));import{BaseTool}from'./baseTool.js';import a0_0x880dc2 from'../utilities/tagParser.js';function a0_0x4f45(_0x308383,_0x554b75){_0x308383=_0x308383-0xea;const _0x41c639=a0_0x41c6();let _0x4f4525=_0x41c639[_0x308383];if(a0_0x4f45['cZxBnF']===undefined){var _0x192f6e=function(_0x45a20b){const _0x17a412='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x880dc2='',_0x44fc46='';for(let _0x52df5c=0x0,_0x3a4aba,_0x3533e3,_0x49ee77=0x0;_0x3533e3=_0x45a20b['charAt'](_0x49ee77++);~_0x3533e3&&(_0x3a4aba=_0x52df5c%0x4?_0x3a4aba*0x40+_0x3533e3:_0x3533e3,_0x52df5c++%0x4)?_0x880dc2+=String['fromCharCode'](0xff&_0x3a4aba>>(-0x2*_0x52df5c&0x6)):0x0){_0x3533e3=_0x17a412['indexOf'](_0x3533e3);}for(let _0x49b4e6=0x0,_0x3cb660=_0x880dc2['length'];_0x49b4e6<_0x3cb660;_0x49b4e6++){_0x44fc46+='%'+('00'+_0x880dc2['charCodeAt'](_0x49b4e6)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x44fc46);};a0_0x4f45['wBNGMO']=_0x192f6e,a0_0x4f45['xEpEUO']={},a0_0x4f45['cZxBnF']=!![];}const _0xded05c=_0x41c639[0x0],_0x47f1f8=_0x308383+_0xded05c,_0xe3f17=a0_0x4f45['xEpEUO'][_0x47f1f8];return!_0xe3f17?(_0x4f4525=a0_0x4f45['wBNGMO'](_0x4f4525),a0_0x4f45['xEpEUO'][_0x47f1f8]=_0x4f4525):_0x4f4525=_0xe3f17,_0x4f4525;}import a0_0x44fc46 from'../utilities/directoryAccessManager.js';import a0_0x52df5c from'fs/promises';import a0_0x3a4aba from'path';import a0_0x3533e3 from'crypto';import{STATIC_ANALYSIS,TOOL_STATUS,SYSTEM_DEFAULTS}from'../utilities/constants.js';function a0_0x41c6(){const _0x3153bd=['CMvHC29U','yw5HBhLZAxndywnOzq','C2XPy2u','oIbMAwXLlxbHDgGGAxmGCMvXDwLYzwqGzM9YigfUywX5EMu','q1jjveLdquW','BwvZC2fNzq','AgfZ','CgfJA2fNzs5QC29U','DgvYCMfMB3jT','C3rYAw5N','Dhj1BMnHDgvK','nti3mLDerKPQBa','BwfW','mtbOyuHKu1q','Cgf0DgvYBG','vfLqrvnduKLqva','Bwf4lwvYCM9YCW','v0fstKLorW','lNrM','oIbMAwXLlxbHDgGGAxmGCMvXDwLYzwqGzM9YihnLy3vYAxr5lxnJyw4','lI4Vyw5HBhL6zxjZl1nLy3vYAxr5qw5HBhL6zxiUANm','zgv0zwn0rNjHBwv3B3jR','D3jPDguTzMLSzq','y29UzMLN','qu5btfLtsvnFveLnru9vva','ChvZAa','zxjYB3jZqNLdyxrLz29YEq','yNvPBgq','BMfTzq','zg9JA2vYlwnVBxbVC2uUEwfTBa','Dg90ywXdCML0AwnHBa','rLjbtuvxt1jlx01btKLgrvnuuW','y3nZ','tufyx0zjtevtx1bfuL9cqvrdsa','Bwv0CMLJCW','AxngAwXL','igj5DgvZicHTyxGG','CMf3q29UDgvUDa','mJeZnxzeqw11AG','AxneAxjLy3rVCNK','AM9PBG','B25qCM9NCMvZCW','tufyx0zjtevFu0LArv9gt1jFqu5btfLtsvm','oIbMAwXLlxbHDgGGAxmGCMvXDwLYzwqGzM9YigzVCM1HDa','C2vJDxjPDhLty2fUuhjVAMvJDa','zMLUzenVBMzPz0zPBgvZ','oIb0ExbLigLZihjLCxvPCMvK','D2fYBG','rMfPBgvKihrVihnLy3vYAxr5ihnJyw4GzMLSzsbPBIbWCM9Qzwn0','Aw5MBW','lMvZBgLUDhjJlMPZB24','kIOVkI57ANmSANn4lg1QCYXJANmSDhmSDhn4lhb5Fq','z2v0u3vWCg9YDgvKqwn0Aw9UCW','Dw5RBM93BG','CgfYywXSzwXcyxrJAgvZ','qwn0Aw9Uia','Dg90ywXbBMfSExnPC1rPBwu','Bwf4rMLSzvnPEMu','CgfYC2vqyxjHBwv0zxjZ','y3jLyxrLrgLYzwn0B3j5qwnJzxnZ','Dg90ywXbBMfSExnLCW','yw5HBhL6zuzPBgu','B2jQzwn0','DhLWzxnJCMLWDa','zMLSzxm','y3DK','qxqGBgvHC3qGB25LigfJDgLVBIbPCYbYzxf1AxjLza','DgLTzw91Da','lNLTBa','C3rHCNrZv2L0Aa','CgfYC2u','zgv2rgvWzw5Kzw5JAwvZ','y3jPDgLJywW','v3jPDguGywnJzxnZigrLBMLLzdOG','DMfSAwrHDgvszwfKqwnJzxnZ','yw5HBhL6zq','BgvUz3rO','zxHLyW','z2v0uhjLDhrPzxjgB3jTyxr0zxi','zM9YBwf0DgvYCW','lMPZB24','zMLSDgvY','z2v0u2vJDxjPDhLbBMfSExPLCG','Dg90ywXjBMzV','yw5HBhL6zs1WCM9Qzwn0','z2v0ugvYzM9YBwfUy2vnzxrYAwnZ','u2vJDxjPDhKGC2nHBM5PBMCGB25SEsbZDxbWB3j0CYbkyxzHu2nYAxb0lcbuExbLu2nYAxb0lcbHBMqGuhL0Ag9UigzPBgvZ','D3jPDgvgAwXL','lI4Vyw5HBhL6zxjZl0PHDMfty3jPChrbBMfSExPLCI5QCW','zgvWzw5Kzw5JAwvZ','AxnbyNnVBhv0zq','AxnbC3LUyW','CMvXDwLYzxnqCM9Qzwn0','AZHZ','y2fJAgvfEhbPCNK','ywXSB3DLza','zxH0BMfTzq','su5gtW','C3vTBwfYEq','rvHuru5tsu9ox1rpx0XbtKDvquDf','DMfSAwrHDgvdB25MAwDeAxjLy3rVCNK','z2v0rvnmAw50qw5HBhL6zxi','z2v0q29UzMLNvMfSAwrHDg9Y','qw5HBhL6Aw5NigjHDgnO','zgv0zwn0tgfUz3vHz2u','DMfSAwrHDguTy29UzMLNlwrPCMvJDg9YEq','z2v0uMvXDwLYzwrqyxjHBwv0zxjZ','DhnJB25MAwCUANnVBG','zgv0zwn0uhL0Ag9UrNjHBwv3B3jR','C3bSAxq','Bwf0y2G','sKfwqvnduKLqva','DhjPBq','BgfUz3vHz2u','u0vwrvjjvfK','DMfSAwrHDgvdB25MAwDgAwXL','Aw5JBhvKzxm','y2XLyxi','C2TPCfrLC3rgAwXLCW','lNbYzxr0AwvYCMm','lMDPDa','mZu5ode2nfrxANbmvG','u0ntuW','zMLSzs1WyxrO','y2HHBMDLCW','BNbTlwf1zgL0','oIbMAwXLlxbHDgGGAxmGCMvXDwLYzwqGzM9YihzHBgLKyxrLlwnVBMzPzW','C2v0','ChL0Ag9U','mJiXnZi5mLzhCwDWDW','rMLSzsb0B28GBgfYz2u6ia','zxjYB3i','zgLZDa','zgv0zwn0sLngCMfTzxDVCMS','zgvWzw5Kzw5JEs1Zy2fU','C2TPCc10zxn0lwzPBgvZ','zgLNzxn0','y2fJAgviAxrZ','zMLSzxncEuXHBMD1ywDL','CMvHzezPBgu','C3vIC3rYAw5N','oIbMAwXLlxbHDgGGAxmGCMvXDwLYzwqGzM9YigzPEa','zgLYzwn0B3j5','BxrPBwu','Dhj1zq','zMLSzxnbBMfSExPLza','C2vJDxjPDhLty2fUrMLSzq','zM9YBwf0DgvK','zMLSzvbHDgG','lI4Vyw5HBhL6zxjZl0ntu0fUywX5EMvYlMPZ','lMDPDgH1yG','qw5HBhLZAxmGy2fJAguGy2XLyxjLza','zw5HyMXLq2fJAgu','zM9YBwf0','Agv4','DxnLq29UDgvUDeHHC2G','icHTyxGG','AMf2yxnJCMLWDa','rMfPBgvKihrVihnLy3vYAxr5ihnJyw4G','Bwf4rMLSzxnqzxjcyxrJAa','D2fYBMLUz3m','y3vZDg9TvMfSAwrHDgvqyxjHBwv0zxjZ','zgvIDwC','y3jLyxrLuMvSyxrPDMvqyxrO','ndq2mxPWA05rsq','C2v2zxjPDhK','rMLSzsb0ExbLig5VDcbZDxbWB3j0zwqGyNKGuhjLDhrPzxi','C2vJDxjPDhKTC2nHBI1WCM9Qzwn0','yw5HBhL6zvbYB2PLy3q','C2vJDxjPDhKTC2nHBG','ihnLy29UzhmklsbpBMX5ihn1ChbVCNrZigXHBMD1ywDLCYb3AxrOigj1AwX0lwLUigfUywX5EMvYCWOGicaG','nZCXmdnkzMrXuw4','DgLTzxn0yw1W','rMfPBgvKihrVigfUywX5EMuG','Dg9ju09tDhjPBMC','ufLuse9o','zML4','lI4Vyw5HBhL6zxjZl1r5Cgvty3jPChrbBMfSExPLCI5QCW','CgfYC2vbDhrYAwj1DgvZ','y29UDgvUDa','yw5HBhL6zxjZ','yxjYyxK','DhLWzq','u3rHDgLJigfUywX5C2LZigfJDgLVBIbMywLSzwq','ywXS','mti2nZeWodDHtNjOtKm','C2vJDxjPDhK','C2L6zq','DMfSAwrHDguTy29UzMLN','CM91BMq','BgLUzxndAgfUz2vK','Aw5JBhvKzvDHCM5PBMDZ','DMfSAwrHDg9Y','Bwf4rxjYB3jZ','ChjLDhrPzxi','BM9Kzv9TB2r1BgvZ','ru5bqKXfx0nbq0Hf','tefor1vbr0u','DMfSAwrHDgvxCML0zufJy2vZCW','mZaXmejrD2PzzW','zM9YrwfJAa','vw5ZDxbWB3j0zwqGzMLSzsb0ExbL','igzPBgvZihbLCIbVCgvYyxrPB24klsbbBMfSExnPCYb0Aw1LB3v0oIa','zxjYB3jZ','BM93','zgLYzwn0B3j5qwnJzxnZtwfUywDLCG','DxrMltG','zMXVB3i','A3vIzxjUzxrLCW','zxHLy3v0zq','lNrMDMfYCW','DxbKyxrLu3vTBwfYEq','zg9JA2vYlwnVBxbVC2uUEw1S','y2f0zwDVCNK','nZiYngrvEMr1Cq','Dg9mB3DLCKnHC2u','uMvHzcbHy2nLC3mGzgvUAwvKoIa','rvjst1i','ywn0Aw9UCW','Bg9Nz2vY','mteYnMndrgPzEq','zw50CMLLCW','lI4Vyw5HBhL6zxjZl1b5DgHVBKfUywX5EMvYlMPZ','Bwf4ugfYywXSzwXgAwXLCW','CMvZB2X2zq','rMLSzsbMB3jTyxr0zwqGyw5KihDYAxr0zw4','zML4rMLSzq','rMfPBgvKihrVihbHCNnLihn0yxrPyYbHBMfSExnPCYbWyxjHBwv0zxjZoIa','vxnPBMCGy2fJAgvKigfUywX5C2LZihjLC3vSDa','Aw5JBhvKzs13yxjUAw5NCW','zML4zwq'];a0_0x41c6=function(){return _0x3153bd;};return a0_0x41c6();}class StaticAnalysisTool extends BaseTool{constructor(_0x49ee77={},_0x49b4e6=null){const _0x4bbf60=a0_0x4f45;super(_0x49ee77,_0x49b4e6),this[_0x4bbf60(0x1cb)]=!![],this[_0x4bbf60(0x1ca)]=![],this[_0x4bbf60(0x1b2)]=_0x49ee77[_0x4bbf60(0x1b2)]||STATIC_ANALYSIS[_0x4bbf60(0x187)],this['maxConcurrentOperations']=_0x49ee77['maxConcurrentOperations']||0x1,this[_0x4bbf60(0x1a8)]=_0x49ee77['maxFileSize']||STATIC_ANALYSIS[_0x4bbf60(0x199)],this[_0x4bbf60(0x127)]=_0x49ee77[_0x4bbf60(0x127)]||STATIC_ANALYSIS[_0x4bbf60(0x190)],this[_0x4bbf60(0x120)]=_0x49ee77[_0x4bbf60(0x120)]!==![]&&STATIC_ANALYSIS[_0x4bbf60(0x14c)],this['analysisCache']=new Map(),this[_0x4bbf60(0x1cd)]=STATIC_ANALYSIS['CACHE_DURATION'],this['parallelAnalysis']=_0x49ee77['parallelAnalysis']!==![],this[_0x4bbf60(0x167)]=_0x49ee77['maxParallelFiles']||0xa,this[_0x4bbf60(0x123)]=_0x49ee77[_0x4bbf60(0x123)]!==![],this['metrics']={'totalAnalyses':0x0,'cacheHits':0x0,'cacheMisses':0x0,'totalAnalysisTime':0x0,'filesAnalyzed':0x0,'parallelBatches':0x0},this[_0x4bbf60(0x155)]=new a0_0x44fc46(_0x49ee77,_0x49b4e6),this[_0x4bbf60(0x13c)]={'javascript':null,'typescript':null,'python':null,'css':null,'scss':null,'less':null,'eslint':null,'security':null,'config':null},this['formatters']={'prettier':null};}['getDescription'](){const _0x4a6a9d=a0_0x4f45;return'\x0aStatic\x20Code\x20Analysis\x20Tool:\x20Analyze\x20code\x20files\x20for\x20errors\x20without\x20execution\x0a\x0aThis\x20tool\x20performs\x20static\x20analysis\x20on\x20code\x20files\x20to\x20find\x20syntax\x20errors,\x20type\x20errors,\x20import\x20issues,\x20and\x20other\x20problems\x20without\x20running\x20the\x20code.\x20It\x20uses\x20official\x20language\x20parsers\x20for\x20accurate\x20results.\x0a\x0aSUPPORTED\x20LANGUAGES:\x0a-\x20JavaScript\x20(.js,\x20.jsx,\x20.mjs,\x20.cjs)\x0a-\x20TypeScript\x20(.ts,\x20.tsx)\x0a-\x20Python\x20(.py)\x0a-\x20CSS\x20(.css)\x0a-\x20SCSS\x20(.scss,\x20.sass)\x0a-\x20LESS\x20(.less)\x0a\x0aUSAGE\x20-\x20XML\x20FORMAT:\x0a\x0aSingle\x20File\x20Analysis:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<analyze\x20file-path=\x22src/index.js\x22\x20/>\x0a[/tool]\x0a\x0aMultiple\x20Files\x20Analysis:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<analyze\x20file-path=\x22src/index.js\x22\x20/>\x0a<analyze\x20file-path=\x22src/utils.js\x22\x20/>\x0a<analyze\x20file-path=\x22src/components/Button.jsx\x22\x20/>\x0a[/tool]\x0a\x0aProject-Wide\x20Analysis:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<analyze-project\x20directory=\x22src\x22\x20pattern=\x22**/*.js\x22\x20/>\x0a[/tool]\x0a\x0aAuto-Fix\x20Code\x20Issues:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<fix\x20file-path=\x22src/app.js\x22\x20/>\x0a[/tool]\x0a\x0aFormat\x20Code:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<format\x20file-path=\x22src/app.js\x22\x20/>\x0a[/tool]\x0a\x0aUSAGE\x20-\x20JSON\x20FORMAT:\x0a\x0a```json\x0a{\x0a\x20\x20\x22toolId\x22:\x20\x22staticanalysis\x22,\x0a\x20\x20\x22actions\x22:\x20[\x0a\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22type\x22:\x20\x22analyze\x22,\x0a\x20\x20\x20\x20\x20\x20\x22filePath\x22:\x20\x22src/index.js\x22\x0a\x20\x20\x20\x20},\x0a\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22type\x22:\x20\x22analyze-project\x22,\x0a\x20\x20\x20\x20\x20\x20\x22directory\x22:\x20\x22src\x22,\x0a\x20\x20\x20\x20\x20\x20\x22pattern\x22:\x20\x22**/*.{js,ts,py}\x22\x0a\x20\x20\x20\x20}\x0a\x20\x20]\x0a}\x0a```\x0a\x0aPARAMETERS:\x0a-\x20file-path:\x20Path\x20to\x20file\x20to\x20analyze\x20(for\x20single\x20file)\x0a-\x20directory:\x20Directory\x20to\x20analyze\x20(for\x20project-wide)\x0a-\x20pattern:\x20Glob\x20pattern\x20for\x20files\x20to\x20include\x20(optional,\x20defaults\x20to\x20language-specific\x20patterns)\x0a-\x20include-warnings:\x20Include\x20warnings\x20in\x20results\x20(true/false,\x20default:\x20true)\x0a-\x20max-errors:\x20Maximum\x20number\x20of\x20errors\x20to\x20return\x20(default:\x20all)\x0a\x0aOUTPUT\x20FORMAT:\x0aReturns\x20structured\x20error\x20information:\x0a-\x20file:\x20File\x20path\x0a-\x20line:\x20Line\x20number\x0a-\x20column:\x20Column\x20number\x0a-\x20severity:\x20critical\x20|\x20error\x20|\x20warning\x20|\x20info\x0a-\x20rule:\x20Rule\x20identifier\x0a-\x20message:\x20Human-readable\x20description\x0a-\x20category:\x20syntax\x20|\x20type\x20|\x20import\x20|\x20style\x20|\x20security\x20|\x20performance\x20|\x20best_practice\x0a-\x20fixable:\x20Whether\x20error\x20can\x20be\x20auto-fixed\x0a-\x20suggestion:\x20Fix\x20suggestion\x20(if\x20applicable)\x0a-\x20remediation:\x20Security\x20remediation\x20advice\x20(for\x20security\x20issues)\x0a\x0aDETECTION:\x0a-\x20Language:\x20Automatically\x20detected\x20from\x20file\x20extension\x0a-\x20Framework:\x20Detected\x20from\x20package.json,\x20requirements.txt,\x20etc.\x0a-\x20Context:\x20Project\x20structure\x20analyzed\x20for\x20better\x20accuracy\x0a\x0aEXAMPLES:\x0a\x0aFind\x20all\x20errors\x20in\x20a\x20JavaScript\x20file:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<analyze\x20file-path=\x22src/app.js\x22\x20/>\x0a[/tool]\x0a\x0aAnalyze\x20TypeScript\x20with\x20type\x20checking:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<analyze\x20file-path=\x22src/types.ts\x22\x20/>\x0a[/tool]\x0a\x0aCheck\x20all\x20Python\x20files\x20in\x20a\x20directory:\x0a[tool\x20id=\x22staticanalysis\x22]\x0a<analyze-project\x20directory=\x22backend\x22\x20pattern=\x22**/*.py\x22\x20/>\x0a[/tool]\x0a\x0aLIMITATIONS:\x0a-\x20File\x20size\x20limit:\x20'+Math[_0x4a6a9d(0x145)](this[_0x4a6a9d(0x1a8)]/0x400/0x400)+'MB\x20per\x20file\x0a-\x20Batch\x20limit:\x20'+this[_0x4a6a9d(0x127)]+_0x4a6a9d(0x152)+this[_0x4a6a9d(0x1b2)]/0x3e8+_0x4a6a9d(0x132);}[a0_0x19f3ef(0x1a9)](_0x3cb660){const _0x450571=a0_0x19f3ef;try{const _0x1c748c={},_0x160fb1=[];this['logger']?.[_0x450571(0x12a)]('StaticAnalysis\x20tool\x20parsing\x20parameters',{'contentLength':_0x3cb660['length'],'contentPreview':_0x3cb660[_0x450571(0x114)](0x0,0xc8)});const _0x4a42c0=/<analyze\s+(.+?)\/>/g;let _0x51bcda;while((_0x51bcda=_0x4a42c0['exec'](_0x3cb660))!==null){const _0x21062c=_0x51bcda[0x1][_0x450571(0xf8)](),_0xc9e977=new a0_0x880dc2(),_0x4e6a42=_0xc9e977['parseAttributes'](_0x21062c),_0x5264ab={'type':_0x450571(0x1ba),..._0x4e6a42};_0x5264ab['file-path']&&(_0x5264ab['filePath']=_0x5264ab[_0x450571(0x103)],delete _0x5264ab[_0x450571(0x103)]),_0x5264ab['include-warnings']&&(_0x5264ab[_0x450571(0x147)]=_0x5264ab[_0x450571(0x16d)]===_0x450571(0x118),delete _0x5264ab['include-warnings']),_0x5264ab['max-errors']&&(_0x5264ab[_0x450571(0x149)]=parseInt(_0x5264ab['max-errors'],0xa),delete _0x5264ab[_0x450571(0x17f)]),_0x160fb1[_0x450571(0x188)](_0x5264ab);}const _0x2167f3=/<analyze-project\s+(.+?)\/>/g;while((_0x51bcda=_0x2167f3[_0x450571(0x1bc)](_0x3cb660))!==null){const _0x340b95=_0x51bcda[0x1][_0x450571(0xf8)](),_0x39d276=new a0_0x880dc2(),_0x10d7ef=_0x39d276[_0x450571(0x13a)](_0x340b95),_0x389953={'type':'analyze-project',..._0x10d7ef};_0x389953[_0x450571(0x16d)]&&(_0x389953[_0x450571(0x147)]=_0x389953['include-warnings']===_0x450571(0x118),delete _0x389953[_0x450571(0x16d)]),_0x389953[_0x450571(0x17f)]&&(_0x389953[_0x450571(0x149)]=parseInt(_0x389953['max-errors'],0xa),delete _0x389953['max-errors']),_0x160fb1[_0x450571(0x188)](_0x389953);}const _0x44ec14=/<fix\s+(.+?)\/>/g;while((_0x51bcda=_0x44ec14['exec'](_0x3cb660))!==null){const _0x42aa34=_0x51bcda[0x1][_0x450571(0xf8)](),_0x515da1=new a0_0x880dc2(),_0x53be3c=_0x515da1['parseAttributes'](_0x42aa34),_0x5bc29b={'type':_0x450571(0x138),..._0x53be3c};_0x5bc29b['file-path']&&(_0x5bc29b[_0x450571(0x11c)]=_0x5bc29b[_0x450571(0x103)],delete _0x5bc29b[_0x450571(0x103)]),_0x5bc29b[_0x450571(0x185)]&&(_0x5bc29b['writeFile']=_0x5bc29b['write-file']==='true',delete _0x5bc29b[_0x450571(0x185)]),_0x160fb1[_0x450571(0x188)](_0x5bc29b);}const _0x5b6613=/<format\s+(.+?)\/>/g;while((_0x51bcda=_0x5b6613[_0x450571(0x1bc)](_0x3cb660))!==null){const _0x7a595e=_0x51bcda[0x1][_0x450571(0xf8)](),_0x59757e=new a0_0x880dc2(),_0x324142=_0x59757e['parseAttributes'](_0x7a595e),_0xb58852={'type':'format',..._0x324142};_0xb58852[_0x450571(0x103)]&&(_0xb58852[_0x450571(0x11c)]=_0xb58852['file-path'],delete _0xb58852['file-path']),_0xb58852['write-file']&&(_0xb58852[_0x450571(0x1c6)]=_0xb58852['write-file']===_0x450571(0x118),delete _0xb58852['write-file']),_0x160fb1['push'](_0xb58852);}const _0x5f5bb8=/<security-scan\s+(.+?)\/>/g;while((_0x51bcda=_0x5f5bb8[_0x450571(0x1bc)](_0x3cb660))!==null){const _0x357760=_0x51bcda[0x1][_0x450571(0xf8)](),_0x3b6805=new a0_0x880dc2(),_0x44a622=_0x3b6805[_0x450571(0x13a)](_0x357760),_0x26e19a={'type':_0x450571(0x131),..._0x44a622};_0x26e19a['file-path']&&(_0x26e19a['filePath']=_0x26e19a[_0x450571(0x103)],delete _0x26e19a['file-path']),_0x26e19a[_0x450571(0x10f)]&&(_0x26e19a[_0x450571(0xfe)]=_0x26e19a['skip-test-files']==='true',delete _0x26e19a[_0x450571(0x10f)]),_0x160fb1[_0x450571(0x188)](_0x26e19a);}const _0xe9f07c=/<security-scan-project\s+(.+?)\/>/g;while((_0x51bcda=_0xe9f07c[_0x450571(0x1bc)](_0x3cb660))!==null){const _0x4b9171=_0x51bcda[0x1][_0x450571(0xf8)](),_0x36c487=new a0_0x880dc2(),_0x250148=_0x36c487['parseAttributes'](_0x4b9171),_0x2eae5e={'type':_0x450571(0x12f),..._0x250148};_0x2eae5e[_0x450571(0x10f)]&&(_0x2eae5e[_0x450571(0xfe)]=_0x2eae5e[_0x450571(0x10f)]==='true',delete _0x2eae5e['skip-test-files']),_0x160fb1[_0x450571(0x188)](_0x2eae5e);}const _0x10e086=/<validate-config\s+(.+?)\/>/g;while((_0x51bcda=_0x10e086[_0x450571(0x1bc)](_0x3cb660))!==null){const _0x4000fa=_0x51bcda[0x1]['trim'](),_0x37ea9c=new a0_0x880dc2(),_0x23a287=_0x37ea9c['parseAttributes'](_0x4000fa),_0x251da2={'type':_0x450571(0x144),..._0x23a287};_0x251da2[_0x450571(0x103)]&&(_0x251da2['filePath']=_0x251da2[_0x450571(0x103)],delete _0x251da2['file-path']),_0x160fb1[_0x450571(0x188)](_0x251da2);}const _0x44d6d8=/<validate-config-directory\s+(.+?)\/>/g;while((_0x51bcda=_0x44d6d8[_0x450571(0x1bc)](_0x3cb660))!==null){const _0x20475a=_0x51bcda[0x1]['trim'](),_0x56773e=new a0_0x880dc2(),_0xf99bd7=_0x56773e[_0x450571(0x13a)](_0x20475a),_0x1d3862={'type':'validate-config-directory',..._0xf99bd7};_0x160fb1['push'](_0x1d3862);}return _0x1c748c['actions']=_0x160fb1,_0x1c748c[_0x450571(0x194)]=_0x3cb660[_0x450571(0xf8)](),this[_0x450571(0x163)]?.['debug']('Parsed\x20StaticAnalysis\x20tool\x20parameters',{'totalActions':_0x160fb1[_0x450571(0x1bb)],'actionTypes':_0x160fb1['map'](_0x4353f0=>_0x4353f0['type'])}),_0x1c748c;}catch(_0x30cc51){throw new Error(_0x450571(0x16b)+_0x30cc51[_0x450571(0x174)]);}}[a0_0x19f3ef(0xf2)](){return['actions'];}[a0_0x19f3ef(0x129)](_0x4f2b76){const _0x20d029=a0_0x19f3ef,_0x470530=[];if(!_0x4f2b76[_0x20d029(0x162)]||!Array['isArray'](_0x4f2b76[_0x20d029(0x162)])||_0x4f2b76[_0x20d029(0x162)]['length']===0x0)_0x470530[_0x20d029(0x188)](_0x20d029(0x1b1));else{for(const [_0x337a13,_0x328824]of _0x4f2b76['actions']['entries']()){if(!_0x328824[_0x20d029(0x13e)]){_0x470530[_0x20d029(0x188)](_0x20d029(0x1a6)+(_0x337a13+0x1)+_0x20d029(0x19d));continue;}switch(_0x328824['type']){case _0x20d029(0x1ba):!_0x328824[_0x20d029(0x11c)]&&_0x470530['push'](_0x20d029(0x1a6)+(_0x337a13+0x1)+_0x20d029(0x172));break;case'analyze-project':!_0x328824['directory']&&_0x470530['push']('Action\x20'+(_0x337a13+0x1)+':\x20directory\x20is\x20required\x20for\x20analyze-project');break;case'fix':!_0x328824[_0x20d029(0x11c)]&&_0x470530[_0x20d029(0x188)]('Action\x20'+(_0x337a13+0x1)+_0x20d029(0x115));break;case _0x20d029(0x121):!_0x328824['filePath']&&_0x470530['push'](_0x20d029(0x1a6)+(_0x337a13+0x1)+_0x20d029(0x19a));break;case'security-scan':!_0x328824['filePath']&&_0x470530[_0x20d029(0x188)](_0x20d029(0x1a6)+(_0x337a13+0x1)+_0x20d029(0x182));break;case _0x20d029(0x12f):!_0x328824[_0x20d029(0x116)]&&_0x470530[_0x20d029(0x188)](_0x20d029(0x1a6)+(_0x337a13+0x1)+':\x20directory\x20is\x20required\x20for\x20security-scan-project');break;case _0x20d029(0x144):!_0x328824['filePath']&&_0x470530['push'](_0x20d029(0x1a6)+(_0x337a13+0x1)+_0x20d029(0x106));break;case'validate-config-directory':!_0x328824['directory']&&_0x470530[_0x20d029(0x188)](_0x20d029(0x1a6)+(_0x337a13+0x1)+':\x20directory\x20is\x20required\x20for\x20validate-config-directory');break;default:_0x470530['push']('Action\x20'+(_0x337a13+0x1)+':\x20unknown\x20action\x20type:\x20'+_0x328824[_0x20d029(0x13e)]);}}_0x4f2b76[_0x20d029(0x162)]['length']>this[_0x20d029(0x127)]&&_0x470530[_0x20d029(0x188)]('Too\x20many\x20actions:\x20'+_0x4f2b76[_0x20d029(0x162)][_0x20d029(0x1bb)]+'\x20(max\x20'+this['maxFilesPerBatch']+')');}return{'valid':_0x470530[_0x20d029(0x1bb)]===0x0,'errors':_0x470530};}async[a0_0x19f3ef(0x159)](_0x46d3f2,_0x186432){const _0x5271d4=a0_0x19f3ef,{actions:_0x40547b}=_0x46d3f2,{projectDir:_0x451b30,agentId:_0x258b80,directoryAccess:_0x1a310a}=_0x186432,_0xa110f5=_0x1a310a||this['directoryAccessManager'][_0x5271d4(0x1aa)]({'workingDirectory':_0x451b30||process[_0x5271d4(0x1b0)](),'writeEnabledDirectories':[_0x451b30||process[_0x5271d4(0x1b0)]()],'restrictToProject':!![]}),_0x2eb41c=this['directoryAccessManager']['getWorkingDirectory'](_0xa110f5),_0x3a2b89={'files':[],'summary':{'totalFiles':0x0,'totalErrors':0x0,'totalWarnings':0x0,'totalInfo':0x0,'errorsByCategory':{},'filesByLanguage':{},'filesWithErrors':0x0}};for(const _0x166926 of _0x40547b){try{let _0x38291f;switch(_0x166926[_0x5271d4(0x13e)]){case'analyze':_0x38291f=await this['analyzeFile'](_0x166926['filePath'],_0x2eb41c,_0xa110f5,_0x166926);_0x38291f&&(_0x3a2b89['files']['push'](_0x38291f),this[_0x5271d4(0x15b)](_0x3a2b89[_0x5271d4(0xea)],_0x38291f));break;case _0x5271d4(0x1c3):const _0x4c8510=await this[_0x5271d4(0x130)](_0x166926[_0x5271d4(0x116)],_0x166926['pattern'],_0x2eb41c,_0xa110f5,_0x166926);_0x3a2b89[_0x5271d4(0x1af)]['push'](..._0x4c8510);for(const _0x5590c0 of _0x4c8510){this['updateSummary'](_0x3a2b89['summary'],_0x5590c0);}break;case'fix':_0x38291f=await this[_0x5271d4(0x16a)](_0x166926['filePath'],_0x2eb41c,_0xa110f5,_0x166926);_0x38291f&&_0x3a2b89[_0x5271d4(0x1af)][_0x5271d4(0x188)](_0x38291f);break;case _0x5271d4(0x121):_0x38291f=await this['formatFile'](_0x166926[_0x5271d4(0x11c)],_0x2eb41c,_0xa110f5,_0x166926);_0x38291f&&_0x3a2b89[_0x5271d4(0x1af)]['push'](_0x38291f);break;case'security-scan':_0x38291f=await this['securityScanFile'](_0x166926['filePath'],_0x2eb41c,_0xa110f5,_0x166926);_0x38291f&&(_0x3a2b89['files']['push'](_0x38291f),this[_0x5271d4(0x15b)](_0x3a2b89['summary'],_0x38291f));break;case'security-scan-project':const _0x5cfbb0=await this[_0x5271d4(0x19b)](_0x166926['directory'],_0x166926[_0x5271d4(0x17d)],_0x2eb41c,_0xa110f5,_0x166926);_0x3a2b89[_0x5271d4(0x1af)]['push'](..._0x5cfbb0);for(const _0x1f292e of _0x5cfbb0){this[_0x5271d4(0x15b)](_0x3a2b89['summary'],_0x1f292e);}break;case _0x5271d4(0x144):_0x38291f=await this['validateConfigFile'](_0x166926['filePath'],_0x2eb41c,_0xa110f5,_0x166926);_0x38291f&&(_0x3a2b89[_0x5271d4(0x1af)][_0x5271d4(0x188)](_0x38291f),this[_0x5271d4(0x15b)](_0x3a2b89[_0x5271d4(0xea)],_0x38291f));break;case'validate-config-directory':const _0x56df5e=await this['validateConfigDirectory'](_0x166926['directory'],_0x2eb41c,_0xa110f5,_0x166926);_0x3a2b89[_0x5271d4(0x1af)]['push'](..._0x56df5e);for(const _0x3938f1 of _0x56df5e){this[_0x5271d4(0x15b)](_0x3a2b89['summary'],_0x3938f1);}break;default:throw new Error('Unknown\x20action\x20type:\x20'+_0x166926['type']);}}catch(_0x3b6014){this[_0x5271d4(0x163)]?.[_0x5271d4(0x10b)](_0x5271d4(0x13f),{'action':_0x166926['type'],'error':_0x3b6014['message']}),_0x3a2b89[_0x5271d4(0x1af)][_0x5271d4(0x188)]({'file':_0x166926['filePath']||_0x166926[_0x5271d4(0x116)],'error':_0x3b6014['message'],'success':![]});}}return{'success':!![],'results':_0x3a2b89,'toolUsed':'staticanalysis','performance':this['getPerformanceMetrics']()};}async[a0_0x19f3ef(0x1ac)](_0x4b5be9,_0x540724,_0x41337b,_0x235aff={}){const _0x2e43a3=a0_0x19f3ef,_0x22b83e=a0_0x3a4aba['isAbsolute'](_0x4b5be9)?a0_0x3a4aba['normalize'](_0x4b5be9):a0_0x3a4aba[_0x2e43a3(0x168)](_0x540724,_0x4b5be9),_0x1e4b5d=this['directoryAccessManager'][_0x2e43a3(0x1b9)](_0x22b83e,_0x41337b);if(!_0x1e4b5d[_0x2e43a3(0x1ce)])throw new Error(_0x2e43a3(0x160)+_0x1e4b5d['reason']);try{const _0x1006ca=await a0_0x52df5c['stat'](_0x22b83e);if(_0x1006ca[_0x2e43a3(0x143)]>this['maxFileSize'])throw new Error(_0x2e43a3(0x10a)+_0x1006ca[_0x2e43a3(0x143)]+_0x2e43a3(0x193)+this['maxFileSize']+')');const _0x27976=this[_0x2e43a3(0xf0)](_0x22b83e);if(!_0x27976)return{'file':this['directoryAccessManager']['createRelativePath'](_0x22b83e,_0x41337b),'fullPath':_0x22b83e,'language':_0x2e43a3(0x1a4),'errors':[],'warnings':[],'info':[],'skipped':!![],'skipReason':_0x2e43a3(0x151)};const _0xd13422=await a0_0x52df5c['readFile'](_0x22b83e,_0x2e43a3(0x156)),_0x502743=this[_0x2e43a3(0x123)]?this['computeContentHash'](_0xd13422):null,_0x64409c=this['useContentHash']?_0x22b83e+':'+_0x502743:_0x22b83e+':'+_0x1006ca[_0x2e43a3(0x117)]['getTime']();if(this['enableCache']&&this['analysisCache'][_0x2e43a3(0x175)](_0x64409c)){const _0x5a0c9d=this[_0x2e43a3(0x170)]['get'](_0x64409c);if(Date['now']()-_0x5a0c9d[_0x2e43a3(0x134)]<this[_0x2e43a3(0x1cd)])return this[_0x2e43a3(0x163)]?.[_0x2e43a3(0x12a)](_0x2e43a3(0x16c),{'file':_0x22b83e}),this[_0x2e43a3(0x191)]['cacheHits']++,this[_0x2e43a3(0x191)]['totalAnalyses']++,_0x5a0c9d['result'];}this[_0x2e43a3(0x191)]['cacheMisses']++,this[_0x2e43a3(0x191)]['totalAnalyses']++;const _0x3c9006=await this['getAnalyzer'](_0x27976);if(!_0x3c9006)return{'file':this[_0x2e43a3(0x155)]['createRelativePath'](_0x22b83e,_0x41337b),'fullPath':_0x22b83e,'language':_0x27976,'errors':[],'warnings':[],'info':[],'skipped':!![],'skipReason':'No\x20analyzer\x20available\x20for\x20'+_0x27976};const _0x4fe228=Date[_0x2e43a3(0x154)](),_0x57205f=await _0x3c9006['analyze'](_0x22b83e,_0xd13422,{'workingDir':_0x540724,'accessConfig':_0x41337b,'framework':await this[_0x2e43a3(0x184)](_0x540724,_0x27976)}),_0xaf4d9c=Date[_0x2e43a3(0x154)]()-_0x4fe228;this['metrics'][_0x2e43a3(0x1a7)]+=_0xaf4d9c,this['metrics'][_0x2e43a3(0x119)]++;const _0x237bf9={'file':this[_0x2e43a3(0x155)]['createRelativePath'](_0x22b83e,_0x41337b),'fullPath':_0x22b83e,'language':_0x27976,'framework':await this[_0x2e43a3(0x184)](_0x540724,_0x27976),'errors':_0x57205f['filter'](_0x1a2537=>_0x1a2537['severity']===STATIC_ANALYSIS[_0x2e43a3(0xfa)]['ERROR']),'warnings':_0x235aff[_0x2e43a3(0x147)]!==![]?_0x57205f['filter'](_0x65f399=>_0x65f399[_0x2e43a3(0x12d)]===STATIC_ANALYSIS['SEVERITY']['WARNING']):[],'info':_0x57205f['filter'](_0xc155b8=>_0xc155b8[_0x2e43a3(0x12d)]===STATIC_ANALYSIS[_0x2e43a3(0xfa)][_0x2e43a3(0x1d0)]),'totalIssues':_0x57205f[_0x2e43a3(0x1bb)],'analyzed':!![],'timestamp':new Date()[_0x2e43a3(0x136)]()};return _0x235aff['maxErrors']&&_0x237bf9['errors']['length']>_0x235aff[_0x2e43a3(0x149)]&&(_0x237bf9[_0x2e43a3(0x153)]=_0x237bf9['errors']['slice'](0x0,_0x235aff[_0x2e43a3(0x149)]),_0x237bf9[_0x2e43a3(0x179)]=!![]),this['enableCache']&&this[_0x2e43a3(0x170)][_0x2e43a3(0x107)](_0x64409c,{'result':_0x237bf9,'timestamp':Date[_0x2e43a3(0x154)]()}),_0x237bf9;}catch(_0x145941){throw new Error(_0x2e43a3(0x135)+_0x4b5be9+':\x20'+_0x145941[_0x2e43a3(0x174)]);}}async[a0_0x19f3ef(0x130)](_0x452ec9,_0x3b6702,_0x445a3b,_0x5ae233,_0x13251a={}){const _0xe4bfd5=a0_0x19f3ef,_0x4d4e90=a0_0x3a4aba[_0xe4bfd5(0x1c9)](_0x452ec9)?a0_0x3a4aba['normalize'](_0x452ec9):a0_0x3a4aba[_0xe4bfd5(0x168)](_0x445a3b,_0x452ec9),_0x2be8de=this['directoryAccessManager']['validateReadAccess'](_0x4d4e90,_0x5ae233);if(!_0x2be8de['allowed'])throw new Error(_0xe4bfd5(0x160)+_0x2be8de[_0xe4bfd5(0x16f)]);const _0x4b9962=await this['findFiles'](_0x4d4e90,_0x3b6702);if(_0x4b9962['length']>this['maxFilesPerBatch'])throw new Error('Too\x20many\x20files:\x20'+_0x4b9962['length']+_0xe4bfd5(0x124)+this['maxFilesPerBatch']+')');const _0x4acc4a=[];if(this['parallelAnalysis']&&_0x4b9962['length']>0x1){this['logger']?.['debug']('Using\x20parallel\x20analysis',{'totalFiles':_0x4b9962[_0xe4bfd5(0x1bb)],'batchSize':this['maxParallelFiles']});for(let _0x4482d1=0x0;_0x4482d1<_0x4b9962['length'];_0x4482d1+=this['maxParallelFiles']){const _0x2ac9b6=_0x4b9962[_0xe4bfd5(0x171)](_0x4482d1,_0x4482d1+this['maxParallelFiles']);this[_0xe4bfd5(0x191)][_0xe4bfd5(0x1a5)]++;const _0x5eba11={'completed':_0x4482d1,'total':_0x4b9962['length'],'percentage':Math['round'](_0x4482d1/_0x4b9962['length']*0x64)};_0x13251a[_0xe4bfd5(0x198)]&&_0x13251a['onProgress'](_0x5eba11);this[_0xe4bfd5(0x163)]?.[_0xe4bfd5(0x12a)](_0xe4bfd5(0xef),{'batch':Math[_0xe4bfd5(0x157)](_0x4482d1/this[_0xe4bfd5(0x167)])+0x1,'filesInBatch':_0x2ac9b6[_0xe4bfd5(0x1bb)],'progress':_0x5eba11['completed']+'/'+_0x5eba11['total']});const _0x4317bb=_0x2ac9b6['map'](async _0x33054d=>{const _0x437696=_0xe4bfd5;try{const _0x450104=await this[_0x437696(0x1ac)](_0x33054d,_0x445a3b,_0x5ae233,_0x13251a);return _0x450104;}catch(_0x2680a4){return this['logger']?.[_0x437696(0x19e)]('Failed\x20to\x20analyze\x20file\x20in\x20project',{'file':_0x33054d,'error':_0x2680a4['message']}),{'file':this[_0x437696(0x155)][_0x437696(0x12b)](_0x33054d,_0x5ae233),'fullPath':_0x33054d,'error':_0x2680a4[_0x437696(0x174)],'success':![]};}}),_0x12da3b=await Promise[_0xe4bfd5(0x140)](_0x4317bb);_0x4acc4a[_0xe4bfd5(0x188)](..._0x12da3b['filter'](_0x4017fd=>_0x4017fd!==null));}_0x13251a[_0xe4bfd5(0x198)]&&_0x13251a['onProgress']({'completed':_0x4b9962[_0xe4bfd5(0x1bb)],'total':_0x4b9962[_0xe4bfd5(0x1bb)],'percentage':0x64});}else for(const _0x28ca7c of _0x4b9962){try{const _0x4703e9=await this[_0xe4bfd5(0x1ac)](_0x28ca7c,_0x445a3b,_0x5ae233,_0x13251a);_0x4703e9&&_0x4acc4a['push'](_0x4703e9);}catch(_0x237f8b){this['logger']?.[_0xe4bfd5(0x19e)]('Failed\x20to\x20analyze\x20file\x20in\x20project',{'file':_0x28ca7c,'error':_0x237f8b[_0xe4bfd5(0x174)]}),_0x4acc4a[_0xe4bfd5(0x188)]({'file':this[_0xe4bfd5(0x155)]['createRelativePath'](_0x28ca7c,_0x5ae233),'fullPath':_0x28ca7c,'error':_0x237f8b['message'],'success':![]});}}return _0x4acc4a;}async[a0_0x19f3ef(0x16a)](_0x56244c,_0x13a5b2,_0x253e8f,_0x51312a={}){const _0x382159=a0_0x19f3ef,_0x1f4216=a0_0x3a4aba[_0x382159(0x1c9)](_0x56244c)?a0_0x3a4aba['normalize'](_0x56244c):a0_0x3a4aba[_0x382159(0x168)](_0x13a5b2,_0x56244c),_0x184ed1=this[_0x382159(0x155)][_0x382159(0x1b9)](_0x1f4216,_0x253e8f);if(!_0x184ed1[_0x382159(0x1ce)])throw new Error('Read\x20access\x20denied:\x20'+_0x184ed1[_0x382159(0x16f)]);if(_0x51312a[_0x382159(0x1c6)]){const _0x3a3eff=this['directoryAccessManager']['validateWriteAccess'](_0x1f4216,_0x253e8f);if(!_0x3a3eff[_0x382159(0x1ce)])throw new Error(_0x382159(0x1b8)+_0x3a3eff['reason']);}try{const _0xa0f6b1=await a0_0x52df5c['readFile'](_0x1f4216,'utf-8'),_0x18b5d6=await this[_0x382159(0xed)](),_0x40d127=await _0x18b5d6['fix'](_0x1f4216,_0xa0f6b1,{'workingDir':_0x13a5b2,'accessConfig':_0x253e8f,'framework':await this[_0x382159(0x184)](_0x13a5b2,this['detectLanguage'](_0x1f4216))});return _0x51312a['writeFile']&&_0x40d127['fixed']&&(await a0_0x52df5c[_0x382159(0x1c6)](_0x1f4216,_0x40d127['content'],'utf-8'),this['logger']?.['info']('File\x20fixed\x20and\x20written',{'file':_0x1f4216})),{'file':this['directoryAccessManager'][_0x382159(0x12b)](_0x1f4216,_0x253e8f),'fullPath':_0x1f4216,'action':_0x382159(0x138),'fixed':_0x40d127['fixed'],'fixedCount':_0x40d127['fixedCount'],'remainingErrors':_0x40d127['remainingErrors'],'remainingWarnings':_0x40d127['remainingWarnings'],'changes':_0x40d127['changes'],'written':!!(_0x51312a[_0x382159(0x1c6)]&&_0x40d127['fixed']),'preview':!_0x51312a[_0x382159(0x1c6)]&&_0x40d127[_0x382159(0x16e)]?_0x40d127[_0x382159(0x13b)]:undefined};}catch(_0x58a63a){throw new Error('Failed\x20to\x20fix\x20'+_0x56244c+':\x20'+_0x58a63a[_0x382159(0x174)]);}}async['formatFile'](_0x2ac04f,_0x2b3c43,_0x233371,_0x305b45={}){const _0x10f057=a0_0x19f3ef,_0x21eaa3=a0_0x3a4aba[_0x10f057(0x1c9)](_0x2ac04f)?a0_0x3a4aba['normalize'](_0x2ac04f):a0_0x3a4aba[_0x10f057(0x168)](_0x2b3c43,_0x2ac04f),_0x125733=this['directoryAccessManager'][_0x10f057(0x1b9)](_0x21eaa3,_0x233371);if(!_0x125733['allowed'])throw new Error('Read\x20access\x20denied:\x20'+_0x125733['reason']);if(_0x305b45['writeFile']){const _0x2c2dfd=this[_0x10f057(0x155)][_0x10f057(0x14e)](_0x21eaa3,_0x233371);if(!_0x2c2dfd['allowed'])throw new Error('Write\x20access\x20denied:\x20'+_0x2c2dfd[_0x10f057(0x16f)]);}try{const _0xc65100=await a0_0x52df5c['readFile'](_0x21eaa3,'utf-8'),_0x509c01=await this[_0x10f057(0x1bd)]();if(!_0x509c01['isSupported'](_0x21eaa3))return{'file':this[_0x10f057(0x155)]['createRelativePath'](_0x21eaa3,_0x233371),'fullPath':_0x21eaa3,'action':_0x10f057(0x121),'formatted':![],'skipped':!![],'skipReason':_0x10f057(0x12e)};const _0x1ddc68=await _0x509c01[_0x10f057(0x121)](_0x21eaa3,_0xc65100,{'workingDir':_0x2b3c43,'accessConfig':_0x233371});return _0x305b45[_0x10f057(0x1c6)]&&_0x1ddc68[_0x10f057(0x11b)]&&(await a0_0x52df5c[_0x10f057(0x1c6)](_0x21eaa3,_0x1ddc68['content'],'utf-8'),this[_0x10f057(0x163)]?.[_0x10f057(0x1a0)](_0x10f057(0x169),{'file':_0x21eaa3})),{'file':this['directoryAccessManager'][_0x10f057(0x12b)](_0x21eaa3,_0x233371),'fullPath':_0x21eaa3,'action':_0x10f057(0x121),'formatted':_0x1ddc68['formatted'],'linesChanged':_0x1ddc68[_0x10f057(0x146)],'changes':_0x1ddc68[_0x10f057(0x104)],'written':!!(_0x305b45['writeFile']&&_0x1ddc68['formatted']),'preview':!_0x305b45[_0x10f057(0x1c6)]&&_0x1ddc68[_0x10f057(0x11b)]?_0x1ddc68[_0x10f057(0x13b)]:undefined};}catch(_0x7069e8){throw new Error('Failed\x20to\x20format\x20'+_0x2ac04f+':\x20'+_0x7069e8[_0x10f057(0x174)]);}}async['securityScanFile'](_0x3613cf,_0x1a5d07,_0x4f1467,_0x467578={}){const _0x327d89=a0_0x19f3ef,_0x4ed8f6=a0_0x3a4aba['isAbsolute'](_0x3613cf)?a0_0x3a4aba['normalize'](_0x3613cf):a0_0x3a4aba['resolve'](_0x1a5d07,_0x3613cf),_0x41c761=this['directoryAccessManager']['validateReadAccess'](_0x4ed8f6,_0x4f1467);if(!_0x41c761['allowed'])throw new Error('Read\x20access\x20denied:\x20'+_0x41c761['reason']);try{const _0x37d79f=await a0_0x52df5c['stat'](_0x4ed8f6);if(_0x37d79f['size']>this[_0x327d89(0x1a8)])throw new Error('File\x20too\x20large:\x20'+_0x37d79f[_0x327d89(0x143)]+_0x327d89(0x193)+this['maxFileSize']+')');const _0x131974=this[_0x327d89(0xf0)](_0x4ed8f6);if(!_0x131974||!['javascript',_0x327d89(0x1ae),'python']['includes'](_0x131974))return{'file':this[_0x327d89(0x155)]['createRelativePath'](_0x4ed8f6,_0x4f1467),'fullPath':_0x4ed8f6,'language':_0x131974||'unknown','issues':[],'skipped':!![],'skipReason':_0x327d89(0x1c5)};const _0x2bfe6d=await a0_0x52df5c['readFile'](_0x4ed8f6,'utf-8'),_0x5097ee=await this['getSecurityAnalyzer'](),_0x41b362=await _0x5097ee[_0x327d89(0x1ba)](_0x4ed8f6,_0x2bfe6d,{'skipTestFiles':_0x467578[_0x327d89(0xfe)]!==![]}),_0x5a6d5a={'file':this['directoryAccessManager']['createRelativePath'](_0x4ed8f6,_0x4f1467),'fullPath':_0x4ed8f6,'language':_0x131974,'action':'security-scan','critical':_0x41b362[_0x327d89(0x1c0)](_0x13ab85=>_0x13ab85[_0x327d89(0x12d)]===STATIC_ANALYSIS[_0x327d89(0xfa)]['CRITICAL']),'errors':_0x41b362[_0x327d89(0x1c0)](_0x4bf992=>_0x4bf992[_0x327d89(0x12d)]===STATIC_ANALYSIS['SEVERITY']['ERROR']),'warnings':_0x41b362[_0x327d89(0x1c0)](_0x4c608f=>_0x4c608f['severity']===STATIC_ANALYSIS[_0x327d89(0xfa)]['WARNING']),'info':_0x41b362['filter'](_0x2accae=>_0x2accae[_0x327d89(0x12d)]===STATIC_ANALYSIS['SEVERITY']['INFO']),'totalIssues':_0x41b362['length'],'analyzed':!![],'scannersUsed':_0x41b362['map'](_0x2ecc79=>_0x2ecc79['scanner'])[_0x327d89(0x1c0)]((_0x2be196,_0x4ef7b3,_0x4003f4)=>_0x4003f4['indexOf'](_0x2be196)===_0x4ef7b3),'timestamp':new Date()[_0x327d89(0x136)]()};return _0x5a6d5a;}catch(_0x50016a){throw new Error(_0x327d89(0x126)+_0x3613cf+':\x20'+_0x50016a['message']);}}async[a0_0x19f3ef(0x19b)](_0x56696b,_0x12f95d,_0x50d8f9,_0x4ac747,_0x29b1e8={}){const _0x26985b=a0_0x19f3ef,_0x3a1ee1=a0_0x3a4aba['isAbsolute'](_0x56696b)?a0_0x3a4aba['normalize'](_0x56696b):a0_0x3a4aba[_0x26985b(0x168)](_0x50d8f9,_0x56696b),_0x31578b=this['directoryAccessManager'][_0x26985b(0x1b9)](_0x3a1ee1,_0x4ac747);if(!_0x31578b[_0x26985b(0x1ce)])throw new Error(_0x26985b(0x160)+_0x31578b['reason']);const _0x43ef5e=await this['getSecurityAnalyzer'](),_0x4d87c8=await _0x43ef5e['analyzeProject'](_0x3a1ee1,_0x26985b(0x125),_0x29b1e8),_0x26e539=_0x12f95d||_0x26985b(0x1a2),_0x3ef578=await this['findFiles'](_0x3a1ee1,_0x26e539);if(_0x3ef578['length']>this[_0x26985b(0x127)])throw new Error('Too\x20many\x20files:\x20'+_0x3ef578[_0x26985b(0x1bb)]+'\x20(max\x20'+this['maxFilesPerBatch']+')');const _0x5699d1=[];if(this['parallelAnalysis']&&_0x3ef578['length']>0x1){this['logger']?.[_0x26985b(0x12a)]('Using\x20parallel\x20security\x20scanning',{'totalFiles':_0x3ef578['length'],'batchSize':this[_0x26985b(0x167)]});for(let _0x1c3874=0x0;_0x1c3874<_0x3ef578['length'];_0x1c3874+=this['maxParallelFiles']){const _0x1b64e2=_0x3ef578['slice'](_0x1c3874,_0x1c3874+this['maxParallelFiles']);_0x29b1e8['onProgress']&&_0x29b1e8[_0x26985b(0x198)]({'completed':_0x1c3874,'total':_0x3ef578['length'],'percentage':Math[_0x26985b(0x145)](_0x1c3874/_0x3ef578[_0x26985b(0x1bb)]*0x64)});const _0x87adf7=_0x1b64e2['map'](async _0x418bdb=>{const _0x514657=_0x26985b;try{return await this[_0x514657(0x11a)](_0x418bdb,_0x50d8f9,_0x4ac747,_0x29b1e8);}catch(_0x7ce325){return this[_0x514657(0x163)]?.['warn']('Failed\x20to\x20security\x20scan\x20file\x20in\x20project',{'file':_0x418bdb,'error':_0x7ce325['message']}),{'file':this[_0x514657(0x155)]['createRelativePath'](_0x418bdb,_0x4ac747),'fullPath':_0x418bdb,'error':_0x7ce325['message'],'success':![]};}}),_0x425acd=await Promise['all'](_0x87adf7);_0x5699d1['push'](..._0x425acd[_0x26985b(0x1c0)](_0x5e3a2f=>_0x5e3a2f!==null));}_0x29b1e8['onProgress']&&_0x29b1e8['onProgress']({'completed':_0x3ef578[_0x26985b(0x1bb)],'total':_0x3ef578['length'],'percentage':0x64});}else for(const _0x17a8d7 of _0x3ef578){try{const _0x37a6cd=await this['securityScanFile'](_0x17a8d7,_0x50d8f9,_0x4ac747,_0x29b1e8);_0x37a6cd&&_0x5699d1[_0x26985b(0x188)](_0x37a6cd);}catch(_0x3b248e){this['logger']?.[_0x26985b(0x19e)](_0x26985b(0x19f),{'file':_0x17a8d7,'error':_0x3b248e[_0x26985b(0x174)]}),_0x5699d1[_0x26985b(0x188)]({'file':this[_0x26985b(0x155)][_0x26985b(0x12b)](_0x17a8d7,_0x4ac747),'fullPath':_0x17a8d7,'error':_0x3b248e[_0x26985b(0x174)],'success':![]});}}return _0x4d87c8['length']>0x0&&_0x5699d1['push']({'file':a0_0x3a4aba[_0x26985b(0x197)](_0x3a1ee1,_0x26985b(0x176)),'fullPath':a0_0x3a4aba[_0x26985b(0x197)](_0x3a1ee1,'package.json'),'action':_0x26985b(0x10e),'critical':_0x4d87c8[_0x26985b(0x1c0)](_0x44b7ae=>_0x44b7ae[_0x26985b(0x12d)]===STATIC_ANALYSIS[_0x26985b(0xfa)][_0x26985b(0x173)]),'errors':_0x4d87c8[_0x26985b(0x1c0)](_0x2f8590=>_0x2f8590[_0x26985b(0x12d)]===STATIC_ANALYSIS[_0x26985b(0xfa)][_0x26985b(0x161)]),'warnings':_0x4d87c8['filter'](_0x5d28ec=>_0x5d28ec['severity']===STATIC_ANALYSIS['SEVERITY'][_0x26985b(0x180)]),'info':_0x4d87c8['filter'](_0x5770dc=>_0x5770dc['severity']===STATIC_ANALYSIS[_0x26985b(0xfa)]['INFO']),'totalIssues':_0x4d87c8[_0x26985b(0x1bb)],'analyzed':!![],'scannersUsed':[_0x26985b(0x105)],'timestamp':new Date()['toISOString']()}),_0x5699d1;}async['validateConfigFile'](_0x5a56b2,_0x3f919f,_0x28143b,_0x505752={}){const _0x44e037=a0_0x19f3ef,_0x262a75=a0_0x3a4aba['isAbsolute'](_0x5a56b2)?a0_0x3a4aba['normalize'](_0x5a56b2):a0_0x3a4aba['resolve'](_0x3f919f,_0x5a56b2),_0x82823e=this['directoryAccessManager'][_0x44e037(0x1b9)](_0x262a75,_0x28143b);if(!_0x82823e[_0x44e037(0x1ce)])throw new Error(_0x44e037(0x160)+_0x82823e[_0x44e037(0x16f)]);try{const _0x32bce1=await a0_0x52df5c['stat'](_0x262a75);if(_0x32bce1['size']>this[_0x44e037(0x1a8)])throw new Error('File\x20too\x20large:\x20'+_0x32bce1[_0x44e037(0x143)]+_0x44e037(0x193)+this['maxFileSize']+')');const _0x2b1ca0=await this[_0x44e037(0xee)](),_0x1efe26=await _0x2b1ca0['validate'](_0x262a75,_0x505752),_0x12857e={'file':this['directoryAccessManager'][_0x44e037(0x12b)](_0x262a75,_0x28143b),'fullPath':_0x262a75,'action':'validate-config','critical':_0x1efe26[_0x44e037(0x1c0)](_0x302bae=>_0x302bae['severity']===STATIC_ANALYSIS[_0x44e037(0xfa)]['CRITICAL']),'errors':_0x1efe26[_0x44e037(0x1c0)](_0x2f3bf8=>_0x2f3bf8['severity']===STATIC_ANALYSIS[_0x44e037(0xfa)]['ERROR']),'warnings':_0x1efe26['filter'](_0x2d1738=>_0x2d1738['severity']===STATIC_ANALYSIS['SEVERITY']['WARNING']),'info':_0x1efe26['filter'](_0x17ffd3=>_0x17ffd3[_0x44e037(0x12d)]===STATIC_ANALYSIS['SEVERITY'][_0x44e037(0x1d0)]),'totalIssues':_0x1efe26[_0x44e037(0x1bb)],'analyzed':!![],'validatorsUsed':_0x1efe26['map'](_0x1361e9=>_0x1361e9[_0x44e037(0x148)])[_0x44e037(0x1c0)]((_0x197da7,_0x34dc21,_0x3937ab)=>_0x3937ab['indexOf'](_0x197da7)===_0x34dc21),'timestamp':new Date()[_0x44e037(0x136)]()};return _0x12857e;}catch(_0x14b2c7){throw new Error('Failed\x20to\x20validate\x20config\x20'+_0x5a56b2+':\x20'+_0x14b2c7[_0x44e037(0x174)]);}}async[a0_0x19f3ef(0xec)](_0x26272c,_0x1e1fd4,_0x1ac7de,_0x2a1a4={}){const _0x47ba90=a0_0x19f3ef,_0x30fd3a=a0_0x3a4aba['isAbsolute'](_0x26272c)?a0_0x3a4aba['normalize'](_0x26272c):a0_0x3a4aba['resolve'](_0x1e1fd4,_0x26272c),_0x38f5e0=this['directoryAccessManager']['validateReadAccess'](_0x30fd3a,_0x1ac7de);if(!_0x38f5e0['allowed'])throw new Error('Read\x20access\x20denied:\x20'+_0x38f5e0['reason']);const _0x13acda=await this[_0x47ba90(0x19c)](_0x30fd3a);if(_0x13acda['length']>this[_0x47ba90(0x127)])throw new Error('Too\x20many\x20config\x20files:\x20'+_0x13acda['length']+_0x47ba90(0x124)+this['maxFilesPerBatch']+')');const _0x515712=[];for(const _0x3e82d7 of _0x13acda){try{const _0x21f260=await this[_0x47ba90(0xfb)](_0x3e82d7,_0x1e1fd4,_0x1ac7de,_0x2a1a4);_0x21f260&&_0x515712[_0x47ba90(0x188)](_0x21f260);}catch(_0x9ffa7e){this[_0x47ba90(0x163)]?.['warn']('Failed\x20to\x20validate\x20config\x20file',{'file':_0x3e82d7,'error':_0x9ffa7e['message']}),_0x515712['push']({'file':this[_0x47ba90(0x155)][_0x47ba90(0x12b)](_0x3e82d7,_0x1ac7de),'fullPath':_0x3e82d7,'error':_0x9ffa7e[_0x47ba90(0x174)],'success':![]});}}return _0x515712;}async[a0_0x19f3ef(0x19c)](_0x54b1dc){const _0x1588ed=a0_0x19f3ef,_0x23b678=[],_0x564151=['package.json',_0x1588ed(0xf3),'Dockerfile',_0x1588ed(0x15c),_0x1588ed(0x18c),'.env','.env.example','.eslintrc.js',_0x1588ed(0x1a1),_0x1588ed(0xff),'.prettierrc.json'],_0x26c550=[_0x1588ed(0x1b3),'.yaml',_0x1588ed(0x1bf),_0x1588ed(0x181),_0x1588ed(0x15a)],_0x153d71=async _0x38b935=>{const _0xb0fcde=_0x1588ed,_0x1b9fdd=await a0_0x52df5c['readdir'](_0x38b935,{'withFileTypes':!![]});for(const _0x36aab3 of _0x1b9fdd){const _0x3737c7=a0_0x3a4aba[_0xb0fcde(0x197)](_0x38b935,_0x36aab3[_0xb0fcde(0x18b)]);if(_0x36aab3[_0xb0fcde(0x196)]()){if(_0x36aab3['name']===_0xb0fcde(0x11e)||_0x36aab3['name']===_0xb0fcde(0x158)||_0x36aab3['name']==='k8s'||_0x36aab3[_0xb0fcde(0x18b)]===_0xb0fcde(0x177))await _0x153d71(_0x3737c7);else{if(![_0xb0fcde(0x14b),_0xb0fcde(0x100),'dist','build'][_0xb0fcde(0xfc)](_0x36aab3['name']))continue;}}else{if(_0x36aab3['isFile']()){if(_0x564151['includes'](_0x36aab3[_0xb0fcde(0x18b)]))_0x23b678['push'](_0x3737c7);else{const _0x10fbb8=a0_0x3a4aba[_0xb0fcde(0x1cf)](_0x36aab3['name'])['toLowerCase']();if(_0x26c550['includes'](_0x10fbb8)){const _0x56f33d=a0_0x3a4aba['basename'](a0_0x3a4aba['dirname'](_0x3737c7));(_0x56f33d==='kubernetes'||_0x56f33d===_0xb0fcde(0x1cc)||_0x56f33d===_0xb0fcde(0x177)||_0x56f33d==='workflows')&&_0x23b678['push'](_0x3737c7);}}}}}};return await _0x153d71(_0x54b1dc),_0x23b678;}['detectLanguage'](_0x2df8ce){const _0x31b002=a0_0x19f3ef,_0x477dd3=a0_0x3a4aba['extname'](_0x2df8ce)['toLowerCase']();return STATIC_ANALYSIS[_0x31b002(0xeb)][_0x477dd3]||null;}async['detectFramework'](_0x310ea1,_0x4f47f6){const _0x2a6ef1=a0_0x19f3ef;try{if(_0x4f47f6===STATIC_ANALYSIS['LANGUAGE']['JAVASCRIPT']||_0x4f47f6===STATIC_ANALYSIS['LANGUAGE'][_0x2a6ef1(0x17e)])return await this[_0x2a6ef1(0x10d)](_0x310ea1);if(_0x4f47f6===STATIC_ANALYSIS['LANGUAGE'][_0x2a6ef1(0x137)])return await this[_0x2a6ef1(0xf4)](_0x310ea1);return null;}catch(_0x461341){return this['logger']?.['debug']('Framework\x20detection\x20failed',{'error':_0x461341[_0x2a6ef1(0x174)]}),null;}}async[a0_0x19f3ef(0x10d)](_0x1691db){const _0x25d3f3=a0_0x19f3ef;try{const _0x5dfb94=a0_0x3a4aba['join'](_0x1691db,STATIC_ANALYSIS['FRAMEWORK_MANIFESTS'][_0x25d3f3(0xf7)]),_0x3c2594=await a0_0x52df5c[_0x25d3f3(0x113)](_0x5dfb94,_0x25d3f3(0x156)),_0x48bf5f=JSON[_0x25d3f3(0x1b5)](_0x3c2594),_0x30f31e={..._0x48bf5f[_0x25d3f3(0x1c8)],..._0x48bf5f[_0x25d3f3(0x1b6)]};for(const [_0x3af83e,_0xd0d107]of Object[_0x25d3f3(0x165)](STATIC_ANALYSIS['JS_FRAMEWORKS'])){if(_0x30f31e[_0xd0d107])return _0x3af83e['toLowerCase']();}return null;}catch(_0x3b31fb){return null;}}async['detectPythonFramework'](_0x1699be){const _0x146938=a0_0x19f3ef;try{const _0x24265d=a0_0x3a4aba['join'](_0x1699be,STATIC_ANALYSIS[_0x146938(0x18e)]['PYTHON']),_0x51fc4c=await a0_0x52df5c[_0x146938(0x113)](_0x24265d,'utf-8');for(const [_0x49adb8,_0x1a2fef]of Object['entries'](STATIC_ANALYSIS['PYTHON_FRAMEWORKS'])){if(_0x51fc4c['toLowerCase']()['includes'](_0x1a2fef))return _0x49adb8['toLowerCase']();}return null;}catch(_0x10af85){try{const _0x49274e=a0_0x3a4aba[_0x146938(0x197)](_0x1699be,STATIC_ANALYSIS[_0x146938(0x18e)]['PYTHON_POETRY']),_0x144675=await a0_0x52df5c[_0x146938(0x113)](_0x49274e,_0x146938(0x156));for(const [_0x2ebfbb,_0x203581]of Object['entries'](STATIC_ANALYSIS['PYTHON_FRAMEWORKS'])){if(_0x144675['toLowerCase']()['includes'](_0x203581))return _0x2ebfbb['toLowerCase']();}}catch{}return null;}}async['findFiles'](_0x8f9bbb,_0x643fee){const _0x5dd21=[],_0x529e27=_0x643fee||'**/*.{js,jsx,mjs,cjs,ts,tsx,py,css,scss,sass,less}',_0x313d45=_0x415068=>{const _0x3b96de=a0_0x4f45,_0x1b003d=[],_0x4dd600=_0x415068[_0x3b96de(0xf6)](/\*\.\{([^}]+)\}/);if(_0x4dd600){const _0xf99ef3=_0x4dd600[0x1][_0x3b96de(0xf5)](',')[_0x3b96de(0x17b)](_0x364ab7=>_0x364ab7['trim']());_0xf99ef3[_0x3b96de(0x150)](_0x5337da=>_0x1b003d['push'](_0x5337da['startsWith']('.')?_0x5337da:'.'+_0x5337da));}else{const _0x1fcbfb=_0x415068[_0x3b96de(0xf6)](/\*\.([a-z]+)$/i);if(_0x1fcbfb){const _0x4a022e=_0x1fcbfb[0x1];_0x1b003d[_0x3b96de(0x188)](_0x4a022e[_0x3b96de(0x1b4)]('.')?_0x4a022e:'.'+_0x4a022e);}}if(_0x1b003d[_0x3b96de(0x1bb)]===0x0)return null;return _0x1b003d;},_0x441f27=_0x313d45(_0x529e27),_0xf0c9cd=async _0x3619a5=>{const _0x32352e=a0_0x4f45,_0x1435e6=await a0_0x52df5c['readdir'](_0x3619a5,{'withFileTypes':!![]});for(const _0x1ee6be of _0x1435e6){const _0xbf0977=a0_0x3a4aba['join'](_0x3619a5,_0x1ee6be[_0x32352e(0x18b)]);if(_0x1ee6be['isDirectory']())![_0x32352e(0x14b),_0x32352e(0x100),_0x32352e(0x10c),_0x32352e(0x18a),'__pycache__','.venv','venv'][_0x32352e(0xfc)](_0x1ee6be['name'])&&await _0xf0c9cd(_0xbf0977);else{if(_0x1ee6be[_0x32352e(0x192)]()){const _0x4d1e85=a0_0x3a4aba[_0x32352e(0x1cf)](_0x1ee6be['name'])[_0x32352e(0x15f)]();STATIC_ANALYSIS[_0x32352e(0xeb)][_0x4d1e85]&&((_0x441f27===null||_0x441f27[_0x32352e(0xfc)](_0x4d1e85))&&_0x5dd21[_0x32352e(0x188)](_0xbf0977));}}}};return await _0xf0c9cd(_0x8f9bbb),_0x5dd21;}async['getAnalyzer'](_0x456228){const _0x8f980e=a0_0x19f3ef;try{if(_0x456228===STATIC_ANALYSIS[_0x8f980e(0x14d)][_0x8f980e(0xf7)]){if(!this['analyzers'][_0x8f980e(0x125)]){const {default:_0x4b711b}=await import(_0x8f980e(0x1c7));this[_0x8f980e(0x13c)]['javascript']=new _0x4b711b(this[_0x8f980e(0x163)]);}return this['analyzers']['javascript'];}if(_0x456228===STATIC_ANALYSIS[_0x8f980e(0x14d)][_0x8f980e(0x17e)]){if(!this['analyzers'][_0x8f980e(0x1ae)]){const {default:_0x38531e}=await import(_0x8f980e(0x139));this[_0x8f980e(0x13c)][_0x8f980e(0x1ae)]=new _0x38531e(this['logger']);}return this['analyzers'][_0x8f980e(0x1ae)];}if(_0x456228===STATIC_ANALYSIS['LANGUAGE'][_0x8f980e(0x137)]){if(!this['analyzers']['python']){const {default:_0x29eb39}=await import(_0x8f980e(0x166));this['analyzers']['python']=new _0x29eb39(this[_0x8f980e(0x163)]);}return this[_0x8f980e(0x13c)][_0x8f980e(0x108)];}if(_0x456228===STATIC_ANALYSIS['LANGUAGE']['CSS']||_0x456228===STATIC_ANALYSIS[_0x8f980e(0x14d)][_0x8f980e(0x102)]||_0x456228===STATIC_ANALYSIS['LANGUAGE']['LESS']){if(!this['analyzers']['css']){const {default:_0x13f548}=await import(_0x8f980e(0x11d));this['analyzers']['css']=new _0x13f548(this['logger']);}return this['analyzers'][_0x8f980e(0x18f)];}return null;}catch(_0x166694){return this[_0x8f980e(0x163)]?.[_0x8f980e(0x10b)]('Failed\x20to\x20load\x20analyzer',{'language':_0x456228,'error':_0x166694['message']}),null;}}async['getESLintAnalyzer'](){if(!this['analyzers']['eslint']){const {default:_0x54fc36}=await import('../analyzers/ESLintAnalyzer.js');this['analyzers']['eslint']=new _0x54fc36(this['logger']);}return this['analyzers']['eslint'];}async['getPrettierFormatter'](){const _0x2526dc=a0_0x19f3ef;if(!this['formatters'][_0x2526dc(0x14a)]){const {default:_0x2b89bf}=await import('../analyzers/PrettierFormatter.js');this['formatters']['prettier']=new _0x2b89bf(this[_0x2526dc(0x163)]);}return this[_0x2526dc(0x1be)][_0x2526dc(0x14a)];}async[a0_0x19f3ef(0x1c1)](){const _0x4db096=a0_0x19f3ef;if(!this[_0x4db096(0x13c)]['security']){const {default:_0x2d3cb4}=await import(_0x4db096(0x183));this[_0x4db096(0x13c)]['security']=new _0x2d3cb4(this[_0x4db096(0x163)]);}return this['analyzers'][_0x4db096(0x142)];}async[a0_0x19f3ef(0xee)](){const _0x4079d2=a0_0x19f3ef;if(!this['analyzers'][_0x4079d2(0x186)]){const {default:_0x261bf5}=await import('../analyzers/ConfigValidator.js');this['analyzers'][_0x4079d2(0x186)]=new _0x261bf5(this[_0x4079d2(0x163)]);}return this[_0x4079d2(0x13c)][_0x4079d2(0x186)];}['updateSummary'](_0x53763a,_0x4b464e){const _0x455db5=a0_0x19f3ef;if(_0x4b464e['analyzed']){_0x53763a['totalFiles']++;const _0x4d15b0=_0x4b464e['critical']?.[_0x455db5(0x1bb)]||0x0,_0x59998d=_0x4b464e[_0x455db5(0x153)]?.[_0x455db5(0x1bb)]||0x0,_0x59e0a0=_0x4b464e['warnings']?.['length']||0x0,_0xefeb70=_0x4b464e[_0x455db5(0x1a0)]?.['length']||0x0;_0x53763a['totalCritical']===undefined&&(_0x53763a[_0x455db5(0x18d)]=0x0);_0x53763a[_0x455db5(0x18d)]+=_0x4d15b0,_0x53763a['totalErrors']+=_0x59998d,_0x53763a['totalWarnings']+=_0x59e0a0,_0x53763a[_0x455db5(0x1c2)]+=_0xefeb70;(_0x4d15b0>0x0||_0x59998d>0x0)&&_0x53763a['filesWithErrors']++;_0x4b464e['language']&&(_0x53763a[_0x455db5(0x112)][_0x4b464e['language']]=(_0x53763a['filesByLanguage'][_0x4b464e[_0x455db5(0xf9)]]||0x0)+0x1);const _0x23818d=[..._0x4b464e[_0x455db5(0x1b7)]||[],..._0x4b464e['errors']||[],..._0x4b464e[_0x455db5(0x128)]||[]];for(const _0x480862 of _0x23818d){_0x480862[_0x455db5(0x15d)]&&(_0x53763a['errorsByCategory'][_0x480862[_0x455db5(0x15d)]]=(_0x53763a[_0x455db5(0x189)][_0x480862['category']]||0x0)+0x1);}}}['computeContentHash'](_0x3ac900){const _0x4e977d=a0_0x19f3ef;return a0_0x3533e3['createHash']('sha256')['update'](_0x3ac900)[_0x4e977d(0x110)](_0x4e977d(0x122))[_0x4e977d(0x114)](0x0,0x10);}[a0_0x19f3ef(0x1c4)](){const _0xab6731=a0_0x19f3ef,_0x2ec62c=this['metrics'][_0xab6731(0x1ab)]>0x0?this['metrics'][_0xab6731(0x111)]/this['metrics'][_0xab6731(0x1ab)]*0x64:0x0,_0x1c9bc1=this['metrics']['filesAnalyzed']>0x0?this['metrics'][_0xab6731(0x1a7)]/this['metrics'][_0xab6731(0x119)]:0x0;return{...this['metrics'],'cacheHitRate':Math[_0xab6731(0x145)](_0x2ec62c*0xa)/0xa,'averageAnalysisTime':Math['round'](_0x1c9bc1),'cacheSize':this[_0xab6731(0x170)][_0xab6731(0x143)]};}['resetPerformanceMetrics'](){this['metrics']={'totalAnalyses':0x0,'cacheHits':0x0,'cacheMisses':0x0,'totalAnalysisTime':0x0,'filesAnalyzed':0x0,'parallelBatches':0x0};}['clearCache'](){const _0x465128=a0_0x19f3ef;this['analysisCache'][_0x465128(0xfd)](),this[_0x465128(0x163)]?.['debug'](_0x465128(0x11f));}['getSupportedActions'](){const _0x32eeaf=a0_0x19f3ef;return['analyze',_0x32eeaf(0x1c3),'fix','format',_0x32eeaf(0x131),'security-scan-project',_0x32eeaf(0x144),_0x32eeaf(0xf1)];}['getParameterSchema'](){const _0x7be50b=a0_0x19f3ef;return{'type':_0x7be50b(0x1ad),'properties':{'actions':{'type':_0x7be50b(0x13d),'minItems':0x1,'items':{'type':_0x7be50b(0x1ad),'properties':{'type':{'type':_0x7be50b(0x178),'enum':this[_0x7be50b(0x1a3)]()},'filePath':{'type':_0x7be50b(0x178)},'directory':{'type':'string'},'pattern':{'type':'string'},'includeWarnings':{'type':'boolean'},'maxErrors':{'type':'number'}},'required':[_0x7be50b(0x13e)]}}},'required':[_0x7be50b(0x162)]};}}export default StaticAnalysisTool;