arkgate 4.8.25 → 4.8.26

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ in the immutable pre-2.0 archive linked below.
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 4.8.26 — 2026-10-13
9
+
10
+ **Patch** over **4.8.25**. #353 and #354. **Write. Check. Ship.** **No required config migration.** No `schemaVersion` bump. Does not close `K01` / `Z09`. This mother `ark.config.json` still does **not** turn `arkOrder` on.
11
+
12
+ **Status: released** (tag `v4.8.26`). Run `npm view arkgate@4.8.26 version` to confirm (#314).
13
+
14
+ ### Fixed
15
+ - `--root` is always the analyzed tree. `--config` is only a file: an explicit path never replaces `--root` with the config's folder (#353, #352).
16
+ - `--strict` refuses a config outside the Git repository before base-ref discovery, including on the trunk (#354).
17
+
8
18
  ## 4.8.25 — 2026-10-05
9
19
 
10
20
  **Patch** over **4.8.24**. Weekly accumulate (#342, #344, #345, #346, #347, #348, #349, #350). **Write. Check. Ship.** **No required config migration.** `childSlices.arkRulesFile` and pinned `sliceAliases` need 4.8.25. No `schemaVersion` bump. Does not close `K01` / `Z09`. This mother `ark.config.json` still does **not** turn `arkOrder` on.
package/README.md CHANGED
@@ -25,11 +25,11 @@ Design the boundary before you implement. Put a small interface in front of the
25
25
 
26
26
  ## Try it
27
27
 
28
- One command. Preview only — no files change. Current release is **4.8.25**
28
+ One command. Preview only — no files change. Current release is **4.8.26**
29
29
  (check npm `latest` with `npm view arkgate version`):
30
30
 
31
31
  ```bash
32
- npx arkgate@4.8.25 start
32
+ npx arkgate@4.8.26 start
33
33
  ```
34
34
 
35
35
  ## What a red result looks like
@@ -355,16 +355,17 @@ export function analyzePolicyTransition({
355
355
  acknowledgementPath,
356
356
  }) {
357
357
  if (!strictMerge && !basePath && !baseRef && !acknowledgementPath) return undefined;
358
+ if (strictMerge && !basePath) {
359
+ const top = repositoryRoot(root);
360
+ if (top) configPathInRepository(root, configPath, top);
361
+ }
358
362
  const base = resolvePolicyBaseConfig({ root, configPath, basePath, baseRef, adoptMissingBase });
359
363
  if (!base && (basePath || (baseRef && !adoptMissingBase) || acknowledgementPath)) {
360
364
  throw new Error('Policy delta was requested but no policy base could be resolved.');
361
365
  }
362
366
  if (!base) return undefined;
363
367
 
364
- // AR02/AR11: load Effective ArkRules so mode edits inside arkrules/*.json classify,
365
- // and attach candidate coverage so covered advisory→enforced can auto-allow.
366
- // Base ArkRules come from the SAME source as the base config (git ref or the
367
- // base file's directory), never from the candidate working tree.
368
+ // Base ArkRules come from the base ref or base file, never the candidate tree.
368
369
  const baseArkRules = loadBaseArkRules(base);
369
370
  const candidateLoad = loadEffectiveArkRulesFromDisk(root, candidateConfig);
370
371
  if (candidateLoad.errors.length > 0) {
@@ -4,6 +4,12 @@
4
4
  * Monorepo honesty (NEW-MONOREPO-CWD-WALKUP): when cwd (or --root) has no
5
5
  * ark.config.json, walk parent directories until one is found. Never invent a
6
6
  * silent 11-layer / empty ADAPT world while a parent monorepo contract exists.
7
+ * That ancestor contains the directory the caller named, so the requested tree
8
+ * stays inside the analysis.
9
+ *
10
+ * An explicit --config path (absolute, or any name with a separator) is a file.
11
+ * Layer patterns resolve against the caller's --root. The file's directory is
12
+ * never a fallback analysis root (#352).
7
13
  *
8
14
  * Security (S0 walk-up review):
9
15
  * - Split **config discovery root** from **write root**.
@@ -104,11 +110,6 @@ function configNameIsPath(configName) {
104
110
  );
105
111
  }
106
112
 
107
- function isInsideRoot(root, target) {
108
- const rel = path.relative(root, target);
109
- return rel === '' || (!rel.startsWith(`..${path.sep}`) && rel !== '..' && !path.isAbsolute(rel));
110
- }
111
-
112
113
  /**
113
114
  * Resolve a nested/absolute --config path without walking parents.
114
115
  * `--root examples/app --config examples/app/ark.config.json` must load the nested
@@ -145,7 +146,8 @@ function resolveConfigPathCandidate(startDir, configName) {
145
146
  * Walk parents from startDir looking for configName (default ark.config.json).
146
147
  * Bounds: filesystem root, max depth, git root, workspaces package root.
147
148
  * Config found at a bound root is accepted; walking above a bound is refused.
148
- * Nested relative --config (`examples/app/ark.config.json`) is a file path, never a walk-up name.
149
+ * An explicit --config path is a file. The returned root stays `startDir`.
150
+ * Basename walk-up (`ark.config.json`) may still adopt an ancestor.
149
151
  *
150
152
  * @param {string} startDir
151
153
  * @param {string} [configName='ark.config.json']
@@ -157,26 +159,12 @@ export function findNearestArkConfig(startDir, configName = 'ark.config.json', o
157
159
  const boundAtGit = opts.boundAtGitRoot !== false;
158
160
  const boundAtWorkspaces = opts.boundAtWorkspacesRoot !== false;
159
161
 
160
- if (typeof configName === 'string' && path.isAbsolute(configName)) {
161
- if (isFile(configName)) {
162
- const root = path.dirname(configName);
163
- const start = path.resolve(startDir || process.cwd());
164
- return { root, configPath: path.resolve(configName), walkedUp: path.resolve(root) !== start };
165
- }
166
- return null;
167
- }
168
-
169
162
  const name = configName || 'ark.config.json';
170
163
  if (configNameIsPath(name)) {
171
164
  const resolved = resolveConfigPathCandidate(startDir, name);
172
165
  if (!resolved) return null;
173
166
  const start = path.resolve(startDir || process.cwd());
174
- const inside = isInsideRoot(start, resolved);
175
- return {
176
- root: inside ? start : path.dirname(resolved),
177
- configPath: resolved,
178
- walkedUp: !inside,
179
- };
167
+ return { root: start, configPath: resolved, walkedUp: false };
180
168
  }
181
169
 
182
170
  let dir = path.resolve(startDir || process.cwd());
@@ -213,9 +201,10 @@ export function findNearestArkConfig(startDir, configName = 'ark.config.json', o
213
201
  * Resolve config discovery vs write roots for CLI invocation.
214
202
  *
215
203
  * - If config exists at startRoot → use startRoot for both.
216
- * - Else walk parents for config (bounded) → configRoot may differ from writeRoot.
204
+ * - An explicit --config path keeps `root` at startRoot. The file's directory is not a fallback.
205
+ * - Else walk parents for a basename config (bounded) → configRoot may differ from writeRoot.
217
206
  * - writeMode without followConfigRoot: keep writeRoot/start as `root` (do not rewrite parent).
218
- * - writeMode + followConfigRoot (or read mode): adopt walked config root as `root`.
207
+ * - writeMode + followConfigRoot (or read mode): adopt a basename walk-up root as `root`.
219
208
  *
220
209
  * @param {string} startRoot
221
210
  * @param {{
@@ -1,4 +1,4 @@
1
- import{I as Le,N as At,P as ce,Q as kt,R as Et,T as Rt,V as Pt,a,e as St,f as wt,r as It,t as vt,x as bt}from"./chunk-SVSQVGFJ.js";var Ct="4.8.25";var C={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},xt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},compositionRoots:{...C,default:[]},kernelRoots:{...C},managedLayers:{...C,default:[]},requireDeclarations:{type:"boolean",default:!0},ignoreDirectNewForErrors:{type:"boolean",default:!0}}},Lt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},planeRoots:{...C,default:[]},managedLayers:{...C,default:[]},maxXiKeys:{type:"integer",minimum:1,default:7},xiKeys:{...C,default:[]},appliesTo:{...C,default:[]}}};function z(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}a(z,"isObject");function er(t){let e=new Set;if(!Array.isArray(t.layers))return e;for(let n of t.layers)z(n)&&typeof n.name=="string"&&n.name.length>0&&e.add(n.name);return e}a(er,"declaredLayerNames");function Ot(t){if(!z(t))return t;let e={mode:t.mode===void 0?"advisory":t.mode,compositionRoots:t.compositionRoots===void 0?[]:t.compositionRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,requireDeclarations:t.requireDeclarations===void 0?!0:t.requireDeclarations};return t.kernelRoots!==void 0&&(e.kernelRoots=t.kernelRoots),t.ignoreDirectNewForErrors!==void 0&&(e.ignoreDirectNewForErrors=t.ignoreDirectNewForErrors),{...t,...e}}a(Ot,"defaultedArkRun");function $t(t){if(!z(t))return t;let e=typeof t.maxXiKeys=="number"&&t.maxXiKeys>0?t.maxXiKeys:7;return{...t,mode:t.mode===void 0?"advisory":t.mode,planeRoots:t.planeRoots===void 0?[]:t.planeRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,maxXiKeys:e,xiKeys:t.xiKeys===void 0?[]:t.xiKeys}}a($t,"defaultedArkOrder");function Dt(t,e,n,r){if(!Array.isArray(e))return;let o=er(t);e.forEach((i,s)=>{typeof i=="string"&&i.length>0&&!o.has(i)&&r.push({path:`$.${n}.managedLayers[${s}]`,message:`layer ${JSON.stringify(i)} is not declared in layers[]`})})}a(Dt,"validateManagedLayersDeclared");function Nt(t,e){let n=t.arkRun;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkRun",e),n.mode==="enforced"){let o=n.kernelRoots??n.compositionRoots;(!Array.isArray(o)||o.length===0)&&e.push({path:n.kernelRoots!==void 0?"$.arkRun.kernelRoots":"$.arkRun.compositionRoots",message:"ARKRUN_MISSING_ROOT: enforced mode requires at least one kernel root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkRun.managedLayers",message:"enforced mode requires at least one managed layer"})}}a(Nt,"validateArkRunExtra");function Tt(t,e){let n=t.arkOrder;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkOrder",e),n.mode==="enforced"){let o=n.planeRoots;(!Array.isArray(o)||o.length===0)&&e.push({path:"$.arkOrder.planeRoots",message:"ARKORDER_MISSING_PLANE: enforced mode requires at least one plane root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkOrder.managedLayers",message:"enforced mode requires at least one managed layer"})}}a(Tt,"validateArkOrderExtra");var ue={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Ht={description:'deny blocks every shared-root import of a slice. deny-cross-parent leaves that hop as a warning and, in ark-check and CI only, reports a slice that reaches another universe through a shared root. The write hook and ESLint see one edge and do not block it. The object form { mode: "deny-cross-parent", stopAt } names composition roots (bootstrap, DI registrations) the whole-graph walk never starts at or passes through; a stop file must still sit under sharedRoots, and stopAt does not silence the direct SHARED_IMPORTS_SLICE warning. arkgate 4.8.22 and older reject deny-cross-parent. arkgate 4.8.23 and older reject the object form (must be one of deny, deny-cross-parent).',oneOf:[{type:"string",enum:["deny","deny-cross-parent"]},{type:"object",additionalProperties:!1,required:["mode","stopAt"],properties:{mode:{type:"string",enum:["deny-cross-parent"]},stopAt:{...ue,minItems:1}}}]},Kt={type:"object",additionalProperties:!1,required:["sliceFolders"],description:`Optional inner wall under this rule. Runs only on a rule with peerIsolation: true and allowed: false; elsewhere it is inert and ark-check warns CONFIG_CHILD_SLICES_INERT (config load still accepts it, as 4.8.23 did). Absent keeps today's universe wall. sliceFolders names children. Flat files are universe common, and so is a commonFolders directory directly under the universe (a folder of that name inside a child belongs to that child). siblings is "deny" (default), "advisory", or { default, enforce, ratchet }. parentMayImportChild defaults to false. message is the text for inner-wall findings. allowedCrossSlice may use a whole-segment *. It clears only a sibling crossing. Cross-parent has no advisory knob. arkgate 4.8.22 and older reject this key. A build that still rejects unknown childSlices fields rejects allowedCrossSlice at config load. A build that still types siblings as a string enum rejects the object at config load.`,properties:{sliceFolders:{...ue,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"]},commonFolders:{...ue,minItems:1},siblings:{description:'"deny" or "advisory", or { default, enforce, ratchet } so listed subtrees are errors while the default stays advisory. ratchet absent: a new advisory crossing fails only when the baseline in use already records an advisory crossing of this rule. ratchet true: any unrecorded advisory crossing fails when a baseline is in use. ratchet false: measure only, never fails. A string-enum build rejects the object at config load (must be one of deny, advisory). arkgate 4.8.23 and older reject ratchet (unknown field).',oneOf:[{type:"string",enum:["deny","advisory"]},{type:"object",additionalProperties:!1,required:["default"],properties:{default:{type:"string",enum:["deny","advisory"]},enforce:{...ue},ratchet:{type:"boolean"}}}]},parentMayImportChild:{type:"boolean"},message:{type:"string",minLength:1,description:"Text for inner-wall findings (CROSS_SIBLING_SLICE and universe common importing a child). The rule message stays the universe-wall text (CROSS_PARENT_SLICE and fail-closed denies). Absent: ArkGate default text, never the rule message. arkgate 4.8.23 and older reject this field (unknown field)."},arkRulesFile:{type:"string",minLength:1,description:"Filename read at each child slice root this wall already resolved. The only token is <Layer>, replaced with a declared layer name (arkrules.<Layer>.json). No slash and no wildcard. A discovered file that omits appliesTo is scoped to that slice directory. Explicit appliesTo outside the slice fails config load (ARKRULE_SCOPE_ESCAPES_SLICE). The effective id is <childId>#<localId>. A build that rejects unknown childSlices fields fails at config load (unknown field)."},sliceAliases:{type:"array",minItems:1,description:"Maps a source path glob onto a child slice id (universe id plus one child segment) so files outside the slice trees take that universe and child for both walls. A path without a wildcard also covers everything under it, as sharedRoots does. A bare name, a universe id alone, a target outside every universe shape, and a wildcard in to are rejected. Under stars identity a target written against the 4.8.23 stars id (star bindings before the last literal dropped, e.g. api/v1/x for modules/*/api/*) still loads when it maps to one universe shape, and ark-check warns CONFIG_SLICE_LEGACY_STARS_ID with the new id; it is rejected only when it maps to more than one shape. Config load checks only the shape; doctor reports a target universe no file belongs to. The glob may not overlap a slice folder, and two aliases may not match the same file. Doctor lists each unpinned alias as an owed move. pinned true lists the alias separately and does not count it as debt. reason is a doctor label and does not pin by itself. A build that rejects unknown childSlices fields fails at config load (unknown field). arkgate 4.8.22 and older reject childSlices.",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},pinned:{type:"boolean",description:"True when a framework forces the path to stay. The alias is not an owed move and does not clear other honesty debt."},reason:{type:"string",minLength:1,description:"Doctor label, such as framework-route. A label alone does not pin."}}}},allowedCrossSlice:{type:"array",minItems:1,description:"Directed child-slice allowances. * matches one whole path segment (features/projects/*). ** and a partial segment are rejected. A bare name is rejected. This list clears only CROSS_SIBLING_SLICE. It cannot clear CROSS_PARENT_SLICE or CROSS_PARENT_VIA_SHARED. The universe allowedCrossSlice still treats * as a literal. A build that rejects unknown childSlices fields fails at config load (unknown field).",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}}}};function I(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}a(I,"isObject");function fe(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}a(fe,"propertyPath");function P(t){let e=t.length;for(;e>0&&t[e-1]==="/";)e-=1;return t.slice(0,e)}a(P,"trimTrailingSlashes");function Vt(t,e){ir(t,e),ar(t,e),ur(t,e),Rr(t,e),Er(t,e)}a(Vt,"validateSliceContract");var Mt='must be "deny", "deny-cross-parent", or { "mode": "deny-cross-parent", "stopAt": ["<composition root path or glob>"] }',Ft="must not cover the whole tree. Name the composition root itself (bootstrap file, DI registrations folder).";function tr(t){return t==="*"||t==="**"}a(tr,"isWildcardSegment");function Wt(t){let e=t.toLowerCase().split("/").filter(o=>o.length>0&&o!==".");(e[0]==="src"||e[0]==="app")&&(e=e.slice(1));let n=e.length;for(;n>0&&tr(e[n-1]??"");)n-=1;let r=e.slice(0,n);return r.some(o=>o.includes("*"))?null:r}a(Wt,"coveredFolder");function nr(t,e){return t.length<=e.length&&t.every((n,r)=>e[r]===n)}a(nr,"isPrefixOf");function rr(t,e){let n=t.layers;if(!Array.isArray(n))return[];let r=new Set([e.from,e.to].filter(i=>typeof i=="string")),o=[];for(let i of n){if(!I(i)||typeof i.name!="string"||!r.has(i.name))continue;let s=Array.isArray(i.patterns)?i.patterns:[];for(let l of s){if(typeof l!="string")continue;let c=l.replace(/\\/g,"/").split("/"),d=c.findIndex(m=>m.includes("*")),f=d===-1?c:c.slice(0,d),p=Wt(f.join("/"));p&&o.push(p)}}return o}a(rr,"ruleLayerFolders");function or(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0)return"must be a non-empty path or glob";let r=n.replace(/^[./]+/,"");if(r===""||r==="*"||r==="**")return Ft;for(let i of n.split("/"))if(i.length===0||i==="."||i==="..")return"must be a path or glob without empty, . or .. segments";let o=Wt(n);return o===null?null:o.length===0?Ft:e.some(i=>nr(o,i))?"must not cover a whole layer root of this rule. Name the composition root itself (bootstrap file, DI registrations folder).":null}a(or,"stopAtEntryIssue");function ir(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r)||r.sharedImportsSlice===void 0)return;let i=r.sharedImportsSlice,s=`$.rules[${o}].sharedImportsSlice`;if(typeof i=="string"){i!=="deny"&&i!=="deny-cross-parent"&&e.push({path:s,message:Mt});return}if(!I(i)){e.push({path:s,message:Mt});return}for(let f of Object.keys(i))f!=="mode"&&f!=="stopAt"&&e.push({path:fe(s,f),message:"unknown field"});i.mode===void 0?e.push({path:`${s}.mode`,message:"is required"}):i.mode!=="deny-cross-parent"&&e.push({path:`${s}.mode`,message:'must be deny-cross-parent. stopAt has no meaning for deny; use the string "deny".'});let l=i.stopAt;if(l===void 0){e.push({path:`${s}.stopAt`,message:"is required"});return}if(!Array.isArray(l)||l.length===0){e.push({path:`${s}.stopAt`,message:"must be a non-empty array of paths or globs"});return}let c=new Set,d=rr(t,r);l.forEach((f,p)=>{let m=`${s}.stopAt[${p}]`;if(typeof f!="string"){e.push({path:m,message:"must be a non-empty path or glob"});return}let h=or(f,d);if(h){e.push({path:m,message:h});return}let S=P(f.trim().replace(/\\/g,"/")).toLowerCase();if(c.has(S)){e.push({path:m,message:"duplicate stopAt entry"});return}c.add(S)})})}a(ir,"validateSharedImportsSlice");var sr=["deny","advisory"],_t='must be "deny", "advisory", or { "default": "deny" | "advisory", "enforce": ["<child id or subtree path>"], "ratchet": true | false }';function ar(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.siblings===void 0)return;let s=i.siblings,l=`$.rules[${o}].childSlices.siblings`;if(typeof s=="string"){sr.includes(s)||e.push({path:l,message:_t});return}if(!I(s)){e.push({path:l,message:_t});return}for(let d of Object.keys(s))d!=="default"&&d!=="enforce"&&d!=="ratchet"&&e.push({path:fe(l,d),message:"unknown field"});if(s.ratchet!==void 0&&typeof s.ratchet!="boolean"&&e.push({path:`${l}.ratchet`,message:"must be a boolean"}),s.default===void 0?e.push({path:`${l}.default`,message:"is required"}):s.default!=="deny"&&s.default!=="advisory"&&e.push({path:`${l}.default`,message:"must be deny or advisory"}),s.enforce===void 0)return;if(!Array.isArray(s.enforce)){e.push({path:`${l}.enforce`,message:"must be an array of child slice ids or subtree paths"});return}let c=new Set;s.enforce.forEach((d,f)=>{let p=`${l}.enforce[${f}]`;if(typeof d!="string"||d.trim().length===0){e.push({path:p,message:"must be a non-empty child slice id or subtree path"});return}let m=P(d.trim().replace(/\\/g,"/"));if(m.split("/").some(h=>h.length===0||h==="."||h==="..")){e.push({path:p,message:"must be a child slice id or subtree path without . or .."});return}if(m.includes("*")){e.push({path:p,message:"must be a child slice id or subtree path. * is not a wildcard on siblings.enforce"});return}if(c.has(m)){e.push({path:p,message:"duplicate enforce entry"});return}c.add(m)})})}a(ar,"validateChildSliceSiblings");var lr="must be a slice id with a slash. A bare name is ambiguous across universes.",cr="* matches one whole path segment. ** and a partial segment are not wildcards.";function dr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty slice id";if(!e.includes("/"))return lr;let n=e.split("/");for(let r of n){if(r.length===0||r==="."||r==="..")return"must be a slice id without empty, . or .. segments";if(r.includes("*")&&r!=="*")return cr}return null}a(dr,"childCrossSlicePatternIssue");function Bt(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase()}a(Bt,"childCrossSlicePatternKey");function ur(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.allowedCrossSlice===void 0)return;let s=i.allowedCrossSlice,l=`$.rules[${o}].childSlices.allowedCrossSlice`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } child slice ids"});return}let c=new Set;s.forEach((d,f)=>{let p=`${l}[${f}]`;if(!I(d)){e.push({path:p,message:"must be an object with from and to"});return}for(let h of Object.keys(d))h!=="from"&&h!=="to"&&e.push({path:fe(p,h),message:"unknown field"});for(let h of["from","to"]){let S=d[h],u=`${p}.${h}`;if(typeof S!="string"||S.trim().length===0){e.push({path:u,message:"must be a non-empty slice id"});continue}let y=dr(S);y&&e.push({path:u,message:y})}if(typeof d.from!="string"||typeof d.to!="string")return;let m=`${Bt(d.from)}\0${Bt(d.to)}`;if(!m.startsWith("\0")&&!m.endsWith("\0")){if(c.has(m)){e.push({path:p,message:"duplicate child slice allowance"});return}c.add(m)}})})}a(ur,"validateChildSliceAllowedCrossSlice");var M="must be a child of a universe shape this rule names (its universe sliceFolders shape plus one child segment). A bare name, a universe id alone, a target outside every universe shape, and a wildcard are rejected. Config load checks the shape only; doctor reports a target universe no file belongs to.",fr="is a 4.8.23 stars id (star bindings before the last literal dropped) that maps to more than one universe shape of this rule. Write the new stars id, which keeps every star binding (e.g. orders/api/v1/x for modules/*/api/*).",pr="overlaps a slice folder. An alias covers only files outside the slice trees.",gr="two slice aliases match the same file";function mr(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase().split("/").filter(e=>e.length>0)}a(mr,"aliasPathSegments");function hr(t){let e=t[t.length-1];return e===void 0||e.includes("*")?[...t]:[...t,"**"]}a(hr,"aliasSegmentsWithSubtree");function Ut(t){let e=[];for(let n of t){if(n.includes("*"))break;e.push(n)}return e}a(Ut,"concreteGlobPrefix");function J(t,e){if(t.length>e.length)return!1;for(let n=0;n<t.length;n+=1)if(t[n]!==e[n])return!1;return!0}a(J,"segmentsArePrefix");function yr(t){let e=t.split(/[/\\]/).filter(Boolean).map(r=>r.toLowerCase());if(e.length<2||e[0]==="*"||e[0]==="**"||!e.some(r=>r==="*"))return null;let n=[];for(let r of e){if(r==="*"||r==="**")break;if(r.includes("*"))return null;n.push(r)}return n.length>0?n:null}a(yr,"anchoredSlicePrefix");function Sr(t,e){let n=Ut(t),r=n.length<t.length,o=n[0]==="src"||n[0]==="app"?n.slice(1):n;return J(e,n)||J(e,o)?!0:r?J(n,e)&&n.length<e.length||J(n,["src",...e])&&n.length<e.length+1||J(n,["app",...e])&&n.length<e.length+1:!1}a(Sr,"globOverlapsAnchored");function wr(t,e){for(let r=0;r<t.length;r+=1){if(t[r]!==e&&t[r]!=="*")continue;let o=t.slice(r+1);if(o.length>=2||o.some(i=>i==="*"||i==="**"))return!0}let n=Ut(t);return n.length<t.length&&(n.length===0||n.length===1&&(n[0]==="src"||n[0]==="app"))}a(wr,"globOverlapsBare");function Ir(t,e){let n=e.split(/[/\\]/).filter(Boolean).map(o=>o.toLowerCase());if(n.length===1&&n[0]&&!n[0].includes("*"))return wr(t,n[0]);let r=yr(e);return r?Sr(t,r):!1}a(Ir,"globOverlapsSliceEntry");function vr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty path glob";if(e==="*"||e==="**")return"must not cover the whole tree";for(let n of e.split("/")){if(n.length===0||n==="."||n==="..")return"must be a path glob without empty, . or .. segments";if(!(n==="*"||n==="**")&&(n.includes("*")||n.includes("?")||n.includes("{")||n.includes("[")))return"* matches one whole path segment. ** is a whole segment. A partial segment is not a wildcard."}return null}a(vr,"aliasGlobIssue");function br(t,e){let n=[];if(!Array.isArray(t))return n;let r=e==="stars";for(let o of t){if(typeof o!="string"||o.length===0)continue;let i=o.split(/[/\\]/).filter(Boolean).map(s=>s.toLowerCase());if(i.length===1&&i[0]&&!i[0].includes("*")){n.push({literals:[i[0],null]});continue}if(!i.some(s=>s==="**"||s.includes("*")&&s!=="*")&&i.includes("*")){if(r){let s=-1;for(let d=0;d<i.length;d+=1)i[d]!=="*"&&(s=d);if(s<0)continue;let l=i.filter((d,f)=>f>=s||d==="*").map(d=>d==="*"?null:d),c=i.slice(s).map(d=>d==="*"?null:d);n.push(c.length===l.length?{literals:l}:{literals:l,legacy:c});continue}n.push({literals:i.map(s=>s==="*"?null:s)})}}return n}a(br,"universeShapes");function de(t,e){return t.literals.length!==e.length?!1:t.literals.every((n,r)=>n===null||n===e[r])}a(de,"shapeMatches");function Ar(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0||n.split("/").some(i=>i.length===0||i==="."||i==="..")||n.includes("*")||!n.includes("/"))return M;let r=n.split("/").map(i=>i.toLowerCase());if(e.length===0||e.some(i=>de(i,r)))return M;if(e.some(i=>de(i,r.slice(0,-1))))return null;let o=new Set(e.filter(i=>i.legacy!==void 0&&!de({literals:i.legacy},r)&&de({literals:i.legacy},r.slice(0,-1))).map(i=>i.literals.map(s=>s??"*").join("/")));return o.size===1?null:o.size>1?fr:M}a(Ar,"aliasTargetIssue");function jt(t){let e=t[0];return(e==="src"||e==="app")&&t.length>1?[t,t.slice(1)]:[t]}a(jt,"aliasGlobVariants");function kr(t,e){let n=jt(t),r=jt(e);for(let o of n)if(x(o,e,0,0,new Map))return!0;for(let o of r)if(x(t,o,0,0,new Map))return!0;return!1}a(kr,"aliasesCanMatchSameFile");function x(t,e,n,r,o){let i=`${n}:${r}`,s=o.get(i);if(s!==void 0)return s;let l=!1;if(n===t.length&&r===e.length)l=!0;else if(n<t.length&&t[n]==="**")l=x(t,e,n+1,r,o)||r<e.length&&x(t,e,n,r+1,o);else if(r<e.length&&e[r]==="**")l=x(t,e,n,r+1,o)||n<t.length&&x(t,e,n+1,r,o);else if(n<t.length&&r<e.length){let c=t[n],d=e[r];(c===d||c==="*"||d==="*")&&(l=x(t,e,n+1,r+1,o))}return o.set(i,l),l}a(x,"globsCanMatchSame");var Gt="must be a filename with exactly one <Layer> token and no slash or wildcard (arkrules.<Layer>.json)";function Er(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.arkRulesFile===void 0)return;let s=`$.rules[${o}].childSlices.arkRulesFile`,l=i.arkRulesFile;if(typeof l!="string"||l.length===0){e.push({path:s,message:Gt});return}(l.split("<Layer>").length!==2||/[*\\/]/.test(l)||l.includes(".."))&&e.push({path:s,message:Gt})})}a(Er,"validateChildSliceArkRulesFile");function Rr(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.sliceAliases===void 0)return;let s=i.sliceAliases,l=`$.rules[${o}].childSlices.sliceAliases`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } slice aliases"});return}let c=br(r.sliceFolders,r.sliceIdentity),d=[...Array.isArray(r.sliceFolders)?r.sliceFolders:[],...Array.isArray(i.sliceFolders)?i.sliceFolders:[]].filter(p=>typeof p=="string"&&p.length>0),f=[];s.forEach((p,m)=>{let h=`${l}[${m}]`;if(!I(p)){e.push({path:h,message:"must be an object with from and to"});return}for(let y of Object.keys(p))y!=="from"&&y!=="to"&&y!=="pinned"&&y!=="reason"&&e.push({path:fe(h,y),message:"unknown field"});let S=p.from,u=p.to;if(typeof S!="string"||S.trim().length===0)e.push({path:`${h}.from`,message:"must be a non-empty path glob"});else{let y=vr(S);if(y)e.push({path:`${h}.from`,message:y});else{let g=hr(mr(S));d.some(v=>Ir(g,v))&&e.push({path:`${h}.from`,message:pr});for(let v of f)if(kr(v,g)){e.push({path:h,message:gr});break}f.push(g)}}if(typeof u!="string"||u.trim().length===0)e.push({path:`${h}.to`,message:M});else{let y=Ar(u,c);y&&e.push({path:`${h}.to`,message:y})}})})}a(Rr,"validateChildSliceAliases");function pe(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}a(pe,"isObject");function F(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}a(F,"propertyPath");function L(t){return t===null?"null":Array.isArray(t)?"array":typeof t}a(L,"valueType");function Pr(t,e){let n="#/$defs/";if(t.startsWith(n))return e.$defs[t.slice(n.length)]}a(Pr,"resolveSchemaRef");function _(t,e,n,r,o){if(e.$ref){let i=Pr(e.$ref,r);if(!i){o.push({path:n,message:`schema reference ${e.$ref} cannot be resolved`});return}_(t,i,n,r,o);return}if(e.const!==void 0&&!Object.is(t,e.const)){o.push({path:n,message:`must equal ${JSON.stringify(e.const)}`});return}if(e.enum&&!e.enum.some(i=>Object.is(i,t))){o.push({path:n,message:`must be one of ${e.enum.map(String).join(", ")}`});return}if(e.type==="object"){if(!pe(t)){o.push({path:n,message:`must be an object; received ${L(t)}`});return}let i=e.properties??{};for(let s of e.required??[])t[s]===void 0&&o.push({path:F(n,s),message:"is required"});if(e.additionalProperties===!1)for(let s of Object.keys(t))s in i||o.push({path:F(n,s),message:"unknown field"});else if(e.additionalProperties!==void 0&&e.additionalProperties!==!0&&typeof e.additionalProperties=="object"){let s=e.additionalProperties;for(let l of Object.keys(t))l in i||_(t[l],s,F(n,l),r,o)}for(let[s,l]of Object.entries(i))t[s]!==void 0&&_(t[s],l,F(n,s),r,o);return}if(e.type==="array"){if(!Array.isArray(t)){o.push({path:n,message:`must be an array; received ${L(t)}`});return}if(e.minItems!==void 0&&t.length<e.minItems&&o.push({path:n,message:`must contain at least ${e.minItems} item(s)`}),e.uniqueItems){let i=t.map(s=>JSON.stringify(s));new Set(i).size!==i.length&&o.push({path:n,message:"must not contain duplicate items"})}e.items&&t.forEach((i,s)=>_(i,e.items,`${n}[${s}]`,r,o));return}if(e.type==="string"){if(typeof t!="string"){o.push({path:n,message:`must be a string; received ${L(t)}`});return}e.minLength!==void 0&&t.length<e.minLength&&o.push({path:n,message:`must contain at least ${e.minLength} character(s)`});return}if(e.type==="boolean"){typeof t!="boolean"&&o.push({path:n,message:`must be a boolean; received ${L(t)}`});return}if(e.type==="integer"){if(!Number.isInteger(t)){o.push({path:n,message:`must be an integer; received ${L(t)}`});return}e.minimum!==void 0&&t<e.minimum&&o.push({path:n,message:`must be at least ${e.minimum}`})}}a(_,"validateSchemaNode");function ge(t){if(typeof t!="string")return null;let e=t.trim().replace(/^@/,"").toLowerCase();return e.length>0?e:null}a(ge,"normalizeStewardId");function qt(t){let e=ge(t);return!e||Oe(e)||e.includes(" ")||e.includes("@")?!1:/^(?!-)[a-z0-9-]{1,39}(?<!-)$/.test(e)}a(qt,"isGitHubHandle");function Cr(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();if(!e.includes("@")||e.includes(" ")||Oe(e))return!1;let n=e.split("@");if(n.length!==2||!n[0]||/\s/.test(e))return!1;let r=n[1].lastIndexOf(".");return r>0&&r<n[1].length-1}a(Cr,"isGitHubEmail");function xr(t){if(typeof t!="string")return null;let e=t.trim().match(/^(?:\d+\+)?([^@]+)@users\.noreply\.github\.com$/i);return e&&qt(e[1])?ge(e[1]):null}a(xr,"githubHandleFromEmail");function zt(t){let e=xr(t);if(e)return e;let n=ge(t);return!n||Oe(n)?null:qt(n)||Cr(n)?n:null}a(zt,"canonicalStewardId");var Lr=/bot\b|\[bot\]|dependabot|renovate|github-actions|imgbot|codecov/i;function Oe(t){let e=ge(t);return!e||Lr.test(e)}a(Oe,"isAutomationAuthor");var A="1.3",Or=["public","auth","admin","internal"];function $r(t){return t?.optional===!0||t?.reserved===!0||t?.allowEmpty===!0}a($r,"isFutureHouseLayer");function Dr(t){let e=t&&typeof t=="object"?t.owners:void 0;if(!Array.isArray(e)||e.length===0)return;let n=e.filter(r=>typeof r=="string"&&r.length>0);return n.length>0?n:void 0}a(Dr,"layerOwnersList");function yi(t){return t?.requireLayerOwners!==!0||!Array.isArray(t.layers)?[]:t.layers.filter(e=>!$r(e)&&!Dr(e)).map(e=>e.name)}a(yi,"layersMissingRequiredOwners");function Si(t){return`Add a GitHub handle or email to ${t}'s owners in ark.config.json (/ark-adopt).`}a(Si,"missingLayerOwnersNextAction");var me="https://unpkg.com/arkgate@4/schemas/ark.config.schema.json",Jt=["DomainModel","ApplicationOrchestration","PersistenceAdapters","IntegrationAdapters","WorkflowSagaEngine","BackgroundJobsScheduling","PresentationAdapters","ReportingReadModels","ExtensibilityMetadata","SecurityAuditObservability","Kernel"],Nr=new Set(["PresentationAdapters->ApplicationOrchestration","ApplicationOrchestration->DomainModel","WorkflowSagaEngine->ApplicationOrchestration","WorkflowSagaEngine->DomainModel","BackgroundJobsScheduling->ApplicationOrchestration"]);function Tr(){let t=[];for(let e of Jt)for(let n of Jt)e===n||Nr.has(`${e}->${n}`)||t.push({from:e,to:n,allowed:!1});return t}a(Tr,"createDefaultRules");var he=Tr(),$e=[{from:"unversioned",to:"1.0"},{from:"1.0",to:"1.1"},{from:"1.1",to:"1.2"},{from:"1.2",to:"1.3"}],b={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Yt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:me,title:"ArkGate architecture contract",description:"Versioned contract consumed identically by ArkGate CLI, MCP, and ESLint surfaces.",type:"object",additionalProperties:!1,required:["$schema","schemaVersion","include","layers","rules"],properties:{$schema:{type:"string",minLength:1,default:me,description:"Editor-facing URL or local path for this JSON Schema."},schemaVersion:{type:"string",const:A,default:A},name:{type:"string",minLength:1},include:{...b,minItems:1,default:["src"]},exclude:{...b,default:[]},excludeGenerated:{type:"boolean",default:!0},frameworkOverlay:{type:"string",minLength:1},layers:{type:"array",default:[],items:{$ref:"#/$defs/layer"}},rules:{type:"array",default:he,items:{$ref:"#/$defs/rule"}},cyclePolicy:{type:"string",enum:["strict","soft","framework-soft","off"],default:"strict"},dynamicImportAllowlist:{...b,default:[]},safety:{$ref:"#/$defs/safety",default:{maxTsSuppressions:0,maxAnyCasts:0,allowInMemory:!1,allowDisabledPeerIsolation:!1}},coverage:{$ref:"#/$defs/coverage"},arkRules:{type:"object",additionalProperties:{description:"A project-relative ArkRules path, or a list of paths merged into one catalog for this layer. A string keeps today's behaviour. An older build that types this value as a string rejects an array at config load.",oneOf:[{type:"string",minLength:1},{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",minLength:1}}]},default:{}},arkRun:{$ref:"#/$defs/arkRun"},arkOrder:{$ref:"#/$defs/arkOrder"},stewards:{...b,default:[]},requireLayerOwners:{type:"boolean"}},$defs:{layer:{type:"object",additionalProperties:!1,required:["name","patterns"],properties:{name:{type:"string",minLength:1},patterns:{...b,minItems:1},exclude:b,intentPrefixes:b,description:{type:"string",minLength:1},trustBoundary:{type:"string",enum:[...Or]},owners:{...b,minItems:1},forbiddenGlobals:b,capabilities:{type:"object",additionalProperties:!1,properties:{deny:{type:"array",uniqueItems:!0,items:{type:"string",enum:["network","filesystem","clock","randomness","environment","process","persistence"]}}}},pure:{type:"boolean"},mayImportInfrastructure:{type:"boolean"},optional:{type:"boolean"},reserved:{type:"boolean"},allowEmpty:{type:"boolean"}}},rule:{type:"object",additionalProperties:!1,required:["from","to","allowed"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},allowed:{type:"boolean"},message:{type:"string",minLength:1},peerIsolation:{type:"boolean"},sliceFolders:{...b,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"],description:"How a starred sliceFolders prefix is named. Absent and path keep today's ids (every literal and star binding). stars keeps the last literal plus every star binding (a star before the last literal is kept too), so parallel trees share one feature id. Bare names are unchanged."},sharedRoots:{...b,minItems:1},allowedCrossSlice:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}},sharedImportsSlice:Ht,childSlices:Kt}},safety:{type:"object",additionalProperties:!1,properties:{maxTsSuppressions:{type:"integer",minimum:0,default:0},maxAnyCasts:{type:"integer",minimum:0,default:0},allowInMemory:{type:"boolean",default:!1},allowDisabledPeerIsolation:{type:"boolean",default:!1}}},coverage:{type:"object",additionalProperties:!1,description:"Invariant coverage scan controls. testGlobs replaces the built-in test-name heuristic; maxFiles raises or lowers the evidence file budget and also bounds structural-hint preload for orchestration-only, thin-adapter, and writes-via-aggregate (default 400; there is no arkrules.hintBudget); coverageRoots declares where the project runs its tests, so a covering test found outside them is reported instead of silently certifying an invariant. When any invariant is enforced, missing coverageRoots fails closed.",properties:{testGlobs:{...b,minItems:1},maxFiles:{type:"integer",minimum:1,description:"Evidence file budget (default 400) and structural-hint preload cap for orchestration-only, thin-adapter, and writes-via-aggregate. Raise this when hinted/governed counts show truncated sensors. There is no separate arkrules.hintBudget."},coverageRoots:{...b,minItems:1}}},arkRun:xt,arkOrder:Lt}},R=class extends Error{static{a(this,"ArkConfigValidationError")}issues;source;constructor(e,n){super(`Invalid ArkGate config (${e}):
1
+ import{I as Le,N as At,P as ce,Q as kt,R as Et,T as Rt,V as Pt,a,e as St,f as wt,r as It,t as vt,x as bt}from"./chunk-SVSQVGFJ.js";var Ct="4.8.26";var C={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},xt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},compositionRoots:{...C,default:[]},kernelRoots:{...C},managedLayers:{...C,default:[]},requireDeclarations:{type:"boolean",default:!0},ignoreDirectNewForErrors:{type:"boolean",default:!0}}},Lt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},planeRoots:{...C,default:[]},managedLayers:{...C,default:[]},maxXiKeys:{type:"integer",minimum:1,default:7},xiKeys:{...C,default:[]},appliesTo:{...C,default:[]}}};function z(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}a(z,"isObject");function er(t){let e=new Set;if(!Array.isArray(t.layers))return e;for(let n of t.layers)z(n)&&typeof n.name=="string"&&n.name.length>0&&e.add(n.name);return e}a(er,"declaredLayerNames");function Ot(t){if(!z(t))return t;let e={mode:t.mode===void 0?"advisory":t.mode,compositionRoots:t.compositionRoots===void 0?[]:t.compositionRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,requireDeclarations:t.requireDeclarations===void 0?!0:t.requireDeclarations};return t.kernelRoots!==void 0&&(e.kernelRoots=t.kernelRoots),t.ignoreDirectNewForErrors!==void 0&&(e.ignoreDirectNewForErrors=t.ignoreDirectNewForErrors),{...t,...e}}a(Ot,"defaultedArkRun");function $t(t){if(!z(t))return t;let e=typeof t.maxXiKeys=="number"&&t.maxXiKeys>0?t.maxXiKeys:7;return{...t,mode:t.mode===void 0?"advisory":t.mode,planeRoots:t.planeRoots===void 0?[]:t.planeRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,maxXiKeys:e,xiKeys:t.xiKeys===void 0?[]:t.xiKeys}}a($t,"defaultedArkOrder");function Dt(t,e,n,r){if(!Array.isArray(e))return;let o=er(t);e.forEach((i,s)=>{typeof i=="string"&&i.length>0&&!o.has(i)&&r.push({path:`$.${n}.managedLayers[${s}]`,message:`layer ${JSON.stringify(i)} is not declared in layers[]`})})}a(Dt,"validateManagedLayersDeclared");function Nt(t,e){let n=t.arkRun;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkRun",e),n.mode==="enforced"){let o=n.kernelRoots??n.compositionRoots;(!Array.isArray(o)||o.length===0)&&e.push({path:n.kernelRoots!==void 0?"$.arkRun.kernelRoots":"$.arkRun.compositionRoots",message:"ARKRUN_MISSING_ROOT: enforced mode requires at least one kernel root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkRun.managedLayers",message:"enforced mode requires at least one managed layer"})}}a(Nt,"validateArkRunExtra");function Tt(t,e){let n=t.arkOrder;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkOrder",e),n.mode==="enforced"){let o=n.planeRoots;(!Array.isArray(o)||o.length===0)&&e.push({path:"$.arkOrder.planeRoots",message:"ARKORDER_MISSING_PLANE: enforced mode requires at least one plane root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkOrder.managedLayers",message:"enforced mode requires at least one managed layer"})}}a(Tt,"validateArkOrderExtra");var ue={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Ht={description:'deny blocks every shared-root import of a slice. deny-cross-parent leaves that hop as a warning and, in ark-check and CI only, reports a slice that reaches another universe through a shared root. The write hook and ESLint see one edge and do not block it. The object form { mode: "deny-cross-parent", stopAt } names composition roots (bootstrap, DI registrations) the whole-graph walk never starts at or passes through; a stop file must still sit under sharedRoots, and stopAt does not silence the direct SHARED_IMPORTS_SLICE warning. arkgate 4.8.22 and older reject deny-cross-parent. arkgate 4.8.23 and older reject the object form (must be one of deny, deny-cross-parent).',oneOf:[{type:"string",enum:["deny","deny-cross-parent"]},{type:"object",additionalProperties:!1,required:["mode","stopAt"],properties:{mode:{type:"string",enum:["deny-cross-parent"]},stopAt:{...ue,minItems:1}}}]},Kt={type:"object",additionalProperties:!1,required:["sliceFolders"],description:`Optional inner wall under this rule. Runs only on a rule with peerIsolation: true and allowed: false; elsewhere it is inert and ark-check warns CONFIG_CHILD_SLICES_INERT (config load still accepts it, as 4.8.23 did). Absent keeps today's universe wall. sliceFolders names children. Flat files are universe common, and so is a commonFolders directory directly under the universe (a folder of that name inside a child belongs to that child). siblings is "deny" (default), "advisory", or { default, enforce, ratchet }. parentMayImportChild defaults to false. message is the text for inner-wall findings. allowedCrossSlice may use a whole-segment *. It clears only a sibling crossing. Cross-parent has no advisory knob. arkgate 4.8.22 and older reject this key. A build that still rejects unknown childSlices fields rejects allowedCrossSlice at config load. A build that still types siblings as a string enum rejects the object at config load.`,properties:{sliceFolders:{...ue,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"]},commonFolders:{...ue,minItems:1},siblings:{description:'"deny" or "advisory", or { default, enforce, ratchet } so listed subtrees are errors while the default stays advisory. ratchet absent: a new advisory crossing fails only when the baseline in use already records an advisory crossing of this rule. ratchet true: any unrecorded advisory crossing fails when a baseline is in use. ratchet false: measure only, never fails. A string-enum build rejects the object at config load (must be one of deny, advisory). arkgate 4.8.23 and older reject ratchet (unknown field).',oneOf:[{type:"string",enum:["deny","advisory"]},{type:"object",additionalProperties:!1,required:["default"],properties:{default:{type:"string",enum:["deny","advisory"]},enforce:{...ue},ratchet:{type:"boolean"}}}]},parentMayImportChild:{type:"boolean"},message:{type:"string",minLength:1,description:"Text for inner-wall findings (CROSS_SIBLING_SLICE and universe common importing a child). The rule message stays the universe-wall text (CROSS_PARENT_SLICE and fail-closed denies). Absent: ArkGate default text, never the rule message. arkgate 4.8.23 and older reject this field (unknown field)."},arkRulesFile:{type:"string",minLength:1,description:"Filename read at each child slice root this wall already resolved. The only token is <Layer>, replaced with a declared layer name (arkrules.<Layer>.json). No slash and no wildcard. A discovered file that omits appliesTo is scoped to that slice directory. Explicit appliesTo outside the slice fails config load (ARKRULE_SCOPE_ESCAPES_SLICE). The effective id is <childId>#<localId>. A build that rejects unknown childSlices fields fails at config load (unknown field)."},sliceAliases:{type:"array",minItems:1,description:"Maps a source path glob onto a child slice id (universe id plus one child segment) so files outside the slice trees take that universe and child for both walls. A path without a wildcard also covers everything under it, as sharedRoots does. A bare name, a universe id alone, a target outside every universe shape, and a wildcard in to are rejected. Under stars identity a target written against the 4.8.23 stars id (star bindings before the last literal dropped, e.g. api/v1/x for modules/*/api/*) still loads when it maps to one universe shape, and ark-check warns CONFIG_SLICE_LEGACY_STARS_ID with the new id; it is rejected only when it maps to more than one shape. Config load checks only the shape; doctor reports a target universe no file belongs to. The glob may not overlap a slice folder, and two aliases may not match the same file. Doctor lists each unpinned alias as an owed move. pinned true lists the alias separately and does not count it as debt. reason is a doctor label and does not pin by itself. A build that rejects unknown childSlices fields fails at config load (unknown field). arkgate 4.8.22 and older reject childSlices.",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},pinned:{type:"boolean",description:"True when a framework forces the path to stay. The alias is not an owed move and does not clear other honesty debt."},reason:{type:"string",minLength:1,description:"Doctor label, such as framework-route. A label alone does not pin."}}}},allowedCrossSlice:{type:"array",minItems:1,description:"Directed child-slice allowances. * matches one whole path segment (features/projects/*). ** and a partial segment are rejected. A bare name is rejected. This list clears only CROSS_SIBLING_SLICE. It cannot clear CROSS_PARENT_SLICE or CROSS_PARENT_VIA_SHARED. The universe allowedCrossSlice still treats * as a literal. A build that rejects unknown childSlices fields fails at config load (unknown field).",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}}}};function I(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}a(I,"isObject");function fe(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}a(fe,"propertyPath");function P(t){let e=t.length;for(;e>0&&t[e-1]==="/";)e-=1;return t.slice(0,e)}a(P,"trimTrailingSlashes");function Vt(t,e){ir(t,e),ar(t,e),ur(t,e),Rr(t,e),Er(t,e)}a(Vt,"validateSliceContract");var Mt='must be "deny", "deny-cross-parent", or { "mode": "deny-cross-parent", "stopAt": ["<composition root path or glob>"] }',Ft="must not cover the whole tree. Name the composition root itself (bootstrap file, DI registrations folder).";function tr(t){return t==="*"||t==="**"}a(tr,"isWildcardSegment");function Wt(t){let e=t.toLowerCase().split("/").filter(o=>o.length>0&&o!==".");(e[0]==="src"||e[0]==="app")&&(e=e.slice(1));let n=e.length;for(;n>0&&tr(e[n-1]??"");)n-=1;let r=e.slice(0,n);return r.some(o=>o.includes("*"))?null:r}a(Wt,"coveredFolder");function nr(t,e){return t.length<=e.length&&t.every((n,r)=>e[r]===n)}a(nr,"isPrefixOf");function rr(t,e){let n=t.layers;if(!Array.isArray(n))return[];let r=new Set([e.from,e.to].filter(i=>typeof i=="string")),o=[];for(let i of n){if(!I(i)||typeof i.name!="string"||!r.has(i.name))continue;let s=Array.isArray(i.patterns)?i.patterns:[];for(let l of s){if(typeof l!="string")continue;let c=l.replace(/\\/g,"/").split("/"),d=c.findIndex(m=>m.includes("*")),f=d===-1?c:c.slice(0,d),p=Wt(f.join("/"));p&&o.push(p)}}return o}a(rr,"ruleLayerFolders");function or(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0)return"must be a non-empty path or glob";let r=n.replace(/^[./]+/,"");if(r===""||r==="*"||r==="**")return Ft;for(let i of n.split("/"))if(i.length===0||i==="."||i==="..")return"must be a path or glob without empty, . or .. segments";let o=Wt(n);return o===null?null:o.length===0?Ft:e.some(i=>nr(o,i))?"must not cover a whole layer root of this rule. Name the composition root itself (bootstrap file, DI registrations folder).":null}a(or,"stopAtEntryIssue");function ir(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r)||r.sharedImportsSlice===void 0)return;let i=r.sharedImportsSlice,s=`$.rules[${o}].sharedImportsSlice`;if(typeof i=="string"){i!=="deny"&&i!=="deny-cross-parent"&&e.push({path:s,message:Mt});return}if(!I(i)){e.push({path:s,message:Mt});return}for(let f of Object.keys(i))f!=="mode"&&f!=="stopAt"&&e.push({path:fe(s,f),message:"unknown field"});i.mode===void 0?e.push({path:`${s}.mode`,message:"is required"}):i.mode!=="deny-cross-parent"&&e.push({path:`${s}.mode`,message:'must be deny-cross-parent. stopAt has no meaning for deny; use the string "deny".'});let l=i.stopAt;if(l===void 0){e.push({path:`${s}.stopAt`,message:"is required"});return}if(!Array.isArray(l)||l.length===0){e.push({path:`${s}.stopAt`,message:"must be a non-empty array of paths or globs"});return}let c=new Set,d=rr(t,r);l.forEach((f,p)=>{let m=`${s}.stopAt[${p}]`;if(typeof f!="string"){e.push({path:m,message:"must be a non-empty path or glob"});return}let h=or(f,d);if(h){e.push({path:m,message:h});return}let S=P(f.trim().replace(/\\/g,"/")).toLowerCase();if(c.has(S)){e.push({path:m,message:"duplicate stopAt entry"});return}c.add(S)})})}a(ir,"validateSharedImportsSlice");var sr=["deny","advisory"],_t='must be "deny", "advisory", or { "default": "deny" | "advisory", "enforce": ["<child id or subtree path>"], "ratchet": true | false }';function ar(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.siblings===void 0)return;let s=i.siblings,l=`$.rules[${o}].childSlices.siblings`;if(typeof s=="string"){sr.includes(s)||e.push({path:l,message:_t});return}if(!I(s)){e.push({path:l,message:_t});return}for(let d of Object.keys(s))d!=="default"&&d!=="enforce"&&d!=="ratchet"&&e.push({path:fe(l,d),message:"unknown field"});if(s.ratchet!==void 0&&typeof s.ratchet!="boolean"&&e.push({path:`${l}.ratchet`,message:"must be a boolean"}),s.default===void 0?e.push({path:`${l}.default`,message:"is required"}):s.default!=="deny"&&s.default!=="advisory"&&e.push({path:`${l}.default`,message:"must be deny or advisory"}),s.enforce===void 0)return;if(!Array.isArray(s.enforce)){e.push({path:`${l}.enforce`,message:"must be an array of child slice ids or subtree paths"});return}let c=new Set;s.enforce.forEach((d,f)=>{let p=`${l}.enforce[${f}]`;if(typeof d!="string"||d.trim().length===0){e.push({path:p,message:"must be a non-empty child slice id or subtree path"});return}let m=P(d.trim().replace(/\\/g,"/"));if(m.split("/").some(h=>h.length===0||h==="."||h==="..")){e.push({path:p,message:"must be a child slice id or subtree path without . or .."});return}if(m.includes("*")){e.push({path:p,message:"must be a child slice id or subtree path. * is not a wildcard on siblings.enforce"});return}if(c.has(m)){e.push({path:p,message:"duplicate enforce entry"});return}c.add(m)})})}a(ar,"validateChildSliceSiblings");var lr="must be a slice id with a slash. A bare name is ambiguous across universes.",cr="* matches one whole path segment. ** and a partial segment are not wildcards.";function dr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty slice id";if(!e.includes("/"))return lr;let n=e.split("/");for(let r of n){if(r.length===0||r==="."||r==="..")return"must be a slice id without empty, . or .. segments";if(r.includes("*")&&r!=="*")return cr}return null}a(dr,"childCrossSlicePatternIssue");function Bt(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase()}a(Bt,"childCrossSlicePatternKey");function ur(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.allowedCrossSlice===void 0)return;let s=i.allowedCrossSlice,l=`$.rules[${o}].childSlices.allowedCrossSlice`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } child slice ids"});return}let c=new Set;s.forEach((d,f)=>{let p=`${l}[${f}]`;if(!I(d)){e.push({path:p,message:"must be an object with from and to"});return}for(let h of Object.keys(d))h!=="from"&&h!=="to"&&e.push({path:fe(p,h),message:"unknown field"});for(let h of["from","to"]){let S=d[h],u=`${p}.${h}`;if(typeof S!="string"||S.trim().length===0){e.push({path:u,message:"must be a non-empty slice id"});continue}let y=dr(S);y&&e.push({path:u,message:y})}if(typeof d.from!="string"||typeof d.to!="string")return;let m=`${Bt(d.from)}\0${Bt(d.to)}`;if(!m.startsWith("\0")&&!m.endsWith("\0")){if(c.has(m)){e.push({path:p,message:"duplicate child slice allowance"});return}c.add(m)}})})}a(ur,"validateChildSliceAllowedCrossSlice");var M="must be a child of a universe shape this rule names (its universe sliceFolders shape plus one child segment). A bare name, a universe id alone, a target outside every universe shape, and a wildcard are rejected. Config load checks the shape only; doctor reports a target universe no file belongs to.",fr="is a 4.8.23 stars id (star bindings before the last literal dropped) that maps to more than one universe shape of this rule. Write the new stars id, which keeps every star binding (e.g. orders/api/v1/x for modules/*/api/*).",pr="overlaps a slice folder. An alias covers only files outside the slice trees.",gr="two slice aliases match the same file";function mr(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase().split("/").filter(e=>e.length>0)}a(mr,"aliasPathSegments");function hr(t){let e=t[t.length-1];return e===void 0||e.includes("*")?[...t]:[...t,"**"]}a(hr,"aliasSegmentsWithSubtree");function Ut(t){let e=[];for(let n of t){if(n.includes("*"))break;e.push(n)}return e}a(Ut,"concreteGlobPrefix");function J(t,e){if(t.length>e.length)return!1;for(let n=0;n<t.length;n+=1)if(t[n]!==e[n])return!1;return!0}a(J,"segmentsArePrefix");function yr(t){let e=t.split(/[/\\]/).filter(Boolean).map(r=>r.toLowerCase());if(e.length<2||e[0]==="*"||e[0]==="**"||!e.some(r=>r==="*"))return null;let n=[];for(let r of e){if(r==="*"||r==="**")break;if(r.includes("*"))return null;n.push(r)}return n.length>0?n:null}a(yr,"anchoredSlicePrefix");function Sr(t,e){let n=Ut(t),r=n.length<t.length,o=n[0]==="src"||n[0]==="app"?n.slice(1):n;return J(e,n)||J(e,o)?!0:r?J(n,e)&&n.length<e.length||J(n,["src",...e])&&n.length<e.length+1||J(n,["app",...e])&&n.length<e.length+1:!1}a(Sr,"globOverlapsAnchored");function wr(t,e){for(let r=0;r<t.length;r+=1){if(t[r]!==e&&t[r]!=="*")continue;let o=t.slice(r+1);if(o.length>=2||o.some(i=>i==="*"||i==="**"))return!0}let n=Ut(t);return n.length<t.length&&(n.length===0||n.length===1&&(n[0]==="src"||n[0]==="app"))}a(wr,"globOverlapsBare");function Ir(t,e){let n=e.split(/[/\\]/).filter(Boolean).map(o=>o.toLowerCase());if(n.length===1&&n[0]&&!n[0].includes("*"))return wr(t,n[0]);let r=yr(e);return r?Sr(t,r):!1}a(Ir,"globOverlapsSliceEntry");function vr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty path glob";if(e==="*"||e==="**")return"must not cover the whole tree";for(let n of e.split("/")){if(n.length===0||n==="."||n==="..")return"must be a path glob without empty, . or .. segments";if(!(n==="*"||n==="**")&&(n.includes("*")||n.includes("?")||n.includes("{")||n.includes("[")))return"* matches one whole path segment. ** is a whole segment. A partial segment is not a wildcard."}return null}a(vr,"aliasGlobIssue");function br(t,e){let n=[];if(!Array.isArray(t))return n;let r=e==="stars";for(let o of t){if(typeof o!="string"||o.length===0)continue;let i=o.split(/[/\\]/).filter(Boolean).map(s=>s.toLowerCase());if(i.length===1&&i[0]&&!i[0].includes("*")){n.push({literals:[i[0],null]});continue}if(!i.some(s=>s==="**"||s.includes("*")&&s!=="*")&&i.includes("*")){if(r){let s=-1;for(let d=0;d<i.length;d+=1)i[d]!=="*"&&(s=d);if(s<0)continue;let l=i.filter((d,f)=>f>=s||d==="*").map(d=>d==="*"?null:d),c=i.slice(s).map(d=>d==="*"?null:d);n.push(c.length===l.length?{literals:l}:{literals:l,legacy:c});continue}n.push({literals:i.map(s=>s==="*"?null:s)})}}return n}a(br,"universeShapes");function de(t,e){return t.literals.length!==e.length?!1:t.literals.every((n,r)=>n===null||n===e[r])}a(de,"shapeMatches");function Ar(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0||n.split("/").some(i=>i.length===0||i==="."||i==="..")||n.includes("*")||!n.includes("/"))return M;let r=n.split("/").map(i=>i.toLowerCase());if(e.length===0||e.some(i=>de(i,r)))return M;if(e.some(i=>de(i,r.slice(0,-1))))return null;let o=new Set(e.filter(i=>i.legacy!==void 0&&!de({literals:i.legacy},r)&&de({literals:i.legacy},r.slice(0,-1))).map(i=>i.literals.map(s=>s??"*").join("/")));return o.size===1?null:o.size>1?fr:M}a(Ar,"aliasTargetIssue");function jt(t){let e=t[0];return(e==="src"||e==="app")&&t.length>1?[t,t.slice(1)]:[t]}a(jt,"aliasGlobVariants");function kr(t,e){let n=jt(t),r=jt(e);for(let o of n)if(x(o,e,0,0,new Map))return!0;for(let o of r)if(x(t,o,0,0,new Map))return!0;return!1}a(kr,"aliasesCanMatchSameFile");function x(t,e,n,r,o){let i=`${n}:${r}`,s=o.get(i);if(s!==void 0)return s;let l=!1;if(n===t.length&&r===e.length)l=!0;else if(n<t.length&&t[n]==="**")l=x(t,e,n+1,r,o)||r<e.length&&x(t,e,n,r+1,o);else if(r<e.length&&e[r]==="**")l=x(t,e,n,r+1,o)||n<t.length&&x(t,e,n+1,r,o);else if(n<t.length&&r<e.length){let c=t[n],d=e[r];(c===d||c==="*"||d==="*")&&(l=x(t,e,n+1,r+1,o))}return o.set(i,l),l}a(x,"globsCanMatchSame");var Gt="must be a filename with exactly one <Layer> token and no slash or wildcard (arkrules.<Layer>.json)";function Er(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.arkRulesFile===void 0)return;let s=`$.rules[${o}].childSlices.arkRulesFile`,l=i.arkRulesFile;if(typeof l!="string"||l.length===0){e.push({path:s,message:Gt});return}(l.split("<Layer>").length!==2||/[*\\/]/.test(l)||l.includes(".."))&&e.push({path:s,message:Gt})})}a(Er,"validateChildSliceArkRulesFile");function Rr(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.sliceAliases===void 0)return;let s=i.sliceAliases,l=`$.rules[${o}].childSlices.sliceAliases`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } slice aliases"});return}let c=br(r.sliceFolders,r.sliceIdentity),d=[...Array.isArray(r.sliceFolders)?r.sliceFolders:[],...Array.isArray(i.sliceFolders)?i.sliceFolders:[]].filter(p=>typeof p=="string"&&p.length>0),f=[];s.forEach((p,m)=>{let h=`${l}[${m}]`;if(!I(p)){e.push({path:h,message:"must be an object with from and to"});return}for(let y of Object.keys(p))y!=="from"&&y!=="to"&&y!=="pinned"&&y!=="reason"&&e.push({path:fe(h,y),message:"unknown field"});let S=p.from,u=p.to;if(typeof S!="string"||S.trim().length===0)e.push({path:`${h}.from`,message:"must be a non-empty path glob"});else{let y=vr(S);if(y)e.push({path:`${h}.from`,message:y});else{let g=hr(mr(S));d.some(v=>Ir(g,v))&&e.push({path:`${h}.from`,message:pr});for(let v of f)if(kr(v,g)){e.push({path:h,message:gr});break}f.push(g)}}if(typeof u!="string"||u.trim().length===0)e.push({path:`${h}.to`,message:M});else{let y=Ar(u,c);y&&e.push({path:`${h}.to`,message:y})}})})}a(Rr,"validateChildSliceAliases");function pe(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}a(pe,"isObject");function F(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}a(F,"propertyPath");function L(t){return t===null?"null":Array.isArray(t)?"array":typeof t}a(L,"valueType");function Pr(t,e){let n="#/$defs/";if(t.startsWith(n))return e.$defs[t.slice(n.length)]}a(Pr,"resolveSchemaRef");function _(t,e,n,r,o){if(e.$ref){let i=Pr(e.$ref,r);if(!i){o.push({path:n,message:`schema reference ${e.$ref} cannot be resolved`});return}_(t,i,n,r,o);return}if(e.const!==void 0&&!Object.is(t,e.const)){o.push({path:n,message:`must equal ${JSON.stringify(e.const)}`});return}if(e.enum&&!e.enum.some(i=>Object.is(i,t))){o.push({path:n,message:`must be one of ${e.enum.map(String).join(", ")}`});return}if(e.type==="object"){if(!pe(t)){o.push({path:n,message:`must be an object; received ${L(t)}`});return}let i=e.properties??{};for(let s of e.required??[])t[s]===void 0&&o.push({path:F(n,s),message:"is required"});if(e.additionalProperties===!1)for(let s of Object.keys(t))s in i||o.push({path:F(n,s),message:"unknown field"});else if(e.additionalProperties!==void 0&&e.additionalProperties!==!0&&typeof e.additionalProperties=="object"){let s=e.additionalProperties;for(let l of Object.keys(t))l in i||_(t[l],s,F(n,l),r,o)}for(let[s,l]of Object.entries(i))t[s]!==void 0&&_(t[s],l,F(n,s),r,o);return}if(e.type==="array"){if(!Array.isArray(t)){o.push({path:n,message:`must be an array; received ${L(t)}`});return}if(e.minItems!==void 0&&t.length<e.minItems&&o.push({path:n,message:`must contain at least ${e.minItems} item(s)`}),e.uniqueItems){let i=t.map(s=>JSON.stringify(s));new Set(i).size!==i.length&&o.push({path:n,message:"must not contain duplicate items"})}e.items&&t.forEach((i,s)=>_(i,e.items,`${n}[${s}]`,r,o));return}if(e.type==="string"){if(typeof t!="string"){o.push({path:n,message:`must be a string; received ${L(t)}`});return}e.minLength!==void 0&&t.length<e.minLength&&o.push({path:n,message:`must contain at least ${e.minLength} character(s)`});return}if(e.type==="boolean"){typeof t!="boolean"&&o.push({path:n,message:`must be a boolean; received ${L(t)}`});return}if(e.type==="integer"){if(!Number.isInteger(t)){o.push({path:n,message:`must be an integer; received ${L(t)}`});return}e.minimum!==void 0&&t<e.minimum&&o.push({path:n,message:`must be at least ${e.minimum}`})}}a(_,"validateSchemaNode");function ge(t){if(typeof t!="string")return null;let e=t.trim().replace(/^@/,"").toLowerCase();return e.length>0?e:null}a(ge,"normalizeStewardId");function qt(t){let e=ge(t);return!e||Oe(e)||e.includes(" ")||e.includes("@")?!1:/^(?!-)[a-z0-9-]{1,39}(?<!-)$/.test(e)}a(qt,"isGitHubHandle");function Cr(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();if(!e.includes("@")||e.includes(" ")||Oe(e))return!1;let n=e.split("@");if(n.length!==2||!n[0]||/\s/.test(e))return!1;let r=n[1].lastIndexOf(".");return r>0&&r<n[1].length-1}a(Cr,"isGitHubEmail");function xr(t){if(typeof t!="string")return null;let e=t.trim().match(/^(?:\d+\+)?([^@]+)@users\.noreply\.github\.com$/i);return e&&qt(e[1])?ge(e[1]):null}a(xr,"githubHandleFromEmail");function zt(t){let e=xr(t);if(e)return e;let n=ge(t);return!n||Oe(n)?null:qt(n)||Cr(n)?n:null}a(zt,"canonicalStewardId");var Lr=/bot\b|\[bot\]|dependabot|renovate|github-actions|imgbot|codecov/i;function Oe(t){let e=ge(t);return!e||Lr.test(e)}a(Oe,"isAutomationAuthor");var A="1.3",Or=["public","auth","admin","internal"];function $r(t){return t?.optional===!0||t?.reserved===!0||t?.allowEmpty===!0}a($r,"isFutureHouseLayer");function Dr(t){let e=t&&typeof t=="object"?t.owners:void 0;if(!Array.isArray(e)||e.length===0)return;let n=e.filter(r=>typeof r=="string"&&r.length>0);return n.length>0?n:void 0}a(Dr,"layerOwnersList");function yi(t){return t?.requireLayerOwners!==!0||!Array.isArray(t.layers)?[]:t.layers.filter(e=>!$r(e)&&!Dr(e)).map(e=>e.name)}a(yi,"layersMissingRequiredOwners");function Si(t){return`Add a GitHub handle or email to ${t}'s owners in ark.config.json (/ark-adopt).`}a(Si,"missingLayerOwnersNextAction");var me="https://unpkg.com/arkgate@4/schemas/ark.config.schema.json",Jt=["DomainModel","ApplicationOrchestration","PersistenceAdapters","IntegrationAdapters","WorkflowSagaEngine","BackgroundJobsScheduling","PresentationAdapters","ReportingReadModels","ExtensibilityMetadata","SecurityAuditObservability","Kernel"],Nr=new Set(["PresentationAdapters->ApplicationOrchestration","ApplicationOrchestration->DomainModel","WorkflowSagaEngine->ApplicationOrchestration","WorkflowSagaEngine->DomainModel","BackgroundJobsScheduling->ApplicationOrchestration"]);function Tr(){let t=[];for(let e of Jt)for(let n of Jt)e===n||Nr.has(`${e}->${n}`)||t.push({from:e,to:n,allowed:!1});return t}a(Tr,"createDefaultRules");var he=Tr(),$e=[{from:"unversioned",to:"1.0"},{from:"1.0",to:"1.1"},{from:"1.1",to:"1.2"},{from:"1.2",to:"1.3"}],b={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Yt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:me,title:"ArkGate architecture contract",description:"Versioned contract consumed identically by ArkGate CLI, MCP, and ESLint surfaces.",type:"object",additionalProperties:!1,required:["$schema","schemaVersion","include","layers","rules"],properties:{$schema:{type:"string",minLength:1,default:me,description:"Editor-facing URL or local path for this JSON Schema."},schemaVersion:{type:"string",const:A,default:A},name:{type:"string",minLength:1},include:{...b,minItems:1,default:["src"]},exclude:{...b,default:[]},excludeGenerated:{type:"boolean",default:!0},frameworkOverlay:{type:"string",minLength:1},layers:{type:"array",default:[],items:{$ref:"#/$defs/layer"}},rules:{type:"array",default:he,items:{$ref:"#/$defs/rule"}},cyclePolicy:{type:"string",enum:["strict","soft","framework-soft","off"],default:"strict"},dynamicImportAllowlist:{...b,default:[]},safety:{$ref:"#/$defs/safety",default:{maxTsSuppressions:0,maxAnyCasts:0,allowInMemory:!1,allowDisabledPeerIsolation:!1}},coverage:{$ref:"#/$defs/coverage"},arkRules:{type:"object",additionalProperties:{description:"A project-relative ArkRules path, or a list of paths merged into one catalog for this layer. A string keeps today's behaviour. An older build that types this value as a string rejects an array at config load.",oneOf:[{type:"string",minLength:1},{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",minLength:1}}]},default:{}},arkRun:{$ref:"#/$defs/arkRun"},arkOrder:{$ref:"#/$defs/arkOrder"},stewards:{...b,default:[]},requireLayerOwners:{type:"boolean"}},$defs:{layer:{type:"object",additionalProperties:!1,required:["name","patterns"],properties:{name:{type:"string",minLength:1},patterns:{...b,minItems:1},exclude:b,intentPrefixes:b,description:{type:"string",minLength:1},trustBoundary:{type:"string",enum:[...Or]},owners:{...b,minItems:1},forbiddenGlobals:b,capabilities:{type:"object",additionalProperties:!1,properties:{deny:{type:"array",uniqueItems:!0,items:{type:"string",enum:["network","filesystem","clock","randomness","environment","process","persistence"]}}}},pure:{type:"boolean"},mayImportInfrastructure:{type:"boolean"},optional:{type:"boolean"},reserved:{type:"boolean"},allowEmpty:{type:"boolean"}}},rule:{type:"object",additionalProperties:!1,required:["from","to","allowed"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},allowed:{type:"boolean"},message:{type:"string",minLength:1},peerIsolation:{type:"boolean"},sliceFolders:{...b,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"],description:"How a starred sliceFolders prefix is named. Absent and path keep today's ids (every literal and star binding). stars keeps the last literal plus every star binding (a star before the last literal is kept too), so parallel trees share one feature id. Bare names are unchanged."},sharedRoots:{...b,minItems:1},allowedCrossSlice:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}},sharedImportsSlice:Ht,childSlices:Kt}},safety:{type:"object",additionalProperties:!1,properties:{maxTsSuppressions:{type:"integer",minimum:0,default:0},maxAnyCasts:{type:"integer",minimum:0,default:0},allowInMemory:{type:"boolean",default:!1},allowDisabledPeerIsolation:{type:"boolean",default:!1}}},coverage:{type:"object",additionalProperties:!1,description:"Invariant coverage scan controls. testGlobs replaces the built-in test-name heuristic; maxFiles raises or lowers the evidence file budget and also bounds structural-hint preload for orchestration-only, thin-adapter, and writes-via-aggregate (default 400; there is no arkrules.hintBudget); coverageRoots declares where the project runs its tests, so a covering test found outside them is reported instead of silently certifying an invariant. When any invariant is enforced, missing coverageRoots fails closed.",properties:{testGlobs:{...b,minItems:1},maxFiles:{type:"integer",minimum:1,description:"Evidence file budget (default 400) and structural-hint preload cap for orchestration-only, thin-adapter, and writes-via-aggregate. Raise this when hinted/governed counts show truncated sensors. There is no separate arkrules.hintBudget."},coverageRoots:{...b,minItems:1}}},arkRun:xt,arkOrder:Lt}},R=class extends Error{static{a(this,"ArkConfigValidationError")}issues;source;constructor(e,n){super(`Invalid ArkGate config (${e}):
2
2
  ${n.map(r=>`- ${r.path}: ${r.message}`).join(`
3
3
  `)}`),this.name="ArkConfigValidationError",this.source=e,this.issues=n}};function Mr(t,e){let n=t.arkRules;if(!(n===void 0||!pe(n)))for(let[r,o]of Object.entries(n)){let i=F("$.arkRules",r);if(typeof o=="string"){o.length===0&&e.push({path:i,message:"must be a non-empty relative path string"});continue}if(!Array.isArray(o)||o.length===0){e.push({path:i,message:"must be a non-empty path string or an array of paths"});continue}let s=new Set;o.forEach((l,c)=>{let d=`${i}[${c}]`;if(typeof l!="string"||l.length===0){e.push({path:d,message:"must be a non-empty relative path string"});return}s.has(l)&&e.push({path:d,message:"duplicate path"}),s.add(l)})}}a(Mr,"validateArkRulesRefs");function Fr(t,e){let n=t.layers;Array.isArray(n)&&n.forEach((r,o)=>{if(!r||typeof r!="object"||Array.isArray(r)||!("owners"in r))return;let i=r.owners;Array.isArray(i)&&i.forEach((s,l)=>{typeof s=="string"&&(zt(s)||e.push({path:`$.layers[${o}].owners[${l}]`,message:"must be a GitHub handle or email (not a display name)"}))})})}a(Fr,"validateLayerOwners");function _r(t){let e={...t,$schema:t.$schema===void 0?me:t.$schema,schemaVersion:t.schemaVersion===void 0?A:t.schemaVersion,include:t.include===void 0?["src"]:t.include,layers:t.layers===void 0?[]:t.layers,rules:t.rules===void 0?he.map(n=>({...n})):t.rules};return t.arkRun!==void 0&&(e.arkRun=Ot(t.arkRun)),t.arkOrder!==void 0&&(e.arkOrder=$t(t.arkOrder)),e}a(_r,"defaultedConfig");function Br(t){return t===A?null:t==="unversioned"?"unversioned":t==="1.0"||t==="1.1"||t==="1.2"?t:null}a(Br,"migratedFromOf");function jr(){let t=new Set([A]);for(let e of $e)e.from!=="unversioned"&&t.add(e.from),t.add(e.to);return t}a(jr,"knownInputVersions");function Gr(t,e="ark.config.json"){if(!pe(t))throw new R(e,[{path:"$",message:`must be an object; received ${L(t)}`}]);let n=jr(),r=t.schemaVersion===void 0?"unversioned":typeof t.schemaVersion=="string"?t.schemaVersion:null;if(r===null)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(t.schemaVersion)}; expected ${A}`}]);if(r!=="unversioned"&&!n.has(r))throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(r)}; expected ${A}`}]);let o=r,i={...t},s=0;for(;o!==A&&s<$e.length+1;){s+=1;let l=$e.find(c=>c.from===o);if(!l)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(o)}; expected ${A}`}]);o=l.to,i.schemaVersion=o}if(o!==A)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(r)}; expected ${A}`}]);return{candidate:_r(i),migratedFrom:Br(r)}}a(Gr,"migrateArkConfig");function Hr(t,e="ark.config.json"){let{candidate:n,migratedFrom:r}=Gr(t,e),o=[];if(_(n,Yt,"$",Yt,o),Nt(n,o),Tt(n,o),Fr(n,o),Vt(n,o),Mr(n,o),o.length>0)throw new R(e,o);return{config:n,migratedFrom:r}}a(Hr,"loadArkConfigContract");function wi(t,e="ark.config.json"){let n;try{n=JSON.parse(t)}catch(r){throw new R(e,[{path:"$",message:`invalid JSON: ${r instanceof Error?r.message:String(r)}`}])}return Hr(n,e)}a(wi,"parseArkConfigJson");function Xt(t){let e={$schema:typeof t.$schema=="string"&&t.$schema.length>0?t.$schema:me,schemaVersion:A};for(let[n,r]of Object.entries(t))n!=="$schema"&&n!=="schemaVersion"&&(e[n]=r);return e}a(Xt,"withArkConfigMetadata");var Zt={RAW_EVENT_PUBLISH:"Publish through a registered intent creator; raw event objects or intent strings bypass Ark contracts and tooling.",PUBLISH_MISSING_SOURCE:"Strict Ark publish calls must include metadata.source."},Kr=Object.freeze([{layer:"DomainModel",prefixes:["Domain."]},{layer:"ApplicationOrchestration",prefixes:["Application."]},{layer:"PersistenceAdapters",prefixes:["Adapter.Persistence.","Adapter.Repository."]},{layer:"IntegrationAdapters",prefixes:["Adapter.Integration.","Adapter.External."]},{layer:"WorkflowSagaEngine",prefixes:["Workflow."]},{layer:"BackgroundJobsScheduling",prefixes:["Job."]},{layer:"PresentationAdapters",prefixes:["Presentation.","Adapter.Presentation.","Adapter.Api."]},{layer:"ReportingReadModels",prefixes:["Reporting."]},{layer:"ExtensibilityMetadata",prefixes:["Metadata."]},{layer:"SecurityAuditObservability",prefixes:["Security.","Audit.","Observability."]},{layer:"Kernel",prefixes:["Kernel."]}]);function De(t){let e=(t.intentPrefixes??[]).filter(n=>n.trim().length>0);return e.length>0?e:Kr.find(n=>n.layer===t.name)?.prefixes??[]}a(De,"effectiveIntentPrefixes");function Qt(t){let e=new Set(t.layers.filter(r=>De(r).length>0).map(r=>r.name)),n=new Set;for(let r of t.rules??[])if(!(r.allowed!==!1||r.peerIsolation===!0))for(let o of[r.from,r.to])e.has(o)||n.add(o);return[...n].sort()}a(Qt,"unresolvableLayerFlowLayers");function bi(t,e){return e.flatMap((r,o)=>(r.prefixes??r.intentPrefixes??[]).map(i=>({layer:r.name,layerIndex:o,prefix:i.endsWith(".")?i:`${i}.`}))).filter(({prefix:r})=>t.startsWith(r)).sort((r,o)=>o.prefix.length-r.prefix.length||r.layerIndex-o.layerIndex)[0]?.layer}a(bi,"resolveIntentLayer");function Vr(t){return/^(Domain|Application|Adapter|Workflow|Job|Presentation|Reporting|Metadata|Security|Audit|Observability|Kernel)\.[A-Za-z0-9_.]+$/.test(t)}a(Vr,"looksLikeArkIntent");function Ai(t){if(!t.publishCall)return[];let e=[];return(t.rawIntentName!==void 0&&Vr(t.rawIntentName)||t.objectHasIntent)&&e.push({ruleId:"RAW_EVENT_PUBLISH",message:Zt.RAW_EVENT_PUBLISH}),t.arkPublishCandidate&&!t.hasSource&&e.push({ruleId:"PUBLISH_MISSING_SOURCE",message:Zt.PUBLISH_MISSING_SOURCE}),e}a(Ai,"classifyPublishFacts");function Wr(t){return t.endsWith(".")?t:`${t}.`}a(Wr,"normalizePrefix");function Ur(t,e){let n=t.prefixes.length?Math.max(...t.prefixes.map(o=>o.length)):0;return(e.prefixes.length?Math.max(...e.prefixes.map(o=>o.length)):0)-n}a(Ur,"byLongestPrefix");function Ne(t){let e=t.layers.map(o=>({...o,prefixes:o.prefixes.map(Wr)})),n=[...e].sort(Ur),r=[...t.rules??[]];return{name:t.name,layers:e,rules:r,resolveLayer(o){return e.find(i=>i.match?.(o))?.name??n.find(i=>i.prefixes.some(s=>o.startsWith(s)))?.name}}}a(Ne,"createArchitectureProfile");function Te(t,e={}){return Ne({name:e.name??t.name??"ark.config.json",layers:t.layers.map((n,r)=>({name:n.name,prefixes:[...De(n)],description:n.description,trustBoundary:n.trustBoundary,owners:n.owners,order:r+1})),rules:t.rules??[]})}a(Te,"createArchitectureProfileFromArkConfig");var qr=[{name:"DomainModel",prefixes:["Domain"],description:"Rich domain model, business rules, and domain events.",order:1},{name:"ApplicationOrchestration",prefixes:["Application"],description:"Use cases and command orchestration.",order:2},{name:"PersistenceAdapters",prefixes:["Adapter.Persistence","Adapter.Repository"],description:"Database, repository, and storage adapters.",order:3},{name:"IntegrationAdapters",prefixes:["Adapter.Integration","Adapter.External"],description:"External systems, APIs, and integration adapters.",order:4},{name:"WorkflowSagaEngine",prefixes:["Workflow"],description:"Sagas, workflows, and long-running processes.",order:5},{name:"BackgroundJobsScheduling",prefixes:["Job"],description:"Background jobs, scheduled work, and async processors.",order:6},{name:"PresentationAdapters",prefixes:["Presentation","Adapter.Presentation","Adapter.Api"],description:"API, UI, controller, and presentation adapters.",order:7},{name:"ReportingReadModels",prefixes:["Reporting"],description:"Read models, projections, and reporting surfaces.",order:8},{name:"ExtensibilityMetadata",prefixes:["Metadata"],description:"Metadata, extensions, and schema contracts.",order:9},{name:"SecurityAuditObservability",prefixes:["Security","Audit","Observability"],description:"Security, audit, and observability concerns.",order:10},{name:"Kernel",prefixes:["Kernel"],description:"Ark-owned governance and kernel signals.",order:11}],Y=Ne({name:"Ark 11-layer Hexagonal Event-Driven Profile",layers:qr,rules:he.map(t=>({...t}))}),zr={DomainModel:["domain"],ApplicationOrchestration:["application","app"],PersistenceAdapters:["adapters/persistence","adapters/repository","repositories","infra/persistence"],IntegrationAdapters:["adapters/integration","adapters/external","integrations"],WorkflowSagaEngine:["workflows","sagas"],BackgroundJobsScheduling:["jobs","schedules"],PresentationAdapters:["presentation","adapters/presentation","adapters/api"],ReportingReadModels:["reporting","read-models","projections"],ExtensibilityMetadata:["metadata","extensions"],SecurityAuditObservability:["security","audit","observability"],Kernel:["kernel"]};function Jr(t={}){let e=t.rootDir??"src",n=t.optionalLayers??!0,r=e==="."?"":`${e}/`;return Xt({include:t.include??[e],layers:Y.layers.map(o=>({name:o.name,patterns:(zr[o.name]??[o.name]).map(i=>`${r}${i}/**`),intentPrefixes:o.prefixes,optional:n})),rules:[...Y.rules]})}a(Jr,"createElevenLayerArkConfig");var X=class{static{a(this,"IntentRegistry")}intents=new Map;dependencies=new Map;productions=new Map;define(e,n){if(this.intents.has(e))throw new Error(`Intent "${e}" is already registered. Intent names must be unique within a registry.`);let r=a(i=>({intent:e,payload:i,metadata:{occurredAt:new Date().toISOString(),source:"unknown"}}),"fn");Object.defineProperty(r,"name",{value:e,enumerable:!0,configurable:!1,writable:!1});let o=r;if(this.intents.set(e,o),n?.dependsOn)for(let i of n.dependsOn)this.declareDependency(e,i);if(n?.produces)for(let i of n.produces)this.declareProduction(e,i);return o}declareDependency(e,n){this.dependencies.has(e)||this.dependencies.set(e,new Set),this.dependencies.get(e).add(n)}declareProduction(e,n){this.productions.has(e)||this.productions.set(e,new Set),this.productions.get(e).add(n)}get(e){return this.intents.get(e)}list(){return Array.from(this.intents.values())}getDependencies(e){let n=this.dependencies.get(e);return n?Array.from(n):[]}getProductions(e){let n=this.productions.get(e);return n?Array.from(n):[]}getAllRelationships(){let e=[];for(let[n,r]of this.dependencies.entries())for(let o of r)e.push({from:n,to:o,kind:"dependsOn"});for(let[n,r]of this.productions.entries())for(let o of r)e.push({from:n,to:o,kind:"produces"});return e}has(e){return this.intents.has(e)}clear(){this.intents.clear(),this.dependencies.clear(),this.productions.clear()}};var en=new X;function Yr(t,e){return en.define(t,e)}a(Yr,"defineIntent");function Me(){return new X}a(Me,"createIntentRegistry");var Xr=en;var tn=["Domain.","Application.","Adapter.","Workflow.","Job.","Presentation.","Reporting.","Metadata.","Security.","Audit.","Observability.","Kernel."];function Fe(t){if(!t||typeof t!="string")return{valid:!1,reason:"Intent name must be a non-empty string"};if(!tn.some(n=>t.startsWith(n)))return{valid:!1,reason:`Intent "${t}" must start with one of: ${tn.join(", ")}`};let e=t.slice(t.indexOf(".")+1);return!e||!/^[A-Za-z][A-Za-z0-9_.]*$/.test(e)?{valid:!1,reason:`Intent "${t}" has an invalid segment after the layer prefix`}:{valid:!0}}a(Fe,"validateIntentName");var O=class extends Error{static{a(this,"PolicyViolationError")}violations;constructor(e){let n=e.map(r=>`- ${r.policyName}: ${r.message}`).join(`
4
4
  `);super(`Hard policy violation(s) detected:
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12;var _chunkA5EIY3HIcjs = require('./chunk-A5EIY3HI.cjs');var Ct="4.8.25";var C={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},xt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},compositionRoots:{...C,default:[]},kernelRoots:{...C},managedLayers:{...C,default:[]},requireDeclarations:{type:"boolean",default:!0},ignoreDirectNewForErrors:{type:"boolean",default:!0}}},Lt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},planeRoots:{...C,default:[]},managedLayers:{...C,default:[]},maxXiKeys:{type:"integer",minimum:1,default:7},xiKeys:{...C,default:[]},appliesTo:{...C,default:[]}}};function z(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, z,"isObject");function er(t){let e=new Set;if(!Array.isArray(t.layers))return e;for(let n of t.layers)z(n)&&typeof n.name=="string"&&n.name.length>0&&e.add(n.name);return e}_chunkA5EIY3HIcjs.a.call(void 0, er,"declaredLayerNames");function Ot(t){if(!z(t))return t;let e={mode:t.mode===void 0?"advisory":t.mode,compositionRoots:t.compositionRoots===void 0?[]:t.compositionRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,requireDeclarations:t.requireDeclarations===void 0?!0:t.requireDeclarations};return t.kernelRoots!==void 0&&(e.kernelRoots=t.kernelRoots),t.ignoreDirectNewForErrors!==void 0&&(e.ignoreDirectNewForErrors=t.ignoreDirectNewForErrors),{...t,...e}}_chunkA5EIY3HIcjs.a.call(void 0, Ot,"defaultedArkRun");function $t(t){if(!z(t))return t;let e=typeof t.maxXiKeys=="number"&&t.maxXiKeys>0?t.maxXiKeys:7;return{...t,mode:t.mode===void 0?"advisory":t.mode,planeRoots:t.planeRoots===void 0?[]:t.planeRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,maxXiKeys:e,xiKeys:t.xiKeys===void 0?[]:t.xiKeys}}_chunkA5EIY3HIcjs.a.call(void 0, $t,"defaultedArkOrder");function Dt(t,e,n,r){if(!Array.isArray(e))return;let o=er(t);e.forEach((i,s)=>{typeof i=="string"&&i.length>0&&!o.has(i)&&r.push({path:`$.${n}.managedLayers[${s}]`,message:`layer ${JSON.stringify(i)} is not declared in layers[]`})})}_chunkA5EIY3HIcjs.a.call(void 0, Dt,"validateManagedLayersDeclared");function Nt(t,e){let n=t.arkRun;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkRun",e),n.mode==="enforced"){let o=_nullishCoalesce(n.kernelRoots, () => (n.compositionRoots));(!Array.isArray(o)||o.length===0)&&e.push({path:n.kernelRoots!==void 0?"$.arkRun.kernelRoots":"$.arkRun.compositionRoots",message:"ARKRUN_MISSING_ROOT: enforced mode requires at least one kernel root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkRun.managedLayers",message:"enforced mode requires at least one managed layer"})}}_chunkA5EIY3HIcjs.a.call(void 0, Nt,"validateArkRunExtra");function Tt(t,e){let n=t.arkOrder;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkOrder",e),n.mode==="enforced"){let o=n.planeRoots;(!Array.isArray(o)||o.length===0)&&e.push({path:"$.arkOrder.planeRoots",message:"ARKORDER_MISSING_PLANE: enforced mode requires at least one plane root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkOrder.managedLayers",message:"enforced mode requires at least one managed layer"})}}_chunkA5EIY3HIcjs.a.call(void 0, Tt,"validateArkOrderExtra");var ue={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Ht={description:'deny blocks every shared-root import of a slice. deny-cross-parent leaves that hop as a warning and, in ark-check and CI only, reports a slice that reaches another universe through a shared root. The write hook and ESLint see one edge and do not block it. The object form { mode: "deny-cross-parent", stopAt } names composition roots (bootstrap, DI registrations) the whole-graph walk never starts at or passes through; a stop file must still sit under sharedRoots, and stopAt does not silence the direct SHARED_IMPORTS_SLICE warning. arkgate 4.8.22 and older reject deny-cross-parent. arkgate 4.8.23 and older reject the object form (must be one of deny, deny-cross-parent).',oneOf:[{type:"string",enum:["deny","deny-cross-parent"]},{type:"object",additionalProperties:!1,required:["mode","stopAt"],properties:{mode:{type:"string",enum:["deny-cross-parent"]},stopAt:{...ue,minItems:1}}}]},Kt={type:"object",additionalProperties:!1,required:["sliceFolders"],description:`Optional inner wall under this rule. Runs only on a rule with peerIsolation: true and allowed: false; elsewhere it is inert and ark-check warns CONFIG_CHILD_SLICES_INERT (config load still accepts it, as 4.8.23 did). Absent keeps today's universe wall. sliceFolders names children. Flat files are universe common, and so is a commonFolders directory directly under the universe (a folder of that name inside a child belongs to that child). siblings is "deny" (default), "advisory", or { default, enforce, ratchet }. parentMayImportChild defaults to false. message is the text for inner-wall findings. allowedCrossSlice may use a whole-segment *. It clears only a sibling crossing. Cross-parent has no advisory knob. arkgate 4.8.22 and older reject this key. A build that still rejects unknown childSlices fields rejects allowedCrossSlice at config load. A build that still types siblings as a string enum rejects the object at config load.`,properties:{sliceFolders:{...ue,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"]},commonFolders:{...ue,minItems:1},siblings:{description:'"deny" or "advisory", or { default, enforce, ratchet } so listed subtrees are errors while the default stays advisory. ratchet absent: a new advisory crossing fails only when the baseline in use already records an advisory crossing of this rule. ratchet true: any unrecorded advisory crossing fails when a baseline is in use. ratchet false: measure only, never fails. A string-enum build rejects the object at config load (must be one of deny, advisory). arkgate 4.8.23 and older reject ratchet (unknown field).',oneOf:[{type:"string",enum:["deny","advisory"]},{type:"object",additionalProperties:!1,required:["default"],properties:{default:{type:"string",enum:["deny","advisory"]},enforce:{...ue},ratchet:{type:"boolean"}}}]},parentMayImportChild:{type:"boolean"},message:{type:"string",minLength:1,description:"Text for inner-wall findings (CROSS_SIBLING_SLICE and universe common importing a child). The rule message stays the universe-wall text (CROSS_PARENT_SLICE and fail-closed denies). Absent: ArkGate default text, never the rule message. arkgate 4.8.23 and older reject this field (unknown field)."},arkRulesFile:{type:"string",minLength:1,description:"Filename read at each child slice root this wall already resolved. The only token is <Layer>, replaced with a declared layer name (arkrules.<Layer>.json). No slash and no wildcard. A discovered file that omits appliesTo is scoped to that slice directory. Explicit appliesTo outside the slice fails config load (ARKRULE_SCOPE_ESCAPES_SLICE). The effective id is <childId>#<localId>. A build that rejects unknown childSlices fields fails at config load (unknown field)."},sliceAliases:{type:"array",minItems:1,description:"Maps a source path glob onto a child slice id (universe id plus one child segment) so files outside the slice trees take that universe and child for both walls. A path without a wildcard also covers everything under it, as sharedRoots does. A bare name, a universe id alone, a target outside every universe shape, and a wildcard in to are rejected. Under stars identity a target written against the 4.8.23 stars id (star bindings before the last literal dropped, e.g. api/v1/x for modules/*/api/*) still loads when it maps to one universe shape, and ark-check warns CONFIG_SLICE_LEGACY_STARS_ID with the new id; it is rejected only when it maps to more than one shape. Config load checks only the shape; doctor reports a target universe no file belongs to. The glob may not overlap a slice folder, and two aliases may not match the same file. Doctor lists each unpinned alias as an owed move. pinned true lists the alias separately and does not count it as debt. reason is a doctor label and does not pin by itself. A build that rejects unknown childSlices fields fails at config load (unknown field). arkgate 4.8.22 and older reject childSlices.",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},pinned:{type:"boolean",description:"True when a framework forces the path to stay. The alias is not an owed move and does not clear other honesty debt."},reason:{type:"string",minLength:1,description:"Doctor label, such as framework-route. A label alone does not pin."}}}},allowedCrossSlice:{type:"array",minItems:1,description:"Directed child-slice allowances. * matches one whole path segment (features/projects/*). ** and a partial segment are rejected. A bare name is rejected. This list clears only CROSS_SIBLING_SLICE. It cannot clear CROSS_PARENT_SLICE or CROSS_PARENT_VIA_SHARED. The universe allowedCrossSlice still treats * as a literal. A build that rejects unknown childSlices fields fails at config load (unknown field).",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}}}};function I(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, I,"isObject");function fe(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}_chunkA5EIY3HIcjs.a.call(void 0, fe,"propertyPath");function P(t){let e=t.length;for(;e>0&&t[e-1]==="/";)e-=1;return t.slice(0,e)}_chunkA5EIY3HIcjs.a.call(void 0, P,"trimTrailingSlashes");function Vt(t,e){ir(t,e),ar(t,e),ur(t,e),Rr(t,e),Er(t,e)}_chunkA5EIY3HIcjs.a.call(void 0, Vt,"validateSliceContract");var Mt='must be "deny", "deny-cross-parent", or { "mode": "deny-cross-parent", "stopAt": ["<composition root path or glob>"] }',Ft="must not cover the whole tree. Name the composition root itself (bootstrap file, DI registrations folder).";function tr(t){return t==="*"||t==="**"}_chunkA5EIY3HIcjs.a.call(void 0, tr,"isWildcardSegment");function Wt(t){let e=t.toLowerCase().split("/").filter(o=>o.length>0&&o!==".");(e[0]==="src"||e[0]==="app")&&(e=e.slice(1));let n=e.length;for(;n>0&&tr(_nullishCoalesce(e[n-1], () => ("")));)n-=1;let r=e.slice(0,n);return r.some(o=>o.includes("*"))?null:r}_chunkA5EIY3HIcjs.a.call(void 0, Wt,"coveredFolder");function nr(t,e){return t.length<=e.length&&t.every((n,r)=>e[r]===n)}_chunkA5EIY3HIcjs.a.call(void 0, nr,"isPrefixOf");function rr(t,e){let n=t.layers;if(!Array.isArray(n))return[];let r=new Set([e.from,e.to].filter(i=>typeof i=="string")),o=[];for(let i of n){if(!I(i)||typeof i.name!="string"||!r.has(i.name))continue;let s=Array.isArray(i.patterns)?i.patterns:[];for(let l of s){if(typeof l!="string")continue;let c=l.replace(/\\/g,"/").split("/"),d=c.findIndex(m=>m.includes("*")),f=d===-1?c:c.slice(0,d),p=Wt(f.join("/"));p&&o.push(p)}}return o}_chunkA5EIY3HIcjs.a.call(void 0, rr,"ruleLayerFolders");function or(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0)return"must be a non-empty path or glob";let r=n.replace(/^[./]+/,"");if(r===""||r==="*"||r==="**")return Ft;for(let i of n.split("/"))if(i.length===0||i==="."||i==="..")return"must be a path or glob without empty, . or .. segments";let o=Wt(n);return o===null?null:o.length===0?Ft:e.some(i=>nr(o,i))?"must not cover a whole layer root of this rule. Name the composition root itself (bootstrap file, DI registrations folder).":null}_chunkA5EIY3HIcjs.a.call(void 0, or,"stopAtEntryIssue");function ir(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r)||r.sharedImportsSlice===void 0)return;let i=r.sharedImportsSlice,s=`$.rules[${o}].sharedImportsSlice`;if(typeof i=="string"){i!=="deny"&&i!=="deny-cross-parent"&&e.push({path:s,message:Mt});return}if(!I(i)){e.push({path:s,message:Mt});return}for(let f of Object.keys(i))f!=="mode"&&f!=="stopAt"&&e.push({path:fe(s,f),message:"unknown field"});i.mode===void 0?e.push({path:`${s}.mode`,message:"is required"}):i.mode!=="deny-cross-parent"&&e.push({path:`${s}.mode`,message:'must be deny-cross-parent. stopAt has no meaning for deny; use the string "deny".'});let l=i.stopAt;if(l===void 0){e.push({path:`${s}.stopAt`,message:"is required"});return}if(!Array.isArray(l)||l.length===0){e.push({path:`${s}.stopAt`,message:"must be a non-empty array of paths or globs"});return}let c=new Set,d=rr(t,r);l.forEach((f,p)=>{let m=`${s}.stopAt[${p}]`;if(typeof f!="string"){e.push({path:m,message:"must be a non-empty path or glob"});return}let h=or(f,d);if(h){e.push({path:m,message:h});return}let S=P(f.trim().replace(/\\/g,"/")).toLowerCase();if(c.has(S)){e.push({path:m,message:"duplicate stopAt entry"});return}c.add(S)})})}_chunkA5EIY3HIcjs.a.call(void 0, ir,"validateSharedImportsSlice");var sr=["deny","advisory"],_t='must be "deny", "advisory", or { "default": "deny" | "advisory", "enforce": ["<child id or subtree path>"], "ratchet": true | false }';function ar(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.siblings===void 0)return;let s=i.siblings,l=`$.rules[${o}].childSlices.siblings`;if(typeof s=="string"){sr.includes(s)||e.push({path:l,message:_t});return}if(!I(s)){e.push({path:l,message:_t});return}for(let d of Object.keys(s))d!=="default"&&d!=="enforce"&&d!=="ratchet"&&e.push({path:fe(l,d),message:"unknown field"});if(s.ratchet!==void 0&&typeof s.ratchet!="boolean"&&e.push({path:`${l}.ratchet`,message:"must be a boolean"}),s.default===void 0?e.push({path:`${l}.default`,message:"is required"}):s.default!=="deny"&&s.default!=="advisory"&&e.push({path:`${l}.default`,message:"must be deny or advisory"}),s.enforce===void 0)return;if(!Array.isArray(s.enforce)){e.push({path:`${l}.enforce`,message:"must be an array of child slice ids or subtree paths"});return}let c=new Set;s.enforce.forEach((d,f)=>{let p=`${l}.enforce[${f}]`;if(typeof d!="string"||d.trim().length===0){e.push({path:p,message:"must be a non-empty child slice id or subtree path"});return}let m=P(d.trim().replace(/\\/g,"/"));if(m.split("/").some(h=>h.length===0||h==="."||h==="..")){e.push({path:p,message:"must be a child slice id or subtree path without . or .."});return}if(m.includes("*")){e.push({path:p,message:"must be a child slice id or subtree path. * is not a wildcard on siblings.enforce"});return}if(c.has(m)){e.push({path:p,message:"duplicate enforce entry"});return}c.add(m)})})}_chunkA5EIY3HIcjs.a.call(void 0, ar,"validateChildSliceSiblings");var lr="must be a slice id with a slash. A bare name is ambiguous across universes.",cr="* matches one whole path segment. ** and a partial segment are not wildcards.";function dr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty slice id";if(!e.includes("/"))return lr;let n=e.split("/");for(let r of n){if(r.length===0||r==="."||r==="..")return"must be a slice id without empty, . or .. segments";if(r.includes("*")&&r!=="*")return cr}return null}_chunkA5EIY3HIcjs.a.call(void 0, dr,"childCrossSlicePatternIssue");function Bt(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase()}_chunkA5EIY3HIcjs.a.call(void 0, Bt,"childCrossSlicePatternKey");function ur(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.allowedCrossSlice===void 0)return;let s=i.allowedCrossSlice,l=`$.rules[${o}].childSlices.allowedCrossSlice`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } child slice ids"});return}let c=new Set;s.forEach((d,f)=>{let p=`${l}[${f}]`;if(!I(d)){e.push({path:p,message:"must be an object with from and to"});return}for(let h of Object.keys(d))h!=="from"&&h!=="to"&&e.push({path:fe(p,h),message:"unknown field"});for(let h of["from","to"]){let S=d[h],u=`${p}.${h}`;if(typeof S!="string"||S.trim().length===0){e.push({path:u,message:"must be a non-empty slice id"});continue}let y=dr(S);y&&e.push({path:u,message:y})}if(typeof d.from!="string"||typeof d.to!="string")return;let m=`${Bt(d.from)}\0${Bt(d.to)}`;if(!m.startsWith("\0")&&!m.endsWith("\0")){if(c.has(m)){e.push({path:p,message:"duplicate child slice allowance"});return}c.add(m)}})})}_chunkA5EIY3HIcjs.a.call(void 0, ur,"validateChildSliceAllowedCrossSlice");var M="must be a child of a universe shape this rule names (its universe sliceFolders shape plus one child segment). A bare name, a universe id alone, a target outside every universe shape, and a wildcard are rejected. Config load checks the shape only; doctor reports a target universe no file belongs to.",fr="is a 4.8.23 stars id (star bindings before the last literal dropped) that maps to more than one universe shape of this rule. Write the new stars id, which keeps every star binding (e.g. orders/api/v1/x for modules/*/api/*).",pr="overlaps a slice folder. An alias covers only files outside the slice trees.",gr="two slice aliases match the same file";function mr(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase().split("/").filter(e=>e.length>0)}_chunkA5EIY3HIcjs.a.call(void 0, mr,"aliasPathSegments");function hr(t){let e=t[t.length-1];return e===void 0||e.includes("*")?[...t]:[...t,"**"]}_chunkA5EIY3HIcjs.a.call(void 0, hr,"aliasSegmentsWithSubtree");function Ut(t){let e=[];for(let n of t){if(n.includes("*"))break;e.push(n)}return e}_chunkA5EIY3HIcjs.a.call(void 0, Ut,"concreteGlobPrefix");function J(t,e){if(t.length>e.length)return!1;for(let n=0;n<t.length;n+=1)if(t[n]!==e[n])return!1;return!0}_chunkA5EIY3HIcjs.a.call(void 0, J,"segmentsArePrefix");function yr(t){let e=t.split(/[/\\]/).filter(Boolean).map(r=>r.toLowerCase());if(e.length<2||e[0]==="*"||e[0]==="**"||!e.some(r=>r==="*"))return null;let n=[];for(let r of e){if(r==="*"||r==="**")break;if(r.includes("*"))return null;n.push(r)}return n.length>0?n:null}_chunkA5EIY3HIcjs.a.call(void 0, yr,"anchoredSlicePrefix");function Sr(t,e){let n=Ut(t),r=n.length<t.length,o=n[0]==="src"||n[0]==="app"?n.slice(1):n;return J(e,n)||J(e,o)?!0:r?J(n,e)&&n.length<e.length||J(n,["src",...e])&&n.length<e.length+1||J(n,["app",...e])&&n.length<e.length+1:!1}_chunkA5EIY3HIcjs.a.call(void 0, Sr,"globOverlapsAnchored");function wr(t,e){for(let r=0;r<t.length;r+=1){if(t[r]!==e&&t[r]!=="*")continue;let o=t.slice(r+1);if(o.length>=2||o.some(i=>i==="*"||i==="**"))return!0}let n=Ut(t);return n.length<t.length&&(n.length===0||n.length===1&&(n[0]==="src"||n[0]==="app"))}_chunkA5EIY3HIcjs.a.call(void 0, wr,"globOverlapsBare");function Ir(t,e){let n=e.split(/[/\\]/).filter(Boolean).map(o=>o.toLowerCase());if(n.length===1&&n[0]&&!n[0].includes("*"))return wr(t,n[0]);let r=yr(e);return r?Sr(t,r):!1}_chunkA5EIY3HIcjs.a.call(void 0, Ir,"globOverlapsSliceEntry");function vr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty path glob";if(e==="*"||e==="**")return"must not cover the whole tree";for(let n of e.split("/")){if(n.length===0||n==="."||n==="..")return"must be a path glob without empty, . or .. segments";if(!(n==="*"||n==="**")&&(n.includes("*")||n.includes("?")||n.includes("{")||n.includes("[")))return"* matches one whole path segment. ** is a whole segment. A partial segment is not a wildcard."}return null}_chunkA5EIY3HIcjs.a.call(void 0, vr,"aliasGlobIssue");function br(t,e){let n=[];if(!Array.isArray(t))return n;let r=e==="stars";for(let o of t){if(typeof o!="string"||o.length===0)continue;let i=o.split(/[/\\]/).filter(Boolean).map(s=>s.toLowerCase());if(i.length===1&&i[0]&&!i[0].includes("*")){n.push({literals:[i[0],null]});continue}if(!i.some(s=>s==="**"||s.includes("*")&&s!=="*")&&i.includes("*")){if(r){let s=-1;for(let d=0;d<i.length;d+=1)i[d]!=="*"&&(s=d);if(s<0)continue;let l=i.filter((d,f)=>f>=s||d==="*").map(d=>d==="*"?null:d),c=i.slice(s).map(d=>d==="*"?null:d);n.push(c.length===l.length?{literals:l}:{literals:l,legacy:c});continue}n.push({literals:i.map(s=>s==="*"?null:s)})}}return n}_chunkA5EIY3HIcjs.a.call(void 0, br,"universeShapes");function de(t,e){return t.literals.length!==e.length?!1:t.literals.every((n,r)=>n===null||n===e[r])}_chunkA5EIY3HIcjs.a.call(void 0, de,"shapeMatches");function Ar(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0||n.split("/").some(i=>i.length===0||i==="."||i==="..")||n.includes("*")||!n.includes("/"))return M;let r=n.split("/").map(i=>i.toLowerCase());if(e.length===0||e.some(i=>de(i,r)))return M;if(e.some(i=>de(i,r.slice(0,-1))))return null;let o=new Set(e.filter(i=>i.legacy!==void 0&&!de({literals:i.legacy},r)&&de({literals:i.legacy},r.slice(0,-1))).map(i=>i.literals.map(s=>_nullishCoalesce(s, () => ("*"))).join("/")));return o.size===1?null:o.size>1?fr:M}_chunkA5EIY3HIcjs.a.call(void 0, Ar,"aliasTargetIssue");function jt(t){let e=t[0];return(e==="src"||e==="app")&&t.length>1?[t,t.slice(1)]:[t]}_chunkA5EIY3HIcjs.a.call(void 0, jt,"aliasGlobVariants");function kr(t,e){let n=jt(t),r=jt(e);for(let o of n)if(x(o,e,0,0,new Map))return!0;for(let o of r)if(x(t,o,0,0,new Map))return!0;return!1}_chunkA5EIY3HIcjs.a.call(void 0, kr,"aliasesCanMatchSameFile");function x(t,e,n,r,o){let i=`${n}:${r}`,s=o.get(i);if(s!==void 0)return s;let l=!1;if(n===t.length&&r===e.length)l=!0;else if(n<t.length&&t[n]==="**")l=x(t,e,n+1,r,o)||r<e.length&&x(t,e,n,r+1,o);else if(r<e.length&&e[r]==="**")l=x(t,e,n,r+1,o)||n<t.length&&x(t,e,n+1,r,o);else if(n<t.length&&r<e.length){let c=t[n],d=e[r];(c===d||c==="*"||d==="*")&&(l=x(t,e,n+1,r+1,o))}return o.set(i,l),l}_chunkA5EIY3HIcjs.a.call(void 0, x,"globsCanMatchSame");var Gt="must be a filename with exactly one <Layer> token and no slash or wildcard (arkrules.<Layer>.json)";function Er(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.arkRulesFile===void 0)return;let s=`$.rules[${o}].childSlices.arkRulesFile`,l=i.arkRulesFile;if(typeof l!="string"||l.length===0){e.push({path:s,message:Gt});return}(l.split("<Layer>").length!==2||/[*\\/]/.test(l)||l.includes(".."))&&e.push({path:s,message:Gt})})}_chunkA5EIY3HIcjs.a.call(void 0, Er,"validateChildSliceArkRulesFile");function Rr(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.sliceAliases===void 0)return;let s=i.sliceAliases,l=`$.rules[${o}].childSlices.sliceAliases`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } slice aliases"});return}let c=br(r.sliceFolders,r.sliceIdentity),d=[...Array.isArray(r.sliceFolders)?r.sliceFolders:[],...Array.isArray(i.sliceFolders)?i.sliceFolders:[]].filter(p=>typeof p=="string"&&p.length>0),f=[];s.forEach((p,m)=>{let h=`${l}[${m}]`;if(!I(p)){e.push({path:h,message:"must be an object with from and to"});return}for(let y of Object.keys(p))y!=="from"&&y!=="to"&&y!=="pinned"&&y!=="reason"&&e.push({path:fe(h,y),message:"unknown field"});let S=p.from,u=p.to;if(typeof S!="string"||S.trim().length===0)e.push({path:`${h}.from`,message:"must be a non-empty path glob"});else{let y=vr(S);if(y)e.push({path:`${h}.from`,message:y});else{let g=hr(mr(S));d.some(v=>Ir(g,v))&&e.push({path:`${h}.from`,message:pr});for(let v of f)if(kr(v,g)){e.push({path:h,message:gr});break}f.push(g)}}if(typeof u!="string"||u.trim().length===0)e.push({path:`${h}.to`,message:M});else{let y=Ar(u,c);y&&e.push({path:`${h}.to`,message:y})}})})}_chunkA5EIY3HIcjs.a.call(void 0, Rr,"validateChildSliceAliases");function pe(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, pe,"isObject");function F(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}_chunkA5EIY3HIcjs.a.call(void 0, F,"propertyPath");function L(t){return t===null?"null":Array.isArray(t)?"array":typeof t}_chunkA5EIY3HIcjs.a.call(void 0, L,"valueType");function Pr(t,e){let n="#/$defs/";if(t.startsWith(n))return e.$defs[t.slice(n.length)]}_chunkA5EIY3HIcjs.a.call(void 0, Pr,"resolveSchemaRef");function _(t,e,n,r,o){if(e.$ref){let i=Pr(e.$ref,r);if(!i){o.push({path:n,message:`schema reference ${e.$ref} cannot be resolved`});return}_(t,i,n,r,o);return}if(e.const!==void 0&&!Object.is(t,e.const)){o.push({path:n,message:`must equal ${JSON.stringify(e.const)}`});return}if(e.enum&&!e.enum.some(i=>Object.is(i,t))){o.push({path:n,message:`must be one of ${e.enum.map(String).join(", ")}`});return}if(e.type==="object"){if(!pe(t)){o.push({path:n,message:`must be an object; received ${L(t)}`});return}let i=_nullishCoalesce(e.properties, () => ({}));for(let s of _nullishCoalesce(e.required, () => ([])))t[s]===void 0&&o.push({path:F(n,s),message:"is required"});if(e.additionalProperties===!1)for(let s of Object.keys(t))s in i||o.push({path:F(n,s),message:"unknown field"});else if(e.additionalProperties!==void 0&&e.additionalProperties!==!0&&typeof e.additionalProperties=="object"){let s=e.additionalProperties;for(let l of Object.keys(t))l in i||_(t[l],s,F(n,l),r,o)}for(let[s,l]of Object.entries(i))t[s]!==void 0&&_(t[s],l,F(n,s),r,o);return}if(e.type==="array"){if(!Array.isArray(t)){o.push({path:n,message:`must be an array; received ${L(t)}`});return}if(e.minItems!==void 0&&t.length<e.minItems&&o.push({path:n,message:`must contain at least ${e.minItems} item(s)`}),e.uniqueItems){let i=t.map(s=>JSON.stringify(s));new Set(i).size!==i.length&&o.push({path:n,message:"must not contain duplicate items"})}e.items&&t.forEach((i,s)=>_(i,e.items,`${n}[${s}]`,r,o));return}if(e.type==="string"){if(typeof t!="string"){o.push({path:n,message:`must be a string; received ${L(t)}`});return}e.minLength!==void 0&&t.length<e.minLength&&o.push({path:n,message:`must contain at least ${e.minLength} character(s)`});return}if(e.type==="boolean"){typeof t!="boolean"&&o.push({path:n,message:`must be a boolean; received ${L(t)}`});return}if(e.type==="integer"){if(!Number.isInteger(t)){o.push({path:n,message:`must be an integer; received ${L(t)}`});return}e.minimum!==void 0&&t<e.minimum&&o.push({path:n,message:`must be at least ${e.minimum}`})}}_chunkA5EIY3HIcjs.a.call(void 0, _,"validateSchemaNode");function ge(t){if(typeof t!="string")return null;let e=t.trim().replace(/^@/,"").toLowerCase();return e.length>0?e:null}_chunkA5EIY3HIcjs.a.call(void 0, ge,"normalizeStewardId");function qt(t){let e=ge(t);return!e||Oe(e)||e.includes(" ")||e.includes("@")?!1:/^(?!-)[a-z0-9-]{1,39}(?<!-)$/.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, qt,"isGitHubHandle");function Cr(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();if(!e.includes("@")||e.includes(" ")||Oe(e))return!1;let n=e.split("@");if(n.length!==2||!n[0]||/\s/.test(e))return!1;let r=n[1].lastIndexOf(".");return r>0&&r<n[1].length-1}_chunkA5EIY3HIcjs.a.call(void 0, Cr,"isGitHubEmail");function xr(t){if(typeof t!="string")return null;let e=t.trim().match(/^(?:\d+\+)?([^@]+)@users\.noreply\.github\.com$/i);return e&&qt(e[1])?ge(e[1]):null}_chunkA5EIY3HIcjs.a.call(void 0, xr,"githubHandleFromEmail");function zt(t){let e=xr(t);if(e)return e;let n=ge(t);return!n||Oe(n)?null:qt(n)||Cr(n)?n:null}_chunkA5EIY3HIcjs.a.call(void 0, zt,"canonicalStewardId");var Lr=/bot\b|\[bot\]|dependabot|renovate|github-actions|imgbot|codecov/i;function Oe(t){let e=ge(t);return!e||Lr.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, Oe,"isAutomationAuthor");var A="1.3",Or=["public","auth","admin","internal"];function $r(t){return _optionalChain([t, 'optionalAccess', _2 => _2.optional])===!0||_optionalChain([t, 'optionalAccess', _3 => _3.reserved])===!0||_optionalChain([t, 'optionalAccess', _4 => _4.allowEmpty])===!0}_chunkA5EIY3HIcjs.a.call(void 0, $r,"isFutureHouseLayer");function Dr(t){let e=t&&typeof t=="object"?t.owners:void 0;if(!Array.isArray(e)||e.length===0)return;let n=e.filter(r=>typeof r=="string"&&r.length>0);return n.length>0?n:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Dr,"layerOwnersList");function yi(t){return _optionalChain([t, 'optionalAccess', _5 => _5.requireLayerOwners])!==!0||!Array.isArray(t.layers)?[]:t.layers.filter(e=>!$r(e)&&!Dr(e)).map(e=>e.name)}_chunkA5EIY3HIcjs.a.call(void 0, yi,"layersMissingRequiredOwners");function Si(t){return`Add a GitHub handle or email to ${t}'s owners in ark.config.json (/ark-adopt).`}_chunkA5EIY3HIcjs.a.call(void 0, Si,"missingLayerOwnersNextAction");var me="https://unpkg.com/arkgate@4/schemas/ark.config.schema.json",Jt=["DomainModel","ApplicationOrchestration","PersistenceAdapters","IntegrationAdapters","WorkflowSagaEngine","BackgroundJobsScheduling","PresentationAdapters","ReportingReadModels","ExtensibilityMetadata","SecurityAuditObservability","Kernel"],Nr=new Set(["PresentationAdapters->ApplicationOrchestration","ApplicationOrchestration->DomainModel","WorkflowSagaEngine->ApplicationOrchestration","WorkflowSagaEngine->DomainModel","BackgroundJobsScheduling->ApplicationOrchestration"]);function Tr(){let t=[];for(let e of Jt)for(let n of Jt)e===n||Nr.has(`${e}->${n}`)||t.push({from:e,to:n,allowed:!1});return t}_chunkA5EIY3HIcjs.a.call(void 0, Tr,"createDefaultRules");var he=Tr(),$e=[{from:"unversioned",to:"1.0"},{from:"1.0",to:"1.1"},{from:"1.1",to:"1.2"},{from:"1.2",to:"1.3"}],b={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Yt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:me,title:"ArkGate architecture contract",description:"Versioned contract consumed identically by ArkGate CLI, MCP, and ESLint surfaces.",type:"object",additionalProperties:!1,required:["$schema","schemaVersion","include","layers","rules"],properties:{$schema:{type:"string",minLength:1,default:me,description:"Editor-facing URL or local path for this JSON Schema."},schemaVersion:{type:"string",const:A,default:A},name:{type:"string",minLength:1},include:{...b,minItems:1,default:["src"]},exclude:{...b,default:[]},excludeGenerated:{type:"boolean",default:!0},frameworkOverlay:{type:"string",minLength:1},layers:{type:"array",default:[],items:{$ref:"#/$defs/layer"}},rules:{type:"array",default:he,items:{$ref:"#/$defs/rule"}},cyclePolicy:{type:"string",enum:["strict","soft","framework-soft","off"],default:"strict"},dynamicImportAllowlist:{...b,default:[]},safety:{$ref:"#/$defs/safety",default:{maxTsSuppressions:0,maxAnyCasts:0,allowInMemory:!1,allowDisabledPeerIsolation:!1}},coverage:{$ref:"#/$defs/coverage"},arkRules:{type:"object",additionalProperties:{description:"A project-relative ArkRules path, or a list of paths merged into one catalog for this layer. A string keeps today's behaviour. An older build that types this value as a string rejects an array at config load.",oneOf:[{type:"string",minLength:1},{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",minLength:1}}]},default:{}},arkRun:{$ref:"#/$defs/arkRun"},arkOrder:{$ref:"#/$defs/arkOrder"},stewards:{...b,default:[]},requireLayerOwners:{type:"boolean"}},$defs:{layer:{type:"object",additionalProperties:!1,required:["name","patterns"],properties:{name:{type:"string",minLength:1},patterns:{...b,minItems:1},exclude:b,intentPrefixes:b,description:{type:"string",minLength:1},trustBoundary:{type:"string",enum:[...Or]},owners:{...b,minItems:1},forbiddenGlobals:b,capabilities:{type:"object",additionalProperties:!1,properties:{deny:{type:"array",uniqueItems:!0,items:{type:"string",enum:["network","filesystem","clock","randomness","environment","process","persistence"]}}}},pure:{type:"boolean"},mayImportInfrastructure:{type:"boolean"},optional:{type:"boolean"},reserved:{type:"boolean"},allowEmpty:{type:"boolean"}}},rule:{type:"object",additionalProperties:!1,required:["from","to","allowed"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},allowed:{type:"boolean"},message:{type:"string",minLength:1},peerIsolation:{type:"boolean"},sliceFolders:{...b,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"],description:"How a starred sliceFolders prefix is named. Absent and path keep today's ids (every literal and star binding). stars keeps the last literal plus every star binding (a star before the last literal is kept too), so parallel trees share one feature id. Bare names are unchanged."},sharedRoots:{...b,minItems:1},allowedCrossSlice:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}},sharedImportsSlice:Ht,childSlices:Kt}},safety:{type:"object",additionalProperties:!1,properties:{maxTsSuppressions:{type:"integer",minimum:0,default:0},maxAnyCasts:{type:"integer",minimum:0,default:0},allowInMemory:{type:"boolean",default:!1},allowDisabledPeerIsolation:{type:"boolean",default:!1}}},coverage:{type:"object",additionalProperties:!1,description:"Invariant coverage scan controls. testGlobs replaces the built-in test-name heuristic; maxFiles raises or lowers the evidence file budget and also bounds structural-hint preload for orchestration-only, thin-adapter, and writes-via-aggregate (default 400; there is no arkrules.hintBudget); coverageRoots declares where the project runs its tests, so a covering test found outside them is reported instead of silently certifying an invariant. When any invariant is enforced, missing coverageRoots fails closed.",properties:{testGlobs:{...b,minItems:1},maxFiles:{type:"integer",minimum:1,description:"Evidence file budget (default 400) and structural-hint preload cap for orchestration-only, thin-adapter, and writes-via-aggregate. Raise this when hinted/governed counts show truncated sensors. There is no separate arkrules.hintBudget."},coverageRoots:{...b,minItems:1}}},arkRun:xt,arkOrder:Lt}},R=class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"ArkConfigValidationError")}constructor(e,n){super(`Invalid ArkGate config (${e}):
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12;var _chunkA5EIY3HIcjs = require('./chunk-A5EIY3HI.cjs');var Ct="4.8.26";var C={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},xt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},compositionRoots:{...C,default:[]},kernelRoots:{...C},managedLayers:{...C,default:[]},requireDeclarations:{type:"boolean",default:!0},ignoreDirectNewForErrors:{type:"boolean",default:!0}}},Lt={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},planeRoots:{...C,default:[]},managedLayers:{...C,default:[]},maxXiKeys:{type:"integer",minimum:1,default:7},xiKeys:{...C,default:[]},appliesTo:{...C,default:[]}}};function z(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, z,"isObject");function er(t){let e=new Set;if(!Array.isArray(t.layers))return e;for(let n of t.layers)z(n)&&typeof n.name=="string"&&n.name.length>0&&e.add(n.name);return e}_chunkA5EIY3HIcjs.a.call(void 0, er,"declaredLayerNames");function Ot(t){if(!z(t))return t;let e={mode:t.mode===void 0?"advisory":t.mode,compositionRoots:t.compositionRoots===void 0?[]:t.compositionRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,requireDeclarations:t.requireDeclarations===void 0?!0:t.requireDeclarations};return t.kernelRoots!==void 0&&(e.kernelRoots=t.kernelRoots),t.ignoreDirectNewForErrors!==void 0&&(e.ignoreDirectNewForErrors=t.ignoreDirectNewForErrors),{...t,...e}}_chunkA5EIY3HIcjs.a.call(void 0, Ot,"defaultedArkRun");function $t(t){if(!z(t))return t;let e=typeof t.maxXiKeys=="number"&&t.maxXiKeys>0?t.maxXiKeys:7;return{...t,mode:t.mode===void 0?"advisory":t.mode,planeRoots:t.planeRoots===void 0?[]:t.planeRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,maxXiKeys:e,xiKeys:t.xiKeys===void 0?[]:t.xiKeys}}_chunkA5EIY3HIcjs.a.call(void 0, $t,"defaultedArkOrder");function Dt(t,e,n,r){if(!Array.isArray(e))return;let o=er(t);e.forEach((i,s)=>{typeof i=="string"&&i.length>0&&!o.has(i)&&r.push({path:`$.${n}.managedLayers[${s}]`,message:`layer ${JSON.stringify(i)} is not declared in layers[]`})})}_chunkA5EIY3HIcjs.a.call(void 0, Dt,"validateManagedLayersDeclared");function Nt(t,e){let n=t.arkRun;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkRun",e),n.mode==="enforced"){let o=_nullishCoalesce(n.kernelRoots, () => (n.compositionRoots));(!Array.isArray(o)||o.length===0)&&e.push({path:n.kernelRoots!==void 0?"$.arkRun.kernelRoots":"$.arkRun.compositionRoots",message:"ARKRUN_MISSING_ROOT: enforced mode requires at least one kernel root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkRun.managedLayers",message:"enforced mode requires at least one managed layer"})}}_chunkA5EIY3HIcjs.a.call(void 0, Nt,"validateArkRunExtra");function Tt(t,e){let n=t.arkOrder;if(n===void 0||!z(n))return;let r=n.managedLayers;if(Dt(t,r,"arkOrder",e),n.mode==="enforced"){let o=n.planeRoots;(!Array.isArray(o)||o.length===0)&&e.push({path:"$.arkOrder.planeRoots",message:"ARKORDER_MISSING_PLANE: enforced mode requires at least one plane root"}),(!Array.isArray(r)||r.length===0)&&e.push({path:"$.arkOrder.managedLayers",message:"enforced mode requires at least one managed layer"})}}_chunkA5EIY3HIcjs.a.call(void 0, Tt,"validateArkOrderExtra");var ue={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Ht={description:'deny blocks every shared-root import of a slice. deny-cross-parent leaves that hop as a warning and, in ark-check and CI only, reports a slice that reaches another universe through a shared root. The write hook and ESLint see one edge and do not block it. The object form { mode: "deny-cross-parent", stopAt } names composition roots (bootstrap, DI registrations) the whole-graph walk never starts at or passes through; a stop file must still sit under sharedRoots, and stopAt does not silence the direct SHARED_IMPORTS_SLICE warning. arkgate 4.8.22 and older reject deny-cross-parent. arkgate 4.8.23 and older reject the object form (must be one of deny, deny-cross-parent).',oneOf:[{type:"string",enum:["deny","deny-cross-parent"]},{type:"object",additionalProperties:!1,required:["mode","stopAt"],properties:{mode:{type:"string",enum:["deny-cross-parent"]},stopAt:{...ue,minItems:1}}}]},Kt={type:"object",additionalProperties:!1,required:["sliceFolders"],description:`Optional inner wall under this rule. Runs only on a rule with peerIsolation: true and allowed: false; elsewhere it is inert and ark-check warns CONFIG_CHILD_SLICES_INERT (config load still accepts it, as 4.8.23 did). Absent keeps today's universe wall. sliceFolders names children. Flat files are universe common, and so is a commonFolders directory directly under the universe (a folder of that name inside a child belongs to that child). siblings is "deny" (default), "advisory", or { default, enforce, ratchet }. parentMayImportChild defaults to false. message is the text for inner-wall findings. allowedCrossSlice may use a whole-segment *. It clears only a sibling crossing. Cross-parent has no advisory knob. arkgate 4.8.22 and older reject this key. A build that still rejects unknown childSlices fields rejects allowedCrossSlice at config load. A build that still types siblings as a string enum rejects the object at config load.`,properties:{sliceFolders:{...ue,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"]},commonFolders:{...ue,minItems:1},siblings:{description:'"deny" or "advisory", or { default, enforce, ratchet } so listed subtrees are errors while the default stays advisory. ratchet absent: a new advisory crossing fails only when the baseline in use already records an advisory crossing of this rule. ratchet true: any unrecorded advisory crossing fails when a baseline is in use. ratchet false: measure only, never fails. A string-enum build rejects the object at config load (must be one of deny, advisory). arkgate 4.8.23 and older reject ratchet (unknown field).',oneOf:[{type:"string",enum:["deny","advisory"]},{type:"object",additionalProperties:!1,required:["default"],properties:{default:{type:"string",enum:["deny","advisory"]},enforce:{...ue},ratchet:{type:"boolean"}}}]},parentMayImportChild:{type:"boolean"},message:{type:"string",minLength:1,description:"Text for inner-wall findings (CROSS_SIBLING_SLICE and universe common importing a child). The rule message stays the universe-wall text (CROSS_PARENT_SLICE and fail-closed denies). Absent: ArkGate default text, never the rule message. arkgate 4.8.23 and older reject this field (unknown field)."},arkRulesFile:{type:"string",minLength:1,description:"Filename read at each child slice root this wall already resolved. The only token is <Layer>, replaced with a declared layer name (arkrules.<Layer>.json). No slash and no wildcard. A discovered file that omits appliesTo is scoped to that slice directory. Explicit appliesTo outside the slice fails config load (ARKRULE_SCOPE_ESCAPES_SLICE). The effective id is <childId>#<localId>. A build that rejects unknown childSlices fields fails at config load (unknown field)."},sliceAliases:{type:"array",minItems:1,description:"Maps a source path glob onto a child slice id (universe id plus one child segment) so files outside the slice trees take that universe and child for both walls. A path without a wildcard also covers everything under it, as sharedRoots does. A bare name, a universe id alone, a target outside every universe shape, and a wildcard in to are rejected. Under stars identity a target written against the 4.8.23 stars id (star bindings before the last literal dropped, e.g. api/v1/x for modules/*/api/*) still loads when it maps to one universe shape, and ark-check warns CONFIG_SLICE_LEGACY_STARS_ID with the new id; it is rejected only when it maps to more than one shape. Config load checks only the shape; doctor reports a target universe no file belongs to. The glob may not overlap a slice folder, and two aliases may not match the same file. Doctor lists each unpinned alias as an owed move. pinned true lists the alias separately and does not count it as debt. reason is a doctor label and does not pin by itself. A build that rejects unknown childSlices fields fails at config load (unknown field). arkgate 4.8.22 and older reject childSlices.",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},pinned:{type:"boolean",description:"True when a framework forces the path to stay. The alias is not an owed move and does not clear other honesty debt."},reason:{type:"string",minLength:1,description:"Doctor label, such as framework-route. A label alone does not pin."}}}},allowedCrossSlice:{type:"array",minItems:1,description:"Directed child-slice allowances. * matches one whole path segment (features/projects/*). ** and a partial segment are rejected. A bare name is rejected. This list clears only CROSS_SIBLING_SLICE. It cannot clear CROSS_PARENT_SLICE or CROSS_PARENT_VIA_SHARED. The universe allowedCrossSlice still treats * as a literal. A build that rejects unknown childSlices fields fails at config load (unknown field).",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}}}};function I(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, I,"isObject");function fe(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}_chunkA5EIY3HIcjs.a.call(void 0, fe,"propertyPath");function P(t){let e=t.length;for(;e>0&&t[e-1]==="/";)e-=1;return t.slice(0,e)}_chunkA5EIY3HIcjs.a.call(void 0, P,"trimTrailingSlashes");function Vt(t,e){ir(t,e),ar(t,e),ur(t,e),Rr(t,e),Er(t,e)}_chunkA5EIY3HIcjs.a.call(void 0, Vt,"validateSliceContract");var Mt='must be "deny", "deny-cross-parent", or { "mode": "deny-cross-parent", "stopAt": ["<composition root path or glob>"] }',Ft="must not cover the whole tree. Name the composition root itself (bootstrap file, DI registrations folder).";function tr(t){return t==="*"||t==="**"}_chunkA5EIY3HIcjs.a.call(void 0, tr,"isWildcardSegment");function Wt(t){let e=t.toLowerCase().split("/").filter(o=>o.length>0&&o!==".");(e[0]==="src"||e[0]==="app")&&(e=e.slice(1));let n=e.length;for(;n>0&&tr(_nullishCoalesce(e[n-1], () => ("")));)n-=1;let r=e.slice(0,n);return r.some(o=>o.includes("*"))?null:r}_chunkA5EIY3HIcjs.a.call(void 0, Wt,"coveredFolder");function nr(t,e){return t.length<=e.length&&t.every((n,r)=>e[r]===n)}_chunkA5EIY3HIcjs.a.call(void 0, nr,"isPrefixOf");function rr(t,e){let n=t.layers;if(!Array.isArray(n))return[];let r=new Set([e.from,e.to].filter(i=>typeof i=="string")),o=[];for(let i of n){if(!I(i)||typeof i.name!="string"||!r.has(i.name))continue;let s=Array.isArray(i.patterns)?i.patterns:[];for(let l of s){if(typeof l!="string")continue;let c=l.replace(/\\/g,"/").split("/"),d=c.findIndex(m=>m.includes("*")),f=d===-1?c:c.slice(0,d),p=Wt(f.join("/"));p&&o.push(p)}}return o}_chunkA5EIY3HIcjs.a.call(void 0, rr,"ruleLayerFolders");function or(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0)return"must be a non-empty path or glob";let r=n.replace(/^[./]+/,"");if(r===""||r==="*"||r==="**")return Ft;for(let i of n.split("/"))if(i.length===0||i==="."||i==="..")return"must be a path or glob without empty, . or .. segments";let o=Wt(n);return o===null?null:o.length===0?Ft:e.some(i=>nr(o,i))?"must not cover a whole layer root of this rule. Name the composition root itself (bootstrap file, DI registrations folder).":null}_chunkA5EIY3HIcjs.a.call(void 0, or,"stopAtEntryIssue");function ir(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r)||r.sharedImportsSlice===void 0)return;let i=r.sharedImportsSlice,s=`$.rules[${o}].sharedImportsSlice`;if(typeof i=="string"){i!=="deny"&&i!=="deny-cross-parent"&&e.push({path:s,message:Mt});return}if(!I(i)){e.push({path:s,message:Mt});return}for(let f of Object.keys(i))f!=="mode"&&f!=="stopAt"&&e.push({path:fe(s,f),message:"unknown field"});i.mode===void 0?e.push({path:`${s}.mode`,message:"is required"}):i.mode!=="deny-cross-parent"&&e.push({path:`${s}.mode`,message:'must be deny-cross-parent. stopAt has no meaning for deny; use the string "deny".'});let l=i.stopAt;if(l===void 0){e.push({path:`${s}.stopAt`,message:"is required"});return}if(!Array.isArray(l)||l.length===0){e.push({path:`${s}.stopAt`,message:"must be a non-empty array of paths or globs"});return}let c=new Set,d=rr(t,r);l.forEach((f,p)=>{let m=`${s}.stopAt[${p}]`;if(typeof f!="string"){e.push({path:m,message:"must be a non-empty path or glob"});return}let h=or(f,d);if(h){e.push({path:m,message:h});return}let S=P(f.trim().replace(/\\/g,"/")).toLowerCase();if(c.has(S)){e.push({path:m,message:"duplicate stopAt entry"});return}c.add(S)})})}_chunkA5EIY3HIcjs.a.call(void 0, ir,"validateSharedImportsSlice");var sr=["deny","advisory"],_t='must be "deny", "advisory", or { "default": "deny" | "advisory", "enforce": ["<child id or subtree path>"], "ratchet": true | false }';function ar(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.siblings===void 0)return;let s=i.siblings,l=`$.rules[${o}].childSlices.siblings`;if(typeof s=="string"){sr.includes(s)||e.push({path:l,message:_t});return}if(!I(s)){e.push({path:l,message:_t});return}for(let d of Object.keys(s))d!=="default"&&d!=="enforce"&&d!=="ratchet"&&e.push({path:fe(l,d),message:"unknown field"});if(s.ratchet!==void 0&&typeof s.ratchet!="boolean"&&e.push({path:`${l}.ratchet`,message:"must be a boolean"}),s.default===void 0?e.push({path:`${l}.default`,message:"is required"}):s.default!=="deny"&&s.default!=="advisory"&&e.push({path:`${l}.default`,message:"must be deny or advisory"}),s.enforce===void 0)return;if(!Array.isArray(s.enforce)){e.push({path:`${l}.enforce`,message:"must be an array of child slice ids or subtree paths"});return}let c=new Set;s.enforce.forEach((d,f)=>{let p=`${l}.enforce[${f}]`;if(typeof d!="string"||d.trim().length===0){e.push({path:p,message:"must be a non-empty child slice id or subtree path"});return}let m=P(d.trim().replace(/\\/g,"/"));if(m.split("/").some(h=>h.length===0||h==="."||h==="..")){e.push({path:p,message:"must be a child slice id or subtree path without . or .."});return}if(m.includes("*")){e.push({path:p,message:"must be a child slice id or subtree path. * is not a wildcard on siblings.enforce"});return}if(c.has(m)){e.push({path:p,message:"duplicate enforce entry"});return}c.add(m)})})}_chunkA5EIY3HIcjs.a.call(void 0, ar,"validateChildSliceSiblings");var lr="must be a slice id with a slash. A bare name is ambiguous across universes.",cr="* matches one whole path segment. ** and a partial segment are not wildcards.";function dr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty slice id";if(!e.includes("/"))return lr;let n=e.split("/");for(let r of n){if(r.length===0||r==="."||r==="..")return"must be a slice id without empty, . or .. segments";if(r.includes("*")&&r!=="*")return cr}return null}_chunkA5EIY3HIcjs.a.call(void 0, dr,"childCrossSlicePatternIssue");function Bt(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase()}_chunkA5EIY3HIcjs.a.call(void 0, Bt,"childCrossSlicePatternKey");function ur(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.allowedCrossSlice===void 0)return;let s=i.allowedCrossSlice,l=`$.rules[${o}].childSlices.allowedCrossSlice`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } child slice ids"});return}let c=new Set;s.forEach((d,f)=>{let p=`${l}[${f}]`;if(!I(d)){e.push({path:p,message:"must be an object with from and to"});return}for(let h of Object.keys(d))h!=="from"&&h!=="to"&&e.push({path:fe(p,h),message:"unknown field"});for(let h of["from","to"]){let S=d[h],u=`${p}.${h}`;if(typeof S!="string"||S.trim().length===0){e.push({path:u,message:"must be a non-empty slice id"});continue}let y=dr(S);y&&e.push({path:u,message:y})}if(typeof d.from!="string"||typeof d.to!="string")return;let m=`${Bt(d.from)}\0${Bt(d.to)}`;if(!m.startsWith("\0")&&!m.endsWith("\0")){if(c.has(m)){e.push({path:p,message:"duplicate child slice allowance"});return}c.add(m)}})})}_chunkA5EIY3HIcjs.a.call(void 0, ur,"validateChildSliceAllowedCrossSlice");var M="must be a child of a universe shape this rule names (its universe sliceFolders shape plus one child segment). A bare name, a universe id alone, a target outside every universe shape, and a wildcard are rejected. Config load checks the shape only; doctor reports a target universe no file belongs to.",fr="is a 4.8.23 stars id (star bindings before the last literal dropped) that maps to more than one universe shape of this rule. Write the new stars id, which keeps every star binding (e.g. orders/api/v1/x for modules/*/api/*).",pr="overlaps a slice folder. An alias covers only files outside the slice trees.",gr="two slice aliases match the same file";function mr(t){return P(t.trim().replace(/\\/g,"/")).toLowerCase().split("/").filter(e=>e.length>0)}_chunkA5EIY3HIcjs.a.call(void 0, mr,"aliasPathSegments");function hr(t){let e=t[t.length-1];return e===void 0||e.includes("*")?[...t]:[...t,"**"]}_chunkA5EIY3HIcjs.a.call(void 0, hr,"aliasSegmentsWithSubtree");function Ut(t){let e=[];for(let n of t){if(n.includes("*"))break;e.push(n)}return e}_chunkA5EIY3HIcjs.a.call(void 0, Ut,"concreteGlobPrefix");function J(t,e){if(t.length>e.length)return!1;for(let n=0;n<t.length;n+=1)if(t[n]!==e[n])return!1;return!0}_chunkA5EIY3HIcjs.a.call(void 0, J,"segmentsArePrefix");function yr(t){let e=t.split(/[/\\]/).filter(Boolean).map(r=>r.toLowerCase());if(e.length<2||e[0]==="*"||e[0]==="**"||!e.some(r=>r==="*"))return null;let n=[];for(let r of e){if(r==="*"||r==="**")break;if(r.includes("*"))return null;n.push(r)}return n.length>0?n:null}_chunkA5EIY3HIcjs.a.call(void 0, yr,"anchoredSlicePrefix");function Sr(t,e){let n=Ut(t),r=n.length<t.length,o=n[0]==="src"||n[0]==="app"?n.slice(1):n;return J(e,n)||J(e,o)?!0:r?J(n,e)&&n.length<e.length||J(n,["src",...e])&&n.length<e.length+1||J(n,["app",...e])&&n.length<e.length+1:!1}_chunkA5EIY3HIcjs.a.call(void 0, Sr,"globOverlapsAnchored");function wr(t,e){for(let r=0;r<t.length;r+=1){if(t[r]!==e&&t[r]!=="*")continue;let o=t.slice(r+1);if(o.length>=2||o.some(i=>i==="*"||i==="**"))return!0}let n=Ut(t);return n.length<t.length&&(n.length===0||n.length===1&&(n[0]==="src"||n[0]==="app"))}_chunkA5EIY3HIcjs.a.call(void 0, wr,"globOverlapsBare");function Ir(t,e){let n=e.split(/[/\\]/).filter(Boolean).map(o=>o.toLowerCase());if(n.length===1&&n[0]&&!n[0].includes("*"))return wr(t,n[0]);let r=yr(e);return r?Sr(t,r):!1}_chunkA5EIY3HIcjs.a.call(void 0, Ir,"globOverlapsSliceEntry");function vr(t){let e=P(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty path glob";if(e==="*"||e==="**")return"must not cover the whole tree";for(let n of e.split("/")){if(n.length===0||n==="."||n==="..")return"must be a path glob without empty, . or .. segments";if(!(n==="*"||n==="**")&&(n.includes("*")||n.includes("?")||n.includes("{")||n.includes("[")))return"* matches one whole path segment. ** is a whole segment. A partial segment is not a wildcard."}return null}_chunkA5EIY3HIcjs.a.call(void 0, vr,"aliasGlobIssue");function br(t,e){let n=[];if(!Array.isArray(t))return n;let r=e==="stars";for(let o of t){if(typeof o!="string"||o.length===0)continue;let i=o.split(/[/\\]/).filter(Boolean).map(s=>s.toLowerCase());if(i.length===1&&i[0]&&!i[0].includes("*")){n.push({literals:[i[0],null]});continue}if(!i.some(s=>s==="**"||s.includes("*")&&s!=="*")&&i.includes("*")){if(r){let s=-1;for(let d=0;d<i.length;d+=1)i[d]!=="*"&&(s=d);if(s<0)continue;let l=i.filter((d,f)=>f>=s||d==="*").map(d=>d==="*"?null:d),c=i.slice(s).map(d=>d==="*"?null:d);n.push(c.length===l.length?{literals:l}:{literals:l,legacy:c});continue}n.push({literals:i.map(s=>s==="*"?null:s)})}}return n}_chunkA5EIY3HIcjs.a.call(void 0, br,"universeShapes");function de(t,e){return t.literals.length!==e.length?!1:t.literals.every((n,r)=>n===null||n===e[r])}_chunkA5EIY3HIcjs.a.call(void 0, de,"shapeMatches");function Ar(t,e){let n=P(t.trim().replace(/\\/g,"/"));if(n.length===0||n.split("/").some(i=>i.length===0||i==="."||i==="..")||n.includes("*")||!n.includes("/"))return M;let r=n.split("/").map(i=>i.toLowerCase());if(e.length===0||e.some(i=>de(i,r)))return M;if(e.some(i=>de(i,r.slice(0,-1))))return null;let o=new Set(e.filter(i=>i.legacy!==void 0&&!de({literals:i.legacy},r)&&de({literals:i.legacy},r.slice(0,-1))).map(i=>i.literals.map(s=>_nullishCoalesce(s, () => ("*"))).join("/")));return o.size===1?null:o.size>1?fr:M}_chunkA5EIY3HIcjs.a.call(void 0, Ar,"aliasTargetIssue");function jt(t){let e=t[0];return(e==="src"||e==="app")&&t.length>1?[t,t.slice(1)]:[t]}_chunkA5EIY3HIcjs.a.call(void 0, jt,"aliasGlobVariants");function kr(t,e){let n=jt(t),r=jt(e);for(let o of n)if(x(o,e,0,0,new Map))return!0;for(let o of r)if(x(t,o,0,0,new Map))return!0;return!1}_chunkA5EIY3HIcjs.a.call(void 0, kr,"aliasesCanMatchSameFile");function x(t,e,n,r,o){let i=`${n}:${r}`,s=o.get(i);if(s!==void 0)return s;let l=!1;if(n===t.length&&r===e.length)l=!0;else if(n<t.length&&t[n]==="**")l=x(t,e,n+1,r,o)||r<e.length&&x(t,e,n,r+1,o);else if(r<e.length&&e[r]==="**")l=x(t,e,n,r+1,o)||n<t.length&&x(t,e,n+1,r,o);else if(n<t.length&&r<e.length){let c=t[n],d=e[r];(c===d||c==="*"||d==="*")&&(l=x(t,e,n+1,r+1,o))}return o.set(i,l),l}_chunkA5EIY3HIcjs.a.call(void 0, x,"globsCanMatchSame");var Gt="must be a filename with exactly one <Layer> token and no slash or wildcard (arkrules.<Layer>.json)";function Er(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.arkRulesFile===void 0)return;let s=`$.rules[${o}].childSlices.arkRulesFile`,l=i.arkRulesFile;if(typeof l!="string"||l.length===0){e.push({path:s,message:Gt});return}(l.split("<Layer>").length!==2||/[*\\/]/.test(l)||l.includes(".."))&&e.push({path:s,message:Gt})})}_chunkA5EIY3HIcjs.a.call(void 0, Er,"validateChildSliceArkRulesFile");function Rr(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!I(r))return;let i=r.childSlices;if(!I(i)||i.sliceAliases===void 0)return;let s=i.sliceAliases,l=`$.rules[${o}].childSlices.sliceAliases`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } slice aliases"});return}let c=br(r.sliceFolders,r.sliceIdentity),d=[...Array.isArray(r.sliceFolders)?r.sliceFolders:[],...Array.isArray(i.sliceFolders)?i.sliceFolders:[]].filter(p=>typeof p=="string"&&p.length>0),f=[];s.forEach((p,m)=>{let h=`${l}[${m}]`;if(!I(p)){e.push({path:h,message:"must be an object with from and to"});return}for(let y of Object.keys(p))y!=="from"&&y!=="to"&&y!=="pinned"&&y!=="reason"&&e.push({path:fe(h,y),message:"unknown field"});let S=p.from,u=p.to;if(typeof S!="string"||S.trim().length===0)e.push({path:`${h}.from`,message:"must be a non-empty path glob"});else{let y=vr(S);if(y)e.push({path:`${h}.from`,message:y});else{let g=hr(mr(S));d.some(v=>Ir(g,v))&&e.push({path:`${h}.from`,message:pr});for(let v of f)if(kr(v,g)){e.push({path:h,message:gr});break}f.push(g)}}if(typeof u!="string"||u.trim().length===0)e.push({path:`${h}.to`,message:M});else{let y=Ar(u,c);y&&e.push({path:`${h}.to`,message:y})}})})}_chunkA5EIY3HIcjs.a.call(void 0, Rr,"validateChildSliceAliases");function pe(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, pe,"isObject");function F(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}_chunkA5EIY3HIcjs.a.call(void 0, F,"propertyPath");function L(t){return t===null?"null":Array.isArray(t)?"array":typeof t}_chunkA5EIY3HIcjs.a.call(void 0, L,"valueType");function Pr(t,e){let n="#/$defs/";if(t.startsWith(n))return e.$defs[t.slice(n.length)]}_chunkA5EIY3HIcjs.a.call(void 0, Pr,"resolveSchemaRef");function _(t,e,n,r,o){if(e.$ref){let i=Pr(e.$ref,r);if(!i){o.push({path:n,message:`schema reference ${e.$ref} cannot be resolved`});return}_(t,i,n,r,o);return}if(e.const!==void 0&&!Object.is(t,e.const)){o.push({path:n,message:`must equal ${JSON.stringify(e.const)}`});return}if(e.enum&&!e.enum.some(i=>Object.is(i,t))){o.push({path:n,message:`must be one of ${e.enum.map(String).join(", ")}`});return}if(e.type==="object"){if(!pe(t)){o.push({path:n,message:`must be an object; received ${L(t)}`});return}let i=_nullishCoalesce(e.properties, () => ({}));for(let s of _nullishCoalesce(e.required, () => ([])))t[s]===void 0&&o.push({path:F(n,s),message:"is required"});if(e.additionalProperties===!1)for(let s of Object.keys(t))s in i||o.push({path:F(n,s),message:"unknown field"});else if(e.additionalProperties!==void 0&&e.additionalProperties!==!0&&typeof e.additionalProperties=="object"){let s=e.additionalProperties;for(let l of Object.keys(t))l in i||_(t[l],s,F(n,l),r,o)}for(let[s,l]of Object.entries(i))t[s]!==void 0&&_(t[s],l,F(n,s),r,o);return}if(e.type==="array"){if(!Array.isArray(t)){o.push({path:n,message:`must be an array; received ${L(t)}`});return}if(e.minItems!==void 0&&t.length<e.minItems&&o.push({path:n,message:`must contain at least ${e.minItems} item(s)`}),e.uniqueItems){let i=t.map(s=>JSON.stringify(s));new Set(i).size!==i.length&&o.push({path:n,message:"must not contain duplicate items"})}e.items&&t.forEach((i,s)=>_(i,e.items,`${n}[${s}]`,r,o));return}if(e.type==="string"){if(typeof t!="string"){o.push({path:n,message:`must be a string; received ${L(t)}`});return}e.minLength!==void 0&&t.length<e.minLength&&o.push({path:n,message:`must contain at least ${e.minLength} character(s)`});return}if(e.type==="boolean"){typeof t!="boolean"&&o.push({path:n,message:`must be a boolean; received ${L(t)}`});return}if(e.type==="integer"){if(!Number.isInteger(t)){o.push({path:n,message:`must be an integer; received ${L(t)}`});return}e.minimum!==void 0&&t<e.minimum&&o.push({path:n,message:`must be at least ${e.minimum}`})}}_chunkA5EIY3HIcjs.a.call(void 0, _,"validateSchemaNode");function ge(t){if(typeof t!="string")return null;let e=t.trim().replace(/^@/,"").toLowerCase();return e.length>0?e:null}_chunkA5EIY3HIcjs.a.call(void 0, ge,"normalizeStewardId");function qt(t){let e=ge(t);return!e||Oe(e)||e.includes(" ")||e.includes("@")?!1:/^(?!-)[a-z0-9-]{1,39}(?<!-)$/.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, qt,"isGitHubHandle");function Cr(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();if(!e.includes("@")||e.includes(" ")||Oe(e))return!1;let n=e.split("@");if(n.length!==2||!n[0]||/\s/.test(e))return!1;let r=n[1].lastIndexOf(".");return r>0&&r<n[1].length-1}_chunkA5EIY3HIcjs.a.call(void 0, Cr,"isGitHubEmail");function xr(t){if(typeof t!="string")return null;let e=t.trim().match(/^(?:\d+\+)?([^@]+)@users\.noreply\.github\.com$/i);return e&&qt(e[1])?ge(e[1]):null}_chunkA5EIY3HIcjs.a.call(void 0, xr,"githubHandleFromEmail");function zt(t){let e=xr(t);if(e)return e;let n=ge(t);return!n||Oe(n)?null:qt(n)||Cr(n)?n:null}_chunkA5EIY3HIcjs.a.call(void 0, zt,"canonicalStewardId");var Lr=/bot\b|\[bot\]|dependabot|renovate|github-actions|imgbot|codecov/i;function Oe(t){let e=ge(t);return!e||Lr.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, Oe,"isAutomationAuthor");var A="1.3",Or=["public","auth","admin","internal"];function $r(t){return _optionalChain([t, 'optionalAccess', _2 => _2.optional])===!0||_optionalChain([t, 'optionalAccess', _3 => _3.reserved])===!0||_optionalChain([t, 'optionalAccess', _4 => _4.allowEmpty])===!0}_chunkA5EIY3HIcjs.a.call(void 0, $r,"isFutureHouseLayer");function Dr(t){let e=t&&typeof t=="object"?t.owners:void 0;if(!Array.isArray(e)||e.length===0)return;let n=e.filter(r=>typeof r=="string"&&r.length>0);return n.length>0?n:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Dr,"layerOwnersList");function yi(t){return _optionalChain([t, 'optionalAccess', _5 => _5.requireLayerOwners])!==!0||!Array.isArray(t.layers)?[]:t.layers.filter(e=>!$r(e)&&!Dr(e)).map(e=>e.name)}_chunkA5EIY3HIcjs.a.call(void 0, yi,"layersMissingRequiredOwners");function Si(t){return`Add a GitHub handle or email to ${t}'s owners in ark.config.json (/ark-adopt).`}_chunkA5EIY3HIcjs.a.call(void 0, Si,"missingLayerOwnersNextAction");var me="https://unpkg.com/arkgate@4/schemas/ark.config.schema.json",Jt=["DomainModel","ApplicationOrchestration","PersistenceAdapters","IntegrationAdapters","WorkflowSagaEngine","BackgroundJobsScheduling","PresentationAdapters","ReportingReadModels","ExtensibilityMetadata","SecurityAuditObservability","Kernel"],Nr=new Set(["PresentationAdapters->ApplicationOrchestration","ApplicationOrchestration->DomainModel","WorkflowSagaEngine->ApplicationOrchestration","WorkflowSagaEngine->DomainModel","BackgroundJobsScheduling->ApplicationOrchestration"]);function Tr(){let t=[];for(let e of Jt)for(let n of Jt)e===n||Nr.has(`${e}->${n}`)||t.push({from:e,to:n,allowed:!1});return t}_chunkA5EIY3HIcjs.a.call(void 0, Tr,"createDefaultRules");var he=Tr(),$e=[{from:"unversioned",to:"1.0"},{from:"1.0",to:"1.1"},{from:"1.1",to:"1.2"},{from:"1.2",to:"1.3"}],b={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Yt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:me,title:"ArkGate architecture contract",description:"Versioned contract consumed identically by ArkGate CLI, MCP, and ESLint surfaces.",type:"object",additionalProperties:!1,required:["$schema","schemaVersion","include","layers","rules"],properties:{$schema:{type:"string",minLength:1,default:me,description:"Editor-facing URL or local path for this JSON Schema."},schemaVersion:{type:"string",const:A,default:A},name:{type:"string",minLength:1},include:{...b,minItems:1,default:["src"]},exclude:{...b,default:[]},excludeGenerated:{type:"boolean",default:!0},frameworkOverlay:{type:"string",minLength:1},layers:{type:"array",default:[],items:{$ref:"#/$defs/layer"}},rules:{type:"array",default:he,items:{$ref:"#/$defs/rule"}},cyclePolicy:{type:"string",enum:["strict","soft","framework-soft","off"],default:"strict"},dynamicImportAllowlist:{...b,default:[]},safety:{$ref:"#/$defs/safety",default:{maxTsSuppressions:0,maxAnyCasts:0,allowInMemory:!1,allowDisabledPeerIsolation:!1}},coverage:{$ref:"#/$defs/coverage"},arkRules:{type:"object",additionalProperties:{description:"A project-relative ArkRules path, or a list of paths merged into one catalog for this layer. A string keeps today's behaviour. An older build that types this value as a string rejects an array at config load.",oneOf:[{type:"string",minLength:1},{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",minLength:1}}]},default:{}},arkRun:{$ref:"#/$defs/arkRun"},arkOrder:{$ref:"#/$defs/arkOrder"},stewards:{...b,default:[]},requireLayerOwners:{type:"boolean"}},$defs:{layer:{type:"object",additionalProperties:!1,required:["name","patterns"],properties:{name:{type:"string",minLength:1},patterns:{...b,minItems:1},exclude:b,intentPrefixes:b,description:{type:"string",minLength:1},trustBoundary:{type:"string",enum:[...Or]},owners:{...b,minItems:1},forbiddenGlobals:b,capabilities:{type:"object",additionalProperties:!1,properties:{deny:{type:"array",uniqueItems:!0,items:{type:"string",enum:["network","filesystem","clock","randomness","environment","process","persistence"]}}}},pure:{type:"boolean"},mayImportInfrastructure:{type:"boolean"},optional:{type:"boolean"},reserved:{type:"boolean"},allowEmpty:{type:"boolean"}}},rule:{type:"object",additionalProperties:!1,required:["from","to","allowed"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},allowed:{type:"boolean"},message:{type:"string",minLength:1},peerIsolation:{type:"boolean"},sliceFolders:{...b,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"],description:"How a starred sliceFolders prefix is named. Absent and path keep today's ids (every literal and star binding). stars keeps the last literal plus every star binding (a star before the last literal is kept too), so parallel trees share one feature id. Bare names are unchanged."},sharedRoots:{...b,minItems:1},allowedCrossSlice:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}},sharedImportsSlice:Ht,childSlices:Kt}},safety:{type:"object",additionalProperties:!1,properties:{maxTsSuppressions:{type:"integer",minimum:0,default:0},maxAnyCasts:{type:"integer",minimum:0,default:0},allowInMemory:{type:"boolean",default:!1},allowDisabledPeerIsolation:{type:"boolean",default:!1}}},coverage:{type:"object",additionalProperties:!1,description:"Invariant coverage scan controls. testGlobs replaces the built-in test-name heuristic; maxFiles raises or lowers the evidence file budget and also bounds structural-hint preload for orchestration-only, thin-adapter, and writes-via-aggregate (default 400; there is no arkrules.hintBudget); coverageRoots declares where the project runs its tests, so a covering test found outside them is reported instead of silently certifying an invariant. When any invariant is enforced, missing coverageRoots fails closed.",properties:{testGlobs:{...b,minItems:1},maxFiles:{type:"integer",minimum:1,description:"Evidence file budget (default 400) and structural-hint preload cap for orchestration-only, thin-adapter, and writes-via-aggregate. Raise this when hinted/governed counts show truncated sensors. There is no separate arkrules.hintBudget."},coverageRoots:{...b,minItems:1}}},arkRun:xt,arkOrder:Lt}},R=class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"ArkConfigValidationError")}constructor(e,n){super(`Invalid ArkGate config (${e}):
2
2
  ${n.map(r=>`- ${r.path}: ${r.message}`).join(`
3
3
  `)}`),this.name="ArkConfigValidationError",this.source=e,this.issues=n}};function Mr(t,e){let n=t.arkRules;if(!(n===void 0||!pe(n)))for(let[r,o]of Object.entries(n)){let i=F("$.arkRules",r);if(typeof o=="string"){o.length===0&&e.push({path:i,message:"must be a non-empty relative path string"});continue}if(!Array.isArray(o)||o.length===0){e.push({path:i,message:"must be a non-empty path string or an array of paths"});continue}let s=new Set;o.forEach((l,c)=>{let d=`${i}[${c}]`;if(typeof l!="string"||l.length===0){e.push({path:d,message:"must be a non-empty relative path string"});return}s.has(l)&&e.push({path:d,message:"duplicate path"}),s.add(l)})}}_chunkA5EIY3HIcjs.a.call(void 0, Mr,"validateArkRulesRefs");function Fr(t,e){let n=t.layers;Array.isArray(n)&&n.forEach((r,o)=>{if(!r||typeof r!="object"||Array.isArray(r)||!("owners"in r))return;let i=r.owners;Array.isArray(i)&&i.forEach((s,l)=>{typeof s=="string"&&(zt(s)||e.push({path:`$.layers[${o}].owners[${l}]`,message:"must be a GitHub handle or email (not a display name)"}))})})}_chunkA5EIY3HIcjs.a.call(void 0, Fr,"validateLayerOwners");function _r(t){let e={...t,$schema:t.$schema===void 0?me:t.$schema,schemaVersion:t.schemaVersion===void 0?A:t.schemaVersion,include:t.include===void 0?["src"]:t.include,layers:t.layers===void 0?[]:t.layers,rules:t.rules===void 0?he.map(n=>({...n})):t.rules};return t.arkRun!==void 0&&(e.arkRun=Ot(t.arkRun)),t.arkOrder!==void 0&&(e.arkOrder=$t(t.arkOrder)),e}_chunkA5EIY3HIcjs.a.call(void 0, _r,"defaultedConfig");function Br(t){return t===A?null:t==="unversioned"?"unversioned":t==="1.0"||t==="1.1"||t==="1.2"?t:null}_chunkA5EIY3HIcjs.a.call(void 0, Br,"migratedFromOf");function jr(){let t=new Set([A]);for(let e of $e)e.from!=="unversioned"&&t.add(e.from),t.add(e.to);return t}_chunkA5EIY3HIcjs.a.call(void 0, jr,"knownInputVersions");function Gr(t,e="ark.config.json"){if(!pe(t))throw new R(e,[{path:"$",message:`must be an object; received ${L(t)}`}]);let n=jr(),r=t.schemaVersion===void 0?"unversioned":typeof t.schemaVersion=="string"?t.schemaVersion:null;if(r===null)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(t.schemaVersion)}; expected ${A}`}]);if(r!=="unversioned"&&!n.has(r))throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(r)}; expected ${A}`}]);let o=r,i={...t},s=0;for(;o!==A&&s<$e.length+1;){s+=1;let l=$e.find(c=>c.from===o);if(!l)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(o)}; expected ${A}`}]);o=l.to,i.schemaVersion=o}if(o!==A)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(r)}; expected ${A}`}]);return{candidate:_r(i),migratedFrom:Br(r)}}_chunkA5EIY3HIcjs.a.call(void 0, Gr,"migrateArkConfig");function Hr(t,e="ark.config.json"){let{candidate:n,migratedFrom:r}=Gr(t,e),o=[];if(_(n,Yt,"$",Yt,o),Nt(n,o),Tt(n,o),Fr(n,o),Vt(n,o),Mr(n,o),o.length>0)throw new R(e,o);return{config:n,migratedFrom:r}}_chunkA5EIY3HIcjs.a.call(void 0, Hr,"loadArkConfigContract");function wi(t,e="ark.config.json"){let n;try{n=JSON.parse(t)}catch(r){throw new R(e,[{path:"$",message:`invalid JSON: ${r instanceof Error?r.message:String(r)}`}])}return Hr(n,e)}_chunkA5EIY3HIcjs.a.call(void 0, wi,"parseArkConfigJson");function Xt(t){let e={$schema:typeof t.$schema=="string"&&t.$schema.length>0?t.$schema:me,schemaVersion:A};for(let[n,r]of Object.entries(t))n!=="$schema"&&n!=="schemaVersion"&&(e[n]=r);return e}_chunkA5EIY3HIcjs.a.call(void 0, Xt,"withArkConfigMetadata");var Zt={RAW_EVENT_PUBLISH:"Publish through a registered intent creator; raw event objects or intent strings bypass Ark contracts and tooling.",PUBLISH_MISSING_SOURCE:"Strict Ark publish calls must include metadata.source."},Kr= exports.f =Object.freeze([{layer:"DomainModel",prefixes:["Domain."]},{layer:"ApplicationOrchestration",prefixes:["Application."]},{layer:"PersistenceAdapters",prefixes:["Adapter.Persistence.","Adapter.Repository."]},{layer:"IntegrationAdapters",prefixes:["Adapter.Integration.","Adapter.External."]},{layer:"WorkflowSagaEngine",prefixes:["Workflow."]},{layer:"BackgroundJobsScheduling",prefixes:["Job."]},{layer:"PresentationAdapters",prefixes:["Presentation.","Adapter.Presentation.","Adapter.Api."]},{layer:"ReportingReadModels",prefixes:["Reporting."]},{layer:"ExtensibilityMetadata",prefixes:["Metadata."]},{layer:"SecurityAuditObservability",prefixes:["Security.","Audit.","Observability."]},{layer:"Kernel",prefixes:["Kernel."]}]);function De(t){let e=(_nullishCoalesce(t.intentPrefixes, () => ([]))).filter(n=>n.trim().length>0);return e.length>0?e:_nullishCoalesce(_optionalChain([Kr, 'access', _6 => _6.find, 'call', _7 => _7(n=>n.layer===t.name), 'optionalAccess', _8 => _8.prefixes]), () => ([]))}_chunkA5EIY3HIcjs.a.call(void 0, De,"effectiveIntentPrefixes");function Qt(t){let e=new Set(t.layers.filter(r=>De(r).length>0).map(r=>r.name)),n=new Set;for(let r of _nullishCoalesce(t.rules, () => ([])))if(!(r.allowed!==!1||r.peerIsolation===!0))for(let o of[r.from,r.to])e.has(o)||n.add(o);return[...n].sort()}_chunkA5EIY3HIcjs.a.call(void 0, Qt,"unresolvableLayerFlowLayers");function bi(t,e){return _optionalChain([e, 'access', _9 => _9.flatMap, 'call', _10 => _10((r,o)=>(_nullishCoalesce(_nullishCoalesce(r.prefixes, () => (r.intentPrefixes)), () => ([]))).map(i=>({layer:r.name,layerIndex:o,prefix:i.endsWith(".")?i:`${i}.`}))), 'access', _11 => _11.filter, 'call', _12 => _12(({prefix:r})=>t.startsWith(r)), 'access', _13 => _13.sort, 'call', _14 => _14((r,o)=>o.prefix.length-r.prefix.length||r.layerIndex-o.layerIndex), 'access', _15 => _15[0], 'optionalAccess', _16 => _16.layer])}_chunkA5EIY3HIcjs.a.call(void 0, bi,"resolveIntentLayer");function Vr(t){return/^(Domain|Application|Adapter|Workflow|Job|Presentation|Reporting|Metadata|Security|Audit|Observability|Kernel)\.[A-Za-z0-9_.]+$/.test(t)}_chunkA5EIY3HIcjs.a.call(void 0, Vr,"looksLikeArkIntent");function Ai(t){if(!t.publishCall)return[];let e=[];return(t.rawIntentName!==void 0&&Vr(t.rawIntentName)||t.objectHasIntent)&&e.push({ruleId:"RAW_EVENT_PUBLISH",message:Zt.RAW_EVENT_PUBLISH}),t.arkPublishCandidate&&!t.hasSource&&e.push({ruleId:"PUBLISH_MISSING_SOURCE",message:Zt.PUBLISH_MISSING_SOURCE}),e}_chunkA5EIY3HIcjs.a.call(void 0, Ai,"classifyPublishFacts");function Wr(t){return t.endsWith(".")?t:`${t}.`}_chunkA5EIY3HIcjs.a.call(void 0, Wr,"normalizePrefix");function Ur(t,e){let n=t.prefixes.length?Math.max(...t.prefixes.map(o=>o.length)):0;return(e.prefixes.length?Math.max(...e.prefixes.map(o=>o.length)):0)-n}_chunkA5EIY3HIcjs.a.call(void 0, Ur,"byLongestPrefix");function Ne(t){let e=t.layers.map(o=>({...o,prefixes:o.prefixes.map(Wr)})),n=[...e].sort(Ur),r=[..._nullishCoalesce(t.rules, () => ([]))];return{name:t.name,layers:e,rules:r,resolveLayer(o){return _nullishCoalesce(_optionalChain([e, 'access', _17 => _17.find, 'call', _18 => _18(i=>_optionalChain([i, 'access', _19 => _19.match, 'optionalCall', _20 => _20(o)])), 'optionalAccess', _21 => _21.name]), () => (_optionalChain([n, 'access', _22 => _22.find, 'call', _23 => _23(i=>i.prefixes.some(s=>o.startsWith(s))), 'optionalAccess', _24 => _24.name])))}}}_chunkA5EIY3HIcjs.a.call(void 0, Ne,"createArchitectureProfile");function Te(t,e={}){return Ne({name:_nullishCoalesce(_nullishCoalesce(e.name, () => (t.name)), () => ("ark.config.json")),layers:t.layers.map((n,r)=>({name:n.name,prefixes:[...De(n)],description:n.description,trustBoundary:n.trustBoundary,owners:n.owners,order:r+1})),rules:_nullishCoalesce(t.rules, () => ([]))})}_chunkA5EIY3HIcjs.a.call(void 0, Te,"createArchitectureProfileFromArkConfig");var qr=[{name:"DomainModel",prefixes:["Domain"],description:"Rich domain model, business rules, and domain events.",order:1},{name:"ApplicationOrchestration",prefixes:["Application"],description:"Use cases and command orchestration.",order:2},{name:"PersistenceAdapters",prefixes:["Adapter.Persistence","Adapter.Repository"],description:"Database, repository, and storage adapters.",order:3},{name:"IntegrationAdapters",prefixes:["Adapter.Integration","Adapter.External"],description:"External systems, APIs, and integration adapters.",order:4},{name:"WorkflowSagaEngine",prefixes:["Workflow"],description:"Sagas, workflows, and long-running processes.",order:5},{name:"BackgroundJobsScheduling",prefixes:["Job"],description:"Background jobs, scheduled work, and async processors.",order:6},{name:"PresentationAdapters",prefixes:["Presentation","Adapter.Presentation","Adapter.Api"],description:"API, UI, controller, and presentation adapters.",order:7},{name:"ReportingReadModels",prefixes:["Reporting"],description:"Read models, projections, and reporting surfaces.",order:8},{name:"ExtensibilityMetadata",prefixes:["Metadata"],description:"Metadata, extensions, and schema contracts.",order:9},{name:"SecurityAuditObservability",prefixes:["Security","Audit","Observability"],description:"Security, audit, and observability concerns.",order:10},{name:"Kernel",prefixes:["Kernel"],description:"Ark-owned governance and kernel signals.",order:11}],Y= exports.l =Ne({name:"Ark 11-layer Hexagonal Event-Driven Profile",layers:qr,rules:he.map(t=>({...t}))}),zr={DomainModel:["domain"],ApplicationOrchestration:["application","app"],PersistenceAdapters:["adapters/persistence","adapters/repository","repositories","infra/persistence"],IntegrationAdapters:["adapters/integration","adapters/external","integrations"],WorkflowSagaEngine:["workflows","sagas"],BackgroundJobsScheduling:["jobs","schedules"],PresentationAdapters:["presentation","adapters/presentation","adapters/api"],ReportingReadModels:["reporting","read-models","projections"],ExtensibilityMetadata:["metadata","extensions"],SecurityAuditObservability:["security","audit","observability"],Kernel:["kernel"]};function Jr(t={}){let e=_nullishCoalesce(t.rootDir, () => ("src")),n=_nullishCoalesce(t.optionalLayers, () => (!0)),r=e==="."?"":`${e}/`;return Xt({include:_nullishCoalesce(t.include, () => ([e])),layers:Y.layers.map(o=>({name:o.name,patterns:(_nullishCoalesce(zr[o.name], () => ([o.name]))).map(i=>`${r}${i}/**`),intentPrefixes:o.prefixes,optional:n})),rules:[...Y.rules]})}_chunkA5EIY3HIcjs.a.call(void 0, Jr,"createElevenLayerArkConfig");var X= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this); }static{_chunkA5EIY3HIcjs.a.call(void 0, this,"IntentRegistry")}__init() {this.intents=new Map}__init2() {this.dependencies=new Map}__init3() {this.productions=new Map}define(e,n){if(this.intents.has(e))throw new Error(`Intent "${e}" is already registered. Intent names must be unique within a registry.`);let r=_chunkA5EIY3HIcjs.a.call(void 0, i=>({intent:e,payload:i,metadata:{occurredAt:new Date().toISOString(),source:"unknown"}}),"fn");Object.defineProperty(r,"name",{value:e,enumerable:!0,configurable:!1,writable:!1});let o=r;if(this.intents.set(e,o),_optionalChain([n, 'optionalAccess', _25 => _25.dependsOn]))for(let i of n.dependsOn)this.declareDependency(e,i);if(_optionalChain([n, 'optionalAccess', _26 => _26.produces]))for(let i of n.produces)this.declareProduction(e,i);return o}declareDependency(e,n){this.dependencies.has(e)||this.dependencies.set(e,new Set),this.dependencies.get(e).add(n)}declareProduction(e,n){this.productions.has(e)||this.productions.set(e,new Set),this.productions.get(e).add(n)}get(e){return this.intents.get(e)}list(){return Array.from(this.intents.values())}getDependencies(e){let n=this.dependencies.get(e);return n?Array.from(n):[]}getProductions(e){let n=this.productions.get(e);return n?Array.from(n):[]}getAllRelationships(){let e=[];for(let[n,r]of this.dependencies.entries())for(let o of r)e.push({from:n,to:o,kind:"dependsOn"});for(let[n,r]of this.productions.entries())for(let o of r)e.push({from:n,to:o,kind:"produces"});return e}has(e){return this.intents.has(e)}clear(){this.intents.clear(),this.dependencies.clear(),this.productions.clear()}}, _class);var en=new X;function Yr(t,e){return en.define(t,e)}_chunkA5EIY3HIcjs.a.call(void 0, Yr,"defineIntent");function Me(){return new X}_chunkA5EIY3HIcjs.a.call(void 0, Me,"createIntentRegistry");var Xr=en;var tn=["Domain.","Application.","Adapter.","Workflow.","Job.","Presentation.","Reporting.","Metadata.","Security.","Audit.","Observability.","Kernel."];function Fe(t){if(!t||typeof t!="string")return{valid:!1,reason:"Intent name must be a non-empty string"};if(!tn.some(n=>t.startsWith(n)))return{valid:!1,reason:`Intent "${t}" must start with one of: ${tn.join(", ")}`};let e=t.slice(t.indexOf(".")+1);return!e||!/^[A-Za-z][A-Za-z0-9_.]*$/.test(e)?{valid:!1,reason:`Intent "${t}" has an invalid segment after the layer prefix`}:{valid:!0}}_chunkA5EIY3HIcjs.a.call(void 0, Fe,"validateIntentName");var O=class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"PolicyViolationError")}constructor(e){let n=e.map(r=>`- ${r.policyName}: ${r.message}`).join(`
4
4
  `);super(`Hard policy violation(s) detected: