bluera-knowledge 0.27.3 → 0.28.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/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
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.28.0](https://github.com/blueraai/bluera-knowledge/compare/v0.27.3...v0.28.0) (2026-02-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * **hooks:** add PostToolUse hook for WebFetch library research detection ([3a6f183](https://github.com/blueraai/bluera-knowledge/commit/3a6f1833bb0d970d364c250335f790b4a86beea9))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **gitignore:** add semantic equivalence, dedup, and managed section markers ([a07d6fe](https://github.com/blueraai/bluera-knowledge/commit/a07d6fe2bdf5214f8deee86b1c888eb318356809))
16
+ * **plugin:** remove redundant hooks manifest entry ([6fa1e6f](https://github.com/blueraai/bluera-knowledge/commit/6fa1e6f1401464db2d2bd8d2929524b73bdc6a4b))
17
+
18
+ ## [0.27.4](https://github.com/blueraai/bluera-knowledge/compare/v0.27.3...v0.27.4) (2026-02-10)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **gitignore:** add semantic equivalence, dedup, and managed section markers ([a07d6fe](https://github.com/blueraai/bluera-knowledge/commit/a07d6fe2bdf5214f8deee86b1c888eb318356809))
24
+ * **plugin:** remove redundant hooks manifest entry ([6fa1e6f](https://github.com/blueraai/bluera-knowledge/commit/6fa1e6f1401464db2d2bd8d2929524b73bdc6a4b))
25
+
5
26
  ## [0.27.3](https://github.com/blueraai/bluera-knowledge/compare/v0.27.2...v0.27.3) (2026-02-07)
6
27
 
7
28
  ## [0.27.2](https://github.com/blueraai/bluera-knowledge/compare/v0.27.1...v0.27.2) (2026-02-05)
@@ -2,7 +2,7 @@ import {
2
2
  createLogger,
3
3
  summarizePayload,
4
4
  truncateForLog
5
- } from "./chunk-GB5WKUBX.js";
5
+ } from "./chunk-WP2GERAJ.js";
6
6
 
7
7
  // src/crawl/intelligent-crawler.ts
8
8
  import { EventEmitter } from "events";
@@ -916,4 +916,4 @@ export {
916
916
  getCrawlStrategy,
917
917
  IntelligentCrawler
918
918
  };
919
- //# sourceMappingURL=chunk-S3DJUNUG.js.map
919
+ //# sourceMappingURL=chunk-BYLIDCWD.js.map
@@ -9,7 +9,7 @@ import {
9
9
  isRepoStoreDefinition,
10
10
  isWebStoreDefinition,
11
11
  summarizePayload
12
- } from "./chunk-GB5WKUBX.js";
12
+ } from "./chunk-WP2GERAJ.js";
13
13
  import {
14
14
  checkStoreModelCompatibility
15
15
  } from "./chunk-H25AEF47.js";
@@ -2402,4 +2402,4 @@ export {
2402
2402
  createMCPServer,
2403
2403
  runMCPServer
2404
2404
  };
2405
- //# sourceMappingURL=chunk-LBE2PTSB.js.map
2405
+ //# sourceMappingURL=chunk-UXT3BCAH.js.map
@@ -2207,20 +2207,17 @@ var ConfigService = class {
2207
2207
  import { readFile as readFile3, writeFile as writeFile3, access as access2 } from "fs/promises";
2208
2208
  import { join as join6 } from "path";
2209
2209
  var REQUIRED_PATTERNS = [
2210
- ".bluera/",
2211
- "!.bluera/",
2210
+ ".bluera/*",
2212
2211
  "!.bluera/bluera-knowledge/",
2212
+ ".bluera/bluera-knowledge/*",
2213
2213
  "!.bluera/bluera-knowledge/stores.config.json",
2214
2214
  "!.bluera/bluera-knowledge/config.json",
2215
2215
  "!.bluera/bluera-knowledge/skill-activation.json",
2216
2216
  ".bluera/bluera-knowledge/data/",
2217
2217
  ".bluera/bluera-knowledge/logs/"
2218
2218
  ];
2219
- var SECTION_HEADER = `
2220
- # Bluera Knowledge
2221
- # Config files (stores.config.json, config.json, skill-activation.json) can be committed
2222
- # Data directory (vector DB, cloned repos) and logs are not committed
2223
- `;
2219
+ var SECTION_BEGIN = "# BEGIN Bluera Knowledge";
2220
+ var SECTION_END = "# END Bluera Knowledge";
2224
2221
  async function fileExists2(path4) {
2225
2222
  try {
2226
2223
  await access2(path4);
@@ -2229,13 +2226,73 @@ async function fileExists2(path4) {
2229
2226
  return false;
2230
2227
  }
2231
2228
  }
2229
+ function isPatternSatisfied(requiredPattern, existingLines) {
2230
+ if (existingLines.includes(requiredPattern)) {
2231
+ return true;
2232
+ }
2233
+ switch (requiredPattern) {
2234
+ case ".bluera/*":
2235
+ return existingLines.includes(".bluera/");
2236
+ case "!.bluera/bluera-knowledge/":
2237
+ return existingLines.includes("!.bluera/bluera-knowledge");
2238
+ case ".bluera/bluera-knowledge/data/":
2239
+ case ".bluera/bluera-knowledge/logs/":
2240
+ return existingLines.includes(".bluera/bluera-knowledge/*");
2241
+ default:
2242
+ return false;
2243
+ }
2244
+ }
2245
+ function removeBkSection(content) {
2246
+ const lines = content.split("\n");
2247
+ const outputLines = [];
2248
+ let removed = false;
2249
+ let i = 0;
2250
+ while (i < lines.length) {
2251
+ const line = lines[i] ?? "";
2252
+ const trimmed = line.trim();
2253
+ if (trimmed === SECTION_BEGIN) {
2254
+ removed = true;
2255
+ i++;
2256
+ while (i < lines.length && (lines[i] ?? "").trim() !== SECTION_END) {
2257
+ i++;
2258
+ }
2259
+ if (i < lines.length) {
2260
+ i++;
2261
+ }
2262
+ continue;
2263
+ }
2264
+ if (trimmed === "# Bluera Knowledge") {
2265
+ removed = true;
2266
+ i++;
2267
+ while (i < lines.length) {
2268
+ const lt = (lines[i] ?? "").trim();
2269
+ if (lt === "" || lt.startsWith("#") || lt.includes(".bluera")) {
2270
+ i++;
2271
+ } else {
2272
+ break;
2273
+ }
2274
+ }
2275
+ continue;
2276
+ }
2277
+ outputLines.push(line);
2278
+ i++;
2279
+ }
2280
+ let lastIdx = outputLines.length - 1;
2281
+ while (lastIdx >= 0 && outputLines[lastIdx]?.trim() === "") {
2282
+ outputLines.pop();
2283
+ lastIdx--;
2284
+ }
2285
+ const cleaned = outputLines.length > 0 ? `${outputLines.join("\n")}
2286
+ ` : "";
2287
+ return { cleaned, removed };
2288
+ }
2232
2289
  var GitignoreService = class {
2233
2290
  gitignorePath;
2234
2291
  constructor(projectRoot) {
2235
2292
  this.gitignorePath = join6(projectRoot, ".gitignore");
2236
2293
  }
2237
2294
  /**
2238
- * Check if all required patterns are present in .gitignore
2295
+ * Check if all required patterns are semantically present in .gitignore
2239
2296
  */
2240
2297
  async hasRequiredPatterns() {
2241
2298
  const exists = await fileExists2(this.gitignorePath);
@@ -2244,50 +2301,62 @@ var GitignoreService = class {
2244
2301
  }
2245
2302
  const content = await readFile3(this.gitignorePath, "utf-8");
2246
2303
  const lines = content.split("\n").map((l) => l.trim());
2247
- for (const pattern of REQUIRED_PATTERNS) {
2248
- if (!lines.includes(pattern)) {
2249
- return false;
2250
- }
2251
- }
2252
- return true;
2304
+ return REQUIRED_PATTERNS.every((pattern) => isPatternSatisfied(pattern, lines));
2253
2305
  }
2254
2306
  /**
2255
2307
  * Ensure required .gitignore patterns are present.
2256
2308
  *
2257
2309
  * - Creates .gitignore if it doesn't exist
2258
- * - Appends missing patterns if .gitignore exists
2259
- * - Does nothing if all patterns are already present
2310
+ * - Removes existing managed sections (old or new format)
2311
+ * - Appends only semantically missing patterns with BEGIN/END markers
2312
+ * - Persists cleanup even when no patterns are missing
2260
2313
  *
2261
2314
  * @returns Object with updated flag and descriptive message
2262
2315
  */
2263
2316
  async ensureGitignorePatterns() {
2264
2317
  const exists = await fileExists2(this.gitignorePath);
2265
2318
  if (!exists) {
2266
- const content = `${SECTION_HEADER.trim()}
2267
- ${REQUIRED_PATTERNS.join("\n")}
2268
- `;
2319
+ const content = [SECTION_BEGIN, ...REQUIRED_PATTERNS, SECTION_END, ""].join("\n");
2269
2320
  await writeFile3(this.gitignorePath, content);
2270
2321
  return {
2271
2322
  updated: true,
2272
2323
  message: "Created .gitignore with Bluera Knowledge patterns"
2273
2324
  };
2274
2325
  }
2275
- const existingContent = await readFile3(this.gitignorePath, "utf-8");
2276
- const lines = existingContent.split("\n").map((l) => l.trim());
2277
- const missingPatterns = REQUIRED_PATTERNS.filter((pattern) => !lines.includes(pattern));
2326
+ let rawContent = await readFile3(this.gitignorePath, "utf-8");
2327
+ rawContent = rawContent.replace(/\r\n/g, "\n");
2328
+ const { cleaned, removed } = removeBkSection(rawContent);
2329
+ const cleanedLines = cleaned.split("\n").map((l) => l.trim());
2330
+ const missingPatterns = REQUIRED_PATTERNS.filter(
2331
+ (pattern) => !isPatternSatisfied(pattern, cleanedLines)
2332
+ );
2278
2333
  if (missingPatterns.length === 0) {
2334
+ if (removed) {
2335
+ await writeFile3(this.gitignorePath, cleaned);
2336
+ return {
2337
+ updated: true,
2338
+ message: "Cleaned redundant Bluera Knowledge section from .gitignore"
2339
+ };
2340
+ }
2279
2341
  return {
2280
2342
  updated: false,
2281
2343
  message: "All Bluera Knowledge patterns already present in .gitignore"
2282
2344
  };
2283
2345
  }
2284
- let newContent = existingContent;
2285
- if (!newContent.endsWith("\n")) {
2346
+ let newContent = cleaned;
2347
+ if (newContent.length > 0) {
2348
+ if (!newContent.endsWith("\n")) {
2349
+ newContent += "\n";
2350
+ }
2286
2351
  newContent += "\n";
2287
2352
  }
2288
- newContent += SECTION_HEADER;
2289
- newContent += `${missingPatterns.join("\n")}
2290
- `;
2353
+ newContent += [SECTION_BEGIN, ...missingPatterns, SECTION_END, ""].join("\n");
2354
+ if (newContent === rawContent) {
2355
+ return {
2356
+ updated: false,
2357
+ message: "All Bluera Knowledge patterns already present in .gitignore"
2358
+ };
2359
+ }
2291
2360
  await writeFile3(this.gitignorePath, newContent);
2292
2361
  return {
2293
2362
  updated: true,
@@ -6625,4 +6694,4 @@ export {
6625
6694
  createServices,
6626
6695
  destroyServices
6627
6696
  };
6628
- //# sourceMappingURL=chunk-GB5WKUBX.js.map
6697
+ //# sourceMappingURL=chunk-WP2GERAJ.js.map