latitude-mcp-server 2.2.5 → 2.2.6
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/dist/api.js +23 -24
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -443,16 +443,9 @@ const ERROR_SUGGESTIONS = {
|
|
|
443
443
|
suggestion: 'Move the <tool-call> tag inside an <assistant> block.',
|
|
444
444
|
},
|
|
445
445
|
};
|
|
446
|
-
/**
|
|
447
|
-
* Get snippet from content around a position
|
|
448
|
-
*/
|
|
449
|
-
function getSnippet(content, startIndex, endIndex) {
|
|
450
|
-
const snippet = content.substring(startIndex, Math.min(endIndex, startIndex + 100));
|
|
451
|
-
return snippet.split('\n')[0] || snippet;
|
|
452
|
-
}
|
|
453
446
|
/**
|
|
454
447
|
* Pre-validate PromptL content using the official promptl-ai library.
|
|
455
|
-
* Returns detailed, actionable error messages.
|
|
448
|
+
* Returns detailed, actionable error messages with code frames.
|
|
456
449
|
*/
|
|
457
450
|
async function validatePromptLContent(content, path) {
|
|
458
451
|
const issues = [];
|
|
@@ -465,9 +458,6 @@ async function validatePromptLContent(content, path) {
|
|
|
465
458
|
});
|
|
466
459
|
// Convert CompileErrors to our ValidationIssue format
|
|
467
460
|
for (const compileError of result.errors) {
|
|
468
|
-
// CompileError has start?.line (Position) and startIndex (number)
|
|
469
|
-
const lineNumber = compileError.start?.line;
|
|
470
|
-
const snippet = getSnippet(content, compileError.startIndex, compileError.endIndex);
|
|
471
461
|
// Get human-readable suggestion based on error code
|
|
472
462
|
const suggestionInfo = ERROR_SUGGESTIONS[compileError.code] || {
|
|
473
463
|
rootCause: compileError.message,
|
|
@@ -475,36 +465,43 @@ async function validatePromptLContent(content, path) {
|
|
|
475
465
|
};
|
|
476
466
|
issues.push({
|
|
477
467
|
type: 'error',
|
|
468
|
+
code: compileError.code,
|
|
478
469
|
message: compileError.message,
|
|
479
470
|
rootCause: suggestionInfo.rootCause,
|
|
480
471
|
suggestion: suggestionInfo.suggestion,
|
|
481
|
-
|
|
482
|
-
|
|
472
|
+
location: compileError.start ? {
|
|
473
|
+
line: compileError.start.line,
|
|
474
|
+
column: compileError.start.column,
|
|
475
|
+
} : undefined,
|
|
476
|
+
codeFrame: compileError.frame, // The beautiful formatted code frame!
|
|
483
477
|
});
|
|
484
478
|
}
|
|
485
479
|
}
|
|
486
480
|
catch (err) {
|
|
487
481
|
// Handle parse errors (thrown, not accumulated)
|
|
488
482
|
if (err instanceof promptl_ai_1.CompileError) {
|
|
489
|
-
const lineNumber = err.start?.line;
|
|
490
|
-
const snippet = getSnippet(content, err.startIndex, err.endIndex);
|
|
491
483
|
const suggestionInfo = ERROR_SUGGESTIONS[err.code] || {
|
|
492
484
|
rootCause: err.message,
|
|
493
485
|
suggestion: 'Fix the syntax error at the indicated location.',
|
|
494
486
|
};
|
|
495
487
|
issues.push({
|
|
496
488
|
type: 'error',
|
|
489
|
+
code: err.code,
|
|
497
490
|
message: err.message,
|
|
498
491
|
rootCause: suggestionInfo.rootCause,
|
|
499
492
|
suggestion: suggestionInfo.suggestion,
|
|
500
|
-
|
|
501
|
-
|
|
493
|
+
location: err.start ? {
|
|
494
|
+
line: err.start.line,
|
|
495
|
+
column: err.start.column,
|
|
496
|
+
} : undefined,
|
|
497
|
+
codeFrame: err.frame,
|
|
502
498
|
});
|
|
503
499
|
}
|
|
504
500
|
else {
|
|
505
501
|
// Unknown error - still report it
|
|
506
502
|
issues.push({
|
|
507
503
|
type: 'error',
|
|
504
|
+
code: 'unknown-error',
|
|
508
505
|
message: err instanceof Error ? err.message : 'Unknown validation error',
|
|
509
506
|
rootCause: 'An unexpected error occurred during validation.',
|
|
510
507
|
suggestion: 'Check the prompt content for syntax errors.',
|
|
@@ -533,10 +530,11 @@ async function identifyFailingDocuments(changes) {
|
|
|
533
530
|
failed.push({
|
|
534
531
|
path: change.path,
|
|
535
532
|
error: mainError.message,
|
|
533
|
+
code: mainError.code,
|
|
536
534
|
rootCause: mainError.rootCause,
|
|
537
535
|
suggestion: mainError.suggestion,
|
|
538
|
-
|
|
539
|
-
|
|
536
|
+
location: mainError.location,
|
|
537
|
+
codeFrame: mainError.codeFrame,
|
|
540
538
|
});
|
|
541
539
|
}
|
|
542
540
|
}
|
|
@@ -601,9 +599,9 @@ async function testSingleDocument(change) {
|
|
|
601
599
|
return {
|
|
602
600
|
path: change.path,
|
|
603
601
|
error: errorMsg,
|
|
602
|
+
code: 'api-validation-error',
|
|
604
603
|
rootCause,
|
|
605
604
|
suggestion,
|
|
606
|
-
snippet: change.content?.substring(0, 300),
|
|
607
605
|
};
|
|
608
606
|
}
|
|
609
607
|
}
|
|
@@ -731,13 +729,14 @@ async function deployToLive(changes, _versionName) {
|
|
|
731
729
|
const errorLines = [];
|
|
732
730
|
for (const doc of failedDocs) {
|
|
733
731
|
errorLines.push(`\n## ❌ ${doc.path}`);
|
|
732
|
+
errorLines.push(`**Error Code:** \`${doc.code}\``);
|
|
734
733
|
errorLines.push(`**Error:** ${doc.error}`);
|
|
735
734
|
errorLines.push(`**Root Cause:** ${doc.rootCause}`);
|
|
736
|
-
if (doc.
|
|
737
|
-
errorLines.push(`**Location:** Line ${doc.
|
|
735
|
+
if (doc.location) {
|
|
736
|
+
errorLines.push(`**Location:** Line ${doc.location.line}, Column ${doc.location.column}`);
|
|
738
737
|
}
|
|
739
|
-
if (doc.
|
|
740
|
-
errorLines.push(`**
|
|
738
|
+
if (doc.codeFrame) {
|
|
739
|
+
errorLines.push(`**Code Context:**\n\`\`\`\n${doc.codeFrame}\n\`\`\``);
|
|
741
740
|
}
|
|
742
741
|
errorLines.push(`**Fix:** ${doc.suggestion}`);
|
|
743
742
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latitude-mcp-server",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"description": "Simplified MCP server for Latitude.so prompt management - 8 focused tools for push, pull, run, and manage prompts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|