Expand description
Lifecycle phases — a repo’s build/dev commands as configurable DATA, not
hard-coded match arms (#880).
A fixed, extensible vocabulary of phase names (Phase) — setup, format,
lint, test, check, clean — each mapped to a single command. The
mapping is resolved:
- the repo’s
[lifecycle]table in.newt/config.toml(project-local, tracked — the repo declares its ownjust clean/just test/ …), published once viaset_lifecycle_override; - else the matching tooling packs — per-ecosystem defaults as data
(built-in +
~/.newt/tooling/*.tomldrop-ins), the sibling of the language-pack model. A polyglot repo matches SEVERAL; an unknown one NONE.
The crew consumes format (its normalize-before-commit step) today; the other
phases are declared-and-available for newt lifecycle <phase> and future
wiring. Adding/removing a phase name is a small, deliberate code change — the
set is intentionally hard-coded (a stable vocabulary), while the commands
are data.
Structs§
- Phase
Commands - A per-phase command map — used both as a pack’s default commands (
[phases]) and as the repo’s[lifecycle]override. Every field optional (an unset phase falls through to the next source). - Tooling
Pack - A toolchain’s lifecycle commands, as data. Selected for a repo when ANY of its
detectmarker files exists at the repo root.
Enums§
- Phase
- The fixed lifecycle-phase vocabulary. Extend deliberately in a future build.
Functions§
- builtin_
tooling_ packs - The built-in tooling packs — worked examples a contributor copies into a
~/.newt/tooling/<name>.tomldrop-in. Override any by name; add new ones. - load_
tooling_ packs_ from_ dir - Load tooling packs from a drop-in dir (
<dir>/*.toml, one per file). Malformed files are skipped with a warning; a missing dir →[]. (The tolerant drop-in contract shared with the language-pack /[backends]dirs.) - merge_
tooling_ packs - Merge pack layers by name — later layers win (built-ins < drop-in dir).
- phase_
commands_ from_ packs - Every
phasecommand from the packs whosedetectmarkers exist inrepo_dir, in pack order. None matching → empty; several → each matching toolchain’s command (a polyglot repo). Pure. - resolved_
phase_ commands - The resolved commands for
phaseinrepo_dir: the repo[lifecycle].<phase>override (a single command) wins; else every matching tooling pack’s default (built-in merged under~/.newt/tooling/). Configuration over Convention; empty = nothing declared for this phase. - set_
lifecycle_ override - Publish the repo
[lifecycle]table (fromConfig::resolve), once.