@fusengine/harness 0.1.31 → 0.1.33
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/adapters/claude/index.mjs +1 -1
- package/dist/adapters/cline/index.mjs +1 -1
- package/dist/adapters/codex/index.mjs +1 -1
- package/dist/adapters/cursor/index.mjs +1 -1
- package/dist/adapters/gemini/index.mjs +1 -1
- package/dist/claude-BatVYnAf.mjs +137 -0
- package/dist/cli/bin.mjs +6 -4
- package/dist/cli/index.mjs +1 -1
- package/dist/{evaluate-j3gRJ_ng.mjs → evaluate-9ch1K2kt.mjs} +1 -1
- package/dist/{handle-DW9cWdVt.mjs → handle-Cxgzd4pZ.mjs} +516 -81
- package/dist/{index-C1vLIMwN.d.mts → index-BEMumjOw.d.mts} +8 -1
- package/dist/{index-mISsk0ff.d.mts → index-DmbOUJK8.d.mts} +12 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +5 -5
- package/dist/init/index.mjs +1 -1
- package/dist/memory/index.mjs +2 -1
- package/dist/memory-la_KkjCS.mjs +1 -0
- package/dist/policy/index.d.mts +2 -2
- package/dist/policy/index.mjs +3 -3
- package/dist/{project-root-ff0_poWU.mjs → project-root-3kk7gCOp.mjs} +7 -1
- package/dist/{run-CXsV-wIJ.mjs → run-CQbtlAKa.mjs} +2 -2
- package/dist/{run-D91N4ul1.mjs → run-Do2JltgU.mjs} +2 -2
- package/dist/runtime/index.d.mts +77 -8
- package/dist/runtime/index.mjs +2 -2
- package/dist/util/index.d.mts +2 -2
- package/dist/util/index.mjs +2 -2
- package/dist/{describe-BYqhoV4c.mjs → validate-CccewDwk.mjs} +47 -2
- package/package.json +1 -1
- package/dist/claude-B9FYp0Yw.mjs +0 -66
- /package/dist/{memory-BkoEbdec.mjs → registry-BkoEbdec.mjs} +0 -0
|
@@ -10,6 +10,13 @@ declare function compactJson(data: unknown): string;
|
|
|
10
10
|
/** True for a source-code file outside generated/vendored directories. */
|
|
11
11
|
declare function isCodeFile(p: string): boolean;
|
|
12
12
|
/**
|
|
13
|
+
* Walk up from `dir` to the nearest ancestor directory containing `marker`.
|
|
14
|
+
* @param dir - Starting directory.
|
|
15
|
+
* @param marker - Sibling file/dir name to look for at each level.
|
|
16
|
+
* @returns The ancestor holding `marker`, or `null` at filesystem root.
|
|
17
|
+
*/
|
|
18
|
+
declare function walkUpFor(dir: string, marker: string): string | null;
|
|
19
|
+
/**
|
|
13
20
|
* Resolve the project root, preferring the repo boundary (`.git`) over a
|
|
14
21
|
* nested `package.json` — avoids false roots in monorepos. Null if none found.
|
|
15
22
|
*/
|
|
@@ -17,4 +24,4 @@ declare function projectRootOrNull(dir: string): string | null;
|
|
|
17
24
|
/** Like {@link projectRootOrNull} but falls back to `process.cwd()`. */
|
|
18
25
|
declare function projectRoot(dir: string): string;
|
|
19
26
|
//#endregion
|
|
20
|
-
export { compactJson as i, projectRoot as n, projectRootOrNull as r, isCodeFile as t };
|
|
27
|
+
export { compactJson as a, walkUpFor as i, projectRoot as n, projectRootOrNull as r, isCodeFile as t };
|
|
@@ -435,4 +435,15 @@ declare function firstComment(text: string): string;
|
|
|
435
435
|
*/
|
|
436
436
|
declare function descFromText(suffix: string, text: string, mdField: string): string;
|
|
437
437
|
//#endregion
|
|
438
|
-
|
|
438
|
+
//#region src/policy/seo/validate.d.ts
|
|
439
|
+
/** True when `path` is an HTML-like file the SEO hook should validate. */
|
|
440
|
+
declare function isHtmlLike(path: string): boolean;
|
|
441
|
+
/**
|
|
442
|
+
* Report the SEO elements missing from HTML-like content (title, meta
|
|
443
|
+
* description, OG title/description/image, canonical, JSON-LD schema).
|
|
444
|
+
* @param html - The file content.
|
|
445
|
+
* @returns The missing element labels (empty when complete).
|
|
446
|
+
*/
|
|
447
|
+
declare function missingSeoElements(html: string): string[];
|
|
448
|
+
//#endregion
|
|
449
|
+
export { APEX_GATES as $, GUARDS as A, TS_DECL_RE as B, SKILL_TRIGGERS as C, detectProjectType as Ct, capVerbosity as D, MAX_TOKENS as E, GO_DECL_RE as F, bashWriteGuard as G, ASK_WRITERS as H, JAVA_DECL_RE as I, ASK_PATTERNS as J, PROTECTED_FRAGMENTS as K, PHP_DECL_RE as L, registerGuard as M, runGuards as N, detectCreationIntent as O, installGuard as P, GuardContext as Q, PY_MODEL_RE as R, skillTriggerGate as S, detectModularArchitecture as St, MAX_EXA_RESULTS as T, requiredArchSkill as Tt, CODE_MUTATORS as U, interfaceSeparationGuard as V, CODE_REDIRECT as W, securityGuard as X, CRITICAL_PATTERNS as Y, Guard as Z, DEV_VERBS as _, evaluateFileSize as _t, firstHeading as a, freshnessGate as at, detectClaudeMdProjectType as b, ModularArchitecture as bt, parseEntry as c, PolicyResult as ct, EXCLUDE_DIRS as d, GIT_BLOCKED as dt, ApexContext as et, PROJECT_INDICATORS as f, PROJECT_INSTALL as ft, loadApexTaskState as g, countLines as gt, buildApexTaskInjection as h, FileSizeVerdict as ht, firstComment as i, evaluateApex as it, clearUserGuards as j, FAIL_CLOSED as k, parseBodyDesc as l, evaluate as lt, buildApexTaskContext as m, matchPatterns as mt, missingSeoElements as n, brainstormGate as nt, TreeEntry as o, solidReadGate as ot, ApexTaskState as p, SYSTEM_INSTALL as pt, protectedPathGuard as q, descFromText as r, docConsultedGate as rt, parseEnrichment as s, PolicyContext as st, isHtmlLike as t, ApexGate as tt, parseField as u, GIT_ASK as ut, buildApexInstruction as v, detectFramework as vt, frameworkSolidGate as w, isApexCommand as wt, detectRequiredSkills as x, ProjectType as xt, buildClaudeMdContext as y, DEV_KEYWORDS as yt, SWIFT_PROTO_RE as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,11 +4,11 @@ import { a as DEFAULT_MAX_LINES, c as splitTarget, d as resolveTtlSec, f as ttlL
|
|
|
4
4
|
import { a as detectHarness, i as HarnessVia, n as HarnessInfo, o as detectMode, r as HarnessMode, s as modeFor, t as HarnessId } from "./harness-DwJskkz_.mjs";
|
|
5
5
|
import { a as isDocConsulted, i as formatDocSatisfactionStatus, n as DocSatisfactionStatus, o as resolveSessions, r as formatDocDeny, t as AuthEntry } from "./doc-helpers-CG1nuf-c.mjs";
|
|
6
6
|
import { t as incrementTrivialEditCounter } from "./index-BOBXQ91y.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { $ as
|
|
7
|
+
import { a as compactJson, i as walkUpFor, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./index-BEMumjOw.mjs";
|
|
8
|
+
import { $ as APEX_GATES, A as GUARDS, B as TS_DECL_RE, C as SKILL_TRIGGERS, Ct as detectProjectType, D as capVerbosity, E as MAX_TOKENS, F as GO_DECL_RE, G as bashWriteGuard, H as ASK_WRITERS, I as JAVA_DECL_RE, J as ASK_PATTERNS, K as PROTECTED_FRAGMENTS, L as PHP_DECL_RE, M as registerGuard, N as runGuards, O as detectCreationIntent, P as installGuard, Q as GuardContext, R as PY_MODEL_RE, S as skillTriggerGate, St as detectModularArchitecture, T as MAX_EXA_RESULTS, Tt as requiredArchSkill, U as CODE_MUTATORS, V as interfaceSeparationGuard, W as CODE_REDIRECT, X as securityGuard, Y as CRITICAL_PATTERNS, Z as Guard, _ as DEV_VERBS, _t as evaluateFileSize, a as firstHeading, at as freshnessGate, b as detectClaudeMdProjectType, bt as ModularArchitecture, c as parseEntry, ct as PolicyResult, d as EXCLUDE_DIRS, dt as GIT_BLOCKED, et as ApexContext, f as PROJECT_INDICATORS, ft as PROJECT_INSTALL, g as loadApexTaskState, gt as countLines, h as buildApexTaskInjection, ht as FileSizeVerdict, i as firstComment, it as evaluateApex, j as clearUserGuards, k as FAIL_CLOSED, l as parseBodyDesc, lt as evaluate, m as buildApexTaskContext, mt as matchPatterns, n as missingSeoElements, nt as brainstormGate, o as TreeEntry, ot as solidReadGate, p as ApexTaskState, pt as SYSTEM_INSTALL, q as protectedPathGuard, r as descFromText, rt as docConsultedGate, s as parseEnrichment, st as PolicyContext, t as isHtmlLike, tt as ApexGate, u as parseField, ut as GIT_ASK, v as buildApexInstruction, vt as detectFramework, w as frameworkSolidGate, wt as isApexCommand, x as detectRequiredSkills, xt as ProjectType, y as buildClaudeMdContext, yt as DEV_KEYWORDS, z as SWIFT_PROTO_RE } from "./index-DmbOUJK8.mjs";
|
|
9
9
|
import { n as RouteResult, r as ScoredRef, t as RefMeta } from "./types-CY5qT2X1.mjs";
|
|
10
10
|
import { a as ReminderState, c as readState, d as throttleMs, i as registryFile, l as setStateField, n as addRoot, o as lessonsFileFor, r as readRoots, s as nowStamp, t as ensureMemoryGitignore, u as stateFileFor } from "./index-DLYhervv.mjs";
|
|
11
11
|
import { a as globToRe, i as scoreReferences, n as toRefMeta, o as parseFrontmatter, r as routeReferences, t as loadRefs } from "./index-DL8MxjuP.mjs";
|
|
12
12
|
import { a as taskStart, c as ensureStateDir, d as stateFilePath, f as acquireLock, i as taskCreate, l as loadState, n as ApexTaskFile, o as ApexState, r as taskComplete, s as apexStateDir, t as ApexTask, u as saveState } from "./index-CPoF_hLP.mjs";
|
|
13
13
|
import { _ as TIME_INTERVALS, a as formatCost, c as formatTokens, d as colors, f as progressiveColor, g as PROGRESS_CHARS, h as PROGRESS_BAR_DEFAULTS, i as formatBasename, l as ColorFn, m as GRADIENT_BLOCKS, n as generateGradientBar, o as formatPath, p as COLOR_THRESHOLDS, r as generateProgressBar, s as formatTimeLeft, t as ProgressBarOptions, u as Palette } from "./index-BWK8slRi.mjs";
|
|
14
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexState, ApexTask, ApexTaskFile, ApexTaskState, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, DocSatisfactionStatus, EXCLUDE_DIRS, FAIL_CLOSED, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, Guard, GuardContext, HarnessId, HarnessInfo, HarnessMode, HarnessVia, IndexSummary, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, ModularArchitecture, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, Palette, PolicyContext, PolicyResult, ProgressBarOptions, ProjectLayout, ProjectType, Prompt, PromptKind, RefMeta, ReminderState, RouteResult, SKILL_TRIGGERS, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, ScoredRef, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, TreeEntry, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvInt, parseField, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registerGuard, registryFile, requiredArchSkill, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, skillTriggerGate, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
|
|
14
|
+
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexState, ApexTask, ApexTaskFile, ApexTaskState, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, DocSatisfactionStatus, EXCLUDE_DIRS, FAIL_CLOSED, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, Guard, GuardContext, HarnessId, HarnessInfo, HarnessMode, HarnessVia, IndexSummary, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, ModularArchitecture, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, Palette, PolicyContext, PolicyResult, ProgressBarOptions, ProjectLayout, ProjectType, Prompt, PromptKind, RefMeta, ReminderState, RouteResult, SKILL_TRIGGERS, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, ScoredRef, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, TreeEntry, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, isHtmlLike, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvInt, parseField, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registerGuard, registryFile, requiredArchSkill, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, skillTriggerGate, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel, walkUpFor };
|
package/dist/index.mjs
CHANGED
|
@@ -2,18 +2,18 @@ import { a as parseEnvInt, i as splitTarget, n as MAX_LINES_ENV_KEY, r as resolv
|
|
|
2
2
|
import { i as ttlLabel, n as TTL_ENV_KEY, r as resolveTtlSec, t as DEFAULT_TTL_SEC } from "./ttl-BG55s6HZ.mjs";
|
|
3
3
|
import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "./layout-C0jaaCQC.mjs";
|
|
4
4
|
import { t as compactJson } from "./compact-json-DK2nX-MK.mjs";
|
|
5
|
-
import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-
|
|
5
|
+
import { i as walkUpFor, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-3kk7gCOp.mjs";
|
|
6
6
|
import { n as detectMode, r as modeFor, t as detectHarness } from "./harness-C8Nxxyn_.mjs";
|
|
7
|
-
import { A as
|
|
8
|
-
import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "./evaluate-
|
|
7
|
+
import { A as evaluateApex, C as MAX_EXA_RESULTS, D as APEX_GATES, E as detectCreationIntent, F as detectProjectType, I as isApexCommand, L as requiredArchSkill, M as solidReadGate, N as DEV_KEYWORDS, O as brainstormGate, P as detectModularArchitecture, S as frameworkSolidGate, T as capVerbosity, _ as buildClaudeMdContext, a as firstHeading, b as skillTriggerGate, c as parseBodyDesc, d as PROJECT_INDICATORS, f as buildApexTaskContext, g as buildApexInstruction, h as DEV_VERBS, i as firstComment, j as freshnessGate, k as docConsultedGate, l as parseField, m as loadApexTaskState, n as missingSeoElements, o as parseEnrichment, p as buildApexTaskInjection, r as descFromText, s as parseEntry, t as isHtmlLike, u as EXCLUDE_DIRS, v as detectClaudeMdProjectType, w as MAX_TOKENS, x as SKILL_TRIGGERS, y as detectRequiredSkills } from "./validate-CccewDwk.mjs";
|
|
8
|
+
import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "./evaluate-9ch1K2kt.mjs";
|
|
9
9
|
import { i as resolveSessions, n as formatDocSatisfactionStatus, r as isDocConsulted, t as formatDocDeny } from "./doc-helpers-Dd_x1-tZ.mjs";
|
|
10
10
|
import { i as parseFrontmatter, n as scoreReferences, r as globToRe, t as routeReferences } from "./router-D8cVrI-s.mjs";
|
|
11
11
|
import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
|
|
12
|
-
import { a as nowStamp, c as stateFileFor, i as lessonsFileFor, l as throttleMs, n as readRoots, o as readState, r as registryFile, s as setStateField, t as addRoot, u as ensureMemoryGitignore } from "./
|
|
12
|
+
import { a as nowStamp, c as stateFileFor, i as lessonsFileFor, l as throttleMs, n as readRoots, o as readState, r as registryFile, s as setStateField, t as addRoot, u as ensureMemoryGitignore } from "./registry-BkoEbdec.mjs";
|
|
13
13
|
import { n as jaccardSimilar, r as queryHash, t as compactMarkdown } from "./cache-C9z9LclL.mjs";
|
|
14
14
|
import { a as extractText, i as mcpCacheKey, n as cachePath, o as loadIndex, r as cacheStore, s as summarizeIndex, t as cacheLookup } from "./store-PrNPm6So.mjs";
|
|
15
15
|
import { t as incrementTrivialEditCounter } from "./freshness-otdUpuvP.mjs";
|
|
16
16
|
import { n as toRefMeta, t as loadRefs } from "./loader-CyAoJv2W.mjs";
|
|
17
17
|
import { a as ensureStateDir, c as stateFilePath, i as apexStateDir, l as acquireLock, n as taskCreate, o as loadState, r as taskStart, s as saveState, t as taskComplete } from "./state-ByhLeKyD.mjs";
|
|
18
18
|
import { a as formatPath, c as colors, d as GRADIENT_BLOCKS, f as PROGRESS_BAR_DEFAULTS, i as formatCost, l as progressiveColor, m as TIME_INTERVALS, n as generateProgressBar, o as formatTimeLeft, p as PROGRESS_CHARS, r as formatBasename, s as formatTokens, t as generateGradientBar, u as COLOR_THRESHOLDS } from "./statusline-D87eUNXl.mjs";
|
|
19
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, FAIL_CLOSED, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, SKILL_TRIGGERS, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvInt, parseField, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registerGuard, registryFile, requiredArchSkill, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, skillTriggerGate, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
|
|
19
|
+
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, FAIL_CLOSED, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, SKILL_TRIGGERS, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, isHtmlLike, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvInt, parseField, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registerGuard, registryFile, requiredArchSkill, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, skillTriggerGate, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel, walkUpFor };
|
package/dist/init/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as codexInit, i as clineInit, n as writeInitFile, o as cursorInit, r as claudeInit, s as geminiInit, t as initFor } from "../run-
|
|
1
|
+
import { a as codexInit, i as clineInit, n as writeInitFile, o as cursorInit, r as claudeInit, s as geminiInit, t as initFor } from "../run-Do2JltgU.mjs";
|
|
2
2
|
export { claudeInit, clineInit, codexInit, cursorInit, geminiInit, initFor, writeInitFile };
|
package/dist/memory/index.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { a as nowStamp, c as stateFileFor, i as lessonsFileFor, l as throttleMs, n as readRoots, o as readState, r as registryFile, s as setStateField, t as addRoot, u as ensureMemoryGitignore } from "../
|
|
1
|
+
import { a as nowStamp, c as stateFileFor, i as lessonsFileFor, l as throttleMs, n as readRoots, o as readState, r as registryFile, s as setStateField, t as addRoot, u as ensureMemoryGitignore } from "../registry-BkoEbdec.mjs";
|
|
2
|
+
import "../memory-la_KkjCS.mjs";
|
|
2
3
|
export { addRoot, ensureMemoryGitignore, lessonsFileFor, nowStamp, readRoots, readState, registryFile, setStateField, stateFileFor, throttleMs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/policy/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexTaskState, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, FAIL_CLOSED, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, Guard, GuardContext, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, ModularArchitecture, PHP_DECL_RE, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, PolicyContext, PolicyResult, ProjectType, SKILL_TRIGGERS, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, TreeEntry, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, capVerbosity, clearUserGuards, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, firstComment, firstHeading, frameworkSolidGate, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, loadApexTaskState, matchPatterns, parseBodyDesc, parseEnrichment, parseEntry, parseField, protectedPathGuard, registerGuard, requiredArchSkill, runGuards, securityGuard, skillTriggerGate, solidReadGate };
|
|
1
|
+
import { $ as APEX_GATES, A as GUARDS, B as TS_DECL_RE, C as SKILL_TRIGGERS, Ct as detectProjectType, D as capVerbosity, E as MAX_TOKENS, F as GO_DECL_RE, G as bashWriteGuard, H as ASK_WRITERS, I as JAVA_DECL_RE, J as ASK_PATTERNS, K as PROTECTED_FRAGMENTS, L as PHP_DECL_RE, M as registerGuard, N as runGuards, O as detectCreationIntent, P as installGuard, Q as GuardContext, R as PY_MODEL_RE, S as skillTriggerGate, St as detectModularArchitecture, T as MAX_EXA_RESULTS, Tt as requiredArchSkill, U as CODE_MUTATORS, V as interfaceSeparationGuard, W as CODE_REDIRECT, X as securityGuard, Y as CRITICAL_PATTERNS, Z as Guard, _ as DEV_VERBS, _t as evaluateFileSize, a as firstHeading, at as freshnessGate, b as detectClaudeMdProjectType, bt as ModularArchitecture, c as parseEntry, ct as PolicyResult, d as EXCLUDE_DIRS, dt as GIT_BLOCKED, et as ApexContext, f as PROJECT_INDICATORS, ft as PROJECT_INSTALL, g as loadApexTaskState, gt as countLines, h as buildApexTaskInjection, ht as FileSizeVerdict, i as firstComment, it as evaluateApex, j as clearUserGuards, k as FAIL_CLOSED, l as parseBodyDesc, lt as evaluate, m as buildApexTaskContext, mt as matchPatterns, n as missingSeoElements, nt as brainstormGate, o as TreeEntry, ot as solidReadGate, p as ApexTaskState, pt as SYSTEM_INSTALL, q as protectedPathGuard, r as descFromText, rt as docConsultedGate, s as parseEnrichment, st as PolicyContext, t as isHtmlLike, tt as ApexGate, u as parseField, ut as GIT_ASK, v as buildApexInstruction, vt as detectFramework, w as frameworkSolidGate, wt as isApexCommand, x as detectRequiredSkills, xt as ProjectType, y as buildClaudeMdContext, yt as DEV_KEYWORDS, z as SWIFT_PROTO_RE } from "../index-DmbOUJK8.mjs";
|
|
2
|
+
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexTaskState, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, FAIL_CLOSED, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, Guard, GuardContext, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, ModularArchitecture, PHP_DECL_RE, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, PolicyContext, PolicyResult, ProjectType, SKILL_TRIGGERS, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, TreeEntry, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, capVerbosity, clearUserGuards, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, firstComment, firstHeading, frameworkSolidGate, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, isHtmlLike, loadApexTaskState, matchPatterns, missingSeoElements, parseBodyDesc, parseEnrichment, parseEntry, parseField, protectedPathGuard, registerGuard, requiredArchSkill, runGuards, securityGuard, skillTriggerGate, solidReadGate };
|
package/dist/policy/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "../evaluate-
|
|
1
|
+
import { A as evaluateApex, C as MAX_EXA_RESULTS, D as APEX_GATES, E as detectCreationIntent, F as detectProjectType, I as isApexCommand, L as requiredArchSkill, M as solidReadGate, N as DEV_KEYWORDS, O as brainstormGate, P as detectModularArchitecture, S as frameworkSolidGate, T as capVerbosity, _ as buildClaudeMdContext, a as firstHeading, b as skillTriggerGate, c as parseBodyDesc, d as PROJECT_INDICATORS, f as buildApexTaskContext, g as buildApexInstruction, h as DEV_VERBS, i as firstComment, j as freshnessGate, k as docConsultedGate, l as parseField, m as loadApexTaskState, n as missingSeoElements, o as parseEnrichment, p as buildApexTaskInjection, r as descFromText, s as parseEntry, t as isHtmlLike, u as EXCLUDE_DIRS, v as detectClaudeMdProjectType, w as MAX_TOKENS, x as SKILL_TRIGGERS, y as detectRequiredSkills } from "../validate-CccewDwk.mjs";
|
|
2
|
+
import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "../evaluate-9ch1K2kt.mjs";
|
|
3
3
|
import "../policy-la_KkjCS.mjs";
|
|
4
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, FAIL_CLOSED, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, PHP_DECL_RE, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, SKILL_TRIGGERS, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, capVerbosity, clearUserGuards, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, firstComment, firstHeading, frameworkSolidGate, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, loadApexTaskState, matchPatterns, parseBodyDesc, parseEnrichment, parseEntry, parseField, protectedPathGuard, registerGuard, requiredArchSkill, runGuards, securityGuard, skillTriggerGate, solidReadGate };
|
|
4
|
+
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, FAIL_CLOSED, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, PHP_DECL_RE, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, SKILL_TRIGGERS, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, capVerbosity, clearUserGuards, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, firstComment, firstHeading, frameworkSolidGate, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, isHtmlLike, loadApexTaskState, matchPatterns, missingSeoElements, parseBodyDesc, parseEnrichment, parseEntry, parseField, protectedPathGuard, registerGuard, requiredArchSkill, runGuards, securityGuard, skillTriggerGate, solidReadGate };
|
|
@@ -9,6 +9,12 @@ const SKIP_DIRS = /(node_modules|vendor|dist|build|\.next|DerivedData|\.git)/;
|
|
|
9
9
|
function isCodeFile(p) {
|
|
10
10
|
return CODE_EXT.test(p) && !SKIP_DIRS.test(p);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Walk up from `dir` to the nearest ancestor directory containing `marker`.
|
|
14
|
+
* @param dir - Starting directory.
|
|
15
|
+
* @param marker - Sibling file/dir name to look for at each level.
|
|
16
|
+
* @returns The ancestor holding `marker`, or `null` at filesystem root.
|
|
17
|
+
*/
|
|
12
18
|
function walkUpFor(dir, marker) {
|
|
13
19
|
let current = resolve(dir);
|
|
14
20
|
while (current !== "/") {
|
|
@@ -29,4 +35,4 @@ function projectRoot(dir) {
|
|
|
29
35
|
return projectRootOrNull(dir) ?? process.cwd();
|
|
30
36
|
}
|
|
31
37
|
//#endregion
|
|
32
|
-
export { projectRoot as n, projectRootOrNull as r, isCodeFile as t };
|
|
38
|
+
export { walkUpFor as i, projectRoot as n, projectRootOrNull as r, isCodeFile as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as isCodeFile } from "./project-root-
|
|
2
|
-
import { t as evaluate } from "./evaluate-
|
|
1
|
+
import { t as isCodeFile } from "./project-root-3kk7gCOp.mjs";
|
|
2
|
+
import { t as evaluate } from "./evaluate-9ch1K2kt.mjs";
|
|
3
3
|
import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
|
|
4
4
|
import { execSync } from "node:child_process";
|
|
5
5
|
//#region src/cli/run.ts
|
|
@@ -11,7 +11,7 @@ function claudeInit(command) {
|
|
|
11
11
|
path: ".claude/settings.json",
|
|
12
12
|
content: json({ hooks: {
|
|
13
13
|
PreToolUse: [{
|
|
14
|
-
matcher: "Write|Edit",
|
|
14
|
+
matcher: "Write|Edit|Bash",
|
|
15
15
|
hooks: [{
|
|
16
16
|
type: "command",
|
|
17
17
|
command
|
|
@@ -113,7 +113,7 @@ const RUNNERS = {
|
|
|
113
113
|
* Build the wiring file(s) for a harness, or null when it has no hook
|
|
114
114
|
* integration (cli-mode harnesses use `harness check` in a pre-commit step).
|
|
115
115
|
*/
|
|
116
|
-
function initFor(id, command = `npx harness hook ${id}`) {
|
|
116
|
+
function initFor(id, command = `npx -y @fusengine/harness hook ${id}`) {
|
|
117
117
|
const make = RUNNERS[id];
|
|
118
118
|
if (!make) return null;
|
|
119
119
|
return [...make(command), {
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -366,7 +366,7 @@ declare function aipilotPostToolUse(payload: Record<string, unknown>, cwd: strin
|
|
|
366
366
|
//#endregion
|
|
367
367
|
//#region src/runtime/lifecycle/dispatch.d.ts
|
|
368
368
|
/** Which plugin's hooks.json invoked the harness (selects SessionStart behavior). */
|
|
369
|
-
type PluginScope = "core" | "solid" | "rules" | "carto" | "security" | "changelog" | "aipilot";
|
|
369
|
+
type PluginScope = "core" | "solid" | "rules" | "carto" | "security" | "changelog" | "aipilot" | "lessons" | "seo";
|
|
370
370
|
/** Inputs the lifecycle dispatcher needs (clock + roots injected). */
|
|
371
371
|
interface LifecycleInput {
|
|
372
372
|
event: string;
|
|
@@ -388,13 +388,16 @@ declare function dispatchLifecycle(input: LifecycleInput): string | null;
|
|
|
388
388
|
/**
|
|
389
389
|
* Dispatch the appropriate PostToolUse tracker for the invoking scope. Carto
|
|
390
390
|
* persists manual enrichments; security records skill reads + MCP research;
|
|
391
|
-
* changelog records watch research
|
|
391
|
+
* changelog records watch research; lessons arms the per-project throttle.
|
|
392
|
+
* Side-effect only.
|
|
392
393
|
* @param scope - The invoking plugin scope.
|
|
393
394
|
* @param event - The normalized event.
|
|
394
395
|
* @param input - The raw tool input.
|
|
395
396
|
* @param now - Clock.
|
|
397
|
+
* @param payload - The raw hook payload (for the lessons mark).
|
|
398
|
+
* @param cwd - The project root (for the lessons mark).
|
|
396
399
|
*/
|
|
397
|
-
declare function postTrackingSideEffects(scope: PluginScope, event: NormalizedEvent, input: Record<string, unknown>, now: number): void;
|
|
400
|
+
declare function postTrackingSideEffects(scope: PluginScope, event: NormalizedEvent, input: Record<string, unknown>, now: number, payload?: Record<string, unknown>, cwd?: string): void;
|
|
398
401
|
//#endregion
|
|
399
402
|
//#region src/runtime/lifecycle/changelog-research.d.ts
|
|
400
403
|
/**
|
|
@@ -409,12 +412,13 @@ declare function trackWatchResearch(tool: string, input: Record<string, unknown>
|
|
|
409
412
|
//#endregion
|
|
410
413
|
//#region src/runtime/lifecycle/cartographer/session-start.d.ts
|
|
411
414
|
/**
|
|
412
|
-
* Regenerate the project map for `cwd` on SessionStart.
|
|
413
|
-
*
|
|
415
|
+
* Regenerate the project map + plugin ecosystem map for `cwd` on SessionStart.
|
|
416
|
+
* Emits the ecosystem navigation context as additionalContext (or "").
|
|
414
417
|
* @param cwd - The working directory.
|
|
415
|
-
* @
|
|
418
|
+
* @param now - Clock for the ecosystem map banner timestamp.
|
|
419
|
+
* @returns The SessionStart additionalContext response, or "".
|
|
416
420
|
*/
|
|
417
|
-
declare function cartoSessionStart(cwd: string): string;
|
|
421
|
+
declare function cartoSessionStart(cwd: string, now?: number): string;
|
|
418
422
|
//#endregion
|
|
419
423
|
//#region src/runtime/lifecycle/cartographer/project-map.d.ts
|
|
420
424
|
/**
|
|
@@ -539,6 +543,71 @@ declare function loadSecurityState(now?: number, home?: string): Record<string,
|
|
|
539
543
|
/** Persist today's security state (indent 2, no trailing newline). */
|
|
540
544
|
declare function saveSecurityState(state: Record<string, unknown>, now?: number, home?: string): void;
|
|
541
545
|
//#endregion
|
|
546
|
+
//#region src/runtime/lifecycle/lessons/dispatch.d.ts
|
|
547
|
+
/**
|
|
548
|
+
* Route a fuse-lessons event to its handler. Returns the native stdout for
|
|
549
|
+
* context-injecting events (SessionStart/SubagentStart/Stop) or "" for the
|
|
550
|
+
* side-effect-only PostToolUse mark.
|
|
551
|
+
* @param event - The raw hook event name.
|
|
552
|
+
* @param payload - The raw hook payload.
|
|
553
|
+
* @param cwd - Project root for memory injection.
|
|
554
|
+
* @param now - Clock.
|
|
555
|
+
* @returns The native stdout (possibly empty).
|
|
556
|
+
*/
|
|
557
|
+
declare function dispatchLessons(event: string, payload: Record<string, unknown>, cwd: string, now: number): string;
|
|
558
|
+
//#endregion
|
|
559
|
+
//#region src/runtime/lifecycle/lessons/state.d.ts
|
|
560
|
+
/** Absolute `<root>/MEMORY/LESSON.md` — the curated, committable lessons file. */
|
|
561
|
+
declare function lessonsFileFor(root: string): string;
|
|
562
|
+
/** Absolute `<root>/MEMORY/state.json` — machine-local throttle counter. */
|
|
563
|
+
declare function lessonsStateFileFor(root: string): string;
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/runtime/lifecycle/seo/post-tool-use.d.ts
|
|
566
|
+
/**
|
|
567
|
+
* Validate the edited file's SEO completeness. Returns a deny message (for a
|
|
568
|
+
* `permissionDecision: deny` response) when HTML-like, opted-in, and missing
|
|
569
|
+
* elements; otherwise `null` (allow).
|
|
570
|
+
* @param payload - The raw PostToolUse payload.
|
|
571
|
+
* @returns The deny reason string, or `null` to allow.
|
|
572
|
+
*/
|
|
573
|
+
declare function seoPostToolUse(payload: Record<string, unknown>): string | null;
|
|
574
|
+
/**
|
|
575
|
+
* SEO PostToolUse as a ready native response: a `permissionDecision: deny`
|
|
576
|
+
* string when the edited file is missing SEO elements, else `null` (allow).
|
|
577
|
+
* @param payload - The raw PostToolUse payload.
|
|
578
|
+
* @returns The deny response string, or `null` to allow.
|
|
579
|
+
*/
|
|
580
|
+
declare function seoPostToolUseResponse(payload: Record<string, unknown>): string | null;
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/runtime/lifecycle/cartographer/ecosystem-map.d.ts
|
|
583
|
+
/**
|
|
584
|
+
* Generate the plugin ecosystem map under `<pluginsDir>/.cartographer`.
|
|
585
|
+
* @param now - Clock for the banner timestamp.
|
|
586
|
+
* @param pluginsDirOverride - Override for the marketplace plugins directory.
|
|
587
|
+
* @returns The map navigation context, or "".
|
|
588
|
+
*/
|
|
589
|
+
declare function generateEcosystemMap(now: number, pluginsDirOverride?: string): string;
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/policy/cartographer/build-tree.d.ts
|
|
592
|
+
/**
|
|
593
|
+
* Indented Unicode tree from scanned plugin items — pure text in, markdown out
|
|
594
|
+
* (no fs). Ports `build_tree.py`.
|
|
595
|
+
*/
|
|
596
|
+
/** A scanned `[type, name, desc]` plugin item (agent/skill/command/hooks). */
|
|
597
|
+
type ScanRow = readonly [type: string, name: string, desc: string];
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/runtime/lifecycle/cartographer/write-plugin-map.d.ts
|
|
600
|
+
/**
|
|
601
|
+
* Write `<outputDir>/<pluginName>/index.md` (indented linked tree) and recurse
|
|
602
|
+
* agents/skills/commands into their own index trees rooted there.
|
|
603
|
+
* @param outputDir - The map root directory.
|
|
604
|
+
* @param pluginName - Display name of the plugin (the index subfolder).
|
|
605
|
+
* @param version - Plugin version ("" to omit).
|
|
606
|
+
* @param items - The scanned `[type, name, desc]` rows.
|
|
607
|
+
* @param pluginPath - Absolute source plugin directory (for recursion).
|
|
608
|
+
*/
|
|
609
|
+
declare function writePluginMap(outputDir: string, pluginName: string, version: string, items: ReadonlyArray<ScanRow>, pluginPath: string): void;
|
|
610
|
+
//#endregion
|
|
542
611
|
//#region src/runtime/lifecycle-bridge.d.ts
|
|
543
612
|
/**
|
|
544
613
|
* Run the ported lifecycle/session/context hooks (SessionStart, SubagentStart/
|
|
@@ -609,4 +678,4 @@ interface PreContext {
|
|
|
609
678
|
*/
|
|
610
679
|
declare function handlePre(ctx: PreContext): Promise<HandleOutcome>;
|
|
611
680
|
//#endregion
|
|
612
|
-
export { Activity, DEFAULT_WINDOW_MS, DuplicationVerdict, type GateInput, HandleOptions, HandleOutcome, LifecycleInput, MCP_TTL_MS, McpIntercept, NormalizedEvent, PluginScope, PreContext, REQUIRED_AGENTS, SolidProfile, TRIVIAL_BUDGET, ToolEvent, activityFor, aipilotPostToolUse, cartoSessionStart, claudeHome, cleanupSession, countFiles, detectDuplication, detectSolidProfile, devContext, dispatchAipilot, dispatchLifecycle, dryGate, extractSymbols, fusengineCache, gate, generateProjectMap, getFileDesc, gitContext, handleHook, handlePre, harnessStateDir, injectRules, isMcpTool, isProject, isoUtc, lifecycleStdout, listChildren, loadEnriched, loadSecurityState, loadSessionState, logToolFailure, mcpPostStore, mcpPreIntercept, mergeLines, normalizeEvent, postEditContext, postEditTypescript, postTrackingSideEffects, preCommitGate, projectContext, promptSubmitContext, pruneEmptyDirs, purgeTtlTree, queryOf, readRules, recordActivity, removeOldFiles, respond, runSessionStartCleanups, sanitizeSessionId, saveApexState, saveSecurityState, saveSessionState, securityAdvisory, securityStateDir, securityStatePath, sessionStartCore, sessionStatePath, sessionsDir, solidDetectStart, subagentCacheContext, taskContext, todayUtc, trackAgentMemory, trackEnrichment, trackFile, trackMcpResearch, trackSessionChanges, trackSkillRead, trackWatchResearch, trimLogFile, validateRulesLoaded, validateTeammateOutput, writeTree };
|
|
681
|
+
export { Activity, DEFAULT_WINDOW_MS, DuplicationVerdict, type GateInput, HandleOptions, HandleOutcome, LifecycleInput, MCP_TTL_MS, McpIntercept, NormalizedEvent, PluginScope, PreContext, REQUIRED_AGENTS, SolidProfile, TRIVIAL_BUDGET, ToolEvent, activityFor, aipilotPostToolUse, cartoSessionStart, claudeHome, cleanupSession, countFiles, detectDuplication, detectSolidProfile, devContext, dispatchAipilot, dispatchLessons, dispatchLifecycle, dryGate, extractSymbols, fusengineCache, gate, generateEcosystemMap, generateProjectMap, getFileDesc, gitContext, handleHook, handlePre, harnessStateDir, injectRules, isMcpTool, isProject, isoUtc, lessonsFileFor, lessonsStateFileFor, lifecycleStdout, listChildren, loadEnriched, loadSecurityState, loadSessionState, logToolFailure, mcpPostStore, mcpPreIntercept, mergeLines, normalizeEvent, postEditContext, postEditTypescript, postTrackingSideEffects, preCommitGate, projectContext, promptSubmitContext, pruneEmptyDirs, purgeTtlTree, queryOf, readRules, recordActivity, removeOldFiles, respond, runSessionStartCleanups, sanitizeSessionId, saveApexState, saveSecurityState, saveSessionState, securityAdvisory, securityStateDir, securityStatePath, seoPostToolUse, seoPostToolUseResponse, sessionStartCore, sessionStatePath, sessionsDir, solidDetectStart, subagentCacheContext, taskContext, todayUtc, trackAgentMemory, trackEnrichment, trackFile, trackMcpResearch, trackSessionChanges, trackSkillRead, trackWatchResearch, trimLogFile, validateRulesLoaded, validateTeammateOutput, writePluginMap, writeTree };
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as projectLayout } from "../layout-C0jaaCQC.mjs";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as detectSolidProfile, A as dispatchLessons, At as activityFor, B as mergeLines, C as securityStateDir, Ct as trackFile, D as dispatchLifecycle, Dt as mcpPostStore, E as trackEnrichment, Et as isMcpTool, F as writePluginMap, G as trackSessionChanges, H as getFileDesc, I as generateProjectMap, J as saveApexState, K as validateRulesLoaded, L as isProject, M as lessonsStateFileFor, N as cartoSessionStart, O as aipilotPostToolUse, Ot as mcpPreIntercept, P as generateEcosystemMap, Q as subagentCacheContext, R as writeTree, S as saveSecurityState, St as recordActivity, T as todayUtc, Tt as MCP_TTL_MS, U as listChildren, V as countFiles, W as postEditTypescript, X as validateTeammateOutput, Y as logToolFailure, Z as trackAgentMemory, _ as trackWatchResearch, _t as sessionStatePath, a as TRIVIAL_BUDGET, at as pruneEmptyDirs, b as isoUtc, bt as taskContext, c as detectDuplication, ct as trimLogFile, d as lifecycleStdout, dt as projectContext, et as solidDetectStart, f as postEditContext, ft as claudeHome, g as postTrackingSideEffects, gt as saveSessionState, h as securityAdvisory, ht as sanitizeSessionId, i as REQUIRED_AGENTS, it as sessionStartCore, j as lessonsFileFor, k as dispatchAipilot, kt as queryOf, l as dryGate, lt as devContext, m as seoPostToolUseResponse, mt as loadSessionState, n as handlePre, nt as readRules, o as gate, ot as purgeTtlTree, p as seoPostToolUse, pt as fusengineCache, q as cleanupSession, r as DEFAULT_WINDOW_MS, rt as runSessionStartCleanups, s as preCommitGate, st as removeOldFiles, t as handleHook, tt as injectRules, u as extractSymbols, ut as gitContext, v as trackMcpResearch, vt as sessionsDir, w as securityStatePath, wt as normalizeEvent, x as loadSecurityState, xt as respond, y as trackSkillRead, yt as promptSubmitContext, z as loadEnriched } from "../handle-Cxgzd4pZ.mjs";
|
|
3
3
|
//#region src/runtime/storage.ts
|
|
4
4
|
/**
|
|
5
5
|
* The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
|
|
@@ -9,4 +9,4 @@ function harnessStateDir(root) {
|
|
|
9
9
|
return projectLayout(root).stateDir;
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
|
-
export { DEFAULT_WINDOW_MS, MCP_TTL_MS, REQUIRED_AGENTS, TRIVIAL_BUDGET, activityFor, aipilotPostToolUse, cartoSessionStart, claudeHome, cleanupSession, countFiles, detectDuplication, detectSolidProfile, devContext, dispatchAipilot, dispatchLifecycle, dryGate, extractSymbols, fusengineCache, gate, generateProjectMap, getFileDesc, gitContext, handleHook, handlePre, harnessStateDir, injectRules, isMcpTool, isProject, isoUtc, lifecycleStdout, listChildren, loadEnriched, loadSecurityState, loadSessionState, logToolFailure, mcpPostStore, mcpPreIntercept, mergeLines, normalizeEvent, postEditContext, postEditTypescript, postTrackingSideEffects, preCommitGate, projectContext, promptSubmitContext, pruneEmptyDirs, purgeTtlTree, queryOf, readRules, recordActivity, removeOldFiles, respond, runSessionStartCleanups, sanitizeSessionId, saveApexState, saveSecurityState, saveSessionState, securityAdvisory, securityStateDir, securityStatePath, sessionStartCore, sessionStatePath, sessionsDir, solidDetectStart, subagentCacheContext, taskContext, todayUtc, trackAgentMemory, trackEnrichment, trackFile, trackMcpResearch, trackSessionChanges, trackSkillRead, trackWatchResearch, trimLogFile, validateRulesLoaded, validateTeammateOutput, writeTree };
|
|
12
|
+
export { DEFAULT_WINDOW_MS, MCP_TTL_MS, REQUIRED_AGENTS, TRIVIAL_BUDGET, activityFor, aipilotPostToolUse, cartoSessionStart, claudeHome, cleanupSession, countFiles, detectDuplication, detectSolidProfile, devContext, dispatchAipilot, dispatchLessons, dispatchLifecycle, dryGate, extractSymbols, fusengineCache, gate, generateEcosystemMap, generateProjectMap, getFileDesc, gitContext, handleHook, handlePre, harnessStateDir, injectRules, isMcpTool, isProject, isoUtc, lessonsFileFor, lessonsStateFileFor, lifecycleStdout, listChildren, loadEnriched, loadSecurityState, loadSessionState, logToolFailure, mcpPostStore, mcpPreIntercept, mergeLines, normalizeEvent, postEditContext, postEditTypescript, postTrackingSideEffects, preCommitGate, projectContext, promptSubmitContext, pruneEmptyDirs, purgeTtlTree, queryOf, readRules, recordActivity, removeOldFiles, respond, runSessionStartCleanups, sanitizeSessionId, saveApexState, saveSecurityState, saveSessionState, securityAdvisory, securityStateDir, securityStatePath, seoPostToolUse, seoPostToolUseResponse, sessionStartCore, sessionStatePath, sessionsDir, solidDetectStart, subagentCacheContext, taskContext, todayUtc, trackAgentMemory, trackEnrichment, trackFile, trackMcpResearch, trackSessionChanges, trackSkillRead, trackWatchResearch, trimLogFile, validateRulesLoaded, validateTeammateOutput, writePluginMap, writeTree };
|
package/dist/util/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { compactJson, isCodeFile, projectRoot, projectRootOrNull };
|
|
1
|
+
import { a as compactJson, i as walkUpFor, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "../index-BEMumjOw.mjs";
|
|
2
|
+
export { compactJson, isCodeFile, projectRoot, projectRootOrNull, walkUpFor };
|
package/dist/util/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { t as compactJson } from "../compact-json-DK2nX-MK.mjs";
|
|
2
|
-
import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "../project-root-
|
|
2
|
+
import { i as walkUpFor, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "../project-root-3kk7gCOp.mjs";
|
|
3
3
|
import "../util-la_KkjCS.mjs";
|
|
4
|
-
export { compactJson, isCodeFile, projectRoot, projectRootOrNull };
|
|
4
|
+
export { compactJson, isCodeFile, projectRoot, projectRootOrNull, walkUpFor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as resolveMaxLines } from "./limits-CHn8AIL1.mjs";
|
|
2
|
-
import { k as countLines } from "./evaluate-
|
|
2
|
+
import { k as countLines } from "./evaluate-9ch1K2kt.mjs";
|
|
3
3
|
import { r as isDocConsulted, t as formatDocDeny } from "./doc-helpers-Dd_x1-tZ.mjs";
|
|
4
4
|
import { t as routeReferences } from "./router-D8cVrI-s.mjs";
|
|
5
5
|
import { join } from "node:path";
|
|
@@ -1034,4 +1034,49 @@ function descFromText(suffix, text, mdField) {
|
|
|
1034
1034
|
return "";
|
|
1035
1035
|
}
|
|
1036
1036
|
//#endregion
|
|
1037
|
-
|
|
1037
|
+
//#region src/policy/seo/validate.ts
|
|
1038
|
+
/**
|
|
1039
|
+
* SEO completeness checks — pure text in, missing-items out (no fs). Ports the
|
|
1040
|
+
* `validate()` of `seo/hooks/validate-seo.ts` using regex instead of cheerio so
|
|
1041
|
+
* the harness keeps zero runtime HTML-parser dependency (presence-only gate).
|
|
1042
|
+
*/
|
|
1043
|
+
/** Extensions the SEO hook validates (HTML-like rendered output). */
|
|
1044
|
+
const HTML_LIKE = /\.(html|astro|tsx|vue|blade\.php)$/;
|
|
1045
|
+
/** True when `path` is an HTML-like file the SEO hook should validate. */
|
|
1046
|
+
function isHtmlLike(path) {
|
|
1047
|
+
return HTML_LIKE.test(path);
|
|
1048
|
+
}
|
|
1049
|
+
/** True when a `<tag …>…</tag>` carries non-empty inner text. */
|
|
1050
|
+
function hasNonEmptyTag(html, tag) {
|
|
1051
|
+
const m = new RegExp(`<${tag}[\\s>][\\s\\S]*?</${tag}>`, "i").exec(html);
|
|
1052
|
+
return !!m && m[0].replace(/<[^>]*>/g, "").trim().length > 0;
|
|
1053
|
+
}
|
|
1054
|
+
/** True when a `<meta …>` whose `selAttr=selVal` has a non-empty `content`. */
|
|
1055
|
+
function hasMetaContent(html, selAttr, selVal) {
|
|
1056
|
+
const tag = new RegExp(`<meta\\b[^>]*\\b${selAttr}\\s*=\\s*["']${selVal}["'][^>]*>`, "i").exec(html)?.[0] ?? "";
|
|
1057
|
+
return (/\bcontent\s*=\s*["']([^"']*)["']/i.exec(tag)?.[1] ?? "").trim().length > 0;
|
|
1058
|
+
}
|
|
1059
|
+
/** True when a `<link rel="canonical">` carries a non-empty `href`. */
|
|
1060
|
+
function hasCanonical(html) {
|
|
1061
|
+
const tag = /<link\b[^>]*\brel\s*=\s*["']canonical["'][^>]*>/i.exec(html)?.[0] ?? "";
|
|
1062
|
+
return (/\bhref\s*=\s*["']([^"']*)["']/i.exec(tag)?.[1] ?? "").trim().length > 0;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Report the SEO elements missing from HTML-like content (title, meta
|
|
1066
|
+
* description, OG title/description/image, canonical, JSON-LD schema).
|
|
1067
|
+
* @param html - The file content.
|
|
1068
|
+
* @returns The missing element labels (empty when complete).
|
|
1069
|
+
*/
|
|
1070
|
+
function missingSeoElements(html) {
|
|
1071
|
+
const missing = [];
|
|
1072
|
+
if (!hasNonEmptyTag(html, "title")) missing.push("<title>");
|
|
1073
|
+
if (!hasMetaContent(html, "name", "description")) missing.push("<meta name='description'>");
|
|
1074
|
+
if (!hasMetaContent(html, "property", "og:title")) missing.push("og:title");
|
|
1075
|
+
if (!hasMetaContent(html, "property", "og:description")) missing.push("og:description");
|
|
1076
|
+
if (!hasMetaContent(html, "property", "og:image")) missing.push("og:image");
|
|
1077
|
+
if (!hasCanonical(html)) missing.push("canonical");
|
|
1078
|
+
if (!/<script\b[^>]*type\s*=\s*["']application\/ld\+json["']/i.test(html)) missing.push("JSON-LD schema");
|
|
1079
|
+
return missing;
|
|
1080
|
+
}
|
|
1081
|
+
//#endregion
|
|
1082
|
+
export { evaluateApex as A, MAX_EXA_RESULTS as C, APEX_GATES as D, detectCreationIntent as E, detectProjectType as F, isApexCommand as I, requiredArchSkill as L, solidReadGate as M, DEV_KEYWORDS as N, brainstormGate as O, detectModularArchitecture as P, frameworkSolidGate as S, capVerbosity as T, buildClaudeMdContext as _, firstHeading as a, skillTriggerGate as b, parseBodyDesc as c, PROJECT_INDICATORS as d, buildApexTaskContext as f, buildApexInstruction as g, DEV_VERBS as h, firstComment as i, freshnessGate as j, docConsultedGate as k, parseField as l, loadApexTaskState as m, missingSeoElements as n, parseEnrichment as o, buildApexTaskInjection as p, descFromText as r, parseEntry as s, isHtmlLike as t, EXCLUDE_DIRS as u, detectClaudeMdProjectType as v, MAX_TOKENS as w, SKILL_TRIGGERS as x, detectRequiredSkills as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusengine/harness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
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",
|
package/dist/claude-B9FYp0Yw.mjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { t as evaluate } from "./evaluate-j3gRJ_ng.mjs";
|
|
2
|
-
import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
|
|
3
|
-
//#region src/adapters/claude/index.ts
|
|
4
|
-
/**
|
|
5
|
-
* Claude Code adapter — the thin Claude-only shim over the portable policy core.
|
|
6
|
-
* Reads the hook stdin payload and emits hookSpecificOutput responses.
|
|
7
|
-
*/
|
|
8
|
-
/** Read & parse the Claude hook payload from stdin (empty object on bad input). */
|
|
9
|
-
async function readClaudeInput() {
|
|
10
|
-
const text = await Bun.stdin.text();
|
|
11
|
-
if (!text.trim()) return {};
|
|
12
|
-
try {
|
|
13
|
-
const parsed = JSON.parse(text);
|
|
14
|
-
return typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
15
|
-
} catch {
|
|
16
|
-
return {};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/** A `deny` hook response for a given event. */
|
|
20
|
-
function denyResponse(event, reason) {
|
|
21
|
-
return JSON.stringify({ hookSpecificOutput: {
|
|
22
|
-
hookEventName: event,
|
|
23
|
-
permissionDecision: "deny",
|
|
24
|
-
permissionDecisionReason: reason
|
|
25
|
-
} });
|
|
26
|
-
}
|
|
27
|
-
/** An `additionalContext` injection response. */
|
|
28
|
-
function contextResponse(event, text) {
|
|
29
|
-
return JSON.stringify({ hookSpecificOutput: {
|
|
30
|
-
hookEventName: event,
|
|
31
|
-
additionalContext: text
|
|
32
|
-
} });
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Render a portable {@link Prompt} as a Claude Code hook response:
|
|
36
|
-
* `block` → `permissionDecision: deny`, `ask` → `permissionDecision: ask`
|
|
37
|
-
* (interactive confirm), `inform` → `additionalContext`.
|
|
38
|
-
*/
|
|
39
|
-
function toClaudeResponse(event, prompt) {
|
|
40
|
-
const reason = formatPrompt(prompt);
|
|
41
|
-
if (prompt.kind === "block") return denyResponse(event, reason);
|
|
42
|
-
if (prompt.kind === "ask") return JSON.stringify({ hookSpecificOutput: {
|
|
43
|
-
hookEventName: event,
|
|
44
|
-
permissionDecision: "ask",
|
|
45
|
-
permissionDecisionReason: reason
|
|
46
|
-
} });
|
|
47
|
-
return contextResponse(event, reason);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Run the bundled policy over a Claude payload and return the native response
|
|
51
|
-
* string (deny/ask/additionalContext), or null to allow.
|
|
52
|
-
*/
|
|
53
|
-
function guard(input) {
|
|
54
|
-
const result = evaluate({
|
|
55
|
-
tool: input.tool_name ?? "Write",
|
|
56
|
-
filePath: input.tool_input?.file_path,
|
|
57
|
-
content: input.tool_input?.content ?? input.tool_input?.new_string,
|
|
58
|
-
command: input.tool_input?.command
|
|
59
|
-
});
|
|
60
|
-
if (result.decision === "allow" || !result.prompt) return null;
|
|
61
|
-
return toClaudeResponse(input.hook_event_name ?? "PreToolUse", result.prompt);
|
|
62
|
-
}
|
|
63
|
-
/** @deprecated use {@link guard}. Kept for back-compat. */
|
|
64
|
-
const fileSizeGuard = guard;
|
|
65
|
-
//#endregion
|
|
66
|
-
export { readClaudeInput as a, guard as i, denyResponse as n, toClaudeResponse as o, fileSizeGuard as r, contextResponse as t };
|
|
File without changes
|