bluera-knowledge 0.13.2 → 0.13.3
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/{chunk-6ZVW2P2F.js → chunk-AJI5DCKY.js} +67 -50
- package/dist/{chunk-6ZVW2P2F.js.map → chunk-AJI5DCKY.js.map} +1 -1
- package/dist/{chunk-GCUKVV33.js → chunk-AOSDVRRH.js} +2 -2
- package/dist/{chunk-H5AKKHY7.js → chunk-XL2UHMBL.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/mcp/server.js +2 -2
- package/dist/workers/background-worker-cli.js +2 -2
- package/package.json +1 -1
- package/src/crawl/bridge.test.ts +1 -1
- package/src/crawl/bridge.ts +25 -2
- /package/dist/{chunk-GCUKVV33.js.map → chunk-AOSDVRRH.js.map} +0 -0
- /package/dist/{chunk-H5AKKHY7.js.map → chunk-XL2UHMBL.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.13.3](https://github.com/blueraai/bluera-knowledge/compare/v0.13.2...v0.13.3) (2026-01-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **crawl:** use absolute path for Python worker in PythonBridge ([f9a45cd](https://github.com/blueraai/bluera-knowledge/commit/f9a45cdcdcee3be1090843fcb17ed3251b5c5a4a))
|
|
11
|
+
|
|
5
12
|
## [0.13.2](https://github.com/blueraai/bluera-knowledge/compare/v0.13.1...v0.13.2) (2026-01-16)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -558,10 +558,10 @@ var ASTParser = class {
|
|
|
558
558
|
});
|
|
559
559
|
const nodes = [];
|
|
560
560
|
traverse(ast, {
|
|
561
|
-
FunctionDeclaration: (
|
|
562
|
-
const node =
|
|
561
|
+
FunctionDeclaration: (path4) => {
|
|
562
|
+
const node = path4.node;
|
|
563
563
|
if (!node.id) return;
|
|
564
|
-
const exported =
|
|
564
|
+
const exported = path4.parent.type === "ExportNamedDeclaration" || path4.parent.type === "ExportDefaultDeclaration";
|
|
565
565
|
nodes.push({
|
|
566
566
|
type: "function",
|
|
567
567
|
name: node.id.name,
|
|
@@ -572,10 +572,10 @@ var ASTParser = class {
|
|
|
572
572
|
signature: this.extractFunctionSignature(node)
|
|
573
573
|
});
|
|
574
574
|
},
|
|
575
|
-
ClassDeclaration: (
|
|
576
|
-
const node =
|
|
575
|
+
ClassDeclaration: (path4) => {
|
|
576
|
+
const node = path4.node;
|
|
577
577
|
if (!node.id) return;
|
|
578
|
-
const exported =
|
|
578
|
+
const exported = path4.parent.type === "ExportNamedDeclaration" || path4.parent.type === "ExportDefaultDeclaration";
|
|
579
579
|
const methods = [];
|
|
580
580
|
for (const member of node.body.body) {
|
|
581
581
|
if (t.isClassMethod(member) && t.isIdentifier(member.key)) {
|
|
@@ -597,9 +597,9 @@ var ASTParser = class {
|
|
|
597
597
|
methods
|
|
598
598
|
});
|
|
599
599
|
},
|
|
600
|
-
TSInterfaceDeclaration: (
|
|
601
|
-
const node =
|
|
602
|
-
const exported =
|
|
600
|
+
TSInterfaceDeclaration: (path4) => {
|
|
601
|
+
const node = path4.node;
|
|
602
|
+
const exported = path4.parent.type === "ExportNamedDeclaration";
|
|
603
603
|
nodes.push({
|
|
604
604
|
type: "interface",
|
|
605
605
|
name: node.id.name,
|
|
@@ -622,8 +622,8 @@ var ASTParser = class {
|
|
|
622
622
|
});
|
|
623
623
|
const imports = [];
|
|
624
624
|
traverse(ast, {
|
|
625
|
-
ImportDeclaration: (
|
|
626
|
-
const node =
|
|
625
|
+
ImportDeclaration: (path4) => {
|
|
626
|
+
const node = path4.node;
|
|
627
627
|
const specifiers = [];
|
|
628
628
|
for (const spec of node.specifiers) {
|
|
629
629
|
if (t.isImportDefaultSpecifier(spec)) {
|
|
@@ -976,10 +976,10 @@ var GoASTParser = class {
|
|
|
976
976
|
continue;
|
|
977
977
|
}
|
|
978
978
|
const stringContent = pathNode.descendantsOfType("interpreted_string_literal_content")[0];
|
|
979
|
-
const
|
|
980
|
-
if (
|
|
979
|
+
const path4 = stringContent !== void 0 ? stringContent.text : pathNode.text.replace(/"/g, "");
|
|
980
|
+
if (path4 !== "") {
|
|
981
981
|
imports.push({
|
|
982
|
-
source:
|
|
982
|
+
source: path4,
|
|
983
983
|
specifiers: [],
|
|
984
984
|
isType: false
|
|
985
985
|
});
|
|
@@ -1616,25 +1616,25 @@ var RustASTParser = class {
|
|
|
1616
1616
|
* - "super::Type" -> { source: "super", specifiers: ["Type"] }
|
|
1617
1617
|
*/
|
|
1618
1618
|
parseImportPath(importPath) {
|
|
1619
|
-
const
|
|
1620
|
-
if (
|
|
1621
|
-
const source =
|
|
1619
|
+
const path4 = importPath.trim();
|
|
1620
|
+
if (path4.includes("::*")) {
|
|
1621
|
+
const source = path4.replace("::*", "");
|
|
1622
1622
|
return { source, specifiers: ["*"] };
|
|
1623
1623
|
}
|
|
1624
|
-
const scopedMatch =
|
|
1624
|
+
const scopedMatch = path4.match(/^(.+)::\{(.+)\}$/);
|
|
1625
1625
|
if (scopedMatch !== null) {
|
|
1626
1626
|
const source = scopedMatch[1] ?? "";
|
|
1627
1627
|
const specifiersStr = scopedMatch[2] ?? "";
|
|
1628
1628
|
const specifiers = specifiersStr.split(",").map((s) => s.trim());
|
|
1629
1629
|
return { source, specifiers };
|
|
1630
1630
|
}
|
|
1631
|
-
const parts =
|
|
1631
|
+
const parts = path4.split("::");
|
|
1632
1632
|
if (parts.length > 1) {
|
|
1633
1633
|
const specifiers = [parts[parts.length - 1] ?? ""];
|
|
1634
1634
|
const source = parts.slice(0, -1).join("::");
|
|
1635
1635
|
return { source, specifiers };
|
|
1636
1636
|
}
|
|
1637
|
-
return { source: "", specifiers: [
|
|
1637
|
+
return { source: "", specifiers: [path4] };
|
|
1638
1638
|
}
|
|
1639
1639
|
};
|
|
1640
1640
|
|
|
@@ -1957,20 +1957,20 @@ var ProjectRootService = class {
|
|
|
1957
1957
|
/**
|
|
1958
1958
|
* Normalize path by resolving symlinks and normalizing separators
|
|
1959
1959
|
*/
|
|
1960
|
-
static normalize(
|
|
1960
|
+
static normalize(path4) {
|
|
1961
1961
|
try {
|
|
1962
|
-
const realPath = realpathSync(
|
|
1962
|
+
const realPath = realpathSync(path4);
|
|
1963
1963
|
return normalize(realPath);
|
|
1964
1964
|
} catch {
|
|
1965
|
-
return normalize(
|
|
1965
|
+
return normalize(path4);
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Validate that a path exists and is a directory
|
|
1970
1970
|
*/
|
|
1971
|
-
static validate(
|
|
1971
|
+
static validate(path4) {
|
|
1972
1972
|
try {
|
|
1973
|
-
const stats = statSync(
|
|
1973
|
+
const stats = statSync(path4);
|
|
1974
1974
|
return stats.isDirectory();
|
|
1975
1975
|
} catch {
|
|
1976
1976
|
return false;
|
|
@@ -2015,9 +2015,9 @@ var DEFAULT_CONFIG = {
|
|
|
2015
2015
|
};
|
|
2016
2016
|
|
|
2017
2017
|
// src/services/config.service.ts
|
|
2018
|
-
async function fileExists(
|
|
2018
|
+
async function fileExists(path4) {
|
|
2019
2019
|
try {
|
|
2020
|
-
await access(
|
|
2020
|
+
await access(path4);
|
|
2021
2021
|
return true;
|
|
2022
2022
|
} catch {
|
|
2023
2023
|
return false;
|
|
@@ -2064,14 +2064,14 @@ var ConfigService = class {
|
|
|
2064
2064
|
resolveDataDir() {
|
|
2065
2065
|
return this.dataDir;
|
|
2066
2066
|
}
|
|
2067
|
-
expandPath(
|
|
2068
|
-
if (
|
|
2069
|
-
return
|
|
2067
|
+
expandPath(path4, baseDir) {
|
|
2068
|
+
if (path4.startsWith("~")) {
|
|
2069
|
+
return path4.replace("~", homedir2());
|
|
2070
2070
|
}
|
|
2071
|
-
if (!
|
|
2072
|
-
return resolve(baseDir,
|
|
2071
|
+
if (!path4.startsWith("/")) {
|
|
2072
|
+
return resolve(baseDir, path4);
|
|
2073
2073
|
}
|
|
2074
|
-
return
|
|
2074
|
+
return path4;
|
|
2075
2075
|
}
|
|
2076
2076
|
};
|
|
2077
2077
|
|
|
@@ -3445,9 +3445,9 @@ var SearchService = class {
|
|
|
3445
3445
|
* This helps queries like "dispatcher" rank async_dispatcher.py higher.
|
|
3446
3446
|
*/
|
|
3447
3447
|
getPathKeywordBoost(query, result) {
|
|
3448
|
-
const
|
|
3449
|
-
if (
|
|
3450
|
-
const pathSegments =
|
|
3448
|
+
const path4 = result.metadata.path;
|
|
3449
|
+
if (path4 === void 0 || path4 === "") return 1;
|
|
3450
|
+
const pathSegments = path4.toLowerCase().replace(/[^a-z0-9]+/g, " ");
|
|
3451
3451
|
const stopWords = /* @__PURE__ */ new Set([
|
|
3452
3452
|
"how",
|
|
3453
3453
|
"to",
|
|
@@ -3489,9 +3489,9 @@ var SearchService = class {
|
|
|
3489
3489
|
* If query mentions a framework, boost results from that framework's files.
|
|
3490
3490
|
*/
|
|
3491
3491
|
getFrameworkContextBoost(query, result) {
|
|
3492
|
-
const
|
|
3492
|
+
const path4 = result.metadata.path ?? result.metadata.url ?? "";
|
|
3493
3493
|
const content = result.content.toLowerCase();
|
|
3494
|
-
const pathLower =
|
|
3494
|
+
const pathLower = path4.toLowerCase();
|
|
3495
3495
|
for (const { pattern, terms } of FRAMEWORK_PATTERNS) {
|
|
3496
3496
|
if (pattern.test(query)) {
|
|
3497
3497
|
const resultMatchesFramework = terms.some(
|
|
@@ -3508,7 +3508,7 @@ var SearchService = class {
|
|
|
3508
3508
|
}
|
|
3509
3509
|
addProgressiveContext(result, query, detail, graph) {
|
|
3510
3510
|
const enhanced = { ...result };
|
|
3511
|
-
const
|
|
3511
|
+
const path4 = result.metadata.path ?? result.metadata.url ?? "unknown";
|
|
3512
3512
|
const fileType = result.metadata["fileType"];
|
|
3513
3513
|
const codeUnit = this.extractCodeUnitFromResult(result);
|
|
3514
3514
|
const symbolName = codeUnit?.name ?? this.extractSymbolName(result.content);
|
|
@@ -3517,11 +3517,11 @@ var SearchService = class {
|
|
|
3517
3517
|
name: symbolName,
|
|
3518
3518
|
signature: codeUnit?.signature ?? "",
|
|
3519
3519
|
purpose: this.generatePurpose(result.content, query),
|
|
3520
|
-
location: `${
|
|
3520
|
+
location: `${path4}${codeUnit ? `:${String(codeUnit.startLine)}` : ""}`,
|
|
3521
3521
|
relevanceReason: this.generateRelevanceReason(result, query)
|
|
3522
3522
|
};
|
|
3523
3523
|
if (detail === "contextual" || detail === "full") {
|
|
3524
|
-
const usage = this.getUsageFromGraph(graph,
|
|
3524
|
+
const usage = this.getUsageFromGraph(graph, path4, symbolName);
|
|
3525
3525
|
enhanced.context = {
|
|
3526
3526
|
interfaces: this.extractInterfaces(result.content),
|
|
3527
3527
|
keyImports: this.extractImports(result.content),
|
|
@@ -3530,7 +3530,7 @@ var SearchService = class {
|
|
|
3530
3530
|
};
|
|
3531
3531
|
}
|
|
3532
3532
|
if (detail === "full") {
|
|
3533
|
-
const relatedCode = this.getRelatedCodeFromGraph(graph,
|
|
3533
|
+
const relatedCode = this.getRelatedCodeFromGraph(graph, path4, symbolName);
|
|
3534
3534
|
enhanced.full = {
|
|
3535
3535
|
completeCode: codeUnit?.fullContent ?? result.content,
|
|
3536
3536
|
relatedCode,
|
|
@@ -3541,9 +3541,9 @@ var SearchService = class {
|
|
|
3541
3541
|
return enhanced;
|
|
3542
3542
|
}
|
|
3543
3543
|
extractCodeUnitFromResult(result) {
|
|
3544
|
-
const
|
|
3545
|
-
if (
|
|
3546
|
-
const ext =
|
|
3544
|
+
const path4 = result.metadata.path;
|
|
3545
|
+
if (path4 === void 0 || path4 === "") return void 0;
|
|
3546
|
+
const ext = path4.split(".").pop() ?? "";
|
|
3547
3547
|
const language = ext === "ts" || ext === "tsx" ? "typescript" : ext === "js" || ext === "jsx" ? "javascript" : ext;
|
|
3548
3548
|
const symbolName = this.extractSymbolName(result.content);
|
|
3549
3549
|
if (symbolName === "") return void 0;
|
|
@@ -3824,9 +3824,9 @@ function extractRepoName(url) {
|
|
|
3824
3824
|
}
|
|
3825
3825
|
|
|
3826
3826
|
// src/services/store.service.ts
|
|
3827
|
-
async function fileExists2(
|
|
3827
|
+
async function fileExists2(path4) {
|
|
3828
3828
|
try {
|
|
3829
|
-
await access2(
|
|
3829
|
+
await access2(path4);
|
|
3830
3830
|
return true;
|
|
3831
3831
|
} catch {
|
|
3832
3832
|
return false;
|
|
@@ -4086,7 +4086,9 @@ var StoreService = class {
|
|
|
4086
4086
|
// src/crawl/bridge.ts
|
|
4087
4087
|
import { spawn as spawn2 } from "child_process";
|
|
4088
4088
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
4089
|
+
import path3 from "path";
|
|
4089
4090
|
import { createInterface } from "readline";
|
|
4091
|
+
import { fileURLToPath } from "url";
|
|
4090
4092
|
import { ZodError } from "zod";
|
|
4091
4093
|
|
|
4092
4094
|
// src/crawl/schemas.ts
|
|
@@ -4166,8 +4168,23 @@ var PythonBridge = class {
|
|
|
4166
4168
|
stderrReadline = null;
|
|
4167
4169
|
start() {
|
|
4168
4170
|
if (this.process) return Promise.resolve();
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
+
const currentFilePath = fileURLToPath(import.meta.url);
|
|
4172
|
+
const isProduction = currentFilePath.includes("/dist/");
|
|
4173
|
+
let pythonWorkerPath;
|
|
4174
|
+
if (isProduction) {
|
|
4175
|
+
const distIndex = currentFilePath.indexOf("/dist/");
|
|
4176
|
+
const pluginRoot = currentFilePath.substring(0, distIndex);
|
|
4177
|
+
pythonWorkerPath = path3.join(pluginRoot, "python", "crawl_worker.py");
|
|
4178
|
+
} else {
|
|
4179
|
+
const srcDir = path3.dirname(path3.dirname(currentFilePath));
|
|
4180
|
+
const projectRoot = path3.dirname(srcDir);
|
|
4181
|
+
pythonWorkerPath = path3.join(projectRoot, "python", "crawl_worker.py");
|
|
4182
|
+
}
|
|
4183
|
+
logger3.debug(
|
|
4184
|
+
{ pythonWorkerPath, currentFilePath, isProduction },
|
|
4185
|
+
"Starting Python bridge process"
|
|
4186
|
+
);
|
|
4187
|
+
this.process = spawn2("python3", [pythonWorkerPath], {
|
|
4171
4188
|
stdio: ["pipe", "pipe", "pipe"]
|
|
4172
4189
|
});
|
|
4173
4190
|
this.process.on("error", (err2) => {
|
|
@@ -4679,4 +4696,4 @@ export {
|
|
|
4679
4696
|
createServices,
|
|
4680
4697
|
destroyServices
|
|
4681
4698
|
};
|
|
4682
|
-
//# sourceMappingURL=chunk-
|
|
4699
|
+
//# sourceMappingURL=chunk-AJI5DCKY.js.map
|