diff --git a/docs/superpowers/plans/2026-06-12-operator-workbench-efficiency.md b/docs/superpowers/plans/2026-06-12-operator-workbench-efficiency.md new file mode 100644 index 0000000..a35c526 --- /dev/null +++ b/docs/superpowers/plans/2026-06-12-operator-workbench-efficiency.md @@ -0,0 +1,1364 @@ +# Operator Workbench Efficiency (F1-F5) Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** 운영자 워크벤치의 검색 보강 수작업을 줄이고(추천 쿼리 원클릭 실행, Google 수동 검색 재노출) 케이스 판단 속도를 높인다(얼굴 크롭 썸네일, 재분석 증거 diff, KB 정비). + +**Architecture:** 백엔드는 `CopyrighterStore`(SQLite, JSON 페이로드)에 메서드를 추가하고 `http_app.py`에 라우트를 잇는 기존 패턴을 그대로 따른다. 프런트는 `web/operator-gui/app.js`의 문자열 템플릿 렌더 + 이벤트 위임 패턴을 따른다. 스펙: `docs/superpowers/specs/2026-06-11-operator-workbench-efficiency-design.md`. + +**Tech Stack:** Python 3.13 표준 라이브러리(http.server, sqlite3), Pillow, pytest / 바닐라 JS(프레임워크 없음), 정적 UI 계약 테스트(`tests/operator_gui/test_static_workbench.py`). + +**실행 명령 공통:** 저장소 루트(`C:\Users\USER\Desktop\munsang\copyrighter`)에서 실행. 테스트는 `python -m pytest <경로> -v`. + +--- + +### Task 1: F1 — 추천 쿼리 바로 실행 / 모두 실행 + +근거 보강 추천 패널의 쿼리 버튼은 현재 수동 검색 입력칸을 채우기만 한다(`applySuggestedQuery`). 쿼리별 "바로 실행"과 패널 "모두 실행"을 추가한다. 서버 변경 없음 — 기존 `/api/search/manual`을 재사용한다. + +**Files:** +- Modify: `web/operator-gui/app.js` (renderEvidenceNextActions ~line 890, 모듈 상단 ~line 28, 클릭 위임 ~line 3550, 케이스 선택 ~line 2130) +- Modify: `web/operator-gui/styles.css` (말미에 추가) +- Test: `tests/operator_gui/test_static_workbench.py` + +- [ ] **Step 1: 실패하는 UI 계약 테스트 작성** + +`tests/operator_gui/test_static_workbench.py` 말미에 추가: + +```python +def test_suggested_queries_support_one_click_and_batch_execution(): + script = _read(APP_JS) + styles = _read(STYLES) + + assert "executeSuggestedQueries" in script + assert "data-run-suggested-query" in script + assert 'id="run-all-suggested-queries"' in script + assert "모두 실행" in script + assert "바로 실행" in script + assert "suggested-query-run-status" in script + # 기존 "입력칸 채우기" 버튼은 수정용으로 유지된다. + assert "data-suggested-query" in script + assert ".suggested-query-item" in styles +``` + +- [ ] **Step 2: 테스트 실패 확인** + +Run: `python -m pytest tests/operator_gui/test_static_workbench.py::test_suggested_queries_support_one_click_and_batch_execution -v` +Expected: FAIL (`assert "executeSuggestedQueries" in script` AssertionError) + +- [ ] **Step 3: app.js 구현** + +(3a) 모듈 상단, `const searchCoverage = {};` (line ~28) 아래에 추가: + +```js +let suggestedQueryRunSummary = null; // { caseId, message } — 현재 케이스의 마지막 추천 쿼리 실행 결과 +``` + +(3b) `renderEvidenceNextActions` 전체를 다음으로 교체: + +```js +function renderEvidenceNextActions(submission) { + const summary = + suggestedQueryRunSummary && suggestedQueryRunSummary.caseId === submission.id + ? `
${escapeHtml(entry.memo)}
`; + const lifecycleActions = + entryStatus === "watchlist" + ? ` + + + ` + : entryStatus === "excluded" + ? "" + : entry.active + ? `` + : ``; + const editForm = + editingKnowledgeEntryId === entry.id + ? ` + + ` + : ""; + return ` +