@imenam/mcp-documentor 1.0.83 → 1.0.85
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.
|
@@ -6,6 +6,18 @@ const logger = createLogger("StorageEngine");
|
|
|
6
6
|
function escapeRegex(s) {
|
|
7
7
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Parses a doc file into a fresh object. Passing options bypasses gray-matter's
|
|
11
|
+
* module-level cache, which hands every caller the same `data` object for identical
|
|
12
|
+
* input: a mutation made by one caller would otherwise be seen by the next read.
|
|
13
|
+
*/
|
|
14
|
+
function parseDocFile(raw) {
|
|
15
|
+
return matter(raw, {});
|
|
16
|
+
}
|
|
17
|
+
/** Drops the keys whose value is undefined: YAML has no representation for them. */
|
|
18
|
+
function withoutUndefined(value) {
|
|
19
|
+
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined));
|
|
20
|
+
}
|
|
9
21
|
export class StorageEngine {
|
|
10
22
|
rootDir;
|
|
11
23
|
historyStore;
|
|
@@ -118,7 +130,7 @@ export class StorageEngine {
|
|
|
118
130
|
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
119
131
|
const frontmatter = {
|
|
120
132
|
title: doc.title,
|
|
121
|
-
tracked_files: doc.tracked_files,
|
|
133
|
+
tracked_files: doc.tracked_files.map(withoutUndefined),
|
|
122
134
|
tags: doc.tags,
|
|
123
135
|
...(doc.related_docs?.length && { related_docs: doc.related_docs }),
|
|
124
136
|
createdAt: doc.createdAt,
|
|
@@ -135,7 +147,7 @@ export class StorageEngine {
|
|
|
135
147
|
if (!fs.existsSync(filePath))
|
|
136
148
|
return null;
|
|
137
149
|
const raw = fs.readFileSync(filePath, "utf-8");
|
|
138
|
-
const { data, content } =
|
|
150
|
+
const { data, content } = parseDocFile(raw);
|
|
139
151
|
const parts = id.split("/");
|
|
140
152
|
const folder = parts.length > 1 ? parts.slice(0, -1).join("/") : undefined;
|
|
141
153
|
return {
|
|
@@ -170,7 +182,7 @@ export class StorageEngine {
|
|
|
170
182
|
for (const filePath of files) {
|
|
171
183
|
try {
|
|
172
184
|
const raw = fs.readFileSync(filePath, "utf-8");
|
|
173
|
-
const { data } =
|
|
185
|
+
const { data } = parseDocFile(raw);
|
|
174
186
|
const stat = fs.statSync(filePath);
|
|
175
187
|
const relPath = path.relative(projectDir, filePath);
|
|
176
188
|
const id = relPath.replace(/\.md$/, "").split(path.sep).join("/");
|
package/dist/src/gui-worker.js
CHANGED
|
@@ -2,7 +2,7 @@ import { serve } from "@hono/node-server";
|
|
|
2
2
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
4
|
import { streamSSE } from "hono/streaming";
|
|
5
|
-
import { ProxyClient } from "@imenam/mcp-gui-interface";
|
|
5
|
+
import { GUI_LISTEN_HOST, ProxyClient, honoGuiGuard } from "@imenam/mcp-gui-interface";
|
|
6
6
|
import { IPCMessageSchema } from "../shared/schemas/doc.schema.js";
|
|
7
7
|
import { isReadOnly } from "../shared/read-only.js";
|
|
8
8
|
import path from "path";
|
|
@@ -125,6 +125,7 @@ async function findSystemBrowser() {
|
|
|
125
125
|
let localPort = 0;
|
|
126
126
|
let guiPublicUrl = '';
|
|
127
127
|
const app = new Hono();
|
|
128
|
+
app.use("*", honoGuiGuard());
|
|
128
129
|
let proxyClient = null;
|
|
129
130
|
const sseControllers = new Set();
|
|
130
131
|
const pendingRequests = new Map();
|
|
@@ -574,7 +575,7 @@ app.get("/api/export-zip/:id", async (c) => {
|
|
|
574
575
|
docId = ref;
|
|
575
576
|
}
|
|
576
577
|
else {
|
|
577
|
-
zip.file(`${ref}.md`, `# [Unqualified doc reference: ${ref} — no project given]
|
|
578
|
+
zip.file(`${ref}.md`, `# [Unqualified doc reference: ${ref} — no project given]
|
|
578
579
|
`);
|
|
579
580
|
continue;
|
|
580
581
|
}
|
|
@@ -757,7 +758,7 @@ app.get("/*", (c, next) => {
|
|
|
757
758
|
*/
|
|
758
759
|
function listen(port, publicUrl, isProxied) {
|
|
759
760
|
logger.info(`Starting Hono server on port ${port}...`);
|
|
760
|
-
const serverInstance = serve({ fetch: app.fetch, port, hostname:
|
|
761
|
+
const serverInstance = serve({ fetch: app.fetch, port, hostname: GUI_LISTEN_HOST }, (info) => {
|
|
761
762
|
logger.info(`Dashboard server listening on port ${info.port}`);
|
|
762
763
|
safeSend(IPCMessageSchema.parse({
|
|
763
764
|
type: "READY",
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const APP_VERSION = "1.0.
|
|
1
|
+
export declare const APP_VERSION = "1.0.85";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated version file - do not edit manually
|
|
2
|
-
export const APP_VERSION = '1.0.
|
|
2
|
+
export const APP_VERSION = '1.0.85';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imenam/mcp-documentor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.85",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"description": "MCP server to create, manage and search project documentation with staleness tracking and semantic search.",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@hono/node-server": "^1.19.10",
|
|
28
|
-
"@imenam/mcp-gui-interface": "^1.0.
|
|
28
|
+
"@imenam/mcp-gui-interface": "^1.0.14",
|
|
29
29
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
30
30
|
"better-sqlite3": "^12.8.0",
|
|
31
31
|
"dotenv": "^17.3.1",
|