Co-authored-by: coder3 <[email protected]>
This commit was merged in pull request #1195.
This commit is contained in:
@@ -154,12 +154,25 @@ export function matchesAny(globs: readonly string[], relPath: string): boolean {
|
||||
return globs.some((g) => matchGlob(g, relPath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Operator entries without wildcards are exact file carve-outs. Treating them
|
||||
* as directory prefixes would let one bare entry hide an entire framework
|
||||
* subtree from reconciliation and drift detection. Operator subtree ownership
|
||||
* remains explicit through `dir/**`.
|
||||
*/
|
||||
function matchesOperatorGlob(glob: string, relPath: string): boolean {
|
||||
const pattern = normalizeRel(glob);
|
||||
if (pattern === '') return false;
|
||||
if (!pattern.includes('*')) return normalizeRel(relPath) === pattern;
|
||||
return matchGlob(pattern, relPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve ownership of a mosaic-home-relative path (deny-wins / fail-safe):
|
||||
* operator globs win, then framework globs, else operator by default.
|
||||
*/
|
||||
export function resolveOwnership(manifest: FrameworkManifest, relPath: string): Ownership {
|
||||
if (matchesAny(manifest.operator, relPath)) return 'operator';
|
||||
if (manifest.operator.some((glob) => matchesOperatorGlob(glob, relPath))) return 'operator';
|
||||
if (matchesAny(manifest.framework, relPath)) return 'framework';
|
||||
return 'operator';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user