Files
document-haness/docs/EXTENDING.md
T

64 lines
2.0 KiB
Markdown

# Extending ClariDoc
## 새 문서 유형 추가
1. `DocumentType`에 enum 추가
2. `STRUCTURE_SPECS`에 reader-question 순서 정의
3. procedural/example/trade-off lint 범주 검토
4. JSON Schema enum 업데이트
5. 각 intent가 unique하고 최소 section 수를 만족하는 테스트 추가
## 새 source type 추가
1. `corpus._classify_source`에 path rule 추가
2. `_SOURCE_WEIGHTS`에 기본 weight 추가
3. prompt의 source hierarchy에 claim role 정의
4. canonical/current state와 rationale/history 충돌 규칙 작성
5. ranking과 provenance 테스트 추가
## 새 reviewer 추가
Pipeline config의 reviewer role은 자유 문자열이지만 중복될 수 없다. role-specific prompt가 필요하면 `ROLE_GUIDANCE`에 추가한다.
추천 role:
- `editor`: 문장과 heading
- `security`: threat model과 secret exposure
- `api`: contract compatibility
- `domain-owner`: project-specific correctness
Model review response는 모든 `REVIEW_DIMENSIONS`를 포함해야 한다.
## 새 provider 추가
`Provider` interface를 구현한다.
```python
class MyProvider(Provider):
def generate(self, request: ProviderRequest) -> ProviderResponse:
...
def check(self) -> dict[str, object]:
...
```
요구사항:
- prompt는 stdin 또는 안전한 API body로 전달
- timeout 강제
- command/error를 audit event로 남길 수 있음
- cwd 복원과 output isolation
- credential을 response/event에 기록하지 않음
- fake executable 또는 fake SDK unit test
## Rationale lint 확장
현재 `RAT001``RAT002`는 lexical heuristic이다. 특정 조직의 decision record가 structured field를 갖고 있다면 다음 확장이 가능하다.
- decision ID별 required claim type
- alternative/accepted-cost/guardrail field validation
- source heading과 claim ID 기반 completeness score
- canonical implementation state와 branch rationale join
Score를 높이기 위해 heuristic을 약화하지 않는다. false positive를 줄일 때는 regression fixture와 golden example을 함께 추가한다.