bluera-knowledge 0.35.0 → 0.37.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 +32 -0
- package/README.md +8 -20
- package/bun.lock +27 -0
- package/dist/{chunk-L2SC6J4K.js → chunk-724FNI27.js} +466 -171
- package/dist/chunk-724FNI27.js.map +1 -0
- package/dist/{chunk-DNGE7FZ4.js → chunk-AO45YFHO.js} +1386 -42
- package/dist/chunk-AO45YFHO.js.map +1 -0
- package/dist/{chunk-MQQ46BST.js → chunk-F6DGSS2N.js} +2 -2
- package/dist/index.js +72 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +37 -3
- package/dist/mcp/server.js +2 -2
- package/dist/workers/background-worker-cli.js +2 -2
- package/hooks/check-ready.sh +17 -7
- package/hooks/hooks.json +17 -1
- package/hooks/lib/store_summary.py +111 -0
- package/hooks/posttooluse-bk-reminder.py +33 -6
- package/hooks/stop-bk-check.py +86 -0
- package/hooks/userpromptsubmit-bk-nudge.py +156 -0
- package/package.json +3 -1
- package/scripts/auto-setup.sh +11 -3
- package/scripts/eval-candidates.sh +235 -0
- package/skills/advanced-workflows/references/combining-workflows.md +17 -0
- package/skills/advanced-workflows/references/error-recovery.md +44 -0
- package/skills/advanced-workflows/references/handling-large-results.md +48 -0
- package/skills/advanced-workflows/references/multi-store-search.md +42 -0
- package/skills/knowledge-search/SKILL.md +1 -1
- package/skills/search/statusline.md +75 -0
- package/skills/store-lifecycle/references/failure-recovery.md +80 -0
- package/skills/store-lifecycle/references/indexing-strategies.md +67 -0
- package/skills/store-lifecycle/references/job-monitoring.md +72 -0
- package/skills/store-lifecycle/references/lifecycle-checklist.md +20 -0
- package/skills/store-lifecycle/references/storage-management.md +43 -0
- package/skills/suggest/SKILL.md +13 -6
- package/dist/chunk-DNGE7FZ4.js.map +0 -1
- package/dist/chunk-L2SC6J4K.js.map +0 -1
- /package/dist/{chunk-MQQ46BST.js.map → chunk-F6DGSS2N.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createLogger,
|
|
3
3
|
summarizePayload,
|
|
4
4
|
truncateForLog
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-724FNI27.js";
|
|
6
6
|
|
|
7
7
|
// src/crawl/intelligent-crawler.ts
|
|
8
8
|
import { EventEmitter } from "events";
|
|
@@ -798,4 +798,4 @@ export {
|
|
|
798
798
|
getCrawlStrategy,
|
|
799
799
|
IntelligentCrawler
|
|
800
800
|
};
|
|
801
|
-
//# sourceMappingURL=chunk-
|
|
801
|
+
//# sourceMappingURL=chunk-F6DGSS2N.js.map
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
ZilAdapter,
|
|
4
4
|
runMCPServer,
|
|
5
5
|
spawnBackgroundWorker
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AO45YFHO.js";
|
|
7
7
|
import {
|
|
8
8
|
IntelligentCrawler,
|
|
9
9
|
getCrawlStrategy
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-F6DGSS2N.js";
|
|
11
11
|
import {
|
|
12
12
|
ASTParser,
|
|
13
13
|
AdapterRegistry,
|
|
@@ -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,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
isRepoStoreDefinition,
|
|
26
27
|
isWebStoreDefinition,
|
|
27
28
|
ok
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-724FNI27.js";
|
|
29
30
|
import {
|
|
30
31
|
createDocumentId
|
|
31
32
|
} from "./chunk-CLIMKLTW.js";
|
|
@@ -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(
|