bluera-knowledge 0.17.1 → 0.17.2
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/CHANGELOG.md +8 -0
- package/dist/{chunk-RAXRD23K.js → chunk-PFHK5Q22.js} +2 -2
- package/dist/{chunk-VKTVMW45.js → chunk-WMALVLFW.js} +95 -93
- package/dist/chunk-WMALVLFW.js.map +1 -0
- package/dist/{chunk-ZGEQCLOZ.js → chunk-YMDXPECI.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/dist/chunk-VKTVMW45.js.map +0 -1
- /package/dist/{chunk-RAXRD23K.js.map → chunk-PFHK5Q22.js.map} +0 -0
- /package/dist/{chunk-ZGEQCLOZ.js.map → chunk-YMDXPECI.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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.17.2](https://github.com/blueraai/bluera-knowledge/compare/v0.17.0...v0.17.2) (2026-01-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **config:** use per-repo paths instead of global directories ([d642fec](https://github.com/blueraai/bluera-knowledge/commit/d642fec3510ef546dd5dc94f91410a38e8aea0e4))
|
|
11
|
+
* **logging:** use per-repo log directory instead of global ([d30000d](https://github.com/blueraai/bluera-knowledge/commit/d30000dd01bb1e8ac810a6fc086543c1368e5449))
|
|
12
|
+
|
|
5
13
|
## [0.17.1](https://github.com/blueraai/bluera-knowledge/compare/v0.17.0...v0.17.1) (2026-01-18)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createLogger,
|
|
4
4
|
summarizePayload,
|
|
5
5
|
truncateForLog
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WMALVLFW.js";
|
|
7
7
|
|
|
8
8
|
// src/crawl/intelligent-crawler.ts
|
|
9
9
|
import { EventEmitter } from "events";
|
|
@@ -833,4 +833,4 @@ export {
|
|
|
833
833
|
getCrawlStrategy,
|
|
834
834
|
IntelligentCrawler
|
|
835
835
|
};
|
|
836
|
-
//# sourceMappingURL=chunk-
|
|
836
|
+
//# sourceMappingURL=chunk-PFHK5Q22.js.map
|
|
@@ -109,18 +109,94 @@ var AdapterRegistry = class _AdapterRegistry {
|
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
// src/logging/logger.ts
|
|
112
|
-
import { mkdirSync, existsSync } from "fs";
|
|
113
|
-
import {
|
|
114
|
-
import { join } from "path";
|
|
112
|
+
import { mkdirSync, existsSync as existsSync2 } from "fs";
|
|
113
|
+
import { join as join2 } from "path";
|
|
115
114
|
import pino from "pino";
|
|
115
|
+
|
|
116
|
+
// src/services/project-root.service.ts
|
|
117
|
+
import { existsSync, statSync, realpathSync } from "fs";
|
|
118
|
+
import { dirname, join, normalize, sep } from "path";
|
|
119
|
+
var ProjectRootService = class {
|
|
120
|
+
/**
|
|
121
|
+
* Resolve project root directory using hierarchical detection.
|
|
122
|
+
*/
|
|
123
|
+
static resolve(options) {
|
|
124
|
+
if (options?.projectRoot !== void 0 && options.projectRoot !== "") {
|
|
125
|
+
return this.normalize(options.projectRoot);
|
|
126
|
+
}
|
|
127
|
+
const projectRootEnv = process.env["PROJECT_ROOT"];
|
|
128
|
+
if (projectRootEnv !== void 0 && projectRootEnv !== "") {
|
|
129
|
+
return this.normalize(projectRootEnv);
|
|
130
|
+
}
|
|
131
|
+
const pwdEnv = process.env["PWD"];
|
|
132
|
+
if (pwdEnv !== void 0 && pwdEnv !== "") {
|
|
133
|
+
return this.normalize(pwdEnv);
|
|
134
|
+
}
|
|
135
|
+
const gitRoot = this.findGitRoot(process.cwd());
|
|
136
|
+
if (gitRoot !== null) {
|
|
137
|
+
return gitRoot;
|
|
138
|
+
}
|
|
139
|
+
return process.cwd();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Find git repository root by walking up the directory tree looking for .git
|
|
143
|
+
*/
|
|
144
|
+
static findGitRoot(startPath) {
|
|
145
|
+
let currentPath = normalize(startPath);
|
|
146
|
+
const root = normalize(sep);
|
|
147
|
+
while (currentPath !== root) {
|
|
148
|
+
const gitPath = join(currentPath, ".git");
|
|
149
|
+
if (existsSync(gitPath)) {
|
|
150
|
+
try {
|
|
151
|
+
const stats = statSync(gitPath);
|
|
152
|
+
if (stats.isDirectory() || stats.isFile()) {
|
|
153
|
+
return currentPath;
|
|
154
|
+
}
|
|
155
|
+
} catch {
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const parentPath = dirname(currentPath);
|
|
159
|
+
if (parentPath === currentPath) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
currentPath = parentPath;
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Normalize path by resolving symlinks and normalizing separators
|
|
168
|
+
*/
|
|
169
|
+
static normalize(path4) {
|
|
170
|
+
try {
|
|
171
|
+
const realPath = realpathSync(path4);
|
|
172
|
+
return normalize(realPath);
|
|
173
|
+
} catch {
|
|
174
|
+
return normalize(path4);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Validate that a path exists and is a directory
|
|
179
|
+
*/
|
|
180
|
+
static validate(path4) {
|
|
181
|
+
try {
|
|
182
|
+
const stats = statSync(path4);
|
|
183
|
+
return stats.isDirectory();
|
|
184
|
+
} catch {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// src/logging/logger.ts
|
|
116
191
|
var VALID_LEVELS = ["trace", "debug", "info", "warn", "error", "fatal"];
|
|
117
192
|
var VALID_LEVELS_SET = new Set(VALID_LEVELS);
|
|
118
193
|
function getLogDir() {
|
|
119
|
-
|
|
194
|
+
const projectRoot = ProjectRootService.resolve();
|
|
195
|
+
return join2(projectRoot, ".bluera", "bluera-knowledge", "logs");
|
|
120
196
|
}
|
|
121
197
|
function ensureLogDir() {
|
|
122
198
|
const logDir = getLogDir();
|
|
123
|
-
if (!
|
|
199
|
+
if (!existsSync2(logDir)) {
|
|
124
200
|
mkdirSync(logDir, { recursive: true });
|
|
125
201
|
}
|
|
126
202
|
return logDir;
|
|
@@ -144,7 +220,7 @@ function initializeLogger() {
|
|
|
144
220
|
return rootLogger;
|
|
145
221
|
}
|
|
146
222
|
const logDir = ensureLogDir();
|
|
147
|
-
const logFile =
|
|
223
|
+
const logFile = join2(logDir, "app.log");
|
|
148
224
|
const level = getLogLevel();
|
|
149
225
|
const options = {
|
|
150
226
|
level,
|
|
@@ -196,13 +272,13 @@ function shutdownLogger() {
|
|
|
196
272
|
|
|
197
273
|
// src/logging/payload.ts
|
|
198
274
|
import { createHash } from "crypto";
|
|
199
|
-
import { writeFileSync, mkdirSync as mkdirSync2, existsSync as
|
|
200
|
-
import { join as
|
|
275
|
+
import { writeFileSync, mkdirSync as mkdirSync2, existsSync as existsSync3 } from "fs";
|
|
276
|
+
import { join as join3 } from "path";
|
|
201
277
|
var MAX_PREVIEW_LENGTH = 500;
|
|
202
278
|
var PAYLOAD_DUMP_THRESHOLD = 1e4;
|
|
203
279
|
function getPayloadDir() {
|
|
204
|
-
const dir =
|
|
205
|
-
if (!
|
|
280
|
+
const dir = join3(getLogDirectory(), "payload");
|
|
281
|
+
if (!existsSync3(dir)) {
|
|
206
282
|
mkdirSync2(dir, { recursive: true });
|
|
207
283
|
}
|
|
208
284
|
return dir;
|
|
@@ -219,7 +295,7 @@ function summarizePayload(content, type, identifier, dumpFull = isLevelEnabled("
|
|
|
219
295
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
220
296
|
const safeId = safeFilename(identifier);
|
|
221
297
|
const filename = `${timestamp}-${type}-${safeId}-${hash}.json`;
|
|
222
|
-
const filepath =
|
|
298
|
+
const filepath = join3(getPayloadDir(), filename);
|
|
223
299
|
writeFileSync(
|
|
224
300
|
filepath,
|
|
225
301
|
JSON.stringify(
|
|
@@ -526,7 +602,7 @@ var JobService = class {
|
|
|
526
602
|
|
|
527
603
|
// src/services/code-graph.service.ts
|
|
528
604
|
import { readFile, writeFile, mkdir, rm } from "fs/promises";
|
|
529
|
-
import { join as
|
|
605
|
+
import { join as join4, dirname as dirname2 } from "path";
|
|
530
606
|
|
|
531
607
|
// src/analysis/ast-parser.ts
|
|
532
608
|
import { parse } from "@babel/parser";
|
|
@@ -1743,7 +1819,7 @@ var CodeGraphService = class {
|
|
|
1743
1819
|
*/
|
|
1744
1820
|
async saveGraph(storeId, graph) {
|
|
1745
1821
|
const graphPath = this.getGraphPath(storeId);
|
|
1746
|
-
await mkdir(
|
|
1822
|
+
await mkdir(dirname2(graphPath), { recursive: true });
|
|
1747
1823
|
const serialized = graph.toJSON();
|
|
1748
1824
|
await writeFile(graphPath, JSON.stringify(serialized, null, 2));
|
|
1749
1825
|
}
|
|
@@ -1856,7 +1932,7 @@ var CodeGraphService = class {
|
|
|
1856
1932
|
this.graphCache.clear();
|
|
1857
1933
|
}
|
|
1858
1934
|
getGraphPath(storeId) {
|
|
1859
|
-
return
|
|
1935
|
+
return join4(this.dataDir, "graphs", `${storeId}.json`);
|
|
1860
1936
|
}
|
|
1861
1937
|
/**
|
|
1862
1938
|
* Type guard for SerializedGraph structure.
|
|
@@ -1901,83 +1977,9 @@ var CodeGraphService = class {
|
|
|
1901
1977
|
|
|
1902
1978
|
// src/services/config.service.ts
|
|
1903
1979
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, access } from "fs/promises";
|
|
1904
|
-
import { homedir
|
|
1980
|
+
import { homedir } from "os";
|
|
1905
1981
|
import { dirname as dirname3, join as join5, resolve } from "path";
|
|
1906
1982
|
|
|
1907
|
-
// src/services/project-root.service.ts
|
|
1908
|
-
import { existsSync as existsSync3, statSync, realpathSync } from "fs";
|
|
1909
|
-
import { dirname as dirname2, join as join4, normalize, sep } from "path";
|
|
1910
|
-
var ProjectRootService = class {
|
|
1911
|
-
/**
|
|
1912
|
-
* Resolve project root directory using hierarchical detection.
|
|
1913
|
-
*/
|
|
1914
|
-
static resolve(options) {
|
|
1915
|
-
if (options?.projectRoot !== void 0 && options.projectRoot !== "") {
|
|
1916
|
-
return this.normalize(options.projectRoot);
|
|
1917
|
-
}
|
|
1918
|
-
const projectRootEnv = process.env["PROJECT_ROOT"];
|
|
1919
|
-
if (projectRootEnv !== void 0 && projectRootEnv !== "") {
|
|
1920
|
-
return this.normalize(projectRootEnv);
|
|
1921
|
-
}
|
|
1922
|
-
const pwdEnv = process.env["PWD"];
|
|
1923
|
-
if (pwdEnv !== void 0 && pwdEnv !== "") {
|
|
1924
|
-
return this.normalize(pwdEnv);
|
|
1925
|
-
}
|
|
1926
|
-
const gitRoot = this.findGitRoot(process.cwd());
|
|
1927
|
-
if (gitRoot !== null) {
|
|
1928
|
-
return gitRoot;
|
|
1929
|
-
}
|
|
1930
|
-
return process.cwd();
|
|
1931
|
-
}
|
|
1932
|
-
/**
|
|
1933
|
-
* Find git repository root by walking up the directory tree looking for .git
|
|
1934
|
-
*/
|
|
1935
|
-
static findGitRoot(startPath) {
|
|
1936
|
-
let currentPath = normalize(startPath);
|
|
1937
|
-
const root = normalize(sep);
|
|
1938
|
-
while (currentPath !== root) {
|
|
1939
|
-
const gitPath = join4(currentPath, ".git");
|
|
1940
|
-
if (existsSync3(gitPath)) {
|
|
1941
|
-
try {
|
|
1942
|
-
const stats = statSync(gitPath);
|
|
1943
|
-
if (stats.isDirectory() || stats.isFile()) {
|
|
1944
|
-
return currentPath;
|
|
1945
|
-
}
|
|
1946
|
-
} catch {
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
const parentPath = dirname2(currentPath);
|
|
1950
|
-
if (parentPath === currentPath) {
|
|
1951
|
-
break;
|
|
1952
|
-
}
|
|
1953
|
-
currentPath = parentPath;
|
|
1954
|
-
}
|
|
1955
|
-
return null;
|
|
1956
|
-
}
|
|
1957
|
-
/**
|
|
1958
|
-
* Normalize path by resolving symlinks and normalizing separators
|
|
1959
|
-
*/
|
|
1960
|
-
static normalize(path4) {
|
|
1961
|
-
try {
|
|
1962
|
-
const realPath = realpathSync(path4);
|
|
1963
|
-
return normalize(realPath);
|
|
1964
|
-
} catch {
|
|
1965
|
-
return normalize(path4);
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
/**
|
|
1969
|
-
* Validate that a path exists and is a directory
|
|
1970
|
-
*/
|
|
1971
|
-
static validate(path4) {
|
|
1972
|
-
try {
|
|
1973
|
-
const stats = statSync(path4);
|
|
1974
|
-
return stats.isDirectory();
|
|
1975
|
-
} catch {
|
|
1976
|
-
return false;
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
};
|
|
1980
|
-
|
|
1981
1983
|
// src/types/config.ts
|
|
1982
1984
|
var DEFAULT_CONFIG = {
|
|
1983
1985
|
version: 1,
|
|
@@ -2074,7 +2076,7 @@ var ConfigService = class {
|
|
|
2074
2076
|
}
|
|
2075
2077
|
expandPath(path4, baseDir) {
|
|
2076
2078
|
if (path4.startsWith("~")) {
|
|
2077
|
-
return path4.replace("~",
|
|
2079
|
+
return path4.replace("~", homedir());
|
|
2078
2080
|
}
|
|
2079
2081
|
if (!path4.startsWith("/")) {
|
|
2080
2082
|
return resolve(baseDir, path4);
|
|
@@ -4734,10 +4736,10 @@ var PythonBridge = class {
|
|
|
4734
4736
|
};
|
|
4735
4737
|
|
|
4736
4738
|
// src/db/embeddings.ts
|
|
4737
|
-
import { homedir as
|
|
4739
|
+
import { homedir as homedir2 } from "os";
|
|
4738
4740
|
import { join as join10 } from "path";
|
|
4739
4741
|
import { pipeline, env } from "@huggingface/transformers";
|
|
4740
|
-
env.cacheDir = join10(
|
|
4742
|
+
env.cacheDir = join10(homedir2(), ".cache", "huggingface-transformers");
|
|
4741
4743
|
var EmbeddingEngine = class {
|
|
4742
4744
|
extractor = null;
|
|
4743
4745
|
modelName;
|
|
@@ -5124,4 +5126,4 @@ export {
|
|
|
5124
5126
|
createServices,
|
|
5125
5127
|
destroyServices
|
|
5126
5128
|
};
|
|
5127
|
-
//# sourceMappingURL=chunk-
|
|
5129
|
+
//# sourceMappingURL=chunk-WMALVLFW.js.map
|