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_extract_style.py

View on GitHub
"""Acceptance: extract_style.py — 소스 실측 기반 스타일 추출 계약 + capture_cli.py 연동.

[검사 항목]
- 8축: 성격이 다른 소스 2종(장난기·이모지·밝은 팔레트 vs 기술·CLI·다크 팔레트)을 넣으면
  서로 다른 팔레트·반경·축 점수가 나오고, 8개 축이 전부 0..1 범위이며 근거 ID 를 가진다.
- 대비: 산출 토큰이 style_preset.CONTRAST_GATES 16쌍을 전부 통과한다 — 테스트가
  sp.contrast_ratio 로 검증기와 독립적으로 재계산한다(보고서의 all_pass 만 믿지 않음).
- CSS 계약: --deck 산출 src/preset.css 가 preset-css 마커·:root 21토큰·.slide·
  .slide.dark,.dark.slide 규칙·파생 토큰을 담고, 외부 자원(url/http/@import)이 없다.
- 안전: .env·*.env·id_rsa·secret* 계열 파일은 스캔에서 제외되고 그 색이 결과에 새지 않는다.
  표식 없는 수동 CSS 는 --force 없이 덮어쓰기 거부(exit 2), --force 면 통과.
- capture_cli: 실제 명령 실행 → exit code·stdout 이 스니펫과 메타 JSON 에 정확히 남고,
  홈 경로(--mask-home)와 토큰(ghp_/sk-/AKIA, 항상)이 ••• 로 가려진다.

[실행] cd edu-deck/shared && python3 -m unittest dev.test_extract_style -v
[주의] 저장소 안에는 아무것도 쓰지 않는다(tempfile 만 사용). --offline 으로 네트워크 무관.
"""
import json
import pathlib
import re
import subprocess
import sys
import tempfile
import unittest

S = pathlib.Path(__file__).resolve().parents[1]        # edu-deck/shared
SCRIPT = S / 'scripts' / 'extract_style.py'
CAPTURE = S / 'scripts' / 'capture_cli.py'

sys.path.insert(0, str(S / 'scripts'))
import style_preset as sp            # noqa: E402
import extract_style as esx          # noqa: E402

AXES = ("energy", "playful", "technical", "serious", "warm", "luxe", "dark", "data")
REQUIRED_VARS = ('--bg', '--bg-2', '--paper', '--line', '--ink', '--soft', '--mut',
                 '--blue', '--blue-text', '--blue-soft', '--accent', '--accent-text',
                 '--accent-soft', '--night', '--night-2', '--night-line',
                 '--on-night', '--on-night-2', '--r-sm', '--r-md', '--r-lg')

PLAYFUL_CSS = """body{background:#fff0f7;color:#5b3a68}
.hero{background:#ffe3f1;color:#c42d84}
.btn{background:#ff7ab8;color:#ffffff;border-radius:22px}
.card{background:#fff8fb;border:1px solid #ffd0e6;border-radius:18px}
.link{color:#8a5cff}
.badge{background:#f3e8ff;color:#7c4dcc;border-radius:24px}
footer{background:#fdf1e6;color:#a0522d}
"""

TECH_CSS = """body{background:#0d1117;color:#c9d1d9}
.code{background:#161b22;color:#79c0ff;font-family:'JetBrains Mono',monospace}
.btn{background:#238636;color:#ffffff;border-radius:3px}
.term{background:#010409;color:#7ee787;font-family:Menlo,monospace;border-radius:4px}
.card{background:#161b22;border:1px solid #30363d;border-radius:6px}
.link{color:#58a6ff}
"""

PLAYFUL_MD = ("# yay fun project!! 🎉🔥✨\n\n" +
              "this is so cool and awesome and fun!! amazing!! play now!! love it! 🎉✨💖🚀\n" * 30 +
              "we love it!! so cute and fun 🧸💫\n")

TECH_MD = ("# deploy cli tool\n\ninstall and configure the api endpoint:\n\n" +
           ("```bash\nnpm install tool --save && tool deploy --config prod.yaml\n"
            "curl -X POST https://api.internal/v3/deploy -d '{\"region\":\"us-1\",\"version\":\"3.2.1\"}'\n"
            "kubectl apply -f cluster.yaml && docker build -t svc:4.1.0 .\n```\n\n"
            "throughput is 99.7% over 1024 runs, p50 = 12.4ms p99 = 88ms\n\n") * 12)


def run_extract(*args, cwd=None):
    """CLI 실행 — (returncode, stdout+stderr)."""
    p = subprocess.run([sys.executable, str(SCRIPT), *args],
                       capture_output=True, text=True, timeout=120, cwd=cwd)
    return p.returncode, (p.stdout or '') + (p.stderr or '')


def run_capture(*args):
    p = subprocess.run([sys.executable, str(CAPTURE), *args],
                       capture_output=True, text=True, timeout=60)
    return p.returncode, (p.stdout or '') + (p.stderr or '')


def build_source(root: pathlib.Path, css: str, md: str, index_html: bool = True):
    root.mkdir(parents=True, exist_ok=True)
    (root / 'site.css').write_text(css)
    (root / 'README.md').write_text(md)
    if index_html:
        (root / 'index.html').write_text(
            '<html><head><title>t</title><link rel="stylesheet" href="site.css"></head><body></body></html>')


class TestExtractStyle(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.tmp = pathlib.Path(tempfile.mkdtemp(prefix='esx-test-'))
        cls.srcA = cls.tmp / 'src-playful'
        cls.srcB = cls.tmp / 'src-tech'
        build_source(cls.srcA, PLAYFUL_CSS, PLAYFUL_MD)
        build_source(cls.srcB, TECH_CSS, TECH_MD)
        cls.reports = {}
        for tag, src in (('A', cls.srcA), ('B', cls.srcB)):
            deck = cls.tmp / f'deck{tag}'
            (deck / 'src').mkdir(parents=True)
            (deck / 'deck.json').write_text(json.dumps({"title": f"t{tag}", "output": "o.html"}))
            rc, out = run_extract('--source', str(src), '--deck', str(deck),
                                  '--json', '--md', '--board', '--offline', cwd=deck)
            assert rc == 0, f'{tag} extract 실패 rc={rc}\n{out}'
            cls.reports[tag] = {
                'deck': deck,
                'css': (deck / 'src' / 'preset.css').read_text(),
                'json': json.loads((deck / 'qa' / 'style-extract.json').read_text()),
            }

    # ---------------- a) 8축 + 두 성격 소스 → 다른 팔레트/반경/축
    def test_eight_axes_complete(self):
        for tag, r in self.reports.items():
            tones = r['json']['tones']
            self.assertEqual(set(AXES), set(tones), f'{tag}: 8축이 빠졌습니다')
            for a in AXES:
                v = tones[a]['value']
                self.assertGreaterEqual(v, 0.0)
                self.assertLessEqual(v, 1.0)
                self.assertIsInstance(tones[a].get('evidence'), list)

    def test_axes_differ_between_sources(self):
        ta = {a: self.reports['A']['json']['tones'][a]['value'] for a in AXES}
        tb = {a: self.reports['B']['json']['tones'][a]['value'] for a in AXES}
        self.assertNotEqual(ta, tb, '성격 다른 소스가 완전히 같은 톤을 냈습니다')
        self.assertGreater(ta['playful'], tb['playful'],
                           f'장난기 소스 playful={ta["playful"]} <= 기술 소스 {tb["playful"]}')
        self.assertGreater(tb['technical'], ta['technical'],
                           f'기술 소스 technical={tb["technical"]} <= 장난기 소스 {ta["technical"]}')
        self.assertGreater(tb['dark'], ta['dark'],
                           f'다크 소스 dark={tb["dark"]} <= 밝은 소스 {ta["dark"]}')

    def test_palettes_and_radii_differ(self):
        pa = self.reports['A']['json']['palette']
        pb = self.reports['B']['json']['palette']
        self.assertNotEqual(pa['tokens'], pb['tokens'], '두 소스가 같은 팔레트를 냈습니다')
        self.assertGreaterEqual(len(set(pa['tokens'].values()) & set(pb['tokens'].values())), 0)
        # 지면 계열은 소스 배경색에서 와야 한다 — 다크 소스의 지면/밤 토큰은 더 어둡다
        la = sp.rel_luminance(pa['tokens']['paper'])
        lb = sp.rel_luminance(pb['tokens']['paper'])
        self.assertNotAlmostEqual(la, lb, places=3)
        ra = {k: pa['radii'][k] for k in ('radius-sm', 'radius-md', 'radius-lg')}
        rb = {k: pb['radii'][k] for k in ('radius-sm', 'radius-md', 'radius-lg')}
        self.assertNotEqual(ra, rb, 'border-radius 가 다른 두 소스가 같은 반경을 냈습니다')

    # ---------------- b) CONTRAST_GATES 전 항목 — 보고서 + 독립 재계산
    def test_contrast_gates_all_pass(self):
        for tag, r in self.reports.items():
            with self.subTest(source=tag):
                self.assertTrue(r['json']['contrast']['all_pass'],
                                f'{tag}: all_pass=False')
                self.assertTrue(all(g['pass'] for g in r['json']['contrast']['gates']))
                toks = r['json']['palette']['tokens']
                for label, fg, bg, need in sp.CONTRAST_GATES:
                    ratio = sp.contrast_ratio(toks[fg], toks[bg])
                    self.assertGreaterEqual(ratio + 1e-9, need,
                                            f'{tag}: {fg}/{bg}={ratio:.2f} < {need}')

    # ---------------- c) CSS 계약
    def test_css_contract(self):
        for tag, r in self.reports.items():
            with self.subTest(source=tag):
                css = r['css']
                self.assertIn('preset-css', css)
                self.assertIn('/* preset.css', css)
                self.assertIn(':root{', css)
                for var in REQUIRED_VARS:
                    self.assertIn(var + ':', css, f'{tag}: {var} 누락')
                self.assertRegex(css, r'\.slide\s*\{')
                self.assertIn('.slide.dark,.dark.slide', css)
                self.assertEqual(css.count('{'), css.count('}'), '괄호 불균형')
                self.assertNotRegex(css, r'url\(|@import|https?://',
                                    '외부 자원 참조가 있습니다')
                # 밤 무대 오버라이드가 밤 토큰을 참조하는지
                self.assertIn('background:var(--night)', css)
                self.assertIn('color:var(--on-night)', css)

    def test_outputs_written(self):
        for tag, r in self.reports.items():
            self.assertTrue((r['deck'] / 'qa' / 'style-extract.md').stat().st_size > 500)
            board = (r['deck'] / 'qa' / 'style-board.html').read_text()
            for tok in ('brand', 'accent', 'night', 'paper'):
                self.assertIn(tok, board)

    # ---------------- d) 비밀 제외 + 덮어쓰기 가드
    def test_secret_files_excluded(self):
        src = self.tmp / 'src-secret'
        build_source(src, TECH_CSS, TECH_MD)
        (src / '.env').write_text('BRAND=#deadb9\nACC=#facade\n')
        (src / 'token.env').write_text('#ff00aa\n')
        (src / 'id_rsa').write_text('-----BEGIN OPENSSH PRIVATE KEY----- #00ffcc')
        (src / 'credentials').write_text('{"k":"#a1b2c3"}')
        out_dir = self.tmp / 'qa-secret'
        rc, out = run_extract('--source', str(src), '--json', '--qa-dir', str(out_dir),
                              '--offline', cwd=self.tmp)
        self.assertEqual(rc, 0, out)
        rep = json.loads((out_dir / 'style-extract.json').read_text())
        names = [s['name'] for s in rep['sources']]
        for bad in ('.env', 'token.env', 'id_rsa', 'credentials'):
            self.assertFalse(any(bad in n for n in names), f'{bad} 이 스캔됐습니다: {names}')
        blob = json.dumps(rep)
        for leak in ('deadb9', 'facade', 'ff00aa', '00ffcc', 'a1b2c3'):
            self.assertNotIn(leak, blob, f'비밀 파일의 색 {leak} 이 결과에 샜습니다')

    def test_overwrite_guard(self):
        manual = self.tmp / 'manual.css'
        manual.write_text('/* hand-made css, not generated */\n:root{--ink:#111}\n')
        rc, out = run_extract('--source', str(self.srcB), '--out-css', str(manual),
                              '--offline', cwd=self.tmp)
        self.assertEqual(rc, 2, f'수동 파일 덮어쓰기가 거부되지 않았습니다: {out}')
        self.assertIn('--force', out)
        self.assertIn('hand-made css', manual.read_text(), '수동 파일이 덮어써졌습니다')
        rc, out = run_extract('--source', str(self.srcB), '--out-css', str(manual),
                              '--force', '--offline', cwd=self.tmp)
        self.assertEqual(rc, 0, out)
        self.assertIn('preset-css', manual.read_text())

    def test_no_source_exit2(self):
        rc, out = run_extract('--source', '/nonexistent/path/xyz', '--offline', cwd=self.tmp)
        self.assertEqual(rc, 2, out)


class TestCaptureCli(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.tmp = pathlib.Path(tempfile.mkdtemp(prefix='cap-test-'))

    def test_real_command_capture(self):
        frag = self.tmp / 'frag.html'
        meta = self.tmp / 'meta.json'
        rc, out = run_capture('--cmd', 'echo HELLO_SNIPPET && echo oops_err >&2; exit 3',
                              '--out', str(frag), '--json', str(meta))
        self.assertEqual(rc, 0, out)
        text = frag.read_text()
        self.assertIn('HELLO_SNIPPET', text)
        self.assertIn('oops_err', text)
        self.assertIn('exit 3', text)
        self.assertIn('<span class="p">', text)
        self.assertIn('class="out"', text)
        self.assertIn('capture_cli.py 실물 캡처', text)
        m = json.loads(meta.read_text())
        self.assertEqual(m['exit_code'], 3)
        self.assertFalse(m['timed_out'])

    def test_home_and_token_masking(self):
        frag = self.tmp / 'mask.html'
        meta = self.tmp / 'mask.json'
        tok = 'ghp_0123456789abcdefXYZW'
        home = str(pathlib.Path.home())
        rc, out = run_capture('--cmd', f'echo {tok}; echo {home}/sekret',
                              '--out', str(frag), '--json', str(meta), '--mask-home')
        self.assertEqual(rc, 0, out)
        text = frag.read_text() + meta.read_text()
        self.assertNotIn(tok, text, '토큰이 마스킹 없이 새었습니다')
        self.assertNotIn(home + '/sekret', text, '홈 경로가 마스킹 없이 새었습니다')
        self.assertIn('•••', text)
        m = json.loads(meta.read_text())
        self.assertGreaterEqual(sum(m['masked']['tokens'].values()), 1)
        self.assertGreaterEqual(m['masked']['home_paths'], 1)

    def test_win_frame_wrapper(self):
        frag = self.tmp / 'wf.html'
        rc, out = run_capture('--cmd', 'true', '--out', str(frag), '--win-frame')
        self.assertEqual(rc, 0, out)
        text = frag.read_text()
        for marker in ('win-frame', 'wf-bar', 'wf-title', 'code-copy'):
            self.assertIn(marker, text)


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