# task-694.1 완료 보고서: 카드뉴스 ContentGeneratorV2 통합 + 재생성 업로드

## SCQA

**S**: CLI `pipeline` 커맨드는 v1 `ContentGenerator`로 카드뉴스를 생성하여 "body" 타입 슬라이드만 생성했으며, `run_full_pipeline.py`에는 이미 V2 파이프라인(ContentGeneratorV2 → CardNewsRenderer)이 작동 중이다.

**C**: CLI와 독립 스크립트 사이의 파이프라인 불일치로, CLI 자동화 시 부실한 콘텐츠(1슬라이드 1항목, 짧은 설명)가 생산되고, V2의 card_list/detail 타입 슬라이드가 활용되지 못했다.

**Q**: CLI `pipeline` 커맨드에서 `--type cardnews`로 ContentGeneratorV2 파이프라인을 사용할 수 있도록 통합하고, 실제 1건을 재생성하여 Threads carousel로 업로드할 수 있는가?

**A**: `orchestrator.py`에 `run_cardnews()` 메서드를 추가하고 `cli.py`에 cardnews 분기를 구현하여 V2 통합 완료. 카드뉴스 1건(6슬라이드, NavyGold 테마)을 재생성하여 Threads에 성공적으로 업로드했다 (Post ID: 18453261838102949). pyright 에러 0건, black/isort 통과.

## 수정 파일 목록

- `/home/jay/projects/ThreadAuto/pipeline/orchestrator.py` — `run_cardnews(category, upload)` 메서드 추가 (line 430~513)
- `/home/jay/projects/ThreadAuto/cli.py` — `pipeline` 커맨드에 `--upload` 옵션 + `cardnews` 분기 추가 (line 582, 592~628)

## diff 요약

- **orchestrator.py**: +83줄. `run_cardnews()` 메서드 신규 (5개 지연 임포트, 토픽선택→V2생성→랜덤테마→CardNewsRenderer→ThreadsPublisher 업로드 플로우)
- **cli.py**: +38줄. `upload` 옵션 추가, `template_type == "cardnews"` 분기에서 `orchestrator.run_cardnews(upload=upload)` 호출 후 Panel 출력

## 업로드 결과

- **Threads Post ID**: 18453261838102949
- **토픽**: SNS 기반 보험 영업의 부상: 규제와 기회 사이 (카테고리: 업계동향)
- **테마**: NavyGold
- **슬라이드**: 6장 (cover 1 + card_list/detail 4 + cta 1)
- **이미지 경로**:
  - `/home/jay/projects/ThreadAuto/output/cardnews_20260318_181257_00.png` (71KB)
  - `/home/jay/projects/ThreadAuto/output/cardnews_20260318_181257_01.png` (115KB)
  - `/home/jay/projects/ThreadAuto/output/cardnews_20260318_181257_02.png` (114KB)
  - `/home/jay/projects/ThreadAuto/output/cardnews_20260318_181257_03.png` (153KB)
  - `/home/jay/projects/ThreadAuto/output/cardnews_20260318_181257_04.png` (131KB)
  - `/home/jay/projects/ThreadAuto/output/cardnews_20260318_181257_05.png` (100KB)

## 검증 결과

- pyright: 0 errors, 0 warnings, 0 informations
- black + isort: 2 files would be left unchanged (스타일 통과)
- ContentGeneratorV2._validate_structure(): 통과 (6슬라이드, cover+4중간+cta)
- 중간 슬라이드: card_list/detail 타입, 항목 2개 이상, 설명 40자+
- Threads 업로드: carousel 6장 정상 업로드

## 발견 이슈 및 해결

### 자체 해결 (3건)
1. **Theme 객체 속성 접근 오류** — Theme은 frozen dataclass이므로 `.get()` 불가, `theme.name` 직접 참조로 수정
   - 상세: orchestrator.py:478 `theme.name` 직접 접근
2. **render_from_slides 반환 타입 불일치** — `list[Path]` → `list[str]` 변환 필요
   - 상세: orchestrator.py:486 `[str(p) for p in rendered_paths]`
3. **publish_cardnews 시그니처 필수 인자 누락** — `title`과 `items`가 필수. 슬라이드에서 items 구성하여 전달
   - 상세: orchestrator.py:494~502

### 범위 외 미해결 (1건)
1. **Firestore 초기화 실패 경고** — GCP ADC 미설정으로 Firestore 미연결. 로컬 파일 폴백으로 정상 동작. 범위 외 사유: 인프라 설정 이슈

## 제약사항 준수 확인
- [x] ContentGeneratorV2._validate_structure() 통과 (6슬라이드, cover+card_list/detail+cta)
- [x] 기존 텍스트형(TypeA~TypeE) 파이프라인 미변경
- [x] 기존 부실 게시물(Post ID: 18075263858417259) 미삭제

## QC 자동 검증 결과

```
overall: WARN (Gate PASS)
- file_check: PASS (3/3 파일 확인)
- data_integrity: PASS
- tdd_check: PASS (테스트 1개 + 구현 2개)
- style_check: PASS (black/isort OK)
- critical_gap: PASS
- pyright_check: WARN (35 reportMissingImports — 프로젝트 PYTHONPATH 설정 이슈, 본 작업 범위 외)
- test_runner: SKIP (관련 테스트 자동추론 결과 0개 — mock 기반 테스트는 별도 실행)
- pytest 결과: 18 passed in 0.15s
```

## 커밋
- `75351be` — [task-694.1] CLI pipeline 커맨드에 ContentGeneratorV2 카드뉴스 통합
- `09db777` — [task-694.1] run_cardnews 단위 테스트 추가 (18 tests)
- `aab1599` — [task-694.1] 테스트 파일 pyright 타입 수정
