mlgym-deploy 2.0.0 → 2.0.1
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 +27 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1212,6 +1212,7 @@ async function createUser(args) {
|
|
|
1212
1212
|
// First generate SSH key pair
|
|
1213
1213
|
console.error('Generating SSH key pair...');
|
|
1214
1214
|
const { publicKey, privateKeyPath } = await generateSSHKeyPair(email);
|
|
1215
|
+
const publicKeyPath = privateKeyPath + '.pub';
|
|
1215
1216
|
console.error(`SSH key generated: ${privateKeyPath}`);
|
|
1216
1217
|
|
|
1217
1218
|
// Create user via backend API with SSH key
|
|
@@ -1238,6 +1239,28 @@ async function createUser(args) {
|
|
|
1238
1239
|
|
|
1239
1240
|
// Format successful response with actual fields from backend
|
|
1240
1241
|
const userData = result.data.user || {};
|
|
1242
|
+
|
|
1243
|
+
// Check SSH key upload status
|
|
1244
|
+
const sshKeyStatus = result.data.ssh_key_status || 'Unknown';
|
|
1245
|
+
const sshKeyUploaded = sshKeyStatus === 'SSH key uploaded successfully';
|
|
1246
|
+
|
|
1247
|
+
// Adjust next steps based on SSH key upload status
|
|
1248
|
+
const nextSteps = [
|
|
1249
|
+
passwordGenerated ? `⚠️ SAVE THIS PASSWORD: ${password}` : 'Using your provided password',
|
|
1250
|
+
`SSH key generated locally at: ${privateKeyPath}`
|
|
1251
|
+
];
|
|
1252
|
+
|
|
1253
|
+
if (sshKeyUploaded) {
|
|
1254
|
+
nextSteps.push(`✅ SSH key uploaded to GitLab (ID: ${result.data.ssh_key_id || 'unknown'})`);
|
|
1255
|
+
nextSteps.push(`Add to SSH agent: ssh-add "${privateKeyPath}"`);
|
|
1256
|
+
nextSteps.push('You can now push code to GitLab repositories');
|
|
1257
|
+
} else {
|
|
1258
|
+
nextSteps.push(`⚠️ SSH key upload failed: ${sshKeyStatus}`);
|
|
1259
|
+
nextSteps.push('You need to manually add the SSH key to GitLab:');
|
|
1260
|
+
nextSteps.push(`cat ${publicKeyPath} # Copy this key`);
|
|
1261
|
+
nextSteps.push('Then add it at: https://git.mlgym.io/-/user_settings/ssh_keys');
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1241
1264
|
const response = {
|
|
1242
1265
|
user_id: userData.user_id || userData.UserID,
|
|
1243
1266
|
email: userData.email || email,
|
|
@@ -1246,14 +1269,11 @@ async function createUser(args) {
|
|
|
1246
1269
|
password: passwordGenerated ? password : '[Your provided password]',
|
|
1247
1270
|
password_generated: passwordGenerated,
|
|
1248
1271
|
ssh_key_path: privateKeyPath,
|
|
1272
|
+
ssh_key_status: sshKeyStatus,
|
|
1273
|
+
ssh_key_uploaded: sshKeyUploaded,
|
|
1249
1274
|
token: result.data.token,
|
|
1250
|
-
message: result.data.message || 'User created successfully
|
|
1251
|
-
next_steps:
|
|
1252
|
-
passwordGenerated ? `⚠️ SAVE THIS PASSWORD: ${password}` : 'Using your provided password',
|
|
1253
|
-
`SSH key created at: ${privateKeyPath}`,
|
|
1254
|
-
`Add this to your SSH agent: ssh-add "${privateKeyPath}"`,
|
|
1255
|
-
'You can now push code to GitLab repositories'
|
|
1256
|
-
]
|
|
1275
|
+
message: result.data.message || 'User created successfully',
|
|
1276
|
+
next_steps: nextSteps
|
|
1257
1277
|
};
|
|
1258
1278
|
|
|
1259
1279
|
return {
|