@azerate/claudette-mcp 1.2.0 → 1.4.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/README.md +130 -17
- package/dist/index.js +338 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
# Claudette MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
MCP server for Claudette IDE - providing Claude with comprehensive workspace management tools.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @azerate/claudette-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install globally:
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @azerate/claudette-mcp
|
|
14
|
+
```
|
|
8
15
|
|
|
9
16
|
## Setup
|
|
10
17
|
|
|
11
18
|
### Option 1: Add via Claude Code CLI
|
|
12
19
|
```bash
|
|
13
|
-
claude mcp add claudette
|
|
20
|
+
claude mcp add claudette -- npx @azerate/claudette-mcp
|
|
14
21
|
```
|
|
15
22
|
|
|
16
23
|
### Option 2: Add to .mcp.json (project-level)
|
|
@@ -20,29 +27,135 @@ Create `.mcp.json` in your project root:
|
|
|
20
27
|
"mcpServers": {
|
|
21
28
|
"claudette": {
|
|
22
29
|
"type": "stdio",
|
|
23
|
-
"command": "
|
|
24
|
-
"args": ["
|
|
30
|
+
"command": "npx",
|
|
31
|
+
"args": ["@azerate/claudette-mcp"]
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
```
|
|
29
36
|
|
|
30
37
|
### Option 3: Add to Claude Code settings
|
|
31
|
-
Add to `~/.claude.json
|
|
38
|
+
Add to `~/.claude.json`:
|
|
32
39
|
```json
|
|
33
40
|
"mcpServers": {
|
|
34
41
|
"claudette": {
|
|
35
42
|
"type": "stdio",
|
|
36
|
-
"command": "
|
|
37
|
-
"args": ["
|
|
43
|
+
"command": "npx",
|
|
44
|
+
"args": ["@azerate/claudette-mcp"]
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
```
|
|
41
48
|
|
|
42
|
-
##
|
|
49
|
+
## Available Tools
|
|
50
|
+
|
|
51
|
+
### Code Quality
|
|
52
|
+
|
|
53
|
+
| Tool | Description |
|
|
54
|
+
|------|-------------|
|
|
55
|
+
| `get_errors` | Get TypeScript compilation errors for the workspace |
|
|
56
|
+
| `run_tests` | Run Jest tests and return results |
|
|
57
|
+
| `get_test_results` | Get the latest test results |
|
|
58
|
+
| `run_benchmarks` | Run performance benchmarks (tinybench/vitest) |
|
|
59
|
+
| `get_benchmark_results` | Get the latest benchmark results |
|
|
60
|
+
|
|
61
|
+
### Git & Changes
|
|
62
|
+
|
|
63
|
+
| Tool | Description |
|
|
64
|
+
|------|-------------|
|
|
65
|
+
| `get_changes` | Get pending git changes (modified, added, deleted files) |
|
|
66
|
+
| `get_checkpoints` | List saved checkpoints (git stash snapshots) |
|
|
67
|
+
| `create_checkpoint` | Create a checkpoint before risky changes |
|
|
68
|
+
| `restore_checkpoint` | Restore workspace to a previous checkpoint |
|
|
69
|
+
| `delete_checkpoint` | Delete a checkpoint permanently |
|
|
70
|
+
|
|
71
|
+
### Workflow Automation
|
|
72
|
+
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `get_workflow_status` | Get current workflow pipeline status |
|
|
76
|
+
| `trigger_workflow` | Start the workflow (lint, types, tests, coverage, benchmarks) |
|
|
77
|
+
| `generate_commit_message` | Generate a commit message from changes |
|
|
78
|
+
| `approve_commit` | Stage and commit with the provided message |
|
|
79
|
+
| `approve_push` | Push committed changes to remote |
|
|
80
|
+
|
|
81
|
+
### Project Memory
|
|
82
|
+
|
|
83
|
+
| Tool | Description |
|
|
84
|
+
|------|-------------|
|
|
85
|
+
| `get_memory` | Get project memory notes |
|
|
86
|
+
| `add_memory` | Add a note to project memory |
|
|
87
|
+
| `clear_memory` | Clear all project memory notes |
|
|
88
|
+
| `delete_memory` | Delete specific notes by index |
|
|
89
|
+
| `replace_memory` | Replace all memory with new notes |
|
|
90
|
+
|
|
91
|
+
### Scripts & Automation
|
|
92
|
+
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `list_scripts` | List npm scripts and their status |
|
|
96
|
+
| `run_script` | Start an npm script |
|
|
97
|
+
| `stop_script` | Stop a running script |
|
|
98
|
+
| `get_console_output` | Get console output from a script |
|
|
99
|
+
| `check_quick_actions` | Check for pending UI-triggered actions |
|
|
100
|
+
|
|
101
|
+
### Refactoring
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `create_refactor_plan` | Analyze workspace and create refactoring plan |
|
|
106
|
+
| `get_refactor_plan` | Get the current refactor plan |
|
|
107
|
+
| `get_next_refactor_step` | Get the next uncompleted step |
|
|
108
|
+
| `verify_refactor` | Run tests and compare to baseline |
|
|
109
|
+
| `complete_refactor_step` | Mark a step as completed |
|
|
110
|
+
| `complete_refactor` | Finish refactoring and delete plan |
|
|
111
|
+
|
|
112
|
+
## Workflow Pipeline
|
|
113
|
+
|
|
114
|
+
The workflow feature provides a guided development process:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
trigger_workflow()
|
|
118
|
+
|
|
|
119
|
+
v
|
|
120
|
+
[AUTOMATIC]
|
|
121
|
+
1. Lint (with auto-fix)
|
|
122
|
+
2. Type checking
|
|
123
|
+
3. Run tests
|
|
124
|
+
4. Coverage analysis
|
|
125
|
+
5. Benchmarks (optional)
|
|
126
|
+
|
|
|
127
|
+
v
|
|
128
|
+
[HUMAN GATES]
|
|
129
|
+
6. Review & Commit (approve_commit)
|
|
130
|
+
7. Push (approve_push)
|
|
131
|
+
8. Create PR
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Example Usage
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
# Check for errors
|
|
138
|
+
get_errors(workspace_path="/path/to/project")
|
|
139
|
+
|
|
140
|
+
# Run full workflow
|
|
141
|
+
trigger_workflow(workspace_path="/path/to/project")
|
|
142
|
+
|
|
143
|
+
# Check workflow status
|
|
144
|
+
get_workflow_status(workspace_path="/path/to/project")
|
|
145
|
+
|
|
146
|
+
# After checks pass, commit
|
|
147
|
+
generate_commit_message(workspace_path="/path/to/project")
|
|
148
|
+
approve_commit(workspace_path="/path/to/project", message="Add new feature")
|
|
149
|
+
|
|
150
|
+
# Push changes
|
|
151
|
+
approve_push(workspace_path="/path/to/project")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Requirements
|
|
155
|
+
|
|
156
|
+
- Node.js 18+
|
|
157
|
+
- Claudette IDE server running on port 52001 (for full functionality)
|
|
158
|
+
|
|
159
|
+
## License
|
|
43
160
|
|
|
44
|
-
|
|
45
|
-
- `get_errors` - Pass workspace_path to check for TypeScript errors
|
|
46
|
-
- `get_changes` - Pass workspace_path to see git status
|
|
47
|
-
- `get_memory` - Pass workspace_path to read project notes
|
|
48
|
-
- `add_memory` - Pass workspace_path and note to save a note
|
|
161
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -419,6 +419,108 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
419
419
|
required: ["workspace_path"],
|
|
420
420
|
},
|
|
421
421
|
},
|
|
422
|
+
{
|
|
423
|
+
name: "run_benchmarks",
|
|
424
|
+
description: "Run performance benchmarks for the workspace. Returns benchmark results with ops/sec and timing data. Supports Tinybench, Vitest bench, and Benchmark.js.",
|
|
425
|
+
inputSchema: {
|
|
426
|
+
type: "object",
|
|
427
|
+
properties: {
|
|
428
|
+
workspace_path: {
|
|
429
|
+
type: "string",
|
|
430
|
+
description: "Path to the workspace directory",
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
required: ["workspace_path"],
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
name: "get_benchmark_results",
|
|
438
|
+
description: "Get the latest benchmark results for the workspace. Shows ops/sec, timing, and comparison data.",
|
|
439
|
+
inputSchema: {
|
|
440
|
+
type: "object",
|
|
441
|
+
properties: {
|
|
442
|
+
workspace_path: {
|
|
443
|
+
type: "string",
|
|
444
|
+
description: "Path to the workspace directory",
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
required: ["workspace_path"],
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
name: "get_workflow_status",
|
|
452
|
+
description: "Get the current workflow status for the workspace. Shows which checks have run (lint, types, tests, coverage, benchmarks) and git action status (commit, push, PR).",
|
|
453
|
+
inputSchema: {
|
|
454
|
+
type: "object",
|
|
455
|
+
properties: {
|
|
456
|
+
workspace_path: {
|
|
457
|
+
type: "string",
|
|
458
|
+
description: "Path to the workspace directory",
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
required: ["workspace_path"],
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: "trigger_workflow",
|
|
466
|
+
description: "Start the development workflow pipeline. Runs automatic checks: lint (with auto-fix), type checking, tests, coverage analysis, and optionally benchmarks. The workflow pauses at git actions (commit, push, PR) for user approval.",
|
|
467
|
+
inputSchema: {
|
|
468
|
+
type: "object",
|
|
469
|
+
properties: {
|
|
470
|
+
workspace_path: {
|
|
471
|
+
type: "string",
|
|
472
|
+
description: "Path to the workspace directory",
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
required: ["workspace_path"],
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: "generate_commit_message",
|
|
480
|
+
description: "Generate a commit message based on the current git changes. Returns a suggested commit message.",
|
|
481
|
+
inputSchema: {
|
|
482
|
+
type: "object",
|
|
483
|
+
properties: {
|
|
484
|
+
workspace_path: {
|
|
485
|
+
type: "string",
|
|
486
|
+
description: "Path to the workspace directory",
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
required: ["workspace_path"],
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: "approve_commit",
|
|
494
|
+
description: "Stage all changes and create a git commit with the provided message. Use after workflow checks pass.",
|
|
495
|
+
inputSchema: {
|
|
496
|
+
type: "object",
|
|
497
|
+
properties: {
|
|
498
|
+
workspace_path: {
|
|
499
|
+
type: "string",
|
|
500
|
+
description: "Path to the workspace directory",
|
|
501
|
+
},
|
|
502
|
+
message: {
|
|
503
|
+
type: "string",
|
|
504
|
+
description: "The commit message",
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
required: ["workspace_path", "message"],
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: "approve_push",
|
|
512
|
+
description: "Push the committed changes to the remote repository.",
|
|
513
|
+
inputSchema: {
|
|
514
|
+
type: "object",
|
|
515
|
+
properties: {
|
|
516
|
+
workspace_path: {
|
|
517
|
+
type: "string",
|
|
518
|
+
description: "Path to the workspace directory",
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
required: ["workspace_path"],
|
|
522
|
+
},
|
|
523
|
+
},
|
|
422
524
|
],
|
|
423
525
|
};
|
|
424
526
|
});
|
|
@@ -904,6 +1006,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
904
1006
|
if (step.type === 'verify_tests') {
|
|
905
1007
|
output += `ACTION: Run verify_refactor to check tests against baseline.`;
|
|
906
1008
|
}
|
|
1009
|
+
else if (step.type === 'write_tests') {
|
|
1010
|
+
output += `IMPORTANT: A test framework was just installed with only a placeholder test.\n`;
|
|
1011
|
+
output += `You MUST write real unit tests for the critical files listed above before proceeding.\n\n`;
|
|
1012
|
+
output += `For each file, create a corresponding test file (e.g., store.test.ts for store.tsx) that:\n`;
|
|
1013
|
+
output += ` 1. Imports the main functions/components from the file\n`;
|
|
1014
|
+
output += ` 2. Tests the core functionality with meaningful assertions\n`;
|
|
1015
|
+
output += ` 3. Covers edge cases and error handling\n\n`;
|
|
1016
|
+
output += `After writing tests, run verify_refactor to establish a proper baseline.`;
|
|
1017
|
+
}
|
|
907
1018
|
else if (step.type === 'extract_module') {
|
|
908
1019
|
output += `ACTION: Extract the listed functions to the target file, then run verify_refactor.`;
|
|
909
1020
|
}
|
|
@@ -1003,6 +1114,233 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1003
1114
|
return { content: [{ type: "text", text: `Error getting test results: ${err.message}` }] };
|
|
1004
1115
|
}
|
|
1005
1116
|
}
|
|
1117
|
+
case "run_benchmarks": {
|
|
1118
|
+
const workspacePath = args?.workspace_path;
|
|
1119
|
+
if (!workspacePath) {
|
|
1120
|
+
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1121
|
+
}
|
|
1122
|
+
try {
|
|
1123
|
+
// Start the benchmarks
|
|
1124
|
+
const response = await fetch(`${CLAUDETTE_API}/api/benchmarks/run`, {
|
|
1125
|
+
method: "POST",
|
|
1126
|
+
headers: { "Content-Type": "application/json" },
|
|
1127
|
+
body: JSON.stringify({ path: workspacePath, async: false }),
|
|
1128
|
+
});
|
|
1129
|
+
const data = await response.json();
|
|
1130
|
+
if (!data.success) {
|
|
1131
|
+
return { content: [{ type: "text", text: `Failed to run benchmarks: ${data.error || data.results?.error}` }] };
|
|
1132
|
+
}
|
|
1133
|
+
const results = data.results;
|
|
1134
|
+
let output = `Benchmark Results\n${"=".repeat(50)}\n\n`;
|
|
1135
|
+
output += `Framework: ${results.framework}\n`;
|
|
1136
|
+
output += `Total Benchmarks: ${results.totalBenchmarks}\n`;
|
|
1137
|
+
output += `Duration: ${(results.duration / 1000).toFixed(2)}s\n\n`;
|
|
1138
|
+
if (results.suites && results.suites.length > 0) {
|
|
1139
|
+
for (const suite of results.suites) {
|
|
1140
|
+
output += `📦 ${suite.name}\n`;
|
|
1141
|
+
for (const bench of suite.benchmarks) {
|
|
1142
|
+
const opsFormatted = bench.opsPerSecond >= 1e6
|
|
1143
|
+
? `${(bench.opsPerSecond / 1e6).toFixed(2)}M`
|
|
1144
|
+
: bench.opsPerSecond >= 1e3
|
|
1145
|
+
? `${(bench.opsPerSecond / 1e3).toFixed(2)}K`
|
|
1146
|
+
: bench.opsPerSecond.toFixed(2);
|
|
1147
|
+
output += ` ⚡ ${bench.name}: ${opsFormatted} ops/s (±${bench.margin.toFixed(1)}%)\n`;
|
|
1148
|
+
}
|
|
1149
|
+
output += '\n';
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
return { content: [{ type: "text", text: output }] };
|
|
1153
|
+
}
|
|
1154
|
+
catch (err) {
|
|
1155
|
+
return { content: [{ type: "text", text: `Error running benchmarks: ${err.message}` }] };
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
case "get_benchmark_results": {
|
|
1159
|
+
const workspacePath = args?.workspace_path;
|
|
1160
|
+
if (!workspacePath) {
|
|
1161
|
+
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1162
|
+
}
|
|
1163
|
+
try {
|
|
1164
|
+
const response = await fetch(`${CLAUDETTE_API}/api/benchmarks/status?path=${encodeURIComponent(workspacePath)}`);
|
|
1165
|
+
const status = await response.json();
|
|
1166
|
+
if (status.isRunning) {
|
|
1167
|
+
return { content: [{ type: "text", text: "Benchmarks are currently running..." }] };
|
|
1168
|
+
}
|
|
1169
|
+
if (!status.lastResult) {
|
|
1170
|
+
return { content: [{ type: "text", text: "No benchmark results found. Run benchmarks first with run_benchmarks." }] };
|
|
1171
|
+
}
|
|
1172
|
+
const results = status.lastResult;
|
|
1173
|
+
let output = `Benchmark Results\n${"=".repeat(50)}\n\n`;
|
|
1174
|
+
output += `Framework: ${results.framework}\n`;
|
|
1175
|
+
output += `Status: ${results.success ? "✅ SUCCESS" : "❌ FAILED"}\n`;
|
|
1176
|
+
output += `Total Benchmarks: ${results.totalBenchmarks}\n`;
|
|
1177
|
+
output += `Duration: ${(results.duration / 1000).toFixed(2)}s\n`;
|
|
1178
|
+
output += `Timestamp: ${results.timestamp}\n\n`;
|
|
1179
|
+
if (results.error) {
|
|
1180
|
+
output += `Error: ${results.error}\n\n`;
|
|
1181
|
+
}
|
|
1182
|
+
if (results.suites && results.suites.length > 0) {
|
|
1183
|
+
output += `Benchmark Details:\n${"─".repeat(40)}\n`;
|
|
1184
|
+
for (const suite of results.suites) {
|
|
1185
|
+
output += `\n📦 ${suite.name} (${suite.benchmarks.length} benchmarks)\n`;
|
|
1186
|
+
for (const bench of suite.benchmarks) {
|
|
1187
|
+
const opsFormatted = bench.opsPerSecond >= 1e6
|
|
1188
|
+
? `${(bench.opsPerSecond / 1e6).toFixed(2)}M`
|
|
1189
|
+
: bench.opsPerSecond >= 1e3
|
|
1190
|
+
? `${(bench.opsPerSecond / 1e3).toFixed(2)}K`
|
|
1191
|
+
: bench.opsPerSecond.toFixed(2);
|
|
1192
|
+
output += ` ⚡ ${bench.name}\n`;
|
|
1193
|
+
output += ` ${opsFormatted} ops/s | avg: ${bench.avgTime.toFixed(4)}ms | ±${bench.margin.toFixed(1)}%\n`;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
return { content: [{ type: "text", text: output }] };
|
|
1198
|
+
}
|
|
1199
|
+
catch (err) {
|
|
1200
|
+
return { content: [{ type: "text", text: `Error getting benchmark results: ${err.message}` }] };
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
case "get_workflow_status": {
|
|
1204
|
+
const workspacePath = args?.workspace_path;
|
|
1205
|
+
if (!workspacePath) {
|
|
1206
|
+
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1207
|
+
}
|
|
1208
|
+
try {
|
|
1209
|
+
const response = await fetch(`${CLAUDETTE_API}/api/workflow/status?path=${encodeURIComponent(workspacePath)}`);
|
|
1210
|
+
const status = await response.json();
|
|
1211
|
+
let output = `Workflow Status\n${"=".repeat(50)}\n\n`;
|
|
1212
|
+
output += `Current Step: ${status.currentStep}\n`;
|
|
1213
|
+
output += `Running: ${status.isRunning ? "Yes" : "No"}\n`;
|
|
1214
|
+
output += `Changed Files: ${status.changedFiles?.length || 0}\n\n`;
|
|
1215
|
+
output += `Automatic Checks:\n${"─".repeat(40)}\n`;
|
|
1216
|
+
const checkSteps = ['lint', 'types', 'tests', 'coverage', 'benchmarks'];
|
|
1217
|
+
for (const step of checkSteps) {
|
|
1218
|
+
const result = status.steps[step];
|
|
1219
|
+
const icon = result.status === 'passed' ? '✅' :
|
|
1220
|
+
result.status === 'failed' ? '❌' :
|
|
1221
|
+
result.status === 'warning' ? '⚠️' :
|
|
1222
|
+
result.status === 'running' ? '🔄' :
|
|
1223
|
+
result.status === 'skipped' ? '⏭️' : '⏸️';
|
|
1224
|
+
let info = '';
|
|
1225
|
+
if (step === 'lint' && result.fixed)
|
|
1226
|
+
info = ` (${result.fixed} fixed)`;
|
|
1227
|
+
if (step === 'types' && result.typeErrors)
|
|
1228
|
+
info = ` (${result.typeErrors} errors)`;
|
|
1229
|
+
if (step === 'tests' && result.passed !== undefined)
|
|
1230
|
+
info = ` (${result.passed}/${result.total})`;
|
|
1231
|
+
if (step === 'coverage' && result.percent !== undefined)
|
|
1232
|
+
info = ` (${result.percent}%)`;
|
|
1233
|
+
output += `${icon} ${step}${info}\n`;
|
|
1234
|
+
}
|
|
1235
|
+
output += `\nGit Actions:\n${"─".repeat(40)}\n`;
|
|
1236
|
+
const gitSteps = ['commit', 'push', 'pr'];
|
|
1237
|
+
for (const step of gitSteps) {
|
|
1238
|
+
const result = status.steps[step];
|
|
1239
|
+
const icon = result.status === 'passed' ? '✅' :
|
|
1240
|
+
result.status === 'pending' ? '⏸️' : '❓';
|
|
1241
|
+
output += `${icon} ${step}\n`;
|
|
1242
|
+
}
|
|
1243
|
+
if (status.error) {
|
|
1244
|
+
output += `\n❌ Error: ${status.error}\n`;
|
|
1245
|
+
}
|
|
1246
|
+
return { content: [{ type: "text", text: output }] };
|
|
1247
|
+
}
|
|
1248
|
+
catch (err) {
|
|
1249
|
+
return { content: [{ type: "text", text: `Error getting workflow status: ${err.message}` }] };
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
case "trigger_workflow": {
|
|
1253
|
+
const workspacePath = args?.workspace_path;
|
|
1254
|
+
if (!workspacePath) {
|
|
1255
|
+
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1256
|
+
}
|
|
1257
|
+
try {
|
|
1258
|
+
const response = await fetch(`${CLAUDETTE_API}/api/workflow/trigger`, {
|
|
1259
|
+
method: "POST",
|
|
1260
|
+
headers: { "Content-Type": "application/json" },
|
|
1261
|
+
body: JSON.stringify({ path: workspacePath }),
|
|
1262
|
+
});
|
|
1263
|
+
const status = await response.json();
|
|
1264
|
+
let output = `Workflow triggered successfully!\n\n`;
|
|
1265
|
+
output += `Current Step: ${status.currentStep}\n`;
|
|
1266
|
+
output += `Changed Files: ${status.changedFiles?.length || 0}\n\n`;
|
|
1267
|
+
output += `The workflow will run these checks automatically:\n`;
|
|
1268
|
+
output += `1. Lint (with auto-fix)\n`;
|
|
1269
|
+
output += `2. Type checking\n`;
|
|
1270
|
+
output += `3. Tests\n`;
|
|
1271
|
+
output += `4. Coverage analysis\n`;
|
|
1272
|
+
output += `5. Benchmarks (optional)\n\n`;
|
|
1273
|
+
output += `Use get_workflow_status to monitor progress.`;
|
|
1274
|
+
return { content: [{ type: "text", text: output }] };
|
|
1275
|
+
}
|
|
1276
|
+
catch (err) {
|
|
1277
|
+
return { content: [{ type: "text", text: `Error triggering workflow: ${err.message}` }] };
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
case "generate_commit_message": {
|
|
1281
|
+
const workspacePath = args?.workspace_path;
|
|
1282
|
+
if (!workspacePath) {
|
|
1283
|
+
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1284
|
+
}
|
|
1285
|
+
try {
|
|
1286
|
+
const response = await fetch(`${CLAUDETTE_API}/api/workflow/commit-message?path=${encodeURIComponent(workspacePath)}`);
|
|
1287
|
+
const data = await response.json();
|
|
1288
|
+
return { content: [{ type: "text", text: `Suggested commit message:\n\n${data.message}` }] };
|
|
1289
|
+
}
|
|
1290
|
+
catch (err) {
|
|
1291
|
+
return { content: [{ type: "text", text: `Error generating commit message: ${err.message}` }] };
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
case "approve_commit": {
|
|
1295
|
+
const workspacePath = args?.workspace_path;
|
|
1296
|
+
const message = args?.message;
|
|
1297
|
+
if (!workspacePath) {
|
|
1298
|
+
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1299
|
+
}
|
|
1300
|
+
if (!message) {
|
|
1301
|
+
return { content: [{ type: "text", text: "Error: message is required" }] };
|
|
1302
|
+
}
|
|
1303
|
+
try {
|
|
1304
|
+
const response = await fetch(`${CLAUDETTE_API}/api/workflow/commit`, {
|
|
1305
|
+
method: "POST",
|
|
1306
|
+
headers: { "Content-Type": "application/json" },
|
|
1307
|
+
body: JSON.stringify({ path: workspacePath, message }),
|
|
1308
|
+
});
|
|
1309
|
+
const result = await response.json();
|
|
1310
|
+
if (result.status === 'passed') {
|
|
1311
|
+
return { content: [{ type: "text", text: `✅ Commit created successfully!\n\nMessage: ${result.message}\nFiles committed: ${result.filesCommitted}` }] };
|
|
1312
|
+
}
|
|
1313
|
+
else {
|
|
1314
|
+
return { content: [{ type: "text", text: `❌ Commit failed: ${result.error}` }] };
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
catch (err) {
|
|
1318
|
+
return { content: [{ type: "text", text: `Error creating commit: ${err.message}` }] };
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
case "approve_push": {
|
|
1322
|
+
const workspacePath = args?.workspace_path;
|
|
1323
|
+
if (!workspacePath) {
|
|
1324
|
+
return { content: [{ type: "text", text: "Error: workspace_path is required" }] };
|
|
1325
|
+
}
|
|
1326
|
+
try {
|
|
1327
|
+
const response = await fetch(`${CLAUDETTE_API}/api/workflow/push`, {
|
|
1328
|
+
method: "POST",
|
|
1329
|
+
headers: { "Content-Type": "application/json" },
|
|
1330
|
+
body: JSON.stringify({ path: workspacePath }),
|
|
1331
|
+
});
|
|
1332
|
+
const result = await response.json();
|
|
1333
|
+
if (result.status === 'passed') {
|
|
1334
|
+
return { content: [{ type: "text", text: `✅ Push successful!\n\nBranch: ${result.branch}\nRemote: ${result.remote}` }] };
|
|
1335
|
+
}
|
|
1336
|
+
else {
|
|
1337
|
+
return { content: [{ type: "text", text: `❌ Push failed: ${result.error}` }] };
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
catch (err) {
|
|
1341
|
+
return { content: [{ type: "text", text: `Error pushing changes: ${err.message}` }] };
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1006
1344
|
default:
|
|
1007
1345
|
return { content: [{ type: "text", text: `Unknown tool: ${name}` }] };
|
|
1008
1346
|
}
|
package/package.json
CHANGED