@kood/claude-code 0.2.5 → 0.3.1

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 (130) hide show
  1. package/dist/index.js +13 -8
  2. package/package.json +1 -1
  3. package/templates/.claude/agents/code-reviewer.md +371 -19
  4. package/templates/.claude/agents/dependency-manager.md +197 -0
  5. package/templates/.claude/agents/deployment-validator.md +136 -0
  6. package/templates/.claude/agents/git-operator.md +147 -0
  7. package/templates/.claude/agents/implementation-executor.md +202 -0
  8. package/templates/.claude/agents/lint-fixer.md +155 -0
  9. package/templates/.claude/agents/refactor-advisor.md +339 -29
  10. package/templates/.claude/commands/agent-creator.md +355 -0
  11. package/templates/.claude/commands/docs-creator.md +404 -163
  12. package/templates/.claude/commands/docs-refactor.md +400 -113
  13. package/templates/.claude/commands/execute.md +357 -185
  14. package/templates/.claude/commands/git-all.md +65 -71
  15. package/templates/.claude/commands/git-session.md +80 -64
  16. package/templates/.claude/commands/git.md +68 -72
  17. package/templates/.claude/commands/lint-fix.md +224 -109
  18. package/templates/.claude/commands/lint-init.md +142 -168
  19. package/templates/.claude/commands/plan.md +300 -84
  20. package/templates/.claude/commands/prd.md +497 -214
  21. package/templates/.claude/commands/pre-deploy.md +242 -0
  22. package/templates/.claude/commands/subagent-creator.md +118 -0
  23. package/templates/.claude/commands/version-update.md +45 -57
  24. package/templates/hono/CLAUDE.md +99 -54
  25. package/templates/hono/docs/guides/conventions.md +352 -0
  26. package/templates/hono/docs/guides/env-setup.md +347 -0
  27. package/templates/hono/docs/guides/getting-started.md +239 -0
  28. package/templates/hono/docs/library/hono/error-handling.md +20 -29
  29. package/templates/hono/docs/library/hono/index.md +25 -52
  30. package/templates/hono/docs/library/hono/middleware.md +16 -75
  31. package/templates/hono/docs/library/hono/rpc.md +7 -35
  32. package/templates/hono/docs/library/hono/validation.md +25 -45
  33. package/templates/hono/docs/library/t3-env/index.md +374 -0
  34. package/templates/npx/CLAUDE.md +165 -65
  35. package/templates/npx/docs/library/commander/index.md +10 -73
  36. package/templates/npx/docs/library/fs-extra/index.md +21 -113
  37. package/templates/npx/docs/library/prompts/index.md +30 -176
  38. package/templates/npx/docs/references/patterns.md +75 -48
  39. package/templates/tanstack-start/CLAUDE.md +101 -77
  40. package/templates/tanstack-start/docs/architecture.md +427 -0
  41. package/templates/tanstack-start/docs/design.md +558 -0
  42. package/templates/tanstack-start/docs/guides/conventions.md +132 -32
  43. package/templates/tanstack-start/docs/guides/env-setup.md +127 -62
  44. package/templates/tanstack-start/docs/guides/getting-started.md +81 -20
  45. package/templates/tanstack-start/docs/guides/hooks.md +241 -36
  46. package/templates/tanstack-start/docs/guides/routes.md +213 -61
  47. package/templates/tanstack-start/docs/guides/services.md +260 -24
  48. package/templates/tanstack-start/docs/library/better-auth/index.md +469 -16
  49. package/templates/tanstack-start/docs/library/t3-env/index.md +307 -0
  50. package/templates/tanstack-start/docs/library/tanstack-query/index.md +12 -21
  51. package/templates/tanstack-start/docs/library/tanstack-query/invalidation.md +22 -35
  52. package/templates/tanstack-start/docs/library/tanstack-query/optimistic-updates.md +7 -24
  53. package/templates/tanstack-start/docs/library/tanstack-query/use-mutation.md +26 -39
  54. package/templates/tanstack-start/docs/library/tanstack-query/use-query.md +23 -26
  55. package/templates/tanstack-start/docs/library/tanstack-router/error-handling.md +32 -147
  56. package/templates/tanstack-start/docs/library/tanstack-router/hooks.md +25 -167
  57. package/templates/tanstack-start/docs/library/tanstack-router/index.md +39 -74
  58. package/templates/tanstack-start/docs/library/tanstack-router/navigation.md +46 -116
  59. package/templates/tanstack-start/docs/library/tanstack-router/route-context.md +35 -154
  60. package/templates/tanstack-start/docs/library/tanstack-router/search-params.md +32 -171
  61. package/templates/tanstack-start/docs/library/tanstack-start/auth-patterns.md +7 -15
  62. package/templates/tanstack-start/docs/library/tanstack-start/routing.md +16 -23
  63. package/templates/tanstack-start/docs/library/zod/complex-types.md +12 -31
  64. package/templates/tanstack-start/docs/library/zod/index.md +18 -35
  65. package/templates/tanstack-start/docs/library/zod/transforms.md +11 -25
  66. package/templates/tanstack-start/docs/library/zod/validation.md +12 -34
  67. package/templates/.claude/agents/debug-detective.md +0 -37
  68. package/templates/.claude/agents/test-writer.md +0 -41
  69. package/templates/.claude/commands/feedback.md +0 -199
  70. package/templates/.claude/commands/ts-fix.md +0 -176
  71. package/templates/.claude/skills/command-creator/LICENSE.txt +0 -202
  72. package/templates/.claude/skills/command-creator/SKILL.md +0 -245
  73. package/templates/.claude/skills/command-creator/scripts/init_command.py +0 -244
  74. package/templates/.claude/skills/command-creator/scripts/package_command.py +0 -125
  75. package/templates/.claude/skills/command-creator/scripts/quick_validate.py +0 -143
  76. package/templates/.claude/skills/frontend-design/SKILL.md +0 -310
  77. package/templates/.claude/skills/frontend-design/references/animation-patterns.md +0 -446
  78. package/templates/.claude/skills/frontend-design/references/colors-2026.md +0 -244
  79. package/templates/.claude/skills/frontend-design/references/typography-2026.md +0 -302
  80. package/templates/.claude/skills/gemini-review/SKILL.md +0 -118
  81. package/templates/.claude/skills/gemini-review/references/checklists.md +0 -129
  82. package/templates/.claude/skills/gemini-review/references/prompt-templates.md +0 -274
  83. package/templates/.claude/skills/skill-creator/LICENSE.txt +0 -202
  84. package/templates/.claude/skills/skill-creator/SKILL.md +0 -184
  85. package/templates/.claude/skills/skill-creator/scripts/init_skill.py +0 -303
  86. package/templates/.claude/skills/skill-creator/scripts/package_skill.py +0 -110
  87. package/templates/.claude/skills/skill-creator/scripts/quick_validate.py +0 -65
  88. package/templates/hono/docs/library/ai-sdk/index.md +0 -190
  89. package/templates/hono/docs/library/ai-sdk/openrouter.md +0 -111
  90. package/templates/hono/docs/library/ai-sdk/providers.md +0 -102
  91. package/templates/hono/docs/library/ai-sdk/streaming.md +0 -146
  92. package/templates/hono/docs/library/ai-sdk/structured-output.md +0 -161
  93. package/templates/hono/docs/library/ai-sdk/tools.md +0 -144
  94. package/templates/hono/docs/library/drizzle/cloudflare-d1.md +0 -247
  95. package/templates/hono/docs/library/drizzle/config.md +0 -167
  96. package/templates/hono/docs/library/drizzle/index.md +0 -259
  97. package/templates/hono/docs/library/hono/env-setup.md +0 -169
  98. package/templates/hono/docs/library/pino/index.md +0 -146
  99. package/templates/tanstack-start/docs/architecture/architecture.md +0 -243
  100. package/templates/tanstack-start/docs/deployment/cloudflare.md +0 -132
  101. package/templates/tanstack-start/docs/deployment/index.md +0 -163
  102. package/templates/tanstack-start/docs/deployment/nitro.md +0 -110
  103. package/templates/tanstack-start/docs/deployment/railway.md +0 -147
  104. package/templates/tanstack-start/docs/deployment/vercel.md +0 -135
  105. package/templates/tanstack-start/docs/design/components.md +0 -175
  106. package/templates/tanstack-start/docs/design/index.md +0 -151
  107. package/templates/tanstack-start/docs/design/safe-area.md +0 -118
  108. package/templates/tanstack-start/docs/design/tailwind-setup.md +0 -156
  109. package/templates/tanstack-start/docs/library/ai-sdk/hooks.md +0 -472
  110. package/templates/tanstack-start/docs/library/ai-sdk/index.md +0 -264
  111. package/templates/tanstack-start/docs/library/ai-sdk/openrouter.md +0 -371
  112. package/templates/tanstack-start/docs/library/ai-sdk/providers.md +0 -403
  113. package/templates/tanstack-start/docs/library/ai-sdk/streaming.md +0 -320
  114. package/templates/tanstack-start/docs/library/ai-sdk/structured-output.md +0 -454
  115. package/templates/tanstack-start/docs/library/ai-sdk/tools.md +0 -473
  116. package/templates/tanstack-start/docs/library/better-auth/2fa.md +0 -48
  117. package/templates/tanstack-start/docs/library/better-auth/advanced.md +0 -55
  118. package/templates/tanstack-start/docs/library/better-auth/plugins.md +0 -34
  119. package/templates/tanstack-start/docs/library/better-auth/session.md +0 -47
  120. package/templates/tanstack-start/docs/library/better-auth/setup.md +0 -41
  121. package/templates/tanstack-start/docs/library/drizzle/cloudflare-d1.md +0 -147
  122. package/templates/tanstack-start/docs/library/drizzle/config.md +0 -118
  123. package/templates/tanstack-start/docs/library/drizzle/crud.md +0 -205
  124. package/templates/tanstack-start/docs/library/drizzle/index.md +0 -79
  125. package/templates/tanstack-start/docs/library/drizzle/relations.md +0 -202
  126. package/templates/tanstack-start/docs/library/drizzle/schema.md +0 -154
  127. package/templates/tanstack-start/docs/library/drizzle/setup.md +0 -96
  128. package/templates/tanstack-start/docs/library/drizzle/transactions.md +0 -127
  129. package/templates/tanstack-start/docs/library/pino/index.md +0 -320
  130. /package/templates/hono/docs/{architecture/architecture.md → architecture.md} +0 -0
@@ -1,8 +1,8 @@
1
- # Commander.js 가이드
1
+ # Commander.js
2
2
 
3
3
  > Node.js CLI 프레임워크
4
4
 
5
- ---
5
+ <patterns>
6
6
 
7
7
  ## 기본 설정
8
8
 
@@ -19,51 +19,38 @@ program
19
19
  program.parse();
20
20
  ```
21
21
 
22
- ---
23
-
24
22
  ## Options
25
23
 
26
- ### 기본 옵션
27
24
  ```typescript
25
+ // 기본
28
26
  program
29
27
  .option('-t, --template <name>', 'template name')
30
28
  .option('-f, --force', 'force overwrite')
31
- .option('-v, --verbose', 'verbose output')
32
29
  .action((options) => {
33
30
  console.log(options.template); // string | undefined
34
31
  console.log(options.force); // boolean | undefined
35
32
  });
36
- ```
37
33
 
38
- ### 필수 옵션
39
- ```typescript
34
+ // 필수
40
35
  program
41
36
  .requiredOption('-c, --config <path>', 'config file path')
42
37
  .action((options) => {
43
38
  // options.config는 항상 존재
44
39
  });
45
- ```
46
40
 
47
- ### 기본값
48
- ```typescript
41
+ // 기본값
49
42
  program
50
43
  .option('-p, --port <number>', 'port number', '3000')
51
44
  .option('-e, --env <name>', 'environment', 'development')
52
- ```
53
45
 
54
- ### 여러 값 수집
55
- ```typescript
46
+ // 여러 값
56
47
  program
57
48
  .option('-i, --include <path...>', 'include paths')
58
49
  .action((options) => {
59
50
  console.log(options.include); // string[]
60
51
  });
61
-
62
- // 사용: --include src lib tests
63
52
  ```
64
53
 
65
- ---
66
-
67
54
  ## Arguments
68
55
 
69
56
  ```typescript
@@ -76,8 +63,6 @@ program
76
63
  });
77
64
  ```
78
65
 
79
- ---
80
-
81
66
  ## Subcommands
82
67
 
83
68
  ```typescript
@@ -86,22 +71,17 @@ program
86
71
  .description('Initialize project')
87
72
  .option('-t, --template <name>', 'template')
88
73
  .action((options) => {
89
- // init 명령어 처리
74
+ // init 처리
90
75
  });
91
76
 
92
77
  program
93
78
  .command('build')
94
79
  .description('Build project')
95
80
  .action(() => {
96
- // build 명령어 처리
81
+ // build 처리
97
82
  });
98
-
99
- // 사용: my-cli init --template react
100
- // 사용: my-cli build
101
83
  ```
102
84
 
103
- ---
104
-
105
85
  ## Async Action
106
86
 
107
87
  ```typescript
@@ -115,50 +95,7 @@ program
115
95
  }
116
96
  });
117
97
 
118
- // await 필요
119
- await program.parseAsync();
120
- ```
121
-
122
- ---
123
-
124
- ## Help 커스터마이징
125
-
126
- ```typescript
127
- program
128
- .addHelpText('beforeAll', 'Custom header')
129
- .addHelpText('afterAll', 'Custom footer');
98
+ await program.parseAsync(); // await 필수
130
99
  ```
131
100
 
132
- ---
133
-
134
- ## 전체 예시
135
-
136
- ```typescript
137
- #!/usr/bin/env node
138
- import { Command } from 'commander';
139
-
140
- const program = new Command();
141
-
142
- program
143
- .name('my-cli')
144
- .description('My awesome CLI tool')
145
- .version('1.0.0');
146
-
147
- program
148
- .option('-t, --template <name>', 'template name')
149
- .option('-f, --force', 'overwrite existing files')
150
- .option('--cwd <path>', 'working directory', process.cwd())
151
- .action(async (options) => {
152
- const { template, force, cwd } = options;
153
-
154
- try {
155
- // 실행 로직
156
- await init({ template, force, cwd });
157
- } catch (error) {
158
- console.error('Error:', error.message);
159
- process.exit(1);
160
- }
161
- });
162
-
163
- program.parse();
164
- ```
101
+ </patterns>
@@ -1,136 +1,50 @@
1
- # fs-extra 가이드
1
+ # fs-extra
2
2
 
3
- > Node.js 파일 시스템 유틸리티 (fs 확장)
3
+ > Node.js 파일 시스템 유틸리티
4
4
 
5
- ---
6
-
7
- ## 기본 Import
5
+ <patterns>
8
6
 
9
7
  ```typescript
10
8
  import fs from 'fs-extra';
11
9
  import path from 'path';
12
- ```
13
-
14
- ---
15
10
 
16
- ## 파일/디렉토리 존재 확인
17
-
18
- ```typescript
19
11
  // 존재 확인
20
12
  const exists = await fs.pathExists('/path/to/file');
21
13
 
22
- if (await fs.pathExists(targetDir)) {
23
- // 이미 존재
24
- }
25
- ```
26
-
27
- ---
28
-
29
- ## 디렉토리 생성
30
-
31
- ```typescript
32
- // 재귀적 생성 (mkdir -p)
14
+ // 디렉토리 생성
33
15
  await fs.ensureDir('/path/to/nested/dir');
34
-
35
- // 단일 생성
36
16
  await fs.mkdir('/path/to/dir');
37
- ```
38
17
 
39
- ---
40
-
41
- ## 파일/디렉토리 복사
42
-
43
- ```typescript
44
- // 파일 복사
18
+ // 복사
45
19
  await fs.copy('/src/file.txt', '/dest/file.txt');
46
-
47
- // 디렉토리 복사 (재귀)
48
20
  await fs.copy('/src/dir', '/dest/dir');
49
-
50
- // 옵션
51
21
  await fs.copy(src, dest, {
52
- overwrite: true, // 덮어쓰기 (기본: true)
53
- errorOnExist: false, // 존재 시 에러 (기본: false)
54
- filter: (src) => { // 필터링
55
- return !src.includes('node_modules');
56
- },
22
+ overwrite: true,
23
+ errorOnExist: false,
24
+ filter: (src) => !src.includes('node_modules'),
57
25
  });
58
- ```
59
26
 
60
- ---
61
-
62
- ## 파일/디렉토리 삭제
63
-
64
- ```typescript
65
- // 삭제 (rm -rf)
27
+ // 삭제
66
28
  await fs.remove('/path/to/dir');
67
29
 
68
- // 디렉토리만 삭제
69
- await fs.rmdir('/path/to/empty-dir');
70
- ```
71
-
72
- ---
73
-
74
- ## 디렉토리 읽기
75
-
76
- ```typescript
77
- // 파일/폴더 목록
30
+ // 디렉토리 읽기
78
31
  const items = await fs.readdir('/path/to/dir');
79
- // ['file1.txt', 'folder1', 'file2.txt']
80
-
81
- // stat으로 타입 확인
82
- for (const item of items) {
83
- const itemPath = path.join(dir, item);
84
- const stat = await fs.stat(itemPath);
85
-
86
- if (stat.isDirectory()) {
87
- // 디렉토리
88
- } else {
89
- // 파일
90
- }
91
- }
92
- ```
93
32
 
94
- ---
33
+ // 파일 타입 확인
34
+ const stat = await fs.stat(itemPath);
35
+ if (stat.isDirectory()) { /* ... */ }
36
+ if (stat.isFile()) { /* ... */ }
95
37
 
96
- ## 파일 읽기/쓰기
97
-
98
- ```typescript
99
- // 읽기
38
+ // 파일 읽기/쓰기
100
39
  const content = await fs.readFile('/path/to/file', 'utf-8');
101
-
102
- // 쓰기
103
40
  await fs.writeFile('/path/to/file', content, 'utf-8');
104
41
 
105
- // JSON 읽기
42
+ // JSON
106
43
  const data = await fs.readJson('/path/to/file.json');
107
-
108
- // JSON 쓰기
109
44
  await fs.writeJson('/path/to/file.json', data, { spaces: 2 });
110
- ```
111
-
112
- ---
113
-
114
- ## 파일 정보
115
-
116
- ```typescript
117
- const stat = await fs.stat('/path/to/file');
118
45
 
119
- stat.isFile(); // 파일 여부
120
- stat.isDirectory(); // 디렉토리 여부
121
- stat.size; // 파일 크기 (bytes)
122
- stat.mtime; // 수정 시간
123
- ```
124
-
125
- ---
126
-
127
- ## 재귀 복사 패턴
128
-
129
- ```typescript
130
- const copyRecursive = async (
131
- src: string,
132
- dest: string,
133
- ): Promise<{ files: number; directories: number }> => {
46
+ // 재귀 복사
47
+ const copyRecursive = async (src: string, dest: string) => {
134
48
  const counter = { files: 0, directories: 0 };
135
49
 
136
50
  const copy = async (s: string, d: string): Promise<void> => {
@@ -153,19 +67,13 @@ const copyRecursive = async (
153
67
  await copy(src, dest);
154
68
  return counter;
155
69
  };
156
- ```
157
70
 
158
- ---
159
-
160
- ## ESM에서 __dirname 사용
161
-
162
- ```typescript
71
+ // ESM __dirname
163
72
  import { fileURLToPath } from 'url';
164
- import path from 'path';
165
73
 
166
74
  const __filename = fileURLToPath(import.meta.url);
167
75
  const __dirname = path.dirname(__filename);
168
-
169
- // 사용
170
76
  const templatesDir = path.resolve(__dirname, '../templates');
171
77
  ```
78
+
79
+ </patterns>
@@ -1,95 +1,56 @@
1
- # prompts 가이드
1
+ # prompts
2
2
 
3
3
  > Interactive CLI prompts
4
4
 
5
- ---
6
-
7
- ## 기본 Import
5
+ <patterns>
8
6
 
9
7
  ```typescript
10
8
  import prompts from 'prompts';
11
- ```
12
-
13
- ---
14
9
 
15
- ## Text Input
16
-
17
- ```typescript
18
- const response = await prompts({
10
+ // Text
11
+ const { name } = await prompts({
19
12
  type: 'text',
20
13
  name: 'name',
21
14
  message: 'What is your name?',
22
15
  initial: 'Anonymous',
23
16
  });
24
17
 
25
- console.log(response.name);
26
- ```
27
-
28
- ---
29
-
30
- ## Confirm (Yes/No)
31
-
32
- ```typescript
33
- const response = await prompts({
18
+ // Confirm
19
+ const { confirmed } = await prompts({
34
20
  type: 'confirm',
35
21
  name: 'confirmed',
36
22
  message: 'Continue?',
37
23
  initial: true,
38
24
  });
39
25
 
40
- if (response.confirmed) {
41
- // Yes
42
- }
43
- ```
44
-
45
- ---
46
-
47
- ## Select (단일 선택)
48
-
49
- ```typescript
50
- const response = await prompts({
26
+ // Select
27
+ const { template } = await prompts({
51
28
  type: 'select',
52
29
  name: 'template',
53
30
  message: 'Select a template:',
54
31
  choices: [
55
32
  { title: 'React', description: 'React framework', value: 'react' },
56
33
  { title: 'Vue', description: 'Vue framework', value: 'vue' },
57
- { title: 'Angular', description: 'Angular framework', value: 'angular' },
58
34
  ],
59
- initial: 0, // 첫 번째 선택
35
+ initial: 0,
60
36
  });
61
37
 
62
- console.log(response.template); // 'react' | 'vue' | 'angular'
63
- ```
64
-
65
- ---
66
-
67
- ## Multiselect (다중 선택)
68
-
69
- ```typescript
70
- const response = await prompts({
38
+ // Multiselect
39
+ const { features } = await prompts({
71
40
  type: 'multiselect',
72
41
  name: 'features',
73
42
  message: 'Select features:',
74
43
  choices: [
75
44
  { title: 'TypeScript', value: 'typescript', selected: true },
76
45
  { title: 'ESLint', value: 'eslint' },
77
- { title: 'Prettier', value: 'prettier' },
78
46
  ],
79
- min: 1, // 최소 1개 선택
80
- max: 5, // 최대 5개 선택
47
+ min: 1,
48
+ max: 5,
81
49
  hint: '- Space to select. Return to submit',
82
50
  });
83
51
 
84
- console.log(response.features); // ['typescript', 'eslint']
85
- ```
86
-
87
- ---
88
-
89
- ## Number Input
90
-
91
- ```typescript
92
- const response = await prompts({
52
+ // Number
53
+ const { port } = await prompts({
93
54
  type: 'number',
94
55
  name: 'port',
95
56
  message: 'Port number?',
@@ -98,105 +59,42 @@ const response = await prompts({
98
59
  max: 65535,
99
60
  });
100
61
 
101
- console.log(response.port); // number
102
- ```
103
-
104
- ---
105
-
106
- ## Password Input
107
-
108
- ```typescript
109
- const response = await prompts({
62
+ // Password
63
+ const { secret } = await prompts({
110
64
  type: 'password',
111
65
  name: 'secret',
112
66
  message: 'Enter password:',
113
67
  });
114
68
 
115
- console.log(response.secret);
116
- ```
117
-
118
- ---
119
-
120
- ## 취소 처리
69
+ // 취소 처리
70
+ const { template } = await prompts({ /* ... */ });
121
71
 
122
- ```typescript
123
- const response = await prompts({
124
- type: 'select',
125
- name: 'template',
126
- message: 'Select:',
127
- choices: [...],
128
- });
129
-
130
- // Ctrl+C 또는 ESC 시 undefined
131
- if (!response.template) {
72
+ if (!template) {
132
73
  console.log('Operation cancelled.');
133
74
  process.exit(0);
134
75
  }
135
- ```
136
-
137
- ---
138
76
 
139
- ## 연속 질문
140
-
141
- ```typescript
77
+ // 연속 질문
142
78
  const response = await prompts([
143
- {
144
- type: 'text',
145
- name: 'name',
146
- message: 'Project name?',
147
- },
148
- {
149
- type: 'select',
150
- name: 'template',
151
- message: 'Template?',
152
- choices: [...],
153
- },
154
- {
155
- type: 'confirm',
156
- name: 'git',
157
- message: 'Initialize git?',
158
- },
79
+ { type: 'text', name: 'name', message: 'Project name?' },
80
+ { type: 'select', name: 'template', message: 'Template?', choices: [...] },
81
+ { type: 'confirm', name: 'git', message: 'Initialize git?' },
159
82
  ]);
160
83
 
161
- console.log(response.name);
162
- console.log(response.template);
163
- console.log(response.git);
164
- ```
165
-
166
- ---
167
-
168
- ## 조건부 질문
169
-
170
- ```typescript
84
+ // 조건부 질문
171
85
  const response = await prompts([
172
- {
173
- type: 'confirm',
174
- name: 'useTypescript',
175
- message: 'Use TypeScript?',
176
- },
177
- {
178
- type: (prev) => prev ? 'confirm' : null, // 이전 답변이 true일 때만
179
- name: 'strict',
180
- message: 'Enable strict mode?',
181
- },
86
+ { type: 'confirm', name: 'useTypescript', message: 'Use TypeScript?' },
87
+ { type: (prev) => prev ? 'confirm' : null, name: 'strict', message: 'Enable strict mode?' },
182
88
  ]);
183
- ```
184
-
185
- ---
186
-
187
- ## Autocomplete
188
89
 
189
- ```typescript
190
- const response = await prompts({
90
+ // Autocomplete
91
+ const { package } = await prompts({
191
92
  type: 'autocomplete',
192
93
  name: 'package',
193
94
  message: 'Search package:',
194
95
  choices: [
195
96
  { title: 'react' },
196
- { title: 'react-dom' },
197
- { title: 'react-router' },
198
97
  { title: 'vue' },
199
- { title: 'angular' },
200
98
  ],
201
99
  suggest: (input, choices) => {
202
100
  return choices.filter((c) =>
@@ -206,48 +104,4 @@ const response = await prompts({
206
104
  });
207
105
  ```
208
106
 
209
- ---
210
-
211
- ## 전체 예시
212
-
213
- ```typescript
214
- import prompts from 'prompts';
215
-
216
- const run = async () => {
217
- // 템플릿 선택
218
- const { templates } = await prompts({
219
- type: 'multiselect',
220
- name: 'templates',
221
- message: 'Select templates (space to select):',
222
- choices: [
223
- { title: 'Hono', value: 'hono' },
224
- { title: 'TanStack Start', value: 'tanstack-start' },
225
- ],
226
- min: 1,
227
- hint: '- Space to select. Return to submit',
228
- });
229
-
230
- if (!templates || templates.length === 0) {
231
- console.log('Cancelled.');
232
- process.exit(0);
233
- }
234
-
235
- // 덮어쓰기 확인
236
- const { overwrite } = await prompts({
237
- type: 'confirm',
238
- name: 'overwrite',
239
- message: 'Files exist. Overwrite?',
240
- initial: false,
241
- });
242
-
243
- if (!overwrite) {
244
- console.log('Cancelled.');
245
- process.exit(0);
246
- }
247
-
248
- // 실행
249
- console.log('Selected:', templates);
250
- };
251
-
252
- run();
253
- ```
107
+ </patterns>