Skip to content

zlsjtj/FigureCraft

scientific-figure-studio

Unverified

FigureCraft 根据科学对象、关系和数据制作科研图与语义配色。适用于机制、硬件、分层材料、定量图及整套配图,交付可编辑图源和分别记录的技术、科学与视觉审阅,保留数值、拓扑和修改范围。

FileKindSize
SKILL.mdskill md8.5 KB
agents/openai.yamlconfig601 B
assets/reference_palettes.jsonconfig11.6 KB
examples/aperture-focus-demo/README.mdmarkdown3.1 KB
examples/aperture-focus-demo/audit/label-load.jsonconfig988 B
examples/aperture-focus-demo/audit/portable-rebuild.jsonconfig1.1 KB
examples/aperture-focus-demo/audit/review-scope.jsonconfig750 B
examples/aperture-focus-demo/audit/semantic-checks.jsonconfig1.5 KB
examples/aperture-focus-demo/brief.mdmarkdown1.4 KB
examples/aperture-focus-demo/caption.mdmarkdown765 B
examples/aperture-focus-demo/exports/baseline/figure.pdfbinary41.1 KB
examples/aperture-focus-demo/exports/baseline/figure.pngbinary47.7 KB
examples/aperture-focus-demo/exports/baseline/figure.svgother3.6 KB
examples/aperture-focus-demo/exports/final/figure.pdfbinary72.4 KB
examples/aperture-focus-demo/exports/final/figure.pngbinary28.0 KB
examples/aperture-focus-demo/exports/final/figure.svgother3.8 KB
examples/aperture-focus-demo/exports/final/figure_deuteranomaly100.pngbinary29.0 KB
examples/aperture-focus-demo/exports/final/figure_grayscale.pngbinary27.4 KB
examples/aperture-focus-demo/exports/first/figure.pdfbinary72.5 KB
examples/aperture-focus-demo/exports/first/figure.pngbinary46.8 KB
examples/aperture-focus-demo/exports/first/figure.svgother4.3 KB
examples/aperture-focus-demo/figure_spec.jsonconfig2.9 KB
examples/aperture-focus-demo/manifest.sha256.jsonconfig2.6 KB
examples/aperture-focus-demo/requirements.txtmanifest61 B
examples/aperture-focus-demo/review.mdmarkdown3.2 KB
examples/aperture-focus-demo/scripts/audit.pyscript3.3 KB
examples/aperture-focus-demo/scripts/rebuild.pyscript10.8 KB
examples/aperture-focus-demo/source/baseline.jsonconfig149 B
examples/aperture-focus-demo/source/final.jsonconfig895 B
examples/aperture-focus-demo/source/first.jsonconfig1.2 KB
examples/assembled-cutaway/README.mdmarkdown3.4 KB
examples/assembled-cutaway/author_geometry.pyscript9.2 KB
examples/assembled-cutaway/author_interface.pyscript8.5 KB
examples/assembled-cutaway/build.pyscript1.7 KB
examples/assembled-cutaway/development-review.jsonconfig1.6 KB
examples/assembled-cutaway/input/implementation.mdmarkdown2.1 KB
examples/assembled-cutaway/scenes/alternative.jsonconfig24.1 KB
examples/assembled-cutaway/scenes/first.jsonconfig21.3 KB
examples/assembled-cutaway/scenes/object-view.jsonconfig25.3 KB
examples/assembled-cutaway/scenes/selected.jsonconfig38.1 KB
examples/assembled-cutaway/views/alternative/figure.pdfbinary42.5 KB
examples/assembled-cutaway/views/alternative/figure.pngbinary86.5 KB
examples/assembled-cutaway/views/alternative/figure.svgother15.1 KB
examples/assembled-cutaway/views/first/figure.pdfbinary42.3 KB
examples/assembled-cutaway/views/first/figure.pngbinary84.6 KB
examples/assembled-cutaway/views/first/figure.svgother13.0 KB
examples/assembled-cutaway/views/object-view/alt.txtmarkdown521 B
examples/assembled-cutaway/views/object-view/caption.txtmarkdown435 B
examples/assembled-cutaway/views/object-view/figure.pdfbinary42.6 KB
examples/assembled-cutaway/views/object-view/figure.pngbinary81.9 KB
examples/assembled-cutaway/views/object-view/figure.svgother14.9 KB
examples/assembled-cutaway/views/object-view/qa-deuteranopia.pngbinary107.8 KB
examples/assembled-cutaway/views/object-view/qa-grayscale.pngbinary98.4 KB
examples/assembled-cutaway/views/selected/alt.txtmarkdown635 B
examples/assembled-cutaway/views/selected/caption.txtmarkdown501 B
examples/assembled-cutaway/views/selected/figure.pdfbinary43.7 KB
examples/assembled-cutaway/views/selected/figure.pngbinary84.4 KB
examples/assembled-cutaway/views/selected/figure.svgother23.4 KB
examples/assembled-cutaway/views/selected/qa-deuteranopia.pngbinary137.8 KB
examples/assembled-cutaway/views/selected/qa-grayscale.pngbinary123.4 KB
examples/bin-latch/README.mdmarkdown2.8 KB
examples/bin-latch/alt_text.txtmarkdown574 B
examples/bin-latch/build_figure.pyscript13.7 KB
examples/bin-latch/caption.txtmarkdown654 B
examples/bin-latch/comparison/new/final/figure.pngbinary107.9 KB
examples/bin-latch/comparison/new/final/figure.svgother9.4 KB
examples/bin-latch/comparison/new/final/manuscript.mdmarkdown9.9 KB
examples/bin-latch/comparison/new/first/figure.pngbinary108.1 KB
examples/bin-latch/comparison/new/first/figure.svgother9.4 KB
examples/bin-latch/comparison/new/first/manuscript.mdmarkdown9.9 KB
examples/bin-latch/comparison/old/final/figure.pngbinary115.3 KB
examples/bin-latch/comparison/old/final/figure.svgother8.1 KB
examples/bin-latch/comparison/old/final/figure/figure.pngbinary115.3 KB
examples/bin-latch/comparison/old/final/manuscript.mdmarkdown9.4 KB
examples/bin-latch/comparison/old/first/figure.pngbinary118.9 KB
examples/bin-latch/comparison/old/first/figure.svgother8.2 KB
examples/bin-latch/comparison/old/first/figure/figure.pngbinary118.9 KB
examples/bin-latch/comparison/old/first/manuscript.mdmarkdown9.4 KB
examples/bin-latch/comparison/plain/final/figure.pngbinary149.9 KB
examples/bin-latch/comparison/plain/final/figure.svgother8.4 KB
examples/bin-latch/comparison/plain/final/manuscript.mdmarkdown10.0 KB
examples/bin-latch/comparison/plain/final/mechanism.svgother8.4 KB
examples/bin-latch/comparison/plain/first/figure.pngbinary149.8 KB
examples/bin-latch/comparison/plain/first/figure.svgother8.4 KB
examples/bin-latch/comparison/plain/first/manuscript.mdmarkdown10.0 KB
examples/bin-latch/comparison/plain/first/mechanism.svgother8.4 KB
examples/bin-latch/figure.pdfbinary126.9 KB
examples/bin-latch/figure.pngbinary112.8 KB
examples/bin-latch/figure.svgother10.7 KB
examples/bin-latch/figure_deuteranopia.pngbinary113.6 KB
examples/bin-latch/figure_grayscale.pngbinary54.4 KB
examples/bin-latch/figure_spec.jsonconfig19.4 KB
examples/bin-latch/input/draft.mdmarkdown6.4 KB
examples/bin-latch/input/implementation_notes.mdmarkdown8.7 KB
examples/bin-latch/input/results.csvother677 B
examples/bin-latch/input/sources_and_limits.mdmarkdown5.6 KB
examples/bin-latch/input/task.mdmarkdown2.8 KB
examples/bin-latch/manuscript.mdmarkdown9.9 KB
examples/bin-latch/requirements.txtmanifest46 B
examples/bin-latch/results.csvother677 B
examples/bin-latch/review-first-look.mdmarkdown7.5 KB
examples/bin-latch/review-followup.mdmarkdown2.3 KB
examples/bin-latch/review-review.mdmarkdown12.8 KB
examples/cable-window/README.mdmarkdown2.4 KB
examples/cable-window/after/figure.pdfbinary44.0 KB
examples/cable-window/after/figure.pngbinary75.1 KB
examples/cable-window/after/figure.svgother8.8 KB
examples/cable-window/before/figure.pdfbinary41.8 KB
examples/cable-window/before/figure.pngbinary100.8 KB
examples/cable-window/before/figure.svgother8.1 KB
examples/cable-window/brief.jsonconfig1.3 KB
examples/cable-window/build_cable_demo.pyscript14.7 KB
examples/cable-window/caption-and-alt.mdmarkdown826 B
examples/cable-window/method-after.mdmarkdown684 B
examples/cable-window/method-before.mdmarkdown717 B
examples/co-wound-editorial/README.mdmarkdown3.7 KB
examples/co-wound-editorial/body.txtmarkdown286 B
examples/co-wound-editorial/build_figure.pyscript7.5 KB
examples/co-wound-editorial/candidates/diagonal-first.pngbinary113.7 KB
examples/co-wound-editorial/candidates/upright.pngbinary102.5 KB
examples/co-wound-editorial/document/clean.docxbinary139.9 KB
examples/co-wound-editorial/document/clean.jsonconfig416 B
examples/co-wound-editorial/document/clean.pdfbinary115.1 KB
examples/co-wound-editorial/document/page-1.pngbinary238.6 KB
examples/co-wound-editorial/selected/alt.txtmarkdown138 B
examples/co-wound-editorial/selected/assembly-roles.pngbinary11.1 KB
examples/co-wound-editorial/selected/assembly.pngbinary125.1 KB
examples/co-wound-editorial/selected/caption.txtmarkdown390 B
examples/co-wound-editorial/selected/detail-roles.pngbinary3.2 KB
examples/co-wound-editorial/selected/detail.pngbinary21.2 KB
examples/co-wound-editorial/selected/deuteranopia-approx.pngbinary107.3 KB
examples/co-wound-editorial/selected/figure.pdfbinary236.1 KB
examples/co-wound-editorial/selected/figure.pngbinary107.4 KB
examples/co-wound-editorial/selected/figure.svgother197.3 KB
examples/co-wound-editorial/selected/grayscale.pngbinary46.8 KB
examples/co-wound-editorial/selected/record.jsonconfig149.3 KB
examples/co-wound-editorial/validation.jsonconfig1.5 KB
examples/co-wound-laminate/README.mdmarkdown3.6 KB
examples/co-wound-laminate/body.txtmarkdown286 B
examples/co-wound-laminate/build_document.pyscript2.5 KB
examples/co-wound-laminate/build_laminate.pyscript9.6 KB
examples/co-wound-laminate/build_laminate_first.pyscript9.6 KB
examples/co-wound-laminate/caption-before.txtmarkdown231 B
examples/co-wound-laminate/caption.txtmarkdown425 B
examples/co-wound-laminate/continuous-v2/assembly-roles.pngbinary9.4 KB
examples/co-wound-laminate/continuous-v2/assembly.pngbinary114.5 KB
examples/co-wound-laminate/continuous-v2/deuteranopia-approx.pngbinary68.3 KB
examples/co-wound-laminate/continuous-v2/figure.pdfbinary193.4 KB
examples/co-wound-laminate/continuous-v2/figure.pngbinary67.3 KB
examples/co-wound-laminate/continuous-v2/figure.svgother157.0 KB
examples/co-wound-laminate/continuous-v2/grayscale.pngbinary30.5 KB
examples/co-wound-laminate/continuous-v2/record.jsonconfig147.5 KB
examples/co-wound-laminate/continuous-v2/tail-detail-roles.pngbinary1022 B
examples/co-wound-laminate/continuous-v2/tail-detail.pngbinary2.2 KB
examples/co-wound-laminate/document/before.docxbinary112.5 KB
examples/co-wound-laminate/document/before.pdfbinary91.5 KB
examples/co-wound-laminate/document/clean.docxbinary102.3 KB
examples/co-wound-laminate/document/clean.pdfbinary89.2 KB
examples/co-wound-laminate/document/review.docxbinary102.3 KB
examples/co-wound-laminate/document/review.pdfbinary89.3 KB
examples/co-wound-laminate/first-continuous/assembly-roles.pngbinary9.6 KB
examples/co-wound-laminate/first-continuous/assembly.pngbinary116.2 KB
examples/co-wound-laminate/first-continuous/deuteranopia-approx.pngbinary80.4 KB
examples/co-wound-laminate/first-continuous/figure.pdfbinary219.0 KB
examples/co-wound-laminate/first-continuous/figure.pngbinary78.6 KB
examples/co-wound-laminate/first-continuous/figure.svgother187.2 KB
examples/co-wound-laminate/first-continuous/grayscale.pngbinary34.3 KB
examples/co-wound-laminate/first-continuous/record.jsonconfig148.8 KB
examples/co-wound-laminate/first-continuous/tail-detail-roles.pngbinary4.2 KB
examples/co-wound-laminate/first-continuous/tail-detail.pngbinary22.8 KB
examples/co-wound-laminate/input.mdmarkdown1.3 KB
examples/co-wound-laminate/section-v2/assembly-roles.pngbinary9.4 KB
examples/co-wound-laminate/section-v2/assembly.pngbinary114.5 KB
examples/co-wound-laminate/section-v2/deuteranopia-approx.pngbinary81.1 KB
examples/co-wound-laminate/section-v2/figure.pdfbinary203.5 KB
examples/co-wound-laminate/section-v2/figure.pngbinary80.0 KB
examples/co-wound-laminate/section-v2/figure.svgother211.4 KB
examples/co-wound-laminate/section-v2/grayscale.pngbinary37.1 KB
examples/co-wound-laminate/section-v2/record.jsonconfig75.5 KB
examples/co-wound-laminate/selected/assembly-roles.pngbinary9.4 KB
examples/co-wound-laminate/selected/assembly.pngbinary114.5 KB
examples/co-wound-laminate/selected/deuteranopia-approx.pngbinary69.2 KB
examples/co-wound-laminate/selected/figure.pdfbinary193.4 KB
examples/co-wound-laminate/selected/figure.pngbinary68.1 KB
examples/co-wound-laminate/selected/figure.svgother157.3 KB
examples/co-wound-laminate/selected/grayscale.pngbinary30.8 KB
examples/co-wound-laminate/selected/record.jsonconfig147.5 KB
examples/co-wound-laminate/selected/tail-detail-roles.pngbinary1022 B
examples/co-wound-laminate/selected/tail-detail.pngbinary2.2 KB
examples/common-reference-demo/README.mdmarkdown2.3 KB
examples/common-reference-demo/alternative/build.pyscript7.4 KB
examples/common-reference-demo/alternative/caption.txtmarkdown453 B
examples/common-reference-demo/alternative/figure.pdfbinary72.6 KB
examples/common-reference-demo/alternative/figure.pngbinary39.9 KB
examples/common-reference-demo/alternative/figure.svgother8.0 KB
examples/common-reference-demo/alternative/figure_spec.jsonconfig17.0 KB
examples/common-reference-demo/caption.txtmarkdown569 B
examples/common-reference-demo/dev/REVIEW.mdmarkdown1.8 KB
examples/common-reference-demo/dev/attempt-01/rows.jsonconfig28.2 KB
examples/common-reference-demo/dev/attempt-01/rows/caption.txtmarkdown529 B

examples/aperture-focus-demo/scripts/rebuild.py

View on GitHub
"""Rebuild the aperture DEMO with explicit paths; refuses existing output folders.
No experiments: all geometry and labels come from the companion JSON and brief.
"""
import argparse, hashlib, json, math, re, shutil, subprocess, sys
from pathlib import Path
from xml.sax.saxutils import escape
from xml.etree import ElementTree as ET
import numpy as np
from PIL import Image
from pypdf import PdfReader
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

MM=72/25.4
def sha(p): return hashlib.sha256(Path(p).read_bytes()).hexdigest()
def write_json(p,obj): p.write_text(json.dumps(obj,ensure_ascii=False,indent=2),encoding='utf-8')

class Drawing:
    def __init__(self,w,h): self.w=w; self.h=h; self.items=[]
    def add(self,typ,id,**kw): self.items.append(dict(type=typ,id=id,**kw))
    def text(self,id,text,x,y,size=10,bold=False,color='#243340',anchor='middle',**kw):
        self.add('text',id,text=text,x=x,y=y,size=size,bold=bold,fill=color,anchor=anchor,**kw)
    def line(self,id,x1,y1,x2,y2,color='#243340',width=.35,dash=None,**kw):
        self.add('line',id,x1=x1,y1=y1,x2=x2,y2=y2,stroke=color,width=width,dash=dash,**kw)
    def arrow(self,id,x1,y1,x2,y2,color='#243340',width=.6,head=1.8,**kw):
        dx=x2-x1;dy=y2-y1;length=math.hypot(dx,dy);ux=dx/length;uy=dy/length
        self.line(id+'-shaft',x1,y1,x2-head*.8*ux,y2-head*.8*uy,color,width,**kw)
        self.add('polygon',id+'-head',points=[[x2,y2],[x2-head*ux-head*.5*uy,y2-head*uy+head*.5*ux],[x2-head*ux+head*.5*uy,y2-head*uy-head*.5*ux]],fill=color,stroke=color,width=.1,**kw)
    def export(self,out,font,bold,pdftoppm):
        pdfmetrics.registerFont(TTFont('TrialArial',str(font)))
        pdfmetrics.registerFont(TTFont('TrialArialBold',str(bold)))
        svg=[f'<svg xmlns="http://www.w3.org/2000/svg" width="{self.w}mm" height="{self.h}mm" viewBox="0 0 {self.w} {self.h}">', '<title>Ideal geometric aperture DEMO</title>', '<desc>Constructed schematic, not experimental measurements.</desc>']
        c=canvas.Canvas(str(out/'figure.pdf'),pagesize=(self.w*MM,self.h*MM),invariant=1)
        c.setTitle('Ideal geometric aperture DEMO')
        def rgb(h):return tuple(int(h[i:i+2],16)/255 for i in (1,3,5))
        for it in self.items:
            typ=it['type']; ident=it['id'];fill=it.get('fill','none');stroke=it.get('stroke','none');sw=it.get('width',0)
            meta=' '.join(f'data-{k.replace("_","-")}="{escape(str(it[k]))}"' for k in ('entity','object_part','logical_id','role','relation','state') if k in it)
            base=f'id="{ident}" {meta} fill="{fill}" stroke="{stroke}" stroke-width="{sw}"'
            c.setFillColorRGB(*rgb(fill if fill!='none' else '#FFFFFF')); c.setStrokeColorRGB(*rgb(stroke if stroke!='none' else '#FFFFFF'));c.setLineWidth(sw*MM);c.setDash([])
            if typ=='rect':
                x,y,w,h=[it[k] for k in ('x','y','w','h')]
                svg.append(f'<rect {base} x="{x}" y="{y}" width="{w}" height="{h}"/>')
                c.rect(x*MM,(self.h-y-h)*MM,w*MM,h*MM,stroke=int(stroke!='none'),fill=int(fill!='none'))
            elif typ=='circle':
                x,y,r=[it[k] for k in ('x','y','r')]
                svg.append(f'<circle {base} cx="{x}" cy="{y}" r="{r}"/>')
                c.circle(x*MM,(self.h-y)*MM,r*MM,stroke=int(stroke!='none'),fill=int(fill!='none'))
            elif typ=='polygon':
                pts=it['points'];p=c.beginPath();p.moveTo(pts[0][0]*MM,(self.h-pts[0][1])*MM)
                for x,y in pts[1:]:p.lineTo(x*MM,(self.h-y)*MM)
                p.close();c.drawPath(p,stroke=int(stroke!='none'),fill=int(fill!='none'))
                svg.append(f'<polygon {base} points="'+ ' '.join(f'{x},{y}' for x,y in pts)+'"/>')
            elif typ=='line':
                x1,y1,x2,y2=[it[k] for k in ('x1','y1','x2','y2')];dash=it.get('dash')
                da=f' stroke-dasharray="{dash}"' if dash else ''
                if dash:c.setDash([float(x)*MM for x in dash.split(',')])
                svg.append(f'<line {base} x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}"{da}/>')
                c.line(x1*MM,(self.h-y1)*MM,x2*MM,(self.h-y2)*MM)
            elif typ=='text':
                x,y,text,size=it['x'],it['y'],it['text'],it['size'];weight='bold' if it['bold'] else 'normal'
                svg.append(f'<text id="{ident}" {meta} x="{x}" y="{y}" fill="{fill}" font-family="Arial" font-size="{size/MM}" font-weight="{weight}" text-anchor="{it["anchor"]}">{escape(text)}</text>')
                c.setFont('TrialArialBold' if it['bold'] else 'TrialArial',size)
                {'middle':c.drawCentredString,'start':c.drawString,'end':c.drawRightString}[it['anchor']](x*MM,(self.h-y)*MM,text)
        svg.append('</svg>');(out/'figure.svg').write_text('\n'.join(svg),encoding='utf-8');c.showPage();c.save()
        cmd=[str(pdftoppm),'-r','200','-singlefile','-png',str(out/'figure.pdf'),str(out/'figure')]
        run=subprocess.run(cmd,capture_output=True,text=True,check=True)
        rgbarr=np.asarray(Image.open(out/'figure.png').convert('RGB'))/255
        linear=np.where(rgbarr<=.04045,rgbarr/12.92,((rgbarr+.055)/1.055)**2.4)
        enc=lambda a:np.where(a<=.0031308,12.92*a,1.055*np.maximum(a,0)**(1/2.4)-.055)
        gray=linear@np.array([.2126,.7152,.0722]);g=np.repeat(enc(gray)[:,:,None],3,axis=2)
        # Machado et al. 2009, deuteranomaly severity 100; one condition only.
        matrix=np.array([[.367322,.860646,-.227968],[.280085,.672501,.047413],[-.011820,.042940,.968881]])
        cvd=enc(np.clip(linear@matrix.T,0,1))
        for name,arr in [('grayscale',g),('deuteranomaly100',cvd)]:Image.fromarray(np.uint8(np.round(np.clip(arr,0,1)*255))).save(out/f'figure_{name}.png')
        reader=PdfReader(out/'figure.pdf');page=reader.pages[0]
        checks={'svg_parse':ET.parse(out/'figure.svg').getroot().tag.endswith('svg'),'pdf_pages':len(reader.pages),'pdf_width_mm':float(page.mediabox.width)/MM,'pdf_height_mm':float(page.mediabox.height)/MM,'pdf_text':page.extract_text(),'svg_text_count':sum(it['type']=='text' for it in self.items),'minimum_label_pt':min(it['size'] for it in self.items if it['type']=='text'),'embedded_raster_count':len(ET.parse(out/'figure.svg').findall('.//{http://www.w3.org/2000/svg}image')),'svg_editability':'Native geometry and text nodes; SVG depends on Arial. PDF embeds font subsets. PNG is raster.','pdftoppm':{'command':['pdftoppm','-r','200','-singlefile','-png','figure.pdf','figure'],'exit_code':run.returncode},'qa_views':{'grayscale':'Linear sRGB luminance (.2126,.7152,.0722)','cvd':'Machado 2009 deuteranomaly severity 100; matrix in rebuild.py; not comprehensive certification'},'visual_review_status':'REVIEW_REQUIRED','author_acceptance':'NOT_REQUESTED'}
        write_json(out/'scene.json',self.items);write_json(out/'technical_checks.json',checks)

def scene(spec):
    d=Drawing(160,84);d.add('rect','background',x=0,y=0,w=160,h=84,fill='#FFFFFF')
    if spec['kind']=='reconstructed_baseline':
        labels=['Disks','Read diameter','Compare with','Move or stop','Record result']
        for i,l in enumerate(labels):
            x=4+i*31
            d.add('rect',f'box-{i}',x=x,y=13,w=28,h=18,fill='#F2F5F7',stroke='#657482',width=.3)
            d.text(f'box-label-{i}',l,x+14,22,9)
            if i==2:d.text('box-label-opening','opening',x+14,26,9)
            if i<4:d.arrow(f'flow-{i}',x+28.3,22,x+30.6,22,width=.3,head=1.1)
        for i,l in enumerate(['Opening width = 3','A: diameter 2; passes','B: diameter 4; blocked','Checks: 2, 2.5, 3, 4']):d.text(f'old-explanation-{i}',l,80,43+i*7,10)
        d.text('reconstruction-note','Reconstructed from the supplied description',80,79,9,color='#596774')
        return d
    u=spec['unit_mm']; wall=spec['wall_x']; cy=spec['center_y'];opening=spec['opening'];rb=spec['diameters']['B']/2*u;ra=spec['diameters']['A']/2*u
    top=cy-opening*u/2;bottom=cy+opening*u/2;xb=wall-math.sqrt(rb**2-(opening*u/2)**2);xa=spec['A_x']
    # One wall, represented by its two connected-to-exterior shoulders. No extra opening.
    d.add('rect','barrier-upper',x=wall,y=15,w=8,h=top-15,fill='#A9B6C0',stroke='#536572',width=.45,entity='barrier',object_part='primary',logical_id='wall',role='rigid_barrier')
    d.add('rect','barrier-lower',x=wall,y=bottom,w=8,h=76-bottom,fill='#A9B6C0',stroke='#536572',width=.45,entity='barrier',object_part='decoration',logical_id='wall',role='rigid_barrier')
    d.line('centerline-left',9,cy,xb-rb-1,cy,'#92A0AB',.25,'1.2,1.2',role='approach_centerline')
    d.line('centerline-right',wall+8,cy,151,cy,'#92A0AB',.25,'1.2,1.2',role='approach_centerline')
    d.arrow('B-approach',20,cy,xb-rb-2,cy,'#A64E24',.7,2.2,relation='B-approaches-right')
    d.arrow('A-through',wall+9.5,cy,xa-ra-2,cy,'#216B7A',.7,2.2,relation='A-exits-right')
    d.add('circle','disk-B',x=xb,y=cy,r=rb,fill='#F3C3A0',stroke='#A64E24',width=.65,entity='disk',object_part='primary',logical_id='B',role='disk_B',state='blocked_left')
    d.add('circle','disk-A',x=xa,y=cy,r=ra,fill='#A7D4DB',stroke='#216B7A',width=.65,entity='disk',object_part='primary',logical_id='A',role='disk_A',state='passed_right')
    # Opening dimension: extend only rightward; split vertical line around label.
    for name,yy in [('top',top),('bottom',bottom)]:d.line('opening-extension-'+name,wall+8.6,yy,110,yy,'#536572',.25)
    d.arrow('opening-dimension-top',107,cy-4,107,top,'#536572',.3,1.6)
    d.arrow('opening-dimension-bottom',107,cy+4,107,bottom,'#536572',.3,1.6)
    for it in spec['labels']:
        pos={'B':xb,'A':xa,'wall':wall+4}.get(it.get('position'),it.get('x',80))
        d.text(it['id'],it['text'],pos,it['y'],it.get('size',10),it.get('bold',False),it.get('color','#243340'),it.get('anchor','middle'),role=it.get('role','label'))
    return d

def main():
    p=argparse.ArgumentParser();p.add_argument('--input',type=Path,required=True);p.add_argument('--out',type=Path,required=True);p.add_argument('--font',type=Path,required=True);p.add_argument('--bold-font',type=Path,required=True);p.add_argument('--pdftoppm',type=Path,required=True);a=p.parse_args()
    if a.out.exists():raise FileExistsError('Refusing existing output directory: '+str(a.out))
    a.out.mkdir(parents=True);spec=json.loads(a.input.read_text(encoding='utf-8'));d=scene(spec);d.export(a.out,a.font,a.bold_font,a.pdftoppm)
    shutil.copy2(a.input,a.out/'input.json')
    write_json(a.out/'run_manifest.json',{'entry_point':Path(__file__).name,'input_name':a.input.name,'output_name':a.out.name,'input_sha256':sha(a.input),'script_sha256':sha(__file__),'fonts':{'regular':{'name':a.font.name,'sha256':sha(a.font)},'bold':{'name':a.bold_font.name,'sha256':sha(a.bold_font)}},'source':spec.get('source'),'files':{f.name:sha(f) for f in a.out.iterdir() if f.is_file()},'scope':'Constructed DEMO; no measured data. External package label audit is separate.'})
    print(a.out)
if __name__=='__main__':main()
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall