rulesync 0.19.0 → 0.20.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/dist/index.js +11 -17
- package/dist/index.mjs +11 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -116,32 +116,24 @@ function generateClaudeMarkdown(rootRules, detailRules) {
|
|
|
116
116
|
if (detailRules.length > 0) {
|
|
117
117
|
lines.push("Please also reference the following documents as needed:");
|
|
118
118
|
lines.push("");
|
|
119
|
+
lines.push("| Document | Description | File Patterns |");
|
|
120
|
+
lines.push("|----------|-------------|---------------|");
|
|
119
121
|
for (const rule of detailRules) {
|
|
120
|
-
|
|
122
|
+
const globsText = rule.frontmatter.globs.length > 0 ? rule.frontmatter.globs.join(", ") : "-";
|
|
123
|
+
lines.push(
|
|
124
|
+
`| @.claude/memories/${rule.filename}.md | ${rule.frontmatter.description} | ${globsText} |`
|
|
125
|
+
);
|
|
121
126
|
}
|
|
122
127
|
lines.push("");
|
|
123
128
|
}
|
|
124
|
-
lines.push("# Claude Code Memory - Project Instructions");
|
|
125
|
-
lines.push("");
|
|
126
|
-
lines.push(
|
|
127
|
-
"Generated from rulesync configuration. These instructions guide Claude Code's behavior for this project."
|
|
128
|
-
);
|
|
129
|
-
lines.push("");
|
|
130
129
|
if (rootRules.length > 0) {
|
|
131
130
|
for (const rule of rootRules) {
|
|
132
|
-
lines.push(
|
|
131
|
+
lines.push(rule.content);
|
|
132
|
+
lines.push("");
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
return lines.join("\n");
|
|
136
136
|
}
|
|
137
|
-
function formatRuleForClaude(rule) {
|
|
138
|
-
const lines = [];
|
|
139
|
-
lines.push(`### ${rule.frontmatter.description}`);
|
|
140
|
-
lines.push("");
|
|
141
|
-
lines.push(rule.content);
|
|
142
|
-
lines.push("");
|
|
143
|
-
return lines;
|
|
144
|
-
}
|
|
145
137
|
function generateMemoryFile(rule) {
|
|
146
138
|
return rule.content.trim();
|
|
147
139
|
}
|
|
@@ -385,7 +377,9 @@ ${errors.join("\n")}`);
|
|
|
385
377
|
const rootRules = rules.filter((rule) => rule.frontmatter.root);
|
|
386
378
|
if (rootRules.length > 1) {
|
|
387
379
|
const rootRuleFiles = rootRules.map((rule) => rule.filepath).join(", ");
|
|
388
|
-
throw new Error(
|
|
380
|
+
throw new Error(
|
|
381
|
+
`Multiple root rules found: ${rootRuleFiles}. Only one rule can have root: true.`
|
|
382
|
+
);
|
|
389
383
|
}
|
|
390
384
|
return rules;
|
|
391
385
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -93,32 +93,24 @@ function generateClaudeMarkdown(rootRules, detailRules) {
|
|
|
93
93
|
if (detailRules.length > 0) {
|
|
94
94
|
lines.push("Please also reference the following documents as needed:");
|
|
95
95
|
lines.push("");
|
|
96
|
+
lines.push("| Document | Description | File Patterns |");
|
|
97
|
+
lines.push("|----------|-------------|---------------|");
|
|
96
98
|
for (const rule of detailRules) {
|
|
97
|
-
|
|
99
|
+
const globsText = rule.frontmatter.globs.length > 0 ? rule.frontmatter.globs.join(", ") : "-";
|
|
100
|
+
lines.push(
|
|
101
|
+
`| @.claude/memories/${rule.filename}.md | ${rule.frontmatter.description} | ${globsText} |`
|
|
102
|
+
);
|
|
98
103
|
}
|
|
99
104
|
lines.push("");
|
|
100
105
|
}
|
|
101
|
-
lines.push("# Claude Code Memory - Project Instructions");
|
|
102
|
-
lines.push("");
|
|
103
|
-
lines.push(
|
|
104
|
-
"Generated from rulesync configuration. These instructions guide Claude Code's behavior for this project."
|
|
105
|
-
);
|
|
106
|
-
lines.push("");
|
|
107
106
|
if (rootRules.length > 0) {
|
|
108
107
|
for (const rule of rootRules) {
|
|
109
|
-
lines.push(
|
|
108
|
+
lines.push(rule.content);
|
|
109
|
+
lines.push("");
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
return lines.join("\n");
|
|
113
113
|
}
|
|
114
|
-
function formatRuleForClaude(rule) {
|
|
115
|
-
const lines = [];
|
|
116
|
-
lines.push(`### ${rule.frontmatter.description}`);
|
|
117
|
-
lines.push("");
|
|
118
|
-
lines.push(rule.content);
|
|
119
|
-
lines.push("");
|
|
120
|
-
return lines;
|
|
121
|
-
}
|
|
122
114
|
function generateMemoryFile(rule) {
|
|
123
115
|
return rule.content.trim();
|
|
124
116
|
}
|
|
@@ -362,7 +354,9 @@ ${errors.join("\n")}`);
|
|
|
362
354
|
const rootRules = rules.filter((rule) => rule.frontmatter.root);
|
|
363
355
|
if (rootRules.length > 1) {
|
|
364
356
|
const rootRuleFiles = rootRules.map((rule) => rule.filepath).join(", ");
|
|
365
|
-
throw new Error(
|
|
357
|
+
throw new Error(
|
|
358
|
+
`Multiple root rules found: ${rootRuleFiles}. Only one rule can have root: true.`
|
|
359
|
+
);
|
|
366
360
|
}
|
|
367
361
|
return rules;
|
|
368
362
|
}
|
package/package.json
CHANGED