@fusengine/harness 0.1.43 → 0.1.45

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.
Files changed (47) hide show
  1. package/dist/adapters/claude/index.d.mts +2 -2
  2. package/dist/adapters/claude/index.mjs +2 -2
  3. package/dist/adapters/cline/index.mjs +1 -1
  4. package/dist/adapters/codex/index.d.mts +1 -1
  5. package/dist/adapters/codex/index.mjs +1 -1
  6. package/dist/adapters/cursor/index.mjs +1 -1
  7. package/dist/adapters/gemini/index.mjs +1 -1
  8. package/dist/cache/index.d.mts +2 -2
  9. package/dist/cache/index.mjs +2 -2
  10. package/dist/{claude-CeRYMOaG.mjs → claude-DLh0fHWM.mjs} +6 -2
  11. package/dist/cli/bin.mjs +227 -7
  12. package/dist/cli/index.mjs +1 -1
  13. package/dist/config/index.d.mts +1 -1
  14. package/dist/config/index.mjs +1 -2
  15. package/dist/{doc-helpers-D14nkD5D.d.mts → doc-helpers-BNfYWvYv.d.mts} +9 -1
  16. package/dist/{doc-helpers-BhzDmJ18.mjs → doc-helpers-CWZegVdR.mjs} +14 -5
  17. package/dist/{dotenv-DGyLln7U.mjs → dotenv-B9nM4cuQ.mjs} +26 -1
  18. package/dist/evaluate-d7Pp8XJH.mjs +784 -0
  19. package/dist/freshness/index.d.mts +1 -1
  20. package/dist/freshness/index.mjs +1 -1
  21. package/dist/{handle-BTHcKWQ5.mjs → handle-DJaaD2BT.mjs} +849 -395
  22. package/dist/home-state-mKZxP4oZ.mjs +52 -0
  23. package/dist/{index-D7GpOmkl.d.mts → index-BA-SqNR7.d.mts} +1 -1
  24. package/dist/{index-BX-xcvhY.d.mts → index-BUwEmIK-.d.mts} +10 -1
  25. package/dist/{index-DXQfL1u8.d.mts → index-BXPySPxE.d.mts} +7 -1
  26. package/dist/{index-CwOdFBOr.d.mts → index-BxjzFraL.d.mts} +3 -1
  27. package/dist/{index-DN4cZDbU.d.mts → index-CVhw7eA0.d.mts} +111 -23
  28. package/dist/index.d.mts +6 -6
  29. package/dist/index.mjs +8 -9
  30. package/dist/{loader-Bn-DbZmt.mjs → loader-AGz4nK7d.mjs} +1 -1
  31. package/dist/{mcp-store-CnsW9oFj.mjs → mcp-store-BkBDmuxN.mjs} +22 -5
  32. package/dist/policy/index.d.mts +2 -2
  33. package/dist/policy/index.mjs +3 -3
  34. package/dist/refs/index.mjs +2 -2
  35. package/dist/{router-BfX0hJg8.mjs → router-PKVNBHge.mjs} +11 -1
  36. package/dist/{run-jgivVDv6.mjs → run-DLXtA5DH.mjs} +1 -1
  37. package/dist/runtime/index.d.mts +71 -14
  38. package/dist/runtime/index.mjs +3 -3
  39. package/dist/{session-state-Dzq6yrw7.d.mts → session-state-D4F_Dub6.d.mts} +1 -1
  40. package/dist/state/index.d.mts +1 -1
  41. package/dist/{store-CdWOQ9zD.mjs → store-CNjFenWe.mjs} +3 -50
  42. package/dist/tracking/index.d.mts +1 -1
  43. package/dist/tracking/index.mjs +1 -1
  44. package/dist/{validate-xi-zc-22.mjs → validate-DcQaKzau.mjs} +538 -84
  45. package/package.json +1 -1
  46. package/dist/evaluate-CeivW6G0.mjs +0 -477
  47. package/dist/ttl-BG55s6HZ.mjs +0 -20
@@ -0,0 +1,52 @@
1
+ import { t as atomicWrite } from "./json-io-DisYd2fb.mjs";
2
+ import { join } from "node:path";
3
+ import { existsSync, mkdirSync, readFileSync } from "node:fs";
4
+ import { homedir } from "node:os";
5
+ //#region src/runtime/home-state.ts
6
+ /** Home `~/.claude` dir — per-harness config (CLAUDE.md, logs, plugins). */
7
+ function claudeHome(home = homedir()) {
8
+ return join(home, ".claude");
9
+ }
10
+ /** Neutral, harness-agnostic home for fuse-harness's OWN cache/state: `~/.fuse-harness`. */
11
+ function fuseHarnessHome(home = homedir()) {
12
+ return join(home, ".fuse-harness");
13
+ }
14
+ /** `~/.fuse-harness/cache` base dir for session/cache state (shared across harnesses). */
15
+ function fusengineCache(home = homedir()) {
16
+ return join(fuseHarnessHome(home), "cache");
17
+ }
18
+ /** `~/.fuse-harness/cache/sessions` — per-session JSON state dir. */
19
+ function sessionsDir(home = homedir()) {
20
+ return join(fusengineCache(home), "sessions");
21
+ }
22
+ const SID_RE = /^[a-zA-Z0-9_-]{1,128}$/;
23
+ /** Validate a session id (1-128 url-safe chars); null when invalid. */
24
+ function sanitizeSessionId(sid) {
25
+ const s = String(sid ?? "").trim();
26
+ return SID_RE.test(s) ? s : null;
27
+ }
28
+ /** Unified per-session state file path: `sessions/session-<sid>.json`. */
29
+ function sessionStatePath(sid, home = homedir()) {
30
+ return join(sessionsDir(home), `session-${sid}.json`);
31
+ }
32
+ /** Load a session-state dict, or `{}` when missing/corrupt (mirrors Python). */
33
+ function loadSessionState(sid, home = homedir()) {
34
+ const path = sessionStatePath(sid, home);
35
+ try {
36
+ if (!existsSync(path)) return {};
37
+ const data = JSON.parse(readFileSync(path, "utf-8"));
38
+ return typeof data === "object" && data !== null && !Array.isArray(data) ? data : {};
39
+ } catch {
40
+ return {};
41
+ }
42
+ }
43
+ /** Atomically persist a session-state dict (0o600 via atomicWrite, indent 2). */
44
+ function saveSessionState(sid, state, home = homedir()) {
45
+ mkdirSync(sessionsDir(home), {
46
+ recursive: true,
47
+ mode: 448
48
+ });
49
+ atomicWrite(sessionStatePath(sid, home), JSON.stringify(state, null, 2));
50
+ }
51
+ //#endregion
52
+ export { sanitizeSessionId as a, sessionsDir as c, loadSessionState as i, fuseHarnessHome as n, saveSessionState as o, fusengineCache as r, sessionStatePath as s, claudeHome as t };
@@ -1,4 +1,4 @@
1
- import { t as AuthEntry } from "./doc-helpers-D14nkD5D.mjs";
1
+ import { t as AuthEntry } from "./doc-helpers-BNfYWvYv.mjs";
2
2
 
3
3
  //#region src/state/lock.d.ts
4
4
  /**
@@ -57,8 +57,15 @@ declare function webfetchCacheWrite(dir: string, tool: string, key: string, body
57
57
  declare function mcpCacheKey(tool: string, query: string): string;
58
58
  /** Path of a cache entry under `dir`. */
59
59
  declare function cachePath(dir: string, tool: string, query: string): string;
60
+ /** A cache hit's body plus its age in ms (now − mtime), for caller-side reporting. */
61
+ interface CacheHit {
62
+ body: string;
63
+ ageMs: number;
64
+ }
60
65
  /** Read a cached entry if it exists and is fresh (mtime within `ttlMs`), else null. */
61
66
  declare function cacheLookup(dir: string, tool: string, query: string, ttlMs: number, now: number): string | null;
67
+ /** Like {@link cacheLookup}, but also reports the entry's age (for `CACHE HIT` wrapper text). */
68
+ declare function cacheLookupMeta(dir: string, tool: string, query: string, ttlMs: number, now: number): CacheHit | null;
62
69
  /**
63
70
  * First fresh cache file whose body contains the (normalized, case-insensitive)
64
71
  * query substring, else null. Relaxes the exact-key match to lift the hit-rate —
@@ -69,7 +76,9 @@ declare function cacheLookup(dir: string, tool: string, query: string, ttlMs: nu
69
76
  * @param now - Current epoch ms.
70
77
  */
71
78
  declare function cacheLookupSubstring(dir: string, query: string, ttlMs: number, now: number): string | null;
79
+ /** Like {@link cacheLookupSubstring}, but also reports the matched entry's age. */
80
+ declare function cacheLookupSubstringMeta(dir: string, query: string, ttlMs: number, now: number): CacheHit | null;
72
81
  /** Store a cache entry (creates the dir; no-op on empty content). */
73
82
  declare function cacheStore(dir: string, tool: string, query: string, content: string): void;
74
83
  //#endregion
75
- export { mcpCacheKey as a, extractText as c, summarizeIndex as d, compactMarkdown as f, cacheStore as i, IndexSummary as l, queryHash as m, cacheLookupSubstring as n, mcpCacheWrite as o, jaccardSimilar as p, cachePath as r, webfetchCacheWrite as s, cacheLookup as t, loadIndex as u };
84
+ export { queryHash as _, cacheLookupSubstringMeta as a, mcpCacheKey as c, extractText as d, IndexSummary as f, jaccardSimilar as g, compactMarkdown as h, cacheLookupSubstring as i, mcpCacheWrite as l, summarizeIndex as m, cacheLookup as n, cachePath as o, loadIndex as p, cacheLookupMeta as r, cacheStore as s, CacheHit as t, webfetchCacheWrite as u };
@@ -9,7 +9,13 @@ import { i as HarnessId } from "./harness-BPPu5CrN.mjs";
9
9
  declare function parseEnvInt(raw: string | undefined, fallback: number): number;
10
10
  //#endregion
11
11
  //#region src/config/ttl.d.ts
12
- /** Default enforcement-freshness window, in seconds (2 minutes). */
12
+ /**
13
+ * Default enforcement-freshness window, in seconds (2 minutes). Matches the
14
+ * plugin's original `FUSE_ENFORCE_TTL_SEC` default. This is the constant that
15
+ * actually reaches production (via `resolveTtlSec` -> `bin.ts`); `gate.ts`'s
16
+ * `DEFAULT_WINDOW_MS` is only a fallback for direct programmatic callers that
17
+ * omit `windowMs` (e.g. tests) and never applies on the real CLI path.
18
+ */
13
19
  declare const DEFAULT_TTL_SEC = 120;
14
20
  /** Default env var name carrying the TTL override. */
15
21
  declare const TTL_ENV_KEY = "FUSE_ENFORCE_TTL_SEC";
@@ -28,6 +28,8 @@ declare function denyResponse(event: string, reason: string): string;
28
28
  declare function blockResponse(reason: string): string;
29
29
  /** An `additionalContext` injection response. */
30
30
  declare function contextResponse(event: string, text: string): string;
31
+ /** A raw `systemMessage` notice — shown to the user without blocking the tool. Mirrors the shared Python `hook_output.allow_pass`/`post_pass` convention. */
32
+ declare function systemMessage(text: string): string;
31
33
  /**
32
34
  * Render a portable {@link Prompt} as a Claude Code hook response:
33
35
  * `block` → `permissionDecision: deny`, `ask` → `permissionDecision: ask`
@@ -42,4 +44,4 @@ declare function guard(input: ClaudeHookInput): string | null;
42
44
  /** @deprecated use {@link guard}. Kept for back-compat. */
43
45
  declare const fileSizeGuard: typeof guard;
44
46
  //#endregion
45
- export { fileSizeGuard as a, toClaudeResponse as c, denyResponse as i, blockResponse as n, guard as o, contextResponse as r, readClaudeInput as s, ClaudeHookInput as t };
47
+ export { fileSizeGuard as a, systemMessage as c, denyResponse as i, toClaudeResponse as l, blockResponse as n, guard as o, contextResponse as r, readClaudeInput as s, ClaudeHookInput as t };
@@ -1,5 +1,5 @@
1
1
  import { t as Prompt } from "./types-D56jSgD9.mjs";
2
- import { t as AuthEntry } from "./doc-helpers-D14nkD5D.mjs";
2
+ import { t as AuthEntry } from "./doc-helpers-BNfYWvYv.mjs";
3
3
  import { t as RefMeta } from "./types-CY5qT2X1.mjs";
4
4
 
5
5
  //#region src/policy/detect-project.d.ts
@@ -41,6 +41,18 @@ declare function detectProjectType(dir: string): ProjectType;
41
41
  declare function detectFramework(filePath: string, content: string): string;
42
42
  //#endregion
43
43
  //#region src/policy/file-size.d.ts
44
+ /**
45
+ * Fixed marketplace plugins root — parity with Python `enforce-file-size.py`'s
46
+ * literal, unexpanded `~/...` string. Exported: reused by
47
+ * `policy/apex.ts::solidReadGate` for its "no reference matched" deny message.
48
+ */
49
+ declare const PLUGINS_DIR = "~/.claude/plugins/marketplaces/fusengine-plugins/plugins";
50
+ /**
51
+ * Skill-dir fragment per framework — parity with Python
52
+ * `enforce-file-size.py::get_solid_ref()` (falls back to `generic/`). Exported:
53
+ * reused by `policy/apex.ts::solidReadGate` (see {@link PLUGINS_DIR}).
54
+ */
55
+ declare const SOLID_REF: Record<string, string>;
44
56
  /** Verdict from {@link evaluateFileSize}. */
45
57
  interface FileSizeVerdict {
46
58
  ok: boolean;
@@ -56,11 +68,34 @@ interface FileSizeVerdict {
56
68
  */
57
69
  declare function countLines(content: string): number;
58
70
  /**
71
+ * Count non-empty, non-comment lines — parity with the Python `count_code_lines`
72
+ * shared by the framework-specific SOLID validators: `_shared/scripts/validate_solid_common.py`
73
+ * (imported by `nextjs-expert/scripts/validate-nextjs-solid.py` and
74
+ * `swift-apple-expert/scripts/validate-swift-solid.py`), duplicated verbatim in
75
+ * `react-expert/scripts/validate-react-solid.py` / `laravel-expert/scripts/validate-laravel-solid.py`.
76
+ * Strips blank lines and lines starting with `//` or `*` — a SINGLE fixed rule
77
+ * for all 4 callers (the Python `comment` param defaults to, and every real
78
+ * call site leaves it at, `"//"` — never per-language despite covering
79
+ * ts/tsx/js/jsx, php and swift).
80
+ *
81
+ * Deliberately distinct from two other "code-only" counters already in this
82
+ * repo, neither of which is a faithful substitute here:
83
+ * - `countLoc` (`runtime/lifecycle/check-file-size.ts`): a genuinely
84
+ * per-language table (PHP additionally strips `#`, Python strips
85
+ * `#`/`"""`/`'''`) — ported from the unrelated `solid/scripts/check-file-size.py`.
86
+ * - `countCodeLines` (`runtime/lifecycle/aipilot/solid-compliance.ts`): also
87
+ * strips `#` — ported from `ai-pilot/scripts/check-solid-compliance.py`.
88
+ * Reusing either would silently strip PHP `#`/Python-style comments that the
89
+ * real react/nextjs/laravel/swift validators do NOT strip.
90
+ * @param content - The file content to measure.
91
+ */
92
+ declare function countFrameworkCodeLines(content: string): number;
93
+ /**
59
94
  * Evaluate a file's line count against the SOLID limit.
60
95
  * @param lines - the file's line count
61
96
  * @param max - the limit (defaults to `resolveMaxLines()`)
62
97
  */
63
- declare function evaluateFileSize(lines: number, max?: number): FileSizeVerdict;
98
+ declare function evaluateFileSize(lines: number, max?: number, filePath?: string, framework?: string, displayLines?: number): FileSizeVerdict;
64
99
  //#endregion
65
100
  //#region src/policy/patterns.d.ts
66
101
  /**
@@ -110,6 +145,12 @@ interface PolicyResult {
110
145
  */
111
146
  declare function evaluate(ctx: PolicyContext): PolicyResult;
112
147
  //#endregion
148
+ //#region src/policy/apex-gates.d.ts
149
+ /** Gate: the routed SOLID references for this edit must have been read. */
150
+ declare const solidReadGate: ApexGate;
151
+ /** Gate: the required prior agents (explore + research) must have run within the window. */
152
+ declare const freshnessGate: ApexGate;
153
+ //#endregion
113
154
  //#region src/policy/apex.d.ts
114
155
  /**
115
156
  * Session context for the stateful APEX gates. The harness adapter supplies this
@@ -129,6 +170,10 @@ interface ApexContext {
129
170
  refsRead?: string[];
130
171
  /** Whether the required prior agents (explore + research) ran within the freshness window. */
131
172
  agentsFresh?: boolean;
173
+ /** Names of REQUIRED_AGENTS that have NOT run fresh (subset), for a precise freshnessGate message. Absent → generic wording. */
174
+ missingAgents?: string[];
175
+ /** Freshness window in ms, used only to label the block message with its TTL (e.g. "2min"). */
176
+ windowMs?: number;
132
177
  /** Whether brainstorming is required for this edit (creation intent on a new file). */
133
178
  brainstormRequired?: boolean;
134
179
  /** Whether the brainstorming agent ran within the window. */
@@ -136,12 +181,8 @@ interface ApexContext {
136
181
  }
137
182
  /** A single APEX gate: returns a blocking {@link Prompt}, or null to pass. */
138
183
  type ApexGate = (ctx: ApexContext) => Prompt | null;
139
- /** Gate: any one documentation source (Context7, Exa, or web) must have been consulted this session. */
184
+ /** Gate: BOTH Context7 AND Exa (or a web fallback alone) must have been consulted this session. */
140
185
  declare const docConsultedGate: ApexGate;
141
- /** Gate: the routed SOLID references for this edit must have been read. */
142
- declare const solidReadGate: ApexGate;
143
- /** Gate: the required prior agents (explore + research) must have run within the window. */
144
- declare const freshnessGate: ApexGate;
145
186
  /** Gate: brainstorming must precede creating new files when flagged. */
146
187
  declare const brainstormGate: ApexGate;
147
188
  /** Default APEX gate chain (brainstorm, freshness, docs, SOLID refs). */
@@ -164,10 +205,15 @@ interface GuardContext {
164
205
  type Guard = (ctx: GuardContext) => Prompt | null;
165
206
  //#endregion
166
207
  //#region src/policy/guards/security.d.ts
167
- /** Critical patterns that must always be blocked. */
168
- declare const CRITICAL_PATTERNS: RegExp[];
169
- /** Patterns that warrant explicit confirmation before running. */
170
- declare const ASK_PATTERNS: RegExp[];
208
+ /** A pattern paired with the violation label to name in the deny/ask reason. */
209
+ interface LabeledPattern {
210
+ re: RegExp;
211
+ label: string;
212
+ }
213
+ /** Critical patterns that must always be blocked — parity `security_rules.py`'s cumulated violation names. */
214
+ declare const CRITICAL_PATTERNS: LabeledPattern[];
215
+ /** Patterns that warrant explicit confirmation before running — parity `security_rules.py`'s ask-level violation names. */
216
+ declare const ASK_PATTERNS: LabeledPattern[];
171
217
  /** Guards against dangerous Bash commands (critical → block, sensitive → ask). */
172
218
  declare function securityGuard(ctx: GuardContext): Prompt | null;
173
219
  //#endregion
@@ -199,21 +245,45 @@ declare const PROTECTED_GIT_RE: RegExp;
199
245
  */
200
246
  declare function protectedPathGuard(ctx: GuardContext): Prompt | null;
201
247
  //#endregion
202
- //#region src/policy/guards/bash-write.d.ts
248
+ //#region src/policy/guards/bash-write-patterns.d.ts
203
249
  /** Redirect (`>`/`>>`) targeting a code-file extension. */
204
250
  declare const CODE_REDIRECT: RegExp;
205
- /** Interpreters / tools that mutate source in place, plus heredoc-into-file.
206
- * `sed`/`perl`/`awk` allow intervening flags before `-i` (parity bash-write-guard.py). */
207
- declare const CODE_MUTATORS: RegExp;
251
+ /**
252
+ * Interpreters / tools that mutate source in place, plus heredoc-into-file
253
+ * split into labeled sub-patterns (parity bash-write-guard.py `DENY_PATTERNS`,
254
+ * each with its own `desc`) so the deny reason names which motif matched
255
+ * instead of a single generic message for all six.
256
+ */
257
+ declare const CODE_MUTATORS: readonly {
258
+ re: RegExp;
259
+ desc: string;
260
+ }[];
208
261
  /** Redirect to a non-code file. Excludes `/dev/null`, `2>`/`N>` and `>&N` fd
209
262
  * redirects via the `(?<![0-9&])` lookbehind + `(?!…|&)` (parity has_file_redirect). */
210
263
  declare const FILE_REDIRECT: RegExp;
211
- /** Other ambiguous file writers (ASK): `tee <file>` (not `tee -a`/path) and `dd … of=`. */
212
- declare const ASK_WRITERS: RegExp;
264
+ /** Other ambiguous file writers (ASK): `tee <file>` (not `tee -a`/path) and `dd … of=`
265
+ * labeled sub-patterns (parity bash-write-guard.py `ASK_PATTERNS`). */
266
+ declare const ASK_WRITERS: readonly {
267
+ re: RegExp;
268
+ desc: string;
269
+ }[];
270
+ /** Commands whose first token never writes, skipped when a real redirect is
271
+ * present (parity bash-write-guard.py `SAFE_PREFIXES`). */
272
+ declare const SAFE_PREFIXES: readonly string[];
273
+ /**
274
+ * Session-state directory the freshness/APEX gates rely on. Any Bash command
275
+ * touching it is a hook-bypass vector, so it is blocked outright — a blunt
276
+ * substring match (read OR write), parity with bash-write-guard.py DENY_PATTERNS
277
+ * `fusengine-cache/sessions` (rebranded to the harness cache path).
278
+ */
279
+ declare const SESSION_STATE_FRAGMENT = ".fuse-harness/cache/sessions";
280
+ //#endregion
281
+ //#region src/policy/guards/bash-write.d.ts
213
282
  /**
214
283
  * Blocks shell commands that mutate code files in place (and heredocs/redirects
215
- * to source files); asks before other file-writing shell commands. Forces use
216
- * of the Write/Edit tool so APEX/SOLID checks are not bypassed.
284
+ * to source files); asks before other file-writing shell commands unless the
285
+ * target is a harness-owned safe path. Forces use of the Write/Edit tool so
286
+ * APEX/SOLID checks are not bypassed.
217
287
  */
218
288
  declare function bashWriteGuard(ctx: GuardContext): Prompt | null;
219
289
  //#endregion
@@ -239,6 +309,12 @@ declare const JAVA_DECL_RE: RegExp;
239
309
  * controller files (Interface Segregation). Fires only when BOTH the path
240
310
  * category AND the content pattern match.
241
311
  *
312
+ * Destination text for TS/JS/Vue/Svelte, PHP and Swift matches the user's own
313
+ * `claude-rules/rules/04-solid-dry-rules.md` ("SOLID Skill per Stack" table),
314
+ * the current authoritative convention — NOT the older `enforce-interfaces.py`
315
+ * text, which this guard originally ported. Go/Python/Java/Kotlin aren't
316
+ * covered by that table, so their destinations stay as a reasonable default.
317
+ *
242
318
  * Parity note: enforce-interfaces.py only inspects `Write` (tool_input.content).
243
319
  * We deliberately also fire on `Edit` — an in-place edit can introduce the same
244
320
  * violation — and the path fragments accept singular *and* plural directory
@@ -317,6 +393,14 @@ declare const SKILL_TRIGGERS: Readonly<Record<string, Readonly<Record<string, Re
317
393
  */
318
394
  declare function detectRequiredSkills(framework: string, content: string): string[];
319
395
  /**
396
+ * True when `filePath`/`content` match the Python Tailwind gate's trigger
397
+ * condition. React/Next.js components embed Tailwind utility classes in
398
+ * `className` — this check fires IN ADDITION TO the primary framework gate,
399
+ * never instead of it: {@link detectFramework} keeps returning "react"/
400
+ * "nextjs" for these files (framework SOLID rules stay correct).
401
+ */
402
+ declare function usesTailwindUtilities(filePath: string, content: string): boolean;
403
+ /**
320
404
  * Block when a required sub-skill's `skills/<name>/` path is absent from
321
405
  * `refsRead`. Mirrors `specific_skill_consulted`, which confirms a skill was
322
406
  * read by checking the tracking file contains `skills/<name>/`.
@@ -326,9 +410,13 @@ declare function detectRequiredSkills(framework: string, content: string): strin
326
410
  * @param forcedSkill - a skill the detected modular architecture forces (optional).
327
411
  * @param cwd - project root; when set and not a shadcn project, `*-shadcn`
328
412
  * requirements are skipped (ports the Python `is_shadcn_project` filter).
413
+ * @param filePath - the file being written; when it's a `.tsx`/`.jsx` file
414
+ * with Tailwind utility classes in `className`, the "tailwind" domain
415
+ * skills are merged in alongside `framework`'s own (ports the separate
416
+ * `check-tailwind-skill.py` gate, independent of react/nextjs).
329
417
  * @returns a `block` Prompt naming the missing sub-skills, or `null` when satisfied.
330
418
  */
331
- declare function skillTriggerGate(framework: string, content: string, refsRead: string[], forcedSkill?: string | null, cwd?: string): Prompt | null;
419
+ declare function skillTriggerGate(framework: string, content: string, refsRead: readonly string[], forcedSkill?: string | null, cwd?: string, filePath?: string): Prompt | null;
332
420
  //#endregion
333
421
  //#region src/policy/claude-md-context.d.ts
334
422
  /** Dev-verb regex (FR/EN) that triggers the APEX preamble (case-insensitive). */
@@ -341,14 +429,14 @@ declare const DEV_VERBS: RegExp;
341
429
  * @param cwd - Project root to scan.
342
430
  * @returns The detected project type label.
343
431
  */
344
- declare function detectClaudeMdProjectType(cwd: string): string;
432
+ declare function detectClaudeMdProjectType(cwd: string): ProjectType;
345
433
  /**
346
434
  * Build the APEX instruction preamble for a development task.
347
435
  * @param projectType - Detected project type label.
348
436
  * @param maxLines - SOLID per-file line ceiling.
349
437
  * @returns The APEX instruction text.
350
438
  */
351
- declare function buildApexInstruction(projectType: string, maxLines: number): string;
439
+ declare function buildApexInstruction(projectType: ProjectType, maxLines: number): string;
352
440
  /**
353
441
  * Build the UserPromptSubmit injection text: read `~/.claude/CLAUDE.md` and,
354
442
  * when the prompt matches a dev verb, prepend the APEX instruction. Returns
@@ -483,4 +571,4 @@ declare function isHtmlLike(path: string): boolean;
483
571
  */
484
572
  declare function missingSeoElements(html: string): string[];
485
573
  //#endregion
486
- export { Guard as $, GUARDS as A, TS_DECL_RE as B, SKILL_TRIGGERS as C, ProjectType as Ct, capVerbosity as D, requiredArchSkill as Dt, MAX_TOKENS as E, isApexCommand as Et, GO_DECL_RE as F, FILE_REDIRECT as G, ASK_WRITERS as H, JAVA_DECL_RE as I, PROTECTED_GIT_RE as J, bashWriteGuard as K, PHP_DECL_RE as L, registerGuard as M, runGuards as N, detectCreationIntent as O, installGuard as P, securityGuard as Q, PY_MODEL_RE as R, skillTriggerGate as S, ModularArchitecture as St, MAX_EXA_RESULTS as T, detectProjectType as Tt, CODE_MUTATORS as U, interfaceSeparationGuard as V, CODE_REDIRECT as W, ASK_PATTERNS as X, protectedPathGuard as Y, CRITICAL_PATTERNS as Z, DEV_VERBS as _, FileSizeVerdict as _t, firstHeading as a, docConsultedGate as at, detectClaudeMdProjectType as b, detectFramework as bt, parseEntry as c, solidReadGate as ct, EXCLUDE_DIRS as d, PolicyResult as dt, GuardContext as et, PROJECT_INDICATORS as f, GIT_ASK as ft, loadApexTaskState as g, matchPatterns as gt, buildApexTaskInjection as h, SYSTEM_INSTALL as ht, firstComment as i, brainstormGate as it, clearUserGuards as j, FAIL_CLOSED as k, parseBodyDesc as l, evaluate as lt, buildApexTaskContext as m, PROJECT_INSTALL as mt, missingSeoElements as n, ApexContext as nt, TreeEntry as o, evaluateApex as ot, ApexTaskState as p, GIT_BLOCKED as pt, PROTECTED_FRAGMENTS as q, descFromText as r, ApexGate as rt, parseEnrichment as s, freshnessGate as st, isHtmlLike as t, APEX_GATES as tt, parseField as u, PolicyContext as ut, buildApexInstruction as v, countLines as vt, frameworkSolidGate as w, detectModularArchitecture as wt, detectRequiredSkills as x, DEV_KEYWORDS as xt, buildClaudeMdContext as y, evaluateFileSize as yt, SWIFT_PROTO_RE as z };
574
+ export { ASK_PATTERNS as $, FAIL_CLOSED as A, ProjectType as At, SWIFT_PROTO_RE as B, usesTailwindUtilities as C, SOLID_REF as Ct, MAX_TOKENS as D, detectFramework as Dt, MAX_EXA_RESULTS as E, evaluateFileSize as Et, installGuard as F, CODE_MUTATORS as G, interfaceSeparationGuard as H, GO_DECL_RE as I, SAFE_PREFIXES as J, CODE_REDIRECT as K, JAVA_DECL_RE as L, clearUserGuards as M, detectProjectType as Mt, registerGuard as N, isApexCommand as Nt, capVerbosity as O, DEV_KEYWORDS as Ot, runGuards as P, requiredArchSkill as Pt, protectedPathGuard as Q, PHP_DECL_RE as R, skillTriggerGate as S, PLUGINS_DIR as St, frameworkSolidGate as T, countLines as Tt, bashWriteGuard as U, TS_DECL_RE as V, ASK_WRITERS as W, PROTECTED_FRAGMENTS as X, SESSION_STATE_FRAGMENT as Y, PROTECTED_GIT_RE as Z, DEV_VERBS as _, GIT_BLOCKED as _t, firstHeading as a, APEX_GATES as at, detectClaudeMdProjectType as b, matchPatterns as bt, parseEntry as c, brainstormGate as ct, EXCLUDE_DIRS as d, freshnessGate as dt, CRITICAL_PATTERNS as et, PROJECT_INDICATORS as f, solidReadGate as ft, loadApexTaskState as g, GIT_ASK as gt, buildApexTaskInjection as h, PolicyResult as ht, firstComment as i, GuardContext as it, GUARDS as j, detectModularArchitecture as jt, detectCreationIntent as k, ModularArchitecture as kt, parseBodyDesc as l, docConsultedGate as lt, buildApexTaskContext as m, PolicyContext as mt, missingSeoElements as n, securityGuard as nt, TreeEntry as o, ApexContext as ot, ApexTaskState as p, evaluate as pt, FILE_REDIRECT as q, descFromText as r, Guard as rt, parseEnrichment as s, ApexGate as st, isHtmlLike as t, LabeledPattern as tt, parseField as u, evaluateApex as ut, buildApexInstruction as v, PROJECT_INSTALL as vt, SKILL_TRIGGERS as w, countFrameworkCodeLines as wt, detectRequiredSkills as x, FileSizeVerdict as xt, buildClaudeMdContext as y, SYSTEM_INSTALL as yt, PY_MODEL_RE as z };
package/dist/index.d.mts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { n as PromptKind, r as formatPrompt, t as Prompt } from "./types-D56jSgD9.mjs";
2
- import { a as mcpCacheKey, c as extractText, d as summarizeIndex, f as compactMarkdown, i as cacheStore, l as IndexSummary, m as queryHash, n as cacheLookupSubstring, o as mcpCacheWrite, p as jaccardSimilar, r as cachePath, s as webfetchCacheWrite, t as cacheLookup, u as loadIndex } from "./index-BX-xcvhY.mjs";
3
- import { _ as parseEnvInt, a as ProjectLayout, c as projectLayout, d as resolveMaxLines, f as splitTarget, g as ttlLabel, h as resolveTtlSec, i as parseEnvFile, l as DEFAULT_MAX_LINES, m as TTL_ENV_KEY, n as envCandidates, o as STATE_GITIGNORE, p as DEFAULT_TTL_SEC, r as loadDotenv, s as STATE_ROOT, t as HOME_DIR, u as MAX_LINES_ENV_KEY } from "./index-DXQfL1u8.mjs";
2
+ import { _ as queryHash, a as cacheLookupSubstringMeta, c as mcpCacheKey, d as extractText, f as IndexSummary, g as jaccardSimilar, h as compactMarkdown, i as cacheLookupSubstring, l as mcpCacheWrite, m as summarizeIndex, n as cacheLookup, o as cachePath, p as loadIndex, r as cacheLookupMeta, s as cacheStore, t as CacheHit, u as webfetchCacheWrite } from "./index-BUwEmIK-.mjs";
3
+ import { _ as parseEnvInt, a as ProjectLayout, c as projectLayout, d as resolveMaxLines, f as splitTarget, g as ttlLabel, h as resolveTtlSec, i as parseEnvFile, l as DEFAULT_MAX_LINES, m as TTL_ENV_KEY, n as envCandidates, o as STATE_GITIGNORE, p as DEFAULT_TTL_SEC, r as loadDotenv, s as STATE_ROOT, t as HOME_DIR, u as MAX_LINES_ENV_KEY } from "./index-BXPySPxE.mjs";
4
4
  import { a as HarnessInfo, i as HarnessId, n as detectMode, o as HarnessMode, r as modeFor, s as HarnessVia, t as detectHarness } from "./harness-BPPu5CrN.mjs";
5
- import { a as isDocConsulted, i as formatDocSatisfactionStatus, n as DocSatisfactionStatus, o as resolveSessions, r as formatDocDeny, t as AuthEntry } from "./doc-helpers-D14nkD5D.mjs";
5
+ import { a as isDocConsulted, i as formatDocSatisfactionStatus, n as DocSatisfactionStatus, o as resolveSessions, r as formatDocDeny, t as AuthEntry } from "./doc-helpers-BNfYWvYv.mjs";
6
6
  import { t as incrementTrivialEditCounter } from "./index-BOBXQ91y.mjs";
7
7
  import { a as compactJson, i as walkUpFor, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./index-BEMumjOw.mjs";
8
- import { $ as Guard, A as GUARDS, B as TS_DECL_RE, C as SKILL_TRIGGERS, Ct as ProjectType, D as capVerbosity, Dt as requiredArchSkill, E as MAX_TOKENS, Et as isApexCommand, F as GO_DECL_RE, G as FILE_REDIRECT, H as ASK_WRITERS, I as JAVA_DECL_RE, J as PROTECTED_GIT_RE, K as bashWriteGuard, L as PHP_DECL_RE, M as registerGuard, N as runGuards, O as detectCreationIntent, P as installGuard, Q as securityGuard, R as PY_MODEL_RE, S as skillTriggerGate, St as ModularArchitecture, T as MAX_EXA_RESULTS, Tt as detectProjectType, U as CODE_MUTATORS, V as interfaceSeparationGuard, W as CODE_REDIRECT, X as ASK_PATTERNS, Y as protectedPathGuard, Z as CRITICAL_PATTERNS, _ as DEV_VERBS, _t as FileSizeVerdict, a as firstHeading, at as docConsultedGate, b as detectClaudeMdProjectType, bt as detectFramework, c as parseEntry, ct as solidReadGate, d as EXCLUDE_DIRS, dt as PolicyResult, et as GuardContext, f as PROJECT_INDICATORS, ft as GIT_ASK, g as loadApexTaskState, gt as matchPatterns, h as buildApexTaskInjection, ht as SYSTEM_INSTALL, i as firstComment, it as brainstormGate, j as clearUserGuards, k as FAIL_CLOSED, l as parseBodyDesc, lt as evaluate, m as buildApexTaskContext, mt as PROJECT_INSTALL, n as missingSeoElements, nt as ApexContext, o as TreeEntry, ot as evaluateApex, p as ApexTaskState, pt as GIT_BLOCKED, q as PROTECTED_FRAGMENTS, r as descFromText, rt as ApexGate, s as parseEnrichment, st as freshnessGate, t as isHtmlLike, tt as APEX_GATES, u as parseField, ut as PolicyContext, v as buildApexInstruction, vt as countLines, w as frameworkSolidGate, wt as detectModularArchitecture, x as detectRequiredSkills, xt as DEV_KEYWORDS, y as buildClaudeMdContext, yt as evaluateFileSize, z as SWIFT_PROTO_RE } from "./index-DN4cZDbU.mjs";
8
+ import { $ as ASK_PATTERNS, A as FAIL_CLOSED, At as ProjectType, B as SWIFT_PROTO_RE, C as usesTailwindUtilities, Ct as SOLID_REF, D as MAX_TOKENS, Dt as detectFramework, E as MAX_EXA_RESULTS, Et as evaluateFileSize, F as installGuard, G as CODE_MUTATORS, H as interfaceSeparationGuard, I as GO_DECL_RE, J as SAFE_PREFIXES, K as CODE_REDIRECT, L as JAVA_DECL_RE, M as clearUserGuards, Mt as detectProjectType, N as registerGuard, Nt as isApexCommand, O as capVerbosity, Ot as DEV_KEYWORDS, P as runGuards, Pt as requiredArchSkill, Q as protectedPathGuard, R as PHP_DECL_RE, S as skillTriggerGate, St as PLUGINS_DIR, T as frameworkSolidGate, Tt as countLines, U as bashWriteGuard, V as TS_DECL_RE, W as ASK_WRITERS, X as PROTECTED_FRAGMENTS, Y as SESSION_STATE_FRAGMENT, Z as PROTECTED_GIT_RE, _ as DEV_VERBS, _t as GIT_BLOCKED, a as firstHeading, at as APEX_GATES, b as detectClaudeMdProjectType, bt as matchPatterns, c as parseEntry, ct as brainstormGate, d as EXCLUDE_DIRS, dt as freshnessGate, et as CRITICAL_PATTERNS, f as PROJECT_INDICATORS, ft as solidReadGate, g as loadApexTaskState, gt as GIT_ASK, h as buildApexTaskInjection, ht as PolicyResult, i as firstComment, it as GuardContext, j as GUARDS, jt as detectModularArchitecture, k as detectCreationIntent, kt as ModularArchitecture, l as parseBodyDesc, lt as docConsultedGate, m as buildApexTaskContext, mt as PolicyContext, n as missingSeoElements, nt as securityGuard, o as TreeEntry, ot as ApexContext, p as ApexTaskState, pt as evaluate, q as FILE_REDIRECT, r as descFromText, rt as Guard, s as parseEnrichment, st as ApexGate, t as isHtmlLike, tt as LabeledPattern, u as parseField, ut as evaluateApex, v as buildApexInstruction, vt as PROJECT_INSTALL, w as SKILL_TRIGGERS, wt as countFrameworkCodeLines, x as detectRequiredSkills, xt as FileSizeVerdict, y as buildClaudeMdContext, yt as SYSTEM_INSTALL, z as PY_MODEL_RE } from "./index-CVhw7eA0.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-mmRF3KNp.mjs";
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-D7GpOmkl.mjs";
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-BA-SqNR7.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, FILE_REDIRECT, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, Guard, GuardContext, HOME_DIR, type HarnessId, type HarnessInfo, type HarnessMode, type 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, PROTECTED_GIT_RE, PY_MODEL_RE, Palette, type PolicyContext, type 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, cacheLookupSubstring, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, envCandidates, 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, loadDotenv, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, mcpCacheWrite, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvFile, 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, webfetchCacheWrite };
14
+ export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexState, ApexTask, ApexTaskFile, ApexTaskState, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, CacheHit, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, DocSatisfactionStatus, EXCLUDE_DIRS, FAIL_CLOSED, FILE_REDIRECT, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, Guard, GuardContext, HOME_DIR, type HarnessId, type HarnessInfo, type HarnessMode, type HarnessVia, IndexSummary, JAVA_DECL_RE, LabeledPattern, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, ModularArchitecture, PHP_DECL_RE, PLUGINS_DIR, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PROTECTED_GIT_RE, PY_MODEL_RE, Palette, type PolicyContext, type PolicyResult, ProgressBarOptions, ProjectLayout, ProjectType, Prompt, PromptKind, RefMeta, ReminderState, RouteResult, SAFE_PREFIXES, SESSION_STATE_FRAGMENT, SKILL_TRIGGERS, SOLID_REF, 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, cacheLookupMeta, cacheLookupSubstring, cacheLookupSubstringMeta, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countFrameworkCodeLines, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, envCandidates, 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, loadDotenv, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, mcpCacheWrite, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvFile, 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, usesTailwindUtilities, walkUpFor, webfetchCacheWrite };
package/dist/index.mjs CHANGED
@@ -1,19 +1,18 @@
1
1
  import { a as parseEnvInt, i as splitTarget, n as MAX_LINES_ENV_KEY, r as resolveMaxLines, t as DEFAULT_MAX_LINES } from "./limits-CHn8AIL1.mjs";
2
- import { i as ttlLabel, n as TTL_ENV_KEY, r as resolveTtlSec, t as DEFAULT_TTL_SEC } from "./ttl-BG55s6HZ.mjs";
2
+ import { a as DEFAULT_TTL_SEC, c as ttlLabel, i as parseEnvFile, n as envCandidates, o as TTL_ENV_KEY, r as loadDotenv, s as resolveTtlSec, t as HOME_DIR } from "./dotenv-B9nM4cuQ.mjs";
3
3
  import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "./layout-C0jaaCQC.mjs";
4
- import { i as parseEnvFile, n as envCandidates, r as loadDotenv, t as HOME_DIR } from "./dotenv-DGyLln7U.mjs";
5
4
  import { t as compactJson } from "./compact-json-DK2nX-MK.mjs";
6
5
  import { i as walkUpFor, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-3kk7gCOp.mjs";
7
6
  import { n as detectMode, r as modeFor, t as detectHarness } from "./harness-C8Nxxyn_.mjs";
8
- 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-xi-zc-22.mjs";
9
- import { A as matchPatterns, C as ASK_PATTERNS, D as GIT_BLOCKED, E as GIT_ASK, M as evaluateFileSize, N as detectFramework, O as PROJECT_INSTALL, S as protectedPathGuard, T as securityGuard, _ as CODE_REDIRECT, a as registerGuard, b as PROTECTED_FRAGMENTS, 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 countLines, k as SYSTEM_INSTALL, 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 FILE_REDIRECT, w as CRITICAL_PATTERNS, x as PROTECTED_GIT_RE, y as bashWriteGuard } from "./evaluate-CeivW6G0.mjs";
10
- import { i as resolveSessions, n as formatDocSatisfactionStatus, r as isDocConsulted, t as formatDocDeny } from "./doc-helpers-BhzDmJ18.mjs";
11
- import { i as parseFrontmatter, n as scoreReferences, r as globToRe, t as routeReferences } from "./router-BfX0hJg8.mjs";
7
+ import { A as detectCreationIntent, B as detectProjectType, D as MAX_EXA_RESULTS, E as frameworkSolidGate, F as freshnessGate, H as requiredArchSkill, I as solidReadGate, L as detectFramework, M as brainstormGate, N as docConsultedGate, O as MAX_TOKENS, P as evaluateApex, R as DEV_KEYWORDS, S as usesTailwindUtilities, T as SKILL_TRIGGERS, V as isApexCommand, a as firstHeading, b as detectRequiredSkills, c as EXCLUDE_DIRS, d as buildApexTaskInjection, f as loadApexTaskState, g as detectClaudeMdProjectType, h as buildClaudeMdContext, i as firstComment, j as APEX_GATES, k as capVerbosity, l as PROJECT_INDICATORS, m as buildApexInstruction, n as missingSeoElements, o as parseEnrichment, p as DEV_VERBS, r as descFromText, s as parseEntry, t as isHtmlLike, u as buildApexTaskContext, v as parseBodyDesc, x as skillTriggerGate, y as parseField, z as detectModularArchitecture } from "./validate-DcQaKzau.mjs";
8
+ import { A as PROJECT_INSTALL, C as PROTECTED_GIT_RE, D as securityGuard, E as CRITICAL_PATTERNS, F as countFrameworkCodeLines, I as countLines, L as evaluateFileSize, M as matchPatterns, N as PLUGINS_DIR, O as GIT_ASK, P as SOLID_REF, S as PROTECTED_FRAGMENTS, T as ASK_PATTERNS, _ as CODE_MUTATORS, a as registerGuard, b as SAFE_PREFIXES, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as ASK_WRITERS, h as bashWriteGuard, i as clearUserGuards, j as SYSTEM_INSTALL, k as GIT_BLOCKED, 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 CODE_REDIRECT, w as protectedPathGuard, x as SESSION_STATE_FRAGMENT, y as FILE_REDIRECT } from "./evaluate-d7Pp8XJH.mjs";
9
+ import { i as resolveSessions, n as formatDocSatisfactionStatus, r as isDocConsulted, t as formatDocDeny } from "./doc-helpers-CWZegVdR.mjs";
10
+ import { i as parseFrontmatter, n as scoreReferences, r as globToRe, t as routeReferences } from "./router-PKVNBHge.mjs";
12
11
  import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
13
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-CymilZiZ.mjs";
14
- import { a as cachePath, c as extractText, d as compactMarkdown, f as jaccardSimilar, i as cacheLookupSubstring, l as loadIndex, n as webfetchCacheWrite, o as cacheStore, p as queryHash, r as cacheLookup, s as mcpCacheKey, t as mcpCacheWrite, u as summarizeIndex } from "./mcp-store-CnsW9oFj.mjs";
13
+ import { a as cacheLookupSubstring, c as cacheStore, d as loadIndex, f as summarizeIndex, h as queryHash, i as cacheLookupMeta, l as mcpCacheKey, m as jaccardSimilar, n as webfetchCacheWrite, o as cacheLookupSubstringMeta, p as compactMarkdown, r as cacheLookup, s as cachePath, t as mcpCacheWrite, u as extractText } from "./mcp-store-BkBDmuxN.mjs";
15
14
  import { t as incrementTrivialEditCounter } from "./freshness-BV3PQkDB.mjs";
16
- import { n as toRefMeta, t as loadRefs } from "./loader-Bn-DbZmt.mjs";
15
+ import { n as toRefMeta, t as loadRefs } from "./loader-AGz4nK7d.mjs";
17
16
  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-9lWvvWk8.mjs";
18
17
  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, FILE_REDIRECT, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, HOME_DIR, 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, PROTECTED_GIT_RE, 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, cacheLookupSubstring, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, envCandidates, 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, loadDotenv, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, mcpCacheWrite, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvFile, 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, webfetchCacheWrite };
18
+ 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, FILE_REDIRECT, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, HOME_DIR, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, PHP_DECL_RE, PLUGINS_DIR, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PROTECTED_GIT_RE, PY_MODEL_RE, SAFE_PREFIXES, SESSION_STATE_FRAGMENT, SKILL_TRIGGERS, SOLID_REF, 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, cacheLookupMeta, cacheLookupSubstring, cacheLookupSubstringMeta, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countFrameworkCodeLines, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, envCandidates, 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, loadDotenv, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, mcpCacheWrite, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvFile, 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, usesTailwindUtilities, walkUpFor, webfetchCacheWrite };
@@ -1,4 +1,4 @@
1
- import { i as parseFrontmatter } from "./router-BfX0hJg8.mjs";
1
+ import { i as parseFrontmatter } from "./router-PKVNBHge.mjs";
2
2
  import { delimiter, join } from "node:path";
3
3
  import { readFile, readdir } from "node:fs/promises";
4
4
  //#region src/refs/loader.ts
@@ -130,10 +130,19 @@ function cachePath(dir, tool, query) {
130
130
  }
131
131
  /** Read a cached entry if it exists and is fresh (mtime within `ttlMs`), else null. */
132
132
  function cacheLookup(dir, tool, query, ttlMs, now) {
133
+ return cacheLookupMeta(dir, tool, query, ttlMs, now)?.body ?? null;
134
+ }
135
+ /** Like {@link cacheLookup}, but also reports the entry's age (for `CACHE HIT` wrapper text). */
136
+ function cacheLookupMeta(dir, tool, query, ttlMs, now) {
133
137
  const path = cachePath(dir, tool, query);
134
138
  try {
135
- if (!existsSync(path) || now - statSync(path).mtimeMs > ttlMs) return null;
136
- return readFileSync(path, "utf8");
139
+ if (!existsSync(path)) return null;
140
+ const ageMs = now - statSync(path).mtimeMs;
141
+ if (ageMs > ttlMs) return null;
142
+ return {
143
+ body: readFileSync(path, "utf8").slice(0, MAX_BODY),
144
+ ageMs
145
+ };
137
146
  } catch {
138
147
  return null;
139
148
  }
@@ -148,6 +157,10 @@ function cacheLookup(dir, tool, query, ttlMs, now) {
148
157
  * @param now - Current epoch ms.
149
158
  */
150
159
  function cacheLookupSubstring(dir, query, ttlMs, now) {
160
+ return cacheLookupSubstringMeta(dir, query, ttlMs, now)?.body ?? null;
161
+ }
162
+ /** Like {@link cacheLookupSubstring}, but also reports the matched entry's age. */
163
+ function cacheLookupSubstringMeta(dir, query, ttlMs, now) {
151
164
  const needle = query.replace(/[\r\n]+/g, " ").slice(0, NEEDLE_LEN).trim().toLowerCase();
152
165
  if (!needle) return null;
153
166
  let names;
@@ -160,9 +173,13 @@ function cacheLookupSubstring(dir, query, ttlMs, now) {
160
173
  if (!name.endsWith(".md")) continue;
161
174
  const path = join(dir, name);
162
175
  try {
163
- if (now - statSync(path).mtimeMs > ttlMs) continue;
176
+ const ageMs = now - statSync(path).mtimeMs;
177
+ if (ageMs > ttlMs) continue;
164
178
  const body = readFileSync(path, "utf8").slice(0, MAX_BODY);
165
- if (body.toLowerCase().includes(needle)) return body;
179
+ if (body.toLowerCase().includes(needle)) return {
180
+ body,
181
+ ageMs
182
+ };
166
183
  } catch {
167
184
  continue;
168
185
  }
@@ -235,4 +252,4 @@ function webfetchCacheWrite(dir, tool, key, body, now) {
235
252
  cacheStore(dir, tool, key, `---\ntool: ${tool}\nkey: ${JSON.stringify(key)}\nts: ${stamp(now)}\nhash: ${hash}\n---\n\n` + compacted);
236
253
  }
237
254
  //#endregion
238
- export { cachePath as a, extractText as c, compactMarkdown as d, jaccardSimilar as f, cacheLookupSubstring as i, loadIndex as l, webfetchCacheWrite as n, cacheStore as o, queryHash as p, cacheLookup as r, mcpCacheKey as s, mcpCacheWrite as t, summarizeIndex as u };
255
+ export { cacheLookupSubstring as a, cacheStore as c, loadIndex as d, summarizeIndex as f, queryHash as h, cacheLookupMeta as i, mcpCacheKey as l, jaccardSimilar as m, webfetchCacheWrite as n, cacheLookupSubstringMeta as o, compactMarkdown as p, cacheLookup as r, cachePath as s, mcpCacheWrite as t, extractText as u };
@@ -1,2 +1,2 @@
1
- import { $ as Guard, A as GUARDS, B as TS_DECL_RE, C as SKILL_TRIGGERS, Ct as ProjectType, D as capVerbosity, Dt as requiredArchSkill, E as MAX_TOKENS, Et as isApexCommand, F as GO_DECL_RE, G as FILE_REDIRECT, H as ASK_WRITERS, I as JAVA_DECL_RE, J as PROTECTED_GIT_RE, K as bashWriteGuard, L as PHP_DECL_RE, M as registerGuard, N as runGuards, O as detectCreationIntent, P as installGuard, Q as securityGuard, R as PY_MODEL_RE, S as skillTriggerGate, St as ModularArchitecture, T as MAX_EXA_RESULTS, Tt as detectProjectType, U as CODE_MUTATORS, V as interfaceSeparationGuard, W as CODE_REDIRECT, X as ASK_PATTERNS, Y as protectedPathGuard, Z as CRITICAL_PATTERNS, _ as DEV_VERBS, _t as FileSizeVerdict, a as firstHeading, at as docConsultedGate, b as detectClaudeMdProjectType, bt as detectFramework, c as parseEntry, ct as solidReadGate, d as EXCLUDE_DIRS, dt as PolicyResult, et as GuardContext, f as PROJECT_INDICATORS, ft as GIT_ASK, g as loadApexTaskState, gt as matchPatterns, h as buildApexTaskInjection, ht as SYSTEM_INSTALL, i as firstComment, it as brainstormGate, j as clearUserGuards, k as FAIL_CLOSED, l as parseBodyDesc, lt as evaluate, m as buildApexTaskContext, mt as PROJECT_INSTALL, n as missingSeoElements, nt as ApexContext, o as TreeEntry, ot as evaluateApex, p as ApexTaskState, pt as GIT_BLOCKED, q as PROTECTED_FRAGMENTS, r as descFromText, rt as ApexGate, s as parseEnrichment, st as freshnessGate, t as isHtmlLike, tt as APEX_GATES, u as parseField, ut as PolicyContext, v as buildApexInstruction, vt as countLines, w as frameworkSolidGate, wt as detectModularArchitecture, x as detectRequiredSkills, xt as DEV_KEYWORDS, y as buildClaudeMdContext, yt as evaluateFileSize, z as SWIFT_PROTO_RE } from "../index-DN4cZDbU.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, FILE_REDIRECT, 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, PROTECTED_GIT_RE, PY_MODEL_RE, type PolicyContext, type 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 };
1
+ import { $ as ASK_PATTERNS, A as FAIL_CLOSED, At as ProjectType, B as SWIFT_PROTO_RE, C as usesTailwindUtilities, Ct as SOLID_REF, D as MAX_TOKENS, Dt as detectFramework, E as MAX_EXA_RESULTS, Et as evaluateFileSize, F as installGuard, G as CODE_MUTATORS, H as interfaceSeparationGuard, I as GO_DECL_RE, J as SAFE_PREFIXES, K as CODE_REDIRECT, L as JAVA_DECL_RE, M as clearUserGuards, Mt as detectProjectType, N as registerGuard, Nt as isApexCommand, O as capVerbosity, Ot as DEV_KEYWORDS, P as runGuards, Pt as requiredArchSkill, Q as protectedPathGuard, R as PHP_DECL_RE, S as skillTriggerGate, St as PLUGINS_DIR, T as frameworkSolidGate, Tt as countLines, U as bashWriteGuard, V as TS_DECL_RE, W as ASK_WRITERS, X as PROTECTED_FRAGMENTS, Y as SESSION_STATE_FRAGMENT, Z as PROTECTED_GIT_RE, _ as DEV_VERBS, _t as GIT_BLOCKED, a as firstHeading, at as APEX_GATES, b as detectClaudeMdProjectType, bt as matchPatterns, c as parseEntry, ct as brainstormGate, d as EXCLUDE_DIRS, dt as freshnessGate, et as CRITICAL_PATTERNS, f as PROJECT_INDICATORS, ft as solidReadGate, g as loadApexTaskState, gt as GIT_ASK, h as buildApexTaskInjection, ht as PolicyResult, i as firstComment, it as GuardContext, j as GUARDS, jt as detectModularArchitecture, k as detectCreationIntent, kt as ModularArchitecture, l as parseBodyDesc, lt as docConsultedGate, m as buildApexTaskContext, mt as PolicyContext, n as missingSeoElements, nt as securityGuard, o as TreeEntry, ot as ApexContext, p as ApexTaskState, pt as evaluate, q as FILE_REDIRECT, r as descFromText, rt as Guard, s as parseEnrichment, st as ApexGate, t as isHtmlLike, tt as LabeledPattern, u as parseField, ut as evaluateApex, v as buildApexInstruction, vt as PROJECT_INSTALL, w as SKILL_TRIGGERS, wt as countFrameworkCodeLines, x as detectRequiredSkills, xt as FileSizeVerdict, y as buildClaudeMdContext, yt as SYSTEM_INSTALL, z as PY_MODEL_RE } from "../index-CVhw7eA0.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, FILE_REDIRECT, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, Guard, GuardContext, JAVA_DECL_RE, LabeledPattern, MAX_EXA_RESULTS, MAX_TOKENS, ModularArchitecture, PHP_DECL_RE, PLUGINS_DIR, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PROTECTED_GIT_RE, PY_MODEL_RE, type PolicyContext, type PolicyResult, ProjectType, SAFE_PREFIXES, SESSION_STATE_FRAGMENT, SKILL_TRIGGERS, SOLID_REF, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, TreeEntry, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, capVerbosity, clearUserGuards, countFrameworkCodeLines, 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, usesTailwindUtilities };
@@ -1,4 +1,4 @@
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-xi-zc-22.mjs";
2
- import { A as matchPatterns, C as ASK_PATTERNS, D as GIT_BLOCKED, E as GIT_ASK, M as evaluateFileSize, N as detectFramework, O as PROJECT_INSTALL, S as protectedPathGuard, T as securityGuard, _ as CODE_REDIRECT, a as registerGuard, b as PROTECTED_FRAGMENTS, 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 countLines, k as SYSTEM_INSTALL, 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 FILE_REDIRECT, w as CRITICAL_PATTERNS, x as PROTECTED_GIT_RE, y as bashWriteGuard } from "../evaluate-CeivW6G0.mjs";
1
+ import { A as detectCreationIntent, B as detectProjectType, D as MAX_EXA_RESULTS, E as frameworkSolidGate, F as freshnessGate, H as requiredArchSkill, I as solidReadGate, L as detectFramework, M as brainstormGate, N as docConsultedGate, O as MAX_TOKENS, P as evaluateApex, R as DEV_KEYWORDS, S as usesTailwindUtilities, T as SKILL_TRIGGERS, V as isApexCommand, a as firstHeading, b as detectRequiredSkills, c as EXCLUDE_DIRS, d as buildApexTaskInjection, f as loadApexTaskState, g as detectClaudeMdProjectType, h as buildClaudeMdContext, i as firstComment, j as APEX_GATES, k as capVerbosity, l as PROJECT_INDICATORS, m as buildApexInstruction, n as missingSeoElements, o as parseEnrichment, p as DEV_VERBS, r as descFromText, s as parseEntry, t as isHtmlLike, u as buildApexTaskContext, v as parseBodyDesc, x as skillTriggerGate, y as parseField, z as detectModularArchitecture } from "../validate-DcQaKzau.mjs";
2
+ import { A as PROJECT_INSTALL, C as PROTECTED_GIT_RE, D as securityGuard, E as CRITICAL_PATTERNS, F as countFrameworkCodeLines, I as countLines, L as evaluateFileSize, M as matchPatterns, N as PLUGINS_DIR, O as GIT_ASK, P as SOLID_REF, S as PROTECTED_FRAGMENTS, T as ASK_PATTERNS, _ as CODE_MUTATORS, a as registerGuard, b as SAFE_PREFIXES, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as ASK_WRITERS, h as bashWriteGuard, i as clearUserGuards, j as SYSTEM_INSTALL, k as GIT_BLOCKED, 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 CODE_REDIRECT, w as protectedPathGuard, x as SESSION_STATE_FRAGMENT, y as FILE_REDIRECT } from "../evaluate-d7Pp8XJH.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, FILE_REDIRECT, 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, PROTECTED_GIT_RE, 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 };
4
+ export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, FAIL_CLOSED, FILE_REDIRECT, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, PHP_DECL_RE, PLUGINS_DIR, PROJECT_INDICATORS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PROTECTED_GIT_RE, PY_MODEL_RE, SAFE_PREFIXES, SESSION_STATE_FRAGMENT, SKILL_TRIGGERS, SOLID_REF, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, capVerbosity, clearUserGuards, countFrameworkCodeLines, 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, usesTailwindUtilities };
@@ -1,4 +1,4 @@
1
- import { i as parseFrontmatter, n as scoreReferences, r as globToRe, t as routeReferences } from "../router-BfX0hJg8.mjs";
2
- import { n as toRefMeta, t as loadRefs } from "../loader-Bn-DbZmt.mjs";
1
+ import { i as parseFrontmatter, n as scoreReferences, r as globToRe, t as routeReferences } from "../router-PKVNBHge.mjs";
2
+ import { n as toRefMeta, t as loadRefs } from "../loader-AGz4nK7d.mjs";
3
3
  import "../refs-la_KkjCS.mjs";
4
4
  export { globToRe, loadRefs, parseFrontmatter, routeReferences, scoreReferences, toRefMeta };
@@ -65,8 +65,18 @@ function routeReferences(refs, filePath, content, skillPath = "") {
65
65
  return {
66
66
  required: scored.slice(0, 2),
67
67
  optional: scored.slice(2, 4),
68
- skillPath
68
+ skillPath: skillPath || skillPathFromRef(scored[0]?.meta.filePath ?? "")
69
69
  };
70
70
  }
71
+ /**
72
+ * Derive a skill's `SKILL.md` path from one of its `references/` file paths
73
+ * (`<skill>/references/...` → `<skill>/SKILL.md`), matching the on-disk skill
74
+ * layout {@link discoverRefs} walks. Returns "" when the ref's path doesn't
75
+ * follow that layout (e.g. ad-hoc refs dirs used in tests).
76
+ */
77
+ function skillPathFromRef(refFilePath) {
78
+ const i = refFilePath.indexOf("/references/");
79
+ return i === -1 ? "" : `${refFilePath.slice(0, i)}/SKILL.md`;
80
+ }
71
81
  //#endregion
72
82
  export { parseFrontmatter as i, scoreReferences as n, globToRe as r, routeReferences as t };
@@ -1,5 +1,5 @@
1
1
  import { t as isCodeFile } from "./project-root-3kk7gCOp.mjs";
2
- import { t as evaluate } from "./evaluate-CeivW6G0.mjs";
2
+ import { t as evaluate } from "./evaluate-d7Pp8XJH.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