@azerate/claudette-mcp 1.7.2 → 1.7.3
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/dist/index.js +47 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { execSync } from "child_process";
|
|
5
6
|
// Import from extracted modules
|
|
6
7
|
import { getScripts, getScriptOutput, startScript, stopScript } from './scripts.js';
|
|
7
8
|
import { getWorkspaceConfig, saveWorkspaceConfig, clearMemory, deleteMemoryNotes, replaceMemory } from './workspace.js';
|
|
@@ -541,7 +542,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
541
542
|
},
|
|
542
543
|
{
|
|
543
544
|
name: "approve_code_review",
|
|
544
|
-
description: "
|
|
545
|
+
description: "Complete the code review step AND merge the PR. This will merge the PR on GitHub and mark the workflow as complete.",
|
|
545
546
|
inputSchema: {
|
|
546
547
|
type: "object",
|
|
547
548
|
properties: {
|
|
@@ -553,6 +554,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
553
554
|
type: "string",
|
|
554
555
|
description: "Name of the reviewer (optional)",
|
|
555
556
|
},
|
|
557
|
+
merge_method: {
|
|
558
|
+
type: "string",
|
|
559
|
+
enum: ["squash", "merge", "rebase"],
|
|
560
|
+
description: "How to merge the PR: squash (default), merge, or rebase",
|
|
561
|
+
},
|
|
556
562
|
},
|
|
557
563
|
required: ["workspace_path"],
|
|
558
564
|
},
|
|
@@ -1552,22 +1558,56 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1552
1558
|
case "approve_code_review": {
|
|
1553
1559
|
const workspacePath = args?.workspace_path;
|
|
1554
1560
|
const reviewer = args?.reviewer;
|
|
1561
|
+
const mergeMethod = args?.merge_method || 'squash';
|
|
1555
1562
|
if (!workspacePath) {
|
|
1556
1563
|
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1557
1564
|
}
|
|
1558
1565
|
try {
|
|
1566
|
+
// First, check if there's an open PR for this branch
|
|
1567
|
+
let prNumber;
|
|
1568
|
+
let prTitle;
|
|
1569
|
+
try {
|
|
1570
|
+
const prInfo = execSync('gh pr view --json number,title', {
|
|
1571
|
+
cwd: workspacePath,
|
|
1572
|
+
encoding: 'utf-8',
|
|
1573
|
+
});
|
|
1574
|
+
const parsed = JSON.parse(prInfo);
|
|
1575
|
+
prNumber = parsed.number?.toString();
|
|
1576
|
+
prTitle = parsed.title;
|
|
1577
|
+
}
|
|
1578
|
+
catch {
|
|
1579
|
+
// No PR found
|
|
1580
|
+
}
|
|
1581
|
+
if (!prNumber) {
|
|
1582
|
+
return { content: [{ type: "text", text: "❌ No open PR found for this branch. Cannot merge." }] };
|
|
1583
|
+
}
|
|
1584
|
+
// Merge the PR using gh CLI
|
|
1585
|
+
const mergeFlag = mergeMethod === 'squash' ? '--squash' : mergeMethod === 'rebase' ? '--rebase' : '--merge';
|
|
1586
|
+
try {
|
|
1587
|
+
execSync(`gh pr merge ${prNumber} ${mergeFlag} --delete-branch`, {
|
|
1588
|
+
cwd: workspacePath,
|
|
1589
|
+
encoding: 'utf-8',
|
|
1590
|
+
stdio: 'pipe',
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
catch (mergeErr) {
|
|
1594
|
+
return { content: [{ type: "text", text: `❌ Failed to merge PR #${prNumber}: ${mergeErr.message}` }] };
|
|
1595
|
+
}
|
|
1596
|
+
// Mark workflow as complete
|
|
1559
1597
|
const response = await fetch(`${CLAUDETTE_API}/api/workflow/code-review`, {
|
|
1560
1598
|
method: "POST",
|
|
1561
1599
|
headers: { "Content-Type": "application/json" },
|
|
1562
1600
|
body: JSON.stringify({ path: workspacePath, reviewer }),
|
|
1563
1601
|
});
|
|
1564
1602
|
const result = await response.json();
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1603
|
+
let output = `✅ PR #${prNumber} merged successfully!\n\n`;
|
|
1604
|
+
output += `Title: ${prTitle}\n`;
|
|
1605
|
+
output += `Method: ${mergeMethod}\n`;
|
|
1606
|
+
output += `Branch deleted: Yes\n`;
|
|
1607
|
+
if (reviewer)
|
|
1608
|
+
output += `Reviewer: ${reviewer}\n`;
|
|
1609
|
+
output += `\nWorkflow complete.`;
|
|
1610
|
+
return { content: [{ type: "text", text: output }] };
|
|
1571
1611
|
}
|
|
1572
1612
|
catch (err) {
|
|
1573
1613
|
return { content: [{ type: "text", text: `Error: ${err.message}` }] };
|
package/package.json
CHANGED