@fusengine/harness 0.1.28 → 0.1.30
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/cache/index.mjs +2 -2
- package/dist/{cache-BzbX-ztL.mjs → cache-C9z9LclL.mjs} +1 -31
- package/dist/{claude-phC5Uh_W.mjs → claude-B9FYp0Yw.mjs} +1 -1
- package/dist/cli/bin.mjs +14 -4
- package/dist/cli/index.mjs +1 -1
- package/dist/describe-CPtgUzFS.mjs +1038 -0
- package/dist/{evaluate-CFYPF3re.mjs → evaluate-j3gRJ_ng.mjs} +14 -2
- package/dist/freshness/index.mjs +1 -1
- package/dist/{freshness-CezohJHo.mjs → freshness-otdUpuvP.mjs} +1 -1
- package/dist/handle-USWK4NSE.mjs +2300 -0
- package/dist/index-mISsk0ff.d.mts +438 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +7 -8
- package/dist/{json-io-xpTDuvtn.mjs → json-io-CAn72gI4.mjs} +1 -1
- package/dist/policy/index.d.mts +2 -2
- package/dist/policy/index.mjs +4 -4
- package/dist/policy-la_KkjCS.mjs +1 -0
- package/dist/{run-B8n-H5hA.mjs → run-CXsV-wIJ.mjs} +1 -1
- package/dist/runtime/index.d.mts +454 -8
- package/dist/runtime/index.mjs +2 -2
- package/dist/state/index.mjs +1 -1
- package/dist/{state-Cs0Y0MG_.mjs → state-ByhLeKyD.mjs} +1 -1
- package/dist/{store-BnHpq2ZB.mjs → store-D-ge2ZPI.mjs} +1 -1
- package/dist/{store-DeIsfMg5.mjs → store-PrNPm6So.mjs} +30 -1
- package/dist/tracking/index.mjs +1 -1
- package/package.json +10 -3
- package/dist/handle-DnOw05K8.mjs +0 -347
- package/dist/index-DNAzITvw.d.mts +0 -227
- package/dist/policy-EuVJ_5hS.mjs +0 -33
- package/dist/verbosity-CXpf3aQQ.mjs +0 -98
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { t as Prompt } from "./types-D56jSgD9.mjs";
|
|
2
|
+
import { t as AuthEntry } from "./doc-helpers-CG1nuf-c.mjs";
|
|
3
|
+
import { t as RefMeta } from "./types-CY5qT2X1.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/policy/detect-project.d.ts
|
|
6
|
+
/** Project types detected from filesystem indicators. */
|
|
7
|
+
type ProjectType = "nextjs" | "nuxt" | "angular" | "svelte" | "vue" | "react" | "tailwind" | "laravel" | "rails" | "django" | "python" | "go" | "rust" | "swift" | "java" | "scala" | "elixir" | "ruby" | "generic";
|
|
8
|
+
/** Keywords that signal a development task (APEX trigger). */
|
|
9
|
+
declare const DEV_KEYWORDS: RegExp;
|
|
10
|
+
/** True when the prompt invokes the /apex command. */
|
|
11
|
+
declare function isApexCommand(prompt: string): boolean;
|
|
12
|
+
/** Modular architecture variants layered on top of the framework. */
|
|
13
|
+
type ModularArchitecture = "fusecore" | "nextjs-modular" | null;
|
|
14
|
+
/**
|
|
15
|
+
* Detect a project-internal modular architecture (a sub-architecture the
|
|
16
|
+
* framework-level {@link detectProjectType} doesn't capture): Fusengine's
|
|
17
|
+
* FuseCore (Laravel) or a `modules/`-based Next.js layout.
|
|
18
|
+
*/
|
|
19
|
+
declare function detectModularArchitecture(dir: string): ModularArchitecture;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the skill a detected modular architecture forces.
|
|
22
|
+
*
|
|
23
|
+
* Ports the Python `check-nextjs-skill.py` / `check-laravel-skill.py` gates:
|
|
24
|
+
* when the project is detected on disk as a modular architecture, a specific
|
|
25
|
+
* skill is required ('solid-nextjs' for nextjs-modular, 'fusecore' for
|
|
26
|
+
* fusecore). Returns `null` when no modular architecture is detected.
|
|
27
|
+
*
|
|
28
|
+
* @param cwd - Project root directory to scan.
|
|
29
|
+
* @returns The forced skill name, or `null` when none applies.
|
|
30
|
+
*/
|
|
31
|
+
declare function requiredArchSkill(cwd: string): string | null;
|
|
32
|
+
/** Detect the project type by scanning config files in `dir`. */
|
|
33
|
+
declare function detectProjectType(dir: string): ProjectType;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/policy/detect-framework.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* Detect the framework from a file path extension + content patterns.
|
|
38
|
+
* Aligned with the fusengine require-solid-read detection (distinct from
|
|
39
|
+
* {@link detectProjectType}, which scans config files on disk).
|
|
40
|
+
*/
|
|
41
|
+
declare function detectFramework(filePath: string, content: string): string;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/policy/file-size.d.ts
|
|
44
|
+
/** Verdict from {@link evaluateFileSize}. */
|
|
45
|
+
interface FileSizeVerdict {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
lines: number;
|
|
48
|
+
max: number;
|
|
49
|
+
message: string | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Count substantive (code-only) lines — blank lines and comment-only lines
|
|
53
|
+
* (`//`, `*`, `/*` block-comment bodies) don't count toward the SOLID limit, so a
|
|
54
|
+
* well-documented file isn't penalized for its JSDoc. (`#` is intentionally NOT
|
|
55
|
+
* skipped: it is code in Rust `#[derive]` and C `#include`, not a comment.)
|
|
56
|
+
*/
|
|
57
|
+
declare function countLines(content: string): number;
|
|
58
|
+
/**
|
|
59
|
+
* Evaluate a file's line count against the SOLID limit.
|
|
60
|
+
* @param lines - the file's line count
|
|
61
|
+
* @param max - the limit (defaults to `resolveMaxLines()`)
|
|
62
|
+
*/
|
|
63
|
+
declare function evaluateFileSize(lines: number, max?: number): FileSizeVerdict;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/policy/patterns.d.ts
|
|
66
|
+
/**
|
|
67
|
+
* Guard pattern data, ported verbatim from the fusengine git/install guards.
|
|
68
|
+
* Note (faithful): `git push.*--force` also matches `--force-with-lease` —
|
|
69
|
+
* preserved from the source guard.
|
|
70
|
+
*/
|
|
71
|
+
/** Destructive git operations to block outright. */
|
|
72
|
+
declare const GIT_BLOCKED: ReadonlyArray<RegExp>;
|
|
73
|
+
/** Git operations that warrant a confirmation prompt. */
|
|
74
|
+
declare const GIT_ASK: ReadonlyArray<RegExp>;
|
|
75
|
+
/** System-level package installs (need confirmation). */
|
|
76
|
+
declare const SYSTEM_INSTALL: ReadonlyArray<RegExp>;
|
|
77
|
+
/** Project-level package installs. */
|
|
78
|
+
declare const PROJECT_INSTALL: ReadonlyArray<RegExp>;
|
|
79
|
+
/** True when `cmd` matches any pattern in `patterns`. */
|
|
80
|
+
declare function matchPatterns(cmd: string, patterns: ReadonlyArray<RegExp>): boolean;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/policy/evaluate.d.ts
|
|
83
|
+
/** Harness-agnostic input to {@link evaluate}. */
|
|
84
|
+
interface PolicyContext {
|
|
85
|
+
/** Tool name (e.g. "Write", "Edit", "Bash"). */
|
|
86
|
+
tool: string;
|
|
87
|
+
filePath?: string;
|
|
88
|
+
content?: string;
|
|
89
|
+
command?: string;
|
|
90
|
+
/** Optional override for the SOLID max-lines limit. */
|
|
91
|
+
maxLines?: number;
|
|
92
|
+
/** Subagent type — `Explore`/`Plan` are exempt from the file-size gate. */
|
|
93
|
+
agentType?: string;
|
|
94
|
+
/** Line count of the existing on-disk file (so an Edit on an oversized file blocks). */
|
|
95
|
+
existingLines?: number;
|
|
96
|
+
}
|
|
97
|
+
/** Harness-agnostic policy decision (+ a portable prompt for adapters to render). */
|
|
98
|
+
interface PolicyResult {
|
|
99
|
+
decision: "allow" | "deny" | "warn";
|
|
100
|
+
message: string | null;
|
|
101
|
+
prompt?: Prompt;
|
|
102
|
+
meta?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Evaluate a single tool-use against the bundled policies, returning a pure
|
|
106
|
+
* decision plus a portable {@link Prompt}. Adapters translate the prompt into
|
|
107
|
+
* their harness's native response (Claude `permissionDecision`, etc.).
|
|
108
|
+
*/
|
|
109
|
+
declare function evaluate(ctx: PolicyContext): PolicyResult;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/policy/apex.d.ts
|
|
112
|
+
/**
|
|
113
|
+
* Session context for the stateful APEX gates. The harness adapter supplies this
|
|
114
|
+
* (the package owns the gate LOGIC; recording the session activity is the
|
|
115
|
+
* adapter's tracking layer).
|
|
116
|
+
*/
|
|
117
|
+
interface ApexContext {
|
|
118
|
+
sessionId: string;
|
|
119
|
+
framework: string;
|
|
120
|
+
filePath: string;
|
|
121
|
+
content: string;
|
|
122
|
+
/** Doc-consultation authorizations from session state (Context7/Exa). */
|
|
123
|
+
authorizations?: Record<string, AuthEntry>;
|
|
124
|
+
/** Available SOLID references for the framework's skill. */
|
|
125
|
+
refs?: RefMeta[];
|
|
126
|
+
/** Absolute paths of SOLID refs already read this session. */
|
|
127
|
+
refsRead?: string[];
|
|
128
|
+
/** Whether the required prior agents (explore + research) ran within the freshness window. */
|
|
129
|
+
agentsFresh?: boolean;
|
|
130
|
+
/** Whether brainstorming is required for this edit (creation intent on a new file). */
|
|
131
|
+
brainstormRequired?: boolean;
|
|
132
|
+
/** Whether the brainstorming agent ran within the window. */
|
|
133
|
+
brainstormFresh?: boolean;
|
|
134
|
+
}
|
|
135
|
+
/** A single APEX gate: returns a blocking {@link Prompt}, or null to pass. */
|
|
136
|
+
type ApexGate = (ctx: ApexContext) => Prompt | null;
|
|
137
|
+
/** Gate: Context7 + Exa must have been consulted this session. */
|
|
138
|
+
declare const docConsultedGate: ApexGate;
|
|
139
|
+
/** Gate: the routed SOLID references for this edit must have been read. */
|
|
140
|
+
declare const solidReadGate: ApexGate;
|
|
141
|
+
/** Gate: the required prior agents (explore + research) must have run within the window. */
|
|
142
|
+
declare const freshnessGate: ApexGate;
|
|
143
|
+
/** Gate: brainstorming must precede creating new files when flagged. */
|
|
144
|
+
declare const brainstormGate: ApexGate;
|
|
145
|
+
/** Default APEX gate chain (brainstorm, freshness, docs, SOLID refs). */
|
|
146
|
+
declare const APEX_GATES: ReadonlyArray<ApexGate>;
|
|
147
|
+
/**
|
|
148
|
+
* Run the APEX gates (chain-of-responsibility): the first failing gate's prompt
|
|
149
|
+
* wins; null means every gate passed (allow).
|
|
150
|
+
*/
|
|
151
|
+
declare function evaluateApex(ctx: ApexContext, gates?: ReadonlyArray<ApexGate>): Prompt | null;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/policy/guards/context.d.ts
|
|
154
|
+
/** Context handed to every guard in the chain. */
|
|
155
|
+
interface GuardContext {
|
|
156
|
+
tool: string;
|
|
157
|
+
filePath?: string;
|
|
158
|
+
content?: string;
|
|
159
|
+
command?: string;
|
|
160
|
+
}
|
|
161
|
+
/** A single guard: returns a blocking/asking Prompt, or null to continue. */
|
|
162
|
+
type Guard = (ctx: GuardContext) => Prompt | null;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/policy/guards/security.d.ts
|
|
165
|
+
/** Critical patterns that must always be blocked. */
|
|
166
|
+
declare const CRITICAL_PATTERNS: RegExp[];
|
|
167
|
+
/** Patterns that warrant explicit confirmation before running. */
|
|
168
|
+
declare const ASK_PATTERNS: RegExp[];
|
|
169
|
+
/** Guards against dangerous Bash commands (critical → block, sensitive → ask). */
|
|
170
|
+
declare function securityGuard(ctx: GuardContext): Prompt | null;
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/policy/guards/protected-path.d.ts
|
|
173
|
+
/** Path fragments that mark a location as internal/generated state (off-limits to Write/Edit). */
|
|
174
|
+
declare const PROTECTED_FRAGMENTS: readonly string[];
|
|
175
|
+
/** Blocks direct edits to internal/generated state directories. */
|
|
176
|
+
declare function protectedPathGuard(ctx: GuardContext): Prompt | null;
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/policy/guards/bash-write.d.ts
|
|
179
|
+
/** Redirect (`>`/`>>`) targeting a code-file extension. */
|
|
180
|
+
declare const CODE_REDIRECT: RegExp;
|
|
181
|
+
/** Interpreters / tools that mutate source in place, plus heredoc-into-file. */
|
|
182
|
+
declare const CODE_MUTATORS: RegExp;
|
|
183
|
+
/** Redirect to a non-code file, or other ambiguous file writers (ASK). */
|
|
184
|
+
declare const ASK_WRITERS: RegExp;
|
|
185
|
+
/**
|
|
186
|
+
* Blocks shell commands that mutate code files in place (and heredocs/redirects
|
|
187
|
+
* to source files); asks before other file-writing shell commands. Forces use
|
|
188
|
+
* of the Write/Edit tool so APEX/SOLID checks are not bypassed.
|
|
189
|
+
*/
|
|
190
|
+
declare function bashWriteGuard(ctx: GuardContext): Prompt | null;
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/policy/guards/interface-separation.d.ts
|
|
193
|
+
/** TS/JS component files: top-level `interface`/`type Foo`. */
|
|
194
|
+
declare const TS_DECL_RE: RegExp;
|
|
195
|
+
/** Python view models: class subclassing a schema/protocol base. */
|
|
196
|
+
declare const PY_MODEL_RE: RegExp;
|
|
197
|
+
/** PHP controllers: top-level `interface` / `abstract class`. */
|
|
198
|
+
declare const PHP_DECL_RE: RegExp;
|
|
199
|
+
/** Swift views: top-level `protocol Foo`. */
|
|
200
|
+
declare const SWIFT_PROTO_RE: RegExp;
|
|
201
|
+
/** Go handlers/controllers: top-level `type Foo interface`. */
|
|
202
|
+
declare const GO_DECL_RE: RegExp;
|
|
203
|
+
/** Java/Kotlin controllers/handlers: top-level `interface`/`record`. */
|
|
204
|
+
declare const JAVA_DECL_RE: RegExp;
|
|
205
|
+
/**
|
|
206
|
+
* Blocks top-level interface/type/protocol declarations in component, view or
|
|
207
|
+
* controller files (Interface Segregation). Fires only when BOTH the path
|
|
208
|
+
* category AND the content pattern match.
|
|
209
|
+
*/
|
|
210
|
+
declare function interfaceSeparationGuard(ctx: GuardContext): Prompt | null;
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/policy/guards/install.d.ts
|
|
213
|
+
/** Asks for confirmation before a dependency or system package install. */
|
|
214
|
+
declare function installGuard(ctx: GuardContext): Prompt | null;
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/policy/guards/index.d.ts
|
|
217
|
+
/** Ordered guard chain: critical/security + protected first, then writes/installs. */
|
|
218
|
+
declare const GUARDS: ReadonlyArray<Guard>;
|
|
219
|
+
/** Block prompt returned when a guard or gate throws (fail-closed). */
|
|
220
|
+
declare const FAIL_CLOSED: Prompt;
|
|
221
|
+
/** Register a user guard — runs AFTER the privileged core chain (two-tier). */
|
|
222
|
+
declare function registerGuard(guard: Guard): void;
|
|
223
|
+
/** Remove all registered user guards (mainly for tests). */
|
|
224
|
+
declare function clearUserGuards(): void;
|
|
225
|
+
/**
|
|
226
|
+
* Run the guard chain — privileged core guards first, then user guards — and
|
|
227
|
+
* return the first firing Prompt, else null. Fail-closed: a guard that throws
|
|
228
|
+
* blocks (never silently passes).
|
|
229
|
+
*/
|
|
230
|
+
declare function runGuards(ctx: GuardContext): Prompt | null;
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/policy/creation-intent.d.ts
|
|
233
|
+
/**
|
|
234
|
+
* True when a prompt expresses creation intent (a new feature/component) and is
|
|
235
|
+
* not a fix/refactor — the signal that brainstorming should precede creation.
|
|
236
|
+
* The harness calls this on UserPromptSubmit, then `recordBrainstormRequired`.
|
|
237
|
+
*/
|
|
238
|
+
declare function detectCreationIntent(prompt: string): boolean;
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/policy/verbosity.d.ts
|
|
241
|
+
/** Max results an exa MCP call may request. */
|
|
242
|
+
declare const MAX_EXA_RESULTS = 3;
|
|
243
|
+
/** Max token budget for exa `tokensNum` / context7 `tokens`. */
|
|
244
|
+
declare const MAX_TOKENS = 2e3;
|
|
245
|
+
/**
|
|
246
|
+
* Cap an MCP call's verbosity — exa `numResults` ≤ 3 (+ `tokensNum` ≤ 2000),
|
|
247
|
+
* Context7 `tokens` ≤ 2000. Returns the capped input (a mutation for the harness
|
|
248
|
+
* to apply) when a change is needed, else null.
|
|
249
|
+
*/
|
|
250
|
+
declare function capVerbosity(tool: string, input: Record<string, unknown>): Record<string, unknown> | null;
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/policy/framework-solid.d.ts
|
|
253
|
+
/**
|
|
254
|
+
* Framework-specific SOLID gate. Dispatches by extension/path to the matching
|
|
255
|
+
* validator (React, Next.js, Laravel, Swift) and returns a blocking
|
|
256
|
+
* {@link Prompt} when any BLOCKING rule fires, or `null` when clean. Excluded
|
|
257
|
+
* build/dependency paths (node_modules, dist, build, .next, vendor, .build,
|
|
258
|
+
* DerivedData, Pods) early-return `null` to avoid false positives.
|
|
259
|
+
* @param filePath - absolute path of the file being written/edited
|
|
260
|
+
* @param content - the file (or new) content under validation
|
|
261
|
+
* @param fileLines - full on-disk line count (set on Edit so a partial
|
|
262
|
+
* `new_string` snippet still judges the whole file, mirroring the base
|
|
263
|
+
* file-size guard / Python `get_full_file_content`). Omit on Write.
|
|
264
|
+
*/
|
|
265
|
+
declare function frameworkSolidGate(filePath: string, content: string, fileLines?: number): Prompt | null;
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/policy/skill-trigger-patterns.d.ts
|
|
268
|
+
/** Map of required sub-skill name → triggering code patterns, keyed by framework. */
|
|
269
|
+
declare const SKILL_TRIGGERS: Readonly<Record<string, Readonly<Record<string, ReadonlyArray<string>>>>>;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/policy/skill-triggers.d.ts
|
|
272
|
+
/**
|
|
273
|
+
* Detect which sub-skills the written `content` requires for a `framework`.
|
|
274
|
+
* Faithful to the Python `detect_required_skills`: first matching pattern per
|
|
275
|
+
* skill wins. Most frameworks match case-insensitively (source `re.IGNORECASE`);
|
|
276
|
+
* `swift` matches case-sensitively (see {@link CASE_SENSITIVE_FRAMEWORKS}).
|
|
277
|
+
* @param framework - "react" | "nextjs" | "laravel" | "swift".
|
|
278
|
+
* @param content - the code being written.
|
|
279
|
+
* @returns required sub-skill names (empty when framework unknown / no match).
|
|
280
|
+
*/
|
|
281
|
+
declare function detectRequiredSkills(framework: string, content: string): string[];
|
|
282
|
+
/**
|
|
283
|
+
* Block when a required sub-skill's `skills/<name>/` path is absent from
|
|
284
|
+
* `refsRead`. Mirrors `specific_skill_consulted`, which confirms a skill was
|
|
285
|
+
* read by checking the tracking file contains `skills/<name>/`.
|
|
286
|
+
* @param framework - "react" | "nextjs" | "laravel".
|
|
287
|
+
* @param content - the code being written.
|
|
288
|
+
* @param refsRead - in-session read reference paths.
|
|
289
|
+
* @param forcedSkill - a skill the detected modular architecture forces (optional).
|
|
290
|
+
* @param cwd - project root; when set and not a shadcn project, `*-shadcn`
|
|
291
|
+
* requirements are skipped (ports the Python `is_shadcn_project` filter).
|
|
292
|
+
* @returns a `block` Prompt naming the missing sub-skills, or `null` when satisfied.
|
|
293
|
+
*/
|
|
294
|
+
declare function skillTriggerGate(framework: string, content: string, refsRead: string[], forcedSkill?: string | null, cwd?: string): Prompt | null;
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/policy/claude-md-context.d.ts
|
|
297
|
+
/** Dev-verb regex (FR/EN) that triggers the APEX preamble (case-insensitive). */
|
|
298
|
+
declare const DEV_VERBS: RegExp;
|
|
299
|
+
/**
|
|
300
|
+
* Detect the project type from the cwd, reproducing the legacy Python logic:
|
|
301
|
+
* package.json containing "next" → nextjs, else "react" → react; else
|
|
302
|
+
* composer.json+artisan → laravel; else Package.swift / *.xcodeproj → swift;
|
|
303
|
+
* else generic.
|
|
304
|
+
* @param cwd - Project root to scan.
|
|
305
|
+
* @returns The detected project type label.
|
|
306
|
+
*/
|
|
307
|
+
declare function detectClaudeMdProjectType(cwd: string): string;
|
|
308
|
+
/**
|
|
309
|
+
* Build the APEX instruction preamble for a development task.
|
|
310
|
+
* @param projectType - Detected project type label.
|
|
311
|
+
* @param maxLines - SOLID per-file line ceiling.
|
|
312
|
+
* @returns The APEX instruction text.
|
|
313
|
+
*/
|
|
314
|
+
declare function buildApexInstruction(projectType: string, maxLines: number): string;
|
|
315
|
+
/**
|
|
316
|
+
* Build the UserPromptSubmit injection text: read `~/.claude/CLAUDE.md` and,
|
|
317
|
+
* when the prompt matches a dev verb, prepend the APEX instruction. Returns
|
|
318
|
+
* `null` when CLAUDE.md is absent/unreadable (the hook then emits nothing).
|
|
319
|
+
* @param prompt - The raw user prompt.
|
|
320
|
+
* @param cwd - Project root (for project-type detection).
|
|
321
|
+
* @returns The injection text, or `null` to emit nothing.
|
|
322
|
+
*/
|
|
323
|
+
declare function buildClaudeMdContext(prompt: string, cwd: string): string | null;
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/policy/apex-task-context.d.ts
|
|
326
|
+
/** Parsed task state injected into a Task sub-agent prompt. */
|
|
327
|
+
interface ApexTaskState {
|
|
328
|
+
/** Current task id (defaults to "1"). */
|
|
329
|
+
id: string;
|
|
330
|
+
/** Task subject (defaults to ""). */
|
|
331
|
+
subject: string;
|
|
332
|
+
/** Current phase (defaults to "analyze"). */
|
|
333
|
+
phase: string;
|
|
334
|
+
/** Comma-joined consulted doc keys, or "none". */
|
|
335
|
+
docs: string;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Read the current task state from `task.json`, reproducing the legacy Python
|
|
339
|
+
* logic. Any read/parse error falls back to `("1", "", "analyze", "none")`.
|
|
340
|
+
* @param taskFile - Absolute path to `.claude/apex/task.json`.
|
|
341
|
+
* @returns The parsed {@link ApexTaskState}.
|
|
342
|
+
*/
|
|
343
|
+
declare function loadApexTaskState(taskFile: string): ApexTaskState;
|
|
344
|
+
/**
|
|
345
|
+
* Build the APEX context string injected into a Task sub-agent prompt.
|
|
346
|
+
* @param state - The parsed task state.
|
|
347
|
+
* @param maxLines - SOLID per-file line ceiling.
|
|
348
|
+
* @returns The injection text.
|
|
349
|
+
*/
|
|
350
|
+
declare function buildApexTaskContext(state: ApexTaskState, maxLines: number): string;
|
|
351
|
+
/**
|
|
352
|
+
* Build the PreToolUse Task injection, gated on the existence of the project's
|
|
353
|
+
* `.claude/apex/` directory. Returns `null` when APEX is not active (no dir).
|
|
354
|
+
* @param projectRoot - `CLAUDE_PROJECT_DIR` or cwd.
|
|
355
|
+
* @returns The injection text, or `null` to emit nothing.
|
|
356
|
+
*/
|
|
357
|
+
declare function buildApexTaskInjection(projectRoot: string): string | null;
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/policy/cartographer/indicators.d.ts
|
|
360
|
+
/**
|
|
361
|
+
* Cartographer indicators — pure data sets used to detect a project root and to
|
|
362
|
+
* exclude noise directories when walking a tree. Ports the constant tables from
|
|
363
|
+
* `generate_project_map.py` / `write_recursive.py`.
|
|
364
|
+
*/
|
|
365
|
+
/** Filenames whose presence marks a directory as a project root. */
|
|
366
|
+
declare const PROJECT_INDICATORS: ReadonlySet<string>;
|
|
367
|
+
/** Directory names skipped entirely during the tree walk. */
|
|
368
|
+
declare const EXCLUDE_DIRS: ReadonlySet<string>;
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/policy/cartographer/frontmatter.d.ts
|
|
371
|
+
/**
|
|
372
|
+
* Extract a single frontmatter field's value from `text`. Strips surrounding
|
|
373
|
+
* quotes; skips YAML block-scalar markers. Returns "" when absent.
|
|
374
|
+
* @param text - The full document text.
|
|
375
|
+
* @param field - The frontmatter key to read.
|
|
376
|
+
* @returns The field value, or "".
|
|
377
|
+
*/
|
|
378
|
+
declare function parseField(text: string, field: string): string;
|
|
379
|
+
/**
|
|
380
|
+
* Derive a short description from the body following the frontmatter: the first
|
|
381
|
+
* non-empty trimmed line, sliced to `maxLen`. Returns "" when none.
|
|
382
|
+
* @param text - The full document text.
|
|
383
|
+
* @param maxLen - Maximum length of the returned description.
|
|
384
|
+
* @returns The body-derived description, or "".
|
|
385
|
+
*/
|
|
386
|
+
declare function parseBodyDesc(text: string, maxLen?: number): string;
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/policy/cartographer/entry.d.ts
|
|
389
|
+
/**
|
|
390
|
+
* Tree-entry parsing — pure line regexes. Ports the line parsers of
|
|
391
|
+
* `merge_index.py` and `track-enrichment.py`.
|
|
392
|
+
*/
|
|
393
|
+
/** A parsed `prefix[name](path) — desc` tree line. */
|
|
394
|
+
interface TreeEntry {
|
|
395
|
+
prefix: string;
|
|
396
|
+
name: string;
|
|
397
|
+
path: string;
|
|
398
|
+
desc: string;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Parse a `merge_index` tree line into its parts. Returns null on no match.
|
|
402
|
+
* @param line - The raw tree line.
|
|
403
|
+
* @returns The parsed entry, or null.
|
|
404
|
+
*/
|
|
405
|
+
declare function parseEntry(line: string): TreeEntry | null;
|
|
406
|
+
/**
|
|
407
|
+
* Parse an enrichment line into `[path, desc]`, requiring a non-empty desc.
|
|
408
|
+
* @param line - The raw index line.
|
|
409
|
+
* @returns The `[path, desc]` pair, or null.
|
|
410
|
+
*/
|
|
411
|
+
declare function parseEnrichment(line: string): [string, string] | null;
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/policy/cartographer/describe.d.ts
|
|
414
|
+
/**
|
|
415
|
+
* First `# ` Markdown heading text (sans hashes), sliced to 60. "" when none.
|
|
416
|
+
* @param text - The document text.
|
|
417
|
+
* @returns The heading text, or "".
|
|
418
|
+
*/
|
|
419
|
+
declare function firstHeading(text: string): string;
|
|
420
|
+
/**
|
|
421
|
+
* First leading comment among the first 10 lines (`//`, `#` but not `#!`, or a
|
|
422
|
+
* `"""`/`'''` docstring), sliced to 60. "" when none.
|
|
423
|
+
* @param text - The source text.
|
|
424
|
+
* @returns The comment text, or "".
|
|
425
|
+
*/
|
|
426
|
+
declare function firstComment(text: string): string;
|
|
427
|
+
/**
|
|
428
|
+
* Derive a description from a file's suffix + text. For `.md`, the supplied
|
|
429
|
+
* frontmatter `description` (truncated) wins over the first heading; for known
|
|
430
|
+
* source suffixes, the first comment; else "".
|
|
431
|
+
* @param suffix - The file extension (with dot).
|
|
432
|
+
* @param text - The file text.
|
|
433
|
+
* @param mdField - The pre-parsed frontmatter `description` (md only).
|
|
434
|
+
* @returns The derived description, or "".
|
|
435
|
+
*/
|
|
436
|
+
declare function descFromText(suffix: string, text: string, mdField: string): string;
|
|
437
|
+
//#endregion
|
|
438
|
+
export { ApexGate as $, registerGuard as A, ASK_WRITERS as B, MAX_EXA_RESULTS as C, requiredArchSkill as Ct, FAIL_CLOSED as D, detectCreationIntent as E, PHP_DECL_RE as F, protectedPathGuard as G, CODE_REDIRECT as H, PY_MODEL_RE as I, securityGuard as J, ASK_PATTERNS as K, SWIFT_PROTO_RE as L, installGuard as M, GO_DECL_RE as N, GUARDS as O, JAVA_DECL_RE as P, ApexContext as Q, TS_DECL_RE as R, frameworkSolidGate as S, isApexCommand as St, capVerbosity as T, bashWriteGuard as U, CODE_MUTATORS as V, PROTECTED_FRAGMENTS as W, GuardContext as X, Guard as Y, APEX_GATES as Z, buildClaudeMdContext as _, DEV_KEYWORDS as _t, parseEnrichment as a, PolicyContext as at, skillTriggerGate as b, detectModularArchitecture as bt, parseField as c, GIT_ASK as ct, ApexTaskState as d, SYSTEM_INSTALL as dt, brainstormGate as et, buildApexTaskContext as f, matchPatterns as ft, buildApexInstruction as g, detectFramework as gt, DEV_VERBS as h, evaluateFileSize as ht, TreeEntry as i, solidReadGate as it, runGuards as j, clearUserGuards as k, EXCLUDE_DIRS as l, GIT_BLOCKED as lt, loadApexTaskState as m, countLines as mt, firstComment as n, evaluateApex as nt, parseEntry as o, PolicyResult as ot, buildApexTaskInjection as p, FileSizeVerdict as pt, CRITICAL_PATTERNS as q, firstHeading as r, freshnessGate as rt, parseBodyDesc as s, evaluate as st, descFromText as t, docConsultedGate as tt, PROJECT_INDICATORS as u, PROJECT_INSTALL as ut, detectClaudeMdProjectType as v, ModularArchitecture as vt, MAX_TOKENS as w, SKILL_TRIGGERS as x, detectProjectType as xt, detectRequiredSkills as y, ProjectType as yt, interfaceSeparationGuard as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -5,10 +5,10 @@ import { a as detectHarness, i as HarnessVia, n as HarnessInfo, o as detectMode,
|
|
|
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
7
|
import { i as compactJson, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./index-C1vLIMwN.mjs";
|
|
8
|
-
import { A as
|
|
8
|
+
import { $ as ApexGate, A as registerGuard, B as ASK_WRITERS, C as MAX_EXA_RESULTS, Ct as requiredArchSkill, D as FAIL_CLOSED, E as detectCreationIntent, F as PHP_DECL_RE, G as protectedPathGuard, H as CODE_REDIRECT, I as PY_MODEL_RE, J as securityGuard, K as ASK_PATTERNS, L as SWIFT_PROTO_RE, M as installGuard, N as GO_DECL_RE, O as GUARDS, P as JAVA_DECL_RE, Q as ApexContext, R as TS_DECL_RE, S as frameworkSolidGate, St as isApexCommand, T as capVerbosity, U as bashWriteGuard, V as CODE_MUTATORS, W as PROTECTED_FRAGMENTS, X as GuardContext, Y as Guard, Z as APEX_GATES, _ as buildClaudeMdContext, _t as DEV_KEYWORDS, a as parseEnrichment, at as PolicyContext, b as skillTriggerGate, bt as detectModularArchitecture, c as parseField, ct as GIT_ASK, d as ApexTaskState, dt as SYSTEM_INSTALL, et as brainstormGate, f as buildApexTaskContext, ft as matchPatterns, g as buildApexInstruction, gt as detectFramework, h as DEV_VERBS, ht as evaluateFileSize, i as TreeEntry, it as solidReadGate, j as runGuards, k as clearUserGuards, l as EXCLUDE_DIRS, lt as GIT_BLOCKED, m as loadApexTaskState, mt as countLines, n as firstComment, nt as evaluateApex, o as parseEntry, ot as PolicyResult, p as buildApexTaskInjection, pt as FileSizeVerdict, q as CRITICAL_PATTERNS, r as firstHeading, rt as freshnessGate, s as parseBodyDesc, st as evaluate, t as descFromText, tt as docConsultedGate, u as PROJECT_INDICATORS, ut as PROJECT_INSTALL, v as detectClaudeMdProjectType, vt as ModularArchitecture, w as MAX_TOKENS, x as SKILL_TRIGGERS, xt as detectProjectType, y as detectRequiredSkills, yt as ProjectType, z as interfaceSeparationGuard } from "./index-mISsk0ff.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, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DocSatisfactionStatus, 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, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, Palette, PolicyContext, PolicyResult, ProgressBarOptions, ProjectLayout, ProjectType, Prompt, PromptKind, RefMeta, ReminderState, RouteResult, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, ScoredRef, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectProjectType, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registerGuard, registryFile, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, 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, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -4,17 +4,16 @@ import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "./lay
|
|
|
4
4
|
import { t as compactJson } from "./compact-json-DK2nX-MK.mjs";
|
|
5
5
|
import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-ff0_poWU.mjs";
|
|
6
6
|
import { n as detectMode, r as modeFor, t as detectHarness } from "./harness-C8Nxxyn_.mjs";
|
|
7
|
-
import {
|
|
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 solidReadGate, C as capVerbosity, D as docConsultedGate, E as brainstormGate, F as requiredArchSkill, M as detectModularArchitecture, N as detectProjectType, O as evaluateApex, P as isApexCommand, S as MAX_TOKENS, T as APEX_GATES, _ as detectRequiredSkills, a as parseEntry, b as frameworkSolidGate, c as EXCLUDE_DIRS, d as buildApexTaskInjection, f as loadApexTaskState, g as detectClaudeMdProjectType, h as buildClaudeMdContext, i as parseEnrichment, j as DEV_KEYWORDS, k as freshnessGate, l as PROJECT_INDICATORS, m as buildApexInstruction, n as firstComment, o as parseBodyDesc, p as DEV_VERBS, r as firstHeading, s as parseField, t as descFromText, u as buildApexTaskContext, v as skillTriggerGate, w as detectCreationIntent, x as MAX_EXA_RESULTS, y as SKILL_TRIGGERS } from "./describe-CPtgUzFS.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-j3gRJ_ng.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
|
-
import { a as APEX_GATES, c as evaluateApex, i as detectCreationIntent, l as freshnessGate, n as MAX_TOKENS, o as brainstormGate, r as capVerbosity, s as docConsultedGate, t as MAX_EXA_RESULTS, u as solidReadGate } from "./verbosity-CXpf3aQQ.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 "./memory-BkoEbdec.mjs";
|
|
14
|
-
import {
|
|
15
|
-
import { a as extractText, i as mcpCacheKey, n as cachePath, r as cacheStore, t as cacheLookup } from "./store-
|
|
16
|
-
import { t as incrementTrivialEditCounter } from "./freshness-
|
|
13
|
+
import { n as jaccardSimilar, r as queryHash, t as compactMarkdown } from "./cache-C9z9LclL.mjs";
|
|
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
|
+
import { t as incrementTrivialEditCounter } from "./freshness-otdUpuvP.mjs";
|
|
17
16
|
import { n as toRefMeta, t as loadRefs } from "./loader-CyAoJv2W.mjs";
|
|
18
|
-
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-
|
|
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";
|
|
19
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";
|
|
20
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, 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_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectProjectType, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registerGuard, registryFile, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, 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, 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 };
|
|
@@ -37,4 +37,4 @@ async function writeJsonFile(path, data, compact = false) {
|
|
|
37
37
|
atomicWrite(path, compact ? compactJson(data) : JSON.stringify(data, null, 2));
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
|
-
export {
|
|
40
|
+
export { writeJsonFile as i, ensureDir as n, readJsonFile as r, atomicWrite as t };
|
package/dist/policy/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FAIL_CLOSED, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, Guard, GuardContext, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, PHP_DECL_RE, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, PolicyContext, PolicyResult, ProjectType, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, capVerbosity, clearUserGuards, countLines, detectCreationIntent, detectFramework, detectProjectType, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, registerGuard, runGuards, securityGuard, solidReadGate };
|
|
1
|
+
import { $ as ApexGate, A as registerGuard, B as ASK_WRITERS, C as MAX_EXA_RESULTS, Ct as requiredArchSkill, D as FAIL_CLOSED, E as detectCreationIntent, F as PHP_DECL_RE, G as protectedPathGuard, H as CODE_REDIRECT, I as PY_MODEL_RE, J as securityGuard, K as ASK_PATTERNS, L as SWIFT_PROTO_RE, M as installGuard, N as GO_DECL_RE, O as GUARDS, P as JAVA_DECL_RE, Q as ApexContext, R as TS_DECL_RE, S as frameworkSolidGate, St as isApexCommand, T as capVerbosity, U as bashWriteGuard, V as CODE_MUTATORS, W as PROTECTED_FRAGMENTS, X as GuardContext, Y as Guard, Z as APEX_GATES, _ as buildClaudeMdContext, _t as DEV_KEYWORDS, a as parseEnrichment, at as PolicyContext, b as skillTriggerGate, bt as detectModularArchitecture, c as parseField, ct as GIT_ASK, d as ApexTaskState, dt as SYSTEM_INSTALL, et as brainstormGate, f as buildApexTaskContext, ft as matchPatterns, g as buildApexInstruction, gt as detectFramework, h as DEV_VERBS, ht as evaluateFileSize, i as TreeEntry, it as solidReadGate, j as runGuards, k as clearUserGuards, l as EXCLUDE_DIRS, lt as GIT_BLOCKED, m as loadApexTaskState, mt as countLines, n as firstComment, nt as evaluateApex, o as parseEntry, ot as PolicyResult, p as buildApexTaskInjection, pt as FileSizeVerdict, q as CRITICAL_PATTERNS, r as firstHeading, rt as freshnessGate, s as parseBodyDesc, st as evaluate, t as descFromText, tt as docConsultedGate, u as PROJECT_INDICATORS, ut as PROJECT_INSTALL, v as detectClaudeMdProjectType, vt as ModularArchitecture, w as MAX_TOKENS, x as SKILL_TRIGGERS, xt as detectProjectType, y as detectRequiredSkills, yt as ProjectType, z as interfaceSeparationGuard } from "../index-mISsk0ff.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, loadApexTaskState, matchPatterns, parseBodyDesc, parseEnrichment, parseEntry, parseField, protectedPathGuard, registerGuard, requiredArchSkill, runGuards, securityGuard, skillTriggerGate, solidReadGate };
|
package/dist/policy/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
3
|
-
import
|
|
4
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FAIL_CLOSED, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, PHP_DECL_RE, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, capVerbosity, clearUserGuards, countLines, detectCreationIntent, detectFramework, detectProjectType, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, registerGuard, runGuards, securityGuard, solidReadGate };
|
|
1
|
+
import { A as solidReadGate, C as capVerbosity, D as docConsultedGate, E as brainstormGate, F as requiredArchSkill, M as detectModularArchitecture, N as detectProjectType, O as evaluateApex, P as isApexCommand, S as MAX_TOKENS, T as APEX_GATES, _ as detectRequiredSkills, a as parseEntry, b as frameworkSolidGate, c as EXCLUDE_DIRS, d as buildApexTaskInjection, f as loadApexTaskState, g as detectClaudeMdProjectType, h as buildClaudeMdContext, i as parseEnrichment, j as DEV_KEYWORDS, k as freshnessGate, l as PROJECT_INDICATORS, m as buildApexInstruction, n as firstComment, o as parseBodyDesc, p as DEV_VERBS, r as firstHeading, s as parseField, t as descFromText, u as buildApexTaskContext, v as skillTriggerGate, w as detectCreationIntent, x as MAX_EXA_RESULTS, y as SKILL_TRIGGERS } from "../describe-CPtgUzFS.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-j3gRJ_ng.mjs";
|
|
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as isCodeFile } from "./project-root-ff0_poWU.mjs";
|
|
2
|
-
import { t as evaluate } from "./evaluate-
|
|
2
|
+
import { t as evaluate } from "./evaluate-j3gRJ_ng.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
|