cleanup/core/config.py
2026-09-05 15:24:52 +02:00

48 lines
1.9 KiB
Python

"""
Central configuration for the vault renamer.
Deliberately NOT in here: the folder taxonomy (01_INBOX, 04_ARBEIT/Cafe_Bach,
etc). That's discovered live from disk every run in scanner.py, since the
taxonomy is expected to keep changing — hardcoding it here would mean
editing code every time a folder gets renamed or added.
"""
import re
# Directory names to skip entirely when scanning: never listed as files,
# never offered as a destination folder.
IGNORE_DIR_NAMES = {
".git", ".stfolder", ".stversions", "__pycache__", "node_modules",
".venv", "venv", ".idea", ".vscode",
}
# The tool's own bookkeeping files — never scanned, never shown as "needing
# a rename". Without this, the app would try to rename its own state/log
# files sitting right there in the scanned folder.
STATE_FILENAME = ".vault_renamer_state.json"
LOG_FILENAME = ".vault_renamer_log.csv"
TOOL_STATE_FILENAMES = {STATE_FILENAME, LOG_FILENAME}
# Filename patterns to skip entirely — pure sync/system noise. Never shown
# in any review list, never touched.
IGNORE_FILE_PATTERNS = [
re.compile(r"^\.sync-conflict-.*"),
re.compile(r"^Thumbs\.db$", re.IGNORECASE),
re.compile(r"^\.~lock\..*#$"), # LibreOffice lock files
re.compile(r"^\.directory$"),
re.compile(r"^desktop\.ini$", re.IGNORECASE),
re.compile(r"^\.DS_Store$"),
]
# A filename counts as "already conventioned" if it starts with
# YYYY-MM-DD_ followed by at least one more character before the extension.
ALREADY_CONVENTIONED = re.compile(r"^\d{4}-\d{2}-\d{2}_.+")
# Formats seen in the vault that are *close* to the convention but not
# quite it — flagged separately so they stand out from genuinely untouched
# files rather than being lumped in with everything else.
NEAR_CONVENTION_PATTERNS = [
re.compile(r"^\d{8}_.+"), # e.g. 20260827_161234
re.compile(r"^\d{2}-\d{2}-\d{4}.+"), # DD-MM-YYYY style
re.compile(r"^\d{2}_\d{2}_\d{4}.+"), # DD_MM_YYYY style
]