@chrono-meta/fh-gate 2.13.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/.claude/rules/fh_4axis_gate.md +35 -1
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/AGENTS.md +50 -0
  4. package/CLAUDE.md +14 -1
  5. package/README.ja.md +3 -3
  6. package/README.ko.md +3 -3
  7. package/README.md +4 -4
  8. package/README.zh.md +3 -3
  9. package/docs/ETHOS.md +21 -0
  10. package/docs/IDENTITIES.md +83 -0
  11. package/knowledge/shared/harness-core/fh_detail_protocols.md +77 -1
  12. package/knowledge/shared/harness-core/measurement-integrity-checklist.md +80 -0
  13. package/knowledge/shared/harness-core/ship_readiness_gate.md +199 -5
  14. package/knowledge/shared/learnings/subagent_invocations_log.yaml +173 -0
  15. package/knowledge/shared/rules/multi_session_close_protocol.md +7 -1
  16. package/package.json +23 -2
  17. package/plugins/fh-commons/.claude-plugin/plugin.json +2 -2
  18. package/plugins/fh-commons/skills/preprep/README.md +45 -0
  19. package/plugins/fh-commons/skills/preprep/SKILL.md +214 -0
  20. package/plugins/fh-commons/skills/preprep/canon_terms.example.yaml +36 -0
  21. package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_negative.md +7 -0
  22. package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_positive.md +8 -0
  23. package/plugins/fh-commons/skills/preprep/fixtures/progression_known_negative.md +13 -0
  24. package/plugins/fh-commons/skills/preprep/fixtures/progression_known_positive.md +13 -0
  25. package/plugins/fh-commons/skills/preprep/fixtures/promise_known_negative.md +9 -0
  26. package/plugins/fh-commons/skills/preprep/fixtures/promise_known_positive.md +7 -0
  27. package/plugins/fh-commons/skills/preprep/interslide_deps.py +223 -0
  28. package/plugins/fh-commons/skills/preprep/jargon_terms.example.yaml +40 -0
  29. package/plugins/fh-commons/skills/preprep/lane_adjacent_dup.py +86 -0
  30. package/plugins/fh-commons/skills/preprep/lane_progression.py +81 -0
  31. package/plugins/fh-commons/skills/preprep/lane_promise.py +121 -0
  32. package/plugins/fh-commons/skills/preprep/ooxml/c1_baseline.txt +12 -0
  33. package/plugins/fh-commons/skills/preprep/ooxml/gate.py +164 -0
  34. package/plugins/fh-commons/skills/preprep/preprep.py +789 -0
  35. package/plugins/fh-commons/skills/preprep/presentation_checklist.md +310 -0
  36. package/plugins/fh-commons/skills/preprep/surfaces.example.yaml +148 -0
  37. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  38. package/plugins/fh-meta/CHANGELOG.md +140 -0
  39. package/plugins/fh-meta/skills/install-wizard/SKILL.md +39 -0
  40. package/scripts/com.forge-harness.daily-report.plist +44 -0
  41. package/scripts/context_continuity_score.sh +894 -0
  42. package/scripts/daily_report.sh +208 -0
  43. package/scripts/digest_landing_check.sh +71 -0
  44. package/scripts/directional_diff_gate.sh +11 -4
  45. package/scripts/fh_session_load.sh +19 -0
  46. package/scripts/field_canon_preload.sh +44 -0
  47. package/scripts/fixture_guard_lib.sh +55 -0
  48. package/scripts/lane_runner_check.sh +34 -1
  49. package/scripts/launchd_wiring_check.sh +182 -0
  50. package/scripts/mapped_tracks.sh +69 -0
  51. package/scripts/novelty_claim_check.sh +5 -1
  52. package/scripts/package_coverage_check.sh +39 -0
  53. package/scripts/portability_lint.sh +117 -0
  54. package/scripts/prepush_guard_check.sh +2 -2
  55. package/scripts/public_surface_scan_files.sh +36 -1
  56. package/scripts/selfcheck.sh +171 -1
  57. package/scripts/session_close_check.sh +17 -0
  58. package/scripts/shell_name_boundary_scan.sh +30 -0
  59. package/scripts/sim_isolated_run.sh +484 -0
  60. package/scripts/test_branch_claim_lanes.sh +8 -3
  61. package/scripts/test_env_purity_lanes.sh +4 -1
  62. package/scripts/test_lane_runner_lanes.sh +75 -0
  63. package/scripts/test_mapped_tracks_lanes.sh +64 -2
  64. package/scripts/test_marker_address_lanes.sh +78 -0
  65. package/scripts/test_marker_soul_check_lanes.sh +36 -0
  66. package/scripts/test_memory_link_check.sh +3 -1
  67. package/scripts/test_node_check_lanes.sh +5 -2
  68. package/scripts/test_node_infra_delta_lanes.sh +3 -1
  69. package/scripts/test_peer_worktree_detect_lanes.sh +3 -1
  70. package/scripts/test_precommit_staged_drift_lanes.sh +91 -0
  71. package/scripts/test_preprep_adjacent_dup_lanes.sh +57 -0
  72. package/scripts/test_preprep_drift_anchor.sh +65 -0
  73. package/scripts/test_preprep_progression_lanes.sh +53 -0
  74. package/scripts/test_preprep_promise_lanes.sh +56 -0
  75. package/scripts/test_preprep_retired_lanes.sh +54 -0
  76. package/scripts/test_prepush_destructive_lanes.sh +5 -2
  77. package/scripts/test_prepush_stdin_integrity.sh +2 -2
  78. package/scripts/test_regression_guard_ci_lanes.sh +4 -1
  79. package/scripts/test_selfcheck_state_lanes.sh +19 -4
  80. package/scripts/test_session_close_lanes.sh +5 -5
  81. package/scripts/test_sim_isolated_run_lanes.sh +265 -0
  82. package/scripts/test_skill_canon_preload_lanes.sh +58 -0
  83. package/scripts/test_target_freeze_lanes.sh +3 -1
  84. package/scripts/test_verdict_watermark_lanes.sh +427 -0
  85. package/scripts/test_wizard_snippet_merge_lanes.sh +4 -1
  86. package/scripts/universal_guard_check.sh +1 -1
  87. package/templates/.git-hooks/pre-commit +426 -8
  88. package/templates/.git-hooks/pre-push +8 -3
  89. package/templates/predelete_check.sh +4 -2
  90. package/templates/regression_guard.sh +7 -1
@@ -0,0 +1,164 @@
1
+ import glob,re,os,sys
2
+ from lxml import etree
3
+ # 작업 트리: 인자 > 환경변수 OOXML_ROOT > 현재 디렉터리(v4 있으면 그쪽)
4
+ _root = sys.argv[1] if len(sys.argv)>1 else os.environ.get('OOXML_ROOT')
5
+ if not _root:
6
+ _root = 'v4' if os.path.isdir('v4/ppt/slides') else '.'
7
+ if not os.path.isdir(os.path.join(_root,'ppt','slides')):
8
+ print('GATE FAIL · 작업 트리를 못 찾음:',_root); sys.exit(1)
9
+ os.chdir(_root)
10
+ ok=True; P='http://schemas.openxmlformats.org/presentationml/2006/main'
11
+ _A='http://schemas.openxmlformats.org/drawingml/2006/main'
12
+ def fail(*a):
13
+ global ok; ok=False; print(' ❌',*a)
14
+ for p in glob.glob('**/*.xml',recursive=True)+glob.glob('**/*.rels',recursive=True):
15
+ try: etree.parse(p)
16
+ except Exception as e: fail('PARSE',p,e)
17
+ # ① 관계 참조 무결성 (repair 다이얼로그의 주범)
18
+ for kind in ('slides','notesSlides','slideLayouts','slideMasters','notesMasters'):
19
+ for p in sorted(glob.glob('ppt/%s/*.xml'%kind)):
20
+ x=open(p).read()
21
+ rp='ppt/%s/_rels/%s.rels'%(kind,os.path.basename(p))
22
+ rmap=set(re.findall(r'Id="([^"]+)"',open(rp).read())) if os.path.exists(rp) else set()
23
+ for attr,rid in re.findall(r'(r:(?:id|embed|link|pict|dm|lo|qs|cs))="([^"]+)"',x):
24
+ if rid not in rmap: fail('DANGLING',p,attr,rid)
25
+ # ② rels 대상 파일 존재
26
+ for rp in glob.glob('**/_rels/*.rels',recursive=True):
27
+ base=os.path.dirname(os.path.dirname(rp))
28
+ for tgt,mode in re.findall(r'Target="([^"]+)"(?:[^>]*TargetMode="([^"]*)")?',open(rp).read()):
29
+ if mode=='External' or tgt.startswith('http'): continue
30
+ f=os.path.normpath(os.path.join(base,tgt))
31
+ if not os.path.exists(f): fail('MISSING TARGET',rp,tgt)
32
+ # ③ cNvPr id 중복 · <a:t> 개행
33
+ for p in sorted(glob.glob('ppt/slides/slide*.xml')):
34
+ ids=[e.get('id') for e in etree.parse(p).iter('{%s}cNvPr'%P)]
35
+ d=[i for i in set(ids) if ids.count(i)>1]
36
+ if d: fail('DUP cNvPr',p,d)
37
+ for m in re.findall(r'<a:t>([^<]*)</a:t>',open(p).read()):
38
+ if '\n' in m or '\r' in m: fail('NEWLINE in a:t',p,repr(m[:30]))
39
+ # ④ 프레젠테이션 등록 / Content_Types / sldId
40
+ pres=open('ppt/presentation.xml').read()
41
+ m={rid:os.path.basename(t) for rid,t in re.findall(r'Id="([^"]+)"[^>]*Target="([^"]+)"',open('ppt/_rels/presentation.xml.rels').read())}
42
+ order=[m[r] for r in re.findall(r'<p:sldId[^>]*r:id="([^"]+)"',pres)]
43
+ ct=open('[Content_Types].xml').read()
44
+ for f in order:
45
+ if '/ppt/slides/%s"'%f not in ct: fail('CT missing',f)
46
+ sld=re.findall(r'<p:sldId id="(\d+)"',pres)
47
+ if len(set(sld))!=len(sld): fail('DUP sldId')
48
+ for p in glob.glob('ppt/slides/slide*.xml'):
49
+ if os.path.basename(p) not in order: fail('ORPHAN slide',p)
50
+ app=open('docProps/app.xml').read()
51
+ if '<Slides>%d</Slides>'%len(order) not in app: fail('app.xml Slides != %d'%len(order))
52
+ if '<Notes>%d</Notes>'%len(order) not in app: fail('app.xml Notes != %d'%len(order))
53
+
54
+ i=app.find('<TitlesOfParts>')
55
+ import re as _re
56
+ n_lp=len(_re.findall(r'<vt:lpstr>',app[i:]))
57
+ sz=int(_re.search(r'<TitlesOfParts><vt:vector size="(\d+)"',app).group(1))
58
+ if n_lp!=sz: fail('app.xml TitlesOfParts vector size %d != lpstr %d'%(sz,n_lp))
59
+
60
+ for _p in sorted(glob.glob('ppt/slides/slide*.xml')):
61
+ _t=etree.parse(_p).getroot().find('.//{%s}cSld/{%s}spTree'%(P,P))
62
+ _k=[etree.QName(e).localname for e in _t]
63
+ if _k[:2]!=['nvGrpSpPr','grpSpPr']: fail('spTree 순서 위반',_p,_k[:3])
64
+
65
+ # ── prstGeom 조정값 이름 검증 (2026-08-27 신설: round2SameRect 에 adj 하나만 줘서 두 번 깨졌다)
66
+ _A='http://schemas.openxmlformats.org/drawingml/2006/main'
67
+ _ADJ={'rect':set(),'ellipse':set(),'line':set(),'roundRect':{'adj'},
68
+ 'arc':{'adj1','adj2'},'round2SameRect':{'adj1','adj2'},'round2DiagRect':{'adj1','adj2'},
69
+ 'round1Rect':{'adj'},'triangle':{'adj'},'chevron':{'adj'},
70
+ 'circularArrow':{'adj1','adj2','adj3','adj4','adj5'},
71
+ 'rightArrow':{'adj1','adj2'},'leftArrow':{'adj1','adj2'},
72
+ 'upArrow':{'adj1','adj2'},'downArrow':{'adj1','adj2'}}
73
+ for _p in sorted(glob.glob('ppt/slides/slide*.xml')):
74
+ for _g in etree.parse(_p).getroot().iter('{%s}prstGeom'%_A):
75
+ _prst=_g.get('prst')
76
+ if _prst not in _ADJ: continue
77
+ _names={x.get('name') for x in _g.iter('{%s}gd'%_A)}
78
+ if _names and not _names <= _ADJ[_prst]:
79
+ fail('prstGeom 조정값 이름', _p, _prst, sorted(_names), '허용:', sorted(_ADJ[_prst]) or '없음')
80
+
81
+ # ── ⑤ Content_Types 역방향: Override 가 가리키는 파트가 실제로 있나 (2026-08-28 신설)
82
+ # 기존 ④ 는 «등록된 슬라이드가 CT 에 있나» 한 방향만 봤다. 슬라이드를 삭제하면
83
+ # CT 에 죽은 Override 가 남고, 그 파일은 PowerPoint 가 아예 열지 못한다.
84
+ # 실제로 40p 삭제 때 정규식이 ContentType 값의 '/' 때문에 매치되지 않아 2개가 남았다.
85
+ _over = set(re.findall(r'<Override PartName="([^"]+)"', ct))
86
+ for _o in sorted(_over):
87
+ if not _o.startswith(('/ppt/slides/','/ppt/notesSlides/')): continue
88
+ if not os.path.exists(_o.lstrip('/')): fail('CT ORPHAN Override', _o, '(파트 파일 없음)')
89
+ for _f in sorted(glob.glob('ppt/notesSlides/notesSlide*.xml')):
90
+ if '/%s"'%_f not in ct: fail('CT missing (notesSlide)', _f)
91
+
92
+ # ── ⑥ 화면 밖으로 나간 도형 (2026-08-28 신설: 26p 가 우측으로 1,854,400 EMU 벗어나 있었다)
93
+ _W,_H = (int(x) for x in (re.search(r'sldSz cx="(\d+)" cy="(\d+)"', pres).groups()))
94
+ for _p in sorted(glob.glob('ppt/slides/slide*.xml')):
95
+ for _sp in etree.parse(_p).getroot().iter():
96
+ if etree.QName(_sp).localname not in ('sp','pic','cxnSp','graphicFrame'): continue
97
+ _xf=_sp.find('.//{%s}spPr/{%s}xfrm'%(P,_A))
98
+ if _xf is None: _xf=_sp.find('.//{%s}xfrm'%_A)
99
+ if _xf is None: continue
100
+ _off=_xf.find('{%s}off'%_A); _ext=_xf.find('{%s}ext'%_A)
101
+ if _off is None or _ext is None: continue
102
+ _x,_y=int(_off.get('x')),int(_off.get('y')); _cx,_cy=int(_ext.get('cx')),int(_ext.get('cy'))
103
+ if _x+_cx > _W+10000 or _y+_cy > _H+10000 or _x < -10000 or _y < -10000:
104
+ _nv=_sp.find('.//{%s}cNvPr'%P)
105
+ fail('OFF-CANVAS', os.path.basename(_p), _nv.get('name') if _nv is not None else '?',
106
+ 'x %d~%d y %d~%d (화면 %dx%d)'%(_x,_x+_cx,_y,_y+_cy,_W,_H))
107
+
108
+ # ── ⑦ 열린 도형에 채움 (2026-08-28 신설: arc 를 카드로 오인해 채우면 부채꼴이 칠해진다)
109
+ _OPEN={'arc','line','straightConnector1','bentConnector2','bentConnector3',
110
+ 'curvedConnector2','curvedConnector3','curvedConnector4','curvedConnector5'}
111
+ for _p in sorted(glob.glob('ppt/slides/slide*.xml')):
112
+ for _sp in etree.parse(_p).getroot().iter('{%s}sp'%P):
113
+ _spPr=_sp.find('{%s}spPr'%P)
114
+ if _spPr is None: continue
115
+ _g=_spPr.find('{%s}prstGeom'%_A)
116
+ if _g is None or _g.get('prst') not in _OPEN: continue
117
+ if _spPr.find('{%s}solidFill'%_A) is not None:
118
+ _nv=_sp.find('.//{%s}cNvPr'%P)
119
+ fail('열린 도형에 채움', os.path.basename(_p),
120
+ _nv.get('name') if _nv is not None else '?', _g.get('prst'))
121
+
122
+ # ── ⑧ 선 굵기 토큰 래칫 (2026-08-28 신설)
123
+ # 체크리스트 C1 은 «구조 1pt · 테두리 3pt · 흐름 7pt · 강조 14pt» 네 토큰을 정한다.
124
+ # 그런데 실측하면 도형을 만들 때마다 눈대중으로 새 굵기가 생겨 42% 가 토큰 밖이었다.
125
+ # 🟥 전량 차단하면 첫 실행부터 막혀 --no-verify 를 훈련시킨다(도달불가 Done-When).
126
+ # 그래서 «지금»을 기준선에 박고 **늘어날 때만** 막는다. 줄면 낮추라고 알린다.
127
+ # 🟥 기준선은 «총합»이 아니라 «굵기별»이다 — 총합만 세면 어느 굵기가 새로 생겼는지
128
+ # 못 짚어서, 판정은 맞고 처방은 틀린 게이트가 된다.
129
+ _C1={12700:'구조 1pt',38100:'테두리 3pt',88900:'흐름 7pt',177800:'강조 14pt'}
130
+ _BASE=os.path.join(os.path.dirname(os.path.abspath(__file__)),'c1_baseline.txt')
131
+ _seen={}
132
+ for _p in sorted(glob.glob('ppt/slides/slide*.xml')):
133
+ for _l in etree.parse(_p).iter('{%s}ln'%_A):
134
+ _w=_l.get('w')
135
+ if not _w or int(_w) in _C1: continue
136
+ _seen.setdefault(int(_w),[]).append(os.path.basename(_p))
137
+ _now={k:len(v) for k,v in _seen.items()}
138
+ _dump=lambda d:'\n'.join('%d %d'%(k,d[k]) for k in sorted(d))
139
+ if os.path.exists(_BASE):
140
+ _prev={}
141
+ for _line in open(_BASE):
142
+ _line=_line.split('#')[0].strip()
143
+ if _line: _k,_v=_line.split(); _prev[int(_k)]=int(_v)
144
+ _grew={k:(_prev.get(k,0),v) for k,v in _now.items() if v>_prev.get(k,0)}
145
+ if _grew:
146
+ fail('C1 선 굵기 토큰 밖이 늘었다 —','허용:',' · '.join('%d(%s)'%(k,v) for k,v in _C1.items()))
147
+ for _w,(_a,_b) in sorted(_grew.items()):
148
+ _tag='새 굵기' if _a==0 else '증가'
149
+ print(' w=%-7d (%.2fpt) %d → %d [%s] 예: %s'%(_w,_w/12700,_a,_b,_tag,
150
+ ', '.join(sorted(set(_seen[_w]))[:3])))
151
+ print(' ↳ 위 굵기를 네 토큰 중 하나로 바꾸거나, 의도한 값이면 %s 를 갱신해라'%os.path.relpath(_BASE))
152
+ elif sum(_now.values())<sum(_prev.values()):
153
+ print(' ✅ C1 토큰 밖 %d → %d 로 줄었다. 기준선 갱신:'%(sum(_prev.values()),sum(_now.values())))
154
+ print(' python3 %s --write-c1-baseline'%os.path.relpath(__file__))
155
+ else:
156
+ print(' ⚠ C1 기준선 없음 — 토큰 밖 %d곳(%d종). 박으려면:'%(sum(_now.values()),len(_now)))
157
+ print(' python3 %s --write-c1-baseline'%os.path.relpath(__file__))
158
+ if '--write-c1-baseline' in sys.argv:
159
+ open(_BASE,'w').write('# C1 선 굵기 기준선 — «굵기 개수». gate.py ⑧ 이 읽는다.\n'+_dump(_now)+'\n')
160
+ print(' ✍ 기준선 기록: %s (%d종 %d곳)'%(os.path.relpath(_BASE),len(_now),sum(_now.values())))
161
+
162
+
163
+ print('GATE','PASS' if ok else 'FAIL','·',len(order),'장')
164
+ sys.exit(0 if ok else 1)