@camunda8/cli 4.3.0 → 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/PLUGIN-HELP.md CHANGED
@@ -243,7 +243,7 @@ export const metadata = {
243
243
  passthrough: true,
244
244
  // Required: names the boundary in `c8ctl help my-command`.
245
245
  passthroughHint: 'Forwards everything after the command name to some-tool',
246
- // Optional, documentation only (not parsed by c8ctl).
246
+ // Optional documentation; the plugin or tool parses these arguments.
247
247
  flagsHint: ['--purge Also delete data'],
248
248
  },
249
249
  },
@@ -260,6 +260,8 @@ export const commands = {
260
260
  - A command is **either** passthrough **or** `{ flags, handler }` — declaring both is rejected at load time, so a command cannot mix declared flags with raw ones. A command whose subcommands need both (like `cluster`, which has its own `--purge` and forwards arbitrary flags to `c8run secrets`) should be a passthrough command and parse its own flags.
261
261
  - c8ctl strips only its **global** flags (`--help`, `--version`/`-v`, `--profile`, `--dry-run`, `--verbose`, `--fields`, `--json`, `--yes`/`-y`), including the value of string-typed ones. They are not forwarded. If the wrapped tool needs one of those names (for example `--yes`), read the host's interpretation from `ctx` (`ctx.yes`, `ctx.profile`, `ctx.dryRun`, ...) and forward it explicitly.
262
262
  - A `--` terminator is forwarded too, and everything after it verbatim, global flag names included.
263
+ - `flagsHint` documents flags handled by the plugin or underlying tool. It does not declare host-parsed flags or shell completions. Passthrough flag completion offers only global flags; subcommands and file completion remain available.
264
+ - Use `passthroughHint` to describe which arguments the plugin handles and which it forwards. For example, `cluster secrets` handles a leading `--c8-version` and forwards `--physical-tenant` unchanged to c8run.
263
265
 
264
266
  ## Plugin Runtime API
265
267
 
package/README.md CHANGED
@@ -71,7 +71,7 @@ c8ctl cluster start
71
71
  c8ctl cluster secrets set OPENAI_API_KEY
72
72
 
73
73
  # Manage isolated local physical tenants (requires a supporting c8run 8.10+ build)
74
- c8ctl cluster tenants add sales
74
+ c8ctl cluster physical-tenants add sales
75
75
 
76
76
  # Deploy a process and start an instance
77
77
  c8ctl deploy ./my-process.bpmn
@@ -48,16 +48,16 @@ c8ctl cluster delete 8.8
48
48
  For physical tenants (supporting Camunda 8.10+ builds):
49
49
 
50
50
  ```bash
51
- c8ctl cluster tenants --c8-version 8.10 add sales
51
+ c8ctl cluster physical-tenants --c8-version 8.10 add sales
52
52
  c8ctl cluster start 8.10
53
- c8ctl cluster tenants list
54
- c8ctl cluster secrets --tenant sales set OPENAI_API_KEY
55
- c8ctl cluster tenants remove sales --yes
56
- # Or choose tenants for one start only:
53
+ c8ctl cluster physical-tenants list
54
+ c8ctl cluster secrets --physical-tenant sales set OPENAI_API_KEY
55
+ c8ctl cluster physical-tenants remove sales --yes
56
+ # Or choose physical tenants for one start only:
57
57
  c8ctl cluster start 8.10 --physical-tenants sales,hr
58
58
  ```
59
59
 
60
- Tenant commands delegate to the selected installed c8run, following the same version selection and terminal behavior as `cluster secrets`. c8run owns tenant configuration and storage. See [local physical tenants](../../docs/getting-started.md#local-physical-tenants) for authentication, profiles, relative paths, and limitations.
60
+ `cluster physical-tenants` delegates to the selected installed c8run, following the same version selection and terminal behavior as `cluster secrets`. `cluster secrets --physical-tenant <id>` (or `--physical-tenant=<id>`) scopes secrets to one physical tenant. The command and selector are forwarded unchanged. These are distinct from logical tenants (`c8ctl list tenants`, `c8ctl use tenant`). c8run owns physical tenant configuration and storage. See [local physical tenants](../../docs/getting-started.md#local-physical-tenants) for authentication, profiles, relative paths, and limitations.
61
61
 
62
62
  ## Version aliases
63
63
 
@@ -331,12 +331,13 @@ export const metadata = {
331
331
  // so the subcommand flags are documented via `flagsHint` instead.
332
332
  passthrough: true,
333
333
  passthroughHint:
334
- '--purge, --debug, --physical-tenants and --c8-version are read by the plugin; arguments after `secrets` or `tenants` are forwarded to c8run',
334
+ '--purge, --debug, --physical-tenants and --c8-version are read by the plugin. For local management, physical-tenants and --physical-tenant are forwarded unchanged to a compatible c8run release.',
335
335
  flagsHint: [
336
336
  '--c8-version <version> Camunda version, alias or major.minor (alternative to the positional <version>)',
337
337
  '--debug (start, stop) Stream raw c8run output',
338
338
  '--purge (stop only) Also delete runtime data after stopping',
339
339
  '--physical-tenants <ids> (start only) Comma-separated physical tenants for this run (repeatable; Camunda 8.10+)',
340
+ '--physical-tenant <id> (secrets only) Scope secrets to one physical tenant (also --physical-tenant=<id>)',
340
341
  ],
341
342
  subcommands: [
342
343
  { name: 'start', description: 'Start local Camunda 8 cluster' },
@@ -350,7 +351,7 @@ export const metadata = {
350
351
  { name: 'logs', description: 'Stream cluster logs' },
351
352
  { name: 'purge', description: 'Delete runtime data (keeps binary) so the next start is fresh' },
352
353
  { name: 'secrets', description: 'Manage local development secrets (passed through to c8run)' },
353
- { name: 'tenants', description: 'Manage local physical tenants (passed through to c8run; Camunda 8.10+)' },
354
+ { name: 'physical-tenants', description: 'Manage local physical tenants (passed through to c8run; Camunda 8.10+)' },
354
355
  ],
355
356
  examples: [
356
357
  { command: 'c8ctl cluster start', description: 'Start a local Camunda 8 cluster (latest stable)' },
@@ -369,9 +370,9 @@ export const metadata = {
369
370
  { command: 'c8ctl cluster secrets list', description: 'List secret names (values are never shown)' },
370
371
  { command: 'c8ctl cluster secrets import .env.secrets', description: 'Import secrets from a dotenv file' },
371
372
  { command: 'c8ctl cluster secrets delete OPENAI_API_KEY --yes', description: 'Delete a secret without prompting' },
372
- { command: 'c8ctl cluster tenants --c8-version 8.10 add sales', description: 'Save a physical tenant using an installed 8.10 build' },
373
+ { command: 'c8ctl cluster physical-tenants --c8-version 8.10 add sales', description: 'Save a physical tenant using an installed 8.10 build' },
373
374
  { command: 'c8ctl cluster start 8.10 --physical-tenants sales,hr', description: 'Start physical tenants for one run only' },
374
- { command: 'c8ctl cluster secrets --tenant sales set OPENAI_API_KEY', description: 'Store a secret for one physical tenant' },
375
+ { command: 'c8ctl cluster secrets --physical-tenant sales set OPENAI_API_KEY', description: 'Store a secret for one physical tenant' },
375
376
  ],
376
377
  },
377
378
  },
@@ -2500,14 +2501,14 @@ export async function stopC8Run(config, debug = false) {
2500
2501
  * `--yes` / `-y` are c8ctl GLOBAL flags, so the host consumes them (it sets
2501
2502
  * `ctx.yes`) and strips them from a passthrough command's args. c8run's own
2502
2503
  * `secrets delete` has a `--yes` flag that skips its confirmation prompt, so
2503
- * restore it when the user asked for it. Tenant removal/reset also require
2504
- * confirmation. Skip tenant selectors when locating a secrets verb, and never
2504
+ * restore it when the user asked for it. Physical tenant removal/reset also
2505
+ * require confirmation. Skip physical tenant selectors when locating a secrets verb, and never
2505
2506
  * append confirmation to a verb that does not accept it. Never mutates `tail`.
2506
2507
  */
2507
2508
  export function withForwardedYes(tail, ctx, command = 'secrets') {
2508
2509
  const versionEnd = tail[0]?.startsWith('--c8-version=') ? 1 : tail[0] === '--c8-version' ? 2 : 0;
2509
2510
  const positions = forwardedPositionals(tail, versionEnd, command === 'secrets');
2510
- const verbs = command === 'tenants' ? ['remove', 'rm', 'reset'] : ['delete'];
2511
+ const verbs = command === 'secrets' ? ['delete'] : ['remove', 'rm', 'reset'];
2511
2512
  if (ctx?.yes !== true || !verbs.includes(tail[positions[0]])) return tail;
2512
2513
  // Everything after a `--` terminator is literal for c8run, so the flag goes
2513
2514
  // immediately before it, and a `--yes` that only appears after it does not count.
@@ -2554,7 +2555,7 @@ export function parseSecretsArgs(tail, command = 'secrets') {
2554
2555
 
2555
2556
  if (passthrough.length === 0) {
2556
2557
  throw new Error(
2557
- `usage: c8ctl cluster ${command} [--c8-version <version>] <${command === 'tenants' ? 'add|list|remove|reset|path|help|...' : 'set|list|path|delete|import|...'}>`,
2558
+ `usage: c8ctl cluster ${command} [--c8-version <version>] <${command === 'secrets' ? 'set|list|path|delete|import|...' : 'add|list|remove|reset|path|help|...'}>`,
2558
2559
  );
2559
2560
  }
2560
2561
 
@@ -2594,19 +2595,19 @@ function forwardedPositionals(args, start, tenantScoped) {
2594
2595
  const positions = [];
2595
2596
  for (let i = start; i < args.length; i++) {
2596
2597
  if (args[i] === '--') break;
2597
- if (tenantScoped && args[i] === '--tenant') {
2598
+ if (tenantScoped && args[i] === '--physical-tenant') {
2598
2599
  i++;
2599
2600
  continue;
2600
2601
  }
2601
- if (tenantScoped && args[i].startsWith('--tenant=')) continue;
2602
+ if (tenantScoped && args[i].startsWith('--physical-tenant=')) continue;
2602
2603
  // Unknown options belong to c8run. Do not guess which tokens they consume.
2603
2604
  positions.push(i);
2604
2605
  }
2605
2606
  return positions;
2606
2607
  }
2607
2608
 
2608
- // Tells c8run which command prefix to print in its hints ("c8ctl cluster tenants list"
2609
- // instead of "c8run tenants list"); c8run builds without support ignore it.
2609
+ // Tells c8run which command prefix to print in its hints ("c8ctl cluster physical-tenants list"
2610
+ // instead of "c8run physical-tenants list"); c8run builds without support ignore it.
2610
2611
  const C8RUN_CLI_NAME = 'c8ctl cluster';
2611
2612
 
2612
2613
  function resolveLocalStoreEnv(env, cwd) {
@@ -2707,7 +2708,7 @@ async function runClusterLocalCommand(
2707
2708
  const version = await selectSecretsVersion(cacheDir, { explicit: explicitVersion });
2708
2709
  if (!version) {
2709
2710
  logger.error(
2710
- `No c8run installed locally. Install one first: c8ctl cluster install ${command === 'tenants' ? '8.10' : 'alpha'}`,
2711
+ `No c8run installed locally. Install one first: c8ctl cluster install ${command === 'secrets' ? 'alpha' : '8.10'}`,
2711
2712
  );
2712
2713
  process.exit(1);
2713
2714
  return;
@@ -2746,8 +2747,8 @@ async function runClusterLocalCommand(
2746
2747
  proc.on('close', (code) => {
2747
2748
  const hint = command === 'secrets'
2748
2749
  ? mapSecretsFailure(code ?? 1, stderrTail, version)
2749
- : code !== 0 && /unsupported operation:\s*tenants/i.test(stderrTail)
2750
- ? `c8run ${version} does not support "tenants" yet. Install a Camunda 8.10+ c8run build containing physical-tenant CLI support with "c8ctl cluster install 8.10"; older cached builds may predate this feature.`
2750
+ : code !== 0 && /unsupported operation:\s*physical-tenants/i.test(stderrTail)
2751
+ ? `c8run ${version} does not support "physical-tenants" yet. Install a Camunda 8.10+ c8run build containing physical-tenant CLI support with "c8ctl cluster install 8.10"; older cached builds may predate this feature.`
2751
2752
  : null;
2752
2753
  if (hint) {
2753
2754
  logger.error(hint);
@@ -3240,7 +3241,7 @@ export function parsePluginArgs(args) {
3240
3241
 
3241
3242
  if (arg === '--physical-tenants' || arg.startsWith('--physical-tenants=')) {
3242
3243
  const value = arg === '--physical-tenants' ? args[i + 1] : arg.slice('--physical-tenants='.length);
3243
- if (!value || value.startsWith('-')) throw new Error('--physical-tenants requires comma-separated tenant IDs');
3244
+ if (!value || value.startsWith('-')) throw new Error('--physical-tenants requires comma-separated physical tenant IDs');
3244
3245
  result.startArgs ??= [];
3245
3246
  result.startArgs.push(arg);
3246
3247
  if (arg === '--physical-tenants') { result.startArgs.push(value); i++; }
@@ -3322,8 +3323,8 @@ export const commands = {
3322
3323
  // Local management passthrough is intercepted before parsePluginArgs:
3323
3324
  // its arguments (verbs, flags, positionals) belong to c8run, not to
3324
3325
  // c8ctl's own version/--debug/--purge parsing.
3325
- if (args[0] === 'secrets' || args[0] === 'tenants') {
3326
- const command = args[0];
3326
+ if (args[0] === 'secrets' || args[0] === 'physical-tenants') {
3327
+ const command = args[0] === 'secrets' ? 'secrets' : 'physical-tenants';
3327
3328
  let parsedLocal;
3328
3329
  try {
3329
3330
  parsedLocal = parseSecretsArgs(withForwardedYes(args.slice(1), ctx, command), command);
@@ -3369,8 +3370,8 @@ export const commands = {
3369
3370
  console.log(' c8ctl cluster install <version>');
3370
3371
  console.log(' c8ctl cluster delete <version>');
3371
3372
  console.log(' c8ctl cluster purge <version>');
3372
- console.log(' c8ctl cluster secrets [--c8-version <version>] <set|list|path|delete|import|...>');
3373
- console.log(' c8ctl cluster tenants [--c8-version <version>] <add|list|remove|reset|path|help>');
3373
+ console.log(' c8ctl cluster secrets [--c8-version <version>] [--physical-tenant <id>] <set|list|path|delete|import|...>');
3374
+ console.log(' c8ctl cluster physical-tenants [--c8-version <version>] <add|list|remove|reset|path|help>');
3374
3375
  console.log('');
3375
3376
  console.log('Subcommands:');
3376
3377
  console.log(' start Download (if needed) and start a local Camunda 8 cluster');
@@ -3382,8 +3383,8 @@ export const commands = {
3382
3383
  console.log(' install Download a version without starting it');
3383
3384
  console.log(' delete Remove a locally cached version to reclaim disk space');
3384
3385
  console.log(' purge Delete runtime data for a version (binary stays intact, next start is fresh)');
3385
- console.log(' secrets Manage local development secrets (forwarded verbatim to c8run)');
3386
- console.log(' tenants Manage local physical tenants (Camunda 8.10+; forwarded to c8run)');
3386
+ console.log(' secrets Manage local development secrets (forwarded to c8run)');
3387
+ console.log(' physical-tenants Manage local physical tenants (Camunda 8.10+; forwarded to c8run)');
3387
3388
  console.log('');
3388
3389
  console.log('Options:');
3389
3390
  console.log(' <version> Camunda version, alias, or major.minor (default: stable)');
@@ -3391,6 +3392,7 @@ export const commands = {
3391
3392
  console.log(' --debug Stream raw c8run output during start');
3392
3393
  console.log(' --purge (stop only) also delete runtime data after stopping');
3393
3394
  console.log(' --physical-tenants <ids> (start only) Extra physical tenants for this run; repeatable');
3395
+ console.log(' --physical-tenant <id> (secrets only) Scope secrets to one physical tenant (also --physical-tenant=<id>)');
3394
3396
  console.log('');
3395
3397
  console.log('A <version> can be:');
3396
3398
  console.log(' stable / alpha Named aliases');
@@ -3423,13 +3425,15 @@ export const commands = {
3423
3425
  console.log(' c8ctl cluster secrets list');
3424
3426
  console.log(' c8ctl cluster secrets import .env.secrets');
3425
3427
  console.log(' c8ctl cluster secrets delete OPENAI_API_KEY --yes');
3426
- console.log(' c8ctl cluster tenants --c8-version 8.10 add sales');
3428
+ console.log(' c8ctl cluster physical-tenants --c8-version 8.10 add sales');
3427
3429
  console.log(' c8ctl cluster start 8.10 --physical-tenants sales,hr');
3428
- console.log(' c8ctl cluster secrets --tenant sales set OPENAI_API_KEY');
3430
+ console.log(' c8ctl cluster secrets --physical-tenant sales set OPENAI_API_KEY');
3429
3431
  console.log('');
3430
- console.log('secrets forwards everything after it to c8run\'s own "secrets" command —');
3432
+ console.log('secrets delegates to c8run\'s own "secrets" command.');
3433
+ console.log('physical-tenants and --physical-tenant are forwarded unchanged to a compatible c8run release.');
3431
3434
  console.log('c8ctl never sees or stores a secret value. Run "c8ctl cluster secrets help"');
3432
3435
  console.log('for c8run\'s own secrets help (--help here belongs to c8ctl).');
3436
+ if (parsed.subcommand) process.exitCode = 1;
3433
3437
  return;
3434
3438
  }
3435
3439
 
@@ -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