Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

chore: auto-save WIP via Claude stop-hook safety net (2026-06-30 15:17)

Ruben Lütke9fb418cb47bd
diff --git a/scripts/ci/docs_privacy_scan.py b/scripts/ci/docs_privacy_scan.py
index a7c1bfd115..d07e59f9cc 100644
--- a/scripts/ci/docs_privacy_scan.py
+++ b/scripts/ci/docs_privacy_scan.py
@@ -11,18 +11,19 @@ pushed.
Two modes:
* **scan** (default) — read-only. Prints every hit as ``path:line: <why>`` and
- exits non-zero if any are found. Wired into a ``PostToolUse`` hook so every
- ``Write``/``Edit`` under ``docs/`` is checked the moment it lands.
+ exits non-zero if any are found. Wired into a ``PostToolUse`` hook (warn), the
+ ``.githooks/pre-push`` gate (fail-closed), and the ``docs-privacy`` CI job.
* **--fix** — applies the ``scrub`` substitutions in place (canonical ordering
- from the manifest) and replaces the two private maintainer emails with a
- neutral placeholder. Used for the one-off bulk clean-up.
+ from the manifest) and replaces the private maintainer emails with a neutral
+ placeholder. Used for the one-off bulk clean-up.
-The manifest's ``scrub`` rows are applied verbatim and in file order (the order
-is load-bearing: full name before surname, GitHub login/slug before the bare
-first name). The two private emails are ``block-only`` in the manifest because
-they must survive untouched in ``.mailmap``; ``.mailmap`` is not under ``docs/``,
-so inside documentation we are free to mask them — and we must, because they
-would otherwise hard-block the next public push.
+Both the ``scrub`` rows and the private ``block-only`` email patterns are read
+from the manifest — this script hardcodes NO personal value of its own (so the
+script itself never leaks an identifier and never drifts from the manifest). The
+emails are ``block-only`` there because they must survive untouched in
+``.mailmap``; ``.mailmap`` is not under ``docs/``, so inside documentation we are
+free to mask them — and we must, because they would otherwise hard-block the
+next public push.
Usage:
python scripts/ci/docs_privacy_scan.py [PATH ...] # scan (read-only)
@@ -41,34 +42,42 @@ from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
MANIFEST = REPO_ROOT / ".claude" / "skills" / "ship-public-release" / "references" / "pii-scrub.tsv"
-# Private maintainer mailboxes. In the manifest these are `block-only` (kept
-# real only in .mailmap); everywhere else they get masked to this placeholder.
-PRIVATE_EMAILS = (
- re.compile(r"ruben\.luetke10@gmail\.com"),
- re.compile(r"harald\.herz@gmx\.de"),
-)
+# Where a private maintainer email gets masked inside docs (the real addresses
+# live only in the manifest + .mailmap; this script never spells one out).
EMAIL_PLACEHOLDER = "[email protected]"
# Text-only file suffixes we look inside. Binary/image docs are skipped.
TEXT_SUFFIXES = {".md", ".markdown", ".html", ".htm", ".txt", ".py", ".toml", ".json", ".yml", ".yaml", ".tsv", ".csv"}
-def load_scrub_rules() -> list[tuple[re.Pattern[str], str, str]]:
- """Return (compiled_pattern, replacement, note) for every `scrub` row, in file order."""
- rules: list[tuple[re.Pattern[str], str, str]] = []
+def load_manifest() -> tuple[list[tuple[re.Pattern[str], str, str]], list[re.Pattern[str]]]:
+ """Parse the canonical scrub manifest.
+
+ Returns ``(scrub_rules, blockonly_email_patterns)``:
+ * ``scrub_rules`` = ``(compiled, replacement, note)`` for every ``scrub`` row,
+ in file order (the order is load-bearing: full name before surname, GitHub
+ login/slug before the bare first name).
+ * ``blockonly_email_patterns`` = compiled patterns from ``block-only`` rows
+ that look like an email (so private maintainer mailboxes are masked inside
+ docs without this script ever hardcoding the address).
+ """
+ scrub_rules: list[tuple[re.Pattern[str], str, str]] = []
+ blockonly_emails: list[re.Pattern[str]] = []
for raw in MANIFEST.read_text(encoding="utf-8").splitlines():
line = raw.rstrip("\n")
if not line or line.lstrip().startswith("#"):
continue
parts = line.split("\t")
- if len(parts) < 3:
+ if len(parts) < 2:
continue
- action, pattern, replacement = parts[0], parts[1], parts[2]
+ action, pattern = parts[0], parts[1]
+ replacement = parts[2] if len(parts) > 2 else ""
note = parts[3] if len(parts) > 3 else ""
- if action != "scrub":
- continue
- rules.append((re.compile(pattern), replacement, note))
- return rules
+ if action == "scrub":
+ scrub_rules.append((re.compile(pattern), replacement, note))
+ elif action == "block-only" and "@" in pattern:
+ blockonly_emails.append(re.compile(pattern))
+ return scrub_rules, blockonly_emails
def tracked_docs() -> list[Path]:
@@ -89,22 +98,30 @@ def _read(path: Path) -> str | None:
return None
-def scan_text(text: str, rules: list[tuple[re.Pattern[str], str, str]]) -> list[tuple[int, str]]:
+def scan_text(
+ text: str,
+ rules: list[tuple[re.Pattern[str], str, str]],
+ emails: list[re.Pattern[str]],
+) -> list[tuple[int, str]]:
"""Return (line_number, why) for every personal-data hit."""
hits: list[tuple[int, str]] = []
for i, line in enumerate(text.splitlines(), start=1):
- for pat in PRIVATE_EMAILS:
+ for pat in emails:
if pat.search(line):
- hits.append((i, f"private maintainer email ({pat.pattern})"))
+ hits.append((i, "private maintainer email"))
for pat, _repl, note in rules:
if pat.search(line):
hits.append((i, f"{note or pat.pattern}"))
return hits
-def fix_text(text: str, rules: list[tuple[re.Pattern[str], str, str]]) -> str:
+def fix_text(
+ text: str,
+ rules: list[tuple[re.Pattern[str], str, str]],
+ emails: list[re.Pattern[str]],
+) -> str:
# Emails first, so the bare-name rules cannot fragment the address.
- for pat in PRIVATE_EMAILS:
+ for pat in emails:
text = pat.sub(EMAIL_PLACEHOLDER, text)
for pat, repl, _note in rules:
text = pat.sub(repl, text)
@@ -117,7 +134,7 @@ def main() -> int:
ap.add_argument("--fix", action="store_true", help="mask personal data in place")
args = ap.parse_args()
- rules = load_scrub_rules()
+ rules, emails = load_manifest()
if args.paths:
targets = [(Path(p) if Path(p).is_absolute() else (REPO_ROOT / p)).resolve() for p in args.paths]
@@ -137,14 +154,14 @@ def main() -> int:
if text is None:
continue
if args.fix:
- new = fix_text(text, rules)
+ new = fix_text(text, rules, emails)
if new != text:
path.write_text(new, encoding="utf-8")
changed += 1
rel = path.relative_to(REPO_ROOT) if REPO_ROOT in path.parents else path
print(f"fixed: {rel}")
else:
- hits = scan_text(text, rules)
+ hits = scan_text(text, rules, emails)
for line_no, why in hits:
rel = path.relative_to(REPO_ROOT) if REPO_ROOT in path.parents else path
print(f"{rel}:{line_no}: {why}")
diff --git a/scripts/config-soll.json b/scripts/config-soll.json
index 5826c7480c..1e00842d7b 100644
--- a/scripts/config-soll.json
+++ b/scripts/config-soll.json
@@ -32,7 +32,7 @@
"allow_sapi5_fallback": false
},
"brain": {
- "primary": "gemini",
+ "primary": "openrouter",
"fallback": "gemini",
"deep_brain": "gemini",
"routing_provider": "gemini",