@azerate/claudette-mcp 1.6.0 → 1.7.1

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.
Files changed (3) hide show
  1. package/README.md +27 -0
  2. package/dist/index.js +142 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -64,6 +64,7 @@ Add to `~/.claude.json`:
64
64
  |------|-------------|
65
65
  | `get_changes` | Get pending git changes (modified, added, deleted files) |
66
66
  | `get_branch_info` | Get current branch, behind/ahead status, sync state |
67
+ | `get_branch_pr_status` | Check if current branch has an open/merged/closed PR |
67
68
  | `create_branch` | Create a new feature branch from main/master |
68
69
  | `sync_branch` | Rebase or merge current branch with main |
69
70
  | `get_checkpoints` | List saved checkpoints (git stash snapshots) |
@@ -76,6 +77,7 @@ Add to `~/.claude.json`:
76
77
  | Tool | Description |
77
78
  |------|-------------|
78
79
  | `get_workflow_status` | Get current workflow pipeline status |
80
+ | `get_workflow_recommendation` | **Smart recommendation** - analyzes branch, PR status, and changes to suggest the best next action |
79
81
  | `trigger_workflow` | Start the workflow (lint, types, tests, coverage, benchmarks) |
80
82
  | `generate_commit_message` | Generate a commit message from changes |
81
83
  | `approve_commit` | Stage and commit with the provided message |
@@ -115,6 +117,31 @@ Add to `~/.claude.json`:
115
117
  | `complete_refactor_step` | Mark a step as completed |
116
118
  | `complete_refactor` | Finish refactoring and delete plan |
117
119
 
120
+ ## Smart Workflow Recommendations
121
+
122
+ Before starting a workflow, always call `get_workflow_recommendation` to get intelligent guidance:
123
+
124
+ ```
125
+ get_workflow_recommendation(workspace_path="/path/to/project")
126
+ ```
127
+
128
+ The tool analyzes your current state and recommends the best action:
129
+
130
+ | Recommended Action | When | What to Do |
131
+ |-------------------|------|------------|
132
+ | `start_workflow` | Normal flow, no blockers | Proceed with `trigger_workflow` |
133
+ | `create_feature_branch` | On main with `requireFeatureBranch` enabled | Use `create_branch` first |
134
+ | `add_to_existing_pr` | On feature branch with open PR | Your commits will update the existing PR |
135
+ | `switch_to_main` | PR was merged, branch is stale | Switch to main, pull, create new branch |
136
+ | `create_new_branch` | PR was closed (not merged) | Create a fresh branch or reopen PR |
137
+ | `sync_branch_first` | Branch is >5 commits behind main | Use `sync_branch` before committing |
138
+ | `no_changes` | No uncommitted changes | Nothing to commit yet |
139
+
140
+ Each recommendation includes:
141
+ - **reason**: Why this action is recommended
142
+ - **suggestion**: What you should do (trust this!)
143
+ - **consequences**: What will happen if you proceed
144
+
118
145
  ## Workflow Pipeline
119
146
 
120
147
  The workflow feature provides a 10-step guided development process with best-practice Git support:
package/dist/index.js CHANGED
@@ -634,6 +634,34 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
634
634
  required: ["workspace_path"],
635
635
  },
636
636
  },
637
+ {
638
+ name: "get_branch_pr_status",
639
+ description: "Check if the current branch has an associated pull request and its status (open, merged, or closed). Useful for understanding the current state before making changes.",
640
+ inputSchema: {
641
+ type: "object",
642
+ properties: {
643
+ workspace_path: {
644
+ type: "string",
645
+ description: "Path to the workspace directory",
646
+ },
647
+ },
648
+ required: ["workspace_path"],
649
+ },
650
+ },
651
+ {
652
+ name: "get_workflow_recommendation",
653
+ description: "Get a smart recommendation for what to do before starting the workflow. Analyzes current branch, PR status, uncommitted changes, and sync status to suggest the best next action. ALWAYS call this before trigger_workflow to ensure you're following best practices.",
654
+ inputSchema: {
655
+ type: "object",
656
+ properties: {
657
+ workspace_path: {
658
+ type: "string",
659
+ description: "Path to the workspace directory",
660
+ },
661
+ },
662
+ required: ["workspace_path"],
663
+ },
664
+ },
637
665
  ],
638
666
  };
639
667
  });
@@ -1356,6 +1384,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1356
1384
  if (status.error) {
1357
1385
  output += `\n❌ Error: ${status.error}\n`;
1358
1386
  }
1387
+ // Show recommendation if available (auto-populated when changes exist)
1388
+ if (status.recommendation) {
1389
+ const rec = status.recommendation;
1390
+ const actionIcons = {
1391
+ 'start_workflow': '▶️',
1392
+ 'create_feature_branch': '🌿',
1393
+ 'add_to_existing_pr': '📝',
1394
+ 'switch_to_main': '🔄',
1395
+ 'create_new_branch': '🆕',
1396
+ 'sync_branch_first': '🔀',
1397
+ 'no_changes': '📭',
1398
+ };
1399
+ const icon = actionIcons[rec.action] || '❓';
1400
+ output += `\n${"─".repeat(40)}\n`;
1401
+ output += `${icon} RECOMMENDATION: ${rec.action.replace(/_/g, ' ').toUpperCase()}\n`;
1402
+ output += `${rec.suggestion}\n`;
1403
+ }
1359
1404
  return { content: [{ type: "text", text: output }] };
1360
1405
  }
1361
1406
  catch (err) {
@@ -1632,6 +1677,103 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1632
1677
  return { content: [{ type: "text", text: `Error: ${err.message}` }] };
1633
1678
  }
1634
1679
  }
1680
+ case "get_branch_pr_status": {
1681
+ const workspacePath = args?.workspace_path;
1682
+ if (!workspacePath) {
1683
+ return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
1684
+ }
1685
+ try {
1686
+ const response = await fetch(`${CLAUDETTE_API}/api/workflow/pr-status?path=${encodeURIComponent(workspacePath)}`);
1687
+ const status = await response.json();
1688
+ let output = `Branch PR Status\n${'='.repeat(50)}\n\n`;
1689
+ if (!status.hasPR) {
1690
+ output += `No pull request found for this branch.\n`;
1691
+ output += `\nThis is normal if:\n`;
1692
+ output += ` • You're on main/master\n`;
1693
+ output += ` • This is a new feature branch without a PR yet\n`;
1694
+ }
1695
+ else {
1696
+ const statusIcon = status.prStatus === 'open' ? '🟢' :
1697
+ status.prStatus === 'merged' ? '🟣' : '🔴';
1698
+ output += `${statusIcon} PR #${status.prNumber}: ${status.prStatus.toUpperCase()}\n`;
1699
+ output += `Title: ${status.prTitle}\n`;
1700
+ output += `URL: ${status.prUrl}\n`;
1701
+ if (status.isDraft) {
1702
+ output += `📝 This is a draft PR\n`;
1703
+ }
1704
+ output += `\n`;
1705
+ if (status.prStatus === 'open') {
1706
+ output += `ℹ️ New commits will be added to this existing PR.\n`;
1707
+ }
1708
+ else if (status.prStatus === 'merged') {
1709
+ output += `⚠️ This PR was merged. Consider switching to main and creating a new branch.\n`;
1710
+ }
1711
+ else {
1712
+ output += `⚠️ This PR was closed without merging. You may want to create a new branch or reopen it.\n`;
1713
+ }
1714
+ }
1715
+ return { content: [{ type: "text", text: output }] };
1716
+ }
1717
+ catch (err) {
1718
+ return { content: [{ type: "text", text: `Error: ${err.message}` }] };
1719
+ }
1720
+ }
1721
+ case "get_workflow_recommendation": {
1722
+ const workspacePath = args?.workspace_path;
1723
+ if (!workspacePath) {
1724
+ return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
1725
+ }
1726
+ try {
1727
+ const response = await fetch(`${CLAUDETTE_API}/api/workflow/recommendation?path=${encodeURIComponent(workspacePath)}`);
1728
+ const rec = await response.json();
1729
+ let output = `Workflow Recommendation\n${'='.repeat(50)}\n\n`;
1730
+ // Action header with icon
1731
+ const actionIcons = {
1732
+ 'start_workflow': '▶️',
1733
+ 'create_feature_branch': '🌿',
1734
+ 'add_to_existing_pr': '📝',
1735
+ 'switch_to_main': '🔄',
1736
+ 'create_new_branch': '🆕',
1737
+ 'sync_branch_first': '🔀',
1738
+ 'no_changes': '📭',
1739
+ };
1740
+ const icon = actionIcons[rec.action] || '❓';
1741
+ output += `${icon} RECOMMENDED ACTION: ${rec.action.replace(/_/g, ' ').toUpperCase()}\n\n`;
1742
+ // Current state summary
1743
+ output += `Current State:\n`;
1744
+ output += `────────────────────────────────────────\n`;
1745
+ output += ` Branch: ${rec.details.currentBranch}${rec.details.isMain ? ' (main)' : ''}\n`;
1746
+ output += ` Changes: ${rec.details.changeCount} uncommitted file(s)\n`;
1747
+ if (rec.details.prStatus) {
1748
+ output += ` PR: #${rec.details.prStatus.prNumber} (${rec.details.prStatus.prStatus})\n`;
1749
+ }
1750
+ if (rec.details.behindMain && rec.details.behindMain > 0) {
1751
+ output += ` ⚠️ Behind main: ${rec.details.behindMain} commit(s)\n`;
1752
+ }
1753
+ output += `\n`;
1754
+ // Reason and suggestion
1755
+ output += `Why:\n`;
1756
+ output += `────────────────────────────────────────\n`;
1757
+ output += `${rec.reason}\n\n`;
1758
+ output += `Suggestion:\n`;
1759
+ output += `────────────────────────────────────────\n`;
1760
+ output += `${rec.suggestion}\n\n`;
1761
+ // What will happen
1762
+ if (rec.consequences.length > 0) {
1763
+ output += `What will happen:\n`;
1764
+ output += `────────────────────────────────────────\n`;
1765
+ for (const c of rec.consequences) {
1766
+ output += ` • ${c}\n`;
1767
+ }
1768
+ }
1769
+ output += `\n${'='.repeat(50)}\n`;
1770
+ output += `Trust this recommendation and proceed accordingly.\n`;
1771
+ return { content: [{ type: "text", text: output }] };
1772
+ }
1773
+ catch (err) {
1774
+ return { content: [{ type: "text", text: `Error: ${err.message}` }] };
1775
+ }
1776
+ }
1635
1777
  default:
1636
1778
  return { content: [{ type: "text", text: `Unknown tool: ${name}` }] };
1637
1779
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azerate/claudette-mcp",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "MCP server for Claudette IDE - TypeScript errors, git changes, checkpoints, memory, and script management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",