@fusengine/harness 0.1.71 → 0.1.72

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/cli/bin.mjs CHANGED
@@ -4,7 +4,7 @@ import { t as detectHarness } from "../harness-Cb9xR8dC.mjs";
4
4
  import { t as claudeHome } from "../home-state-D0RLWP8J.mjs";
5
5
  import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-B4BqxlXH.mjs";
6
6
  import { n as writeInitFile, t as initFor } from "../run-Do2JltgU.mjs";
7
- import { $ as runningVersion, Q as runDoctor, Z as notify, et as versionBanner, t as handleHook, zt as todayUtc } from "../handle-CSjRTUDf.mjs";
7
+ import { $ as runningVersion, Q as runDoctor, Z as notify, et as versionBanner, t as handleHook, zt as todayUtc } from "../handle-Cw1H21Eg.mjs";
8
8
  import { p as readStdin$1 } from "../claude-Z0pN-dqc.mjs";
9
9
  import { delimiter, join } from "node:path";
10
10
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
@@ -790,16 +790,18 @@ function readRules(rulesDir) {
790
790
  return parts.join("\n\n");
791
791
  }
792
792
  /**
793
- * Build the rules injection for claude-rules (SessionStart + UserPromptSubmit):
794
- * read `<pluginRoot>/rules/*.md` and emit as `additionalContext`, or "" when no
795
- * rules. Ports `claude-rules/scripts/inject-rules.py` (which always tags the
796
- * output `hookEventName: "SessionStart"`, even on UserPromptSubmit).
793
+ * Build the rules injection for claude-rules (SessionStart, UserPromptSubmit,
794
+ * SubagentStart): read `<pluginRoot>/rules/*.md` and emit as `additionalContext`,
795
+ * or "" when no rules. Tags the output with the *actual* `hookEventName` — the
796
+ * spec requires it to match the firing event (a hardcoded "SessionStart" is
797
+ * non-conforming and may be dropped on UserPromptSubmit/SubagentStart).
797
798
  * @param pluginRoot - `CLAUDE_PLUGIN_ROOT` of the claude-rules plugin.
799
+ * @param event - The firing hook event name (e.g. "SessionStart").
798
800
  * @returns The native hook stdout (possibly empty).
799
801
  */
800
- function injectRules(pluginRoot) {
802
+ function injectRules(pluginRoot, event) {
801
803
  const content = readRules(join(pluginRoot, "rules"));
802
- return content ? contextResponse("SessionStart", content) : "";
804
+ return content ? contextResponse(event, content) : "";
803
805
  }
804
806
  //#endregion
805
807
  //#region src/runtime/lifecycle/solid-detect.ts
@@ -5313,7 +5315,7 @@ async function aipilotPostToolUse(payload, cwd) {
5313
5315
  /** SessionStart handler keyed on plugin scope. */
5314
5316
  function sessionStart(input) {
5315
5317
  if (input.scope === "solid") return solidDetectStart();
5316
- if (input.scope === "rules") return injectRules(process.env.CLAUDE_PLUGIN_ROOT ?? input.cwd);
5318
+ if (input.scope === "rules") return injectRules(process.env.CLAUDE_PLUGIN_ROOT ?? input.cwd, input.event);
5317
5319
  if (input.scope === "carto") return cartoSessionStart(input.cwd, input.now);
5318
5320
  if (input.scope === "lessons") return dispatchLessons("SessionStart", input.payload, input.cwd, input.now);
5319
5321
  const core = sessionStartCore(input.cwd, void 0, input.now);
@@ -5329,9 +5331,9 @@ function sessionStart(input) {
5329
5331
  function dispatchLifecycle(input) {
5330
5332
  switch (input.event) {
5331
5333
  case "SessionStart": return sessionStart(input);
5332
- case "UserPromptSubmit": return input.scope === "rules" ? injectRules(process.env.CLAUDE_PLUGIN_ROOT ?? input.cwd) : null;
5334
+ case "UserPromptSubmit": return input.scope === "rules" ? injectRules(process.env.CLAUDE_PLUGIN_ROOT ?? input.cwd, input.event) : null;
5333
5335
  case "SubagentStart":
5334
- if (input.scope === "rules") return injectRules(process.env.CLAUDE_PLUGIN_ROOT ?? input.cwd);
5336
+ if (input.scope === "rules") return injectRules(process.env.CLAUDE_PLUGIN_ROOT ?? input.cwd, input.event);
5335
5337
  if (input.scope === "aipilot") return "";
5336
5338
  if (input.scope === "lessons") return dispatchLessons("SubagentStart", input.payload, input.cwd, input.now);
5337
5339
  return subagentCacheContext(input.payload.session_id);
@@ -352,14 +352,16 @@ declare function sessionStartCore(cwd: string, home?: string, now?: number): str
352
352
  /** Read & concatenate all `*.md` files (sorted) under `rulesDir`. */
353
353
  declare function readRules(rulesDir: string): string;
354
354
  /**
355
- * Build the rules injection for claude-rules (SessionStart + UserPromptSubmit):
356
- * read `<pluginRoot>/rules/*.md` and emit as `additionalContext`, or "" when no
357
- * rules. Ports `claude-rules/scripts/inject-rules.py` (which always tags the
358
- * output `hookEventName: "SessionStart"`, even on UserPromptSubmit).
355
+ * Build the rules injection for claude-rules (SessionStart, UserPromptSubmit,
356
+ * SubagentStart): read `<pluginRoot>/rules/*.md` and emit as `additionalContext`,
357
+ * or "" when no rules. Tags the output with the *actual* `hookEventName` — the
358
+ * spec requires it to match the firing event (a hardcoded "SessionStart" is
359
+ * non-conforming and may be dropped on UserPromptSubmit/SubagentStart).
359
360
  * @param pluginRoot - `CLAUDE_PLUGIN_ROOT` of the claude-rules plugin.
361
+ * @param event - The firing hook event name (e.g. "SessionStart").
360
362
  * @returns The native hook stdout (possibly empty).
361
363
  */
362
- declare function injectRules(pluginRoot: string): string;
364
+ declare function injectRules(pluginRoot: string, event: string): string;
363
365
  //#endregion
364
366
  //#region src/runtime/lifecycle/solid-detect.d.ts
365
367
  /** A SOLID project profile: type label, per-file line limit, interface dir. */
@@ -1,6 +1,6 @@
1
1
  import { r as projectLayout } from "../layout-C0jaaCQC.mjs";
2
2
  import { a as sanitizeSessionId, c as sessionsDir, i as loadSessionState, n as fuseHarnessHome, o as saveSessionState, r as fusengineCache, s as sessionStatePath, t as claudeHome } from "../home-state-D0RLWP8J.mjs";
3
- import { A as trackMcpResearch, At as defaultStateDir, B as generateProjectMap, C as seoPostToolUse, Ct as trimLogFile, D as securityAdvisoryForPatch, Dt as claudeMdKey, E as securityAdvisory, Et as projectContext, F as dispatchAipilot, Ft as loadSecurityState, G as countFiles, H as writeTree, I as dispatchLessons, It as saveSecurityState, J as lessonsArchiveFileFor, K as getFileDesc, L as cartoSessionStart, Lt as securityStateDir, M as trackEnrichment, Mt as trackFile, N as dispatchLifecycle, Nt as normalizeEvent, O as postTrackingSideEffects, Ot as promptSubmitContext, P as aipilotPostToolUse, Pt as isoUtc, R as generateEcosystemMap, Rt as securityStatePath, S as postEditContext, St as removeOldFiles, T as dispatchMemory, Tt as gitContext, U as loadEnriched, V as isProject, W as mergeLines, X as lessonsStateFileFor, Y as lessonsFileFor, _ as preCommitGate, _t as readRules, a as recordActivity, at as saveApexState, b as extractSymbols, bt as pruneEmptyDirs, c as MCP_TTL_MS, ct as trackAgentMemory, d as isMcpTool, dt as validateSolidGate, f as queryOf, ft as checkFileSize, g as gate, gt as injectRules, h as TRIVIAL_BUDGET, ht as solidDetectStart, i as respond, it as cleanupSession, j as trackSkillRead, jt as projectHash, k as trackWatchResearch, kt as taskContext, l as WEBFETCH_TTL_MS, lt as subagentCacheContext, m as REQUIRED_AGENTS, mt as detectSolidProfile, n as activityFor, nt as trackSessionChanges, o as mcpPostStore, ot as logToolFailure, p as DEFAULT_WINDOW_MS, pt as countLoc, q as listChildren, r as handlePre, rt as validateRulesLoaded, s as mcpPreIntercept, st as validateTeammateOutput, t as handleHook, tt as postEditTypescript, u as cacheQueryOf, ut as validateTailwind, v as detectDuplication, vt as runSessionStartCleanups, w as seoPostToolUseResponse, wt as devContext, x as lifecycleStdout, xt as purgeTtlTree, y as dryGate, yt as sessionStartCore, z as writePluginMap, zt as todayUtc } from "../handle-CSjRTUDf.mjs";
3
+ import { A as trackMcpResearch, At as defaultStateDir, B as generateProjectMap, C as seoPostToolUse, Ct as trimLogFile, D as securityAdvisoryForPatch, Dt as claudeMdKey, E as securityAdvisory, Et as projectContext, F as dispatchAipilot, Ft as loadSecurityState, G as countFiles, H as writeTree, I as dispatchLessons, It as saveSecurityState, J as lessonsArchiveFileFor, K as getFileDesc, L as cartoSessionStart, Lt as securityStateDir, M as trackEnrichment, Mt as trackFile, N as dispatchLifecycle, Nt as normalizeEvent, O as postTrackingSideEffects, Ot as promptSubmitContext, P as aipilotPostToolUse, Pt as isoUtc, R as generateEcosystemMap, Rt as securityStatePath, S as postEditContext, St as removeOldFiles, T as dispatchMemory, Tt as gitContext, U as loadEnriched, V as isProject, W as mergeLines, X as lessonsStateFileFor, Y as lessonsFileFor, _ as preCommitGate, _t as readRules, a as recordActivity, at as saveApexState, b as extractSymbols, bt as pruneEmptyDirs, c as MCP_TTL_MS, ct as trackAgentMemory, d as isMcpTool, dt as validateSolidGate, f as queryOf, ft as checkFileSize, g as gate, gt as injectRules, h as TRIVIAL_BUDGET, ht as solidDetectStart, i as respond, it as cleanupSession, j as trackSkillRead, jt as projectHash, k as trackWatchResearch, kt as taskContext, l as WEBFETCH_TTL_MS, lt as subagentCacheContext, m as REQUIRED_AGENTS, mt as detectSolidProfile, n as activityFor, nt as trackSessionChanges, o as mcpPostStore, ot as logToolFailure, p as DEFAULT_WINDOW_MS, pt as countLoc, q as listChildren, r as handlePre, rt as validateRulesLoaded, s as mcpPreIntercept, st as validateTeammateOutput, t as handleHook, tt as postEditTypescript, u as cacheQueryOf, ut as validateTailwind, v as detectDuplication, vt as runSessionStartCleanups, w as seoPostToolUseResponse, wt as devContext, x as lifecycleStdout, xt as purgeTtlTree, y as dryGate, yt as sessionStartCore, z as writePluginMap, zt as todayUtc } from "../handle-Cw1H21Eg.mjs";
4
4
  //#region src/runtime/storage.ts
5
5
  /**
6
6
  * The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusengine/harness",
3
- "version": "0.1.71",
3
+ "version": "0.1.72",
4
4
  "description": "Harness-agnostic toolkit for AI coding agents: runtime harness detection (Claude Code, Codex, Cursor, Cline, Gemini, Aider...), pure policy core (env config, project/framework detection, SOLID/file-size limits, APEX freshness, guard patterns, portable prompts), cache, project memory, ref routing, state/locks, statusline, per-harness adapters (Claude/Cursor/Cline/Gemini) and a cli-mode harness-check binary. Bun-native, with a built dist for Node + bundlers.",
5
5
  "type": "module",
6
6
  "module": "src/index.ts",