#!/usr/bin/env python3
"""Seed a NEW isolated checkout home with the Pi discovery-failure fixture."""
import argparse, json, pathlib, subprocess
p = argparse.ArgumentParser()
p.add_argument('checkout',type=pathlib.Path)
p.add_argument('workspace',type=pathlib.Path)
p.add_argument('wrapper',type=pathlib.Path)
a=p.parse_args()
settings=a.checkout/'.t3/userdata/settings.json'
if settings.exists():
    raise SystemExit('Use a fresh isolated home; refusing to replace settings.')
settings.parent.mkdir(parents=True,exist_ok=True)
settings.write_text(json.dumps({'providerInstances':{'pi':{'driver':'pi','enabled':True,'config':{'binaryPath':str(a.wrapper.resolve()),'launchArgs':'--model anthropic/claude-haiku-5-5 --no-extensions --no-skills --no-prompt-templates --no-context-files','customModels':[]}}}}))
a.workspace.mkdir(parents=True,exist_ok=True)
subprocess.run(['git','init','-q',str(a.workspace)],check=True)
