@kood/claude-code 0.1.12 → 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,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()
@@ -1,125 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- 커맨드 패키저 - 커맨드 파일을 배포용 zip 파일로 생성
4
-
5
- 사용법:
6
- python package_command.py <commands-폴더-경로> [출력-디렉토리]
7
- python package_command.py <command.md-경로> [출력-디렉토리]
8
-
9
- 예시:
10
- python package_command.py .claude/commands
11
- python package_command.py .claude/commands ./dist
12
- python package_command.py .claude/commands/review-security.md
13
- """
14
-
15
- import sys
16
- import zipfile
17
- from pathlib import Path
18
- from quick_validate import validate_command, validate_commands_folder
19
-
20
-
21
- def package_commands(source_path, output_dir=None):
22
- """
23
- 커맨드 파일(들)을 zip 파일로 패키징.
24
-
25
- Args:
26
- source_path: 커맨드 파일 또는 커맨드 폴더 경로
27
- output_dir: zip 파일 출력 디렉토리 (선택)
28
-
29
- Returns:
30
- 생성된 zip 파일 경로, 오류 시 None
31
- """
32
- source_path = Path(source_path).resolve()
33
-
34
- # 소스 존재 확인
35
- if not source_path.exists():
36
- print(f"❌ 오류: 경로를 찾을 수 없음: {source_path}")
37
- return None
38
-
39
- # 단일 파일인지 폴더인지 확인
40
- is_folder = source_path.is_dir()
41
-
42
- # 패키징 전 검증
43
- print("🔍 커맨드 검증 중...")
44
-
45
- if is_folder:
46
- valid, results = validate_commands_folder(source_path)
47
- for name, v, message in results:
48
- status = "✅" if v else "❌"
49
- print(f" [{status}] {name}: {message}")
50
- if not valid:
51
- print("\n❌ 검증 실패. 패키징 전에 오류를 수정해주세요.")
52
- return None
53
- print(f"\n✅ 모든 {len(results)}개 커맨드 검증 완료.\n")
54
- else:
55
- valid, message = validate_command(source_path)
56
- if not valid:
57
- print(f" ❌ 검증 실패: {message}")
58
- print("\n패키징 전에 검증 오류를 수정해주세요.")
59
- return None
60
- print(f" ✅ {message}\n")
61
-
62
- # 출력 위치 결정
63
- if is_folder:
64
- zip_name = source_path.name
65
- else:
66
- zip_name = source_path.stem
67
-
68
- if output_dir:
69
- output_path = Path(output_dir).resolve()
70
- output_path.mkdir(parents=True, exist_ok=True)
71
- else:
72
- output_path = Path.cwd()
73
-
74
- zip_filename = output_path / f"{zip_name}-commands.zip"
75
-
76
- # zip 파일 생성
77
- try:
78
- with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:
79
- if is_folder:
80
- # 폴더의 모든 .md 파일 추가
81
- for md_file in source_path.glob('**/*.md'):
82
- arcname = md_file.relative_to(source_path.parent)
83
- zipf.write(md_file, arcname)
84
- print(f" 📦 추가: {arcname}")
85
- else:
86
- # 단일 파일 추가
87
- arcname = source_path.name
88
- zipf.write(source_path, arcname)
89
- print(f" 📦 추가: {arcname}")
90
-
91
- print(f"\n✅ 패키징 완료: {zip_filename}")
92
- return zip_filename
93
-
94
- except Exception as e:
95
- print(f"❌ zip 파일 생성 오류: {e}")
96
- return None
97
-
98
-
99
- def main():
100
- if len(sys.argv) < 2:
101
- print("사용법: python package_command.py <commands-경로> [출력-디렉토리]")
102
- print("\n예시:")
103
- print(" python package_command.py .claude/commands")
104
- print(" python package_command.py .claude/commands ./dist")
105
- print(" python package_command.py .claude/commands/review-security.md")
106
- sys.exit(1)
107
-
108
- source_path = sys.argv[1]
109
- output_dir = sys.argv[2] if len(sys.argv) > 2 else None
110
-
111
- print(f"📦 커맨드 패키징: {source_path}")
112
- if output_dir:
113
- print(f" 출력 디렉토리: {output_dir}")
114
- print()
115
-
116
- result = package_commands(source_path, output_dir)
117
-
118
- if result:
119
- sys.exit(0)
120
- else:
121
- sys.exit(1)
122
-
123
-
124
- if __name__ == "__main__":
125
- main()