agentic-sdlc-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/.env.example +20 -0
- package/README.md +335 -0
- package/dist/config.d.ts +22 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +39 -0
- package/dist/config.js.map +1 -0
- package/dist/github/client.d.ts +28 -0
- package/dist/github/client.d.ts.map +1 -0
- package/dist/github/client.js +90 -0
- package/dist/github/client.js.map +1 -0
- package/dist/github/context.d.ts +47 -0
- package/dist/github/context.d.ts.map +1 -0
- package/dist/github/context.js +123 -0
- package/dist/github/context.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/index.d.ts +9 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +315 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/tools/agent-handoff.d.ts +100 -0
- package/dist/tools/agent-handoff.d.ts.map +1 -0
- package/dist/tools/agent-handoff.js +196 -0
- package/dist/tools/agent-handoff.js.map +1 -0
- package/dist/tools/create-issue-set.d.ts +90 -0
- package/dist/tools/create-issue-set.d.ts.map +1 -0
- package/dist/tools/create-issue-set.js +142 -0
- package/dist/tools/create-issue-set.js.map +1 -0
- package/dist/tools/create-pr-summary.d.ts +60 -0
- package/dist/tools/create-pr-summary.d.ts.map +1 -0
- package/dist/tools/create-pr-summary.js +179 -0
- package/dist/tools/create-pr-summary.js.map +1 -0
- package/dist/tools/plan-from-context.d.ts +71 -0
- package/dist/tools/plan-from-context.d.ts.map +1 -0
- package/dist/tools/plan-from-context.js +201 -0
- package/dist/tools/plan-from-context.js.map +1 -0
- package/dist/tools/prepare-work-item.d.ts +90 -0
- package/dist/tools/prepare-work-item.d.ts.map +1 -0
- package/dist/tools/prepare-work-item.js +250 -0
- package/dist/tools/prepare-work-item.js.map +1 -0
- package/dist/tools/quality-gate-status.d.ts +175 -0
- package/dist/tools/quality-gate-status.d.ts.map +1 -0
- package/dist/tools/quality-gate-status.js +200 -0
- package/dist/tools/quality-gate-status.js.map +1 -0
- package/dist/tools/release-readiness.d.ts +55 -0
- package/dist/tools/release-readiness.d.ts.map +1 -0
- package/dist/tools/release-readiness.js +202 -0
- package/dist/tools/release-readiness.js.map +1 -0
- package/dist/tools/repo-context.d.ts +62 -0
- package/dist/tools/repo-context.d.ts.map +1 -0
- package/dist/tools/repo-context.js +183 -0
- package/dist/tools/repo-context.js.map +1 -0
- package/dist/tools/review-pr.d.ts +104 -0
- package/dist/tools/review-pr.d.ts.map +1 -0
- package/dist/tools/review-pr.js +378 -0
- package/dist/tools/review-pr.js.map +1 -0
- package/dist/tools/security-triage.d.ts +94 -0
- package/dist/tools/security-triage.d.ts.map +1 -0
- package/dist/tools/security-triage.js +228 -0
- package/dist/tools/security-triage.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: prepare_work_item
|
|
3
|
+
*
|
|
4
|
+
* Handler extracted as `handlePrepareWorkItem` for testing.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { resolveRepo, getOctokit, handleGitHubError } from "../github/client.js";
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Schema
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export const PrepareWorkItemInputSchema = z.object({
|
|
12
|
+
owner: z.string().optional().describe("GitHub owner. Falls back to GITHUB_OWNER."),
|
|
13
|
+
repo: z.string().optional().describe("GitHub repo. Falls back to GITHUB_REPO."),
|
|
14
|
+
issueNumber: z.number().int().positive().describe("The GitHub issue number."),
|
|
15
|
+
includeRelatedFiles: z
|
|
16
|
+
.boolean()
|
|
17
|
+
.default(false)
|
|
18
|
+
.describe("Attempt to identify related files from issue body keywords."),
|
|
19
|
+
includeRecentPRs: z
|
|
20
|
+
.boolean()
|
|
21
|
+
.default(false)
|
|
22
|
+
.describe("Include recent merged PRs touching related files."),
|
|
23
|
+
});
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Output schema
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
const RecentPrMatchShape = z.object({
|
|
28
|
+
number: z.number().int(),
|
|
29
|
+
title: z.string(),
|
|
30
|
+
url: z.string(),
|
|
31
|
+
mergedAt: z.string().nullable(),
|
|
32
|
+
matchedFiles: z.array(z.string()),
|
|
33
|
+
});
|
|
34
|
+
export const PrepareWorkItemOutputSchema = {
|
|
35
|
+
issueNumber: z.number().int(),
|
|
36
|
+
title: z.string(),
|
|
37
|
+
state: z.string(),
|
|
38
|
+
url: z.string(),
|
|
39
|
+
labels: z.array(z.string()),
|
|
40
|
+
assignees: z.array(z.string()),
|
|
41
|
+
relatedFileHints: z.array(z.string()),
|
|
42
|
+
recentPRs: z.array(RecentPrMatchShape),
|
|
43
|
+
handoffPrompt: z.string(),
|
|
44
|
+
};
|
|
45
|
+
/** Bounds for the includeRecentPRs heuristic — keeps API calls and token usage predictable. */
|
|
46
|
+
const RECENT_PRS_TO_SCAN = 20;
|
|
47
|
+
const MAX_RECENT_PR_MATCHES = 5;
|
|
48
|
+
/** True if a changed-file path and a heuristic file hint plausibly refer to the same file. */
|
|
49
|
+
export function fileMatchesHint(filename, hint) {
|
|
50
|
+
return (filename === hint ||
|
|
51
|
+
filename.endsWith("/" + hint) ||
|
|
52
|
+
hint.endsWith("/" + filename) ||
|
|
53
|
+
filename.endsWith(hint) ||
|
|
54
|
+
hint.endsWith(filename));
|
|
55
|
+
}
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Core handler (exported for testing)
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
/**
|
|
60
|
+
* Heuristically find recent merged PRs that touched any of `fileHints`.
|
|
61
|
+
* Scans at most RECENT_PRS_TO_SCAN recently-updated closed PRs and stops
|
|
62
|
+
* early once MAX_RECENT_PR_MATCHES matches are found, to bound API calls.
|
|
63
|
+
*/
|
|
64
|
+
export async function findRecentPRsForFileHints(octokit, ref, fileHints) {
|
|
65
|
+
if (fileHints.length === 0)
|
|
66
|
+
return [];
|
|
67
|
+
const { data: candidates } = await octokit.pulls.list({
|
|
68
|
+
owner: ref.owner,
|
|
69
|
+
repo: ref.repo,
|
|
70
|
+
state: "closed",
|
|
71
|
+
sort: "updated",
|
|
72
|
+
direction: "desc",
|
|
73
|
+
per_page: RECENT_PRS_TO_SCAN,
|
|
74
|
+
});
|
|
75
|
+
const matches = [];
|
|
76
|
+
for (const pr of candidates) {
|
|
77
|
+
if (!pr.merged_at)
|
|
78
|
+
continue; // skip closed-without-merge PRs
|
|
79
|
+
if (matches.length >= MAX_RECENT_PR_MATCHES)
|
|
80
|
+
break;
|
|
81
|
+
const { data: files } = await octokit.pulls.listFiles({
|
|
82
|
+
owner: ref.owner,
|
|
83
|
+
repo: ref.repo,
|
|
84
|
+
pull_number: pr.number,
|
|
85
|
+
per_page: 100,
|
|
86
|
+
});
|
|
87
|
+
const matchedFiles = files
|
|
88
|
+
.filter((f) => fileHints.some((hint) => fileMatchesHint(f.filename, hint)))
|
|
89
|
+
.map((f) => f.filename);
|
|
90
|
+
if (matchedFiles.length > 0) {
|
|
91
|
+
matches.push({
|
|
92
|
+
number: pr.number,
|
|
93
|
+
title: pr.title,
|
|
94
|
+
url: pr.html_url,
|
|
95
|
+
mergedAt: pr.merged_at,
|
|
96
|
+
matchedFiles,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return matches;
|
|
101
|
+
}
|
|
102
|
+
export async function handlePrepareWorkItem(params, ref, octokit) {
|
|
103
|
+
const { data: issue } = await octokit.issues.get({
|
|
104
|
+
owner: ref.owner,
|
|
105
|
+
repo: ref.repo,
|
|
106
|
+
issue_number: params.issueNumber,
|
|
107
|
+
});
|
|
108
|
+
const { data: comments } = await octokit.issues.listComments({
|
|
109
|
+
owner: ref.owner,
|
|
110
|
+
repo: ref.repo,
|
|
111
|
+
issue_number: params.issueNumber,
|
|
112
|
+
per_page: 5,
|
|
113
|
+
});
|
|
114
|
+
const labels = issue.labels.map((l) => typeof l === "string" ? l : (l.name ?? ""));
|
|
115
|
+
const assignees = issue.assignees?.map((a) => "@" + a.login) ?? [];
|
|
116
|
+
// Heuristic: extract file paths from body
|
|
117
|
+
const fileHints = [];
|
|
118
|
+
if (params.includeRelatedFiles && issue.body) {
|
|
119
|
+
const matches = issue.body.match(/[a-zA-Z0-9_/.-]+\.[a-zA-Z]{2,5}/g) ?? [];
|
|
120
|
+
const filtered = matches
|
|
121
|
+
.filter((m) => m.includes("/") ||
|
|
122
|
+
m.endsWith(".ts") ||
|
|
123
|
+
m.endsWith(".js") ||
|
|
124
|
+
m.endsWith(".py"))
|
|
125
|
+
.slice(0, 10);
|
|
126
|
+
fileHints.push(...filtered);
|
|
127
|
+
}
|
|
128
|
+
const recentPRs = params.includeRecentPRs
|
|
129
|
+
? await findRecentPRsForFileHints(octokit, ref, fileHints)
|
|
130
|
+
: [];
|
|
131
|
+
const handoffPrompt = [
|
|
132
|
+
`You are working on issue #${issue.number}: "${issue.title}" in ${ref.owner}/${ref.repo}.`,
|
|
133
|
+
`The full issue description is provided below. Your task is to implement the required changes,`,
|
|
134
|
+
`add tests, and open a pull request. Follow the non-goals and acceptance criteria strictly.`,
|
|
135
|
+
`Use the quality_gate_status tool to verify CI before marking work complete.`,
|
|
136
|
+
].join(" ");
|
|
137
|
+
const structured = {
|
|
138
|
+
issueNumber: issue.number,
|
|
139
|
+
title: issue.title,
|
|
140
|
+
state: issue.state,
|
|
141
|
+
url: issue.html_url,
|
|
142
|
+
labels,
|
|
143
|
+
assignees,
|
|
144
|
+
relatedFileHints: fileHints,
|
|
145
|
+
recentPRs,
|
|
146
|
+
handoffPrompt,
|
|
147
|
+
};
|
|
148
|
+
const lines = [
|
|
149
|
+
`# Work Item Brief: #${issue.number} — ${issue.title}`,
|
|
150
|
+
"",
|
|
151
|
+
`**URL:** ${issue.html_url}`,
|
|
152
|
+
`**State:** ${issue.state}`,
|
|
153
|
+
`**Labels:** ${labels.length > 0 ? labels.join(", ") : "(none)"}`,
|
|
154
|
+
`**Assignees:** ${assignees.length > 0 ? assignees.join(", ") : "(none)"}`,
|
|
155
|
+
`**Created:** ${issue.created_at}`,
|
|
156
|
+
"",
|
|
157
|
+
"## Issue Summary",
|
|
158
|
+
"",
|
|
159
|
+
issue.body ?? "(no description)",
|
|
160
|
+
"",
|
|
161
|
+
"## Goals",
|
|
162
|
+
"- Implement the changes described in the issue above",
|
|
163
|
+
"- Ensure all acceptance criteria are met",
|
|
164
|
+
"- Maintain or improve test coverage",
|
|
165
|
+
"",
|
|
166
|
+
"## Non-Goals",
|
|
167
|
+
"- Do not refactor unrelated code",
|
|
168
|
+
"- Do not change public API contracts unless explicitly stated in the issue",
|
|
169
|
+
"",
|
|
170
|
+
"## Acceptance Criteria",
|
|
171
|
+
"_(Derived from issue body — verify with the issue author)_",
|
|
172
|
+
"- [ ] All described behaviour is implemented and tested",
|
|
173
|
+
"- [ ] No regressions in existing tests",
|
|
174
|
+
"- [ ] PR passes all CI checks",
|
|
175
|
+
"",
|
|
176
|
+
"## Risks",
|
|
177
|
+
"- Scope may be broader than the issue description suggests",
|
|
178
|
+
"- Related tests may need updating",
|
|
179
|
+
"- Linked issues (if any) may introduce dependencies",
|
|
180
|
+
];
|
|
181
|
+
if (comments.length > 0) {
|
|
182
|
+
lines.push("", "## Recent Comments");
|
|
183
|
+
for (const c of comments.slice(0, 3)) {
|
|
184
|
+
const preview = (c.body ?? "").slice(0, 300);
|
|
185
|
+
const ellipsis = (c.body ?? "").length > 300 ? "..." : "";
|
|
186
|
+
lines.push(`\n**@${c.user?.login ?? "unknown"}** (${c.created_at}):\n${preview}${ellipsis}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (fileHints.length > 0) {
|
|
190
|
+
lines.push("", "## Potentially Related Files (heuristic)");
|
|
191
|
+
fileHints.forEach((f) => lines.push(`- \`${f}\``));
|
|
192
|
+
}
|
|
193
|
+
if (params.includeRecentPRs) {
|
|
194
|
+
lines.push("", "## Recent Related PRs (heuristic)");
|
|
195
|
+
if (recentPRs.length > 0) {
|
|
196
|
+
recentPRs.forEach((pr) => lines.push(`- #${pr.number} ${pr.title} -> ${pr.url} (merged ${pr.mergedAt ?? "unknown"}; touched ${pr.matchedFiles.join(", ")})`));
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
lines.push(fileHints.length === 0
|
|
200
|
+
? "(no related file hints available — enable includeRelatedFiles to find matching PRs)"
|
|
201
|
+
: "(no recent merged PRs found touching the related files)");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
lines.push("", "## Recommended Verification Commands", "```powershell", "# Run tests", "npm test", "", "# Type check", "npm run typecheck", "", "# Build", "npm run build", "```", "", "## Agent Handoff Prompt", "", "```", handoffPrompt, "```");
|
|
205
|
+
return { text: lines.join("\n"), structured };
|
|
206
|
+
}
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
// Registration
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
export function registerPrepareWorkItemTool(server) {
|
|
211
|
+
server.registerTool("prepare_work_item", {
|
|
212
|
+
title: "Prepare Work Item Brief",
|
|
213
|
+
description: `Generate an agent-ready brief for a GitHub issue, including summary, goals, non-goals, acceptance criteria, risks, and a handoff prompt.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
- owner, repo: Repository coordinates.
|
|
217
|
+
- issueNumber (number): The issue to prepare.
|
|
218
|
+
- includeRelatedFiles (boolean): Heuristically list related file paths. Default: false.
|
|
219
|
+
- includeRecentPRs (boolean): Scan recent merged PRs (up to 20) for ones that touched the
|
|
220
|
+
related file hints and return up to 5 matches. Requires includeRelatedFiles to find hints
|
|
221
|
+
to match against — if no hints exist, returns an empty list. Default: false.
|
|
222
|
+
|
|
223
|
+
Returns: Structured markdown brief ready to paste into an agent prompt.`,
|
|
224
|
+
inputSchema: PrepareWorkItemInputSchema,
|
|
225
|
+
outputSchema: PrepareWorkItemOutputSchema,
|
|
226
|
+
annotations: {
|
|
227
|
+
readOnlyHint: true,
|
|
228
|
+
destructiveHint: false,
|
|
229
|
+
idempotentHint: true,
|
|
230
|
+
openWorldHint: true,
|
|
231
|
+
},
|
|
232
|
+
}, async (params) => {
|
|
233
|
+
try {
|
|
234
|
+
const ref = resolveRepo(params.owner, params.repo);
|
|
235
|
+
const octokit = getOctokit();
|
|
236
|
+
const { text, structured } = await handlePrepareWorkItem(params, ref, octokit);
|
|
237
|
+
return {
|
|
238
|
+
content: [{ type: "text", text }],
|
|
239
|
+
structuredContent: structured,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
return {
|
|
244
|
+
isError: true,
|
|
245
|
+
content: [{ type: "text", text: handleGitHubError(error) }],
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=prepare-work-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-work-item.js","sourceRoot":"","sources":["../../src/tools/prepare-work-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIjF,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IAClF,IAAI,EAAE,C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AO,GAAG,UAAU,EAAE,CAAC;YAC7B,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;YAC/E,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;gBACjC,iBAAiB,EAAE,UAAgD;aACpE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;aAC5D,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: quality_gate_status
|
|
3
|
+
*
|
|
4
|
+
* Core logic extracted as `categorizeChecks` and `handleQualityGateStatus`
|
|
5
|
+
* for unit testing without MCP machinery.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import type { CheckStatus, RepoRef } from "../types.js";
|
|
10
|
+
import type { Octokit } from "@octokit/rest";
|
|
11
|
+
export declare const QualityGateInputSchema: z.ZodObject<{
|
|
12
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
13
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
14
|
+
pullNumber: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
owner?: string | undefined;
|
|
18
|
+
repo?: string | undefined;
|
|
19
|
+
ref?: string | undefined;
|
|
20
|
+
pullNumber?: number | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
owner?: string | undefined;
|
|
23
|
+
repo?: string | undefined;
|
|
24
|
+
ref?: string | undefined;
|
|
25
|
+
pullNumber?: number | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export type QualityGateInput = z.infer<typeof QualityGateInputSchema>;
|
|
28
|
+
export declare const QualityGateOutputSchema: {
|
|
29
|
+
contextLabel: z.ZodString;
|
|
30
|
+
headSha: z.ZodString;
|
|
31
|
+
conclusion: z.ZodEnum<["passing", "failing", "pending"]>;
|
|
32
|
+
categories: z.ZodObject<{
|
|
33
|
+
failing: z.ZodArray<z.ZodObject<{
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
status: z.ZodString;
|
|
36
|
+
conclusion: z.ZodNullable<z.ZodString>;
|
|
37
|
+
url: z.ZodNullable<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
status: string;
|
|
40
|
+
name: string;
|
|
41
|
+
url: string | null;
|
|
42
|
+
conclusion: string | null;
|
|
43
|
+
}, {
|
|
44
|
+
status: string;
|
|
45
|
+
name: string;
|
|
46
|
+
url: string | null;
|
|
47
|
+
conclusion: string | null;
|
|
48
|
+
}>, "many">;
|
|
49
|
+
pending: z.ZodArray<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
status: z.ZodString;
|
|
52
|
+
conclusion: z.ZodNullable<z.ZodString>;
|
|
53
|
+
url: z.ZodNullable<z.ZodString>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
status: string;
|
|
56
|
+
name: string;
|
|
57
|
+
url: string | null;
|
|
58
|
+
conclusion: string | null;
|
|
59
|
+
}, {
|
|
60
|
+
status: string;
|
|
61
|
+
name: string;
|
|
62
|
+
url: string | null;
|
|
63
|
+
conclusion: string | null;
|
|
64
|
+
}>, "many">;
|
|
65
|
+
passing: z.ZodArray<z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
status: z.ZodString;
|
|
68
|
+
conclusion: z.ZodNullable<z.ZodString>;
|
|
69
|
+
url: z.ZodNullable<z.ZodString>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
status: string;
|
|
72
|
+
name: string;
|
|
73
|
+
url: string | null;
|
|
74
|
+
conclusion: string | null;
|
|
75
|
+
}, {
|
|
76
|
+
status: string;
|
|
77
|
+
name: string;
|
|
78
|
+
url: string | null;
|
|
79
|
+
conclusion: string | null;
|
|
80
|
+
}>, "many">;
|
|
81
|
+
skipped: z.ZodArray<z.ZodObject<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
status: z.ZodString;
|
|
84
|
+
conclusion: z.ZodNullable<z.ZodString>;
|
|
85
|
+
url: z.ZodNullable<z.ZodString>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
status: string;
|
|
88
|
+
name: string;
|
|
89
|
+
url: string | null;
|
|
90
|
+
conclusion: string | null;
|
|
91
|
+
}, {
|
|
92
|
+
status: string;
|
|
93
|
+
name: string;
|
|
94
|
+
url: string | null;
|
|
95
|
+
conclusion: string | null;
|
|
96
|
+
}>, "many">;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
pending: {
|
|
99
|
+
status: string;
|
|
100
|
+
name: string;
|
|
101
|
+
url: string | null;
|
|
102
|
+
conclusion: string | null;
|
|
103
|
+
}[];
|
|
104
|
+
skipped: {
|
|
105
|
+
status: string;
|
|
106
|
+
name: string;
|
|
107
|
+
url: string | null;
|
|
108
|
+
conclusion: string | null;
|
|
109
|
+
}[];
|
|
110
|
+
passing: {
|
|
111
|
+
status: string;
|
|
112
|
+
name: string;
|
|
113
|
+
url: string | null;
|
|
114
|
+
conclusion: string | null;
|
|
115
|
+
}[];
|
|
116
|
+
failing: {
|
|
117
|
+
status: string;
|
|
118
|
+
name: string;
|
|
119
|
+
url: string | null;
|
|
120
|
+
conclusion: string | null;
|
|
121
|
+
}[];
|
|
122
|
+
}, {
|
|
123
|
+
pending: {
|
|
124
|
+
status: string;
|
|
125
|
+
name: string;
|
|
126
|
+
url: string | null;
|
|
127
|
+
conclusion: string | null;
|
|
128
|
+
}[];
|
|
129
|
+
skipped: {
|
|
130
|
+
status: string;
|
|
131
|
+
name: string;
|
|
132
|
+
url: string | null;
|
|
133
|
+
conclusion: string | null;
|
|
134
|
+
}[];
|
|
135
|
+
passing: {
|
|
136
|
+
status: string;
|
|
137
|
+
name: string;
|
|
138
|
+
url: string | null;
|
|
139
|
+
conclusion: string | null;
|
|
140
|
+
}[];
|
|
141
|
+
failing: {
|
|
142
|
+
status: string;
|
|
143
|
+
name: string;
|
|
144
|
+
url: string | null;
|
|
145
|
+
conclusion: string | null;
|
|
146
|
+
}[];
|
|
147
|
+
}>;
|
|
148
|
+
totalChecks: z.ZodNumber;
|
|
149
|
+
};
|
|
150
|
+
export interface CheckCategories {
|
|
151
|
+
failing: CheckStatus[];
|
|
152
|
+
pending: CheckStatus[];
|
|
153
|
+
passing: CheckStatus[];
|
|
154
|
+
skipped: CheckStatus[];
|
|
155
|
+
}
|
|
156
|
+
export interface QualityGateResult {
|
|
157
|
+
contextLabel: string;
|
|
158
|
+
headSha: string;
|
|
159
|
+
conclusion: "passing" | "failing" | "pending";
|
|
160
|
+
categories: CheckCategories;
|
|
161
|
+
totalChecks: number;
|
|
162
|
+
}
|
|
163
|
+
/** Categorise raw check-run objects into pass/fail/pending/skipped buckets. */
|
|
164
|
+
export declare function categorizeChecks(checkRuns: Array<{
|
|
165
|
+
name: string;
|
|
166
|
+
status: string | null;
|
|
167
|
+
conclusion: string | null;
|
|
168
|
+
html_url?: string | null;
|
|
169
|
+
}>): CheckCategories;
|
|
170
|
+
export declare function handleQualityGateStatus(params: QualityGateInput, ref: RepoRef, octokit: Octokit): Promise<{
|
|
171
|
+
text: string;
|
|
172
|
+
structured: QualityGateResult;
|
|
173
|
+
}>;
|
|
174
|
+
export declare function registerQualityGateStatusTool(server: McpServer): void;
|
|
175
|
+
//# sourceMappingURL=quality-gate-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC,GACD,eAAe,CAuBjB;AAMD,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,iBAAiB,CAAA;CAAE,CAAC,CA+G1D;AAMD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuCrE"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: quality_gate_status
|
|
3
|
+
*
|
|
4
|
+
* Core logic extracted as `categorizeChecks` and `handleQualityGateStatus`
|
|
5
|
+
* for unit testing without MCP machinery.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { resolveRepo, getOctokit, paginateAll, handleGitHubError } from "../github/client.js";
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Schema
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
export const QualityGateInputSchema = z.object({
|
|
13
|
+
owner: z.string().optional().describe("GitHub owner. Falls back to GITHUB_OWNER."),
|
|
14
|
+
repo: z.string().optional().describe("GitHub repo. Falls back to GITHUB_REPO."),
|
|
15
|
+
pullNumber: z
|
|
16
|
+
.number().int().positive().optional()
|
|
17
|
+
.describe("PR number. Takes precedence over ref when provided."),
|
|
18
|
+
ref: z
|
|
19
|
+
.string().optional()
|
|
20
|
+
.describe("Git ref (branch name, commit SHA). Ignored if pullNumber is set."),
|
|
21
|
+
});
|
|
22
|
+
const CheckStatusShape = z.object({
|
|
23
|
+
name: z.string(),
|
|
24
|
+
status: z.string(),
|
|
25
|
+
conclusion: z.string().nullable(),
|
|
26
|
+
url: z.string().nullable(),
|
|
27
|
+
});
|
|
28
|
+
export const QualityGateOutputSchema = {
|
|
29
|
+
contextLabel: z.string(),
|
|
30
|
+
headSha: z.string(),
|
|
31
|
+
conclusion: z.enum(["passing", "failing", "pending"]),
|
|
32
|
+
categories: z.object({
|
|
33
|
+
failing: z.array(CheckStatusShape),
|
|
34
|
+
pending: z.array(CheckStatusShape),
|
|
35
|
+
passing: z.array(CheckStatusShape),
|
|
36
|
+
skipped: z.array(CheckStatusShape),
|
|
37
|
+
}),
|
|
38
|
+
totalChecks: z.number().int(),
|
|
39
|
+
};
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Pure helpers (exported for testing)
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
/** Categorise raw check-run objects into pass/fail/pending/skipped buckets. */
|
|
44
|
+
export function categorizeChecks(checkRuns) {
|
|
45
|
+
const toStatus = (run) => ({
|
|
46
|
+
name: run.name,
|
|
47
|
+
status: run.status ?? "unknown",
|
|
48
|
+
conclusion: run.conclusion ?? null,
|
|
49
|
+
url: run.html_url ?? null,
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
failing: checkRuns
|
|
53
|
+
.filter((c) => c.conclusion === "failure" || c.conclusion === "timed_out")
|
|
54
|
+
.map(toStatus),
|
|
55
|
+
pending: checkRuns
|
|
56
|
+
.filter((c) => c.status === "queued" || c.status === "in_progress" || c.status === "pending")
|
|
57
|
+
.map(toStatus),
|
|
58
|
+
passing: checkRuns.filter((c) => c.conclusion === "success").map(toStatus),
|
|
59
|
+
skipped: checkRuns
|
|
60
|
+
.filter((c) => c.conclusion === "skipped" || c.conclusion === "neutral")
|
|
61
|
+
.map(toStatus),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// Core handler (exported for testing)
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
export async function handleQualityGateStatus(params, ref, octokit) {
|
|
68
|
+
let headSha;
|
|
69
|
+
let contextLabel;
|
|
70
|
+
if (params.pullNumber) {
|
|
71
|
+
const { data: pr } = await octokit.pulls.get({
|
|
72
|
+
owner: ref.owner,
|
|
73
|
+
repo: ref.repo,
|
|
74
|
+
pull_number: params.pullNumber,
|
|
75
|
+
});
|
|
76
|
+
headSha = pr.head.sha;
|
|
77
|
+
contextLabel = `PR #${params.pullNumber} (${pr.title})`;
|
|
78
|
+
}
|
|
79
|
+
else if (params.ref) {
|
|
80
|
+
const { data: refData } = await octokit.git.getRef({
|
|
81
|
+
owner: ref.owner,
|
|
82
|
+
repo: ref.repo,
|
|
83
|
+
ref: params.ref.replace(/^refs\//, ""),
|
|
84
|
+
});
|
|
85
|
+
headSha = refData.object.sha;
|
|
86
|
+
contextLabel = `ref: ${params.ref}`;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
throw new Error("Either pullNumber or ref is required.");
|
|
90
|
+
}
|
|
91
|
+
// Paginate check runs (repos with many checks can exceed 100)
|
|
92
|
+
const allRuns = await paginateAll((page, perPage) => octokit.checks
|
|
93
|
+
.listForRef({
|
|
94
|
+
owner: ref.owner,
|
|
95
|
+
repo: ref.repo,
|
|
96
|
+
ref: headSha,
|
|
97
|
+
per_page: perPage,
|
|
98
|
+
page,
|
|
99
|
+
})
|
|
100
|
+
.then((r) => r.data.check_runs), 300);
|
|
101
|
+
const cats = categorizeChecks(allRuns);
|
|
102
|
+
const overallConclusion = cats.failing.length > 0
|
|
103
|
+
? "failing"
|
|
104
|
+
: cats.pending.length > 0
|
|
105
|
+
? "pending"
|
|
106
|
+
: "passing";
|
|
107
|
+
const conclusionLabel = overallConclusion === "passing"
|
|
108
|
+
? "[PASS] All checks passed"
|
|
109
|
+
: overallConclusion === "failing"
|
|
110
|
+
? "[FAIL] Some checks are failing"
|
|
111
|
+
: "[PENDING] Checks are still running";
|
|
112
|
+
const structured = {
|
|
113
|
+
contextLabel,
|
|
114
|
+
headSha,
|
|
115
|
+
conclusion: overallConclusion,
|
|
116
|
+
categories: cats,
|
|
117
|
+
totalChecks: allRuns.length,
|
|
118
|
+
};
|
|
119
|
+
const lines = [
|
|
120
|
+
`# Quality Gate Status - ${contextLabel}`,
|
|
121
|
+
"",
|
|
122
|
+
`**Commit:** \`${headSha.slice(0, 8)}\``,
|
|
123
|
+
`**Conclusion:** ${conclusionLabel}`,
|
|
124
|
+
"",
|
|
125
|
+
`| | Count |`,
|
|
126
|
+
`|---|---|`,
|
|
127
|
+
`| Passing | ${cats.passing.length} |`,
|
|
128
|
+
`| Failing | ${cats.failing.length} |`,
|
|
129
|
+
`| Pending | ${cats.pending.length} |`,
|
|
130
|
+
`| Skipped | ${cats.skipped.length} |`,
|
|
131
|
+
`| Total | ${allRuns.length} |`,
|
|
132
|
+
];
|
|
133
|
+
if (cats.failing.length > 0) {
|
|
134
|
+
lines.push("", "## [FAIL] Failing Checks");
|
|
135
|
+
cats.failing.forEach((c) => {
|
|
136
|
+
const link = c.url ? ` - [view](${c.url})` : "";
|
|
137
|
+
lines.push(`- **${c.name}**: ${c.conclusion}${link}`);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (cats.pending.length > 0) {
|
|
141
|
+
lines.push("", "## [PENDING] Pending Checks");
|
|
142
|
+
cats.pending.forEach((c) => lines.push(`- **${c.name}**: ${c.status}`));
|
|
143
|
+
}
|
|
144
|
+
if (cats.passing.length > 0) {
|
|
145
|
+
lines.push("", "## [PASS] Passing Checks");
|
|
146
|
+
cats.passing.forEach((c) => lines.push(`- ${c.name}`));
|
|
147
|
+
}
|
|
148
|
+
lines.push("", "## Next Actions");
|
|
149
|
+
if (cats.failing.length > 0) {
|
|
150
|
+
lines.push("- Fix the failing checks listed above before proceeding.", "- Use `review_pr_against_standard` for deeper analysis of PR issues.");
|
|
151
|
+
}
|
|
152
|
+
else if (cats.pending.length > 0) {
|
|
153
|
+
lines.push("- Wait for pending checks to complete, then re-run this tool.");
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
lines.push("- All checks pass. Safe to request review or merge.", "- Run `release_readiness_check` for a full pre-release assessment.");
|
|
157
|
+
}
|
|
158
|
+
return { text: lines.join("\n"), structured };
|
|
159
|
+
}
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Registration
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
export function registerQualityGateStatusTool(server) {
|
|
164
|
+
server.registerTool("quality_gate_status", {
|
|
165
|
+
title: "Quality Gate Status",
|
|
166
|
+
description: `Read check-run results for a pull request or git ref.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
- owner, repo: Repository coordinates.
|
|
170
|
+
- pullNumber (number?): PR number (preferred).
|
|
171
|
+
- ref (string?): Branch name or commit SHA.
|
|
172
|
+
|
|
173
|
+
Returns: Summary of all check runs with pass/fail/pending counts and next actions.`,
|
|
174
|
+
inputSchema: QualityGateInputSchema,
|
|
175
|
+
outputSchema: QualityGateOutputSchema,
|
|
176
|
+
annotations: {
|
|
177
|
+
readOnlyHint: true,
|
|
178
|
+
destructiveHint: false,
|
|
179
|
+
idempotentHint: true,
|
|
180
|
+
openWorldHint: true,
|
|
181
|
+
},
|
|
182
|
+
}, async (params) => {
|
|
183
|
+
try {
|
|
184
|
+
const ref = resolveRepo(params.owner, params.repo);
|
|
185
|
+
const octokit = getOctokit();
|
|
186
|
+
const { text, structured } = await handleQualityGateStatus(params, ref, octokit);
|
|
187
|
+
return {
|
|
188
|
+
content: [{ type: "text", text }],
|
|
189
|
+
structuredContent: structured,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
return {
|
|
194
|
+
isError: true,
|
|
195
|
+
content: [{ type: "text", text: handleGitHubError(error) }],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=quality-gate-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-gate-status.js","sourceRoot":"","sources":["../../src/tools/quality-gate-status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KA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