@azerate/claudette-mcp 1.7.1 → 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 +71 -8
- 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';
|
|
@@ -523,7 +524,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
523
524
|
},
|
|
524
525
|
{
|
|
525
526
|
name: "approve_write_tests",
|
|
526
|
-
description: "Mark the write tests step as complete
|
|
527
|
+
description: "Mark the write tests step as complete AFTER you have written tests. CRITICAL: You MUST write tests before calling this - NEVER skip this step or ask the user if they want to skip. When workflow reaches ready_write_tests, immediately write tests for uncovered files, then call this tool.",
|
|
527
528
|
inputSchema: {
|
|
528
529
|
type: "object",
|
|
529
530
|
properties: {
|
|
@@ -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
|
},
|
|
@@ -1384,6 +1390,29 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1384
1390
|
if (status.error) {
|
|
1385
1391
|
output += `\n❌ Error: ${status.error}\n`;
|
|
1386
1392
|
}
|
|
1393
|
+
// CRITICAL: Show explicit action required when at ready_write_tests step
|
|
1394
|
+
if (status.currentStep === 'ready_write_tests') {
|
|
1395
|
+
output += `\n${"═".repeat(50)}\n`;
|
|
1396
|
+
output += `🚨 ACTION REQUIRED: WRITE TESTS\n`;
|
|
1397
|
+
output += `${"═".repeat(50)}\n\n`;
|
|
1398
|
+
output += `Coverage is at ${status.steps.coverage?.percent || 0}%.\n\n`;
|
|
1399
|
+
output += `DO NOT SKIP THIS STEP. You MUST:\n`;
|
|
1400
|
+
output += `1. Identify files that need test coverage\n`;
|
|
1401
|
+
output += `2. Write tests for uncovered code paths\n`;
|
|
1402
|
+
output += `3. Run tests to verify they pass\n`;
|
|
1403
|
+
output += `4. Use approve_write_tests when done\n\n`;
|
|
1404
|
+
if (status.steps.coverage?.uncoveredFiles?.length > 0) {
|
|
1405
|
+
output += `Files needing tests:\n`;
|
|
1406
|
+
for (const file of status.steps.coverage.uncoveredFiles.slice(0, 5)) {
|
|
1407
|
+
output += ` - ${file}\n`;
|
|
1408
|
+
}
|
|
1409
|
+
if (status.steps.coverage.uncoveredFiles.length > 5) {
|
|
1410
|
+
output += ` ... and ${status.steps.coverage.uncoveredFiles.length - 5} more\n`;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
output += `\nNEVER ask the user if they want to skip writing tests.\n`;
|
|
1414
|
+
output += `ALWAYS write tests before proceeding to commit.\n`;
|
|
1415
|
+
}
|
|
1387
1416
|
// Show recommendation if available (auto-populated when changes exist)
|
|
1388
1417
|
if (status.recommendation) {
|
|
1389
1418
|
const rec = status.recommendation;
|
|
@@ -1529,22 +1558,56 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1529
1558
|
case "approve_code_review": {
|
|
1530
1559
|
const workspacePath = args?.workspace_path;
|
|
1531
1560
|
const reviewer = args?.reviewer;
|
|
1561
|
+
const mergeMethod = args?.merge_method || 'squash';
|
|
1532
1562
|
if (!workspacePath) {
|
|
1533
1563
|
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1534
1564
|
}
|
|
1535
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
|
|
1536
1597
|
const response = await fetch(`${CLAUDETTE_API}/api/workflow/code-review`, {
|
|
1537
1598
|
method: "POST",
|
|
1538
1599
|
headers: { "Content-Type": "application/json" },
|
|
1539
1600
|
body: JSON.stringify({ path: workspacePath, reviewer }),
|
|
1540
1601
|
});
|
|
1541
1602
|
const result = await response.json();
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
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 }] };
|
|
1548
1611
|
}
|
|
1549
1612
|
catch (err) {
|
|
1550
1613
|
return { content: [{ type: "text", text: `Error: ${err.message}` }] };
|
package/package.json
CHANGED