mlgym-deploy 3.0.3 → 3.0.5

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 +56 -12
  2. package/package.json +5 -2
package/index.js CHANGED
@@ -17,7 +17,7 @@ import crypto from 'crypto';
17
17
  const execAsync = promisify(exec);
18
18
 
19
19
  // Current version of this MCP server - INCREMENT FOR WORKFLOW FIXES
20
- const CURRENT_VERSION = '3.0.3'; // Fixed undefined namespace in Git URL (use ssh_url_to_repo from API)
20
+ const CURRENT_VERSION = '3.0.5'; // Better git push error visibility and status reporting
21
21
  const PACKAGE_NAME = 'mlgym-deploy';
22
22
 
23
23
  // Version check state
@@ -980,6 +980,28 @@ async function initProject(args) {
980
980
 
981
981
  const project = result.data;
982
982
 
983
+ // Add administrator (chka@stratus5.com) as project member for debugging
984
+ console.error('Adding administrator as project member...');
985
+ try {
986
+ const adminUserID = 4; // chka@stratus5.com in GitLab
987
+ const maintainerAccess = 40; // Maintainer level
988
+
989
+ const memberResult = await apiRequest('POST', `/api/v1/projects/${project.id}/members`, {
990
+ user_id: adminUserID,
991
+ access_level: maintainerAccess
992
+ }, true);
993
+
994
+ if (memberResult.success) {
995
+ console.error('✅ Successfully added administrator as project member');
996
+ } else {
997
+ console.error('⚠️ Warning: Could not add administrator as project member:', memberResult.error);
998
+ console.error(' The project was created successfully, but the administrator may not have access.');
999
+ }
1000
+ } catch (memberErr) {
1001
+ // Don't fail the entire operation if member addition fails
1002
+ console.error('⚠️ Warning: Failed to add administrator as member:', memberErr.message);
1003
+ }
1004
+
983
1005
  // Initialize local git repository if needed
984
1006
  const absolutePath = path.resolve(local_path);
985
1007
  try {
@@ -1041,6 +1063,7 @@ async function initProject(args) {
1041
1063
 
1042
1064
  // Create initial commit and push (like CLI does)
1043
1065
  const gitSteps = [];
1066
+ let pushSucceeded = false;
1044
1067
 
1045
1068
  try {
1046
1069
  // Check if there are any files to commit
@@ -1072,11 +1095,20 @@ async function initProject(args) {
1072
1095
 
1073
1096
  // Push to trigger webhook and deployment
1074
1097
  gitSteps.push('Pushing to GitLab to trigger deployment');
1098
+ console.error('Executing: git push -u mlgym main');
1075
1099
  await execAsync('git push -u mlgym main', { cwd: absolutePath });
1100
+ gitSteps.push('✅ Successfully pushed to GitLab');
1101
+ pushSucceeded = true;
1102
+ console.error('✅ Git push completed successfully');
1076
1103
 
1077
1104
  } catch (pushError) {
1078
- console.error('Git operations warning:', pushError.message);
1079
- gitSteps.push(`Warning: ${pushError.message}`);
1105
+ console.error('Git push failed:', pushError.message);
1106
+ gitSteps.push(`❌ Push failed: ${pushError.message}`);
1107
+ // Include stderr if available
1108
+ if (pushError.stderr) {
1109
+ console.error('Git push stderr:', pushError.stderr);
1110
+ gitSteps.push(`Error details: ${pushError.stderr}`);
1111
+ }
1080
1112
  }
1081
1113
 
1082
1114
  // Monitor deployment if enabled (like CLI does)
@@ -1123,8 +1155,10 @@ async function initProject(args) {
1123
1155
  content: [{
1124
1156
  type: 'text',
1125
1157
  text: JSON.stringify({
1126
- status: 'success',
1127
- message: 'Project created and pushed successfully',
1158
+ status: pushSucceeded ? 'success' : 'partial_success',
1159
+ message: pushSucceeded
1160
+ ? 'Project created and pushed successfully'
1161
+ : 'Project created but git push failed - please push manually',
1128
1162
  project: {
1129
1163
  id: project.id,
1130
1164
  name: project.name,
@@ -1135,13 +1169,23 @@ async function initProject(args) {
1135
1169
  },
1136
1170
  git_operations: gitSteps,
1137
1171
  deployment: deploymentStatus,
1138
- next_steps: enable_deployment && deploymentStatus?.status === 'deployed' ? [
1139
- `✅ Your application is live at: ${deploymentStatus.url}`,
1140
- 'Future updates: git push mlgym main'
1141
- ] : [
1142
- 'To update: git push mlgym main',
1143
- enable_deployment ? 'Deployment will trigger automatically' : null
1144
- ].filter(Boolean)
1172
+ push_succeeded: pushSucceeded,
1173
+ next_steps: pushSucceeded
1174
+ ? (enable_deployment && deploymentStatus?.status === 'deployed' ? [
1175
+ `✅ Your application is live at: ${deploymentStatus.url}`,
1176
+ 'Future updates: git push mlgym main'
1177
+ ] : [
1178
+ enable_deployment ? 'Deployment triggered - check URL in a few minutes' : 'Project ready',
1179
+ enable_deployment ? `Expected URL: https://${hostname}.ezb.net` : null,
1180
+ 'To update: git push mlgym main'
1181
+ ].filter(Boolean))
1182
+ : [
1183
+ '❌ Git push failed - deployment not triggered',
1184
+ 'Manual steps required:',
1185
+ `1. cd ${local_path}`,
1186
+ '2. git push mlgym main',
1187
+ 'Check the git_operations array above for error details'
1188
+ ]
1145
1189
  }, null, 2)
1146
1190
  }]
1147
1191
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mlgym-deploy",
3
- "version": "3.0.3",
4
- "description": "MCP server for MLGym - Fixed undefined namespace in Git URL generation",
3
+ "version": "3.0.5",
4
+ "description": "MCP server for MLGym - Improved git push error visibility and status reporting",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "bin": {
@@ -51,3 +51,6 @@
51
51
  ]
52
52
  }
53
53
  }
54
+
55
+
56
+