mlgym-deploy 2.8.0 → 2.10.0

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 +16 -20
  2. package/package.json +1 -1
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 = '2.8.0'; // Fixed to match CLI workflow: nested API payload, git push, deployment monitoring
20
+ const CURRENT_VERSION = '2.10.0'; // Fixed SSH key handling: generate and include in user creation request
21
21
  const PACKAGE_NAME = 'mlgym-deploy';
22
22
 
23
23
  // Version check state
@@ -275,10 +275,16 @@ async function authenticate(args) {
275
275
 
276
276
  // Try to create account
277
277
  try {
278
+ // Generate SSH key BEFORE creating user
279
+ console.error('Generating SSH key for new user...');
280
+ const { publicKey, privateKeyPath } = await generateSSHKeyPair(email);
281
+
282
+ // Create user with SSH key included
278
283
  const createResult = await apiRequest('POST', '/api/v1/users', {
279
284
  email,
280
285
  name: full_name,
281
- password
286
+ password,
287
+ ssh_key: publicKey // Include SSH key in user creation
282
288
  }, false);
283
289
 
284
290
  if (createResult.success) {
@@ -291,16 +297,6 @@ async function authenticate(args) {
291
297
  if (loginResult.success && loginResult.data.token) {
292
298
  await saveAuth(email, loginResult.data.token);
293
299
 
294
- // Generate and add SSH key for new user
295
- console.error('Generating SSH key for new user...');
296
- const { publicKey, privateKeyPath } = await generateSSHKeyPair(email);
297
-
298
- const keyTitle = `mlgym-${new Date().toISOString().split('T')[0]}`;
299
- await apiRequest('POST', '/api/v1/keys', {
300
- title: keyTitle,
301
- key: publicKey
302
- }, true);
303
-
304
300
  return {
305
301
  content: [{
306
302
  type: 'text',
@@ -311,9 +307,11 @@ async function authenticate(args) {
311
307
  user_id: loginResult.data.user?.user_id,
312
308
  gitlab_username: loginResult.data.user?.gitlab_username,
313
309
  ssh_key_path: privateKeyPath,
310
+ ssh_key_status: createResult.data.ssh_key_status || 'SSH key configured',
314
311
  next_steps: [
315
312
  'New account created',
316
313
  `SSH key generated at: ${privateKeyPath}`,
314
+ 'SSH key automatically uploaded to GitLab',
317
315
  'You can now create projects and deploy'
318
316
  ]
319
317
  }, null, 2)
@@ -945,7 +943,7 @@ async function initProject(args) {
945
943
 
946
944
  console.error(`Creating project: ${name}`);
947
945
 
948
- // Create project via backend API with CORRECT nested structure (matching CLI)
946
+ // Create project via backend API with FLAT structure (matching CLI)
949
947
  const projectData = {
950
948
  name: name,
951
949
  description: description
@@ -958,13 +956,11 @@ async function initProject(args) {
958
956
  byte => byte.toString(16).padStart(2, '0')
959
957
  ).join('');
960
958
 
961
- // Use nested deployment_info structure like CLI does
962
- projectData.deployment_info = {
963
- type: 'dockerfile',
964
- enabled: true,
965
- webhook_secret: webhookSecret,
966
- hostname: hostname
967
- };
959
+ // Use FLAT structure exactly like CLI does - no nested deployment_info
960
+ projectData.enable_deployment = true;
961
+ projectData.webhook_secret = webhookSecret;
962
+ projectData.hostname = hostname;
963
+ projectData.local_path = local_path;
968
964
  }
969
965
 
970
966
  const result = await apiRequest('POST', '/api/v1/projects', projectData, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlgym-deploy",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "description": "MCP server for GitLab Backend - User creation and project deployment",
5
5
  "main": "index.js",
6
6
  "type": "module",