import pathlib, subprocess, sys
project, worktree = sys.argv[1:]
subprocess.run(['git', '-C', project, 'worktree', 'remove', worktree], check=True)
folder = pathlib.Path(worktree)
folder.mkdir()
(folder / 'yarn.lock').write_text('# Synthetic retained content\n')
(folder / 'node_modules').mkdir()
assert not (folder / '.git').exists()
print('Retained folder created: yarn.lock and empty node_modules; .git absent')
