haansi 0.1.113 → 0.1.114
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/haansi.js +89 -3
- 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.
|
|
98
|
+
version: "0.1.114",
|
|
99
99
|
description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
|
|
100
100
|
bin: {
|
|
101
101
|
haansi: "./dist/haansi.js"
|
|
@@ -89186,6 +89186,73 @@ var init_replay_lang = __esm({
|
|
|
89186
89186
|
}
|
|
89187
89187
|
});
|
|
89188
89188
|
|
|
89189
|
+
// src/commands/replay-spec-gaps.ts
|
|
89190
|
+
function testKeysOf(source, path2) {
|
|
89191
|
+
const lang = adapterFor(path2);
|
|
89192
|
+
if (!lang) return [];
|
|
89193
|
+
const out = /* @__PURE__ */ new Set();
|
|
89194
|
+
const add = (re) => {
|
|
89195
|
+
for (const m of source.matchAll(re)) out.add(m[1]);
|
|
89196
|
+
};
|
|
89197
|
+
if (lang.id === "js") {
|
|
89198
|
+
add(new RegExp(String.raw`[{,]\s*(${IDENT3})\s*\??:`, "g"));
|
|
89199
|
+
} else {
|
|
89200
|
+
add(new RegExp(String.raw`[(,]\s*(${IDENT3})\s*=(?!=)`, "g"));
|
|
89201
|
+
add(new RegExp(String.raw`["'](${IDENT3})["']\s*:`, "g"));
|
|
89202
|
+
}
|
|
89203
|
+
add(
|
|
89204
|
+
new RegExp(String.raw`(?<!(?:^|[^A-Za-z0-9_$])[0-9]+)\.\s*(${IDENT3})`, "g")
|
|
89205
|
+
);
|
|
89206
|
+
return [...out];
|
|
89207
|
+
}
|
|
89208
|
+
function wordsOf2(text) {
|
|
89209
|
+
return new Set(text.match(new RegExp(IDENT3, "g")) ?? []);
|
|
89210
|
+
}
|
|
89211
|
+
async function specGapsOf(show, grep, task, prompt2) {
|
|
89212
|
+
const shown = wordsOf2(prompt2);
|
|
89213
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
89214
|
+
for (const file2 of task.testFiles) {
|
|
89215
|
+
const source = await show(task.targetSha, file2);
|
|
89216
|
+
if (source === null) continue;
|
|
89217
|
+
for (const key of testKeysOf(source, file2))
|
|
89218
|
+
if (!shown.has(key)) candidates.add(key);
|
|
89219
|
+
}
|
|
89220
|
+
const asked = [...candidates].sort().slice(0, MAX_GAP_CANDIDATES);
|
|
89221
|
+
if (!asked.length) return [];
|
|
89222
|
+
const found = await grep(task.baseSha, asked);
|
|
89223
|
+
return asked.filter((n) => !found.has(n)).slice(0, MAX_GAPS);
|
|
89224
|
+
}
|
|
89225
|
+
function gitGrepNames(run3) {
|
|
89226
|
+
return async (sha, names) => {
|
|
89227
|
+
const found = /* @__PURE__ */ new Set();
|
|
89228
|
+
for (const name of names) {
|
|
89229
|
+
const res = await run3([
|
|
89230
|
+
"grep",
|
|
89231
|
+
"-q",
|
|
89232
|
+
"-w",
|
|
89233
|
+
"-I",
|
|
89234
|
+
"-F",
|
|
89235
|
+
"-e",
|
|
89236
|
+
name,
|
|
89237
|
+
sha,
|
|
89238
|
+
"--"
|
|
89239
|
+
]).catch(() => null);
|
|
89240
|
+
if (!res || res.code !== 1) found.add(name);
|
|
89241
|
+
}
|
|
89242
|
+
return found;
|
|
89243
|
+
};
|
|
89244
|
+
}
|
|
89245
|
+
var MAX_GAP_CANDIDATES, MAX_GAPS, IDENT3;
|
|
89246
|
+
var init_replay_spec_gaps = __esm({
|
|
89247
|
+
"src/commands/replay-spec-gaps.ts"() {
|
|
89248
|
+
"use strict";
|
|
89249
|
+
init_replay_lang();
|
|
89250
|
+
MAX_GAP_CANDIDATES = 200;
|
|
89251
|
+
MAX_GAPS = 20;
|
|
89252
|
+
IDENT3 = String.raw`[A-Za-z_][A-Za-z0-9_]*`;
|
|
89253
|
+
}
|
|
89254
|
+
});
|
|
89255
|
+
|
|
89189
89256
|
// src/commands/replay-interface.ts
|
|
89190
89257
|
async function firstAt(show, sha, paths) {
|
|
89191
89258
|
for (const path2 of paths) {
|
|
@@ -90145,6 +90212,19 @@ async function runStoredReplays(options, deps) {
|
|
|
90145
90212
|
targetSha: task.targetSha,
|
|
90146
90213
|
testFiles: task.testFiles
|
|
90147
90214
|
}).catch(() => []);
|
|
90215
|
+
if (!named.length && task.baseSha && task.targetSha)
|
|
90216
|
+
task.specGaps = await specGapsOf(
|
|
90217
|
+
deps.showFile,
|
|
90218
|
+
gitGrepNames(
|
|
90219
|
+
(args) => (deps.gitStdout ?? deps.git)(args, deps.repoDir)
|
|
90220
|
+
),
|
|
90221
|
+
{
|
|
90222
|
+
baseSha: task.baseSha,
|
|
90223
|
+
targetSha: task.targetSha,
|
|
90224
|
+
testFiles: task.testFiles
|
|
90225
|
+
},
|
|
90226
|
+
cardPrompt(task, null)
|
|
90227
|
+
).catch(() => []);
|
|
90148
90228
|
if (named.length && task.baseSha)
|
|
90149
90229
|
task.failingPaths = await failingPathsOf(
|
|
90150
90230
|
deps.showFile,
|
|
@@ -90237,6 +90317,10 @@ async function runStoredReplays(options, deps) {
|
|
|
90237
90317
|
deps.log(
|
|
90238
90318
|
`\u2026 ${label}: the tests use ${task.testInterface.length} module(s) the start lacks; named in the prompt`
|
|
90239
90319
|
);
|
|
90320
|
+
if (task.specGaps?.length)
|
|
90321
|
+
deps.log(
|
|
90322
|
+
`\u2026 ${label}: the tests rely on ${task.specGaps.length} name(s) the prompt and the start never have: ${task.specGaps.join(", ")}`
|
|
90323
|
+
);
|
|
90240
90324
|
let targetSent = false;
|
|
90241
90325
|
let baselineChange = null;
|
|
90242
90326
|
for (const arm of arms) {
|
|
@@ -90404,7 +90488,8 @@ async function runStoredReplays(options, deps) {
|
|
|
90404
90488
|
configFingerprint,
|
|
90405
90489
|
errors: options.noDiffs ? null : r.errors ?? [],
|
|
90406
90490
|
testCounts: r.testCounts ?? [],
|
|
90407
|
-
usage: r.usage ?? []
|
|
90491
|
+
usage: r.usage ?? [],
|
|
90492
|
+
specGaps: task.specGaps ? task.specGaps.length : null
|
|
90408
90493
|
});
|
|
90409
90494
|
if (sendTarget) targetSent = true;
|
|
90410
90495
|
deps.log(
|
|
@@ -90461,6 +90546,7 @@ var init_replay_tasks = __esm({
|
|
|
90461
90546
|
init_replay();
|
|
90462
90547
|
init_replay_scale();
|
|
90463
90548
|
init_replay_codex();
|
|
90549
|
+
init_replay_spec_gaps();
|
|
90464
90550
|
init_replay_interface();
|
|
90465
90551
|
init_replay_spec();
|
|
90466
90552
|
init_replay_context();
|
|
@@ -90478,7 +90564,7 @@ var init_replay_tasks = __esm({
|
|
|
90478
90564
|
"bug-fix": "For a failing test, search with its name and the error line, and ask get_prior_attempts with the failing test files and the files they import.",
|
|
90479
90565
|
feature: "Ask with the modules and names under 'What the tests use'."
|
|
90480
90566
|
};
|
|
90481
|
-
FEATURE_MIN_FILE_RECALL = 0.
|
|
90567
|
+
FEATURE_MIN_FILE_RECALL = 0.4;
|
|
90482
90568
|
share2 = (part, whole) => whole === 0 ? null : Math.round(part / whole * 1e3) / 1e3;
|
|
90483
90569
|
pct = (v) => v === null ? "n/a" : `${Math.round(v * 100)}%`;
|
|
90484
90570
|
}
|