Sectors
A sector is a piece of code that moves through the campaign as one, such as a folder or a
file. You set a perimeter, and the campaign finds sectors in the code.
campaigns: billing-ddd: scope: src/** perimeter: marker: "**/context.ts"Perimeters
Section titled “Perimeters”| Perimeter | One sector per… | Sector name |
|---|---|---|
{ marker: <glob> } |
file matching the glob. The marker’s folder is the sector. | the folder, or the marker’s name |
{ glob: <glob> } |
match, such as src/components/*/ |
the matched path |
{ match, probes } |
detector match, at the holdout given (default declaration) |
file#declaration |
file |
file | the path without its extension |
nx |
Nx project, read from project.json files |
the project’s name |
-
marker: the marker may export asectorobject to set its name and claim files outside its folder (read, never run). Two markers with one name make one sector.export const sector = {name: "billing",owns: ["src/controllers/billing*", "src/services/billing/**"],}; -
match: match the sector in every shape, old and new, or it vanishes once migrated. At least onefiresprobe must be a finished sector (no objective fires on it), or the policy refuses to load. -
file: dropping the extension keepsa.jsanda.tsone sector.
The scope sector and legacy
Section titled “The scope sector and legacy”- With no
perimeter, the whole scope is one sector namedscope, as for a library swap. - Files in the scope that no sector claims form the
legacysector, which stays at the first phase. A holdout moved from a sector into legacy counts as new growth there. legacy: <globs>narrows which unclaimed files count as legacy. Unclaimed files outside it belong to no sector.- A file in two sectors (nested perimeters) fails
check. - Deleting a marker returns its folder to legacy, and the nudge says so.
The scope
Section titled “The scope”scope is the globs the campaign sees. { path, extensions } adds files the language pack
skips:
scope: { path: src/**, extensions: [.js, .jsx] }Only this campaign sees them. Objectives over files the pack can’t parse can use only path,
report or fn terms.
Sector terms
Section titled “Sector terms”These terms check a sector’s files together. Their objective sets holdout: sector.
| Term | Holds when |
|---|---|
has: <detector> |
at least one file in the sector matches, such as a migration or an integration test |
oneRoot: true |
every file sits under the sector’s root (co-located, as an endState needs) |
oneHost: <glob> |
every file matches the glob (the sector was moved whole) |
has-migration: holdout: sector sector: { has: { path: { file: "/migrations/.*\\.ts$" } } }Only the CLI reports sector terms; the editor rule reads their result from the ledger.