mlgym-deploy 3.3.1 → 3.3.2

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 (2) hide show
  1. package/index.js +13 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  } from '@modelcontextprotocol/sdk/types.js';
9
9
  import axios from 'axios';
10
10
  import fs from 'fs/promises';
11
+ import fsSync from 'fs';
11
12
  import path from 'path';
12
13
  import os from 'os';
13
14
  import { exec } from 'child_process';
@@ -17,7 +18,7 @@ import crypto from 'crypto';
17
18
  const execAsync = promisify(exec);
18
19
 
19
20
  // Current version of this MCP server - INCREMENT FOR WORKFLOW FIXES
20
- const CURRENT_VERSION = '3.3.1'; // Updated help with plain English examples showing what users say vs tool calls
21
+ const CURRENT_VERSION = '3.3.2'; // Fixed fs.existsSync bug by importing fsSync for synchronous file operations
21
22
  const PACKAGE_NAME = 'mlgym-deploy';
22
23
 
23
24
  // Debug logging configuration - ENABLED BY DEFAULT
@@ -1302,9 +1303,9 @@ async function initProject(args) {
1302
1303
 
1303
1304
  for (const filename of composeFiles) {
1304
1305
  const composePath = path.join(local_path, filename);
1305
- if (fs.existsSync(composePath)) {
1306
+ if (fsSync.existsSync(composePath)) {
1306
1307
  try {
1307
- composeContent = fs.readFileSync(composePath, 'utf8');
1308
+ composeContent = fsSync.readFileSync(composePath, 'utf8');
1308
1309
  log.info(`MCP >>> [initProject] Read ${filename}: ${composeContent.length} bytes`);
1309
1310
  break;
1310
1311
  } catch (err) {
@@ -2014,10 +2015,10 @@ async function deployProject(args) {
2014
2015
  if (strategy.type === 'docker-compose') {
2015
2016
  const composePath = path.join(local_path, 'docker-compose.yml');
2016
2017
  const composePathYAML = path.join(local_path, 'docker-compose.yaml');
2017
- const actualPath = fs.existsSync(composePath) ? composePath : composePathYAML;
2018
+ const actualPath = fsSync.existsSync(composePath) ? composePath : composePathYAML;
2018
2019
 
2019
- if (fs.existsSync(actualPath)) {
2020
- const content = fs.readFileSync(actualPath, 'utf8');
2020
+ if (fsSync.existsSync(actualPath)) {
2021
+ const content = fsSync.readFileSync(actualPath, 'utf8');
2021
2022
  const validation = validateAndFixDockerCompose(content);
2022
2023
 
2023
2024
  if (!validation.isValid) {
@@ -2028,11 +2029,11 @@ async function deployProject(args) {
2028
2029
 
2029
2030
  // Auto-fix the issues
2030
2031
  log.info('MCP >>> Auto-fixing docker-compose.yml port mappings...');
2031
- fs.writeFileSync(actualPath, validation.fixedContent);
2032
+ fsSync.writeFileSync(actualPath, validation.fixedContent);
2032
2033
 
2033
2034
  // Create backup
2034
2035
  const backupPath = actualPath + '.backup';
2035
- fs.writeFileSync(backupPath, content);
2036
+ fsSync.writeFileSync(backupPath, content);
2036
2037
  log.info(`MCP >>> Created backup at ${backupPath}`);
2037
2038
 
2038
2039
  log.success('MCP >>> Fixed docker-compose.yml:');
@@ -2044,8 +2045,8 @@ async function deployProject(args) {
2044
2045
  } else if (strategy.type === 'dockerfile') {
2045
2046
  const dockerfilePath = path.join(local_path, 'Dockerfile');
2046
2047
 
2047
- if (fs.existsSync(dockerfilePath)) {
2048
- const content = fs.readFileSync(dockerfilePath, 'utf8');
2048
+ if (fsSync.existsSync(dockerfilePath)) {
2049
+ const content = fsSync.readFileSync(dockerfilePath, 'utf8');
2049
2050
  const validation = validateDockerfile(content);
2050
2051
 
2051
2052
  if (!validation.isValid) {
@@ -2073,8 +2074,8 @@ async function deployProject(args) {
2073
2074
  const fixedContent = lines.join('\n');
2074
2075
 
2075
2076
  // Create backup
2076
- fs.writeFileSync(dockerfilePath + '.backup', content);
2077
- fs.writeFileSync(dockerfilePath, fixedContent);
2077
+ fsSync.writeFileSync(dockerfilePath + '.backup', content);
2078
+ fsSync.writeFileSync(dockerfilePath, fixedContent);
2078
2079
 
2079
2080
  log.success('MCP >>> Fixed Dockerfile: added EXPOSE 80');
2080
2081
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlgym-deploy",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "MCP server for MLGym - Complete deployment management: deploy, configure, monitor, and rollback applications",
5
5
  "main": "index.js",
6
6
  "type": "module",