@imenam/mcp-documentor 1.0.36 → 1.0.38

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.
@@ -268,6 +268,22 @@ app.get("/api/doc/*", async (c) => {
268
268
  return c.json({ error: result.error }, 400);
269
269
  return c.json(result.data);
270
270
  });
271
+ app.put("/api/doc/*", async (c) => {
272
+ try {
273
+ const id = decodeURIComponent(c.req.path.slice("/api/doc/".length));
274
+ const body = await c.req.json();
275
+ if (body.content === undefined) {
276
+ return c.json({ error: "content is required" }, 400);
277
+ }
278
+ const result = await ipcRequest("UPDATE_DOC", { id, content: body.content, title: body.title }, 15000);
279
+ if (result.error)
280
+ return c.json({ error: result.error }, 500);
281
+ return c.json(result.data ?? { success: true });
282
+ }
283
+ catch (err) {
284
+ return c.json({ error: err.message }, 500);
285
+ }
286
+ });
271
287
  app.get("/api/freshness/*", async (c) => {
272
288
  const id = decodeURIComponent(c.req.path.slice("/api/freshness/".length));
273
289
  const result = await ipcRequest("CHECK_FRESHNESS", { id });
package/dist/src/index.js CHANGED
@@ -126,6 +126,9 @@ function handleIPCMessage(msg) {
126
126
  else if (msg.type === "GET_DOC_VERSION") {
127
127
  handleGetDocVersionIPC(msg);
128
128
  }
129
+ else if (msg.type === "UPDATE_DOC") {
130
+ handleUpdateDocIPC(msg);
131
+ }
129
132
  else {
130
133
  logger.debug(`Unhandled message from GUI: ${msg.type}`);
131
134
  }
@@ -254,6 +257,40 @@ async function handleGetDoc(msg) {
254
257
  });
255
258
  }
256
259
  }
260
+ async function handleUpdateDocIPC(msg) {
261
+ try {
262
+ const result = await updateDoc(storageEngine, embeddingEngine, {
263
+ path: msg.data.id,
264
+ content: msg.data.content,
265
+ ...(msg.data.title !== undefined && { title: msg.data.title }),
266
+ });
267
+ if (result.isError) {
268
+ const text = result.content[0]?.type === "text" ? result.content[0].text : "Update failed";
269
+ broadcastToGUI({
270
+ type: "UPDATE_DOC_RESPONSE",
271
+ correlationId: msg.correlationId,
272
+ error: text,
273
+ timestamp: new Date().toISOString(),
274
+ });
275
+ return;
276
+ }
277
+ const message = result.content[0]?.type === "text" ? result.content[0].text : undefined;
278
+ broadcastToGUI({
279
+ type: "UPDATE_DOC_RESPONSE",
280
+ correlationId: msg.correlationId,
281
+ data: { success: true, message },
282
+ timestamp: new Date().toISOString(),
283
+ });
284
+ }
285
+ catch (err) {
286
+ broadcastToGUI({
287
+ type: "UPDATE_DOC_RESPONSE",
288
+ correlationId: msg.correlationId,
289
+ error: err.message,
290
+ timestamp: new Date().toISOString(),
291
+ });
292
+ }
293
+ }
257
294
  async function handleCheckFreshness(msg) {
258
295
  try {
259
296
  const resolved = await storageEngine.resolveDoc(msg.data.id ?? msg.data.path);
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.36";
1
+ export declare const APP_VERSION = "1.0.38";
@@ -1,2 +1,2 @@
1
1
  // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.36';
2
+ export const APP_VERSION = '1.0.38';