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 @@
|
|
|
1
|
+
{"version":3,"file":"agent-handoff.d.ts","sourceRoot":"","sources":["../../src/tools/agent-handoff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAM7C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;EAWlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAMxE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBpC,CAAC;AAMF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/E,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC7F;AAMD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAoJ3D;AAMD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2ChE"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: agent_handoff_packet
|
|
3
|
+
*
|
|
4
|
+
* Handler extracted as `handleAgentHandoff` for testing.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { resolveRepo, getOctokit, handleGitHubError } from "../github/client.js";
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Schema
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export const AgentHandoffInputSchema = 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().optional()
|
|
15
|
+
.describe("Issue being worked on (if applicable)."),
|
|
16
|
+
pullNumber: z.number().int().positive().optional()
|
|
17
|
+
.describe("PR being worked on (if applicable)."),
|
|
18
|
+
currentStatus: z.string().min(1)
|
|
19
|
+
.describe("Free-text description of the current work status."),
|
|
20
|
+
nextSteps: z.array(z.string()).optional()
|
|
21
|
+
.describe("Ordered list of next steps for the incoming agent."),
|
|
22
|
+
});
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Output schema
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
export const AgentHandoffOutputSchema = {
|
|
27
|
+
repo: z.string(),
|
|
28
|
+
defaultBranch: z.string(),
|
|
29
|
+
currentStatus: z.string(),
|
|
30
|
+
nextSteps: z.array(z.string()),
|
|
31
|
+
handoffPrompt: z.string(),
|
|
32
|
+
issueRef: z
|
|
33
|
+
.object({
|
|
34
|
+
number: z.number().int(),
|
|
35
|
+
title: z.string(),
|
|
36
|
+
state: z.string(),
|
|
37
|
+
url: z.string(),
|
|
38
|
+
})
|
|
39
|
+
.nullable(),
|
|
40
|
+
prRef: z
|
|
41
|
+
.object({
|
|
42
|
+
number: z.number().int(),
|
|
43
|
+
title: z.string(),
|
|
44
|
+
state: z.string(),
|
|
45
|
+
branch: z.string(),
|
|
46
|
+
url: z.string(),
|
|
47
|
+
})
|
|
48
|
+
.nullable(),
|
|
49
|
+
};
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Core handler (exported for testing)
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
export async function handleAgentHandoff(params, ref, octokit) {
|
|
54
|
+
const { data: repoData } = await octokit.repos.get({
|
|
55
|
+
owner: ref.owner,
|
|
56
|
+
repo: ref.repo,
|
|
57
|
+
});
|
|
58
|
+
let issueRef = null;
|
|
59
|
+
if (params.issueNumber) {
|
|
60
|
+
try {
|
|
61
|
+
const { data: issue } = await octokit.issues.get({
|
|
62
|
+
owner: ref.owner,
|
|
63
|
+
repo: ref.repo,
|
|
64
|
+
issue_number: params.issueNumber,
|
|
65
|
+
});
|
|
66
|
+
issueRef = {
|
|
67
|
+
number: issue.number,
|
|
68
|
+
title: issue.title,
|
|
69
|
+
state: issue.state,
|
|
70
|
+
url: issue.html_url,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// Could not fetch — leave null
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let prRef = null;
|
|
78
|
+
if (params.pullNumber) {
|
|
79
|
+
try {
|
|
80
|
+
const { data: pr } = await octokit.pulls.get({
|
|
81
|
+
owner: ref.owner,
|
|
82
|
+
repo: ref.repo,
|
|
83
|
+
pull_number: params.pullNumber,
|
|
84
|
+
});
|
|
85
|
+
prRef = {
|
|
86
|
+
number: pr.number,
|
|
87
|
+
title: pr.title,
|
|
88
|
+
state: pr.state + (pr.draft ? " (draft)" : ""),
|
|
89
|
+
branch: `${pr.head.ref} -> ${pr.base.ref}`,
|
|
90
|
+
url: pr.html_url,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Could not fetch — leave null
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const nextSteps = params.nextSteps ?? [
|
|
98
|
+
"Review the current state of the issue/PR",
|
|
99
|
+
"Run quality_gate_status to check CI",
|
|
100
|
+
"Address any remaining review comments",
|
|
101
|
+
"Ensure tests pass before proceeding",
|
|
102
|
+
];
|
|
103
|
+
const handoffLines = [
|
|
104
|
+
`You are taking over work on ${ref.owner}/${ref.repo}.`,
|
|
105
|
+
"",
|
|
106
|
+
`Current status: ${params.currentStatus}`,
|
|
107
|
+
"",
|
|
108
|
+
`Repository: ${repoData.full_name} (default branch: ${repoData.default_branch})`,
|
|
109
|
+
];
|
|
110
|
+
if (issueRef) {
|
|
111
|
+
handoffLines.push(`Issue #${issueRef.number}: ${issueRef.title} [${issueRef.state}] ${issueRef.url}`);
|
|
112
|
+
}
|
|
113
|
+
if (prRef) {
|
|
114
|
+
handoffLines.push(`PR #${prRef.number}: ${prRef.title} [${prRef.state}] ${prRef.url}`);
|
|
115
|
+
}
|
|
116
|
+
handoffLines.push("", "Your next steps (in order):", ...nextSteps.map((s, i) => `${i + 1}. ${s}`), "", "Tools available: repo_context, quality_gate_status, review_pr_against_standard, security_triage, release_readiness_check", "", "Start by calling repo_context to orient yourself, then proceed with the next steps above.");
|
|
117
|
+
const handoffPrompt = handoffLines.join("\n");
|
|
118
|
+
const structured = {
|
|
119
|
+
repo: repoData.full_name,
|
|
120
|
+
defaultBranch: repoData.default_branch,
|
|
121
|
+
currentStatus: params.currentStatus,
|
|
122
|
+
nextSteps,
|
|
123
|
+
handoffPrompt,
|
|
124
|
+
issueRef,
|
|
125
|
+
prRef,
|
|
126
|
+
};
|
|
127
|
+
const lines = [
|
|
128
|
+
`# Agent Handoff Packet: ${ref.owner}/${ref.repo}`,
|
|
129
|
+
"",
|
|
130
|
+
"## Handoff Prompt",
|
|
131
|
+
"",
|
|
132
|
+
"```",
|
|
133
|
+
handoffPrompt,
|
|
134
|
+
"```",
|
|
135
|
+
"",
|
|
136
|
+
"## Repo Context Snapshot",
|
|
137
|
+
"",
|
|
138
|
+
`- Full name: ${repoData.full_name}`,
|
|
139
|
+
`- Default branch: ${repoData.default_branch}`,
|
|
140
|
+
`- Language: ${repoData.language ?? "unknown"}`,
|
|
141
|
+
`- Visibility: ${repoData.visibility ?? "unknown"}`,
|
|
142
|
+
];
|
|
143
|
+
if (issueRef) {
|
|
144
|
+
lines.push("", "### Active Issue", `Issue #${issueRef.number}: ${issueRef.title}`, `State: ${issueRef.state}`, `URL: ${issueRef.url}`);
|
|
145
|
+
}
|
|
146
|
+
if (prRef) {
|
|
147
|
+
lines.push("", "### Active PR", `PR #${prRef.number}: ${prRef.title}`, `State: ${prRef.state}`, `Branch: ${prRef.branch}`, `URL: ${prRef.url}`);
|
|
148
|
+
}
|
|
149
|
+
lines.push("", "## Current Status", "", params.currentStatus, "", "## Decisions Made", "", "_(Document decisions here before handing off)_", "- No decisions recorded.", "", "## Remaining Tasks", "", ...nextSteps.map((s, i) => `${i + 1}. ${s}`), "", "## Verification Required", "", "- [ ] Run quality_gate_status to confirm CI is passing", "- [ ] Run review_pr_against_standard if a PR is open", "- [ ] Run security_triage if security-related changes were made", "- [ ] Confirm all acceptance criteria are met");
|
|
150
|
+
return { text: lines.join("\n"), structured };
|
|
151
|
+
}
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
// Registration
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
export function registerAgentHandoffTool(server) {
|
|
156
|
+
server.registerTool("agent_handoff_packet", {
|
|
157
|
+
title: "Agent Handoff Packet",
|
|
158
|
+
description: `Generate a compact handoff packet so another AI agent can continue SDLC work.
|
|
159
|
+
|
|
160
|
+
Use when wrapping up a session, before handing off to a specialised agent, or when context is nearing its limit.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
- owner, repo: Repository coordinates.
|
|
164
|
+
- issueNumber (number?): Issue being worked on.
|
|
165
|
+
- pullNumber (number?): PR being worked on.
|
|
166
|
+
- currentStatus (string): What has been done so far.
|
|
167
|
+
- nextSteps (string[]?): Ordered tasks for the next agent.
|
|
168
|
+
|
|
169
|
+
Returns: Compact handoff prompt, repo context snapshot, and remaining tasks.`,
|
|
170
|
+
inputSchema: AgentHandoffInputSchema,
|
|
171
|
+
outputSchema: AgentHandoffOutputSchema,
|
|
172
|
+
annotations: {
|
|
173
|
+
readOnlyHint: true,
|
|
174
|
+
destructiveHint: false,
|
|
175
|
+
idempotentHint: true,
|
|
176
|
+
openWorldHint: true,
|
|
177
|
+
},
|
|
178
|
+
}, async (params) => {
|
|
179
|
+
try {
|
|
180
|
+
const ref = resolveRepo(params.owner, params.repo);
|
|
181
|
+
const octokit = getOctokit();
|
|
182
|
+
const { text, structured } = await handleAgentHandoff(params, ref, octokit);
|
|
183
|
+
return {
|
|
184
|
+
content: [{ type: "text", text }],
|
|
185
|
+
structuredContent: structured,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return {
|
|
190
|
+
isError: true,
|
|
191
|
+
content: [{ type: "text", text: handleGitHubError(error) }],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=agent-handoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-handoff.js","sourceRoot":"","sources":["../../src/tools/agent-handoff.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,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IAClF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC/E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;SAChD,QAAQ,CAAC,wCAAwC,CAAC;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;SAC/C,QAAQ,CAAC,qCAAqC,CAAC;IAClD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SAC7B,QAAQ,CAAC,mDAAm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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,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: create_issue_set
|
|
3
|
+
*
|
|
4
|
+
* Handler extracted as `handleCreateIssueSet` for testability.
|
|
5
|
+
* Splits an SDLC plan into GitHub issues. dryRun defaults to TRUE.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import type { RepoRef } from "../types.js";
|
|
10
|
+
import type { Octokit } from "@octokit/rest";
|
|
11
|
+
export declare const CreateIssueSetInputSchema: z.ZodObject<{
|
|
12
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
13
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
14
|
+
titlePrefix: z.ZodOptional<z.ZodString>;
|
|
15
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
16
|
+
title: z.ZodString;
|
|
17
|
+
body: z.ZodString;
|
|
18
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
19
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
title: string;
|
|
22
|
+
body: string;
|
|
23
|
+
labels?: string[] | undefined;
|
|
24
|
+
assignees?: string[] | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
title: string;
|
|
27
|
+
body: string;
|
|
28
|
+
labels?: string[] | undefined;
|
|
29
|
+
assignees?: string[] | undefined;
|
|
30
|
+
}>, "many">;
|
|
31
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
issues: {
|
|
34
|
+
title: string;
|
|
35
|
+
body: string;
|
|
36
|
+
labels?: string[] | undefined;
|
|
37
|
+
assignees?: string[] | undefined;
|
|
38
|
+
}[];
|
|
39
|
+
dryRun: boolean;
|
|
40
|
+
owner?: string | undefined;
|
|
41
|
+
repo?: string | undefined;
|
|
42
|
+
titlePrefix?: string | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
issues: {
|
|
45
|
+
title: string;
|
|
46
|
+
body: string;
|
|
47
|
+
labels?: string[] | undefined;
|
|
48
|
+
assignees?: string[] | undefined;
|
|
49
|
+
}[];
|
|
50
|
+
owner?: string | undefined;
|
|
51
|
+
repo?: string | undefined;
|
|
52
|
+
titlePrefix?: string | undefined;
|
|
53
|
+
dryRun?: boolean | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export type CreateIssueSetInput = z.infer<typeof CreateIssueSetInputSchema>;
|
|
56
|
+
export declare const CreateIssueSetOutputSchema: {
|
|
57
|
+
dryRun: z.ZodBoolean;
|
|
58
|
+
count: z.ZodNumber;
|
|
59
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
60
|
+
number: z.ZodNumber;
|
|
61
|
+
title: z.ZodString;
|
|
62
|
+
url: z.ZodString;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
number: number;
|
|
65
|
+
title: string;
|
|
66
|
+
url: string;
|
|
67
|
+
}, {
|
|
68
|
+
number: number;
|
|
69
|
+
title: string;
|
|
70
|
+
url: string;
|
|
71
|
+
}>, "many">;
|
|
72
|
+
previewTitles: z.ZodArray<z.ZodString, "many">;
|
|
73
|
+
};
|
|
74
|
+
export interface CreatedIssue {
|
|
75
|
+
number: number;
|
|
76
|
+
title: string;
|
|
77
|
+
url: string;
|
|
78
|
+
}
|
|
79
|
+
export interface CreateIssueSetResult {
|
|
80
|
+
dryRun: boolean;
|
|
81
|
+
count: number;
|
|
82
|
+
issues: CreatedIssue[];
|
|
83
|
+
previewTitles: string[];
|
|
84
|
+
}
|
|
85
|
+
export declare function handleCreateIssueSet(params: CreateIssueSetInput, ref: RepoRef, octokit: Octokit): Promise<{
|
|
86
|
+
text: string;
|
|
87
|
+
structured: CreateIssueSetResult;
|
|
88
|
+
}>;
|
|
89
|
+
export declare function registerCreateIssueSetTool(server: McpServer): void;
|
|
90
|
+
//# sourceMappingURL=create-issue-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-issue-set.d.ts","sourceRoot":"","sources":["../../src/tools/create-issue-set.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAM7C,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;CAatC,CAAC;AAMF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAMD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,mBAAmB,EAC3B,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,oBAAoB,CAAA;CAAE,CAAC,CA+D7D;AAMD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0ClE"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: create_issue_set
|
|
3
|
+
*
|
|
4
|
+
* Handler extracted as `handleCreateIssueSet` for testability.
|
|
5
|
+
* Splits an SDLC plan into GitHub issues. dryRun defaults to TRUE.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { resolveRepo, getOctokit, handleGitHubError } from "../github/client.js";
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Schemas
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
export const CreateIssueSetInputSchema = 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
|
+
titlePrefix: z.string().optional().describe("Optional prefix prepended to every issue title."),
|
|
16
|
+
issues: z
|
|
17
|
+
.array(z.object({
|
|
18
|
+
title: z.string().min(1).describe("Issue title."),
|
|
19
|
+
body: z.string().describe("Issue body (markdown)."),
|
|
20
|
+
labels: z.array(z.string()).optional().describe("Labels to apply."),
|
|
21
|
+
assignees: z.array(z.string()).optional().describe("GitHub usernames to assign."),
|
|
22
|
+
}))
|
|
23
|
+
.min(1)
|
|
24
|
+
.max(50)
|
|
25
|
+
.describe("Array of issues to create (1-50)."),
|
|
26
|
+
dryRun: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.default(true)
|
|
29
|
+
.describe("If true (default), preview issues without creating them."),
|
|
30
|
+
});
|
|
31
|
+
export const CreateIssueSetOutputSchema = {
|
|
32
|
+
dryRun: z.boolean().describe("Whether this was a preview-only run."),
|
|
33
|
+
count: z.number().int().describe("Number of issues previewed or created."),
|
|
34
|
+
issues: z
|
|
35
|
+
.array(z.object({
|
|
36
|
+
number: z.number().int(),
|
|
37
|
+
title: z.string(),
|
|
38
|
+
url: z.string(),
|
|
39
|
+
}))
|
|
40
|
+
.describe("Created issues (empty in dry run)."),
|
|
41
|
+
previewTitles: z.array(z.string()).describe("Final titles (with prefix applied)."),
|
|
42
|
+
};
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Core handler (exported for testing)
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
export async function handleCreateIssueSet(params, ref, octokit) {
|
|
47
|
+
const prefix = params.titlePrefix ? `${params.titlePrefix} ` : "";
|
|
48
|
+
if (params.dryRun) {
|
|
49
|
+
const previewTitles = params.issues.map((i) => `${prefix}${i.title}`);
|
|
50
|
+
const structured = {
|
|
51
|
+
dryRun: true,
|
|
52
|
+
count: params.issues.length,
|
|
53
|
+
issues: [],
|
|
54
|
+
previewTitles,
|
|
55
|
+
};
|
|
56
|
+
const lines = [
|
|
57
|
+
`# Issue Set Preview (dry run) - ${params.issues.length} issue(s)`,
|
|
58
|
+
"",
|
|
59
|
+
`Repo: ${ref.owner}/${ref.repo}`,
|
|
60
|
+
"",
|
|
61
|
+
"> No issues were created. Set `dryRun: false` to create them.",
|
|
62
|
+
"",
|
|
63
|
+
];
|
|
64
|
+
params.issues.forEach((issue, i) => {
|
|
65
|
+
lines.push(`## ${i + 1}. ${prefix}${issue.title}`, "", issue.body, "", issue.labels && issue.labels.length > 0 ? `**Labels:** ${issue.labels.join(", ")}` : "", issue.assignees && issue.assignees.length > 0
|
|
66
|
+
? `**Assignees:** ${issue.assignees.join(", ")}`
|
|
67
|
+
: "", "");
|
|
68
|
+
});
|
|
69
|
+
return { text: lines.filter((l) => l !== "").join("\n"), structured };
|
|
70
|
+
}
|
|
71
|
+
// Live mode - create issues sequentially
|
|
72
|
+
const created = [];
|
|
73
|
+
for (const issue of params.issues) {
|
|
74
|
+
const { data } = await octokit.issues.create({
|
|
75
|
+
owner: ref.owner,
|
|
76
|
+
repo: ref.repo,
|
|
77
|
+
title: `${prefix}${issue.title}`,
|
|
78
|
+
body: issue.body,
|
|
79
|
+
labels: issue.labels,
|
|
80
|
+
assignees: issue.assignees,
|
|
81
|
+
});
|
|
82
|
+
created.push({ number: data.number, title: data.title, url: data.html_url });
|
|
83
|
+
}
|
|
84
|
+
const structured = {
|
|
85
|
+
dryRun: false,
|
|
86
|
+
count: created.length,
|
|
87
|
+
issues: created,
|
|
88
|
+
previewTitles: created.map((c) => c.title),
|
|
89
|
+
};
|
|
90
|
+
const lines = [
|
|
91
|
+
`# Issue Set Created - ${created.length} issue(s)`,
|
|
92
|
+
"",
|
|
93
|
+
`Repo: ${ref.owner}/${ref.repo}`,
|
|
94
|
+
"",
|
|
95
|
+
...created.map((c) => `- #${c.number} ${c.title} - ${c.url}`),
|
|
96
|
+
];
|
|
97
|
+
return { text: lines.join("\n"), structured };
|
|
98
|
+
}
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// Registration
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
export function registerCreateIssueSetTool(server) {
|
|
103
|
+
server.registerTool("create_issue_set", {
|
|
104
|
+
title: "Create GitHub Issue Set",
|
|
105
|
+
description: `Split an SDLC plan into GitHub issues. Supports dryRun (default TRUE) - preview mode.
|
|
106
|
+
|
|
107
|
+
SAFETY: dryRun defaults to true. You MUST explicitly pass dryRun:false to create issues.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
- owner, repo: Repository coordinates.
|
|
111
|
+
- titlePrefix (string?): Prefix for every issue title.
|
|
112
|
+
- issues (array): 1-50 issues, each with title, body, labels?, assignees?.
|
|
113
|
+
- dryRun (boolean): Default true - preview mode only.
|
|
114
|
+
|
|
115
|
+
Returns: Created issue numbers + URLs (live) or a preview (dry run).`,
|
|
116
|
+
inputSchema: CreateIssueSetInputSchema,
|
|
117
|
+
outputSchema: CreateIssueSetOutputSchema,
|
|
118
|
+
annotations: {
|
|
119
|
+
readOnlyHint: false,
|
|
120
|
+
destructiveHint: false,
|
|
121
|
+
idempotentHint: false,
|
|
122
|
+
openWorldHint: true,
|
|
123
|
+
},
|
|
124
|
+
}, async (params) => {
|
|
125
|
+
try {
|
|
126
|
+
const ref = resolveRepo(params.owner, params.repo);
|
|
127
|
+
const octokit = getOctokit();
|
|
128
|
+
const { text, structured } = await handleCreateIssueSet(params, ref, octokit);
|
|
129
|
+
return {
|
|
130
|
+
content: [{ type: "text", text }],
|
|
131
|
+
structuredContent: structured,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
return {
|
|
136
|
+
isError: true,
|
|
137
|
+
content: [{ type: "text", text: handleGitHubError(error) }],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=create-issue-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-issue-set.js","sourceRoot":"","sources":["../../src/tools/create-issue-set.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIjF,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IAClF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC/E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;IAC9F,MAAM,EAAE,CAAC;SACN,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,CAAC,CAA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AAM,EAAE,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;aAC5D,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: create_pr_summary
|
|
3
|
+
*
|
|
4
|
+
* Handler extracted as `handleCreatePrSummary` for testing.
|
|
5
|
+
* Uses paginateAll for PR file listing.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import type { RepoRef } from "../types.js";
|
|
10
|
+
import type { Octokit } from "@octokit/rest";
|
|
11
|
+
export declare const CreatePrSummaryInputSchema: z.ZodObject<{
|
|
12
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
13
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
14
|
+
pullNumber: z.ZodNumber;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
pullNumber: number;
|
|
17
|
+
owner?: string | undefined;
|
|
18
|
+
repo?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
pullNumber: number;
|
|
21
|
+
owner?: string | undefined;
|
|
22
|
+
repo?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type CreatePrSummaryInput = z.infer<typeof CreatePrSummaryInputSchema>;
|
|
25
|
+
export declare const CreatePrSummaryOutputSchema: {
|
|
26
|
+
pullNumber: z.ZodNumber;
|
|
27
|
+
title: z.ZodString;
|
|
28
|
+
author: z.ZodString;
|
|
29
|
+
isDraft: z.ZodBoolean;
|
|
30
|
+
baseRef: z.ZodString;
|
|
31
|
+
headRef: z.ZodString;
|
|
32
|
+
commits: z.ZodNumber;
|
|
33
|
+
totalAdditions: z.ZodNumber;
|
|
34
|
+
totalDeletions: z.ZodNumber;
|
|
35
|
+
totalFiles: z.ZodNumber;
|
|
36
|
+
hasTests: z.ZodBoolean;
|
|
37
|
+
risks: z.ZodArray<z.ZodString, "many">;
|
|
38
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
39
|
+
};
|
|
40
|
+
export interface PrSummaryResult {
|
|
41
|
+
pullNumber: number;
|
|
42
|
+
title: string;
|
|
43
|
+
author: string;
|
|
44
|
+
isDraft: boolean;
|
|
45
|
+
baseRef: string;
|
|
46
|
+
headRef: string;
|
|
47
|
+
commits: number;
|
|
48
|
+
totalAdditions: number;
|
|
49
|
+
totalDeletions: number;
|
|
50
|
+
totalFiles: number;
|
|
51
|
+
hasTests: boolean;
|
|
52
|
+
risks: string[];
|
|
53
|
+
labels: string[];
|
|
54
|
+
}
|
|
55
|
+
export declare function handleCreatePrSummary(params: CreatePrSummaryInput, ref: RepoRef, octokit: Octokit): Promise<{
|
|
56
|
+
text: string;
|
|
57
|
+
structured: PrSummaryResult;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function registerCreatePrSummaryTool(server: McpServer): void;
|
|
60
|
+
//# sourceMappingURL=create-pr-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-pr-summary.d.ts","sourceRoot":"","sources":["../../src/tools/create-pr-summary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAM7C,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAIrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAM9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;CAcvC,CAAC;AAMF,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB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