diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-09 00:14:33 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-09 00:14:33 +0300 |
| commit | 756ae621bd97a8b776fefb15e5e7e2292f98ee45 (patch) | |
| tree | b454f958e6aef70bf7ca40dcbc106323cee2a42f /AGENTS.md | |
| parent | 3f8b79f2b1384e3abc2b1bb2fe913688c7ec251c (diff) | |
dependencies
Diffstat (limited to 'AGENTS.md')
| -rw-r--r-- | AGENTS.md | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -2,3 +2,21 @@ ## Resource Management All public functions which start with `Have` should be responsible for registering the resource they create. + +## Dependencies +Concrete resource types (e.g. `file.File`, `dir.Dir`, `link.Link`, `pkg.Package`) +embed `embed.DependsOn` to accumulate dependency IDs. The `DependsOn` option +records those IDs, and each `Present` function forwards them into +`resource.Register(..., x.DependsOn.IDs...)`. A `Multi` dependency is expanded +via `Dependencies()` so each member is depended upon individually, and +`repository.apply()` topologically sorts resources by their `dependsOn` set. + +## Shared embeds +State common to all concrete resource types lives in the `embed` package and is +embedded rather than redeclared: +- `embed.DependsOn` — dependency IDs (`IDs` field) plus the `AddDependency` method. +- `embed.Absence` — the `Absent` field plus the `SetAbsent` method (implements + `opt.Absentable`). + +When adding a field or capability shared by every resource type, prefer a new +embed type here instead of duplicating the field and its setter in each resource. |
