@azerate/claudette-mcp 1.7.4 → 1.7.5
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 +42 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1563,6 +1563,48 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1563
1563
|
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1564
1564
|
}
|
|
1565
1565
|
try {
|
|
1566
|
+
// SAFETY CHECK 1: Check for uncommitted changes
|
|
1567
|
+
try {
|
|
1568
|
+
const status = execSync('git status --porcelain', {
|
|
1569
|
+
cwd: workspacePath,
|
|
1570
|
+
encoding: 'utf-8',
|
|
1571
|
+
}).trim();
|
|
1572
|
+
if (status) {
|
|
1573
|
+
return { content: [{ type: "text", text: `❌ BLOCKED: You have uncommitted changes!\n\nUncommitted files:\n${status}\n\nCommit and push these changes before merging to avoid losing code.` }] };
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
catch {
|
|
1577
|
+
// Ignore git status errors
|
|
1578
|
+
}
|
|
1579
|
+
// SAFETY CHECK 2: Check if local branch is ahead of remote (unpushed commits)
|
|
1580
|
+
try {
|
|
1581
|
+
const ahead = execSync('git rev-list @{u}..HEAD --count', {
|
|
1582
|
+
cwd: workspacePath,
|
|
1583
|
+
encoding: 'utf-8',
|
|
1584
|
+
}).trim();
|
|
1585
|
+
const aheadCount = parseInt(ahead, 10);
|
|
1586
|
+
if (aheadCount > 0) {
|
|
1587
|
+
return { content: [{ type: "text", text: `❌ BLOCKED: You have ${aheadCount} unpushed commit(s)!\n\nPush your changes before merging to avoid losing code.\nUse approve_push first, then try approve_code_review again.` }] };
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
catch {
|
|
1591
|
+
// No upstream or error - continue (might be ok)
|
|
1592
|
+
}
|
|
1593
|
+
// SAFETY CHECK 3: Fetch and verify remote is up to date
|
|
1594
|
+
try {
|
|
1595
|
+
execSync('git fetch', { cwd: workspacePath, stdio: 'pipe', timeout: 10000 });
|
|
1596
|
+
const behind = execSync('git rev-list HEAD..@{u} --count', {
|
|
1597
|
+
cwd: workspacePath,
|
|
1598
|
+
encoding: 'utf-8',
|
|
1599
|
+
}).trim();
|
|
1600
|
+
const behindCount = parseInt(behind, 10);
|
|
1601
|
+
if (behindCount > 0) {
|
|
1602
|
+
return { content: [{ type: "text", text: `❌ BLOCKED: Remote has ${behindCount} commit(s) you don't have locally!\n\nPull the latest changes before merging.` }] };
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
catch {
|
|
1606
|
+
// Ignore fetch errors
|
|
1607
|
+
}
|
|
1566
1608
|
// First, check if there's an open PR for this branch
|
|
1567
1609
|
let prNumber;
|
|
1568
1610
|
let prTitle;
|
package/package.json
CHANGED