> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ヘルプ

> コマンドごとのドキュメント、ガイドトピック、機械可読な JSON をターミナルで取得

`difyctl` のヘルプシステムは 4 つの領域をカバーします。[トップレベルの概要](#ヘルプの表示)、[コマンドまたはグループごとのヘルプ](#コマンドまたはグループごとのヘルプ)、[ガイドトピック](#ガイドトピック)、そしてそれらすべての [機械可読な形式](#機械可読ヘルプ) です。ヘルプはすべて stdout に出力され、終了コード `0` で終了します。

## ヘルプの表示

次の 4 つの呼び出し方法は、いずれも同じトップレベルの概要を表示します。

```bash theme={null}
difyctl
difyctl help
difyctl --help
difyctl -h
```

概要には、各コマンドとその概要、3 つの入門例、[グローバルフラグ](/ja/3.13.x/develop/cli/reference/global-flags)、[ガイドトピック](#ガイドトピック) が一覧表示されます。この一覧に本リファレンスへのリンクを添えたものは、[コマンドインデックス](/ja/3.13.x/develop/cli/reference/command-index) を参照してください。

## コマンドまたはグループごとのヘルプ

任意のコマンドに `--help` を付けるか、コマンドの前に `help` を置きます。

```bash theme={null}
difyctl run app --help
difyctl help run app
```

コマンドごとのヘルプには、そのコマンドの説明、使用法の行、引数、デフォルト値付きのフラグ、例が表示されます。

コマンドではなくコマンドグループを指定すると、そのグループのサブコマンドが一覧表示されます。

```bash theme={null}
difyctl auth --help
```

```text theme={null}
COMMANDS
  auth devices list    List active sessions for the current bearer
  auth devices revoke  Revoke one or all session devices
  auth list            List all authenticated contexts (host + account pairs)
  auth login           Sign in to Dify via OAuth device flow
  auth logout          Log out of the active Dify host
  auth whoami          Print the active subject's identity
```

コマンド、トピック、グループのいずれにも一致しない名前は、`unknown help topic: <name>` と候補を表示し、終了コード `1` で失敗します。

## ガイドトピック

長文のトピックは CLI に同梱されており、`difyctl help <topic>` で読みます。

| トピック | 内容 |
| :- | :- |
| `account` | オンボーディングのガイダンス。 |
| `environment` | `DIFY_*` 環境変数に関する CLI 自身の説明。 |
| `agent` | `difyctl` を駆動する Agent 向けのコマンド横断の規約。 |
| `external` | 外部 SSO ユーザー向けのサインインヘルプ。 |

これらのトピックは CLI に組み込まれています。`difyctl` が実際に読み取る変数については、[環境変数](/ja/3.13.x/develop/cli/reference/environment-variables) を参照してください。

## 機械可読ヘルプ

すべてのヘルプ領域が `-o json` と `-o yaml` を受け付けます。`difyctl` を駆動するコーディングエージェントは、主に次の 2 つを使います。[コンパクトなコマンド一覧](#コンパクトなコマンド一覧) でコマンドを選び、そのコマンドの [ディスクリプタ](#コマンドごとのディスクリプタ) で引数とフラグを読み取ります。[完全なドキュメント](#完全なドキュメント) は、コマンド横断の規約とトピック一覧も 1 回でまとめて返します。

### コンパクトなコマンド一覧

トップレベルのヘルプに `--compact` を付けると、各コマンドが 3 つのフィールドだけで出力されます。`command`（コマンドのパス）、`description`（1 行の説明）、`effect` ラベル（`read`、`write`、`destructive`）です。それ以外は含まれないため、一覧全体が小さく、コマンドを選ぶ前に一度で読み切れます。

```bash theme={null}
difyctl help -o json --compact
```

一覧の先頭部分は次のとおりです。

```json theme={null}
{
  "commands": [
    {
      "command": "auth devices list",
      "description": "List active sessions for the current bearer",
      "effect": "read"
    },
    {
      "command": "auth devices revoke",
      "description": "Revoke one or all session devices",
      "effect": "destructive"
    },
    {
      "command": "auth list",
      "description": "List all authenticated contexts (host + account pairs)",
      "effect": "read"
    },
    {
      "command": "auth login",
      "description": "Sign in to Dify via OAuth device flow",
      "effect": "write"
    }
  ]
}
```

`--compact` はトップレベルのヘルプ専用で、`-o json` または `-o yaml` が必要です。コマンドごとのヘルプに付けた場合や、構造化形式を指定しない場合は、使用法エラーとして終了コード `2` で失敗します。

### コマンドごとのディスクリプタ

コマンドを選んだら、そのディスクリプタが一覧に含まれない情報をすべて補います。コマンドごとのヘルプは、どちらの書き方でもディスクリプタを返します。

```bash theme={null}
difyctl help auth whoami -o json
difyctl auth whoami --help -o json
```

```json theme={null}
{
  "command": "auth whoami",
  "description": "Print the active subject's identity",
  "effect": "read",
  "args": [],
  "flags": [
    {
      "name": "json",
      "char": null,
      "type": "boolean",
      "default": false,
      "multiple": false,
      "options": null,
      "description": "emit JSON"
    }
  ],
  "examples": [
    "difyctl auth whoami",
    "difyctl auth whoami --json"
  ],
  "agentGuide": null
}
```

各ディスクリプタには、型とデフォルト値を含むコマンドの引数とフラグ、例、`effect` ラベルが含まれます。存在する場合は、エージェント向けのコマンド固有のガイダンスである `agentGuide` 文字列も含まれます。

### 完全なドキュメント

`--compact` を付けない場合、トップレベルのヘルプはコマンドの全体像を 1 つのドキュメントとして出力します。

```bash theme={null}
difyctl help -o json
```

このドキュメントには 4 つのトップレベルキーがあります。

* `bin`：実行ファイル名（`difyctl`）
* `contract`：終了コード、出力形式、エラー出力の構造、コマンド横断のルール
* `commands`：コマンドごとに 1 つの完全なディスクリプタ
* `topics`：各ガイドトピックの名前と 1 行の概要。本文は `difyctl help <topic>` で読み取る

## 終了コード

| コード | 意味 |
| :- | :- |
| `0` | ヘルプを出力 |
| `1` | 不明なヘルプトピックまたはコマンド名 |
| `2` | トップレベルの `-o json` または `-o yaml` ヘルプ以外での `--compact` |

完全な体系については、[出力形式と終了コード](/ja/3.13.x/develop/cli/reference/output-formats-and-exit-codes) を参照してください。
