@hiveai/cli 0.9.30 → 0.9.31

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
@@ -7323,7 +7323,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
7323
7323
  };
7324
7324
  }
7325
7325
  var SERVER_NAME = "haive";
7326
- var SERVER_VERSION = "0.9.30";
7326
+ var SERVER_VERSION = "0.9.31";
7327
7327
  function jsonResult(data) {
7328
7328
  return {
7329
7329
  content: [
@@ -12395,14 +12395,14 @@ function registerDoctor(program2) {
12395
12395
  fix: "Edit .ai/haive.config.json: set autoSessionEnd: true (or re-run `haive init` without --manual)."
12396
12396
  });
12397
12397
  }
12398
- findings.push(...await collectInstallFindings(root, "0.9.30"));
12398
+ findings.push(...await collectInstallFindings(root, "0.9.31"));
12399
12399
  try {
12400
12400
  const legacyRaw = execSync3("haive-mcp --version", {
12401
12401
  encoding: "utf8",
12402
12402
  timeout: 3e3,
12403
12403
  stdio: ["ignore", "pipe", "ignore"]
12404
12404
  }).trim();
12405
- const cliVersion = "0.9.30";
12405
+ const cliVersion = "0.9.31";
12406
12406
  if (legacyRaw && legacyRaw !== cliVersion) {
12407
12407
  findings.push({
12408
12408
  severity: "warn",
@@ -12982,7 +12982,9 @@ function truncate3(text, max) {
12982
12982
  import { spawn as spawn5 } from "child_process";
12983
12983
  import "commander";
12984
12984
  import {
12985
+ antiPatternGateParams,
12985
12986
  findProjectRoot as findProjectRoot44,
12987
+ loadConfig as loadConfig11,
12986
12988
  resolveHaivePaths as resolveHaivePaths40
12987
12989
  } from "@hiveai/core";
12988
12990
  function registerPrecommit(program2) {
@@ -12990,8 +12992,7 @@ function registerPrecommit(program2) {
12990
12992
  "Run a pre-commit safety check: scans `git diff --cached` against known anti-patterns,\n surfaces conventions/decisions anchored to touched files, and warns about stale anchored memories.\n\n Wire it into git as: `.git/hooks/pre-commit` running `haive precommit` (exit 1 = block).\n\n Examples:\n haive precommit # auto-detects staged diff\n haive precommit --block-on any # block on any warning, not just high-confidence\n haive precommit --paths src/auth.ts src/db.ts # explicit paths instead of git diff"
12991
12993
  ).option(
12992
12994
  "--block-on <mode>",
12993
- "'any' | 'high-confidence' (default) | 'never' (report only)",
12994
- "high-confidence"
12995
+ "'any' | 'high-confidence' | 'never' (report only). Default: derived from enforcement.antiPatternGate."
12995
12996
  ).option("--no-semantic", "disable semantic search in anti-patterns matching").option(
12996
12997
  "--no-anchored-blocks",
12997
12998
  "do not block on anchored, diff-corroborated anti-patterns (only block on very strong semantic matches)"
@@ -12999,6 +13000,11 @@ function registerPrecommit(program2) {
12999
13000
  const root = findProjectRoot44(opts.dir);
13000
13001
  const paths = resolveHaivePaths40(root);
13001
13002
  const ctx = { paths };
13003
+ const config = await loadConfig11(paths);
13004
+ const gate = config.enforcement?.antiPatternGate ?? "anchored";
13005
+ const gateParams = antiPatternGateParams(gate);
13006
+ const blockOn = opts.blockOn ?? gateParams.block_on;
13007
+ const anchoredBlocks = opts.anchoredBlocks === false ? false : gateParams.anchored_blocks;
13002
13008
  let diff = "";
13003
13009
  let touchedPaths = opts.paths ?? [];
13004
13010
  if (touchedPaths.length === 0) {
@@ -13036,8 +13042,8 @@ function registerPrecommit(program2) {
13036
13042
  const result = await preCommitCheck({
13037
13043
  diff: diff || void 0,
13038
13044
  paths: touchedPaths,
13039
- block_on: opts.blockOn ?? "high-confidence",
13040
- anchored_blocks: opts.anchoredBlocks !== false,
13045
+ block_on: blockOn,
13046
+ anchored_blocks: anchoredBlocks,
13041
13047
  semantic: opts.noSemantic ? false : true
13042
13048
  }, ctx);
13043
13049
  if (opts.json) {
@@ -13080,7 +13086,7 @@ function registerPrecommit(program2) {
13080
13086
  console.log();
13081
13087
  }
13082
13088
  if (result.should_block) {
13083
- ui.error(`Blocking commit (block_on=${opts.blockOn ?? "high-confidence"}). Address the warnings above or pass --block-on never to bypass.`);
13089
+ ui.error(`Blocking commit (gate=${gate}, block_on=${blockOn}). Address the warnings above or pass --block-on never to bypass.`);
13084
13090
  process.exit(1);
13085
13091
  }
13086
13092
  if (result.warnings.length === 0 && result.stale_anchors.length === 0) {
@@ -13366,10 +13372,11 @@ import { chmod as chmod2, mkdir as mkdir19, readFile as readFile21, readdir as r
13366
13372
  import path50 from "path";
13367
13373
  import "commander";
13368
13374
  import {
13375
+ antiPatternGateParams as antiPatternGateParams2,
13369
13376
  findProjectRoot as findProjectRoot49,
13370
13377
  hasRecentBriefingMarker,
13371
13378
  isFreshIsoDate,
13372
- loadConfig as loadConfig11,
13379
+ loadConfig as loadConfig12,
13373
13380
  loadMemoriesFromDir as loadMemoriesFromDir36,
13374
13381
  memoryMatchesAnchorPaths as memoryMatchesAnchorPaths6,
13375
13382
  readRecentBriefingMarker,
@@ -13390,7 +13397,7 @@ function registerEnforce(program2) {
13390
13397
  const root = findProjectRoot49(opts.dir);
13391
13398
  const paths = resolveHaivePaths45(root);
13392
13399
  await mkdir19(paths.haiveDir, { recursive: true });
13393
- const current = await loadConfig11(paths);
13400
+ const current = await loadConfig12(paths);
13394
13401
  await saveConfig4(paths, {
13395
13402
  ...current,
13396
13403
  enforcement: {
@@ -13663,7 +13670,7 @@ async function buildEnforcementReport(dir, stage, sessionId) {
13663
13670
  const root = findProjectRoot49(dir);
13664
13671
  const paths = resolveHaivePaths45(root);
13665
13672
  const initialized = existsSync68(paths.haiveDir);
13666
- const config = initialized ? await loadConfig11(paths) : {};
13673
+ const config = initialized ? await loadConfig12(paths) : {};
13667
13674
  if (initialized) await applyLightweightRepairs(root, paths);
13668
13675
  const mode = config.enforcement?.mode ?? "strict";
13669
13676
  const findings = [];
@@ -13693,7 +13700,7 @@ async function buildEnforcementReport(dir, stage, sessionId) {
13693
13700
  findings: [{ severity: "info", code: "enforcement-off", message: "hAIve enforcement is disabled." }]
13694
13701
  });
13695
13702
  }
13696
- findings.push(...await inspectIntegrationVersions(root, "0.9.30"));
13703
+ findings.push(...await inspectIntegrationVersions(root, "0.9.31"));
13697
13704
  if (config.enforcement?.requireBriefingFirst !== false && stage !== "ci") {
13698
13705
  const hasBriefing = await hasRecentBriefingMarker(paths, sessionId);
13699
13706
  findings.push(hasBriefing ? { severity: "ok", code: "briefing-loaded", message: "A recent hAIve briefing marker exists." } : {
@@ -13861,11 +13868,12 @@ async function runPrecommitPolicy(paths, gate) {
13861
13868
  return [{ severity: "info", code: "no-staged-changes", message: "No staged changes found for pre-commit policy." }];
13862
13869
  }
13863
13870
  const diff = await runCommand4("git", ["diff", "--cached"], paths.root).catch(() => "");
13871
+ const { block_on, anchored_blocks } = antiPatternGateParams2(gate);
13864
13872
  const result = await preCommitCheck({
13865
13873
  diff,
13866
13874
  paths: touchedPaths,
13867
- block_on: gate === "strict" ? "any" : "high-confidence",
13868
- anchored_blocks: gate === "anchored",
13875
+ block_on,
13876
+ anchored_blocks,
13869
13877
  semantic: true
13870
13878
  }, { paths });
13871
13879
  if (!result.should_block) {
@@ -14304,7 +14312,7 @@ function registerRun(program2) {
14304
14312
 
14305
14313
  // src/index.ts
14306
14314
  var program = new Command52();
14307
- program.name("haive").description("hAIve \u2014 the memory and enforcement layer of your agent harness").version("0.9.30").option("--advanced", "show maintenance and experimental commands in help");
14315
+ program.name("haive").description("hAIve \u2014 the memory and enforcement layer of your agent harness").version("0.9.31").option("--advanced", "show maintenance and experimental commands in help");
14308
14316
  registerInit(program);
14309
14317
  registerWelcome(program);
14310
14318
  registerResolveProject(program);