mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-02 07:47:58 +00:00
Rename env/static.env → env/default.env across the entire repo
(string label, doc links, Python file-path constants) — the
`parse_static_env*` function names stay as a stable API surface.
Sort all `*.env` / `*.env.j2` entries alphabetically (52 in
default.env, 4 in ci.env, 46 of 49 j2 templates; 3 templates
with Jinja2 `{% %}` control flow are skipped because conditional
blocks would tear apart under a naive sort). Sort all 83
Makefile target blocks alphabetically; .PHONY group headers
stay in place.
Collapse the two remaining multi-line Makefile recipe comments
(dotenv-force, test-signed) to single-line WHY comments.
Add four lint tests under tests/lint/filesystem/ to keep the
invariants enforced going forward:
- env/test_alphabetical_sort.py
- env/test_single_line_comments.py (# nocheck: markers exempt)
- makefile/test_alphabetical_targets.py
- makefile/test_single_line_comments.py (# nocheck: markers exempt)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
885 B
Python
34 lines
885 B
Python
"""CLI entry: `python -m cli.meta.env` (also `make dotenv`)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
from utils.env.builder import build_env
|
|
from utils.env.parser import parse_static_env_with_comments
|
|
from utils.env.writer import write_dotenv
|
|
|
|
from . import PROJECT_ROOT as REPO_ROOT
|
|
|
|
|
|
def main() -> int:
|
|
static_path = REPO_ROOT / "env" / "default.env"
|
|
out_path = REPO_ROOT / ".env"
|
|
|
|
if not static_path.is_file():
|
|
print(f"ERROR: missing {static_path}", file=sys.stderr)
|
|
return 2
|
|
|
|
static, static_comments = parse_static_env_with_comments(static_path)
|
|
eb = build_env(static, repo_root=REPO_ROOT, comments=static_comments)
|
|
write_dotenv(eb, out_path)
|
|
print(
|
|
f"Wrote {out_path.relative_to(REPO_ROOT)} ({len(eb.values)} variables)",
|
|
file=sys.stderr,
|
|
)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|