haansi 0.1.125 → 0.1.126

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.
Files changed (2) hide show
  1. package/dist/haansi.js +35 -28
  2. package/package.json +1 -1
package/dist/haansi.js CHANGED
@@ -95,7 +95,7 @@ var require_package = __commonJS({
95
95
  "package.json"(exports2, module2) {
96
96
  module2.exports = {
97
97
  name: "haansi",
98
- version: "0.1.125",
98
+ version: "0.1.126",
99
99
  description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
100
100
  bin: {
101
101
  haansi: "./dist/haansi.js"
@@ -88058,11 +88058,14 @@ function parseDiff(text) {
88058
88058
  }
88059
88059
  return files;
88060
88060
  }
88061
+ function isDocFile(path2) {
88062
+ return DOC_FILE_RE.test(path2);
88063
+ }
88061
88064
  function lineKeys(files, tests) {
88062
88065
  const keys = /* @__PURE__ */ new Map();
88063
88066
  const add = (key) => keys.set(key, (keys.get(key) ?? 0) + 1);
88064
88067
  for (const f of files) {
88065
- if (tests.has(f.path)) continue;
88068
+ if (tests.has(f.path) || isDocFile(f.path)) continue;
88066
88069
  for (const l of f.added) if (l.trim()) add(`${f.path}\0+${l.trim()}`);
88067
88070
  for (const l of f.removed) if (l.trim()) add(`${f.path}\0-${l.trim()}`);
88068
88071
  }
@@ -88080,7 +88083,7 @@ function lineOverlapOf(agent, target, testFiles) {
88080
88083
  let linesAdded = 0;
88081
88084
  let linesRemoved = 0;
88082
88085
  for (const f of agent) {
88083
- if (tests.has(f.path)) continue;
88086
+ if (tests.has(f.path) || isDocFile(f.path)) continue;
88084
88087
  linesAdded += f.added.length;
88085
88088
  linesRemoved += f.removed.length;
88086
88089
  }
@@ -88144,12 +88147,13 @@ async function targetDiffOf(deps, baseSha, targetSha) {
88144
88147
  );
88145
88148
  return diff.code === 0 ? diff.output : null;
88146
88149
  }
88147
- var MAX_DIFF_CHARS, PATH_OF, count3, share;
88150
+ var MAX_DIFF_CHARS, PATH_OF, DOC_FILE_RE, count3, share;
88148
88151
  var init_replay_diff = __esm({
88149
88152
  "src/commands/replay-diff.ts"() {
88150
88153
  "use strict";
88151
88154
  MAX_DIFF_CHARS = 2e5;
88152
88155
  PATH_OF = /^diff --git a\/(.+?) b\/(.+)$/;
88156
+ DOC_FILE_RE = /^docs\/|\.(md|mdx|markdown|rst|adoc)$/i;
88153
88157
  count3 = (keys) => [...keys.values()].reduce((n, c) => n + c, 0);
88154
88158
  share = (part, whole) => whole === 0 ? null : Math.round(part / whole * 1e3) / 1e3;
88155
88159
  }
@@ -90092,7 +90096,8 @@ async function gateOnContext(deps, tasks, options) {
90092
90096
  missed: count4("missed"),
90093
90097
  recurring: count4("recurring"),
90094
90098
  noContext,
90095
- unknown: unknown2
90099
+ unknown: unknown2,
90100
+ tiers
90096
90101
  };
90097
90102
  }
90098
90103
  function fromChecks(tasks, limit, shard) {
@@ -90457,10 +90462,9 @@ async function changedFiles(deps, dir, baseSha) {
90457
90462
  }
90458
90463
  function overlapOf(changed, task, reference = null) {
90459
90464
  const tests = new Set(task.testFiles);
90460
- const mine = new Set(changed.filter((f) => !tests.has(f)));
90461
- const theirs = new Set(
90462
- (reference ?? task.targetFiles).filter((f) => !tests.has(f))
90463
- );
90465
+ const graded = (f) => !tests.has(f) && !isDocFile(f);
90466
+ const mine = new Set(changed.filter(graded));
90467
+ const theirs = new Set((reference ?? task.targetFiles).filter(graded));
90464
90468
  const both = [...mine].filter((f) => theirs.has(f)).length;
90465
90469
  const myAreas = new Set([...mine].map(areaOf));
90466
90470
  const theirAreas = new Set([...theirs].map(areaOf));
@@ -90555,22 +90559,9 @@ async function runStoredReplays(options, deps) {
90555
90559
  `Shard ${options.shard.index}/${options.shard.count}: ${mine.length} of ${set2.tasks.length} task(s).`
90556
90560
  );
90557
90561
  }
90558
- const { states } = await runCalibration(
90559
- // With the context gate, --limit caps the tasks replayed (found ones),
90560
- // not the ones calibrated: calibrating only the first n left the rest
90561
- // "not valid" and the gate often found none among those n. Calibration
90562
- // runs tests only, no model. Without the gate, the first n as before.
90563
- calibrateTaskOptions(
90564
- { ...options, limit: options.anyContext ? options.limit : null },
90565
- { setupCmd, testCmd }
90566
- ),
90567
- { ...deps, report: deps.reportCalibration },
90568
- { ...set2, tasks: mine }
90562
+ const usable = mine.filter(
90563
+ (t) => t.testFiles.length > 0 && t.testFiles.every(safeTestFile) && SHA.test(t.baseSha) && SHA.test(t.targetSha)
90569
90564
  );
90570
- const valid = mine.filter(
90571
- (t) => states.get(t.taskId) === "valid" && t.testFiles.length > 0 && t.testFiles.every(safeTestFile) && SHA.test(t.baseSha) && SHA.test(t.targetSha)
90572
- );
90573
- const notValid = mine.length - valid.length;
90574
90565
  const arms = [...options.arms].sort(
90575
90566
  (a, b) => Number(a !== "baseline") - Number(b !== "baseline")
90576
90567
  );
@@ -90641,18 +90632,19 @@ async function runStoredReplays(options, deps) {
90641
90632
  let missed = 0;
90642
90633
  let recurringCount = 0;
90643
90634
  let contextUnknown = 0;
90644
- let gated = valid;
90635
+ let tiers = /* @__PURE__ */ new Map();
90636
+ let gated = usable;
90645
90637
  if (options.anyContext) {
90646
- if (valid.length)
90638
+ if (usable.length)
90647
90639
  deps.log(
90648
90640
  "--any-context: replaying valid tasks without the context check."
90649
90641
  );
90650
- } else if (valid.length) {
90642
+ } else if (usable.length) {
90651
90643
  const recurring = await recurringFailures(
90652
90644
  set2.tasks,
90653
90645
  commitTimeOf((args) => (deps.gitStdout ?? deps.git)(args, deps.repoDir))
90654
90646
  );
90655
- const gate = await gateOnContext(deps, valid, {
90647
+ const gate = await gateOnContext(deps, usable, {
90656
90648
  recurring,
90657
90649
  agentCmd: options.judgeCmd || options.agentCmd,
90658
90650
  timeoutMs: options.timeoutMs,
@@ -90669,7 +90661,22 @@ async function runStoredReplays(options, deps) {
90669
90661
  recurringCount = gate.recurring;
90670
90662
  noContext = gate.noContext;
90671
90663
  contextUnknown = gate.unknown;
90664
+ tiers = gate.tiers;
90672
90665
  }
90666
+ const { states } = await runCalibration(
90667
+ calibrateTaskOptions(
90668
+ { ...options, limit: options.anyContext ? options.limit : null },
90669
+ { setupCmd, testCmd }
90670
+ ),
90671
+ { ...deps, report: deps.reportCalibration },
90672
+ { ...set2, tasks: gated }
90673
+ );
90674
+ const calibrated = gated.length;
90675
+ gated = gated.filter((t) => states.get(t.taskId) === "valid");
90676
+ const notValid = mine.length - usable.length + (calibrated - gated.length);
90677
+ const ofTier = (tier) => gated.filter((t) => tiers.get(t.taskId) === tier).length;
90678
+ missed = ofTier("missed");
90679
+ recurringCount = ofTier("recurring");
90673
90680
  if (options.checkOnly) {
90674
90681
  deps.log(
90675
90682
  `Checked: ${gated.length - missed - recurringCount} found \xB7 ${missed} missed \xB7 ${recurringCount} recurring \xB7 ${nearby} nearby \xB7 ${noContext} with no on-point or nearby context \xB7 ${contextUnknown} unknown \xB7 ${notValid} not valid.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haansi",
3
- "version": "0.1.125",
3
+ "version": "0.1.126",
4
4
  "description": "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
5
5
  "bin": {
6
6
  "haansi": "./dist/haansi.js"