Files
cline-multi-mirror/docs/sdk/plugin-install.mdx
T
HybridTalentComputing 8d519391b1 Sync with upstream v3.83.0
Replace all files with clean upstream Cline v3.83.0 content.
ShengSuanYun provider code automatically removed.
2026-05-15 13:02:01 +08:00

141 lines
3.7 KiB
Plaintext

---
title: "Installing Plugins"
sidebarTitle: "Installing Plugins"
description: "Install plugins from npm, git, or local sources using the CLI or programmatically."
---
The Cline CLI provides a `plugin install` command to install plugins from various sources. You can also load plugins programmatically via session config.
## CLI Installation
Use the `cline plugin install` command to install plugins from npm, git repositories, or local paths.
```sh
cline plugin install <source> [options]
```
The shorthand `cline plugin i` works as well.
### Install from npm
```sh
cline plugin install --npm @scope/plugin-name
```
Installs the package from the npm registry into the Cline plugin directory.
### Install from Git
```sh
cline plugin install --git https://github.com/owner/repo.git
cline plugin install --git github.com/owner/repo
```
Clones the repository (shallow, with blobless filter for speed) and installs its dependencies. The `.git` directory is excluded from the final install.
### Install from Local Source
```sh
cline plugin install ./path/to/plugin.ts # Single file
cline plugin install /absolute/path/to/dir # Directory with package.json
```
Supports both files and directories. Local installs copy the source, filter out `.git` and `node_modules`, and run `npm install` to resolve dependencies.
### Options
| Option | Description |
|--------|-------------|
| `--npm` | Treat the source as an npm package name |
| `--git` | Treat the source as a git repository URL |
| `--force` | Overwrite an existing plugin at the same path |
| `--json` | Output results as JSON (useful for scripting) |
| `--cwd` | Working directory for relative paths |
### Examples
```sh
# Install a local plugin directory
cline plugin install ./my-custom-plugin
# Install an npm package as a plugin
cline plugin install --npm @cline/plugin-sql
# Install from a GitHub repo
cline plugin install --git https://github.com/my-org/my-plugin.git
# Force reinstall an existing plugin
cline plugin install --force --npm @scope/plugin-name
# Use shorthand
cline plugin i --git github.com/owner/repo
```
### Listing Installed Plugins
Installed plugins appear in the `plugins` section of your CLI config:
```sh
cline config
```
## Programmatic Installation
### Using `pluginPaths` (ClineCore)
In SDK code, load plugins from file paths using the `pluginPaths` session config option:
```typescript
import { ClineCore } from "@cline/sdk"
const cline = await ClineCore.create({ clientName: "my-app" })
await cline.start({
config: {
systemPrompt: "Analyze this project",
// ...model/runtime config
pluginPaths: ["/absolute/path/to/plugin.ts"],
},
})
```
Plugin files must export an `AgentPlugin` as the default export.
### Using `plugins` (Agent Runtime)
When using the `Agent` or `AgentRuntime` directly, pass plugin instances in the `plugins` array:
```typescript
import { Agent } from "@cline/sdk"
import { myPlugin } from "./my-plugin"
const agent = new Agent({
providerId: "anthropic",
modelId: "claude-sonnet-4-6",
plugins: [myPlugin],
})
```
### Using `extensions` (ClineCore)
With `ClineCore`, use the `extensions` config array instead:
```typescript
import { ClineCore } from "@cline/sdk"
const cline = await ClineCore.create({ clientName: "my-app" })
await cline.start({
config: {
systemPrompt: "Analyze customer records",
extensions: [myPlugin],
},
})
```
## Next Steps
- **Learn about [Plugins](/sdk/plugins)** — Understand what plugins are and their benefits.
- **Follow the [Writing Plugins](/sdk/guides/writing-plugins) guide** — Build and distribute your own plugin.
- **Explore [Plugin Examples](/sdk/plugin-examples)** — Copy ready-to-run plugin examples from the SDK repository.