| name | reuse-governor-local |
| description | Use when adding or refactoring `naverworks-cli` commands or internals and you need to manage project-specific code reuse, helper extraction, duplication cleanup, or reuse exceptions. Reviews hotspot-heavy `cmd/` and `internal/` code, decides whether to reuse an existing helper, extract a new shared helper, keep logic local, or grant a time-bounded waiver, and records catalog/lifecycle/scorecard updates. If you only need build, test, deploy, release, version, profile, or commit workflows, use the existing project-local skills instead. |
naverworks ์ฌ์ฌ์ฉ ๊ฑฐ๋ฒ๋์ค
์ด ์ ์ฅ์๋ ์ด๋ฏธ ๊ณต์ฉ ํฌํผ๊ฐ ๋ง์๋ฐ๋ ๋๋ฉ์ธ๋ณ ๋ณด์ผ๋ฌํ๋ ์ดํธ๊ฐ ๋ค์ ์๊ธฐ๊ธฐ ์ฌ์. ์ด ์คํฌ์ ๊ณต์ฉํ๊ฐ ๋ง๋์ง, ๋ก์ปฌ ์ ์ง๊ฐ ๋ง๋์ง, ์์ธ๋ฅผ ์ค์ผ ํ๋์ง๋ฅผ ๋จผ์ ํ๋จํ๊ณ , ๊ทธ ๊ฒฐ์ ์ catalog, waiver, decision note, scorecard์ ๋จ๊ธฐ๊ฒ ํ๋ค.
์
์ถ๋ ฅ ๊ณ์ฝ
์
๋ ฅ
| ์
๋ ฅ | ํ์ ์ฌ๋ถ | ์ค๋ช
|
|---|
target_files | ํ์ | ๋ฐ๊พธ๋ ํ์ผ ๋๋ ํจํค์ง |
change_intent | ํ์ | ์ ์์ ํ๋์ง (์ ์ปค๋งจ๋, ์ค๋ณต ์ ๊ฑฐ, helper ์ถ์ถ, ์์ธ ์ ์ง ๋ฑ) |
scope | ์ ํ | cmd, internal, docs, mixed |
force_decision | ์ ํ | ์ด๋ฏธ ๋ฐฉํฅ์ด ์ ํด์ก๋ค๋ฉด reuse, extract, keep-local, waive ์ค ํ๋ |
์ถ๋ ฅ
| ํ๋ | ์ค๋ช
|
|---|
decision | reuse, extract, keep-local, waive ์ค ํ๋ |
reason | ๊ฒฐ์ ๊ทผ๊ฑฐ 1-3์ค |
existing_helper | ์ฌ์ฌ์ฉ ๋์ ๊ณต์ฉ ํฌํผ ๋๋ none |
follow_up | ํ์ ํ์ ์์
๋ชฉ๋ก |
records | ๊ฐฑ์ ํ catalog/waiver/decision/scorecard ํ์ผ |
์ฑ๊ณต ๊ธฐ์ค
- ๊ธฐ์กด ๊ณต์ฉ ํฌํผ๋ฅผ ๋จผ์ ๊ฒํ ํ๋ค.
- ๋ฌด์๋ฏธํ shared helper ์ฆ๊ฐ๋ฅผ ๋ง์๋ค.
- ์์ธ๋
owner, reason, expires_on ์์ด ๋จ๊ธฐ์ง ์์๋ค.
- ์ ๋ช
๋ น์ ์ถ๊ฐํ๋ฉด
cmd/smoke_test.go ๋ฐ์ ์ฌ๋ถ๋ฅผ ํจ๊ป ๊ฒํ ํ๋ค.
๊ธฐ๋ณธ ์์น
cmd/helpers.go, internal/api/client.go, internal/api/pagination.go, internal/fileutil/write.go ๊ฐ์ ๊ธฐ์กด ํฌํผ ์ถ๋ถํฐ ๋ณธ๋ค.
- ํ ๋ฒ๋ง ์ฐ๋ ์ถ์ํ๋ ๋์์ ๊ฐ๋ฆฌ๋ ์ถ์ํ๋ shared๋ก ์ฌ๋ฆฌ์ง ์๋๋ค.
- false positive๋ฅผ ํ์ฉํ๋ค. ๋ฐ๋ณต์ฒ๋ผ ๋ณด์ฌ๋ ๋ถ๊ธฐ ๊ตฌ์กฐ๊ฐ ๋ค๋ฅด๋ฉด
keep-local ๋๋ waive๊ฐ ๋ ๋ซ๋ค.
- hotspot๋ถํฐ ์ ๋ฆฌํ๋ค. ํนํ
cmd/directory.go, cmd/drive.go์ฒ๋ผ ํธ์ถ๋์ด ํฐ ํ์ผ์ ์ฐ์ ํ๋ค.
- ๊ณต์ฉํ๋ ์์ธ ๊ฒฐ์ ์ ๊ธฐ๋ก์ผ๋ก ๋จ๊ธด๋ค. "์ ์ด๋ ๊ฒ ํ๋์ง"๊ฐ ์์ผ๋ฉด ๋ค์ ๋ฆฌํฉํฐ์์ ๋ ๊ฐ์ ์ธ์ ๋ฐ๋ณต๋จ.
์คํ ์ ์ฐจ
1. Inventory
์๋๋ฅผ ๋จผ์ ํ์ธํ๋ค.
ํ์ํ๋ฉด scripts/reuse-scorecard.sh๋ก ํ์ฌ helper adoption๊ณผ hotspot์ ๋จผ์ ๋ฝ๋๋ค.
2. Classify
์ธ๋ถ ๊ท์น์ references/operating-model.md๋ฅผ ๋ฐ๋ฅธ๋ค.
| ์ํฉ | ๊ฒฐ์ |
|---|
| ๊ธฐ์กด helper๊ฐ ๋์/์
๋ ฅ ๊ตฌ์กฐ๋ฅผ ๊ฑฐ์ ๊ทธ๋๋ก ๋ฎ์ | reuse |
| ๋์ผ ํจํด์ด 2๊ฐ ์ด์์ด๊ณ shared๋ก ์ฌ๋ ค๋ ์๋ฏธ๊ฐ ์ ๋ช
ํจ | extract |
| ํธ์ถ๋ถ ํน์ ๋ถ๊ธฐ๋ ๋๋ฉ์ธ ๋ฌธ๋งฅ์ด ์ปค์ shared helper๊ฐ ์คํ๋ ค ํ๋ฆผ | keep-local |
| ์ง๊ธ์ ๊ณต์ฉํ๊ฐ ๊ณผํ๊ณ , ๋์ค์ ๋ค์ ๋ณผ ๊ฐ์น๊ฐ ์์ | waive |
3. Record
extract ๋๋ waive๋ฉด ๊ธฐ๋ก์ ๋จ๊ธด๋ค.
- data file ์คํค๋ง: references/data-files.md
- ํ
ํ๋ฆฟ asset:
assets/catalog.yaml, assets/waivers.yaml, assets/decision-template.md
๊ธฐ๋ก ๊ท์น:
extract: catalog ์ํธ๋ฆฌ ์ถ๊ฐ ๋๋ lifecycle ๊ฐฑ์
waive: waiver ์ํธ๋ฆฌ ์ถ๊ฐ, expires_on ํ์
- ํฐ ๊ฒฐ์ :
docs/reuse/decisions/YYYY-MM-DD-<topic>.md ์์ฑ
4. Enforce
๋ค์์ ๊ฐ์ด ์ ๊ฒํ๋ค.
- ์ command๋ฉด
cmd/smoke_test.go ๋ฑ๋ก ํ์ ์ฌ๋ถ
- ๊ธฐ์กด helper rename/์ญ์ ๋ฉด call-site ์ํฅ ๋ฒ์
deprecated helper๋ฉด replacement๊ฐ catalog์ ์๋์ง
- waiver๊ฐ ๋ง๋ฃ ์์ ์ด๋ฉด ์ด๋ฒ ๋ณ๊ฒฝ์์ ๊ฐ์ด ํด์ ๊ฐ๋ฅํ์ง
5. Verify
๋ณ๊ฒฝ ๋ฒ์์ ๋ง๊ฒ ์ต์ ๊ฒ์ฆ์ ๊ณ ๋ฅธ๋ค.
go test ./... -v
go vet ./...
- ํน์ ํจํค์ง ์ง์ค ํ
์คํธ
scripts/reuse-scorecard.sh ์ฌ์คํ
build/test/deploy ์์ฒด๊ฐ ๋ชฉ์ ์ด๋ฉด ์ด ์คํฌ๋ก ๊ณ์ ๋ฐ์ง ๋ง๊ณ ํด๋น ์ ์ฉ ์คํฌ๋ก ๋๊ธด๋ค.
์์
์ฐ์ถ๋ฌผ
์ฐ์ถ๋ฌผ ํ์์ ์๋์ฒ๋ผ ์งง๊ณ ๊ตฌ์กฐ์ ์ผ๋ก ๋จ๊ธด๋ค.
Decision: reuse
Existing helper: runListCmd
Reason: list pagination pattern matches current helper and avoids new closure boilerplate
Follow-up:
- addListFlags on the new list command
- verify smoke registration
Records:
- docs/reuse/catalog.yaml unchanged
- docs/reuse/waivers.yaml unchanged
๋๋
Decision: waive
Existing helper: runListCmd
Reason: folder-conditional branching makes generic list helper misleading
Follow-up:
- add waiver entry with owner and expiry
- revisit during next drive refactor
Records:
- docs/reuse/waivers.yaml
- docs/reuse/decisions/YYYY-MM-DD-drive-shared-folder-list.md
๋ฆฌ์์ค