위키 볼트를 wiki 폴더로: 위키 파일을 wiki/ 안으로 모음
- wiki/ 안으로 옮김: .obsidian, raw, assets, tools, CLAUDE.md, PROJECT.md
- 맨 위 CLAUDE.md 는 `@wiki/CLAUDE.md` 한 줄 (Claude Code 자동 참조용)
- 맨 위에 남김: .claude (Claude Code), README.md (Gitea 첫 화면), 프로그램 파일
- wiki/tools 도구 기준 폴더를 wiki 로, .claude 명령·.gitignore·문서 속 경로 갱신
- wiki/.obsidian/app.json: 볼트 밖이 된 폴더 제외 목록 삭제
- 작업현황·변경기록·지시기록 갱신 (v2.1.0, d1a8009 포함)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HnDmXrFqktWwYa1cuJRAVZ
This commit is contained in:
75
wiki/tools/build_menu.py
Normal file
75
wiki/tools/build_menu.py
Normal file
@@ -0,0 +1,75 @@
|
||||
"""폴더 = 메뉴. wiki/08_화면 의 폴더 구조로 메뉴 HTML 과 화면목록.md 를 만든다.
|
||||
폴더 이름 규칙: 숫자_메뉴이름 (숫자 = 순서). 폴더를 바꾸고 다시 실행하면 메뉴도 같이 바뀐다.
|
||||
사용: python tools/build_menu.py → wiki/08_화면/menu.html, wiki/08_화면/00_화면목록.md"""
|
||||
import pathlib, re, html, urllib.parse
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent # = wiki 폴더 (볼트)
|
||||
SCR = ROOT / "08_화면"
|
||||
PAT = re.compile(r"^(\d+)_(.+)$")
|
||||
|
||||
def menu_dirs(d):
|
||||
return sorted([p for p in d.iterdir() if p.is_dir() and PAT.match(p.name)], key=lambda p: int(PAT.match(p.name)[1]))
|
||||
|
||||
def label(p):
|
||||
return PAT.match(p.name)[2]
|
||||
|
||||
def status(p):
|
||||
f = p / "화면설명.md"
|
||||
if f.exists():
|
||||
m = re.search(r"^status:\s*(\S+)", f.read_text(encoding="utf-8"), re.M)
|
||||
if m: return m[1]
|
||||
return "없음"
|
||||
|
||||
def rel(p):
|
||||
return urllib.parse.quote(p.relative_to(SCR).as_posix())
|
||||
|
||||
def tree_html(d, depth=0):
|
||||
out = []
|
||||
for p in menu_dirs(d):
|
||||
imgs = sorted(p.glob("화면*.png"))
|
||||
img = "|".join(rel(i) for i in imgs) # 슬라이드가 여러 장이면 전부 표시
|
||||
proto = rel(p / "prototype.html") if (p / "prototype.html").exists() else "" # 실행 가능한 시제품
|
||||
out.append(f'<li><a href="#" data-img="{img}" data-proto="{proto}" data-md="{rel(p / "화면설명.md")}">'
|
||||
f'{html.escape(label(p))} <small>[{status(p)}]</small></a>')
|
||||
sub = tree_html(p, depth + 1)
|
||||
if sub: out.append(f"<ul>{sub}</ul>")
|
||||
out.append("</li>")
|
||||
return "".join(out)
|
||||
|
||||
def tree_md(d, depth=0):
|
||||
lines = []
|
||||
for p in menu_dirs(d):
|
||||
link = (p / "화면설명").relative_to(SCR.parent).as_posix()
|
||||
lines.append(f"{' ' * depth}- [[{link}|{label(p)}]] `{status(p)}`")
|
||||
lines += tree_md(p, depth + 1)
|
||||
return lines
|
||||
|
||||
PAGE = """<!DOCTYPE html><html lang="ko"><head><meta charset="utf-8"><title>화면 메뉴 미리보기</title>
|
||||
<style>body{margin:0;display:flex;height:100vh;font-family:'Malgun Gothic',sans-serif}
|
||||
nav{width:300px;overflow:auto;border-right:1px solid #ccc;padding:12px;background:#f7f7f9}
|
||||
nav ul{list-style:none;padding-left:16px}nav a{text-decoration:none;color:#222;display:block;padding:3px}
|
||||
nav a.on{background:#2b6cb0;color:#fff;border-radius:4px}small{color:#888}nav a.on small{color:#dde}
|
||||
main{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#e9ecef}
|
||||
#tabs{margin:8px}#tabs button{margin:0 3px;padding:4px 12px;border:1px solid #2b6cb0;background:#fff;color:#2b6cb0;border-radius:4px;cursor:pointer}#tabs button.on{background:#2b6cb0;color:#fff}#tabs a.run{margin-left:12px;padding:4px 12px;background:#f6ad55;color:#222;border-radius:4px;text-decoration:none;font-weight:bold}
|
||||
img{max-width:95%;max-height:88vh;box-shadow:0 2px 12px #0003;background:#fff}#t{margin:8px;color:#555}</style></head>
|
||||
<body><nav><b>메뉴 (폴더 구조)</b><ul>__TREE__</ul></nav><main><div id="tabs"></div><img id="v" alt=""><div id="t">왼쪽 메뉴를 누르면 화면이 보입니다</div></main>
|
||||
<script>document.querySelectorAll('nav a').forEach(a=>a.onclick=e=>{e.preventDefault();
|
||||
document.querySelectorAll('nav a').forEach(x=>x.classList.remove('on'));a.classList.add('on');
|
||||
const imgs=(a.dataset.img||'').split('|').filter(x=>x);const tb=document.getElementById('tabs');tb.innerHTML='';
|
||||
const show=i=>{document.getElementById('v').src=imgs[i]||'';
|
||||
document.getElementById('t').textContent=imgs.length?decodeURIComponent(imgs[i]):'화면 이미지가 아직 없습니다';
|
||||
tb.querySelectorAll('button').forEach((b,j)=>b.classList.toggle('on',i==j));};
|
||||
if(imgs.length>1)imgs.forEach((x,i)=>{const b=document.createElement('button');b.textContent='화면 '+(i+1);b.onclick=()=>show(i);tb.appendChild(b);});
|
||||
if(a.dataset.proto){const r=document.createElement('a');r.className='run';r.href=a.dataset.proto;r.target='_blank';r.textContent='▶ 실행해 보기';tb.appendChild(r);}
|
||||
show(0);});
|
||||
const f=document.querySelector('nav a');if(f)f.click();</script></body></html>"""
|
||||
|
||||
def main():
|
||||
(SCR / "menu.html").write_text(PAGE.replace("__TREE__", tree_html(SCR)), encoding="utf-8")
|
||||
md = ["# 00_화면목록 (자동 생성 — 직접 수정하지 마세요)", "",
|
||||
"폴더를 추가/이름변경하고 `python tools/build_menu.py` 를 실행하면 갱신됩니다.",
|
||||
"브라우저 미리보기: `wiki/08_화면/menu.html`", ""] + tree_md(SCR)
|
||||
(SCR / "00_화면목록.md").write_text("\n".join(md) + "\n", encoding="utf-8")
|
||||
print("메뉴 갱신 완료:", SCR / "menu.html")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
13
wiki/tools/check_lines.py
Normal file
13
wiki/tools/check_lines.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""소스 줄 수 검사: 700줄 초과(오류), 400줄 초과(경고) 파일을 출력한다.
|
||||
사용: python tools/check_lines.py <폴더>"""
|
||||
import sys, pathlib
|
||||
EXT = {".py",".kt",".java",".swift",".dart",".c",".cc",".cpp",".h",".hpp",".rs",".cs",".js",".ts",".tsx",".go",".m",".mm"}
|
||||
root = pathlib.Path(sys.argv[1] if len(sys.argv) > 1 else "src")
|
||||
bad = 0
|
||||
for f in sorted(root.rglob("*")):
|
||||
if f.suffix.lower() in EXT and f.is_file():
|
||||
n = sum(1 for _ in f.open(encoding="utf-8", errors="ignore"))
|
||||
if n > 700: print(f"[오류 {n}줄] {f}"); bad += 1
|
||||
elif n > 400: print(f"[경고 {n}줄] {f}")
|
||||
print("완료" if bad == 0 else f"700줄 초과 {bad}개 — 분리 필요")
|
||||
sys.exit(1 if bad else 0)
|
||||
26
wiki/tools/new_instruction.py
Normal file
26
wiki/tools/new_instruction.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""사용자 지시 기록 파일 생성 (KST 일시).
|
||||
사용: python tools/new_instruction.py "제목" [원문파일.txt]
|
||||
→ wiki/01_사용자지시/YYYYMMDD_HHMM_제목.md 생성 + 00_지시목록.md 에 한 줄 추가"""
|
||||
import sys, pathlib, datetime, re
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent # = wiki 폴더 (볼트)
|
||||
DIR = ROOT / "01_사용자지시"
|
||||
KST = datetime.timezone(datetime.timedelta(hours=9))
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
print(__doc__); sys.exit(1)
|
||||
title = re.sub(r'[\\/:*?"<>|\s]+', "_", sys.argv[1]).strip("_")
|
||||
body = pathlib.Path(sys.argv[2]).read_text(encoding="utf-8") if len(sys.argv) > 2 else ""
|
||||
now = datetime.datetime.now(KST)
|
||||
stem = f"{now:%Y%m%d_%H%M}_{title}"
|
||||
f = DIR / f"{stem}.md"
|
||||
f.write_text(
|
||||
f"---\n일시: {now:%Y-%m-%d %H:%M} (KST)\n제목: {sys.argv[1]}\nstatus: 접수\n---\n"
|
||||
f"# 사용자 지시 원문 (수정 없이 보관)\n```text\n{body}\n```\n"
|
||||
"# 처리 결과\n## 만든 것\n## 가정\n## 남은 일\n", encoding="utf-8")
|
||||
with (DIR / "00_지시목록.md").open("a", encoding="utf-8") as idx:
|
||||
idx.write(f"| {now:%Y-%m-%d %H:%M} | {sys.argv[1]} | 접수 | [[{stem}]] |\n")
|
||||
print(f)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
47
wiki/tools/new_project.py
Normal file
47
wiki/tools/new_project.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""표준 AI WIKI 플랫폼를 새 프로젝트로 복사하거나, 기존 프로젝트의 표준 부분만 갱신한다.
|
||||
사용: python tools/new_project.py <대상폴더> --type 개발용 --platforms android,windows [--modules player,explorer]
|
||||
python tools/new_project.py <기존프로젝트폴더> --update (표준 문서·도구만 덮어씀)
|
||||
※ 표준 원본(맨 위 = 볼트) 구조 기준 도구. JJ_OllamaManager 는 wiki 폴더가 볼트라서
|
||||
이 프로젝트에 --update 를 그대로 쓰면 맨 위에 파일이 다시 생김 (2026-11-03)"""
|
||||
import sys, shutil, pathlib, argparse, re
|
||||
SRC = pathlib.Path(__file__).resolve().parent.parent
|
||||
STD = ["CLAUDE.md", "README.md", "tools", ".claude", "assets/icons",
|
||||
"wiki/00_시작", "wiki/02_개발방법", "wiki/03_모듈화/01_모듈표준.md", "wiki/03_모듈화/02_모듈화프로젝트_진행.md",
|
||||
"wiki/04_플랫폼", "wiki/05_코딩표준", "wiki/06_저장소_동기화", "wiki/07_제안서/01_제안서_작업절차.md",
|
||||
"wiki/07_제안서/02_아이콘_PPT규칙.md", "wiki/09_연결가이드", "wiki/99_템플릿"]
|
||||
SKIP = shutil.ignore_patterns(".git", ".ppt_state.json", "workspace*.json", "__pycache__")
|
||||
|
||||
def copy(rel, dst):
|
||||
s, d = SRC / rel, dst / rel
|
||||
d.parent.mkdir(parents=True, exist_ok=True)
|
||||
if s.is_dir(): shutil.copytree(s, d, dirs_exist_ok=True, ignore=SKIP)
|
||||
elif s.exists(): shutil.copy2(s, d)
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("dst"); ap.add_argument("--type", default="개발용")
|
||||
ap.add_argument("--platforms", default="windows"); ap.add_argument("--modules", default="")
|
||||
ap.add_argument("--update", action="store_true")
|
||||
a = ap.parse_args(); dst = pathlib.Path(a.dst).resolve()
|
||||
if a.update:
|
||||
for r in STD: copy(r, dst)
|
||||
print("표준 갱신 완료 (PROJECT.md, 지시, 화면, raw 는 유지):", dst); return
|
||||
if dst.exists() and any(dst.iterdir()):
|
||||
sys.exit("대상 폴더가 비어 있지 않습니다. --update 를 쓰세요.")
|
||||
shutil.copytree(SRC, dst, dirs_exist_ok=True, ignore=SKIP)
|
||||
# 프로젝트 고유 내용 초기화
|
||||
for d in ["wiki/01_사용자지시"]:
|
||||
for f in (dst / d).glob("2*.md"): f.unlink()
|
||||
(dst / d / "00_지시목록.md").write_text("# 사용자 지시 목록\n\n| 일시(KST) | 제목 | 상태 | 파일 |\n|---|---|---|---|\n", encoding="utf-8")
|
||||
p = dst / "PROJECT.md"; t = p.read_text(encoding="utf-8")
|
||||
plats = ", ".join(x.strip() for x in a.platforms.split(",") if x.strip())
|
||||
mods = ", ".join(x.strip() for x in a.modules.split(",") if x.strip())
|
||||
t = re.sub(r"^project_name:.*$", f"project_name: {dst.name}", t, flags=re.M)
|
||||
t = re.sub(r"^project_type:\s*\S+", f"project_type: {a.type}", t, flags=re.M)
|
||||
t = re.sub(r"^platforms:.*$", f"platforms: [{plats}]", t, flags=re.M)
|
||||
t = re.sub(r"^uses_modules:.*$", f"uses_modules: [{mods}]", t, flags=re.M)
|
||||
p.write_text(t, encoding="utf-8")
|
||||
print("새 프로젝트 생성:", dst)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
106
wiki/tools/ppt_watch.py
Normal file
106
wiki/tools/ppt_watch.py
Normal 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 # = wiki 폴더 (볼트)
|
||||
TARGETS = [ROOT / "08_화면", ROOT / "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()
|
||||
Reference in New Issue
Block a user