@blastlabs/utils 1.16.0 → 1.17.0
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.
package/bin/init-ai-rules.cjs
CHANGED
|
@@ -94,10 +94,13 @@ function parseFrontmatter(content) {
|
|
|
94
94
|
const body = match[2];
|
|
95
95
|
|
|
96
96
|
const frontmatter = {};
|
|
97
|
+
let currentKey = null;
|
|
98
|
+
|
|
97
99
|
for (const line of yamlBlock.split("\n")) {
|
|
100
|
+
// 키-값 쌍 파싱
|
|
98
101
|
const kvMatch = line.match(/^(\w+):\s*(.*)$/);
|
|
99
102
|
if (kvMatch) {
|
|
100
|
-
|
|
103
|
+
currentKey = kvMatch[1];
|
|
101
104
|
let value = kvMatch[2].trim();
|
|
102
105
|
|
|
103
106
|
if (value === "true") value = true;
|
|
@@ -112,7 +115,18 @@ function parseFrontmatter(content) {
|
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
if (value !== undefined) {
|
|
115
|
-
frontmatter[
|
|
118
|
+
frontmatter[currentKey] = value;
|
|
119
|
+
}
|
|
120
|
+
} else if (line.startsWith(" -") && currentKey) {
|
|
121
|
+
// 배열 값 처리 (paths 등)
|
|
122
|
+
const arrayValueMatch = line.match(/^\s*-\s*"([^"]+)"\s*$/);
|
|
123
|
+
if (arrayValueMatch) {
|
|
124
|
+
const arrayValue = arrayValueMatch[1];
|
|
125
|
+
// 현재 키의 값이 배열이 아니면 배열로 초기화
|
|
126
|
+
if (!Array.isArray(frontmatter[currentKey])) {
|
|
127
|
+
frontmatter[currentKey] = [];
|
|
128
|
+
}
|
|
129
|
+
frontmatter[currentKey].push(arrayValue);
|
|
116
130
|
}
|
|
117
131
|
}
|
|
118
132
|
}
|
|
@@ -140,9 +154,16 @@ function serializeClaudeFrontmatter(frontmatter) {
|
|
|
140
154
|
if (frontmatter.description) {
|
|
141
155
|
yaml += `description: "${frontmatter.description}"\n`;
|
|
142
156
|
}
|
|
143
|
-
//
|
|
144
|
-
if (frontmatter.
|
|
145
|
-
|
|
157
|
+
// paths는 항상 적용되지 않는 경우에만 포함
|
|
158
|
+
if (frontmatter.paths && frontmatter.alwaysApply !== true) {
|
|
159
|
+
if (Array.isArray(frontmatter.paths)) {
|
|
160
|
+
yaml += "paths:\n";
|
|
161
|
+
for (const p of frontmatter.paths) {
|
|
162
|
+
yaml += ` - "${p}"\n`;
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
yaml += `paths:\n - "${frontmatter.paths}"\n`;
|
|
166
|
+
}
|
|
146
167
|
}
|
|
147
168
|
// alwaysApply는 Claude에서 사용하지 않으므로 생략
|
|
148
169
|
yaml += "---\n";
|
package/package.json
CHANGED
package/rules/entities-layer.md
CHANGED
package/rules/react-hooks.md
CHANGED
package/rules/shared-layer.md
CHANGED
package/rules/testing.md
CHANGED