@kood/claude-code 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/index.js +17 -31
  2. package/package.json +1 -1
  3. package/templates/.claude/commands/feedback.md +189 -0
  4. package/templates/npx/docs/commands/docs-creator.md +0 -239
  5. package/templates/npx/docs/commands/docs-refactor.md +0 -168
  6. package/templates/npx/docs/commands/git-all.md +0 -83
  7. package/templates/npx/docs/commands/git-session.md +0 -91
  8. package/templates/npx/docs/commands/git.md +0 -86
  9. package/templates/npx/docs/commands/lint-fix.md +0 -170
  10. package/templates/npx/docs/commands/lint-init.md +0 -300
  11. package/templates/npx/docs/commands/ts-fix.md +0 -176
  12. package/templates/npx/docs/skills/command-creator/LICENSE.txt +0 -202
  13. package/templates/npx/docs/skills/command-creator/SKILL.md +0 -245
  14. package/templates/npx/docs/skills/command-creator/scripts/init_command.py +0 -244
  15. package/templates/npx/docs/skills/command-creator/scripts/package_command.py +0 -125
  16. package/templates/npx/docs/skills/command-creator/scripts/quick_validate.py +0 -143
  17. package/templates/npx/docs/skills/skill-creator/LICENSE.txt +0 -202
  18. package/templates/npx/docs/skills/skill-creator/SKILL.md +0 -184
  19. package/templates/npx/docs/skills/skill-creator/scripts/init_skill.py +0 -303
  20. package/templates/npx/docs/skills/skill-creator/scripts/package_skill.py +0 -110
  21. package/templates/npx/docs/skills/skill-creator/scripts/quick_validate.py +0 -65
  22. package/templates/tanstack-start/docs/commands/docs-creator.md +0 -239
  23. package/templates/tanstack-start/docs/commands/docs-refactor.md +0 -168
  24. package/templates/tanstack-start/docs/commands/git-all.md +0 -83
  25. package/templates/tanstack-start/docs/commands/git-session.md +0 -91
  26. package/templates/tanstack-start/docs/commands/git.md +0 -86
  27. package/templates/tanstack-start/docs/commands/lint-fix.md +0 -170
  28. package/templates/tanstack-start/docs/commands/lint-init.md +0 -300
  29. package/templates/tanstack-start/docs/commands/ts-fix.md +0 -176
  30. package/templates/tanstack-start/docs/skills/command-creator/LICENSE.txt +0 -202
  31. package/templates/tanstack-start/docs/skills/command-creator/SKILL.md +0 -245
  32. package/templates/tanstack-start/docs/skills/command-creator/scripts/init_command.py +0 -244
  33. package/templates/tanstack-start/docs/skills/command-creator/scripts/package_command.py +0 -125
  34. package/templates/tanstack-start/docs/skills/command-creator/scripts/quick_validate.py +0 -143
  35. package/templates/tanstack-start/docs/skills/skill-creator/LICENSE.txt +0 -202
  36. package/templates/tanstack-start/docs/skills/skill-creator/SKILL.md +0 -184
  37. package/templates/tanstack-start/docs/skills/skill-creator/scripts/init_skill.py +0 -303
  38. package/templates/tanstack-start/docs/skills/skill-creator/scripts/package_skill.py +0 -110
  39. package/templates/tanstack-start/docs/skills/skill-creator/scripts/quick_validate.py +0 -65
  40. /package/templates/{hono/docs → .claude}/commands/docs-creator.md +0 -0
  41. /package/templates/{hono/docs → .claude}/commands/docs-refactor.md +0 -0
  42. /package/templates/{hono/docs → .claude}/commands/git-all.md +0 -0
  43. /package/templates/{hono/docs → .claude}/commands/git-session.md +0 -0
  44. /package/templates/{hono/docs → .claude}/commands/git.md +0 -0
  45. /package/templates/{hono/docs → .claude}/commands/lint-fix.md +0 -0
  46. /package/templates/{hono/docs → .claude}/commands/lint-init.md +0 -0
  47. /package/templates/{hono/docs → .claude}/commands/ts-fix.md +0 -0
  48. /package/templates/{hono/docs → .claude}/skills/command-creator/LICENSE.txt +0 -0
  49. /package/templates/{hono/docs → .claude}/skills/command-creator/SKILL.md +0 -0
  50. /package/templates/{hono/docs → .claude}/skills/command-creator/scripts/init_command.py +0 -0
  51. /package/templates/{hono/docs → .claude}/skills/command-creator/scripts/package_command.py +0 -0
  52. /package/templates/{hono/docs → .claude}/skills/command-creator/scripts/quick_validate.py +0 -0
  53. /package/templates/{hono/docs → .claude}/skills/skill-creator/LICENSE.txt +0 -0
  54. /package/templates/{hono/docs → .claude}/skills/skill-creator/SKILL.md +0 -0
  55. /package/templates/{hono/docs → .claude}/skills/skill-creator/scripts/init_skill.py +0 -0
  56. /package/templates/{hono/docs → .claude}/skills/skill-creator/scripts/package_skill.py +0 -0
  57. /package/templates/{hono/docs → .claude}/skills/skill-creator/scripts/quick_validate.py +0 -0
@@ -1,202 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
@@ -1,245 +0,0 @@
1
- ---
2
- name: command-creator
3
- description: 슬래시 커맨드 생성 가이드. 새 커맨드를 만들거나 기존 커맨드를 수정할 때 사용. (project)
4
- license: Complete terms in LICENSE.txt
5
- ---
6
-
7
- # Command Creator
8
-
9
- Claude Code 확장을 위한 슬래시 커맨드 생성 가이드.
10
-
11
- ## 커맨드 개요
12
-
13
- 커맨드는 재사용 가능한 프롬프트 단축키. `/command-name`으로 호출.
14
-
15
- ### 커맨드 제공 요소
16
-
17
- | 요소 | 설명 |
18
- |------|------|
19
- | 재사용 프롬프트 | 슬래시 커맨드로 트리거 |
20
- | 도구 권한 | 워크플로우별 사전 설정 |
21
- | 인수 지원 | 호출 시 동적 값 전달 |
22
- | 컨텍스트 주입 | 파일 또는 셸 출력 자동 포함 |
23
-
24
- ### 커맨드 vs 스킬
25
-
26
- | 특성 | 커맨드 | 스킬 |
27
- |------|--------|------|
28
- | 구조 | 단일 `.md` 파일 | `SKILL.md` + 번들 리소스 |
29
- | 복잡도 | 간단한 프롬프트 | 다단계 워크플로우 |
30
- | 리소스 | 없음 | scripts, references, assets |
31
- | 용도 | 빠른 단축키 | 도메인 전문성 |
32
-
33
- ### 커맨드 구조
34
-
35
- ```
36
- command-name.md
37
- ├── YAML frontmatter (선택)
38
- │ ├── description: (권장)
39
- │ ├── allowed-tools: (선택)
40
- │ ├── argument-hint: (선택)
41
- │ ├── model: (선택)
42
- │ └── disable-model-invocation: (선택)
43
- └── Markdown 지침 (필수)
44
- ```
45
-
46
- ### 파일 위치
47
-
48
- | 위치 | 경로 | 범위 |
49
- |------|------|------|
50
- | 프로젝트 | `.claude/commands/` | git으로 팀 공유 |
51
- | 개인 | `~/.claude/commands/` | 개인 전용 |
52
-
53
- 이름 충돌 시 프로젝트 커맨드 우선.
54
-
55
- ### Frontmatter 필드
56
-
57
- | 필드 | 목적 | 기본값 |
58
- |------|------|--------|
59
- | `description` | 설명 (/help에 표시) | 첫 줄 |
60
- | `allowed-tools` | 허용 도구 | 대화 상속 |
61
- | `argument-hint` | 인수 힌트 (자동완성) | 없음 |
62
- | `model` | 사용 모델 | 대화 상속 |
63
- | `disable-model-invocation` | SlashCommand 도구 사용 방지 | false |
64
-
65
- ### 명명 규칙
66
-
67
- - 파일명 = 커맨드명: `security-check.md` → `/security-check`
68
- - hyphen-case (소문자, 숫자, 하이픈만)
69
- - 최대 40자 권장
70
-
71
- ## 생성 프로세스
72
-
73
- ### 1단계: 목적 파악
74
-
75
- 질문:
76
- - "어떤 작업을 자동화하나?"
77
- - "어떤 인수가 필요하나?"
78
- - "어떤 도구를 허용해야 하나?"
79
- - "프로젝트용인가 개인용인가?"
80
-
81
- **좋은 예시**: `/review-security`, `/commit-fix`, `/add-tests`, `/explain-error`
82
-
83
- ### 2단계: 구조 계획
84
-
85
- | 요소 | 설명 |
86
- |------|------|
87
- | 인수 | `$ARGUMENTS` (전체), `$1`, `$2` (위치별) |
88
- | 도구 | `Bash(git:*)`, `Read`, `Write`, `Edit` 등 |
89
- | 컨텍스트 | `@filepath` (파일), `` `command` `` (셸 출력) |
90
-
91
- ### 3단계: 초기화
92
-
93
- ```bash
94
- scripts/init_command.py <command-name> --path <output-directory>
95
- ```
96
-
97
- 옵션: `--project` (기본), `--personal`
98
-
99
- ### 4단계: 편집
100
-
101
- **작성 스타일**: 명령형 사용 ("코드 검토" ← "코드를 검토해 주세요" ❌)
102
-
103
- **예시 패턴**:
104
-
105
- 인수 사용:
106
- ```markdown
107
- ---
108
- description: 커밋 생성
109
- argument-hint: <type> <message>
110
- allowed-tools: Bash(git add:*), Bash(git commit:*)
111
- ---
112
-
113
- 타입 "$1", 메시지 "$2"로 커밋 생성.
114
- 형식: <type>: <message>
115
- ```
116
-
117
- 파일 컨텍스트:
118
- ```markdown
119
- ---
120
- description: 보안 검토
121
- allowed-tools: Read
122
- ---
123
-
124
- 보안 취약점 검토:
125
- @$ARGUMENTS
126
-
127
- 체크: SQL 인젝션, XSS, 민감 데이터 노출
128
- ```
129
-
130
- 셸 출력:
131
- ```markdown
132
- ---
133
- description: git 상태 설명
134
- allowed-tools: Bash(git:*)
135
- ---
136
-
137
- 현재 상태:
138
- !`git status`
139
-
140
- 최근 커밋:
141
- !`git log --oneline -5`
142
-
143
- 저장소 상태 설명.
144
- ```
145
-
146
- ### 5단계: 패키징
147
-
148
- ```bash
149
- scripts/package_command.py <path/to/commands-folder> [output-directory]
150
- ```
151
-
152
- ### 6단계: 반복
153
-
154
- 사용 → 문제 발견 → 수정 → 재테스트
155
-
156
- ## Subagent 활용
157
-
158
- 커맨드 생성 시 subagent를 활용하여 메인 컨텍스트 보호.
159
-
160
- ### 활용 시점
161
-
162
- ```
163
- 1. Explore agent → 기존 커맨드 패턴 분석
164
- 2. Explore agent → 관련 워크플로우 파악
165
- 3. Plan agent → 커맨드 구조 설계
166
- 4. 메인 에이전트 → 설계 기반 작성
167
- ```
168
-
169
- ### 프롬프트 예시
170
-
171
- ```
172
- Explore agent에게:
173
- "프로젝트의 기존 커맨드들을 분석하고 보고해줘:
174
- - 커맨드 목록 및 용도
175
- - 공통 패턴 (인수, 도구 권한)
176
- - 네임스페이스 구조"
177
- ```
178
-
179
- ```
180
- Plan agent에게:
181
- "새 커맨드 구조 설계:
182
- - 목적 및 사용 시나리오
183
- - 필요 인수
184
- - 허용 도구
185
- - 컨텍스트 주입 방식"
186
- ```
187
-
188
- ## 빠른 참조
189
-
190
- ### 인수 문법
191
-
192
- | 문법 | 설명 | 예시 |
193
- |------|------|------|
194
- | `$ARGUMENTS` | 전체 인수 | `/cmd foo bar` → `foo bar` |
195
- | `$1`, `$2` | 위치 인수 | `/cmd foo bar` → `$1=foo`, `$2=bar` |
196
-
197
- ### 컨텍스트 주입
198
-
199
- | 문법 | 설명 |
200
- |------|------|
201
- | `@filepath` | 파일 내용 포함 |
202
- | `` `command` `` | 셸 출력 포함 |
203
-
204
- ### 도구 패턴
205
-
206
- | 패턴 | 설명 |
207
- |------|------|
208
- | `Bash(git:*)` | 모든 git 명령 |
209
- | `Bash(npm:*)` | 모든 npm 명령 |
210
- | `Read`, `Write`, `Edit` | 파일 작업 |
211
- | `WebFetch` | 웹 콘텐츠 가져오기 |
212
-
213
- ### 네임스페이싱
214
-
215
- 하위 디렉토리로 구성:
216
- - `.claude/commands/frontend/component.md` → `/component` (project:frontend)
217
- - `.claude/commands/backend/test.md` → `/test` (project:backend)
218
-
219
- ## 체크리스트
220
-
221
- ### 계획 단계
222
-
223
- - [ ] 목적 명확히 정의
224
- - [ ] 필요 인수 파악
225
- - [ ] 허용 도구 결정
226
- - [ ] 프로젝트/개인 범위 결정
227
-
228
- ### 작성 단계
229
-
230
- - [ ] 명령형 작성
231
- - [ ] description 추가
232
- - [ ] 인수 힌트 설정 (필요 시)
233
- - [ ] 도구 권한 최소화
234
- - [ ] 컨텍스트 주입 설정
235
-
236
- ### 검증 단계
237
-
238
- - [ ] 다양한 인수로 테스트
239
- - [ ] 권한 오류 확인
240
- - [ ] 팀 공유 시 git 커밋
241
-
242
- ## 참조
243
-
244
- - [Claude Code Commands](https://docs.anthropic.com/en/docs/claude-code/slash-commands)
245
- - [Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices)
@@ -1,244 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- 커맨드 초기화 스크립트 - 템플릿에서 새 슬래시 커맨드 생성
4
-
5
- 사용법:
6
- init_command.py <커맨드명> --path <경로>
7
- init_command.py <커맨드명> --project
8
- init_command.py <커맨드명> --personal
9
-
10
- 예시:
11
- init_command.py review-security --path .claude/commands
12
- init_command.py commit-fix --project
13
- init_command.py my-helper --personal
14
- """
15
-
16
- import sys
17
- import os
18
- from pathlib import Path
19
-
20
-
21
- COMMAND_TEMPLATE = """---
22
- description: [TODO: 커맨드가 하는 일에 대한 간단한 설명]
23
- allowed-tools: [TODO: 필요한 도구 목록, 예: Bash(git:*), Read, Write]
24
- argument-hint: [TODO: 예상 인자, 예: <file> <type>]
25
- ---
26
-
27
- # {command_title}
28
-
29
- [TODO: 여기에 커맨드 지시사항 작성]
30
-
31
- ## 예시 패턴
32
-
33
- ### 인자 사용하기
34
-
35
- 모든 인자를 단일 문자열로:
36
- ```
37
- 다음을 처리하세요: $ARGUMENTS
38
- ```
39
-
40
- 위치 인자:
41
- ```
42
- $1 파일을 $2 우선순위로 검토하세요
43
- ```
44
-
45
- ### 컨텍스트 포함하기
46
-
47
- 파일 내용:
48
- ```
49
- @$1 의 코드를 검토하세요
50
- ```
51
-
52
- 셸 출력:
53
- ```
54
- 현재 상태: !`git status`
55
- ```
56
-
57
- ### 일반적인 지시사항
58
-
59
- [TODO: 실제 커맨드 지시사항으로 대체. 예시:]
60
-
61
- **코드 리뷰용:**
62
- ```
63
- 다음 코드를 검토하세요:
64
- - 보안 취약점
65
- - 성능 이슈
66
- - 코드 스타일 위반
67
-
68
- @$ARGUMENTS
69
- ```
70
-
71
- **커밋 생성용:**
72
- ```
73
- 다음 형식으로 git 커밋 생성:
74
- - 타입: $1
75
- - 메시지: $2
76
-
77
- 컨벤셔널 커밋 형식을 따르세요.
78
- ```
79
-
80
- **테스트 생성용:**
81
- ```
82
- @$1 의 코드에 대한 유닛 테스트 생성
83
-
84
- 포함할 것:
85
- - 엣지 케이스
86
- - 에러 처리
87
- - 해피 패스 시나리오
88
- ```
89
-
90
- ---
91
-
92
- 이 템플릿 내용을 삭제하고 위에 실제 커맨드 지시사항을 작성하세요.
93
- """
94
-
95
- SIMPLE_TEMPLATE = """---
96
- description: {description}
97
- allowed-tools: {tools}
98
- argument-hint: {hint}
99
- ---
100
-
101
- {instructions}
102
- """
103
-
104
-
105
- def title_case_command_name(command_name):
106
- """하이픈으로 구분된 커맨드명을 Title Case로 변환."""
107
- return ' '.join(word.capitalize() for word in command_name.split('-'))
108
-
109
-
110
- def get_project_commands_path():
111
- """프로젝트 커맨드 디렉토리 경로 반환."""
112
- return Path.cwd() / '.claude' / 'commands'
113
-
114
-
115
- def get_personal_commands_path():
116
- """개인 커맨드 디렉토리 경로 반환."""
117
- return Path.home() / '.claude' / 'commands'
118
-
119
-
120
- def init_command(command_name, path):
121
- """
122
- 템플릿으로 새 커맨드 파일 초기화.
123
-
124
- Args:
125
- command_name: 커맨드 이름 (.md 확장자 제외)
126
- path: 커맨드 파일이 생성될 경로
127
-
128
- Returns:
129
- 생성된 커맨드 파일 경로, 오류 시 None
130
- """
131
- # 커맨드명 검증
132
- if not command_name:
133
- print("❌ 오류: 커맨드 이름이 필요합니다")
134
- return None
135
-
136
- # .md 확장자 제거
137
- if command_name.endswith('.md'):
138
- command_name = command_name[:-3]
139
-
140
- # 이름 규칙 검증
141
- import re
142
- if not re.match(r'^[a-z0-9-]+$', command_name):
143
- print(f"❌ 오류: 커맨드 이름 '{command_name}'은 하이픈-케이스여야 합니다")
144
- print(" (소문자, 숫자, 하이픈만 허용)")
145
- return None
146
-
147
- if command_name.startswith('-') or command_name.endswith('-') or '--' in command_name:
148
- print(f"❌ 오류: 커맨드 이름 '{command_name}'은 하이픈으로 시작/끝나거나")
149
- print(" 연속된 하이픈을 포함할 수 없습니다")
150
- return None
151
-
152
- if len(command_name) > 40:
153
- print(f"❌ 오류: 커맨드 이름 '{command_name}'이 40자를 초과합니다")
154
- return None
155
-
156
- # 커맨드 파일 경로 결정
157
- command_dir = Path(path).resolve()
158
- command_file = command_dir / f'{command_name}.md'
159
-
160
- # 파일 존재 여부 확인
161
- if command_file.exists():
162
- print(f"❌ 오류: 커맨드 파일이 이미 존재합니다: {command_file}")
163
- return None
164
-
165
- # 필요시 디렉토리 생성
166
- try:
167
- command_dir.mkdir(parents=True, exist_ok=True)
168
- except Exception as e:
169
- print(f"❌ 오류: 디렉토리 생성 실패: {e}")
170
- return None
171
-
172
- # 템플릿에서 커맨드 파일 생성
173
- command_title = title_case_command_name(command_name)
174
- command_content = COMMAND_TEMPLATE.format(
175
- command_name=command_name,
176
- command_title=command_title
177
- )
178
-
179
- try:
180
- command_file.write_text(command_content)
181
- print(f"✅ 커맨드 파일 생성: {command_file}")
182
- except Exception as e:
183
- print(f"❌ 오류: 커맨드 파일 생성 실패: {e}")
184
- return None
185
-
186
- # 다음 단계 안내
187
- print(f"\n✅ 커맨드 '{command_name}' 초기화 완료!")
188
- print(f"\n사용법: /{command_name}")
189
- print("\n다음 단계:")
190
- print("1. 커맨드 파일을 편집하여 TODO 항목 완성")
191
- print("2. frontmatter의 description 업데이트")
192
- print("3. 템플릿 내용을 실제 지시사항으로 교체")
193
- print(f"4. 커맨드 테스트: /{command_name}")
194
-
195
- return command_file
196
-
197
-
198
- def main():
199
- if len(sys.argv) < 3:
200
- print("사용법: init_command.py <커맨드명> --path <경로>")
201
- print(" init_command.py <커맨드명> --project")
202
- print(" init_command.py <커맨드명> --personal")
203
- print("\n커맨드명 요구사항:")
204
- print(" - 하이픈-케이스 식별자 (예: 'review-security')")
205
- print(" - 소문자, 숫자, 하이픈만 허용")
206
- print(" - 최대 40자")
207
- print("\n예시:")
208
- print(" init_command.py review-security --path .claude/commands")
209
- print(" init_command.py commit-fix --project")
210
- print(" init_command.py my-helper --personal")
211
- sys.exit(1)
212
-
213
- command_name = sys.argv[1]
214
- option = sys.argv[2]
215
-
216
- # 옵션에 따라 경로 결정
217
- if option == '--project':
218
- path = get_project_commands_path()
219
- elif option == '--personal':
220
- path = get_personal_commands_path()
221
- elif option == '--path':
222
- if len(sys.argv) < 4:
223
- print("❌ 오류: --path는 디렉토리 인자가 필요합니다")
224
- sys.exit(1)
225
- path = sys.argv[3]
226
- else:
227
- print(f"❌ 오류: 알 수 없는 옵션 '{option}'")
228
- print("--path <경로>, --project, --personal 중 하나를 사용하세요")
229
- sys.exit(1)
230
-
231
- print(f"🚀 커맨드 초기화: {command_name}")
232
- print(f" 위치: {path}")
233
- print()
234
-
235
- result = init_command(command_name, path)
236
-
237
- if result:
238
- sys.exit(0)
239
- else:
240
- sys.exit(1)
241
-
242
-
243
- if __name__ == "__main__":
244
- main()