Files
Pier_v1/RAG/design-model-box-sample_2/tools/generate_rhythm_review.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

36 lines
2.3 KiB
Python

"""Re-read an authorized source row while preserving its cycle rhythm."""
import argparse
import copy
import json
from pathlib import Path
import sys
root=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(root/'src/backend' if (root/'src/backend').is_dir() else root))
def run(args):
import server
from cad_rebar_recipe import load_sources
from body_source_tie import build_reference_review
server.require_modeling_rules()
job=json.loads(args.job.read_text());plan=job['result'];working=copy.deepcopy(plan)
selected=[g for g in working['rebar_groups'] if g.get('mark')==args.mark and g.get('rebar_block')==args.block]
if len(selected)!=1:raise ValueError('selected fabrication row is not unique')
target=selected[0];rule=target['source_body_tie_binding']['reference_rule']
for g in working['rebar_groups']:g.pop('quantity_distribution',None)
target['quantity_distribution']={'explicit_user_authorization':True,'preserve_cycle_rhythm':True}
sources=load_sources(server.rehydrate_drawing_set_analysis(job['sourceContext']['analysis']))
failures=[];groups=build_reference_review(working,sources,rule,authorized=True,failures=failures)
generated=[g for g in groups if g['id']==target['id']]
if len(generated)!=1:raise ValueError('selected row failed fresh generation: '+str(failures))
result=copy.deepcopy(plan);result['rebar_groups']=[g for g in plan['rebar_groups'] if g.get('id')!=target['id']]+generated
result['quantityDistributionReview']={'group_ids':[target['id']],'failures':[],'engineering_approved':False}
authorization={'explicit_request':True,'source_sha256':sorted(sources),'marks':[args.mark],
'scope':'user-authorized source cycle rhythm with drawing-N terminal selection'}
with args.output.open('x') as stream:json.dump({'result':result,'authorization':authorization},stream,ensure_ascii=False)
print(json.dumps({'generated':target['id'],'count':generated[0]['count'],'station_policy':generated[0]['quantity_distribution']['policy']}))
if __name__=='__main__':
p=argparse.ArgumentParser(description=__doc__);p.add_argument('job',type=Path)
p.add_argument('--mark',required=True);p.add_argument('--block',required=True);p.add_argument('--output',type=Path,required=True)
run(p.parse_args())