latitude-mcp-server 2.1.6 → 2.1.7
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.d.ts +4 -4
- package/dist/api.js +38 -63
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -28,12 +28,12 @@ export declare function createVersion(name: string): Promise<Version>;
|
|
|
28
28
|
export declare function publishVersion(versionUuid: string, title?: string): Promise<Version>;
|
|
29
29
|
export declare function listDocuments(versionUuid?: string): Promise<Document[]>;
|
|
30
30
|
export declare function getDocument(path: string, versionUuid?: string): Promise<Document>;
|
|
31
|
-
export declare function createOrUpdateDocument(versionUuid: string, path: string, content: string): Promise<Document>;
|
|
31
|
+
export declare function createOrUpdateDocument(versionUuid: string, path: string, content: string, force?: boolean): Promise<Document>;
|
|
32
32
|
export declare function deleteDocument(versionUuid: string, path: string): Promise<void>;
|
|
33
33
|
export declare function runDocument(path: string, parameters?: Record<string, unknown>, versionUuid?: string): Promise<RunResult>;
|
|
34
34
|
/**
|
|
35
|
-
* Deploy changes to LIVE version
|
|
36
|
-
*
|
|
35
|
+
* Deploy changes directly to LIVE version using force mode
|
|
36
|
+
* This bypasses the draft->publish workflow which requires provider validation
|
|
37
37
|
*/
|
|
38
|
-
export declare function deployToLive(changes: DocumentChange[],
|
|
38
|
+
export declare function deployToLive(changes: DocumentChange[], _versionName?: string): Promise<DeployResult>;
|
|
39
39
|
export declare function getPromptNames(): Promise<string[]>;
|
package/dist/api.js
CHANGED
|
@@ -171,12 +171,12 @@ async function getDocument(path, versionUuid = 'live') {
|
|
|
171
171
|
const normalizedPath = path.startsWith('/') ? path.slice(1) : path;
|
|
172
172
|
return request(`/projects/${projectId}/versions/${versionUuid}/documents/${normalizedPath}`);
|
|
173
173
|
}
|
|
174
|
-
async function createOrUpdateDocument(versionUuid, path, content) {
|
|
174
|
+
async function createOrUpdateDocument(versionUuid, path, content, force = false) {
|
|
175
175
|
const projectId = getProjectId();
|
|
176
|
-
logger.debug(`Creating/updating document: ${path} (${content.length} chars)`);
|
|
176
|
+
logger.debug(`Creating/updating document: ${path} (${content.length} chars, force=${force})`);
|
|
177
177
|
return request(`/projects/${projectId}/versions/${versionUuid}/documents/create-or-update`, {
|
|
178
178
|
method: 'POST',
|
|
179
|
-
body: { path, prompt: content },
|
|
179
|
+
body: { path, prompt: content, force },
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
async function deleteDocument(versionUuid, path) {
|
|
@@ -197,69 +197,44 @@ async function runDocument(path, parameters, versionUuid = 'live') {
|
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
200
|
+
* Deploy changes directly to LIVE version using force mode
|
|
201
|
+
* This bypasses the draft->publish workflow which requires provider validation
|
|
202
202
|
*/
|
|
203
|
-
function
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
203
|
+
async function deployToLive(changes, _versionName) {
|
|
204
|
+
const added = [];
|
|
205
|
+
const modified = [];
|
|
206
|
+
const deleted = [];
|
|
207
|
+
// Process each change directly to LIVE with force=true
|
|
208
|
+
for (const change of changes) {
|
|
209
|
+
logger.info(`Deploying ${change.status}: ${change.path}`);
|
|
210
|
+
if (change.status === 'deleted') {
|
|
211
|
+
try {
|
|
212
|
+
await deleteDocument('live', change.path);
|
|
213
|
+
deleted.push(change.path);
|
|
214
|
+
logger.debug(`Deleted: ${change.path}`);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
// Document might not exist, log and continue
|
|
218
|
+
logger.warn(`Failed to delete ${change.path}:`, error);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
// Use force=true to push directly to LIVE
|
|
223
|
+
await createOrUpdateDocument('live', change.path, change.content, true);
|
|
224
|
+
if (change.status === 'added') {
|
|
225
|
+
added.push(change.path);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
modified.push(change.path);
|
|
229
|
+
}
|
|
230
|
+
logger.debug(`${change.status}: ${change.path}`);
|
|
231
|
+
}
|
|
222
232
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
* Push changes to a version using the push endpoint
|
|
227
|
-
*/
|
|
228
|
-
async function pushChangesToVersion(versionUuid, changes) {
|
|
229
|
-
const projectId = getProjectId();
|
|
230
|
-
const apiChanges = changes.map((c) => ({
|
|
231
|
-
path: c.path,
|
|
232
|
-
content: c.content,
|
|
233
|
-
status: c.status,
|
|
234
|
-
}));
|
|
235
|
-
logger.debug(`Pushing ${changes.length} change(s) to version ${versionUuid}`);
|
|
236
|
-
await request(`/projects/${projectId}/versions/${versionUuid}/push`, {
|
|
237
|
-
method: 'POST',
|
|
238
|
-
body: { changes: apiChanges },
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Deploy changes to LIVE version
|
|
243
|
-
* Creates a draft → pushes changes → publishes to LIVE
|
|
244
|
-
*/
|
|
245
|
-
async function deployToLive(changes, versionName) {
|
|
246
|
-
const name = versionName || formatSFTimestamp();
|
|
247
|
-
// Step 1: Create a new draft version
|
|
248
|
-
logger.info(`Creating draft: ${name}`);
|
|
249
|
-
const version = await createVersion(name);
|
|
250
|
-
// Step 2: Push all changes to the draft using the push endpoint
|
|
251
|
-
logger.info(`Pushing ${changes.length} change(s) to draft...`);
|
|
252
|
-
await pushChangesToVersion(version.uuid, changes);
|
|
253
|
-
// Step 3: Publish the draft to LIVE
|
|
254
|
-
logger.info(`Publishing version ${version.uuid} to LIVE with title: ${name}`);
|
|
255
|
-
const published = await publishVersion(version.uuid, name);
|
|
256
|
-
logger.info(`Published! Version is now LIVE: ${published.uuid}`);
|
|
257
|
-
// Categorize changes for return value
|
|
258
|
-
const added = changes.filter((c) => c.status === 'added').map((c) => c.path);
|
|
259
|
-
const modified = changes.filter((c) => c.status === 'modified').map((c) => c.path);
|
|
260
|
-
const deleted = changes.filter((c) => c.status === 'deleted').map((c) => c.path);
|
|
233
|
+
// Get current LIVE version info
|
|
234
|
+
const docs = await listDocuments('live');
|
|
235
|
+
const liveVersionUuid = docs.length > 0 ? docs[0].versionUuid : 'live';
|
|
261
236
|
return {
|
|
262
|
-
version:
|
|
237
|
+
version: { uuid: liveVersionUuid },
|
|
263
238
|
documentsProcessed: changes.length,
|
|
264
239
|
added,
|
|
265
240
|
modified,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latitude-mcp-server",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
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",
|