@ai-coders/context 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generators/agents/agentConfig.d.ts +4 -0
- package/dist/generators/agents/agentConfig.d.ts.map +1 -0
- package/dist/generators/agents/agentConfig.js +138 -0
- package/dist/generators/agents/agentConfig.js.map +1 -0
- package/dist/generators/agents/agentGenerator.d.ts +13 -0
- package/dist/generators/agents/agentGenerator.d.ts.map +1 -0
- package/dist/generators/agents/agentGenerator.js +80 -0
- package/dist/generators/agents/agentGenerator.js.map +1 -0
- package/dist/generators/agents/agentTypes.d.ts +4 -0
- package/dist/generators/agents/agentTypes.d.ts.map +1 -0
- package/dist/generators/agents/agentTypes.js +22 -0
- package/dist/generators/agents/agentTypes.js.map +1 -0
- package/dist/generators/agents/contextUtils.d.ts +8 -0
- package/dist/generators/agents/contextUtils.d.ts.map +1 -0
- package/dist/generators/agents/contextUtils.js +15 -0
- package/dist/generators/agents/contextUtils.js.map +1 -0
- package/dist/generators/agents/index.d.ts +6 -0
- package/dist/generators/agents/index.d.ts.map +1 -0
- package/dist/generators/agents/index.js +16 -0
- package/dist/generators/agents/index.js.map +1 -0
- package/dist/generators/agents/promptFormatter.d.ts +9 -0
- package/dist/generators/agents/promptFormatter.d.ts.map +1 -0
- package/dist/generators/agents/promptFormatter.js +84 -0
- package/dist/generators/agents/promptFormatter.js.map +1 -0
- package/dist/generators/analyzers/codebaseAnalyzer.d.ts +45 -0
- package/dist/generators/analyzers/codebaseAnalyzer.d.ts.map +1 -0
- package/dist/generators/analyzers/codebaseAnalyzer.js +293 -0
- package/dist/generators/analyzers/codebaseAnalyzer.js.map +1 -0
- package/dist/generators/analyzers/index.d.ts +3 -0
- package/dist/generators/analyzers/index.d.ts.map +1 -0
- package/dist/generators/analyzers/index.js +6 -0
- package/dist/generators/analyzers/index.js.map +1 -0
- package/dist/generators/documentation/documentationGenerator.d.ts +19 -0
- package/dist/generators/documentation/documentationGenerator.d.ts.map +1 -0
- package/dist/generators/documentation/documentationGenerator.js +127 -0
- package/dist/generators/documentation/documentationGenerator.js.map +1 -0
- package/dist/generators/documentation/documentationTemplates.d.ts +21 -0
- package/dist/generators/documentation/documentationTemplates.d.ts.map +1 -0
- package/dist/generators/documentation/documentationTemplates.js +359 -0
- package/dist/generators/documentation/documentationTemplates.js.map +1 -0
- package/dist/generators/documentation/documentationTypes.d.ts +11 -0
- package/dist/generators/documentation/documentationTypes.d.ts.map +1 -0
- package/dist/generators/documentation/documentationTypes.js +22 -0
- package/dist/generators/documentation/documentationTypes.js.map +1 -0
- package/dist/generators/documentation/documentationUtils.d.ts +7 -0
- package/dist/generators/documentation/documentationUtils.d.ts.map +1 -0
- package/dist/generators/documentation/documentationUtils.js +28 -0
- package/dist/generators/documentation/documentationUtils.js.map +1 -0
- package/dist/generators/documentation/enhancedDocumentationGenerator.d.ts +21 -0
- package/dist/generators/documentation/enhancedDocumentationGenerator.d.ts.map +1 -0
- package/dist/generators/documentation/enhancedDocumentationGenerator.js +216 -0
- package/dist/generators/documentation/enhancedDocumentationGenerator.js.map +1 -0
- package/dist/generators/documentation/incrementalDocumentationGenerator.d.ts +33 -0
- package/dist/generators/documentation/incrementalDocumentationGenerator.d.ts.map +1 -0
- package/dist/generators/documentation/incrementalDocumentationGenerator.js +400 -0
- package/dist/generators/documentation/incrementalDocumentationGenerator.js.map +1 -0
- package/dist/generators/documentation/index.d.ts +8 -0
- package/dist/generators/documentation/index.d.ts.map +1 -0
- package/dist/generators/documentation/index.js +22 -0
- package/dist/generators/documentation/index.js.map +1 -0
- package/dist/generators/documentation/newDocumentationTemplates.d.ts +19 -0
- package/dist/generators/documentation/newDocumentationTemplates.d.ts.map +1 -0
- package/dist/generators/documentation/newDocumentationTemplates.js +307 -0
- package/dist/generators/documentation/newDocumentationTemplates.js.map +1 -0
- package/dist/generators/documentationGenerator.d.ts +3 -21
- package/dist/generators/documentationGenerator.d.ts.map +1 -1
- package/dist/generators/documentationGenerator.js +46 -597
- package/dist/generators/documentationGenerator.js.map +1 -1
- package/dist/generators/documentationTemplates.d.ts +16 -0
- package/dist/generators/documentationTemplates.d.ts.map +1 -0
- package/dist/generators/documentationTemplates.js +326 -0
- package/dist/generators/documentationTemplates.js.map +1 -0
- package/dist/generators/documentationUtils.d.ts +7 -0
- package/dist/generators/documentationUtils.d.ts.map +1 -0
- package/dist/generators/documentationUtils.js +38 -0
- package/dist/generators/documentationUtils.js.map +1 -0
- package/dist/generators/guidelines/agentIntegration.d.ts +43 -0
- package/dist/generators/guidelines/agentIntegration.d.ts.map +1 -0
- package/dist/generators/guidelines/agentIntegration.js +157 -0
- package/dist/generators/guidelines/agentIntegration.js.map +1 -0
- package/dist/generators/guidelines/guidelineTypes.d.ts +40 -0
- package/dist/generators/guidelines/guidelineTypes.d.ts.map +1 -0
- package/dist/generators/guidelines/guidelineTypes.js +144 -0
- package/dist/generators/guidelines/guidelineTypes.js.map +1 -0
- package/dist/generators/guidelines/guidelinesAnalyzer.d.ts +30 -0
- package/dist/generators/guidelines/guidelinesAnalyzer.d.ts.map +1 -0
- package/dist/generators/guidelines/guidelinesAnalyzer.js +263 -0
- package/dist/generators/guidelines/guidelinesAnalyzer.js.map +1 -0
- package/dist/generators/guidelines/guidelinesGenerator.d.ts +30 -0
- package/dist/generators/guidelines/guidelinesGenerator.d.ts.map +1 -0
- package/dist/generators/guidelines/guidelinesGenerator.js +249 -0
- package/dist/generators/guidelines/guidelinesGenerator.js.map +1 -0
- package/dist/generators/guidelines/guidelinesTemplates.d.ts +23 -0
- package/dist/generators/guidelines/guidelinesTemplates.d.ts.map +1 -0
- package/dist/generators/guidelines/guidelinesTemplates.js +304 -0
- package/dist/generators/guidelines/guidelinesTemplates.js.map +1 -0
- package/dist/generators/guidelines/index.d.ts +6 -0
- package/dist/generators/guidelines/index.d.ts.map +1 -0
- package/dist/generators/guidelines/index.js +16 -0
- package/dist/generators/guidelines/index.js.map +1 -0
- package/dist/generators/moduleGrouper.d.ts +14 -0
- package/dist/generators/moduleGrouper.d.ts.map +1 -0
- package/dist/generators/moduleGrouper.js +82 -0
- package/dist/generators/moduleGrouper.js.map +1 -0
- package/dist/generators/projectAnalyzer.d.ts +14 -0
- package/dist/generators/projectAnalyzer.d.ts.map +1 -0
- package/dist/generators/projectAnalyzer.js +217 -0
- package/dist/generators/projectAnalyzer.js.map +1 -0
- package/dist/generators/shared/contextGenerator.d.ts +12 -0
- package/dist/generators/shared/contextGenerator.d.ts.map +1 -0
- package/dist/generators/shared/contextGenerator.js +109 -0
- package/dist/generators/shared/contextGenerator.js.map +1 -0
- package/dist/generators/shared/generatorUtils.d.ts +16 -0
- package/dist/generators/shared/generatorUtils.d.ts.map +1 -0
- package/dist/generators/shared/generatorUtils.js +119 -0
- package/dist/generators/shared/generatorUtils.js.map +1 -0
- package/dist/generators/shared/index.d.ts +3 -0
- package/dist/generators/shared/index.d.ts.map +1 -0
- package/dist/generators/shared/index.js +8 -0
- package/dist/generators/shared/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +230 -13
- package/dist/index.js.map +1 -1
- package/dist/utils/interactiveMode.d.ts +6 -1
- package/dist/utils/interactiveMode.d.ts.map +1 -1
- package/dist/utils/interactiveMode.js +375 -70
- package/dist/utils/interactiveMode.js.map +1 -1
- package/dist/utils/tokenEstimator.d.ts +10 -9
- package/dist/utils/tokenEstimator.d.ts.map +1 -1
- package/dist/utils/tokenEstimator.js +45 -109
- package/dist/utils/tokenEstimator.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuidelinesAgentIntegration = void 0;
|
|
4
|
+
const agentGenerator_1 = require("../agents/agentGenerator");
|
|
5
|
+
/**
|
|
6
|
+
* Integration layer between Guidelines Generator and Agent System
|
|
7
|
+
*
|
|
8
|
+
* This class leverages the existing agent system to enhance guideline generation
|
|
9
|
+
* by using specialized agents (architect-specialist, documentation-writer) to
|
|
10
|
+
* provide expert context and validation for generated guidelines.
|
|
11
|
+
*/
|
|
12
|
+
class GuidelinesAgentIntegration {
|
|
13
|
+
constructor(fileMapper, llmClient) {
|
|
14
|
+
this.fileMapper = fileMapper;
|
|
15
|
+
this.llmClient = llmClient;
|
|
16
|
+
this.agentGenerator = new agentGenerator_1.AgentGenerator(fileMapper, llmClient);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Enhance guideline generation using architect-specialist agent context
|
|
20
|
+
*/
|
|
21
|
+
async enhanceWithArchitectAgent(repoStructure, moduleGroups, category) {
|
|
22
|
+
// The architect-specialist agent is perfect for:
|
|
23
|
+
// - architecture guidelines
|
|
24
|
+
// - performance guidelines
|
|
25
|
+
// - code-style guidelines
|
|
26
|
+
// - overall system design guidance
|
|
27
|
+
const architectContext = `Repository Analysis for ${category} Guidelines:
|
|
28
|
+
|
|
29
|
+
Project Structure:
|
|
30
|
+
${moduleGroups.map(m => `- ${m.name}: ${m.description} (${m.files.length} files)`).join('\n')}
|
|
31
|
+
|
|
32
|
+
Focus Area: ${category}
|
|
33
|
+
|
|
34
|
+
As an architect specialist, analyze this codebase and provide expert insights for creating ${category} guidelines that would be most valuable for this specific project structure and technology stack.
|
|
35
|
+
|
|
36
|
+
Consider:
|
|
37
|
+
1. Current architectural patterns evident in the codebase
|
|
38
|
+
2. Areas where ${category} guidelines would have the most impact
|
|
39
|
+
3. Technology-specific best practices for ${category}
|
|
40
|
+
4. Common pitfalls to avoid in this type of project
|
|
41
|
+
5. Specific recommendations for this codebase's current state
|
|
42
|
+
|
|
43
|
+
Provide architectural insights that should be incorporated into ${category} guidelines.`;
|
|
44
|
+
return architectContext;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Enhance guideline generation using documentation-writer agent context
|
|
48
|
+
*/
|
|
49
|
+
async enhanceWithDocumentationAgent(repoStructure, moduleGroups, category) {
|
|
50
|
+
// The documentation-writer agent is perfect for:
|
|
51
|
+
// - documentation guidelines
|
|
52
|
+
// - code-style guidelines (commenting, naming)
|
|
53
|
+
// - git-workflow guidelines (commit messages, PR descriptions)
|
|
54
|
+
// - general communication and knowledge sharing
|
|
55
|
+
const docContext = `Documentation Analysis for ${category} Guidelines:
|
|
56
|
+
|
|
57
|
+
Current Documentation State:
|
|
58
|
+
- Total Files: ${repoStructure.totalFiles}
|
|
59
|
+
- README files: ${repoStructure.files.filter(f => f.relativePath.toLowerCase().includes('readme')).length}
|
|
60
|
+
- Documentation directories: ${repoStructure.files.filter(f => f.relativePath.includes('docs') || f.relativePath.includes('doc')).length}
|
|
61
|
+
|
|
62
|
+
Focus Area: ${category}
|
|
63
|
+
|
|
64
|
+
As a documentation specialist, analyze how ${category} guidelines should be structured and presented to maximize their effectiveness for developers working on this codebase.
|
|
65
|
+
|
|
66
|
+
Consider:
|
|
67
|
+
1. How ${category} guidelines should be documented for best accessibility
|
|
68
|
+
2. What examples and templates would be most helpful
|
|
69
|
+
3. How to make guidelines actionable and measurable
|
|
70
|
+
4. Integration with existing documentation patterns
|
|
71
|
+
5. Onboarding and reference use cases
|
|
72
|
+
|
|
73
|
+
Provide documentation expertise for creating effective ${category} guidelines.`;
|
|
74
|
+
return docContext;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get agent-enhanced context for specific guideline categories
|
|
78
|
+
*/
|
|
79
|
+
async getEnhancedContext(category, repoStructure, moduleGroups) {
|
|
80
|
+
const categoryAgentMap = {
|
|
81
|
+
'testing': 'architect',
|
|
82
|
+
'frontend': 'architect',
|
|
83
|
+
'backend': 'architect',
|
|
84
|
+
'database': 'architect',
|
|
85
|
+
'security': 'architect',
|
|
86
|
+
'performance': 'architect',
|
|
87
|
+
'code-style': 'both',
|
|
88
|
+
'git-workflow': 'documentation',
|
|
89
|
+
'deployment': 'architect',
|
|
90
|
+
'monitoring': 'architect',
|
|
91
|
+
'documentation': 'documentation',
|
|
92
|
+
'architecture': 'architect'
|
|
93
|
+
};
|
|
94
|
+
const agentApproach = categoryAgentMap[category];
|
|
95
|
+
const result = { recommendedAgentApproach: agentApproach };
|
|
96
|
+
if (agentApproach === 'architect' || agentApproach === 'both') {
|
|
97
|
+
result.architectContext = await this.enhanceWithArchitectAgent(repoStructure, moduleGroups, category);
|
|
98
|
+
}
|
|
99
|
+
if (agentApproach === 'documentation' || agentApproach === 'both') {
|
|
100
|
+
result.documentationContext = await this.enhanceWithDocumentationAgent(repoStructure, moduleGroups, category);
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Generate agent prompts specifically for guideline validation and enhancement
|
|
106
|
+
*/
|
|
107
|
+
async generateGuidelineValidationPrompts(repoStructure, outputDir, verbose = false) {
|
|
108
|
+
// Generate specialized agent prompts for guideline creation and validation
|
|
109
|
+
await this.agentGenerator.generateAgentPrompts(repoStructure, outputDir, verbose);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Create guideline-specific agent prompt that combines multiple agent perspectives
|
|
113
|
+
*/
|
|
114
|
+
createCombinedAgentPrompt(category, architectContext, documentationContext) {
|
|
115
|
+
let prompt = `# Guidelines Creation Agent for ${category.toUpperCase()}
|
|
116
|
+
|
|
117
|
+
You are a specialized AI agent focused on creating comprehensive ${category} guidelines.
|
|
118
|
+
|
|
119
|
+
## Your Role
|
|
120
|
+
Combine the expertise of both architect and documentation specialists to create actionable, practical guidelines for ${category}.
|
|
121
|
+
|
|
122
|
+
`;
|
|
123
|
+
if (architectContext) {
|
|
124
|
+
prompt += `## Architectural Perspective
|
|
125
|
+
${architectContext}
|
|
126
|
+
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
if (documentationContext) {
|
|
130
|
+
prompt += `## Documentation Perspective
|
|
131
|
+
${documentationContext}
|
|
132
|
+
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
prompt += `## Your Task
|
|
136
|
+
Create detailed, actionable ${category} guidelines that:
|
|
137
|
+
|
|
138
|
+
1. **Are Specific**: Tailored to this exact codebase and technology stack
|
|
139
|
+
2. **Are Actionable**: Provide clear steps and decisions developers can follow
|
|
140
|
+
3. **Are Measurable**: Include ways to verify adherence to guidelines
|
|
141
|
+
4. **Are Practical**: Focus on real-world development scenarios
|
|
142
|
+
5. **Are Maintainable**: Can evolve with the project over time
|
|
143
|
+
|
|
144
|
+
## Guidelines Structure
|
|
145
|
+
For each guideline, provide:
|
|
146
|
+
- **Rule**: Clear, concise statement of what to do
|
|
147
|
+
- **Rationale**: Why this rule matters for this specific project
|
|
148
|
+
- **Examples**: Concrete examples using the project's technology stack
|
|
149
|
+
- **Tools**: Specific tools or automation to support the guideline
|
|
150
|
+
- **Validation**: How to check if the guideline is being followed
|
|
151
|
+
|
|
152
|
+
Focus on guidelines that will have the highest impact on code quality, team productivity, and project maintainability.`;
|
|
153
|
+
return prompt;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.GuidelinesAgentIntegration = GuidelinesAgentIntegration;
|
|
157
|
+
//# sourceMappingURL=agentIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentIntegration.js","sourceRoot":"","sources":["../../../src/generators/guidelines/agentIntegration.ts"],"names":[],"mappings":";;;AAEA,6DAA0D;AAK1D;;;;;;GAMG;AACH,MAAa,0BAA0B;IAGrC,YACU,UAAsB,EACtB,SAAwB;QADxB,eAAU,GAAV,UAAU,CAAY;QACtB,cAAS,GAAT,SAAS,CAAe;QAEhC,IAAI,CAAC,cAAc,GAAG,IAAI,+BAAc,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,yBAAyB,CAC7B,aAA4B,EAC5B,YAA2B,EAC3B,QAA2B;QAE3B,iDAAiD;QACjD,4BAA4B;QAC5B,2BAA2B;QAC3B,0BAA0B;QAC1B,mCAAmC;QAEn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QAED,IAAI,oBAAoB,EAAE,CAAC;YACzB,MAAM,IAAI;EACd,oBAAoB;;CAErB,CAAC;QACE,CAAC;QAED,MAAM,IAAI;8BACgB,QAAQ;;;;;;;;;;;;;;;;uHAgBiF,CAAC;QAEpH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3LD,gEA2LC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const GUIDELINE_CATEGORIES: readonly ["testing", "frontend", "backend", "database", "security", "performance", "code-style", "git-workflow", "deployment", "monitoring", "documentation", "architecture"];
|
|
2
|
+
export type GuidelineCategory = typeof GUIDELINE_CATEGORIES[number];
|
|
3
|
+
export declare const GUIDELINE_CATEGORIES_ARRAY: GuidelineCategory[];
|
|
4
|
+
export interface GuidelineConfig {
|
|
5
|
+
categories: GuidelineCategory[];
|
|
6
|
+
techStack: string[];
|
|
7
|
+
projectType: 'frontend' | 'backend' | 'fullstack' | 'library' | 'cli' | 'mobile';
|
|
8
|
+
complexity: 'simple' | 'moderate' | 'complex';
|
|
9
|
+
teamSize: 'solo' | 'small' | 'medium' | 'large';
|
|
10
|
+
includeExamples: boolean;
|
|
11
|
+
includeTools: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface DetectedTechnology {
|
|
14
|
+
name: string;
|
|
15
|
+
category: 'framework' | 'library' | 'database' | 'tool' | 'language';
|
|
16
|
+
confidence: number;
|
|
17
|
+
files: string[];
|
|
18
|
+
patterns: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface GuidelineRule {
|
|
21
|
+
rule: string;
|
|
22
|
+
rationale: string;
|
|
23
|
+
examples?: string[];
|
|
24
|
+
antiPatterns?: string[];
|
|
25
|
+
tools?: string[];
|
|
26
|
+
severity: 'must' | 'should' | 'could';
|
|
27
|
+
}
|
|
28
|
+
export interface GuidelineSection {
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
rules: GuidelineRule[];
|
|
32
|
+
relatedCategories?: GuidelineCategory[];
|
|
33
|
+
}
|
|
34
|
+
export declare const TECHNOLOGY_PATTERNS: Record<string, {
|
|
35
|
+
files: string[];
|
|
36
|
+
dependencies?: string[];
|
|
37
|
+
patterns?: string[];
|
|
38
|
+
category: DetectedTechnology['category'];
|
|
39
|
+
}>;
|
|
40
|
+
//# sourceMappingURL=guidelineTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidelineTypes.d.ts","sourceRoot":"","sources":["../../../src/generators/guidelines/guidelineTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,+KAavB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,0BAA0B,EAAE,iBAAiB,EAA8B,CAAC;AAEzF,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;IACjF,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAC9C,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAChD,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE;IAC/C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAkIA,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TECHNOLOGY_PATTERNS = exports.GUIDELINE_CATEGORIES_ARRAY = exports.GUIDELINE_CATEGORIES = void 0;
|
|
4
|
+
exports.GUIDELINE_CATEGORIES = [
|
|
5
|
+
'testing',
|
|
6
|
+
'frontend',
|
|
7
|
+
'backend',
|
|
8
|
+
'database',
|
|
9
|
+
'security',
|
|
10
|
+
'performance',
|
|
11
|
+
'code-style',
|
|
12
|
+
'git-workflow',
|
|
13
|
+
'deployment',
|
|
14
|
+
'monitoring',
|
|
15
|
+
'documentation',
|
|
16
|
+
'architecture'
|
|
17
|
+
];
|
|
18
|
+
exports.GUIDELINE_CATEGORIES_ARRAY = [...exports.GUIDELINE_CATEGORIES];
|
|
19
|
+
exports.TECHNOLOGY_PATTERNS = {
|
|
20
|
+
// Frontend Frameworks
|
|
21
|
+
'React': {
|
|
22
|
+
files: ['package.json', '*.jsx', '*.tsx'],
|
|
23
|
+
dependencies: ['react', '@types/react'],
|
|
24
|
+
patterns: ['useState', 'useEffect', 'Component'],
|
|
25
|
+
category: 'framework'
|
|
26
|
+
},
|
|
27
|
+
'Vue': {
|
|
28
|
+
files: ['package.json', '*.vue'],
|
|
29
|
+
dependencies: ['vue', '@vue/'],
|
|
30
|
+
patterns: ['<template>', '<script>', '<style>'],
|
|
31
|
+
category: 'framework'
|
|
32
|
+
},
|
|
33
|
+
'Angular': {
|
|
34
|
+
files: ['package.json', '*.component.ts', 'angular.json'],
|
|
35
|
+
dependencies: ['@angular/'],
|
|
36
|
+
patterns: ['@Component', '@Injectable', '@NgModule'],
|
|
37
|
+
category: 'framework'
|
|
38
|
+
},
|
|
39
|
+
'Next.js': {
|
|
40
|
+
files: ['package.json', 'next.config.js', 'pages/', 'app/'],
|
|
41
|
+
dependencies: ['next'],
|
|
42
|
+
patterns: ['getServerSideProps', 'getStaticProps'],
|
|
43
|
+
category: 'framework'
|
|
44
|
+
},
|
|
45
|
+
// Backend Frameworks
|
|
46
|
+
'Express': {
|
|
47
|
+
files: ['package.json', '*.js', '*.ts'],
|
|
48
|
+
dependencies: ['express', '@types/express'],
|
|
49
|
+
patterns: ['app.get', 'app.post', 'middleware'],
|
|
50
|
+
category: 'framework'
|
|
51
|
+
},
|
|
52
|
+
'Fastify': {
|
|
53
|
+
files: ['package.json'],
|
|
54
|
+
dependencies: ['fastify'],
|
|
55
|
+
patterns: ['fastify.register', 'fastify.get'],
|
|
56
|
+
category: 'framework'
|
|
57
|
+
},
|
|
58
|
+
'NestJS': {
|
|
59
|
+
files: ['package.json', '*.controller.ts', '*.service.ts'],
|
|
60
|
+
dependencies: ['@nestjs/'],
|
|
61
|
+
patterns: ['@Controller', '@Injectable', '@Module'],
|
|
62
|
+
category: 'framework'
|
|
63
|
+
},
|
|
64
|
+
// Databases
|
|
65
|
+
'MongoDB': {
|
|
66
|
+
files: ['package.json'],
|
|
67
|
+
dependencies: ['mongodb', 'mongoose'],
|
|
68
|
+
patterns: ['Schema', 'Model', 'connect'],
|
|
69
|
+
category: 'database'
|
|
70
|
+
},
|
|
71
|
+
'PostgreSQL': {
|
|
72
|
+
files: ['package.json', '*.sql'],
|
|
73
|
+
dependencies: ['pg', 'postgres', 'prisma'],
|
|
74
|
+
patterns: ['SELECT', 'INSERT', 'CREATE TABLE'],
|
|
75
|
+
category: 'database'
|
|
76
|
+
},
|
|
77
|
+
'Redis': {
|
|
78
|
+
files: ['package.json'],
|
|
79
|
+
dependencies: ['redis', 'ioredis'],
|
|
80
|
+
patterns: ['redis.get', 'redis.set'],
|
|
81
|
+
category: 'database'
|
|
82
|
+
},
|
|
83
|
+
// Testing Frameworks
|
|
84
|
+
'Jest': {
|
|
85
|
+
files: ['package.json', '*.test.js', '*.test.ts', 'jest.config.js'],
|
|
86
|
+
dependencies: ['jest', '@types/jest'],
|
|
87
|
+
patterns: ['describe', 'it', 'expect'],
|
|
88
|
+
category: 'tool'
|
|
89
|
+
},
|
|
90
|
+
'Cypress': {
|
|
91
|
+
files: ['package.json', 'cypress.config.js', 'cypress/'],
|
|
92
|
+
dependencies: ['cypress'],
|
|
93
|
+
patterns: ['cy.visit', 'cy.get', 'cy.click'],
|
|
94
|
+
category: 'tool'
|
|
95
|
+
},
|
|
96
|
+
'Vitest': {
|
|
97
|
+
files: ['package.json', 'vitest.config.ts'],
|
|
98
|
+
dependencies: ['vitest'],
|
|
99
|
+
patterns: ['describe', 'it', 'expect'],
|
|
100
|
+
category: 'tool'
|
|
101
|
+
},
|
|
102
|
+
// Build Tools
|
|
103
|
+
'Webpack': {
|
|
104
|
+
files: ['webpack.config.js', 'package.json'],
|
|
105
|
+
dependencies: ['webpack'],
|
|
106
|
+
patterns: ['module.exports', 'entry:', 'output:'],
|
|
107
|
+
category: 'tool'
|
|
108
|
+
},
|
|
109
|
+
'Vite': {
|
|
110
|
+
files: ['vite.config.ts', 'vite.config.js', 'package.json'],
|
|
111
|
+
dependencies: ['vite'],
|
|
112
|
+
patterns: ['defineConfig', 'plugins:', 'build:'],
|
|
113
|
+
category: 'tool'
|
|
114
|
+
},
|
|
115
|
+
// Languages
|
|
116
|
+
'TypeScript': {
|
|
117
|
+
files: ['tsconfig.json', '*.ts', '*.tsx'],
|
|
118
|
+
dependencies: ['typescript', '@types/'],
|
|
119
|
+
patterns: ['interface', 'type', 'enum'],
|
|
120
|
+
category: 'language'
|
|
121
|
+
},
|
|
122
|
+
'Python': {
|
|
123
|
+
files: ['*.py', 'requirements.txt', 'pyproject.toml'],
|
|
124
|
+
patterns: ['def ', 'class ', 'import '],
|
|
125
|
+
category: 'language'
|
|
126
|
+
},
|
|
127
|
+
'Go': {
|
|
128
|
+
files: ['*.go', 'go.mod'],
|
|
129
|
+
patterns: ['func ', 'package ', 'import ('],
|
|
130
|
+
category: 'language'
|
|
131
|
+
},
|
|
132
|
+
// DevOps/Deployment
|
|
133
|
+
'Docker': {
|
|
134
|
+
files: ['Dockerfile', 'docker-compose.yml', '.dockerignore'],
|
|
135
|
+
patterns: ['FROM ', 'RUN ', 'COPY '],
|
|
136
|
+
category: 'tool'
|
|
137
|
+
},
|
|
138
|
+
'Kubernetes': {
|
|
139
|
+
files: ['*.yaml', '*.yml'],
|
|
140
|
+
patterns: ['apiVersion:', 'kind:', 'metadata:'],
|
|
141
|
+
category: 'tool'
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=guidelineTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidelineTypes.js","sourceRoot":"","sources":["../../../src/generators/guidelines/guidelineTypes.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG;IAClC,SAAS;IACT,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,aAAa;IACb,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,cAAc;CACN,CAAC;AAIE,QAAA,0BAA0B,GAAwB,CAAC,GAAG,4B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Q,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC;QAC3C,QAAQ,EAAE,UAAU;KACrB;IAED,oBAAoB;IACpB,QAAQ,EAAE;QACR,KAAK,EAAE,CAAC,YAAY,EAAE,oBAAoB,EAAE,eAAe,CAAC;QAC5D,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;QACpC,QAAQ,EAAE,MAAM;KACjB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC1B,QAAQ,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,WAAW,CAAC;QAC/C,QAAQ,EAAE,MAAM;KACjB;CACF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RepoStructure } from '../../types';
|
|
2
|
+
import { FileMapper } from '../../utils/fileMapper';
|
|
3
|
+
import { GuidelineCategory, DetectedTechnology, GuidelineConfig } from './guidelineTypes';
|
|
4
|
+
export declare class GuidelinesAnalyzer {
|
|
5
|
+
private fileMapper;
|
|
6
|
+
constructor(fileMapper: FileMapper);
|
|
7
|
+
analyzeCodebase(repoStructure: RepoStructure): Promise<{
|
|
8
|
+
technologies: DetectedTechnology[];
|
|
9
|
+
projectType: GuidelineConfig['projectType'];
|
|
10
|
+
complexity: GuidelineConfig['complexity'];
|
|
11
|
+
recommendedCategories: GuidelineCategory[];
|
|
12
|
+
techStack: string[];
|
|
13
|
+
}>;
|
|
14
|
+
detectTechnologies(repoStructure: RepoStructure): Promise<DetectedTechnology[]>;
|
|
15
|
+
private detectTechnology;
|
|
16
|
+
private checkFilePatterns;
|
|
17
|
+
private checkDependencies;
|
|
18
|
+
private checkCodePatterns;
|
|
19
|
+
private matchesPattern;
|
|
20
|
+
private determineProjectType;
|
|
21
|
+
private assessComplexity;
|
|
22
|
+
private recommendCategories;
|
|
23
|
+
analyzeTestingPatterns(repoStructure: RepoStructure): Promise<{
|
|
24
|
+
testFrameworks: string[];
|
|
25
|
+
testPatterns: string[];
|
|
26
|
+
coverageTools: string[];
|
|
27
|
+
testTypes: string[];
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=guidelinesAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidelinesAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/generators/guidelines/guidelinesAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAY,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,kBAAkB;IACjB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEpC,eAAe,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC;QAC3D,YAAY,EAAE,kBAAkB,EAAE,CAAC;QACnC,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;QAC5C,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;QAC1C,qBAAqB,EAAE,iBAAiB,EAAE,CAAC;QAC3C,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IAgBI,kBAAkB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;YAavE,gBAAgB;IA2C9B,OAAO,CAAC,iBAAiB;YAcX,iBAAiB;YAiCjB,iBAAiB;IAuB/B,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,oBAAoB;IA8B5B,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,mBAAmB;IA4CrB,sBAAsB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC;QAClE,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CA2CH"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuidelinesAnalyzer = void 0;
|
|
4
|
+
const guidelineTypes_1 = require("./guidelineTypes");
|
|
5
|
+
class GuidelinesAnalyzer {
|
|
6
|
+
constructor(fileMapper) {
|
|
7
|
+
this.fileMapper = fileMapper;
|
|
8
|
+
}
|
|
9
|
+
async analyzeCodebase(repoStructure) {
|
|
10
|
+
const technologies = await this.detectTechnologies(repoStructure);
|
|
11
|
+
const projectType = this.determineProjectType(repoStructure, technologies);
|
|
12
|
+
const complexity = this.assessComplexity(repoStructure, technologies);
|
|
13
|
+
const recommendedCategories = this.recommendCategories(technologies, projectType);
|
|
14
|
+
const techStack = technologies.map(t => t.name);
|
|
15
|
+
return {
|
|
16
|
+
technologies,
|
|
17
|
+
projectType,
|
|
18
|
+
complexity,
|
|
19
|
+
recommendedCategories,
|
|
20
|
+
techStack
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async detectTechnologies(repoStructure) {
|
|
24
|
+
const detectedTech = [];
|
|
25
|
+
for (const [techName, pattern] of Object.entries(guidelineTypes_1.TECHNOLOGY_PATTERNS)) {
|
|
26
|
+
const detection = await this.detectTechnology(techName, pattern, repoStructure);
|
|
27
|
+
if (detection.confidence > 0.3) { // Only include if confidence > 30%
|
|
28
|
+
detectedTech.push(detection);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return detectedTech.sort((a, b) => b.confidence - a.confidence);
|
|
32
|
+
}
|
|
33
|
+
async detectTechnology(techName, pattern, repoStructure) {
|
|
34
|
+
let confidence = 0;
|
|
35
|
+
const matchingFiles = [];
|
|
36
|
+
const foundPatterns = [];
|
|
37
|
+
// Check file patterns
|
|
38
|
+
const fileMatches = this.checkFilePatterns(pattern.files, repoStructure.files);
|
|
39
|
+
if (fileMatches.length > 0) {
|
|
40
|
+
confidence += 0.4;
|
|
41
|
+
matchingFiles.push(...fileMatches);
|
|
42
|
+
}
|
|
43
|
+
// Check dependencies
|
|
44
|
+
if (pattern.dependencies) {
|
|
45
|
+
const depMatches = await this.checkDependencies(pattern.dependencies, repoStructure);
|
|
46
|
+
if (depMatches.length > 0) {
|
|
47
|
+
confidence += 0.5;
|
|
48
|
+
foundPatterns.push(...depMatches);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Check code patterns
|
|
52
|
+
if (pattern.patterns) {
|
|
53
|
+
const codeMatches = await this.checkCodePatterns(pattern.patterns, repoStructure, matchingFiles);
|
|
54
|
+
if (codeMatches.length > 0) {
|
|
55
|
+
confidence += 0.3;
|
|
56
|
+
foundPatterns.push(...codeMatches);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
name: techName,
|
|
61
|
+
category: pattern.category,
|
|
62
|
+
confidence: Math.min(confidence, 1.0),
|
|
63
|
+
files: matchingFiles,
|
|
64
|
+
patterns: foundPatterns
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
checkFilePatterns(patterns, files) {
|
|
68
|
+
const matches = [];
|
|
69
|
+
for (const pattern of patterns) {
|
|
70
|
+
for (const file of files) {
|
|
71
|
+
if (this.matchesPattern(file.relativePath, pattern)) {
|
|
72
|
+
matches.push(file.relativePath);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return [...new Set(matches)]; // Remove duplicates
|
|
77
|
+
}
|
|
78
|
+
async checkDependencies(dependencies, repoStructure) {
|
|
79
|
+
const packageJsonFiles = repoStructure.files.filter(f => f.relativePath.endsWith('package.json'));
|
|
80
|
+
const foundDeps = [];
|
|
81
|
+
for (const pkgFile of packageJsonFiles) {
|
|
82
|
+
try {
|
|
83
|
+
const content = await this.fileMapper.readFileContent(pkgFile.path);
|
|
84
|
+
const pkg = JSON.parse(content);
|
|
85
|
+
const allDeps = {
|
|
86
|
+
...pkg.dependencies,
|
|
87
|
+
...pkg.devDependencies,
|
|
88
|
+
...pkg.peerDependencies
|
|
89
|
+
};
|
|
90
|
+
for (const dep of dependencies) {
|
|
91
|
+
for (const depName of Object.keys(allDeps)) {
|
|
92
|
+
if (depName.includes(dep) || dep.includes(depName)) {
|
|
93
|
+
foundDeps.push(depName);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
// Skip invalid package.json files
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return [...new Set(foundDeps)];
|
|
103
|
+
}
|
|
104
|
+
async checkCodePatterns(patterns, repoStructure, relevantFiles) {
|
|
105
|
+
const foundPatterns = [];
|
|
106
|
+
const filesToCheck = relevantFiles.length > 0
|
|
107
|
+
? repoStructure.files.filter(f => relevantFiles.includes(f.relativePath))
|
|
108
|
+
: repoStructure.files.slice(0, 20); // Sample files if no relevant files specified
|
|
109
|
+
for (const file of filesToCheck) {
|
|
110
|
+
try {
|
|
111
|
+
const content = await this.fileMapper.readFileContent(file.path);
|
|
112
|
+
for (const pattern of patterns) {
|
|
113
|
+
if (content.includes(pattern)) {
|
|
114
|
+
foundPatterns.push(pattern);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
// Skip files that can't be read
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return [...new Set(foundPatterns)];
|
|
123
|
+
}
|
|
124
|
+
matchesPattern(filePath, pattern) {
|
|
125
|
+
// Convert glob-like patterns to regex
|
|
126
|
+
const regexPattern = pattern
|
|
127
|
+
.replace(/\./g, '\\.')
|
|
128
|
+
.replace(/\*/g, '.*')
|
|
129
|
+
.replace(/\?/g, '.');
|
|
130
|
+
const regex = new RegExp(regexPattern, 'i');
|
|
131
|
+
return regex.test(filePath) || filePath.includes(pattern.replace('*', ''));
|
|
132
|
+
}
|
|
133
|
+
determineProjectType(repoStructure, technologies) {
|
|
134
|
+
const hasBackend = technologies.some(t => ['Express', 'Fastify', 'NestJS'].includes(t.name) ||
|
|
135
|
+
t.category === 'database');
|
|
136
|
+
const hasFrontend = technologies.some(t => ['React', 'Vue', 'Angular', 'Next.js'].includes(t.name));
|
|
137
|
+
const hasCLI = repoStructure.files.some(f => f.relativePath.includes('bin/') ||
|
|
138
|
+
f.relativePath.includes('cli') ||
|
|
139
|
+
f.relativePath.includes('command'));
|
|
140
|
+
const hasLib = repoStructure.files.some(f => f.relativePath === 'index.ts' ||
|
|
141
|
+
f.relativePath === 'lib/index.ts');
|
|
142
|
+
if (hasCLI)
|
|
143
|
+
return 'cli';
|
|
144
|
+
if (hasLib && !hasFrontend && !hasBackend)
|
|
145
|
+
return 'library';
|
|
146
|
+
if (hasFrontend && hasBackend)
|
|
147
|
+
return 'fullstack';
|
|
148
|
+
if (hasFrontend)
|
|
149
|
+
return 'frontend';
|
|
150
|
+
if (hasBackend)
|
|
151
|
+
return 'backend';
|
|
152
|
+
return 'library'; // Default fallback
|
|
153
|
+
}
|
|
154
|
+
assessComplexity(repoStructure, technologies) {
|
|
155
|
+
const fileCount = repoStructure.totalFiles;
|
|
156
|
+
const techCount = technologies.length;
|
|
157
|
+
const hasMultipleFrameworks = technologies.filter(t => t.category === 'framework').length > 1;
|
|
158
|
+
const hasDatabase = technologies.some(t => t.category === 'database');
|
|
159
|
+
const hasDeployment = technologies.some(t => ['Docker', 'Kubernetes'].includes(t.name));
|
|
160
|
+
let complexityScore = 0;
|
|
161
|
+
// File count scoring
|
|
162
|
+
if (fileCount > 200)
|
|
163
|
+
complexityScore += 3;
|
|
164
|
+
else if (fileCount > 50)
|
|
165
|
+
complexityScore += 2;
|
|
166
|
+
else
|
|
167
|
+
complexityScore += 1;
|
|
168
|
+
// Technology diversity scoring
|
|
169
|
+
if (techCount > 10)
|
|
170
|
+
complexityScore += 3;
|
|
171
|
+
else if (techCount > 5)
|
|
172
|
+
complexityScore += 2;
|
|
173
|
+
else
|
|
174
|
+
complexityScore += 1;
|
|
175
|
+
// Architecture complexity
|
|
176
|
+
if (hasMultipleFrameworks)
|
|
177
|
+
complexityScore += 2;
|
|
178
|
+
if (hasDatabase)
|
|
179
|
+
complexityScore += 1;
|
|
180
|
+
if (hasDeployment)
|
|
181
|
+
complexityScore += 2;
|
|
182
|
+
if (complexityScore >= 8)
|
|
183
|
+
return 'complex';
|
|
184
|
+
if (complexityScore >= 5)
|
|
185
|
+
return 'moderate';
|
|
186
|
+
return 'simple';
|
|
187
|
+
}
|
|
188
|
+
recommendCategories(technologies, projectType) {
|
|
189
|
+
const categories = new Set();
|
|
190
|
+
// Always include these basic categories
|
|
191
|
+
categories.add('code-style');
|
|
192
|
+
categories.add('git-workflow');
|
|
193
|
+
categories.add('documentation');
|
|
194
|
+
// Add testing if testing framework detected
|
|
195
|
+
if (technologies.some(t => ['Jest', 'Cypress', 'Vitest'].includes(t.name))) {
|
|
196
|
+
categories.add('testing');
|
|
197
|
+
}
|
|
198
|
+
// Frontend-specific categories
|
|
199
|
+
if (projectType === 'frontend' || projectType === 'fullstack') {
|
|
200
|
+
categories.add('frontend');
|
|
201
|
+
categories.add('performance');
|
|
202
|
+
}
|
|
203
|
+
// Backend-specific categories
|
|
204
|
+
if (projectType === 'backend' || projectType === 'fullstack') {
|
|
205
|
+
categories.add('backend');
|
|
206
|
+
categories.add('security');
|
|
207
|
+
categories.add('monitoring');
|
|
208
|
+
}
|
|
209
|
+
// Database categories
|
|
210
|
+
if (technologies.some(t => t.category === 'database')) {
|
|
211
|
+
categories.add('database');
|
|
212
|
+
}
|
|
213
|
+
// Deployment categories
|
|
214
|
+
if (technologies.some(t => ['Docker', 'Kubernetes'].includes(t.name))) {
|
|
215
|
+
categories.add('deployment');
|
|
216
|
+
}
|
|
217
|
+
// Architecture for complex projects
|
|
218
|
+
if (technologies.length > 5 || projectType === 'fullstack') {
|
|
219
|
+
categories.add('architecture');
|
|
220
|
+
}
|
|
221
|
+
return Array.from(categories);
|
|
222
|
+
}
|
|
223
|
+
async analyzeTestingPatterns(repoStructure) {
|
|
224
|
+
const testFiles = repoStructure.files.filter(f => f.relativePath.includes('test') ||
|
|
225
|
+
f.relativePath.includes('spec') ||
|
|
226
|
+
f.relativePath.includes('__tests__'));
|
|
227
|
+
const testFrameworks = [];
|
|
228
|
+
const testPatterns = [];
|
|
229
|
+
const coverageTools = [];
|
|
230
|
+
const testTypes = [];
|
|
231
|
+
// Detect test frameworks
|
|
232
|
+
for (const file of testFiles.slice(0, 10)) {
|
|
233
|
+
try {
|
|
234
|
+
const content = await this.fileMapper.readFileContent(file.path);
|
|
235
|
+
if (content.includes('describe') && content.includes('it')) {
|
|
236
|
+
testFrameworks.push('Jest/Mocha-style');
|
|
237
|
+
}
|
|
238
|
+
if (content.includes('cy.')) {
|
|
239
|
+
testFrameworks.push('Cypress');
|
|
240
|
+
testTypes.push('E2E Testing');
|
|
241
|
+
}
|
|
242
|
+
if (content.includes('render(') && content.includes('screen.')) {
|
|
243
|
+
testFrameworks.push('React Testing Library');
|
|
244
|
+
testTypes.push('Component Testing');
|
|
245
|
+
}
|
|
246
|
+
if (content.includes('mount(') || content.includes('shallow(')) {
|
|
247
|
+
testFrameworks.push('Enzyme');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
// Skip files that can't be read
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
testFrameworks: [...new Set(testFrameworks)],
|
|
256
|
+
testPatterns: [...new Set(testPatterns)],
|
|
257
|
+
coverageTools: [...new Set(coverageTools)],
|
|
258
|
+
testTypes: [...new Set(testTypes)]
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.GuidelinesAnalyzer = GuidelinesAnalyzer;
|
|
263
|
+
//# sourceMappingURL=guidelinesAnalyzer.js.map
|