claude-autopm 1.13.4 → 1.13.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-autopm",
3
- "version": "1.13.4",
3
+ "version": "1.13.6",
4
4
  "description": "Autonomous Project Management Framework for Claude Code - Advanced AI-powered development automation",
5
5
  "main": "bin/autopm.js",
6
6
  "bin": {
@@ -228,42 +228,49 @@ class MCPHandler {
228
228
  const config = this.loadConfig();
229
229
  const activeServers = config.mcp?.activeServers || [];
230
230
 
231
- // Ensure .claude directory exists even if no servers
231
+ // Ensure .claude directory exists
232
232
  this.ensureClaudeDir();
233
233
 
234
+ // Read existing mcp-servers.json to preserve all servers
235
+ let existingMcpConfig = { mcpServers: {}, contextPools: {}, documentationSources: {} };
236
+ if (fs.existsSync(this.mcpServersPath)) {
237
+ try {
238
+ const content = fs.readFileSync(this.mcpServersPath, 'utf8');
239
+ existingMcpConfig = JSON.parse(content);
240
+ } catch (error) {
241
+ console.log('⚠️ Could not read existing mcp-servers.json, creating new');
242
+ }
243
+ }
244
+
234
245
  if (activeServers.length === 0) {
235
- console.log('ℹ️ No active servers to sync');
236
- // Still create empty mcp-servers.json
237
- const emptyConfig = {
238
- mcpServers: {},
239
- contextPools: config.mcp?.contextPools || {},
240
- documentationSources: config.mcp?.documentationSources || {}
241
- };
242
- fs.writeFileSync(
243
- this.mcpServersPath,
244
- JSON.stringify(emptyConfig, null, 2)
245
- );
246
+ console.log('ℹ️ No active servers in config.json');
247
+ console.log('💡 Preserving existing servers in mcp-servers.json');
248
+ console.log(`📊 Existing servers: ${Object.keys(existingMcpConfig.mcpServers).length}`);
246
249
  return;
247
250
  }
248
251
 
252
+ // Start with existing configuration
249
253
  const mcpConfig = {
250
- mcpServers: {},
251
- contextPools: config.mcp?.contextPools || {},
252
- documentationSources: config.mcp?.documentationSources || {}
254
+ mcpServers: existingMcpConfig.mcpServers || {},
255
+ contextPools: existingMcpConfig.contextPools || {},
256
+ documentationSources: existingMcpConfig.documentationSources || {}
253
257
  };
254
258
 
255
- // Process each active server
259
+ // Update active servers from registry
256
260
  activeServers.forEach(serverName => {
257
261
  const server = this.getServer(serverName);
258
262
  if (!server) {
259
- console.log(` ⚠️ Server '${serverName}' not found, skipping`);
263
+ console.log(` ⚠️ Server '${serverName}' not found in registry, skipping`);
260
264
  return;
261
265
  }
262
266
 
267
+ // Convert env metadata to simple strings for Claude Code compatibility
268
+ const envVars = this._convertEnvMetadataToStrings(server.metadata.env);
269
+
263
270
  mcpConfig.mcpServers[serverName] = {
264
271
  command: server.metadata.command,
265
272
  args: server.metadata.args,
266
- env: server.metadata.env || {},
273
+ env: envVars,
267
274
  envFile: server.metadata.envFile
268
275
  };
269
276
 
@@ -278,6 +285,7 @@ class MCPHandler {
278
285
 
279
286
  console.log(`\n✅ Configuration synced to ${this.mcpServersPath}`);
280
287
  console.log(`📊 Active servers: ${activeServers.length}`);
288
+ console.log(`📦 Total servers in file: ${Object.keys(mcpConfig.mcpServers).length}`);
281
289
  }
282
290
 
283
291
  /**
@@ -1244,6 +1252,42 @@ This server can be integrated with various agents and context pools.
1244
1252
  return defaultValue !== '';
1245
1253
  }
1246
1254
 
1255
+ /**
1256
+ * Convert env metadata objects to simple string format for Claude Code
1257
+ * @private
1258
+ * @param {Object} envObj - Environment variables object (may contain metadata)
1259
+ * @returns {Object} Environment variables as simple strings
1260
+ */
1261
+ _convertEnvMetadataToStrings(envObj) {
1262
+ if (!envObj) return {};
1263
+
1264
+ const converted = {};
1265
+
1266
+ Object.entries(envObj).forEach(([key, value]) => {
1267
+ // If value is already a string, keep it
1268
+ if (typeof value === 'string') {
1269
+ converted[key] = value;
1270
+ }
1271
+ // If value is metadata object, convert to string format
1272
+ else if (typeof value === 'object' && value !== null) {
1273
+ const defaultVal = value.default || '';
1274
+ // If it's a literal value (not empty string), use it directly
1275
+ if (defaultVal && !defaultVal.startsWith('${')) {
1276
+ converted[key] = defaultVal;
1277
+ }
1278
+ // Otherwise use variable substitution format
1279
+ else {
1280
+ converted[key] = `\${${key}:-${defaultVal}}`;
1281
+ }
1282
+ }
1283
+ else {
1284
+ converted[key] = String(value);
1285
+ }
1286
+ });
1287
+
1288
+ return converted;
1289
+ }
1290
+
1247
1291
  /**
1248
1292
  * Run comprehensive MCP diagnostics
1249
1293
  * @returns {Object} Diagnostic results