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
26 changes: 17 additions & 9 deletions CONTRIBUTING.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ rulesync/
│ ├── parsers/ # インポート機能用ツール固有パーサー
│ │ ├── copilot.ts # GitHub Copilot設定のパース (.github/copilot-instructions.md)
│ │ ├── cursor.ts # Cursor設定のパース (.cursorrules, .cursor/rules/*.mdc)
│ │ │ # 4つのルールタイプをサポート: always, manual, specificFiles, intelligently
│ │ ├── cline.ts # Cline設定のパース (.cline/instructions.md)
│ │ ├── claudecode.ts # Claude Code設定のパース (CLAUDE.md, .claude/memories/*.md)
│ │ ├── geminicli.ts # Gemini CLI設定のパース (GEMINI.md, .gemini/memories/*.md)
Expand Down Expand Up @@ -211,7 +212,7 @@ type(scope): description

## テスト

プロジェクトは包括的なカバレッジ(現在: 21テストファイルで157テスト、目標: 80%+カバレッジ)でVitestを使用してテストしています:
プロジェクトは包括的なカバレッジ(現在: 37テストファイルで314テスト、86.62%カバレッジ達成)でVitestを使用してテストしています:

### テスト構造

Expand All @@ -231,7 +232,7 @@ type(scope): description
### テストの実行

```bash
# すべてのテスト(21テストファイルで157テスト
# すべてのテスト(37テストファイルで314テスト
pnpm test

# 開発用ウォッチモード
Expand All @@ -250,13 +251,20 @@ pnpm test src/parsers/ # すべてのパーサーのテス

### モジュール別テストカバレッジ

- **cli/commands**: 85.41%(良好なカバレッジ、新しいimportコマンドのテストが必要)
- **core**: 62.97%(改善が必要、新しいimporterモジュールのテストが必要)
- **generators**: すべてのモジュールで高カバレッジ
- **utils**: すべてのモジュールで高カバレッジ
- **types**: すべてのモジュールで高カバレッジ
- **cli/commands**: 96.21%(優秀なカバレッジ)
- **core**: 90.76%(高カバレッジを達成)
- **generators**: すべてのモジュールで高カバレッジ(98.35%)
- **parsers**: 74.66%(良好なカバレッジ、cursorパーサーは89.49%)
- **utils**: すべてのモジュールで高カバレッジ(100%)
- **types**: 型定義ファイルのため測定対象外

注意: 新しいインポート機能のテスト実装が必要なため、カバレッジが一時的に低下しています。
### 最近の改善

- **Cursorパーサー**: 仕様変更に対応し、4つのルールタイプ(always, manual, specificFiles, intelligently)をサポート
- **Cursorジェネレーター**: cursorRuleTypeフィールドの優先処理に対応
- **型安全性**: `any`型を`unknown`型に置き換え、適切な型ガードで型安全性を向上
- **テストスイート**: 23個の包括的なテストを追加し、エラーハンドリングやエッジケースを網羅
- **カバレッジ**: 全体で86.62%達成、80%目標を大幅に上回る

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

Expand Down Expand Up @@ -353,4 +361,4 @@ export async function parseNewToolConfiguration(
- より広範なトピックについてはディスカッションを開始
- ガイダンスについてはメンテナーに連絡

rulesyncへの貢献をありがとうございます!
rulesyncへの貢献をありがとうございます!
26 changes: 17 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ rulesync/
│ ├── 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)
│ │ │ # Supports 4 rule types: always, manual, specificFiles, intelligently
│ │ ├── 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)
Expand Down Expand Up @@ -211,7 +212,7 @@ The style is automatically enforced by our CI pipeline and pre-commit hooks.

## Testing

The project uses Vitest for testing with comprehensive coverage (current: 157 tests across 21 test files, target: 80%+ coverage):
The project uses Vitest for testing with comprehensive coverage (current: 314 tests across 37 test files, 86.62% coverage achieved):

### Test Structure

Expand All @@ -231,7 +232,7 @@ The project uses Vitest for testing with comprehensive coverage (current: 157 te
### Running Tests

```bash
# All tests (157 tests across 21 test files)
# All tests (314 tests across 37 test files)
pnpm test

# Watch mode for development
Expand All @@ -250,13 +251,20 @@ pnpm test src/parsers/ # Test all parsers

### Test Coverage by Module

- **cli/commands**: 85.41% (good coverage, new import command needs testing)
- **core**: 62.97% (needs improvement, new importer module requires tests)
- **generators**: High coverage across all modules
- **utils**: High coverage across all modules
- **types**: High coverage across all modules
- **cli/commands**: 96.21% (excellent coverage)
- **core**: 90.76% (high coverage achieved)
- **generators**: High coverage across all modules (98.35%)
- **parsers**: 74.66% (good coverage, cursor parser achieved 89.49%)
- **utils**: High coverage across all modules (100%)
- **types**: Type definition files (not measured)

Note: Coverage temporarily reduced due to new import functionality requiring test implementation.
### Recent Improvements

- **Cursor Parser**: Updated to support specification changes with 4 rule types (always, manual, specificFiles, intelligently)
- **Cursor Generator**: Updated with cursorRuleType field priority
- **Type Safety**: Improved type safety by replacing `any` types with `unknown` and proper type guards
- **Test Suite**: Added 23 comprehensive tests covering error handling and edge cases
- **Coverage**: Achieved 86.62% overall, significantly exceeding 80% target

## Adding New AI Tools

Expand Down Expand Up @@ -353,4 +361,4 @@ Feel free to:
- Start a discussion for broader topics
- Reach out to maintainers for guidance

Thank you for contributing to rulesync!
Thank you for contributing to rulesync!
72 changes: 55 additions & 17 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ rulesyncは2レベルのルールシステムを使用します:

各AIツールはルールレベルを異なって処理します:

| ツール | ルートルール | 非ルートルール | 特別な動作 |
|------|------------|----------------|------------------|
| **Claude Code** | `./CLAUDE.md` | `.claude/memories/*.md` | CLAUDE.mdが詳細ファイルへの`@filename`参照を含む |
| **Cursor** | `ruletype: always` | `ruletype: autoattached` | globsのない詳細ルールは`ruletype: agentrequested`を使用 |
| **GitHub Copilot** | 標準フォーマット | 標準フォーマット | すべてのルールがフロントマター付きの同じフォーマットを使用 |
| **Cline** | 標準フォーマット | 標準フォーマット | すべてのルールがプレーンMarkdownフォーマットを使用 |
| **Roo Code** | 標準フォーマット | 標準フォーマット | すべてのルールが説明ヘッダー付きのプレーンMarkdownフォーマットを使用 |
| **Gemini CLI** | `GEMINI.md` | `.gemini/memories/*.md` | GEMINI.mdがメモリファイルへの`@filename`参照を含む |
| ツール | ルートルール | 非ルートルール | 特別な動作 |
| ------------------ | ------------------ | ------------------------ | -------------------------------------------------------------------- |
| **Claude Code** | `./CLAUDE.md` | `.claude/memories/*.md` | CLAUDE.mdが詳細ファイルへの`@filename`参照を含む |
| **Cursor** | `cursorRuleType: always` | `cursorRuleType: specificFiles` (globs指定時)<br>`cursorRuleType: intelligently` (description指定時)<br>`cursorRuleType: manual` (デフォルト) | コンテンツ解析に基づく高度なルールタイプシステム |
| **GitHub Copilot** | 標準フォーマット | 標準フォーマット | すべてのルールがフロントマター付きの同じフォーマットを使用 |
| **Cline** | 標準フォーマット | 標準フォーマット | すべてのルールがプレーンMarkdownフォーマットを使用 |
| **Roo Code** | 標準フォーマット | 標準フォーマット | すべてのルールが説明ヘッダー付きのプレーンMarkdownフォーマットを使用 |
| **Gemini CLI** | `GEMINI.md` | `.gemini/memories/*.md` | GEMINI.mdがメモリファイルへの`@filename`参照を含む |

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

Expand Down Expand Up @@ -241,6 +241,34 @@ importコマンドの動作:
- YAMLフロントマター付きのCursorのMDCファイルなど複雑なフォーマットをサポート
- 複数ファイルのインポート(例:`.claude/memories/`ディレクトリのすべてのファイル)に対応

### Cursorインポートの詳細

Cursorからのインポートでは、以下の4つのルールタイプが自動的に識別されます:

1. **always** (`cursorRuleType: always`)
- 条件: `alwaysApply: true` が設定されている場合
- 変換: ルートルール(`root: false`)としてインポート、`globs: ["**/*"]`を設定

2. **manual** (`cursorRuleType: manual`)
- 条件: description空 + globs空 + `alwaysApply: false`
- 変換: 空のglobsパターンでインポート(手動適用ルール)

3. **specificFiles** (`cursorRuleType: specificFiles`)
- 条件: globs指定あり(description有無問わず)
- 変換: 指定されたglobsパターンを配列として保持、descriptionは空文字に設定

4. **intelligently** (`cursorRuleType: intelligently`)
- 条件: description指定あり + globs空
- 変換: descriptionを保持、空のglobsパターンを設定

#### エッジケース処理
- **description非空 + globs非空の場合**: `specificFiles`として処理(globsパターンを優先)
- **判定条件に該当しない場合**: `manual`として処理(デフォルト)

#### Cursorのサポートファイル
- `.cursor/rules/*.mdc` (モダンな推奨形式)
- `.cursorrules` (レガシーな形式)

### 5. その他のコマンド

```bash
Expand Down Expand Up @@ -314,9 +342,19 @@ root: true | false # 必須: ルールレベル (概要の場合tr
targets: ["*"] # 必須: ターゲットツール (* = すべて、または特定のツール)
description: "簡潔な説明" # 必須: ルールの説明
globs: "**/*.ts,**/*.js" # 必須: ファイルパターン (カンマ区切りまたは空文字列)
cursorRuleType: "always" # オプション: Cursor固有のルールタイプ (always, manual, specificFiles, intelligently)
---
```

#### cursorRuleTypeフィールド (オプション)

Cursorツール用の追加メタデータフィールド:

- **`always`**: プロジェクト全体に常に適用されるルール
- **`manual`**: 手動で適用するルール(デフォルト)
- **`specificFiles`**: 特定のファイルパターンに自動適用されるルール
- **`intelligently`**: AIが判断して適用するルール

### ファイル例

**ルートファイル** (`.rulesync/overview.md`):
Expand Down Expand Up @@ -351,14 +389,14 @@ globs: "**/*.ts,**/*.tsx"

## 生成される設定ファイル

| ツール | 出力パス | フォーマット | ルールレベル処理 |
|------|------------|--------|-------------------|
| **GitHub Copilot** | `.github/instructions/*.instructions.md` | フロントマター + Markdown | 両レベルとも同じフォーマットを使用 |
| **Cursor** | `.cursor/rules/*.mdc` | MDC (YAMLヘッダー + Markdown) | ルート: `ruletype: always`<br>非ルート: `ruletype: autoattached`<br>globsなしの非ルート: `ruletype: agentrequested` |
| **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`参照を含む |
| ツール | 出力パス | フォーマット | ルールレベル処理 |
| ------------------ | ------------------------------------------------------------ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **GitHub Copilot** | `.github/instructions/*.instructions.md` | フロントマター + Markdown | 両レベルとも同じフォーマットを使用 |
| **Cursor** | `.cursor/rules/*.mdc` | MDC (YAMLヘッダー + Markdown) | ルート: `cursorRuleType: always`<br>非ルート: `cursorRuleType: specificFiles` (globs指定時)<br>非ルート: `cursorRuleType: intelligently` (description指定時)<br>非ルート: `cursorRuleType: manual` (デフォルト) |
| **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 Expand Up @@ -445,4 +483,4 @@ MIT License

Issues と Pull Requests を歓迎します!

開発環境の設定と貢献ガイドラインについては、[CONTRIBUTING.ja.md](./CONTRIBUTING.ja.md)を参照してください。
開発環境の設定と貢献ガイドラインについては、[CONTRIBUTING.ja.md](./CONTRIBUTING.ja.md)を参照してください。
Loading