@hivelore/cli 0.43.2 → 0.44.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/README.md CHANGED
@@ -233,6 +233,7 @@ Run the repeatable quality gate for Hivelore itself or for a project using Hivel
233
233
  ```bash
234
234
  hivelore eval
235
235
  hivelore eval --semantic-only
236
+ hivelore eval --semantic-ranking # require and exercise the real embeddings-backed ranker
236
237
  hivelore eval --spec .ai/eval/spec.json --fail-under 80
237
238
  ```
238
239
 
@@ -533,14 +534,14 @@ hivelore install-hooks --dir /path/to/project
533
534
 
534
535
  ---
535
536
 
536
- ### `hivelore embeddings`
537
+ ### `hivelore index`
537
538
 
538
539
  Manage the local semantic search index (requires `@hivelore/embeddings` to be installed).
539
540
 
540
541
  ```bash
541
- hivelore embeddings index # Build or refresh the embeddings index
542
- hivelore embeddings status # Show index stats (count, last updated, model)
543
- hivelore embeddings query "how do we handle retries on payment failures"
542
+ hivelore index memories # Build or refresh the embeddings index
543
+ hivelore index status # Show index stats (count, last updated, model)
544
+ hivelore index query "how do we handle retries on payment failures"
544
545
  ```
545
546
 
546
547
  The model (`bge-small-en-v1.5`, ~110MB) is downloaded on first use and cached locally. **No data leaves your machine.**
@@ -655,8 +656,8 @@ Install `@hivelore/embeddings` for similarity-based memory retrieval:
655
656
 
656
657
  ```bash
657
658
  npm install -g @hivelore/embeddings
658
- hivelore embeddings index # First run downloads the model (~110MB)
659
- hivelore embeddings query "payment retry logic"
659
+ hivelore index memories # First run downloads the model (~110MB)
660
+ hivelore index query "payment retry logic"
660
661
  ```
661
662
 
662
663
  From MCP: set `semantic: true` on `mem_search` or `get_briefing`.
@@ -3,6 +3,8 @@
3
3
  // ../mcp/dist/server.js
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import { mkdir as mkdir8, writeFile as writeFile15 } from "fs/promises";
7
+ import path15 from "path";
6
8
  import { findProjectRoot, resolveHaivePaths } from "@hivelore/core";
7
9
  import { mkdir, writeFile } from "fs/promises";
8
10
  import { existsSync } from "fs";
@@ -3211,7 +3213,7 @@ function oneLine(value) {
3211
3213
  return value.replace(/\s+/g, " ").replace(/"/g, '\\"').trim().slice(0, 120);
3212
3214
  }
3213
3215
  function serverVersion() {
3214
- return true ? "0.43.2" : "dev";
3216
+ return true ? "0.44.0" : "dev";
3215
3217
  }
3216
3218
  var CodeMapInputSchema = {
3217
3219
  file: z21.string().optional().describe("Filter to files whose path contains this substring"),
@@ -3454,7 +3456,8 @@ var AntiPatternsCheckInputSchema = {
3454
3456
  ),
3455
3457
  min_semantic_score: z26.number().min(0).max(1).default(0.45).describe(
3456
3458
  "Minimum cosine score for semantic-only anti-pattern hits. Anchor/literal matches still surface. Default 0.45 keeps broad, weakly-related memories out of review noise."
3457
- )
3459
+ ),
3460
+ track: z26.boolean().default(true).describe("Record real prevention outcomes. Set false for eval/selftest probes so synthetic cases never inflate ROI.")
3458
3461
  };
3459
3462
  function tokenizeDiffForLiteral(diff) {
3460
3463
  const lines = diff.split("\n");
@@ -3647,7 +3650,9 @@ async function antiPatternsCheck(input, ctx) {
3647
3650
  }).slice(0, input.limit);
3648
3651
  const isHardBlockCatch = (w) => w.reasons.includes("sensor");
3649
3652
  const strongCatches = warnings.filter(isHardBlockCatch);
3650
- await recordPreventionHits(ctx.paths, strongCatches.map((w) => w.id), "anti-pattern");
3653
+ if (input.track !== false) {
3654
+ await recordPreventionHits(ctx.paths, strongCatches.map((w) => w.id), "anti-pattern");
3655
+ }
3651
3656
  return {
3652
3657
  scanned: negative.length,
3653
3658
  warnings
@@ -4376,13 +4381,14 @@ Main code areas detected: ${areas}
4376
4381
  }
4377
4382
  var PostTaskArgsSchema = {
4378
4383
  task_summary: z35.string().optional().describe("One sentence describing what you just did"),
4379
- files_touched: z35.array(z35.string()).optional().describe("Files you created or modified during the task")
4384
+ files_touched: z35.string().optional().describe("Files you created or modified during the task, as CSV or a JSON array string")
4380
4385
  };
4381
4386
  function postTaskPrompt(args, ctx) {
4382
4387
  const taskLine = args.task_summary ? `
4383
4388
  Task just completed: **${args.task_summary}**` : "";
4384
- const filesLine = args.files_touched && args.files_touched.length > 0 ? `
4385
- Files touched: ${args.files_touched.map((f) => `\`${f}\``).join(", ")}` : "";
4389
+ const filesTouched = parsePromptFilesTouched(args.files_touched);
4390
+ const filesLine = filesTouched.length > 0 ? `
4391
+ Files touched: ${filesTouched.map((f) => `\`${f}\``).join(", ")}` : "";
4386
4392
  const text = `You have just finished a task. Before closing this session, take 60 seconds to capture what you learned.
4387
4393
  ${taskLine}${filesLine}
4388
4394
 
@@ -4471,6 +4477,20 @@ When done, respond with a brief summary: "Saved N memories: [list of IDs]. Sessi
4471
4477
  ]
4472
4478
  };
4473
4479
  }
4480
+ function parsePromptFilesTouched(input) {
4481
+ const raw = input?.trim();
4482
+ if (!raw) return [];
4483
+ if (raw.startsWith("[")) {
4484
+ try {
4485
+ const parsed = JSON.parse(raw);
4486
+ if (Array.isArray(parsed)) {
4487
+ return parsed.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean);
4488
+ }
4489
+ } catch {
4490
+ }
4491
+ }
4492
+ return raw.split(",").map((value) => value.trim()).filter(Boolean);
4493
+ }
4474
4494
  var ImportDocsArgsSchema = {
4475
4495
  content: z36.string().describe("The documentation content to analyze and import as memories (Markdown, README, ADR, etc.)"),
4476
4496
  source: z36.string().optional().describe("Origin of the content (file path, URL, or document title) \u2014 used to anchor memories"),
@@ -4538,7 +4558,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
4538
4558
  };
4539
4559
  }
4540
4560
  var SERVER_NAME = "hivelore";
4541
- var SERVER_VERSION = "0.43.2";
4561
+ var SERVER_VERSION = "0.44.0";
4542
4562
  function jsonResult(data) {
4543
4563
  return {
4544
4564
  content: [
@@ -5477,11 +5497,22 @@ function printHaiveMcpVersion() {
5477
5497
  }
5478
5498
  async function runHaiveMcpStdio(options) {
5479
5499
  const { server, context } = createHaiveServer({ root: options.root, env: process.env });
5500
+ await writeMcpRuntimeMarker(context).catch(() => {
5501
+ });
5480
5502
  console.error(
5481
5503
  `[haive-mcp] starting server v${SERVER_VERSION} (project root: ${context.paths.root})`
5482
5504
  );
5483
5505
  await server.connect(new StdioServerTransport());
5484
5506
  }
5507
+ async function writeMcpRuntimeMarker(context) {
5508
+ await mkdir8(context.paths.runtimeDir, { recursive: true });
5509
+ await writeFile15(path15.join(context.paths.runtimeDir, "mcp-server.json"), JSON.stringify({
5510
+ version: SERVER_VERSION,
5511
+ pid: process.pid,
5512
+ started_at: (/* @__PURE__ */ new Date()).toISOString(),
5513
+ command: "hivelore mcp --stdio"
5514
+ }, null, 2), "utf8");
5515
+ }
5485
5516
 
5486
5517
  export {
5487
5518
  astEngineAvailable,
@@ -5516,6 +5547,7 @@ export {
5516
5547
  createHaiveServer,
5517
5548
  parseMcpCliArgs,
5518
5549
  printHaiveMcpVersion,
5519
- runHaiveMcpStdio
5550
+ runHaiveMcpStdio,
5551
+ writeMcpRuntimeMarker
5520
5552
  };
5521
- //# sourceMappingURL=chunk-FXDGOBPT.js.map
5553
+ //# sourceMappingURL=chunk-6KRXMDLC.js.map