You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -76,66 +82,83 @@ data class ModelContextService(
76
82
/**
77
83
* Build a prompt for the model context based on the provided README file.
78
84
*
79
-
* @param readme List of code snippets from the repository to analyze
85
+
* @param codeSnippets List of code snippets from the repository to analyze
86
+
* @param readme Content of the README file
80
87
* @return A structured prompt for the model
81
88
*/
82
-
funbuildInsightsPrompt(readme:String) =
83
-
"""|You are an expert codebase analyst with deep expertise in software architecture, secure and scalable system design, and programming languages including Java, Kotlin, Python, Go, Scala, JavaScript, TypeScript, C++, Rust, Ruby, and others.
"""|You are analyzing a software codebase that includes a README file and source code files. Your task is to extract a structured summary of the codebase’s architecture, components, and relationships.
84
91
|
85
-
|You will be provided with the README file of a repository. Based on the README **alone**, provide a comprehensive analysis covering the following aspects:
92
+
|Use the information provided below.
86
93
|
87
-
|1. **Overall architecture** — inferred from descriptions, diagrams, setup steps, or configuration details.
88
-
|2. **Primary programming languages** — identify the main languages used and describe how they interact if applicable.
89
-
|3. **Key components and dependencies** — identify modules, services, tools, or third-party integrations and their relationships.
90
-
|4. **Design patterns** — mention any explicitly referenced or implicitly suggested architectural or code patterns.
91
-
|5. **Code quality signals** — identify any potential issues or areas of improvement (e.g., based on structure, naming, tooling).
92
-
|6. **Security considerations** — highlight any security best practices followed or missing (e.g., credential handling, auth mechanisms).
|8. **Language-specific practices** — note idiomatic usage or violations of best practices for the identified languages.
94
+
|----------------------
95
+
|README Content:
95
96
|
96
-
|If any of the above are not explicitly described, provide clearly labeled **inferences** based on available information.
97
+
|~~~markdown
98
+
|${readme.replace("```", "~~~")}
99
+
|~~~
97
100
|
98
-
|Format your response in markdown using clear sections. Include direct references to specific README content where relevant. If multiple languages are involved, explain any cross-language integration points.
101
+
|----------------------
102
+
|Code Snippets:
99
103
|
100
-
|README Content:
101
-
|~~~markdown
102
-
|${readme.replace("```","~~~")}
103
-
|~~~"""
104
+
|${codeSnippets.joinToString("\n\n")}
105
+
|----------------------
106
+
|
107
+
|For each file:
108
+
|- File name and language
109
+
|- Main classes, functions, or data structures
110
+
|- Purpose of the file (based on comments, function names, etc.)
111
+
|- Key public interfaces (functions, methods, classes)
112
+
|- If applicable, how this file connects to other parts of the codebase (e.g. imports, API usage, function calls)
113
+
|
114
+
|Use this format:
115
+
|
116
+
|### File: path/to/file.ext (Language: X)
117
+
|- **Purpose**: ...
118
+
|- **Key Components**:
119
+
| - ...
120
+
|- **Relationships**:
121
+
| - ...
122
+
|
123
+
|Repeat this for all files. Avoid speculation. Be concise and grounded in the content above.
124
+
|"""
104
125
.trimMargin()
105
126
106
127
/**
107
128
* Build a summary prompt for the model context based on the provided code structure and snippets.
108
129
*
109
-
* @param codeStructure Map representing the structure of the codebase
110
-
* @param codeSnippets List of code snippets from the repository
|Use the extracted structural analysis below to build the summary.
118
137
|
119
-
|**Code Snippets:**
120
-
|${codeSnippets.joinToString("\n\n")}
138
+
|----------------------
121
139
|
122
-
|Using this information, write a comprehensive and accessible summary of the codebase. Your goal is to help a technically proficient developer who is new to the project quickly understand its structure and purpose.
140
+
|Structural Analysis:
123
141
|
124
-
|Your summary must cover the following aspects:
142
+
|${parseInsights(insights)}
143
+
|----------------------
125
144
|
126
-
|1. **Main purpose** of the project
127
-
|2. **Core architecture and components**
128
-
|3. **Technologies and programming languages** used
129
-
|4. **Key functionality and workflows**
130
-
|5. **Potential areas for improvement or refactoring**
145
+
|You must include:
131
146
|
132
-
|Where helpful, include **brief illustrative code snippets** from the examples provided to clarify key concepts, architectural decisions, or coding patterns.
147
+
|1. **Main Purpose** – what the software does, who might use it.
148
+
|2. **Architecture Overview** – main components and how they interact.
149
+
|3. **Technologies and Languages** – what languages, frameworks, or tools are used.
150
+
|4. **Key Workflows** – example flow of data, processing, or control (e.g., "HTTP request -> router -> controller -> database").
151
+
|5. **Strengths and Weaknesses** – any observed complexity, tight coupling, lack of documentation, or reusable design patterns.
133
152
|
134
-
|Format your response using markdown with clear section headings and concise, informative language. Avoid speculation beyond the provided inputs unless clearly stated as inference.
135
-
|"""
153
+
|Where helpful, include:
154
+
|- Short code snippets or function/method names (language-agnostic).
155
+
|- Architecture patterns if detected (e.g., MVC, pub/sub, monolith, microservice).
156
+
|
157
+
|Format the output using Markdown. Be concise and insightful.
0 commit comments