from pathlib import Path import hashlib,json,shutil root=Path(__file__).resolve().parents[2] old=root/'code/packages/0.1.3-alpha' package=root/'code/packages/0.1.4-alpha' build=root/'work/undo-redo-package/release' package.mkdir(exist_ok=True) # Resume only this task's partially staged new package. for item in old.iterdir(): if item.name in {'demo','shape-plugins','package-manifest.json','README.md','README.txt','build-info.json','TikZRefinery.exe'}:continue if item.is_dir():shutil.copytree(item,package/item.name,dirs_exist_ok=True) else:shutil.copy2(item,package/item.name) if not (package/'TikZRefinery.exe').exists():shutil.copy2(build/'TikZRefinery.exe',package/'TikZRefinery.exe') shutil.copytree(build/'shape-plugins',package/'shape-plugins',dirs_exist_ok=True) shutil.copy2(build/'build-info.json',package/'build-info.json') demo=package/'demo';demo.mkdir(exist_ok=True) (demo/'history.tex').write_bytes(b'% Undo/redo demo; preserve comments and spelling\r\n' b'\\documentclass{article}\r\n\\usepackage{tikz}\r\n\\pagestyle{empty}\r\n\\begin{document}\r\n\\begin{tikzpicture}\r\n' b'\\path[use as bounding box] (-2cm,-2cm) rectangle (8cm,5cm);\r\n' b'\\draw[line width=0.6pt] (+0.00cm,0cm) rectangle (2cm,1cm);\r\n' b'\\draw[->] (3cm,0cm) -- (5cm,1cm);\r\n\\end{tikzpicture}\r\n\\end{document}\r\n') readme='''TikZRefinery 0.1.4-alpha — Windows x64 Release Open TikZRefinery.exe, then demo/history.tex. This package includes its Qt/MinGW runtime and the rectangle plugin; keep the directory contents together. Move a rectangle or resize a selected corner. Edit > Undo (Ctrl+Z) and Redo (Ctrl+Y) restore completed changes, including exact source spelling. Save keeps history; a successful Open clears it. History is session-only, without automatic eviction yet. Preview/cancel/no-op do not create entries. A changed edit after Undo discards the abandoned redo branch. Undo/Redo do not write the file. Creation remains disabled, Files remains an Open placeholder, and generic transactions, provider management and integrated compilation remain planned. About identifies the source checkpoint and modified working tree. The older 0.1.3-alpha, 0.1.2-alpha and frozen 0.10.3 packages are preserved. ''' for name in ['README.md','README.txt']:(package/name).write_text(readme,encoding='utf-8') identity=json.loads((package/'build-info.json').read_text(encoding='utf-8-sig')) manifest=dict(application='TikZRefinery',**identity,reportVersion='0.1.4-alpha',platform='Windows x64', configuration='Release',packagedOn='2026-11-24',scope='Session undo/redo for completed coordinate edits; unbounded exact snapshots; generic transactions/file-store extraction pending', tests='Eight Debug and eight Release CTest suites passed',provider=json.loads((build/'generated/rectangle-plugin.json').read_text(encoding='utf-8-sig'))) sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest() inputs=[p for base in ['code/src','code/tests','code/plugin-api','code/plugins','code/cmake'] for p in (root/base).rglob('*') if p.is_file() and '/evidence/' not in p.as_posix()] inputs += [root/'code/CMakeLists.txt',root/'documents/latex/TikZRefinery.tex'] manifest['sourceFiles']=[dict(path=str(p.relative_to(root)),sha256=sha(p)) for p in sorted(inputs)] manifest['deployedFiles']=[dict(path=str(p.relative_to(package)),sha256=sha(p)) for p in sorted(package.rglob('*')) if p.is_file()] manifest['executableSha256']=sha(package/'TikZRefinery.exe') (package/'package-manifest.json').write_text(json.dumps(manifest,indent=2),encoding='utf-8') shutil.copy2(package/'package-manifest.json',root/'code/tests/evidence/undo-redo-2026-11-24/package-manifest.json') print(package)