mlgym-deploy 2.4.1 → 2.5.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.
- package/index.js +70 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16,8 +16,8 @@ import crypto from 'crypto';
|
|
|
16
16
|
|
|
17
17
|
const execAsync = promisify(exec);
|
|
18
18
|
|
|
19
|
-
// Current version of this MCP server - INCREMENT FOR WORKFLOW
|
|
20
|
-
const CURRENT_VERSION = '2.
|
|
19
|
+
// Current version of this MCP server - INCREMENT FOR WORKFLOW COMPLIANCE
|
|
20
|
+
const CURRENT_VERSION = '2.5.0';
|
|
21
21
|
const PACKAGE_NAME = 'mlgym-deploy';
|
|
22
22
|
|
|
23
23
|
// Version check state
|
|
@@ -353,6 +353,48 @@ async function authenticate(args) {
|
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
// Check for existing MLGym project in current directory
|
|
357
|
+
async function checkExistingProject(local_path = '.') {
|
|
358
|
+
const absolutePath = path.resolve(local_path);
|
|
359
|
+
|
|
360
|
+
// Check for git repository
|
|
361
|
+
try {
|
|
362
|
+
const { stdout: remotes } = await execAsync('git remote -v', { cwd: absolutePath });
|
|
363
|
+
|
|
364
|
+
// Check for mlgym remote
|
|
365
|
+
if (remotes.includes('mlgym') && remotes.includes('git.mlgym.io')) {
|
|
366
|
+
// Extract project info from remote URL
|
|
367
|
+
const match = remotes.match(/mlgym\s+git@git\.mlgym\.io:([^\/]+)\/([^\.]+)\.git/);
|
|
368
|
+
if (match) {
|
|
369
|
+
const [, namespace, projectName] = match;
|
|
370
|
+
return {
|
|
371
|
+
exists: true,
|
|
372
|
+
name: projectName,
|
|
373
|
+
namespace: namespace,
|
|
374
|
+
configured: true,
|
|
375
|
+
message: `Project '${projectName}' already configured for MLGym deployment`
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Git repo exists but no mlgym remote
|
|
381
|
+
return {
|
|
382
|
+
exists: false,
|
|
383
|
+
has_git: true,
|
|
384
|
+
configured: false,
|
|
385
|
+
message: 'Git repository exists but no MLGym remote configured'
|
|
386
|
+
};
|
|
387
|
+
} catch {
|
|
388
|
+
// No git repository
|
|
389
|
+
return {
|
|
390
|
+
exists: false,
|
|
391
|
+
has_git: false,
|
|
392
|
+
configured: false,
|
|
393
|
+
message: 'No git repository found in current directory'
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
356
398
|
// Check authentication status
|
|
357
399
|
async function checkAuthStatus() {
|
|
358
400
|
const auth = await loadAuth();
|
|
@@ -548,7 +590,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
548
590
|
tools: [
|
|
549
591
|
{
|
|
550
592
|
name: 'mlgym_auth_status',
|
|
551
|
-
description: '
|
|
593
|
+
description: 'ALWAYS CALL THIS FIRST! Check authentication status before any other operation.',
|
|
552
594
|
inputSchema: {
|
|
553
595
|
type: 'object',
|
|
554
596
|
properties: {}
|
|
@@ -556,7 +598,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
556
598
|
},
|
|
557
599
|
{
|
|
558
600
|
name: 'mlgym_authenticate',
|
|
559
|
-
description: '
|
|
601
|
+
description: 'PHASE 1: Authentication ONLY. Get email, password, and existing account status in ONE interaction. Never ask for project details here!',
|
|
560
602
|
inputSchema: {
|
|
561
603
|
type: 'object',
|
|
562
604
|
properties: {
|
|
@@ -589,9 +631,23 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
589
631
|
required: ['email', 'password']
|
|
590
632
|
}
|
|
591
633
|
},
|
|
634
|
+
{
|
|
635
|
+
name: 'mlgym_project_status',
|
|
636
|
+
description: 'PHASE 2 START: Check if MLGym project exists in current directory. Call this AFTER authentication succeeds.',
|
|
637
|
+
inputSchema: {
|
|
638
|
+
type: 'object',
|
|
639
|
+
properties: {
|
|
640
|
+
local_path: {
|
|
641
|
+
type: 'string',
|
|
642
|
+
description: 'Local directory path (defaults to current directory)',
|
|
643
|
+
default: '.'
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
},
|
|
592
648
|
{
|
|
593
649
|
name: 'mlgym_project_init',
|
|
594
|
-
description: '
|
|
650
|
+
description: 'PHASE 2: Create project ONLY after checking project status. Never ask for email/password here - only project details!',
|
|
595
651
|
inputSchema: {
|
|
596
652
|
type: 'object',
|
|
597
653
|
properties: {
|
|
@@ -645,6 +701,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
645
701
|
case 'mlgym_authenticate':
|
|
646
702
|
return await authenticate(args);
|
|
647
703
|
|
|
704
|
+
case 'mlgym_project_status':
|
|
705
|
+
const projectStatus = await checkExistingProject(args.local_path);
|
|
706
|
+
return {
|
|
707
|
+
content: [{
|
|
708
|
+
type: 'text',
|
|
709
|
+
text: JSON.stringify(projectStatus, null, 2)
|
|
710
|
+
}]
|
|
711
|
+
};
|
|
712
|
+
|
|
648
713
|
case 'mlgym_project_init':
|
|
649
714
|
return await initProject(args);
|
|
650
715
|
|