| 87 | `${scope}:${scope === "realm" ? realm : niche}:${family}`; |
| 88 | |
| 89 | const targetForOverride = (file, targets) => { |
| 90 | const stem = basename(file, extname(file)); |
| 91 | const family = FAMILY_KINDS.find((kind) => stem.endsWith(`-${kind}`)); |
| 92 | if (!family) return null; |
| 93 | |
| 94 | const niche = stem.slice(0, -(family.length + 1)); |
| 95 | const district = targets.find((target) => target.niche === niche); |
| 96 | if (!district) { |
| 97 | return { error: `${basename(file)} names an unknown district "${niche}"` }; |
| 98 | } |
| 99 | if (!district.families.includes(family)) { |
| 100 | return { |
| 101 | error: `${family} is not unlocked in ${niche} at level ${district.level}`, |
| 102 | }; |
| 103 | } |
| 104 | |
| 105 | return { scope: "district", ...district, family }; |
| 106 | }; |
| 107 | |
| 108 | const realmForFile = (file) => { |
| 109 | const stem = basename(file, extname(file)); |