# This Week in Claude, 27 November 2026: find automations calling retiring Claude models.
# Usage: python3 find_old_claude_models.py "path/to/folder" (Windows: py instead of python3)
import sys
from pathlib import Path

RETIRING = {
    "claude-sonnet-4-5": "retires 30 Nov 2026, move to claude-sonnet-5-5",
    "claude-opus-4-5": "retires 22 Jan 2027, move to claude-opus-5-5",
}
FILE_TYPES = {".py", ".js", ".ts", ".json", ".yaml", ".yml", ".toml", ".txt", ".env"}

def scan(folder):
    hits = 0
    for path in Path(folder).rglob("*"):
        if not path.is_file():
            continue
        if path.suffix.lower() not in FILE_TYPES and path.name != ".env":
            continue
        try:
            lines = path.read_text(errors="ignore").splitlines()
        except OSError:
            continue
        for number, line in enumerate(lines, 1):
            for model, note in RETIRING.items():
                if model in line:
                    hits += 1
                    print(f"{path}:{number} {model} ({note})")
    print(f"\n{hits} line(s) to change." if hits else "No retiring Claude models found.")

if __name__ == "__main__":
    scan(sys.argv[1] if len(sys.argv) > 1 else ".")
