@imenam/mcp-documentor 1.0.83 → 1.0.84
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/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const APP_VERSION = "1.0.
|
|
1
|
+
export declare const APP_VERSION = "1.0.84";
|
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.84';
|