@fusengine/harness 0.1.27 → 0.1.29

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.
@@ -1,2 +1,2 @@
1
- import { a as readClaudeInput, i as guard, n as denyResponse, o as toClaudeResponse, r as fileSizeGuard, t as contextResponse } from "../../claude-CeNVUGku.mjs";
1
+ import { a as readClaudeInput, i as guard, n as denyResponse, o as toClaudeResponse, r as fileSizeGuard, t as contextResponse } from "../../claude-B9FYp0Yw.mjs";
2
2
  export { contextResponse, denyResponse, fileSizeGuard, guard, readClaudeInput, toClaudeResponse };
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BIK60lOR.mjs";
1
+ import { t as evaluate } from "../../evaluate-j3gRJ_ng.mjs";
2
2
  import { t as formatPrompt } from "../../types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/cline/index.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { a as readClaudeInput, i as guard, n as denyResponse, t as contextResponse } from "../../claude-CeNVUGku.mjs";
1
+ import { a as readClaudeInput, i as guard, n as denyResponse, t as contextResponse } from "../../claude-B9FYp0Yw.mjs";
2
2
  export { contextResponse, denyResponse, guard, readClaudeInput as readCodexInput };
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BIK60lOR.mjs";
1
+ import { t as evaluate } from "../../evaluate-j3gRJ_ng.mjs";
2
2
  import { t as formatPrompt } from "../../types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/cursor/index.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BIK60lOR.mjs";
1
+ import { t as evaluate } from "../../evaluate-j3gRJ_ng.mjs";
2
2
  import { t as formatPrompt } from "../../types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/gemini/index.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "./evaluate-BIK60lOR.mjs";
1
+ import { t as evaluate } from "./evaluate-j3gRJ_ng.mjs";
2
2
  import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/claude/index.ts
4
4
  /**
package/dist/cli/bin.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { r as resolveTtlSec } from "../ttl-BG55s6HZ.mjs";
3
3
  import { t as detectHarness } from "../harness-C8Nxxyn_.mjs";
4
- import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-BdcSLer0.mjs";
4
+ import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-CXsV-wIJ.mjs";
5
5
  import { n as writeInitFile, t as initFor } from "../run-D91N4ul1.mjs";
6
- import { t as handleHook } from "../handle-BJ2xdeA-.mjs";
6
+ import { t as handleHook } from "../handle-nu3GYVek.mjs";
7
7
  //#region src/cli/bin.ts
8
8
  /**
9
9
  * harness — CLI for @fusengine/harness.
@@ -1,2 +1,2 @@
1
- import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-BdcSLer0.mjs";
1
+ import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-CXsV-wIJ.mjs";
2
2
  export { checkStaged, stagedContent, stagedFiles };
@@ -22,9 +22,21 @@ function detectFramework(filePath, content) {
22
22
  }
23
23
  //#endregion
24
24
  //#region src/policy/file-size.ts
25
- /** Count lines in file content (empty string = 0). */
25
+ /**
26
+ * Count substantive (code-only) lines — blank lines and comment-only lines
27
+ * (`//`, `*`, `/*` block-comment bodies) don't count toward the SOLID limit, so a
28
+ * well-documented file isn't penalized for its JSDoc. (`#` is intentionally NOT
29
+ * skipped: it is code in Rust `#[derive]` and C `#include`, not a comment.)
30
+ */
26
31
  function countLines(content) {
27
- return content === "" ? 0 : content.split("\n").length;
32
+ if (content === "") return 0;
33
+ let n = 0;
34
+ for (const line of content.split("\n")) {
35
+ const s = line.trim();
36
+ if (!s || s.startsWith("//") || s.startsWith("*") || s.startsWith("/*")) continue;
37
+ n++;
38
+ }
39
+ return n;
28
40
  }
29
41
  /**
30
42
  * Evaluate a file's line count against the SOLID limit.
@@ -118,7 +130,7 @@ const CRITICAL_PATTERNS = [
118
130
  /\b(?:curl|wget)\b[^|]*\|\s*(?:sudo\s+)?(?:ba|z|da|k)?sh\b/,
119
131
  /\bchmod\s+(?:-[a-zA-Z]+\s+)*777\s+\//,
120
132
  /\bmkfs(?:\.[a-z0-9]+)?\b/,
121
- /\bdd\b[^\n]*\bof=\/dev\/(?:disk|sd|hd|nvme|mmcblk|vd)/i,
133
+ /\bdd\b[^\n]*\bof=\/dev\/(?:r?disk|sd|hd|nvme|mmcblk|vd|xvd)/i,
122
134
  /\bshred\b/,
123
135
  /\bfdisk\b/,
124
136
  /\bdiskutil\s+(?:erase|partitionDisk)/i,
@@ -139,9 +151,26 @@ const ASK_PATTERNS = [
139
151
  /\bunlink\s/,
140
152
  /\bdel\s/
141
153
  ];
142
- /** Strip heredoc bodies so their content isn't matched as a command (false positives). */
154
+ /**
155
+ * Strip heredoc bodies so their content isn't matched as a command (false positives).
156
+ * Two-phase scan: a backreference-free opener regex finds `<<[-]DELIM`, then the body
157
+ * is cut up to the closing delimiter via `indexOf` — O(n), no catastrophic backtracking.
158
+ */
143
159
  function stripHeredoc(cmd) {
144
- return cmd.replace(/<<-?\s*['"]?(\w+)['"]?[\s\S]*?\n[ \t]*\1\b/g, " ");
160
+ const opener = /<<-?\s*['"]?(\w+)['"]?/g;
161
+ let out = cmd;
162
+ let m;
163
+ while ((m = opener.exec(out)) !== null) {
164
+ const delim = m[1] ?? "";
165
+ const closer = new RegExp(`\\n[ \\t]*${delim}\\b`);
166
+ const rest = out.slice(m.index + m[0].length);
167
+ const hit = closer.exec(rest);
168
+ if (!hit || hit.index === void 0) break;
169
+ const end = m.index + m[0].length + hit.index + hit[0].length;
170
+ out = `${out.slice(0, m.index)} ${out.slice(end)}`;
171
+ opener.lastIndex = m.index;
172
+ }
173
+ return out;
145
174
  }
146
175
  /** Guards against dangerous Bash commands (critical → block, sensitive → ask). */
147
176
  function securityGuard(ctx) {