From e8637b424d0bd6f10c8333799e3515791a64b048 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 7 Apr 2026 16:16:04 +0900 Subject: [PATCH] =?UTF-8?q?docs(commit-policy):=20=EC=9E=90=EB=8F=99=20foo?= =?UTF-8?q?ter=20=EA=B8=88=EC=A7=80=20=EC=A0=88=EC=B0=A8=EB=A5=BC=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .opencode/commands/commit.md | 3 ++- .opencode/skills/commit-policy/SKILL.md | 11 +++++++---- AGENTS.md | 3 +++ docs/20260407_커밋footer자동추가차단.md | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 docs/20260407_커밋footer자동추가차단.md diff --git a/.opencode/commands/commit.md b/.opencode/commands/commit.md index 0528089b..06cedcac 100644 --- a/.opencode/commands/commit.md +++ b/.opencode/commands/commit.md @@ -15,7 +15,8 @@ subtask: true 1. 로드한 `commit-policy` 스킬의 Hard Requirements와 Execution Flow를 그대로 수행한다. 2. `AGENTS.md`의 최소 정책(형식/한글 description/검증 스크립트)을 항상 만족한다. 3. `$ARGUMENTS`가 있으면 scope 또는 description 의도에 반영하되, 스킬 규칙과 형식을 깨지 않는다. -4. 마지막에 실행 명령과 pre-check/post-check PASS/FAIL 핵심 결과를 간단히 보고한다. +4. 가능하면 메시지 파일을 검증한 뒤 같은 파일을 `git commit -F`에 전달해 검증을 통과한 메시지를 그대로 사용하고, `Ultraworked with [Sisyphus]...` 및 `Co-authored-by: Sisyphus ` 라인이 본문에 추가되지 않도록 확인한다. +5. 마지막에 실행 명령과 pre-check/post-check PASS/FAIL 핵심 결과를 간단히 보고한다. 추가 사용자 의도: $ARGUMENTS diff --git a/.opencode/skills/commit-policy/SKILL.md b/.opencode/skills/commit-policy/SKILL.md index b13180e7..505a5fdd 100644 --- a/.opencode/skills/commit-policy/SKILL.md +++ b/.opencode/skills/commit-policy/SKILL.md @@ -20,6 +20,7 @@ Use this workflow whenever the task includes creating a commit. 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`. +7. Never include `Ultraworked with [Sisyphus]...` or `Co-authored-by: Sisyphus ` in the commit body. ## Execution Flow @@ -31,12 +32,13 @@ Use this workflow whenever the task includes creating a commit. 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 ""` + - `./work/scripts/check-commit-message-rules.sh --message ""` 5. If validation fails, revise message and re-run until PASS. -6. Commit using the validated message. +6. Prefer validating a message file with `./work/scripts/check-commit-message-rules.sh --message-file ` and commit with the same file via `git commit -F ` so the exact validated message is reused unchanged. 7. Run post-commit validation: - - `./work/scripts/check-commit-message-rules.sh` -8. Report executed commands and PASS/FAIL summary. + - `./work/scripts/check-commit-message-rules.sh` +8. If post-commit validation fails because an automatic footer was appended, stop and report the failure instead of treating the commit as valid. +9. Report executed commands and PASS/FAIL summary. ## Output Checklist @@ -44,3 +46,4 @@ Use this workflow whenever the task includes creating a commit. - Whether pre-check passed. - Whether post-check passed. - Any excluded files and reason. +- Whether forbidden Sisyphus footer lines were absent in the final commit body. diff --git a/AGENTS.md b/AGENTS.md index a679c05e..01e1a3c8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -113,17 +113,20 @@ - `type`은 소문자(`feat`, `fix`, `chore`, `docs`, `refactor`, `test` 등)를 사용한다. - 제목(description)은 한글로 작성하고, 명령형/간결한 현재형으로 작성한다. - 이슈 참조 footer는 `Refs: #123` 또는 `Refs: #123, #456` 형식을 사용한다. +- 커밋 본문에는 `Ultraworked with [Sisyphus]...` 및 `Co-authored-by: Sisyphus ` 자동 footer를 포함하지 않는다. ### 커밋 메시지 검증 절차 - `git commit` 실행 직전에 `work/scripts/check-commit-message-rules.sh`를 실행해 규칙 준수 여부를 확인한다. - `git commit` 실행 직후에도 `work/scripts/check-commit-message-rules.sh`를 다시 실행해 최종 메시지를 재검증한다. - 스크립트 결과가 `[FAIL]`이면 커밋 메시지를 규칙에 맞게 수정한 뒤 다시 검증한다. +- 커밋 실행 시 검증한 메시지를 그대로 사용하고, 도구 기본 footer가 자동 추가되지 않도록 최종 커밋 본문을 확인한다. ## 작업 절차 체크리스트 - 변경 전: 유사 기능 코드를 먼저 찾아 네이밍/예외/응답 패턴을 맞춘다. - 변경 중: 공개 API 스키마를 임의 변경하지 말고, 작은 단위로 안전하게 수정한다. - 변경 후: 최소 단일 테스트 또는 `./gradlew test`를 실행하고, 필요 시 `./gradlew ktlintCheck`를 수행한다. - 커밋 전/후: `commit-policy` 스킬을 먼저 로드하고, `git commit` 직전과 직후에 `work/scripts/check-commit-message-rules.sh`를 실행해 커밋 메시지 규칙 준수 여부를 확인한다. +- 커밋 전/후 확인 시 Sisyphus attribution footer가 없는지 함께 검증한다. ## 작업 계획 문서 규칙 (docs) - 모든 작업 시작 전에 `docs` 폴더 아래에 계획 문서를 먼저 생성하고, 해당 문서를 기준으로 구현을 진행한다. diff --git a/docs/20260407_커밋footer자동추가차단.md b/docs/20260407_커밋footer자동추가차단.md new file mode 100644 index 00000000..ee336ce9 --- /dev/null +++ b/docs/20260407_커밋footer자동추가차단.md @@ -0,0 +1,22 @@ +# 20260407 커밋 footer 자동 추가 차단 + +## 구현 계획 +- [x] oh-my-openagent 기본 footer 동작과 저장소 로컬 커밋 워크플로우의 영향 범위를 문서화한다. +- [x] `AGENTS.md`에 커밋 본문에서 Sisyphus footer와 자동 `Co-authored-by` 라인을 허용하지 않는 규칙을 추가한다. +- [x] `.opencode/skills/commit-policy/SKILL.md`에 검증된 메시지를 그대로 `git commit`에 전달하고 자동 footer를 금지하는 절차를 반영한다. +- [x] `.opencode/commands/commit.md`에 `/commit` 커맨드가 자동 footer 없는 최종 메시지를 사용하도록 지시를 보강한다. +- [x] `work/scripts/check-commit-message-rules.sh`에 Sisyphus footer 및 자동 `Co-authored-by` 라인 차단 검증을 추가한다. +- [x] 변경 문서와 스크립트에 대해 진단 및 실행 검증을 수행한다. + +## 검증 기록 +- [x] 작업 완료 후 검증 결과를 기록한다. + +- 1차 구현 + - 무엇을: `AGENTS.md`, `.opencode/skills/commit-policy/SKILL.md`, `.opencode/commands/commit.md`, `work/scripts/check-commit-message-rules.sh`를 수정해 커밋 본문에서 `Ultraworked with [Sisyphus]...`와 `Co-authored-by: Sisyphus ` 자동 footer를 금지하고, `/commit` 경로가 검증된 메시지를 그대로 `git commit`에 전달하도록 명시했다. + - 왜: oh-my-openagent 기본 설정과 알려진 버그로 자동 footer가 붙을 수 있으므로, 저장소 로컬 규칙과 검증 스크립트에서 이를 명시적으로 차단해야 커밋 결과를 일관되게 통제할 수 있기 때문이다. + - 어떻게: `lsp_diagnostics`로 `AGENTS.md`, `.opencode/skills/commit-policy/SKILL.md`, `.opencode/commands/commit.md`, `work/scripts/check-commit-message-rules.sh`, `docs/20260407_커밋footer자동추가차단.md`에 대해 모두 `No diagnostics found`를 확인했다. `bash -n work/scripts/check-commit-message-rules.sh`로 문법을 검증했고, `./work/scripts/check-commit-message-rules.sh --message`로 정상 메시지/`Refs` footer 허용 케이스는 PASS, Sisyphus footer와 자동 `Co-authored-by` 케이스는 FAIL을 확인했다. 추가로 `./gradlew tasks --all` 실행 결과 `BUILD SUCCESSFUL`을 확인했다. + +- 2차 수정 + - 무엇을: Oracle 검토 의견을 반영해 `.opencode/skills/commit-policy/SKILL.md`와 `.opencode/commands/commit.md`에서 `--message-file` 검증 후 같은 파일을 `git commit -F`에 전달하는 경로를 권장하도록 보강했고, `work/scripts/check-commit-message-rules.sh`의 `Co-authored-by` 차단 조건을 공백 변형까지 탐지하도록 확장했다. + - 왜: exact string 하나만 금지하면 footer 형식이 조금만 달라져도 놓칠 수 있으므로, 외부 기본 동작이나 버그로 인한 변형까지 더 안정적으로 차단해야 하기 때문이다. + - 어떻게: `lsp_diagnostics`로 `.opencode/skills/commit-policy/SKILL.md`, `.opencode/commands/commit.md`, `work/scripts/check-commit-message-rules.sh`에 대해 모두 `No diagnostics found`를 확인했다. `bash -n work/scripts/check-commit-message-rules.sh`를 다시 실행해 문법을 검증했고, `./work/scripts/check-commit-message-rules.sh --message`로 기본 메시지와 `Refs` footer는 PASS, Sisyphus footer/기본 `Co-authored-by`/공백 변형 `Co-authored-by` 케이스는 모두 FAIL을 확인했다.