#!/usr/bin/env python3
"""Synthetic Claude plugin fixture. Usage: seed.py SCRATCH_ROOT
Use the resulting claude-config as the provider home. Supply authentication
privately through the provider environment; never upload credentials.
"""
import json, subprocess, sys, os
from pathlib import Path
root=Path(sys.argv[1]).resolve()
market=root/'marketplace'; config=root/'claude-config'
for d in ['.claude-plugin','plugins/menu-proof/.claude-plugin','plugins/menu-proof/skills/greeting','plugins/menu-proof/commands']:
 (market/d).mkdir(parents=True,exist_ok=True)
config.mkdir(parents=True,exist_ok=True)
files={'.claude-plugin/marketplace.json':json.dumps({'name':'menu-proof-market','owner':{'name':'Evidence'},'plugins':[{'name':'menu-proof','source':'./plugins/menu-proof','description':'Synthetic menu evidence plugin'}]}),
'plugins/menu-proof/.claude-plugin/plugin.json':json.dumps({'name':'menu-proof','version':'1.0.0','description':'Synthetic menu evidence plugin'}),
'plugins/menu-proof/skills/greeting/SKILL.md':'---\nname: greeting\ndescription: Produce the synthetic menu proof greeting\n---\nReply exactly: MENU_PROOF_SKILL_INVOKED\n',
'plugins/menu-proof/commands/wave.md':'---\ndescription: Produce the synthetic menu proof wave\n---\nReply exactly: MENU_PROOF_COMMAND_INVOKED\n'}
for name,content in files.items(): (market/name).write_text(content)
env={**os.environ,'CLAUDE_CONFIG_DIR':str(config)}
subprocess.run(['claude','plugin','marketplace','add',str(market)],env=env,check=True)
subprocess.run(['claude','plugin','install','menu-proof@menu-proof-market','--scope','user'],env=env,check=True)
p=config/'settings.json'; settings=json.loads(p.read_text()); settings.pop('enabledPlugins',None); p.write_text(json.dumps(settings))
(root/'plugin-settings.json').write_text(json.dumps({'enabledPlugins':{'menu-proof@menu-proof-market':True}}))
