Fonds Module
Discovery, validation, scope, and sidecar symlink sync for the fonds/
workspace — stable resource pools (bibliographies, contacts, datasets),
distinct from projects/ (executable code).
Modules
| File |
Exports |
__init__.py |
FondInfo, build_fond_info, discover_fonds, resolve_fond_root, validate_fond_structure |
discovery.py |
discover_fonds, resolve_fond_root, NON_RENDERED_FOND_SUBDIRS, RENDERED_FOND_SUBDIRS |
fonds_info.py |
FondInfo, build_fond_info |
validation.py |
validate_fond_structure |
public_scope.py |
PUBLIC_FOND_NAMES, public_fond_infos, public_fond_names, public_fond_data_paths |
linking.py |
sync_private_fond_links, private_fonds_root, is_managed_symlink, LIFECYCLE_LINK_DIRS, LinkSyncResult |
Discovery and validation
from pathlib import Path
from infrastructure.fonds import discover_fonds, resolve_fond_root, validate_fond_structure, FondInfo
# Discover all valid fonds (skips working/, archive/)
fonds: list[FondInfo] = discover_fonds(Path("."))
for f in fonds:
print(f.qualified_name, f.fond_type, f.is_valid)
# Resolve by name
path = resolve_fond_root(Path("."), "templates/template_bibliography")
path = resolve_fond_root(Path("."), "template_bibliography") # bare name
# Validate structure (requires fonds.yaml + data/)
is_valid, message = validate_fond_structure(Path("fonds/templates/template_bibliography"))
FondInfo dataclass
from infrastructure.fonds import FondInfo, build_fond_info
info = build_fond_info(Path("fonds/templates/template_bibliography"))
info.name # "template_bibliography"
info.fond_type # "type" from fonds.yaml, or "generic"
info.has_data # True iff data/ exists
info.is_valid # True iff has_data
info.qualified_name # "template_bibliography" or "program/name"
Public scope
from infrastructure.fonds.public_scope import (
PUBLIC_FOND_NAMES, # ('templates/template_bibliography', ...)
public_fond_infos, # list[FondInfo] present in checkout
public_fond_names, # list[str] sorted
public_fond_data_paths, # list[Path] repo-relative data/ paths for CI scope
)
Sidecar sync
from pathlib import Path
from infrastructure.fonds.linking import (
sync_private_fond_links,
private_fonds_root,
is_managed_symlink,
LinkSyncResult,
)
root = private_fonds_root(Path(".")) # Path | None
result: LinkSyncResult = sync_private_fond_links(Path("."), dry_run=True)
print(result.summary())
# result.created / .updated / .removed / .skipped / .changed
CLI
uv run python -m infrastructure.fonds.linking --dry-run
uv run python -m infrastructure.fonds.linking
uv run python -m infrastructure.fonds.linking --no-prune
uv run python -m infrastructure.fonds.linking --private-root /path/to/fonds
Fond structure contract
| Path |
Required? |
fonds.yaml |
✅ manifest |
data/ |
✅ resource data |
manuscript/ |
optional |
scripts/ |
optional |
tests/ |
optional |
Discovery scope constants
from infrastructure.fonds.discovery import NON_RENDERED_FOND_SUBDIRS, RENDERED_FOND_SUBDIRS
# NON_RENDERED_FOND_SUBDIRS = frozenset({"working", "archive"})
# RENDERED_FOND_SUBDIRS = frozenset({"templates"})
Environment variables
| Variable |
Purpose |
TEMPLATE_FONDS_ROOT |
Override private fonds root (highest precedence) |
TEMPLATE_SKIP_FOND_LINK_SYNC |
Set to skip auto-sync in orchestration CLI |
Safety invariants (linking.py)
- Real directories and unmanaged symlinks are never touched.
PROTECTED_NAMES (public exemplars from PUBLIC_FOND_NAMES) are always skipped.
- No-op and no error when the private sidecar is absent.
See also
AGENTS.md — full operating contract, boundaries, lifecycle layout
../project/SKILL.md — canonical project-layer skill (same pattern)
1---2name: infrastructure-fonds3description: "Skill for the fonds module — discovery, validation, scope, and private-sidecar symlink sync for the top-level fonds/ directory (archival collection units such as bibliographies, contact registries, and dataset catalogs). Use when discovering fonds (discover_fonds), resolving a fond path (resolve_fond_root), validating fond structure (validate_fond_structure), building FondInfo dataclasses (build_fond_info), checking PUBLIC_FOND_NAMES for CI-safe scope (public_scope.py), syncing private lifecycle fonds into the template checkout (sync_private_fond_links / linking.py), checking whether a path is a managed fond symlink (is_managed_symlink), or adding new public fonds exemplars. Distinct from projects/ (executable research code); fonds are passive data stores requiring fonds.yaml + data/ (not src/ + tests/)."4metadata:5 source: https://skillmd.com/skills/docxology/infrastructure-fonds6---78# Fonds Module910Discovery, validation, scope, and sidecar symlink sync for the `fonds/`11workspace — stable resource pools (bibliographies, contacts, datasets),12distinct from `projects/` (executable code).1314## Modules1516| File | Exports |17|------|---------|18| `__init__.py` | `FondInfo`, `build_fond_info`, `discover_fonds`, `resolve_fond_root`, `validate_fond_structure` |19| `discovery.py` | `discover_fonds`, `resolve_fond_root`, `NON_RENDERED_FOND_SUBDIRS`, `RENDERED_FOND_SUBDIRS` |20| `fonds_info.py` | `FondInfo`, `build_fond_info` |21| `validation.py` | `validate_fond_structure` |22| `public_scope.py` | `PUBLIC_FOND_NAMES`, `public_fond_infos`, `public_fond_names`, `public_fond_data_paths` |23| `linking.py` | `sync_private_fond_links`, `private_fonds_root`, `is_managed_symlink`, `LIFECYCLE_LINK_DIRS`, `LinkSyncResult` |2425## Discovery and validation2627```python28from pathlib import Path29from infrastructure.fonds import discover_fonds, resolve_fond_root, validate_fond_structure, FondInfo3031# Discover all valid fonds (skips working/, archive/)32fonds: list[FondInfo] = discover_fonds(Path("."))33for f in fonds:34 print(f.qualified_name, f.fond_type, f.is_valid)3536# Resolve by name37path = resolve_fond_root(Path("."), "templates/template_bibliography")38path = resolve_fond_root(Path("."), "template_bibliography") # bare name3940# Validate structure (requires fonds.yaml + data/)41is_valid, message = validate_fond_structure(Path("fonds/templates/template_bibliography"))42```4344## FondInfo dataclass4546```python47from infrastructure.fonds import FondInfo, build_fond_info4849info = build_fond_info(Path("fonds/templates/template_bibliography"))50info.name # "template_bibliography"51info.fond_type # "type" from fonds.yaml, or "generic"52info.has_data # True iff data/ exists53info.is_valid # True iff has_data54info.qualified_name # "template_bibliography" or "program/name"55```5657## Public scope5859```python60from infrastructure.fonds.public_scope import (61 PUBLIC_FOND_NAMES, # ('templates/template_bibliography', ...)62 public_fond_infos, # list[FondInfo] present in checkout63 public_fond_names, # list[str] sorted64 public_fond_data_paths, # list[Path] repo-relative data/ paths for CI scope65)66```6768## Sidecar sync6970```python71from pathlib import Path72from infrastructure.fonds.linking import (73 sync_private_fond_links,74 private_fonds_root,75 is_managed_symlink,76 LinkSyncResult,77)7879root = private_fonds_root(Path(".")) # Path | None80result: LinkSyncResult = sync_private_fond_links(Path("."), dry_run=True)81print(result.summary())82# result.created / .updated / .removed / .skipped / .changed83```8485## CLI8687```bash88uv run python -m infrastructure.fonds.linking --dry-run89uv run python -m infrastructure.fonds.linking90uv run python -m infrastructure.fonds.linking --no-prune91uv run python -m infrastructure.fonds.linking --private-root /path/to/fonds92```9394## Fond structure contract9596| Path | Required? |97|------|-----------|98| `fonds.yaml` | ✅ manifest |99| `data/` | ✅ resource data |100| `manuscript/` | optional |101| `scripts/` | optional |102| `tests/` | optional |103104## Discovery scope constants105106```python107from infrastructure.fonds.discovery import NON_RENDERED_FOND_SUBDIRS, RENDERED_FOND_SUBDIRS108# NON_RENDERED_FOND_SUBDIRS = frozenset({"working", "archive"})109# RENDERED_FOND_SUBDIRS = frozenset({"templates"})110```111112## Environment variables113114| Variable | Purpose |115|----------|---------|116| `TEMPLATE_FONDS_ROOT` | Override private fonds root (highest precedence) |117| `TEMPLATE_SKIP_FOND_LINK_SYNC` | Set to skip auto-sync in orchestration CLI |118119## Safety invariants (linking.py)120121- Real directories and unmanaged symlinks are **never** touched.122- `PROTECTED_NAMES` (public exemplars from `PUBLIC_FOND_NAMES`) are always skipped.123- No-op and no error when the private sidecar is absent.124125## See also126127- [`AGENTS.md`](AGENTS.md) — full operating contract, boundaries, lifecycle layout128- [`../project/SKILL.md`](../project/SKILL.md) — canonical project-layer skill (same pattern)