@aramassa/ai-rules 0.3.3 → 0.3.4
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.
|
@@ -26,16 +26,117 @@ AI-rules プロジェクトにおけるレシピファイル(recipe files)
|
|
|
26
26
|
|
|
27
27
|
### 実行タスク
|
|
28
28
|
|
|
29
|
-
#### 手順1:
|
|
29
|
+
#### 手順1: 事前確認とフィルター属性の検証 ⚠️**必須**
|
|
30
|
+
|
|
31
|
+
**1-1. 利用可能な属性の事前確認(必須)**
|
|
32
|
+
|
|
33
|
+
レシピファイル作成前に、必ず以下のコマンドでfrontmatter属性を確認してください:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# 全ての利用可能な属性と値を確認
|
|
37
|
+
npx ai-rules stats --src artifact
|
|
38
|
+
|
|
39
|
+
# 特定の属性値でマッチするファイルを事前確認
|
|
40
|
+
npx ai-rules extract --type coding-rules --src artifact --out /tmp/test.md
|
|
41
|
+
npx ai-rules extract --attr category=configuration --src artifact --out /tmp/test.md
|
|
42
|
+
npx ai-rules extract --language typescript --src artifact --out /tmp/test.md
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**1-2. 事前確認チェックリスト**
|
|
46
|
+
- [ ] **属性存在確認**: 指定したい属性(category, focus等)が実際のファイルに存在するか
|
|
47
|
+
- [ ] **属性値確認**: 期待する値(例:category=best-practices)が実際に使われているか
|
|
48
|
+
- [ ] **対象ファイル数確認**: フィルター適用後に期待するファイル数が抽出されるか
|
|
49
|
+
- [ ] **意図しないファイル混入確認**: 不要なファイルが含まれていないか
|
|
50
|
+
|
|
51
|
+
**1-3. 実際の利用可能な属性値(2025年1月時点)**
|
|
52
|
+
|
|
53
|
+
以下は `npx ai-rules stats --src artifact` の結果に基づく実際の値です:
|
|
54
|
+
|
|
55
|
+
**type属性の値(18種類)**
|
|
56
|
+
- `chatmode` (3) - チャットモード設定
|
|
57
|
+
- `coding-rules` (3) - コーディング規約
|
|
58
|
+
- `development-rules` (7) - 開発ルール全般
|
|
59
|
+
- `development` (2) - 開発関連
|
|
60
|
+
- `documentation` (3) - ドキュメント作成
|
|
61
|
+
- `documentation-ai` (4) - AI向けドキュメント
|
|
62
|
+
- `git-rules` (1) - Git関連ルール
|
|
63
|
+
- `infrastructure` (1) - インフラ設定
|
|
64
|
+
- `package-management` (1) - パッケージ管理
|
|
65
|
+
- `planning` (2) - プランニング関連
|
|
66
|
+
- `prompt` (3) - プロンプト設定
|
|
67
|
+
- `python-cli` (1) - Python CLI開発
|
|
68
|
+
- `retrospective` (1) - 振り返り分析
|
|
69
|
+
- `skel` (1) - スケルトン管理
|
|
70
|
+
- `test` (6) - テスト関連
|
|
71
|
+
- `tidying-up` (1) - 整理整頓
|
|
72
|
+
- `workspace-management` (1) - ワークスペース管理
|
|
73
|
+
|
|
74
|
+
**category属性の値(21種類)**
|
|
75
|
+
- `best-practices` (2) - ベストプラクティス
|
|
76
|
+
- `configuration` (2) - 設定管理
|
|
77
|
+
- `methodology` (1) - 手法・方法論
|
|
78
|
+
- `implementation` (1) - 実装関連
|
|
79
|
+
- `api-usage` (1) - API使用方法
|
|
80
|
+
- `configuration-management` (1) - 設定管理
|
|
81
|
+
- `chrome-extension` (4) - Chrome拡張開発
|
|
82
|
+
- `code-quality` (1) - コード品質
|
|
83
|
+
- `desktop-app` (1) - デスクトップアプリ
|
|
84
|
+
- `github` (1) - GitHub関連
|
|
85
|
+
- `github-protection` (1) - GitHub保護設定
|
|
86
|
+
- `github-actions` (1) - GitHub Actions
|
|
87
|
+
- `restrictions` (1) - 制約・制限
|
|
88
|
+
- `content-creation` (1) - コンテンツ作成
|
|
89
|
+
- `instruction-generation` (1) - インストラクション生成
|
|
90
|
+
- `todo-planning` (1) - TODO計画
|
|
91
|
+
|
|
92
|
+
**focus属性の値(17種類)**
|
|
93
|
+
- `structured-process` (1) - 構造化プロセス
|
|
94
|
+
- `timeout` (2) - タイムアウト設定
|
|
95
|
+
- `structure` (1) - 構造設計
|
|
96
|
+
- `uv-workspace` (1) - uvワークスペース
|
|
97
|
+
- `cli-development` (1) - CLI開発
|
|
98
|
+
- `openai` (1) - OpenAI関連
|
|
99
|
+
- `architecture-security` (1) - アーキテクチャセキュリティ
|
|
100
|
+
- `html-structure` (1) - HTML構造
|
|
101
|
+
- `javascript-patterns` (1) - JavaScriptパターン
|
|
102
|
+
- `manifest-configuration` (1) - マニフェスト設定
|
|
103
|
+
- `mandatory-tools` (1) - 必須ツール
|
|
104
|
+
- `electron` (1) - Electron開発
|
|
105
|
+
- `issue-templates` (1) - Issueテンプレート
|
|
106
|
+
- `file-protection` (1) - ファイル保護
|
|
107
|
+
- `environment-independence` (1) - 環境非依存
|
|
108
|
+
- `test-policy` (1) - テストポリシー
|
|
109
|
+
- `workflow-management` (1) - ワークフロー管理
|
|
110
|
+
|
|
111
|
+
**language属性の値(8種類)**
|
|
112
|
+
- `typescript` (3) - TypeScript
|
|
113
|
+
- `javascript` (3) - JavaScript
|
|
114
|
+
- `python` (2) - Python
|
|
115
|
+
- `nodejs,typescript` (1) - Node.js + TypeScript組み合わせ
|
|
116
|
+
- `typescript,nodejs` (3) - TypeScript + Node.js組み合わせ
|
|
117
|
+
- `typescript,javascript` (1) - TypeScript + JavaScript組み合わせ
|
|
118
|
+
- `ansible` (1) - Ansible
|
|
119
|
+
- `html` (1) - HTML
|
|
120
|
+
- `json` (1) - JSON
|
|
121
|
+
|
|
122
|
+
**その他の属性**
|
|
123
|
+
- `applyTo`: ファイルパターン (`"**/*.ts"`, `"**/manifest.json"` など)
|
|
124
|
+
- `chatmode`: チャットモード種別 (`bug-reproduce`, `instruction-improve`, `planning`)
|
|
125
|
+
- `framework`: フレームワーク (`electron`, `npm`, `rollup`, `bdd`)
|
|
126
|
+
- `target`: 対象 (`ai`, `human`)
|
|
127
|
+
- `dir`: ディレクトリ (`docs-ai/external`, `docs-ai/history` など)
|
|
128
|
+
- `tools`: 利用ツール (長いカンマ区切りリスト)
|
|
129
|
+
|
|
130
|
+
**1-4. 要件分析とファイル調査**
|
|
30
131
|
|
|
31
132
|
**ファイル構成の調査**
|
|
32
|
-
1.
|
|
33
|
-
2. 各ファイルのfrontmatter
|
|
133
|
+
1. 上記の実際の属性値を参考に、必要なファイル群を特定
|
|
134
|
+
2. 各ファイルのfrontmatter属性を `stats` コマンドで分析
|
|
34
135
|
3. 既存のプリセットレシピを参考として確認
|
|
35
136
|
|
|
36
137
|
**要件の明確化**
|
|
37
138
|
- 生成するドキュメントの目的と対象読者
|
|
38
|
-
- 必要なinstruction
|
|
139
|
+
- 必要なinstruction種別とフィルタリング条件(実際の値を使用)
|
|
39
140
|
- 出力ファイル構成と配置場所
|
|
40
141
|
- FrontMatter継承とカスタム属性の必要性
|
|
41
142
|
|
|
@@ -111,29 +212,203 @@ recipe:
|
|
|
111
212
|
out: "custom-rules.instructions.md"
|
|
112
213
|
```
|
|
113
214
|
|
|
114
|
-
#### 手順3:
|
|
215
|
+
#### 手順3: フィルタリング条件の設定(実際の属性値使用)
|
|
216
|
+
|
|
217
|
+
**⚠️ 重要**: 以下の例は実際の `npx ai-rules stats --src artifact` の結果に基づいています。
|
|
218
|
+
|
|
219
|
+
**標準フィルター(基本)**
|
|
220
|
+
```yaml
|
|
221
|
+
type: coding-rules # 実際の値: coding-rules, test, documentation など
|
|
222
|
+
language: typescript # 実際の値: typescript, javascript, python など
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**標準フィルター(配列指定)**
|
|
226
|
+
```yaml
|
|
227
|
+
type: [coding-rules, development-rules] # 複数のタイプを指定(OR条件)
|
|
228
|
+
language: [typescript, javascript] # 複数の言語を指定(OR条件)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**高度なフィルター(filters フィールド)**
|
|
232
|
+
```yaml
|
|
233
|
+
filters:
|
|
234
|
+
category: best-practices # 実際の値: configuration, best-practices, methodology など
|
|
235
|
+
focus: timeout # 実際の値: timeout, structure, validation など
|
|
236
|
+
applyTo: "**/*.ts" # ファイルパターン指定
|
|
237
|
+
chatmode: bug-reproduce # 実際の値: bug-reproduce, instruction-improve, planning
|
|
238
|
+
framework: electron # 実際の値: electron, npm, rollup, bdd
|
|
239
|
+
target: ai # 実際の値: ai, human
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**実用的な組み合わせ例**
|
|
243
|
+
|
|
244
|
+
1. **TypeScriptコーディングルール**
|
|
245
|
+
```yaml
|
|
246
|
+
type: coding-rules
|
|
247
|
+
language: typescript
|
|
248
|
+
filters:
|
|
249
|
+
category: best-practices
|
|
250
|
+
# 結果: TypeScriptのベストプラクティスに関するコーディングルール
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
2. **テストに関する設定(タイムアウト関連)**
|
|
254
|
+
```yaml
|
|
255
|
+
type: test
|
|
256
|
+
filters:
|
|
257
|
+
focus: timeout
|
|
258
|
+
# 結果: テスト関連でタイムアウトにフォーカスした設定
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
3. **Chrome拡張開発ルール**
|
|
262
|
+
```yaml
|
|
263
|
+
filters:
|
|
264
|
+
category: chrome-extension
|
|
265
|
+
focus: manifest-configuration
|
|
266
|
+
# 結果: Chrome拡張開発のマニフェスト設定関連
|
|
267
|
+
```
|
|
115
268
|
|
|
116
|
-
|
|
269
|
+
4. **AI向けドキュメント**
|
|
117
270
|
```yaml
|
|
118
|
-
type:
|
|
119
|
-
|
|
271
|
+
type: documentation-ai
|
|
272
|
+
filters:
|
|
273
|
+
target: ai
|
|
274
|
+
dir: docs-ai/internal
|
|
275
|
+
# 結果: 内部AI向けドキュメント
|
|
120
276
|
```
|
|
121
277
|
|
|
122
|
-
|
|
278
|
+
**配列値サポート(OR条件)**
|
|
123
279
|
```yaml
|
|
124
280
|
filters:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
281
|
+
focus:
|
|
282
|
+
- timeout
|
|
283
|
+
- structure
|
|
284
|
+
- validation
|
|
285
|
+
category:
|
|
286
|
+
- configuration
|
|
287
|
+
- best-practices
|
|
288
|
+
# 結果: focus は timeout OR structure OR validation
|
|
289
|
+
# AND category は configuration OR best-practices
|
|
129
290
|
```
|
|
130
291
|
|
|
131
|
-
|
|
292
|
+
**複合条件(AND条件)**
|
|
132
293
|
- フィルター値は単一値または配列を指定可能
|
|
133
|
-
-
|
|
294
|
+
- 配列内の値はOR条件(いずれかにマッチ)
|
|
134
295
|
- 複数フィルター間はAND条件(すべてにマッチ)
|
|
296
|
+
- `type`/`language` と `filters` の組み合わせもAND条件
|
|
297
|
+
|
|
298
|
+
#### 手順4: レシピ作成の推奨ワークフロー ⚠️**必須手順**
|
|
299
|
+
|
|
300
|
+
**4-1. 属性確認を含む完全なワークフロー**
|
|
301
|
+
|
|
302
|
+
```markdown
|
|
303
|
+
## レシピ作成ワークフロー(推奨)
|
|
304
|
+
|
|
305
|
+
### Phase 1: 要件明確化
|
|
306
|
+
1. **目的設定**: どのようなファイル群を対象にしたいかを決定
|
|
307
|
+
2. **対象範囲特定**: 必要なinstruction種別を明確化
|
|
308
|
+
|
|
309
|
+
### Phase 2: 属性調査(重要)
|
|
310
|
+
3. **利用可能属性確認**: `npx ai-rules stats --src artifact` で現在の属性を調査
|
|
311
|
+
4. **フィルター条件設計**: 対象ファイルを絞り込む条件を設計
|
|
312
|
+
|
|
313
|
+
### Phase 3: 事前検証(必須)
|
|
314
|
+
5. **個別フィルター検証**: 各フィルター条件を個別にテスト
|
|
315
|
+
6. **組み合わせ検証**: 複数フィルターの組み合わせをテスト
|
|
316
|
+
7. **結果確認**: 期待するファイル数・内容が取得できるか確認
|
|
317
|
+
|
|
318
|
+
### Phase 4: レシピ作成・実行
|
|
319
|
+
8. **レシピファイル作成**: 検証済みの条件でレシピファイルを作成
|
|
320
|
+
9. **最終実行**: レシピを実行して期待通りの結果になるかを確認
|
|
321
|
+
10. **品質チェック**: 生成されたドキュメントの内容を確認
|
|
322
|
+
```
|
|
135
323
|
|
|
136
|
-
|
|
324
|
+
**4-2. 属性検証の具体的コマンド例**
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Step 1: 全体の属性状況を把握
|
|
328
|
+
npx ai-rules stats --src artifact
|
|
329
|
+
|
|
330
|
+
# Step 2: 個別条件のテスト(ファイル数を確認)
|
|
331
|
+
npx ai-rules extract --type coding-rules --src artifact --out /tmp/test-type.md
|
|
332
|
+
echo "Coding rules files: $(wc -l < /tmp/test-type.md) lines"
|
|
333
|
+
|
|
334
|
+
npx ai-rules extract --language typescript --src artifact --out /tmp/test-lang.md
|
|
335
|
+
echo "TypeScript files: $(wc -l < /tmp/test-lang.md) lines"
|
|
336
|
+
|
|
337
|
+
npx ai-rules extract --attr category=best-practices --src artifact --out /tmp/test-cat.md
|
|
338
|
+
echo "Best practices files: $(wc -l < /tmp/test-cat.md) lines"
|
|
339
|
+
|
|
340
|
+
npx ai-rules extract --attr focus=timeout --src artifact --out /tmp/test-focus.md
|
|
341
|
+
echo "Timeout focus files: $(wc -l < /tmp/test-focus.md) lines"
|
|
342
|
+
|
|
343
|
+
# Step 3: 組み合わせ条件のテスト
|
|
344
|
+
npx ai-rules extract --type test --attr focus=timeout --src artifact --out /tmp/test-combo.md
|
|
345
|
+
echo "Test + timeout files: $(wc -l < /tmp/test-combo.md) lines"
|
|
346
|
+
|
|
347
|
+
# Step 4: 結果内容の確認
|
|
348
|
+
head -20 /tmp/test-combo.md # 実際の内容を確認
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**4-3. よくある検証パターン**
|
|
352
|
+
|
|
353
|
+
**パターンA: TypeScript開発ルール**
|
|
354
|
+
```bash
|
|
355
|
+
# 事前検証
|
|
356
|
+
npx ai-rules stats --src artifact | grep -A5 "type:" # typeの値確認
|
|
357
|
+
npx ai-rules stats --src artifact | grep -A10 "language:" # languageの値確認
|
|
358
|
+
|
|
359
|
+
# フィルターテスト
|
|
360
|
+
npx ai-rules extract --type coding-rules --language typescript --src artifact --out /tmp/ts-test.md
|
|
361
|
+
echo "Result: $(wc -l < /tmp/ts-test.md) lines matched"
|
|
362
|
+
|
|
363
|
+
# 期待結果: TypeScriptのコーディングルールファイルが取得される
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**パターンB: 設定管理関連**
|
|
367
|
+
```bash
|
|
368
|
+
# 事前検証
|
|
369
|
+
npx ai-rules stats --src artifact | grep -A15 "category:" # categoryの値確認
|
|
370
|
+
|
|
371
|
+
# フィルターテスト
|
|
372
|
+
npx ai-rules extract --attr category=configuration --src artifact --out /tmp/config-test.md
|
|
373
|
+
echo "Configuration files: $(wc -l < /tmp/config-test.md) lines"
|
|
374
|
+
|
|
375
|
+
# 期待結果: 設定管理関連のファイルが取得される
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**パターンC: 複合条件テスト**
|
|
379
|
+
```bash
|
|
380
|
+
# 複数条件の検証
|
|
381
|
+
npx ai-rules extract --type test --attr focus=timeout,category=best-practices --src artifact --out /tmp/complex-test.md
|
|
382
|
+
echo "Complex filter result: $(wc -l < /tmp/complex-test.md) lines"
|
|
383
|
+
|
|
384
|
+
# 期待結果: テスト関連 AND タイムアウトフォーカス AND ベストプラクティスのファイル
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**4-4. 検証時のトラブルシューティング**
|
|
388
|
+
|
|
389
|
+
**空の結果が返される場合**
|
|
390
|
+
```bash
|
|
391
|
+
# 原因調査
|
|
392
|
+
npx ai-rules stats --src artifact | grep "focus:" -A20 # focusの実際の値を確認
|
|
393
|
+
npx ai-rules stats --src artifact | grep "category:" -A20 # categoryの実際の値を確認
|
|
394
|
+
|
|
395
|
+
# 個別条件で段階的にテスト
|
|
396
|
+
npx ai-rules extract --attr focus=timeout --src artifact --out /tmp/debug1.md
|
|
397
|
+
npx ai-rules extract --attr category=configuration --src artifact --out /tmp/debug2.md
|
|
398
|
+
|
|
399
|
+
# 結果比較
|
|
400
|
+
ls -la /tmp/debug*.md # ファイルサイズを比較
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**期待と異なるファイルが含まれる場合**
|
|
404
|
+
```bash
|
|
405
|
+
# 実際にマッチしたファイルの確認
|
|
406
|
+
npx ai-rules extract --type coding-rules --src artifact --out /tmp/check.md
|
|
407
|
+
grep "^#" /tmp/check.md | head -10 # ヘッダーを確認してファイル名を特定
|
|
408
|
+
|
|
409
|
+
# 特定ファイルのfrontmatterを確認
|
|
410
|
+
head -15 artifact/path/to/specific/file.md # frontmatter部分を直接確認
|
|
411
|
+
```
|
|
137
412
|
|
|
138
413
|
**出力ファイル設定**
|
|
139
414
|
```yaml
|
|
@@ -162,7 +437,7 @@ recipe:
|
|
|
162
437
|
- 同じoutputファイルに複数アイテムが出力される場合、2番目以降は自動的にappendモード
|
|
163
438
|
- 明示的にmodeを指定することで上書き可能
|
|
164
439
|
|
|
165
|
-
#### 手順
|
|
440
|
+
#### 手順6: FrontMatter とメタデータ設計
|
|
166
441
|
|
|
167
442
|
**直接指定方式**
|
|
168
443
|
```yaml
|
|
@@ -185,7 +460,7 @@ frontmatter:
|
|
|
185
460
|
- 配列: すべての要素を結合
|
|
186
461
|
- オブジェクト: 後の値で上書き
|
|
187
462
|
|
|
188
|
-
#### 手順
|
|
463
|
+
#### 手順7: インポートと拡張性
|
|
189
464
|
|
|
190
465
|
**プリセット活用**
|
|
191
466
|
```yaml
|
|
@@ -310,7 +585,7 @@ recipe:
|
|
|
310
585
|
applyTo: "**/*"
|
|
311
586
|
```
|
|
312
587
|
|
|
313
|
-
#### TypeScript
|
|
588
|
+
#### TypeScriptプロジェクト向け(実際の属性値使用)
|
|
314
589
|
|
|
315
590
|
```yaml
|
|
316
591
|
# TypeScript project comprehensive rules
|
|
@@ -323,19 +598,18 @@ recipe:
|
|
|
323
598
|
|
|
324
599
|
- title: "Custom TypeScript Rules"
|
|
325
600
|
out: "custom-typescript.instructions.md" # ファイル名のみ
|
|
326
|
-
type: coding-rules
|
|
327
|
-
language: typescript
|
|
601
|
+
type: coding-rules # 実際の値を使用
|
|
602
|
+
language: typescript # 実際の値を使用
|
|
328
603
|
filters:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
- performance
|
|
604
|
+
category: best-practices # 実際の値を使用
|
|
605
|
+
focus: timeout # 実際の値を使用
|
|
332
606
|
frontmatter:
|
|
333
607
|
"@description": true
|
|
334
608
|
customization: "high"
|
|
335
609
|
applyTo: "**/*.ts"
|
|
336
610
|
```
|
|
337
611
|
|
|
338
|
-
####
|
|
612
|
+
#### マルチ出力設定(実際の属性値使用)
|
|
339
613
|
|
|
340
614
|
```yaml
|
|
341
615
|
# Generate multiple specialized documents
|
|
@@ -345,21 +619,21 @@ config:
|
|
|
345
619
|
recipe:
|
|
346
620
|
- title: "Development Guidelines"
|
|
347
621
|
out: "development.instructions.md" # ファイル名のみ
|
|
348
|
-
type: coding-rules
|
|
622
|
+
type: coding-rules # 実際の値を使用
|
|
349
623
|
filters:
|
|
350
|
-
category:
|
|
624
|
+
category: best-practices # 実際の値を使用
|
|
351
625
|
|
|
352
626
|
- title: "Testing Guidelines"
|
|
353
|
-
out: "testing.instructions.md"
|
|
354
|
-
type: test
|
|
627
|
+
out: "testing.instructions.md" # ファイル名のみ
|
|
628
|
+
type: test # 実際の値を使用
|
|
355
629
|
filters:
|
|
356
|
-
|
|
630
|
+
focus: timeout # 実際の値を使用
|
|
357
631
|
|
|
358
|
-
- title: "
|
|
359
|
-
out: "
|
|
632
|
+
- title: "Configuration Guidelines"
|
|
633
|
+
out: "configuration.instructions.md" # ファイル名のみ
|
|
360
634
|
filters:
|
|
361
|
-
category: configuration
|
|
362
|
-
focus:
|
|
635
|
+
category: configuration # 実際の値を使用
|
|
636
|
+
focus: structure # 実際の値を使用
|
|
363
637
|
```
|
|
364
638
|
|
|
365
639
|
### カスタマイズ指針
|
|
@@ -383,38 +657,39 @@ recipe:
|
|
|
383
657
|
|
|
384
658
|
#### 技術スタック別設定
|
|
385
659
|
|
|
386
|
-
|
|
660
|
+
**フロントエンド中心(実際の属性値使用)**
|
|
387
661
|
```yaml
|
|
388
662
|
config:
|
|
389
663
|
baseDir: .github/instructions
|
|
390
664
|
|
|
391
665
|
recipe:
|
|
392
666
|
- import: :typescript
|
|
393
|
-
- title: "
|
|
394
|
-
out: "
|
|
395
|
-
type:
|
|
396
|
-
language: [typescript, javascript]
|
|
667
|
+
- title: "Chrome Extension Guidelines"
|
|
668
|
+
out: "chrome-extension-guidelines.instructions.md"
|
|
669
|
+
type: development-rules # 実際の値を使用
|
|
670
|
+
language: [typescript, javascript] # 実際の値を使用
|
|
397
671
|
filters:
|
|
398
|
-
category:
|
|
399
|
-
focus:
|
|
672
|
+
category: chrome-extension # 実際の値を使用
|
|
673
|
+
focus: manifest-configuration # 実際の値を使用
|
|
400
674
|
```
|
|
401
675
|
|
|
402
|
-
|
|
676
|
+
**デスクトップアプリ中心(実際の属性値使用)**
|
|
403
677
|
```yaml
|
|
404
678
|
config:
|
|
405
679
|
baseDir: .github/instructions
|
|
406
680
|
|
|
407
681
|
recipe:
|
|
408
682
|
- import: :typescript
|
|
409
|
-
- title: "
|
|
410
|
-
out: "
|
|
411
|
-
type:
|
|
683
|
+
- title: "Electron Development"
|
|
684
|
+
out: "electron-development.instructions.md"
|
|
685
|
+
type: development-rules # 実際の値を使用
|
|
412
686
|
filters:
|
|
413
|
-
category:
|
|
414
|
-
|
|
687
|
+
category: desktop-app # 実際の値を使用
|
|
688
|
+
framework: electron # 実際の値を使用
|
|
689
|
+
focus: electron # 実際の値を使用
|
|
415
690
|
```
|
|
416
691
|
|
|
417
|
-
|
|
692
|
+
**フルスタック(実際の属性値使用)**
|
|
418
693
|
```yaml
|
|
419
694
|
config:
|
|
420
695
|
baseDir: .github/instructions
|
|
@@ -424,9 +699,9 @@ recipe:
|
|
|
424
699
|
- import: :typescript
|
|
425
700
|
- title: "Full Stack Guidelines"
|
|
426
701
|
out: "fullstack-guidelines.instructions.md"
|
|
427
|
-
type:
|
|
702
|
+
type: development-rules # 実際の値を使用
|
|
428
703
|
filters:
|
|
429
|
-
category: [
|
|
704
|
+
category: [best-practices, configuration] # 実際の値を使用(OR条件)
|
|
430
705
|
```
|
|
431
706
|
|
|
432
707
|
### トラブルシューティング
|
|
@@ -467,10 +742,85 @@ recipe:
|
|
|
467
742
|
|
|
468
743
|
#### 一般的な問題と解決法
|
|
469
744
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
745
|
+
#### 一般的な問題と解決法(属性検証強化版)
|
|
746
|
+
|
|
747
|
+
**フィルタリング結果が空の場合**
|
|
748
|
+
|
|
749
|
+
**Step 1: 属性の実在確認**
|
|
750
|
+
```bash
|
|
751
|
+
# 指定した属性が実際に存在するかチェック
|
|
752
|
+
npx ai-rules stats --src artifact | grep "category:" -A20
|
|
753
|
+
npx ai-rules stats --src artifact | grep "focus:" -A20
|
|
754
|
+
npx ai-rules stats --src artifact | grep "type:" -A20
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
**Step 2: 段階的なデバッグ**
|
|
758
|
+
```bash
|
|
759
|
+
# 個別条件で確認
|
|
760
|
+
npx ai-rules extract --attr category=best-practices --src artifact --out /tmp/debug-cat.md
|
|
761
|
+
npx ai-rules extract --attr focus=timeout --src artifact --out /tmp/debug-focus.md
|
|
762
|
+
npx ai-rules extract --type test --src artifact --out /tmp/debug-type.md
|
|
763
|
+
|
|
764
|
+
# ファイルサイズで結果を確認
|
|
765
|
+
ls -la /tmp/debug-*.md
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
**Step 3: よくある間違いパターン**
|
|
769
|
+
- ❌ `category=best_practices` (アンダースコアは使わない)
|
|
770
|
+
- ✅ `category=best-practices` (ハイフンを使用)
|
|
771
|
+
- ❌ `type=coding_rules` (アンダースコアは使わない)
|
|
772
|
+
- ✅ `type=coding-rules` (ハイフンを使用)
|
|
773
|
+
- ❌ `focus=Time-out` (大文字小文字が違う)
|
|
774
|
+
- ✅ `focus=timeout` (すべて小文字)
|
|
775
|
+
|
|
776
|
+
**属性値の正確な確認方法**
|
|
777
|
+
```bash
|
|
778
|
+
# 実際のファイルから属性値を直接確認
|
|
779
|
+
find artifact -name "*.md" -exec head -10 {} \; | grep -E "^(type|category|focus|language):" | sort | uniq
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
**フィルター条件の組み合わせが適切でない場合**
|
|
783
|
+
|
|
784
|
+
**問題**: 複数条件でAND検索すると該当ファイルがない
|
|
785
|
+
```yaml
|
|
786
|
+
# 問題例: 存在しない組み合わせ
|
|
787
|
+
filters:
|
|
788
|
+
category: chrome-extension
|
|
789
|
+
focus: timeout # chrome-extensionでtimeoutはない可能性
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
**解決方法**:
|
|
793
|
+
```bash
|
|
794
|
+
# 実際の組み合わせを事前に確認
|
|
795
|
+
npx ai-rules extract --attr category=chrome-extension --src artifact --out /tmp/chrome-files.md
|
|
796
|
+
grep -E "^(focus|type|language):" /tmp/chrome-files.md | sort | uniq
|
|
797
|
+
|
|
798
|
+
# 結果から適切な組み合わせを選択
|
|
799
|
+
# 例: chrome-extension + manifest-configuration が適切な組み合わせ
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
**frontmatter属性の記述ミス**
|
|
803
|
+
- 大文字小文字の一致確認: `best-practices` vs `Best-Practices`
|
|
804
|
+
- 配列形式での指定確認: `language: [typescript, javascript]`
|
|
805
|
+
- カンマ区切り vs 配列記法の確認: `typescript,javascript` vs `[typescript, javascript]`
|
|
806
|
+
|
|
807
|
+
**実際のファイル内容と期待の相違**
|
|
808
|
+
|
|
809
|
+
**問題**: 期待するファイルが抽出されない
|
|
810
|
+
```bash
|
|
811
|
+
# 特定ファイルのfrontmatter直接確認
|
|
812
|
+
head -15 artifact/instructions/specific-file.md
|
|
813
|
+
|
|
814
|
+
# そのファイルの属性値を確認
|
|
815
|
+
grep -E "^(type|category|focus|language|applyTo):" artifact/instructions/specific-file.md
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
**解決方法**:
|
|
819
|
+
```bash
|
|
820
|
+
# より広い条件で検索してから絞り込み
|
|
821
|
+
npx ai-rules extract --type coding-rules --src artifact --out /tmp/broad-search.md
|
|
822
|
+
grep "typescript" /tmp/broad-search.md -A5 -B5 # 関連内容を確認
|
|
823
|
+
```
|
|
474
824
|
|
|
475
825
|
**FrontMatter継承が機能しない**
|
|
476
826
|
- @ syntax の正確な記述確認
|
|
@@ -498,9 +848,24 @@ recipe:
|
|
|
498
848
|
|
|
499
849
|
#### 活用ツール
|
|
500
850
|
|
|
501
|
-
|
|
851
|
+
**必須の事前確認コマンド**
|
|
852
|
+
- `npx ai-rules stats --src artifact` - 利用可能属性と値の完全な確認(レシピ作成前に必須)
|
|
502
853
|
- `npx ai-rules presets` - プリセット一覧の表示
|
|
503
|
-
|
|
854
|
+
|
|
855
|
+
**フィルター検証用コマンド**
|
|
856
|
+
- `npx ai-rules extract --type [type-value] --src artifact --out /tmp/test.md` - タイプ別フィルター検証
|
|
857
|
+
- `npx ai-rules extract --language [lang-value] --src artifact --out /tmp/test.md` - 言語別フィルター検証
|
|
858
|
+
- `npx ai-rules extract --attr category=[cat-value] --src artifact --out /tmp/test.md` - カテゴリ別フィルター検証
|
|
859
|
+
- `npx ai-rules extract --attr focus=[focus-value] --src artifact --out /tmp/test.md` - フォーカス別フィルター検証
|
|
860
|
+
|
|
861
|
+
**レシピ実行コマンド**
|
|
862
|
+
- `npx ai-rules extract --recipe [file]` - レシピファイル実行
|
|
863
|
+
- `npx ai-rules extract --recipe :preset-name` - プリセット実行
|
|
864
|
+
|
|
865
|
+
**デバッグ用コマンド**
|
|
866
|
+
- `npx ai-rules extract --recipe [file] --debug` - デバッグ情報付き実行
|
|
867
|
+
- `wc -l /tmp/test-output.md` - 抽出されたファイル数の確認
|
|
868
|
+
- `head -20 /tmp/test-output.md` - 抽出内容の部分確認
|
|
504
869
|
|
|
505
870
|
#### コミュニティリソース
|
|
506
871
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aramassa/ai-rules",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "This repository collects guidelines and instructions for developing AI agents. It contains documents covering communication rules, coding standards, testing strategies, and general operational practices.",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"packages/extract",
|