latitude-mcp-server 2.2.2 → 2.2.3
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 +61 -9
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -397,6 +397,40 @@ async function runDocument(path, parameters, versionUuid = 'live') {
|
|
|
397
397
|
timeout: API_TIMEOUT_MS,
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Identify which documents fail validation by testing each one individually.
|
|
402
|
+
* Used when a batch publish fails to provide actionable error messages.
|
|
403
|
+
*/
|
|
404
|
+
async function identifyFailingDocuments(changes) {
|
|
405
|
+
const failed = [];
|
|
406
|
+
for (const change of changes) {
|
|
407
|
+
if (change.status === 'deleted')
|
|
408
|
+
continue; // Deletes don't have content validation
|
|
409
|
+
try {
|
|
410
|
+
// Create a test draft for this single document
|
|
411
|
+
const testDraft = await createVersion(`validation-test-${change.path}`);
|
|
412
|
+
// Push just this document
|
|
413
|
+
await pushChanges(testDraft.uuid, [change]);
|
|
414
|
+
// Try to publish - this will fail if document has validation errors
|
|
415
|
+
await publishVersion(testDraft.uuid);
|
|
416
|
+
// If we get here, document is valid - the draft was published but that's ok
|
|
417
|
+
logger.debug(`Document ${change.path} validated successfully`);
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
// This document failed - capture the error
|
|
421
|
+
const errorMsg = error instanceof LatitudeApiError
|
|
422
|
+
? error.message
|
|
423
|
+
: (error instanceof Error ? error.message : 'Unknown validation error');
|
|
424
|
+
failed.push({
|
|
425
|
+
path: change.path,
|
|
426
|
+
error: errorMsg,
|
|
427
|
+
content: change.content?.substring(0, 200) + (change.content && change.content.length > 200 ? '...' : ''),
|
|
428
|
+
});
|
|
429
|
+
logger.debug(`Document ${change.path} failed validation: ${errorMsg}`);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return failed;
|
|
433
|
+
}
|
|
400
434
|
/**
|
|
401
435
|
* Create a synthetic Version object for no-op deploys.
|
|
402
436
|
* Returns a fully populated Version with all required fields.
|
|
@@ -461,15 +495,33 @@ async function deployToLive(changes, _versionName) {
|
|
|
461
495
|
logger.info(`Push complete: ${pushResult.documentsProcessed} documents processed`);
|
|
462
496
|
// Step 3: Publish the draft to make it LIVE
|
|
463
497
|
logger.info(`Publishing draft ${draft.uuid} to LIVE...`);
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
498
|
+
try {
|
|
499
|
+
const published = await publishVersion(draft.uuid, draftName);
|
|
500
|
+
logger.info(`Published successfully! Version is now LIVE: ${published.uuid}`);
|
|
501
|
+
return {
|
|
502
|
+
version: published,
|
|
503
|
+
documentsProcessed: pushResult.documentsProcessed,
|
|
504
|
+
added,
|
|
505
|
+
modified,
|
|
506
|
+
deleted,
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
catch (publishError) {
|
|
510
|
+
// Publish failed - identify which document(s) have validation errors
|
|
511
|
+
logger.warn('Batch publish failed, identifying problematic documents...');
|
|
512
|
+
const failedDocs = await identifyFailingDocuments(actualChanges);
|
|
513
|
+
if (failedDocs.length > 0) {
|
|
514
|
+
const errorDetails = failedDocs.map(f => `- ${f.path}: ${f.error}`).join('\n');
|
|
515
|
+
throw new LatitudeApiError({
|
|
516
|
+
name: 'DocumentValidationError',
|
|
517
|
+
errorCode: 'DOCUMENT_VALIDATION_FAILED',
|
|
518
|
+
message: `${failedDocs.length} document(s) failed validation:\n${errorDetails}`,
|
|
519
|
+
details: { failedDocuments: failedDocs },
|
|
520
|
+
}, 422);
|
|
521
|
+
}
|
|
522
|
+
// Re-throw original error if we couldn't identify specific failures
|
|
523
|
+
throw publishError;
|
|
524
|
+
}
|
|
473
525
|
}
|
|
474
526
|
async function getPromptNames() {
|
|
475
527
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latitude-mcp-server",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
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",
|