bluera-knowledge 0.35.0 → 0.36.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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +16 -0
- package/README.md +7 -19
- package/dist/index.js +69 -2
- package/dist/index.js.map +1 -1
- package/hooks/hooks.json +17 -1
- package/hooks/stop-bk-check.py +86 -0
- package/hooks/userpromptsubmit-bk-nudge.py +136 -0
- package/package.json +1 -1
- package/scripts/auto-setup.sh +11 -3
- package/skills/knowledge-search/SKILL.md +1 -1
- package/skills/suggest/SKILL.md +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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.36.0](https://github.com/blueraai/bluera-knowledge/compare/v0.34.0...v0.36.0) (2026-03-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **activation:** directive skill description + UserPromptSubmit/Stop hooks for proactive BK usage ([64d48da](https://github.com/blueraai/bluera-knowledge/commit/64d48da2eb8e278fb7a8de0a2676f77bf6adc320))
|
|
11
|
+
* **mcp:** return friendly message when add-repo URL is already indexed ([1ca0a6a](https://github.com/blueraai/bluera-knowledge/commit/1ca0a6aeb9e7646a6d3056dde60b34abd34ba10c))
|
|
12
|
+
* **suggest:** AI-driven dependency importance filtering via Claude CLI ([0984039](https://github.com/blueraai/bluera-knowledge/commit/0984039d9c0bb607969f7db8d92d1e7d47cb08ff))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* force UTF-8 encoding for Python bridge on Windows ([d6a0c9e](https://github.com/blueraai/bluera-knowledge/commit/d6a0c9eb261f65367659672ff4c21873f39505f6))
|
|
18
|
+
* **hooks:** make Python hooks executable, add stdin drain, remove stale files ([219b645](https://github.com/blueraai/bluera-knowledge/commit/219b6459e955764645c8edd0c98ff0be2b9c96b8))
|
|
19
|
+
* **mcp:** expand shell variables in PROJECT_ROOT to prevent literal ${PWD} directories ([2ab025f](https://github.com/blueraai/bluera-knowledge/commit/2ab025f42fb8d063cccc3dacfc47ed87d299d634))
|
|
20
|
+
|
|
5
21
|
## [0.35.0](https://github.com/blueraai/bluera-knowledge/compare/v0.34.0...v0.35.0) (2026-03-21)
|
|
6
22
|
|
|
7
23
|
|
package/README.md
CHANGED
|
@@ -197,7 +197,7 @@ bluera-knowledge store list
|
|
|
197
197
|
### 🎯 Core Features
|
|
198
198
|
|
|
199
199
|
- **🔬 Smart Dependency Analysis** - Automatically scans your project to identify which libraries are most heavily used by counting import statements across all source files
|
|
200
|
-
-
|
|
200
|
+
- **🤖 AI-Powered Importance Filtering** - Uses Claude to select the most valuable dependencies for indexing — prioritizing core frameworks, complex APIs, and libraries likely to cause debugging issues over trivial utilities and dev tools
|
|
201
201
|
- **🔍 Automatic Repository Discovery** - Queries package registries (NPM, PyPI, crates.io, Go modules) to automatically find GitHub repository URLs
|
|
202
202
|
- **📦 Git Repository Indexing** - Clones and indexes dependency source code for both semantic search and direct file access
|
|
203
203
|
- **📁 Local Folder Indexing** - Indexes any local content - documentation, standards, reference materials, or custom content
|
|
@@ -732,27 +732,15 @@ This hybrid approach reduces unnecessary tool calls and context usage while main
|
|
|
732
732
|
|
|
733
733
|
Result: Fewer tool calls, more accurate results, less context consumed.
|
|
734
734
|
|
|
735
|
-
### 🎯
|
|
735
|
+
### 🎯 Proactive Activation
|
|
736
736
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
**Toggle via slash command:**
|
|
740
|
-
- `/bluera-knowledge:skill-activation` - Show current status
|
|
741
|
-
- `/bluera-knowledge:skill-activation on` - Enable (default)
|
|
742
|
-
- `/bluera-knowledge:skill-activation off` - Disable
|
|
743
|
-
- `/bluera-knowledge:skill-activation config` - Toggle individual skills
|
|
737
|
+
BK activates automatically when you work with dependencies — no manual invocation needed.
|
|
744
738
|
|
|
745
739
|
**How it works:**
|
|
746
|
-
|
|
747
|
-
-
|
|
748
|
-
-
|
|
749
|
-
-
|
|
750
|
-
- "Multi-step workflow" → suggests `advanced-workflows`
|
|
751
|
-
- "Add/delete store" → suggests `store-lifecycle`
|
|
752
|
-
|
|
753
|
-
Claude evaluates each suggestion and invokes relevant skills before answering. Users who already use BK terminology are excluded (they already know the tool).
|
|
754
|
-
|
|
755
|
-
**Configuration stored in:** `.bluera/bluera-knowledge/skill-activation.json` (relative to project root)
|
|
740
|
+
- **Directive skill description** tells Claude to ALWAYS use BK for library/dependency questions
|
|
741
|
+
- **UserPromptSubmit hook** injects a BK reminder when your prompt involves dependencies
|
|
742
|
+
- **Stop hook** catches cases where dependency dirs were accessed but BK wasn't consulted
|
|
743
|
+
- **Prescriptive MCP tool descriptions** ensure Claude reaches for BK search before training data
|
|
756
744
|
|
|
757
745
|
---
|
|
758
746
|
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ProjectRootService,
|
|
17
17
|
StoreDefinitionService,
|
|
18
18
|
classifyWebContentType,
|
|
19
|
+
createLogger,
|
|
19
20
|
createServices,
|
|
20
21
|
destroyServices,
|
|
21
22
|
err,
|
|
@@ -421,6 +422,7 @@ function createMCPCommand(getOptions) {
|
|
|
421
422
|
import { Command as Command4 } from "commander";
|
|
422
423
|
|
|
423
424
|
// src/plugin/commands.ts
|
|
425
|
+
import { execSync } from "child_process";
|
|
424
426
|
import ora3 from "ora";
|
|
425
427
|
|
|
426
428
|
// src/analysis/dependency-usage-analyzer.ts
|
|
@@ -894,6 +896,14 @@ var RepoUrlResolver = class {
|
|
|
894
896
|
};
|
|
895
897
|
|
|
896
898
|
// src/plugin/commands.ts
|
|
899
|
+
var logger = createLogger("plugin-commands");
|
|
900
|
+
function extractStringField(obj, key) {
|
|
901
|
+
if (typeof obj !== "object" || obj === null || !(key in obj)) return void 0;
|
|
902
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
903
|
+
if (descriptor === void 0) return void 0;
|
|
904
|
+
const value = descriptor.value;
|
|
905
|
+
return typeof value === "string" ? value : void 0;
|
|
906
|
+
}
|
|
897
907
|
async function handleAddRepo(args, options = {}) {
|
|
898
908
|
const services = await createServices(
|
|
899
909
|
options.config,
|
|
@@ -1001,6 +1011,51 @@ async function handleStores(options = {}) {
|
|
|
1001
1011
|
await destroyServices(services);
|
|
1002
1012
|
}
|
|
1003
1013
|
}
|
|
1014
|
+
function filterImportantDeps(usages) {
|
|
1015
|
+
if (usages.length <= 5) return usages;
|
|
1016
|
+
const depList = usages.map(
|
|
1017
|
+
(u) => `- ${u.packageName}: ${String(u.importCount)} imports in ${String(u.fileCount)} files${u.isDevDependency ? " (dev)" : ""}`
|
|
1018
|
+
).join("\n");
|
|
1019
|
+
const prompt = [
|
|
1020
|
+
"Given this project's dependencies ranked by import frequency:",
|
|
1021
|
+
"",
|
|
1022
|
+
depList,
|
|
1023
|
+
"",
|
|
1024
|
+
"Select the dependencies that would be MOST VALUABLE to have their source code indexed for an AI coding assistant. Focus on:",
|
|
1025
|
+
"- Core frameworks and libraries the project builds on (not dev tools)",
|
|
1026
|
+
"- Libraries with complex APIs where understanding internals helps",
|
|
1027
|
+
"- Libraries likely to cause debugging issues or have non-obvious behavior",
|
|
1028
|
+
"- Skip: test runners, linters, formatters, build tools, @types packages, trivial utilities",
|
|
1029
|
+
"",
|
|
1030
|
+
'Return ONLY a JSON array of package names, e.g.: ["react", "prisma", "zod"]',
|
|
1031
|
+
"Do not explain. Just the JSON array."
|
|
1032
|
+
].join("\n");
|
|
1033
|
+
const output = execSync("claude -p --output-format json --model haiku", {
|
|
1034
|
+
input: prompt,
|
|
1035
|
+
encoding: "utf-8",
|
|
1036
|
+
timeout: 3e4,
|
|
1037
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1038
|
+
});
|
|
1039
|
+
const parsed = JSON.parse(output);
|
|
1040
|
+
const resultText = extractStringField(parsed, "result");
|
|
1041
|
+
if (resultText === void 0) {
|
|
1042
|
+
throw new Error("Unexpected Claude CLI output format");
|
|
1043
|
+
}
|
|
1044
|
+
const jsonMatch = /\[[\s\S]*\]/.exec(resultText);
|
|
1045
|
+
if (jsonMatch === null) {
|
|
1046
|
+
throw new Error("No JSON array found in Claude response");
|
|
1047
|
+
}
|
|
1048
|
+
const selected = JSON.parse(jsonMatch[0]);
|
|
1049
|
+
if (!Array.isArray(selected)) {
|
|
1050
|
+
throw new Error("Claude response is not an array");
|
|
1051
|
+
}
|
|
1052
|
+
const selectedNames = new Set(selected.filter((s) => typeof s === "string"));
|
|
1053
|
+
const filtered = usages.filter((u) => selectedNames.has(u.packageName));
|
|
1054
|
+
if (filtered.length < 2) {
|
|
1055
|
+
throw new Error("Claude returned too few results");
|
|
1056
|
+
}
|
|
1057
|
+
return filtered;
|
|
1058
|
+
}
|
|
1004
1059
|
async function handleSuggest(options = {}) {
|
|
1005
1060
|
const projectRoot = options.projectRoot ?? process.env["PWD"] ?? process.cwd();
|
|
1006
1061
|
console.log("Analyzing project dependencies...\n");
|
|
@@ -1035,8 +1090,20 @@ async function handleSuggest(options = {}) {
|
|
|
1035
1090
|
console.log("\u2714 All dependencies are already in knowledge stores!");
|
|
1036
1091
|
return;
|
|
1037
1092
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1093
|
+
let topSuggestions;
|
|
1094
|
+
try {
|
|
1095
|
+
const spinner2 = ora3("Selecting important dependencies with AI...").start();
|
|
1096
|
+
topSuggestions = filterImportantDeps(newUsages);
|
|
1097
|
+
spinner2.stop();
|
|
1098
|
+
console.log("AI-selected dependencies most valuable for source indexing:\n");
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
logger.debug(
|
|
1101
|
+
{ error: error instanceof Error ? error.message : String(error) },
|
|
1102
|
+
"AI filtering unavailable, falling back to top-5 by usage"
|
|
1103
|
+
);
|
|
1104
|
+
topSuggestions = newUsages.slice(0, 5);
|
|
1105
|
+
console.log("Top dependencies by usage in this project:\n");
|
|
1106
|
+
}
|
|
1040
1107
|
topSuggestions.forEach((usage, i) => {
|
|
1041
1108
|
console.log(`${String(i + 1)}. ${usage.packageName}`);
|
|
1042
1109
|
console.log(
|