import pathlib, subprocess, sys
root=pathlib.Path(sys.argv[1])
for side, sha in [('base','e0d6aadb88d229746be9503c510baaccbad84f4f'),('head','36ef66b23e2d32e14a8237835e01783ea1e26401')]:
 print(side.upper(), sha)
 for title in ['Orchard','Meadow']:
  repo=root/(side+'-projects')/title
  def git(*args): return subprocess.check_output(['git','-C',str(repo),*args],text=True)
  worktrees=list((repo/'.claude/worktrees').glob('*'))
  print('Project:', title)
  print('git status --porcelain --untracked-files=all:',repr(git('status','--porcelain','--untracked-files=all')))
  print('Nested checkouts:',len(worktrees))
  for wt in worktrees:
   rel=wt.relative_to(repo).as_posix()
   print('Checkout:',rel)
   print('Git checkout HEAD matches main:',git('rev-parse','main').strip()==subprocess.check_output(['git','-C',str(wt),'rev-parse','HEAD'],text=True).strip())
   print('git check-ignore:',git('check-ignore',rel).strip())
   print('Local marker in ancestor chain:',repo in wt.parents, (repo/'CLAUDE.local.md').read_text().strip())
   print('Shared parent marker in ancestor chain:',repo.parent in wt.parents,(repo.parent/'CLAUDE.local.md').read_text().strip())
 print()
