Skip to content

legalize-kr/compiler

Repository files navigation

legalize-kr / compiler

legalize-kr/legalize-pipeline이 만드는 .cache/ 디렉토리를 입력으로 받아 법령(legalize-kr), 판례(precedent-kr), 행정규칙(admrule-kr), 자치법규(ordinance-kr) bare Git 저장소를 직접 써내는 Rust 컴파일러 모음입니다. 각 도메인이 한 Cargo workspace 안에 멤버 크레이트로 공존합니다.

Workspace 구조

compiler/
├── Cargo.toml         # virtual workspace
├── Cargo.lock         # 단일 lockfile
├── admrules/          # 행정규칙 컴파일러 (binary: admrule-kr-compiler)
├── laws/              # 법령 컴파일러 (binary: legalize-kr-compiler)
├── ordinances/        # 자치법규 컴파일러 (binary: ordinance-kr-compiler)
└── precedents/        # 판례 컴파일러 (binary: precedent-kr-compiler)

멤버별 README는 역할이 다릅니다. */README.md는 컴파일러 사용·개발 문서이고, */assets/README.md는 컴파일 결과 저장소의 루트 README.md로 포함되는 원본입니다.

도메인 컴파일러 README 결과 저장소 README 원본
법령 laws/README.md laws/assets/README.md
판례 precedents/README.md precedents/assets/README.md
행정규칙 admrules/README.md admrules/assets/README.md
자치법규 ordinances/README.md ordinances/assets/README.md

빠른 시작

# 워크스페이스 전체 빌드 (네 컴파일러 바이너리 동시 산출)
cargo build --workspace --release

# 법령 컴파일
./target/release/legalize-kr-compiler ../.cache -o ./output.git

# 판례 컴파일
./target/release/precedent-kr-compiler ../.cache/precedent -o ./precedent-output.git

# 행정규칙 컴파일
./target/release/admrule-kr-compiler ../.cache/admrule -o ./admrule-output.git

# 자치법규 컴파일
./target/release/ordinance-kr-compiler ../.cache/ordinance -o ./ordinance-output.git

# 공통 점검/메타데이터 옵션
./target/release/legalize-kr-compiler ../.cache --validate
./target/release/precedent-kr-compiler ../.cache/precedent --manifest ./manifest.json

네 컴파일러 모두 기본 출력은 bare Git 저장소이며, -o/--output을 생략하면 output.git에 씁니다. --validate는 저장소를 쓰지 않고 JSON 점검 결과만 표준 출력으로 내보내며, --manifest는 빌드 결과의 HEAD와 엔트리 수를 JSON으로 기록합니다. 행정규칙/자치법규 컴파일러의 기존 Markdown tree 출력은 --tree로 사용할 수 있습니다.

CI 4종 게이트

push 전 다음 4종을 모두 로컬에서 통과시키세요:

cargo fmt --all -- --check
cargo clippy --workspace --no-deps -- -D warnings
cargo shear
cargo test --workspace

pre-commit 훅 활성화

.githooks/pre-commitcargo fmt --check 게이트가 있습니다. clone 또는 worktree 직후 한 번 실행해 활성화하세요:

git config core.hooksPath .githooks

legalize-kr / compiler is primarily distributed under the terms of both the Apache License (Version 2.0) and the MIT license. See COPYRIGHT for details.