@hiveai/cli 0.20.0 → 0.20.1

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
@@ -2222,6 +2222,7 @@ import { existsSync as existsSync10 } from "fs";
2222
2222
  import path10 from "path";
2223
2223
  import {
2224
2224
  buildFrontmatter,
2225
+ loadMemoriesFromDir as loadMemoriesFromDir5,
2225
2226
  memoryFilePath,
2226
2227
  serializeMemory as serializeMemory2,
2227
2228
  STACK_PACK_TAG
@@ -3299,6 +3300,15 @@ async function seedStackPack(haivePaths, stack) {
3299
3300
  const memories = PACKS[stack];
3300
3301
  if (!memories) return { memories: 0, sensors: 0 };
3301
3302
  await mkdir5(haivePaths.teamDir, { recursive: true });
3303
+ const DATE_PREFIX = /^\d{4}-\d{2}-\d{2}-/;
3304
+ const existingTopics = /* @__PURE__ */ new Set();
3305
+ const existingSignatures = /* @__PURE__ */ new Set();
3306
+ if (existsSync10(haivePaths.memoriesDir)) {
3307
+ for (const { memory: memory2 } of await loadMemoriesFromDir5(haivePaths.memoriesDir)) {
3308
+ if (memory2.frontmatter.topic) existingTopics.add(memory2.frontmatter.topic);
3309
+ existingSignatures.add(memory2.frontmatter.id.replace(DATE_PREFIX, ""));
3310
+ }
3311
+ }
3302
3312
  let memCount = 0;
3303
3313
  let sensorCount = 0;
3304
3314
  for (const mem of memories) {
@@ -3313,6 +3323,9 @@ async function seedStackPack(haivePaths, stack) {
3313
3323
  last_fired: null
3314
3324
  } : void 0;
3315
3325
  const combinedSlug = mem.slug === stack || mem.slug.startsWith(`${stack}-`) ? mem.slug : `${stack}-${mem.slug}`;
3326
+ const topic = `stack-pack:${stack}:${mem.slug}`;
3327
+ const signature = `${mem.type}-${combinedSlug}`;
3328
+ if (existingTopics.has(topic) || existingSignatures.has(signature)) continue;
3316
3329
  const fm = buildFrontmatter({
3317
3330
  type: mem.type,
3318
3331
  slug: combinedSlug,
@@ -3321,6 +3334,7 @@ async function seedStackPack(haivePaths, stack) {
3321
3334
  // STACK_PACK_TAG marks this as generic seed knowledge so briefing ranking
3322
3335
  // keeps it at `background` priority until it earns a repo-specific anchor.
3323
3336
  tags: [...mem.tags, STACK_PACK_TAG],
3337
+ topic,
3324
3338
  ...sensor ? { sensor } : {}
3325
3339
  });
3326
3340
  const filePath = memoryFilePath(haivePaths, "team", fm.id);
@@ -3330,6 +3344,8 @@ async function seedStackPack(haivePaths, stack) {
3330
3344
  ${SEED_FOOTER(stack)}` });
3331
3345
  await mkdir5(path10.dirname(filePath), { recursive: true });
3332
3346
  await writeFile6(filePath, content, "utf8");
3347
+ existingTopics.add(topic);
3348
+ existingSignatures.add(signature);
3333
3349
  memCount++;
3334
3350
  if (sensor) sensorCount++;
3335
3351
  }
@@ -3338,7 +3354,7 @@ ${SEED_FOOTER(stack)}` });
3338
3354
 
3339
3355
  // src/commands/init.ts
3340
3356
  var execFileAsync = promisify2(execFile2);
3341
- var HAIVE_GITHUB_ACTION_REF = `v${"0.20.0"}`;
3357
+ var HAIVE_GITHUB_ACTION_REF = `v${"0.20.1"}`;
3342
3358
  var PROJECT_CONTEXT_TEMPLATE = `# Project context
3343
3359
 
3344
3360
  > Generated by \`haive init\`. Run \`haive init --bootstrap\` to auto-fill from your codebase,
@@ -4459,7 +4475,7 @@ import { existsSync as existsSync22 } from "fs";
4459
4475
  import path22 from "path";
4460
4476
  import { z as z2 } from "zod";
4461
4477
  import { existsSync as existsSync32 } from "fs";
4462
- import { loadMemoriesFromDir as loadMemoriesFromDir5 } from "@hiveai/core";
4478
+ import { loadMemoriesFromDir as loadMemoriesFromDir6 } from "@hiveai/core";
4463
4479
  import { z as z3 } from "zod";
4464
4480
  import { createHash } from "crypto";
4465
4481
  import { mkdir as mkdir22, writeFile as writeFile22 } from "fs/promises";
@@ -4511,7 +4527,7 @@ import {
4511
4527
  applyFeedbackAdjustment,
4512
4528
  computeImpact,
4513
4529
  getUsage as getUsage22,
4514
- loadMemoriesFromDir as loadMemoriesFromDir6,
4530
+ loadMemoriesFromDir as loadMemoriesFromDir62,
4515
4531
  loadUsageIndex as loadUsageIndex32,
4516
4532
  recordApplied,
4517
4533
  recordRejection as recordRejection2,
@@ -4842,7 +4858,7 @@ async function memList(input, ctx) {
4842
4858
  if (!existsSync32(ctx.paths.memoriesDir)) {
4843
4859
  return { memories: [] };
4844
4860
  }
4845
- const all = await loadMemoriesFromDir5(ctx.paths.memoriesDir);
4861
+ const all = await loadMemoriesFromDir6(ctx.paths.memoriesDir);
4846
4862
  const filtered = all.filter(({ memory: memory2 }) => {
4847
4863
  const fm = memory2.frontmatter;
4848
4864
  if (input.scope && fm.scope !== input.scope) return false;
@@ -5374,7 +5390,7 @@ async function memFeedback(input, ctx) {
5374
5390
  if (!existsSync82(ctx.paths.memoriesDir)) {
5375
5391
  return { ok: false, id: input.id, error: "No .ai/memories \u2014 run `haive init` first." };
5376
5392
  }
5377
- const all = await loadMemoriesFromDir6(ctx.paths.memoriesDir);
5393
+ const all = await loadMemoriesFromDir62(ctx.paths.memoriesDir);
5378
5394
  const target = all.find((m) => m.memory.frontmatter.id === input.id);
5379
5395
  if (!target) {
5380
5396
  return { ok: false, id: input.id, error: `No memory with id '${input.id}'.` };
@@ -8584,7 +8600,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
8584
8600
  };
8585
8601
  }
8586
8602
  var SERVER_NAME = "haive";
8587
- var SERVER_VERSION = "0.20.0";
8603
+ var SERVER_VERSION = "0.20.1";
8588
8604
  function jsonResult(data) {
8589
8605
  return {
8590
8606
  content: [
@@ -14336,7 +14352,7 @@ function registerDoctor(program2) {
14336
14352
  fix: "Edit .ai/haive.config.json: set autoSessionEnd: true (or re-run `haive init` without --manual)."
14337
14353
  });
14338
14354
  }
14339
- findings.push(...await collectInstallFindings(root, "0.20.0"));
14355
+ findings.push(...await collectInstallFindings(root, "0.20.1"));
14340
14356
  findings.push(...await collectToolchainFindings(root));
14341
14357
  try {
14342
14358
  const legacyRaw = execSync3("haive-mcp --version", {
@@ -14344,7 +14360,7 @@ function registerDoctor(program2) {
14344
14360
  timeout: 3e3,
14345
14361
  stdio: ["ignore", "pipe", "ignore"]
14346
14362
  }).trim();
14347
- const cliVersion = "0.20.0";
14363
+ const cliVersion = "0.20.1";
14348
14364
  if (legacyRaw && legacyRaw !== cliVersion) {
14349
14365
  findings.push({
14350
14366
  severity: "warn",
@@ -16044,7 +16060,7 @@ async function buildEnforcementReport(dir, stage, sessionId) {
16044
16060
  findings: [{ severity: "info", code: "enforcement-off", message: "hAIve enforcement is disabled." }]
16045
16061
  });
16046
16062
  }
16047
- findings.push(...await inspectIntegrationVersions(root, "0.20.0"));
16063
+ findings.push(...await inspectIntegrationVersions(root, "0.20.1"));
16048
16064
  if (config.enforcement?.requireBriefingFirst !== false && stage !== "ci") {
16049
16065
  const hasBriefing = await hasRecentBriefingMarker2(paths, sessionId);
16050
16066
  findings.push(hasBriefing ? { severity: "ok", code: "briefing-loaded", message: "A recent hAIve briefing marker exists." } : {
@@ -16167,8 +16183,9 @@ async function verifyDecisionCoverage(paths, stage, sessionId) {
16167
16183
  return [{ severity: "info", code: "decision-coverage-no-changes", message: "No changed files to match against policy memories." }];
16168
16184
  }
16169
16185
  const all = await loadMemoriesFromDir38(paths.memoriesDir);
16186
+ const changedSet = new Set(changedFiles);
16170
16187
  const policyTypes = /* @__PURE__ */ new Set(["decision", "gotcha", "architecture", "convention"]);
16171
- const relevant = all.map(({ memory: memory2 }) => memory2).filter((memory2) => {
16188
+ const relevant = all.filter(({ memory: memory2 }) => {
16172
16189
  const fm = memory2.frontmatter;
16173
16190
  if (!policyTypes.has(fm.type)) return false;
16174
16191
  if (fm.status !== "validated") return false;
@@ -16187,12 +16204,16 @@ async function verifyDecisionCoverage(paths, stage, sessionId) {
16187
16204
  severity: "ok",
16188
16205
  code: "decision-coverage-ci-pass",
16189
16206
  message: `CI surfaced ${relevant.length} relevant anchored decision/polic${relevant.length === 1 ? "y" : "ies"} for ${changedFiles.length} changed file(s). Runtime briefing markers are local-only and are not expected on GitHub Actions.`,
16190
- memory_ids: relevant.slice(0, 20).map((memory2) => memory2.frontmatter.id),
16207
+ memory_ids: relevant.slice(0, 20).map(({ memory: memory2 }) => memory2.frontmatter.id),
16191
16208
  affected_files: changedFiles.slice(0, 10)
16192
16209
  }];
16193
16210
  }
16194
16211
  const consulted = new Set(marker?.memory_ids ?? []);
16195
- const missing = relevant.filter((memory2) => !consulted.has(memory2.frontmatter.id));
16212
+ const missing = relevant.filter(({ memory: memory2, filePath }) => {
16213
+ if (consulted.has(memory2.frontmatter.id)) return false;
16214
+ if (changedSet.has(path53.relative(paths.root, filePath))) return false;
16215
+ return true;
16216
+ }).map(({ memory: memory2 }) => memory2);
16196
16217
  if (missing.length === 0) {
16197
16218
  return [{
16198
16219
  severity: "ok",
@@ -18079,7 +18100,7 @@ function registerBridges(program2) {
18079
18100
 
18080
18101
  // src/index.ts
18081
18102
  var program = new Command64();
18082
- program.name("haive").description("hAIve - repo-native memory and context policy for coding-agent harnesses").version("0.20.0").option("--advanced", "show maintenance and experimental commands in help");
18103
+ program.name("haive").description("hAIve - repo-native memory and context policy for coding-agent harnesses").version("0.20.1").option("--advanced", "show maintenance and experimental commands in help");
18083
18104
  registerInit(program);
18084
18105
  registerWelcome(program);
18085
18106
  registerResolveProject(program);