projectpulse-mcp 1.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/LICENSE +21 -0
- package/README.md +73 -0
- package/bin/projectpulse-mcp.js +2 -0
- package/dist/github/client.d.ts +3 -0
- package/dist/github/client.d.ts.map +1 -0
- package/dist/github/client.js +10 -0
- package/dist/github/client.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/scoring/health-score.d.ts +16 -0
- package/dist/scoring/health-score.d.ts.map +1 -0
- package/dist/scoring/health-score.js +80 -0
- package/dist/scoring/health-score.js.map +1 -0
- package/dist/scoring/health-score.test.d.ts +2 -0
- package/dist/scoring/health-score.test.d.ts.map +1 -0
- package/dist/scoring/health-score.test.js +209 -0
- package/dist/scoring/health-score.test.js.map +1 -0
- package/dist/tools/analyze-code-scanning.d.ts +12 -0
- package/dist/tools/analyze-code-scanning.d.ts.map +1 -0
- package/dist/tools/analyze-code-scanning.js +44 -0
- package/dist/tools/analyze-code-scanning.js.map +1 -0
- package/dist/tools/analyze-code-scanning.test.d.ts +2 -0
- package/dist/tools/analyze-code-scanning.test.d.ts.map +1 -0
- package/dist/tools/analyze-code-scanning.test.js +62 -0
- package/dist/tools/analyze-code-scanning.test.js.map +1 -0
- package/dist/tools/analyze-dependencies.d.ts +13 -0
- package/dist/tools/analyze-dependencies.d.ts.map +1 -0
- package/dist/tools/analyze-dependencies.js +31 -0
- package/dist/tools/analyze-dependencies.js.map +1 -0
- package/dist/tools/analyze-dependencies.test.d.ts +2 -0
- package/dist/tools/analyze-dependencies.test.d.ts.map +1 -0
- package/dist/tools/analyze-dependencies.test.js +65 -0
- package/dist/tools/analyze-dependencies.test.js.map +1 -0
- package/dist/tools/check-ci-status.d.ts +13 -0
- package/dist/tools/check-ci-status.d.ts.map +1 -0
- package/dist/tools/check-ci-status.js +32 -0
- package/dist/tools/check-ci-status.js.map +1 -0
- package/dist/tools/check-ci-status.test.d.ts +2 -0
- package/dist/tools/check-ci-status.test.d.ts.map +1 -0
- package/dist/tools/check-ci-status.test.js +90 -0
- package/dist/tools/check-ci-status.test.js.map +1 -0
- package/dist/tools/get-health-score.d.ts +12 -0
- package/dist/tools/get-health-score.d.ts.map +1 -0
- package/dist/tools/get-health-score.js +47 -0
- package/dist/tools/get-health-score.js.map +1 -0
- package/dist/tools/get-health-score.test.d.ts +2 -0
- package/dist/tools/get-health-score.test.d.ts.map +1 -0
- package/dist/tools/get-health-score.test.js +93 -0
- package/dist/tools/get-health-score.test.js.map +1 -0
- package/dist/tools/get-repo-health.d.ts +12 -0
- package/dist/tools/get-repo-health.d.ts.map +1 -0
- package/dist/tools/get-repo-health.js +49 -0
- package/dist/tools/get-repo-health.js.map +1 -0
- package/dist/tools/get-repo-health.test.d.ts +2 -0
- package/dist/tools/get-repo-health.test.d.ts.map +1 -0
- package/dist/tools/get-repo-health.test.js +80 -0
- package/dist/tools/get-repo-health.test.js.map +1 -0
- package/dist/types/health.d.ts +16 -0
- package/dist/types/health.d.ts.map +1 -0
- package/dist/types/health.js +2 -0
- package/dist/types/health.js.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +7 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { getOctokit } from '../github/client.js';
|
|
3
|
+
import { executeGetRepoHealth } from './get-repo-health.js';
|
|
4
|
+
// Mock intero modulo
|
|
5
|
+
vi.mock('../github/client.js');
|
|
6
|
+
describe('executeGetRepoHealth', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
vi.resetAllMocks(); // pulisci mock tra un test e l'altro
|
|
9
|
+
});
|
|
10
|
+
it('should return repo data for valid repo', async () => {
|
|
11
|
+
// 1. Configura mock: getOctokit() ritorna oggetto con repos.get()
|
|
12
|
+
const mockReposGet = vi.fn().mockResolvedValue({
|
|
13
|
+
data: {
|
|
14
|
+
full_name: 'test/repo',
|
|
15
|
+
description: 'test description',
|
|
16
|
+
stargazers_count: 100,
|
|
17
|
+
open_issues_count: 5,
|
|
18
|
+
language: 'TypeScript',
|
|
19
|
+
license: { spdx_id: 'MIT' },
|
|
20
|
+
pushed_at: '2023-10-01T00:00:00Z',
|
|
21
|
+
default_branch: 'main',
|
|
22
|
+
archived: false,
|
|
23
|
+
forks_count: 10
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
vi.mocked(getOctokit).mockReturnValue({
|
|
27
|
+
repos: { get: mockReposGet }
|
|
28
|
+
});
|
|
29
|
+
// 2. Chiama il tool
|
|
30
|
+
const result = await executeGetRepoHealth({ owner: 'test', repo: 'repo' });
|
|
31
|
+
// 3. Verifica output
|
|
32
|
+
expect(mockReposGet).toHaveBeenCalledWith({ owner: 'test', repo: 'repo' });
|
|
33
|
+
expect(result.content).toHaveLength(1);
|
|
34
|
+
expect(result.content[0].type).toBe('text');
|
|
35
|
+
const parsedText = JSON.parse(result.content[0].text);
|
|
36
|
+
expect(parsedText).toEqual({
|
|
37
|
+
full_name: 'test/repo',
|
|
38
|
+
description: 'test description',
|
|
39
|
+
stargazers_count: 100,
|
|
40
|
+
open_issues_count: 5,
|
|
41
|
+
language: 'TypeScript',
|
|
42
|
+
license: 'MIT',
|
|
43
|
+
pushed_at: '2023-10-01T00:00:00Z',
|
|
44
|
+
default_branch: 'main',
|
|
45
|
+
archived: false,
|
|
46
|
+
forks_count: 10
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
it('should handle 404 for non-existent repo', async () => {
|
|
50
|
+
// 1. Configura mock: repos.get() lancia errore con status 404
|
|
51
|
+
const notFoundError = new Error('Not Found');
|
|
52
|
+
notFoundError.status = 404;
|
|
53
|
+
const mockReposGet = vi.fn().mockRejectedValue(notFoundError);
|
|
54
|
+
vi.mocked(getOctokit).mockReturnValue({
|
|
55
|
+
repos: { get: mockReposGet }
|
|
56
|
+
});
|
|
57
|
+
// 2. Chiama il tool
|
|
58
|
+
const result = await executeGetRepoHealth({ owner: 'test', repo: 'not-found' });
|
|
59
|
+
// 3. Verifica che ritorna messaggio errore, non throw
|
|
60
|
+
expect(result.content).toHaveLength(1);
|
|
61
|
+
expect(result.content[0].type).toBe('text');
|
|
62
|
+
const parsedText = JSON.parse(result.content[0].text);
|
|
63
|
+
expect(parsedText).toEqual({
|
|
64
|
+
error: "Repository not found",
|
|
65
|
+
details: "Not Found"
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
it('should throw error for non-404 errors', async () => {
|
|
69
|
+
const serverError = new Error('Internal Server Error');
|
|
70
|
+
serverError.status = 500;
|
|
71
|
+
const mockReposGet = vi.fn().mockRejectedValue(serverError);
|
|
72
|
+
vi.mocked(getOctokit).mockReturnValue({
|
|
73
|
+
repos: { get: mockReposGet }
|
|
74
|
+
});
|
|
75
|
+
await expect(executeGetRepoHealth({ owner: 'test', repo: 'error-repo' }))
|
|
76
|
+
.rejects
|
|
77
|
+
.toThrow('Internal Server Error');
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=get-repo-health.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-repo-health.test.js","sourceRoot":"","sources":["../../src/tools/get-repo-health.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,qBAAqB;AACrB,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAE/B,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE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YACvB,KAAK,EAAE,sBAAsB;YAC7B,OAAO,EAAE,WAAW;SACvB,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,WAAW,GAAG,IAAI,KAAK,CAAC,uBAAuB,CAAQ,CAAC;QAC9D,WAAW,CAAC,MAAM,GAAG,GAAG,CAAC;QAEzB,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAE5D,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC;YAClC,KAAK,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE;SACxB,CAAC,CAAC;QAEV,MAAM,MAAM,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;aACpE,OAAO;aACP,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type Grade = 'A' | 'B' | 'C' | 'D' | 'F';
|
|
2
|
+
type CategoryScore = {
|
|
3
|
+
score: number;
|
|
4
|
+
weight: number;
|
|
5
|
+
detail: string;
|
|
6
|
+
};
|
|
7
|
+
type HealthReport = {
|
|
8
|
+
repo: string;
|
|
9
|
+
score: number;
|
|
10
|
+
grade: Grade;
|
|
11
|
+
breakdown: Record<string, CategoryScore>;
|
|
12
|
+
suggestions: string[];
|
|
13
|
+
checkedAt: string;
|
|
14
|
+
};
|
|
15
|
+
export { Grade, CategoryScore, HealthReport };
|
|
16
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/types/health.ts"],"names":[],"mappings":"AACA,KAAK,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAGzC,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAA;AAGD,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/types/health.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../src/vitest.config.ts"],"names":[],"mappings":";AAEA,wBAIG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../src/vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IACxB,IAAI,EAAE;QACF,OAAO,EAAE,IAAI;KAChB;CACJ,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "projectpulse-mcp",
|
|
3
|
+
"description": "MCP Server for GitHub repository health monitoring",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "vitest run",
|
|
8
|
+
"test:watch": "vitest",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"lint": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"github",
|
|
15
|
+
"health",
|
|
16
|
+
"monitoring",
|
|
17
|
+
"ai"
|
|
18
|
+
],
|
|
19
|
+
"author": "Alessandro Chiodo",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
24
|
+
"@octokit/rest": "^22.0.1",
|
|
25
|
+
"dotenv": "^17.4.2",
|
|
26
|
+
"zod": "^4.4.3"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^26.4.0",
|
|
30
|
+
"tsx": "^4.23.12",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"vitest": "^4.1.11"
|
|
33
|
+
},
|
|
34
|
+
"bin": {
|
|
35
|
+
"projectpulse-mcp": "./bin/projectpulse-mcp.js"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"bin"
|
|
40
|
+
]
|
|
41
|
+
}
|