claude-autopm 1.17.0 → 1.18.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/bin/commands/team.js +86 -0
- package/package.json +1 -1
package/bin/commands/team.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const MCPHandler = require('../../scripts/mcp-handler.js');
|
|
5
6
|
|
|
6
7
|
// Paths
|
|
7
8
|
const projectRoot = process.cwd();
|
|
@@ -68,6 +69,69 @@ function validateAgentFiles(agents, projectRoot) {
|
|
|
68
69
|
return missingAgents;
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
// Helper function to validate MCP dependencies for agents
|
|
73
|
+
function validateAgentMCPDependencies(agents, projectRoot) {
|
|
74
|
+
const warnings = [];
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const mcpHandler = new MCPHandler();
|
|
78
|
+
const config = mcpHandler.loadConfig();
|
|
79
|
+
const activeServers = config.mcp?.activeServers || [];
|
|
80
|
+
|
|
81
|
+
// Track all required MCP servers across all agents
|
|
82
|
+
const requiredServers = new Map(); // server -> [agents that need it]
|
|
83
|
+
|
|
84
|
+
agents.forEach(agentPath => {
|
|
85
|
+
// Extract agent name from path
|
|
86
|
+
// Handle both "core/test-runner.md" and "test-runner.md" formats
|
|
87
|
+
let agentName = agentPath;
|
|
88
|
+
if (agentName.endsWith('.md')) {
|
|
89
|
+
agentName = agentName.slice(0, -3); // Remove .md extension
|
|
90
|
+
}
|
|
91
|
+
// Get just the filename without directory
|
|
92
|
+
agentName = path.basename(agentName);
|
|
93
|
+
|
|
94
|
+
// Get MCP dependencies for this agent
|
|
95
|
+
const agentMCP = mcpHandler.getAgentMCP(agentName);
|
|
96
|
+
|
|
97
|
+
if (agentMCP.found && agentMCP.mcpServers.length > 0) {
|
|
98
|
+
agentMCP.mcpServers.forEach(serverName => {
|
|
99
|
+
if (!requiredServers.has(serverName)) {
|
|
100
|
+
requiredServers.set(serverName, []);
|
|
101
|
+
}
|
|
102
|
+
requiredServers.get(serverName).push(agentName);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Check which required servers are missing or inactive
|
|
108
|
+
requiredServers.forEach((agentNames, serverName) => {
|
|
109
|
+
const isActive = activeServers.includes(serverName);
|
|
110
|
+
const serverExists = mcpHandler.getServer(serverName);
|
|
111
|
+
|
|
112
|
+
if (!serverExists) {
|
|
113
|
+
warnings.push({
|
|
114
|
+
type: 'not_installed',
|
|
115
|
+
server: serverName,
|
|
116
|
+
agents: agentNames
|
|
117
|
+
});
|
|
118
|
+
} else if (!isActive) {
|
|
119
|
+
warnings.push({
|
|
120
|
+
type: 'not_active',
|
|
121
|
+
server: serverName,
|
|
122
|
+
agents: agentNames
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
} catch (error) {
|
|
128
|
+
// If MCP validation fails, just warn but don't block
|
|
129
|
+
console.warn('⚠️ Warning: Could not validate MCP dependencies');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return warnings;
|
|
133
|
+
}
|
|
134
|
+
|
|
71
135
|
// Helper function to generate agent include list in Markdown format
|
|
72
136
|
function generateAgentIncludes(agents) {
|
|
73
137
|
return agents
|
|
@@ -216,6 +280,28 @@ const commands = {
|
|
|
216
280
|
});
|
|
217
281
|
}
|
|
218
282
|
|
|
283
|
+
// Validate MCP dependencies
|
|
284
|
+
const mcpWarnings = validateAgentMCPDependencies(agents, projectRoot);
|
|
285
|
+
if (mcpWarnings.length > 0) {
|
|
286
|
+
console.warn('\n⚠️ MCP Dependency Warnings:\n');
|
|
287
|
+
|
|
288
|
+
mcpWarnings.forEach(warning => {
|
|
289
|
+
if (warning.type === 'not_installed') {
|
|
290
|
+
console.warn(`❌ MCP server '${warning.server}' is NOT INSTALLED`);
|
|
291
|
+
console.warn(` Required by: ${warning.agents.join(', ')}`);
|
|
292
|
+
console.warn(` Fix: autopm mcp install ${warning.server}`);
|
|
293
|
+
} else if (warning.type === 'not_active') {
|
|
294
|
+
console.warn(`⚪ MCP server '${warning.server}' is NOT ACTIVE`);
|
|
295
|
+
console.warn(` Required by: ${warning.agents.join(', ')}`);
|
|
296
|
+
console.warn(` Fix: autopm mcp enable ${warning.server}`);
|
|
297
|
+
}
|
|
298
|
+
console.warn('');
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
console.warn('💡 Tip: Run "autopm mcp list" to see all MCP servers');
|
|
302
|
+
console.warn('💡 Tip: Run "autopm mcp setup" for interactive configuration\n');
|
|
303
|
+
}
|
|
304
|
+
|
|
219
305
|
// Update CLAUDE.md with the new agent list
|
|
220
306
|
updateClaudeMd(agents);
|
|
221
307
|
console.log('✓ Updated CLAUDE.md with team agents');
|