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