@hiveai/mcp 0.23.0 → 0.24.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/dist/index.js +28 -10
- package/dist/index.js.map +1 -1
- package/dist/server.js +28 -10
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1587,6 +1587,7 @@ async function memSessionEnd(input, ctx) {
|
|
|
1587
1587
|
// src/tools/get-briefing.ts
|
|
1588
1588
|
import { readFile as readFile5, writeFile as writeFile13 } from "fs/promises";
|
|
1589
1589
|
import { existsSync as existsSync21 } from "fs";
|
|
1590
|
+
import path11 from "path";
|
|
1590
1591
|
import {
|
|
1591
1592
|
allocateBudget,
|
|
1592
1593
|
briefingProofLine,
|
|
@@ -2030,6 +2031,7 @@ async function getBriefing(input, ctx) {
|
|
|
2030
2031
|
const topSymbols = Object.entries(codeMap.files).flatMap(
|
|
2031
2032
|
([fp, entry]) => entry.exports.slice(0, 3).map((e) => `${e.name} (${fp.split("/").slice(-2).join("/")})`)
|
|
2032
2033
|
).slice(0, 15).join(", ");
|
|
2034
|
+
const commands = await detectRunCommands(ctx.paths.root);
|
|
2033
2035
|
projectContext = `# Project context (auto-generated by hAIve)
|
|
2034
2036
|
|
|
2035
2037
|
> \u26A0 This is a minimal auto-generated context based on the code-map. Invoke the \`bootstrap_project\` MCP prompt to replace it with a full analysis.
|
|
@@ -2039,7 +2041,10 @@ async function getBriefing(input, ctx) {
|
|
|
2039
2041
|
- **Main file types:** ${topExts}
|
|
2040
2042
|
- **Generated at:** ${codeMap.generated_at}
|
|
2041
2043
|
|
|
2042
|
-
|
|
2044
|
+
` + (commands ? `## Commands
|
|
2045
|
+
${commands}
|
|
2046
|
+
|
|
2047
|
+
` : "") + `## Key exports (sample)
|
|
2043
2048
|
` + topSymbols + "\n";
|
|
2044
2049
|
autoContextGenerated = true;
|
|
2045
2050
|
setupWarnings.push(
|
|
@@ -2319,6 +2324,19 @@ When done, call \`mem_session_end\` to acknowledge \u2014 this clears the pendin
|
|
|
2319
2324
|
}
|
|
2320
2325
|
};
|
|
2321
2326
|
}
|
|
2327
|
+
async function detectRunCommands(root) {
|
|
2328
|
+
const pkgPath = path11.join(root, "package.json");
|
|
2329
|
+
if (!existsSync21(pkgPath)) return null;
|
|
2330
|
+
try {
|
|
2331
|
+
const pkg = JSON.parse(await readFile5(pkgPath, "utf8"));
|
|
2332
|
+
const scripts = pkg.scripts ?? {};
|
|
2333
|
+
const order = ["test", "build", "lint", "typecheck", "type-check", "dev", "start"];
|
|
2334
|
+
const lines = order.filter((name) => typeof scripts[name] === "string" && scripts[name].trim() !== "").map((name) => `- \`${name}\`: \`${scripts[name]}\``);
|
|
2335
|
+
return lines.length > 0 ? lines.join("\n") : null;
|
|
2336
|
+
} catch {
|
|
2337
|
+
return null;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2322
2340
|
|
|
2323
2341
|
// src/tools/code-map.ts
|
|
2324
2342
|
import { estimateTokens as estimateTokens2, loadCodeMap as loadCodeMap2, queryCodeMap as queryCodeMap2 } from "@hiveai/core";
|
|
@@ -2558,7 +2576,7 @@ async function codeSearch(input, ctx) {
|
|
|
2558
2576
|
// src/tools/why-this-file.ts
|
|
2559
2577
|
import { existsSync as existsSync24 } from "fs";
|
|
2560
2578
|
import { spawn } from "child_process";
|
|
2561
|
-
import
|
|
2579
|
+
import path12 from "path";
|
|
2562
2580
|
import {
|
|
2563
2581
|
deriveConfidence as deriveConfidence5,
|
|
2564
2582
|
getUsage as getUsage7,
|
|
@@ -2576,7 +2594,7 @@ var WhyThisFileInputSchema = {
|
|
|
2576
2594
|
memory_limit: z25.number().int().positive().max(20).default(5).describe("Cap on memories anchored to this path.")
|
|
2577
2595
|
};
|
|
2578
2596
|
async function whyThisFile(input, ctx) {
|
|
2579
|
-
const fileExists = existsSync24(
|
|
2597
|
+
const fileExists = existsSync24(path12.join(ctx.paths.root, input.path));
|
|
2580
2598
|
const [commits, memories, codeMap] = await Promise.all([
|
|
2581
2599
|
runGitLog(ctx.paths.root, input.path, input.git_log_limit).catch(() => []),
|
|
2582
2600
|
collectAnchoredMemories(ctx, input.path, input.memory_limit),
|
|
@@ -3629,7 +3647,7 @@ function repairTargetPathForWarning(warning, paths) {
|
|
|
3629
3647
|
// src/tools/pattern-detect.ts
|
|
3630
3648
|
import { mkdir as mkdir8, writeFile as writeFile14 } from "fs/promises";
|
|
3631
3649
|
import { existsSync as existsSync29 } from "fs";
|
|
3632
|
-
import
|
|
3650
|
+
import path13 from "path";
|
|
3633
3651
|
import { execSync as execSync2 } from "child_process";
|
|
3634
3652
|
import {
|
|
3635
3653
|
buildFrontmatter as buildFrontmatter5,
|
|
@@ -3678,13 +3696,13 @@ async function patternDetect(input, ctx) {
|
|
|
3678
3696
|
try {
|
|
3679
3697
|
const changedFiles = gitChangedFiles(ctx.paths.root, input.since_days);
|
|
3680
3698
|
const configFiles = changedFiles.filter(
|
|
3681
|
-
(f) => CONFIG_PATTERNS.some((p) =>
|
|
3699
|
+
(f) => CONFIG_PATTERNS.some((p) => path13.basename(f.toLowerCase()).includes(p))
|
|
3682
3700
|
);
|
|
3683
3701
|
for (const file of configFiles.slice(0, 5)) {
|
|
3684
3702
|
const diff = gitFileDiff(ctx.paths.root, file, input.since_days);
|
|
3685
3703
|
if (!diff) continue;
|
|
3686
|
-
const parentDir =
|
|
3687
|
-
const baseName =
|
|
3704
|
+
const parentDir = path13.basename(path13.dirname(file));
|
|
3705
|
+
const baseName = path13.basename(file).replace(/\.[^.]+$/, "");
|
|
3688
3706
|
const slug = `${parentDir}-${baseName}`.replace(/[^a-z0-9]/gi, "-").toLowerCase().slice(0, 40);
|
|
3689
3707
|
matches.push({
|
|
3690
3708
|
kind: "config_change",
|
|
@@ -3748,7 +3766,7 @@ async function patternDetect(input, ctx) {
|
|
|
3748
3766
|
for (const [p, { count, tools }] of pathCounts) {
|
|
3749
3767
|
if (count < HOT_FILE_MIN) continue;
|
|
3750
3768
|
if (tools.has("mem_tried") || tools.has("mem_observe")) continue;
|
|
3751
|
-
if (CONFIG_PATTERNS.some((cp) =>
|
|
3769
|
+
if (CONFIG_PATTERNS.some((cp) => path13.basename(p).includes(cp))) continue;
|
|
3752
3770
|
const slug = p.replace(/[^a-z0-9]/g, "-").replace(/-+/g, "-").slice(0, 40);
|
|
3753
3771
|
matches.push({
|
|
3754
3772
|
kind: "hot_file",
|
|
@@ -3795,7 +3813,7 @@ async function patternDetect(input, ctx) {
|
|
|
3795
3813
|
void 0
|
|
3796
3814
|
);
|
|
3797
3815
|
if (existsSync29(file)) continue;
|
|
3798
|
-
await mkdir8(
|
|
3816
|
+
await mkdir8(path13.dirname(file), { recursive: true });
|
|
3799
3817
|
await writeFile14(
|
|
3800
3818
|
file,
|
|
3801
3819
|
serializeMemory12({ frontmatter: fm, body: match.proposed_body }),
|
|
@@ -4252,7 +4270,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
4252
4270
|
// src/server.ts
|
|
4253
4271
|
import { hasRecentBriefingMarker, loadConfigSync } from "@hiveai/core";
|
|
4254
4272
|
var SERVER_NAME = "haive";
|
|
4255
|
-
var SERVER_VERSION = "0.
|
|
4273
|
+
var SERVER_VERSION = "0.24.0";
|
|
4256
4274
|
function jsonResult(data) {
|
|
4257
4275
|
return {
|
|
4258
4276
|
content: [
|