{"id":50670377,"url":"https://github.com/9bow/compiler-for-precedent","last_synced_at":"2026-06-08T10:33:45.906Z","repository":{"id":353891083,"uuid":"1210390019","full_name":"9bow/compiler-for-precedent","owner":"9bow","description":"판례 캐시 XML을 Git bare repository로 변환하는 Rust 컴파일러","archived":false,"fork":false,"pushed_at":"2026-04-26T03:38:01.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-26T05:28:42.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/9bow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-14T11:19:22.000Z","updated_at":"2026-04-26T03:38:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/9bow/compiler-for-precedent","commit_stats":null,"previous_names":["9bow/compiler-for-precedent"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/9bow/compiler-for-precedent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9bow%2Fcompiler-for-precedent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9bow%2Fcompiler-for-precedent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9bow%2Fcompiler-for-precedent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9bow%2Fcompiler-for-precedent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/9bow","download_url":"https://codeload.github.com/9bow/compiler-for-precedent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9bow%2Fcompiler-for-precedent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34059156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-08T10:33:44.293Z","updated_at":"2026-06-08T10:33:45.895Z","avatar_url":"https://github.com/9bow.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# precedent-kr-compiler\n\n[legalize-kr/legalize-pipeline]으로 만들어진 `.cache/precedent` 디렉토리를 git으로 바꿔주는\n컴파일러입니다. 이 프로그램은 법제처 API를 직접 호출하지 않고, 이미 존재하는\n캐시만 입력으로 받습니다.\n\n[legalize-kr/legalize-pipeline]: https://github.com/legalize-kr/legalize-pipeline\n\n## 사용법\n\n```bash\nprecedent-kr-compiler \u003cinput_cache_dir\u003e [-o \u003coutput_git_dir\u003e]\n```\n\n기본 출력 경로는 `./output.git`입니다. 결과물은 bare repo이므로 내용을 보려면\nclone해서 확인하면 됩니다.\n\n```bash\nprecedent-kr-compiler ../.cache/precedent\ngit clone ./output.git ./precedent-kr\ncd precedent-kr\n```\n\n출력 bare repo 경로를 직접 지정할 수도 있습니다.\n\n```bash\nprecedent-kr-compiler ../.cache/precedent -o ./another.git\n```\n\n## 동작 방식\n\n2-pass로 동작합니다.\n\n1. `{cache_dir}/*.xml`의 메타데이터만 읽어 정렬용 entry를 만듭니다.\n   - `\u003cPrecService\u003e` 루트가 아니거나 `판례정보일련번호`가 없는 파일은 warning과 함께 건너뜁니다.\n2. entry를 다음 순서로 정렬합니다.\n   - `선고일자 asc` (빈 날짜는 마지막)\n   - `사건번호 asc`\n   - `판례일련번호 asc (numeric)`\n3. 경로 충돌 규칙을 적용해 출력 파일 경로를 확정합니다.\n   - 기본 경로: `{사건종류}/{법원등급}/{사건번호}.md`\n   - 충돌 시: `{사건종류}/{법원등급}/{사건번호}_{판례일련번호}.md`\n4. 정렬된 순서대로 XML 본문을 다시 파싱해 Markdown과 commit message를 만들고 commit을 작성합니다.\n   - 이 단계는 chunk 단위로 병렬 render를 수행하면서, main thread는 순서대로 commit만 씁니다.\n\n## 출력 특성\n\n- 매 실행마다 fresh bare repo를 새로 만듭니다.\n- branch는 `main`입니다.\n- object database는 direct pack writer로 만들고, 마지막에 `.idx` v2 index로 마무리합니다.\n- refs backend는 `HEAD`와 `refs/heads/main` loose ref 파일을 직접 씁니다.\n- commit author/committer는 `legalize-kr-bot \u003cbot@legalize.kr\u003e`입니다.\n- commit timestamp는 선고일자 기준 KST `12:00:00`입니다.\n- `1970-01-01` 이전 날짜 및 빈 선고일자는 epoch 이전 commit을 피하기 위해 clamp합니다.\n- 업스트림이 오래된 판례의 `선고일자`를 단기(檀紀) 4자리 연도로 반환하는 경우가 있습니다(예: `42890525`). 파싱 시점에 단기 범위(4200–4330)를 서기로 변환(`CE = 단기 − 2333`)하여 정렬·타임스탬프·frontmatter가 모두 서기 기준으로 일치하도록 처리합니다. 대상 판례 목록은 생성된 저장소 `README.md`를 참고하세요.\n- **긴 파일명 capping (`NAME_MAX=255` 대응)**: 형사 병합/분리 판결은 `사건번호` 한 필드에 수십~수백 개의 사건번호를 쉼표로 나열하는 경우가 있습니다(예: `2011고합669, 743, 746, ..., 985-1 (병합) (분리)`). 그대로 파일명으로 쓰면 macOS APFS의 `NAME_MAX=255 bytes` 제한을 초과해 `git clone` 후 `checkout`이 실패합니다. `render.rs:cap_filename_bytes`가 파일명 stem(확장자 제외)을 UTF-8 기준 180바이트로 cap하고, 잘린 경우 `_{판례일련번호}`를 접미사로 붙여 고유성과 역추적성을 보존합니다. 업스트림 API가 사건번호 끝을 `....`로 잘라 보내는 경우가 있는데, 현재는 그대로 포함되므로 잘림 흔적이 파일명에 남을 수 있습니다.\n\n## 출력 저장소 구조\n\n```\n{사건종류}/\n  {법원등급}/\n    {사건번호}.md\n```\n\n예시:\n- `민사/대법원/2024다12345.md`\n- `형사/하급심/2023고합678.md`\n- `일반행정/대법원/2022두9012.md`\n\n`사건종류`: 민사, 형사, 일반행정, 세무, 특허, 가사, 기타  \n`법원등급`: 대법원 (법원종류코드 `400201`), 하급심 (`400202`), 미분류 (기타)\n\n## 개발\n\n```bash\n# test\ncargo test\n\n# format\ncargo fmt\n\n# lint\ncargo clippy\n\n# release build\ncargo build --release\n```\n\n### 크로스 컴파일 방법\n\nmacOS에서:\n\n```bash\nbrew install filosottile/musl-cross/musl-cross\n\nrustup target add x86_64-unknown-linux-musl aarch64-unknown-linux-musl\n\ncargo build -r --target x86_64-unknown-linux-musl\ncargo build -r --target aarch64-unknown-linux-musl\n```\n\n\u0026nbsp;\n\n---\n\n*precedent-kr-compiler* is primarily distributed under the terms of both the\n[Apache License (Version 2.0)] and the [MIT license].\n\n[MIT license]: LICENSE-MIT\n[Apache License (Version 2.0)]: LICENSE-APACHE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9bow%2Fcompiler-for-precedent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F9bow%2Fcompiler-for-precedent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9bow%2Fcompiler-for-precedent/lists"}