@prodbeam/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/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +208 -0
- package/dist/CLAUDE.md +7 -0
- package/dist/adapters/github-mcp.d.ts +25 -0
- package/dist/adapters/github-mcp.d.ts.map +1 -0
- package/dist/adapters/github-mcp.js +307 -0
- package/dist/adapters/github-mcp.js.map +1 -0
- package/dist/adapters/jira-mcp.d.ts +14 -0
- package/dist/adapters/jira-mcp.d.ts.map +1 -0
- package/dist/adapters/jira-mcp.js +159 -0
- package/dist/adapters/jira-mcp.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +256 -0
- package/dist/cli.js.map +1 -0
- package/dist/clients/github-client.d.ts +29 -0
- package/dist/clients/github-client.d.ts.map +1 -0
- package/dist/clients/github-client.js +116 -0
- package/dist/clients/github-client.js.map +1 -0
- package/dist/clients/jira-client.d.ts +30 -0
- package/dist/clients/jira-client.d.ts.map +1 -0
- package/dist/clients/jira-client.js +115 -0
- package/dist/clients/jira-client.js.map +1 -0
- package/dist/clients/types.d.ts +155 -0
- package/dist/clients/types.d.ts.map +1 -0
- package/dist/clients/types.js +2 -0
- package/dist/clients/types.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +426 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/prompt.d.ts +18 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/prompt.js +122 -0
- package/dist/commands/prompt.js.map +1 -0
- package/dist/config/credentials.d.ts +9 -0
- package/dist/config/credentials.d.ts.map +1 -0
- package/dist/config/credentials.js +87 -0
- package/dist/config/credentials.js.map +1 -0
- package/dist/config/paths.d.ts +6 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +31 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/team-config.d.ts +204 -0
- package/dist/config/team-config.d.ts.map +1 -0
- package/dist/config/team-config.js +86 -0
- package/dist/config/team-config.js.map +1 -0
- package/dist/config/thresholds.d.ts +15 -0
- package/dist/config/thresholds.d.ts.map +1 -0
- package/dist/config/thresholds.js +18 -0
- package/dist/config/thresholds.js.map +1 -0
- package/dist/config/types.d.ts +42 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/discovery/github-discovery.d.ts +4 -0
- package/dist/discovery/github-discovery.d.ts.map +1 -0
- package/dist/discovery/github-discovery.js +46 -0
- package/dist/discovery/github-discovery.js.map +1 -0
- package/dist/discovery/jira-discovery.d.ts +4 -0
- package/dist/discovery/jira-discovery.d.ts.map +1 -0
- package/dist/discovery/jira-discovery.js +68 -0
- package/dist/discovery/jira-discovery.js.map +1 -0
- package/dist/discovery/types.d.ts +40 -0
- package/dist/discovery/types.d.ts.map +1 -0
- package/dist/discovery/types.js +2 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/generators/metrics-calculator.d.ts +5 -0
- package/dist/generators/metrics-calculator.d.ts.map +1 -0
- package/dist/generators/metrics-calculator.js +101 -0
- package/dist/generators/metrics-calculator.js.map +1 -0
- package/dist/generators/report-generator.d.ts +25 -0
- package/dist/generators/report-generator.d.ts.map +1 -0
- package/dist/generators/report-generator.js +375 -0
- package/dist/generators/report-generator.js.map +1 -0
- package/dist/generators/sprint-analyzer.d.ts +5 -0
- package/dist/generators/sprint-analyzer.d.ts.map +1 -0
- package/dist/generators/sprint-analyzer.js +88 -0
- package/dist/generators/sprint-analyzer.js.map +1 -0
- package/dist/history/history-store.d.ts +15 -0
- package/dist/history/history-store.d.ts.map +1 -0
- package/dist/history/history-store.js +197 -0
- package/dist/history/history-store.js.map +1 -0
- package/dist/history/snapshot-builder.d.ts +15 -0
- package/dist/history/snapshot-builder.d.ts.map +1 -0
- package/dist/history/snapshot-builder.js +45 -0
- package/dist/history/snapshot-builder.js.map +1 -0
- package/dist/history/types.d.ts +33 -0
- package/dist/history/types.d.ts.map +1 -0
- package/dist/history/types.js +2 -0
- package/dist/history/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +797 -0
- package/dist/index.js.map +1 -0
- package/dist/insights/anomaly-detector.d.ts +28 -0
- package/dist/insights/anomaly-detector.d.ts.map +1 -0
- package/dist/insights/anomaly-detector.js +154 -0
- package/dist/insights/anomaly-detector.js.map +1 -0
- package/dist/insights/team-health.d.ts +24 -0
- package/dist/insights/team-health.d.ts.map +1 -0
- package/dist/insights/team-health.js +151 -0
- package/dist/insights/team-health.js.map +1 -0
- package/dist/insights/trend-analyzer.d.ts +5 -0
- package/dist/insights/trend-analyzer.d.ts.map +1 -0
- package/dist/insights/trend-analyzer.js +79 -0
- package/dist/insights/trend-analyzer.js.map +1 -0
- package/dist/insights/types.d.ts +10 -0
- package/dist/insights/types.d.ts.map +1 -0
- package/dist/insights/types.js +2 -0
- package/dist/insights/types.js.map +1 -0
- package/dist/orchestrator/data-fetcher.d.ts +16 -0
- package/dist/orchestrator/data-fetcher.d.ts.map +1 -0
- package/dist/orchestrator/data-fetcher.js +169 -0
- package/dist/orchestrator/data-fetcher.js.map +1 -0
- package/dist/orchestrator/time-range.d.ts +8 -0
- package/dist/orchestrator/time-range.d.ts.map +1 -0
- package/dist/orchestrator/time-range.js +27 -0
- package/dist/orchestrator/time-range.js.map +1 -0
- package/dist/types/github.d.ts +40 -0
- package/dist/types/github.d.ts.map +1 -0
- package/dist/types/github.js +2 -0
- package/dist/types/github.js.map +1 -0
- package/dist/types/jira.d.ts +18 -0
- package/dist/types/jira.d.ts.map +1 -0
- package/dist/types/jira.js +2 -0
- package/dist/types/jira.js.map +1 -0
- package/dist/types/retrospective.d.ts +38 -0
- package/dist/types/retrospective.d.ts.map +1 -0
- package/dist/types/retrospective.js +2 -0
- package/dist/types/retrospective.js.map +1 -0
- package/dist/types/weekly.d.ts +41 -0
- package/dist/types/weekly.d.ts.map +1 -0
- package/dist/types/weekly.js +2 -0
- package/dist/types/weekly.js.map +1 -0
- package/dist/validators.d.ts +236 -0
- package/dist/validators.d.ts.map +1 -0
- package/dist/validators.js +62 -0
- package/dist/validators.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export async function discoverJiraTeam(client, emails, host) {
|
|
2
|
+
const [members, apiProjects] = await Promise.all([
|
|
3
|
+
Promise.all(emails.map((email) => discoverJiraMember(client, email))),
|
|
4
|
+
client.getProjects().catch(() => []),
|
|
5
|
+
]);
|
|
6
|
+
const projects = apiProjects.map((p) => ({
|
|
7
|
+
key: p.key,
|
|
8
|
+
name: p.name,
|
|
9
|
+
}));
|
|
10
|
+
const activeSprints = await discoverActiveSprints(client, projects);
|
|
11
|
+
return {
|
|
12
|
+
members,
|
|
13
|
+
projects,
|
|
14
|
+
activeSprints,
|
|
15
|
+
host,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function discoverJiraMember(client, email) {
|
|
19
|
+
const result = {
|
|
20
|
+
email,
|
|
21
|
+
accountId: null,
|
|
22
|
+
displayName: null,
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
const user = await client.searchUserByEmail(email);
|
|
26
|
+
if (user) {
|
|
27
|
+
result.accountId = user.accountId;
|
|
28
|
+
result.displayName = user.displayName;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
result.error = `No Jira user found for ${email}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
result.error = error instanceof Error ? error.message : 'Unknown error';
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
async function discoverActiveSprints(client, projects) {
|
|
40
|
+
const sprintMap = new Map();
|
|
41
|
+
for (const project of projects) {
|
|
42
|
+
try {
|
|
43
|
+
const boards = await client.getBoards(project.key);
|
|
44
|
+
for (const board of boards) {
|
|
45
|
+
try {
|
|
46
|
+
const sprints = await client.getSprints(board.id, 'active');
|
|
47
|
+
for (const sprint of sprints) {
|
|
48
|
+
if (!sprintMap.has(sprint.id)) {
|
|
49
|
+
sprintMap.set(sprint.id, {
|
|
50
|
+
id: sprint.id,
|
|
51
|
+
name: sprint.name,
|
|
52
|
+
state: sprint.state,
|
|
53
|
+
startDate: sprint.startDate,
|
|
54
|
+
endDate: sprint.endDate,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return Array.from(sprintMap.values());
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=jira-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jira-discovery.js","sourceRoot":"","sources":["../../src/discovery/jira-discovery.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAkB,EAClB,MAAgB,EAChB,IAAY;IAGZ,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;KACrC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAA2B,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/D,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,IAAI,EAAE,CAAC,CAAC,IAAI;KACb,CAAC,CAAC,CAAC;IA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Q,CAAC,CAAC;oBAC5D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;wBAC7B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;4BAC9B,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE;gCACvB,EAAE,EAAE,MAAM,CAAC,EAAE;gCACb,IAAI,EAAE,MAAM,CAAC,IAAI;gCACjB,KAAK,EAAE,MAAM,CAAC,KAAK;gCACnB,SAAS,EAAE,MAAM,CAAC,SAAS;gCAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;6BACxB,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;gBAET,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;QAET,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface GitHubMemberDiscovery {
|
|
2
|
+
email: string;
|
|
3
|
+
username: string | null;
|
|
4
|
+
orgs: string[];
|
|
5
|
+
repos: string[];
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface JiraMemberDiscovery {
|
|
9
|
+
email: string;
|
|
10
|
+
accountId: string | null;
|
|
11
|
+
displayName: string | null;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GitHubTeamDiscovery {
|
|
15
|
+
members: GitHubMemberDiscovery[];
|
|
16
|
+
orgs: string[];
|
|
17
|
+
repos: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface JiraProjectDiscovery {
|
|
20
|
+
key: string;
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
export interface JiraSprintDiscovery {
|
|
24
|
+
id: number;
|
|
25
|
+
name: string;
|
|
26
|
+
state: 'active' | 'closed' | 'future';
|
|
27
|
+
startDate?: string;
|
|
28
|
+
endDate?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface JiraTeamDiscovery {
|
|
31
|
+
members: JiraMemberDiscovery[];
|
|
32
|
+
projects: JiraProjectDiscovery[];
|
|
33
|
+
activeSprints: JiraSprintDiscovery[];
|
|
34
|
+
host: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TeamDiscoveryResult {
|
|
37
|
+
github: GitHubTeamDiscovery;
|
|
38
|
+
jira: JiraTeamDiscovery | null;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/discovery/types.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,qBAAqB,EAAE,CAAC;IAEjC,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAGD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAE/B,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IAEjC,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/discovery/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GitHubActivity } from '../types/github.js';
|
|
2
|
+
import type { JiraActivity } from '../types/jira.js';
|
|
3
|
+
import type { WeeklyMetrics } from '../types/weekly.js';
|
|
4
|
+
export declare function calculateWeeklyMetrics(github: GitHubActivity, jira?: JiraActivity): WeeklyMetrics;
|
|
5
|
+
//# sourceMappingURL=metrics-calculator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-calculator.d.ts","sourceRoot":"","sources":["../../src/generators/metrics-calculator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAkC,MAAM,oBAAoB,CAAC;AAKxF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,aAAa,CA+FjG"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export function calculateWeeklyMetrics(github, jira) {
|
|
2
|
+
const repoMap = new Map();
|
|
3
|
+
const getRepo = (repo) => {
|
|
4
|
+
let entry = repoMap.get(repo);
|
|
5
|
+
if (!entry) {
|
|
6
|
+
entry = {
|
|
7
|
+
repo,
|
|
8
|
+
commits: 0,
|
|
9
|
+
pullRequests: 0,
|
|
10
|
+
merged: 0,
|
|
11
|
+
additions: 0,
|
|
12
|
+
deletions: 0,
|
|
13
|
+
reviews: 0,
|
|
14
|
+
};
|
|
15
|
+
repoMap.set(repo, entry);
|
|
16
|
+
}
|
|
17
|
+
return entry;
|
|
18
|
+
};
|
|
19
|
+
for (const c of github.commits) {
|
|
20
|
+
getRepo(c.repo).commits++;
|
|
21
|
+
}
|
|
22
|
+
let prOpen = 0;
|
|
23
|
+
let prMerged = 0;
|
|
24
|
+
let prClosed = 0;
|
|
25
|
+
let totalAdditions = 0;
|
|
26
|
+
let totalDeletions = 0;
|
|
27
|
+
for (const pr of github.pullRequests) {
|
|
28
|
+
const r = getRepo(pr.repo);
|
|
29
|
+
r.pullRequests++;
|
|
30
|
+
if (pr.state === 'merged') {
|
|
31
|
+
prMerged++;
|
|
32
|
+
r.merged++;
|
|
33
|
+
}
|
|
34
|
+
else if (pr.state === 'open') {
|
|
35
|
+
prOpen++;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
prClosed++;
|
|
39
|
+
}
|
|
40
|
+
totalAdditions += pr.additions ?? 0;
|
|
41
|
+
totalDeletions += pr.deletions ?? 0;
|
|
42
|
+
r.additions += pr.additions ?? 0;
|
|
43
|
+
r.deletions += pr.deletions ?? 0;
|
|
44
|
+
}
|
|
45
|
+
let approved = 0;
|
|
46
|
+
let changesRequested = 0;
|
|
47
|
+
let commented = 0;
|
|
48
|
+
for (const rev of github.reviews) {
|
|
49
|
+
getRepo(rev.repo).reviews++;
|
|
50
|
+
if (rev.state === 'APPROVED')
|
|
51
|
+
approved++;
|
|
52
|
+
else if (rev.state === 'CHANGES_REQUESTED')
|
|
53
|
+
changesRequested++;
|
|
54
|
+
else
|
|
55
|
+
commented++;
|
|
56
|
+
}
|
|
57
|
+
const repoBreakdown = Array.from(repoMap.values()).sort((a, b) => {
|
|
58
|
+
const totalA = a.commits + a.pullRequests + a.reviews;
|
|
59
|
+
const totalB = b.commits + b.pullRequests + b.reviews;
|
|
60
|
+
return totalB - totalA;
|
|
61
|
+
});
|
|
62
|
+
const metrics = {
|
|
63
|
+
totalCommits: github.commits.length,
|
|
64
|
+
pullRequests: {
|
|
65
|
+
total: github.pullRequests.length,
|
|
66
|
+
open: prOpen,
|
|
67
|
+
merged: prMerged,
|
|
68
|
+
closed: prClosed,
|
|
69
|
+
},
|
|
70
|
+
additions: totalAdditions,
|
|
71
|
+
deletions: totalDeletions,
|
|
72
|
+
reviews: {
|
|
73
|
+
total: github.reviews.length,
|
|
74
|
+
approved,
|
|
75
|
+
changesRequested,
|
|
76
|
+
commented,
|
|
77
|
+
},
|
|
78
|
+
repoBreakdown,
|
|
79
|
+
};
|
|
80
|
+
if (jira && jira.issues.length > 0) {
|
|
81
|
+
metrics.jira = calculateJiraMetrics(jira);
|
|
82
|
+
}
|
|
83
|
+
return metrics;
|
|
84
|
+
}
|
|
85
|
+
function calculateJiraMetrics(jira) {
|
|
86
|
+
const byStatus = {};
|
|
87
|
+
const byPriority = {};
|
|
88
|
+
const byType = {};
|
|
89
|
+
for (const issue of jira.issues) {
|
|
90
|
+
byStatus[issue.status] = (byStatus[issue.status] ?? 0) + 1;
|
|
91
|
+
byPriority[issue.priority] = (byPriority[issue.priority] ?? 0) + 1;
|
|
92
|
+
byType[issue.issueType] = (byType[issue.issueType] ?? 0) + 1;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
totalIssues: jira.issues.length,
|
|
96
|
+
byStatus,
|
|
97
|
+
byPriority,
|
|
98
|
+
byType,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=metrics-calculator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-calculator.js","sourceRoot":"","sources":["../../src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C;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GitHubActivity } from '../types/github.js';
|
|
2
|
+
import type { JiraActivity } from '../types/jira.js';
|
|
3
|
+
import type { WeeklyReportInput } from '../types/weekly.js';
|
|
4
|
+
import type { RetroReportInput } from '../types/retrospective.js';
|
|
5
|
+
import type { TrendInsight } from '../insights/types.js';
|
|
6
|
+
import type { Anomaly } from '../insights/anomaly-detector.js';
|
|
7
|
+
import type { TeamHealthReport } from '../insights/team-health.js';
|
|
8
|
+
export interface ReportExtras {
|
|
9
|
+
trends?: TrendInsight[];
|
|
10
|
+
anomalies?: Anomaly[];
|
|
11
|
+
health?: TeamHealthReport;
|
|
12
|
+
}
|
|
13
|
+
interface DailyReportInput {
|
|
14
|
+
github: GitHubActivity;
|
|
15
|
+
jira?: JiraActivity;
|
|
16
|
+
}
|
|
17
|
+
export declare function generateDailyReport(input: DailyReportInput): string;
|
|
18
|
+
export declare function generateTeamDailyReport(memberActivities: Array<{
|
|
19
|
+
github: GitHubActivity;
|
|
20
|
+
jira?: JiraActivity;
|
|
21
|
+
}>, teamName: string): string;
|
|
22
|
+
export declare function generateWeeklyReport(input: WeeklyReportInput, extras?: ReportExtras): string;
|
|
23
|
+
export declare function generateRetrospective(input: RetroReportInput, extras?: ReportExtras): string;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=report-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generator.d.ts","sourceRoot":"","sources":["../../src/generators/report-generator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,UAAU,gBAAgB;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAKD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CA6DnE;AAKD,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,IAAI,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC,EACxE,QAAQ,EAAE,MAAM,GACf,MAAM,CA8FR;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAwH5F;AAMD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAgH5F"}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { calculateWeeklyMetrics } from './metrics-calculator.js';
|
|
2
|
+
import { analyzeSprintActivity } from './sprint-analyzer.js';
|
|
3
|
+
export function generateDailyReport(input) {
|
|
4
|
+
const { github, jira } = input;
|
|
5
|
+
const today = new Date().toLocaleDateString('en-US', {
|
|
6
|
+
weekday: 'long',
|
|
7
|
+
year: 'numeric',
|
|
8
|
+
month: 'long',
|
|
9
|
+
day: 'numeric',
|
|
10
|
+
});
|
|
11
|
+
const parts = [];
|
|
12
|
+
parts.push(`# Daily Standup - ${today}`);
|
|
13
|
+
parts.push('');
|
|
14
|
+
parts.push(`## GitHub Activity (Last 24 Hours) - ${github.username}`);
|
|
15
|
+
parts.push('');
|
|
16
|
+
parts.push(`### Commits: ${github.commits.length}`);
|
|
17
|
+
if (github.commits.length > 0) {
|
|
18
|
+
for (const c of github.commits) {
|
|
19
|
+
parts.push(`- \`${c.sha}\` ${c.message} (${c.repo})`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
parts.push('_No commits_');
|
|
24
|
+
}
|
|
25
|
+
parts.push('');
|
|
26
|
+
parts.push(`### Pull Requests: ${github.pullRequests.length}`);
|
|
27
|
+
if (github.pullRequests.length > 0) {
|
|
28
|
+
for (const pr of github.pullRequests) {
|
|
29
|
+
parts.push(`- #${pr.number}: ${pr.title} [${pr.state}]`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
parts.push('_No pull requests_');
|
|
34
|
+
}
|
|
35
|
+
parts.push('');
|
|
36
|
+
parts.push(`### Reviews: ${github.reviews.length}`);
|
|
37
|
+
if (github.reviews.length > 0) {
|
|
38
|
+
for (const r of github.reviews) {
|
|
39
|
+
parts.push(`- PR #${r.pullRequestNumber}: ${r.pullRequestTitle} [${r.state}]`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
parts.push('_No reviews_');
|
|
44
|
+
}
|
|
45
|
+
if (jira && jira.issues.length > 0) {
|
|
46
|
+
parts.push('');
|
|
47
|
+
parts.push(`### Jira Issues: ${jira.issues.length}`);
|
|
48
|
+
for (const issue of jira.issues) {
|
|
49
|
+
const link = issue.url ? `[${issue.key}](${issue.url})` : issue.key;
|
|
50
|
+
parts.push(`- ${link}: ${issue.summary} [${issue.status}]`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
parts.push('');
|
|
54
|
+
parts.push('---');
|
|
55
|
+
return parts.join('\n');
|
|
56
|
+
}
|
|
57
|
+
export function generateTeamDailyReport(memberActivities, teamName) {
|
|
58
|
+
const today = new Date().toLocaleDateString('en-US', {
|
|
59
|
+
weekday: 'long',
|
|
60
|
+
year: 'numeric',
|
|
61
|
+
month: 'long',
|
|
62
|
+
day: 'numeric',
|
|
63
|
+
});
|
|
64
|
+
const parts = [];
|
|
65
|
+
parts.push(`# Team Standup: ${teamName} - ${today}`);
|
|
66
|
+
parts.push('');
|
|
67
|
+
let totalCommits = 0;
|
|
68
|
+
let totalPRs = 0;
|
|
69
|
+
let totalReviews = 0;
|
|
70
|
+
let totalIssues = 0;
|
|
71
|
+
for (const { github, jira } of memberActivities) {
|
|
72
|
+
totalCommits += github.commits.length;
|
|
73
|
+
totalPRs += github.pullRequests.length;
|
|
74
|
+
totalReviews += github.reviews.length;
|
|
75
|
+
if (jira)
|
|
76
|
+
totalIssues += jira.issues.length;
|
|
77
|
+
}
|
|
78
|
+
parts.push('## Summary');
|
|
79
|
+
parts.push('');
|
|
80
|
+
parts.push(`| Metric | Count |`);
|
|
81
|
+
parts.push(`|--------|-------|`);
|
|
82
|
+
parts.push(`| Team Members | ${memberActivities.length} |`);
|
|
83
|
+
parts.push(`| Total Commits | ${totalCommits} |`);
|
|
84
|
+
parts.push(`| Total PRs | ${totalPRs} |`);
|
|
85
|
+
parts.push(`| Total Reviews | ${totalReviews} |`);
|
|
86
|
+
if (totalIssues > 0) {
|
|
87
|
+
parts.push(`| Total Jira Issues | ${totalIssues} |`);
|
|
88
|
+
}
|
|
89
|
+
parts.push('');
|
|
90
|
+
for (const { github, jira } of memberActivities) {
|
|
91
|
+
parts.push(`## ${github.username}`);
|
|
92
|
+
parts.push('');
|
|
93
|
+
if (github.commits.length > 0) {
|
|
94
|
+
parts.push(`**Commits:** ${github.commits.length}`);
|
|
95
|
+
for (const c of github.commits) {
|
|
96
|
+
parts.push(`- \`${c.sha}\` ${c.message} (${c.repo})`);
|
|
97
|
+
}
|
|
98
|
+
parts.push('');
|
|
99
|
+
}
|
|
100
|
+
if (github.pullRequests.length > 0) {
|
|
101
|
+
parts.push(`**Pull Requests:** ${github.pullRequests.length}`);
|
|
102
|
+
for (const pr of github.pullRequests) {
|
|
103
|
+
parts.push(`- #${pr.number}: ${pr.title} [${pr.state}]`);
|
|
104
|
+
}
|
|
105
|
+
parts.push('');
|
|
106
|
+
}
|
|
107
|
+
if (github.reviews.length > 0) {
|
|
108
|
+
parts.push(`**Reviews:** ${github.reviews.length}`);
|
|
109
|
+
for (const r of github.reviews) {
|
|
110
|
+
parts.push(`- PR #${r.pullRequestNumber}: ${r.pullRequestTitle} [${r.state}]`);
|
|
111
|
+
}
|
|
112
|
+
parts.push('');
|
|
113
|
+
}
|
|
114
|
+
if (jira && jira.issues.length > 0) {
|
|
115
|
+
parts.push(`**Jira Issues:** ${jira.issues.length}`);
|
|
116
|
+
for (const issue of jira.issues) {
|
|
117
|
+
const link = issue.url ? `[${issue.key}](${issue.url})` : issue.key;
|
|
118
|
+
parts.push(`- ${link}: ${issue.summary} [${issue.status}]`);
|
|
119
|
+
}
|
|
120
|
+
parts.push('');
|
|
121
|
+
}
|
|
122
|
+
if (github.commits.length === 0 &&
|
|
123
|
+
github.pullRequests.length === 0 &&
|
|
124
|
+
github.reviews.length === 0 &&
|
|
125
|
+
(!jira || jira.issues.length === 0)) {
|
|
126
|
+
parts.push('_No activity in the last 24 hours_');
|
|
127
|
+
parts.push('');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
parts.push('---');
|
|
131
|
+
return parts.join('\n');
|
|
132
|
+
}
|
|
133
|
+
export function generateWeeklyReport(input, extras) {
|
|
134
|
+
const { github, jira } = input;
|
|
135
|
+
const trends = extras?.trends;
|
|
136
|
+
const anomalies = extras?.anomalies;
|
|
137
|
+
const health = extras?.health;
|
|
138
|
+
const metrics = calculateWeeklyMetrics(github, jira);
|
|
139
|
+
const endDate = new Date().toLocaleDateString('en-US', {
|
|
140
|
+
weekday: 'long',
|
|
141
|
+
year: 'numeric',
|
|
142
|
+
month: 'long',
|
|
143
|
+
day: 'numeric',
|
|
144
|
+
});
|
|
145
|
+
const parts = [];
|
|
146
|
+
parts.push(`# Weekly Engineering Summary - ${endDate}`);
|
|
147
|
+
parts.push('');
|
|
148
|
+
parts.push(`## GitHub Activity (Last 7 Days) - ${github.username}`);
|
|
149
|
+
parts.push('');
|
|
150
|
+
parts.push('### Metrics');
|
|
151
|
+
parts.push('');
|
|
152
|
+
parts.push('| Metric | Count |');
|
|
153
|
+
parts.push('|--------|-------|');
|
|
154
|
+
parts.push(`| Commits | ${metrics.totalCommits} |`);
|
|
155
|
+
parts.push(`| Pull Requests | ${metrics.pullRequests.total} (${metrics.pullRequests.open} open, ${metrics.pullRequests.merged} merged, ${metrics.pullRequests.closed} closed) |`);
|
|
156
|
+
parts.push(`| Code Changes | +${metrics.additions}/-${metrics.deletions} |`);
|
|
157
|
+
parts.push(`| Reviews | ${metrics.reviews.total} (${metrics.reviews.approved} approved, ${metrics.reviews.changesRequested} changes requested) |`);
|
|
158
|
+
parts.push('');
|
|
159
|
+
if (metrics.repoBreakdown.length > 0) {
|
|
160
|
+
parts.push('### Repository Breakdown');
|
|
161
|
+
parts.push('');
|
|
162
|
+
parts.push('| Repository | Commits | PRs | Merged | +/- | Reviews |');
|
|
163
|
+
parts.push('|------------|---------|-----|--------|-----|---------|');
|
|
164
|
+
for (const r of metrics.repoBreakdown) {
|
|
165
|
+
parts.push(`| ${r.repo} | ${r.commits} | ${r.pullRequests} | ${r.merged} | +${r.additions}/-${r.deletions} | ${r.reviews} |`);
|
|
166
|
+
}
|
|
167
|
+
parts.push('');
|
|
168
|
+
}
|
|
169
|
+
parts.push(`### Commits: ${github.commits.length}`);
|
|
170
|
+
if (github.commits.length > 0) {
|
|
171
|
+
for (const c of github.commits) {
|
|
172
|
+
parts.push(`- \`${c.sha}\` ${c.message} (${c.repo})`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
parts.push('_No commits_');
|
|
177
|
+
}
|
|
178
|
+
parts.push('');
|
|
179
|
+
parts.push(`### Pull Requests: ${github.pullRequests.length}`);
|
|
180
|
+
if (github.pullRequests.length > 0) {
|
|
181
|
+
for (const pr of github.pullRequests) {
|
|
182
|
+
const stats = pr.additions !== undefined ? ` (+${pr.additions}/-${pr.deletions})` : '';
|
|
183
|
+
parts.push(`- #${pr.number}: ${pr.title} [${pr.state}]${stats}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
parts.push('_No pull requests_');
|
|
188
|
+
}
|
|
189
|
+
parts.push('');
|
|
190
|
+
parts.push(`### Reviews: ${github.reviews.length}`);
|
|
191
|
+
if (github.reviews.length > 0) {
|
|
192
|
+
for (const r of github.reviews) {
|
|
193
|
+
parts.push(`- PR #${r.pullRequestNumber}: ${r.pullRequestTitle} [${r.state}]`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
parts.push('_No reviews_');
|
|
198
|
+
}
|
|
199
|
+
if (jira && jira.issues.length > 0 && metrics.jira) {
|
|
200
|
+
parts.push('');
|
|
201
|
+
parts.push(`### Jira Issues: ${metrics.jira.totalIssues}`);
|
|
202
|
+
parts.push('');
|
|
203
|
+
parts.push('| Status | Count |');
|
|
204
|
+
parts.push('|--------|-------|');
|
|
205
|
+
for (const [status, count] of Object.entries(metrics.jira.byStatus)) {
|
|
206
|
+
parts.push(`| ${status} | ${count} |`);
|
|
207
|
+
}
|
|
208
|
+
parts.push('');
|
|
209
|
+
for (const issue of jira.issues) {
|
|
210
|
+
const link = issue.url ? `[${issue.key}](${issue.url})` : issue.key;
|
|
211
|
+
parts.push(`- ${link}: ${issue.summary} [${issue.status}]`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (trends && trends.length > 0) {
|
|
215
|
+
parts.push('');
|
|
216
|
+
renderTrends(parts, trends);
|
|
217
|
+
}
|
|
218
|
+
if (anomalies && anomalies.length > 0) {
|
|
219
|
+
parts.push('');
|
|
220
|
+
renderAnomalies(parts, anomalies);
|
|
221
|
+
}
|
|
222
|
+
if (health) {
|
|
223
|
+
parts.push('');
|
|
224
|
+
renderTeamHealth(parts, health);
|
|
225
|
+
}
|
|
226
|
+
parts.push('');
|
|
227
|
+
parts.push('---');
|
|
228
|
+
return parts.join('\n');
|
|
229
|
+
}
|
|
230
|
+
export function generateRetrospective(input, extras) {
|
|
231
|
+
const { github, jira, sprintName, dateRange } = input;
|
|
232
|
+
const metrics = analyzeSprintActivity(github, jira);
|
|
233
|
+
const trends = extras?.trends;
|
|
234
|
+
const anomalies = extras?.anomalies;
|
|
235
|
+
const health = extras?.health;
|
|
236
|
+
const parts = [];
|
|
237
|
+
parts.push(`# Sprint Retrospective: ${sprintName}`);
|
|
238
|
+
parts.push('');
|
|
239
|
+
parts.push(`**Period:** ${dateRange.from} to ${dateRange.to}`);
|
|
240
|
+
parts.push(`**Developer:** ${github.username}`);
|
|
241
|
+
parts.push('');
|
|
242
|
+
parts.push('## Sprint Metrics');
|
|
243
|
+
parts.push('');
|
|
244
|
+
parts.push('| Metric | Value |');
|
|
245
|
+
parts.push('|--------|-------|');
|
|
246
|
+
parts.push(`| Commits | ${metrics.totalCommits} |`);
|
|
247
|
+
parts.push(`| Pull Requests | ${metrics.pullRequests.total} (${metrics.pullRequests.merged} merged, ${metrics.pullRequests.open} open, ${metrics.pullRequests.closed} closed) |`);
|
|
248
|
+
parts.push(`| Merge Rate | ${metrics.pullRequests.mergeRate}% |`);
|
|
249
|
+
if (metrics.avgMergeTimeHours !== null) {
|
|
250
|
+
parts.push(`| Avg Merge Time | ${metrics.avgMergeTimeHours} hours |`);
|
|
251
|
+
}
|
|
252
|
+
parts.push(`| Code Changes | +${metrics.additions}/-${metrics.deletions} |`);
|
|
253
|
+
parts.push(`| Reviews | ${metrics.reviews.total} (${metrics.reviews.approved} approved, ${metrics.reviews.changesRequested} changes requested) |`);
|
|
254
|
+
if (metrics.jira) {
|
|
255
|
+
parts.push(`| Jira Completion | ${metrics.jira.completed}/${metrics.jira.totalIssues} (${metrics.jira.completionRate}%) |`);
|
|
256
|
+
}
|
|
257
|
+
parts.push('');
|
|
258
|
+
if (metrics.jira && jira && jira.issues.length > 0) {
|
|
259
|
+
parts.push('## Jira Issues');
|
|
260
|
+
parts.push('');
|
|
261
|
+
parts.push('| Type | Count |');
|
|
262
|
+
parts.push('|------|-------|');
|
|
263
|
+
for (const [type, count] of Object.entries(metrics.jira.byType)) {
|
|
264
|
+
parts.push(`| ${type} | ${count} |`);
|
|
265
|
+
}
|
|
266
|
+
parts.push('');
|
|
267
|
+
for (const issue of jira.issues) {
|
|
268
|
+
const link = issue.url ? `[${issue.key}](${issue.url})` : issue.key;
|
|
269
|
+
parts.push(`- ${link}: ${issue.summary} [${issue.status}]`);
|
|
270
|
+
}
|
|
271
|
+
parts.push('');
|
|
272
|
+
}
|
|
273
|
+
parts.push(`## Commits: ${github.commits.length}`);
|
|
274
|
+
if (github.commits.length > 0) {
|
|
275
|
+
for (const c of github.commits) {
|
|
276
|
+
parts.push(`- \`${c.sha}\` ${c.message} (${c.repo})`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
parts.push('_No commits_');
|
|
281
|
+
}
|
|
282
|
+
parts.push('');
|
|
283
|
+
parts.push(`## Pull Requests: ${github.pullRequests.length}`);
|
|
284
|
+
if (github.pullRequests.length > 0) {
|
|
285
|
+
for (const pr of github.pullRequests) {
|
|
286
|
+
const stats = pr.additions !== undefined ? ` (+${pr.additions}/-${pr.deletions})` : '';
|
|
287
|
+
parts.push(`- #${pr.number}: ${pr.title} [${pr.state}]${stats}`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
parts.push('_No pull requests_');
|
|
292
|
+
}
|
|
293
|
+
parts.push('');
|
|
294
|
+
parts.push(`## Reviews: ${github.reviews.length}`);
|
|
295
|
+
if (github.reviews.length > 0) {
|
|
296
|
+
for (const r of github.reviews) {
|
|
297
|
+
parts.push(`- PR #${r.pullRequestNumber}: ${r.pullRequestTitle} [${r.state}]`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
parts.push('_No reviews_');
|
|
302
|
+
}
|
|
303
|
+
if (trends && trends.length > 0) {
|
|
304
|
+
parts.push('');
|
|
305
|
+
renderTrends(parts, trends);
|
|
306
|
+
}
|
|
307
|
+
if (anomalies && anomalies.length > 0) {
|
|
308
|
+
parts.push('');
|
|
309
|
+
renderAnomalies(parts, anomalies);
|
|
310
|
+
}
|
|
311
|
+
if (health) {
|
|
312
|
+
parts.push('');
|
|
313
|
+
renderTeamHealth(parts, health);
|
|
314
|
+
}
|
|
315
|
+
parts.push('');
|
|
316
|
+
parts.push('---');
|
|
317
|
+
return parts.join('\n');
|
|
318
|
+
}
|
|
319
|
+
const SEVERITY_ICON = {
|
|
320
|
+
alert: '[!!]',
|
|
321
|
+
warning: '[!]',
|
|
322
|
+
info: '[i]',
|
|
323
|
+
};
|
|
324
|
+
function renderTrends(parts, trends) {
|
|
325
|
+
parts.push('## Trends vs Previous Period');
|
|
326
|
+
parts.push('');
|
|
327
|
+
parts.push('| Metric | Change | Direction | Severity |');
|
|
328
|
+
parts.push('|--------|--------|-----------|----------|');
|
|
329
|
+
for (const t of trends) {
|
|
330
|
+
const arrow = t.direction === 'up' ? 'Up' : t.direction === 'down' ? 'Down' : 'Stable';
|
|
331
|
+
const sign = t.changePercent > 0 ? '+' : '';
|
|
332
|
+
parts.push(`| ${t.metric} | ${sign}${t.changePercent}% | ${arrow} | ${SEVERITY_ICON[t.severity]} ${t.severity} |`);
|
|
333
|
+
}
|
|
334
|
+
parts.push('');
|
|
335
|
+
for (const t of trends) {
|
|
336
|
+
parts.push(`- ${SEVERITY_ICON[t.severity]} ${t.message}`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const ANOMALY_ICON = {
|
|
340
|
+
alert: '[!!]',
|
|
341
|
+
warning: '[!]',
|
|
342
|
+
info: '[i]',
|
|
343
|
+
};
|
|
344
|
+
function renderAnomalies(parts, anomalies) {
|
|
345
|
+
parts.push('## Insights');
|
|
346
|
+
parts.push('');
|
|
347
|
+
for (const a of anomalies) {
|
|
348
|
+
parts.push(`- ${ANOMALY_ICON[a.severity]} **${a.severity}:** ${a.message}`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const TREND_ARROW = {
|
|
352
|
+
up: 'Up',
|
|
353
|
+
down: 'Down',
|
|
354
|
+
stable: 'Stable',
|
|
355
|
+
};
|
|
356
|
+
function renderTeamHealth(parts, health) {
|
|
357
|
+
parts.push(`## Team Health: ${health.overallScore}/100`);
|
|
358
|
+
parts.push('');
|
|
359
|
+
parts.push('| Dimension | Score | Trend |');
|
|
360
|
+
parts.push('|-----------|-------|-------|');
|
|
361
|
+
const dims = health.dimensions;
|
|
362
|
+
parts.push(`| Velocity | ${dims.velocity.score} | ${TREND_ARROW[dims.velocity.trend]} |`);
|
|
363
|
+
parts.push(`| Throughput | ${dims.throughput.score} | ${TREND_ARROW[dims.throughput.trend]} |`);
|
|
364
|
+
parts.push(`| Review Coverage | ${dims.reviewCoverage.score} | ${TREND_ARROW[dims.reviewCoverage.trend]} |`);
|
|
365
|
+
parts.push(`| Issue Flow | ${dims.issueFlow.score} | ${TREND_ARROW[dims.issueFlow.trend]} |`);
|
|
366
|
+
if (health.recommendations.length > 0) {
|
|
367
|
+
parts.push('');
|
|
368
|
+
parts.push('### Recommendations');
|
|
369
|
+
parts.push('');
|
|
370
|
+
for (const rec of health.recommendations) {
|
|
371
|
+
parts.push(`- ${rec}`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
//# sourceMappingURL=report-generator.js.map
|