Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

### Added

- `GLOBAL_RULES.md`에 `## 검증` 섹션 추가. 저장소에 정의된 build/test/lint를 실행하고, 명령은
manifest·Makefile·CI 워크플로에서 확인하며, 정의되지 않은 명령을 지어내거나 실행하지 못한 것을
통과로 가정하지 않도록 지시합니다. 테스트를 삭제·skip·단정 약화로 통과시키는 것을 금지합니다.
- `GLOBAL_RULES.md`에 `## 안전` 섹션 추가. secret·자격 증명 취급, `.env` 및 CI secret 설정 접근
금지, 요청에 없는 파괴적 작업(대량 삭제, git history 재작성, force push, 데이터 삭제 migration)
금지, lock 파일 수정 범위를 규정합니다. 기존에는 secret 관련 문구가 `--auth yes`일 때만
생성됐지만 이제 항상 포함됩니다.
- `TEST_RULES.md` 생성. 렌더러와 프로필별 테스트 규칙 데이터는 이미 있었지만 출력 목록에
연결되어 있지 않아 실제로는 생성되지 않았습니다. AGENTS.md 라우팅 표에도 추가했습니다.
- 루트 `AGENTS.md` 진입점 생성. 코딩 에이전트가 자동으로 읽는 상위 지시문 경로를 확보하기 위한
변경입니다. `.codex/` 아래 문서는 자동 로드 대상이 아니므로 기존에는 `codex_start_prompt.txt`를
사용자가 직접 붙여넣지 않으면 생성된 규칙이 적용되지 않았습니다. 상세 규칙을 복사하지 않고
Expand All @@ -21,8 +30,16 @@
스모크 실행, 별도 job에서 `python -m build` 및 `twine check`를 수행합니다.
- 이 CHANGELOG.

### Changed

- 프레임워크별 규칙을 `GLOBAL_RULES.md` 한 곳에서만 정의합니다. 기존에는 동일한 문장이
`GLOBAL_RULES.md`, `CODE_STYLE_RULES.md`, `SERVICE_LAYER_RULES.md`에 그대로 세 번
들어갔습니다. 두 문서에는 참조 문구를 남깁니다.

### Removed

- 호출되지 않던 렌더러 메서드 5종 제거(`_render_framework_rules`, `_render_project_overview`,
`_render_feature_spec`, `_render_api_spec`, `_render_db_spec`). 총 208줄.
- 저장소에 커밋되어 있던 `release_0_3_0/` 빌드 산출물(`.whl`, `.tar.gz`). 배포 아티팩트는
버전 관리 대상이 아니며 GitHub Releases 또는 PyPI에서 받을 수 있습니다.

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ AGENTS.md
│ ├── DOCUMENT_RULE.md
│ ├── DOMAIN_MODEL_RULES.md
│ ├── EXTERNAL_INTEGRATION_RULES.md
│ └── SERVICE_LAYER_RULES.md
│ ├── SERVICE_LAYER_RULES.md
│ └── TEST_RULES.md
├── ref_docs/
└── codex_start_prompt.txt

Expand All @@ -198,6 +199,10 @@ docs/

기존 `AGENTS.md`가 있으면 덮어쓰지 않으므로 직접 수정한 내용은 재생성 후에도 유지됩니다. 생성을 원하지 않으면 `--no-agents-md`를 사용하세요.

`GLOBAL_RULES.md`에는 변경을 완료로 보고하기 전 실행할 검증 절차와, secret 취급·파괴적 작업 금지를 다루는 안전 규칙이 포함됩니다. 이 도구는 대상 저장소를 스캔하지 않으므로 구체적인 명령을 적어 넣는 대신 저장소에서 확인하도록 지시하고 없는 명령을 지어내지 못하게 합니다.

프레임워크별 규칙은 `GLOBAL_RULES.md`에만 두고 다른 문서에서는 참조합니다. 같은 문장을 여러 문서에 반복해도 준수율이 오르지는 않고 컨텍스트 예산만 소모하기 때문입니다.

`ai_rule_developer`는 코딩할 때 지켜야 하는 규칙입니다. `ref_docs`는 외부 아키텍처 문서, PRD, 리서치, 벤더 문서처럼 사용자가 임의로 추가하는 참고자료 공간이므로 디렉토리만 생성합니다. 프로젝트 자체 명세는 루트 `docs/` 아래에 생성되며, 기존 `docs/` 파일이 있으면 덮어쓰지 않습니다. `codex_start_prompt.txt`는 Codex가 작업 시작 전에 `.codex` 문서를 먼저 읽고 규칙 우선순위를 적용하도록 지시합니다.

## 지원 프레임워크 프로필
Expand Down
303 changes: 83 additions & 220 deletions codex_builder/template_renderer.py

Large diffs are not rendered by default.

50 changes: 38 additions & 12 deletions tests/snapshots/default_ko.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,8 @@ docs/database
- 서로 다른 계층을 섞은 파일
- 저장소 formatter와 충돌하는 포맷팅

[FastAPI 스타일 메모]
- APIRouter는 라우팅과 의존성 연결만 담당한다.
- Service가 FastAPI Response, Depends, Request에 직접 의존하지 않게 한다.
- Repository는 SQLAlchemy, SQLModel 등 실제 저장소 API를 감싸는 경계로 둔다.
- 예외는 도메인/서비스 예외로 먼저 표현하고 controller에서 HTTP 상태로 변환한다.
- 배경 작업, 외부 호출, 긴 작업은 service 하위의 명시적 adapter/client로 분리한다.
[프레임워크 규칙]
- 프레임워크별 규칙은 `GLOBAL_RULES.md`에 있다. 이 문서와 함께 적용한다.

========================================================================
# file: .codex/ai_rule_developer/DOCUMENT_RULE.md
Expand Down Expand Up @@ -317,6 +313,24 @@ docs/database
- 외부 연동은 확인된 계약을 기준으로 구현하고 실패 동작을 명시한다.
- 동작이 비명시적인 핵심 코드에 의도 설명 없이 코드를 추가하지 않는다.

## 검증
- 작업을 완료로 보고하기 전에 이 저장소에 정의된 build, test, lint 명령을 실행한다.
- 명령은 저장소에서 확인한다. package manifest, `Makefile`, task runner 설정, 기여 문서, CI 워크플로를
확인하고, 정의되어 있지 않은 명령을 임의로 만들어내지 않는다.
- 현재 환경에서 실행할 수 없는 명령이 있으면 통과했다고 가정하지 말고 실행하지 못했다고 명시한다.
- 테스트가 실패하면 원인을 보고한다. 테스트를 삭제하거나 skip 처리하거나 단정을 약화시켜 통과시키지 않는다.
- 동작이 바뀌면 같은 변경에서 테스트를 추가하거나 수정한다.

## 안전
- secret, 토큰, 자격 증명, 개인정보를 코드, 로그, 응답, 문서, 커밋 메시지에 남기지 않는다.
예시가 필요하면 실제 값 대신 누가 봐도 placeholder임이 분명한 값을 사용한다.
- `.env`, 자격 증명 파일, CI secret 설정은 읽거나 수정하지 않는다. 새 키가 필요하면 키 이름만 알리고
값 설정은 사람에게 맡긴다.
- 요청에 없는 파괴적 작업을 수행하지 않는다. 파일이나 디렉토리 일괄 삭제, git history 재작성,
force push, branch 삭제, 데이터가 사라지는 migration이 여기에 해당한다.
- 되돌릴 수 없는 작업이 정말 필요하면 내용을 설명하고 실행 전에 확인을 받는다.
- 의존성 lock 파일은 의존성 변경이 작업 목적일 때만 수정한다.

========================================================================
# file: .codex/ai_rule_developer/SERVICE_LAYER_RULES.md
========================================================================
Expand Down Expand Up @@ -348,12 +362,23 @@ Service/Application 계층은 비즈니스 로직의 중심이다.
- 외부 API 호출을 무관한 비즈니스 로직에 직접 섞기
- 복잡한 분기 로직을 하나의 메서드에 몰아넣기

[FastAPI Service Notes]
- APIRouter는 라우팅과 의존성 연결만 담당한다.
- Service가 FastAPI Response, Depends, Request에 직접 의존하지 않게 한다.
- Repository는 SQLAlchemy, SQLModel 등 실제 저장소 API를 감싸는 경계로 둔다.
- 예외는 도메인/서비스 예외로 먼저 표현하고 controller에서 HTTP 상태로 변환한다.
- 배경 작업, 외부 호출, 긴 작업은 service 하위의 명시적 adapter/client로 분리한다.
[프레임워크 규칙]
- 프레임워크별 규칙은 `GLOBAL_RULES.md`에 있다. 이 문서와 함께 적용한다.

========================================================================
# file: .codex/ai_rule_developer/TEST_RULES.md
========================================================================
# 테스트 규칙 - snapshot-default

## 기본 규칙
- 동작이 바뀌면 테스트를 추가하거나 수정한다.
- 성공 케이스, validation 실패, authorization 실패, 중요한 오류 경로를 검증한다.
- 구현 세부사항보다 공개 계약과 사용자 관찰 가능 동작을 기준으로 테스트한다.

## FastAPI
- Service 테스트는 repository/client를 대체 객체로 격리한다.
- API 테스트는 TestClient 또는 httpx 기반으로 요청/응답 계약을 검증한다.
- Repository 테스트는 DB 스키마와 쿼리 동작을 별도로 검증한다.

========================================================================
# file: .codex/codex_start_prompt.txt
Expand Down Expand Up @@ -431,6 +456,7 @@ Service/Application 계층은 비즈니스 로직의 중심이다.
| Entity, schema, 도메인 상태 | `.codex/ai_rule_developer/DOMAIN_MODEL_RULES.md`, `docs/database/schema.md` |
| 유스케이스와 비즈니스 로직 | `.codex/ai_rule_developer/SERVICE_LAYER_RULES.md` |
| 외부 연동 | `.codex/ai_rule_developer/EXTERNAL_INTEGRATION_RULES.md` |
| 테스트 | `.codex/ai_rule_developer/TEST_RULES.md` |
| 문서 갱신 | `.codex/ai_rule_developer/DOCUMENT_RULE.md` |

## 우선순위
Expand Down
53 changes: 41 additions & 12 deletions tests/snapshots/fastapi_full_en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,8 @@ Follow the existing formatter and linter first. When the formatter does not deci
- Files that mix unrelated layers.
- Formatting that fights the repository's configured formatter.

[FastAPI Style Notes]
- APIRouter should only handle routing and dependency wiring.
- Services should not directly depend on FastAPI Response, Depends, or Request.
- Repositories wrap storage APIs such as SQLAlchemy or SQLModel.
- Represent errors as domain/service exceptions first, then map them to HTTP statuses in controllers.
- Move background jobs, external calls, and long-running work into explicit adapters/clients below services.
[Framework Rules]
- Framework-specific rules live in `GLOBAL_RULES.md`. Apply them together with this document.

========================================================================
# file: .codex/ai_rule_developer/DOCUMENT_RULE.md
Expand Down Expand Up @@ -355,6 +351,24 @@ Before changing files, read the `.codex` documents and treat them as repository-
- Implement external integrations against their confirmed contracts and keep failure behavior explicit.
- Do not add core code without documenting the intent when the behavior is non-obvious.

## Verification
- Run this repository's build, test, and lint commands before calling a change finished.
- Discover those commands from the repository itself: package manifests, `Makefile`, task runner
configuration, contributor docs, or the CI workflow. Do not invent a command that is not defined.
- If a command cannot be run in the current environment, say so explicitly instead of assuming it passed.
- If a test fails, report the cause. Never delete a test, skip it, or weaken an assertion to get a green run.
- When behavior changes, update or add tests in the same change.

## Safety
- Never write secrets, tokens, credentials, or personal data into code, logs, responses, docs, or commit
messages. Use obvious placeholders in examples.
- Do not read or edit `.env` files, credential files, or CI secret configuration. If a new key is needed,
report the key name and let a human set the value.
- Do not perform destructive actions the request did not ask for: bulk file or directory deletion,
rewriting git history, force pushing, deleting branches, or data-destroying migrations.
- If an irreversible step is genuinely required, describe it and ask before running it.
- Change dependency lock files only when the task is about dependencies.

========================================================================
# file: .codex/ai_rule_developer/SERVICE_LAYER_RULES.md
========================================================================
Expand Down Expand Up @@ -386,12 +400,26 @@ The service/application layer is the center of business logic.
- Mixing external API calls directly into unrelated business logic.
- Cramming complex branching into one method.

[FastAPI Service Notes]
- APIRouter should only handle routing and dependency wiring.
- Services should not directly depend on FastAPI Response, Depends, or Request.
- Repositories wrap storage APIs such as SQLAlchemy or SQLModel.
- Represent errors as domain/service exceptions first, then map them to HTTP statuses in controllers.
- Move background jobs, external calls, and long-running work into explicit adapters/clients below services.
[Framework Rules]
- Framework-specific rules live in `GLOBAL_RULES.md`. Apply them together with this document.

========================================================================
# file: .codex/ai_rule_developer/TEST_RULES.md
========================================================================
# Test Rules - snapshot-full-en

## Base Rules
- Add or update tests when behavior changes.
- Cover success cases, validation failures, authorization failures, and important error paths.
- Keep tests aligned with public contracts rather than implementation trivia.

## FastAPI
- Isolate service tests with repository/client doubles.
- Use TestClient or httpx-based API tests to verify request/response contracts.
- Verify repository tests against database schema and query behavior separately.

## Database Tests
- Verify repository behavior and migration/schema assumptions for `postgres`.

========================================================================
# file: .codex/codex_start_prompt.txt
Expand Down Expand Up @@ -468,6 +496,7 @@ Load only what the current task needs:
| Entity, schema, domain state | `.codex/ai_rule_developer/DOMAIN_MODEL_RULES.md`, `docs/database/schema.md` |
| Use-case and business logic | `.codex/ai_rule_developer/SERVICE_LAYER_RULES.md` |
| Third-party or upstream integration | `.codex/ai_rule_developer/EXTERNAL_INTEGRATION_RULES.md` |
| Tests | `.codex/ai_rule_developer/TEST_RULES.md` |
| Documentation updates | `.codex/ai_rule_developer/DOCUMENT_RULE.md` |

## Precedence
Expand Down
68 changes: 45 additions & 23 deletions tests/snapshots/fastapi_react_full_ko.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,8 @@ docs/database
- 서로 다른 계층을 섞은 파일
- 저장소 formatter와 충돌하는 포맷팅

[FastAPI 스타일 메모]
- APIRouter는 라우팅과 의존성 연결만 담당한다.
- Service가 FastAPI Response, Depends, Request에 직접 의존하지 않게 한다.
- Repository는 SQLAlchemy, SQLModel 등 실제 저장소 API를 감싸는 경계로 둔다.
- 예외는 도메인/서비스 예외로 먼저 표현하고 controller에서 HTTP 상태로 변환한다.
- 배경 작업, 외부 호출, 긴 작업은 service 하위의 명시적 adapter/client로 분리한다.

[React 스타일 메모]
- 컴포넌트 안에서 fetch/axios 호출을 직접 수행하지 않는다.
- 복잡한 상태 전이는 hook 또는 store action으로 분리한다.
- 공통 UI 컴포넌트와 기능 전용 컴포넌트를 분리한다.
- API 타입과 UI view model의 변환 위치를 명확히 둔다.
[프레임워크 규칙]
- 프레임워크별 규칙은 `GLOBAL_RULES.md`에 있다. 이 문서와 함께 적용한다.

========================================================================
# file: .codex/ai_rule_developer/DOCUMENT_RULE.md
Expand Down Expand Up @@ -396,6 +386,24 @@ docs/database
- 외부 연동은 확인된 계약을 기준으로 구현하고 실패 동작을 명시한다.
- 동작이 비명시적인 핵심 코드에 의도 설명 없이 코드를 추가하지 않는다.

## 검증
- 작업을 완료로 보고하기 전에 이 저장소에 정의된 build, test, lint 명령을 실행한다.
- 명령은 저장소에서 확인한다. package manifest, `Makefile`, task runner 설정, 기여 문서, CI 워크플로를
확인하고, 정의되어 있지 않은 명령을 임의로 만들어내지 않는다.
- 현재 환경에서 실행할 수 없는 명령이 있으면 통과했다고 가정하지 말고 실행하지 못했다고 명시한다.
- 테스트가 실패하면 원인을 보고한다. 테스트를 삭제하거나 skip 처리하거나 단정을 약화시켜 통과시키지 않는다.
- 동작이 바뀌면 같은 변경에서 테스트를 추가하거나 수정한다.

## 안전
- secret, 토큰, 자격 증명, 개인정보를 코드, 로그, 응답, 문서, 커밋 메시지에 남기지 않는다.
예시가 필요하면 실제 값 대신 누가 봐도 placeholder임이 분명한 값을 사용한다.
- `.env`, 자격 증명 파일, CI secret 설정은 읽거나 수정하지 않는다. 새 키가 필요하면 키 이름만 알리고
값 설정은 사람에게 맡긴다.
- 요청에 없는 파괴적 작업을 수행하지 않는다. 파일이나 디렉토리 일괄 삭제, git history 재작성,
force push, branch 삭제, 데이터가 사라지는 migration이 여기에 해당한다.
- 되돌릴 수 없는 작업이 정말 필요하면 내용을 설명하고 실행 전에 확인을 받는다.
- 의존성 lock 파일은 의존성 변경이 작업 목적일 때만 수정한다.

========================================================================
# file: .codex/ai_rule_developer/SERVICE_LAYER_RULES.md
========================================================================
Expand Down Expand Up @@ -427,18 +435,31 @@ Service/Application 계층은 비즈니스 로직의 중심이다.
- 외부 API 호출을 무관한 비즈니스 로직에 직접 섞기
- 복잡한 분기 로직을 하나의 메서드에 몰아넣기

[FastAPI Service Notes]
- APIRouter는 라우팅과 의존성 연결만 담당한다.
- Service가 FastAPI Response, Depends, Request에 직접 의존하지 않게 한다.
- Repository는 SQLAlchemy, SQLModel 등 실제 저장소 API를 감싸는 경계로 둔다.
- 예외는 도메인/서비스 예외로 먼저 표현하고 controller에서 HTTP 상태로 변환한다.
- 배경 작업, 외부 호출, 긴 작업은 service 하위의 명시적 adapter/client로 분리한다.
[프레임워크 규칙]
- 프레임워크별 규칙은 `GLOBAL_RULES.md`에 있다. 이 문서와 함께 적용한다.

[React Service Notes]
- 컴포넌트 안에서 fetch/axios 호출을 직접 수행하지 않는다.
- 복잡한 상태 전이는 hook 또는 store action으로 분리한다.
- 공통 UI 컴포넌트와 기능 전용 컴포넌트를 분리한다.
- API 타입과 UI view model의 변환 위치를 명확히 둔다.
========================================================================
# file: .codex/ai_rule_developer/TEST_RULES.md
========================================================================
# 테스트 규칙 - snapshot-full

## 기본 규칙
- 동작이 바뀌면 테스트를 추가하거나 수정한다.
- 성공 케이스, validation 실패, authorization 실패, 중요한 오류 경로를 검증한다.
- 구현 세부사항보다 공개 계약과 사용자 관찰 가능 동작을 기준으로 테스트한다.

## FastAPI
- Service 테스트는 repository/client를 대체 객체로 격리한다.
- API 테스트는 TestClient 또는 httpx 기반으로 요청/응답 계약을 검증한다.
- Repository 테스트는 DB 스키마와 쿼리 동작을 별도로 검증한다.

## React
- 컴포넌트 테스트는 사용자 상호작용과 표시 결과를 검증한다.
- hook 테스트는 상태 전이와 비동기 흐름을 검증한다.
- service 테스트는 API client 경계와 오류 변환을 검증한다.

## DB 테스트
- `mysql` repository 동작과 migration/schema 가정을 검증한다.

========================================================================
# file: .codex/codex_start_prompt.txt
Expand Down Expand Up @@ -518,6 +539,7 @@ Service/Application 계층은 비즈니스 로직의 중심이다.
| Entity, schema, 도메인 상태 | `.codex/ai_rule_developer/DOMAIN_MODEL_RULES.md`, `docs/database/schema.md` |
| 유스케이스와 비즈니스 로직 | `.codex/ai_rule_developer/SERVICE_LAYER_RULES.md` |
| 외부 연동 | `.codex/ai_rule_developer/EXTERNAL_INTEGRATION_RULES.md` |
| 테스트 | `.codex/ai_rule_developer/TEST_RULES.md` |
| 문서 갱신 | `.codex/ai_rule_developer/DOCUMENT_RULE.md` |

## 우선순위
Expand Down
Loading
Loading