diff options
Diffstat (limited to 'packages/web/src/content/docs/ja/modes.mdx')
| -rw-r--r-- | packages/web/src/content/docs/ja/modes.mdx | 331 |
1 files changed, 331 insertions, 0 deletions
diff --git a/packages/web/src/content/docs/ja/modes.mdx b/packages/web/src/content/docs/ja/modes.mdx new file mode 100644 index 000000000..79025e281 --- /dev/null +++ b/packages/web/src/content/docs/ja/modes.mdx @@ -0,0 +1,331 @@ +--- +title: モード +description: さまざまなユースケースに応じたさまざまなモード。 +--- + +:::注意 +モードは、opencode config の `agent` オプションを通じて設定されるようになりました。の +`mode` オプションは非推奨になりました。 [詳細はこちら](/docs/agents)。 +::: + +opencode のモードを使用すると、さまざまなユースケースに合わせて動作、ツール、プロンプトをカスタマイズできます。 + +**ビルド** と **プラン** という 2 つの組み込みモードが付属しています。カスタマイズできます +これらを使用するか、opencode config を通じて独自の設定を行います。 + +セッション中にモードを切り替えることも、構成ファイルでモードを構成することもできます。 + +--- + +## 内蔵 + +opencode には 2 つの組み込みモードが付属しています。 + +--- + +### 建てる + +ビルドは、すべてのツールが有効になっている **デフォルト** モードです。これは、ファイル操作やシステム コマンドへのフル アクセスが必要な開発作業の標準モードです。 + +--- + +### プラン + +計画と分析のために設計された制限付きモード。プラン モードでは、次のツールはデフォルトで無効になっています。 + +- `write` - 新しいファイルを作成できません +- `edit` - 計画自体の詳細を示す `.opencode/plans/*.md` にあるファイルを除き、既存のファイルを変更できません +- `patch` - パッチを適用できません +- `bash` - シェルコマンドを実行できません + +このモードは、コードベースに実際の変更を加えずに、AI にコードを分析させたり、変更を提案したり、計画を作成させたい場合に便利です。 + +--- + +## スイッチング + +セッション中に _Tab_ キーを使用してモードを切り替えることができます。または、設定された `switch_mode` キーバインド。 + +参照: [コードのフォーマット構成については、Formatters](/docs/formatters)。 + +--- + +## 設定する + +組み込みモードをカスタマイズしたり、構成を通じて独自のモードを作成したりできます。モードは次の 2 つの方法で設定できます。 + +### JSON構成 + +`opencode.json` 構成ファイルでモードを構成します。 + +```json title="opencode.json" +{ + "$schema": "https://opencode.ai/config.json", + "mode": { + "build": { + "model": "anthropic/claude-sonnet-4-20250514", + "prompt": "{file:./prompts/build.txt}", + "tools": { + "write": true, + "edit": true, + "bash": true + } + }, + "plan": { + "model": "anthropic/claude-haiku-4-20250514", + "tools": { + "write": false, + "edit": false, + "bash": false + } + } + } +} +``` + +### マークダウン構成 + +マークダウン ファイルを使用してモードを定義することもできます。それらを次の場所に置きます。 + +- グローバル: `~/.config/opencode/agents/` +- プロジェクト: `.opencode/modes/` + +```markdown title="~/.config/opencode/modes/review.md" +--- +model: anthropic/claude-sonnet-4-20250514 +temperature: 0.1 +tools: + write: false + edit: false + bash: false +--- + +You are in code review mode. Focus on: + +- Code quality and best practices +- Potential bugs and edge cases +- Performance implications +- Security considerations + +Provide constructive feedback without making direct changes. +``` + +マークダウン ファイル名はモード名になります (例: `review.md` は `review` モードを作成します)。 + +これらの構成オプションを詳しく見てみましょう。 + +--- + +### モデル + +`model` 設定を使用して、このモードのデフォルト モデルをオーバーライドします。さまざまなタスクに最適化されたさまざまなモデルを使用する場合に役立ちます。たとえば、計画にはより高速なモデルを、実装にはより有能なモデルを使用します。 + +```json title="opencode.json" +{ + "mode": { + "plan": { + "model": "anthropic/claude-haiku-4-20250514" + } + } +} +``` + +--- + +### 温度 + +`temperature` 構成を使用して、AI の応答のランダム性と創造性を制御します。値が低いほど、応答はより集中的かつ決定的になりますが、値が高いほど、創造性と変動性が高まります。 + +```json title="opencode.json" +{ + "mode": { + "plan": { + "temperature": 0.1 + }, + "creative": { + "temperature": 0.8 + } + } +} +``` + +通常、温度値の範囲は 0.0 ~ 1.0 です。 + +- **0.0-0.2**: 非常に焦点が絞られた決定的な応答。コード分析と計画に最適です。 +- **0.3-0.5**: 創造性を備えたバランスの取れた応答。一般的な開発タスクに適しています。 +- **0.6-1.0**: より創造的で多様な応答。ブレーンストーミングや探索に役立ちます。 + +```json title="opencode.json" +{ + "mode": { + "analyze": { + "temperature": 0.1, + "prompt": "{file:./prompts/analysis.txt}" + }, + "build": { + "temperature": 0.3 + }, + "brainstorm": { + "temperature": 0.7, + "prompt": "{file:./prompts/creative.txt}" + } + } +} +``` + +温度が指定されていない場合、opencode はモデル固有のデフォルトを使用します (通常、ほとんどのモデルでは 0、Qwen モデルでは 0.55)。 + +--- + +### プロンプト + +`prompt` 構成を使用して、このモードのカスタム システム プロンプト ファイルを指定します。プロンプト ファイルには、モードの目的に固有の指示が含まれている必要があります。 + +```json title="opencode.json" +{ + "mode": { + "review": { + "prompt": "{file:./prompts/code-review.txt}" + } + } +} +``` + +このパスは、構成ファイルが配置されている場所に対する相対パスです。したがって、これは次の場合に機能します +グローバルなオープンコード構成とプロジェクト固有の構成の両方。 + +--- + +### ツール + +`tools` 設定を使用して、このモードでどのツールを使用できるかを制御します。特定のツールを `true` または `false` に設定することで、有効または無効にすることができます。 + +```json +{ + "mode": { + "readonly": { + "tools": { + "write": false, + "edit": false, + "bash": false, + "read": true, + "grep": true, + "glob": true + } + } + } +} +``` + +ツールが指定されていない場合は、すべてのツールがデフォルトで有効になります。 + +--- + +#### 利用可能なツール + +ここでは、モード設定を通じて制御できるすべてのツールを示します。 + +|ツール |説明 | +| ----------- | ----------------------- | +| `bash` |シェルコマンドを実行する | +| `edit` |既存のファイルを変更する | +| `write` |新しいファイルを作成する | +| `read` |ファイルの内容を読み取る | +| `grep` |ファイルの内容を検索 | +| `glob` |パターンでファイルを検索 | +| `list` |ディレクトリの内容をリストする | +| `patch` |ファイルにパッチを適用する | +| `todowrite` | ToDo リストを管理する | +| `todoread` | ToDo リストを読む | +| `webfetch` | Web コンテンツを取得する | + +--- + +## カスタムモード + +構成に追加することで、独自のカスタム モードを作成できます。両方のアプローチを使用した例を次に示します。 + +### JSON設定の使用 + +```json title="opencode.json" {4-14} +{ + "$schema": "https://opencode.ai/config.json", + "mode": { + "docs": { + "prompt": "{file:./prompts/documentation.txt}", + "tools": { + "write": true, + "edit": true, + "bash": false, + "read": true, + "grep": true, + "glob": true + } + } + } +} +``` + +### マークダウンファイルの使用 + +モード ファイルをプロジェクト固有モードの場合は `.opencode/modes/` に、グローバル モードの場合は `~/.config/opencode/modes/` に作成します。 + +```markdown title=".opencode/modes/debug.md" +--- +temperature: 0.1 +tools: + bash: true + read: true + grep: true + write: false + edit: false +--- + +You are in debug mode. Your primary goal is to help investigate and diagnose issues. + +Focus on: + +- Understanding the problem through careful analysis +- Using bash commands to inspect system state +- Reading relevant files and logs +- Searching for patterns and anomalies +- Providing clear explanations of findings + +Do not make any changes to files. Only investigate and report. +``` + +```markdown title="~/.config/opencode/modes/refactor.md" +--- +model: anthropic/claude-sonnet-4-20250514 +temperature: 0.2 +tools: + edit: true + read: true + grep: true + glob: true +--- + +You are in refactoring mode. Focus on improving code quality without changing functionality. + +Priorities: + +- Improve code readability and maintainability +- Apply consistent naming conventions +- Reduce code duplication +- Optimize performance where appropriate +- Ensure all tests continue to pass +``` + +--- + +### ユースケース + +さまざまなモードの一般的な使用例をいくつか示します。 + +- **ビルド モード**: すべてのツールを有効にした完全な開発作業 +- **計画モード**: 変更を加えずに分析および計画を立てる +- **レビュー モード**: 読み取り専用アクセスとドキュメント ツールによるコード レビュー +- **デバッグ モード**: bash および読み取りツールを有効にして調査に重点を置きます +- **ドキュメント モード**: ファイル操作を使用してドキュメントを作成しますが、システム コマンドは使用しません + +また、さまざまなユースケースにさまざまなモデルが適していることがわかるかもしれません。 |
