rulesync 0.18.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 +15 -16
- package/dist/index.mjs +15 -16
- 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
|
}
|
|
@@ -382,6 +374,13 @@ async function parseRulesFromDirectory(aiRulesDir) {
|
|
|
382
374
|
throw new Error(`Validation errors found:
|
|
383
375
|
${errors.join("\n")}`);
|
|
384
376
|
}
|
|
377
|
+
const rootRules = rules.filter((rule) => rule.frontmatter.root);
|
|
378
|
+
if (rootRules.length > 1) {
|
|
379
|
+
const rootRuleFiles = rootRules.map((rule) => rule.filepath).join(", ");
|
|
380
|
+
throw new Error(
|
|
381
|
+
`Multiple root rules found: ${rootRuleFiles}. Only one rule can have root: true.`
|
|
382
|
+
);
|
|
383
|
+
}
|
|
385
384
|
return rules;
|
|
386
385
|
}
|
|
387
386
|
async function parseRuleFile(filepath) {
|
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
|
}
|
|
@@ -359,6 +351,13 @@ async function parseRulesFromDirectory(aiRulesDir) {
|
|
|
359
351
|
throw new Error(`Validation errors found:
|
|
360
352
|
${errors.join("\n")}`);
|
|
361
353
|
}
|
|
354
|
+
const rootRules = rules.filter((rule) => rule.frontmatter.root);
|
|
355
|
+
if (rootRules.length > 1) {
|
|
356
|
+
const rootRuleFiles = rootRules.map((rule) => rule.filepath).join(", ");
|
|
357
|
+
throw new Error(
|
|
358
|
+
`Multiple root rules found: ${rootRuleFiles}. Only one rule can have root: true.`
|
|
359
|
+
);
|
|
360
|
+
}
|
|
362
361
|
return rules;
|
|
363
362
|
}
|
|
364
363
|
async function parseRuleFile(filepath) {
|
package/package.json
CHANGED