Skip to content

✨ feat: port passthrough from commithelper-go package#80

Merged
djk01281 merged 2 commits into
mainfrom
feature/76
Jul 2, 2026
Merged

✨ feat: port passthrough from commithelper-go package#80
djk01281 merged 2 commits into
mainfrom
feature/76

Conversation

@djk01281

@djk01281 djk01281 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

요약

Closes #76

새 옵션: passthrough

  • passthrough에 등록된 프로젝트의 키를 브랜치에서 찾아 커밋 메시지에 그대로 복사합니다. prefix를 저장소 참조로 번역하는 rules와 구분됩니다.
{
    "rules": { "feature": null, "qa": "org/repo" },
    "passthrough": ["PROJ", "ABC"],
    "protect": ["main"]
}
  • 등록된 프로젝트만 인식합니다. UTF-8, SHA-1 같은 무관한 대문자-숫자 토큰이 이슈로 오인되지 않습니다.
  • 생략하면 비활성화됩니다. rules는 계속 동작합니다.
  • 브랜치가 rules prefix와 키 양쪽에 매칭되면 rules가 우선합니다.

해석 순서와 케이스

rules(prefix → GitHub 참조) → passthrough(키 그대로) → 둘 다 아니면 원본 유지. 위 설정 기준:

브랜치 결과 해석 경로 이전 대비
feature/123 [#123] rules 동일
qa/45 [org/repo#45] rules 동일
feature/PROJ-123 [PROJ-123] passthrough 신규 태깅
feature/OPS-9 태깅 안 함 없음 (OPS 미등록) 동일
feature/12-ABC-34 [#12] 양쪽 매칭, rules 우선 동일
feature/wip 태깅 안 함 없음 동일
main 커밋 차단 protect 동일

키 인식 규칙

<PROJECT>-<NUMBER>를 브랜치 이름 어디서든 찾습니다. PROJECT는 대문자 2자 이상([A-Z][A-Z0-9]+), NUMBER는 1~7자리 숫자. Jigit과 동일한 규칙이므로 commithelper가 태깅하는 키는 Jigit에서도 같은 방식으로 링크됩니다.

passthrough: ["PROJ"] 기준:

브랜치 태깅 이유
PROJ-123 [PROJ-123] 순수 키
feature_PROJ-123 [PROJ-123] 키 앞 문자 무관, 어디서든 인식
PROJ-123-add-login [PROJ-123] 숫자 뒤 suffix 무시
PROJ-123-20260101 [PROJ-123] -<숫자>(날짜) suffix도 무시
PROJ-12345678 태깅 안 함 숫자 8자리 이상
PROJ/123 태깅 안 함 키는 - 사용, 슬래시 형태는 rules prefix 영역
PROJ_123 태깅 안 함 프로젝트와 숫자는 -로 이어야 함
proj-123 태깅 안 함 프로젝트는 대문자
OPS-123 태깅 안 함 미등록 프로젝트

동작 변경: 재태깅 판단 기준

--amend나 훅 재실행 시 태그 중복([#123] [#123] fix)을 막기 위한 "이미 태깅됨" 검사의 기준을 바꿉니다: ISSUE_TAGGING_REGEXalreadyHasRef.

  • 기존: 메시지에 […#숫자] 형태가 하나라도 있으면 건너뜁니다. #을 요구해 [PROJ-1871] 같은 하이픈 키를 인식하지 못하고, 다른 이슈의 태그([#999])가 이 브랜치의 태그 추가를 막습니다.
  • 변경: 이 브랜치에서 붙일 참조가 메시지에 이미 있는지만 확인합니다.

브랜치 feature/123(붙일 참조 #123) 기준:

들어온 메시지 기존 변경 후
[#123] fix 건너뜀 건너뜀
[#999] fix 건너뜀 [#123] 추가 → [#123] [#999] fix
fixes #123 [#123] 추가 건너뜀 (본문의 참조도 태깅으로 간주)
fix [#123] 추가 [#123] 추가
  • 2행(다른 이슈 태그가 더 이상 차단하지 않음)과 3행(본문에 이미 있는 참조를 태깅된 것으로 간주)이 동작 변경입니다. 판단 기준이 "임의의 대괄호 태그 존재"에서 "이 브랜치 참조의 존재"로 바뀌었습니니다
  • --amend·재실행에서 같은 태그를 중복으로 붙이지 않는 보장은 이전과 동일합니다.

테스트

  • resolveKey: Jigit 규칙을 미러링한 인식 테이블 + 엣지 케이스
  • alreadyHasRef: 위 재태깅 판단 케이스
  • getCommitMessageByBranchName: end-to-end

Reflect the passthrough / verbatim-key rules from @naverpay/commithelper-go
into the original @naverpay/commit-helper.

- passthrough: verbatim Jira/Linear keys (feature/PROJ-1871 -> [PROJ-1871]),
  Jigit key recognition (<KEY>-<1-7 digit number>, anywhere in the branch),
  allowlist-only so tokens like UTF-8 are never mistaken for issues.
- reference-specific idempotency (alreadyHasRef) replacing the old any-tag
  ISSUE_TAGGING_REGEX gate; safe on git commit --amend / hook re-run,
  including verbatim keys like [PROJ-1871].
- hybrid casing: preserve branch case so uppercase keys are recognized;
  rules lookup and protect matching stay case-insensitive.

BREAKING: idempotency is now reference-specific -- a tag for a different
issue no longer suppresses tagging ([#123] [#999] ...). Major bump via
changeset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@djk01281 djk01281 self-assigned this Jul 1, 2026
@npayfebot

npayfebot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ Changeset detected

Latest commit: 31cb20a

@naverpay/commit-helper package have detected changes.

If no version change is needed, please add skip-detect-change to the label.

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@naverpay/commit-helper 💥 Major
powered by: naverpay changeset detect-add actions

@djk01281

djk01281 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

/canary-publish

@npayfebot

Copy link
Copy Markdown
Contributor

Published Canary Packages

@naverpay/commit-helper@2.0.0-canary.260701-c0c01ef

@djk01281 djk01281 marked this pull request as ready for review July 2, 2026 00:25
@djk01281 djk01281 requested a review from a team as a code owner July 2, 2026 00:25

@boxersb boxersb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kyungmi kyungmi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go 버전(commithelper-go)에서 포팅한 passthrough 로직이 resolveKey, alreadyHasRef, 우선순위 처리 전부 충실하게 반영되어 있습니다.

  • resolveKeyalreadyHasRef → 우선순위(rules > passthrough) 모두 Go 구현체와 동작 일치 확인
  • 재태깅 기준 변경(ISSUE_TAGGING_REGEXalreadyHasRef)에 대한 behavior-change lock 테스트 포함된 점 좋았습니다
  • changeset major bump 근거도 PR 설명에 명확히 정리되어 있어 리뷰하기 수월했습니다

@djk01281 djk01281 merged commit 68e5aef into main Jul 2, 2026
4 checks passed
@djk01281 djk01281 deleted the feature/76 branch July 2, 2026 02:29
@djk01281

djk01281 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

감사합니다! 🙇🏻🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[commit-helper-go] 대문자 패턴 인식 가능 옵션 추가

4 participants