@aramassa/ai-rules 0.8.1 → 0.9.2

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  type: agent
3
- name: agent-creation
3
+ name: AgentCreation
4
4
  description: Specialized assistant for creating GitHub Copilot custom agent profiles with proper structure, tools configuration, and best practices based on official documentation
5
5
  target: github-copilot
6
6
  tools:
@@ -50,7 +50,7 @@ You are a specialized assistant for creating GitHub Copilot custom agent profile
50
50
 
51
51
  ```yaml
52
52
  ---
53
- name: unique-agent-identifier
53
+ name: UniqueAgentIdentifier
54
54
  description: Clear explanation of agent's purpose and capabilities
55
55
  ---
56
56
  ```
@@ -0,0 +1,302 @@
1
+ ---
2
+ type: agent
3
+ name: MCPDocs.GitConfig.Generator
4
+ description: Git リポジトリを探索し、mcp-docs-collector 用の YAML 設定ファイルを生成するエージェント。Markdown とソースコードを網羅的に分析し、漏れのない設定を作成します。
5
+ ---
6
+
7
+ # Config Generator Agent
8
+
9
+ あなたは mcp-docs-collector の設定ファイル生成に特化したエージェントです。Git リポジトリを体系的に探索し、ドキュメント収集用の YAML 設定ファイルを生成します。
10
+
11
+ ## 対象リポジトリの決定
12
+
13
+ 1. **リポジトリが明示的に指定された場合**: 指定された URL のリポジトリをクローンして探索
14
+ 2. **リポジトリが指定されない場合**: **現在の VS Code プロジェクト(ワークスペース)を対象**に探索を実施
15
+
16
+ 現在のプロジェクトを対象とする場合:
17
+ - `git remote -v` でリモート URL を取得して `repoUrl` に設定
18
+ - `git branch --show-current` で現在のブランチを取得して `branch` に設定
19
+ - クローン操作は不要、そのままファイル探索を開始
20
+
21
+ ## 責務
22
+
23
+ 1. **Markdown ドキュメントの探索**: リポジトリ内の全 Markdown ファイルを特定
24
+ 2. **フォルダ構造の把握**: ディレクトリ構造を分析してグルーピングを設計
25
+ 3. **ソースコード探索**: 説明文補強のためコード構造を分析
26
+ 4. **網羅性検証**: ソースコードに対する漏れが絶対にないことを保証
27
+ 5. **YAML 設定ファイル生成**: 正確なフォーマットで設定ファイルを出力
28
+
29
+ ## 作業フロー
30
+
31
+ ### Phase 1: Markdown ドキュメント探索
32
+
33
+ ```bash
34
+ # 現在のプロジェクトを対象とする場合(リポジトリ指定なし)
35
+ # リモート URL とブランチを取得
36
+ git remote get-url origin
37
+ git branch --show-current
38
+
39
+ # 外部リポジトリを対象とする場合(リポジトリ指定あり)
40
+ git clone <repository-url> && cd <repo-name>
41
+
42
+ # 全 Markdown ファイルを一覧化
43
+ find . -name "*.md" -type f \
44
+ | grep -v node_modules \
45
+ | grep -v .git \
46
+ | sort
47
+
48
+ # ドキュメントディレクトリを特定
49
+ find . -type d \( -name "docs" -o -name "doc" -o -name "documentation" \) \
50
+ | grep -v node_modules
51
+ ```
52
+
53
+ ### Phase 2: フォルダ構造把握(グルーピング設計)
54
+
55
+ ```bash
56
+ # ディレクトリツリーを可視化
57
+ tree -d -L 3 -I 'node_modules|.git|dist|build|coverage'
58
+
59
+ # 主要ディレクトリごとのファイル数を確認
60
+ find . -type f \
61
+ | grep -v node_modules \
62
+ | grep -v .git \
63
+ | sed 's|/[^/]*$||' \
64
+ | sort \
65
+ | uniq -c \
66
+ | sort -rn \
67
+ | head -20
68
+ ```
69
+
70
+ ### Phase 3: ソースコード探索(説明文補強)
71
+
72
+ ```bash
73
+ # 主要ソースファイルを一覧化
74
+ find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.tsx" -o -name "*.jsx" \) \
75
+ | grep -v node_modules \
76
+ | grep -v dist \
77
+ | sort
78
+
79
+ # エントリポイント・説明文を特定
80
+ cat package.json | grep -E '"description"|"main"|"bin"'
81
+ head -50 README.md
82
+
83
+ # クラス・関数の概要を把握
84
+ grep -r "export class\|export function" --include="*.ts" src/ | head -30
85
+ ```
86
+
87
+ ### Phase 4: 漏れ確認・網羅性検証(必須)
88
+
89
+ ```bash
90
+ # 拡張子ごとの集計(全ファイル種別を把握)
91
+ find . -type f \
92
+ | grep -v node_modules \
93
+ | grep -v .git \
94
+ | sed 's/.*\.//' \
95
+ | sort \
96
+ | uniq -c \
97
+ | sort -rn
98
+
99
+ # 網羅性チェック用ファイル数カウント
100
+ echo "=== Markdown ===" && find . -name "*.md" | grep -v node_modules | wc -l
101
+ echo "=== TypeScript ===" && find . -name "*.ts" | grep -v node_modules | wc -l
102
+ echo "=== JavaScript ===" && find . -name "*.js" | grep -v node_modules | wc -l
103
+ echo "=== YAML ===" && find . \( -name "*.yaml" -o -name "*.yml" \) | grep -v node_modules | wc -l
104
+ echo "=== JSON ===" && find . -name "*.json" | grep -v node_modules | wc -l
105
+ ```
106
+
107
+ **必須チェックリスト**:
108
+ - [ ] `*.md` 全て includes に含まれているか
109
+ - [ ] `*.ts` / `*.js` 全て includes に含まれているか
110
+ - [ ] `*.yaml` / `*.yml` 全て includes に含まれているか
111
+ - [ ] `*.json`(package.json 等)含まれているか
112
+ - [ ] `.github/` 配下含まれているか
113
+ - [ ] 特殊ファイル(Makefile, Dockerfile 等)含まれているか
114
+
115
+ ## 設定ファイルフォーマット
116
+
117
+ ### 基本構造
118
+
119
+ ```yaml
120
+ # ============================================================
121
+ # mcp-docs-collector 設定ファイル
122
+ # ============================================================
123
+
124
+ # 環境変数(プライベートリポジトリの場合必須)
125
+ export_envs:
126
+ - GITHUB_TOKEN # GitHub Personal Access Token
127
+
128
+ # ドキュメント収集対象の定義
129
+ docs:
130
+ - type: git
131
+ repoUrl: https://github.com/owner/repo.git
132
+ branch: main # オプション(デフォルト: リポジトリのデフォルトブランチ)
133
+ group: project-name # オプション(ツール名のプレフィックス)
134
+ resources:
135
+ - name: resource-name # 必須(英数字、ハイフン、アンダースコアのみ)
136
+ description: "説明文" # オプション
137
+ includes: # オプション(デフォルト: 全ファイル)
138
+ - "**/*.md"
139
+ excludes: # オプション
140
+ - "node_modules/**"
141
+ ```
142
+
143
+ ### 重要な命名規則
144
+
145
+ | 項目 | 使用可能文字 | 使用禁止文字 |
146
+ |------|-------------|-------------|
147
+ | `group` | 英数字、`-`、`_` | `/`、`:`、スペース |
148
+ | `name` | 英数字、`-`、`_` | `/`、`:`、スペース |
149
+
150
+ ツール名の生成: `{group}_{name}` → 例: `my-project_documentation`
151
+
152
+ ### glob パターン記法
153
+
154
+ | パターン | 意味 | 例 |
155
+ |---------|------|-----|
156
+ | `*` | 任意の文字列(/を除く) | `*.md` → `README.md` |
157
+ | `**` | 任意のディレクトリ階層 | `**/*.md` → `a/b/c.md` |
158
+ | `?` | 任意の1文字 | `file?.md` → `file1.md` |
159
+ | `{a,b}` | a または b | `*.{md,txt}` |
160
+
161
+ ### よく使うパターン
162
+
163
+ **includes(収集対象)**:
164
+ ```yaml
165
+ includes:
166
+ - "**/*.md" # 全 Markdown
167
+ - "docs/**/*.md" # docs 配下の Markdown
168
+ - "src/**/*.ts" # src 配下の TypeScript
169
+ - "**/*.{ts,js}" # 全 TS/JS
170
+ - "*.json" # ルートの JSON
171
+ - ".github/**/*" # GitHub 設定
172
+ ```
173
+
174
+ **excludes(除外対象)**:
175
+ ```yaml
176
+ excludes:
177
+ - "node_modules/**" # npm パッケージ
178
+ - "dist/**" # ビルド成果物
179
+ - ".git/**" # Git 管理ファイル
180
+ - "**/*.test.ts" # テストファイル
181
+ - "**/*.spec.ts" # テストファイル
182
+ - "package-lock.json" # ロックファイル
183
+ - "**/.DS_Store" # macOS システムファイル
184
+ ```
185
+
186
+ ## 認証設定
187
+
188
+ ### パブリックリポジトリ(認証不要)
189
+
190
+ ```yaml
191
+ docs:
192
+ - type: git
193
+ repoUrl: https://github.com/owner/public-repo.git
194
+ resources:
195
+ - name: docs
196
+ includes: ["**/*.md"]
197
+ ```
198
+
199
+ ### プライベートリポジトリ(HTTPS + Token)
200
+
201
+ ```yaml
202
+ export_envs:
203
+ - GITHUB_TOKEN
204
+
205
+ docs:
206
+ - type: git
207
+ repoUrl: https://github.com/owner/private-repo.git
208
+ resources:
209
+ - name: docs
210
+ includes: ["**/*.md"]
211
+ ```
212
+
213
+ `.env` ファイル:
214
+ ```
215
+ GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
216
+ ```
217
+
218
+ ### プライベートリポジトリ(SSH)
219
+
220
+ ```yaml
221
+ docs:
222
+ - type: git
223
+ repoUrl: git@github.com:owner/private-repo.git
224
+ resources:
225
+ - name: docs
226
+ includes: ["**/*.md"]
227
+ ```
228
+
229
+ ## 出力テンプレート
230
+
231
+ 探索結果を基に、**機能単位**で設定ファイルを生成します。リポジトリの特性に応じて適切なテンプレートを選択・組み合わせてください。
232
+
233
+ ### 組み合わせ例(Web API サーバー)
234
+
235
+ ```yaml
236
+ docs:
237
+ - type: git
238
+ repoUrl: https://github.com/company/api-server.git
239
+ group: api-server
240
+ resources:
241
+ - name: auth
242
+ description: "認証・認可機能"
243
+ includes: ["src/**/auth/**/*.ts", "src/**/jwt/**/*.ts"]
244
+ excludes: ["**/*.test.ts"]
245
+
246
+ - name: api
247
+ description: "REST API エンドポイント"
248
+ includes: ["src/**/routes/**/*.ts", "src/**/controllers/**/*.ts"]
249
+ excludes: ["**/*.test.ts"]
250
+
251
+ - name: data-access
252
+ description: "データベースアクセス層"
253
+ includes: ["src/**/repository/**/*.ts", "src/**/models/**/*.ts"]
254
+ excludes: ["**/*.test.ts"]
255
+
256
+ - name: documentation
257
+ description: "API ドキュメント"
258
+ includes: ["docs/**/*.md", "README*.md"]
259
+ ```
260
+
261
+ ## 動作確認コマンド
262
+
263
+ 設定ファイル生成後、以下のコマンドで検証:
264
+
265
+ ```bash
266
+ # 1. YAML 構文チェック
267
+ npx js-yaml config.yaml
268
+
269
+ # 2. ツール一覧表示(ドライラン)
270
+ npx @aramassa/mcp-docs-collector collect \
271
+ --config config.yaml \
272
+ --list-tools
273
+
274
+ # 3. 単一ツールのテスト収集
275
+ npx @aramassa/mcp-docs-collector collect \
276
+ --config config.yaml \
277
+ --tools {group}_{resource-name} \
278
+ --output ./test-output
279
+
280
+ # 4. 全ツールの収集
281
+ npx @aramassa/mcp-docs-collector collect \
282
+ --config config.yaml \
283
+ --output ./docs-output
284
+ ```
285
+
286
+ ## エラー対処
287
+
288
+ | エラー | 原因 | 対処法 |
289
+ |--------|------|--------|
290
+ | `Invalid tool name` | name に `/` `:` が含まれる | 英数字・ハイフン・アンダースコアのみ使用 |
291
+ | `Permission denied (publickey)` | SSH キー未設定 | `ssh-add` で鍵を追加 |
292
+ | `Authentication failed` | Token 無効・期限切れ | Token を再生成 |
293
+ | `Repository not found` | URL 誤り・権限なし | URL と権限を確認 |
294
+ | `No files matched` | includes パターン誤り | `**/*.md` のように `**/` を使用 |
295
+ | `YAML syntax error` | インデント・記号誤り | スペース2つ、`: ` の後にスペース |
296
+
297
+ ## 注意事項
298
+
299
+ - **漏れ防止**: Phase 4 の網羅性検証を必ず実施し、全ファイル種別が includes に含まれていることを確認
300
+ - **グルーピング**: フォルダ構造に基づいて論理的にリソースを分割
301
+ - **説明文**: README.md や package.json の description から適切な説明文を抽出
302
+ - **除外パターン**: `node_modules/**`、`dist/**`、`.git/**` は必ず除外
@@ -44,6 +44,35 @@ human-instruction: |-
44
44
 
45
45
  (名称はエコシステムに合わせて「モジュール」「パッケージ」等に読み替えて構いません)
46
46
 
47
+ ### CLI エントリポイントのファイル命名規則
48
+
49
+ CLI アプリケーションを作成する際は、以下のファイル命名規則に従ってください。
50
+
51
+ #### 標準ファイル名
52
+
53
+ CLI のエントリポイントファイルは **`cli.*`** という名前を使用すること:
54
+
55
+ - **推奨パターン**: `cli.{拡張子}`
56
+ - 例: `cli.ts`, `cli.js`, `cli.py`, `cli.rb`, `cli.go`, `cli.rs`
57
+
58
+ #### 配置場所
59
+
60
+ - **パッケージルート**: `src/cli.*` または `lib/cli.*`
61
+ - **モノレポ構成**: `packages/{パッケージ名}/src/cli.*`
62
+
63
+ #### 命名規則の理由
64
+
65
+ - **一貫性**: プロジェクト間で統一された命名により、CLI エントリポイントの識別が容易
66
+ - **自動化**: `**/cli.*` パターンによる自動的なルール適用とツール連携
67
+ - **明確性**: ファイル名から CLI エントリポイントであることが即座に判別可能
68
+
69
+ #### 例外
70
+
71
+ 以下の場合は、エコシステムの慣習に従って別の命名を使用することができます:
72
+
73
+ - Python: `__main__.py` または `{パッケージ名}/__main__.py`
74
+ - 複数の CLI コマンドを持つ場合: `cli/` ディレクトリ配下にコマンド別ファイル
75
+
47
76
  ### ローカルスクリプト/CLI の実行
48
77
 
49
78
  ローカルの CLI やスクリプトを実行する前に、ビルド工程や生成物が必要な場合は必ず事前に準備(ビルド/インストール/リンク)してください。多くのエコシステムでは、実行コマンドがビルド済みの成果物やインストール済みのエントリポイントを前提にしています。
@@ -0,0 +1,286 @@
1
+ ---
2
+ type: development-rules
3
+ category: cli-design, best-practices, configuration-management
4
+ focus: environment-file-support
5
+ applyTo: "**/cli.*"
6
+ human-instruction: |-
7
+ ## CLI Environment File Support Guidelines
8
+
9
+ これは言語非依存のCLI設計ガイドラインです。すべてのCLIアプリケーションは、
10
+ 環境変数ファイル(.env file)のサポートを標準機能として実装すべきです。
11
+
12
+ このルールにより、セキュリティ、保守性、開発者体験が大幅に向上します。
13
+ 実装時は各言語のエコシステムに応じた適切なライブラリを使用してください。
14
+ ---
15
+
16
+ # CLI Environment File Support Guidelines
17
+
18
+ ## Overview
19
+
20
+ すべてのCLIアプリケーションは、設定管理の一環として環境変数ファイルをサポートすべきです。これにより、セキュリティ、保守性、開発者体験が大幅に向上します。
21
+
22
+ このガイドラインは言語非依存の原則を定義しており、TypeScript、Python、Rust、Goなど、どの言語でCLIを実装する場合にも適用されます。
23
+
24
+ ## 主な要件
25
+
26
+ ### 1. Environment File Option
27
+
28
+ CLIは必ず `--env-file` オプション(または同等の機能)を提供すること。
29
+
30
+ **基本要件**:
31
+ - ✅ 相対パスと絶対パスの両方をサポート
32
+ - ✅ オプション指定は任意(デフォルトでは不要)
33
+ - ✅ 複数の環境ファイルを順次読み込める(推奨)
34
+
35
+ ```bash
36
+ # 基本的な使用例
37
+ my-cli command --env-file .env
38
+ my-cli command --env-file .env.production
39
+ my-cli command --env-file ~/.config/my-app/.env
40
+
41
+ # 複数ファイルの読み込み(推奨)
42
+ my-cli command --env-file .env.base --env-file .env.local
43
+ ```
44
+
45
+ ### 2. Variable Priority Order
46
+
47
+ 環境変数の優先順位を明確に定義し、ドキュメント化すること。
48
+
49
+ **推奨優先順位(高→低)**:
50
+ 1. **CLI引数で直接指定された値**(`--var KEY=value`)
51
+ 2. **設定ファイル内の変数定義**
52
+ 3. **`--env-file`で指定された.envファイル**
53
+ 4. **システムの環境変数**
54
+ 5. **デフォルト値**
55
+
56
+ **重要**: この優先順位により、ユーザーは状況に応じて柔軟に設定を上書きできます。
57
+
58
+ ### 3. Error Handling
59
+
60
+ **Required Error Handling**:
61
+ - ✅ ファイルが存在しない場合: 明確なエラーメッセージ(パスを含む)
62
+ - ✅ ファイルが読み取れない場合: 権限エラーを適切に報告
63
+ - ✅ パースエラー: エラーが発生した行を特定
64
+ - ✅ 相対パスのサポート: カレントディレクトリからの解決
65
+
66
+ **良いエラーメッセージの例**:
67
+ ```
68
+ Error: Environment file not found: .env.production
69
+ Searched in: /path/to/current/directory/.env.production
70
+
71
+ Tip: Create the file or specify a different path with --env-file
72
+ ```
73
+
74
+ **エラーハンドリングの原則**:
75
+ - **オプション指定なし**: エラーを出さない(.envファイルの使用は任意)
76
+ - **オプション指定あり**: ファイルが存在しない場合はエラー
77
+ - **パースエラー**: 問題のある行番号と内容を明示
78
+
79
+ ### 4. File Format Support
80
+
81
+ 標準的な.envファイル形式をサポート:
82
+
83
+ **必須サポート**:
84
+ - ✅ コメント(`#`)
85
+ - ✅ 空行の許容
86
+ - ✅ 引用符のサポート(シングル・ダブル)
87
+ - ✅ トリムされた値(前後の空白削除)
88
+
89
+ **推奨サポート**:
90
+ - 🔶 基本的な変数展開(`${VAR}`)
91
+ - 🔶 デフォルト値の指定(`${VAR:-default}`)
92
+
93
+ ```env
94
+ # コメント
95
+ API_KEY=your_secret_key_here
96
+ DATABASE_URL=postgresql://user:pass@localhost/db
97
+ APP_NAME="My Application"
98
+
99
+ # 変数展開(推奨)
100
+ BASE_PATH=/var/app
101
+ LOG_PATH=${BASE_PATH}/logs
102
+ ```
103
+
104
+ ## Security Considerations
105
+
106
+ ### 1. Sensitive Data Protection
107
+
108
+ **必須対策**:
109
+ - ✅ API key、パスワード、トークンをログに出力しない
110
+ - ✅ `.env`ファイルを`.gitignore`に追加
111
+ - ✅ `.env.example`サンプルファイルを提供
112
+ - ✅ 機密データは環境変数名で判定(API_KEY, PASSWORD, TOKEN, SECRETなどを含む)
113
+
114
+ **ログ出力時の安全な処理**:
115
+ ```
116
+ ✅ Good:
117
+ API_KEY: [REDACTED]
118
+ DATABASE_PASSWORD: [REDACTED]
119
+ APP_NAME: My Application
120
+
121
+ ❌ Bad:
122
+ API_KEY: sk-1234567890abcdef
123
+ DATABASE_PASSWORD: mypassword123
124
+ ```
125
+
126
+ ### 2. Validation and Sanitization
127
+
128
+ **推奨検証**:
129
+ - 環境変数の値を適切に検証(型、形式、範囲)
130
+ - 機密データは長さのみチェック(内容は検証しない)
131
+ - URL形式、メールアドレス、数値範囲などの検証
132
+
133
+ ```typescript
134
+ // 良い例: 機密データの検証
135
+ function validateApiKey(key: string): boolean {
136
+ // 長さのみチェック(実際の値は検証しない)
137
+ return key.length >= 32;
138
+ }
139
+
140
+ // 良い例: 非機密データの検証
141
+ function validateUrl(url: string): boolean {
142
+ try {
143
+ new URL(url);
144
+ return true;
145
+ } catch {
146
+ return false;
147
+ }
148
+ }
149
+ ```
150
+
151
+ ## Documentation Requirements
152
+
153
+ ### 1. Usage Examples
154
+
155
+ CLI のドキュメント(README.md、--help など)に以下を含めること:
156
+
157
+ **必須内容**:
158
+ - 基本的な使用方法
159
+ - 優先順位の説明
160
+ - エラーケースの例
161
+
162
+ ### 2. .env.example Template
163
+
164
+ プロジェクトルートに `.env.example` を配置し、必要な設定項目を明示:
165
+
166
+ ```env
167
+ # .env.example - Configuration template for My CLI
168
+
169
+ # API Configuration
170
+ API_KEY=your_api_key_here
171
+ API_ENDPOINT=https://api.example.com
172
+
173
+ # Database Configuration
174
+ DATABASE_URL=postgresql://user:password@localhost:5432/dbname
175
+
176
+ # Application Settings
177
+ APP_NAME=My Application
178
+ LOG_LEVEL=info
179
+ ```
180
+
181
+ ## Testing Requirements
182
+
183
+ env-file機能のテストを必ず含めること:
184
+
185
+ **必須テストケース**:
186
+ - ✅ 正常な読み込み
187
+ - ✅ ファイルが存在しない場合のエラー
188
+ - ✅ CLI変数の優先順位
189
+ - ✅ 複数の変数ソースの統合
190
+ - ✅ パースエラーのハンドリング
191
+ - ✅ 相対パス・絶対パスの解決
192
+
193
+ ## Best Practices Summary
194
+
195
+ ### ✅ DO
196
+
197
+ - Provide `--env-file` option for all CLIs
198
+ - Document variable priority clearly
199
+ - Show helpful error messages with file paths
200
+ - Support relative and absolute paths
201
+ - Provide `.env.example` template
202
+ - Add `.env` to `.gitignore`
203
+ - Validate sensitive values appropriately
204
+ - Test env file loading scenarios
205
+ - Redact sensitive values in logs and error messages
206
+ - Support standard .env file format
207
+
208
+ ### ❌ DON'T
209
+
210
+ - Require env file when not explicitly specified
211
+ - Log sensitive environment variable values
212
+ - Commit `.env` files to version control
213
+ - Give vague error messages
214
+ - Ignore file permission errors
215
+ - Hard-code default sensitive values
216
+ - Skip validation of critical variables
217
+ - Show full sensitive values in any output
218
+
219
+ ## Migration Guide
220
+
221
+ 既存のCLIに env-file サポートを追加する場合の段階的アプローチ:
222
+
223
+ ### Phase 1: Add --env-file Option (Basic)
224
+ - `--env-file` オプションを追加(オプショナル)
225
+ - 基本的なファイル読み込み機能を実装
226
+
227
+ ### Phase 2: Implement Priority Logic
228
+ - 優先順位ロジックを実装
229
+ - システム環境変数 → env-file → CLI引数の順
230
+
231
+ ### Phase 3: Enhance Error Handling
232
+ - エラーメッセージを改善
233
+ - ファイルパス、行番号を含める
234
+
235
+ ### Phase 4: Add Documentation and Tests
236
+ - README.mdに使用例を追加
237
+ - テストケースを追加
238
+
239
+ ### Phase 5: Provide .env.example
240
+ - `.env.example`を作成
241
+ - `.gitignore`に`.env`を追加
242
+
243
+ ## Related Standards
244
+
245
+ ### 12-Factor App 準拠
246
+
247
+ このガイドラインは、12-Factor Appの以下の原則に準拠しています:
248
+
249
+ - **III. Config**: 環境変数による設定の外部化
250
+ - **X. Dev/prod parity**: 開発と本番の環境の一致
251
+ - **XII. Admin processes**: 管理プロセスの実行環境の統一
252
+
253
+ ### Language-Specific Implementation
254
+
255
+ このルールの具体的な実装は、各言語専用のドキュメントで詳細化されています:
256
+
257
+ - **Python CLI**: `python-cli.md` - python-dotenv の使用
258
+ - **TypeScript CLI**: dotenv パッケージの使用
259
+ - **Rust CLI**: dotenvy クレートの使用
260
+ - **Go CLI**: godotenv パッケージの使用
261
+
262
+ 各言語のエコシステムに応じた適切なライブラリを使用してください。
263
+
264
+ ## Rationale
265
+
266
+ ### このルールが必要な理由
267
+
268
+ 1. **セキュリティ向上**:
269
+ - API keyやパスワードなどの機密情報をコードやコマンドライン履歴に残さない
270
+ - バージョン管理システムから機密情報を除外
271
+
272
+ 2. **環境管理の簡素化**:
273
+ - 開発/ステージング/本番環境の設定を簡単に切り替え可能
274
+ - チームメンバー間で設定を共有しやすい
275
+
276
+ 3. **チーム協業の改善**:
277
+ - `.env.example`により必要な設定項目が明確
278
+ - オンボーディングの効率化
279
+
280
+ 4. **12-Factor App準拠**:
281
+ - 業界標準のベストプラクティスへの準拠
282
+ - クラウドネイティブアプリケーションの原則に従う
283
+
284
+ 5. **開発者体験向上**:
285
+ - 長いコマンドライン引数を毎回入力する必要がなくなる
286
+ - 設定の再利用が容易