mlgym-deploy 3.0.1 → 3.0.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.
- package/index.js +41 -1
- package/package.json +2 -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.
|
|
20
|
+
const CURRENT_VERSION = '3.0.2'; // Fixed SSH key propagation delay before git push
|
|
21
21
|
const PACKAGE_NAME = 'mlgym-deploy';
|
|
22
22
|
|
|
23
23
|
// Version check state
|
|
@@ -999,6 +999,46 @@ async function initProject(args) {
|
|
|
999
999
|
|
|
1000
1000
|
await execAsync(`git remote add mlgym ${gitUrl}`, { cwd: absolutePath });
|
|
1001
1001
|
|
|
1002
|
+
// Ensure SSH key is ready for git push
|
|
1003
|
+
const authInfo = await loadAuth();
|
|
1004
|
+
if (authInfo.email) {
|
|
1005
|
+
const sanitizedEmail = authInfo.email.replace('@', '_at_').replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
1006
|
+
const sshKeyPath = path.join(os.homedir(), '.ssh', `mlgym_${sanitizedEmail}`);
|
|
1007
|
+
|
|
1008
|
+
try {
|
|
1009
|
+
// Check if SSH key exists
|
|
1010
|
+
await fs.access(sshKeyPath);
|
|
1011
|
+
|
|
1012
|
+
// Add SSH key to agent
|
|
1013
|
+
console.error('Adding SSH key to ssh-agent...');
|
|
1014
|
+
try {
|
|
1015
|
+
await execAsync(`ssh-add "${sshKeyPath}" 2>/dev/null`);
|
|
1016
|
+
} catch (agentErr) {
|
|
1017
|
+
// ssh-agent might not be running, which is OK if SSH config is properly set
|
|
1018
|
+
console.error('Note: ssh-agent not available, relying on SSH config');
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// Wait for GitLab SSH key propagation (10 seconds)
|
|
1022
|
+
console.error('Waiting for GitLab SSH key propagation (10 seconds)...');
|
|
1023
|
+
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
1024
|
+
|
|
1025
|
+
// Test SSH connectivity
|
|
1026
|
+
console.error('Testing SSH connection to GitLab...');
|
|
1027
|
+
try {
|
|
1028
|
+
await execAsync('ssh -T git@git.mlgym.io 2>&1', { timeout: 10000 });
|
|
1029
|
+
} catch (sshTestErr) {
|
|
1030
|
+
// SSH test may fail with "Welcome to GitLab" message which returns exit code 1
|
|
1031
|
+
// This is actually success - we just need to verify the key works
|
|
1032
|
+
const output = sshTestErr.stdout || sshTestErr.stderr || '';
|
|
1033
|
+
if (!output.includes('Welcome') && !output.includes('successfully authenticated')) {
|
|
1034
|
+
console.error('SSH connection test warning:', output);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
} catch (keyErr) {
|
|
1038
|
+
console.error('Warning: SSH key setup issue:', keyErr.message);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1002
1042
|
// Create initial commit and push (like CLI does)
|
|
1003
1043
|
const gitSteps = [];
|
|
1004
1044
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mlgym-deploy",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "MCP server for MLGym -
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"description": "MCP server for MLGym - Fixed SSH key propagation for git push operations",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|