@houtini/lm 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +273 -0
- package/LICENSE +21 -0
- package/README.md +203 -0
- package/dist/cache/analysis-cache.d.ts +33 -0
- package/dist/cache/analysis-cache.d.ts.map +1 -0
- package/dist/cache/analysis-cache.js +56 -0
- package/dist/cache/analysis-cache.js.map +1 -0
- package/dist/cache/cache-manager.d.ts +29 -0
- package/dist/cache/cache-manager.d.ts.map +1 -0
- package/dist/cache/cache-manager.js +85 -0
- package/dist/cache/cache-manager.js.map +1 -0
- package/dist/cache/index.d.ts +16 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +17 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/prompt-cache.d.ts +33 -0
- package/dist/cache/prompt-cache.d.ts.map +1 -0
- package/dist/cache/prompt-cache.js +61 -0
- package/dist/cache/prompt-cache.js.map +1 -0
- package/dist/config.d.ts +43 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +70 -0
- package/dist/config.js.map +1 -0
- package/dist/core/ThreeStagePromptManager.d.ts +39 -0
- package/dist/core/ThreeStagePromptManager.d.ts.map +1 -0
- package/dist/core/ThreeStagePromptManager.js +176 -0
- package/dist/core/ThreeStagePromptManager.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +230 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/base-plugin.d.ts +47 -0
- package/dist/plugins/base-plugin.d.ts.map +1 -0
- package/dist/plugins/base-plugin.js +90 -0
- package/dist/plugins/base-plugin.js.map +1 -0
- package/dist/plugins/index.d.ts +58 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +161 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/types.d.ts +5 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +5 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/prompts/analyze/code-quality.d.ts +116 -0
- package/dist/prompts/analyze/code-quality.d.ts.map +1 -0
- package/dist/prompts/analyze/code-quality.js +433 -0
- package/dist/prompts/analyze/code-quality.js.map +1 -0
- package/dist/prompts/analyze/compare-integration.d.ts +130 -0
- package/dist/prompts/analyze/compare-integration.d.ts.map +1 -0
- package/dist/prompts/analyze/compare-integration.js +543 -0
- package/dist/prompts/analyze/compare-integration.js.map +1 -0
- package/dist/prompts/analyze/count-files.d.ts +109 -0
- package/dist/prompts/analyze/count-files.d.ts.map +1 -0
- package/dist/prompts/analyze/count-files.js +399 -0
- package/dist/prompts/analyze/count-files.js.map +1 -0
- package/dist/prompts/analyze/database-queries.d.ts +156 -0
- package/dist/prompts/analyze/database-queries.d.ts.map +1 -0
- package/dist/prompts/analyze/database-queries.js +759 -0
- package/dist/prompts/analyze/database-queries.js.map +1 -0
- package/dist/prompts/analyze/dependencies.d.ts +97 -0
- package/dist/prompts/analyze/dependencies.d.ts.map +1 -0
- package/dist/prompts/analyze/dependencies.js +333 -0
- package/dist/prompts/analyze/dependencies.js.map +1 -0
- package/dist/prompts/analyze/diff-signatures.d.ts +139 -0
- package/dist/prompts/analyze/diff-signatures.d.ts.map +1 -0
- package/dist/prompts/analyze/diff-signatures.js +702 -0
- package/dist/prompts/analyze/diff-signatures.js.map +1 -0
- package/dist/prompts/analyze/find-patterns.d.ts +128 -0
- package/dist/prompts/analyze/find-patterns.d.ts.map +1 -0
- package/dist/prompts/analyze/find-patterns.js +520 -0
- package/dist/prompts/analyze/find-patterns.js.map +1 -0
- package/dist/prompts/analyze/find-unused-css.d.ts +151 -0
- package/dist/prompts/analyze/find-unused-css.d.ts.map +1 -0
- package/dist/prompts/analyze/find-unused-css.js +754 -0
- package/dist/prompts/analyze/find-unused-css.js.map +1 -0
- package/dist/prompts/analyze/n8n-workflow.d.ts +137 -0
- package/dist/prompts/analyze/n8n-workflow.d.ts.map +1 -0
- package/dist/prompts/analyze/n8n-workflow.js +529 -0
- package/dist/prompts/analyze/n8n-workflow.js.map +1 -0
- package/dist/prompts/analyze/project-structure.d.ts +126 -0
- package/dist/prompts/analyze/project-structure.d.ts.map +1 -0
- package/dist/prompts/analyze/project-structure.js +569 -0
- package/dist/prompts/analyze/project-structure.js.map +1 -0
- package/dist/prompts/analyze/security-audit.d.ts +142 -0
- package/dist/prompts/analyze/security-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/security-audit.js +637 -0
- package/dist/prompts/analyze/security-audit.js.map +1 -0
- package/dist/prompts/analyze/single-file.d.ts +162 -0
- package/dist/prompts/analyze/single-file.d.ts.map +1 -0
- package/dist/prompts/analyze/single-file.js +665 -0
- package/dist/prompts/analyze/single-file.js.map +1 -0
- package/dist/prompts/analyze/trace-execution.d.ts +126 -0
- package/dist/prompts/analyze/trace-execution.d.ts.map +1 -0
- package/dist/prompts/analyze/trace-execution.js +609 -0
- package/dist/prompts/analyze/trace-execution.js.map +1 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +116 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.js +454 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.js.map +1 -0
- package/dist/prompts/analyze/wordpress-security.d.ts +146 -0
- package/dist/prompts/analyze/wordpress-security.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-security.js +698 -0
- package/dist/prompts/analyze/wordpress-security.js.map +1 -0
- package/dist/prompts/analyze/wordpress-theme-audit.d.ts +114 -0
- package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-theme-audit.js +538 -0
- package/dist/prompts/analyze/wordpress-theme-audit.js.map +1 -0
- package/dist/prompts/custom/custom-prompt.d.ts +135 -0
- package/dist/prompts/custom/custom-prompt.d.ts.map +1 -0
- package/dist/prompts/custom/custom-prompt.js +419 -0
- package/dist/prompts/custom/custom-prompt.js.map +1 -0
- package/dist/prompts/fun/arcade-game.d.ts +152 -0
- package/dist/prompts/fun/arcade-game.d.ts.map +1 -0
- package/dist/prompts/fun/arcade-game.js +653 -0
- package/dist/prompts/fun/arcade-game.js.map +1 -0
- package/dist/prompts/fun/create_text_adventure.d.ts +100 -0
- package/dist/prompts/fun/create_text_adventure.d.ts.map +1 -0
- package/dist/prompts/fun/create_text_adventure.js +397 -0
- package/dist/prompts/fun/create_text_adventure.js.map +1 -0
- package/dist/prompts/fun/css-art-generator.d.ts +168 -0
- package/dist/prompts/fun/css-art-generator.d.ts.map +1 -0
- package/dist/prompts/fun/css-art-generator.js +827 -0
- package/dist/prompts/fun/css-art-generator.js.map +1 -0
- package/dist/prompts/generate/project-documentation.d.ts +137 -0
- package/dist/prompts/generate/project-documentation.d.ts.map +1 -0
- package/dist/prompts/generate/project-documentation.js +666 -0
- package/dist/prompts/generate/project-documentation.js.map +1 -0
- package/dist/prompts/generate/refactoring.d.ts +164 -0
- package/dist/prompts/generate/refactoring.d.ts.map +1 -0
- package/dist/prompts/generate/refactoring.js +621 -0
- package/dist/prompts/generate/refactoring.js.map +1 -0
- package/dist/prompts/generate/responsive-component.d.ts +147 -0
- package/dist/prompts/generate/responsive-component.d.ts.map +1 -0
- package/dist/prompts/generate/responsive-component.js +955 -0
- package/dist/prompts/generate/responsive-component.js.map +1 -0
- package/dist/prompts/generate/typescript-conversion.d.ts +144 -0
- package/dist/prompts/generate/typescript-conversion.d.ts.map +1 -0
- package/dist/prompts/generate/typescript-conversion.js +527 -0
- package/dist/prompts/generate/typescript-conversion.js.map +1 -0
- package/dist/prompts/generate/unit-tests.d.ts +139 -0
- package/dist/prompts/generate/unit-tests.d.ts.map +1 -0
- package/dist/prompts/generate/unit-tests.js +578 -0
- package/dist/prompts/generate/unit-tests.js.map +1 -0
- package/dist/prompts/generate/wordpress-plugin.d.ts +179 -0
- package/dist/prompts/generate/wordpress-plugin.d.ts.map +1 -0
- package/dist/prompts/generate/wordpress-plugin.js +763 -0
- package/dist/prompts/generate/wordpress-plugin.js.map +1 -0
- package/dist/prompts/generate/wordpress-theme-from-static.d.ts +177 -0
- package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +1 -0
- package/dist/prompts/generate/wordpress-theme-from-static.js +695 -0
- package/dist/prompts/generate/wordpress-theme-from-static.js.map +1 -0
- package/dist/prompts/shared/cache-manager.d.ts +45 -0
- package/dist/prompts/shared/cache-manager.d.ts.map +1 -0
- package/dist/prompts/shared/cache-manager.js +129 -0
- package/dist/prompts/shared/cache-manager.js.map +1 -0
- package/dist/prompts/shared/helpers.d.ts +39 -0
- package/dist/prompts/shared/helpers.d.ts.map +1 -0
- package/dist/prompts/shared/helpers.js +151 -0
- package/dist/prompts/shared/helpers.js.map +1 -0
- package/dist/prompts/shared/templates.d.ts +35 -0
- package/dist/prompts/shared/templates.d.ts.map +1 -0
- package/dist/prompts/shared/templates.js +77 -0
- package/dist/prompts/shared/templates.js.map +1 -0
- package/dist/prompts/shared/types.d.ts +112 -0
- package/dist/prompts/shared/types.d.ts.map +1 -0
- package/dist/prompts/shared/types.js +5 -0
- package/dist/prompts/shared/types.js.map +1 -0
- package/dist/prompts/system/find-unused-files.d.ts +106 -0
- package/dist/prompts/system/find-unused-files.d.ts.map +1 -0
- package/dist/prompts/system/find-unused-files.js +353 -0
- package/dist/prompts/system/find-unused-files.js.map +1 -0
- package/dist/security/index.d.ts +39 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +46 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/integration-helpers.d.ts +121 -0
- package/dist/security/integration-helpers.d.ts.map +1 -0
- package/dist/security/integration-helpers.js +190 -0
- package/dist/security/integration-helpers.js.map +1 -0
- package/dist/security/output-encoder.d.ts +94 -0
- package/dist/security/output-encoder.d.ts.map +1 -0
- package/dist/security/output-encoder.js +295 -0
- package/dist/security/output-encoder.js.map +1 -0
- package/dist/security/prompt-injection-guard.d.ts +59 -0
- package/dist/security/prompt-injection-guard.d.ts.map +1 -0
- package/dist/security/prompt-injection-guard.js +249 -0
- package/dist/security/prompt-injection-guard.js.map +1 -0
- package/dist/security/sanitisation.d.ts +67 -0
- package/dist/security/sanitisation.d.ts.map +1 -0
- package/dist/security/sanitisation.js +398 -0
- package/dist/security/sanitisation.js.map +1 -0
- package/dist/security/security-service.d.ts +103 -0
- package/dist/security/security-service.d.ts.map +1 -0
- package/dist/security/security-service.js +303 -0
- package/dist/security/security-service.js.map +1 -0
- package/dist/security-config.d.ts +45 -0
- package/dist/security-config.d.ts.map +1 -0
- package/dist/security-config.js +63 -0
- package/dist/security-config.js.map +1 -0
- package/dist/system/function-list.d.ts +61 -0
- package/dist/system/function-list.d.ts.map +1 -0
- package/dist/system/function-list.js +111 -0
- package/dist/system/function-list.js.map +1 -0
- package/dist/system/function-registry.d.ts +23 -0
- package/dist/system/function-registry.d.ts.map +1 -0
- package/dist/system/function-registry.js +136 -0
- package/dist/system/function-registry.js.map +1 -0
- package/dist/system/health-check.d.ts +33 -0
- package/dist/system/health-check.d.ts.map +1 -0
- package/dist/system/health-check.js +98 -0
- package/dist/system/health-check.js.map +1 -0
- package/dist/system/path-resolver.d.ts +55 -0
- package/dist/system/path-resolver.d.ts.map +1 -0
- package/dist/system/path-resolver.js +90 -0
- package/dist/system/path-resolver.js.map +1 -0
- package/dist/templates/plugin-template.d.ts +121 -0
- package/dist/templates/plugin-template.d.ts.map +1 -0
- package/dist/templates/plugin-template.js +450 -0
- package/dist/templates/plugin-template.js.map +1 -0
- package/dist/types/chunking-types.d.ts +88 -0
- package/dist/types/chunking-types.d.ts.map +1 -0
- package/dist/types/chunking-types.js +18 -0
- package/dist/types/chunking-types.js.map +1 -0
- package/dist/types/prompt-stages.d.ts +42 -0
- package/dist/types/prompt-stages.d.ts.map +1 -0
- package/dist/types/prompt-stages.js +6 -0
- package/dist/types/prompt-stages.js.map +1 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/css-parser.d.ts +26 -0
- package/dist/utils/css-parser.d.ts.map +1 -0
- package/dist/utils/css-parser.js +117 -0
- package/dist/utils/css-parser.js.map +1 -0
- package/dist/utils/path-resolver.d.ts +13 -0
- package/dist/utils/path-resolver.d.ts.map +1 -0
- package/dist/utils/path-resolver.js +78 -0
- package/dist/utils/path-resolver.js.map +1 -0
- package/dist/utils/plugin-utilities.d.ts +171 -0
- package/dist/utils/plugin-utilities.d.ts.map +1 -0
- package/dist/utils/plugin-utilities.js +221 -0
- package/dist/utils/plugin-utilities.js.map +1 -0
- package/dist/utils/streamHandler.d.ts +3 -0
- package/dist/utils/streamHandler.d.ts.map +1 -0
- package/dist/utils/streamHandler.js +137 -0
- package/dist/utils/streamHandler.js.map +1 -0
- package/dist/validation/output-validator.d.ts +136 -0
- package/dist/validation/output-validator.d.ts.map +1 -0
- package/dist/validation/output-validator.js +262 -0
- package/dist/validation/output-validator.js.map +1 -0
- package/dist/validation/response-factory.d.ts +44 -0
- package/dist/validation/response-factory.d.ts.map +1 -0
- package/dist/validation/response-factory.js +202 -0
- package/dist/validation/response-factory.js.map +1 -0
- package/dist/validation/schemas.d.ts +519 -0
- package/dist/validation/schemas.d.ts.map +1 -0
- package/dist/validation/schemas.js +6 -0
- package/dist/validation/schemas.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Template - Modern v4.2 (Single Source of Truth)
|
|
3
|
+
*
|
|
4
|
+
* Universal template that intelligently handles both single-file and multi-file analysis
|
|
5
|
+
* Automatically detects analysis type based on provided parameters
|
|
6
|
+
*
|
|
7
|
+
* Copy this template for creating any new plugin - it adapts to your needs
|
|
8
|
+
*/
|
|
9
|
+
import { BasePlugin } from '../../plugins/base-plugin.js';
|
|
10
|
+
import { ThreeStagePromptManager } from '../../core/ThreeStagePromptManager.js';
|
|
11
|
+
import { withSecurity } from '../../security/integration-helpers.js';
|
|
12
|
+
import { readFileContent } from '../shared/helpers.js';
|
|
13
|
+
import { ModelSetup, ResponseProcessor, ParameterValidator, ErrorHandler, MultiFileAnalysis } from '../../utils/plugin-utilities.js';
|
|
14
|
+
import { getAnalysisCache } from '../../cache/index.js';
|
|
15
|
+
// Common Node.js modules - Use these instead of require()
|
|
16
|
+
import { basename, dirname, extname, relative } from 'path';
|
|
17
|
+
import { readFile, stat } from 'fs/promises';
|
|
18
|
+
export class ProjectStructureAnalyzer extends BasePlugin {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this.name = 'analyze_project_structure';
|
|
22
|
+
this.category = 'analyze';
|
|
23
|
+
this.description = 'Analyze complete project structure and architecture with actionable strategic recommendations';
|
|
24
|
+
// Universal parameter set - supports both single and multi-file scenarios
|
|
25
|
+
this.parameters = {
|
|
26
|
+
// Single-file parameters
|
|
27
|
+
code: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'The code to analyze (for single-file analysis)',
|
|
30
|
+
required: false
|
|
31
|
+
},
|
|
32
|
+
filePath: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Path to single file to analyze',
|
|
35
|
+
required: false
|
|
36
|
+
},
|
|
37
|
+
// Multi-file parameters
|
|
38
|
+
projectPath: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'Absolute path to project root',
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
files: {
|
|
44
|
+
type: 'array',
|
|
45
|
+
description: 'Array of specific file paths (for multi-file analysis)',
|
|
46
|
+
required: false,
|
|
47
|
+
items: { type: 'string' }
|
|
48
|
+
},
|
|
49
|
+
maxDepth: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
description: 'Maximum directory depth to analyze (1-5)',
|
|
52
|
+
required: false,
|
|
53
|
+
default: 3
|
|
54
|
+
},
|
|
55
|
+
// Universal parameters
|
|
56
|
+
language: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'Programming language',
|
|
59
|
+
required: false,
|
|
60
|
+
default: 'javascript'
|
|
61
|
+
},
|
|
62
|
+
analysisDepth: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
description: 'Level of analysis detail',
|
|
65
|
+
enum: ['basic', 'detailed', 'comprehensive'],
|
|
66
|
+
default: 'detailed',
|
|
67
|
+
required: false
|
|
68
|
+
},
|
|
69
|
+
analysisType: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: 'Type of analysis to perform',
|
|
72
|
+
enum: ['architecture', 'patterns', 'comprehensive'],
|
|
73
|
+
default: 'comprehensive',
|
|
74
|
+
required: false
|
|
75
|
+
},
|
|
76
|
+
focusAreas: {
|
|
77
|
+
type: 'array',
|
|
78
|
+
description: 'Areas to focus on: architecture, dependencies, complexity, patterns',
|
|
79
|
+
required: false,
|
|
80
|
+
default: [],
|
|
81
|
+
items: { type: 'string' }
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
this.analysisCache = getAnalysisCache();
|
|
85
|
+
this.multiFileAnalysis = new MultiFileAnalysis();
|
|
86
|
+
// Cache and analysis utilities are initialized above
|
|
87
|
+
}
|
|
88
|
+
async execute(params, llmClient) {
|
|
89
|
+
return await withSecurity(this, params, llmClient, async (secureParams) => {
|
|
90
|
+
try {
|
|
91
|
+
// 1. Auto-detect analysis mode based on parameters
|
|
92
|
+
const analysisMode = this.detectAnalysisMode(secureParams);
|
|
93
|
+
// 2. Validate parameters based on detected mode
|
|
94
|
+
this.validateParameters(secureParams, analysisMode);
|
|
95
|
+
// 3. Setup model
|
|
96
|
+
const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
|
|
97
|
+
// 4. Route to appropriate analysis method
|
|
98
|
+
if (analysisMode === 'single-file') {
|
|
99
|
+
return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return ErrorHandler.createExecutionError('analyze_project_structure', error);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Auto-detect whether this is single-file or multi-file analysis
|
|
112
|
+
*/
|
|
113
|
+
detectAnalysisMode(params) {
|
|
114
|
+
// Single-file indicators take priority (avoids default parameter issues)
|
|
115
|
+
if (params.code || params.filePath) {
|
|
116
|
+
return 'single-file';
|
|
117
|
+
}
|
|
118
|
+
// Multi-file indicators
|
|
119
|
+
if (params.projectPath || params.files) {
|
|
120
|
+
return 'multi-file';
|
|
121
|
+
}
|
|
122
|
+
// Default to multi-file for project structure analysis
|
|
123
|
+
return 'multi-file';
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Validate parameters based on detected analysis mode
|
|
127
|
+
*/
|
|
128
|
+
validateParameters(params, mode) {
|
|
129
|
+
if (mode === 'single-file') {
|
|
130
|
+
ParameterValidator.validateCodeOrFile(params);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
ParameterValidator.validateProjectPath(params);
|
|
134
|
+
ParameterValidator.validateDepth(params);
|
|
135
|
+
}
|
|
136
|
+
// Universal validations
|
|
137
|
+
ParameterValidator.validateEnum(params, 'analysisType', ['architecture', 'patterns', 'comprehensive']);
|
|
138
|
+
ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Execute single-file analysis
|
|
142
|
+
*/
|
|
143
|
+
async executeSingleFileAnalysis(params, model, contextLength) {
|
|
144
|
+
// Process single file input
|
|
145
|
+
let codeToAnalyze = params.code;
|
|
146
|
+
if (params.filePath) {
|
|
147
|
+
codeToAnalyze = await readFileContent(params.filePath);
|
|
148
|
+
}
|
|
149
|
+
// Generate prompt stages for single file
|
|
150
|
+
const promptStages = this.getSingleFilePromptStages({
|
|
151
|
+
...params,
|
|
152
|
+
code: codeToAnalyze
|
|
153
|
+
});
|
|
154
|
+
// Execute with appropriate method
|
|
155
|
+
const promptManager = new ThreeStagePromptManager(contextLength);
|
|
156
|
+
const needsChunking = promptManager.needsChunking(promptStages);
|
|
157
|
+
if (needsChunking) {
|
|
158
|
+
const conversation = promptManager.createChunkedConversation(promptStages);
|
|
159
|
+
const messages = [
|
|
160
|
+
conversation.systemMessage,
|
|
161
|
+
...conversation.dataMessages,
|
|
162
|
+
conversation.analysisMessage
|
|
163
|
+
];
|
|
164
|
+
return await ResponseProcessor.executeChunked(messages, model, contextLength, 'analyze_project_structure', 'single');
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return await ResponseProcessor.executeDirect(promptStages, model, contextLength, 'analyze_project_structure');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Execute multi-file analysis
|
|
172
|
+
*/
|
|
173
|
+
async executeMultiFileAnalysis(params, model, contextLength) {
|
|
174
|
+
// Discover files
|
|
175
|
+
let filesToAnalyze = params.files ||
|
|
176
|
+
await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.analysisType);
|
|
177
|
+
// Perform multi-file analysis with caching
|
|
178
|
+
const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
|
|
179
|
+
// Generate prompt stages for multi-file
|
|
180
|
+
const promptStages = this.getMultiFilePromptStages({
|
|
181
|
+
...params,
|
|
182
|
+
analysisResult,
|
|
183
|
+
fileCount: filesToAnalyze.length
|
|
184
|
+
});
|
|
185
|
+
// Always use chunking for multi-file
|
|
186
|
+
const promptManager = new ThreeStagePromptManager(contextLength);
|
|
187
|
+
const conversation = promptManager.createChunkedConversation(promptStages);
|
|
188
|
+
const messages = [
|
|
189
|
+
conversation.systemMessage,
|
|
190
|
+
...conversation.dataMessages,
|
|
191
|
+
conversation.analysisMessage
|
|
192
|
+
];
|
|
193
|
+
return await ResponseProcessor.executeChunked(messages, model, contextLength, 'analyze_project_structure', 'multifile');
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Single-file structure analysis - focuses on file's role in larger architecture
|
|
197
|
+
*/
|
|
198
|
+
getSingleFilePromptStages(params) {
|
|
199
|
+
const { code, language, analysisDepth, analysisType, filePath } = params;
|
|
200
|
+
const fileName = filePath ? basename(filePath) : 'unknown';
|
|
201
|
+
const focusAreas = params.focusAreas || [];
|
|
202
|
+
const systemAndContext = `You are a senior software architect with 15+ years of experience analyzing codebases and providing strategic guidance to development teams.
|
|
203
|
+
|
|
204
|
+
**YOUR EXPERTISE:**
|
|
205
|
+
- Identifying architectural patterns and anti-patterns
|
|
206
|
+
- Recognizing scalability bottlenecks and technical debt
|
|
207
|
+
- Providing actionable recommendations that balance pragmatism with best practices
|
|
208
|
+
- Understanding business impact of technical decisions
|
|
209
|
+
|
|
210
|
+
**ANALYSIS CONTEXT:**
|
|
211
|
+
- File: ${fileName}
|
|
212
|
+
- Language: ${language}
|
|
213
|
+
- Analysis Depth: ${analysisDepth}
|
|
214
|
+
- Analysis Type: ${analysisType}
|
|
215
|
+
- Focus Areas: ${focusAreas.length ? focusAreas.join(', ') : 'comprehensive'}
|
|
216
|
+
- Mode: Single File Architectural Analysis
|
|
217
|
+
|
|
218
|
+
**YOUR MISSION:**
|
|
219
|
+
Analyze this file's role in the broader architecture. Don't just describe what it does - explain its strategic importance, potential issues, and how it fits into modern software patterns.`;
|
|
220
|
+
const dataPayload = `File to analyze: ${fileName}
|
|
221
|
+
|
|
222
|
+
\`\`\`${language}
|
|
223
|
+
${code}
|
|
224
|
+
\`\`\``;
|
|
225
|
+
const outputInstructions = `Provide comprehensive architectural analysis of this file covering:
|
|
226
|
+
|
|
227
|
+
**Executive Summary:**
|
|
228
|
+
- **File Role**: What role does this file play in the overall architecture?
|
|
229
|
+
- **Architectural Pattern**: What pattern does this file implement or support?
|
|
230
|
+
- **Business Criticality**: How critical is this file to business operations?
|
|
231
|
+
|
|
232
|
+
**Structural Analysis:**
|
|
233
|
+
- **Primary Responsibilities**: List the main responsibilities of this file
|
|
234
|
+
- **Dependencies**:
|
|
235
|
+
- Key imports and what this file relies on
|
|
236
|
+
- What this file exports and provides to other parts
|
|
237
|
+
- Coupling assessment (tight/loose/moderate) with explanation
|
|
238
|
+
- **Design Patterns**: Identify any design patterns used in this file
|
|
239
|
+
- **Code Organization**: Assessment of how well the code is structured internally
|
|
240
|
+
|
|
241
|
+
**Architectural Insights:**
|
|
242
|
+
- **Strengths & Opportunities**: What this file does well architecturally
|
|
243
|
+
- **Technical Debt**: Areas where technical debt is accumulating
|
|
244
|
+
- **Scalability Considerations**: How will this file behave as the system grows?
|
|
245
|
+
- **Maintainability Score**: Rate 1-10 with detailed explanation
|
|
246
|
+
|
|
247
|
+
**Strategic Recommendations:**
|
|
248
|
+
For each recommendation, provide:
|
|
249
|
+
- **Priority**: High/medium/low priority level
|
|
250
|
+
- **Recommendation**: Specific actionable recommendation
|
|
251
|
+
- **Rationale**: Why this matters for the business/team
|
|
252
|
+
- **Effort**: Low/medium/high implementation effort
|
|
253
|
+
- **Impact**: Business or technical impact of implementing this
|
|
254
|
+
|
|
255
|
+
**Confidence Assessment:** Your confidence level in this analysis
|
|
256
|
+
|
|
257
|
+
Focus on strategic architectural insights that help developers make better decisions, not just code review comments.`;
|
|
258
|
+
return { systemAndContext, dataPayload, outputInstructions };
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Multi-file project structure analysis - comprehensive architectural overview
|
|
262
|
+
*/
|
|
263
|
+
getMultiFilePromptStages(params) {
|
|
264
|
+
const { analysisResult, analysisType, analysisDepth, fileCount, projectPath } = params;
|
|
265
|
+
const focusAreas = params.focusAreas || [];
|
|
266
|
+
const projectName = projectPath ? basename(projectPath) : 'Project';
|
|
267
|
+
const systemAndContext = `You are a senior software architect and technical consultant specializing in ${analysisDepth} ${analysisType} analysis.
|
|
268
|
+
|
|
269
|
+
**YOUR EXPERTISE:**
|
|
270
|
+
- 15+ years architecting scalable software systems
|
|
271
|
+
- Expert in identifying patterns, anti-patterns, and architectural smells
|
|
272
|
+
- Skilled at translating technical analysis into business recommendations
|
|
273
|
+
- Proven track record helping teams improve system design and maintainability
|
|
274
|
+
|
|
275
|
+
**PROJECT CONTEXT:**
|
|
276
|
+
- Project: ${projectName}
|
|
277
|
+
- Files Analyzed: ${fileCount}
|
|
278
|
+
- Analysis Type: ${analysisType}
|
|
279
|
+
- Analysis Depth: ${analysisDepth}
|
|
280
|
+
- Focus Areas: ${focusAreas.length ? focusAreas.join(', ') : 'comprehensive architecture'}
|
|
281
|
+
- Mode: Complete Project Architecture Analysis
|
|
282
|
+
|
|
283
|
+
**YOUR MISSION:**
|
|
284
|
+
Provide a comprehensive architectural assessment that helps the development team understand their system's current state and chart a path forward. Focus on actionable insights that balance technical excellence with practical business needs.`;
|
|
285
|
+
const dataPayload = `Complete project structure analysis:
|
|
286
|
+
|
|
287
|
+
${JSON.stringify(analysisResult, null, 2)}`;
|
|
288
|
+
const outputInstructions = `Provide comprehensive project architecture analysis covering:
|
|
289
|
+
|
|
290
|
+
**Executive Summary:**
|
|
291
|
+
- **Overall Architectural Health**: Assess as excellent/good/concerning/poor with 2-sentence explanation
|
|
292
|
+
- **Primary Strengths**: Top 3 architectural strengths of this project
|
|
293
|
+
- **Critical Concerns**: Top 3 areas requiring immediate attention
|
|
294
|
+
- **Recommended Focus**: What should the team prioritize next?
|
|
295
|
+
|
|
296
|
+
**Architectural Overview:**
|
|
297
|
+
- **Detected Patterns**: For each pattern found:
|
|
298
|
+
- Pattern name (e.g., MVC, Microservices, Layered)
|
|
299
|
+
- Implementation quality (well/partially/poorly implemented)
|
|
300
|
+
- Impact on the system
|
|
301
|
+
- **System Complexity**:
|
|
302
|
+
- Complexity level (low/moderate/high/excessive)
|
|
303
|
+
- Justification for this complexity level
|
|
304
|
+
- Whether the complexity is manageable
|
|
305
|
+
- **Code Organization**:
|
|
306
|
+
- Directory structure assessment (well-organized/adequate/chaotic)
|
|
307
|
+
- Separation of concerns (clear/mixed/tangled)
|
|
308
|
+
- Consistency score (1-10 with explanation)
|
|
309
|
+
|
|
310
|
+
**Dependency Analysis:**
|
|
311
|
+
- **External Dependencies**:
|
|
312
|
+
- Count and risk level assessment (low/medium/high)
|
|
313
|
+
- List of concerning outdated dependencies
|
|
314
|
+
- Dependency management recommendations
|
|
315
|
+
- **Internal Coupling**:
|
|
316
|
+
- Coupling level (loose/moderate/tight)
|
|
317
|
+
- Files or modules with coupling issues
|
|
318
|
+
- Specific decoupling suggestions
|
|
319
|
+
|
|
320
|
+
**Quality and Maintainability:**
|
|
321
|
+
- **Code Quality Score**: Rate 1-10 with detailed explanation
|
|
322
|
+
- **Technical Debt Areas**: For each area:
|
|
323
|
+
- Specific area of technical debt
|
|
324
|
+
- Severity (low/medium/high/critical)
|
|
325
|
+
- Business impact explanation
|
|
326
|
+
- Specific remediation steps
|
|
327
|
+
- **Testability**: Assessment of how easy this codebase is to test
|
|
328
|
+
- **Documentation**: Current state of project documentation
|
|
329
|
+
|
|
330
|
+
**Scalability and Performance:**
|
|
331
|
+
- **Current Scalability**: Assessment of how well this system will scale
|
|
332
|
+
- **Performance Bottlenecks**: Identified or potential performance issues
|
|
333
|
+
- **Resource Utilization**: Efficient or concerning resource usage patterns
|
|
334
|
+
- **Scaling Recommendations**: Specific recommendations for growth
|
|
335
|
+
|
|
336
|
+
**Strategic Recommendations:**
|
|
337
|
+
For each recommendation, provide:
|
|
338
|
+
- **Category**: architecture/dependencies/quality/performance/team
|
|
339
|
+
- **Priority**: critical/high/medium/low
|
|
340
|
+
- **Recommendation**: Specific actionable recommendation
|
|
341
|
+
- **Business Justification**: Why this matters for business success
|
|
342
|
+
- **Technical Justification**: Technical reasoning
|
|
343
|
+
- **Estimated Effort**: hours/days/weeks/months
|
|
344
|
+
- **Expected Impact**: Measurable impact on team or system
|
|
345
|
+
- **Prerequisites**: What needs to happen first
|
|
346
|
+
- **Risk of Not Implementing**: What happens if this is ignored
|
|
347
|
+
|
|
348
|
+
**Next Steps:**
|
|
349
|
+
- **Immediate Actions**: Actions to take this week
|
|
350
|
+
- **Short-term Actions**: Actions for next 1-3 months
|
|
351
|
+
- **Long-term Initiatives**: Strategic initiatives for 6+ months
|
|
352
|
+
- **Team Capability Needs**: Skills or knowledge the team should develop
|
|
353
|
+
|
|
354
|
+
Focus on recommendations that help the team ship better software faster. Every suggestion should clearly explain both the technical benefit and business value.`;
|
|
355
|
+
return { systemAndContext, dataPayload, outputInstructions };
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Backwards compatibility method
|
|
359
|
+
*/
|
|
360
|
+
getPromptStages(params) {
|
|
361
|
+
const mode = this.detectAnalysisMode(params);
|
|
362
|
+
if (mode === 'single-file') {
|
|
363
|
+
return this.getSingleFilePromptStages(params);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
return this.getMultiFilePromptStages(params);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
// Multi-file helper methods
|
|
370
|
+
async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
|
|
371
|
+
const extensions = this.getFileExtensions(analysisType);
|
|
372
|
+
return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
|
|
373
|
+
}
|
|
374
|
+
async performMultiFileAnalysis(files, params, model, contextLength) {
|
|
375
|
+
const cacheKey = this.analysisCache.generateKey('analyze_project_structure', params, files);
|
|
376
|
+
const cached = await this.analysisCache.get(cacheKey);
|
|
377
|
+
if (cached)
|
|
378
|
+
return cached;
|
|
379
|
+
const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualFile(file, params, model), contextLength);
|
|
380
|
+
// Aggregate results into comprehensive project analysis
|
|
381
|
+
const aggregatedResult = {
|
|
382
|
+
summary: `Project structure analysis of ${files.length} files`,
|
|
383
|
+
projectMetrics: {
|
|
384
|
+
totalFiles: files.length,
|
|
385
|
+
totalSize: fileAnalysisResults.reduce((sum, result) => sum + (result.size || 0), 0),
|
|
386
|
+
averageFileSize: Math.round(fileAnalysisResults.reduce((sum, result) => sum + (result.size || 0), 0) / files.length),
|
|
387
|
+
totalLines: fileAnalysisResults.reduce((sum, result) => sum + (result.lines || 0), 0),
|
|
388
|
+
fileTypeDistribution: this.analyzeFileTypes(fileAnalysisResults),
|
|
389
|
+
directoryStructure: this.analyzeDirectoryStructure(files, params.projectPath)
|
|
390
|
+
},
|
|
391
|
+
architecturalInsights: {
|
|
392
|
+
largestFiles: fileAnalysisResults
|
|
393
|
+
.sort((a, b) => (b.size || 0) - (a.size || 0))
|
|
394
|
+
.slice(0, 10)
|
|
395
|
+
.map(f => ({ path: f.relativePath, size: f.size, lines: f.lines })),
|
|
396
|
+
complexityIndicators: this.calculateComplexityMetrics(fileAnalysisResults),
|
|
397
|
+
organizationPatterns: this.identifyOrganizationPatterns(files),
|
|
398
|
+
dependencyStructure: this.analyzeDependencyStructure(fileAnalysisResults)
|
|
399
|
+
},
|
|
400
|
+
fileAnalysisResults
|
|
401
|
+
};
|
|
402
|
+
await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
|
|
403
|
+
modelUsed: model.identifier || 'unknown',
|
|
404
|
+
executionTime: Date.now() - Date.now(), // TODO: Track actual execution time
|
|
405
|
+
timestamp: new Date().toISOString()
|
|
406
|
+
});
|
|
407
|
+
return aggregatedResult;
|
|
408
|
+
}
|
|
409
|
+
async analyzeIndividualFile(file, params, model) {
|
|
410
|
+
const content = await readFile(file, 'utf-8');
|
|
411
|
+
const stats = await stat(file);
|
|
412
|
+
return {
|
|
413
|
+
filePath: file,
|
|
414
|
+
fileName: basename(file),
|
|
415
|
+
size: content.length,
|
|
416
|
+
lines: content.split('\n').length,
|
|
417
|
+
extension: extname(file),
|
|
418
|
+
relativePath: relative(params.projectPath || '', file),
|
|
419
|
+
directory: dirname(relative(params.projectPath || '', file)),
|
|
420
|
+
isEmpty: content.trim().length === 0,
|
|
421
|
+
isConfigFile: this.isConfigFile(file),
|
|
422
|
+
isTestFile: this.isTestFile(file),
|
|
423
|
+
lastModified: stats.mtime,
|
|
424
|
+
// Basic complexity indicators
|
|
425
|
+
functionsCount: this.countFunctions(content),
|
|
426
|
+
importsCount: this.countImports(content),
|
|
427
|
+
exportsCount: this.countExports(content)
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
getFileExtensions(analysisType) {
|
|
431
|
+
const extensionMap = {
|
|
432
|
+
'architecture': ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs', '.php', '.rb', '.go', '.json', '.yaml', '.yml', '.xml'],
|
|
433
|
+
'patterns': ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs', '.php', '.rb', '.go', '.vue', '.svelte'],
|
|
434
|
+
'comprehensive': ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs', '.php', '.rb', '.go', '.vue', '.svelte', '.json', '.yaml', '.yml', '.xml', '.md', '.txt', '.css', '.scss', '.less']
|
|
435
|
+
};
|
|
436
|
+
return extensionMap[analysisType] || extensionMap.comprehensive;
|
|
437
|
+
}
|
|
438
|
+
// Helper methods for analysis
|
|
439
|
+
analyzeFileTypes(results) {
|
|
440
|
+
const typeCount = {};
|
|
441
|
+
results.forEach(result => {
|
|
442
|
+
const ext = result.extension || 'no-extension';
|
|
443
|
+
typeCount[ext] = (typeCount[ext] || 0) + 1;
|
|
444
|
+
});
|
|
445
|
+
return typeCount;
|
|
446
|
+
}
|
|
447
|
+
analyzeDirectoryStructure(files, projectPath) {
|
|
448
|
+
const structure = {};
|
|
449
|
+
files.forEach(file => {
|
|
450
|
+
const relativePath = projectPath ? relative(projectPath, file) : file;
|
|
451
|
+
const parts = relativePath.split(/[\/\\]/);
|
|
452
|
+
let current = structure;
|
|
453
|
+
parts.forEach((part, index) => {
|
|
454
|
+
if (index === parts.length - 1) {
|
|
455
|
+
// It's a file
|
|
456
|
+
if (!current._files)
|
|
457
|
+
current._files = [];
|
|
458
|
+
current._files.push(part);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
// It's a directory
|
|
462
|
+
if (!current[part])
|
|
463
|
+
current[part] = {};
|
|
464
|
+
current = current[part];
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
return structure;
|
|
469
|
+
}
|
|
470
|
+
calculateComplexityMetrics(results) {
|
|
471
|
+
const sizes = results.map(r => r.size || 0);
|
|
472
|
+
const lines = results.map(r => r.lines || 0);
|
|
473
|
+
return {
|
|
474
|
+
fileSizeVariance: this.calculateVariance(sizes),
|
|
475
|
+
lineLengthVariance: this.calculateVariance(lines),
|
|
476
|
+
largeFileCount: sizes.filter(s => s > 10000).length,
|
|
477
|
+
veryLargeFileCount: sizes.filter(s => s > 50000).length
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
identifyOrganizationPatterns(files) {
|
|
481
|
+
const patterns = [];
|
|
482
|
+
// Check for common patterns
|
|
483
|
+
if (files.some(f => f.includes('/src/')))
|
|
484
|
+
patterns.push('src-directory');
|
|
485
|
+
if (files.some(f => f.includes('/lib/')))
|
|
486
|
+
patterns.push('lib-directory');
|
|
487
|
+
if (files.some(f => f.includes('/components/')))
|
|
488
|
+
patterns.push('component-structure');
|
|
489
|
+
if (files.some(f => f.includes('/utils/') || f.includes('/helpers/')))
|
|
490
|
+
patterns.push('utility-separation');
|
|
491
|
+
if (files.some(f => f.includes('/test/') || f.includes('/__tests__/')))
|
|
492
|
+
patterns.push('test-organization');
|
|
493
|
+
if (files.some(f => f.includes('/config/')))
|
|
494
|
+
patterns.push('configuration-separation');
|
|
495
|
+
return patterns;
|
|
496
|
+
}
|
|
497
|
+
analyzeDependencyStructure(results) {
|
|
498
|
+
const totalImports = results.reduce((sum, r) => sum + (r.importsCount || 0), 0);
|
|
499
|
+
const totalExports = results.reduce((sum, r) => sum + (r.exportsCount || 0), 0);
|
|
500
|
+
const filesWithImports = results.filter(r => (r.importsCount || 0) > 0).length;
|
|
501
|
+
const filesWithExports = results.filter(r => (r.exportsCount || 0) > 0).length;
|
|
502
|
+
return {
|
|
503
|
+
totalImports,
|
|
504
|
+
totalExports,
|
|
505
|
+
averageImportsPerFile: filesWithImports ? Math.round(totalImports / filesWithImports) : 0,
|
|
506
|
+
averageExportsPerFile: filesWithExports ? Math.round(totalExports / filesWithExports) : 0,
|
|
507
|
+
interconnectionLevel: filesWithImports / results.length
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
// Utility methods
|
|
511
|
+
isConfigFile(file) {
|
|
512
|
+
const configPatterns = ['.json', '.yaml', '.yml', '.xml', '.ini', '.toml', '.config.', 'package.json', 'tsconfig.', 'webpack.', 'babel.'];
|
|
513
|
+
return configPatterns.some(pattern => file.includes(pattern));
|
|
514
|
+
}
|
|
515
|
+
isTestFile(file) {
|
|
516
|
+
const testPatterns = ['.test.', '.spec.', '__test__', '__spec__', '/test/', '/tests/', '/spec/'];
|
|
517
|
+
return testPatterns.some(pattern => file.includes(pattern));
|
|
518
|
+
}
|
|
519
|
+
countFunctions(content) {
|
|
520
|
+
// Simple function counting - can be enhanced
|
|
521
|
+
const functionPatterns = [
|
|
522
|
+
/function\s+\w+/g,
|
|
523
|
+
/const\s+\w+\s*=\s*\(/g,
|
|
524
|
+
/let\s+\w+\s*=\s*\(/g,
|
|
525
|
+
/\w+\s*:\s*function/g,
|
|
526
|
+
/\w+\s*=>\s*/g
|
|
527
|
+
];
|
|
528
|
+
return functionPatterns.reduce((count, pattern) => {
|
|
529
|
+
const matches = content.match(pattern);
|
|
530
|
+
return count + (matches ? matches.length : 0);
|
|
531
|
+
}, 0);
|
|
532
|
+
}
|
|
533
|
+
countImports(content) {
|
|
534
|
+
const importPatterns = [
|
|
535
|
+
/^import\s+/gm,
|
|
536
|
+
/^const\s+.*=\s*require\(/gm,
|
|
537
|
+
/^from\s+.*import/gm
|
|
538
|
+
];
|
|
539
|
+
return importPatterns.reduce((count, pattern) => {
|
|
540
|
+
const matches = content.match(pattern);
|
|
541
|
+
return count + (matches ? matches.length : 0);
|
|
542
|
+
}, 0);
|
|
543
|
+
}
|
|
544
|
+
countExports(content) {
|
|
545
|
+
const exportPatterns = [
|
|
546
|
+
/^export\s+/gm,
|
|
547
|
+
/^module\.exports/gm,
|
|
548
|
+
/^exports\./gm
|
|
549
|
+
];
|
|
550
|
+
return exportPatterns.reduce((count, pattern) => {
|
|
551
|
+
const matches = content.match(pattern);
|
|
552
|
+
return count + (matches ? matches.length : 0);
|
|
553
|
+
}, 0);
|
|
554
|
+
}
|
|
555
|
+
calculateVariance(numbers) {
|
|
556
|
+
if (numbers.length === 0)
|
|
557
|
+
return 0;
|
|
558
|
+
const mean = numbers.reduce((sum, n) => sum + n, 0) / numbers.length;
|
|
559
|
+
const squaredDiffs = numbers.map(n => Math.pow(n - mean, 2));
|
|
560
|
+
return squaredDiffs.reduce((sum, diff) => sum + diff, 0) / numbers.length;
|
|
561
|
+
}
|
|
562
|
+
generateCacheKey(files, params) {
|
|
563
|
+
const fileHash = files.join('|');
|
|
564
|
+
const paramHash = JSON.stringify(params);
|
|
565
|
+
return `${fileHash}_${paramHash}`.substring(0, 64);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
export default ProjectStructureAnalyzer;
|
|
569
|
+
//# sourceMappingURL=project-structure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-structure.js","sourceRoot":"","sources":["../../../src/prompts/analyze/project-structure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,0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