#!/usr/bin/env python """managed.py -- the managed-file record `.claude/pa3-managed.json` (3.9.7 T7). drift print `none`, or one line per packaged file that differs from its recorded copy: ` | base | | edited in ` stamp keep the edit as the user's version: bump `version:` to `+uN`, record it decline record the edit as declined: drift stays silent until the file changes again Exit 2 when is not listed in the record. A thin CLI over `pa.install.managed`. """ import argparse import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) def _find_root(): """Walk up from cwd to the project root (has .claude/pa3-managed.json or HOW_WE_WORK.md).""" d = os.getcwd() while True: if (os.path.isfile(os.path.join(d, ".claude", "pa3-managed.json")) or os.path.isfile(os.path.join(d, "HOW_WE_WORK.md"))): return d parent = os.path.dirname(d) if parent == d: return os.getcwd() d = parent def _managed(): """