@hiveai/cli 0.13.8 → 0.13.9
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 +59 -18
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3019,7 +3019,7 @@ ${SEED_FOOTER(stack)}` });
|
|
|
3019
3019
|
}
|
|
3020
3020
|
|
|
3021
3021
|
// src/commands/init.ts
|
|
3022
|
-
var HAIVE_GITHUB_ACTION_REF = `v${"0.13.
|
|
3022
|
+
var HAIVE_GITHUB_ACTION_REF = `v${"0.13.9"}`;
|
|
3023
3023
|
var PROJECT_CONTEXT_TEMPLATE = `# Project context
|
|
3024
3024
|
|
|
3025
3025
|
> Generated by \`haive init\`. Run \`haive init --bootstrap\` to auto-fill from your codebase,
|
|
@@ -4133,6 +4133,7 @@ import { z as z25 } from "zod";
|
|
|
4133
4133
|
import { existsSync as existsSync25 } from "fs";
|
|
4134
4134
|
import {
|
|
4135
4135
|
addedLinesFromDiff,
|
|
4136
|
+
appendPreventionEvent,
|
|
4136
4137
|
buildDocFrequency,
|
|
4137
4138
|
CODE_STOPWORDS,
|
|
4138
4139
|
deriveConfidence as deriveConfidence6,
|
|
@@ -4143,7 +4144,9 @@ import {
|
|
|
4143
4144
|
loadUsageIndex as loadUsageIndex10,
|
|
4144
4145
|
literalMatchesAnyToken as literalMatchesAnyToken3,
|
|
4145
4146
|
memoryMatchesAnchorPaths as memoryMatchesAnchorPaths4,
|
|
4147
|
+
recordPrevention,
|
|
4146
4148
|
runSensors,
|
|
4149
|
+
saveUsageIndex as saveUsageIndex4,
|
|
4147
4150
|
sensorTargetsFromDiff,
|
|
4148
4151
|
tokenizeQuery as tokenizeQuery3
|
|
4149
4152
|
} from "@hiveai/core";
|
|
@@ -6669,6 +6672,22 @@ async function antiPatternsCheck(input, ctx) {
|
|
|
6669
6672
|
};
|
|
6670
6673
|
return score(b) - score(a);
|
|
6671
6674
|
}).slice(0, input.limit);
|
|
6675
|
+
const strongCatches = warnings.filter(
|
|
6676
|
+
(w) => w.reasons.includes("sensor") || w.distinctive_literal === true || w.reasons.includes("anchor") && w.reasons.includes("literal")
|
|
6677
|
+
);
|
|
6678
|
+
if (strongCatches.length > 0) {
|
|
6679
|
+
const recordedIds = [];
|
|
6680
|
+
for (const w of strongCatches) if (recordPrevention(usage, w.id)) recordedIds.push(w.id);
|
|
6681
|
+
if (recordedIds.length > 0) {
|
|
6682
|
+
await saveUsageIndex4(ctx.paths, usage).catch(() => {
|
|
6683
|
+
});
|
|
6684
|
+
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
6685
|
+
for (const id of recordedIds) {
|
|
6686
|
+
await appendPreventionEvent(ctx.paths, { at, id, source: "anti-pattern" }).catch(() => {
|
|
6687
|
+
});
|
|
6688
|
+
}
|
|
6689
|
+
}
|
|
6690
|
+
}
|
|
6672
6691
|
return {
|
|
6673
6692
|
scanned: negative.length,
|
|
6674
6693
|
warnings
|
|
@@ -7919,7 +7938,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
7919
7938
|
};
|
|
7920
7939
|
}
|
|
7921
7940
|
var SERVER_NAME = "haive";
|
|
7922
|
-
var SERVER_VERSION = "0.13.
|
|
7941
|
+
var SERVER_VERSION = "0.13.9";
|
|
7923
7942
|
function jsonResult(data) {
|
|
7924
7943
|
return {
|
|
7925
7944
|
content: [
|
|
@@ -10688,7 +10707,7 @@ import {
|
|
|
10688
10707
|
loadUsageIndex as loadUsageIndex18,
|
|
10689
10708
|
recordRejection as recordRejection3,
|
|
10690
10709
|
resolveHaivePaths as resolveHaivePaths23,
|
|
10691
|
-
saveUsageIndex as
|
|
10710
|
+
saveUsageIndex as saveUsageIndex5,
|
|
10692
10711
|
serializeMemory as serializeMemory19
|
|
10693
10712
|
} from "@hiveai/core";
|
|
10694
10713
|
function registerMemoryReject(memory2) {
|
|
@@ -10721,7 +10740,7 @@ function registerMemoryReject(memory2) {
|
|
|
10721
10740
|
);
|
|
10722
10741
|
const idx = await loadUsageIndex18(paths);
|
|
10723
10742
|
recordRejection3(idx, id, opts.reason ?? null);
|
|
10724
|
-
await
|
|
10743
|
+
await saveUsageIndex5(paths, idx);
|
|
10725
10744
|
const u = idx.by_id[id];
|
|
10726
10745
|
ui.success(
|
|
10727
10746
|
`Rejected ${id} (status=rejected, ${u.rejected_count} rejection${u.rejected_count === 1 ? "" : "s"})`
|
|
@@ -10740,7 +10759,7 @@ import {
|
|
|
10740
10759
|
findProjectRoot as findProjectRoot27,
|
|
10741
10760
|
loadUsageIndex as loadUsageIndex19,
|
|
10742
10761
|
resolveHaivePaths as resolveHaivePaths24,
|
|
10743
|
-
saveUsageIndex as
|
|
10762
|
+
saveUsageIndex as saveUsageIndex6
|
|
10744
10763
|
} from "@hiveai/core";
|
|
10745
10764
|
function registerMemoryRm(memory2) {
|
|
10746
10765
|
memory2.command("delete <id>").alias("rm").description("Delete a memory file (and its usage entry by default). Mirrors MCP mem_delete. Alias: rm").option("-y, --yes", "skip the confirmation prompt").option("--keep-usage", "do not remove the usage.json entry").option("-d, --dir <dir>", "project root").action(async (id, opts) => {
|
|
@@ -10774,7 +10793,7 @@ function registerMemoryRm(memory2) {
|
|
|
10774
10793
|
const idx = await loadUsageIndex19(paths);
|
|
10775
10794
|
if (idx.by_id[id]) {
|
|
10776
10795
|
delete idx.by_id[id];
|
|
10777
|
-
await
|
|
10796
|
+
await saveUsageIndex6(paths, idx);
|
|
10778
10797
|
ui.info("Removed usage entry");
|
|
10779
10798
|
}
|
|
10780
10799
|
}
|
|
@@ -10984,7 +11003,7 @@ import {
|
|
|
10984
11003
|
recordApplied as recordApplied2,
|
|
10985
11004
|
recordRejection as recordRejection4,
|
|
10986
11005
|
resolveHaivePaths as resolveHaivePaths28,
|
|
10987
|
-
saveUsageIndex as
|
|
11006
|
+
saveUsageIndex as saveUsageIndex7
|
|
10988
11007
|
} from "@hiveai/core";
|
|
10989
11008
|
function registerMemoryFeedback(memory2) {
|
|
10990
11009
|
memory2.command("feedback <id>").description(
|
|
@@ -11013,7 +11032,7 @@ function registerMemoryFeedback(memory2) {
|
|
|
11013
11032
|
const outcome = opts.applied ? "applied" : "rejected";
|
|
11014
11033
|
if (opts.applied) recordApplied2(index, id);
|
|
11015
11034
|
else recordRejection4(index, id, opts.reason ?? null);
|
|
11016
|
-
await
|
|
11035
|
+
await saveUsageIndex7(paths, index);
|
|
11017
11036
|
const usage = getUsage19(index, id);
|
|
11018
11037
|
const impact = computeImpact4(target.memory.frontmatter, usage);
|
|
11019
11038
|
if (opts.json) {
|
|
@@ -13488,7 +13507,7 @@ function registerDoctor(program2) {
|
|
|
13488
13507
|
fix: "Edit .ai/haive.config.json: set autoSessionEnd: true (or re-run `haive init` without --manual)."
|
|
13489
13508
|
});
|
|
13490
13509
|
}
|
|
13491
|
-
findings.push(...await collectInstallFindings(root, "0.13.
|
|
13510
|
+
findings.push(...await collectInstallFindings(root, "0.13.9"));
|
|
13492
13511
|
findings.push(...await collectToolchainFindings(root));
|
|
13493
13512
|
try {
|
|
13494
13513
|
const legacyRaw = execSync3("haive-mcp --version", {
|
|
@@ -13496,7 +13515,7 @@ function registerDoctor(program2) {
|
|
|
13496
13515
|
timeout: 3e3,
|
|
13497
13516
|
stdio: ["ignore", "pipe", "ignore"]
|
|
13498
13517
|
}).trim();
|
|
13499
|
-
const cliVersion = "0.13.
|
|
13518
|
+
const cliVersion = "0.13.9";
|
|
13500
13519
|
if (legacyRaw && legacyRaw !== cliVersion) {
|
|
13501
13520
|
findings.push({
|
|
13502
13521
|
severity: "warn",
|
|
@@ -15105,7 +15124,7 @@ async function buildEnforcementReport(dir, stage, sessionId) {
|
|
|
15105
15124
|
findings: [{ severity: "info", code: "enforcement-off", message: "hAIve enforcement is disabled." }]
|
|
15106
15125
|
});
|
|
15107
15126
|
}
|
|
15108
|
-
findings.push(...await inspectIntegrationVersions(root, "0.13.
|
|
15127
|
+
findings.push(...await inspectIntegrationVersions(root, "0.13.9"));
|
|
15109
15128
|
if (config.enforcement?.requireBriefingFirst !== false && stage !== "ci") {
|
|
15110
15129
|
const hasBriefing = await hasRecentBriefingMarker2(paths, sessionId);
|
|
15111
15130
|
findings.push(hasBriefing ? { severity: "ok", code: "briefing-loaded", message: "A recent hAIve briefing marker exists." } : {
|
|
@@ -16096,14 +16115,15 @@ import path53 from "path";
|
|
|
16096
16115
|
import { promisify as promisify2 } from "util";
|
|
16097
16116
|
import "commander";
|
|
16098
16117
|
import {
|
|
16118
|
+
appendPreventionEvent as appendPreventionEvent2,
|
|
16099
16119
|
findProjectRoot as findProjectRoot53,
|
|
16100
16120
|
isRetiredMemory as isRetiredMemory3,
|
|
16101
16121
|
loadMemoriesFromDir as loadMemoriesFromDir39,
|
|
16102
16122
|
loadUsageIndex as loadUsageIndex29,
|
|
16103
|
-
recordPrevention,
|
|
16123
|
+
recordPrevention as recordPrevention2,
|
|
16104
16124
|
resolveHaivePaths as resolveHaivePaths49,
|
|
16105
16125
|
runSensors as runSensors2,
|
|
16106
|
-
saveUsageIndex as
|
|
16126
|
+
saveUsageIndex as saveUsageIndex8,
|
|
16107
16127
|
sensorTargetsFromDiff as sensorTargetsFromDiff2,
|
|
16108
16128
|
serializeMemory as serializeMemory27
|
|
16109
16129
|
} from "@hiveai/core";
|
|
@@ -16141,10 +16161,17 @@ function registerSensors(program2) {
|
|
|
16141
16161
|
const firedIds = [...new Set(hits.map((hit) => hit.memory_id))];
|
|
16142
16162
|
if (firedIds.length > 0) {
|
|
16143
16163
|
const usage = await loadUsageIndex29(paths);
|
|
16144
|
-
|
|
16145
|
-
for (const id of firedIds) if (
|
|
16146
|
-
if (
|
|
16147
|
-
|
|
16164
|
+
const recordedIds = [];
|
|
16165
|
+
for (const id of firedIds) if (recordPrevention2(usage, id)) recordedIds.push(id);
|
|
16166
|
+
if (recordedIds.length > 0) {
|
|
16167
|
+
await saveUsageIndex8(paths, usage).catch(() => {
|
|
16168
|
+
});
|
|
16169
|
+
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
16170
|
+
for (const id of recordedIds) {
|
|
16171
|
+
await appendPreventionEvent2(paths, { at, id, source: "sensor" }).catch(() => {
|
|
16172
|
+
});
|
|
16173
|
+
}
|
|
16174
|
+
}
|
|
16148
16175
|
}
|
|
16149
16176
|
const output = {
|
|
16150
16177
|
scanned: memories.length,
|
|
@@ -16489,6 +16516,7 @@ import {
|
|
|
16489
16516
|
buildDashboard,
|
|
16490
16517
|
findProjectRoot as findProjectRoot55,
|
|
16491
16518
|
loadMemoriesFromDir as loadMemoriesFromDir41,
|
|
16519
|
+
loadPreventionEvents,
|
|
16492
16520
|
loadUsageIndex as loadUsageIndex30,
|
|
16493
16521
|
resolveHaivePaths as resolveHaivePaths51
|
|
16494
16522
|
} from "@hiveai/core";
|
|
@@ -16505,10 +16533,12 @@ function registerDashboard(program2) {
|
|
|
16505
16533
|
}
|
|
16506
16534
|
const memories = existsSync78(paths.memoriesDir) ? await loadMemoriesFromDir41(paths.memoriesDir) : [];
|
|
16507
16535
|
const usage = await loadUsageIndex30(paths);
|
|
16536
|
+
const preventionEvents = await loadPreventionEvents(paths);
|
|
16508
16537
|
const top = Math.max(1, Number.parseInt(opts.top ?? "10", 10) || 10);
|
|
16509
16538
|
const dormantDays = opts.dormantDays ? Number.parseInt(opts.dormantDays, 10) : void 0;
|
|
16510
16539
|
const report = buildDashboard(memories, usage, {
|
|
16511
16540
|
top,
|
|
16541
|
+
preventionEvents,
|
|
16512
16542
|
...dormantDays !== void 0 && Number.isFinite(dormantDays) ? { dormantDays } : {}
|
|
16513
16543
|
});
|
|
16514
16544
|
if (opts.json) {
|
|
@@ -16553,11 +16583,22 @@ function renderDashboard(r) {
|
|
|
16553
16583
|
console.log(
|
|
16554
16584
|
` ${prevention.total_events > 0 ? ui.green(`${prevention.total_events} catch event(s)`) : "0 catch events"} \xB7 ${prevention.memories_with_catches} memor${prevention.memories_with_catches === 1 ? "y" : "ies"} with catches`
|
|
16555
16585
|
);
|
|
16586
|
+
console.log(
|
|
16587
|
+
` ${ui.dim("trend:")} ${prevention.trend.last_7d} in 7d \xB7 ${prevention.trend.last_30d} in 30d ${ui.dim("weekly")} [${prevention.trend.weekly.join(" ")}]`
|
|
16588
|
+
);
|
|
16556
16589
|
for (const p of prevention.top.slice(0, 5)) {
|
|
16557
16590
|
console.log(
|
|
16558
16591
|
` ${ui.green("\u2713")} ${p.prevented_count}\xD7 ${p.id}` + (p.last_prevented_at ? ui.dim(` last ${p.last_prevented_at.slice(0, 10)}`) : "")
|
|
16559
16592
|
);
|
|
16560
16593
|
}
|
|
16594
|
+
if (prevention.recurrence.recurring_count > 0) {
|
|
16595
|
+
console.log(
|
|
16596
|
+
` ${ui.yellow("recurrence:")} ${prevention.recurrence.recurring_count} lesson(s) re-introduced after capture ` + ui.dim("(caught on \u22652 distinct days)")
|
|
16597
|
+
);
|
|
16598
|
+
for (const r2 of prevention.recurrence.top.slice(0, 5)) {
|
|
16599
|
+
console.log(` ${ui.yellow("\u21BB")} ${r2.distinct_days} days \xB7 ${r2.catches}\xD7 ${r2.id}`);
|
|
16600
|
+
}
|
|
16601
|
+
}
|
|
16561
16602
|
console.log();
|
|
16562
16603
|
console.log(ui.bold("Health"));
|
|
16563
16604
|
console.log(
|
|
@@ -16595,7 +16636,7 @@ function warnNum(n) {
|
|
|
16595
16636
|
|
|
16596
16637
|
// src/index.ts
|
|
16597
16638
|
var program = new Command58();
|
|
16598
|
-
program.name("haive").description("hAIve - repo-native memory and context policy for coding-agent harnesses").version("0.13.
|
|
16639
|
+
program.name("haive").description("hAIve - repo-native memory and context policy for coding-agent harnesses").version("0.13.9").option("--advanced", "show maintenance and experimental commands in help");
|
|
16599
16640
|
registerInit(program);
|
|
16600
16641
|
registerWelcome(program);
|
|
16601
16642
|
registerResolveProject(program);
|