@hivelore/cli 0.51.0 → 0.52.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 CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  readPresumedCorrectTargets,
14
14
  runAstSensorOnContent,
15
15
  runHaiveMcpStdio
16
- } from "./chunk-UK4CWVS7.js";
16
+ } from "./chunk-IICT42WP.js";
17
17
  import {
18
18
  registerMemoryPending
19
19
  } from "./chunk-OYJKHD22.js";
@@ -3762,7 +3762,7 @@ ${SEED_FOOTER(stack)}` });
3762
3762
 
3763
3763
  // src/commands/init.ts
3764
3764
  var execFileAsync = promisify2(execFile2);
3765
- var HAIVE_GITHUB_ACTION_REF = `v${"0.51.0"}`;
3765
+ var HAIVE_GITHUB_ACTION_REF = `v${"0.52.0"}`;
3766
3766
  var PROJECT_CONTEXT_TEMPLATE = `# Project context
3767
3767
 
3768
3768
  > Generated by \`hivelore init\`. Run \`hivelore init --bootstrap\` to auto-fill from your codebase,
@@ -9158,7 +9158,7 @@ function registerDoctor(program2) {
9158
9158
  }
9159
9159
  const astSensorCount = sensorMemories.filter((m) => m.memory.frontmatter.sensor?.kind === "ast").length;
9160
9160
  if (astSensorCount > 0) {
9161
- const { astEngineAvailable: astEngineAvailable2 } = await import("./server-Z4M6ERWN.js");
9161
+ const { astEngineAvailable: astEngineAvailable2 } = await import("./server-UAD33QQZ.js");
9162
9162
  if (!await astEngineAvailable2()) {
9163
9163
  findings.push({
9164
9164
  severity: "warn",
@@ -9329,8 +9329,8 @@ function registerDoctor(program2) {
9329
9329
  fix: "Edit .ai/hivelore.config.json: set autoSessionEnd: true (or re-run `hivelore init` without --manual)."
9330
9330
  });
9331
9331
  }
9332
- findings.push(...await collectInstallFindings(root, "0.51.0"));
9333
- findings.push(...await collectMcpRuntimeFindings(paths, "0.51.0"));
9332
+ findings.push(...await collectInstallFindings(root, "0.52.0"));
9333
+ findings.push(...await collectMcpRuntimeFindings(paths, "0.52.0"));
9334
9334
  findings.push(...await collectToolchainFindings(root));
9335
9335
  try {
9336
9336
  const legacyRaw = execSync("haive-mcp --version", {
@@ -9338,7 +9338,7 @@ function registerDoctor(program2) {
9338
9338
  timeout: 3e3,
9339
9339
  stdio: ["ignore", "pipe", "ignore"]
9340
9340
  }).trim();
9341
- const cliVersion = "0.51.0";
9341
+ const cliVersion = "0.52.0";
9342
9342
  if (legacyRaw && legacyRaw !== cliVersion) {
9343
9343
  findings.push({
9344
9344
  severity: "warn",
@@ -9607,7 +9607,7 @@ function collectBehaviourCoverageFindings(codeMap, memories) {
9607
9607
  if (!codeMap) return [];
9608
9608
  const codeFiles = Object.keys(codeMap.files);
9609
9609
  const cov = assessBehaviourCoverage2({ memories, codeFiles });
9610
- if (cov.mainAreas.length === 0) return [];
9610
+ if (cov.mainAreas.length === 0 && cov.totalOracles === 0) return [];
9611
9611
  const uncoveredHint = cov.uncoveredAreas.length > 0 && cov.totalOracles > 0 ? `
9612
9612
  No behavioural oracle: ${cov.uncoveredAreas.slice(0, 5).map((a) => `\`${a}\``).join(", ")}` + (cov.uncoveredAreas.length > 5 ? `, +${cov.uncoveredAreas.length - 5} more` : "") : "";
9613
9613
  let fix;
@@ -9625,7 +9625,7 @@ function collectBehaviourCoverageFindings(codeMap, memories) {
9625
9625
  code: "behaviour-coverage",
9626
9626
  alwaysShow: true,
9627
9627
  section: "Protection",
9628
- coverage_percent: Math.round(cov.areasWithOracle.length / cov.mainAreas.length * 100),
9628
+ coverage_percent: cov.mainAreas.length > 0 ? Math.round(cov.areasWithOracle.length / cov.mainAreas.length * 100) : cov.totalOracles > 0 ? 100 : 0,
9629
9629
  message: `Behaviour harness: ${renderBehaviourCoverageLine2(cov)}.` + uncoveredHint,
9630
9630
  fix
9631
9631
  }];
@@ -11154,7 +11154,7 @@ async function buildEnforcementReport(dir, stage, sessionId) {
11154
11154
  findings: [{ severity: "info", code: "enforcement-off", message: "Hivelore enforcement is disabled." }]
11155
11155
  });
11156
11156
  }
11157
- findings.push(...await inspectIntegrationVersions(root, "0.51.0"));
11157
+ findings.push(...await inspectIntegrationVersions(root, "0.52.0"));
11158
11158
  if (config.enforcement?.requireBriefingFirst !== false && stage !== "ci") {
11159
11159
  const hasBriefing = await hasRecentBriefingMarker(paths, sessionId);
11160
11160
  findings.push(hasBriefing ? { severity: "ok", code: "briefing-loaded", message: "A recent Hivelore briefing marker exists." } : {
@@ -12826,6 +12826,7 @@ import path42 from "path";
12826
12826
  import { promisify as promisify7 } from "util";
12827
12827
  import "commander";
12828
12828
  import {
12829
+ extractCorrectApproachExamples,
12829
12830
  extractSensorExamples,
12830
12831
  appendSensorEvaluations as appendSensorEvaluations2,
12831
12832
  assessSensorHealth as assessSensorHealth4,
@@ -13120,7 +13121,8 @@ function registerSensors(program2) {
13120
13121
  const currentTargets = await readPresumedCorrectTargets(root, anchorPaths);
13121
13122
  const check = sensorSelfCheck2(sensor, {
13122
13123
  currentTargets,
13123
- badExamples: extractSensorExamples(found.memory.body)
13124
+ badExamples: extractSensorExamples(found.memory.body),
13125
+ correctExamples: extractCorrectApproachExamples(found.memory.body)
13124
13126
  });
13125
13127
  if (currentTargets.length > 0 && !check.silent_on_current) {
13126
13128
  ui.error(
@@ -13129,6 +13131,13 @@ function registerSensors(program2) {
13129
13131
  process.exitCode = 1;
13130
13132
  return;
13131
13133
  }
13134
+ if (check.fires_on_correct === true) {
13135
+ ui.error(
13136
+ "Refusing to block: this sensor fires on the lesson's OWN recommended fix (its `Instead, use:` approach) \u2014 it is inverted and would block the correct code, never the mistake. Point the pattern at the FAULTY usage, or pass --force."
13137
+ );
13138
+ process.exitCode = 1;
13139
+ return;
13140
+ }
13132
13141
  if (check.fires_on_bad === true) {
13133
13142
  ui.success("Self-check passed: fires on the lesson's bad example, silent on current code.");
13134
13143
  } else if (check.fires_on_bad === false) {
@@ -13177,7 +13186,7 @@ function registerSensors(program2) {
13177
13186
  }
13178
13187
  }
13179
13188
  const root2 = findProjectRoot39(opts.dir);
13180
- const { proposeSensor } = await import("./server-Z4M6ERWN.js");
13189
+ const { proposeSensor } = await import("./server-UAD33QQZ.js");
13181
13190
  const out = await proposeSensor(
13182
13191
  {
13183
13192
  memory_id: id,
@@ -13239,6 +13248,7 @@ function registerSensors(program2) {
13239
13248
  ...opts.badExample ? [opts.badExample] : [],
13240
13249
  ...extractSensorExamples(found.memory.body)
13241
13250
  ];
13251
+ const correctExamples = extractCorrectApproachExamples(found.memory.body);
13242
13252
  const sensor = {
13243
13253
  kind: "regex",
13244
13254
  pattern: opts.pattern,
@@ -13251,7 +13261,7 @@ function registerSensors(program2) {
13251
13261
  autogen: false,
13252
13262
  last_fired: null
13253
13263
  };
13254
- const verdict = judgeProposedSensor(sensor, { currentTargets, badExamples });
13264
+ const verdict = judgeProposedSensor(sensor, { currentTargets, badExamples, correctExamples });
13255
13265
  if (opts.json && !verdict.accepted) {
13256
13266
  console.log(JSON.stringify({
13257
13267
  accepted: verdict.accepted,
@@ -13268,6 +13278,8 @@ function registerSensors(program2) {
13268
13278
  ui.error(`Rejected (${verdict.reason}).`);
13269
13279
  if (verdict.reason === "fires-on-current") {
13270
13280
  ui.warn(`Fires on the CURRENT correct code in: ${verdict.self_check.fired_on.join(", ")}. Add/tighten --absent, then re-run.`);
13281
+ } else if (verdict.reason === "fires-on-correct") {
13282
+ ui.warn("Inverted: the pattern matches the lesson's OWN recommended fix (its `Instead, use:` approach) \u2014 it would block correct code, never the mistake. Point --pattern at the FAULTY usage, then re-run.");
13271
13283
  } else if (verdict.reason === "missed-bad-example") {
13272
13284
  ui.warn("Did not match the bad example \u2014 the pattern won't catch the mistake. Adjust --pattern, then re-run.");
13273
13285
  } else if (verdict.reason === "brittle") {
@@ -14244,7 +14256,7 @@ function registerBridges(program2) {
14244
14256
 
14245
14257
  // src/index.ts
14246
14258
  var program = new Command48();
14247
- program.name("hivelore").description("Hivelore - the deterministic policy gate for agent-written code (rules live as repo-native team memory)").version("0.51.0").option("--advanced", "show maintenance and experimental commands in help").showSuggestionAfterError(true);
14259
+ program.name("hivelore").description("Hivelore - the deterministic policy gate for agent-written code (rules live as repo-native team memory)").version("0.52.0").option("--advanced", "show maintenance and experimental commands in help").showSuggestionAfterError(true);
14248
14260
  registerInit(program);
14249
14261
  registerResolveProject(program);
14250
14262
  registerEnforce(program);