@hivelore/cli 0.39.0 → 0.39.2

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.
@@ -139,6 +139,8 @@ import { existsSync as existsSync15 } from "fs";
139
139
  import path5 from "path";
140
140
  import {
141
141
  extractSensorExamples,
142
+ extractTestFilePathsFromCommand,
143
+ hasPendingTestMarker,
142
144
  judgeProposedSensor,
143
145
  loadMemoriesFromDir as loadMemoriesFromDir13,
144
146
  serializeMemory as serializeMemory7
@@ -1394,6 +1396,24 @@ async function proposeSensor(input, ctx) {
1394
1396
  }
1395
1397
  const personalScopeNudge = found.memory.frontmatter.scope === "personal" ? ` Note: this lesson is personal-scoped, so the sensor guards only YOUR machine (personal memories are gitignored). Promote it so the gate travels with the repo: hivelore memory promote ${input.memory_id}.` : "";
1396
1398
  if (kind !== "regex") {
1399
+ const referencedTests = extractTestFilePathsFromCommand(input.command.trim()).filter((rel) => existsSync15(path5.resolve(ctx.paths.root, rel)));
1400
+ const pendingTests = [];
1401
+ for (const rel of referencedTests) {
1402
+ try {
1403
+ if (hasPendingTestMarker(await readFile3(path5.resolve(ctx.paths.root, rel), "utf8"))) pendingTests.push(rel);
1404
+ } catch {
1405
+ }
1406
+ }
1407
+ if (pendingTests.length > 0 && input.severity === "block") {
1408
+ return {
1409
+ accepted: false,
1410
+ memory_id: input.memory_id,
1411
+ severity: input.severity,
1412
+ reason: "oracle-pending",
1413
+ guidance: `The routed test is still a PENDING stub (${pendingTests.join(", ")}) \u2014 it passes on anything, so the sensor would enforce nothing while reporting protection. Write the assertion (RED on the incident, GREEN once fixed), run it, then re-propose.`,
1414
+ self_check: { silent_on_current: false, fires_on_bad: null, fired_on: pendingTests }
1415
+ };
1416
+ }
1397
1417
  const verdictCmd = runCommandForValidation(input.command.trim(), ctx.paths.root, input.timeout_ms);
1398
1418
  const anchorPathsCmd = input.paths.length > 0 ? input.paths : found.memory.frontmatter.anchor.paths;
1399
1419
  if (verdictCmd.status !== "passed" && input.severity === "block") {
@@ -1427,7 +1447,7 @@ ${verdictCmd.detail}`,
1427
1447
  accepted: true,
1428
1448
  memory_id: input.memory_id,
1429
1449
  severity: input.severity,
1430
- guidance: (verdictCmd.status === "passed" ? "Command oracle passes on the current tree; the gate now runs it when the diff touches the sensor's paths (requires enforcement.runCommandSensors=true)." : `Accepted at warn severity, but note: ${verdictCmd.status} on the current tree (${verdictCmd.detail}).`) + personalScopeNudge,
1450
+ guidance: (verdictCmd.status === "passed" ? "Command oracle passes on the current tree; the gate now runs it when the diff touches the sensor's paths (requires enforcement.runCommandSensors=true)." : `Accepted at warn severity, but note: ${verdictCmd.status} on the current tree (${verdictCmd.detail}).`) + (pendingTests.length > 0 ? ` Note: the routed test is still a PENDING stub (${pendingTests.join(", ")}) \u2014 it passes on anything; write the assertion to make this oracle real.` : "") + personalScopeNudge,
1431
1451
  self_check: { silent_on_current: verdictCmd.status === "passed", fires_on_bad: null, fired_on: [] }
1432
1452
  };
1433
1453
  }
@@ -1510,7 +1530,10 @@ async function memTried(input, ctx) {
1510
1530
  if (!existsSync16(ctx.paths.haiveDir)) {
1511
1531
  throw new Error(`No .ai/ directory at ${ctx.paths.root}. Run 'hivelore init' first.`);
1512
1532
  }
1513
- const slug = input.what.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 5).join("-");
1533
+ const SLUG_STOPWORDS = /* @__PURE__ */ new Set(["and", "or", "the", "a", "an", "of", "to", "in", "for", "with", "on", "at", "by"]);
1534
+ const words = input.what.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 5);
1535
+ while (words.length > 2 && SLUG_STOPWORDS.has(words[words.length - 1])) words.pop();
1536
+ const slug = words.join("-");
1514
1537
  const scope = input.scope ?? (input.sensor ? "team" : "personal");
1515
1538
  const baseFm = buildFrontmatter2({
1516
1539
  type: "attempt",
@@ -2875,7 +2898,7 @@ function oneLine(value) {
2875
2898
  return value.replace(/\s+/g, " ").replace(/"/g, '\\"').trim().slice(0, 120);
2876
2899
  }
2877
2900
  function serverVersion() {
2878
- return true ? "0.39.0" : "dev";
2901
+ return true ? "0.39.2" : "dev";
2879
2902
  }
2880
2903
  var CodeMapInputSchema = {
2881
2904
  file: z21.string().optional().describe("Filter to files whose path contains this substring"),
@@ -4202,7 +4225,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
4202
4225
  };
4203
4226
  }
4204
4227
  var SERVER_NAME = "hivelore";
4205
- var SERVER_VERSION = "0.39.0";
4228
+ var SERVER_VERSION = "0.39.2";
4206
4229
  function jsonResult(data) {
4207
4230
  return {
4208
4231
  content: [
@@ -5178,4 +5201,4 @@ export {
5178
5201
  printHaiveMcpVersion,
5179
5202
  runHaiveMcpStdio
5180
5203
  };
5181
- //# sourceMappingURL=chunk-I4VELI5K.js.map
5204
+ //# sourceMappingURL=chunk-XA5FXG6E.js.map