@hiveai/cli 0.13.1 → 0.13.5
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 +52 -28
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3012,7 +3012,7 @@ ${SEED_FOOTER(stack)}` });
|
|
|
3012
3012
|
}
|
|
3013
3013
|
|
|
3014
3014
|
// src/commands/init.ts
|
|
3015
|
-
var HAIVE_GITHUB_ACTION_REF = `v${"0.13.
|
|
3015
|
+
var HAIVE_GITHUB_ACTION_REF = `v${"0.13.5"}`;
|
|
3016
3016
|
var PROJECT_CONTEXT_TEMPLATE = `# Project context
|
|
3017
3017
|
|
|
3018
3018
|
> Generated by \`haive init\`. Run \`haive init --bootstrap\` to auto-fill from your codebase,
|
|
@@ -3749,7 +3749,7 @@ async function installClaudeHooks(opts) {
|
|
|
3749
3749
|
}
|
|
3750
3750
|
function registerInstallHooks(program2) {
|
|
3751
3751
|
program2.command("install-hooks [target]").description(
|
|
3752
|
-
"Install hAIve hooks. Targets:\n\n git (default) post-merge / post-rewrite / pre-push for haive sync + precommit\n claude SessionStart + PreToolUse + PostToolUse + SessionEnd hooks\n for briefing injection, pre-edit blocking, and capture (Claude Code only)\n\n Examples:\n haive install-hooks # git hooks (legacy default)\n haive install-hooks git\n haive install-hooks claude\n haive install-hooks claude --scope project\n haive install-hooks claude --uninstall\n"
|
|
3752
|
+
"Install hAIve hooks (same effect as `haive enforce install`, kept for back-compat). Targets:\n\n git (default) post-merge / post-rewrite / pre-push for haive sync + precommit\n claude SessionStart + PreToolUse + PostToolUse + SessionEnd hooks\n for briefing injection, pre-edit blocking, and capture (Claude Code only)\n\n Examples:\n haive install-hooks # git hooks (legacy default)\n haive install-hooks git\n haive install-hooks claude\n haive install-hooks claude --scope project\n haive install-hooks claude --uninstall\n"
|
|
3753
3753
|
).option("-d, --dir <dir>", "project root").option("--force", "overwrite existing hooks (git target only)").option("--scope <scope>", "claude target: 'user' (~/.claude) or 'project' (.claude/)", "user").option("--uninstall", "remove previously installed hAIve hooks (claude target only)").option("--settings <path>", "explicit path to settings.json (claude target only)").action(async (target, opts) => {
|
|
3754
3754
|
const t = (target ?? "git").toLowerCase();
|
|
3755
3755
|
if (t === "git") {
|
|
@@ -7912,7 +7912,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
|
|
|
7912
7912
|
};
|
|
7913
7913
|
}
|
|
7914
7914
|
var SERVER_NAME = "haive";
|
|
7915
|
-
var SERVER_VERSION = "0.13.
|
|
7915
|
+
var SERVER_VERSION = "0.13.5";
|
|
7916
7916
|
function jsonResult(data) {
|
|
7917
7917
|
return {
|
|
7918
7918
|
content: [
|
|
@@ -9308,7 +9308,7 @@ Attends une **confirmation explicite** avant d'agir.
|
|
|
9308
9308
|
|
|
9309
9309
|
**Prochaines \xE9tapes (si confirm\xE9) :**
|
|
9310
9310
|
- Rechercher les usages : \`haive memory for-files <fichiers concern\xE9s>\`
|
|
9311
|
-
- V\xE9rifier les m\xE9moires li\xE9es : \`haive memory
|
|
9311
|
+
- V\xE9rifier les m\xE9moires li\xE9es : \`haive memory search ${diff.contract}\``;
|
|
9312
9312
|
const fm = buildFrontmatter6({
|
|
9313
9313
|
type: "gotcha",
|
|
9314
9314
|
slug,
|
|
@@ -9505,8 +9505,8 @@ import {
|
|
|
9505
9505
|
suggestSensorFromMemory as suggestSensorFromMemory3
|
|
9506
9506
|
} from "@hiveai/core";
|
|
9507
9507
|
function registerMemoryAdd(memory2) {
|
|
9508
|
-
memory2.command("add").description(
|
|
9509
|
-
`Save a piece of knowledge as a persistent memory.
|
|
9508
|
+
memory2.command("save").alias("add").description(
|
|
9509
|
+
`Save a piece of knowledge as a persistent memory. Mirrors MCP mem_save. Alias: add.
|
|
9510
9510
|
|
|
9511
9511
|
Memory types:
|
|
9512
9512
|
skill \u2014 reusable procedure/playbook agents follow for a recurring task (e.g. deploy, review)
|
|
@@ -10555,7 +10555,7 @@ function registerMemoryPending(memory2) {
|
|
|
10555
10555
|
const pending = all.filter(filterFn);
|
|
10556
10556
|
if (pending.length === 0) {
|
|
10557
10557
|
ui.info("No draft or proposed memories awaiting review.");
|
|
10558
|
-
ui.info("Drafts are created by `haive memory
|
|
10558
|
+
ui.info("Drafts are created by `haive memory save` without `--status validated`.");
|
|
10559
10559
|
return;
|
|
10560
10560
|
}
|
|
10561
10561
|
pending.sort(
|
|
@@ -10612,7 +10612,7 @@ import {
|
|
|
10612
10612
|
trackReads as trackReads4
|
|
10613
10613
|
} from "@hiveai/core";
|
|
10614
10614
|
function registerMemoryQuery(memory2) {
|
|
10615
|
-
memory2.command("
|
|
10615
|
+
memory2.command("search <text>").alias("query").description("Search memories by id, tag, or substring (AND, OR fallback). Mirrors MCP mem_search. Alias: query").option("-d, --dir <dir>", "project root").option("--limit <n>", "max results", "20").option("--scope <scope>", "personal | team | module").option("--status <csv>", "filter by status (draft,proposed,validated,stale,rejected)").option("--show-rejected", "include rejected memories (hidden by default)").action(async (text, opts) => {
|
|
10616
10616
|
const root = findProjectRoot25(opts.dir);
|
|
10617
10617
|
const paths = resolveHaivePaths22(root);
|
|
10618
10618
|
if (!existsSync47(paths.memoriesDir)) {
|
|
@@ -10736,7 +10736,7 @@ import {
|
|
|
10736
10736
|
saveUsageIndex as saveUsageIndex5
|
|
10737
10737
|
} from "@hiveai/core";
|
|
10738
10738
|
function registerMemoryRm(memory2) {
|
|
10739
|
-
memory2.command("
|
|
10739
|
+
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) => {
|
|
10740
10740
|
const root = findProjectRoot27(opts.dir);
|
|
10741
10741
|
const paths = resolveHaivePaths24(root);
|
|
10742
10742
|
if (!existsSync49(paths.memoriesDir)) {
|
|
@@ -10787,7 +10787,7 @@ import {
|
|
|
10787
10787
|
resolveHaivePaths as resolveHaivePaths25
|
|
10788
10788
|
} from "@hiveai/core";
|
|
10789
10789
|
function registerMemoryShow(memory2) {
|
|
10790
|
-
memory2.command("
|
|
10790
|
+
memory2.command("get <id>").alias("show").description("Print a memory's frontmatter, body, and confidence/usage. Mirrors MCP mem_get. Alias: show").option("--raw", "print the raw file contents instead of a summary").option("-d, --dir <dir>", "project root").action(async (id, opts) => {
|
|
10791
10791
|
const root = findProjectRoot28(opts.dir);
|
|
10792
10792
|
const paths = resolveHaivePaths25(root);
|
|
10793
10793
|
if (!existsSync50(paths.memoriesDir)) {
|
|
@@ -12355,7 +12355,7 @@ async function renderMemoryHits(paths, opts) {
|
|
|
12355
12355
|
console.log(ui.bold(`Memory hits (${window})`));
|
|
12356
12356
|
if (entries.length === 0) {
|
|
12357
12357
|
ui.info(
|
|
12358
|
-
`No memory reads recorded in window. Reads are logged when \`haive briefing\` or \`haive memory
|
|
12358
|
+
`No memory reads recorded in window. Reads are logged when \`haive briefing\` or \`haive memory search\` surface a memory.`
|
|
12359
12359
|
);
|
|
12360
12360
|
return;
|
|
12361
12361
|
}
|
|
@@ -12388,7 +12388,7 @@ import {
|
|
|
12388
12388
|
resolveHaivePaths as resolveHaivePaths37
|
|
12389
12389
|
} from "@hiveai/core";
|
|
12390
12390
|
function registerBench(program2) {
|
|
12391
|
-
program2.command("bench").description("Self-test the
|
|
12391
|
+
program2.command("selftest").alias("bench").description("Self-test the LOCAL hAIve install: runs core MCP tools against this project and reports latency + payload size. Different from `benchmark` (which measures hAIve-vs-plain agent value). Alias: bench").option("-t, --task <task>", "task description for ranking-aware tools", "audit dependencies for security risks").option("--json", "emit JSON instead of a table", false).option("-d, --dir <dir>", "project root").action(async (opts) => {
|
|
12392
12392
|
const root = findProjectRoot40(opts.dir);
|
|
12393
12393
|
const paths = resolveHaivePaths37(root);
|
|
12394
12394
|
const ctx = { paths };
|
|
@@ -12515,7 +12515,7 @@ import path41 from "path";
|
|
|
12515
12515
|
import "commander";
|
|
12516
12516
|
import { estimateTokens as estimateTokens4, findProjectRoot as findProjectRoot41 } from "@hiveai/core";
|
|
12517
12517
|
function registerBenchmark(program2) {
|
|
12518
|
-
const benchmark = program2.command("benchmark").description("
|
|
12518
|
+
const benchmark = program2.command("benchmark").description("Measure hAIve's VALUE: paired hAIve-vs-plain agent runs (correctness, tokens, tools). Different from `selftest` (which only checks local install latency).");
|
|
12519
12519
|
benchmark.command("report").description("Summarize BENCHMARK_AGENT_REPORT.md files from a paired hAIve/plain agent benchmark.").option("-d, --dir <dir>", "benchmark root", "benchmarks/agent-benchmark").option("--out <file>", "write a Markdown report").option("--json", "emit JSON", false).action(async (opts) => {
|
|
12520
12520
|
const root = resolveBenchmarkRoot(opts.dir);
|
|
12521
12521
|
const rows = await collectRows(root);
|
|
@@ -13344,7 +13344,7 @@ function registerDoctor(program2) {
|
|
|
13344
13344
|
severity: "warn",
|
|
13345
13345
|
code: "stale-draft-memories",
|
|
13346
13346
|
message: `${oldDrafts.length} draft memor${oldDrafts.length === 1 ? "y has" : "ies have"} been in draft status for 30+ days: ${ids}${more}`,
|
|
13347
|
-
fix: "haive memory approve <id> # activate\nhaive memory
|
|
13347
|
+
fix: "haive memory approve <id> # activate\nhaive memory delete <id> # or delete if obsolete"
|
|
13348
13348
|
});
|
|
13349
13349
|
}
|
|
13350
13350
|
const policyMemories = memories.filter((m) => !isStackPackSeed4(m.memory.frontmatter));
|
|
@@ -13481,7 +13481,7 @@ function registerDoctor(program2) {
|
|
|
13481
13481
|
fix: "Edit .ai/haive.config.json: set autoSessionEnd: true (or re-run `haive init` without --manual)."
|
|
13482
13482
|
});
|
|
13483
13483
|
}
|
|
13484
|
-
findings.push(...await collectInstallFindings(root, "0.13.
|
|
13484
|
+
findings.push(...await collectInstallFindings(root, "0.13.5"));
|
|
13485
13485
|
findings.push(...await collectToolchainFindings(root));
|
|
13486
13486
|
try {
|
|
13487
13487
|
const legacyRaw = execSync3("haive-mcp --version", {
|
|
@@ -13489,7 +13489,7 @@ function registerDoctor(program2) {
|
|
|
13489
13489
|
timeout: 3e3,
|
|
13490
13490
|
stdio: ["ignore", "pipe", "ignore"]
|
|
13491
13491
|
}).trim();
|
|
13492
|
-
const cliVersion = "0.13.
|
|
13492
|
+
const cliVersion = "0.13.5";
|
|
13493
13493
|
if (legacyRaw && legacyRaw !== cliVersion) {
|
|
13494
13494
|
findings.push({
|
|
13495
13495
|
severity: "warn",
|
|
@@ -13705,7 +13705,7 @@ async function collectHarnessCoverageFindings(codeMap, memories) {
|
|
|
13705
13705
|
code: "harness-coverage",
|
|
13706
13706
|
coverage_percent: pct2,
|
|
13707
13707
|
message: `${covered}/${total} code-map files have validated memory anchors (${pct2}%). ` + coverageDesc + uncoveredHint,
|
|
13708
|
-
fix: pct2 < 50 && total > 10 ? `haive memory
|
|
13708
|
+
fix: pct2 < 50 && total > 10 ? `haive memory save --type gotcha|convention|architecture --paths <key-file> --scope team` : void 0,
|
|
13709
13709
|
section: "Harness coverage"
|
|
13710
13710
|
});
|
|
13711
13711
|
return findings;
|
|
@@ -14166,7 +14166,7 @@ import {
|
|
|
14166
14166
|
} from "@hiveai/core";
|
|
14167
14167
|
function registerPrecommit(program2) {
|
|
14168
14168
|
program2.command("precommit").description(
|
|
14169
|
-
"Run a pre-commit safety check
|
|
14169
|
+
"Run a pre-commit safety check (manual variant of `haive enforce check --stage pre-commit`):\n 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"
|
|
14170
14170
|
).option(
|
|
14171
14171
|
"--block-on <mode>",
|
|
14172
14172
|
"'any' | 'high-confidence' | 'never' (report only). Default: derived from enforcement.antiPatternGate."
|
|
@@ -14356,7 +14356,7 @@ function registerWelcome(program2) {
|
|
|
14356
14356
|
console.log(ui.bold(`hAIve welcome \u2014 ${pick.length} team memories (${root})`));
|
|
14357
14357
|
console.log(ui.dim(`Next: invoke get_briefing with your task or run 'haive briefing --task "\u2026"'`));
|
|
14358
14358
|
if (pick.length === 0) {
|
|
14359
|
-
ui.warn("No team memories yet \u2014 add some with 'haive memory
|
|
14359
|
+
ui.warn("No team memories yet \u2014 add some with 'haive memory save' or promote personal ones.");
|
|
14360
14360
|
return;
|
|
14361
14361
|
}
|
|
14362
14362
|
let i = 1;
|
|
@@ -15053,7 +15053,10 @@ async function buildEnforcementReport(dir, stage, sessionId) {
|
|
|
15053
15053
|
const paths = resolveHaivePaths48(root);
|
|
15054
15054
|
const initialized = existsSync75(paths.haiveDir);
|
|
15055
15055
|
const config = initialized ? await loadConfig13(paths) : {};
|
|
15056
|
-
if (initialized)
|
|
15056
|
+
if (initialized) {
|
|
15057
|
+
await applyLightweightRepairs(root, paths);
|
|
15058
|
+
if (stage === "pre-commit") await stageResyncedArtifacts(root, paths);
|
|
15059
|
+
}
|
|
15057
15060
|
const mode = config.enforcement?.mode ?? "strict";
|
|
15058
15061
|
const findings = [];
|
|
15059
15062
|
if (!initialized) {
|
|
@@ -15082,7 +15085,7 @@ async function buildEnforcementReport(dir, stage, sessionId) {
|
|
|
15082
15085
|
findings: [{ severity: "info", code: "enforcement-off", message: "hAIve enforcement is disabled." }]
|
|
15083
15086
|
});
|
|
15084
15087
|
}
|
|
15085
|
-
findings.push(...await inspectIntegrationVersions(root, "0.13.
|
|
15088
|
+
findings.push(...await inspectIntegrationVersions(root, "0.13.5"));
|
|
15086
15089
|
if (config.enforcement?.requireBriefingFirst !== false && stage !== "ci") {
|
|
15087
15090
|
const hasBriefing = await hasRecentBriefingMarker2(paths, sessionId);
|
|
15088
15091
|
findings.push(hasBriefing ? { severity: "ok", code: "briefing-loaded", message: "A recent hAIve briefing marker exists." } : {
|
|
@@ -15971,6 +15974,15 @@ async function readStdin2(maxBytes) {
|
|
|
15971
15974
|
setTimeout(finish, 2e3);
|
|
15972
15975
|
});
|
|
15973
15976
|
}
|
|
15977
|
+
async function stageResyncedArtifacts(root, paths) {
|
|
15978
|
+
const rel = path51.relative(root, paths.projectContext);
|
|
15979
|
+
const tracked = await runCommand4("git", ["ls-files", "--error-unmatch", "--", rel], root).then(() => true).catch(() => false);
|
|
15980
|
+
if (!tracked) return;
|
|
15981
|
+
const unchanged = await runCommand4("git", ["diff", "--quiet", "--", rel], root).then(() => true).catch(() => false);
|
|
15982
|
+
if (unchanged) return;
|
|
15983
|
+
await runCommand4("git", ["add", "--", rel], root).catch(() => {
|
|
15984
|
+
});
|
|
15985
|
+
}
|
|
15974
15986
|
function runCommand4(cmd, args, cwd) {
|
|
15975
15987
|
return new Promise((resolve, reject) => {
|
|
15976
15988
|
const proc = spawn6(cmd, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
@@ -16488,7 +16500,7 @@ function warnNum(n) {
|
|
|
16488
16500
|
|
|
16489
16501
|
// src/index.ts
|
|
16490
16502
|
var program = new Command58();
|
|
16491
|
-
program.name("haive").description("hAIve - repo-native memory and context policy for coding-agent harnesses").version("0.13.
|
|
16503
|
+
program.name("haive").description("hAIve - repo-native memory and context policy for coding-agent harnesses").version("0.13.5").option("--advanced", "show maintenance and experimental commands in help");
|
|
16492
16504
|
registerInit(program);
|
|
16493
16505
|
registerWelcome(program);
|
|
16494
16506
|
registerResolveProject(program);
|
|
@@ -16564,14 +16576,14 @@ var CORE_ROOT_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
16564
16576
|
"session"
|
|
16565
16577
|
]);
|
|
16566
16578
|
var CORE_MEMORY_COMMANDS = /* @__PURE__ */ new Set([
|
|
16567
|
-
"
|
|
16579
|
+
"save",
|
|
16568
16580
|
"list",
|
|
16569
|
-
"
|
|
16570
|
-
"
|
|
16581
|
+
"search",
|
|
16582
|
+
"get",
|
|
16571
16583
|
"verify",
|
|
16572
16584
|
"lint",
|
|
16573
16585
|
"tried",
|
|
16574
|
-
"
|
|
16586
|
+
"delete"
|
|
16575
16587
|
]);
|
|
16576
16588
|
var CORE_SESSION_COMMANDS = /* @__PURE__ */ new Set(["end"]);
|
|
16577
16589
|
applySurfaceVisibility(program);
|
|
@@ -16589,12 +16601,24 @@ program.parseAsync(process.argv).catch((err) => {
|
|
|
16589
16601
|
function applySurfaceVisibility(root) {
|
|
16590
16602
|
const showAdvanced = process.argv.includes("--advanced") || process.env.HAIVE_SHOW_ADVANCED === "1";
|
|
16591
16603
|
if (!showAdvanced) hideNonCoreCommands(root);
|
|
16604
|
+
const familiesBlock = showAdvanced ? [
|
|
16605
|
+
"",
|
|
16606
|
+
"Advanced surface, by family:",
|
|
16607
|
+
" reports: dashboard \xB7 stats \xB7 playback eval: eval \xB7 benchmark \xB7 selftest (alias: bench)",
|
|
16608
|
+
" index: index \xB7 code-search \xB7 embeddings runtime: runtime \xB7 observe \xB7 snapshot",
|
|
16609
|
+
" ops: memory <sub> \xB7 sensors \xB7 ingest \xB7 hub \xB7 sync \xB7 install-hooks (= enforce install) \xB7 precommit (= enforce check)"
|
|
16610
|
+
] : [];
|
|
16592
16611
|
root.addHelpText(
|
|
16593
16612
|
"after",
|
|
16594
16613
|
[
|
|
16595
16614
|
"",
|
|
16596
|
-
"
|
|
16597
|
-
"
|
|
16615
|
+
"Golden path (what you type day to day):",
|
|
16616
|
+
" init \u2192 doctor \u2192 agent setup \u2192 briefing \u2192 memory save/tried \u2192 sensors check \u2192 enforce finish \u2192 sync \u2192 session end",
|
|
16617
|
+
"",
|
|
16618
|
+
"Memory verbs mirror the MCP tools: memory save/search/get/delete <-> mem_save/mem_search/mem_get/mem_delete",
|
|
16619
|
+
"(old verbs add/query/show/rm still work as aliases).",
|
|
16620
|
+
...familiesBlock,
|
|
16621
|
+
"",
|
|
16598
16622
|
"Run `haive --advanced --help` or set HAIVE_SHOW_ADVANCED=1 to show maintenance and experimental commands."
|
|
16599
16623
|
].join("\n")
|
|
16600
16624
|
);
|