@camunda8/cli 4.4.0-alpha.1 → 4.4.0
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/dist/default-plugins/element-template/AGENTS.md +11 -1
- package/dist/default-plugins/element-template/README.md +192 -0
- package/dist/default-plugins/element-template/c8ctl-plugin.js +3124 -81
- package/dist/default-plugins/element-template/docs/design.md +108 -0
- package/dist/default-plugins/element-template/migration/migrates-from.schema.json +241 -0
- package/dist/framework/command-registry.d.ts +1 -1
- package/dist/framework/command-registry.js +1 -1
- package/dist/framework/command-registry.js.map +1 -1
- package/dist/framework/ui/completion.d.ts.map +1 -1
- package/dist/framework/ui/completion.js +61 -19
- package/dist/framework/ui/completion.js.map +1 -1
- package/package.json +2 -1
|
@@ -10,7 +10,8 @@ version resolution.
|
|
|
10
10
|
| File | Purpose |
|
|
11
11
|
| --- | --- |
|
|
12
12
|
| `c8ctl-plugin.ts` | Plugin API (metadata + commands export), subcommand dispatch table |
|
|
13
|
-
| `commands/<name>.ts` | One file per subcommand: `apply`, `edit`, `get`, `get-properties`, `info`, `search`, `sync` |
|
|
13
|
+
| `commands/<name>.ts` | One file per subcommand: `apply`, `edit`, `get`, `get-properties`, `info`, `search`, `sync`, `update`. `update` is a thin wrapper over `commands/migrate.ts` |
|
|
14
|
+
| `migration/` | The migration engine behind `update`: recipe parser (`recipe.ts`, schema in `migrates-from.schema.json`), step resolution (`steps.ts`), value resolution (`plan.ts`), applying to a headless modeler (`apply.ts`) and the report model (`report.ts`). **Self-contained: nothing in this folder may import from c8ctl or from the rest of the plugin**, so it can be lifted out into a library. `migration-output.ts` (outside it) renders the report. |
|
|
14
15
|
| `template-ref.ts` | `parseTemplateRef`, `readBpmnInput`, `getExecutionPlatformVersion`, `resolveOotbTemplate`, `loadTemplate` |
|
|
15
16
|
| `cache.ts` | Cache I/O, sync, search, version resolution |
|
|
16
17
|
| `releases.ts` | `camunda/connectors` GitHub releases: listing, newest-release-per-minor selection, bundle download, tar.gz reader |
|
|
@@ -97,6 +98,15 @@ version resolution.
|
|
|
97
98
|
npm run build:vendor && node --experimental-strip-types --test tests/unit/element-template.test.ts
|
|
98
99
|
```
|
|
99
100
|
|
|
101
|
+
Test fixtures in `tests/fixtures/element-templates/` are synthetic. Never
|
|
102
|
+
commit upstream connector templates (see its `SOURCES.md`). To check the AI
|
|
103
|
+
Agent v1 to v2 migration against the real templates, fetched at a pinned
|
|
104
|
+
`camunda/connectors` commit:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
C8CTL_FIDELITY=1 node --experimental-strip-types --test tests/unit/element-template-migration-upstream-fidelity.test.ts
|
|
108
|
+
```
|
|
109
|
+
|
|
100
110
|
Smoke-test against the live connectors releases (writes to a throwaway
|
|
101
111
|
dir):
|
|
102
112
|
|
|
@@ -16,6 +16,7 @@ The verb is organized as a workflow: discover → inspect → act → export →
|
|
|
16
16
|
| `info <template>` | Show the template metadata card (id, version, applies-to, engines, docs). `--engine-version` resolves the latest compatible version. |
|
|
17
17
|
| `get-properties <template> [<name>...]` | List settable properties — condensed by default, `--detailed` for full cards. `--engine-version` resolves the latest compatible version. |
|
|
18
18
|
| `apply <template> <element-id> [<file.bpmn>]` | Apply a template to a BPMN element (in place, or to stdout). |
|
|
19
|
+
| `update <template-id> [<element-id>] [<file.bpmn>]` | Move all elements that use a template to its latest version, or to another template with `--to`, migrating their values. |
|
|
19
20
|
| `get <template>` | Print the raw template JSON to stdout (pipe-friendly). |
|
|
20
21
|
| `sync` | Populate / refresh the local OOTB template cache. **Run this once before any other OOTB subcommand.** |
|
|
21
22
|
|
|
@@ -101,6 +102,197 @@ c8ctl element-template sync
|
|
|
101
102
|
c8ctl element-template sync --prune # also drop entries no longer in a selected release
|
|
102
103
|
```
|
|
103
104
|
|
|
105
|
+
## Migrating to a newer template
|
|
106
|
+
|
|
107
|
+
`update <template-id>` moves every element that uses that template to a newer
|
|
108
|
+
version of it, or to a different template. Values the new template binds under
|
|
109
|
+
another key are moved along instead of being dropped, and a report lists what
|
|
110
|
+
happened.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Preview moving all elements to the latest compatible version of their template
|
|
114
|
+
c8ctl element-template update io.camunda.connectors.HttpJson.v2 process.bpmn --dry-run
|
|
115
|
+
|
|
116
|
+
# Update one element, pinned to a version
|
|
117
|
+
c8ctl element-template update io.camunda.connectors.HttpJson.v2 Task_1 process.bpmn \
|
|
118
|
+
--to io.camunda.connectors.HttpJson.v2@15 --in-place
|
|
119
|
+
|
|
120
|
+
# Move all elements to another template (its embedded recipe moves renamed values)
|
|
121
|
+
c8ctl element-template update io.camunda.connectors.agenticai.aiagent.v1 process.bpmn \
|
|
122
|
+
--to io.camunda.connectors.agenticai.ai-agent-task.v2 --in-place
|
|
123
|
+
|
|
124
|
+
# Same, with a recipe from a file, or a single value moved by hand
|
|
125
|
+
c8ctl element-template update old.id process.bpmn --to new.json --recipe recipe.json -i
|
|
126
|
+
c8ctl element-template update old.id process.bpmn --to new.json --map maxTokens=limit -i
|
|
127
|
+
|
|
128
|
+
# The report as data (needs --in-place or --dry-run, because stdout carries the BPMN otherwise)
|
|
129
|
+
c8ctl element-template update old.id process.bpmn --dry-run --json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- The first argument is the applied template ID (never a path or `id@n`).
|
|
133
|
+
An optional element ID limits the update to one element; a run that selects
|
|
134
|
+
no element fails. For several files, loop in the shell.
|
|
135
|
+
- Without `--to`, the target is the newest version of the same template ID
|
|
136
|
+
compatible with the BPMN's `modeler:executionPlatformVersion`. The command
|
|
137
|
+
never changes the template ID unless `--to` names another template
|
|
138
|
+
(`<id>[@<n>]`, path or URL). Elements already on a newer version are skipped.
|
|
139
|
+
- `--map <from>=<to>` moves the original value of one binding to another on every
|
|
140
|
+
selected element, after the recipe steps. A moved value does not count as
|
|
141
|
+
dropped. Prefixes such as `input:` work as in `apply --set`.
|
|
142
|
+
- Values the engine cannot read, such as message, called-element or form
|
|
143
|
+
bindings, are not diffed. Unless the target binds such an editable field
|
|
144
|
+
identically and not as Hidden, `report.skipped.unchecked` lists it and the
|
|
145
|
+
migration counts as lossy. Without the source template's definition, every such
|
|
146
|
+
value set on the element counts.
|
|
147
|
+
- All selected elements migrate in memory and the file is written once, only if
|
|
148
|
+
every element succeeds. A dry run exits 1 when an element would fail to migrate or the write would
|
|
149
|
+
need `--allow-lossy`. It does not serialize the BPMN. JSON output is one document:
|
|
150
|
+
`{dryRun, command, results, summary, deprecation}`.
|
|
151
|
+
- Each JSON result carries `elementId` and, when the element has a name,
|
|
152
|
+
`elementName`. An updated result carries `recipe` (with `path` for a
|
|
153
|
+
`--recipe` file, as given, and `owner`, the template carrying an embedded recipe), `counts` and `report` with `moved`, `added`,
|
|
154
|
+
`changed`, `dropped` and `kept`. Fields use template IDs: `group` is the group
|
|
155
|
+
ID, `groupLabel` its label, `propertyId` the property `id`. `moved` and
|
|
156
|
+
`added` items carry the stored `value`; `moved`, `added` and `changed` items
|
|
157
|
+
carry `source`: `recipe`, `map` or `default` (target template default).
|
|
158
|
+
`kept` lists unchanged values without their values. Items follow the group
|
|
159
|
+
and property order of the target template; `dropped` follows the source
|
|
160
|
+
template. `deprecation` is `{templateId, successors}` for a deprecated
|
|
161
|
+
selected template, else `null`. A failed result carries `hint` when a next
|
|
162
|
+
step exists.
|
|
163
|
+
- Without `--in-place` the BPMN goes to stdout and the report to stderr.
|
|
164
|
+
- Lossy in-place writes and refused embedded-recipe fallbacks require `--allow-lossy`.
|
|
165
|
+
Preview with `--dry-run` first. Unusable explicit `--recipe` files always fail,
|
|
166
|
+
even with authorization; correct the source entry or source-version floor.
|
|
167
|
+
- In-place migrations take a sibling `.migration.lock` and check original input
|
|
168
|
+
contents before temporary-file preparation and again immediately before rename.
|
|
169
|
+
Changes observed during preparation are rejected. Replacement uses a sibling
|
|
170
|
+
temporary file and rename; rename failures, including EXDEV, fail without a
|
|
171
|
+
direct overwrite.
|
|
172
|
+
`apply --in-place` and `edit --in-place` do not take the lock, but refuse to
|
|
173
|
+
replace a file whose contents changed since they read it, so they never
|
|
174
|
+
overwrite a migration that committed in between.
|
|
175
|
+
A killed writer can leave a stale lock and temporary file; confirm no writer is
|
|
176
|
+
active before inspecting and removing them. Recovery is manual. External edits
|
|
177
|
+
between the final comparison and rename and symlink aliases are not covered by
|
|
178
|
+
the cooperative lock; this design has no atomic compare-and-swap. Tests cover
|
|
179
|
+
injected ENOSPC/EIO before and after actual partial bytes and real SIGINT/SIGTERM
|
|
180
|
+
termination during paused split writes, preserving original bytes. Physical
|
|
181
|
+
disk exhaustion and interruption of an executing kernel syscall are not proven.
|
|
182
|
+
The unit suite runs on Windows; POSIX signal, permission and EPIPE cases skip it. Cleanup attempts preserve
|
|
183
|
+
the primary operation error; failed cleanup can leave artifacts for manual recovery.
|
|
184
|
+
- Migration requires `executionPlatform="Camunda Cloud"` and
|
|
185
|
+
`executionPlatformVersion` in the Modeler namespace
|
|
186
|
+
`http://camunda.org/schema/modeler/1.0` (the usual prefix is `modeler`; aliases
|
|
187
|
+
are accepted). Exactly one of each attribute is required. Versions accept strict
|
|
188
|
+
`major.minor` or full semantic versions, including standard prerelease/build
|
|
189
|
+
syntax; arbitrary coercible strings are rejected. Standard semver prerelease
|
|
190
|
+
matching applies. Incompatible explicit targets and malformed declared engine
|
|
191
|
+
constraints are rejected; automatic selection uses compatible source versions.
|
|
192
|
+
Missing template engine constraints retain legacy eligibility. Every required
|
|
193
|
+
intermediate version must also be compatible and available.
|
|
194
|
+
- No-op XML output preserves the original BPMN bytes and sends its message to
|
|
195
|
+
stderr. JSON emits the migration-report envelope with `noop: true` and empty
|
|
196
|
+
change collections. In-place no-ops do not rewrite the BPMN, and dry-run emits
|
|
197
|
+
no XML and writes no BPMN files. Supplied recipes are still validated.
|
|
198
|
+
- Colour and emoji markers are used in text mode. Colour follows the terminal
|
|
199
|
+
and honours `NO_COLOR` and `FORCE_COLOR`.
|
|
200
|
+
- Report values with credential-like keys, labels or template property/group
|
|
201
|
+
metadata are redacted in text and JSON, including dry-run. Known sensitive
|
|
202
|
+
values are also scrubbed from notes and CLI diagnostics. This does not change
|
|
203
|
+
migration decisions or BPMN values. Custom secrets without recognizable identity,
|
|
204
|
+
unknown secret text and alternate encodings cannot be identified reliably.
|
|
205
|
+
**Raw BPMN XML retains secrets**, including no-op stdout; avoid logging it.
|
|
206
|
+
|
|
207
|
+
### Migration recipes
|
|
208
|
+
|
|
209
|
+
A recipe describes how values of older templates map onto the template that
|
|
210
|
+
carries it. It lives in the target template as `metadata.migratesFrom`, or in
|
|
211
|
+
a file passed with `--recipe`, which replaces the embedded one. Without a recipe,
|
|
212
|
+
values are carried over by binding identity and the rest is dropped; the report
|
|
213
|
+
lists each drop with its old value, subject to sensitivity redaction. Unusable
|
|
214
|
+
explicit recipes fail even with `--allow-lossy`; refused embedded recipes require
|
|
215
|
+
authorization except when previewing. Diagnostics distinguish malformed recipes,
|
|
216
|
+
coverage refusal, wrong source IDs and unmet reached-version floors. Coverage
|
|
217
|
+
covers every step, including the change to another template: an entry that reads
|
|
218
|
+
a path the reached source version does not define refuses the recipe. Guard
|
|
219
|
+
paths count as reads, including `exists` and negated guards. An empty
|
|
220
|
+
`--recipe` value is an error, not a request for ordinary carry-over.
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"schemaVersion": 1,
|
|
225
|
+
"sources": [
|
|
226
|
+
{
|
|
227
|
+
"kind": "change",
|
|
228
|
+
"sourceTemplateId": "io.example.connector.v1",
|
|
229
|
+
"minSourceVersion": 3,
|
|
230
|
+
"paths": [
|
|
231
|
+
{ "from": "provider", "to": "backend.provider",
|
|
232
|
+
"valueMap": { "rules": [{ "match": "azure", "value": "openai" }] } },
|
|
233
|
+
{ "to": "backend.type", "set": "foundry",
|
|
234
|
+
"when": { "path": "provider", "equals": "azure" },
|
|
235
|
+
"note": { "level": "warning", "message": "Azure now runs on the Foundry backend." } }
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
| Entry | Effect |
|
|
243
|
+
|-------|--------|
|
|
244
|
+
| `{ from, to, valueMap? }` | Moves a value to another key, optionally translating it (`*` globs, first match wins, optional `default`). |
|
|
245
|
+
| `{ to, set }` | Writes a static value, for example a new discriminator. |
|
|
246
|
+
| `{ to, template }` | Composes a value from source values with `${path}`. |
|
|
247
|
+
| `{ when, rules: [...] }` | Applies the nested entries only when the guard holds. |
|
|
248
|
+
|
|
249
|
+
Any entry can carry `when` (`equals`, `matches`, `in`, `exists`, optionally negated with `not`).
|
|
250
|
+
Entries other than `rules` groups can also carry `note`: a message shown in the report when the entry took effect, either a string or
|
|
251
|
+
`{ "level": "info" | "warning", "message": "..." }`. Paths are binding keys; prefix one with
|
|
252
|
+
`input:`, `output:`, `header:`, `property:`, `taskDefinition:`, `agentDefinition:` or `adHoc:` when the
|
|
253
|
+
same key is bound by several binding types.
|
|
254
|
+
Unqualified rename sources, guards and interpolation references reject ambiguous
|
|
255
|
+
binding types. Duplicate backing entries/containers also fail rather than choosing
|
|
256
|
+
an arbitrary value. Simultaneously active writes to the same resolved destination
|
|
257
|
+
fail even when one uses a qualified alias; mutually exclusive guarded writes and
|
|
258
|
+
qualified writes to distinct binding types remain valid. A destination bound only by
|
|
259
|
+
Hidden properties with a fixed `value` is rejected. A rename whose guard
|
|
260
|
+
fails is reported as not moved only when no active entry moved the same source.
|
|
261
|
+
|
|
262
|
+
Migration validates resolved writes and populated non-Hidden carry-over against
|
|
263
|
+
active destination properties, including conditional duplicates. Supported checks
|
|
264
|
+
are choices, `notEmpty` and patterns. Optional/required FEEL expressions bypass
|
|
265
|
+
literal choices/patterns, but empty required expressions fail. Unsupported active
|
|
266
|
+
constraints, cyclic conditions and conditions without a known operator fail
|
|
267
|
+
closed. A condition is not checked for extra keys: `allMatch` and the first
|
|
268
|
+
known operator (`isActive`, `equals`, `oneOf`, `isEmpty`) decide. This does not validate
|
|
269
|
+
FEEL expression syntax. Reports reconcile surviving writes with actual stored
|
|
270
|
+
values, including FEEL normalization, rather than claiming planner intent as success.
|
|
271
|
+
|
|
272
|
+
A source with `kind: "upgrade"` requires `toVersion` and the recipe owner's ID: an element climbs
|
|
273
|
+
each destination above its applied version in ascending order. A `kind: "change"` source must name
|
|
274
|
+
a different ID and may require `minSourceVersion`, a floor on the version actually reached by
|
|
275
|
+
source upgrades. Merely loading a newer template does not satisfy that floor. The highest reachable
|
|
276
|
+
floor wins; an omitted floor is the fallback. File recipes replace only the target recipe.
|
|
277
|
+
This revised dialect keeps `schemaVersion: 1` but rejects legacy `minVersion` recipes and requires
|
|
278
|
+
`kind` on every source. Older strict readers reject the new fields. See
|
|
279
|
+
[`migration/migrates-from.schema.json`](./migration/migrates-from.schema.json) for the full format.
|
|
280
|
+
Recipes are validated strictly: an unknown key or an unsupported `schemaVersion` fails the command
|
|
281
|
+
instead of being ignored. `metadata.migratesFrom` is not part of the official element template schema.
|
|
282
|
+
Draft07 validation alone is insufficient: the parser also rejects duplicate source markers/floors,
|
|
283
|
+
and owner validation checks source IDs and upgrade destinations against the template carrying the recipe.
|
|
284
|
+
An optional `$schema` accepts any string, including blank strings. Paths, IDs, notes, templates,
|
|
285
|
+
and match patterns require a non-whitespace character; surrounding whitespace is preserved.
|
|
286
|
+
Scalar values accept strings (including blank strings), finite numbers, and booleans. An omitted
|
|
287
|
+
note level defaults to `info`; explicit `null` is invalid. Empty `paths` and guard `in` lists are valid,
|
|
288
|
+
but sources, groups, guard lists, and value-map rules must be non-empty.
|
|
289
|
+
|
|
290
|
+
#### AI Agent v1 to v2
|
|
291
|
+
|
|
292
|
+
c8ctl ships no connector recipes. The AI Agent v2 templates in
|
|
293
|
+
`camunda/connectors` embed their v1 recipes as `metadata.migratesFrom`,
|
|
294
|
+
so `update` picks them up from the cache once a release carries them.
|
|
295
|
+
|
|
104
296
|
## Inspecting a template
|
|
105
297
|
|
|
106
298
|
`info` and `get-properties` separate the two questions an agent or human
|