update plugin cli guide

This commit is contained in:
Bowen Liang
2025-04-30 16:23:13 +08:00
parent 9ef04ec43e
commit 3e65a35a3c
16 changed files with 147 additions and 104 deletions

0
en/SUMMARY.md Normal file
View File

0
en/link-check-report.md Normal file
View File

View File

@@ -8,7 +8,7 @@ After completing plugin development, you can package your plugin project as a lo
You'll need the Dify plugin development scaffolding tool for packaging plugins. Download the tool from the [official GitHub releases page](https://github.com/langgenius/dify-plugin-daemon/releases).
See the [Initialize Development Tools](../quick-start/develop-plugins/initialize-development-tools.mdx) tutorial for dependency installation and configuration steps.
See the [Install Development Tools](../quick-start/develop-plugins/initialize-development-tools.mdx) tutorial for dependency installation and configuration steps.
Select and download the version appropriate for your operating system from the release assets.

View File

@@ -7,7 +7,7 @@ title: Develop Plugins
You can quickly understand how to develop different types of plugins and master the functional components involved in plugin development through these development examples:
<Card title="Initialize Development Tools" icon="link" href="/en/plugins/quick-start/develop-plugins/initialize-development-tools">
<Card title="Install Development Tools" icon="link" href="/en/plugins/quick-start/develop-plugins/initialize-development-tools">
</Card>
Using the **Google Search** tool as an example to demonstrate how to develop tool-type plugins. For more details, please take refer to the following:

View File

@@ -1,52 +1,67 @@
---
title: Initialize Development Tools
title: Install Development Tools
---
Before start to develop Dify plugins, please prepare the following prerequisites:
* [Dify Plugin CLI tool](https://github.com/langgenius/dify-plugin-daemon?tab=readme-ov-file#cli)
* Python 3.12+
Before start to develop Dify plugins please prepare the following prerequisites:
### **1. Install Dify Plugin CLI Tool**
* Dify plugin scaffolding tool
* Python environment, version ≥ 3.12
The Dify Plugin CLI Tool can be installed either with from Homebrew (on Linux and MacOS) or with the standalone binary executable file (on Windows, Linux and MacOS).
> The Dify plugin development scaffolding tool, also known as `dify-plugin-daemon`, can be regarded as a plugin development SDK.
#### Install with Homebrew
### **1. Installing the Dify Plugin Development Scaffolding Tool**
For the macOS and Linux users, installing Dify Plugin CLI with [Homebrew](https://brew.sh/) is recommended.
Visit the [Dify plugin GitHub page](https://github.com/langgenius/dify-plugin-daemon/releases) and select and download the version suitable for your operating system.
Tap the [Homebrew formula for Dify Plugin CLI tool](https://github.com/langgenius/homebrew-dify), and then install it with `brew install`.
Using **macOS with M-series chips** as an example: Download the `dify-plugin-darwin-arm64` file from the project address mentioned above. Then, in the terminal, navigate to the file's location and grant it execution permissions:
```
chmod +x dify-plugin-darwin-arm64
```bash
brew tap langgenius/dify
brew install dify
```
Run the following command to verify successful installation.
To check the installation, run `dify version` and a version code should be displayed.
```bash
dify version
```
./dify-plugin-darwin-arm64 version
To upgrade the Dify Plugin CLI tool, run the following command:
```bash
brew upgrade dify
```
#### Install with binary executable
1. Download the binary executable
On the asset list of the release page of [Dify Plugin CLI Tool](https://github.com/langgenius/dify-plugin-daemon/releases), choose and download the binary executable for the OS system (Linux / macOS / Windows) and the chip architecture (`amd64` for x86 chips / `arm64` for ARM or Apple's M chips).
Using **MacOS with M chips** as an example. Download the `dify-plugin-darwin-arm64` file and grant it execution permissions by running the command:
```bash
chmod +x ./dify-plugin-darwin-arm64
mv ./dify-plugin-darwin-arm64 ./dify
```
To check the installation, run `./dify version` and a version code should be displayed.
```bash
./dify version
```
> If the system shows an "Apple cannot verify" error, go to **Settings → Privacy & Security → Security**, and click the "Open Anyway" button.
After running the command, the installation is successful, if the terminal returns version information like `v0.0.1-beta.15`.
<Info>
**Tips:**
If you want to use the `dify` command globally in your system to run the scaffolding tool, it's recommended to rename the binary file to `dify` and copy it to the `/usr/local/bin` system path.
After configuration, entering the `dify version` command in the terminal will output the version number.
<img
src="https://assets-docs.dify.ai/2025/01/74e57a57c1ae1cc70f4a45084cbbb37e.png"
className="mx-auto"
alt=""
/>
**Tips:**
To use `dify` command globally system-wide, it's recommended to rename the binary file to `dify` and copy it to the
`/usr/local/bin` system path.
</Info>
### **2. Initialize Python Environment**
### **2. Install Python**
Python version 3.12 or higher is required. Python installer is available on [python.org](https://www.python.org/downloads/).
For detailed instructions, please refer to the [Python installation](https://pythontest.com/python/installing-python-3-11/) tutorial. Python version 3.12 or higher is required.
### 3. **Develop plugins**

View File

@@ -373,11 +373,11 @@
| 163 | extension-plugin.md | extension-plugin |
| 163 | 扩展 Agent 策略 | ../../schema-definition/agent |
| 163 | 扩展 Agent 策略 | ../../schema-definition/agent |
| 164 | 初始化开发工具 | plugins/quick-start/develop-plugins/initialize-development-tools |
| 164 | 安装插件开发工具 | plugins/quick-start/develop-plugins/initialize-development-tools |
| 164 | agent-strategy-plugin.md | agent-strategy-plugin |
| 164 | bundle.md | bundle |
| 165 | Tool 插件 | plugins/quick-start/develop-plugins/tool-plugin |
| 165 | 初始化开发工具 | initialize-development-tools |
| 165 | 安装插件开发工具 | initialize-development-tools |
| 165 | 接口文档 | ../../schema-definition/ |
| 165 | ProviderConfig | ../../schema-definition/general-specifications.md#providerconfig |
| 165 | 工具接口文档 | ../../schema-definition/tool |
@@ -390,8 +390,8 @@
| 165 | 反向调用 Dify 能力 | ../../schema-definition/reverse-invocation-of-the-dify-service/ |
| 165 | 工具 | ../../schema-definition/tool |
| 165 | 模型 | ../../schema-definition/model/ |
| 165 | 初始化开发工具 | initialize-development-tools |
| 165 | 初始化开发工具 | initialize-development-tools |
| 165 | 安装插件开发工具 | initialize-development-tools |
| 165 | 安装插件开发工具 | initialize-development-tools |
| 165 | 接口文档 | ../../schema-definition/ |
| 165 | Bundle 插件:将多个插件打包 | bundle |
| 165 | Manifest | ../../schema-definition/manifest |
@@ -399,7 +399,7 @@
| 165 | 反向调用 Dify 能力 | ../../schema-definition/reverse-invocation-of-the-dify-service/ |
| 165 | 工具 | ../../schema-definition/tool |
| 165 | 模型 | ../../schema-definition/model/ |
| 165 | 初始化开发工具 | initialize-development-tools |
| 165 | 安装插件开发工具 | initialize-development-tools |
| 165 | Manifest | ../../schema-definition/manifest |
| 166 | Model 插件 | plugins/quick-start/develop-plugins/model-plugin/README |
| 166 | 创建模型供应商 | create-model-providers |
@@ -407,11 +407,11 @@
| 166 | 自定义 | customizable-model |
| 166 | 调试插件 | ../../debug-plugins |
| 167 | 创建模型供应商 | plugins/quick-start/develop-plugins/model-plugin/create-model-providers |
| 167 | 初始化开发工具 | ../initialize-development-tools |
| 167 | 安装插件开发工具 | ../initialize-development-tools |
| 167 | 模型接口文档 | ../../../schema-definition/model/model-schema |
| 167 | 接入预定义模型 | ../../../../guides/model-configuration/predefined-model |
| 167 | 接入自定义模型 | ../../../../guides/model-configuration/customizable-model |
| 167 | 初始化开发工具 | ../initialize-development-tools |
| 167 | 安装插件开发工具 | ../initialize-development-tools |
| 168 | 接入预定义模型 | plugins/quick-start/develop-plugins/model-plugin/integrate-the-predefined-model |
| 168 | 模型供应商 | create-model-providers |
| 168 | AIModelEntity | ../../../schema-definition/model/model-designing-rules.md#aimodelentity |
@@ -546,7 +546,7 @@
| 196 | 发布至个人 GitHub 仓库 | plugins/publish-plugins/publish-plugin-on-personal-github-repo |
| 196 | 打包插件 | broken-reference |
| 197 | 本地发布与分享 | plugins/publish-plugins/package-plugin-file-and-publish |
| 197 | 初始化开发工具 | ../quick-start/develop-plugins/initialize-development-tools |
| 197 | 安装插件开发工具 | ../quick-start/develop-plugins/initialize-development-tools |
| 197 | 远程连接测试 | ../quick-start/develop-plugins/extension-plugin.md#tiao-shi-cha-jian |
| 198 | 常见问题 | plugins/faq |
| 202 | 后端 | development/backend/README |
@@ -700,7 +700,7 @@
| 122 | 使用全套开源工具构建 LLM 应用实战:在 Dify 调用 Baichuan 开源模型能力 | learn-more/use-cases/practical-implementation-of-building-llm-applications-using-a-full-set-of-open-source-tools |
| 126 | 开发 Slack Bot 插件 | plugins/best-practice/develop-a-slack-bot-plugin |
| 126 | 开发 Slack Bot 插件 | plugins/best-practice/develop-a-slack-bot-plugin |
| 128 | 初始化开发工具 | ../initialize-development-tools |
| 128 | 安装插件开发工具 | ../initialize-development-tools |
| 128 | 快速开始:开发 Extension 插件 | ../extension-plugin |
| 128 | 反向调用App | ../../../schema-definition/reverse-invocation-of-the-dify-service/app |
| 128 | 开发 Extension 插件 | ../extension-plugin |
@@ -747,7 +747,7 @@
| 行号 | 链接文本 | 链接 URL |
|------|----------|----------|
| 42 | 初始化开发工具 | ../initialize-development-tools |
| 42 | 安装插件开发工具 | ../initialize-development-tools |
| 64 | 快速开始:开发 Extension 插件 | ../extension-plugin |
| 76 | 反向调用App | ../../../schema-definition/reverse-invocation-of-the-dify-service/app |
| 316 | 开发 Extension 插件 | ../extension-plugin |

View File

@@ -2,56 +2,67 @@
title: 開発環境のセットアップ
---
Difyプラグインの開発を始める前に、以下の前提条件を準備してください
* [DifyプラグインCLIツール](https://github.com/langgenius/dify-plugin-daemon?tab=readme-ov-file#cli)
* Python 3.12+
Difyプラグインを開発する前に、次の準備を整えましょう。
### **1. DifyプラグインCLIツールのインストール**
* Difyプラグイン用のスキャフォールディングツール
* バージョン3.12以上のPython環境
DifyプラグインCLIツールは、HomebrewLinuxおよびMacOSまたはスタンドアロンのバイナリ実行ファイルWindows、Linux、MacOS用を使用してインストールできます。
### **1. Difyプラグインスキャフォールディングツールのインストール方法**
#### Homebrewでインストール
> Dify プラグイン開発スキャフォールディングツール、別名 `dify-plugin-daemon` は、プラグイン開発 SDK として見なすことができます。
MacOSおよびLinuxユーザーには、[Homebrew](https://brew.sh/)を使用したDifyプラグインCLIのインストールを推奨します。
[DifyプラグインのGitHubページ](https://github.com/langgenius/dify-plugin-daemon/releases) へアクセスし、ご利用のオペレーティングシステムに適したバージョンをダウンロードしてください
[DifyプラグインCLIツールのHomebrewフォーミュラ](https://github.com/langgenius/homebrew-dify)をタップし、`brew install`でインストールします
**Mシリーズチップ搭載のmacOS**向けのダウンロード例:プロジェクトページから`dify-plugin-darwin-arm64`をダウンロードし、ターミナルを開いてファイルのあるディレクトリに移動した後、以下のコマンドで実行権限を付与します:
```
chmod +x dify-plugin-darwin-arm64
```bash
brew tap langgenius/dify
brew install dify
```
インストールが成功したかどうかを確認するには、次のコマンドを実行します。
```
./dify-plugin-darwin-arm64 version
インストールを確認するために、`dify version`を実行すると、バージョンコードが表示されます。
```bash
dify version
```
> システムが「Appleによって検証されていません」と警告を出す場合は、**設定 → セキュリティとプライバシー → セキュリティ**ボタンを開き、「とにかく開く」を選択してください。
DifyプラグインCLIツールをアップグレードするには、次のコマンドを実行します
コマンドを実行し、`v0.0.1-beta.15`などのバージョン情報が表示されれば、インストール完了です。
```bash
brew upgrade dify
```
#### バイナリ実行ファイルでインストール
1. バイナリ実行ファイルをダウンロードします。
[DifyプラグインCLIツールのリリースページ](https://github.com/langgenius/dify-plugin-daemon/releases)のアセットリストから、OSシステムLinux / MacOS / Windowsとチップアーキテクチャ`amd64`はx86チップ、`arm64`はARMまたはAppleのMチップ用のバイナリ実行ファイルを選択してダウンロードします。
**MチップのMacOS**を例にとると、`dify-plugin-darwin-arm64`ファイルをダウンロードし、次のコマンドを実行して実行権限を付与します:
```bash
chmod +x ./dify-plugin-darwin-arm64
mv ./dify-plugin-darwin-arm64 ./dify
```
インストールを確認するために、`./dify version`を実行すると、バージョンコードが表示されます。
```bash
./dify version
```
> システムに「Appleは確認できません」というエラーが表示された場合は、**設定 → プライバシーとセキュリティ → セキュリティ**に移動し、「今すぐ開く」ボタンをクリックします。
<Info>
**Tips:**
`dify`コマンドをシステム全体で利用したい場合は、ダウンロードしたバイナリファイルの名前を`dify`に変更し、`/usr/local/bin`にコピーすることをお勧めします。
この設定を行うと、ターミナルから`dify version`と入力するだけで、インストールされたバージョンを確認できます。
<img
src="https://assets-docs.dify.ai/2025/01/74e57a57c1ae1cc70f4a45084cbbb37e.png"
alt=""
/>
**ヒント:**
`dify`コマンドをグローバルにシステム全体で使用するには、バイナリファイルの名前を`dify`に変更し、`/usr/local/bin`システムパスにコピーすることを推奨します。
</Info>
### **2. Initialize Python Environment**
### **2. Pythonのインストール**
For detailed instructions, please refer to the [Python installation](https://pythontest.com/python/installing-python-3-11/) tutorial, or ask the LLM for complete installation instructions.
Pythonのバージョンは3.12以上が必要です。Pythonのインストーラは[python.org](https://www.python.org/downloads/)で入手できます。
### **2. Python環境の設定**
### **3. プラグインの開発**
Pythonのインストール方法については、[Pythonインストール](https://pythontest.com/python/installing-python-3-11/)チュートリアルを参照するか、LLMに詳細な手順を尋ねてみてください。
### **3. プラグインの開発について**
さまざまなタイプのプラグイン開発の例については、以下の内容を参照してください。
さまざまなタイプのプラグイン開発の具体例については、以下のリンクをご参照ください。

View File

@@ -38,7 +38,7 @@ Slack 是一个自由开放的实时办公通信平台,拥有丰富的 API。
### 前置准备
* Dify 插件脚手架工具,详细说明请参考[初始化开发工具](../initialize-development-tools)。
* Dify 插件脚手架工具,详细说明请参考[安装插件开发工具](../initialize-development-tools)。
* Python 环境,版本号 ≥ 3.12,详细说明请参考 [Python 安装教程](https://pythontest.com/python/installing-python-3-11/),或询问 LLM 获取完整的安装教程。
* 创建 Slack App 并获取 OAuth Token

View File

@@ -15,7 +15,7 @@ title: 打包为本地文件与分享
### 前置准备
* **Dify 插件开发工具**,详细说明请参考[初始化开发工具](../quick-start/develop-plugins/initialize-development-tools)。
* **Dify 插件开发工具**,详细说明请参考[安装插件开发工具](../quick-start/develop-plugins/initialize-development-tools)。
配置完成后,在终端输入 `dify version` 命令,检查是否输出版本号信息以确认已安装必要的开发工具。

View File

@@ -8,7 +8,7 @@ description: 'Author: Yeuoly, Allen'
你可以通过以下**插件开发示例**,了解如何开发不同类型的插件,快速上手并掌握插件开发过程中可能涉及的功能组件。正式开始插件开发前,需要在本地环境中安装并初始化开发脚手架。请参考以下内容:
<Card title="初始化开发工具" icon="link" href="./initialize-development-tools">
<Card title="安装插件开发工具" icon="link" href="./initialize-development-tools">
initialize-development-tools.md
</Card>

View File

@@ -11,7 +11,7 @@ Agent 策略插件能够帮助 LLM 执行推理或决策逻辑,包括工具选
* Dify 插件脚手架工具
* Python 环境,版本号 ≥ 3.12
关于如何准备插件开发的脚手架工具,详细说明请参考[初始化开发工具](initialize-development-tools)。
关于如何准备插件开发的脚手架工具,详细说明请参考[安装插件开发工具](initialize-development-tools)。
<Info>**Tips**:在终端运行 `dify version` 命令,检查是否出现版本号以确认成功安装脚手架工具。</Info>

View File

@@ -16,7 +16,7 @@ Bundle 插件包是多个插件的集合。它可以将多个插件打包在一
* Dify 插件脚手架工具
* Python 环境,版本号 ≥ 3.10
关于如何准备插件开发的脚手架工具,详细说明请参考[初始化开发工具](initialize-development-tools)。
关于如何准备插件开发的脚手架工具,详细说明请参考[安装插件开发工具](initialize-development-tools)。
### 创建 Bundle 项目

View File

@@ -10,7 +10,7 @@ title: Extension 插件
* Dify 插件脚手架工具
* Python 环境,版本号 ≥ 3.12
关于如何准备插件开发的脚手架工具,详细说明请参考[初始化开发工具](initialize-development-tools)。
关于如何准备插件开发的脚手架工具,详细说明请参考[安装插件开发工具](initialize-development-tools)。
### 创建新项目 <a href="#chuang-jian-xin-xiang-mu" id="chuang-jian-xin-xiang-mu"></a>

View File

@@ -1,51 +1,68 @@
---
title: 初始化开发工具
title: 安装插件开发工具
---
在开始开发 Dify 插件之前,请准备以下先决条件:
* [Dify 插件 CLI 工具](https://github.com/langgenius/dify-plugin-daemon?tab=readme-ov-file#cli)
* Python 3.12+
开发 Dify 插件需要进行以下准备。
### **1. 安装 Dify 插件 CLI 工具**
* Dify 插件脚手架工具
* Python 环境,版本号 ≥ 3.12
Dify 插件 CLI 工具可以通过 Homebrew在 Linux 和 MacOS 上)或独立的二进制可执行文件(在 Windows、Linux 和 MacOS 上)进行安装。
> Dify 插件开发脚手架工具又称为 `dify-plugin-daemon`,可以被视作**插件开发 SDK**。
#### 使用 Homebrew 安装
### **1. 安装 Dify 插件开发脚手架工具**
对于 MacOS 和 Linux 用户,建议使用 [Homebrew](https://brew.sh/) 安装 Dify 插件 CLI。
访问 [Dify Plugin CLI](https://github.com/langgenius/dify-plugin-daemon/releases) 项目地址,下载并安装最新版本号和对应操作系统的工具
本文**以装载 M 系列芯片的 macOS** 为例。下载 `dify-plugin-darwin-arm64` 文件后,赋予其执行权限。
先添加 [Dify 插件 CLI 工具的 Homebrew 配方](https://github.com/langgenius/homebrew-dify),然后使用 `brew install` 进行安装
```bash
chmod +x dify-plugin-darwin-arm64
brew tap langgenius/dify
brew install dify
```
运行以下命令检查安装是否成功
要检查安装情况,可以运行 `dify version`,应该会显示版本代码
```bash
dify version
```
要升级 Dify 插件 CLI 工具,请运行以下命令:
```bash
./dify-plugin-darwin-arm64 version
brew upgrade dify
```
> 若提示 “Apple 无法验证” 错误,请前往 **“设置 → 隐私与安全性 → 安全性”**,轻点 “仍要打开” 按钮。
#### 使用二进制可执行文件安装
运行命令后,终端若返回类似 `v0.0.1-beta.15` 的版本号信息,则说明安装成功。
1. 下载二进制可执行文件
在 [Dify 插件 CLI 工具](https://github.com/langgenius/dify-plugin-daemon/releases) 的发布页面资产列表中选择并下载适合操作系统Linux / MacOS / Windows和芯片架构`amd64` 适用于 x86 芯片 / `arm64` 适用于 ARM 或 Apple 的 M 芯片)的二进制可执行文件。
以 **MacOS M 芯片** 为例。下载 `dify-plugin-darwin-arm64` 文件并通过运行以下命令授予执行权限:
```bash
chmod +x ./dify-plugin-darwin-arm64
mv ./dify-plugin-darwin-arm64 ./dify
```
要检查安装情况,可以运行 `./dify version`,应该会显示版本代码。
```bash
./dify version
```
> 如果系统显示“Apple 无法验证”的错误,请前往 **设置 → 隐私与安全 → 安全性**,点击“仍然打开”按钮。
<Info>
如果想要在系统全局使用 `dify` 命令运行脚手架工具,建议将二进制文件重命名为 `dify` 并拷贝至 `/usr/local/bin` 系统路径
配置完成后,在终端输入 `dify version` 命令后将输出版本号信息。
![](https://assets-docs.dify.ai/2025/02/74e57a57c1ae1cc70f4a45084cbbb37e.png)
**提示:**
要在系统范围内全局使用 `dify` 命令,建议将二进制文件重命名为 `dify` 并复制到 `/usr/local/bin` 系统路径
</Info>
### **2. 初始化 Python 环境**
### **2. 安装 Python**
详细说明请参考 [Python 安装教程](https://pythontest.com/python/installing-python-3-11/),或询问 LLM 安装版本号 ≥ 3.12 的 Python 环境,
需要 Python 3.12 或更高版本。Python 安装程序可在 [python.org](https://www.python.org/downloads/) 上获取。
### 3. 开发插件
### **3. 开发插件**
请参考以下内容查看不同类型插件开发示例。
请参考以下内容,以获取不同类型插件开发示例。
<Card title="tool-plugin" icon="link" href="tool-plugin">
工具插件

View File

@@ -10,7 +10,7 @@ title: 创建模型供应商
* Dify 插件脚手架工具
* Python 环境,版本号 ≥ 3.12
关于如何准备插件开发的脚手架工具,详细说明请参考[初始化开发工具](../initialize-development-tools)。
关于如何准备插件开发的脚手架工具,详细说明请参考[安装插件开发工具](../initialize-development-tools)。
### 创建新项目 <a href="#chuang-jian-xin-xiang-mu" id="chuang-jian-xin-xiang-mu"></a>

View File

@@ -24,7 +24,7 @@ title: Tool 插件
* Dify 插件脚手架工具
* Python 环境,版本号 ≥ 3.12
关于如何准备插件开发的脚手架工具,详细说明请参考[初始化开发工具](initialize-development-tools)。
关于如何准备插件开发的脚手架工具,详细说明请参考[安装插件开发工具](initialize-development-tools)。
### 创建新项目