위키 정리: 표준 AI WIKI 플랫폼 구조 적용

- 표준(diadmin/AI_Wiki_Platform 38f17d7)을 new_project.py 방식으로 복사:
  PROJECT.md(개발용 · windows, mac, linux), CLAUDE.md, .claude, .obsidian,
  raw, assets, tools, wiki/00~09·99 (08_화면은 빈 구조, 포탈 예시 제외)
- 프로젝트 문서 wiki/10_JJ_Ollama_Manager/: 00_홈(예전 wiki/00 홈.md 갱신 -
  host 방식·포트 전달), 01_설치, 02_메뉴_사용법, 03_ComfyUI, 04_문제_해결,
  05_변경_기록, 06_작업_현황 (Gitea 위키 6페이지 + 10/29~11/3 내용 통합)
- 사용자 지시 기록 20261103_1657_위키_정리
- .gitignore/.gitattributes 표준 규칙 합침, README에 위키 안내

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K3UWnbHEdCxxWhyNx7Cpd2
This commit is contained in:
Claude
2026-11-03 08:01:41 +00:00
parent a9b59594b3
commit 92e4dbe3cb
64 changed files with 1674 additions and 117 deletions

106
tools/ppt_watch.py Normal file
View File

@@ -0,0 +1,106 @@
"""PPT 변경 감지 → PNG 자동 재생성 → 위키(화면설명.md / 장표설명.md) 자동 반영.
대상: wiki/08_화면/**/*.pptx, wiki/07_제안서/**/*.pptx
사용: python tools/ppt_watch.py (계속 감시, 5초 간격)
python tools/ppt_watch.py --once (한 번만 검사)
변환: Windows = PowerPoint(설치 시) → 없으면 LibreOffice / Mac·Linux = LibreOffice + pdftoppm
필요: pip install python-pptx (Windows PowerPoint 사용 시 pip install pywin32)"""
import sys, os, time, json, hashlib, pathlib, subprocess, shutil, tempfile, datetime, re
ROOT = pathlib.Path(__file__).resolve().parent.parent
TARGETS = [ROOT / "wiki" / "08_화면", ROOT / "wiki" / "07_제안서"]
STATE = ROOT / "tools" / ".ppt_state.json"
KST = datetime.timezone(datetime.timedelta(hours=9))
A, B = "<!-- PPT-AUTO-START -->", "<!-- PPT-AUTO-END -->"
def digest(p):
return hashlib.sha1(p.read_bytes()).hexdigest()
def png_name(pptx, i):
return pptx.with_name(f"{pptx.stem}.png" if i == 1 else f"{pptx.stem}_{i:02d}.png")
def to_png_powerpoint(pptx):
import win32com.client # pywin32
app = win32com.client.Dispatch("PowerPoint.Application")
pres = app.Presentations.Open(str(pptx), WithWindow=False)
try:
for i, s in enumerate(pres.Slides, 1):
s.Export(str(png_name(pptx, i)), "PNG", 1600, 900)
finally:
pres.Close()
def soffice():
for c in ("soffice", "libreoffice", r"C:\Program Files\LibreOffice\program\soffice.exe",
"/Applications/LibreOffice.app/Contents/MacOS/soffice"):
if shutil.which(c) or os.path.exists(c): return shutil.which(c) or c
raise RuntimeError("LibreOffice 가 필요합니다")
def to_png_libreoffice(pptx):
with tempfile.TemporaryDirectory() as t:
subprocess.run([soffice(), "--headless", "--convert-to", "pdf", "--outdir", t, str(pptx)],
check=True, capture_output=True)
pdf = pathlib.Path(t) / f"{pptx.stem}.pdf"
subprocess.run(["pdftoppm", "-png", "-r", "110", str(pdf), str(pathlib.Path(t) / "s")], check=True)
for i, f in enumerate(sorted(pathlib.Path(t).glob("s-*.png")), 1):
shutil.move(str(f), png_name(pptx, i))
def to_png(pptx):
for old in pptx.parent.glob(f"{pptx.stem}*.png"):
old.unlink()
if os.name == "nt":
try:
return to_png_powerpoint(pptx)
except Exception:
pass
to_png_libreoffice(pptx)
def slide_texts(pptx):
from pptx import Presentation
out = []
for i, s in enumerate(Presentation(str(pptx)).slides, 1):
t = [sh.text_frame.text.strip() for sh in s.shapes if sh.has_text_frame and sh.text_frame.text.strip()]
out.append((i, t))
return out
def update_wiki(pptx):
md = pptx.parent / ("화면설명.md" if "08_화면" in pptx.parts else f"{pptx.stem}_장표설명.md")
body = md.read_text(encoding="utf-8") if md.exists() else f"---\nstatus: 초안\n---\n# {pptx.stem}\n"
lines = [A, f"## PPT 내용 (자동 추출 — {pptx.name})"]
for i, t in slide_texts(pptx):
lines.append(f"### 슬라이드 {i}\n![[{png_name(pptx, i).name}]]")
lines += [f"- {x.replace(chr(10), ' / ')}" for x in t]
lines.append(B)
block = "\n".join(lines)
body = re.sub(re.escape(A) + ".*?" + re.escape(B), block, body, flags=re.S) if A in body else body.rstrip() + "\n\n" + block + "\n"
now = datetime.datetime.now(KST)
if "## 수정 이력" not in body:
body += "\n## 수정 이력\n"
body = body.rstrip() + f"\n- {now:%Y-%m-%d %H:%M} PPT 변경 감지 → 이미지·내용 자동 갱신 (검토 필요)\n"
body = re.sub(r"^status:\s*컨펌", "status: 검토중", body, flags=re.M) # 컨펌 후 바뀌면 재검토
md.write_text(body, encoding="utf-8")
def scan(state):
changed = []
for base in TARGETS:
for p in base.rglob("*.pptx"):
if p.name.startswith("~$"): continue
h = digest(p); k = p.relative_to(ROOT).as_posix()
if state.get(k) != h:
try:
to_png(p); update_wiki(p); state[k] = h; changed.append(k)
print("갱신:", k)
except Exception as e:
print("실패:", k, e)
if changed:
STATE.write_text(json.dumps(state, ensure_ascii=False, indent=1), encoding="utf-8")
subprocess.run([sys.executable, str(ROOT / "tools" / "build_menu.py")])
return changed
def main():
state = json.loads(STATE.read_text(encoding="utf-8")) if STATE.exists() else {}
if "--once" in sys.argv:
scan(state); return
print("PPT 감시 중... (Ctrl+C 종료)")
while True:
scan(state); time.sleep(5)
if __name__ == "__main__":
main()