docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
---
|
||||
id: wiki-2026-0508-ndf-parse
|
||||
title: ndf-parse
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [NDF Parser, Eugen NDF]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.85
|
||||
verification_status: applied
|
||||
tags: [parsing, modding, eugen, wargame, ndf]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: Python
|
||||
framework: ndf-parse (Ulibos)
|
||||
---
|
||||
|
||||
# ndf-parse
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 Eugen Systems NDF (Nakami Design File) 의 lossless parser — 매 mod tooling 의 backbone."**. NDF 는 매 Eugen 의 in-house declarative DSL — Wargame, Steel Division, WARNO 매 game data definition 사용. `ndf-parse` (Ulibos) 는 매 round-trip preservation (comments, whitespace, formatting) 의 Python parser.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 NDF 구조
|
||||
- **Object**: `EntityName is TEntityType ( property = value )` — 매 typed object literal.
|
||||
- **Template**: `template TFoo [Param: int] is TFoo ( ... )` — 매 generic-like.
|
||||
- **Map**: `MAP[(k, v), ...]` — 매 ordered dictionary.
|
||||
- **Vector**: `[a, b, c]` — 매 ordered list.
|
||||
- **GUID/Reference**: `GUID:{...}`, `~/Path/To/Object` — 매 reference.
|
||||
|
||||
### 매 ndf-parse 특징
|
||||
- **AST round-trip**: 매 parse → modify → unparse 후 매 byte-identical (modify X 영역).
|
||||
- **Visitor / walker**: 매 dataclass-like node tree.
|
||||
- **CLI**: `ndf` command — 매 batch script.
|
||||
- **2026 stable**: WARNO modding scene 매 standard.
|
||||
|
||||
### 매 응용
|
||||
1. WARNO mod (unit balance, new factions).
|
||||
2. Steel Division 2 mod.
|
||||
3. Automated balance tuning (CSV → NDF script).
|
||||
4. Diff tool — 매 patch-vs-vanilla compare.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Install + parse
|
||||
```python
|
||||
# pip install ndf-parse
|
||||
import ndf_parse as ndf
|
||||
|
||||
with open('UniteDescriptor.ndf', 'r', encoding='utf-8') as f:
|
||||
source = f.read()
|
||||
|
||||
tree = ndf.parse(source) # ndf.model.List
|
||||
print(len(tree)) # top-level statement count
|
||||
```
|
||||
|
||||
### Walk + find object
|
||||
```python
|
||||
for stmt in tree:
|
||||
if stmt.kind == 'object' and stmt.name == 'Descriptor_Unit_M1A2_Abrams_US':
|
||||
unit = stmt.value
|
||||
for member in unit:
|
||||
if member.member == 'MaxPhysicalDamages':
|
||||
print('HP:', member.value)
|
||||
```
|
||||
|
||||
### Mutate + write back
|
||||
```python
|
||||
import ndf_parse as ndf
|
||||
from ndf_parse import edit
|
||||
|
||||
with edit('UniteDescriptor.ndf') as tree:
|
||||
for stmt in tree:
|
||||
if stmt.kind == 'object' and 'Abrams' in stmt.name:
|
||||
for m in stmt.value:
|
||||
if m.member == 'MaxPhysicalDamages':
|
||||
m.value = '15' # buff HP
|
||||
|
||||
# `with edit(...)` 매 auto-write back, 매 untouched bytes 보존.
|
||||
```
|
||||
|
||||
### Add new member
|
||||
```python
|
||||
from ndf_parse.model import MemberRow
|
||||
|
||||
with edit('Ammunition.ndf') as tree:
|
||||
for stmt in tree:
|
||||
if stmt.name == 'Ammo_Custom_HEAT':
|
||||
stmt.value.add(MemberRow(member='HEDamage', value='9'))
|
||||
```
|
||||
|
||||
### Template instantiation lookup
|
||||
```python
|
||||
def find_template(tree, name):
|
||||
for stmt in tree:
|
||||
if stmt.kind == 'template' and stmt.name == name:
|
||||
return stmt
|
||||
return None
|
||||
```
|
||||
|
||||
### CSV → NDF batch patch
|
||||
```python
|
||||
import csv, ndf_parse as ndf
|
||||
from ndf_parse import edit
|
||||
|
||||
balance = {row['unit']: row for row in csv.DictReader(open('balance.csv'))}
|
||||
|
||||
with edit('UniteDescriptor.ndf') as tree:
|
||||
for stmt in tree:
|
||||
if stmt.kind != 'object': continue
|
||||
cfg = balance.get(stmt.name)
|
||||
if not cfg: continue
|
||||
for m in stmt.value:
|
||||
if m.member in cfg:
|
||||
m.value = cfg[m.member]
|
||||
```
|
||||
|
||||
### Diff vs vanilla
|
||||
```python
|
||||
import ndf_parse as ndf
|
||||
vanilla = ndf.parse(open('vanilla/UniteDescriptor.ndf').read())
|
||||
modded = ndf.parse(open('mod/UniteDescriptor.ndf').read())
|
||||
|
||||
vanilla_units = {s.name: s for s in vanilla if s.kind == 'object'}
|
||||
for s in modded:
|
||||
if s.kind != 'object': continue
|
||||
base = vanilla_units.get(s.name)
|
||||
if base and ndf.unparse(base.value) != ndf.unparse(s.value):
|
||||
print(f'changed: {s.name}')
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 single value tweak | `with edit()` context manager |
|
||||
| 매 large refactor | parse → walk → unparse explicit |
|
||||
| 매 batch CSV-driven | edit + lookup table |
|
||||
| 매 lossless preservation 필요 | ndf-parse (regex 의 X) |
|
||||
| 매 read-only analytics | parse + walk only |
|
||||
|
||||
**기본값**: 매 `with edit()` context — 매 mod 작업 80% case.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Parser]] · [[AST]]
|
||||
- 응용: [[WARNO_Modding]] · [[Eugen_Engine]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 Eugen game mod, WARNO balance script, NDF diff/patch tool.
|
||||
**언제 X**: 매 non-Eugen game (Bethesda Plugin = ESM/ESP, Paradox = PDX script). 매 다른 parser.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Regex 으로 NDF 편집**: 매 nested template / comment break. 매 ndf-parse 의 사용.
|
||||
- **매 unparse 후 manual format**: 매 round-trip 의 손실. 매 ndf-parse 가 매 formatting 보존.
|
||||
- **매 GUID hard-code**: 매 reference 깨짐. 매 path 의 사용 (`~/Foo/Bar`).
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (ndf-parse PyPI, Ulibos GitHub, WARNO modding wiki).
|
||||
- 신뢰도 A-.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — NDF parser API + mod patterns |
|
||||
Reference in New Issue
Block a user