2026-02-05 21:12:06 -08:00
|
|
|
#!/usr/bin/env -S uv run --script
|
|
|
|
|
# /// script
|
|
|
|
|
# requires-python = ">=3.12"
|
C1: SHA-pin tooling dependencies (2026-04 cycle) (#344)
## Summary
Monthly tooling dependency refresh, with a one-time conversion from version-tag pins (`rev = "vX.Y.Z"`, `image:tag`, `>=`) to SHA / digest pins everywhere.
## Changes
- **prek hooks**: all `rev = "vX.Y.Z"` → commit SHA + `# vX.Y.Z` comment. Bumped trufflehog (3.94.0→3.95.2), kingfisher (1.91.0→1.97.0), ruff (0.15.7→0.15.12), shfmt (3.13.0→3.13.1), prettier (3.8.1→3.8.3), actionlint (1.7.11→1.7.12).
- **fly/Dockerfile**: tag pins → `image@sha256:...` digest pins. Bumped nginx (1.29.6→1.30.0-alpine), tailscale (v1.94.1→v1.94.2 — still inside the safe pre-1.96.5 range), alloy (v1.14.1→v1.16.0).
- **mise-tasks**: PEP 723 inline deps converted from `>=` to `==` (PEP 508 doesn't support hashes inline). All scripts pinned to current latest: rich 15.0.0, typer 0.25.0, pyyaml 6.0.3, httpx 0.28.1.
- **prek `additional_dependencies`**: ansible-lint==26.4.0, ansible-core==2.20.5.
- **taplo-lint**: pass `--no-schema`. Upstream's `--default-schema-catalogs` returns a format taplo v0.9.3 can't parse — we don't validate against TOML schemas anyway, so this turns off the broken catalog fetch.
- **docs/update-tooling-dependencies**: documents the SHA-pin convention, `docker buildx imagetools inspect` for digest lookup, and `prek clean` before re-verifying (cache grows to several GiB).
Forgejo workflow `actions/checkout@v6.0.2` was already at the latest SHA — no change.
## Test plan
- [x] `prek run --all-files` passes after `prek clean`
- [x] `deploy-fly` workflow builds and deploys the new fly image on merge
- [x] `fly status -a blumeops-proxy` healthy after deploy
- [x] Spot-check a few mise tasks (`mise run blumeops-tasks`, `mise run docs-check-links`) to confirm pinned deps resolve cleanly
Reviewed-on: https://forge.eblu.me/eblume/blumeops/pulls/344
2026-04-30 16:51:43 -07:00
|
|
|
# dependencies = ["rich==15.0.0", "typer==0.25.0"]
|
2026-02-05 21:12:06 -08:00
|
|
|
# ///
|
|
|
|
|
#MISE description="Report docs by git-last-modified date, highlighting stale ones"
|
2026-02-22 10:20:11 -08:00
|
|
|
#USAGE flag "--threshold <threshold>" default="180" help="Days before a doc is considered stale"
|
2026-02-05 21:12:06 -08:00
|
|
|
"""Report documentation files sorted by git-last-modified date.
|
|
|
|
|
|
|
|
|
|
Scans all markdown files in docs/ (excluding changelog.d/) and shows
|
|
|
|
|
their last modification date according to git. Docs older than the
|
|
|
|
|
threshold (default 180 days) are highlighted as stale.
|
|
|
|
|
|
|
|
|
|
This is informational only — it always exits 0.
|
|
|
|
|
|
2026-02-06 07:08:46 -08:00
|
|
|
Usage: mise run docs-review-stale [-- --threshold 90]
|
2026-02-05 21:12:06 -08:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
|
import sys
|
|
|
|
|
from datetime import datetime, timezone
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
from typing import Annotated
|
|
|
|
|
|
|
|
|
|
import typer
|
|
|
|
|
from rich.console import Console
|
|
|
|
|
from rich.table import Table
|
|
|
|
|
|
|
|
|
|
DOCS_DIR = Path(__file__).parent.parent / "docs"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def git_last_modified(file_path: Path) -> datetime | None:
|
|
|
|
|
"""Get the last git commit date for a file."""
|
|
|
|
|
try:
|
|
|
|
|
result = subprocess.run(
|
|
|
|
|
["git", "log", "-1", "--format=%aI", "--", str(file_path)],
|
|
|
|
|
capture_output=True,
|
|
|
|
|
text=True,
|
|
|
|
|
check=True,
|
|
|
|
|
)
|
|
|
|
|
date_str = result.stdout.strip()
|
|
|
|
|
if not date_str:
|
|
|
|
|
return None
|
|
|
|
|
return datetime.fromisoformat(date_str)
|
|
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(
|
|
|
|
|
threshold: Annotated[int, typer.Option(help="Days before a doc is considered stale")] = 180,
|
|
|
|
|
) -> None:
|
|
|
|
|
console = Console()
|
|
|
|
|
threshold_days = threshold
|
|
|
|
|
console.print("[bold]Documentation Staleness Report[/bold]")
|
|
|
|
|
console.print(f"Threshold: {threshold_days} days")
|
|
|
|
|
console.print()
|
|
|
|
|
|
|
|
|
|
now = datetime.now(timezone.utc)
|
|
|
|
|
entries: list[tuple[str, datetime, int, bool]] = []
|
|
|
|
|
|
|
|
|
|
for md_file in sorted(DOCS_DIR.rglob("*.md")):
|
|
|
|
|
if "changelog.d" in md_file.parts:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
last_modified = git_last_modified(md_file)
|
|
|
|
|
if last_modified is None:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
rel_path = str(md_file.relative_to(DOCS_DIR))
|
|
|
|
|
age_days = (now - last_modified).days
|
|
|
|
|
is_stale = age_days > threshold_days
|
|
|
|
|
entries.append((rel_path, last_modified, age_days, is_stale))
|
|
|
|
|
|
|
|
|
|
# Sort oldest-first
|
|
|
|
|
entries.sort(key=lambda e: e[1])
|
|
|
|
|
|
|
|
|
|
stale_count = sum(1 for e in entries if e[3])
|
|
|
|
|
|
|
|
|
|
table = Table(show_header=True, header_style="bold")
|
|
|
|
|
table.add_column("File")
|
|
|
|
|
table.add_column("Last Modified", justify="right")
|
|
|
|
|
table.add_column("Age (days)", justify="right")
|
|
|
|
|
table.add_column("Status")
|
|
|
|
|
|
|
|
|
|
for rel_path, last_modified, age_days, is_stale in entries:
|
|
|
|
|
date_str = last_modified.strftime("%Y-%m-%d")
|
|
|
|
|
if is_stale:
|
|
|
|
|
table.add_row(
|
|
|
|
|
f"[red]{rel_path}[/red]",
|
|
|
|
|
f"[red]{date_str}[/red]",
|
|
|
|
|
f"[red]{age_days}[/red]",
|
|
|
|
|
"[red]STALE[/red]",
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
table.add_row(rel_path, date_str, str(age_days), "[green]OK[/green]")
|
|
|
|
|
|
|
|
|
|
console.print(table)
|
|
|
|
|
console.print()
|
|
|
|
|
console.print(f"Total: {len(entries)} docs, {stale_count} stale")
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
typer.run(main)
|