Documentation
¶
Overview ¶
Package countgen derives the library's count-bearing numbers from the tree and writes them into the three count-bearing docs (FEATURES.md, skill/SKILL.md, README.md).
WHY THIS EXISTS: every component addition forced a hand-typed same-commit count bump in FEATURES/SKILL (TODO #996) — the tax this generator deletes. Run `go run ./tools/countgen/cmd/countgen -w` after any change that moves a count; commit the diff in the same commit as the source change.
INDEPENDENT VERIFIER: utils.TestDocsCountDrift re-derives every count with its own implementation and asserts the docs directly — it is deliberately NOT this package's code, so the two layers cross-check each other. If they ever disagree, CI goes red and the reconciliation is the signal.
DELIBERATELY NOT DERIVED (no mechanical source; semantics owned by docs/count-definitions.md):
- the enums TOTAL ("74 typed enums") — "exported closed-set string types" is a semantic judgment; only the IsValid count is mechanical;
- the FEATURES.md `utils` row ("0"): utils owns no components by definition, yet utils/dismiss.templ exports a helper templ function — a mechanical count would print 1 against a deliberate 0;
- "~31,500 lines of Go/templ source" and "in 5 packages" prose counts;
- the "8 components accept ContainerAware" figure (ADR-0018 lookup-map semantics).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply rewrites both docs to match the tree, returning the changed file names.
Every site location was captured against the ORIGINAL doc bytes, so the replacements splice into a working copy from the end of the file backwards — applying them in site order would invalidate later offsets, and building each replacement from the pristine content (the 2026-11-02 shape) silently dropped all but the last drifted site per file.
Types ¶
type Counts ¶
type Counts struct {
Components int // exported templ funcs across the 9 counted packages
PackageCounts map[string]int // per package (counted 9 + icons + recipes)
Recipes int // recipes/*.templ exported screens
ComponentsPlusRecipes int // Components + Recipes
Icons int // iconPathData entries + Spinner
IsValid int // <Name>IsValid( declarations, library source
GeneratedFiles int // *_templ.go files (website excluded)
HTMLGoldens int // committed .golden baselines (visualtest/website excluded)
VisualGoldens int // visualtest/testdata .png goldens
ErrorpageConstructors int // exported constructors in errorpage/constructors.go
}
Counts holds every number countgen derives from the tree.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
countgen
command
Command countgen keeps the count-bearing tables in FEATURES.md and skill/SKILL.md derived from the tree instead of hand-typed.
|
Command countgen keeps the count-bearing tables in FEATURES.md and skill/SKILL.md derived from the tree instead of hand-typed. |