@enokdev/springdocs-mcp 1.2.2 → 1.2.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.
- package/README.md +275 -243
- package/build/index.js +202 -57
- package/build/index.js.map +1 -1
- package/build/services/advanced-features.d.ts +39 -0
- package/build/services/advanced-features.d.ts.map +1 -0
- package/build/services/advanced-features.js +574 -0
- package/build/services/advanced-features.js.map +1 -0
- package/build/services/cache.d.ts +36 -0
- package/build/services/cache.d.ts.map +1 -0
- package/build/services/cache.js +68 -0
- package/build/services/cache.js.map +1 -0
- package/build/services/springboot-docs-optimized.d.ts +55 -0
- package/build/services/springboot-docs-optimized.d.ts.map +1 -0
- package/build/services/springboot-docs-optimized.js +593 -0
- package/build/services/springboot-docs-optimized.js.map +1 -0
- package/build/services/springboot-docs.js +1 -1
- package/build/tools/index.d.ts +262 -0
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +115 -0
- package/build/tools/index.js.map +1 -1
- package/package.json +17 -6
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import { CacheService } from './cache.js';
|
|
2
|
+
/**
|
|
3
|
+
* Advanced features service for Spring documentation
|
|
4
|
+
*/
|
|
5
|
+
export class AdvancedFeaturesService {
|
|
6
|
+
cache;
|
|
7
|
+
constructor() {
|
|
8
|
+
this.cache = new CacheService();
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Search across the entire Spring ecosystem
|
|
12
|
+
*/
|
|
13
|
+
async searchEcosystem(query, scope = 'all', limit = 5) {
|
|
14
|
+
const cacheKey = `ecosystem:${query}:${scope}:${limit}`;
|
|
15
|
+
const cached = this.cache.get(cacheKey);
|
|
16
|
+
if (cached)
|
|
17
|
+
return cached;
|
|
18
|
+
const results = {
|
|
19
|
+
query,
|
|
20
|
+
scope,
|
|
21
|
+
totalResults: 0,
|
|
22
|
+
categories: {}
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
if (scope === 'all' || scope === 'projects') {
|
|
26
|
+
results.categories.projects = await this.searchProjects(query, limit);
|
|
27
|
+
}
|
|
28
|
+
if (scope === 'all' || scope === 'guides') {
|
|
29
|
+
results.categories.guides = await this.searchGuides(query, limit);
|
|
30
|
+
}
|
|
31
|
+
if (scope === 'all' || scope === 'docs') {
|
|
32
|
+
results.categories.documentation = await this.searchDocumentation(query, limit);
|
|
33
|
+
}
|
|
34
|
+
if (scope === 'all' || scope === 'api') {
|
|
35
|
+
results.categories.api = await this.searchAPI(query, limit);
|
|
36
|
+
}
|
|
37
|
+
results.totalResults = Object.values(results.categories)
|
|
38
|
+
.reduce((total, category) => total + (category?.length || 0), 0);
|
|
39
|
+
this.cache.set(cacheKey, results);
|
|
40
|
+
return results;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('Error in ecosystem search:', error);
|
|
44
|
+
throw new Error('Failed to search Spring ecosystem');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get step-by-step tutorials
|
|
49
|
+
*/
|
|
50
|
+
async getTutorial(topic, level = 'beginner') {
|
|
51
|
+
const cacheKey = `tutorial:${topic}:${level}`;
|
|
52
|
+
const cached = this.cache.get(cacheKey);
|
|
53
|
+
if (cached)
|
|
54
|
+
return cached;
|
|
55
|
+
const tutorials = this.getTutorialDatabase();
|
|
56
|
+
const tutorial = tutorials[topic]?.[level];
|
|
57
|
+
if (!tutorial) {
|
|
58
|
+
const availableTopics = Object.keys(tutorials).join(', ');
|
|
59
|
+
return `# Tutorial Not Found
|
|
60
|
+
|
|
61
|
+
The tutorial for "${topic}" at "${level}" level is not available.
|
|
62
|
+
|
|
63
|
+
## Available Topics:
|
|
64
|
+
${availableTopics}
|
|
65
|
+
|
|
66
|
+
## Available Levels:
|
|
67
|
+
- beginner
|
|
68
|
+
- intermediate
|
|
69
|
+
- advanced
|
|
70
|
+
|
|
71
|
+
Please use one of the available topics and levels.`;
|
|
72
|
+
}
|
|
73
|
+
this.cache.setLongTerm(cacheKey, tutorial);
|
|
74
|
+
return tutorial;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Compare Spring Boot versions
|
|
78
|
+
*/
|
|
79
|
+
async compareVersions(version1, version2, focus = 'all') {
|
|
80
|
+
const cacheKey = `compare:${version1}:${version2}:${focus}`;
|
|
81
|
+
const cached = this.cache.get(cacheKey);
|
|
82
|
+
if (cached)
|
|
83
|
+
return cached;
|
|
84
|
+
try {
|
|
85
|
+
const comparison = await this.generateVersionComparison(version1, version2, focus);
|
|
86
|
+
this.cache.setLongTerm(cacheKey, comparison);
|
|
87
|
+
return comparison;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error('Error comparing versions:', error);
|
|
91
|
+
throw new Error(`Failed to compare Spring Boot versions ${version1} and ${version2}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get best practices
|
|
96
|
+
*/
|
|
97
|
+
async getBestPractices(category, experienceLevel = 'intermediate') {
|
|
98
|
+
const cacheKey = `practices:${category}:${experienceLevel}`;
|
|
99
|
+
const cached = this.cache.get(cacheKey);
|
|
100
|
+
if (cached)
|
|
101
|
+
return cached;
|
|
102
|
+
const practices = this.getBestPracticesDatabase();
|
|
103
|
+
const categoryPractices = practices[category];
|
|
104
|
+
if (!categoryPractices) {
|
|
105
|
+
const availableCategories = Object.keys(practices).join(', ');
|
|
106
|
+
return `# Best Practices Not Found
|
|
107
|
+
|
|
108
|
+
Best practices for "${category}" category are not available.
|
|
109
|
+
|
|
110
|
+
## Available Categories:
|
|
111
|
+
${availableCategories}
|
|
112
|
+
|
|
113
|
+
Please use one of the available categories.`;
|
|
114
|
+
}
|
|
115
|
+
const result = this.formatBestPractices(categoryPractices, category, experienceLevel);
|
|
116
|
+
this.cache.setLongTerm(cacheKey, result);
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Diagnose Spring issues
|
|
121
|
+
*/
|
|
122
|
+
async diagnoseIssues(errorMessage, component, stackTrace) {
|
|
123
|
+
const cacheKey = `diagnose:${this.hashString(errorMessage)}:${component || 'general'}`;
|
|
124
|
+
const cached = this.cache.get(cacheKey);
|
|
125
|
+
if (cached)
|
|
126
|
+
return cached;
|
|
127
|
+
const diagnosis = this.performIssueDiagnosis(errorMessage, component, stackTrace);
|
|
128
|
+
this.cache.set(cacheKey, diagnosis, 60 * 60 * 1000); // 1 hour cache
|
|
129
|
+
return diagnosis;
|
|
130
|
+
}
|
|
131
|
+
// Private helper methods
|
|
132
|
+
async searchProjects(query, limit) {
|
|
133
|
+
// Simplified project search - in real implementation, this would fetch from Spring.io
|
|
134
|
+
const mockProjects = [
|
|
135
|
+
{ name: 'Spring Boot', description: 'Create stand-alone, production-grade Spring applications', url: 'https://spring.io/projects/spring-boot' },
|
|
136
|
+
{ name: 'Spring Security', description: 'Powerful and highly customizable security framework', url: 'https://spring.io/projects/spring-security' },
|
|
137
|
+
{ name: 'Spring Data', description: 'Consistent programming model for data access', url: 'https://spring.io/projects/spring-data' },
|
|
138
|
+
];
|
|
139
|
+
return mockProjects
|
|
140
|
+
.filter(p => p.name.toLowerCase().includes(query.toLowerCase()) ||
|
|
141
|
+
p.description.toLowerCase().includes(query.toLowerCase()))
|
|
142
|
+
.slice(0, limit);
|
|
143
|
+
}
|
|
144
|
+
async searchGuides(query, limit) {
|
|
145
|
+
const mockGuides = [
|
|
146
|
+
{ title: 'Building a RESTful Web Service', url: 'https://spring.io/guides/gs/rest-service/', type: 'Getting Started' },
|
|
147
|
+
{ title: 'Accessing Data with JPA', url: 'https://spring.io/guides/gs/accessing-data-jpa/', type: 'Getting Started' },
|
|
148
|
+
{ title: 'Securing a Web Application', url: 'https://spring.io/guides/gs/securing-web/', type: 'Getting Started' },
|
|
149
|
+
];
|
|
150
|
+
return mockGuides
|
|
151
|
+
.filter(g => g.title.toLowerCase().includes(query.toLowerCase()))
|
|
152
|
+
.slice(0, limit);
|
|
153
|
+
}
|
|
154
|
+
async searchDocumentation(query, limit) {
|
|
155
|
+
const mockDocs = [
|
|
156
|
+
{ title: 'Spring Boot Reference Documentation', url: 'https://docs.spring.io/spring-boot/docs/current/reference/', type: 'Reference' },
|
|
157
|
+
{ title: 'Spring Framework Documentation', url: 'https://docs.spring.io/spring-framework/docs/current/reference/', type: 'Reference' },
|
|
158
|
+
];
|
|
159
|
+
return mockDocs
|
|
160
|
+
.filter(d => d.title.toLowerCase().includes(query.toLowerCase()))
|
|
161
|
+
.slice(0, limit);
|
|
162
|
+
}
|
|
163
|
+
async searchAPI(query, limit) {
|
|
164
|
+
const mockAPI = [
|
|
165
|
+
{ title: 'Spring Boot API Documentation', url: 'https://docs.spring.io/spring-boot/docs/current/api/', type: 'API' },
|
|
166
|
+
{ title: 'Spring Framework API', url: 'https://docs.spring.io/spring-framework/docs/current/javadoc-api/', type: 'API' },
|
|
167
|
+
];
|
|
168
|
+
return mockAPI
|
|
169
|
+
.filter(a => a.title.toLowerCase().includes(query.toLowerCase()))
|
|
170
|
+
.slice(0, limit);
|
|
171
|
+
}
|
|
172
|
+
getTutorialDatabase() {
|
|
173
|
+
return {
|
|
174
|
+
'rest-api': {
|
|
175
|
+
beginner: `# Building Your First REST API with Spring Boot
|
|
176
|
+
|
|
177
|
+
## Prerequisites
|
|
178
|
+
- Java 11 or higher
|
|
179
|
+
- Basic understanding of Java
|
|
180
|
+
- Maven or Gradle
|
|
181
|
+
|
|
182
|
+
## Step 1: Create a New Spring Boot Project
|
|
183
|
+
\`\`\`bash
|
|
184
|
+
curl https://start.spring.io/starter.zip \\
|
|
185
|
+
-d dependencies=web \\
|
|
186
|
+
-d name=my-rest-api \\
|
|
187
|
+
-d packageName=com.example.api \\
|
|
188
|
+
-o my-rest-api.zip
|
|
189
|
+
\`\`\`
|
|
190
|
+
|
|
191
|
+
## Step 2: Create a Simple Controller
|
|
192
|
+
\`\`\`java
|
|
193
|
+
@RestController
|
|
194
|
+
@RequestMapping("/api")
|
|
195
|
+
public class HelloController {
|
|
196
|
+
|
|
197
|
+
@GetMapping("/hello")
|
|
198
|
+
public String hello() {
|
|
199
|
+
return "Hello, World!";
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@GetMapping("/hello/{name}")
|
|
203
|
+
public String helloName(@PathVariable String name) {
|
|
204
|
+
return "Hello, " + name + "!";
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
## Step 3: Run the Application
|
|
210
|
+
\`\`\`bash
|
|
211
|
+
./mvnw spring-boot:run
|
|
212
|
+
\`\`\`
|
|
213
|
+
|
|
214
|
+
## Step 4: Test Your API
|
|
215
|
+
\`\`\`bash
|
|
216
|
+
curl http://localhost:8080/api/hello
|
|
217
|
+
curl http://localhost:8080/api/hello/John
|
|
218
|
+
\`\`\`
|
|
219
|
+
|
|
220
|
+
## Next Steps
|
|
221
|
+
- Add request/response DTOs
|
|
222
|
+
- Implement POST, PUT, DELETE methods
|
|
223
|
+
- Add input validation
|
|
224
|
+
- Handle exceptions properly`,
|
|
225
|
+
intermediate: `# Advanced REST API Development with Spring Boot
|
|
226
|
+
|
|
227
|
+
## Data Transfer Objects (DTOs)
|
|
228
|
+
\`\`\`java
|
|
229
|
+
public class UserDto {
|
|
230
|
+
@NotBlank
|
|
231
|
+
private String name;
|
|
232
|
+
|
|
233
|
+
@Email
|
|
234
|
+
private String email;
|
|
235
|
+
|
|
236
|
+
// getters and setters
|
|
237
|
+
}
|
|
238
|
+
\`\`\`
|
|
239
|
+
|
|
240
|
+
## Service Layer
|
|
241
|
+
\`\`\`java
|
|
242
|
+
@Service
|
|
243
|
+
public class UserService {
|
|
244
|
+
|
|
245
|
+
@Autowired
|
|
246
|
+
private UserRepository userRepository;
|
|
247
|
+
|
|
248
|
+
public UserDto createUser(UserDto userDto) {
|
|
249
|
+
User user = mapToEntity(userDto);
|
|
250
|
+
User savedUser = userRepository.save(user);
|
|
251
|
+
return mapToDto(savedUser);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
\`\`\`
|
|
255
|
+
|
|
256
|
+
## Exception Handling
|
|
257
|
+
\`\`\`java
|
|
258
|
+
@ControllerAdvice
|
|
259
|
+
public class GlobalExceptionHandler {
|
|
260
|
+
|
|
261
|
+
@ExceptionHandler(ValidationException.class)
|
|
262
|
+
public ResponseEntity<ErrorResponse> handleValidation(ValidationException ex) {
|
|
263
|
+
return ResponseEntity.badRequest()
|
|
264
|
+
.body(new ErrorResponse("Validation failed", ex.getMessage()));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
\`\`\`
|
|
268
|
+
|
|
269
|
+
## Testing
|
|
270
|
+
\`\`\`java
|
|
271
|
+
@SpringBootTest
|
|
272
|
+
@AutoConfigureTestDatabase
|
|
273
|
+
class UserControllerTest {
|
|
274
|
+
|
|
275
|
+
@Autowired
|
|
276
|
+
private TestRestTemplate restTemplate;
|
|
277
|
+
|
|
278
|
+
@Test
|
|
279
|
+
void shouldCreateUser() {
|
|
280
|
+
UserDto user = new UserDto("John", "john@example.com");
|
|
281
|
+
ResponseEntity<UserDto> response = restTemplate.postForEntity(
|
|
282
|
+
"/api/users", user, UserDto.class);
|
|
283
|
+
|
|
284
|
+
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
\`\`\``,
|
|
288
|
+
advanced: `# Production-Ready REST API with Spring Boot
|
|
289
|
+
|
|
290
|
+
## Advanced Features Implementation
|
|
291
|
+
|
|
292
|
+
### 1. API Versioning
|
|
293
|
+
\`\`\`java
|
|
294
|
+
@RestController
|
|
295
|
+
@RequestMapping("/api/v1/users")
|
|
296
|
+
public class UserControllerV1 {
|
|
297
|
+
// Version 1 implementation
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
@RestController
|
|
301
|
+
@RequestMapping("/api/v2/users")
|
|
302
|
+
public class UserControllerV2 {
|
|
303
|
+
// Version 2 with breaking changes
|
|
304
|
+
}
|
|
305
|
+
\`\`\`
|
|
306
|
+
|
|
307
|
+
### 2. HATEOAS Implementation
|
|
308
|
+
\`\`\`java
|
|
309
|
+
@GetMapping("/{id}")
|
|
310
|
+
public EntityModel<UserDto> getUser(@PathVariable Long id) {
|
|
311
|
+
UserDto user = userService.findById(id);
|
|
312
|
+
return EntityModel.of(user)
|
|
313
|
+
.add(linkTo(methodOn(UserController.class).getUser(id)).withSelfRel())
|
|
314
|
+
.add(linkTo(UserController.class).withRel("users"));
|
|
315
|
+
}
|
|
316
|
+
\`\`\`
|
|
317
|
+
|
|
318
|
+
### 3. Advanced Security
|
|
319
|
+
\`\`\`java
|
|
320
|
+
@Configuration
|
|
321
|
+
@EnableWebSecurity
|
|
322
|
+
public class SecurityConfig {
|
|
323
|
+
|
|
324
|
+
@Bean
|
|
325
|
+
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
326
|
+
http.oauth2ResourceServer(oauth2 -> oauth2.jwt(withDefaults()))
|
|
327
|
+
.authorizeHttpRequests(authz -> authz
|
|
328
|
+
.requestMatchers("/api/public/**").permitAll()
|
|
329
|
+
.requestMatchers(HttpMethod.GET, "/api/users").hasRole("USER")
|
|
330
|
+
.requestMatchers("/api/admin/**").hasRole("ADMIN")
|
|
331
|
+
.anyRequest().authenticated()
|
|
332
|
+
);
|
|
333
|
+
return http.build();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
\`\`\`
|
|
337
|
+
|
|
338
|
+
### 4. Metrics and Monitoring
|
|
339
|
+
\`\`\`java
|
|
340
|
+
@Component
|
|
341
|
+
public class ApiMetrics {
|
|
342
|
+
|
|
343
|
+
private final MeterRegistry meterRegistry;
|
|
344
|
+
private final Counter apiCallCounter;
|
|
345
|
+
|
|
346
|
+
public ApiMetrics(MeterRegistry meterRegistry) {
|
|
347
|
+
this.meterRegistry = meterRegistry;
|
|
348
|
+
this.apiCallCounter = Counter.builder("api.calls")
|
|
349
|
+
.description("Number of API calls")
|
|
350
|
+
.register(meterRegistry);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
\`\`\`
|
|
354
|
+
|
|
355
|
+
### 5. Rate Limiting
|
|
356
|
+
\`\`\`java
|
|
357
|
+
@Component
|
|
358
|
+
public class RateLimitingFilter implements Filter {
|
|
359
|
+
|
|
360
|
+
private final RedisTemplate<String, String> redisTemplate;
|
|
361
|
+
|
|
362
|
+
@Override
|
|
363
|
+
public void doFilter(ServletRequest request, ServletResponse response,
|
|
364
|
+
FilterChain chain) throws IOException, ServletException {
|
|
365
|
+
|
|
366
|
+
String clientId = getClientId(request);
|
|
367
|
+
if (isRateLimited(clientId)) {
|
|
368
|
+
((HttpServletResponse) response).setStatus(429);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
chain.doFilter(request, response);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
\`\`\``
|
|
376
|
+
},
|
|
377
|
+
// Add more tutorials for other topics
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
async generateVersionComparison(version1, version2, focus) {
|
|
381
|
+
// This would fetch actual version data in a real implementation
|
|
382
|
+
return `# Spring Boot Version Comparison: ${version1} vs ${version2}
|
|
383
|
+
|
|
384
|
+
## Overview
|
|
385
|
+
Comparing Spring Boot ${version1} with ${version2}
|
|
386
|
+
|
|
387
|
+
## Major Changes
|
|
388
|
+
${focus === 'all' || focus === 'breaking-changes' ? `
|
|
389
|
+
### Breaking Changes
|
|
390
|
+
- Java version requirements updated
|
|
391
|
+
- Configuration property changes
|
|
392
|
+
- Deprecated APIs removed
|
|
393
|
+
` : ''}
|
|
394
|
+
|
|
395
|
+
${focus === 'all' || focus === 'new-features' ? `
|
|
396
|
+
### New Features
|
|
397
|
+
- Enhanced auto-configuration
|
|
398
|
+
- New starters available
|
|
399
|
+
- Improved monitoring capabilities
|
|
400
|
+
` : ''}
|
|
401
|
+
|
|
402
|
+
${focus === 'all' || focus === 'deprecations' ? `
|
|
403
|
+
### Deprecations
|
|
404
|
+
- Legacy configuration support
|
|
405
|
+
- Outdated dependencies
|
|
406
|
+
- Old API patterns
|
|
407
|
+
` : ''}
|
|
408
|
+
|
|
409
|
+
## Migration Guide
|
|
410
|
+
1. Update Java version if required
|
|
411
|
+
2. Update dependency versions
|
|
412
|
+
3. Review configuration changes
|
|
413
|
+
4. Test thoroughly
|
|
414
|
+
|
|
415
|
+
## Recommendation
|
|
416
|
+
${this.getUpgradeRecommendation(version1, version2)}`;
|
|
417
|
+
}
|
|
418
|
+
getBestPracticesDatabase() {
|
|
419
|
+
return {
|
|
420
|
+
architecture: {
|
|
421
|
+
title: 'Spring Boot Architecture Best Practices',
|
|
422
|
+
practices: [
|
|
423
|
+
{
|
|
424
|
+
title: 'Layer Separation',
|
|
425
|
+
description: 'Maintain clear separation between presentation, business, and data layers',
|
|
426
|
+
examples: ['Controller → Service → Repository pattern', 'Use DTOs for data transfer'],
|
|
427
|
+
level: ['beginner', 'intermediate', 'expert']
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
title: 'Dependency Injection',
|
|
431
|
+
description: 'Use constructor injection and avoid field injection',
|
|
432
|
+
examples: ['@Autowired on constructors', 'Final fields for dependencies'],
|
|
433
|
+
level: ['intermediate', 'expert']
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
},
|
|
437
|
+
performance: {
|
|
438
|
+
title: 'Performance Optimization',
|
|
439
|
+
practices: [
|
|
440
|
+
{
|
|
441
|
+
title: 'Lazy Loading',
|
|
442
|
+
description: 'Use lazy loading for JPA relationships',
|
|
443
|
+
examples: ['@OneToMany(fetch = FetchType.LAZY)', 'Use @EntityGraph for specific queries'],
|
|
444
|
+
level: ['intermediate', 'expert']
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
title: 'Connection Pooling',
|
|
448
|
+
description: 'Configure proper database connection pooling',
|
|
449
|
+
examples: ['HikariCP configuration', 'Monitor connection usage'],
|
|
450
|
+
level: ['expert']
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
// Add more categories...
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
formatBestPractices(practices, category, level) {
|
|
458
|
+
const filtered = practices.practices.filter((p) => p.level.includes(level));
|
|
459
|
+
let result = `# ${practices.title}\n\n`;
|
|
460
|
+
result += `**Experience Level:** ${level}\n\n`;
|
|
461
|
+
filtered.forEach((practice, index) => {
|
|
462
|
+
result += `## ${index + 1}. ${practice.title}\n\n`;
|
|
463
|
+
result += `${practice.description}\n\n`;
|
|
464
|
+
result += `**Examples:**\n`;
|
|
465
|
+
practice.examples.forEach((example) => {
|
|
466
|
+
result += `- ${example}\n`;
|
|
467
|
+
});
|
|
468
|
+
result += '\n';
|
|
469
|
+
});
|
|
470
|
+
return result;
|
|
471
|
+
}
|
|
472
|
+
performIssueDiagnosis(errorMessage, component, stackTrace) {
|
|
473
|
+
const commonIssues = {
|
|
474
|
+
'Port 8080 was already in use': {
|
|
475
|
+
cause: 'Another application is using the default Spring Boot port',
|
|
476
|
+
solutions: [
|
|
477
|
+
'Change port in application.properties: server.port=8081',
|
|
478
|
+
'Kill the process using port 8080',
|
|
479
|
+
'Use a different port for your application'
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
'Failed to configure a DataSource': {
|
|
483
|
+
cause: 'Database configuration is missing or incorrect',
|
|
484
|
+
solutions: [
|
|
485
|
+
'Add database dependency to pom.xml/build.gradle',
|
|
486
|
+
'Configure datasource properties in application.properties',
|
|
487
|
+
'Use @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) if no database needed'
|
|
488
|
+
]
|
|
489
|
+
},
|
|
490
|
+
'NoSuchBeanDefinitionException': {
|
|
491
|
+
cause: 'Required bean is not found in the application context',
|
|
492
|
+
solutions: [
|
|
493
|
+
'Check if the class is annotated with @Component, @Service, @Repository, or @Controller',
|
|
494
|
+
'Ensure the class is in a package scanned by @ComponentScan',
|
|
495
|
+
'Verify @Autowired dependencies are correctly configured'
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
for (const [pattern, issue] of Object.entries(commonIssues)) {
|
|
500
|
+
if (errorMessage.includes(pattern)) {
|
|
501
|
+
return `# Spring Boot Issue Diagnosis
|
|
502
|
+
|
|
503
|
+
## Error Analysis
|
|
504
|
+
**Error:** ${errorMessage}
|
|
505
|
+
${component ? `**Component:** ${component}` : ''}
|
|
506
|
+
|
|
507
|
+
## Root Cause
|
|
508
|
+
${issue.cause}
|
|
509
|
+
|
|
510
|
+
## Recommended Solutions
|
|
511
|
+
${issue.solutions.map((solution, index) => `${index + 1}. ${solution}`).join('\n')}
|
|
512
|
+
|
|
513
|
+
${stackTrace ? `
|
|
514
|
+
## Stack Trace Analysis
|
|
515
|
+
The provided stack trace shows:
|
|
516
|
+
\`\`\`
|
|
517
|
+
${stackTrace.substring(0, 500)}${stackTrace.length > 500 ? '...' : ''}
|
|
518
|
+
\`\`\`
|
|
519
|
+
` : ''}
|
|
520
|
+
|
|
521
|
+
## Additional Resources
|
|
522
|
+
- [Spring Boot Documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/)
|
|
523
|
+
- [Common Application Properties](https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html)`;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return `# Spring Boot Issue Diagnosis
|
|
527
|
+
|
|
528
|
+
## Error Analysis
|
|
529
|
+
**Error:** ${errorMessage}
|
|
530
|
+
${component ? `**Component:** ${component}` : ''}
|
|
531
|
+
|
|
532
|
+
## Diagnosis
|
|
533
|
+
This appears to be a custom or less common error. Here are general troubleshooting steps:
|
|
534
|
+
|
|
535
|
+
1. **Check Logs:** Review the full stack trace for more context
|
|
536
|
+
2. **Verify Configuration:** Ensure all properties are correctly set
|
|
537
|
+
3. **Dependencies:** Check if all required dependencies are included
|
|
538
|
+
4. **Version Compatibility:** Verify Spring Boot and dependency versions are compatible
|
|
539
|
+
|
|
540
|
+
## Recommended Actions
|
|
541
|
+
1. Enable debug logging: \`logging.level.org.springframework=DEBUG\`
|
|
542
|
+
2. Check Spring Boot documentation for the specific component
|
|
543
|
+
3. Search Spring Boot GitHub issues for similar problems
|
|
544
|
+
4. Consider posting on Stack Overflow with the full stack trace
|
|
545
|
+
|
|
546
|
+
${stackTrace ? `
|
|
547
|
+
## Stack Trace Analysis
|
|
548
|
+
\`\`\`
|
|
549
|
+
${stackTrace.substring(0, 500)}${stackTrace.length > 500 ? '...' : ''}
|
|
550
|
+
\`\`\`
|
|
551
|
+
` : ''}`;
|
|
552
|
+
}
|
|
553
|
+
getUpgradeRecommendation(version1, version2) {
|
|
554
|
+
// Simplified version comparison logic
|
|
555
|
+
const v1Major = parseInt(version1.split('.')[0]);
|
|
556
|
+
const v2Major = parseInt(version2.split('.')[0]);
|
|
557
|
+
if (v2Major > v1Major) {
|
|
558
|
+
return `🚨 Major version upgrade detected. This may include breaking changes. Plan for thorough testing and potential code modifications.`;
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
return `✅ Minor/patch version upgrade. Generally safe to upgrade with minimal breaking changes expected.`;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
hashString(str) {
|
|
565
|
+
let hash = 0;
|
|
566
|
+
for (let i = 0; i < str.length; i++) {
|
|
567
|
+
const char = str.charCodeAt(i);
|
|
568
|
+
hash = ((hash << 5) - hash) + char;
|
|
569
|
+
hash = hash & hash; // Convert to 32-bit integer
|
|
570
|
+
}
|
|
571
|
+
return Math.abs(hash).toString();
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
//# sourceMappingURL=advanced-features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced-features.js","sourceRoot":"","sources":["../../src/services/advanced-features.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAC1B,KAAK,CAAe;IAE5B;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AC,CAAC,CAAC,CAAC;QAEjD,IAAI,OAAO,GAAG,OAAO,EAAE,CAAC;YACtB,OAAO,mIAAmI,CAAC;QAC7I,CAAC;aAAM,CAAC;YACN,OAAO,kGAAkG,CAAC;QAC5G,CAAC;IACH,CAAC;IAEO,UAAU,CAAC,GAAW;QAC5B,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;YACnC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,4BAA4B;QAClD,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intelligent caching service for Spring documentation
|
|
3
|
+
*/
|
|
4
|
+
export declare class CacheService {
|
|
5
|
+
private cache;
|
|
6
|
+
private readonly DEFAULT_TTL;
|
|
7
|
+
private readonly LONG_TTL;
|
|
8
|
+
/**
|
|
9
|
+
* Get cached data if available and not expired
|
|
10
|
+
*/
|
|
11
|
+
get<T>(key: string): T | null;
|
|
12
|
+
/**
|
|
13
|
+
* Store data in cache with optional custom TTL
|
|
14
|
+
*/
|
|
15
|
+
set<T>(key: string, data: T, ttl?: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Store data with long TTL for stable content
|
|
18
|
+
*/
|
|
19
|
+
setLongTerm<T>(key: string, data: T): void;
|
|
20
|
+
/**
|
|
21
|
+
* Clear expired entries
|
|
22
|
+
*/
|
|
23
|
+
cleanup(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get cache statistics
|
|
26
|
+
*/
|
|
27
|
+
getStats(): {
|
|
28
|
+
size: number;
|
|
29
|
+
expired: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Clear all cache
|
|
33
|
+
*/
|
|
34
|
+
clear(): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/services/cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAoE;IACjF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEhD;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAY7B;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAQhD;;OAEG;IACH,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IAI1C;;OAEG;IACH,OAAO,IAAI,IAAI;IASf;;OAEG;IACH,QAAQ,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAa7C;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|