@hivelore/mcp 0.47.0 → 0.51.0

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
@@ -1859,6 +1859,10 @@ var ScaffoldTestInputSchema = {
1859
1859
  memory_id: z17.string().min(1).describe("Id of the attempt/gotcha lesson to scaffold a post-incident test from."),
1860
1860
  framework: z17.enum(["vitest", "jest", "pytest", "gotest"]).optional().describe("Test framework. Auto-detected from the package that owns the lesson's anchor paths when omitted."),
1861
1861
  out_path: z17.string().optional().describe("Override the generated test file path (repo-relative)."),
1862
+ style: z17.enum(["example", "property", "differential"]).optional().describe(
1863
+ "Test shape (default 'example'): 'property' states the invariant once and checks it over many generated inputs (fast-check/Hypothesis); 'differential' asserts the subject agrees with a `reference` implementation for all inputs. Both lower the cost of expressing the invariant."
1864
+ ),
1865
+ reference: z17.string().optional().describe("Required for style='differential': import specifier of the reference implementation to compare against."),
1862
1866
  red_ref: z17.string().optional().describe(
1863
1867
  "Pre-fix incident commit/ref. When set, the scaffold names the symbols the fix (<red_ref>..HEAD) touched within the lesson's anchor scope and pre-fills the example around them, so the assertion is a targeted edit rather than a blank page. A bad ref falls back to the generic template."
1864
1868
  ),
@@ -1870,6 +1874,10 @@ async function scaffoldTest(input, ctx) {
1870
1874
  if (!found) {
1871
1875
  return { ok: false, error: `No memory found with id ${input.memory_id}`, memory_id: input.memory_id };
1872
1876
  }
1877
+ const style = input.style ?? "example";
1878
+ if (style === "differential" && !input.reference) {
1879
+ return { ok: false, error: "style='differential' requires `reference` (the reference implementation to compare against).", memory_id: input.memory_id };
1880
+ }
1873
1881
  const anchorPaths = found.memory.frontmatter.anchor.paths ?? [];
1874
1882
  const allGroups = await detectTestFrameworksForAnchors(ctx.paths.root, anchorPaths);
1875
1883
  const groups = input.out_path ? allGroups.slice(0, 1) : allGroups;
@@ -1893,8 +1901,9 @@ async function scaffoldTest(input, ctx) {
1893
1901
  paths: anchorPaths,
1894
1902
  incidentHints
1895
1903
  };
1904
+ const styleOpts = { style, reference: input.reference };
1896
1905
  let scaffolds = groups.map(
1897
- (g) => scaffoldPostIncidentTest(lesson, { framework: frameworkFor(g.framework), outPath: input.out_path, baseDir: g.baseDir })
1906
+ (g) => scaffoldPostIncidentTest(lesson, { framework: frameworkFor(g.framework), outPath: input.out_path, baseDir: g.baseDir, ...styleOpts })
1898
1907
  );
1899
1908
  let proposeCommand = scaffolds[0].proposeCommand;
1900
1909
  if (scaffolds.length > 1) {
@@ -1903,7 +1912,8 @@ async function scaffoldTest(input, ctx) {
1903
1912
  (g) => scaffoldPostIncidentTest(lesson, {
1904
1913
  framework: frameworkFor(g.framework),
1905
1914
  baseDir: g.baseDir,
1906
- proposeCommandOverride: proposeCommand
1915
+ proposeCommandOverride: proposeCommand,
1916
+ ...styleOpts
1907
1917
  })
1908
1918
  );
1909
1919
  }
@@ -3215,7 +3225,7 @@ function oneLine(value) {
3215
3225
  return value.replace(/\s+/g, " ").replace(/"/g, '\\"').trim().slice(0, 120);
3216
3226
  }
3217
3227
  function serverVersion() {
3218
- return true ? "0.47.0" : "dev";
3228
+ return true ? "0.51.0" : "dev";
3219
3229
  }
3220
3230
 
3221
3231
  // src/tools/code-map.ts
@@ -3527,7 +3537,7 @@ function isHaiveOwnedPath(p) {
3527
3537
  if (p.startsWith(".ai/")) return true;
3528
3538
  if (HAIVE_GENERATED_FILES.has(p)) return true;
3529
3539
  if (p.startsWith(".cursor/rules/")) return true;
3530
- if (/^\.github\/workflows\/haive-.*\.ya?ml$/.test(p)) return true;
3540
+ if (/^\.github\/workflows\/(hivelore|haive)-.*\.ya?ml$/.test(p)) return true;
3531
3541
  return false;
3532
3542
  }
3533
3543
  var MAX_FUZZY_SCAN_LINES = 2e4;
@@ -4535,13 +4545,25 @@ Examples of things to look for:
4535
4545
  ### 5. Did you find that an existing memory is outdated or wrong?
4536
4546
  \u2192 If yes, call **\`mem_update\`** with the correct information, or **\`mem_reject\`** if it's completely wrong
4537
4547
 
4548
+ ## The bar \u2014 capture only what is UNGUESSABLE
4549
+
4550
+ A memory earns its place only if it carries *hard-won, repo-specific knowledge a capable teammate could
4551
+ NOT infer* from the code, the docs, or common practice. A "decision" that merely restates what the
4552
+ implementation already shows, a "convention" that is just standard style, a "gotcha" that is generic
4553
+ best practice \u2014 these are noise, and noise makes every future briefing worse. **For a routine change,
4554
+ capturing nothing is the correct, expected outcome.** Only reach for \`mem_save\` when you can name the
4555
+ arbitrary constraint (an invariant, a tradeoff with a real WHY, a footgun that cost you time) that the
4556
+ next agent would otherwise get wrong.
4557
+
4538
4558
  ## Rules
4539
4559
 
4540
4560
  - One memory per insight. Don't cram multiple lessons into one body.
4541
4561
  - Anchor memories to file paths when possible (the \`paths\` field) \u2014 this enables staleness detection.
4542
4562
  - Prefer \`scope="team"\` for anything a teammate or future agent would benefit from.
4543
- - Skip sections where you genuinely have nothing to add. Don't fabricate memories.
4544
- - **Question 0 is not optional** \u2014 always scan your exploration history for code-level discoveries.
4563
+ - Skip sections where you genuinely have nothing to add. Don't fabricate memories \u2014 an empty post-task
4564
+ is better than a corpus of restated obvious facts.
4565
+ - Scan your exploration history for genuine code-level discoveries (failed approaches, real footguns),
4566
+ but hold each to the bar above before saving it.
4545
4567
 
4546
4568
  ### 6. Close the session \u2014 always
4547
4569
  Call **\`mem_session_end\`** with:
@@ -4668,7 +4690,7 @@ When done, respond with: "Imported N memories: [list of IDs]" or "Nothing action
4668
4690
  // src/server.ts
4669
4691
  import { hasRecentBriefingMarker, loadConfigSync } from "@hivelore/core";
4670
4692
  var SERVER_NAME = "hivelore";
4671
- var SERVER_VERSION = "0.47.0";
4693
+ var SERVER_VERSION = "0.51.0";
4672
4694
  function jsonResult(data) {
4673
4695
  return {
4674
4696
  content: [
@@ -4745,7 +4767,8 @@ var MUTATING_TOOLS = /* @__PURE__ */ new Set([
4745
4767
  function createHaiveServer(options = {}) {
4746
4768
  const context = createContext(options);
4747
4769
  const config = loadConfigSync(context.paths);
4748
- const toolProfile = options.env?.HAIVE_TOOL_PROFILE ?? config.enforcement?.toolProfile ?? "enforcement";
4770
+ const toolProfile = options.env?.HIVELORE_TOOL_PROFILE ?? options.env?.HAIVE_TOOL_PROFILE ?? // legacy env name
4771
+ config.enforcement?.toolProfile ?? "enforcement";
4749
4772
  const requireBriefingFirst = options.env?.HAIVE_REQUIRE_BRIEFING_FIRST === "0" ? false : config.enforcement?.requireBriefingFirst ?? true;
4750
4773
  let briefingLoaded = false;
4751
4774
  const tracker = new SessionTracker(context);