Skip to content

insightflo/edu-deck-skills / edu-deck

edu-deck

Flagged

Entry skill for education deck requests. Use FIRST when the user wants 교육자료, 강의 자료, 교육용 슬라이드, 직원 교육 덱, or a training series (예: "○○ 교육자료 만들어줘", "사내 교육 시리즈 만들어", "여러 편으로 나눠 교육 자료"). 판별 후 단일 발행(주제 하나, 파일 하나)이면 edu-deck-solo 경로를, 여러 편 시리즈·진도 관리·허브가 필요하면 edu-deck-series 경로를 탄다. 애매하면 사용자에게 한 번 묻는다. 덱 제작 절차는 이 스킬에 없고 각 하위 스킬에 있다.

FileKindSize
SKILL.mdskill md14.1 KB
distribution/NOTICES.mdmarkdown1.5 KB
distribution/README.mdmarkdown3.4 KB
distribution/USAGE.mdmarkdown5.5 KB
shared/assets/css/components.cssother23.2 KB
shared/assets/css/core.cssother15.1 KB
shared/assets/css/pack-runtime.cssother9.4 KB
shared/assets/css/responsive.cssother10.6 KB
shared/assets/css/theme-switch.cssother3.4 KB
shared/assets/css/themes.cssother11.2 KB
shared/assets/css/tokens.cssother2.5 KB
shared/assets/css/viewer.cssother17.5 KB
shared/assets/css/visual-motion.cssother19.3 KB
shared/assets/fonts/GowunBatang-Regular.woff2binary523.3 KB
shared/assets/fonts/GowunDodum-Regular.woff2binary435.5 KB
shared/assets/fonts/OFL-GowunBatang.txtmarkdown4.3 KB
shared/assets/fonts/OFL-GowunDodum.txtmarkdown4.3 KB
shared/assets/fonts/OFL.txtmarkdown4.3 KB
shared/assets/fonts/PretendardVariable.woff2binary2.0 MB
shared/assets/icons/base.svgother9.3 KB
shared/assets/icons/extra.svgother18.4 KB
shared/assets/icons/si.svgother7.6 KB
shared/assets/js/cover-art.jsscript82.9 KB
shared/assets/js/motion.jsscript84.4 KB
shared/assets/js/patterns.jsscript7.2 KB
shared/assets/js/responsive.jsscript21.6 KB
shared/assets/js/sheet.jsscript1.5 KB
shared/assets/js/study.jsscript33.6 KB
shared/assets/js/talk.jsscript9.2 KB
shared/assets/js/themes.jsscript7.8 KB
shared/assets/js/viewer.jsscript29.1 KB
shared/assets/kit/patterns.cssother5.4 KB
shared/assets/kit/stack.jsscript15.8 KB
shared/assets/pack-shell.htmlother2.9 MB
shared/assets/packs/atlas/style.cssother1.7 KB
shared/assets/packs/atlas/template.htmlother2.1 KB
shared/assets/packs/base.cssother2.2 KB
shared/assets/packs/briefing/style.cssother1.4 KB
shared/assets/packs/briefing/template.htmlother1.7 KB
shared/assets/packs/casebook/style.cssother1.4 KB
shared/assets/packs/casebook/template.htmlother1.5 KB
shared/assets/packs/catalog.jsonconfig10.3 KB
shared/assets/packs/editorial/style.cssother1.2 KB
shared/assets/packs/editorial/template.htmlother2.0 KB
shared/assets/packs/field/style.cssother1.5 KB
shared/assets/packs/field/template.htmlother1.6 KB
shared/assets/packs/flows.jsonconfig21.8 KB
shared/assets/packs/lab/style.cssother1.4 KB
shared/assets/packs/lab/template.htmlother1.6 KB
shared/assets/packs/seminar/style.cssother1.4 KB
shared/assets/packs/seminar/template.htmlother1.7 KB
shared/assets/packs/workbook/style.cssother1.6 KB
shared/assets/packs/workbook/template.htmlother1.7 KB
shared/assets/shell.htmlother2.9 MB
shared/assets/snippets/01-cover-bauhaus.htmlother3.3 KB
shared/assets/snippets/01-cover-bento.htmlother6.7 KB
shared/assets/snippets/01-cover-bigstat.htmlother2.3 KB
shared/assets/snippets/01-cover-blueprint.htmlother4.3 KB
shared/assets/snippets/01-cover-bold-poster.htmlother3.4 KB
shared/assets/snippets/01-cover-center.htmlother2.5 KB
shared/assets/snippets/01-cover-diagram.htmlother2.4 KB
shared/assets/snippets/01-cover-editorial-lab.htmlother3.6 KB
shared/assets/snippets/01-cover-future-portal.htmlother3.6 KB
shared/assets/snippets/01-cover-learning-path.htmlother3.7 KB
shared/assets/snippets/01-cover-modular-cards.htmlother3.9 KB
shared/assets/snippets/01-cover-monograph.htmlother3.1 KB
shared/assets/snippets/01-cover-mosaic.htmlother2.4 KB
shared/assets/snippets/01-cover-paper-collage.htmlother3.1 KB
shared/assets/snippets/01-cover-split.htmlother2.8 KB
shared/assets/snippets/01-cover-stripes.htmlother2.4 KB
shared/assets/snippets/01-cover-workbook-notes.htmlother3.8 KB
shared/assets/snippets/02-agenda.htmlother21.2 KB
shared/assets/snippets/03-timeline.htmlother14.2 KB
shared/assets/snippets/04-map.htmlother16.3 KB
shared/assets/snippets/05-mechanism.htmlother14.5 KB
shared/assets/snippets/06-traits-grid.htmlother16.9 KB
shared/assets/snippets/07-meter.htmlother17.1 KB
shared/assets/snippets/08-compare-2.htmlother18.2 KB
shared/assets/snippets/09-compare-table.htmlother16.0 KB
shared/assets/snippets/10-hub.htmlother15.1 KB
shared/assets/snippets/11-levels.htmlother15.1 KB
shared/assets/snippets/12-tile-grid.htmlother12.3 KB
shared/assets/snippets/13-sequence.htmlother15.0 KB
shared/assets/snippets/14-mapping.htmlother13.7 KB
shared/assets/snippets/15-mock-legend.htmlother11.2 KB
shared/assets/snippets/16-mock-options.htmlother10.5 KB
shared/assets/snippets/17-statement.htmlother7.5 KB
shared/assets/snippets/18-build-up.htmlother14.0 KB
shared/assets/snippets/19-frame-form.htmlother9.2 KB
shared/assets/snippets/20-before-after.htmlother13.6 KB
shared/assets/snippets/21-worked-example.htmlother16.5 KB
shared/assets/snippets/22-worked-artifact.htmlother9.2 KB
shared/assets/snippets/23-quiz-ab.htmlother7.1 KB
shared/assets/snippets/24-quiz-sort.htmlother8.0 KB
shared/assets/snippets/25-quiz-ox.htmlother6.9 KB
shared/assets/snippets/26-rules-dark.htmlother13.7 KB
shared/assets/snippets/27-checklist.htmlother8.3 KB
shared/assets/snippets/28-sources.htmlother9.8 KB
shared/assets/snippets/29-closing.htmlother6.0 KB
shared/assets/snippets/30-check.htmlother10.3 KB
shared/assets/snippets/31-stat-strip.htmlother11.4 KB
shared/assets/snippets/32-screen-cite.htmlother14.1 KB
shared/assets/snippets/33-chart-bar.htmlother17.0 KB
shared/assets/snippets/34-chart-line.htmlother17.9 KB
shared/assets/snippets/35-explore.htmlother9.6 KB
shared/assets/snippets/36-detail-sheet.htmlother9.9 KB
shared/assets/snippets/37-arch-flow.htmlother17.2 KB
shared/assets/snippets/38-part-divider.htmlother7.0 KB
shared/assets/snippets/39-quadrant.htmlother10.0 KB
shared/assets/snippets/40-flashcards.htmlother12.4 KB
shared/assets/snippets/41-ops-report.htmlother22.8 KB
shared/assets/snippets/42-sankey-flow.htmlother9.7 KB
shared/assets/snippets/43-decision-tree.htmlother8.7 KB
shared/assets/snippets/44-kanban-board.htmlother9.4 KB
shared/assets/snippets/45-version-graph.htmlother8.9 KB
shared/assets/snippets/46-event-fanout.htmlother8.1 KB
shared/assets/snippets/47-route-tour.htmlother9.3 KB
shared/assets/snippets/48-waterfall.htmlother7.9 KB
shared/assets/snippets/49-mesh-network.htmlother7.8 KB
shared/assets/snippets/50-heatmap-grid.htmlother11.9 KB
shared/assets/snippets/51-swimlane.htmlother8.2 KB
shared/assets/snippets/52-cycle-ring.htmlother7.1 KB
shared/assets/snippets/53-verdict.htmlother6.9 KB
shared/assets/snippets/54-diagnose.htmlother3.0 KB
shared/assets/snippets/55-window-frame.htmlother3.3 KB
shared/assets/snippets/56-gate-chain.htmlother5.6 KB
shared/assets/snippets/patterns/code.htmlother1.2 KB
shared/assets/snippets/patterns/faq.htmlother839 B
shared/assets/snippets/patterns/fx.htmlother2.8 KB
shared/assets/snippets/patterns/pin-shot.htmlother1.5 KB
shared/assets/snippets/patterns/tabs.htmlother1.1 KB
shared/assets/style-sheets/README.mdmarkdown1.7 KB
shared/assets/style-sheets/previews/clean-professional.pngbinary1.4 MB
shared/assets/style-sheets/previews/creative-magazine.pngbinary2.1 MB
shared/assets/style-sheets/previews/data-dashboard.pngbinary1.3 MB
shared/assets/style-sheets/previews/e-ink-magazine.pngbinary2.4 MB
shared/assets/style-sheets/previews/handdrawn-technical.pngbinary2.0 MB
shared/assets/style-sheets/previews/handdrawn-whiteboard.pngbinary1.9 MB
shared/assets/style-sheets/previews/mckinsey-style.pngbinary1.7 MB
shared/assets/style-sheets/previews/party-government-red.pngbinary1.5 MB
shared/assets/style-sheets/previews/retro-flat-illustration.pngbinary2.3 MB
shared/assets/style-sheets/previews/scientific-defense.pngbinary1.4 MB
shared/assets/style-sheets/previews/teaching-courseware.pngbinary1.4 MB
shared/assets/style-sheets/previews/warm-handmade.pngbinary2.3 MB
shared/assets/style-sheets/党政红风格.mdmarkdown8.5 KB
shared/assets/style-sheets/创意杂志风.mdmarkdown3.3 KB
shared/assets/style-sheets/复古扁平插画风.mdmarkdown3.3 KB
shared/assets/style-sheets/手绘技术解释风.mdmarkdown4.7 KB
shared/assets/style-sheets/手绘白板风.mdmarkdown3.3 KB
shared/assets/style-sheets/教学课件风.mdmarkdown9.7 KB
shared/assets/style-sheets/数据仪表盘风.mdmarkdown3.4 KB
shared/assets/style-sheets/清爽专业风.mdmarkdown4.4 KB
shared/assets/style-sheets/温暖手工风.mdmarkdown3.3 KB
shared/assets/style-sheets/电子墨水杂志风.mdmarkdown4.6 KB
shared/assets/style-sheets/科研答辩风.mdmarkdown9.1 KB
shared/assets/style-sheets/麦肯锡风格.mdmarkdown14.8 KB
shared/dev/README.mdmarkdown12.7 KB
shared/dev/crayon-reference.htmlother19.1 KB
shared/dev/defect_test.pyscript5.7 KB
shared/dev/fill_test.pyscript3.4 KB
shared/dev/make_icons.pyscript10.0 KB
shared/dev/make_snippets.pyscript16.0 KB
shared/dev/pack_shell_template.htmlother35.7 KB
shared/dev/port.pyscript1.5 KB
shared/dev/shell_template.htmlother61.0 KB
shared/dev/test_absorb_snippets.pyscript5.5 KB
shared/dev/test_arch_lanes.pyscript12.0 KB
shared/dev/test_arch_si.pyscript17.5 KB
shared/dev/test_arch_trace.pyscript5.6 KB
shared/dev/test_check_talk_est.pyscript4.1 KB
shared/dev/test_chrome_menu.pyscript13.2 KB
shared/dev/test_consult_chart.pyscript35.9 KB
shared/dev/test_consult_regen.pyscript3.5 KB
shared/dev/test_consulting_check.pyscript7.4 KB
shared/dev/test_contrast_backdrop.pyscript8.6 KB
shared/dev/test_contrast_matrix.pyscript9.2 KB
shared/dev/test_cover_art.pyscript10.7 KB
shared/dev/test_cover_custom.pyscript10.8 KB
shared/dev/test_cover_rework.pyscript8.3 KB
shared/dev/test_dblclick_finish.pyscript6.5 KB
shared/dev/test_diagram_variants.pyscript13.8 KB
shared/dev/test_extract_copy.pyscript7.3 KB
shared/dev/test_extract_style.pyscript13.8 KB
shared/dev/test_figslot.pyscript14.0 KB
shared/dev/test_final_gate.pyscript2.5 KB
shared/dev/test_flint_model.pyscript5.5 KB
shared/dev/test_flint_theme.pyscript4.6 KB
shared/dev/test_free_mode.pyscript10.7 KB
shared/dev/test_fx_absorb.pyscript13.8 KB
shared/dev/test_fx_draft.pyscript38.0 KB
shared/dev/test_fx_patterns.pyscript16.8 KB
shared/dev/test_key_motion.pyscript9.3 KB
shared/dev/test_koboyo_icons.pyscript8.6 KB
shared/dev/test_miniflow.pyscript11.7 KB
shared/dev/test_motion_techniques.pyscript11.9 KB
shared/dev/test_ops_report.pyscript11.4 KB
shared/dev/test_pack_browser.pyscript15.7 KB
shared/dev/test_pack_checker.pyscript10.1 KB
shared/dev/test_pack_icons.pyscript6.5 KB
shared/dev/test_pack_router.pyscript5.1 KB

shared/dev/test_consult_chart.py

View on GitHub
"""Acceptance: chart_gen.mjs — 컨설팅 차트 생성기(waterfall · ranked-bar-h · diverging-bar).

[검사 항목]
- 결정성: 같은 모델 → 같은 바이트(2회 실행). 레이아웃·정렬에 시간·난수·로캘이 없다는 증거.
- 계산 가드: waterfall 시작+증감 합계가 calc.expectTotal 과 다르면 exit 1 — 수치-주장
  불일치를 사람 검토가 아니라 생성 시점에 막는다(이 스킬의 핵심 안전 장치).
- 출처 계약: source.text·synthetic 누락은 exit 1. synthetic:true 면 "가상 데이터"가
  출처 블록에 강제로 새겨진다.
- 주석·강조 계약: main 2개 이상·sub 3개 이상, highlight/on 이 data 에 없는 label 은 exit 1.
- 산출 조각: script·SMIL·CSS 애니메이션 0 · data-step 존재 · k-* 클래스/var(--…)만 ·
  출처 블록 항상 존재 · 모션은 엔진 속성(data-step/.wf/data-fx/data-count)뿐.

[실행] cd edu-deck/shared && python3 -m unittest dev.test_consult_chart -v
[주의] node 18+ 가 PATH 에 있어야 한다(없으면 skip). 저장소에는 아무것도 쓰지 않는다(임시 폴더 사용).
"""
import json
import re
import shutil
import subprocess
import tempfile
import unittest
from pathlib import Path

S = Path(__file__).resolve().parents[1]      # edu-deck/shared
ROOT = S.parents[1]                          # 저장소 루트
GEN = ROOT / 'consulting-deck' / 'charts' / 'chart_gen.mjs'
EX = ROOT / 'consulting-deck' / 'charts' / 'examples'
WF = EX / 'wf-it-cost.json'
RB = EX / 'rb-ai-gap.json'
DB = EX / 'db-cost-yoy.json'
ST = EX / 'st-cost-mix.json'
LN = EX / 'ln-margin-trend.json'
SC = EX / 'sc-practice.json'
HM = EX / 'hm-usage.json'
MX = EX / 'mx-portfolio.json'
TN = EX / 'tn-sensitivity.json'
SK = EX / 'sk-budget.json'
PA = EX / 'pa-defect.json'
BL = EX / 'bl-kpi.json'
DM = EX / 'db-cost-shift.json'
SL = EX / 'sl-share.json'
WA = EX / 'wf-cost-mix.json'
P3A = [ST, LN, SC, HM, MX, TN, SK, PA]
P4 = [BL, DM, SL, WA]
NODE = shutil.which('node')


def run(model_path, out=None, extra=()):
    """생성기 실행 — (returncode, stdout+stderr). out 이 있으면 그 파일에 쓴다."""
    cmd = [NODE, str(GEN), '--in', str(model_path)]
    if out:
        cmd += ['-o', str(out)]
    cmd += list(extra)
    p = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
    return p.returncode, (p.stdout + p.stderr)


@unittest.skipUnless(NODE, 'node 없음')
class ConsultChartTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.tmp = Path(tempfile.mkdtemp(prefix='edudeck-cchart-'))

    @classmethod
    def tearDownClass(cls):
        shutil.rmtree(cls.tmp, ignore_errors=True)

    def _mutate(self, src, fn, name):
        model = json.loads(Path(src).read_text(encoding='utf-8'))
        fn(model)
        p = self.tmp / name
        p.write_text(json.dumps(model, ensure_ascii=False), encoding='utf-8')
        return p

    # ── 결정성 ──────────────────────────────────────────────────────
    def test_three_types_deterministic(self):
        for src in (WF, RB, DB):
            a, b = self.tmp / (src.stem + 'a.html'), self.tmp / (src.stem + 'b.html')
            for f in (a, b):
                code, log = run(src, f)
                self.assertEqual(code, 0, log)
            self.assertEqual(a.read_bytes(), b.read_bytes(), f'{src.name}: 두 실행 결과가 다르다')

    # ── 계산 가드 ───────────────────────────────────────────────────
    def test_waterfall_sum_mismatch_rejected(self):
        def bad(m):
            m['chart']['calc']['expectTotal'] = 900
        p = self._mutate(WF, bad, 'sum.json')
        code, log = run(p, self.tmp / 'sum.html')
        self.assertEqual(code, 1)
        self.assertIn('합계 불일치', log)
        self.assertIn('expectTotal', log)

    def test_waterfall_total_value_mismatch_rejected(self):
        def bad(m):
            m['chart']['data'][-1]['value'] = 880
        p = self._mutate(WF, bad, 'tot.json')
        code, log = run(p, self.tmp / 'tot.html')
        self.assertEqual(code, 1)
        self.assertIn('누적', log)

    # ── 출처 계약 ───────────────────────────────────────────────────
    def test_missing_source_rejected(self):
        def bad(m):
            del m['source']
        p = self._mutate(RB, bad, 'nosrc.json')
        code, log = run(p, self.tmp / 'nosrc.html')
        self.assertEqual(code, 1)
        self.assertIn('source.text', log)

    def test_missing_synthetic_rejected(self):
        def bad(m):
            del m['source']['synthetic']
        p = self._mutate(RB, bad, 'nosyn.json')
        code, log = run(p, self.tmp / 'nosyn.html')
        self.assertEqual(code, 1)
        self.assertIn('synthetic', log)

    def test_synthetic_flag_forces_marker(self):
        out = self.tmp / 'wf.html'
        code, log = run(WF, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('가상 데이터', html)
        self.assertIn('Source:', html)
        # synthetic:false 는 표기 없이 통과해야 한다
        p = self._mutate(WF, lambda m: m['source'].__setitem__('synthetic', False), 'real.json')
        out2 = self.tmp / 'real.html'
        code, log = run(p, out2)
        self.assertEqual(code, 0, log)
        self.assertNotIn('가상 데이터', out2.read_text(encoding='utf-8'))

    # ── 주석·강조 계약 ──────────────────────────────────────────────
    def test_annotation_overflow_rejected(self):
        def bad(m):
            m['chart']['annotations'].append({'label': '둘째 핵심', 'on': '툴 통합', 'kind': 'main'})
        p = self._mutate(WF, bad, 'ann.json')
        code, log = run(p, self.tmp / 'ann.html')
        self.assertEqual(code, 1)
        self.assertIn('annotations 초과', log)

    def test_annotation_unknown_target_rejected(self):
        def bad(m):
            m['chart']['annotations'][0]['on'] = '없는항목'
        p = self._mutate(WF, bad, 'annon.json')
        code, log = run(p, self.tmp / 'annon.html')
        self.assertEqual(code, 1)
        self.assertIn('없는항목', log)

    def test_highlight_unknown_label_rejected(self):
        def bad(m):
            m['chart']['highlight'].append('없는항목')
        p = self._mutate(RB, bad, 'hl.json')
        code, log = run(p, self.tmp / 'hl.html')
        self.assertEqual(code, 1)
        self.assertIn('없는항목', log)

    # ── 스키마 필수·범위 ────────────────────────────────────────────
    def test_missing_question_rejected(self):
        def bad(m):
            del m['chart']['question']
        p = self._mutate(RB, bad, 'noq.json')
        code, log = run(p, self.tmp / 'noq.html')
        self.assertEqual(code, 1)
        self.assertIn('question', log)

    def test_data_count_out_of_range_rejected(self):
        def bad(m):
            m['chart']['data'] = m['chart']['data'][:2]
        p = self._mutate(RB, bad, 'few.json')
        code, log = run(p, self.tmp / 'few.html')
        self.assertEqual(code, 1)
        self.assertIn('범위', log)

    def test_ranked_negative_rejected(self):
        def bad(m):
            m['chart']['data'][0]['value'] = -3
        p = self._mutate(RB, bad, 'neg.json')
        code, log = run(p, self.tmp / 'neg.html')
        self.assertEqual(code, 1)
        self.assertIn('diverging-bar', log)

    # ── 산출 조각 계약 ──────────────────────────────────────────────
    def test_fragment_contract(self):
        for src in (WF, RB, DB):
            out = self.tmp / (src.stem + '-frag.html')
            code, log = run(src, out)
            self.assertEqual(code, 0, log)
            html = out.read_text(encoding='utf-8')
            for bad in ('<script', '<animate', '@keyframes', 'requestAnimationFrame', 'http://', 'https://'):
                self.assertNotIn(bad, html, f'{src.name}: {bad} 발견')
            self.assertIn('data-step=', html, f'{src.name}: data-step 없음')
            self.assertIn('<aside class="notes">', html)
            self.assertIn('class="dg"', html)
            self.assertIn('Source:', html, f'{src.name}: 출처 블록 없음')
            self.assertIn('class="c-src"', html, f'{src.name}: c-src 출처 블록 없음')
            self.assertNotIn('<p class="small"', html, f'{src.name}: 구형 p.small 출처 블록 잔존')
            # 색은 토큰만 — hex 색 코드 금지
            self.assertIsNone(re.search(r'#[0-9a-fA-F]{3,8}\b', html), f'{src.name}: hex 색 발견')
            # 모션은 엔진 속성뿐 — data-lint="svg-diagram" 은 도식 린트 표식(diagram_lint 계약)
            attrs = set(re.findall(r'\bdata-[a-z-]+', html))
            self.assertTrue(attrs <= {'data-archetype', 'data-variant', 'data-step', 'data-fx', 'data-count', 'data-lint'},
                            f'{src.name}: 예상 밖 속성 {attrs}')

    # ── 타입별 형태 ─────────────────────────────────────────────────
    def test_waterfall_structure(self):
        out = self.tmp / 'wf-struct.html'
        code, log = run(WF, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-archetype="waterfall"', html)
        self.assertEqual(html.count('class="wf"'), 6, '항목 수만큼 .wf 단계 그룹')
        self.assertIn('data-count', html, '최종 합계는 count-up')
        self.assertIn('k-solid-n', html, 'total 막대는 k-solid-n')
        self.assertIn('−140', html, '증감 라벨은 부호 포함')
        self.assertIn('>핵심<', html, 'main 주석은 캡슐 배지 표식')

    def test_ranked_sorted_and_highlight(self):
        out = self.tmp / 'rb-struct.html'
        code, log = run(RB, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="ranked"', html)
        # 값 내림차순 — 첫 단계 그룹의 항목이 최대값 62
        first = re.search(r'<g data-step="1">.*?</g>', html, re.S).group(0)
        self.assertIn('업무 재설계 병행', first)
        self.assertIn('>62<', first)
        self.assertIn('var(--accent)', first, 'highlight 는 초점색')
        self.assertIn('data-fx="bar-grow"', html)

    def test_diverging_directions(self):
        out = self.tmp / 'db-struct.html'
        code, log = run(DB, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="diverging"', html)
        self.assertIn('transform-origin:left center', html, '양수 막대는 왼쪽 고정 성장')
        self.assertIn('transform-origin:right center', html, '음수 막대는 오른쪽(0축) 고정 성장')
        self.assertIn('+11.8', html)
        self.assertIn('−5.4', html)

    # ── 축 생략(axis break) ─────────────────────────────────────────
    def test_axis_break_auto(self):
        # base(1240) 가 max 의 100% ≥60% — 자동 축 생략으로 증감 막대가 전부 18px 이상
        out = self.tmp / 'wf-brk.html'
        code, log = run(WF, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        # 증감 막대 = 파랑/초점색/회색 fill(base·total 의 k-solid-n 제외)
        delta_heights = [float(h) for h, attrs in
                         re.findall(r'<rect[^>]*height="([\d.]+)"([^>]*)>', html)
                         if 'rx=' not in attrs and
                         ('k-solid-b' in attrs or 'var(--accent)' in attrs or 'var(--muted)' in attrs)]
        self.assertEqual(len(delta_heights), 4)
        self.assertTrue(all(h >= 18 for h in delta_heights),
                        f'증감 막대 {delta_heights} — 축 생략 후에도 18px 미만')
        self.assertEqual(html.count('class="axis-brk"'), 2, 'base·total 막대에 축 생략 마크 2쌍')

    def test_axis_break_explicit(self):
        # axisBreak=800 명시 — sc=360/440 → -140 막대는 114.55px
        p = self._mutate(WF, lambda m: m['chart']['measure'].__setitem__('axisBreak', 800), 'brk800.json')
        out = self.tmp / 'brk800.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('height="114.55"', html, 'axisBreak 명시 스케일 미적용')
        # 범위 밖 명시(≥최소누적)는 무시+경고
        p2 = self._mutate(WF, lambda m: m['chart']['measure'].__setitem__('axisBreak', 5000), 'brkX.json')
        code, log = run(p2, self.tmp / 'brkX.html')
        self.assertEqual(code, 0, log)

    def test_axis_break_min_bar_floor(self):
        # 생략 활성 시 작은 증감 막대도 18px 가시 하한 — 상단 누적 위치는 실값 유지
        # (-15억 막대는 스케일상 13px — 클램프가 없으면 실패해야 한다)
        def mk(m):
            m['chart']['measure']['axisBreak'] = 830
            m['chart']['data'].insert(4, {'label': '사무용 소액', 'value': -15, 'kind': 'delta'})
            m['chart']['calc']['expectTotal'] = 875
            m['chart']['data'][-1]['value'] = 875
        p = self._mutate(WF, mk, 'brk830.json')
        out = self.tmp / 'brk830.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        hs = [float(h) for h in __import__('re').findall(r'height="([0-9.]+)"', html)]
        self.assertTrue(all(h >= 18 for h in hs), f'18px 미만 막대: {hs}')

    # ── 막대 역할별 색 분리 ─────────────────────────────────────────
    def test_role_colors(self):
        out = self.tmp / 'wf-col.html'
        code, log = run(WF, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertGreaterEqual(html.count('class="k-solid-n"'), 2, 'base·total 은 잉크(k-solid-n)')
        self.assertIn('class="k-solid-b"', html, '일반 증감은 파랑(k-solid-b)')
        self.assertIn('fill="var(--accent)"', html, 'highlight 증감은 초점색')
        self.assertRegex(html, r'fill="var\(--muted\)" stroke="var\(--soft\)"', 'oneoff 증감은 회색+테두리')

    # ── 단위·출처 마크업 ────────────────────────────────────────────
    def test_unit_label_all_types(self):
        for src in (WF, RB, DB):
            out = self.tmp / (src.stem + '-unit.html')
            code, log = run(src, out)
            self.assertEqual(code, 0, log)
            self.assertIn('(단위:', out.read_text(encoding='utf-8'), f'{src.name}: 단위 표기 없음')

    def test_source_block_markup(self):
        out = self.tmp / 'wf-src.html'
        code, log = run(WF, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('<p class="c-note" data-step="6"><b>방법론·한계</b>', html)
        self.assertIn('<div class="c-src" data-step="6">', html)
        self.assertIn('<p class="s-syn">가상 데이터</p>', html)
        # synthetic:false → s-syn 없음 · note 없으면 c-note 없음
        def real(m):
            m['source']['synthetic'] = False
            del m['source']['note']
        p = self._mutate(WF, real, 'real2.json')
        out2 = self.tmp / 'real2.html'
        code, log = run(p, out2)
        self.assertEqual(code, 0, log)
        h2 = out2.read_text(encoding='utf-8')
        self.assertNotIn('s-syn', h2)
        self.assertNotIn('c-note', h2)
        self.assertIn('c-src', h2)

    # ── 주석 위치(겹침 없음) ────────────────────────────────────────
    def test_annotations_clear_of_axis_labels(self):
        out = self.tmp / 'wf-ann.html'
        code, log = run(WF, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        # waterfall: 항목 라벨 y=508 — 주석 라인은 ±10px 안에 들어오면 안 된다
        ann_ys = [float(y) for y in re.findall(r'<text x="[\d.]+" y="([\d.]+)" font-size="2[04]"[^>]*class="k-t-[ot]"', html)]
        self.assertTrue(ann_ys, 'waterfall 주석 없음')
        for y in ann_ys:
            self.assertFalse(498 < y < 518, f'주석 y={y} 가 항목 라벨(508)과 겹침')
        # 리더선 — 주석마다 점선 var(--accent) 세로선
        self.assertGreaterEqual(html.count('stroke="var(--accent)" stroke-width="2"'), len(ann_ys) - 1)

    def test_ranked_mixed_annotations(self):
        # rb 예시: main 은 인라인 불가 → 막대 아래(행 가산), sub 2개는 수치 뒤 인라인
        out = self.tmp / 'rb-ann.html'
        code, log = run(RB, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('재설계 유무가 성과를 7배 가른다', html)   # 아래 배치는 원문 유지(넓은 폭)
        self.assertIn('목표 연동 시 전환율 2배', html)
        self.assertIn('>핵심<', html, 'main 주석 캡슐 배지')
        self.assertIn('>참고<', html, 'sub 주석 캡슐 배지')
        # 주석 y 가 다른 항목 라벨 y 와 겹치지 않는지 — 그룹별 비교
        groups = re.findall(r'<g data-step="\d+">(.*?)</g>', html, re.S)
        name_ys = []
        ann_positions = []   # (자기 그룹 name_y, 주석 y)
        for g in groups:
            ny2 = re.search(r'<text x="300" y="([\d.]+)"', g)
            name_y = float(ny2.group(1)) if ny2 else None
            if name_y is not None:
                name_ys.append(name_y)
            for ay in re.findall(r'<text[^>]*y="([\d.]+)"[^>]*font-size="2[04]"[^>]*class="k-t-[ot]"', g):
                ann_positions.append((name_y, float(ay)))
        for name_y, ay in ann_positions:
            others = {y for y in name_ys if y != name_y}
            for y in others:
                self.assertNotAlmostEqual(ay, y, delta=10,
                                          msg=f'주석 y={ay} 가 다른 항목 라벨 y={y} 와 겹침')

    # ── Phase 3a: 8타입 공통 계약 ───────────────────────────────────
    def test_p3a_eight_types_deterministic(self):
        for src in P3A:
            o1, o2 = self.tmp / (src.stem + 'a.html'), self.tmp / (src.stem + 'b.html')
            code, log = run(src, o1)
            self.assertEqual(code, 0, f'{src.name}: {log}')
            code, log = run(src, o2)
            self.assertEqual(code, 0, f'{src.name}: {log}')
            self.assertEqual(o1.read_bytes(), o2.read_bytes(), f'{src.name}: 비결정적 출력')
            html = o1.read_text(encoding='utf-8')
            for bad in ('<script', '<animate', '@keyframes', 'requestAnimationFrame'):
                self.assertNotIn(bad, html, f'{src.name}: {bad}')
            self.assertIn('data-step=', html, f'{src.name}: data-step 없음')
            self.assertIn('class="c-src"', html, f'{src.name}: 출처 블록 없음')
            self.assertIn('(단위:', html, f'{src.name}: 단위 표기 없음')
            self.assertIsNone(re.search(r'#[0-9a-fA-F]{3,8}\b', html), f'{src.name}: hex 색')

    # ── stacked-bar ─────────────────────────────────────────────────
    def test_stacked_total_mismatch_rejected(self):
        def bad(m):
            m['chart']['data'][0]['total'] = 999
        p = self._mutate(ST, bad, 'st-bad.json')
        code, log = run(p, self.tmp / 'st-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('세그먼트 합', log)

    def test_stacked_structure(self):
        out = self.tmp / 'st-ok.html'
        code, log = run(ST, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="stacked"', html)
        self.assertIn('fill="var(--muted)"', html, 'oneoff 세그먼트 회색 없음')
        self.assertIn('var(--accent)', html, 'highlight 세그먼트 없음')
        # ztd 참조 재설계(2026-11-09): 농도(opacity) 순환 → 회색 트랙 램프 + 종이색 분리선
        self.assertGreaterEqual(html.count('stroke="var(--paper)" stroke-width="2.5"'), 3,
                                '세그먼트 분리선(종이색 stroke) 부족')
        self.assertIn('var(--track)', html, '비초점 세그먼트 트랙 램프 없음')

    # ── line ────────────────────────────────────────────────────────
    def test_line_series_len_mismatch_rejected(self):
        def bad(m):
            m['chart']['series'][0]['points'] = [1, 2, 3]
        p = self._mutate(LN, bad, 'ln-bad.json')
        code, log = run(p, self.tmp / 'ln-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('points 수', log)

    def test_line_structure(self):
        out = self.tmp / 'ln-ok.html'
        code, log = run(LN, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="line"', html)
        self.assertIn('opacity=".14"', html, 'fill 계열 면적 없음')
        self.assertIn('stroke="var(--accent)"', html, 'highlight 계열 초점색 없음')

    # ── scatter ─────────────────────────────────────────────────────
    def test_scatter_axis_label_required(self):
        def bad(m):
            del m['chart']['measure']['x']
        p = self._mutate(SC, bad, 'sc-bad.json')
        code, log = run(p, self.tmp / 'sc-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('measure.x', log)

    def test_scatter_structure(self):
        out = self.tmp / 'sc-ok.html'
        code, log = run(SC, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="scatter"', html)
        self.assertGreaterEqual(html.count('<circle'), 9, '점 수 부족')

    # ── heatmap ─────────────────────────────────────────────────────
    def test_heatmap_bad_cell_ref_rejected(self):
        def bad(m):
            m['chart']['data']['cells'][0]['r'] = 9
        p = self._mutate(HM, bad, 'hm-bad.json')
        code, log = run(p, self.tmp / 'hm-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('r,c 참조 불가', log)

    def test_heatmap_structure(self):
        out = self.tmp / 'hm-ok.html'
        code, log = run(HM, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="matrix"', html)
        self.assertIn('color-mix', html, 'color-mix 농도 없음')
        self.assertIn('var(--accent)', html, 'highlight 행/열 초점 없음')

    # ── matrix-2x2 ──────────────────────────────────────────────────
    def test_matrix_axes_required(self):
        def bad(m):
            del m['chart']['axes']
        p = self._mutate(MX, bad, 'mx-bad.json')
        code, log = run(p, self.tmp / 'mx-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('chart.axes', log)

    def test_matrix_structure(self):
        out = self.tmp / 'mx-ok.html'
        code, log = run(MX, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="matrix-2x2"', html)
        self.assertIn('집중 육성', html, '사분면 라벨 없음')

    # ── tornado ─────────────────────────────────────────────────────
    def test_tornado_low_ge_high_rejected(self):
        def bad(m):
            m['chart']['data'][0]['low'] = 300
        p = self._mutate(TN, bad, 'tn-bad.json')
        code, log = run(p, self.tmp / 'tn-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('low', log)

    def test_tornado_sorted_by_range(self):
        out = self.tmp / 'tn-ok.html'
        code, log = run(TN, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        first = html.find('판매 단가')
        second = html.find('판매 물량')
        self.assertTrue(0 < first < second, '범위 내림차순 정렬 아님')
        self.assertIn('−210', html)

    # ── sankey ──────────────────────────────────────────────────────
    def test_sankey_bad_flow_ref_rejected(self):
        def bad(m):
            m['chart']['data']['flows'][0]['to'] = 'nowhere'
        p = self._mutate(SK, bad, 'sk-bad.json')
        code, log = run(p, self.tmp / 'sk-bad.html')
        self.assertEqual(code, 1)
        self.assertIn("nodes 에 없는 id", log)

    def test_sankey_structure(self):
        out = self.tmp / 'sk-ok.html'
        code, log = run(SK, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="data"', html)
        self.assertGreaterEqual(html.count(' Z" fill='), 6, '흐름 밴드 부족')
        self.assertIn('class="k-solid-n"', html, '중간 노드 남색 없음')

    # ── pareto ──────────────────────────────────────────────────────
    def test_pareto_ratio_sum_rejected(self):
        def bad(m):
            m['chart']['measure']['unit'] = '%'
        p = self._mutate(PA, bad, 'pa-bad.json')
        code, log = run(p, self.tmp / 'pa-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('비율 모드', log)

    def test_pareto_structure(self):
        out = self.tmp / 'pa-ok.html'
        code, log = run(PA, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="pareto"', html)
        self.assertIn('100%', html, '누적 100% 라벨 없음')
        self.assertIn('80%', html, '80% 임계선 라벨 없음')
        self.assertIn('transform-origin:center bottom', html)

    # ── slide.class ─────────────────────────────────────────────────
    def test_slide_class(self):
        def add(m):
            m['slide']['class'] = 'consult'
        p = self._mutate(RB, add, 'cls.json')
        out = self.tmp / 'cls.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        self.assertIn('<section class="slide consult"', out.read_text(encoding='utf-8'))

    # ── P2 옵션: sidecar · bridge · targetQuadrant ─────────────────
    def test_sidecar_panel_structure(self):
        def add(m):
            m['chart']['canvas'] = 'sidecar'
            m['chart']['sidecar'] = {'v': '42', 'unit': '%', 'h': '시사점 한 줄',
                                     'bullets': ['첫째 근거', '둘째 근거']}
        p = self._mutate(WF, add, 'sidecar.json')
        out = self.tmp / 'sidecar.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('class="c-sidecar"', html)
        self.assertIn('class="c-sidecar-main"', html)
        self.assertIn('class="c-sidecar-panel"', html)
        self.assertIn('>42<small>%</small>', html, '헤드라인 수치+단위')
        self.assertIn('시사점 한 줄', html)
        self.assertEqual(html.count('<li>'), 2, '불릿 수')
        self.assertIn('viewBox="0 0 1040', html, 'sidecar 캔버스는 좁은 폭')
        self.assertIn('class="c-src"', html, '출처 블록은 사이드카 밖에 유지')

    def test_sidecar_default_key(self):
        p = self._mutate(WF, lambda m: m['chart'].__setitem__('sidecar', {'v': '7', 'bullets': ['하나']}), 'sidecar-k.json')
        out = self.tmp / 'sidecar-k.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        self.assertIn('>시사점<', out.read_text(encoding='utf-8'))

    def test_sidecar_validation_rejected(self):
        # bullets 4개 → FAIL
        p = self._mutate(WF, lambda m: m['chart'].__setitem__('sidecar',
                         {'v': '1', 'bullets': ['a', 'b', 'c', 'd']}), 'sc-bad.json')
        code, log = run(p, self.tmp / 'sc-bad.html')
        self.assertEqual(code, 1)
        self.assertIn('bullets', log)
        # v 누락 → FAIL
        p = self._mutate(WF, lambda m: m['chart'].__setitem__('sidecar', {'bullets': ['a']}), 'sc-bad2.json')
        code, log = run(p, self.tmp / 'sc-bad2.html')
        self.assertEqual(code, 1)
        # canvas:"sidecar" 인데 sidecar 없음 → 경고, 생성은 계속
        p = self._mutate(WF, lambda m: m['chart'].__setitem__('canvas', 'sidecar'), 'sc-warn.json')
        code, log = run(p, self.tmp / 'sc-warn.html')
        self.assertEqual(code, 0, log)
        self.assertIn('WARN', log.upper())

    def test_bridge_total(self):
        def add(m):
            m['chart']['bridge'] = 'total'
        p = self._mutate(ST, add, 'bridge-t.json')
        out = self.tmp / 'bridge-t.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('stroke-dasharray', html, '총계 다리는 점선')
        self.assertIn('%', html, '변화율 캡슐 % 표기')

    def test_bridge_wrong_type_warned(self):
        p = self._mutate(WF, lambda m: m['chart'].__setitem__('bridge', 'total'), 'br-wf.json')
        code, log = run(p, self.tmp / 'br-wf.html')
        self.assertEqual(code, 0, log)
        self.assertIn('WARN', log.upper())

    def test_target_quadrant(self):
        def add(m):
            m['chart']['targetQuadrant'] = 'tr'
        p = self._mutate(MX, add, 'tq.json')
        out = self.tmp / 'tq.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('var(--accent) 7%', html, '목표 사분면 틴트')
        code2, log2 = run(p, self.tmp / 'tq2.html')
        self.assertEqual(out.read_bytes(), (self.tmp / 'tq2.html').read_bytes(), '결정성')
        # 잘못된 값 → FAIL
        p = self._mutate(MX, lambda m: m['chart'].__setitem__('targetQuadrant', 'xx'), 'tq-bad.json')
        code, log = run(p, self.tmp / 'tq-bad.html')
        self.assertEqual(code, 1)

    def test_matrix_steps_compressed(self):
        # 점이 많아도 단계는 축(1)+비초점(2)+초점(3)으로 압축된다
        out = self.tmp / 'mx-steps.html'
        code, log = run(MX, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        steps = [int(s) for s in re.findall(r'<g data-step="(\d+)"', html)]
        self.assertLessEqual(max(steps), 3, f'matrix 단계 과다: {sorted(set(steps))}')

    def test_end_delta_bridge(self):
        # line + endDelta: 마지막 눈금의 두 계열 끝점 사이에 점선 브리지 + Δ·배수 라벨
        def add(m):
            m['chart']['endDelta'] = True
        p = self._mutate(LN, add, 'endd.json')
        out = self.tmp / 'endd.html'
        code, log = run(p, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('stroke-dasharray="6 5"', html, '격차 점선 브리지 없음')
        self.assertIn('+8.6%p · 2.6×', html, 'Δ·배수 라벨(14.1-5.5, 14.1/5.5) 없음')

    def test_matrix_labels_near_points(self):
        # 점 라벨은 점에서 ±34px(세로) 안쪽 후보 배치 — 멀리 이탈하면 실패
        out = self.tmp / 'mx-near.html'
        code, log = run(MX, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        pts = [(float(m[0]), float(m[1])) for m in re.findall(r'<circle cx="([\d.]+)" cy="([\d.]+)"', html)]
        self.assertTrue(pts, '점 없음')
        far = 0
        for m in re.finditer(r'<text x="([\d.]+)" y="([\d.]+)" font-size="20"[^>]*>([^<]+)</text>', html):
            tx, ty = float(m[1]), float(m[2])
            if not any(abs(px - tx) < 200 and abs(py - ty) < 60 for px, py in pts):
                far += 1
        self.assertEqual(far, 0, '점에서 이탈한 라벨이 있다')

    # ── 신유형 4종(kodoc round2 8번) ────────────────────────────────
    def test_new_types_deterministic(self):
        for src in P4:
            a, b = self.tmp / (src.stem + 'a.html'), self.tmp / (src.stem + 'b.html')
            for f in (a, b):
                code, log = run(src, f)
                self.assertEqual(code, 0, f'{src.name}: {log}')
            self.assertEqual(a.read_bytes(), b.read_bytes(), f'{src.name}: 두 실행 결과가 다르다')

    def test_bullet_target_line_and_over_accent(self):
        out = self.tmp / 'bl.html'
        code, log = run(BL, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="bullet"', html)
        self.assertIn('목표', html)
        self.assertIn('var(--accent)', html, '목표 초과 강조 없음(가동률 92≥90)')

    def test_bullet_missing_target_rejected(self):
        def bad(m):
            del m['chart']['data'][0]['target']
        p = self._mutate(BL, bad, 'bl-no-t.json')
        code, log = run(p)
        self.assertEqual(code, 1)
        self.assertIn('target', log)

    def test_dumbbell_delta_label(self):
        out = self.tmp / 'dm.html'
        code, log = run(DM, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertIn('data-variant="dumbbell"', html)
        self.assertIn('−40', html, 'Δ 라벨(120→80) 없음')
        self.assertIn('fill="var(--accent)"', html, 'highlight 강조 없음')

    def test_slope_single_highlight(self):
        out = self.tmp / 'sl.html'
        code, log = run(SL, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertEqual(html.count('stroke="var(--accent)"'), 1, '최대 변화 항목 단일 강조가 아니다(A +12)')

    def test_waffle_sum_rejected(self):
        def bad(m):
            m['chart']['data'][0]['value'] = 90
        p = self._mutate(WA, bad, 'wa-sum.json')
        code, log = run(p)
        self.assertEqual(code, 1)
        self.assertIn('100', log)

    def test_waffle_cells_100(self):
        out = self.tmp / 'wa.html'
        code, log = run(WA, out)
        self.assertEqual(code, 0, log)
        html = out.read_text(encoding='utf-8')
        self.assertEqual(len(re.findall(r'<rect[^>]*rx="10"', html)), 100, '10×10 칸 수 불일치')

    # ── --check 계약 ────────────────────────────────────────────────
    def test_check_byte_compare(self):
        out = self.tmp / 'chk.html'
        code, log = run(WF, out)
        self.assertEqual(code, 0, log)
        code, log = run(WF, out, ['--check'])
        self.assertEqual(code, 0, log)
        self.assertIn('SAME', log)
        out.write_text(out.read_text() + 'x', encoding='utf-8')
        code, log = run(WF, out, ['--check'])
        self.assertEqual(code, 1)
        self.assertIn('DIFF', log)


if __name__ == '__main__':
    unittest.main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall