@camunda8/cli 2.8.0-alpha.1 → 2.8.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PLUGIN-HELP.md +145 -8
- package/README.md +1171 -73
- package/dist/command-dispatch.d.ts.map +1 -1
- package/dist/command-dispatch.js +3 -2
- package/dist/command-dispatch.js.map +1 -1
- package/dist/command-framework.d.ts.map +1 -1
- package/dist/command-framework.js +22 -1
- package/dist/command-framework.js.map +1 -1
- package/dist/command-registry.d.ts +49 -311
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +46 -33
- package/dist/command-registry.js.map +1 -1
- package/dist/commands/completion.d.ts +16 -33
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +31 -689
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/mcp-proxy.d.ts +0 -17
- package/dist/commands/mcp-proxy.d.ts.map +1 -1
- package/dist/commands/mcp-proxy.js +3 -104
- package/dist/commands/mcp-proxy.js.map +1 -1
- package/dist/commands/open.d.ts +3 -44
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +5 -81
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/plugins.d.ts +2 -8
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +2 -28
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/run.d.ts +8 -8
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +60 -60
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/search.d.ts +2 -39
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +2 -83
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/session.d.ts +1 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +5 -0
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/watch.d.ts +2 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +17 -8
- package/dist/commands/watch.js.map +1 -1
- package/dist/completion.d.ts +36 -0
- package/dist/completion.d.ts.map +1 -0
- package/dist/completion.js +816 -0
- package/dist/completion.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -1
- package/dist/config.js.map +1 -1
- package/dist/{commands/deployments.d.ts → deployments.d.ts} +1 -1
- package/dist/deployments.d.ts.map +1 -0
- package/dist/{commands/deployments.js → deployments.js} +8 -8
- package/dist/deployments.js.map +1 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/{commands/help.js → help.js} +68 -4
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +285 -9
- package/dist/index.js.map +1 -1
- package/dist/mcp-proxy-helpers.d.ts +23 -0
- package/dist/mcp-proxy-helpers.d.ts.map +1 -0
- package/dist/mcp-proxy-helpers.js +109 -0
- package/dist/mcp-proxy-helpers.js.map +1 -0
- package/dist/open-helpers.d.ts +52 -0
- package/dist/open-helpers.d.ts.map +1 -0
- package/dist/open-helpers.js +88 -0
- package/dist/open-helpers.js.map +1 -0
- package/dist/plugin-loader.d.ts +61 -2
- package/dist/plugin-loader.d.ts.map +1 -1
- package/dist/plugin-loader.js +229 -22
- package/dist/plugin-loader.js.map +1 -1
- package/dist/plugin-version.d.ts +15 -0
- package/dist/plugin-version.d.ts.map +1 -0
- package/dist/plugin-version.js +37 -0
- package/dist/plugin-version.js.map +1 -0
- package/dist/search-helpers.d.ts +46 -0
- package/dist/search-helpers.d.ts.map +1 -0
- package/dist/search-helpers.js +90 -0
- package/dist/search-helpers.js.map +1 -0
- package/dist/watch-constants.d.ts +7 -0
- package/dist/watch-constants.d.ts.map +1 -0
- package/dist/watch-constants.js +7 -0
- package/dist/watch-constants.js.map +1 -0
- package/package.json +11 -7
- package/dist/commands/deployments.d.ts.map +0 -1
- package/dist/commands/deployments.js.map +0 -1
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/help.js.map +0 -1
- /package/dist/{commands/help.d.ts → help.d.ts} +0 -0
package/PLUGIN-HELP.md
CHANGED
|
@@ -51,7 +51,128 @@ Registry locations by OS:
|
|
|
51
51
|
|
|
52
52
|
## Plugin Structure for Help
|
|
53
53
|
|
|
54
|
-
Plugins can export an optional `metadata` object alongside the required `commands` object
|
|
54
|
+
Plugins can export an optional `metadata` object alongside the required `commands` object.
|
|
55
|
+
|
|
56
|
+
## Plugin Flags
|
|
57
|
+
|
|
58
|
+
Plugins can declare custom flags per command. Flags are declared inline inside the command entry rather than in a separate top-level export.
|
|
59
|
+
|
|
60
|
+
To add flags to a command, replace the bare handler function with an object that has `flags` and `handler` properties:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
export const commands = {
|
|
64
|
+
'my-command': {
|
|
65
|
+
flags: {
|
|
66
|
+
source: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'Source element ID',
|
|
69
|
+
},
|
|
70
|
+
target: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'Target element ID',
|
|
73
|
+
},
|
|
74
|
+
detailed: {
|
|
75
|
+
type: 'boolean',
|
|
76
|
+
description: 'Show detailed output',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
handler: async (args: string[], flags?: Record<string, unknown>) => {
|
|
80
|
+
// Flag values are unknown — cast before use
|
|
81
|
+
const source = flags?.source as string | undefined;
|
|
82
|
+
const target = flags?.target as string | undefined;
|
|
83
|
+
const detailed = flags?.detailed as boolean | undefined;
|
|
84
|
+
console.log('Args:', args);
|
|
85
|
+
console.log('Source:', source);
|
|
86
|
+
console.log('Target:', target);
|
|
87
|
+
console.log('Detailed:', detailed);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Commands without flags continue to use the bare function form:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
export const commands = {
|
|
97
|
+
'my-command': {
|
|
98
|
+
flags: { /* ... */ },
|
|
99
|
+
handler: async (args, flags) => { /* ... */ },
|
|
100
|
+
},
|
|
101
|
+
'other-command': async (args) => { /* no flags needed */ },
|
|
102
|
+
};
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Flag Definition Structure
|
|
106
|
+
|
|
107
|
+
Each flag can have the following properties:
|
|
108
|
+
|
|
109
|
+
- `type`: `'string'` or `'boolean'` (required)
|
|
110
|
+
- `description`: Describes the flag for documentation purposes (required). Not currently shown in `c8ctl help` output.
|
|
111
|
+
- `short`: Single-character alias (optional, e.g., `'s'` for `-s`)
|
|
112
|
+
- `required`: When `true`, the CLI exits with an error if the flag is omitted (optional, defaults to `false`)
|
|
113
|
+
|
|
114
|
+
> **Important:** Plugin flags are checked against c8ctl's built-in flags at runtime with different consequences depending on where the collision occurs:
|
|
115
|
+
> - **Long-name collision** (e.g. `--output`, `--verbose`, `--dry-run`): the entire plugin flag is dropped. A warning is emitted and the handler will not receive the value.
|
|
116
|
+
> - **Short-alias collision** (e.g. `-v`, `-o`, `-h`): only the short alias is stripped. The long flag name still works — `--myflag value` is parsed correctly, but `-m value` is not.
|
|
117
|
+
>
|
|
118
|
+
> Avoid long names like `--output`, `--limit`, `--all`, `--asc`, `--desc`, `--sort-by`, `--dry-run`, `--verbose`, `--fields`, `--profile`, `--help`, `--version`, and short aliases `-o`, `-l`, `-v`, `-p`, `-h`.
|
|
119
|
+
|
|
120
|
+
### Example with Flags
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
// c8ctl-plugin.js
|
|
124
|
+
export const commands = {
|
|
125
|
+
'model': {
|
|
126
|
+
flags: {
|
|
127
|
+
append: {
|
|
128
|
+
type: 'boolean',
|
|
129
|
+
description: 'Append to existing model instead of replacing',
|
|
130
|
+
},
|
|
131
|
+
source: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
description: 'Source element ID for connection',
|
|
134
|
+
short: 's',
|
|
135
|
+
},
|
|
136
|
+
target: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
description: 'Target element ID for connection',
|
|
139
|
+
short: 't',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
handler: async (args, flags) => {
|
|
143
|
+
const [action] = args;
|
|
144
|
+
|
|
145
|
+
if (action === 'connect' && flags?.source && flags?.target) {
|
|
146
|
+
console.log(`Connecting ${flags.source} → ${flags.target}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (flags?.append) {
|
|
150
|
+
console.log('Appending to existing model');
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const metadata = {
|
|
157
|
+
name: 'model-plugin',
|
|
158
|
+
commands: {
|
|
159
|
+
'model': {
|
|
160
|
+
description: 'Modify BPMN models',
|
|
161
|
+
examples: [
|
|
162
|
+
{ command: 'c8ctl model connect --source Gateway_1 --target Task_2', description: 'Connect elements' },
|
|
163
|
+
{ command: 'c8ctl model connect -s Gateway_1 -t Task_2', description: 'Connect using short flags' },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Backward Compatibility
|
|
171
|
+
|
|
172
|
+
Commands declared as bare functions continue to work unchanged:
|
|
173
|
+
- Existing handlers receive `args` only (the `flags` parameter is `undefined`)
|
|
174
|
+
- The handler signature `async (args)` remains valid
|
|
175
|
+
- No migration required for commands that don't use custom flags
|
|
55
176
|
|
|
56
177
|
## Plugin Runtime API
|
|
57
178
|
|
|
@@ -108,7 +229,7 @@ export const commands = {
|
|
|
108
229
|
console.log('Client ready:', typeof client === 'object');
|
|
109
230
|
// implementation
|
|
110
231
|
},
|
|
111
|
-
|
|
232
|
+
|
|
112
233
|
optimize: async (args: string[]) => {
|
|
113
234
|
console.log('Optimizing...');
|
|
114
235
|
// implementation
|
|
@@ -119,8 +240,6 @@ export const commands = {
|
|
|
119
240
|
### JavaScript Example
|
|
120
241
|
|
|
121
242
|
```javascript
|
|
122
|
-
import { c8ctl } from '@camunda8/cli/runtime';
|
|
123
|
-
|
|
124
243
|
// Optional metadata export
|
|
125
244
|
export const metadata = {
|
|
126
245
|
name: 'my-plugin',
|
|
@@ -130,7 +249,7 @@ export const metadata = {
|
|
|
130
249
|
description: 'Deploy all resources in a directory',
|
|
131
250
|
examples: [
|
|
132
251
|
{ command: 'c8ctl deploy-all ./src', description: 'Deploy resources from ./src' },
|
|
133
|
-
{ command: 'c8ctl deploy-all ./src --
|
|
252
|
+
{ command: 'c8ctl deploy-all --path ./src --preview', description: 'Preview without deploying' },
|
|
134
253
|
],
|
|
135
254
|
},
|
|
136
255
|
status: {
|
|
@@ -141,10 +260,28 @@ export const metadata = {
|
|
|
141
260
|
|
|
142
261
|
// Required commands export
|
|
143
262
|
export const commands = {
|
|
144
|
-
'deploy-all':
|
|
145
|
-
|
|
263
|
+
'deploy-all': {
|
|
264
|
+
flags: {
|
|
265
|
+
preview: {
|
|
266
|
+
type: 'boolean',
|
|
267
|
+
description: 'Preview without deploying',
|
|
268
|
+
},
|
|
269
|
+
path: {
|
|
270
|
+
type: 'string',
|
|
271
|
+
description: 'Directory path to deploy from',
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
handler: async (args, flags) => {
|
|
275
|
+
const path = flags?.path || args[0] || './';
|
|
276
|
+
|
|
277
|
+
if (flags?.preview) {
|
|
278
|
+
console.log(`Would deploy from: ${path}`);
|
|
279
|
+
} else {
|
|
280
|
+
console.log(`Deploying from: ${path}`);
|
|
281
|
+
}
|
|
282
|
+
},
|
|
146
283
|
},
|
|
147
|
-
|
|
284
|
+
|
|
148
285
|
status: async (args) => {
|
|
149
286
|
console.log('Checking status...');
|
|
150
287
|
},
|