You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugins can extend the CLI with custom commands via the `contributes.commands` manifest field. The CLI automatically discovers and loads these commands at startup.
164
+
### `os doctor`
146
165
147
-
### How to Create a CLI Plugin
166
+
-`-v, --verbose` — Show fix suggestions for warnings
167
+
-`--scan-deprecations` — Scan for deprecated patterns
148
168
149
-
**1. Declare commands in the plugin manifest:**
169
+
## oclif Plugin System
150
170
151
-
```typescript
152
-
exportdefaultdefineStack({
153
-
manifest: {
154
-
id: 'com.acme.marketplace',
155
-
version: '1.0.0',
156
-
type: 'plugin',
157
-
name: 'Marketplace Plugin',
158
-
contributes: {
159
-
commands: [
160
-
{
161
-
name: 'marketplace',
162
-
description: 'Manage marketplace applications',
163
-
module: './dist/cli.js',
164
-
},
165
-
],
166
-
},
167
-
},
168
-
});
171
+
The CLI uses oclif's built-in plugin system for extensibility. Third-party plugins (e.g., cloud commands, marketplace tools) can extend the CLI without modifying the main package.
172
+
173
+
### How Plugin Extension Works
174
+
175
+
1.**Create an oclif plugin package** with its own `oclif` config in `package.json`
176
+
2.**Export oclif Command classes** from the plugin's `src/commands/` directory
177
+
3.**Install the plugin** via `os plugins install <package>` or declare it in the main CLI's `oclif.plugins`
178
+
179
+
### Creating a CLI Plugin
180
+
181
+
**1. Configure the plugin's `package.json`:**
182
+
183
+
```json
184
+
{
185
+
"name": "@acme/plugin-marketplace",
186
+
"oclif": {
187
+
"commands": {
188
+
"strategy": "pattern",
189
+
"target": "./dist/commands",
190
+
"glob": "**/*.js"
191
+
}
192
+
}
193
+
}
169
194
```
170
195
171
-
**2. Export Commander.js commands from the module:**
0 commit comments