@chiway/contextweaver 1.0.0 → 1.1.0
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/SearchService-MYPOCM3B.js +886 -0
- package/dist/chunk-6QMYML5V.js +1760 -0
- package/dist/{chunk-B6OWNBOD.js → chunk-6Z4JEEVJ.js} +32 -22
- package/dist/{chunk-EZG4H4MN.js → chunk-7G5V7YT5.js} +4 -4
- package/dist/{chunk-2CY5SYBI.js → chunk-NQR4CGQ6.js} +6 -4
- package/dist/{codebaseRetrieval-IC44RHCL.js → codebaseRetrieval-NLAMGOA2.js} +3 -3
- package/dist/index.js +5 -5
- package/dist/scanner-RFG4YWYI.js +11 -0
- package/dist/{server-PPQUHCUB.js → server-27HI7WZO.js} +3 -3
- package/package.json +5 -3
- package/dist/SearchService-533KL2HP.js +0 -1654
- package/dist/chunk-HR5KUQSM.js +0 -906
- package/dist/scanner-SZ2BDYDS.js +0 -11
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isDebugEnabled,
|
|
2
3
|
logger
|
|
3
4
|
} from "./chunk-AMQQK4P7.js";
|
|
4
5
|
|
|
@@ -156,17 +157,19 @@ function searchChunksFts(db, query, limit) {
|
|
|
156
157
|
"Chunk FTS \u5BBD\u5BB9\u641C\u7D22\u8865\u5F55"
|
|
157
158
|
);
|
|
158
159
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
160
|
+
if (isDebugEnabled()) {
|
|
161
|
+
logger.debug(
|
|
162
|
+
{
|
|
163
|
+
chunkCount: results.length,
|
|
164
|
+
topChunks: results.slice(0, 5).map((r) => ({
|
|
165
|
+
path: r.filePath.split("/").slice(-2).join("/"),
|
|
166
|
+
chunkIndex: r.chunkIndex,
|
|
167
|
+
bm25: r.score.toFixed(3)
|
|
168
|
+
}))
|
|
169
|
+
},
|
|
170
|
+
"Chunk FTS \u53EC\u56DE\u7ED3\u679C"
|
|
171
|
+
);
|
|
172
|
+
}
|
|
170
173
|
return results.sort((a, b) => b.score - a.score);
|
|
171
174
|
}
|
|
172
175
|
function batchUpsertFileFts(db, files) {
|
|
@@ -316,16 +319,18 @@ function searchFilesFts(db, query, limit) {
|
|
|
316
319
|
"FTS \u5BBD\u5BB9\u641C\u7D22\u8865\u5F55"
|
|
317
320
|
);
|
|
318
321
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
322
|
+
if (isDebugEnabled()) {
|
|
323
|
+
logger.debug(
|
|
324
|
+
{
|
|
325
|
+
fileCount: results.length,
|
|
326
|
+
topFiles: results.slice(0, 5).map((r) => ({
|
|
327
|
+
path: r.path.split("/").slice(-2).join("/"),
|
|
328
|
+
bm25: r.score.toFixed(3)
|
|
329
|
+
}))
|
|
330
|
+
},
|
|
331
|
+
"FTS \u53EC\u56DE\u7ED3\u679C"
|
|
332
|
+
);
|
|
333
|
+
}
|
|
329
334
|
return results.sort((a, b) => b.score - a.score);
|
|
330
335
|
}
|
|
331
336
|
function isFtsInitialized(db) {
|
|
@@ -402,6 +407,9 @@ function initDb(projectId) {
|
|
|
402
407
|
`);
|
|
403
408
|
initFilesFts(db);
|
|
404
409
|
initChunksFts(db);
|
|
410
|
+
db.pragma("synchronous = NORMAL");
|
|
411
|
+
db.pragma("temp_store = MEMORY");
|
|
412
|
+
db.pragma("cache_size = -64000");
|
|
405
413
|
return db;
|
|
406
414
|
}
|
|
407
415
|
function closeDb(db) {
|
|
@@ -496,6 +504,8 @@ function batchDelete(db, paths) {
|
|
|
496
504
|
}
|
|
497
505
|
function clear(db) {
|
|
498
506
|
db.exec("DELETE FROM files");
|
|
507
|
+
db.exec("DELETE FROM files_fts");
|
|
508
|
+
db.exec("DELETE FROM chunks_fts");
|
|
499
509
|
}
|
|
500
510
|
var METADATA_KEY_EMBEDDING_DIMENSIONS = "embedding_dimensions";
|
|
501
511
|
function getMetadata(db, key) {
|
|
@@ -542,4 +552,4 @@ export {
|
|
|
542
552
|
getStoredEmbeddingDimensions,
|
|
543
553
|
setStoredEmbeddingDimensions
|
|
544
554
|
};
|
|
545
|
-
//# sourceMappingURL=chunk-
|
|
555
|
+
//# sourceMappingURL=chunk-6Z4JEEVJ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateProjectId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6Z4JEEVJ.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
6
|
} from "./chunk-AMQQK4P7.js";
|
|
@@ -60,7 +60,7 @@ function isProjectIndexed(projectId) {
|
|
|
60
60
|
}
|
|
61
61
|
async function ensureIndexed(repoPath, projectId, onProgress) {
|
|
62
62
|
const { withLock } = await import("./lock-DVY3KJSK.js");
|
|
63
|
-
const { scan } = await import("./scanner-
|
|
63
|
+
const { scan } = await import("./scanner-RFG4YWYI.js");
|
|
64
64
|
await withLock(
|
|
65
65
|
projectId,
|
|
66
66
|
"index",
|
|
@@ -124,7 +124,7 @@ async function handleCodebaseRetrieval(args, onProgress) {
|
|
|
124
124
|
},
|
|
125
125
|
"MCP \u67E5\u8BE2\u6784\u5EFA"
|
|
126
126
|
);
|
|
127
|
-
const { SearchService } = await import("./SearchService-
|
|
127
|
+
const { SearchService } = await import("./SearchService-MYPOCM3B.js");
|
|
128
128
|
const service = new SearchService(projectId, repo_path);
|
|
129
129
|
await service.init();
|
|
130
130
|
logger.debug("SearchService \u521D\u59CB\u5316\u5B8C\u6210");
|
|
@@ -283,4 +283,4 @@ export {
|
|
|
283
283
|
codebaseRetrievalSchema,
|
|
284
284
|
handleCodebaseRetrieval
|
|
285
285
|
};
|
|
286
|
-
//# sourceMappingURL=chunk-
|
|
286
|
+
//# sourceMappingURL=chunk-7G5V7YT5.js.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
closeAllIndexers,
|
|
3
3
|
closeAllVectorStores,
|
|
4
|
-
getIndexer
|
|
5
|
-
|
|
4
|
+
getIndexer,
|
|
5
|
+
invalidateAllExpanderCaches
|
|
6
|
+
} from "./chunk-6QMYML5V.js";
|
|
6
7
|
import {
|
|
7
8
|
batchDelete,
|
|
8
9
|
batchUpdateMtime,
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
getStoredEmbeddingDimensions,
|
|
17
18
|
initDb,
|
|
18
19
|
setStoredEmbeddingDimensions
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-6Z4JEEVJ.js";
|
|
20
21
|
import {
|
|
21
22
|
logger
|
|
22
23
|
} from "./chunk-AMQQK4P7.js";
|
|
@@ -1350,6 +1351,7 @@ async function scan(rootPath, options = {}) {
|
|
|
1350
1351
|
}
|
|
1351
1352
|
}
|
|
1352
1353
|
options.onProgress?.(100, 100, "\u7D22\u5F15\u5B8C\u6210");
|
|
1354
|
+
invalidateAllExpanderCaches();
|
|
1353
1355
|
return stats;
|
|
1354
1356
|
} finally {
|
|
1355
1357
|
closeDb(db);
|
|
@@ -1361,4 +1363,4 @@ async function scan(rootPath, options = {}) {
|
|
|
1361
1363
|
export {
|
|
1362
1364
|
scan
|
|
1363
1365
|
};
|
|
1364
|
-
//# sourceMappingURL=chunk-
|
|
1366
|
+
//# sourceMappingURL=chunk-NQR4CGQ6.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
codebaseRetrievalSchema,
|
|
3
3
|
handleCodebaseRetrieval
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-7G5V7YT5.js";
|
|
5
|
+
import "./chunk-6Z4JEEVJ.js";
|
|
6
6
|
import "./chunk-AMQQK4P7.js";
|
|
7
7
|
import "./chunk-RJURH22T.js";
|
|
8
8
|
export {
|
|
9
9
|
codebaseRetrievalSchema,
|
|
10
10
|
handleCodebaseRetrieval
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=codebaseRetrieval-
|
|
12
|
+
//# sourceMappingURL=codebaseRetrieval-NLAMGOA2.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
scan
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-NQR4CGQ6.js";
|
|
5
|
+
import "./chunk-6QMYML5V.js";
|
|
6
6
|
import {
|
|
7
7
|
generateProjectId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6Z4JEEVJ.js";
|
|
9
9
|
import {
|
|
10
10
|
logger
|
|
11
11
|
} from "./chunk-AMQQK4P7.js";
|
|
@@ -120,7 +120,7 @@ cli.command("index [path]", "\u626B\u63CF\u4EE3\u7801\u5E93\u5E76\u5EFA\u7ACB\u7
|
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
cli.command("mcp", "\u542F\u52A8 MCP \u670D\u52A1\u5668").action(async () => {
|
|
123
|
-
const { startMcpServer } = await import("./server-
|
|
123
|
+
const { startMcpServer } = await import("./server-27HI7WZO.js");
|
|
124
124
|
try {
|
|
125
125
|
await startMcpServer();
|
|
126
126
|
} catch (err) {
|
|
@@ -141,7 +141,7 @@ cli.command("search", "\u672C\u5730\u68C0\u7D22\uFF08\u53C2\u6570\u5BF9\u9F50 MC
|
|
|
141
141
|
process.exit(1);
|
|
142
142
|
}
|
|
143
143
|
const technicalTerms = (options.technicalTerms || "").split(",").map((t) => t.trim()).filter(Boolean);
|
|
144
|
-
const { handleCodebaseRetrieval } = await import("./codebaseRetrieval-
|
|
144
|
+
const { handleCodebaseRetrieval } = await import("./codebaseRetrieval-NLAMGOA2.js");
|
|
145
145
|
const response = await handleCodebaseRetrieval({
|
|
146
146
|
repo_path: repoPath,
|
|
147
147
|
information_request: informationRequest,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
codebaseRetrievalSchema,
|
|
3
3
|
handleCodebaseRetrieval
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-7G5V7YT5.js";
|
|
5
|
+
import "./chunk-6Z4JEEVJ.js";
|
|
6
6
|
import {
|
|
7
7
|
logger
|
|
8
8
|
} from "./chunk-AMQQK4P7.js";
|
|
@@ -144,4 +144,4 @@ async function startMcpServer() {
|
|
|
144
144
|
export {
|
|
145
145
|
startMcpServer
|
|
146
146
|
};
|
|
147
|
-
//# sourceMappingURL=server-
|
|
147
|
+
//# sourceMappingURL=server-27HI7WZO.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chiway/contextweaver",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A context weaving tool for LLMs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "hsingjui",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"build": "tsup src/index.ts src/mcp/main.ts --format esm --dts --out-dir dist --sourcemap --clean",
|
|
27
27
|
"build:release": "tsup src/index.ts src/mcp/main.ts --format esm --dts --out-dir dist --clean",
|
|
28
28
|
"dev": "tsup src/index.ts src/mcp/main.ts --format esm --dts --out-dir dist --sourcemap --watch",
|
|
29
|
-
"fmt": "biome check --write ./src"
|
|
29
|
+
"fmt": "biome check --write ./src",
|
|
30
|
+
"test": "vitest run"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@keqingmoe/tree-sitter": "^0.26.2",
|
|
@@ -58,7 +59,8 @@
|
|
|
58
59
|
"@types/node": "^24.0.0",
|
|
59
60
|
"knip": "^5.78.0",
|
|
60
61
|
"tsup": "^8.5.1",
|
|
61
|
-
"typescript": "^5.9.3"
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"vitest": "^4.1.0"
|
|
62
64
|
},
|
|
63
65
|
"pnpm": {
|
|
64
66
|
"onlyBuiltDependencies": [
|