_managed¶
rhiza_hooks._managed
¶
Work out which paths in this repo are owned by the template, not by the project.
A rhiza-managed repo syncs its development infrastructure from a template repo.
.rhiza/template.lock records what the last sync wrote, and
.rhiza/template.yml records what the project deliberately opted out of. The
set of template-owned paths is the first minus the second, and it is the answer
several hooks need: editing such a path is pointless (the next sync overwrites
it), and pointing release tooling at one is actively harmful.
The subtraction is not optional. The lock's files: block lists every path the
profile would deliver including ones the project excludes — and the lock's own
exclude: key does not mirror template.yml's (it is [] in a repo with two
active exclusions). So template.yml is the only reliable source for the opt-outs,
and a caller that trusted files: alone would flag files the project legitimately
owns.
managed_paths(repo_root)
¶
Return the repo-relative paths the template owns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_root
|
Path
|
Root directory of the repository. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Paths listed in |
set[str]
|
the project excludes in |
set[str]
|
missing or unusable — a repo that is managed but not yet synced owns |
set[str]
|
everything, so callers then have nothing to enforce. |
Source code in rhiza_hooks/_managed.py
template_repository(repo_root)
¶
Return the template repository recorded by the last sync, e.g. owner/repo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_root
|
Path
|
Root directory of the repository. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The lock's |
str | None
|
record one. Callers use it to name where a managed file should be changed |
str | None
|
instead; the lock maps no file to its originating bundle, so the |
str | None
|
repository is as specific as this can get. |