project-customization-mcp 0.1.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/LICENSE +21 -0
- package/README.md +373 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +29 -0
- package/build/index.js.map +1 -0
- package/build/prompts.d.ts +30 -0
- package/build/prompts.js +98 -0
- package/build/prompts.js.map +1 -0
- package/build/resources.d.ts +47 -0
- package/build/resources.js +173 -0
- package/build/resources.js.map +1 -0
- package/build/server.d.ts +12 -0
- package/build/server.js +288 -0
- package/build/server.js.map +1 -0
- package/build/tools.d.ts +23 -0
- package/build/tools.js +133 -0
- package/build/tools.js.map +1 -0
- package/build/types.d.ts +62 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/utils/bestPractices.d.ts +16 -0
- package/build/utils/bestPractices.js +230 -0
- package/build/utils/bestPractices.js.map +1 -0
- package/build/utils/fileHandler.d.ts +46 -0
- package/build/utils/fileHandler.js +144 -0
- package/build/utils/fileHandler.js.map +1 -0
- package/build/utils/logger.d.ts +20 -0
- package/build/utils/logger.js +42 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/projectScanner.d.ts +26 -0
- package/build/utils/projectScanner.js +182 -0
- package/build/utils/projectScanner.js.map +1 -0
- package/build/utils/validator.d.ts +115 -0
- package/build/utils/validator.js +120 -0
- package/build/utils/validator.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project analysis and scanning utility
|
|
3
|
+
*/
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { FileHandler } from './fileHandler.js';
|
|
6
|
+
import { logger } from './logger.js';
|
|
7
|
+
export class ProjectScanner {
|
|
8
|
+
/**
|
|
9
|
+
* Detect project type based on files
|
|
10
|
+
*/
|
|
11
|
+
static async detectProjectType(projectRoot) {
|
|
12
|
+
const packageJsonExists = await FileHandler.fileExists(path.join(projectRoot, 'package.json'));
|
|
13
|
+
const pipfileExists = await FileHandler.fileExists(path.join(projectRoot, 'Pipfile'));
|
|
14
|
+
const pyprojectExists = await FileHandler.fileExists(path.join(projectRoot, 'pyproject.toml'));
|
|
15
|
+
const csProjectExists = await FileHandler.listFiles(projectRoot).then((files) => files.some((f) => f.endsWith('.csproj')));
|
|
16
|
+
if (packageJsonExists)
|
|
17
|
+
return 'nodejs';
|
|
18
|
+
if (pipfileExists || pyprojectExists)
|
|
19
|
+
return 'python';
|
|
20
|
+
if (csProjectExists)
|
|
21
|
+
return 'dotnet';
|
|
22
|
+
return 'unknown';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Detect frameworks and languages
|
|
26
|
+
*/
|
|
27
|
+
static async detectFrameworks(projectRoot) {
|
|
28
|
+
const frameworks = [];
|
|
29
|
+
try {
|
|
30
|
+
const packageJsonPath = path.join(projectRoot, 'package.json');
|
|
31
|
+
if (await FileHandler.fileExists(packageJsonPath)) {
|
|
32
|
+
const content = await FileHandler.readFile(packageJsonPath);
|
|
33
|
+
const packageJson = JSON.parse(content);
|
|
34
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
35
|
+
if (deps.react)
|
|
36
|
+
frameworks.push('React');
|
|
37
|
+
if (deps.vue)
|
|
38
|
+
frameworks.push('Vue');
|
|
39
|
+
if (deps.angular)
|
|
40
|
+
frameworks.push('Angular');
|
|
41
|
+
if (deps.next)
|
|
42
|
+
frameworks.push('Next.js');
|
|
43
|
+
if (deps.nuxt)
|
|
44
|
+
frameworks.push('Nuxt');
|
|
45
|
+
if (deps.express || deps['@nestjs/core'])
|
|
46
|
+
frameworks.push('Node.js Backend');
|
|
47
|
+
if (deps.typescript)
|
|
48
|
+
frameworks.push('TypeScript');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
logger.warn('Error detecting frameworks', error);
|
|
53
|
+
}
|
|
54
|
+
return [...new Set(frameworks)];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Detect programming languages in the project
|
|
58
|
+
*/
|
|
59
|
+
static async detectLanguages(projectRoot) {
|
|
60
|
+
const languages = new Set();
|
|
61
|
+
try {
|
|
62
|
+
const files = await FileHandler.listFiles(projectRoot, true);
|
|
63
|
+
for (const file of files) {
|
|
64
|
+
const ext = path.extname(file).toLowerCase();
|
|
65
|
+
if (ext === '.ts')
|
|
66
|
+
languages.add('TypeScript');
|
|
67
|
+
if (ext === '.tsx')
|
|
68
|
+
languages.add('TypeScript/JSX');
|
|
69
|
+
if (ext === '.js')
|
|
70
|
+
languages.add('JavaScript');
|
|
71
|
+
if (ext === '.jsx')
|
|
72
|
+
languages.add('JavaScript/JSX');
|
|
73
|
+
if (ext === '.py')
|
|
74
|
+
languages.add('Python');
|
|
75
|
+
if (ext === '.cs')
|
|
76
|
+
languages.add('C#');
|
|
77
|
+
if (ext === '.java')
|
|
78
|
+
languages.add('Java');
|
|
79
|
+
if (ext === '.go')
|
|
80
|
+
languages.add('Go');
|
|
81
|
+
if (ext === '.rb')
|
|
82
|
+
languages.add('Ruby');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
logger.warn('Error detecting languages', error);
|
|
87
|
+
}
|
|
88
|
+
return Array.from(languages);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Scan project structure
|
|
92
|
+
*/
|
|
93
|
+
static async scanProjectStructure(projectRoot, maxDepth = 3) {
|
|
94
|
+
const folders = [];
|
|
95
|
+
const files = [];
|
|
96
|
+
let totalFiles = 0;
|
|
97
|
+
try {
|
|
98
|
+
const traverse = async (currentPath, depth = 0) => {
|
|
99
|
+
if (depth > maxDepth)
|
|
100
|
+
return;
|
|
101
|
+
const entries = await FileHandler.listFiles(currentPath);
|
|
102
|
+
for (const entry of entries) {
|
|
103
|
+
const fullPath = path.join(currentPath, entry);
|
|
104
|
+
const stat = await FileHandler.getFileStats(fullPath);
|
|
105
|
+
if (!stat)
|
|
106
|
+
continue;
|
|
107
|
+
if (stat.isDirectory()) {
|
|
108
|
+
const fileCount = await FileHandler.listFiles(fullPath).then((f) => f.length);
|
|
109
|
+
folders.push({
|
|
110
|
+
path: fullPath,
|
|
111
|
+
name: path.basename(fullPath),
|
|
112
|
+
depth,
|
|
113
|
+
fileCount,
|
|
114
|
+
});
|
|
115
|
+
await traverse(fullPath, depth + 1);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
totalFiles++;
|
|
119
|
+
files.push({
|
|
120
|
+
path: fullPath,
|
|
121
|
+
name: path.basename(fullPath),
|
|
122
|
+
extension: path.extname(fullPath),
|
|
123
|
+
size: stat.size,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
await traverse(projectRoot);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
logger.error('Error scanning project structure', error);
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
root: projectRoot,
|
|
135
|
+
folders,
|
|
136
|
+
files: files.slice(0, 100), // Limit to first 100 files in response
|
|
137
|
+
totalFiles,
|
|
138
|
+
keyDirectories: ['src', 'lib', 'components', 'pages', 'utils', 'tests', 'docs'],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Collect project metadata
|
|
143
|
+
*/
|
|
144
|
+
static async getProjectMetadata(projectRoot) {
|
|
145
|
+
let projectName = path.basename(projectRoot);
|
|
146
|
+
let description = '';
|
|
147
|
+
try {
|
|
148
|
+
const packageJsonPath = path.join(projectRoot, 'package.json');
|
|
149
|
+
if (await FileHandler.fileExists(packageJsonPath)) {
|
|
150
|
+
const content = await FileHandler.readFile(packageJsonPath);
|
|
151
|
+
const packageJson = JSON.parse(content);
|
|
152
|
+
projectName = packageJson.name || projectName;
|
|
153
|
+
description = packageJson.description || '';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
logger.warn('Error reading package.json', error);
|
|
158
|
+
}
|
|
159
|
+
const projectType = await this.detectProjectType(projectRoot);
|
|
160
|
+
const frameworks = await this.detectFrameworks(projectRoot);
|
|
161
|
+
const programmingLanguages = await this.detectLanguages(projectRoot);
|
|
162
|
+
const hasGitHub = await FileHandler.fileExists(path.join(projectRoot, '.git'));
|
|
163
|
+
const hasPackageJson = await FileHandler.fileExists(path.join(projectRoot, 'package.json'));
|
|
164
|
+
const hasPythonProject = await FileHandler.fileExists(path.join(projectRoot, 'pyproject.toml'));
|
|
165
|
+
const hasReadme = await FileHandler.fileExists(path.join(projectRoot, 'README.md'));
|
|
166
|
+
const hasCopilotInstructions = await FileHandler.fileExists(path.join(projectRoot, '.github', 'copilot-instructions.md'));
|
|
167
|
+
return {
|
|
168
|
+
name: projectName,
|
|
169
|
+
description,
|
|
170
|
+
projectRoot,
|
|
171
|
+
projectType,
|
|
172
|
+
hasGitHub,
|
|
173
|
+
hasPackageJson,
|
|
174
|
+
hasPythonProject,
|
|
175
|
+
hasReadme,
|
|
176
|
+
hasCopilotInstructions,
|
|
177
|
+
frameworks,
|
|
178
|
+
programmingLanguages,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=projectScanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectScanner.js","sourceRoot":"","sources":["../../src/utils/projectScanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,WAAmB;QAChD,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,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AAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;QAC5F,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC;QAChG,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;QACpF,MAAM,sBAAsB,GAAG,MAAM,WAAW,CAAC,UAAU,CACzD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAC7D,CAAC;QAEF,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,WAAW;YACX,WAAW;YACX,WAAW;YACX,SAAS;YACT,cAAc;YACd,gBAAgB;YAChB,SAAS;YACT,sBAAsB;YACtB,UAAU;YACV,oBAAoB;SACrB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input validation using Zod
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
/**
|
|
6
|
+
* Schema for project analysis tool input
|
|
7
|
+
*/
|
|
8
|
+
export declare const AnalyzeProjectInputSchema: z.ZodObject<{
|
|
9
|
+
projectPath: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
projectPath?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
projectPath?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Schema for generating copilot instructions
|
|
17
|
+
*/
|
|
18
|
+
export declare const GenerateCopilotInstructionsInputSchema: z.ZodObject<{
|
|
19
|
+
projectPath: z.ZodOptional<z.ZodString>;
|
|
20
|
+
analysisData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
projectPath?: string | undefined;
|
|
23
|
+
analysisData?: Record<string, any> | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
projectPath?: string | undefined;
|
|
26
|
+
analysisData?: Record<string, any> | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Schema for updating README
|
|
30
|
+
*/
|
|
31
|
+
export declare const UpdateReadmeInputSchema: z.ZodObject<{
|
|
32
|
+
projectPath: z.ZodOptional<z.ZodString>;
|
|
33
|
+
guidelines: z.ZodOptional<z.ZodString>;
|
|
34
|
+
analysisData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
guidelines?: string | undefined;
|
|
37
|
+
projectPath?: string | undefined;
|
|
38
|
+
analysisData?: Record<string, any> | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
guidelines?: string | undefined;
|
|
41
|
+
projectPath?: string | undefined;
|
|
42
|
+
analysisData?: Record<string, any> | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Schema for getting project customization recommendations
|
|
46
|
+
*/
|
|
47
|
+
export declare const GetRecommendationsInputSchema: z.ZodObject<{
|
|
48
|
+
projectPath: z.ZodOptional<z.ZodString>;
|
|
49
|
+
analysisData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
projectPath?: string | undefined;
|
|
52
|
+
analysisData?: Record<string, any> | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
projectPath?: string | undefined;
|
|
55
|
+
analysisData?: Record<string, any> | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Validate and parse input using provided schema
|
|
59
|
+
*/
|
|
60
|
+
export declare function validateInput<T>(schema: z.ZodSchema, input: unknown): T;
|
|
61
|
+
/**
|
|
62
|
+
* Generate tool definitions for MCP server
|
|
63
|
+
*/
|
|
64
|
+
export declare const TOOL_DEFINITIONS: ({
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: string;
|
|
69
|
+
properties: {
|
|
70
|
+
projectPath: {
|
|
71
|
+
type: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
analysisData?: undefined;
|
|
75
|
+
guidelines?: undefined;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
} | {
|
|
79
|
+
name: string;
|
|
80
|
+
description: string;
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: string;
|
|
83
|
+
properties: {
|
|
84
|
+
projectPath: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
analysisData: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
guidelines?: undefined;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
} | {
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
inputSchema: {
|
|
99
|
+
type: string;
|
|
100
|
+
properties: {
|
|
101
|
+
projectPath: {
|
|
102
|
+
type: string;
|
|
103
|
+
description: string;
|
|
104
|
+
};
|
|
105
|
+
guidelines: {
|
|
106
|
+
type: string;
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
analysisData: {
|
|
110
|
+
type: string;
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
})[];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input validation using Zod
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
/**
|
|
6
|
+
* Schema for project analysis tool input
|
|
7
|
+
*/
|
|
8
|
+
export const AnalyzeProjectInputSchema = z.object({
|
|
9
|
+
projectPath: z.string().optional().describe('Path to the project to analyze'),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Schema for generating copilot instructions
|
|
13
|
+
*/
|
|
14
|
+
export const GenerateCopilotInstructionsInputSchema = z.object({
|
|
15
|
+
projectPath: z.string().optional().describe('Path to the project'),
|
|
16
|
+
analysisData: z.record(z.any()).optional().describe('Previously analyzed project data'),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Schema for updating README
|
|
20
|
+
*/
|
|
21
|
+
export const UpdateReadmeInputSchema = z.object({
|
|
22
|
+
projectPath: z.string().optional().describe('Path to the project'),
|
|
23
|
+
guidelines: z.string().optional().describe('Custom guidelines to add to README'),
|
|
24
|
+
analysisData: z.record(z.any()).optional().describe('Previously analyzed project data'),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Schema for getting project customization recommendations
|
|
28
|
+
*/
|
|
29
|
+
export const GetRecommendationsInputSchema = z.object({
|
|
30
|
+
projectPath: z.string().optional().describe('Path to the project'),
|
|
31
|
+
analysisData: z.record(z.any()).optional().describe('Previously analyzed project data'),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Validate and parse input using provided schema
|
|
35
|
+
*/
|
|
36
|
+
export function validateInput(schema, input) {
|
|
37
|
+
try {
|
|
38
|
+
return schema.parse(input);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof z.ZodError) {
|
|
42
|
+
throw new Error(`Validation failed: ${error.errors.map((e) => e.message).join(', ')}`);
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generate tool definitions for MCP server
|
|
49
|
+
*/
|
|
50
|
+
export const TOOL_DEFINITIONS = [
|
|
51
|
+
{
|
|
52
|
+
name: 'analyze_project',
|
|
53
|
+
description: 'Analyze a VS Code project structure and detect project type, frameworks, languages, and customization opportunities',
|
|
54
|
+
inputSchema: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
projectPath: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Path to the project directory (defaults to current working directory)',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'generate_copilot_instructions',
|
|
66
|
+
description: 'Generate a .github/copilot-instructions.md file based on project analysis and best practices',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
projectPath: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'Path to the project directory',
|
|
73
|
+
},
|
|
74
|
+
analysisData: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
description: 'Previously analyzed project data (from analyze_project tool)',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'update_readme',
|
|
83
|
+
description: 'Update or create README.md with project guidelines and best practices',
|
|
84
|
+
inputSchema: {
|
|
85
|
+
type: 'object',
|
|
86
|
+
properties: {
|
|
87
|
+
projectPath: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: 'Path to the project directory',
|
|
90
|
+
},
|
|
91
|
+
guidelines: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Custom guidelines to include in README',
|
|
94
|
+
},
|
|
95
|
+
analysisData: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
description: 'Previously analyzed project data',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'get_customization_recommendations',
|
|
104
|
+
description: 'Get recommendations for customizing VS Code settings, instruction files, and project guidelines',
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
properties: {
|
|
108
|
+
projectPath: {
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: 'Path to the project directory',
|
|
111
|
+
},
|
|
112
|
+
analysisData: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
description: 'Previously analyzed project data',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/utils/validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;CAC9E,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAClE,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CACxF,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAClE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAChF,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CACxF,CAAC,CAAC;AAEH;;GAEG;AACH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Z,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8DAA8D;iBAC5E;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,uEAAuE;QACpF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,+BAA+B;iBAC7C;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wCAAwC;iBACtD;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kCAAkC;iBAChD;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,mCAAmC;QACzC,WAAW,EAAE,iGAAiG;QAC9G,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,+BAA+B;iBAC7C;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kCAAkC;iBAChD;aACF;SACF;KACF;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "project-customization-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "An MCP server for automating project customization based on best practices. Analyzes projects and generates customization files for any IDE or tool that supports the Model Context Protocol.",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"project-customization-mcp": "./build/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"start": "node ./build/index.js",
|
|
12
|
+
"dev": "tsx watch src/index.ts",
|
|
13
|
+
"prepare": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"build",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"mcp",
|
|
22
|
+
"model-context-protocol",
|
|
23
|
+
"project-customization",
|
|
24
|
+
"code-analysis",
|
|
25
|
+
"project-guidelines",
|
|
26
|
+
"best-practices",
|
|
27
|
+
"ai",
|
|
28
|
+
"llm"
|
|
29
|
+
],
|
|
30
|
+
"author": "Your Name",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"type": "module",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/yourusername/project-customization-mcp.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/yourusername/project-customization-mcp#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/yourusername/project-customization-mcp/issues"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
43
|
+
"zod": "^3.25.76"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^25.0.10",
|
|
47
|
+
"tsx": "^4.21.0",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
}
|
|
50
|
+
}
|