codex-rule-maker 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/PKG-INFO +31 -61
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/README.md +30 -60
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/builder.py +5 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/constants.py +15 -9
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/profiles.py +71 -8
- codex_rule_maker-0.2.0/codex_builder/template_renderer.py +1890 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_rule_maker.egg-info/PKG-INFO +31 -61
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/pyproject.toml +1 -1
- codex_rule_maker-0.2.0/tests/test_builder.py +130 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/tests/test_cli.py +35 -8
- codex_rule_maker-0.1.0/codex_builder/template_renderer.py +0 -702
- codex_rule_maker-0.1.0/tests/test_builder.py +0 -93
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/__init__.py +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/cli.py +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/models.py +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/prompt.py +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_builder/validator.py +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_rule_maker.egg-info/SOURCES.txt +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_rule_maker.egg-info/dependency_links.txt +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_rule_maker.egg-info/entry_points.txt +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_rule_maker.egg-info/requires.txt +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/codex_rule_maker.egg-info/top_level.txt +0 -0
- {codex_rule_maker-0.1.0 → codex_rule_maker-0.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codex-rule-maker
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: CLI tool that generates a .codex folder with AI developer rules and project reference documents.
|
|
5
5
|
Author: codex-rule-maker
|
|
6
6
|
Project-URL: Homepage, https://github.com/Sharon77770/codex_rule_maker
|
|
@@ -28,9 +28,7 @@ Requires-Dist: twine<7,>=5; extra == "dev"
|
|
|
28
28
|
|
|
29
29
|
# codex-rule-maker
|
|
30
30
|
|
|
31
|
-
`codex-rule-maker`는 프로젝트 루트에 `.codex`
|
|
32
|
-
|
|
33
|
-
이 도구는 `output_ex/.codex` 예시의 철학을 참고했습니다. 예시를 그대로 복사하지 않고, 규칙 문서와 참고 문서를 분리한 범용 템플릿으로 일반화했습니다.
|
|
31
|
+
`codex-rule-maker`는 프로젝트 루트에 `.codex` 규칙 폴더와 `docs/` 프로젝트 문서 템플릿을 자동 구성하는 Python CLI 도구입니다. 사용자가 프로젝트 이름, 설명, 스택, DB, 인증 여부, 외부 API 여부, 문서화 수준, 문서 언어를 입력하면 Codex가 작업 전에 읽을 개발 규칙과 프로젝트 문서 구조를 생성합니다.
|
|
34
32
|
|
|
35
33
|
## 설치
|
|
36
34
|
|
|
@@ -49,36 +47,7 @@ pip install -e .
|
|
|
49
47
|
codex-init --help
|
|
50
48
|
```
|
|
51
49
|
|
|
52
|
-
PyPI
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
pip install codex-rule-maker
|
|
56
|
-
codex-init --help
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## PyPI 배포
|
|
60
|
-
|
|
61
|
-
배포 전 패키지를 빌드하고 검사합니다.
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
pip install -e ".[dev]"
|
|
65
|
-
python -m build
|
|
66
|
-
python -m twine check dist/*
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
PyPI API token을 발급한 뒤 업로드합니다.
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
python -m twine upload dist/*
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
테스트 PyPI에 먼저 올리고 싶다면 다음 명령을 사용합니다.
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
python -m twine upload --repository testpypi dist/*
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
업로드가 끝나면 새 환경에서 설치를 확인합니다.
|
|
50
|
+
PyPI 설치:
|
|
82
51
|
|
|
83
52
|
```bash
|
|
84
53
|
pip install codex-rule-maker
|
|
@@ -168,10 +137,11 @@ codex-init --force --overwrite
|
|
|
168
137
|
## 예시 실행 흐름
|
|
169
138
|
|
|
170
139
|
```text
|
|
171
|
-
프로젝트 이름 [sample]:
|
|
172
|
-
프로젝트 설명:
|
|
140
|
+
프로젝트 이름 [sample]: 마리오
|
|
141
|
+
프로젝트 설명: 2D 플렛포머 게임
|
|
173
142
|
지원 프로필:
|
|
174
143
|
- fastapi
|
|
144
|
+
- python
|
|
175
145
|
- springboot
|
|
176
146
|
- react
|
|
177
147
|
- nextjs
|
|
@@ -188,8 +158,8 @@ DB 종류 [mysql]: mysql
|
|
|
188
158
|
|
|
189
159
|
생성 설정 확인
|
|
190
160
|
|
|
191
|
-
프로젝트 이름:
|
|
192
|
-
설명:
|
|
161
|
+
프로젝트 이름: 마리오
|
|
162
|
+
설명: 2D 플랫포머 게임
|
|
193
163
|
스택: fastapi,react
|
|
194
164
|
DB: mysql
|
|
195
165
|
인증: yes
|
|
@@ -216,33 +186,44 @@ DB: mysql
|
|
|
216
186
|
| `--interactive` | 대화형 입력 사용 및 최종 확인 표시 | 비활성 |
|
|
217
187
|
| `--force` | 기존 `.codex`가 있으면 백업 후 재생성 | 비활성 |
|
|
218
188
|
| `--overwrite` | `--force`와 함께 기존 `.codex` 삭제 후 재생성 | 비활성 |
|
|
219
|
-
| `--target-dir` | `.codex
|
|
189
|
+
| `--target-dir` | `.codex`와 `docs/`를 생성할 대상 디렉토리 | 현재 디렉토리 |
|
|
220
190
|
|
|
221
191
|
## 생성 구조
|
|
222
192
|
|
|
223
193
|
```text
|
|
224
194
|
.codex/
|
|
225
|
-
├──
|
|
195
|
+
├── ai_rule_developer/
|
|
226
196
|
│ ├── GLOBAL_RULES.md
|
|
227
197
|
│ ├── ARCHITECTURE_RULES.md
|
|
228
198
|
│ ├── CODE_STYLE_RULES.md
|
|
229
199
|
│ ├── API_DESIGN_RULES.md
|
|
230
200
|
│ ├── DOCUMENT_RULE.md
|
|
231
|
-
│ ├──
|
|
232
|
-
│
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
│ ├── FEATURE_SPEC.md
|
|
236
|
-
│ ├── API_SPEC.md
|
|
237
|
-
│ └── DB_SPEC.md
|
|
201
|
+
│ ├── DOMAIN_MODEL_RULES.md
|
|
202
|
+
│ ├── EXTERNAL_INTEGRATION_RULES.md
|
|
203
|
+
│ └── SERVICE_LAYER_RULES.md
|
|
204
|
+
├── ref_docs/
|
|
238
205
|
└── codex_start_prompt.txt
|
|
206
|
+
|
|
207
|
+
docs/
|
|
208
|
+
├── architecture/
|
|
209
|
+
│ ├── directory.md
|
|
210
|
+
│ ├── architecture.md
|
|
211
|
+
│ ├── component.md
|
|
212
|
+
│ ├── state.md
|
|
213
|
+
│ └── flow.md
|
|
214
|
+
├── api/
|
|
215
|
+
│ ├── endpoints.md
|
|
216
|
+
│ └── specification.md
|
|
217
|
+
└── database/
|
|
218
|
+
└── schema.md
|
|
239
219
|
```
|
|
240
220
|
|
|
241
|
-
`
|
|
221
|
+
`ai_rule_developer`는 코딩할 때 지켜야 하는 규칙입니다. `ref_docs`는 외부 아키텍처 문서, PRD, 리서치, 벤더 문서처럼 사용자가 임의로 추가하는 참고자료 공간이므로 디렉토리만 생성합니다. 프로젝트 자체 명세는 루트 `docs/` 아래에 생성되며, 기존 `docs/` 파일이 있으면 덮어쓰지 않습니다. `codex_start_prompt.txt`는 Codex가 작업 시작 전에 `.codex` 문서를 먼저 읽고 규칙 우선순위를 적용하도록 지시합니다.
|
|
242
222
|
|
|
243
223
|
## 지원 프레임워크 프로필
|
|
244
224
|
|
|
245
225
|
- `fastapi`: controller/service/repository/schema/entity 계층 분리
|
|
226
|
+
- `python`: 일반 Python package/module/service/adapter/CLI 경계 분리
|
|
246
227
|
- `springboot`: controller/service/repository/entity/dto 계층 분리
|
|
247
228
|
- `react`: component/page/hook/service/store 분리
|
|
248
229
|
- `nextjs`: App Router, Server Component와 Client Component 구분
|
|
@@ -253,6 +234,7 @@ DB: mysql
|
|
|
253
234
|
|
|
254
235
|
```bash
|
|
255
236
|
codex-init --stack fastapi,react
|
|
237
|
+
codex-init --stack python
|
|
256
238
|
codex-init --stack fullstack-fastapi-react
|
|
257
239
|
codex-init --stack nextjs
|
|
258
240
|
```
|
|
@@ -265,6 +247,7 @@ codex-init --stack nextjs
|
|
|
265
247
|
- `--auth yes`는 인증/권한 규칙을 포함합니다.
|
|
266
248
|
- `--external-api yes`는 외부 연동 계층 분리 규칙을 포함합니다.
|
|
267
249
|
- `--db mysql`처럼 DB를 지정하면 DB, Repository, Schema 관련 규칙을 포함합니다.
|
|
250
|
+
- 프로젝트 명세 템플릿은 `.codex/ref_docs`가 아니라 `docs/architecture`, `docs/api`, `docs/database`에 생성됩니다.
|
|
268
251
|
|
|
269
252
|
## 테스트
|
|
270
253
|
|
|
@@ -272,16 +255,3 @@ codex-init --stack nextjs
|
|
|
272
255
|
pip install -e ".[dev]"
|
|
273
256
|
pytest
|
|
274
257
|
```
|
|
275
|
-
|
|
276
|
-
검증 범위:
|
|
277
|
-
|
|
278
|
-
- 기본 생성 성공
|
|
279
|
-
- 옵션만으로 생성 가능
|
|
280
|
-
- 누락 값 prompt 보완
|
|
281
|
-
- 잘못된 stack/docs/language 검증
|
|
282
|
-
- FastAPI 프로필 생성
|
|
283
|
-
- React 프로필 생성
|
|
284
|
-
- Fullstack FastAPI React 프로필 생성
|
|
285
|
-
- 기존 `.codex`가 있을 때 prompt 중단
|
|
286
|
-
- `--force`가 있으면 기존 `.codex` 백업 후 재생성
|
|
287
|
-
- `--force --overwrite`가 있으면 기존 `.codex` 삭제 후 재생성
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# codex-rule-maker
|
|
2
2
|
|
|
3
|
-
`codex-rule-maker`는 프로젝트 루트에 `.codex`
|
|
4
|
-
|
|
5
|
-
이 도구는 `output_ex/.codex` 예시의 철학을 참고했습니다. 예시를 그대로 복사하지 않고, 규칙 문서와 참고 문서를 분리한 범용 템플릿으로 일반화했습니다.
|
|
3
|
+
`codex-rule-maker`는 프로젝트 루트에 `.codex` 규칙 폴더와 `docs/` 프로젝트 문서 템플릿을 자동 구성하는 Python CLI 도구입니다. 사용자가 프로젝트 이름, 설명, 스택, DB, 인증 여부, 외부 API 여부, 문서화 수준, 문서 언어를 입력하면 Codex가 작업 전에 읽을 개발 규칙과 프로젝트 문서 구조를 생성합니다.
|
|
6
4
|
|
|
7
5
|
## 설치
|
|
8
6
|
|
|
@@ -21,36 +19,7 @@ pip install -e .
|
|
|
21
19
|
codex-init --help
|
|
22
20
|
```
|
|
23
21
|
|
|
24
|
-
PyPI
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pip install codex-rule-maker
|
|
28
|
-
codex-init --help
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## PyPI 배포
|
|
32
|
-
|
|
33
|
-
배포 전 패키지를 빌드하고 검사합니다.
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
pip install -e ".[dev]"
|
|
37
|
-
python -m build
|
|
38
|
-
python -m twine check dist/*
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
PyPI API token을 발급한 뒤 업로드합니다.
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
python -m twine upload dist/*
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
테스트 PyPI에 먼저 올리고 싶다면 다음 명령을 사용합니다.
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
python -m twine upload --repository testpypi dist/*
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
업로드가 끝나면 새 환경에서 설치를 확인합니다.
|
|
22
|
+
PyPI 설치:
|
|
54
23
|
|
|
55
24
|
```bash
|
|
56
25
|
pip install codex-rule-maker
|
|
@@ -140,10 +109,11 @@ codex-init --force --overwrite
|
|
|
140
109
|
## 예시 실행 흐름
|
|
141
110
|
|
|
142
111
|
```text
|
|
143
|
-
프로젝트 이름 [sample]:
|
|
144
|
-
프로젝트 설명:
|
|
112
|
+
프로젝트 이름 [sample]: 마리오
|
|
113
|
+
프로젝트 설명: 2D 플렛포머 게임
|
|
145
114
|
지원 프로필:
|
|
146
115
|
- fastapi
|
|
116
|
+
- python
|
|
147
117
|
- springboot
|
|
148
118
|
- react
|
|
149
119
|
- nextjs
|
|
@@ -160,8 +130,8 @@ DB 종류 [mysql]: mysql
|
|
|
160
130
|
|
|
161
131
|
생성 설정 확인
|
|
162
132
|
|
|
163
|
-
프로젝트 이름:
|
|
164
|
-
설명:
|
|
133
|
+
프로젝트 이름: 마리오
|
|
134
|
+
설명: 2D 플랫포머 게임
|
|
165
135
|
스택: fastapi,react
|
|
166
136
|
DB: mysql
|
|
167
137
|
인증: yes
|
|
@@ -188,33 +158,44 @@ DB: mysql
|
|
|
188
158
|
| `--interactive` | 대화형 입력 사용 및 최종 확인 표시 | 비활성 |
|
|
189
159
|
| `--force` | 기존 `.codex`가 있으면 백업 후 재생성 | 비활성 |
|
|
190
160
|
| `--overwrite` | `--force`와 함께 기존 `.codex` 삭제 후 재생성 | 비활성 |
|
|
191
|
-
| `--target-dir` | `.codex
|
|
161
|
+
| `--target-dir` | `.codex`와 `docs/`를 생성할 대상 디렉토리 | 현재 디렉토리 |
|
|
192
162
|
|
|
193
163
|
## 생성 구조
|
|
194
164
|
|
|
195
165
|
```text
|
|
196
166
|
.codex/
|
|
197
|
-
├──
|
|
167
|
+
├── ai_rule_developer/
|
|
198
168
|
│ ├── GLOBAL_RULES.md
|
|
199
169
|
│ ├── ARCHITECTURE_RULES.md
|
|
200
170
|
│ ├── CODE_STYLE_RULES.md
|
|
201
171
|
│ ├── API_DESIGN_RULES.md
|
|
202
172
|
│ ├── DOCUMENT_RULE.md
|
|
203
|
-
│ ├──
|
|
204
|
-
│
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
│ ├── FEATURE_SPEC.md
|
|
208
|
-
│ ├── API_SPEC.md
|
|
209
|
-
│ └── DB_SPEC.md
|
|
173
|
+
│ ├── DOMAIN_MODEL_RULES.md
|
|
174
|
+
│ ├── EXTERNAL_INTEGRATION_RULES.md
|
|
175
|
+
│ └── SERVICE_LAYER_RULES.md
|
|
176
|
+
├── ref_docs/
|
|
210
177
|
└── codex_start_prompt.txt
|
|
178
|
+
|
|
179
|
+
docs/
|
|
180
|
+
├── architecture/
|
|
181
|
+
│ ├── directory.md
|
|
182
|
+
│ ├── architecture.md
|
|
183
|
+
│ ├── component.md
|
|
184
|
+
│ ├── state.md
|
|
185
|
+
│ └── flow.md
|
|
186
|
+
├── api/
|
|
187
|
+
│ ├── endpoints.md
|
|
188
|
+
│ └── specification.md
|
|
189
|
+
└── database/
|
|
190
|
+
└── schema.md
|
|
211
191
|
```
|
|
212
192
|
|
|
213
|
-
`
|
|
193
|
+
`ai_rule_developer`는 코딩할 때 지켜야 하는 규칙입니다. `ref_docs`는 외부 아키텍처 문서, PRD, 리서치, 벤더 문서처럼 사용자가 임의로 추가하는 참고자료 공간이므로 디렉토리만 생성합니다. 프로젝트 자체 명세는 루트 `docs/` 아래에 생성되며, 기존 `docs/` 파일이 있으면 덮어쓰지 않습니다. `codex_start_prompt.txt`는 Codex가 작업 시작 전에 `.codex` 문서를 먼저 읽고 규칙 우선순위를 적용하도록 지시합니다.
|
|
214
194
|
|
|
215
195
|
## 지원 프레임워크 프로필
|
|
216
196
|
|
|
217
197
|
- `fastapi`: controller/service/repository/schema/entity 계층 분리
|
|
198
|
+
- `python`: 일반 Python package/module/service/adapter/CLI 경계 분리
|
|
218
199
|
- `springboot`: controller/service/repository/entity/dto 계층 분리
|
|
219
200
|
- `react`: component/page/hook/service/store 분리
|
|
220
201
|
- `nextjs`: App Router, Server Component와 Client Component 구분
|
|
@@ -225,6 +206,7 @@ DB: mysql
|
|
|
225
206
|
|
|
226
207
|
```bash
|
|
227
208
|
codex-init --stack fastapi,react
|
|
209
|
+
codex-init --stack python
|
|
228
210
|
codex-init --stack fullstack-fastapi-react
|
|
229
211
|
codex-init --stack nextjs
|
|
230
212
|
```
|
|
@@ -237,6 +219,7 @@ codex-init --stack nextjs
|
|
|
237
219
|
- `--auth yes`는 인증/권한 규칙을 포함합니다.
|
|
238
220
|
- `--external-api yes`는 외부 연동 계층 분리 규칙을 포함합니다.
|
|
239
221
|
- `--db mysql`처럼 DB를 지정하면 DB, Repository, Schema 관련 규칙을 포함합니다.
|
|
222
|
+
- 프로젝트 명세 템플릿은 `.codex/ref_docs`가 아니라 `docs/architecture`, `docs/api`, `docs/database`에 생성됩니다.
|
|
240
223
|
|
|
241
224
|
## 테스트
|
|
242
225
|
|
|
@@ -244,16 +227,3 @@ codex-init --stack nextjs
|
|
|
244
227
|
pip install -e ".[dev]"
|
|
245
228
|
pytest
|
|
246
229
|
```
|
|
247
|
-
|
|
248
|
-
검증 범위:
|
|
249
|
-
|
|
250
|
-
- 기본 생성 성공
|
|
251
|
-
- 옵션만으로 생성 가능
|
|
252
|
-
- 누락 값 prompt 보완
|
|
253
|
-
- 잘못된 stack/docs/language 검증
|
|
254
|
-
- FastAPI 프로필 생성
|
|
255
|
-
- React 프로필 생성
|
|
256
|
-
- Fullstack FastAPI React 프로필 생성
|
|
257
|
-
- 기존 `.codex`가 있을 때 prompt 중단
|
|
258
|
-
- `--force`가 있으면 기존 `.codex` 백업 후 재생성
|
|
259
|
-
- `--force --overwrite`가 있으면 기존 `.codex` 삭제 후 재생성
|
|
@@ -47,10 +47,15 @@ class CodexBuilder:
|
|
|
47
47
|
backup_dir = self._replace_existing_codex(codex_dir, backup_existing=backup_existing)
|
|
48
48
|
|
|
49
49
|
try:
|
|
50
|
+
for relative_dir in self._renderer.render_directories(config):
|
|
51
|
+
(root / relative_dir).mkdir(parents=True, exist_ok=True)
|
|
52
|
+
|
|
50
53
|
written_files: list[Path] = []
|
|
51
54
|
for relative_path, content in rendered_files.items():
|
|
52
55
|
destination = root / relative_path
|
|
53
56
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
57
|
+
if destination.exists() and relative_path.parts[0] != CODEX_DIR_NAME:
|
|
58
|
+
continue
|
|
54
59
|
destination.write_text(content.rstrip() + "\n", encoding="utf-8")
|
|
55
60
|
written_files.append(destination)
|
|
56
61
|
except OSError as exc:
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
CODEX_DIR_NAME = ".codex"
|
|
6
|
-
AI_RULE_DIR_NAME = "
|
|
7
|
-
REF_DOCS_DIR_NAME = "
|
|
6
|
+
AI_RULE_DIR_NAME = "ai_rule_developer"
|
|
7
|
+
REF_DOCS_DIR_NAME = "ref_docs"
|
|
8
|
+
DOCS_DIR_NAME = "docs"
|
|
8
9
|
START_PROMPT_FILE_NAME = "codex_start_prompt.txt"
|
|
9
10
|
|
|
10
11
|
RULE_FILE_NAMES = (
|
|
@@ -13,15 +14,20 @@ RULE_FILE_NAMES = (
|
|
|
13
14
|
"CODE_STYLE_RULES.md",
|
|
14
15
|
"API_DESIGN_RULES.md",
|
|
15
16
|
"DOCUMENT_RULE.md",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
17
|
+
"DOMAIN_MODEL_RULES.md",
|
|
18
|
+
"EXTERNAL_INTEGRATION_RULES.md",
|
|
19
|
+
"SERVICE_LAYER_RULES.md",
|
|
18
20
|
)
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
22
|
+
DOC_FILE_NAMES = (
|
|
23
|
+
"architecture/directory.md",
|
|
24
|
+
"architecture/architecture.md",
|
|
25
|
+
"architecture/component.md",
|
|
26
|
+
"architecture/state.md",
|
|
27
|
+
"architecture/flow.md",
|
|
28
|
+
"api/endpoints.md",
|
|
29
|
+
"api/specification.md",
|
|
30
|
+
"database/schema.md",
|
|
25
31
|
)
|
|
26
32
|
|
|
27
33
|
DEFAULT_LANGUAGE = "ko"
|
|
@@ -43,6 +43,63 @@ class FrameworkProfile:
|
|
|
43
43
|
return self.test_rules_en if language == "en" else self.test_rules_ko
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
PYTHON_PROFILE = FrameworkProfile(
|
|
47
|
+
key="python",
|
|
48
|
+
display_name="Python",
|
|
49
|
+
philosophy_ko="일반 Python 프로젝트는 프레임워크 전제 없이 package/module, service, adapter, CLI 경계를 명확히 분리한다.",
|
|
50
|
+
philosophy_en="General Python projects should separate package/module, service, adapter, and CLI boundaries without assuming a framework.",
|
|
51
|
+
architecture_ko=(
|
|
52
|
+
"패키지는 기능 또는 도메인 책임 기준으로 나누고 임시 script 모음처럼 방치하지 않는다.",
|
|
53
|
+
"CLI 또는 실행 진입점은 입력 파싱과 출력 변환만 담당하고 실제 판단은 service/application 계층에 위임한다.",
|
|
54
|
+
"핵심 도메인 함수와 클래스는 파일 시스템, 네트워크, 환경 변수, process args에 직접 의존하지 않게 한다.",
|
|
55
|
+
"파일, DB, 외부 API, subprocess 연동은 adapter 또는 infrastructure 모듈 뒤에 둔다.",
|
|
56
|
+
"권장 흐름: Entrypoint/CLI -> Application Service -> Domain/Adapter -> External System.",
|
|
57
|
+
),
|
|
58
|
+
architecture_en=(
|
|
59
|
+
"Split packages by feature or domain responsibility instead of leaving them as loose script collections.",
|
|
60
|
+
"CLI or runtime entrypoints should only parse input and map output, then delegate decisions to service/application layers.",
|
|
61
|
+
"Keep core domain functions and classes independent from filesystem, network, environment variables, and process args.",
|
|
62
|
+
"Put filesystem, database, external API, and subprocess integrations behind adapter or infrastructure modules.",
|
|
63
|
+
"Recommended flow: Entrypoint/CLI -> Application Service -> Domain/Adapter -> External System.",
|
|
64
|
+
),
|
|
65
|
+
framework_rules_ko=(
|
|
66
|
+
"import 시점에 파일 생성, 네트워크 호출, 프로세스 실행 같은 부수효과가 발생하지 않게 한다.",
|
|
67
|
+
"실행 가능한 모듈은 `main()` 진입점을 제공하고 직접 실행 코드는 `if __name__ == \"__main__\"` 아래에 둔다.",
|
|
68
|
+
"표준 라이브러리로 충분한 문제에 불필요한 dependency를 추가하지 않는다.",
|
|
69
|
+
"공개 함수와 클래스에는 의미 있는 타입 힌트를 유지하고, 입력/출력 모델은 명확한 자료 구조로 표현한다.",
|
|
70
|
+
"순수 계산 로직과 I/O 로직을 분리해 테스트와 재사용이 가능하게 한다.",
|
|
71
|
+
),
|
|
72
|
+
framework_rules_en=(
|
|
73
|
+
"Avoid import-time side effects such as file creation, network calls, or process execution.",
|
|
74
|
+
"Runnable modules should expose a `main()` entrypoint and keep direct execution under `if __name__ == \"__main__\"`.",
|
|
75
|
+
"Do not add dependencies when the standard library is enough for the problem.",
|
|
76
|
+
"Keep meaningful type hints on public functions and classes, and represent input/output models with explicit data structures.",
|
|
77
|
+
"Separate pure computation from I/O so logic stays testable and reusable.",
|
|
78
|
+
),
|
|
79
|
+
api_rules_ko=(
|
|
80
|
+
"공개 함수, 클래스, CLI 옵션은 외부 계약으로 보고 이름과 반환 형식을 안정적으로 관리한다.",
|
|
81
|
+
"외부 입력은 진입점에서 검증하고 내부 모델로 변환한 뒤 service 계층에 전달한다.",
|
|
82
|
+
"예외는 호출자가 처리할 수 있는 명확한 타입 또는 메시지로 표현한다.",
|
|
83
|
+
),
|
|
84
|
+
api_rules_en=(
|
|
85
|
+
"Treat public functions, classes, and CLI options as external contracts with stable names and return shapes.",
|
|
86
|
+
"Validate external input at the entrypoint and convert it into internal models before passing it to services.",
|
|
87
|
+
"Represent errors with clear exception types or messages that callers can handle.",
|
|
88
|
+
),
|
|
89
|
+
test_rules_ko=(
|
|
90
|
+
"순수 로직 테스트와 파일/네트워크/환경 변수 I/O 테스트를 분리한다.",
|
|
91
|
+
"`tmp_path`, monkeypatch, test double을 사용해 파일 시스템과 외부 의존성을 격리한다.",
|
|
92
|
+
"CLI 인자, 설정 파싱, 오류 경로는 회귀 테스트로 고정한다.",
|
|
93
|
+
),
|
|
94
|
+
test_rules_en=(
|
|
95
|
+
"Separate tests for pure logic from tests that cover filesystem, network, or environment I/O.",
|
|
96
|
+
"Use `tmp_path`, monkeypatching, and test doubles to isolate filesystem and external dependencies.",
|
|
97
|
+
"Lock down CLI arguments, configuration parsing, and error paths with regression tests.",
|
|
98
|
+
),
|
|
99
|
+
directories=("src/<package_name>", "src/<package_name>/services", "src/<package_name>/adapters", "tests", "scripts"),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
46
103
|
FASTAPI_PROFILE = FrameworkProfile(
|
|
47
104
|
key="fastapi",
|
|
48
105
|
display_name="FastAPI",
|
|
@@ -325,50 +382,50 @@ FULLSTACK_FASTAPI_REACT_PROFILE = FrameworkProfile(
|
|
|
325
382
|
architecture_ko=(
|
|
326
383
|
"backend는 Controller -> Service -> Repository -> DB 흐름을 따른다.",
|
|
327
384
|
"frontend는 Page -> Hook/Store -> Service -> API 흐름을 따른다.",
|
|
328
|
-
"
|
|
385
|
+
"docs/api/specification.md는 백엔드 response schema와 프론트엔드 service 타입의 공통 계약이다.",
|
|
329
386
|
"백엔드 Entity를 프론트엔드 타입으로 직접 취급하지 않는다.",
|
|
330
387
|
"인증, 오류, pagination, enum 값은 양쪽 구현과 문서를 함께 갱신한다.",
|
|
331
388
|
),
|
|
332
389
|
architecture_en=(
|
|
333
390
|
"Backend follows Controller -> Service -> Repository -> DB.",
|
|
334
391
|
"Frontend follows Page -> Hook/Store -> Service -> API.",
|
|
335
|
-
"
|
|
392
|
+
"docs/api/specification.md is the shared contract between backend response schemas and frontend service types.",
|
|
336
393
|
"Do not treat backend entities as frontend types directly.",
|
|
337
394
|
"Update auth, errors, pagination, and enum values in both implementations and docs.",
|
|
338
395
|
),
|
|
339
396
|
framework_rules_ko=(
|
|
340
397
|
"backend와 frontend 디렉토리 경계를 분명히 유지한다.",
|
|
341
|
-
"API 변경은 backend schema, frontend service/type,
|
|
398
|
+
"API 변경은 backend schema, frontend service/type, docs/api/specification.md를 함께 수정한다.",
|
|
342
399
|
"React 컴포넌트는 백엔드 엔드포인트를 직접 호출하지 않고 service 계층을 통한다.",
|
|
343
400
|
"FastAPI service는 프론트엔드 화면 구조를 알지 못해야 한다.",
|
|
344
401
|
"CORS, 인증 토큰, 오류 응답 형식은 공통 정책으로 문서화한다.",
|
|
345
402
|
),
|
|
346
403
|
framework_rules_en=(
|
|
347
404
|
"Keep backend and frontend directory boundaries clear.",
|
|
348
|
-
"API changes must update backend schemas, frontend services/types, and
|
|
405
|
+
"API changes must update backend schemas, frontend services/types, and docs/api/specification.md together.",
|
|
349
406
|
"React components call backend endpoints through the service layer, not directly.",
|
|
350
407
|
"FastAPI services must not know frontend screen structure.",
|
|
351
408
|
"Document CORS, auth tokens, and error response format as shared policies.",
|
|
352
409
|
),
|
|
353
410
|
api_rules_ko=(
|
|
354
|
-
"OpenAPI 또는 명시적
|
|
411
|
+
"OpenAPI 또는 명시적 docs/api/specification.md를 기준 계약으로 유지한다.",
|
|
355
412
|
"Request/Response 필드명은 백엔드와 프론트엔드에서 동일하게 관리한다.",
|
|
356
413
|
"인증이 필요한 API는 권한 요구사항과 실패 응답을 반드시 문서화한다.",
|
|
357
414
|
),
|
|
358
415
|
api_rules_en=(
|
|
359
|
-
"Keep OpenAPI or explicit
|
|
416
|
+
"Keep OpenAPI or explicit docs/api/specification.md as the source contract.",
|
|
360
417
|
"Maintain identical request/response field names across backend and frontend.",
|
|
361
418
|
"Document authorization requirements and failure responses for protected APIs.",
|
|
362
419
|
),
|
|
363
420
|
test_rules_ko=(
|
|
364
421
|
"백엔드 API 테스트와 프론트엔드 service 테스트가 같은 계약을 검증하게 한다.",
|
|
365
422
|
"주요 사용자 흐름은 E2E 또는 통합 테스트 대상으로 둔다.",
|
|
366
|
-
"API mock은 실제
|
|
423
|
+
"API mock은 실제 docs/api/specification.md와 불일치하지 않게 관리한다.",
|
|
367
424
|
),
|
|
368
425
|
test_rules_en=(
|
|
369
426
|
"Backend API tests and frontend service tests should verify the same contract.",
|
|
370
427
|
"Cover major user flows with E2E or integration tests.",
|
|
371
|
-
"Keep API mocks aligned with
|
|
428
|
+
"Keep API mocks aligned with docs/api/specification.md.",
|
|
372
429
|
),
|
|
373
430
|
directories=("backend/app/controllers", "backend/app/services", "backend/app/repositories", "frontend/src/pages", "frontend/src/components", "frontend/src/services", "frontend/src/stores"),
|
|
374
431
|
)
|
|
@@ -377,6 +434,7 @@ PROFILES: dict[str, FrameworkProfile] = {
|
|
|
377
434
|
profile.key: profile
|
|
378
435
|
for profile in (
|
|
379
436
|
FASTAPI_PROFILE,
|
|
437
|
+
PYTHON_PROFILE,
|
|
380
438
|
SPRINGBOOT_PROFILE,
|
|
381
439
|
REACT_PROFILE,
|
|
382
440
|
NEXTJS_PROFILE,
|
|
@@ -386,6 +444,11 @@ PROFILES: dict[str, FrameworkProfile] = {
|
|
|
386
444
|
}
|
|
387
445
|
|
|
388
446
|
PROFILE_ALIASES: dict[str, str] = {
|
|
447
|
+
"py": "python",
|
|
448
|
+
"python3": "python",
|
|
449
|
+
"plain-python": "python",
|
|
450
|
+
"vanilla-python": "python",
|
|
451
|
+
"general-python": "python",
|
|
389
452
|
"fast-api": "fastapi",
|
|
390
453
|
"spring": "springboot",
|
|
391
454
|
"spring-boot": "springboot",
|