feat(pipeline): YouTube Tab → PDF 자동 추출 파이프라인 초기 구현
- 5단계 파이프라인: 다운로드 → 프레임 추출 → 패턴 감지 → 중복 제거 → PDF 생성 - 3가지 패턴 지원: overlay, split, scroll - MSE 기반 픽셀 비교 프레임 중복 제거 - split 모드: 42% 크롭 + 밝기 필터 + Tab 라인 검증 - overlay 모드: 320x120 정규화 + 슬라이딩 윈도우 비교 - 프로젝트 문서 초기 작성 (architecture, tech-stack, STATUS, known-issues)
This commit is contained in:
52
.agent/workflows/debug.md
Normal file
52
.agent/workflows/debug.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
description: 에러/버그 발생 시 체계적 디버깅 워크플로우 (에러, 안돼요, 왜 안돼, 버그, 디버그, 수정)
|
||||
---
|
||||
|
||||
# Debug Workflow
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 추측으로 코드를 수정하지 마세요. 반드시 이 순서를 따릅니다.
|
||||
|
||||
## 1단계: 정보 수집 (추측 금지)
|
||||
|
||||
- [ ] 에러 메시지 **전문** 확인 (절대 잘라내지 않기)
|
||||
- [ ] 관련 로그 파일 확인
|
||||
- [ ] 환경 정보 확인 (OS, Node/Python 버전, 의존성 버전 등)
|
||||
- [ ] 에러가 발생하는 **정확한 입력/조건** 파악
|
||||
|
||||
## 2단계: Known Issues 확인
|
||||
|
||||
`.agent/references/known-issues.md`를 읽고 동일하거나 유사한 문제가 있는지 확인합니다.
|
||||
|
||||
> [!CAUTION]
|
||||
> **known-issues 확인 없이 해결 시도를 시작하지 마세요.**
|
||||
> 이미 해결된 문제를 다시 삽질하는 것은 시간 낭비입니다.
|
||||
|
||||
## 3단계: 근본 원인 분석
|
||||
|
||||
- [ ] 에러가 발생하는 **정확한 코드 위치** 확인
|
||||
- [ ] 가설을 세우고, 가설을 검증할 수 있는 **최소한의 테스트** 수행
|
||||
- [ ] 가설이 틀렸다면 **즉시 다른 가설로 전환**
|
||||
|
||||
> [!WARNING]
|
||||
> **동일한 접근을 2회 초과 시도하지 마세요.**
|
||||
> 2회 실패 시 유저에게 보고하고 판단을 요청합니다.
|
||||
> 보고 내용: 시도한 것 / 실패한 것 / 원인 가설 / 다음 제안
|
||||
|
||||
## 4단계: 수정 및 검증
|
||||
|
||||
- [ ] 수정 적용
|
||||
- [ ] 동일 에러가 재현되지 않는지 확인
|
||||
- [ ] 사이드 이펙트(다른 기능에 영향) 없는지 확인
|
||||
|
||||
## 5단계: 기록
|
||||
|
||||
- [ ] `known-issues.md`에 새 항목 추가 (아래 포맷 사용)
|
||||
|
||||
```markdown
|
||||
### [날짜] [키워드] — 한줄 요약
|
||||
- **증상**: 무엇이 잘못되었는가
|
||||
- **원인**: 근본 원인
|
||||
- **해결**: 올바른 해결 방법
|
||||
- **주의**: 재발 방지를 위한 교훈
|
||||
```
|
||||
188
.agent/workflows/end.md
Normal file
188
.agent/workflows/end.md
Normal file
@@ -0,0 +1,188 @@
|
||||
---
|
||||
description: 세션 종료 시 devlog 기록 + git commit + Vikunja 동기화 (끝, 마무리, 커밋해, 완료)
|
||||
---
|
||||
|
||||
# 세션 종료 프로토콜
|
||||
|
||||
작업 완료, "끝", "마무리", "커밋해" 등 요청 시 이 워크플로우를 실행합니다.
|
||||
|
||||
// turbo-all
|
||||
|
||||
## 0. 학습 기록 (실패/시행착오 저장)
|
||||
|
||||
이번 세션에서 발생한 실패, 시행착오, 새로 알게 된 사실을 정리합니다:
|
||||
|
||||
- [ ] `.agent/references/known-issues.md`에 추가할 항목이 있는지 확인
|
||||
- [ ] 있다면 아래 포맷으로 추가:
|
||||
|
||||
```markdown
|
||||
### [날짜] [키워드] — 한줄 요약
|
||||
- **증상**: ...
|
||||
- **원인**: ...
|
||||
- **해결**: ...
|
||||
- **주의**: ...
|
||||
```
|
||||
|
||||
## 1. Devlog 기록
|
||||
|
||||
### Index 업데이트 (필수 — 매 작업)
|
||||
|
||||
오늘 날짜의 index 파일에 완료된 작업 1줄을 추가합니다.
|
||||
|
||||
- **파일**: `docs/devlog/YYYY-MM-DD.md`
|
||||
- **형식**:
|
||||
```markdown
|
||||
| NNN | HH:MM | 작업 설명 | `커밋해시` | ✅ 또는 🔧 |
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> - ✅ = 완료, 🔧 = 미완료 (다음 세션에서 이어받기)
|
||||
> - 파일이 없으면 새로 생성 (테이블 헤더 포함)
|
||||
|
||||
### Entry 작성 (선택적 — 필요할 때만)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Entry는 **git/Vikunja/wiki에 없는 정보**가 있을 때만 작성합니다.
|
||||
|
||||
**Entry 작성 기준:**
|
||||
- ✅ 설계 결정이 있었을 때 (왜 A가 아닌 B를 선택했는지)
|
||||
- ✅ 미완료 사항이 있을 때 (다음 세션이 이어받아야 할 맥락)
|
||||
- ✅ 삽질/트러블슈팅이 있었을 때 (같은 실수 방지)
|
||||
|
||||
**Entry 불필요:**
|
||||
- ❌ 단순 버그 픽스 (커밋 메시지로 충분)
|
||||
- ❌ 문서 업데이트 (git diff로 충분)
|
||||
- ❌ 이미 Vikunja 태스크에 상세 설명이 있는 경우
|
||||
|
||||
**Entry 파일**: `docs/devlog/entries/YYYYMMDD-NNN.md`
|
||||
```markdown
|
||||
# 작업 제목
|
||||
|
||||
- **시간**: YYYY-MM-DD HH:MM~HH:MM
|
||||
- **Commit**: `해시`
|
||||
- **Vikunja**: #태스크번호 → done/진행중
|
||||
|
||||
## 결정 사항
|
||||
- 왜 이 방식을 선택했는지
|
||||
|
||||
## 미완료
|
||||
- 남은 작업 (있을 경우)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Vikunja 동기화
|
||||
|
||||
> [!CAUTION]
|
||||
> **반드시 `vikunja_helper.py` 사용.** 직접 API 호출 금지.
|
||||
> Vikunja API는 POST 시 body에 없는 필드를 빈값으로 덮어씁니다.
|
||||
|
||||
### 2-1. 커밋 전수 검사
|
||||
|
||||
이번 세션의 **모든 커밋을 하나씩 검사**하고 Vikunja에 매핑합니다.
|
||||
|
||||
```powershell
|
||||
git log --oneline -20
|
||||
```
|
||||
|
||||
| 커밋 유형 | Vikunja 액션 |
|
||||
|-----------|-------------|
|
||||
| 기존 태스크 해당 작업 **완료** | `C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\vikunja_helper.py done {ID}` |
|
||||
| 신규 작업 완료 (기존 태스크 없음) | `C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\vikunja_helper.py create "제목" "설명" --done --labels Backend,Priority:High` |
|
||||
| 작업 중 발견된 **미완료 TODO** | `C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\vikunja_helper.py create "제목" "설명" --labels Backend,Priority:Mid` |
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 모든 커밋이 기존 또는 신규 태스크에 매핑되었는지 확인.
|
||||
|
||||
### 2-2. 완료 처리
|
||||
|
||||
```powershell
|
||||
C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\vikunja_helper.py done {TASK_ID}
|
||||
```
|
||||
|
||||
### 2-3. 신규 태스크 생성
|
||||
|
||||
```powershell
|
||||
C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\vikunja_helper.py create "제목" "설명" --labels Backend,Priority:High
|
||||
```
|
||||
|
||||
### 라벨 규칙
|
||||
|
||||
**영역 (필수 1개 이상):** `Backend` / `Frontend` / `Engine` / `Infra` / `Test`
|
||||
**우선순위 (필수 1개):** `Priority:High` / `Priority:Mid` / `Priority:Low`
|
||||
|
||||
---
|
||||
|
||||
## 3. 설계 문서 업데이트 (필수)
|
||||
|
||||
- [ ] `.agent/references/STATUS.md` — 모듈 상태 테이블 업데이트 (변경 있었다면)
|
||||
- 기능 추가/제거 → 기능 목록 테이블 업데이트
|
||||
- 모듈 변경 → 모듈 상태 + 최근 변경 업데이트
|
||||
- 마일스톤 달성 → 최근 마일스톤 추가
|
||||
- [ ] `.agent/references/architecture.md` — 구조 변경이 있었다면 업데이트
|
||||
|
||||
## 4. Wiki 동기화 (로컬 변경 기반)
|
||||
|
||||
로컬 references 파일이 변경되었는지 확인합니다:
|
||||
|
||||
```powershell
|
||||
git diff --name-only .agent/references/
|
||||
```
|
||||
|
||||
변경된 파일이 있으면 **파일별로** Wiki에 업로드합니다:
|
||||
|
||||
| 로컬 파일 | Wiki 페이지 |
|
||||
|-----------|------------|
|
||||
| `STATUS.md` | "Status" |
|
||||
| `architecture.md` | "Architecture" |
|
||||
|
||||
```powershell
|
||||
# STATUS.md가 변경된 경우
|
||||
C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\wiki_helper.py update "Status" .agent\references\STATUS.md
|
||||
```
|
||||
```powershell
|
||||
# architecture.md가 변경된 경우
|
||||
C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\wiki_helper.py update "Architecture" .agent\references\architecture.md
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> 변경된 파일이 없으면 이 단계를 건너뜁니다.
|
||||
|
||||
---
|
||||
|
||||
## 5. Git Commit & Push
|
||||
|
||||
```powershell
|
||||
git add -A
|
||||
git status --short
|
||||
```
|
||||
```powershell
|
||||
git commit -m "커밋 메시지"
|
||||
```
|
||||
```powershell
|
||||
git push origin main
|
||||
```
|
||||
|
||||
**커밋 메시지 컨벤션:**
|
||||
```
|
||||
<type>(<scope>): <description>
|
||||
|
||||
type: feat|fix|refactor|test|docs|chore|ci|infra
|
||||
scope: (선택)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. 최종 체크리스트
|
||||
|
||||
> [!WARNING]
|
||||
> 아래 항목 중 하나라도 누락되면 세션 종료를 완료할 수 없습니다.
|
||||
|
||||
- [ ] known-issues 업데이트됨 (새 이슈가 있었다면)
|
||||
- [ ] devlog index 업데이트됨
|
||||
- [ ] devlog entry 작성됨 (필요한 경우만)
|
||||
- [ ] Vikunja 태스크 생성/완료 처리됨 (커밋 전수 검사 기반)
|
||||
- [ ] STATUS.md 업데이트됨 (모듈/기능 변경이 있었다면)
|
||||
- [ ] Wiki 동기화됨 (변경된 references 파일이 있었다면)
|
||||
- [ ] git push 완료
|
||||
- [ ] 사용자에게 완료 보고
|
||||
328
.agent/workflows/helpers/vikunja_helper.py
Normal file
328
.agent/workflows/helpers/vikunja_helper.py
Normal file
@@ -0,0 +1,328 @@
|
||||
"""Vikunja safe task updater — preserves existing fields when updating tasks.
|
||||
|
||||
Usage:
|
||||
python vikunja_helper.py done 75 # Mark task #75 as done
|
||||
python vikunja_helper.py done 71 77 78 # Mark multiple tasks done
|
||||
python vikunja_helper.py undone 75 # Mark task #75 as not done
|
||||
python vikunja_helper.py comment 75 "text" # Add comment to task #75
|
||||
python vikunja_helper.py desc 75 "text" # Set description (appends if exists)
|
||||
python vikunja_helper.py create "title" "desc" --labels Backend,Priority:High
|
||||
python vikunja_helper.py create "title" "desc" --done --labels Frontend,Priority:Mid
|
||||
python vikunja_helper.py label 75 Backend Priority:High # Add labels to task
|
||||
python vikunja_helper.py list # List all tasks
|
||||
python vikunja_helper.py list todo # List TODO only
|
||||
python vikunja_helper.py list done # List DONE only
|
||||
python vikunja_helper.py projects # List all Vikunja projects
|
||||
python vikunja_helper.py report # Project status report (current)
|
||||
python vikunja_helper.py report <project_id> # Project status report (specific)
|
||||
"""
|
||||
|
||||
import sys
|
||||
import json
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import io
|
||||
|
||||
# Fix Windows console encoding (cp949 → utf-8)
|
||||
if sys.stdout.encoding != "utf-8":
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
|
||||
|
||||
# ============================================================
|
||||
# ⚙️ CONFIGURATION — PROJECT_ID만 프로젝트별로 변경하세요
|
||||
# ============================================================
|
||||
API_BASE = "https://plan.variet.net/api/v1"
|
||||
TOKEN = "tk_070f8e0b715e818bb7178c3815ed5389040eddca"
|
||||
PROJECT_ID = 7 # Variet Agent 프로젝트
|
||||
# ============================================================
|
||||
|
||||
HEADERS = {
|
||||
"Authorization": f"Bearer {TOKEN}",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
# Label name → Vikunja label ID mapping
|
||||
# Customize for your project's labels
|
||||
LABEL_MAP = {
|
||||
"Backend": 1, "Frontend": 2, "Engine": 3, "Infra": 4, "Test": 5,
|
||||
"Priority:High": 6, "Priority:Mid": 7, "Priority:Low": 8,
|
||||
"Agent": 17, "Tool": 18, "AI/LLM": 19,
|
||||
}
|
||||
|
||||
|
||||
def api_get(path: str):
|
||||
req = urllib.request.Request(f"{API_BASE}{path}", headers=HEADERS)
|
||||
with urllib.request.urlopen(req) as resp:
|
||||
return json.loads(resp.read().decode("utf-8"))
|
||||
|
||||
|
||||
def api_post(path: str, data: dict):
|
||||
body = json.dumps(data).encode("utf-8")
|
||||
req = urllib.request.Request(f"{API_BASE}{path}", data=body, headers=HEADERS, method="POST")
|
||||
with urllib.request.urlopen(req) as resp:
|
||||
return json.loads(resp.read().decode("utf-8"))
|
||||
|
||||
|
||||
def api_put(path: str, data: dict):
|
||||
body = json.dumps(data).encode("utf-8")
|
||||
req = urllib.request.Request(f"{API_BASE}{path}", data=body, headers=HEADERS, method="PUT")
|
||||
with urllib.request.urlopen(req) as resp:
|
||||
return json.loads(resp.read().decode("utf-8"))
|
||||
|
||||
|
||||
def get_task(task_id: int) -> dict:
|
||||
return api_get(f"/tasks/{task_id}")
|
||||
|
||||
|
||||
def safe_update_task(task_id: int, updates: dict) -> dict:
|
||||
task = get_task(task_id)
|
||||
safe_body = {
|
||||
"title": task.get("title", ""),
|
||||
"description": task.get("description", ""),
|
||||
"priority": task.get("priority", 0),
|
||||
"done": task.get("done", False),
|
||||
}
|
||||
safe_body.update(updates)
|
||||
return api_post(f"/tasks/{task_id}", safe_body)
|
||||
|
||||
|
||||
def mark_done(task_ids: list):
|
||||
for tid in task_ids:
|
||||
result = safe_update_task(tid, {"done": True})
|
||||
title = result.get("title", "?")
|
||||
print(f" ✅ #{tid} → done=True [{title}]")
|
||||
|
||||
|
||||
def mark_undone(task_ids: list):
|
||||
for tid in task_ids:
|
||||
result = safe_update_task(tid, {"done": False})
|
||||
title = result.get("title", "?")
|
||||
print(f" ⬜ #{tid} → done=False [{title}]")
|
||||
|
||||
|
||||
def add_comment(task_id: int, comment: str):
|
||||
result = api_put(f"/tasks/{task_id}/comments", {"comment": comment})
|
||||
print(f" 💬 #{task_id} comment added (id={result.get('id', '?')})")
|
||||
|
||||
|
||||
def set_description(task_id: int, desc: str, append: bool = True):
|
||||
task = get_task(task_id)
|
||||
existing = task.get("description", "") or ""
|
||||
if append and existing:
|
||||
new_desc = existing.rstrip() + "\n\n" + desc
|
||||
else:
|
||||
new_desc = desc
|
||||
result = safe_update_task(task_id, {"description": new_desc})
|
||||
print(f" 📝 #{task_id} description updated [{result.get('title', '?')}]")
|
||||
|
||||
|
||||
def list_tasks(filter_: str = "all"):
|
||||
all_tasks = []
|
||||
page = 1
|
||||
while True:
|
||||
batch = api_get(f"/projects/{PROJECT_ID}/tasks?per_page=50&page={page}")
|
||||
if not batch:
|
||||
break
|
||||
all_tasks.extend(batch)
|
||||
if len(batch) < 50:
|
||||
break
|
||||
page += 1
|
||||
|
||||
if filter_ == "todo":
|
||||
all_tasks = [t for t in all_tasks if not t["done"]]
|
||||
elif filter_ == "done":
|
||||
all_tasks = [t for t in all_tasks if t["done"]]
|
||||
|
||||
all_tasks.sort(key=lambda t: t["id"])
|
||||
for t in all_tasks:
|
||||
status = "✅" if t["done"] else "⬜"
|
||||
desc = (t.get("description") or "")[:50].replace("\n", " ")
|
||||
labels = ", ".join(l["title"] for l in (t.get("labels") or []))
|
||||
print(f" {status} #{t['id']:3d} {t['title'][:40]:<40} [{labels}] {desc}")
|
||||
print(f"\n Total: {len(all_tasks)} tasks")
|
||||
|
||||
|
||||
def add_labels(task_id: int, label_names: list):
|
||||
for name in label_names:
|
||||
label_id = LABEL_MAP.get(name)
|
||||
if not label_id:
|
||||
print(f" ⚠️ Unknown label '{name}'. Valid: {', '.join(LABEL_MAP.keys())}")
|
||||
continue
|
||||
try:
|
||||
api_put(f"/tasks/{task_id}/labels", {"label_id": label_id})
|
||||
print(f" 🏷️ #{task_id} + {name} (id={label_id})")
|
||||
except Exception as e:
|
||||
if "already" in str(e).lower() or "409" in str(e):
|
||||
print(f" 🏷️ #{task_id} already has {name}")
|
||||
else:
|
||||
print(f" ⚠️ #{task_id} label {name} failed: {e}")
|
||||
|
||||
|
||||
def create_task(title: str, description: str = "", done: bool = False, labels: list = None):
|
||||
payload = {"title": title, "description": description}
|
||||
result = api_put(f"/projects/{PROJECT_ID}/tasks", payload)
|
||||
task_id = result["id"]
|
||||
print(f" ✨ #{task_id} created: {result.get('title', '?')}")
|
||||
|
||||
if labels:
|
||||
add_labels(task_id, labels)
|
||||
|
||||
if done:
|
||||
result = safe_update_task(task_id, {"done": True})
|
||||
print(f" ✅ #{task_id} → done=True")
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def list_projects():
|
||||
"""Vikunja 전체 프로젝트 목록 + 태스크 통계."""
|
||||
projects = api_get("/projects")
|
||||
print("📂 프로젝트 목록:")
|
||||
for p in projects:
|
||||
pid = p["id"]
|
||||
title = p["title"]
|
||||
# 각 프로젝트의 태스크 수 조회
|
||||
try:
|
||||
tasks = api_get(f"/projects/{pid}/tasks?per_page=200")
|
||||
todo = sum(1 for t in tasks if not t["done"])
|
||||
done = sum(1 for t in tasks if t["done"])
|
||||
print(f" #{pid:<3d} {title:<30s} TODO: {todo} DONE: {done}")
|
||||
except Exception:
|
||||
print(f" #{pid:<3d} {title:<30s} (조회 실패)")
|
||||
print(f"\n Total: {len(projects)} projects")
|
||||
|
||||
|
||||
def report(project_id: int = None):
|
||||
"""프로젝트 종합 현황 보고 (태스크 + git log + devlog)."""
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
pid = project_id or PROJECT_ID
|
||||
|
||||
# 1) 프로젝트 이름 조회
|
||||
try:
|
||||
projects = api_get("/projects")
|
||||
proj_name = next((p["title"] for p in projects if p["id"] == pid), f"Project #{pid}")
|
||||
except Exception:
|
||||
proj_name = f"Project #{pid}"
|
||||
|
||||
print(f"=== 프로젝트 현황: {proj_name} (#{pid}) ===")
|
||||
|
||||
# 2) 태스크 현황
|
||||
try:
|
||||
tasks = api_get(f"/projects/{pid}/tasks?per_page=200")
|
||||
todo_tasks = [t for t in tasks if not t["done"]]
|
||||
done_tasks = [t for t in tasks if t["done"]]
|
||||
total = len(tasks)
|
||||
rate = f"{len(done_tasks)/total*100:.0f}%" if total else "N/A"
|
||||
|
||||
print(f"\n[태스크]")
|
||||
print(f" TODO: {len(todo_tasks)}건 | DONE: {len(done_tasks)}건 | 완료율: {rate}")
|
||||
|
||||
if todo_tasks:
|
||||
print(f" 미완료:")
|
||||
for t in todo_tasks:
|
||||
labels = ", ".join(l["title"] for l in (t.get("labels") or []))
|
||||
label_str = f" [{labels}]" if labels else ""
|
||||
desc = (t.get("description") or "")[:40].replace("\n", " ")
|
||||
desc_str = f" {desc}" if desc else ""
|
||||
print(f" ⬜ #{t['id']} {t['title'][:50]}{label_str}{desc_str}")
|
||||
|
||||
if done_tasks:
|
||||
# 최근 완료 5건만 표시
|
||||
recent_done = sorted(done_tasks, key=lambda t: t.get("done_at", ""), reverse=True)[:5]
|
||||
print(f" 최근 완료 (최대 5건):")
|
||||
for t in recent_done:
|
||||
print(f" ✅ #{t['id']} {t['title'][:50]}")
|
||||
except Exception as e:
|
||||
print(f" 태스크 조회 실패: {e}")
|
||||
|
||||
# 3) Git log (현재 디렉토리 기준)
|
||||
print(f"\n[최근 커밋 5건]")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["git", "log", "--oneline", "-5"],
|
||||
capture_output=True, timeout=10,
|
||||
encoding="utf-8", errors="replace",
|
||||
)
|
||||
if result.returncode == 0 and result.stdout.strip():
|
||||
for line in result.stdout.strip().splitlines():
|
||||
print(f" {line}")
|
||||
else:
|
||||
print(" (git log 없음)")
|
||||
except Exception:
|
||||
print(" (git 실행 불가)")
|
||||
|
||||
# 4) Devlog (오늘/어제)
|
||||
print(f"\n[Devlog]")
|
||||
today = datetime.now().strftime("%Y-%m-%d")
|
||||
yesterday = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
|
||||
|
||||
devlog_found = False
|
||||
for date_str in [today, yesterday]:
|
||||
devlog_path = Path("docs/devlog") / f"{date_str}.md"
|
||||
if devlog_path.exists():
|
||||
content = devlog_path.read_text(encoding="utf-8").strip()
|
||||
# 최대 500자
|
||||
if len(content) > 500:
|
||||
content = content[:500] + "\n ...(생략)"
|
||||
print(f" [{date_str}]")
|
||||
for line in content.splitlines():
|
||||
print(f" {line}")
|
||||
devlog_found = True
|
||||
break
|
||||
|
||||
if not devlog_found:
|
||||
print(" (최근 devlog 없음)")
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
print(__doc__)
|
||||
return
|
||||
|
||||
cmd = sys.argv[1].lower()
|
||||
|
||||
if cmd == "done":
|
||||
ids = [int(x) for x in sys.argv[2:]]
|
||||
mark_done(ids)
|
||||
elif cmd == "undone":
|
||||
ids = [int(x) for x in sys.argv[2:]]
|
||||
mark_undone(ids)
|
||||
elif cmd == "comment":
|
||||
add_comment(int(sys.argv[2]), sys.argv[3])
|
||||
elif cmd == "desc":
|
||||
set_description(int(sys.argv[2]), sys.argv[3])
|
||||
elif cmd == "list":
|
||||
f = sys.argv[2] if len(sys.argv) > 2 else "all"
|
||||
list_tasks(f)
|
||||
elif cmd == "label":
|
||||
if len(sys.argv) < 4:
|
||||
print("Usage: vikunja_helper.py label TASK_ID Label1 Label2 ...")
|
||||
return
|
||||
add_labels(int(sys.argv[2]), sys.argv[3:])
|
||||
elif cmd == "create":
|
||||
title = sys.argv[2] if len(sys.argv) > 2 else ""
|
||||
desc = sys.argv[3] if len(sys.argv) > 3 and not sys.argv[3].startswith("--") else ""
|
||||
is_done = "--done" in sys.argv
|
||||
labels = None
|
||||
for i, arg in enumerate(sys.argv):
|
||||
if arg == "--labels" and i + 1 < len(sys.argv):
|
||||
labels = sys.argv[i + 1].split(",")
|
||||
break
|
||||
if not title:
|
||||
print("Error: title is required")
|
||||
return
|
||||
create_task(title, desc, done=is_done, labels=labels)
|
||||
elif cmd == "projects":
|
||||
list_projects()
|
||||
elif cmd == "report":
|
||||
pid = int(sys.argv[2]) if len(sys.argv) > 2 else None
|
||||
report(pid)
|
||||
else:
|
||||
print(f"Unknown command: {cmd}")
|
||||
print(__doc__)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
100
.agent/workflows/helpers/wiki_helper.py
Normal file
100
.agent/workflows/helpers/wiki_helper.py
Normal file
@@ -0,0 +1,100 @@
|
||||
"""Gitea Wiki helper: list, read, create, update wiki pages.
|
||||
|
||||
Usage:
|
||||
wiki_helper.py list — list all pages
|
||||
wiki_helper.py read <title> — read a page
|
||||
wiki_helper.py create <title> <file> — create a page from file
|
||||
wiki_helper.py update <title> <file> — update a page from file
|
||||
"""
|
||||
import sys, io, json, base64, urllib.request, urllib.error
|
||||
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
|
||||
# ============================================================
|
||||
# ⚙️ CONFIGURATION — GITEA_REPO만 프로젝트별로 변경하세요
|
||||
# ============================================================
|
||||
GITEA_BASE_URL = "https://git.variet.net"
|
||||
GITEA_OWNER = "Variet"
|
||||
GITEA_REPO = "variet-agent" # Variet Agent 프로젝트
|
||||
GITEA_TOKEN = "3a01b4b15a39921572e64c413353e870d4d2161b"
|
||||
# ============================================================
|
||||
|
||||
BASE = f"{GITEA_BASE_URL}/api/v1/repos/{GITEA_OWNER}/{GITEA_REPO}/wiki"
|
||||
HEADERS = {"Authorization": f"token {GITEA_TOKEN}", "Content-Type": "application/json"}
|
||||
|
||||
def _req(method, path, data=None):
|
||||
url = f"{BASE}{path}"
|
||||
body = json.dumps(data).encode() if data else None
|
||||
req = urllib.request.Request(url, data=body, headers=HEADERS, method=method)
|
||||
try:
|
||||
with urllib.request.urlopen(req) as resp:
|
||||
return json.loads(resp.read().decode())
|
||||
except urllib.error.HTTPError as e:
|
||||
err = e.read().decode()
|
||||
print(f" ⚠️ HTTP {e.code}: {err}")
|
||||
return None
|
||||
|
||||
def _find_sub_url(title):
|
||||
pages = _req("GET", "/pages")
|
||||
if pages:
|
||||
for p in pages:
|
||||
if p.get("title", "").lower() == title.lower():
|
||||
return p.get("sub_url", title)
|
||||
return title
|
||||
|
||||
def list_pages():
|
||||
pages = _req("GET", "/pages")
|
||||
if pages:
|
||||
print(f"=== {len(pages)} Wiki Pages ===")
|
||||
for p in pages:
|
||||
print(f" {p.get('title', '?')}")
|
||||
return pages
|
||||
|
||||
def read_page(title):
|
||||
sub = _find_sub_url(title)
|
||||
page = _req("GET", f"/page/{sub}")
|
||||
if page and page.get("content_base64"):
|
||||
content = base64.b64decode(page["content_base64"]).decode("utf-8")
|
||||
return content
|
||||
return None
|
||||
|
||||
def create_page(title, content):
|
||||
data = {
|
||||
"title": title,
|
||||
"content_base64": base64.b64encode(content.encode()).decode(),
|
||||
}
|
||||
result = _req("POST", "/new", data)
|
||||
if result:
|
||||
print(f" ✅ Created wiki page: {title}")
|
||||
return result
|
||||
|
||||
def update_page(title, content):
|
||||
sub = _find_sub_url(title)
|
||||
data = {
|
||||
"title": title,
|
||||
"content_base64": base64.b64encode(content.encode()).decode(),
|
||||
}
|
||||
result = _req("PATCH", f"/page/{sub}", data)
|
||||
if result:
|
||||
print(f" ✅ Updated wiki page: {title}")
|
||||
return result
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmd = sys.argv[1] if len(sys.argv) > 1 else "list"
|
||||
|
||||
if cmd == "list":
|
||||
list_pages()
|
||||
elif cmd == "read" and len(sys.argv) > 2:
|
||||
content = read_page(sys.argv[2])
|
||||
if content:
|
||||
print(content[:5000])
|
||||
else:
|
||||
print(f" Page '{sys.argv[2]}' not found")
|
||||
elif cmd == "create" and len(sys.argv) > 3:
|
||||
with open(sys.argv[3], "r", encoding="utf-8") as f:
|
||||
create_page(sys.argv[2], f.read())
|
||||
elif cmd == "update" and len(sys.argv) > 3:
|
||||
with open(sys.argv[3], "r", encoding="utf-8") as f:
|
||||
update_page(sys.argv[2], f.read())
|
||||
else:
|
||||
print("Usage: wiki_helper.py list|read <title>|create <title> <file>|update <title> <file>")
|
||||
39
.agent/workflows/pre-task.md
Normal file
39
.agent/workflows/pre-task.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
description: 모든 구현 작업 전 실행하는 사전 점검 체크리스트 (pre-task, 준비, 시작 전, 계획, 구현)
|
||||
---
|
||||
|
||||
# Pre-Task Checklist
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 코딩을 시작하기 전에 반드시 이 체크리스트를 순서대로 완료하세요.
|
||||
> 체크리스트를 건너뛸 경우 불필요한 시행착오가 발생합니다.
|
||||
|
||||
## 1단계: 요구사항 정리
|
||||
|
||||
- [ ] 유저 요청을 구체적 작업 항목으로 분해
|
||||
- [ ] 변경 범위(scope)를 명확히 정의 (영향받는 파일/모듈)
|
||||
- [ ] 성공 기준(acceptance criteria) 확인
|
||||
|
||||
## 2단계: 레퍼런스 확인 (추측 금지)
|
||||
|
||||
- [ ] `.agents/references/architecture.md` — 현재 아키텍처 확인
|
||||
- [ ] `.agents/references/tech-stack.md` — 기술 스택 및 버전 확인
|
||||
- [ ] `.agents/references/conventions.md` — 코딩 컨벤션 확인
|
||||
- [ ] `.agents/references/known-issues.md` — 과거 실패 패턴 확인
|
||||
- [ ] 관련 기존 코드 최소 3개 파일 읽기
|
||||
|
||||
> [!CAUTION]
|
||||
> 레퍼런스 문서가 존재하는 주제에 대해 추측하지 마세요.
|
||||
> 문서가 없으면 유저에게 확인을 요청하세요.
|
||||
|
||||
## 3단계: 계획 수립
|
||||
|
||||
- [ ] 변경할 파일 목록 작성
|
||||
- [ ] 의존성 순서 파악 (어떤 파일부터 수정해야 하는가?)
|
||||
- [ ] 리스크 식별 (어디서 실패할 가능성이 높은가?)
|
||||
- [ ] 테스트 방법 결정 (어떻게 검증할 것인가?)
|
||||
|
||||
## 4단계: 유저 확인
|
||||
|
||||
- [ ] 계획을 유저에게 보고하고 승인받기 (변경 파일 3개 이상인 경우)
|
||||
- [ ] 작은 변경은 바로 실행하되, 변경 내용을 명확히 설명
|
||||
78
.agent/workflows/services.md
Normal file
78
.agent/workflows/services.md
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
description: 프로젝트 서비스 연동 정보 + 작업 프로토콜 (서비스, 크레덴셜, API)
|
||||
---
|
||||
|
||||
# 서비스 연동 정보
|
||||
|
||||
> [!CAUTION]
|
||||
> 아래에는 API 토큰이 포함되어 있습니다. 외부에 노출하지 마세요.
|
||||
|
||||
## 런타임 환경
|
||||
|
||||
| 항목 | 값 |
|
||||
|------|-----|
|
||||
| **Python** | `C:\ProgramData\miniforge3\envs\score\python.exe` |
|
||||
| **Shell** | PowerShell (`curl` = `Invoke-WebRequest` 별칭이므로 반드시 **`curl.exe`** 사용) |
|
||||
|
||||
> [!TIP]
|
||||
> 기술 스택 상세: `.agent/references/tech-stack.md` 참조
|
||||
> PowerShell 주의사항: `.agent/AGENT.md` PowerShell Notes 참조
|
||||
|
||||
## Gitea (Git Repository)
|
||||
|
||||
| 항목 | 값 |
|
||||
|------|-----|
|
||||
| **Base URL** | `https://git.variet.net` |
|
||||
| **API Base** | `https://git.variet.net/api/v1` |
|
||||
| **Repo** | `Variet/guitar_score` |
|
||||
| **Token** | `3a01b4b15a39921572e64c413353e870d4d2161b` |
|
||||
| **Auth Header** | `-H "Authorization: token 3a01b4b15a39921572e64c413353e870d4d2161b"` |
|
||||
|
||||
## Vikunja (Task Management)
|
||||
|
||||
| 항목 | 값 |
|
||||
|------|-----|
|
||||
| **Base URL** | `https://plan.variet.net` |
|
||||
| **API Base** | `https://plan.variet.net/api/v1` |
|
||||
| **Project ID** | `12` |
|
||||
| **Token** | `tk_070f8e0b715e818bb7178c3815ed5389040eddca` |
|
||||
| **Auth Header** | `-H "Authorization: Bearer tk_070f8e0b715e818bb7178c3815ed5389040eddca"` |
|
||||
|
||||
### Vikunja 태스크 조회
|
||||
|
||||
> [!TIP]
|
||||
> 직접 API 호출 대신 반드시 helper 스크립트를 사용하세요.
|
||||
|
||||
```powershell
|
||||
C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\vikunja_helper.py list todo
|
||||
```
|
||||
|
||||
### Vikunja 라벨 체계
|
||||
|
||||
**영역 라벨 (필수, 1개 이상):**
|
||||
|
||||
| ID | 라벨 | 적용 대상 |
|
||||
|:--:|-------|-----------|
|
||||
| 1 | `Backend` | 서버, DB, API |
|
||||
| 2 | `Frontend` | UI, 인터페이스 |
|
||||
| 3 | `Engine` | 엔진 로직/연산 |
|
||||
| 4 | `Infra` | Docker, CI/CD, 배포 |
|
||||
| 5 | `Test` | 테스트, E2E |
|
||||
| 17 | `Agent` | 에이전트 관련 |
|
||||
| 18 | `Tool` | 도구 관련 |
|
||||
| 19 | `AI/LLM` | AI/LLM 관련 |
|
||||
|
||||
**우선순위 라벨 (필수, 1개):**
|
||||
|
||||
| ID | 라벨 | 기준 |
|
||||
|:--:|-------|------|
|
||||
| 6 | `Priority:High` | 장애, 필수 기능 |
|
||||
| 7 | `Priority:Mid` | 개선, UX, 리팩토링 |
|
||||
| 8 | `Priority:Low` | nice-to-have |
|
||||
|
||||
## 모니터링 서비스
|
||||
|
||||
| 서비스 | URL | 용도 |
|
||||
|--------|-----|------|
|
||||
| Uptime Kuma | `https://status.variet.net` | 서비스 모니터링 |
|
||||
| Authentik | `https://auth.variet.net` | SSO 인증 |
|
||||
66
.agent/workflows/start.md
Normal file
66
.agent/workflows/start.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
description: 세션 시작 시 프로젝트 맥락을 빠르게 복구하는 워크플로우 (시작, continue, 이어서, 작업 시작)
|
||||
---
|
||||
|
||||
# 세션 시작 프로토콜
|
||||
|
||||
새 대화 시작, "continue", "이어서", "작업 시작" 등 요청 시 이 워크플로우를 실행합니다.
|
||||
|
||||
// turbo-all
|
||||
|
||||
## 절차
|
||||
|
||||
### 0. 에이전트 룰 & 맥락 로딩 (자동)
|
||||
|
||||
`.agent/AGENT.md`를 읽고 에이전트 행동 규칙을 로딩합니다.
|
||||
`.agent/references/known-issues.md`를 읽어 최근 이슈를 파악합니다.
|
||||
`.agent/references/STATUS.md`를 읽어 전체 설계 현황과 기능 목록을 파악합니다.
|
||||
|
||||
### 1. Devlog 맥락 복구
|
||||
|
||||
오늘 + 어제 devlog index를 읽고 최근 작업 흐름을 파악합니다.
|
||||
|
||||
```powershell
|
||||
$today = Get-Date -Format "yyyy-MM-dd"
|
||||
$yesterday = (Get-Date).AddDays(-1).ToString("yyyy-MM-dd")
|
||||
if (Test-Path "docs\devlog\$today.md") {
|
||||
Write-Host "=== Devlog: $today ==="
|
||||
Get-Content "docs\devlog\$today.md"
|
||||
} elseif (Test-Path "docs\devlog\$yesterday.md") {
|
||||
Write-Host "=== Devlog: $yesterday (no entry for today yet) ==="
|
||||
Get-Content "docs\devlog\$yesterday.md"
|
||||
} else {
|
||||
Write-Host "=== No recent devlog found ==="
|
||||
}
|
||||
```
|
||||
|
||||
미완료(🔧) 항목이 있으면 해당 entry 파일을 읽어 이어받기 맥락을 확보합니다:
|
||||
- Entry 경로: `docs/devlog/entries/YYYYMMDD-NNN.md`
|
||||
|
||||
### 2. Git 상태 확인
|
||||
|
||||
```powershell
|
||||
git status --short
|
||||
```
|
||||
```powershell
|
||||
git log --oneline -5
|
||||
```
|
||||
|
||||
### 3. Vikunja TODO 태스크
|
||||
|
||||
```powershell
|
||||
C:\ProgramData\miniforge3\envs\variet-agent\python.exe .agent\workflows\helpers\vikunja_helper.py list todo
|
||||
```
|
||||
|
||||
### 4. 종합 보고
|
||||
|
||||
결과를 종합하여 사용자에게 보고:
|
||||
- 마지막 작업 맥락 + 미완료 항목 (devlog 🔧 기반)
|
||||
- TODO 태스크 목록 (라벨 + 우선순위)
|
||||
- 다음 작업 제안
|
||||
|
||||
**우선순위 판단 기준** (라벨만으로 판단 금지):
|
||||
- P0: 최근 커밋에서 스키마/모델/인터페이스 변경 → 연쇄 영향 점검
|
||||
- P1: 서버 기동/API 응답 장애
|
||||
- P2: 기능 미완성/UX 개선
|
||||
- P3: 정확도 향상, 신규 기능, CI/CD, 문서 정리
|
||||
Reference in New Issue
Block a user