Files
2nd/scratch/link_orphans.py
T

88 lines
3.4 KiB
Python

import os
topics_path = r'E:\Wiki\2nd\10_Wiki\Topics'
def get_files_with_prefix(prefix):
matches = []
for root, dirs, files in os.walk(topics_path):
for f in files:
if f.lower().startswith(prefix.lower()) and f.endswith('.md'):
# Extract name without ext and handle paths relative to Topics
rel_path = os.path.relpath(os.path.join(root, f), topics_path).replace('\\', '/')
matches.append(rel_path[:-3])
return sorted(matches)
# 1. Skybound Orphans
skybound_files = get_files_with_prefix('2026-04-')
skybound_files = [f for f in skybound_files if 'skybound' in f.lower()]
# 2. Datacollector Orphans
dc_files = get_files_with_prefix('2026-04-')
dc_files = [f for f in dc_files if 'datacollector' in f.lower()]
# 3. War Commander (Game Design) files
wc_files = get_files_with_prefix('') # Look for files in Game Design
wc_files = [f for f in wc_files if 'Game Design' in f]
print(f"Skybound files found: {len(skybound_files)}")
print(f"Datacollector files found: {len(dc_files)}")
print(f"War Commander files found: {len(wc_files)}")
# Generating Skybound Update
with open(os.path.join(topics_path, 'Skybound', 'Skybound-Knowledge-Hub.md'), 'r', encoding='utf-8') as f:
hub_content = f.read()
if '## 🏷️ Keyword Cluster: #Project_Logs' not in hub_content:
log_section = "\n## 🏷️ Keyword Cluster: #Project_Logs (최근 개발 로그)\n"
for f in skybound_files:
name = os.path.basename(f)
log_section += f"- [[{f}|{name}]]\n"
hub_content += log_section
with open(os.path.join(topics_path, 'Skybound', 'Skybound-Knowledge-Hub.md'), 'w', encoding='utf-8') as f:
f.write(hub_content)
# Generating Datacollector Hub
dc_hub = f"""# 📡 Datacollector Project: Engineering Hub (MOC)
데이터 수집 및 자동화 프로세스를 관리하는 핵심 허브입니다.
---
## 🏷️ Keyword Cluster: #Development_Logs (개발 및 이슈 기록)
- {"".join([f"- [[{f}]]\n" for f in dc_files])}
---
**Status**: Managed by Antigravity AI
"""
with open(os.path.join(topics_path, 'Datacollector', 'Datacollector-Knowledge-Hub.md'), 'w', encoding='utf-8') as f:
f.write(dc_hub)
# Generating War Commander Hub
wc_hub = f"""# ⚔️ War Commander: Strategic Knowledge Hub (MOC)
전장 지배를 위한 핵심 전술 및 자원 관리 체계입니다.
---
## 🏷️ Keyword Cluster: #Tactical_Units (전술 부대 및 운용)
- [[Game Design/Combined-Arms|Combined Arms (제병협동)]]
- [[Game Design/Mixed-Platoons|Mixed Platoons (혼성 소대)]]
- [[Game Design/Rock-Paper-Scissors-Dynamic|Rock-Paper-Scissors Dynamic (상성 체계)]]
## 🏷️ Keyword Cluster: #Base_Defense (기지 방어 및 건축)
- [[Game Design/Defensive-Architecture|Defensive Architecture (방어 건축학)]]
- [[Game Design/Defense-Buildings|Defense Buildings (방어 건물)]]
- [[Game Design/Base-Layouts|Base Layouts (기지 배치)]]
- [[Game Design/Anti-Air-and-Anti-Ground-Combat|Anti-Air & Anti-Ground Combat]]
## 🏷️ Keyword Cluster: #Resources_Progression (자원 및 성장)
- [[Game Design/Iridium|Iridium (이리듐)]]
- [[Game Design/Arc-2-Technology|Arc 2 Technology]]
- [[Game Design/Evolution-of-the-War-Commander-Combat-Ecosystem|Combat Ecosystem Evolution]]
---
**Last Update**: 2026-04-27
"""
with open(os.path.join(topics_path, 'Game Design', 'War-Commander-Strategic-Hub.md'), 'w', encoding='utf-8') as f:
f.write(wc_hub)