Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,17 @@ pnpm-lock.yaml
**/.github/instructions/
**/.cursor/rules/
**/.clinerules/
**/CLAUDE.md
**/.roo/rules/
**/CLAUDE.md
**/.claude/memories/
**/GEMINI.md
**/.gemini/memories/

**/.rulesync/copilot__*
**/.rulesync/cursor__*
**/.rulesync/cline__*
**/.rulesync/roo__*
**/.rulesync/claudecode__*
**/.rulesync/geminicli__*

/tmp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
root: false
targets: ['claude']
targets: ['*']
description: "Claude Code memories specification"
globs: []
---
Expand Down
2 changes: 1 addition & 1 deletion .rulesync/rules-specification-cline.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
root: false
targets: ['cline']
targets: ['*']
description: "Cline rules specification"
globs: []
---
Expand Down
2 changes: 1 addition & 1 deletion .rulesync/rules-specification-copilot.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
root: false
targets: ['copilot']
targets: ['*']
description: "GitHub Copilot custom instructions specification"
globs: []
---
Expand Down
2 changes: 1 addition & 1 deletion .rulesync/rules-specification-cursor.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
root: false
targets: ['cursor']
targets: ['*']
description: "Cursor project rules specification"
globs: []
---
Expand Down
2 changes: 1 addition & 1 deletion .rulesync/rules-specification-roo.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
root: false
targets: ['roo']
targets: ['*']
description: "Roo Code rules specification"
globs: []
---
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"clinerules",
"cursorrules",
"dyoshikawa",
"geminicli",
"Nonoctal",
"roorules",
"rulesync",
Expand Down
9 changes: 6 additions & 3 deletions CONTRIBUTING.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ rulesync/
│ │ ├── cursor.ts # Cursor Project Rules (MDCフォーマット)
│ │ ├── cline.ts # Cline Rules
│ │ ├── claudecode.ts # Claude Code Memory (CLAUDE.md + memories)
│ │ ├── geminicli.ts # Gemini CLI設定 (GEMINI.md + memories)
│ │ └── roo.ts # Roo Code Rules
│ ├── parsers/ # インポート機能用ツール固有パーサー
│ │ ├── copilot.ts # GitHub Copilot設定のパース (.github/copilot-instructions.md)
│ │ ├── cursor.ts # Cursor設定のパース (.cursorrules, .cursor/rules/*.mdc)
│ │ ├── cline.ts # Cline設定のパース (.cline/instructions.md)
│ │ ├── claudecode.ts # Claude Code設定のパース (CLAUDE.md, .claude/memories/*.md)
│ │ ├── geminicli.ts # Gemini CLI設定のパース (GEMINI.md, .gemini/memories/*.md)
│ │ └── roo.ts # Roo Code設定のパース (.roo/instructions.md)
│ ├── types/ # TypeScript型定義
│ │ ├── config.ts # 設定型
Expand Down Expand Up @@ -249,16 +251,17 @@ pnpm test src/parsers/ # すべてのパーサーのテス

## 新しいAIツールの追加

新しいAIツールのサポートを追加するには:
新しいAIツールのサポートを追加するには(最近追加された`geminicli`を参考として):

1. **ジェネレーターを作成**: `src/generators/newtool.ts`を追加
2. **パーサーを作成**: インポート機能用に`src/parsers/newtool.ts`を追加
3. **インターフェースを実装**: パターンに従って非同期関数をエクスポート
4. **コアに追加**: `src/core/generator.ts`と`src/core/importer.ts`を更新
5. **CLIオプションを追加**: generateとimportコマンドの両方で`src/cli/index.ts`を更新
6. **型を更新**: `src/types/rules.ts`の`ToolTarget`に追加
7. **テストを追加**: `src/generators/newtool.test.ts`と`src/parsers/newtool.test.ts`を作成
8. **ドキュメントを更新**: README.mdとREADME.ja.mdに追加
7. **設定を更新**: `src/utils/config.ts`で出力パスを追加
8. **テストを追加**: `src/generators/newtool.test.ts`と`src/parsers/newtool.test.ts`を作成
9. **ドキュメントを更新**: README.mdとREADME.ja.mdに追加

### ジェネレーターインターフェースパターン

Expand Down
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ rulesync/
│ │ ├── cursor.ts # Cursor Project Rules (MDC format)
│ │ ├── cline.ts # Cline Rules
│ │ ├── claudecode.ts # Claude Code Memory (CLAUDE.md + memories)
│ │ ├── geminicli.ts # Gemini CLI configuration (GEMINI.md + memories)
│ │ └── roo.ts # Roo Code Rules
│ ├── parsers/ # Tool-specific parsers for import functionality
│ │ ├── copilot.ts # Parse GitHub Copilot configurations (.github/copilot-instructions.md)
│ │ ├── cursor.ts # Parse Cursor configurations (.cursorrules, .cursor/rules/*.mdc)
│ │ ├── cline.ts # Parse Cline configurations (.cline/instructions.md)
│ │ ├── claudecode.ts # Parse Claude Code configurations (CLAUDE.md, .claude/memories/*.md)
│ │ ├── geminicli.ts # Parse Gemini CLI configurations (GEMINI.md, .gemini/memories/*.md)
│ │ └── roo.ts # Parse Roo Code configurations (.roo/instructions.md)
│ ├── types/ # TypeScript type definitions
│ │ ├── config.ts # Configuration types
Expand Down Expand Up @@ -249,16 +251,17 @@ Note: Coverage temporarily reduced due to new import functionality requiring tes

## Adding New AI Tools

To add support for a new AI tool:
To add support for a new AI tool (see the recent addition of `geminicli` as a reference):

1. **Create generator**: Add `src/generators/newtool.ts`
2. **Create parser**: Add `src/parsers/newtool.ts` for import functionality
3. **Implement interfaces**: Export async functions following the patterns
4. **Add to core**: Update `src/core/generator.ts` and `src/core/importer.ts`
5. **Add CLI options**: Update `src/cli/index.ts` for both generate and import commands
6. **Update types**: Add to `ToolTarget` in `src/types/rules.ts`
7. **Add tests**: Create `src/generators/newtool.test.ts` and `src/parsers/newtool.test.ts`
8. **Update docs**: Add to README.md and README.ja.md
7. **Update config**: Add output path in `src/utils/config.ts`
8. **Add tests**: Create `src/generators/newtool.test.ts` and `src/parsers/newtool.test.ts`
9. **Update docs**: Add to README.md and README.ja.md

### Generator Interface Pattern

Expand Down
11 changes: 9 additions & 2 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rulesyncは以下のAI開発ツールの**生成**と**インポート**の両
- **Cline Rules** (`.clinerules/*.md` + `.cline/instructions.md`)
- **Claude Code Memory** (`./CLAUDE.md` + `.claude/memories/*.md`)
- **Roo Code Rules** (`.roo/rules/*.md` + `.roo/instructions.md`)
- **Gemini CLI** (`GEMINI.md` + `.gemini/memories/*.md`)

## インストール

Expand Down Expand Up @@ -68,6 +69,7 @@ yarn global add rulesync
npx rulesync import --copilot # .github/copilot-instructions.mdから
npx rulesync import --cline # .cline/instructions.mdから
npx rulesync import --roo # .roo/instructions.mdから
npx rulesync import --geminicli # GEMINI.mdと.gemini/memories/*.mdから
```

2. **`.rulesync/`ディレクトリのインポートされたルールを確認・編集**
Expand All @@ -93,9 +95,10 @@ AI開発ツールは新しいツールが頻繁に登場し、急速に進化し
- Cursor:リファクタリング
- Claude Code:アーキテクチャ設計
- Cline:デバッグ支援
- Gemini CLI:知的コード解析

### 🔓 **ベンダーロックインなし**
ベンダーロックインを完全に回避できます。rulesyncの使用を停止することを決定した場合でも、生成されたルールファイル(`.github/instructions/`、`.cursor/rules/`、`.clinerules/`、`CLAUDE.md`など)をそのまま使い続けることができます。
ベンダーロックインを完全に回避できます。rulesyncの使用を停止することを決定した場合でも、生成されたルールファイル(`.github/instructions/`、`.cursor/rules/`、`.clinerules/`、`CLAUDE.md`、`GEMINI.md`など)をそのまま使い続けることができます。

### 🎯 **ツール間の一貫性**
すべてのAIツールに一貫したルールを適用し、チーム全体のコード品質と開発体験を向上させます。
Expand Down Expand Up @@ -171,6 +174,7 @@ rulesyncは2レベルのルールシステムを使用します:
| **GitHub Copilot** | 標準フォーマット | 標準フォーマット | すべてのルールがフロントマター付きの同じフォーマットを使用 |
| **Cline** | 標準フォーマット | 標準フォーマット | すべてのルールがプレーンMarkdownフォーマットを使用 |
| **Roo Code** | 標準フォーマット | 標準フォーマット | すべてのルールが説明ヘッダー付きのプレーンMarkdownフォーマットを使用 |
| **Gemini CLI** | `GEMINI.md` | `.gemini/memories/*.md` | GEMINI.mdがメモリファイルへの`@filename`参照を含む |

### 3. 設定ファイルの生成

Expand All @@ -184,6 +188,7 @@ npx rulesync generate --cursor
npx rulesync generate --cline
npx rulesync generate --claudecode
npx rulesync generate --roo
npx rulesync generate --geminicli

# クリーンビルド(既存ファイルを最初に削除)
npx rulesync generate --delete
Expand All @@ -205,7 +210,7 @@ npx rulesync generate --base-dir ./apps/web,./apps/api,./packages/shared

- `--delete`: 新しいファイルを作成する前に既存の生成済みファイルをすべて削除
- `--verbose`: 生成プロセス中に詳細出力を表示
- `--copilot`, `--cursor`, `--cline`, `--claudecode`, `--roo`: 指定されたツールのみ生成
- `--copilot`, `--cursor`, `--cline`, `--claudecode`, `--roo`, `--geminicli`: 指定されたツールのみ生成
- `--base-dir <paths>`: 指定されたベースディレクトリに設定ファイルを生成(複数パスの場合はカンマ区切り)。異なるプロジェクトディレクトリにツール固有の設定を生成したいmonorepoセットアップに便利。

### 4. 既存設定のインポート
Expand All @@ -219,6 +224,7 @@ npx rulesync import --cursor # .cursorrulesと.cursor/rules/*.mdからイン
npx rulesync import --copilot # .github/copilot-instructions.mdと.github/instructions/*.instructions.mdからインポート
npx rulesync import --cline # .cline/instructions.mdからインポート
npx rulesync import --roo # .roo/instructions.mdからインポート
npx rulesync import --geminicli # GEMINI.mdと.gemini/memories/*.mdからインポート

# 複数のツールからインポート
npx rulesync import --claudecode --cursor --copilot
Expand Down Expand Up @@ -326,6 +332,7 @@ globs: "**/*.ts,**/*.tsx"
| **Cline** | `.clinerules/*.md` | プレーンMarkdown | 両レベルとも同じフォーマットを使用 |
| **Claude Code** | `./CLAUDE.md` (ルート)<br>`.claude/memories/*.md` (非ルート) | プレーンMarkdown | ルートはCLAUDE.mdに移動<br>非ルートは別メモリファイルに移動<br>CLAUDE.mdは`@filename`参照を含む |
| **Roo Code** | `.roo/rules/*.md` | プレーンMarkdown | 両レベルとも説明ヘッダー付きの同じフォーマットを使用 |
| **Gemini CLI** | `GEMINI.md` (ルート)<br>`.gemini/memories/*.md` (非ルート) | プレーンMarkdown | ルートはGEMINI.mdに移動<br>非ルートは別メモリファイルに移動<br>GEMINI.mdは`@filename`参照を含む |

## バリデーション

Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rulesync supports both **generation** and **import** for the following AI develo
- **Cline Rules** (`.clinerules/*.md` + `.cline/instructions.md`)
- **Claude Code Memory** (`./CLAUDE.md` + `.claude/memories/*.md`)
- **Roo Code Rules** (`.roo/rules/*.md` + `.roo/instructions.md`)
- **Gemini CLI** (`GEMINI.md` + `.gemini/memories/*.md`)

## Installation

Expand Down Expand Up @@ -68,6 +69,7 @@ If you already have AI tool configurations, you can import them into rulesync fo
npx rulesync import --copilot # From .github/copilot-instructions.md
npx rulesync import --cline # From .cline/instructions.md
npx rulesync import --roo # From .roo/instructions.md
npx rulesync import --geminicli # From GEMINI.md and .gemini/memories/*.md
```

2. **Review and edit** the imported rules in `.rulesync/` directory
Expand All @@ -93,9 +95,10 @@ Enable hybrid development workflows combining multiple AI tools:
- Cursor for refactoring
- Claude Code for architecture design
- Cline for debugging assistance
- Gemini CLI for intelligent code analysis

### 🔓 **No Vendor Lock-in**
Avoid vendor lock-in completely. If you decide to stop using rulesync, you can continue using the generated rule files (`.github/instructions/`, `.cursor/rules/`, `.clinerules/`, `CLAUDE.md`, etc.) as-is.
Avoid vendor lock-in completely. If you decide to stop using rulesync, you can continue using the generated rule files (`.github/instructions/`, `.cursor/rules/`, `.clinerules/`, `CLAUDE.md`, `GEMINI.md`, etc.) as-is.

### 🎯 **Consistency Across Tools**
Apply consistent rules across all AI tools, improving code quality and development experience for the entire team.
Expand Down Expand Up @@ -171,6 +174,7 @@ Each AI tool handles rule levels differently:
| **GitHub Copilot** | Standard format | Standard format | All rules use same format with frontmatter |
| **Cline** | Standard format | Standard format | All rules use plain Markdown format |
| **Roo Code** | Standard format | Standard format | All rules use plain Markdown format with description header |
| **Gemini CLI** | `GEMINI.md` | `.gemini/memories/*.md` | GEMINI.md includes `@filename` references to memory files |

### 3. Generate Configuration Files

Expand All @@ -184,6 +188,7 @@ npx rulesync generate --cursor
npx rulesync generate --cline
npx rulesync generate --claudecode
npx rulesync generate --roo
npx rulesync generate --geminicli

# Clean build (delete existing files first)
npx rulesync generate --delete
Expand All @@ -205,7 +210,7 @@ npx rulesync generate --base-dir ./apps/web,./apps/api,./packages/shared

- `--delete`: Remove all existing generated files before creating new ones
- `--verbose`: Show detailed output during generation process
- `--copilot`, `--cursor`, `--cline`, `--claudecode`, `--roo`: Generate only for specified tools
- `--copilot`, `--cursor`, `--cline`, `--claudecode`, `--roo`, `--geminicli`: Generate only for specified tools
- `--base-dir <paths>`: Generate configuration files in specified base directories (comma-separated for multiple paths). Useful for monorepo setups where you want to generate tool-specific configurations in different project directories.

### 4. Import Existing Configurations
Expand All @@ -219,6 +224,7 @@ npx rulesync import --cursor # Import from .cursorrules and .cursor/rules/*.
npx rulesync import --copilot # Import from .github/copilot-instructions.md and .github/instructions/*.instructions.md
npx rulesync import --cline # Import from .cline/instructions.md
npx rulesync import --roo # Import from .roo/instructions.md
npx rulesync import --geminicli # Import from GEMINI.md and .gemini/memories/*.md

# Import from multiple tools
npx rulesync import --claudecode --cursor --copilot
Expand Down Expand Up @@ -326,6 +332,7 @@ globs: "**/*.ts,**/*.tsx"
| **Cline** | `.clinerules/*.md` | Plain Markdown | Both levels use same format |
| **Claude Code** | `./CLAUDE.md` (root)<br>`.claude/memories/*.md` (non-root) | Plain Markdown | Root goes to CLAUDE.md<br>Non-root go to separate memory files<br>CLAUDE.md includes `@filename` references |
| **Roo Code** | `.roo/rules/*.md` | Plain Markdown | Both levels use same format with description header |
| **Gemini CLI** | `GEMINI.md` (root)<br>`.gemini/memories/*.md` (non-root) | Plain Markdown | Root goes to GEMINI.md<br>Non-root go to separate memory files<br>GEMINI.md includes `@filename` references |

## Validation

Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export async function generateCommand(options: GenerateOptions = {}): Promise<vo
case "roo":
deleteTasks.push(removeDirectory(config.outputPaths.roo));
break;
case "geminicli":
deleteTasks.push(removeDirectory(config.outputPaths.geminicli));
break;
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/cli/commands/gitignore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("gitignoreCommand", () => {
expect.stringContaining("# Generated by rulesync")
);
expect(console.log).toHaveBeenCalledWith(
expect.stringContaining("✅ .gitignoreに8個のルールを追加しました:")
expect.stringContaining("✅ .gitignoreに10個のルールを追加しました:")
);
});

Expand Down Expand Up @@ -60,6 +60,8 @@ describe("gitignoreCommand", () => {
CLAUDE.md
.claude/memories/
.roo/rules/
GEMINI.md
.gemini/memories/
# Support for --base-dir option (any depth)
**/.github/copilot-instructions.md
**/.github/instructions/
Expand All @@ -68,6 +70,8 @@ CLAUDE.md
**/CLAUDE.md
**/.claude/memories/
**/.roo/rules/
**/GEMINI.md
**/.gemini/memories/
`;

mockExistsSync.mockReturnValue(true);
Expand Down Expand Up @@ -98,7 +102,7 @@ CLAUDE.md
expect.stringContaining(".clinerules/")
);
expect(console.log).toHaveBeenCalledWith(
expect.stringContaining("✅ .gitignoreに7個のルールを追加しました:")
expect.stringContaining("✅ .gitignoreに9個のルールを追加しました:")
);
});
});
2 changes: 2 additions & 0 deletions src/cli/commands/gitignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const gitignoreCommand = async (): Promise<void> => {
"**/CLAUDE.md",
"**/.claude/memories/",
"**/.roo/rules/",
"**/GEMINI.md",
"**/.gemini/memories/",
];

let gitignoreContent = "";
Expand Down
4 changes: 3 additions & 1 deletion src/cli/commands/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface ImportOptions {
copilot?: boolean;
cline?: boolean;
roo?: boolean;
geminicli?: boolean;
verbose?: boolean;
}

Expand All @@ -19,11 +20,12 @@ export async function importCommand(options: ImportOptions = {}): Promise<void>
if (options.copilot) tools.push("copilot");
if (options.cline) tools.push("cline");
if (options.roo) tools.push("roo");
if (options.geminicli) tools.push("geminicli");

// Validate that at least one tool is selected
if (tools.length === 0) {
console.error(
"❌ Please specify at least one tool to import from (--claudecode, --cursor, --copilot, --cline, --roo)"
"❌ Please specify at least one tool to import from (--claudecode, --cursor, --copilot, --cline, --roo, --geminicli)"
);
process.exit(1);
}
Expand Down
3 changes: 3 additions & 0 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ program
.option("--copilot", "Import from GitHub Copilot (.github/copilot-instructions.md)")
.option("--cline", "Import from Cline (.cline/instructions.md)")
.option("--roo", "Import from Roo Code (.roo/instructions.md)")
.option("--geminicli", "Import from Gemini CLI (GEMINI.md)")
.option("-v, --verbose", "Verbose output")
.action(importCommand);

Expand All @@ -45,6 +46,7 @@ program
.option("--cline", "Generate only for Cline")
.option("--claudecode", "Generate only for Claude Code")
.option("--roo", "Generate only for Roo Code")
.option("--geminicli", "Generate only for Gemini CLI")
.option("--delete", "Delete all existing files in output directories before generating")
.option(
"-b, --base-dir <paths>",
Expand All @@ -58,6 +60,7 @@ program
if (options.cline) tools.push("cline");
if (options.claudecode) tools.push("claudecode");
if (options.roo) tools.push("roo");
if (options.geminicli) tools.push("geminicli");

const generateOptions: {
verbose?: boolean;
Expand Down
3 changes: 3 additions & 0 deletions src/core/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { generateClaudecodeConfig } from "../generators/claudecode.js";
import { generateClineConfig } from "../generators/cline.js";
import { generateCopilotConfig } from "../generators/copilot.js";
import { generateCursorConfig } from "../generators/cursor.js";
import { generateGeminiConfig } from "../generators/geminicli.js";
import { generateRooConfig } from "../generators/roo.js";
import type { Config, GeneratedOutput, ParsedRule, ToolTarget } from "../types/index.js";
import { resolveTargets } from "../utils/index.js";
Expand Down Expand Up @@ -64,6 +65,8 @@ async function generateForTool(
return await generateClaudecodeConfig(rules, config, baseDir);
case "roo":
return generateRooConfig(rules, config, baseDir);
case "geminicli":
return generateGeminiConfig(rules, config, baseDir);
default:
console.warn(`Unknown tool: ${tool}`);
return null;
Expand Down
Loading