refactor(commit): 커밋 정책을 commit-policy 스킬로 분리한다
This commit is contained in:
21
.opencode/commands/commit.md
Normal file
21
.opencode/commands/commit.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
description: commit-policy 스킬을 로드해 커밋 메시지 생성과 전후 검증을 수행한다
|
||||||
|
agent: build
|
||||||
|
subtask: true
|
||||||
|
---
|
||||||
|
|
||||||
|
작업 목표:
|
||||||
|
현재 변경사항을 안전하게 커밋한다.
|
||||||
|
|
||||||
|
필수 시작 단계:
|
||||||
|
1. `skill` 도구로 `commit-policy` 스킬을 먼저 로드한다.
|
||||||
|
- `skill({ name: "commit-policy" })`
|
||||||
|
|
||||||
|
실행 단계:
|
||||||
|
1. 로드한 `commit-policy` 스킬의 Hard Requirements와 Execution Flow를 그대로 수행한다.
|
||||||
|
2. `AGENTS.md`의 최소 정책(형식/한글 description/검증 스크립트)을 항상 만족한다.
|
||||||
|
3. `$ARGUMENTS`가 있으면 scope 또는 description 의도에 반영하되, 스킬 규칙과 형식을 깨지 않는다.
|
||||||
|
4. 마지막에 실행 명령과 pre-check/post-check PASS/FAIL 핵심 결과를 간단히 보고한다.
|
||||||
|
|
||||||
|
추가 사용자 의도:
|
||||||
|
$ARGUMENTS
|
||||||
46
.opencode/skills/commit-policy/SKILL.md
Normal file
46
.opencode/skills/commit-policy/SKILL.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
name: commit-policy
|
||||||
|
description: Apply this skill for any git commit task in this repository. It enforces commit message format and validation flow defined in AGENTS.md and work/scripts/check-commit-message-rules.sh, including pre-commit and post-commit verification.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Commit Policy Skill
|
||||||
|
|
||||||
|
Use this workflow whenever the task includes creating a commit.
|
||||||
|
|
||||||
|
## Required References
|
||||||
|
|
||||||
|
- `@AGENTS.md`
|
||||||
|
- `@work/scripts/check-commit-message-rules.sh`
|
||||||
|
|
||||||
|
## Hard Requirements
|
||||||
|
|
||||||
|
1. Use commit subject format: `<type>(scope): <description>`.
|
||||||
|
2. `type` must be lowercase (for example `feat`, `fix`, `chore`, `docs`, `refactor`, `test`).
|
||||||
|
3. `description` must include Korean text and stay concise in imperative present tone.
|
||||||
|
4. Optional footer must use `Refs: #123` or `Refs: #123, #456` format.
|
||||||
|
5. Never commit secret files (`.env`, key/token/secret credential files).
|
||||||
|
6. Never bypass hooks with `--no-verify`.
|
||||||
|
|
||||||
|
## Execution Flow
|
||||||
|
|
||||||
|
1. Inspect context with:
|
||||||
|
- `git status`
|
||||||
|
- `git diff --cached`
|
||||||
|
- `git diff`
|
||||||
|
- `git log -5 --oneline`
|
||||||
|
2. Stage commit target files only. Exclude suspicious secret-bearing files.
|
||||||
|
3. Draft commit message from the change intent (focus on why, not only what).
|
||||||
|
4. Run pre-commit validation with the full draft message:
|
||||||
|
- `./work/scripts/check-commit-message-rules.sh --message "<full message>"`
|
||||||
|
5. If validation fails, revise message and re-run until PASS.
|
||||||
|
6. Commit using the validated message.
|
||||||
|
7. Run post-commit validation:
|
||||||
|
- `./work/scripts/check-commit-message-rules.sh`
|
||||||
|
8. Report executed commands and PASS/FAIL summary.
|
||||||
|
|
||||||
|
## Output Checklist
|
||||||
|
|
||||||
|
- Final commit subject.
|
||||||
|
- Whether pre-check passed.
|
||||||
|
- Whether post-check passed.
|
||||||
|
- Any excluded files and reason.
|
||||||
24
AGENTS.md
24
AGENTS.md
@@ -99,24 +99,12 @@
|
|||||||
별도 규칙 파일이 추가되면 본 문서보다 해당 규칙을 우선 반영한다.
|
별도 규칙 파일이 추가되면 본 문서보다 해당 규칙을 우선 반영한다.
|
||||||
|
|
||||||
## 커밋 메시지 규칙 (표준 Conventional Commits)
|
## 커밋 메시지 규칙 (표준 Conventional Commits)
|
||||||
기본 형식:
|
- 커밋 상세 가이드/절차는 `.opencode/skills/commit-policy/SKILL.md`를 단일 기준으로 사용한다.
|
||||||
```text
|
- 커밋 작업 시작 시 `skill` 도구로 `commit-policy`를 먼저 로드한다.
|
||||||
<type>(scope): <description>
|
- 기본 형식은 `<type>(scope): <description>`를 사용한다.
|
||||||
```
|
- `type`은 소문자(`feat`, `fix`, `chore`, `docs`, `refactor`, `test` 등)를 사용한다.
|
||||||
|
|
||||||
핵심 규칙:
|
|
||||||
- `type`은 소문자 사용 (`feat`, `fix`, `chore`, `docs`, `refactor`, `test` 등).
|
|
||||||
- `scope`는 선택 사항이지만 가능하면 모듈 단위로 명시.
|
|
||||||
- 제목(description)은 한글로 작성하고, 명령형/간결한 현재형으로 작성한다.
|
- 제목(description)은 한글로 작성하고, 명령형/간결한 현재형으로 작성한다.
|
||||||
- 브레이킹 변경은 `!` 또는 `BREAKING CHANGE:` footer로 명시.
|
- 이슈 참조 footer는 `Refs: #123` 또는 `Refs: #123, #456` 형식을 사용한다.
|
||||||
- 이슈 참조는 footer 사용(예: `Refs: #123`).
|
|
||||||
|
|
||||||
예시:
|
|
||||||
```text
|
|
||||||
feat(chat): 채팅 쿼터 구매 엔드포인트를 추가한다
|
|
||||||
fix(member): 마이페이지 API의 null 인증 주체 처리를 보완한다
|
|
||||||
refactor(content): 랭킹 조회 로직을 전용 리포지토리로 분리한다
|
|
||||||
```
|
|
||||||
|
|
||||||
### 커밋 메시지 검증 절차
|
### 커밋 메시지 검증 절차
|
||||||
- `git commit` 실행 직전에 `work/scripts/check-commit-message-rules.sh`를 실행해 규칙 준수 여부를 확인한다.
|
- `git commit` 실행 직전에 `work/scripts/check-commit-message-rules.sh`를 실행해 규칙 준수 여부를 확인한다.
|
||||||
@@ -127,7 +115,7 @@ refactor(content): 랭킹 조회 로직을 전용 리포지토리로 분리한
|
|||||||
- 변경 전: 유사 기능 코드를 먼저 찾아 네이밍/예외/응답 패턴을 맞춘다.
|
- 변경 전: 유사 기능 코드를 먼저 찾아 네이밍/예외/응답 패턴을 맞춘다.
|
||||||
- 변경 중: 공개 API 스키마를 임의 변경하지 말고, 작은 단위로 안전하게 수정한다.
|
- 변경 중: 공개 API 스키마를 임의 변경하지 말고, 작은 단위로 안전하게 수정한다.
|
||||||
- 변경 후: 최소 단일 테스트 또는 `./gradlew test`를 실행하고, 필요 시 `./gradlew ktlintCheck`를 수행한다.
|
- 변경 후: 최소 단일 테스트 또는 `./gradlew test`를 실행하고, 필요 시 `./gradlew ktlintCheck`를 수행한다.
|
||||||
- 커밋 전/후: `git commit` 직전과 직후에 `work/scripts/check-commit-message-rules.sh`를 실행해 커밋 메시지 규칙 준수 여부를 확인한다.
|
- 커밋 전/후: `commit-policy` 스킬을 먼저 로드하고, `git commit` 직전과 직후에 `work/scripts/check-commit-message-rules.sh`를 실행해 커밋 메시지 규칙 준수 여부를 확인한다.
|
||||||
|
|
||||||
## 작업 계획 문서 규칙 (docs)
|
## 작업 계획 문서 규칙 (docs)
|
||||||
- 모든 작업 시작 전에 `docs` 폴더 아래에 계획 문서를 먼저 생성하고, 해당 문서를 기준으로 구현을 진행한다.
|
- 모든 작업 시작 전에 `docs` 폴더 아래에 계획 문서를 먼저 생성하고, 해당 문서를 기준으로 구현을 진행한다.
|
||||||
|
|||||||
15
docs/20260220_커밋규칙스킬분리.md
Normal file
15
docs/20260220_커밋규칙스킬분리.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# 20260220 커밋 규칙 스킬 분리
|
||||||
|
|
||||||
|
## 구현 계획
|
||||||
|
- [x] 커밋 메시지 정책의 최소 필수 항목을 `AGENTS.md`에 유지한다.
|
||||||
|
- [x] 커밋 상세 절차와 실행 가이드를 `.opencode/skills/commit-policy/SKILL.md`로 분리한다.
|
||||||
|
- [x] `/commit` 커맨드가 커밋 작업 시작 시 `commit-policy` 스킬을 우선 로드하도록 갱신한다.
|
||||||
|
- [x] 커밋 검증 강제 수단(`work/scripts/check-commit-message-rules.sh`)이 유지되는지 확인한다.
|
||||||
|
- [x] 문서 변경 검증을 위해 `./gradlew tasks --all`을 실행한다.
|
||||||
|
|
||||||
|
## 검증 기록
|
||||||
|
- [x] 작업 완료 후 검증 결과를 기록한다.
|
||||||
|
|
||||||
|
- 무엇을: `AGENTS.md`의 커밋 섹션을 최소 정책(형식, 한글 description, 검증 절차, 스킬 로드 지침) 중심으로 정리하고, 상세 절차를 `.opencode/skills/commit-policy/SKILL.md`로 분리했다. `/commit` 커맨드(`.opencode/commands/commit.md`)는 실행 시 `commit-policy` 스킬을 먼저 로드하도록 변경했다.
|
||||||
|
- 왜: 커밋 상세 규칙을 상시 컨텍스트에서 분리해 토큰 사용량을 줄이면서도, 커밋 시점에는 스킬 로드로 동일한 절차를 강제하기 위해서다.
|
||||||
|
- 어떻게 검증했는지: `AGENTS.md`, `.opencode/commands/commit.md`, `.opencode/skills/commit-policy/SKILL.md`, `docs/20260220_커밋규칙스킬분리.md`에 대해 `lsp_diagnostics`를 실행해 모두 `No diagnostics found`를 확인했다. 추가로 `./gradlew tasks --all`과 `./gradlew build`를 실행해 모두 `BUILD SUCCESSFUL`을 확인했다.
|
||||||
Reference in New Issue
Block a user