@stackguide/mcp-server 2.4.0 → 3.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/README.md +82 -16
- package/dist/config/healthWeights.d.ts +87 -0
- package/dist/config/healthWeights.d.ts.map +1 -0
- package/dist/config/healthWeights.js +238 -0
- package/dist/config/healthWeights.js.map +1 -0
- package/dist/config/types.d.ts +104 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/handlers/generate.d.ts +6 -0
- package/dist/handlers/generate.d.ts.map +1 -1
- package/dist/handlers/generate.js +81 -5
- package/dist/handlers/generate.js.map +1 -1
- package/dist/handlers/health.d.ts +7 -0
- package/dist/handlers/health.d.ts.map +1 -1
- package/dist/handlers/health.js +151 -69
- package/dist/handlers/health.js.map +1 -1
- package/dist/handlers/review.d.ts +12 -0
- package/dist/handlers/review.d.ts.map +1 -1
- package/dist/handlers/review.js +220 -21
- package/dist/handlers/review.js.map +1 -1
- package/dist/services/analysisCache.d.ts +110 -0
- package/dist/services/analysisCache.d.ts.map +1 -0
- package/dist/services/analysisCache.js +233 -0
- package/dist/services/analysisCache.js.map +1 -0
- package/dist/services/codeAnalyzer.d.ts +73 -30
- package/dist/services/codeAnalyzer.d.ts.map +1 -1
- package/dist/services/codeAnalyzer.js +384 -36
- package/dist/services/codeAnalyzer.js.map +1 -1
- package/dist/services/conventionDetector.d.ts +40 -0
- package/dist/services/conventionDetector.d.ts.map +1 -0
- package/dist/services/conventionDetector.js +465 -0
- package/dist/services/conventionDetector.js.map +1 -0
- package/dist/services/cursorDirectory.d.ts +29 -2
- package/dist/services/cursorDirectory.d.ts.map +1 -1
- package/dist/services/cursorDirectory.js +260 -9
- package/dist/services/cursorDirectory.js.map +1 -1
- package/dist/utils/validation.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,46 +22,112 @@ Dynamic context loading for AI coding assistants. Works with **Cursor** and **Gi
|
|
|
22
22
|
|
|
23
23
|
Just talk naturally:
|
|
24
24
|
|
|
25
|
-
- *"Set up my project"* → Auto-configures
|
|
26
|
-
- *"Review my code"* → Analyzes
|
|
25
|
+
- *"Set up my project"* → Auto-configures with interactive wizard
|
|
26
|
+
- *"Review my code"* → Analyzes with Quick Fix suggestions
|
|
27
|
+
- *"Generate a component"* → Creates boilerplate code
|
|
28
|
+
- *"Check project health"* → Returns health score (A-F)
|
|
27
29
|
- *"Browse React rules"* → Shows community rules
|
|
28
30
|
|
|
29
|
-
## Tools (
|
|
31
|
+
## Tools (12 total)
|
|
30
32
|
|
|
33
|
+
### Core Tools
|
|
31
34
|
| Tool | Description | Example |
|
|
32
35
|
|------|-------------|---------|
|
|
33
|
-
| `setup` | Configure project
|
|
36
|
+
| `setup` | Configure project with wizard | `setup` or `setup type:"react-typescript"` |
|
|
34
37
|
| `context` | View current configuration | `context` or `context full:true` |
|
|
35
38
|
| `rules` | List, search, get rules | `rules action:"search" query:"security"` |
|
|
36
39
|
| `knowledge` | Access patterns & solutions | `knowledge action:"get" query:"architecture"` |
|
|
37
|
-
| `review` | Review code
|
|
40
|
+
| `review` | Review code with Quick Fixes | `review file:"src/index.ts" focus:"security"` |
|
|
41
|
+
|
|
42
|
+
### Advanced Features (NEW in v2.4.0)
|
|
43
|
+
| Tool | Description | Example |
|
|
44
|
+
|------|-------------|---------|
|
|
45
|
+
| `generate` | Generate boilerplate code | `generate type:"component" name:"UserCard"` |
|
|
46
|
+
| `health` | Project health score (A-F) | `health detailed:true` |
|
|
47
|
+
|
|
48
|
+
### Integration Tools
|
|
49
|
+
| Tool | Description | Example |
|
|
50
|
+
|------|-------------|---------|
|
|
38
51
|
| `cursor` | Browse cursor.directory | `cursor action:"browse" query:"react"` |
|
|
39
52
|
| `docs` | Fetch web documentation | `docs action:"fetch" url:"https://..."` |
|
|
40
53
|
| `config` | Save/load configurations | `config action:"save" name:"my-project"` |
|
|
41
54
|
| `custom_rule` | Create custom rules | `custom_rule action:"create" name:"..." content:"..."` |
|
|
42
|
-
| `help` | Get help | `help` or `help topic:"
|
|
55
|
+
| `help` | Get help | `help` or `help topic:"generate"` |
|
|
56
|
+
|
|
57
|
+
## New in v2.4.0: Advanced Features
|
|
58
|
+
|
|
59
|
+
### 🏭 Template Generator
|
|
60
|
+
Generate boilerplate for components, hooks, services, tests, API routes, models, and utilities:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
generate type:"component" name:"UserCard"
|
|
64
|
+
generate type:"hook" name:"useAuth"
|
|
65
|
+
generate type:"service" name:"ApiService"
|
|
66
|
+
generate type:"test" name:"UserCard" options:{"framework":"vitest"}
|
|
67
|
+
generate type:"api" name:"Users" options:{"framework":"nextjs"}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 🔧 Quick Fix Suggestions
|
|
71
|
+
Code review now includes actionable Quick Fixes:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
🔴 [SEC001] Avoid using eval() - it can execute arbitrary code
|
|
75
|
+
- Line: 15
|
|
76
|
+
- Code: `eval(userInput)`
|
|
77
|
+
- 🔧 Quick Fix: Replace eval() with JSON.parse()
|
|
78
|
+
- Replace: `eval(` → With: `JSON.parse(`
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 🏥 Project Health Score
|
|
82
|
+
Get a comprehensive health analysis with grade (A-F):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
health detailed:true
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
- Overall score (0-100) with grade
|
|
90
|
+
- Category breakdown (Configuration, Code Quality, Structure, Docs, Testing)
|
|
91
|
+
- Critical issues and recommendations
|
|
92
|
+
|
|
93
|
+
### 🧙 Interactive Setup Wizard
|
|
94
|
+
Setup now provides tailored recommendations:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"wizard": {
|
|
99
|
+
"recommendations": {
|
|
100
|
+
"suggestedTools": ["ESLint", "Prettier", "TypeScript strict mode"],
|
|
101
|
+
"vsCodeExtensions": ["ES7+ React snippets", "Error Lens"],
|
|
102
|
+
"tips": ["Use functional components", "Memoize with useMemo"]
|
|
103
|
+
},
|
|
104
|
+
"nextSteps": ["Run `context`", "Run `review`", "Run `health`"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
43
108
|
|
|
44
109
|
## Supported Stacks
|
|
45
110
|
|
|
46
|
-
`python-django` · `python-fastapi` · `react-node` · `react-typescript` · `vue-node` · `nextjs` · `express` · `nestjs` · `laravel` · `rails` · `golang` · `rust`
|
|
111
|
+
`python-django` · `python-fastapi` · `python-flask` · `react-node` · `react-typescript` · `vue-node` · `nextjs` · `express` · `nestjs` · `laravel` · `rails` · `golang` · `rust`
|
|
47
112
|
|
|
48
113
|
## Examples
|
|
49
114
|
|
|
50
115
|
```bash
|
|
51
|
-
# Auto-setup
|
|
116
|
+
# Auto-setup with wizard
|
|
52
117
|
setup
|
|
53
118
|
|
|
54
|
-
#
|
|
55
|
-
|
|
119
|
+
# Generate React component
|
|
120
|
+
generate type:"component" name:"Dashboard"
|
|
56
121
|
|
|
57
|
-
# Review
|
|
58
|
-
review
|
|
122
|
+
# Review with Quick Fixes
|
|
123
|
+
review file:"src/App.tsx" focus:"performance"
|
|
59
124
|
|
|
60
|
-
#
|
|
61
|
-
|
|
125
|
+
# Check project health
|
|
126
|
+
health
|
|
62
127
|
|
|
63
|
-
#
|
|
64
|
-
cursor action:"
|
|
128
|
+
# Browse and import community rules
|
|
129
|
+
cursor action:"popular"
|
|
130
|
+
cursor action:"import" slug:"typescript-best-practices"
|
|
65
131
|
```
|
|
66
132
|
|
|
67
133
|
## License
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health Weights Configuration
|
|
3
|
+
*
|
|
4
|
+
* Externalized scoring weights for project health analysis.
|
|
5
|
+
* Can be overridden per-project via stackguide.config.json
|
|
6
|
+
*/
|
|
7
|
+
export interface CategoryWeight {
|
|
8
|
+
name: string;
|
|
9
|
+
maxScore: number;
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IssueWeights {
|
|
13
|
+
critical: number;
|
|
14
|
+
error: number;
|
|
15
|
+
warning: number;
|
|
16
|
+
info: number;
|
|
17
|
+
suggestion: number;
|
|
18
|
+
}
|
|
19
|
+
export interface HealthWeightsConfig {
|
|
20
|
+
version: string;
|
|
21
|
+
categories: {
|
|
22
|
+
configuration: CategoryWeight;
|
|
23
|
+
codeQuality: CategoryWeight;
|
|
24
|
+
structure: CategoryWeight;
|
|
25
|
+
documentation: CategoryWeight;
|
|
26
|
+
testing: CategoryWeight;
|
|
27
|
+
};
|
|
28
|
+
issueWeights: IssueWeights;
|
|
29
|
+
gradeThresholds: {
|
|
30
|
+
A: number;
|
|
31
|
+
B: number;
|
|
32
|
+
C: number;
|
|
33
|
+
D: number;
|
|
34
|
+
F: number;
|
|
35
|
+
};
|
|
36
|
+
bonuses: {
|
|
37
|
+
hasTypeScript: number;
|
|
38
|
+
hasLinter: number;
|
|
39
|
+
hasPrettier: number;
|
|
40
|
+
hasCI: number;
|
|
41
|
+
hasTests: number;
|
|
42
|
+
hasReadme: number;
|
|
43
|
+
hasLicense: number;
|
|
44
|
+
hasContributing: number;
|
|
45
|
+
};
|
|
46
|
+
penalties: {
|
|
47
|
+
noPackageLock: number;
|
|
48
|
+
hasSecurityIssues: number;
|
|
49
|
+
outdatedDependencies: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Default health weights configuration
|
|
54
|
+
*/
|
|
55
|
+
export declare const DEFAULT_HEALTH_WEIGHTS: HealthWeightsConfig;
|
|
56
|
+
/**
|
|
57
|
+
* Read project-specific weight overrides
|
|
58
|
+
*/
|
|
59
|
+
export declare function loadProjectWeights(projectPath: string): Partial<HealthWeightsConfig> | null;
|
|
60
|
+
/**
|
|
61
|
+
* Merge default weights with project overrides
|
|
62
|
+
*/
|
|
63
|
+
export declare function getHealthWeights(projectPath: string): HealthWeightsConfig;
|
|
64
|
+
/**
|
|
65
|
+
* Validate that category weights sum to 100
|
|
66
|
+
*/
|
|
67
|
+
export declare function validateWeights(weights: HealthWeightsConfig): {
|
|
68
|
+
valid: boolean;
|
|
69
|
+
errors: string[];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Get grade from score using weights config
|
|
73
|
+
*/
|
|
74
|
+
export declare function getGradeFromScore(score: number, weights: HealthWeightsConfig): string;
|
|
75
|
+
/**
|
|
76
|
+
* Calculate issue deduction based on weights
|
|
77
|
+
*/
|
|
78
|
+
export declare function calculateIssueDeduction(issueType: keyof IssueWeights, count: number, weights: HealthWeightsConfig): number;
|
|
79
|
+
/**
|
|
80
|
+
* Generate sample config file content
|
|
81
|
+
*/
|
|
82
|
+
export declare function generateSampleConfig(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Get weights documentation as markdown
|
|
85
|
+
*/
|
|
86
|
+
export declare function getWeightsDocumentation(weights: HealthWeightsConfig): string;
|
|
87
|
+
//# sourceMappingURL=healthWeights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"healthWeights.d.ts","sourceRoot":"","sources":["../../src/config/healthWeights.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAGhB,UAAU,EAAE;QACV,aAAa,EAAE,cAAc,CAAC;QAC9B,WAAW,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;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,YAAY,EAC7B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,mBAAmB,GAC3B,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAqB7C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAuC5E"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health Weights Configuration
|
|
3
|
+
*
|
|
4
|
+
* Externalized scoring weights for project health analysis.
|
|
5
|
+
* Can be overridden per-project via stackguide.config.json
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
import { logger } from '../utils/logger.js';
|
|
10
|
+
/**
|
|
11
|
+
* Default health weights configuration
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_HEALTH_WEIGHTS = {
|
|
14
|
+
version: '1.0.0',
|
|
15
|
+
categories: {
|
|
16
|
+
configuration: {
|
|
17
|
+
name: 'Configuration',
|
|
18
|
+
maxScore: 20,
|
|
19
|
+
description: 'Project setup, dependencies, and tooling configuration'
|
|
20
|
+
},
|
|
21
|
+
codeQuality: {
|
|
22
|
+
name: 'Code Quality',
|
|
23
|
+
maxScore: 30,
|
|
24
|
+
description: 'Code analysis results, patterns, and best practices'
|
|
25
|
+
},
|
|
26
|
+
structure: {
|
|
27
|
+
name: 'Structure',
|
|
28
|
+
maxScore: 20,
|
|
29
|
+
description: 'Project organization, file structure, and architecture'
|
|
30
|
+
},
|
|
31
|
+
documentation: {
|
|
32
|
+
name: 'Documentation',
|
|
33
|
+
maxScore: 15,
|
|
34
|
+
description: 'README, inline docs, and API documentation'
|
|
35
|
+
},
|
|
36
|
+
testing: {
|
|
37
|
+
name: 'Testing',
|
|
38
|
+
maxScore: 15,
|
|
39
|
+
description: 'Test coverage, test structure, and test quality'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
issueWeights: {
|
|
43
|
+
critical: 10,
|
|
44
|
+
error: 5,
|
|
45
|
+
warning: 2,
|
|
46
|
+
info: 0.5,
|
|
47
|
+
suggestion: 0.25
|
|
48
|
+
},
|
|
49
|
+
gradeThresholds: {
|
|
50
|
+
A: 90,
|
|
51
|
+
B: 80,
|
|
52
|
+
C: 70,
|
|
53
|
+
D: 60,
|
|
54
|
+
F: 0
|
|
55
|
+
},
|
|
56
|
+
bonuses: {
|
|
57
|
+
hasTypeScript: 5,
|
|
58
|
+
hasLinter: 3,
|
|
59
|
+
hasPrettier: 2,
|
|
60
|
+
hasCI: 3,
|
|
61
|
+
hasTests: 5,
|
|
62
|
+
hasReadme: 2,
|
|
63
|
+
hasLicense: 1,
|
|
64
|
+
hasContributing: 1
|
|
65
|
+
},
|
|
66
|
+
penalties: {
|
|
67
|
+
noPackageLock: 2,
|
|
68
|
+
hasSecurityIssues: 10,
|
|
69
|
+
outdatedDependencies: 3
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const CONFIG_FILE_NAME = 'stackguide.config.json';
|
|
73
|
+
/**
|
|
74
|
+
* Read project-specific weight overrides
|
|
75
|
+
*/
|
|
76
|
+
export function loadProjectWeights(projectPath) {
|
|
77
|
+
const configPath = path.join(projectPath, CONFIG_FILE_NAME);
|
|
78
|
+
try {
|
|
79
|
+
if (fs.existsSync(configPath)) {
|
|
80
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
81
|
+
const config = JSON.parse(content);
|
|
82
|
+
if (config.healthWeights) {
|
|
83
|
+
logger.debug('Loaded project health weights', { projectPath });
|
|
84
|
+
return config.healthWeights;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
logger.debug('Failed to load project health weights', { error });
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Merge default weights with project overrides
|
|
95
|
+
*/
|
|
96
|
+
export function getHealthWeights(projectPath) {
|
|
97
|
+
const projectWeights = loadProjectWeights(projectPath);
|
|
98
|
+
if (!projectWeights) {
|
|
99
|
+
return DEFAULT_HEALTH_WEIGHTS;
|
|
100
|
+
}
|
|
101
|
+
// Deep merge with defaults
|
|
102
|
+
return {
|
|
103
|
+
...DEFAULT_HEALTH_WEIGHTS,
|
|
104
|
+
...projectWeights,
|
|
105
|
+
categories: {
|
|
106
|
+
...DEFAULT_HEALTH_WEIGHTS.categories,
|
|
107
|
+
...projectWeights.categories
|
|
108
|
+
},
|
|
109
|
+
issueWeights: {
|
|
110
|
+
...DEFAULT_HEALTH_WEIGHTS.issueWeights,
|
|
111
|
+
...projectWeights.issueWeights
|
|
112
|
+
},
|
|
113
|
+
gradeThresholds: {
|
|
114
|
+
...DEFAULT_HEALTH_WEIGHTS.gradeThresholds,
|
|
115
|
+
...projectWeights.gradeThresholds
|
|
116
|
+
},
|
|
117
|
+
bonuses: {
|
|
118
|
+
...DEFAULT_HEALTH_WEIGHTS.bonuses,
|
|
119
|
+
...projectWeights.bonuses
|
|
120
|
+
},
|
|
121
|
+
penalties: {
|
|
122
|
+
...DEFAULT_HEALTH_WEIGHTS.penalties,
|
|
123
|
+
...projectWeights.penalties
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Validate that category weights sum to 100
|
|
129
|
+
*/
|
|
130
|
+
export function validateWeights(weights) {
|
|
131
|
+
const errors = [];
|
|
132
|
+
// Check category sum
|
|
133
|
+
const categorySum = Object.values(weights.categories).reduce((sum, cat) => sum + cat.maxScore, 0);
|
|
134
|
+
if (categorySum !== 100) {
|
|
135
|
+
errors.push(`Category weights must sum to 100, got ${categorySum}`);
|
|
136
|
+
}
|
|
137
|
+
// Check grade thresholds are in descending order
|
|
138
|
+
const thresholds = weights.gradeThresholds;
|
|
139
|
+
if (thresholds.A <= thresholds.B ||
|
|
140
|
+
thresholds.B <= thresholds.C ||
|
|
141
|
+
thresholds.C <= thresholds.D) {
|
|
142
|
+
errors.push('Grade thresholds must be in descending order (A > B > C > D > F)');
|
|
143
|
+
}
|
|
144
|
+
// Check for negative values
|
|
145
|
+
for (const [key, value] of Object.entries(weights.issueWeights)) {
|
|
146
|
+
if (value < 0) {
|
|
147
|
+
errors.push(`Issue weight "${key}" cannot be negative`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
valid: errors.length === 0,
|
|
152
|
+
errors
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get grade from score using weights config
|
|
157
|
+
*/
|
|
158
|
+
export function getGradeFromScore(score, weights) {
|
|
159
|
+
const { gradeThresholds } = weights;
|
|
160
|
+
if (score >= gradeThresholds.A)
|
|
161
|
+
return 'A';
|
|
162
|
+
if (score >= gradeThresholds.B)
|
|
163
|
+
return 'B';
|
|
164
|
+
if (score >= gradeThresholds.C)
|
|
165
|
+
return 'C';
|
|
166
|
+
if (score >= gradeThresholds.D)
|
|
167
|
+
return 'D';
|
|
168
|
+
return 'F';
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Calculate issue deduction based on weights
|
|
172
|
+
*/
|
|
173
|
+
export function calculateIssueDeduction(issueType, count, weights) {
|
|
174
|
+
return weights.issueWeights[issueType] * count;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Generate sample config file content
|
|
178
|
+
*/
|
|
179
|
+
export function generateSampleConfig() {
|
|
180
|
+
const sample = {
|
|
181
|
+
"$schema": "https://stackguide.dev/schema/config.json",
|
|
182
|
+
"healthWeights": {
|
|
183
|
+
"categories": {
|
|
184
|
+
"testing": {
|
|
185
|
+
"maxScore": 20,
|
|
186
|
+
"description": "Increased testing weight for this project"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"issueWeights": {
|
|
190
|
+
"critical": 15,
|
|
191
|
+
"error": 7
|
|
192
|
+
},
|
|
193
|
+
"gradeThresholds": {
|
|
194
|
+
"A": 95
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
return JSON.stringify(sample, null, 2);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get weights documentation as markdown
|
|
202
|
+
*/
|
|
203
|
+
export function getWeightsDocumentation(weights) {
|
|
204
|
+
const lines = [
|
|
205
|
+
'# Health Score Weights',
|
|
206
|
+
'',
|
|
207
|
+
'## Categories',
|
|
208
|
+
''
|
|
209
|
+
];
|
|
210
|
+
for (const [key, cat] of Object.entries(weights.categories)) {
|
|
211
|
+
lines.push(`### ${cat.name} (${cat.maxScore} points)`);
|
|
212
|
+
lines.push(cat.description);
|
|
213
|
+
lines.push('');
|
|
214
|
+
}
|
|
215
|
+
lines.push('## Issue Deductions');
|
|
216
|
+
lines.push('');
|
|
217
|
+
lines.push('| Severity | Points Deducted |');
|
|
218
|
+
lines.push('|----------|-----------------|');
|
|
219
|
+
for (const [key, value] of Object.entries(weights.issueWeights)) {
|
|
220
|
+
lines.push(`| ${key} | -${value} |`);
|
|
221
|
+
}
|
|
222
|
+
lines.push('');
|
|
223
|
+
lines.push('## Grade Thresholds');
|
|
224
|
+
lines.push('');
|
|
225
|
+
lines.push('| Grade | Minimum Score |');
|
|
226
|
+
lines.push('|-------|---------------|');
|
|
227
|
+
for (const [grade, threshold] of Object.entries(weights.gradeThresholds)) {
|
|
228
|
+
lines.push(`| ${grade} | ${threshold}+ |`);
|
|
229
|
+
}
|
|
230
|
+
lines.push('');
|
|
231
|
+
lines.push('## Bonuses');
|
|
232
|
+
lines.push('');
|
|
233
|
+
for (const [key, value] of Object.entries(weights.bonuses)) {
|
|
234
|
+
lines.push(`- ${key}: +${value} points`);
|
|
235
|
+
}
|
|
236
|
+
return lines.join('\n');
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=healthWeights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health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S,KAAK,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -16,6 +16,110 @@ export interface Rule {
|
|
|
16
16
|
enabled: boolean;
|
|
17
17
|
priority: number;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Severity levels for code analysis issues
|
|
21
|
+
*/
|
|
22
|
+
export type IssueSeverity = 'error' | 'warning' | 'info' | 'suggestion';
|
|
23
|
+
/**
|
|
24
|
+
* Quick fix definition for auto-corrections
|
|
25
|
+
*/
|
|
26
|
+
export interface QuickFix {
|
|
27
|
+
description: string;
|
|
28
|
+
before: string;
|
|
29
|
+
after: string;
|
|
30
|
+
isRegex?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Base interface for all analysis rules
|
|
34
|
+
*/
|
|
35
|
+
export interface BaseAnalysisRule {
|
|
36
|
+
id: string;
|
|
37
|
+
category: AnalysisCategory;
|
|
38
|
+
severity: IssueSeverity;
|
|
39
|
+
message: string;
|
|
40
|
+
suggestion?: string;
|
|
41
|
+
languages?: string[];
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
priority: number;
|
|
44
|
+
source: 'builtin' | 'user' | 'project';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Regex-based pattern matching rule (current implementation)
|
|
48
|
+
*/
|
|
49
|
+
export interface PatternRule extends BaseAnalysisRule {
|
|
50
|
+
type: 'pattern';
|
|
51
|
+
pattern: RegExp;
|
|
52
|
+
quickFix?: (match: string) => QuickFix | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* AST-based rule (future implementation - Phase 2)
|
|
56
|
+
*/
|
|
57
|
+
export interface ASTRule extends BaseAnalysisRule {
|
|
58
|
+
type: 'ast';
|
|
59
|
+
nodeType: string;
|
|
60
|
+
check: (node: unknown) => boolean;
|
|
61
|
+
quickFix?: (node: unknown) => QuickFix | undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* External linter rule (future implementation - Phase 3)
|
|
65
|
+
*/
|
|
66
|
+
export interface LinterRule extends BaseAnalysisRule {
|
|
67
|
+
type: 'linter';
|
|
68
|
+
linter: 'eslint' | 'prettier' | 'biome' | 'ruff' | 'pylint';
|
|
69
|
+
linterRule: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Union type for all analysis rules
|
|
73
|
+
*/
|
|
74
|
+
export type AnalysisRule = PatternRule | ASTRule | LinterRule;
|
|
75
|
+
/**
|
|
76
|
+
* Analysis categories (more specific than RuleCategory)
|
|
77
|
+
*/
|
|
78
|
+
export type AnalysisCategory = 'security' | 'performance' | 'coding-standards' | 'architecture' | 'best-practices' | 'testing' | 'accessibility' | 'react' | 'node' | 'python' | 'go' | 'rust';
|
|
79
|
+
/**
|
|
80
|
+
* Analysis rule registry for managing all rules
|
|
81
|
+
*/
|
|
82
|
+
export interface AnalysisRuleRegistry {
|
|
83
|
+
builtin: AnalysisRule[];
|
|
84
|
+
user: AnalysisRule[];
|
|
85
|
+
project: AnalysisRule[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Code issue found during analysis
|
|
89
|
+
*/
|
|
90
|
+
export interface CodeIssue {
|
|
91
|
+
severity: IssueSeverity;
|
|
92
|
+
rule: string;
|
|
93
|
+
category: string;
|
|
94
|
+
message: string;
|
|
95
|
+
line?: number;
|
|
96
|
+
column?: number;
|
|
97
|
+
code?: string;
|
|
98
|
+
suggestion?: string;
|
|
99
|
+
quickFix?: QuickFix;
|
|
100
|
+
source: 'builtin' | 'user' | 'project';
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Analysis result for a single file
|
|
104
|
+
*/
|
|
105
|
+
export interface AnalysisResult {
|
|
106
|
+
file: string;
|
|
107
|
+
language: string;
|
|
108
|
+
issues: CodeIssue[];
|
|
109
|
+
score: number;
|
|
110
|
+
summary: {
|
|
111
|
+
errors: number;
|
|
112
|
+
warnings: number;
|
|
113
|
+
info: number;
|
|
114
|
+
suggestions: number;
|
|
115
|
+
};
|
|
116
|
+
quickFixes?: QuickFix[];
|
|
117
|
+
rulesApplied: {
|
|
118
|
+
builtin: number;
|
|
119
|
+
user: number;
|
|
120
|
+
project: number;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
19
123
|
export type RuleCategory = 'coding-standards' | 'best-practices' | 'security' | 'performance' | 'architecture' | 'testing' | 'documentation' | 'naming-conventions';
|
|
20
124
|
export interface KnowledgeFile {
|
|
21
125
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GACnB,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,YAAY,GACZ,kBAAkB,GAClB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,CAAC;AAGb,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAA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,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,eAAe,GACf,cAAc,GACd,UAAU,GACV,WAAW,GACX,iBAAiB,CAAC;AAGtB,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,IAAI,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,WAAW;IAC1B,iBAAiB,EAAE,WAAW,GAAG,IAAI,CAAC;IACtC,mBAAmB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC9C,WAAW,EAAE,IAAI,EAAE,CAAC;IACpB,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC;AAGD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,WAAW,EAAE,WAAW,CAiH/D,CAAC"}
|
package/dist/config/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AA4NA,gCAAgC;AAChC,MAAM,CAAC,MAAM,kBAAkB,GAAqC;IAClE,eAAe,EAAE;QACf,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,kCAAkC;QAC/C,SAAS,EAAE,CAAC,QAAQ,CAAC;QACrB,UAAU,EAAE,CAAC,QAAQ,CAAC;QACtB,cAAc,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,aAAa,CAAC;KACvD;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,g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AAc,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;KACtC;IACD,MAAM,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,2BAA2B;QACxC,SAAS,EAAE,CAAC,MAAM,CAAC;QACnB,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;KAC1C;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,8BAA8B;QAC3C,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,EAAE;KACnB;CACF,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate handler - Generate boilerplate code from templates
|
|
3
3
|
* Phase 6: Advanced Features
|
|
4
|
+
*
|
|
5
|
+
* Improvements:
|
|
6
|
+
* - Detects project conventions (quotes, semicolons, indentation)
|
|
7
|
+
* - Adapts templates based on state management in use
|
|
8
|
+
* - Respects existing code patterns
|
|
4
9
|
*/
|
|
5
10
|
import { ServerState, ToolResponse } from './types.js';
|
|
6
11
|
interface GenerateArgs {
|
|
@@ -11,6 +16,7 @@ interface GenerateArgs {
|
|
|
11
16
|
withTests?: boolean;
|
|
12
17
|
withStyles?: boolean;
|
|
13
18
|
framework?: string;
|
|
19
|
+
scanProject?: boolean;
|
|
14
20
|
};
|
|
15
21
|
}
|
|
16
22
|
export declare function handleGenerate(args: GenerateArgs, state: ServerState): Promise<ToolResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/handlers/generate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/handlers/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAA8B,MAAM,YAAY,CAAC;AAInF,UAAU,YAAY;IACpB,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AA8xBD,wBAAsB,cAAc,CAClC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,YAAY,CAAC,CA0EvB"}
|