@blastlabs/utils 1.15.1 → 1.15.2

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.
@@ -46,8 +46,8 @@ function parseArgs(args) {
46
46
  }
47
47
 
48
48
  function showHelp() {
49
- console.log("@blastlabs/utils - Cursor Rules Installer\n");
50
- console.log("프로젝트에 .cursor/rules/ 규칙 파일들을 설치합니다.\n");
49
+ console.log("@blastlabs/utils - AI Rules Installer (Cursor + Claude)\n");
50
+ console.log("프로젝트에 .cursor/rules/ CLAUDE.md를 설치합니다.\n");
51
51
  console.log("사용법: npx blastlabs-init-ai-rules [options]\n");
52
52
  console.log("Options:");
53
53
  console.log(" --fsd FSD 아키텍처 규칙 포함");
@@ -58,6 +58,9 @@ function showHelp() {
58
58
  console.log(" npx blastlabs-init-ai-rules # 기본 규칙만");
59
59
  console.log(" npx blastlabs-init-ai-rules --fsd # 기본 + FSD 규칙");
60
60
  console.log(" npx blastlabs-init-ai-rules --all # 모든 규칙");
61
+ console.log("\n생성되는 파일:");
62
+ console.log(" .cursor/rules/*.mdc - Cursor용 규칙 파일들");
63
+ console.log(" CLAUDE.md - Claude Code용 규칙 파일");
61
64
  console.log("\n⚠️ 프로젝트 루트 디렉토리에서 실행해주세요!");
62
65
  }
63
66
 
@@ -101,6 +104,41 @@ function copyRule(ruleName, sourceDir, targetDir) {
101
104
  return true;
102
105
  }
103
106
 
107
+ function extractMdcContent(filePath) {
108
+ // .mdc 파일에서 frontmatter 제거하고 내용만 추출
109
+ const content = fs.readFileSync(filePath, "utf-8");
110
+ const frontmatterMatch = content.match(/^---\n[\s\S]*?\n---\n/);
111
+ if (frontmatterMatch) {
112
+ return content.slice(frontmatterMatch[0].length).trim();
113
+ }
114
+ return content.trim();
115
+ }
116
+
117
+ function generateClaudeMd(ruleFiles, sourceDir, targetDir) {
118
+ const claudePath = path.join(targetDir, "CLAUDE.md");
119
+
120
+ if (fs.existsSync(claudePath)) {
121
+ console.log(" ⏭️ CLAUDE.md - 이미 존재함, 건너뜀");
122
+ return false;
123
+ }
124
+
125
+ let content = "# Project Development Rules\n\n";
126
+ content += "이 파일은 Claude Code를 위한 프로젝트 규칙입니다.\n\n";
127
+ content += "---\n\n";
128
+
129
+ for (const ruleName of ruleFiles) {
130
+ const sourcePath = path.join(sourceDir, ruleName);
131
+ if (fs.existsSync(sourcePath)) {
132
+ const ruleContent = extractMdcContent(sourcePath);
133
+ content += ruleContent + "\n\n---\n\n";
134
+ }
135
+ }
136
+
137
+ fs.writeFileSync(claudePath, content.trim() + "\n");
138
+ console.log(" ✅ CLAUDE.md");
139
+ return true;
140
+ }
141
+
104
142
  function main() {
105
143
  const args = process.argv.slice(2);
106
144
  const options = parseArgs(args);
@@ -156,19 +194,29 @@ function main() {
156
194
  }
157
195
  }
158
196
 
197
+ // CLAUDE.md 생성
198
+ console.log("\n📄 CLAUDE.md 생성 중...\n");
199
+ const claudeCreated = generateClaudeMd(rulesToInstall, rulesSourceDir, targetDir);
200
+ if (claudeCreated) {
201
+ installedCount++;
202
+ } else {
203
+ skippedCount++;
204
+ }
205
+
159
206
  console.log("\n" + "─".repeat(40));
160
207
  console.log(`\n✨ 완료! ${installedCount}개 설치, ${skippedCount}개 건너뜀`);
161
208
 
162
- console.log("\n📦 설치된 규칙 카테고리:");
209
+ console.log("\n📁 생성된 파일:");
210
+ console.log(" ├── .cursor/rules/*.mdc (Cursor용)");
211
+ console.log(" └── CLAUDE.md (Claude Code용)");
212
+
213
+ console.log("\n📦 포함된 규칙:");
163
214
  console.log(" ├── base (기본 규칙)");
164
215
  if (options.all || options.fsd) {
165
216
  console.log(" └── fsd (Feature-Sliced Design)");
166
217
  }
167
218
 
168
- console.log("\n💡 Tip:");
169
- console.log(" - 각 .mdc 파일의 globs 패턴에 따라 자동 적용됩니다");
170
- console.log(" - alwaysApply: true 규칙은 항상 적용됩니다");
171
- console.log(" - 프로젝트에 맞게 규칙을 수정하세요!");
219
+ console.log("\n💡 Tip: 프로젝트에 맞게 규칙 파일들을 수정하세요!");
172
220
  }
173
221
 
174
222
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blastlabs/utils",
3
- "version": "1.15.1",
3
+ "version": "1.15.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",