rulesync 0.29.0 → 0.32.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/README.ja.md +21 -9
- package/README.md +21 -9
- package/dist/index.js +23 -12
- package/dist/index.mjs +23 -12
- package/package.json +3 -1
package/README.ja.md
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
[](https://github.com/dyoshikawa/rulesync/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/rulesync)
|
|
5
5
|
|
|
6
|
-
統一されたAIルールファイル(`.rulesync/*.md`)から、様々なAI開発ツール用の設定ファイルを自動生成するNode.js CLI
|
|
6
|
+
統一されたAIルールファイル(`.rulesync/*.md`)から、様々なAI開発ツール用の設定ファイルを自動生成するNode.js CLIツールです。既存のAIツール設定を統一形式にインポートすることも可能です。
|
|
7
7
|
|
|
8
8
|
[English](./README.md) | **日本語**
|
|
9
9
|
|
|
10
10
|
## 対応ツール
|
|
11
11
|
|
|
12
|
+
rulesyncは以下のAI開発ツールの**生成**と**インポート**の両方をサポートしています:
|
|
13
|
+
|
|
12
14
|
- **GitHub Copilot Custom Instructions** (`.github/copilot-instructions.md` + `.github/instructions/*.instructions.md`)
|
|
13
|
-
- **Cursor Project Rules** (`.cursor/rules/*.mdc`)
|
|
14
|
-
- **Cline Rules** (`.clinerules/*.md`)
|
|
15
|
+
- **Cursor Project Rules** (`.cursor/rules/*.mdc` + `.cursorrules`)
|
|
16
|
+
- **Cline Rules** (`.clinerules/*.md` + `.cline/instructions.md`)
|
|
15
17
|
- **Claude Code Memory** (`./CLAUDE.md` + `.claude/memories/*.md`)
|
|
16
|
-
- **Roo Code Rules** (`.roo/rules/*.md`)
|
|
18
|
+
- **Roo Code Rules** (`.roo/rules/*.md` + `.roo/instructions.md`)
|
|
17
19
|
|
|
18
20
|
## インストール
|
|
19
21
|
|
|
@@ -53,11 +55,19 @@ yarn global add rulesync
|
|
|
53
55
|
|
|
54
56
|
### AIツール設定を持つ既存プロジェクト
|
|
55
57
|
|
|
56
|
-
既にAI
|
|
58
|
+
既にAIツールの設定がある場合、それらをrulesync形式にインポートできます:
|
|
57
59
|
|
|
58
60
|
1. **既存設定をインポート:**
|
|
59
61
|
```bash
|
|
62
|
+
# 複数のツールから一度にインポート
|
|
60
63
|
npx rulesync import --claudecode --cursor --copilot
|
|
64
|
+
|
|
65
|
+
# または特定のツールからインポート
|
|
66
|
+
npx rulesync import --claudecode # CLAUDE.mdと.claude/memories/*.mdから
|
|
67
|
+
npx rulesync import --cursor # .cursorrulesと.cursor/rules/*.mdcから
|
|
68
|
+
npx rulesync import --copilot # .github/copilot-instructions.mdから
|
|
69
|
+
npx rulesync import --cline # .cline/instructions.mdから
|
|
70
|
+
npx rulesync import --roo # .roo/instructions.mdから
|
|
61
71
|
```
|
|
62
72
|
|
|
63
73
|
2. **`.rulesync/`ディレクトリのインポートされたルールを確認・編集**
|
|
@@ -218,11 +228,13 @@ npx rulesync import --claudecode --verbose
|
|
|
218
228
|
```
|
|
219
229
|
|
|
220
230
|
importコマンドの動作:
|
|
221
|
-
-
|
|
222
|
-
-
|
|
223
|
-
-
|
|
224
|
-
- ファイル名の競合を避けるためツール固有のプレフィックスを使用(例:`
|
|
231
|
+
- カスタムパーサーを使用して各AIツールの既存設定ファイルをパース
|
|
232
|
+
- 適切なフロントマターメタデータを付けてrulesync形式に変換
|
|
233
|
+
- インポートしたコンテンツと適切なルール分類で新しい`.rulesync/*.md`ファイルを作成
|
|
234
|
+
- ファイル名の競合を避けるためツール固有のプレフィックスを使用(例:`claudecode-overview.md`、`cursor-custom-rules.md`)
|
|
225
235
|
- 競合が発生した場合はユニークなファイル名を生成
|
|
236
|
+
- YAMLフロントマター付きのCursorのMDCファイルなど複雑なフォーマットをサポート
|
|
237
|
+
- 複数ファイルのインポート(例:`.claude/memories/`ディレクトリのすべてのファイル)に対応
|
|
226
238
|
|
|
227
239
|
### 5. その他のコマンド
|
|
228
240
|
|
package/README.md
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
[](https://github.com/dyoshikawa/rulesync/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/rulesync)
|
|
5
5
|
|
|
6
|
-
A Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files (`.rulesync/*.md`).
|
|
6
|
+
A Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files (`.rulesync/*.md`). Also imports existing AI tool configurations into the unified format.
|
|
7
7
|
|
|
8
8
|
**English** | [日本語](./README.ja.md)
|
|
9
9
|
|
|
10
10
|
## Supported Tools
|
|
11
11
|
|
|
12
|
+
rulesync supports both **generation** and **import** for the following AI development tools:
|
|
13
|
+
|
|
12
14
|
- **GitHub Copilot Custom Instructions** (`.github/copilot-instructions.md` + `.github/instructions/*.instructions.md`)
|
|
13
|
-
- **Cursor Project Rules** (`.cursor/rules/*.mdc`)
|
|
14
|
-
- **Cline Rules** (`.clinerules/*.md`)
|
|
15
|
+
- **Cursor Project Rules** (`.cursor/rules/*.mdc` + `.cursorrules`)
|
|
16
|
+
- **Cline Rules** (`.clinerules/*.md` + `.cline/instructions.md`)
|
|
15
17
|
- **Claude Code Memory** (`./CLAUDE.md` + `.claude/memories/*.md`)
|
|
16
|
-
- **Roo Code Rules** (`.roo/rules/*.md`)
|
|
18
|
+
- **Roo Code Rules** (`.roo/rules/*.md` + `.roo/instructions.md`)
|
|
17
19
|
|
|
18
20
|
## Installation
|
|
19
21
|
|
|
@@ -53,11 +55,19 @@ yarn global add rulesync
|
|
|
53
55
|
|
|
54
56
|
### Existing Project with AI Tool Configurations
|
|
55
57
|
|
|
56
|
-
If you already have AI tool configurations, you can import them:
|
|
58
|
+
If you already have AI tool configurations, you can import them into rulesync format:
|
|
57
59
|
|
|
58
60
|
1. **Import existing configurations:**
|
|
59
61
|
```bash
|
|
62
|
+
# Import from multiple tools at once
|
|
60
63
|
npx rulesync import --claudecode --cursor --copilot
|
|
64
|
+
|
|
65
|
+
# Or import from specific tools
|
|
66
|
+
npx rulesync import --claudecode # From CLAUDE.md and .claude/memories/*.md
|
|
67
|
+
npx rulesync import --cursor # From .cursorrules and .cursor/rules/*.mdc
|
|
68
|
+
npx rulesync import --copilot # From .github/copilot-instructions.md
|
|
69
|
+
npx rulesync import --cline # From .cline/instructions.md
|
|
70
|
+
npx rulesync import --roo # From .roo/instructions.md
|
|
61
71
|
```
|
|
62
72
|
|
|
63
73
|
2. **Review and edit** the imported rules in `.rulesync/` directory
|
|
@@ -218,11 +228,13 @@ npx rulesync import --claudecode --verbose
|
|
|
218
228
|
```
|
|
219
229
|
|
|
220
230
|
The import command will:
|
|
221
|
-
- Parse existing configuration files from each AI tool
|
|
222
|
-
- Convert them to rulesync format with appropriate frontmatter
|
|
223
|
-
- Create new `.rulesync/*.md` files with imported content
|
|
224
|
-
- Use tool-specific prefixes to avoid filename conflicts (e.g., `
|
|
231
|
+
- Parse existing configuration files from each AI tool using custom parsers
|
|
232
|
+
- Convert them to rulesync format with appropriate frontmatter metadata
|
|
233
|
+
- Create new `.rulesync/*.md` files with imported content and proper rule categorization
|
|
234
|
+
- Use tool-specific prefixes to avoid filename conflicts (e.g., `claudecode-overview.md`, `cursor-custom-rules.md`)
|
|
225
235
|
- Generate unique filenames if conflicts occur
|
|
236
|
+
- Support complex formats like Cursor's MDC files with YAML frontmatter
|
|
237
|
+
- Handle multiple file imports (e.g., all files from `.claude/memories/` directory)
|
|
226
238
|
|
|
227
239
|
### 5. Other Commands
|
|
228
240
|
|
package/dist/index.js
CHANGED
|
@@ -435,7 +435,7 @@ function validateFrontmatter(data, filepath) {
|
|
|
435
435
|
`Invalid "targets" field in ${filepath}: must be an array, got ${typeof obj.targets}`
|
|
436
436
|
);
|
|
437
437
|
}
|
|
438
|
-
const validTargets = ["copilot", "cursor", "cline", "claude", "roo", "*"];
|
|
438
|
+
const validTargets = ["copilot", "cursor", "cline", "claude", "claudecode", "roo", "*"];
|
|
439
439
|
for (const target of obj.targets) {
|
|
440
440
|
if (typeof target !== "string" || !validTargets.includes(target)) {
|
|
441
441
|
throw new Error(
|
|
@@ -612,14 +612,6 @@ var gitignoreCommand = async () => {
|
|
|
612
612
|
const gitignorePath = (0, import_node_path9.join)(process.cwd(), ".gitignore");
|
|
613
613
|
const rulesFilesToIgnore = [
|
|
614
614
|
"# Generated by rulesync - AI tool configuration files",
|
|
615
|
-
".github/copilot-instructions.md",
|
|
616
|
-
".github/instructions/",
|
|
617
|
-
".cursor/rules/",
|
|
618
|
-
".clinerules/",
|
|
619
|
-
"CLAUDE.md",
|
|
620
|
-
".claude/memories/",
|
|
621
|
-
".roo/rules/",
|
|
622
|
-
"# Support for --base-dir option (any depth)",
|
|
623
615
|
"**/.github/copilot-instructions.md",
|
|
624
616
|
"**/.github/instructions/",
|
|
625
617
|
"**/.cursor/rules/",
|
|
@@ -854,6 +846,25 @@ async function parseCopilotConfiguration(baseDir = process.cwd()) {
|
|
|
854
846
|
// src/parsers/cursor.ts
|
|
855
847
|
var import_node_path13 = require("path");
|
|
856
848
|
var import_gray_matter3 = __toESM(require("gray-matter"));
|
|
849
|
+
var import_js_yaml = __toESM(require("js-yaml"));
|
|
850
|
+
var customMatterOptions = {
|
|
851
|
+
engines: {
|
|
852
|
+
yaml: {
|
|
853
|
+
parse: (str) => {
|
|
854
|
+
try {
|
|
855
|
+
const preprocessed = str.replace(/^(\s*globs:\s*)\*\s*$/gm, '$1"*"');
|
|
856
|
+
return import_js_yaml.default.load(preprocessed, { schema: import_js_yaml.default.DEFAULT_SCHEMA });
|
|
857
|
+
} catch (error) {
|
|
858
|
+
try {
|
|
859
|
+
return import_js_yaml.default.load(str, { schema: import_js_yaml.default.FAILSAFE_SCHEMA });
|
|
860
|
+
} catch {
|
|
861
|
+
throw error;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
};
|
|
857
868
|
async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
858
869
|
const errors = [];
|
|
859
870
|
const rules = [];
|
|
@@ -861,7 +872,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
861
872
|
if (await fileExists(cursorFilePath)) {
|
|
862
873
|
try {
|
|
863
874
|
const rawContent = await readFileContent(cursorFilePath);
|
|
864
|
-
const parsed = (0, import_gray_matter3.default)(rawContent);
|
|
875
|
+
const parsed = (0, import_gray_matter3.default)(rawContent, customMatterOptions);
|
|
865
876
|
const content = parsed.content.trim();
|
|
866
877
|
if (content) {
|
|
867
878
|
const frontmatter = {
|
|
@@ -892,7 +903,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
892
903
|
const filePath = (0, import_node_path13.join)(cursorRulesDir, file);
|
|
893
904
|
try {
|
|
894
905
|
const rawContent = await readFileContent(filePath);
|
|
895
|
-
const parsed = (0, import_gray_matter3.default)(rawContent);
|
|
906
|
+
const parsed = (0, import_gray_matter3.default)(rawContent, customMatterOptions);
|
|
896
907
|
const content = parsed.content.trim();
|
|
897
908
|
if (content) {
|
|
898
909
|
const filename = (0, import_node_path13.basename)(file, ".mdc");
|
|
@@ -1390,7 +1401,7 @@ async function watchCommand() {
|
|
|
1390
1401
|
|
|
1391
1402
|
// src/cli/index.ts
|
|
1392
1403
|
var program = new import_commander.Command();
|
|
1393
|
-
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.
|
|
1404
|
+
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.32.0");
|
|
1394
1405
|
program.command("init").description("Initialize rulesync in current directory").action(initCommand);
|
|
1395
1406
|
program.command("add <filename>").description("Add a new rule file").action(addCommand);
|
|
1396
1407
|
program.command("gitignore").description("Add generated files to .gitignore").action(gitignoreCommand);
|
package/dist/index.mjs
CHANGED
|
@@ -412,7 +412,7 @@ function validateFrontmatter(data, filepath) {
|
|
|
412
412
|
`Invalid "targets" field in ${filepath}: must be an array, got ${typeof obj.targets}`
|
|
413
413
|
);
|
|
414
414
|
}
|
|
415
|
-
const validTargets = ["copilot", "cursor", "cline", "claude", "roo", "*"];
|
|
415
|
+
const validTargets = ["copilot", "cursor", "cline", "claude", "claudecode", "roo", "*"];
|
|
416
416
|
for (const target of obj.targets) {
|
|
417
417
|
if (typeof target !== "string" || !validTargets.includes(target)) {
|
|
418
418
|
throw new Error(
|
|
@@ -589,14 +589,6 @@ var gitignoreCommand = async () => {
|
|
|
589
589
|
const gitignorePath = join7(process.cwd(), ".gitignore");
|
|
590
590
|
const rulesFilesToIgnore = [
|
|
591
591
|
"# Generated by rulesync - AI tool configuration files",
|
|
592
|
-
".github/copilot-instructions.md",
|
|
593
|
-
".github/instructions/",
|
|
594
|
-
".cursor/rules/",
|
|
595
|
-
".clinerules/",
|
|
596
|
-
"CLAUDE.md",
|
|
597
|
-
".claude/memories/",
|
|
598
|
-
".roo/rules/",
|
|
599
|
-
"# Support for --base-dir option (any depth)",
|
|
600
592
|
"**/.github/copilot-instructions.md",
|
|
601
593
|
"**/.github/instructions/",
|
|
602
594
|
"**/.cursor/rules/",
|
|
@@ -831,6 +823,25 @@ async function parseCopilotConfiguration(baseDir = process.cwd()) {
|
|
|
831
823
|
// src/parsers/cursor.ts
|
|
832
824
|
import { basename as basename4, join as join11 } from "path";
|
|
833
825
|
import matter3 from "gray-matter";
|
|
826
|
+
import yaml from "js-yaml";
|
|
827
|
+
var customMatterOptions = {
|
|
828
|
+
engines: {
|
|
829
|
+
yaml: {
|
|
830
|
+
parse: (str) => {
|
|
831
|
+
try {
|
|
832
|
+
const preprocessed = str.replace(/^(\s*globs:\s*)\*\s*$/gm, '$1"*"');
|
|
833
|
+
return yaml.load(preprocessed, { schema: yaml.DEFAULT_SCHEMA });
|
|
834
|
+
} catch (error) {
|
|
835
|
+
try {
|
|
836
|
+
return yaml.load(str, { schema: yaml.FAILSAFE_SCHEMA });
|
|
837
|
+
} catch {
|
|
838
|
+
throw error;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
};
|
|
834
845
|
async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
835
846
|
const errors = [];
|
|
836
847
|
const rules = [];
|
|
@@ -838,7 +849,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
838
849
|
if (await fileExists(cursorFilePath)) {
|
|
839
850
|
try {
|
|
840
851
|
const rawContent = await readFileContent(cursorFilePath);
|
|
841
|
-
const parsed = matter3(rawContent);
|
|
852
|
+
const parsed = matter3(rawContent, customMatterOptions);
|
|
842
853
|
const content = parsed.content.trim();
|
|
843
854
|
if (content) {
|
|
844
855
|
const frontmatter = {
|
|
@@ -869,7 +880,7 @@ async function parseCursorConfiguration(baseDir = process.cwd()) {
|
|
|
869
880
|
const filePath = join11(cursorRulesDir, file);
|
|
870
881
|
try {
|
|
871
882
|
const rawContent = await readFileContent(filePath);
|
|
872
|
-
const parsed = matter3(rawContent);
|
|
883
|
+
const parsed = matter3(rawContent, customMatterOptions);
|
|
873
884
|
const content = parsed.content.trim();
|
|
874
885
|
if (content) {
|
|
875
886
|
const filename = basename4(file, ".mdc");
|
|
@@ -1367,7 +1378,7 @@ async function watchCommand() {
|
|
|
1367
1378
|
|
|
1368
1379
|
// src/cli/index.ts
|
|
1369
1380
|
var program = new Command();
|
|
1370
|
-
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.
|
|
1381
|
+
program.name("rulesync").description("Unified AI rules management CLI tool").version("0.32.0");
|
|
1371
1382
|
program.command("init").description("Initialize rulesync in current directory").action(initCommand);
|
|
1372
1383
|
program.command("add <filename>").description("Add a new rule file").action(addCommand);
|
|
1373
1384
|
program.command("gitignore").description("Add generated files to .gitignore").action(gitignoreCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rulesync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Unified AI rules management CLI tool that generates configuration files for various AI development tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -35,12 +35,14 @@
|
|
|
35
35
|
"chokidar": "4.0.3",
|
|
36
36
|
"commander": "14.0.0",
|
|
37
37
|
"gray-matter": "4.0.3",
|
|
38
|
+
"js-yaml": "4.1.0",
|
|
38
39
|
"marked": "15.0.12"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@biomejs/biome": "2.0.0",
|
|
42
43
|
"@secretlint/secretlint-rule-preset-recommend": "10.1.0",
|
|
43
44
|
"@tsconfig/node24": "24.0.1",
|
|
45
|
+
"@types/js-yaml": "4.0.9",
|
|
44
46
|
"@types/node": "24.0.3",
|
|
45
47
|
"@typescript/native-preview": "7.0.0-dev.20250623.1",
|
|
46
48
|
"@vitest/coverage-v8": "3.2.4",
|