@imenam/mcp-documentor 1.0.42 → 1.0.44
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/shared/schemas/doc.schema.d.ts +3 -0
- package/dist/shared/schemas/doc.schema.js +2 -1
- package/dist/src/core/section-tracker.d.ts +3 -1
- package/dist/src/core/section-tracker.js +30 -6
- package/dist/src/gui-worker.js +13 -1
- package/dist/src/index.js +42 -0
- package/dist/src/tools/get-doc-metadata.js +1 -1
- package/dist/src/tools/refresh-file-snapshot.js +5 -1
- package/dist/src/tools/search-docs.js +5 -4
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/gui/dist/assets/{_baseUniq-CAC7UtIV.js → _baseUniq-BU0U623P.js} +1 -1
- package/gui/dist/assets/{arc-CWPLoMKh.js → arc-Ce3Gb8xA.js} +1 -1
- package/gui/dist/assets/{architectureDiagram-Q4EWVU46-BWFAS_jb.js → architectureDiagram-Q4EWVU46-Ces_mPGF.js} +1 -1
- package/gui/dist/assets/{blockDiagram-DXYQGD6D-CT_9uxA4.js → blockDiagram-DXYQGD6D-B8Y-pXgj.js} +1 -1
- package/gui/dist/assets/{c4Diagram-AHTNJAMY-D-DmwGiz.js → c4Diagram-AHTNJAMY-WNjVDfrm.js} +1 -1
- package/gui/dist/assets/channel-Bawra3aZ.js +1 -0
- package/gui/dist/assets/{chunk-4BX2VUAB-C0xLQwJ7.js → chunk-4BX2VUAB-DiqlRlBf.js} +1 -1
- package/gui/dist/assets/{chunk-4TB4RGXK-bMsBCqYj.js → chunk-4TB4RGXK-CxKEFtUX.js} +1 -1
- package/gui/dist/assets/{chunk-55IACEB6-BY1WMvcH.js → chunk-55IACEB6-w5vdVSko.js} +1 -1
- package/gui/dist/assets/{chunk-EDXVE4YY-BQC7TacF.js → chunk-EDXVE4YY-Dg6HQynX.js} +1 -1
- package/gui/dist/assets/{chunk-FMBD7UC4-bP7fPFzd.js → chunk-FMBD7UC4-B_8Ah5kO.js} +1 -1
- package/gui/dist/assets/{chunk-OYMX7WX6-C4IwYIda.js → chunk-OYMX7WX6-BT0nXoHz.js} +1 -1
- package/gui/dist/assets/{chunk-QZHKN3VN-Cf4Xcz9l.js → chunk-QZHKN3VN-3KYhwfha.js} +1 -1
- package/gui/dist/assets/{chunk-YZCP3GAM-CigQkEAZ.js → chunk-YZCP3GAM-UAMyKnC1.js} +1 -1
- package/gui/dist/assets/classDiagram-6PBFFD2Q-A3ottNSQ.js +1 -0
- package/gui/dist/assets/classDiagram-v2-HSJHXN6E-A3ottNSQ.js +1 -0
- package/gui/dist/assets/clone-mIFDnjwl.js +1 -0
- package/gui/dist/assets/{cose-bilkent-S5V4N54A-CrIJv9Xh.js → cose-bilkent-S5V4N54A-DClmwFbl.js} +1 -1
- package/gui/dist/assets/{dagre-KV5264BT-DTbmoEVc.js → dagre-KV5264BT-CTaJghw8.js} +1 -1
- package/gui/dist/assets/{diagram-5BDNPKRD-Cnjq8sNy.js → diagram-5BDNPKRD-DDL2xiIH.js} +1 -1
- package/gui/dist/assets/{diagram-G4DWMVQ6-Cc0sWbzZ.js → diagram-G4DWMVQ6-uNQmnOVi.js} +1 -1
- package/gui/dist/assets/{diagram-MMDJMWI5-D34S9PpQ.js → diagram-MMDJMWI5-Cd2q0xCp.js} +1 -1
- package/gui/dist/assets/{diagram-TYMM5635-BsPe6ShI.js → diagram-TYMM5635-f5gxEjq1.js} +1 -1
- package/gui/dist/assets/{erDiagram-SMLLAGMA-BeFJ1foo.js → erDiagram-SMLLAGMA-9vfXUDTU.js} +1 -1
- package/gui/dist/assets/{flowDiagram-DWJPFMVM-CjMFd88O.js → flowDiagram-DWJPFMVM-BKu8hLQt.js} +1 -1
- package/gui/dist/assets/{ganttDiagram-T4ZO3ILL-CugMb9XL.js → ganttDiagram-T4ZO3ILL-JKTpXhdp.js} +1 -1
- package/gui/dist/assets/{gitGraphDiagram-UUTBAWPF-BMDVmwo4.js → gitGraphDiagram-UUTBAWPF-WPLTQc61.js} +1 -1
- package/gui/dist/assets/{graph-IE3vzU1d.js → graph-BaMEnwCR.js} +1 -1
- package/gui/dist/assets/index-BzyTjtNB.css +1 -0
- package/gui/dist/assets/{index-Tfvmw2iu.js → index-CaPQpXd3.js} +90 -90
- package/gui/dist/assets/{infoDiagram-42DDH7IO-dFksHKzL.js → infoDiagram-42DDH7IO-VapOHi4Y.js} +1 -1
- package/gui/dist/assets/{ishikawaDiagram-UXIWVN3A-Dn5JS3n-.js → ishikawaDiagram-UXIWVN3A-Cf7vBj2E.js} +1 -1
- package/gui/dist/assets/{journeyDiagram-VCZTEJTY-flNLUjGA.js → journeyDiagram-VCZTEJTY-DtC9ymAy.js} +1 -1
- package/gui/dist/assets/{kanban-definition-6JOO6SKY-BHMQ95I3.js → kanban-definition-6JOO6SKY-O0fDNBIn.js} +1 -1
- package/gui/dist/assets/{layout-DILumY9_.js → layout-CKm9GbtU.js} +1 -1
- package/gui/dist/assets/{linear-CEWdQMoX.js → linear-Cn1ygZ55.js} +1 -1
- package/gui/dist/assets/{min-BSijUdNS.js → min-CVVJHMPl.js} +1 -1
- package/gui/dist/assets/{mindmap-definition-QFDTVHPH-CbIdCT18.js → mindmap-definition-QFDTVHPH-BJkWNcu5.js} +1 -1
- package/gui/dist/assets/{pieDiagram-DEJITSTG-BIeSpZ8o.js → pieDiagram-DEJITSTG-DBvmgJfB.js} +1 -1
- package/gui/dist/assets/{quadrantDiagram-34T5L4WZ-C2_VeK0y.js → quadrantDiagram-34T5L4WZ-vWwN725k.js} +1 -1
- package/gui/dist/assets/{requirementDiagram-MS252O5E-BobeMyYU.js → requirementDiagram-MS252O5E-D7JQGgq0.js} +1 -1
- package/gui/dist/assets/{sankeyDiagram-XADWPNL6-_0K0w8mh.js → sankeyDiagram-XADWPNL6-V_OhiBi2.js} +1 -1
- package/gui/dist/assets/{sequenceDiagram-FGHM5R23-CxWseivu.js → sequenceDiagram-FGHM5R23-C7-ndrI7.js} +1 -1
- package/gui/dist/assets/{stateDiagram-FHFEXIEX-xAnXnHUU.js → stateDiagram-FHFEXIEX-DtqD-GG8.js} +1 -1
- package/gui/dist/assets/stateDiagram-v2-QKLJ7IA2-DhNiUVPk.js +1 -0
- package/gui/dist/assets/{timeline-definition-GMOUNBTQ-CPuPjJg7.js → timeline-definition-GMOUNBTQ-BSd1iHP7.js} +1 -1
- package/gui/dist/assets/{vennDiagram-DHZGUBPP-oTLkRNDM.js → vennDiagram-DHZGUBPP-5vVRkiC1.js} +1 -1
- package/gui/dist/assets/{wardley-RL74JXVD-AP7N9VGj.js → wardley-RL74JXVD-Dd64Tq4P.js} +1 -1
- package/gui/dist/assets/{wardleyDiagram-NUSXRM2D-t_vBEbYh.js → wardleyDiagram-NUSXRM2D-r6Y_JsSV.js} +1 -1
- package/gui/dist/assets/{xychartDiagram-5P7HB3ND-DrSm-1-s.js → xychartDiagram-5P7HB3ND-CKHTns95.js} +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/gui/dist/assets/channel-BPqVwb1D.js +0 -1
- package/gui/dist/assets/classDiagram-6PBFFD2Q-C4UDSQAO.js +0 -1
- package/gui/dist/assets/classDiagram-v2-HSJHXN6E-C4UDSQAO.js +0 -1
- package/gui/dist/assets/clone-Bqy5nShd.js +0 -1
- package/gui/dist/assets/index-BEJDvqRE.css +0 -1
- package/gui/dist/assets/stateDiagram-v2-QKLJ7IA2-BAi3xiyL.js +0 -1
|
@@ -5,6 +5,7 @@ export declare const TrackedSectionSchema: z.ZodObject<{
|
|
|
5
5
|
bottom: z.ZodArray<z.ZodString>;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
7
|
sectionHash: z.ZodString;
|
|
8
|
+
lineCount: z.ZodOptional<z.ZodNumber>;
|
|
8
9
|
}, z.core.$strip>;
|
|
9
10
|
export type TrackedSection = z.infer<typeof TrackedSectionSchema>;
|
|
10
11
|
export declare const TrackedFileSchema: z.ZodObject<{
|
|
@@ -17,6 +18,7 @@ export declare const TrackedFileSchema: z.ZodObject<{
|
|
|
17
18
|
bottom: z.ZodArray<z.ZodString>;
|
|
18
19
|
}, z.core.$strip>;
|
|
19
20
|
sectionHash: z.ZodString;
|
|
21
|
+
lineCount: z.ZodOptional<z.ZodNumber>;
|
|
20
22
|
}, z.core.$strip>>>;
|
|
21
23
|
}, z.core.$strip>;
|
|
22
24
|
export type TrackedFile = z.infer<typeof TrackedFileSchema>;
|
|
@@ -46,6 +48,7 @@ export declare const DocSchema: z.ZodObject<{
|
|
|
46
48
|
bottom: z.ZodArray<z.ZodString>;
|
|
47
49
|
}, z.core.$strip>;
|
|
48
50
|
sectionHash: z.ZodString;
|
|
51
|
+
lineCount: z.ZodOptional<z.ZodNumber>;
|
|
49
52
|
}, z.core.$strip>>>;
|
|
50
53
|
}, z.core.$strip>>>;
|
|
51
54
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -5,6 +5,7 @@ export const TrackedSectionSchema = z.object({
|
|
|
5
5
|
bottom: z.array(z.string()),
|
|
6
6
|
}),
|
|
7
7
|
sectionHash: z.string(),
|
|
8
|
+
lineCount: z.number().optional(),
|
|
8
9
|
});
|
|
9
10
|
export const TrackedFileSchema = z.object({
|
|
10
11
|
path: z.string(),
|
|
@@ -75,7 +76,7 @@ export const SearchDocsArgsSchema = z.object({
|
|
|
75
76
|
});
|
|
76
77
|
export const RefreshFileSnapshotArgsSchema = z.object({
|
|
77
78
|
paths: z.array(z.string()).min(1).describe("Paths of documentation entries to refresh, e.g. ['backend/auth/authentication', 'setup']"),
|
|
78
|
-
file_paths: z.array(z.string()).optional().describe("Specific tracked file paths to refresh (refreshes all tracked files if omitted)"),
|
|
79
|
+
file_paths: z.array(z.string()).optional().describe("Specific tracked file paths to refresh, as absolute paths (refreshes all tracked files if omitted)"),
|
|
79
80
|
});
|
|
80
81
|
export const GetDocMetadataArgsSchema = z.object({
|
|
81
82
|
path: z.string().describe("Path of the documentation entry, e.g. 'backend/auth/authentication'"),
|
|
@@ -2,7 +2,9 @@ import type { TrackedSection } from "../../shared/schemas/doc.schema.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Reads a file and snapshots a section defined by 1-indexed [start, end] line numbers.
|
|
4
4
|
* Extracts top/bottom anchor lines and computes a hash of the section content.
|
|
5
|
-
* The `lines` input is intentionally not persisted — only anchors and
|
|
5
|
+
* The `lines` input is intentionally not persisted — only anchors, sectionHash, and lineCount are stored.
|
|
6
|
+
* `lineCount` is used by findAndHashSection to constrain the bottom anchor search and prevent
|
|
7
|
+
* false matches when the file contains repeated lines.
|
|
6
8
|
*/
|
|
7
9
|
export declare function snapshotSection(absolutePath: string, start: number, end: number): TrackedSection;
|
|
8
10
|
type FindResult = {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import crypto from "crypto";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
const ANCHOR_SIZE = 3;
|
|
4
|
+
// Tolerance (in lines) around the expected bottom anchor position when lineCount is known.
|
|
5
|
+
const BOTTOM_ANCHOR_TOLERANCE = 10;
|
|
4
6
|
/**
|
|
5
7
|
* Reads a file and snapshots a section defined by 1-indexed [start, end] line numbers.
|
|
6
8
|
* Extracts top/bottom anchor lines and computes a hash of the section content.
|
|
7
|
-
* The `lines` input is intentionally not persisted — only anchors and
|
|
9
|
+
* The `lines` input is intentionally not persisted — only anchors, sectionHash, and lineCount are stored.
|
|
10
|
+
* `lineCount` is used by findAndHashSection to constrain the bottom anchor search and prevent
|
|
11
|
+
* false matches when the file contains repeated lines.
|
|
8
12
|
*/
|
|
9
13
|
export function snapshotSection(absolutePath, start, end) {
|
|
10
14
|
const fileContent = fs.readFileSync(absolutePath, "utf-8");
|
|
@@ -24,7 +28,7 @@ export function snapshotSection(absolutePath, start, end) {
|
|
|
24
28
|
bottom = sectionLines.slice(sectionLines.length - ANCHOR_SIZE);
|
|
25
29
|
}
|
|
26
30
|
const sectionHash = crypto.createHash("sha256").update(sectionLines.join("\n")).digest("hex");
|
|
27
|
-
return { anchors: { top, bottom }, sectionHash };
|
|
31
|
+
return { anchors: { top, bottom }, sectionHash, lineCount: sectionLines.length };
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* Locates a tracked section in the current file content using its stored anchors,
|
|
@@ -50,12 +54,23 @@ export function findAndHashSection(absolutePath, section) {
|
|
|
50
54
|
}
|
|
51
55
|
return { found: false };
|
|
52
56
|
}
|
|
53
|
-
// Normal path: locate top anchor, then search for bottom anchor below it
|
|
57
|
+
// Normal path: locate top anchor, then search for bottom anchor below it.
|
|
58
|
+
// If lineCount is stored, constrain the search window to prevent false matches on repeated lines.
|
|
54
59
|
for (let i = 0; i <= fileLines.length - top.length; i++) {
|
|
55
60
|
if (!top.every((line, j) => fileLines[i + j] === line))
|
|
56
61
|
continue;
|
|
57
62
|
const searchStart = i + top.length;
|
|
58
|
-
|
|
63
|
+
// Constrain bottom anchor search when lineCount is known
|
|
64
|
+
const expectedBottomStart = section.lineCount !== undefined
|
|
65
|
+
? i + section.lineCount - bottom.length
|
|
66
|
+
: undefined;
|
|
67
|
+
const kMin = expectedBottomStart !== undefined
|
|
68
|
+
? Math.max(searchStart, expectedBottomStart - BOTTOM_ANCHOR_TOLERANCE)
|
|
69
|
+
: searchStart;
|
|
70
|
+
const kMax = expectedBottomStart !== undefined
|
|
71
|
+
? Math.min(fileLines.length - bottom.length, expectedBottomStart + BOTTOM_ANCHOR_TOLERANCE)
|
|
72
|
+
: fileLines.length - bottom.length;
|
|
73
|
+
for (let k = kMin; k <= kMax; k++) {
|
|
59
74
|
if (!bottom.every((line, j) => fileLines[k + j] === line))
|
|
60
75
|
continue;
|
|
61
76
|
const sectionLines = fileLines.slice(i, k + bottom.length);
|
|
@@ -87,12 +102,21 @@ export function relocateAndRefreshSection(absolutePath, section) {
|
|
|
87
102
|
if (!top.every((line, j) => fileLines[i + j] === line))
|
|
88
103
|
continue;
|
|
89
104
|
const searchStart = i + top.length;
|
|
90
|
-
|
|
105
|
+
const expectedBottomStart = section.lineCount !== undefined
|
|
106
|
+
? i + section.lineCount - bottom.length
|
|
107
|
+
: undefined;
|
|
108
|
+
const kMin = expectedBottomStart !== undefined
|
|
109
|
+
? Math.max(searchStart, expectedBottomStart - BOTTOM_ANCHOR_TOLERANCE)
|
|
110
|
+
: searchStart;
|
|
111
|
+
const kMax = expectedBottomStart !== undefined
|
|
112
|
+
? Math.min(fileLines.length - bottom.length, expectedBottomStart + BOTTOM_ANCHOR_TOLERANCE)
|
|
113
|
+
: fileLines.length - bottom.length;
|
|
114
|
+
for (let k = kMin; k <= kMax; k++) {
|
|
91
115
|
if (!bottom.every((line, j) => fileLines[k + j] === line))
|
|
92
116
|
continue;
|
|
93
117
|
const sectionLines = fileLines.slice(i, k + bottom.length);
|
|
94
118
|
const sectionHash = crypto.createHash("sha256").update(sectionLines.join("\n")).digest("hex");
|
|
95
|
-
return { found: true, refreshed: { anchors: section.anchors, sectionHash } };
|
|
119
|
+
return { found: true, refreshed: { anchors: section.anchors, sectionHash, lineCount: sectionLines.length } };
|
|
96
120
|
}
|
|
97
121
|
}
|
|
98
122
|
return { found: false };
|
package/dist/src/gui-worker.js
CHANGED
|
@@ -356,6 +356,16 @@ app.post("/api/search", async (c) => {
|
|
|
356
356
|
return c.json({ error: result.error }, 500);
|
|
357
357
|
return c.json(result.data);
|
|
358
358
|
});
|
|
359
|
+
app.get("/api/file-section/*", async (c) => {
|
|
360
|
+
const docId = c.req.query("docId");
|
|
361
|
+
if (!docId)
|
|
362
|
+
return c.json({ error: "docId query param required" }, 400);
|
|
363
|
+
const filePath = decodeURIComponent(c.req.path.slice("/api/file-section/".length));
|
|
364
|
+
const result = await ipcRequest("GET_FILE_SECTION", { docId, filePath }, 8000);
|
|
365
|
+
if (result.error)
|
|
366
|
+
return c.json({ error: result.error }, 400);
|
|
367
|
+
return c.json(result.data);
|
|
368
|
+
});
|
|
359
369
|
// Export bundles
|
|
360
370
|
app.get("/api/export-bundles", (c) => {
|
|
361
371
|
const bundlesPath = path.join(dataDir, "export-bundles.json");
|
|
@@ -390,6 +400,7 @@ app.get("/api/export-zip/:id", async (c) => {
|
|
|
390
400
|
}
|
|
391
401
|
}
|
|
392
402
|
catch { /* use default */ }
|
|
403
|
+
const flat = c.req.query('flat') === '1';
|
|
393
404
|
const zip = new JSZip();
|
|
394
405
|
for (const ref of bundle.docs) {
|
|
395
406
|
let project;
|
|
@@ -416,7 +427,8 @@ app.get("/api/export-zip/:id", async (c) => {
|
|
|
416
427
|
content = `# [Read error: ${ref}]\n`;
|
|
417
428
|
}
|
|
418
429
|
}
|
|
419
|
-
|
|
430
|
+
const zipPath = flat ? `${docId.split('/').pop()}.md` : `${project}/${docId}.md`;
|
|
431
|
+
zip.file(zipPath, content);
|
|
420
432
|
}
|
|
421
433
|
const zipBuffer = await zip.generateAsync({ type: "nodebuffer" });
|
|
422
434
|
return new Response(new Uint8Array(zipBuffer), {
|
package/dist/src/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { listDocs } from "./tools/list-docs.js";
|
|
|
17
17
|
import { updateDoc } from "./tools/update-doc.js";
|
|
18
18
|
import { searchDocs } from "./tools/search-docs.js";
|
|
19
19
|
import { checkFreshness, computeFreshness } from "./tools/check-freshness.js";
|
|
20
|
+
import { findAndHashSection } from "./core/section-tracker.js";
|
|
20
21
|
import { setProject } from "./tools/set-project.js";
|
|
21
22
|
import { listProjects } from "./tools/list-projects.js";
|
|
22
23
|
import { refreshFileSnapshot } from "./tools/refresh-file-snapshot.js";
|
|
@@ -137,6 +138,9 @@ function handleIPCMessage(msg) {
|
|
|
137
138
|
else if (msg.type === "UPDATE_DOC") {
|
|
138
139
|
handleUpdateDocIPC(msg);
|
|
139
140
|
}
|
|
141
|
+
else if (msg.type === "GET_FILE_SECTION") {
|
|
142
|
+
handleGetFileSection(msg);
|
|
143
|
+
}
|
|
140
144
|
else {
|
|
141
145
|
logger.debug(`Unhandled message from GUI: ${msg.type}`);
|
|
142
146
|
}
|
|
@@ -383,6 +387,44 @@ async function handleUpdateDocIPC(msg) {
|
|
|
383
387
|
});
|
|
384
388
|
}
|
|
385
389
|
}
|
|
390
|
+
async function handleGetFileSection(msg) {
|
|
391
|
+
try {
|
|
392
|
+
const { docId, filePath } = msg.data;
|
|
393
|
+
const resolved = await storageEngine.resolveDoc(docId);
|
|
394
|
+
if (!resolved)
|
|
395
|
+
throw new Error("Doc not found");
|
|
396
|
+
const trackedFile = resolved.doc.tracked_files.find((f) => f.path === filePath);
|
|
397
|
+
if (!trackedFile || !trackedFile.sections?.length)
|
|
398
|
+
throw new Error("No sections for this file");
|
|
399
|
+
const absolutePath = path.resolve(process.cwd(), filePath);
|
|
400
|
+
const fileLines = fs.readFileSync(absolutePath, "utf-8").split("\n");
|
|
401
|
+
const sections = trackedFile.sections.map((section) => {
|
|
402
|
+
const result = findAndHashSection(absolutePath, section);
|
|
403
|
+
if (!result.found)
|
|
404
|
+
return null;
|
|
405
|
+
const { start, end } = result.lines;
|
|
406
|
+
return {
|
|
407
|
+
start,
|
|
408
|
+
end,
|
|
409
|
+
code: fileLines.slice(start - 1, end).join("\n"),
|
|
410
|
+
};
|
|
411
|
+
}).filter(Boolean);
|
|
412
|
+
broadcastToGUI({
|
|
413
|
+
type: "GET_FILE_SECTION_RESPONSE",
|
|
414
|
+
correlationId: msg.correlationId,
|
|
415
|
+
data: { sections, filePath },
|
|
416
|
+
timestamp: new Date().toISOString(),
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
catch (err) {
|
|
420
|
+
broadcastToGUI({
|
|
421
|
+
type: "GET_FILE_SECTION_RESPONSE",
|
|
422
|
+
correlationId: msg.correlationId,
|
|
423
|
+
error: err.message,
|
|
424
|
+
timestamp: new Date().toISOString(),
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
386
428
|
async function handleCheckFreshness(msg) {
|
|
387
429
|
try {
|
|
388
430
|
const resolved = await storageEngine.resolveDoc(msg.data.id ?? msg.data.path);
|
|
@@ -26,7 +26,7 @@ export async function getDocMetadata(storageEngine, args) {
|
|
|
26
26
|
if (doc.tracked_files.length > 0) {
|
|
27
27
|
text += `\nTracked files (${doc.tracked_files.length} total):\n`;
|
|
28
28
|
text += doc.tracked_files.map((f) => {
|
|
29
|
-
let entry = ` ${fileStatusIcon(f.path)} — ${f.path}\n
|
|
29
|
+
let entry = ` ${fileStatusIcon(f.path)} — ${f.path}\n File mtime: ${f.lastModifiedAt}`;
|
|
30
30
|
if (f.sections && f.sections.length > 0) {
|
|
31
31
|
const sectionLines = f.sections.map((section, idx) => {
|
|
32
32
|
const result = findAndHashSection(f.path, section);
|
|
@@ -17,8 +17,12 @@ export async function refreshFileSnapshot(storageEngine, historyStore, args) {
|
|
|
17
17
|
const missing = [];
|
|
18
18
|
const skipped = [];
|
|
19
19
|
const anchorsLost = [];
|
|
20
|
+
// Normalize to forward slashes and lowercase for case-insensitive comparison on Windows
|
|
21
|
+
// (e.g. stored 'c:\...' vs provided 'C:\...'). file_paths must be absolute paths.
|
|
22
|
+
const norm = (p) => p.replace(/\\/g, "/").toLowerCase();
|
|
23
|
+
const resolvedFilePaths = validated.file_paths?.map(norm);
|
|
20
24
|
for (const tracked of doc.tracked_files) {
|
|
21
|
-
if (
|
|
25
|
+
if (resolvedFilePaths && !resolvedFilePaths.includes(norm(tracked.path))) {
|
|
22
26
|
skipped.push(tracked.path);
|
|
23
27
|
continue;
|
|
24
28
|
}
|
|
@@ -2,9 +2,9 @@ import { SearchDocsArgsSchema } from "../../shared/schemas/doc.schema.js";
|
|
|
2
2
|
export async function searchDocs(storageEngine, embeddingEngine, args) {
|
|
3
3
|
try {
|
|
4
4
|
const validated = SearchDocsArgsSchema.parse(args);
|
|
5
|
-
const
|
|
6
|
-
const results = await embeddingEngine.
|
|
7
|
-
const doc = await storageEngine.getDoc(
|
|
5
|
+
const config = storageEngine.getConfig();
|
|
6
|
+
const results = await embeddingEngine.searchAcrossProjects(validated.query, config.projects, validated.top_k, async (project, docPath) => {
|
|
7
|
+
const doc = await storageEngine.getDoc(docPath, project);
|
|
8
8
|
if (!doc)
|
|
9
9
|
return null;
|
|
10
10
|
return { title: doc.title, content: doc.content };
|
|
@@ -13,7 +13,8 @@ export async function searchDocs(storageEngine, embeddingEngine, args) {
|
|
|
13
13
|
return { content: [{ type: "text", text: "No matching documentation entries found." }] };
|
|
14
14
|
}
|
|
15
15
|
const lines = results.map((r, i) => {
|
|
16
|
-
|
|
16
|
+
const projectTag = r.project ? ` _(project: ${r.project})_` : "";
|
|
17
|
+
return `${i + 1}. **${r.title}** [${r.id}]${projectTag} — score: ${(r.score * 100).toFixed(1)}%\n ${r.excerpt}...`;
|
|
17
18
|
});
|
|
18
19
|
return {
|
|
19
20
|
content: [{ type: "text", text: `Search results for "${validated.query}":\n\n${lines.join("\n\n")}` }],
|
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.44";
|
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.44';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aY as L,bu as ln,aH as A,aW as P,aG as W,bv as gn,bw as dn,bx as hn,by as z,bz as pn,bp as An,bA as m,aZ as N,b2 as B,b5 as T,bB as _n,b0 as on,bC as wn,bs as On,aI as V,bq as vn,bD as R}from"./index-
|
|
1
|
+
import{aY as L,bu as ln,aH as A,aW as P,aG as W,bv as gn,bw as dn,bx as hn,by as z,bz as pn,bp as An,bA as m,aZ as N,b2 as B,b5 as T,bB as _n,b0 as on,bC as wn,bs as On,aI as V,bq as vn,bD as R}from"./index-CaPQpXd3.js";var Pn="[object Symbol]";function x(n){return typeof n=="symbol"||L(n)&&ln(n)==Pn}function bn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e<i;)f[e]=r(n[e],e,n);return f}var U=P?P.prototype:void 0,H=U?U.toString:void 0;function k(n){if(typeof n=="string")return n;if(A(n))return bn(n,k)+"";if(x(n))return H?H.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function yn(){}function En(n,r){for(var e=-1,i=n==null?0:n.length;++e<i&&r(n[e],e,n)!==!1;);return n}function cn(n,r,e,i){for(var f=n.length,t=e+-1;++t<f;)if(r(n[t],t,n))return t;return-1}function Tn(n){return n!==n}function In(n,r,e){for(var i=e-1,f=n.length;++i<f;)if(n[i]===r)return i;return-1}function Rn(n,r,e){return r===r?In(n,r,e):cn(n,Tn,e)}function Sn(n,r){var e=n==null?0:n.length;return!!e&&Rn(n,r,0)>-1}function M(n){return W(n)?gn(n):dn(n)}var Ln=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function C(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Ln.test(n)||r!=null&&n in Object(r)}var Mn=500;function Cn(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var $n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dn=/\\(\\)?/g,Gn=Cn(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace($n,function(e,i,f,t){r.push(f?t.replace(Dn,"$1"):i||e)}),r});function Fn(n){return n==null?"":k(n)}function j(n,r){return A(n)?n:C(n,r)?[n]:Gn(Fn(n))}function I(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=j(r,n);for(var e=0,i=r.length;n!=null&&e<i;)n=n[I(r[e++])];return e&&e==i?n:void 0}function mn(n,r,e){var i=n==null?void 0:nn(n,r);return i===void 0?e:i}function rn(n,r){for(var e=-1,i=r.length,f=n.length;++e<i;)n[f+e]=r[e];return n}var K=P?P.isConcatSpreadable:void 0;function Nn(n){return A(n)||z(n)||!!(K&&n&&n[K])}function Kr(n,r,e,i,f){var t=-1,s=n.length;for(e||(e=Nn),f||(f=[]);++t<s;){var u=n[t];e(u)?rn(f,u):i||(f[f.length]=u)}return f}function Bn(n,r,e,i){var f=-1,t=n==null?0:n.length;for(i&&t&&(e=n[++f]);++f<t;)e=r(e,n[f],f,n);return e}function en(n,r){for(var e=-1,i=n==null?0:n.length,f=0,t=[];++e<i;){var s=n[e];r(s,e,n)&&(t[f++]=s)}return t}function Un(){return[]}var Hn=Object.prototype,Kn=Hn.propertyIsEnumerable,q=Object.getOwnPropertySymbols,qn=q?function(n){return n==null?[]:(n=Object(n),en(q(n),function(r){return Kn.call(n,r)}))}:Un;function Zn(n,r,e){var i=r(n);return A(n)?i:rn(i,e(n))}function Z(n){return Zn(n,M,qn)}var Yn="__lodash_hash_undefined__";function Xn(n){return this.__data__.set(n,Yn),this}function Jn(n){return this.__data__.has(n)}function b(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new pn;++r<e;)this.add(n[r])}b.prototype.add=b.prototype.push=Xn;b.prototype.has=Jn;function Qn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i;)if(r(n[e],e,n))return!0;return!1}function tn(n,r){return n.has(r)}var Wn=1,zn=2;function fn(n,r,e,i,f,t){var s=e&Wn,u=n.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&zn?new b:void 0;for(t.set(n,r),t.set(r,n);++l<u;){var p=n[l],_=r[l];if(i)var w=s?i(_,p,l,r,n,t):i(p,_,l,n,r,t);if(w!==void 0){if(w)continue;d=!1;break}if(o){if(!Qn(r,function(O,v){if(!tn(o,v)&&(p===O||f(p,O,e,i,t)))return o.push(v)})){d=!1;break}}else if(!(p===_||f(p,_,e,i,t))){d=!1;break}}return t.delete(n),t.delete(r),d}function Vn(n){var r=-1,e=Array(n.size);return n.forEach(function(i,f){e[++r]=[f,i]}),e}function $(n){var r=-1,e=Array(n.size);return n.forEach(function(i){e[++r]=i}),e}var kn=1,jn=2,nr="[object Boolean]",rr="[object Date]",er="[object Error]",ir="[object Map]",tr="[object Number]",fr="[object RegExp]",sr="[object Set]",ur="[object String]",ar="[object Symbol]",lr="[object ArrayBuffer]",gr="[object DataView]",Y=P?P.prototype:void 0,S=Y?Y.valueOf:void 0;function dr(n,r,e,i,f,t,s){switch(e){case gr:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case lr:return!(n.byteLength!=r.byteLength||!t(new m(n),new m(r)));case nr:case rr:case tr:return An(+n,+r);case er:return n.name==r.name&&n.message==r.message;case fr:case ur:return n==r+"";case ir:var u=Vn;case sr:var a=i&kn;if(u||(u=$),n.size!=r.size&&!a)return!1;var h=s.get(n);if(h)return h==r;i|=jn,s.set(n,r);var g=fn(u(n),u(r),i,f,t,s);return s.delete(n),g;case ar:if(S)return S.call(n)==S.call(r)}return!1}var hr=1,pr=Object.prototype,Ar=pr.hasOwnProperty;function _r(n,r,e,i,f,t){var s=e&hr,u=Z(n),a=u.length,h=Z(r),g=h.length;if(a!=g&&!s)return!1;for(var l=a;l--;){var d=u[l];if(!(s?d in r:Ar.call(r,d)))return!1}var o=t.get(n),p=t.get(r);if(o&&p)return o==r&&p==n;var _=!0;t.set(n,r),t.set(r,n);for(var w=s;++l<a;){d=u[l];var O=n[d],v=r[d];if(i)var F=s?i(v,O,d,r,n,t):i(O,v,d,n,r,t);if(!(F===void 0?O===v||f(O,v,e,i,t):F)){_=!1;break}w||(w=d=="constructor")}if(_&&!w){var y=n.constructor,E=r.constructor;y!=E&&"constructor"in n&&"constructor"in r&&!(typeof y=="function"&&y instanceof y&&typeof E=="function"&&E instanceof E)&&(_=!1)}return t.delete(n),t.delete(r),_}var or=1,X="[object Arguments]",J="[object Array]",c="[object Object]",wr=Object.prototype,Q=wr.hasOwnProperty;function Or(n,r,e,i,f,t){var s=A(n),u=A(r),a=s?J:N(n),h=u?J:N(r);a=a==X?c:a,h=h==X?c:h;var g=a==c,l=h==c,d=a==h;if(d&&B(n)){if(!B(r))return!1;s=!0,g=!1}if(d&&!g)return t||(t=new T),s||_n(n)?fn(n,r,e,i,f,t):dr(n,r,a,e,i,f,t);if(!(e&or)){var o=g&&Q.call(n,"__wrapped__"),p=l&&Q.call(r,"__wrapped__");if(o||p){var _=o?n.value():n,w=p?r.value():r;return t||(t=new T),f(_,w,e,i,t)}}return d?(t||(t=new T),_r(n,r,e,i,f,t)):!1}function D(n,r,e,i,f){return n===r?!0:n==null||r==null||!L(n)&&!L(r)?n!==n&&r!==r:Or(n,r,e,i,D,f)}var vr=1,Pr=2;function br(n,r,e,i){var f=e.length,t=f;if(n==null)return!t;for(n=Object(n);f--;){var s=e[f];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++f<t;){s=e[f];var u=s[0],a=n[u],h=s[1];if(s[2]){if(a===void 0&&!(u in n))return!1}else{var g=new T,l;if(!(l===void 0?D(h,a,vr|Pr,i,g):l))return!1}}return!0}function sn(n){return n===n&&!on(n)}function yr(n){for(var r=M(n),e=r.length;e--;){var i=r[e],f=n[i];r[e]=[i,f,sn(f)]}return r}function un(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function Er(n){var r=yr(n);return r.length==1&&r[0][2]?un(r[0][0],r[0][1]):function(e){return e===n||br(e,n,r)}}function cr(n,r){return n!=null&&r in Object(n)}function Tr(n,r,e){r=j(r,n);for(var i=-1,f=r.length,t=!1;++i<f;){var s=I(r[i]);if(!(t=n!=null&&e(n,s)))break;n=n[s]}return t||++i!=f?t:(f=n==null?0:n.length,!!f&&wn(f)&&On(s,f)&&(A(n)||z(n)))}function Ir(n,r){return n!=null&&Tr(n,r,cr)}var Rr=1,Sr=2;function Lr(n,r){return C(n)&&sn(r)?un(I(n),r):function(e){var i=mn(e,n);return i===void 0&&i===r?Ir(e,n):D(r,i,Rr|Sr)}}function xr(n){return function(r){return r?.[n]}}function Mr(n){return function(r){return nn(r,n)}}function Cr(n){return C(n)?xr(I(n)):Mr(n)}function an(n){return typeof n=="function"?n:n==null?V:typeof n=="object"?A(n)?Lr(n[0],n[1]):Er(n):Cr(n)}function $r(n,r){return n&&vn(n,r,M)}function Dr(n,r){return function(e,i){if(e==null)return e;if(!W(e))return n(e,i);for(var f=e.length,t=-1,s=Object(e);++t<f&&i(s[t],t,s)!==!1;);return e}}var G=Dr($r);function Gr(n){return typeof n=="function"?n:V}function qr(n,r){var e=A(n)?En:G;return e(n,Gr(r))}function Fr(n,r){var e=[];return G(n,function(i,f,t){r(i,f,t)&&e.push(i)}),e}function Zr(n,r){var e=A(n)?en:Fr;return e(n,an(r))}function mr(n,r,e,i,f){return f(n,function(t,s,u){e=i?(i=!1,t):r(e,t,s,u)}),e}function Yr(n,r,e){var i=A(n)?Bn:mr,f=arguments.length<3;return i(n,an(r),e,f,G)}var Nr=1/0,Br=R&&1/$(new R([,-0]))[1]==Nr?function(n){return new R(n)}:yn,Ur=200;function Xr(n,r,e){var i=-1,f=Sn,t=n.length,s=!0,u=[],a=u;if(t>=Ur){var h=r?null:Br(n);if(h)return $(h);s=!1,f=tn,a=new b}else a=r?[]:u;n:for(;++i<t;){var g=n[i],l=r?r(g):g;if(g=g!==0?g:0,s&&l===l){for(var d=a.length;d--;)if(a[d]===l)continue n;r&&a.push(l),u.push(g)}else f(a,l,e)||(a!==u&&a.push(l),u.push(g))}return u}export{G as a,Kr as b,an as c,bn as d,rn as e,Zn as f,qn as g,En as h,x as i,Z as j,M as k,Xr as l,Zr as m,qr as n,cn as o,Gr as p,$r as q,Yr as r,Un as s,Tr as t,j as u,I as v,nn as w,Ir as x,Fn as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-
|
|
1
|
+
import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-CaPQpXd3.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[H(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|