@camunda8/cli 4.7.0-alpha.23 → 4.7.0-alpha.24
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/README.md +1 -2
- package/dist/command-dispatch.d.ts.map +1 -1
- package/dist/command-dispatch.js +0 -3
- package/dist/command-dispatch.js.map +1 -1
- package/dist/default-plugins/mcp/README.md +33 -0
- package/dist/default-plugins/mcp/c8ctl-plugin.js +2604 -0
- package/dist/default-plugins/mcp/package.json +8 -0
- package/dist/default-plugins/modeler/c8ctl-plugin.js +80 -15
- package/dist/default-plugins/setup/README.md +12 -6
- package/dist/default-plugins/setup/c8ctl-plugin.js +173 -119
- package/dist/default-plugins/skills/README.md +9 -2
- package/dist/default-plugins/skills/c8ctl-plugin.js +116 -20
- package/dist/framework/command-registry.d.ts +0 -30
- package/dist/framework/command-registry.d.ts.map +1 -1
- package/dist/framework/command-registry.js +0 -54
- package/dist/framework/command-registry.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/mcp.d.ts +0 -9
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -109
- package/dist/commands/mcp.js.map +0 -1
|
@@ -3216,10 +3216,26 @@ function noModelerInstalled() {
|
|
|
3216
3216
|
message: "Camunda Modeler is not installed; run `c8ctl modeler install` first."
|
|
3217
3217
|
};
|
|
3218
3218
|
}
|
|
3219
|
-
function
|
|
3219
|
+
function verifyExpectedRemovalTarget(ctx, target) {
|
|
3220
|
+
const expected = ctx.expectedRemovalTarget;
|
|
3221
|
+
if (expected !== void 0 && (target === void 0 || target.method !== expected.method || target.path !== expected.path)) {
|
|
3222
|
+
throw new Error(
|
|
3223
|
+
"Camunda Modeler installation changed after the setup preview; refusing to remove a different target. Run `c8ctl setup --remove` again to review the current installation."
|
|
3224
|
+
);
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
function dryRunResult(command, message, removalTarget) {
|
|
3220
3228
|
return {
|
|
3221
3229
|
kind: "dryRun",
|
|
3222
|
-
|
|
3230
|
+
// `wouldChange` lets automation (c8ctl setup --remove) tell a real
|
|
3231
|
+
// preview apart from a normalized "nothing to do" info result.
|
|
3232
|
+
info: {
|
|
3233
|
+
dryRun: true,
|
|
3234
|
+
command,
|
|
3235
|
+
message,
|
|
3236
|
+
wouldChange: true,
|
|
3237
|
+
...removalTarget === void 0 ? {} : { removalTarget }
|
|
3238
|
+
}
|
|
3223
3239
|
};
|
|
3224
3240
|
}
|
|
3225
3241
|
function homebrewModelerInstalled() {
|
|
@@ -3507,6 +3523,7 @@ function removeWindowsModeler(ctx) {
|
|
|
3507
3523
|
`winget is not available, so c8ctl cannot safely remove the Modeler installation at ${installDir}.`
|
|
3508
3524
|
);
|
|
3509
3525
|
}
|
|
3526
|
+
verifyExpectedRemovalTarget(ctx, void 0);
|
|
3510
3527
|
return noModelerInstalled();
|
|
3511
3528
|
}
|
|
3512
3529
|
if (!isInstalledWith({
|
|
@@ -3520,12 +3537,16 @@ function removeWindowsModeler(ctx) {
|
|
|
3520
3537
|
`Camunda Modeler at ${installDir} is not installed with winget; refusing to remove it.`
|
|
3521
3538
|
);
|
|
3522
3539
|
}
|
|
3540
|
+
verifyExpectedRemovalTarget(ctx, void 0);
|
|
3523
3541
|
return noModelerInstalled();
|
|
3524
3542
|
}
|
|
3543
|
+
const removalTarget = { method: "winget-package", path: installDir };
|
|
3544
|
+
verifyExpectedRemovalTarget(ctx, removalTarget);
|
|
3525
3545
|
if (ctx.isDryRun) {
|
|
3526
3546
|
return dryRunResult(
|
|
3527
3547
|
"modeler remove",
|
|
3528
|
-
"Dry run: would remove Camunda Modeler with `winget uninstall --id Camunda.Modeler --exact --source winget`."
|
|
3548
|
+
"Dry run: would remove Camunda Modeler with `winget uninstall --id Camunda.Modeler --exact --source winget`.",
|
|
3549
|
+
removalTarget
|
|
3529
3550
|
);
|
|
3530
3551
|
}
|
|
3531
3552
|
reportProgress(ctx, "Removing Camunda Modeler with winget...");
|
|
@@ -3746,11 +3767,20 @@ async function updateLinuxModeler(ctx) {
|
|
|
3746
3767
|
}
|
|
3747
3768
|
function removeLinuxModeler(ctx) {
|
|
3748
3769
|
const installation = linuxModelerForAction("remove");
|
|
3749
|
-
if (!installation)
|
|
3770
|
+
if (!installation) {
|
|
3771
|
+
verifyExpectedRemovalTarget(ctx, void 0);
|
|
3772
|
+
return noModelerInstalled();
|
|
3773
|
+
}
|
|
3774
|
+
const removalTarget = {
|
|
3775
|
+
method: "linux-managed-install",
|
|
3776
|
+
path: installation.installDir
|
|
3777
|
+
};
|
|
3778
|
+
verifyExpectedRemovalTarget(ctx, removalTarget);
|
|
3750
3779
|
if (ctx.isDryRun) {
|
|
3751
3780
|
return dryRunResult(
|
|
3752
3781
|
"modeler remove",
|
|
3753
|
-
`Dry run: would remove Camunda Modeler ${installation.version} from ${installation.installDir} and unregister its file types
|
|
3782
|
+
`Dry run: would remove Camunda Modeler ${installation.version} from ${installation.installDir} and unregister its file types.`,
|
|
3783
|
+
removalTarget
|
|
3754
3784
|
);
|
|
3755
3785
|
}
|
|
3756
3786
|
if (process.getuid?.() !== 0) {
|
|
@@ -3784,20 +3814,31 @@ function removeLinuxModeler(ctx) {
|
|
|
3784
3814
|
}
|
|
3785
3815
|
async function removeMacModeler(ctx) {
|
|
3786
3816
|
if (hasPackageManager("brew", "Homebrew") && homebrewModelerInstalled()) {
|
|
3787
|
-
if (ctx.isDryRun) {
|
|
3788
|
-
return dryRunResult(
|
|
3789
|
-
"modeler remove",
|
|
3790
|
-
"Dry run: would remove Camunda Modeler with `brew uninstall --cask camunda-modeler`."
|
|
3791
|
-
);
|
|
3792
|
-
}
|
|
3793
3817
|
let appPath2;
|
|
3794
3818
|
try {
|
|
3795
3819
|
appPath2 = resolveHomebrewModelerPath();
|
|
3796
3820
|
} catch (error) {
|
|
3821
|
+
if (ctx.isDryRun || ctx.expectedRemovalTarget !== void 0) {
|
|
3822
|
+
throw error;
|
|
3823
|
+
}
|
|
3797
3824
|
ctx.logger.warn(
|
|
3798
3825
|
`Could not locate the Homebrew Modeler bundle before uninstalling it: ${errorMessage(error)}`
|
|
3799
3826
|
);
|
|
3800
3827
|
}
|
|
3828
|
+
const removalTarget2 = appPath2 === void 0 ? void 0 : { method: "homebrew-cask", path: appPath2 };
|
|
3829
|
+
verifyExpectedRemovalTarget(ctx, removalTarget2);
|
|
3830
|
+
if (ctx.isDryRun) {
|
|
3831
|
+
if (removalTarget2 === void 0) {
|
|
3832
|
+
throw new Error(
|
|
3833
|
+
"Could not identify the Homebrew Modeler target for the removal preview."
|
|
3834
|
+
);
|
|
3835
|
+
}
|
|
3836
|
+
return dryRunResult(
|
|
3837
|
+
"modeler remove",
|
|
3838
|
+
"Dry run: would remove Camunda Modeler with `brew uninstall --cask camunda-modeler`.",
|
|
3839
|
+
removalTarget2
|
|
3840
|
+
);
|
|
3841
|
+
}
|
|
3801
3842
|
reportProgress(ctx, "Removing Camunda Modeler with Homebrew...");
|
|
3802
3843
|
runCommand("brew", ["uninstall", "--cask", "camunda-modeler"], {
|
|
3803
3844
|
failureMessage: "Homebrew could not remove Camunda Modeler",
|
|
@@ -3810,7 +3851,12 @@ async function removeMacModeler(ctx) {
|
|
|
3810
3851
|
};
|
|
3811
3852
|
}
|
|
3812
3853
|
const appPath = findInstalledModeler();
|
|
3813
|
-
if (!appPath)
|
|
3854
|
+
if (!appPath) {
|
|
3855
|
+
verifyExpectedRemovalTarget(ctx, void 0);
|
|
3856
|
+
return noModelerInstalled();
|
|
3857
|
+
}
|
|
3858
|
+
const removalTarget = { method: "macos-app-bundle", path: appPath };
|
|
3859
|
+
verifyExpectedRemovalTarget(ctx, removalTarget);
|
|
3814
3860
|
if (isHomebrewCaskPath(appPath)) {
|
|
3815
3861
|
throw new Error(
|
|
3816
3862
|
"Camunda Modeler appears to be Homebrew-managed, but its cask was not found; refusing to remove the app bundle directly."
|
|
@@ -3820,7 +3866,8 @@ async function removeMacModeler(ctx) {
|
|
|
3820
3866
|
if (ctx.isDryRun) {
|
|
3821
3867
|
return dryRunResult(
|
|
3822
3868
|
"modeler remove",
|
|
3823
|
-
`Dry run: would remove the Camunda Modeler app bundle at ${appPath}
|
|
3869
|
+
`Dry run: would remove the Camunda Modeler app bundle at ${appPath}.`,
|
|
3870
|
+
removalTarget
|
|
3824
3871
|
);
|
|
3825
3872
|
}
|
|
3826
3873
|
reportProgress(ctx, `Removing Camunda Modeler from ${appPath}...`);
|
|
@@ -3891,6 +3938,20 @@ var metadata = {
|
|
|
3891
3938
|
}
|
|
3892
3939
|
}
|
|
3893
3940
|
};
|
|
3941
|
+
function expectedRemovalTargetFromEnvironment() {
|
|
3942
|
+
const serialized = process.env.C8CTL_SETUP_MODELER_REMOVAL_TARGET;
|
|
3943
|
+
if (serialized === void 0) return void 0;
|
|
3944
|
+
let parsed;
|
|
3945
|
+
try {
|
|
3946
|
+
parsed = JSON.parse(serialized);
|
|
3947
|
+
} catch {
|
|
3948
|
+
throw new Error("Invalid setup-provided Modeler removal target.");
|
|
3949
|
+
}
|
|
3950
|
+
if (!isRecord(parsed) || typeof parsed.method !== "string" || parsed.method.length === 0 || typeof parsed.path !== "string" || parsed.path.length === 0) {
|
|
3951
|
+
throw new Error("Invalid setup-provided Modeler removal target.");
|
|
3952
|
+
}
|
|
3953
|
+
return { method: parsed.method, path: parsed.path };
|
|
3954
|
+
}
|
|
3894
3955
|
async function modelerHandler(args, _flags, ctx) {
|
|
3895
3956
|
if (!ctx) throw new Error("modeler requires the plugin host context");
|
|
3896
3957
|
const { logger } = ctx;
|
|
@@ -3918,14 +3979,18 @@ async function modelerHandler(args, _flags, ctx) {
|
|
|
3918
3979
|
const result = await operation({
|
|
3919
3980
|
isDryRun: ctx.dryRun,
|
|
3920
3981
|
logger,
|
|
3921
|
-
quiet: ctx.quiet
|
|
3982
|
+
quiet: ctx.quiet,
|
|
3983
|
+
...action === "remove" ? {
|
|
3984
|
+
expectedRemovalTarget: expectedRemovalTargetFromEnvironment()
|
|
3985
|
+
} : {}
|
|
3922
3986
|
});
|
|
3923
3987
|
const normalized = result.kind === "info" && ctx.dryRun ? {
|
|
3924
3988
|
kind: "dryRun",
|
|
3925
3989
|
info: {
|
|
3926
3990
|
dryRun: true,
|
|
3927
3991
|
command: `modeler ${action}`,
|
|
3928
|
-
message: result.message
|
|
3992
|
+
message: result.message,
|
|
3993
|
+
wouldChange: false
|
|
3929
3994
|
}
|
|
3930
3995
|
} : result;
|
|
3931
3996
|
if (normalized.kind === "dryRun") {
|
|
@@ -13,18 +13,24 @@ development.
|
|
|
13
13
|
- `c8ctl setup --yes` — set up the defaults without prompting (Rocket Launch
|
|
14
14
|
blueprint).
|
|
15
15
|
- `c8ctl setup --remove [--stop-cluster]` — preview and remove setup-managed
|
|
16
|
-
MCP entries, Camunda skills,
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
MCP entries, Camunda skills, a c8ctl-managed Desktop Modeler installation,
|
|
17
|
+
and blueprint files; `--stop-cluster` also stops the local cluster without
|
|
18
|
+
purging its data.
|
|
19
19
|
|
|
20
20
|
## Architecture
|
|
21
21
|
|
|
22
22
|
The wizard orchestrates the commands that own each capability instead of
|
|
23
23
|
reimplementing them: `c8ctl cluster start`/`stop` (cluster plugin),
|
|
24
24
|
`c8ctl modeler install` (modeler plugin), `c8ctl skills install` (skills
|
|
25
|
-
plugin), `c8ctl mcp install` and `c8ctl deploy` (core).
|
|
26
|
-
to text output; their progress is buffered and surfaces
|
|
27
|
-
fails.
|
|
25
|
+
plugin), `c8ctl mcp install` (mcp plugin) and `c8ctl deploy` (core).
|
|
26
|
+
Children run pinned to text output; their progress is buffered and surfaces
|
|
27
|
+
only when a step fails.
|
|
28
|
+
|
|
29
|
+
Removal orchestrates the same owners: the unified preview is built from
|
|
30
|
+
shared inspection helpers and a `modeler remove --dry-run` probe, and after
|
|
31
|
+
one confirmation the actual teardown runs as child commands —
|
|
32
|
+
`c8ctl mcp uninstall` per harness,
|
|
33
|
+
`c8ctl skills remove --harness <harness> --yes`, and `c8ctl modeler remove`.
|
|
28
34
|
|
|
29
35
|
## Flags
|
|
30
36
|
|
|
@@ -2283,7 +2283,6 @@ function renderCommandFailure(logger, message, error, { verbose = false } = {})
|
|
|
2283
2283
|
var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
|
|
2284
2284
|
|
|
2285
2285
|
// src/utils/command-local/mcp-install-helpers.ts
|
|
2286
|
-
import { randomUUID } from "node:crypto";
|
|
2287
2286
|
import {
|
|
2288
2287
|
closeSync,
|
|
2289
2288
|
existsSync as existsSync2,
|
|
@@ -3971,47 +3970,6 @@ function skillRemovalLocation(skill, { env = process.env, home, platform: platfo
|
|
|
3971
3970
|
function camundaSkillRemovalPath(skill, options = {}) {
|
|
3972
3971
|
return skillRemovalLocation(skill, options).directory;
|
|
3973
3972
|
}
|
|
3974
|
-
function removeCamundaSkill(skill, options = {}) {
|
|
3975
|
-
const { directory, root } = skillRemovalLocation(skill, options);
|
|
3976
|
-
const directoryInfo = lstatSync(directory, { throwIfNoEntry: false });
|
|
3977
|
-
if (!directoryInfo) return;
|
|
3978
|
-
if (directoryInfo.isSymbolicLink()) {
|
|
3979
|
-
const rootInfo2 = statSync(root, { throwIfNoEntry: false });
|
|
3980
|
-
if (!rootInfo2?.isDirectory()) {
|
|
3981
|
-
throw new Error(
|
|
3982
|
-
`Cannot safely remove Camunda skill "${skill.name}": its user skills directory is unavailable.`
|
|
3983
|
-
);
|
|
3984
|
-
}
|
|
3985
|
-
const rootRealPath2 = realpathSync(root);
|
|
3986
|
-
const parentRealPath = realpathSync(dirname2(directory));
|
|
3987
|
-
if (!isWithinPath(rootRealPath2, parentRealPath)) {
|
|
3988
|
-
throw new Error(
|
|
3989
|
-
`Cannot safely remove Camunda skill "${skill.name}": its parent directory resolves outside the user skills directory.`
|
|
3990
|
-
);
|
|
3991
|
-
}
|
|
3992
|
-
unlinkSync(directory);
|
|
3993
|
-
return;
|
|
3994
|
-
}
|
|
3995
|
-
if (!directoryInfo.isDirectory()) {
|
|
3996
|
-
throw new Error(
|
|
3997
|
-
`Cannot safely remove Camunda skill "${skill.name}": its listed path is not a directory.`
|
|
3998
|
-
);
|
|
3999
|
-
}
|
|
4000
|
-
const rootInfo = statSync(root, { throwIfNoEntry: false });
|
|
4001
|
-
if (!rootInfo?.isDirectory()) {
|
|
4002
|
-
throw new Error(
|
|
4003
|
-
`Cannot safely remove Camunda skill "${skill.name}": its user skills directory is unavailable.`
|
|
4004
|
-
);
|
|
4005
|
-
}
|
|
4006
|
-
const rootRealPath = realpathSync(root);
|
|
4007
|
-
const directoryRealPath = realpathSync(directory);
|
|
4008
|
-
if (!isWithinPath(rootRealPath, directoryRealPath) || directoryRealPath === rootRealPath) {
|
|
4009
|
-
throw new Error(
|
|
4010
|
-
`Cannot safely remove Camunda skill "${skill.name}": its directory resolves outside the user skills directory.`
|
|
4011
|
-
);
|
|
4012
|
-
}
|
|
4013
|
-
rmSync(directory, { recursive: true });
|
|
4014
|
-
}
|
|
4015
3973
|
function requireSuccessfulSkillCommand(result, action) {
|
|
4016
3974
|
if (result.error) {
|
|
4017
3975
|
const errorCode = "code" in result.error && typeof result.error.code === "string" ? result.error.code : void 0;
|
|
@@ -4328,64 +4286,6 @@ function planMcpConfigs({
|
|
|
4328
4286
|
}
|
|
4329
4287
|
return plans;
|
|
4330
4288
|
}
|
|
4331
|
-
function acquireConfigLock(targetPath, timeoutMs, retryMs) {
|
|
4332
|
-
const lockPath = `${targetPath}.lock`;
|
|
4333
|
-
const deadline = Date.now() + timeoutMs;
|
|
4334
|
-
const waitSlot = new Int32Array(new SharedArrayBuffer(4));
|
|
4335
|
-
for (; ; ) {
|
|
4336
|
-
try {
|
|
4337
|
-
closeSync(openSync(lockPath, "wx", 384));
|
|
4338
|
-
return lockPath;
|
|
4339
|
-
} catch (error) {
|
|
4340
|
-
if (!(isRecord(error) && error.code === "EEXIST")) throw error;
|
|
4341
|
-
if (Date.now() >= deadline) {
|
|
4342
|
-
throw new Error(
|
|
4343
|
-
`Another c8ctl process is updating ${targetPath}. Retry shortly, or remove the stale lock ${lockPath} if that process crashed.`
|
|
4344
|
-
);
|
|
4345
|
-
}
|
|
4346
|
-
Atomics.wait(waitSlot, 0, 0, retryMs);
|
|
4347
|
-
}
|
|
4348
|
-
}
|
|
4349
|
-
}
|
|
4350
|
-
function writeMcpConfig(plan, options) {
|
|
4351
|
-
if (!plan.changes.some(
|
|
4352
|
-
(change) => change.status === "installed" || change.status === "updated" || change.status === "removed"
|
|
4353
|
-
))
|
|
4354
|
-
return;
|
|
4355
|
-
mkdirSync(dirname3(plan.targetPath), { recursive: true });
|
|
4356
|
-
const lockPath = acquireConfigLock(
|
|
4357
|
-
plan.targetPath,
|
|
4358
|
-
options?.lockTimeoutMs ?? 5e3,
|
|
4359
|
-
options?.lockRetryMs ?? 50
|
|
4360
|
-
);
|
|
4361
|
-
try {
|
|
4362
|
-
const temp = `${plan.targetPath}.${randomUUID()}.tmp`;
|
|
4363
|
-
let fd;
|
|
4364
|
-
let created = false;
|
|
4365
|
-
try {
|
|
4366
|
-
fd = openSync(temp, "wx", 384);
|
|
4367
|
-
created = true;
|
|
4368
|
-
writeFileSync(fd, plan.content, "utf8");
|
|
4369
|
-
if (process.platform !== "win32") fchmodSync(fd, plan.mode);
|
|
4370
|
-
fsyncSync(fd);
|
|
4371
|
-
closeSync(fd);
|
|
4372
|
-
fd = void 0;
|
|
4373
|
-
const current = readOptionalFile(plan.targetPath);
|
|
4374
|
-
if (current === plan.content) return;
|
|
4375
|
-
if (current !== plan.original) {
|
|
4376
|
-
throw new Error(
|
|
4377
|
-
`MCP config changed during installation: ${plan.path}. Run the command again.`
|
|
4378
|
-
);
|
|
4379
|
-
}
|
|
4380
|
-
renameSync(temp, plan.targetPath);
|
|
4381
|
-
} finally {
|
|
4382
|
-
if (fd !== void 0) closeSync(fd);
|
|
4383
|
-
if (created) rmSync2(temp, { force: true });
|
|
4384
|
-
}
|
|
4385
|
-
} finally {
|
|
4386
|
-
rmSync2(lockPath, { force: true });
|
|
4387
|
-
}
|
|
4388
|
-
}
|
|
4389
4289
|
|
|
4390
4290
|
// src/utils/command-local/process-instance-helpers.ts
|
|
4391
4291
|
function extractProcessId(bpmnContent) {
|
|
@@ -5487,7 +5387,8 @@ var SETUP_MCP_HARNESSES = [
|
|
|
5487
5387
|
"vscode"
|
|
5488
5388
|
];
|
|
5489
5389
|
async function inspectSetupRemovalInventory({
|
|
5490
|
-
cwd = process.cwd()
|
|
5390
|
+
cwd = process.cwd(),
|
|
5391
|
+
detectModeler
|
|
5491
5392
|
} = {}) {
|
|
5492
5393
|
const mcpHarnesses = process.platform === "darwin" || process.platform === "win32" ? [...SETUP_MCP_HARNESSES, "claude-desktop"] : [...SETUP_MCP_HARNESSES];
|
|
5493
5394
|
const mcpPlanningFailures = [];
|
|
@@ -5539,13 +5440,26 @@ async function inspectSetupRemovalInventory({
|
|
|
5539
5440
|
});
|
|
5540
5441
|
}
|
|
5541
5442
|
});
|
|
5443
|
+
let modeler;
|
|
5444
|
+
let modelerInspectionFailure;
|
|
5445
|
+
if (detectModeler) {
|
|
5446
|
+
try {
|
|
5447
|
+
modeler = await detectModeler();
|
|
5448
|
+
} catch (error) {
|
|
5449
|
+
modelerInspectionFailure = {
|
|
5450
|
+
message: error instanceof Error ? error.message : String(error)
|
|
5451
|
+
};
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5542
5454
|
return {
|
|
5543
5455
|
mcp,
|
|
5544
5456
|
mcpPlanningFailures,
|
|
5545
5457
|
skills,
|
|
5546
5458
|
skillDiscoveryFailures,
|
|
5547
5459
|
blueprints,
|
|
5548
|
-
blueprintPlanningFailures
|
|
5460
|
+
blueprintPlanningFailures,
|
|
5461
|
+
modeler,
|
|
5462
|
+
modelerInspectionFailure
|
|
5549
5463
|
};
|
|
5550
5464
|
}
|
|
5551
5465
|
|
|
@@ -5653,6 +5567,77 @@ function spawnClusterStop(ctx) {
|
|
|
5653
5567
|
stderrPassthrough: true
|
|
5654
5568
|
});
|
|
5655
5569
|
}
|
|
5570
|
+
function captureC8ctlJson(argv) {
|
|
5571
|
+
const label = `c8ctl ${argv.join(" ")}`;
|
|
5572
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
5573
|
+
const child = spawn2(
|
|
5574
|
+
process.execPath,
|
|
5575
|
+
[...process.execArgv, CLI_ENTRY, ...argv],
|
|
5576
|
+
{
|
|
5577
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
5578
|
+
env: { ...process.env, C8CTL_OUTPUT_MODE: "json" }
|
|
5579
|
+
}
|
|
5580
|
+
);
|
|
5581
|
+
let stdout = "";
|
|
5582
|
+
let stderr = "";
|
|
5583
|
+
child.stdout?.setEncoding("utf-8");
|
|
5584
|
+
child.stderr?.setEncoding("utf-8");
|
|
5585
|
+
child.stdout?.on("data", (chunk) => {
|
|
5586
|
+
stdout += chunk;
|
|
5587
|
+
});
|
|
5588
|
+
child.stderr?.on("data", (chunk) => {
|
|
5589
|
+
stderr += chunk;
|
|
5590
|
+
});
|
|
5591
|
+
child.on(
|
|
5592
|
+
"error",
|
|
5593
|
+
(error) => rejectPromise(new Error(`Could not run ${label}: ${error.message}`))
|
|
5594
|
+
);
|
|
5595
|
+
child.on("close", (code) => {
|
|
5596
|
+
if (code !== 0) {
|
|
5597
|
+
const detail = stderr.trim();
|
|
5598
|
+
rejectPromise(
|
|
5599
|
+
new Error(
|
|
5600
|
+
`${label} failed (exit code ${code}).${detail ? ` ${detail}` : ""}`
|
|
5601
|
+
)
|
|
5602
|
+
);
|
|
5603
|
+
return;
|
|
5604
|
+
}
|
|
5605
|
+
try {
|
|
5606
|
+
resolvePromise(JSON.parse(stdout));
|
|
5607
|
+
} catch {
|
|
5608
|
+
rejectPromise(
|
|
5609
|
+
new Error(`${label} did not print a JSON payload: ${stdout.trim()}`)
|
|
5610
|
+
);
|
|
5611
|
+
}
|
|
5612
|
+
});
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5615
|
+
async function detectModelerRemoval() {
|
|
5616
|
+
const payload = await captureC8ctlJson([
|
|
5617
|
+
"modeler",
|
|
5618
|
+
"remove",
|
|
5619
|
+
"--dry-run"
|
|
5620
|
+
]);
|
|
5621
|
+
if (!isRecord(payload) || typeof payload.wouldChange !== "boolean") {
|
|
5622
|
+
throw new Error(
|
|
5623
|
+
'modeler remove --dry-run returned an invalid response: expected a boolean "wouldChange" field.'
|
|
5624
|
+
);
|
|
5625
|
+
}
|
|
5626
|
+
if (!payload.wouldChange) return void 0;
|
|
5627
|
+
const removalTarget = payload.removalTarget;
|
|
5628
|
+
if (!isRecord(removalTarget) || typeof removalTarget.method !== "string" || removalTarget.method.length === 0 || typeof removalTarget.path !== "string" || removalTarget.path.length === 0) {
|
|
5629
|
+
throw new Error(
|
|
5630
|
+
'modeler remove --dry-run returned an invalid response: expected a "removalTarget" object with nonempty "method" and "path".'
|
|
5631
|
+
);
|
|
5632
|
+
}
|
|
5633
|
+
return {
|
|
5634
|
+
message: typeof payload.message === "string" ? payload.message : "remove Camunda Desktop Modeler",
|
|
5635
|
+
target: {
|
|
5636
|
+
method: removalTarget.method,
|
|
5637
|
+
path: removalTarget.path
|
|
5638
|
+
}
|
|
5639
|
+
};
|
|
5640
|
+
}
|
|
5656
5641
|
var CLUSTER_HEALTH_TIMEOUT_MS = 12e4;
|
|
5657
5642
|
var CLUSTER_HEALTH_POLL_MS = 2e3;
|
|
5658
5643
|
async function runClusterStart(ctx, run) {
|
|
@@ -5960,6 +5945,11 @@ async function executePlan(ctx, selected, blueprintId, { color }) {
|
|
|
5960
5945
|
}
|
|
5961
5946
|
return { failures, run };
|
|
5962
5947
|
}
|
|
5948
|
+
function modelerRemovalLine(message) {
|
|
5949
|
+
const match = /^Dry run: would remove (.+)$/.exec(message);
|
|
5950
|
+
if (match) return `Remove ${match[1]}`;
|
|
5951
|
+
return `Remove Camunda Desktop Modeler with \`c8ctl modeler remove\` (${message})`;
|
|
5952
|
+
}
|
|
5963
5953
|
function setupRemovalPreview(inventory, stopCluster) {
|
|
5964
5954
|
const items = [];
|
|
5965
5955
|
const warnings = [];
|
|
@@ -5992,6 +5982,11 @@ function setupRemovalPreview(inventory, stopCluster) {
|
|
|
5992
5982
|
warnings.push(warning);
|
|
5993
5983
|
lines.push(` Warning: ${warning}`);
|
|
5994
5984
|
}
|
|
5985
|
+
if (inventory.modelerInspectionFailure) {
|
|
5986
|
+
const warning = `Could not inspect the Camunda Desktop Modeler installation: ${inventory.modelerInspectionFailure.message}. Modeler was left untouched.`;
|
|
5987
|
+
warnings.push(warning);
|
|
5988
|
+
lines.push(` Warning: ${warning}`);
|
|
5989
|
+
}
|
|
5995
5990
|
for (const failure of inventory.blueprintPlanningFailures) {
|
|
5996
5991
|
const warning = `Could not inspect setup blueprint marker in ${failure.directory}: ${failure.message}. That project was left untouched.`;
|
|
5997
5992
|
warnings.push(warning);
|
|
@@ -6008,6 +6003,14 @@ function setupRemovalPreview(inventory, stopCluster) {
|
|
|
6008
6003
|
` Remove Camunda skill "${skill.name}" for ${skill.harness} (${skill.path}; all contents will be removed)`
|
|
6009
6004
|
);
|
|
6010
6005
|
}
|
|
6006
|
+
if (inventory.modeler) {
|
|
6007
|
+
items.push({
|
|
6008
|
+
type: "modeler",
|
|
6009
|
+
action: "remove",
|
|
6010
|
+
message: inventory.modeler.message
|
|
6011
|
+
});
|
|
6012
|
+
lines.push(` ${modelerRemovalLine(inventory.modeler.message)}`);
|
|
6013
|
+
}
|
|
6011
6014
|
for (const blueprint of inventory.blueprints) {
|
|
6012
6015
|
const files = [.../* @__PURE__ */ new Set([...blueprint.files, ".c8ctl-blueprint.json"])];
|
|
6013
6016
|
items.push({
|
|
@@ -6031,7 +6034,7 @@ function setupRemovalPreview(inventory, stopCluster) {
|
|
|
6031
6034
|
if (items.length === 0)
|
|
6032
6035
|
lines.push(" No setup-managed components were found.");
|
|
6033
6036
|
lines.push(
|
|
6034
|
-
" Listed skill directories and blueprint files may contain local edits; those contents will be removed. Untracked blueprint files
|
|
6037
|
+
" Listed skill directories and blueprint files may contain local edits; those contents will be removed. Untracked blueprint files are kept."
|
|
6035
6038
|
);
|
|
6036
6039
|
lines.push("Nothing was removed.");
|
|
6037
6040
|
return {
|
|
@@ -6051,7 +6054,7 @@ function removalFailure(ctx, action, error) {
|
|
|
6051
6054
|
}
|
|
6052
6055
|
async function applySetupRemoval(ctx, inventory, stopCluster) {
|
|
6053
6056
|
const { logger } = ctx;
|
|
6054
|
-
let failures = inventory.mcpPlanningFailures.length + inventory.skillDiscoveryFailures.length + inventory.blueprintPlanningFailures.length;
|
|
6057
|
+
let failures = inventory.mcpPlanningFailures.length + inventory.skillDiscoveryFailures.length + inventory.blueprintPlanningFailures.length + (inventory.modelerInspectionFailure ? 1 : 0);
|
|
6055
6058
|
for (const failure of inventory.mcpPlanningFailures) {
|
|
6056
6059
|
logger.error(
|
|
6057
6060
|
`Could not inspect MCP configuration for ${failure.harness}: ${failure.message}. That configuration was left untouched.`
|
|
@@ -6067,6 +6070,11 @@ async function applySetupRemoval(ctx, inventory, stopCluster) {
|
|
|
6067
6070
|
`Could not inspect setup blueprint marker in ${failure.directory}: ${failure.message}. That project was left untouched.`
|
|
6068
6071
|
);
|
|
6069
6072
|
}
|
|
6073
|
+
if (inventory.modelerInspectionFailure) {
|
|
6074
|
+
logger.error(
|
|
6075
|
+
`Could not inspect the Camunda Desktop Modeler installation: ${inventory.modelerInspectionFailure.message}. Modeler was left untouched.`
|
|
6076
|
+
);
|
|
6077
|
+
}
|
|
6070
6078
|
if (stopCluster) {
|
|
6071
6079
|
try {
|
|
6072
6080
|
await spawnClusterStop(ctx);
|
|
@@ -6080,8 +6088,19 @@ async function applySetupRemoval(ctx, inventory, stopCluster) {
|
|
|
6080
6088
|
}
|
|
6081
6089
|
}
|
|
6082
6090
|
for (const { plan, servers } of inventory.mcp) {
|
|
6091
|
+
if (servers.length === 0) continue;
|
|
6092
|
+
const targets = [
|
|
6093
|
+
servers.includes("camunda-docs") ? "--docs" : void 0,
|
|
6094
|
+
servers.some((server) => server !== "camunda-docs") ? "--orchestration" : void 0
|
|
6095
|
+
].filter((flag) => flag !== void 0);
|
|
6083
6096
|
try {
|
|
6084
|
-
|
|
6097
|
+
await spawnC8ctl(
|
|
6098
|
+
ctx,
|
|
6099
|
+
["mcp", "uninstall", plan.harness, ...targets],
|
|
6100
|
+
// stderr stays visible: a failing child's diagnostics are
|
|
6101
|
+
// otherwise suppressed with the rest of the quiet output.
|
|
6102
|
+
{ skipStdoutLine: () => true, stderrPassthrough: true }
|
|
6103
|
+
);
|
|
6085
6104
|
for (const server of servers) {
|
|
6086
6105
|
logger.info(
|
|
6087
6106
|
`Removed MCP server "${server}" for ${plan.harness} from ${plan.path}.`,
|
|
@@ -6097,20 +6116,53 @@ async function applySetupRemoval(ctx, inventory, stopCluster) {
|
|
|
6097
6116
|
);
|
|
6098
6117
|
}
|
|
6099
6118
|
}
|
|
6100
|
-
for (const
|
|
6119
|
+
for (const harness of new Set(
|
|
6120
|
+
inventory.skills.map((skill) => skill.harness)
|
|
6121
|
+
)) {
|
|
6122
|
+
const skills = inventory.skills.filter(
|
|
6123
|
+
(skill) => skill.harness === harness
|
|
6124
|
+
);
|
|
6125
|
+
const names = skills.map((skill) => skill.name);
|
|
6126
|
+
const skillPaths = skills.flatMap((skill) => ["--skill-path", skill.path]);
|
|
6101
6127
|
try {
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6128
|
+
await spawnC8ctl(
|
|
6129
|
+
ctx,
|
|
6130
|
+
[
|
|
6131
|
+
"skills",
|
|
6132
|
+
"remove",
|
|
6133
|
+
...names,
|
|
6134
|
+
"--harness",
|
|
6135
|
+
harness,
|
|
6136
|
+
...skillPaths,
|
|
6137
|
+
"--yes"
|
|
6138
|
+
],
|
|
6139
|
+
{
|
|
6140
|
+
skipStdoutLine: (line) => line === "Skills removal preview:" || line.startsWith(" Remove Camunda skill") || line === "Skills removal finished.",
|
|
6141
|
+
promoteStdoutLine: (line) => line.startsWith("Removed Camunda skill"),
|
|
6142
|
+
stderrPassthrough: true
|
|
6143
|
+
}
|
|
6106
6144
|
);
|
|
6107
6145
|
} catch (error) {
|
|
6108
6146
|
failures += 1;
|
|
6109
|
-
removalFailure(
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6147
|
+
removalFailure(ctx, `remove Camunda skills for ${harness}`, error);
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
6150
|
+
if (inventory.modeler) {
|
|
6151
|
+
try {
|
|
6152
|
+
await spawnC8ctl(ctx, ["modeler", "remove"], {
|
|
6153
|
+
promoteStdoutLine: (line) => line.includes("Modeler"),
|
|
6154
|
+
// Registration-cleanup warnings and failure diagnostics ride
|
|
6155
|
+
// stderr — keep them visible in quiet removal runs.
|
|
6156
|
+
stderrPassthrough: true,
|
|
6157
|
+
extraEnv: {
|
|
6158
|
+
C8CTL_SETUP_MODELER_REMOVAL_TARGET: JSON.stringify(
|
|
6159
|
+
inventory.modeler.target
|
|
6160
|
+
)
|
|
6161
|
+
}
|
|
6162
|
+
});
|
|
6163
|
+
} catch (error) {
|
|
6164
|
+
failures += 1;
|
|
6165
|
+
removalFailure(ctx, "remove Camunda Desktop Modeler", error);
|
|
6114
6166
|
}
|
|
6115
6167
|
}
|
|
6116
6168
|
for (const blueprint of inventory.blueprints) {
|
|
@@ -6149,7 +6201,9 @@ async function applySetupRemoval(ctx, inventory, stopCluster) {
|
|
|
6149
6201
|
}
|
|
6150
6202
|
async function runSetupRemoval(ctx, stopCluster) {
|
|
6151
6203
|
const { logger } = ctx;
|
|
6152
|
-
const inventory = await inspectSetupRemovalInventory(
|
|
6204
|
+
const inventory = await inspectSetupRemovalInventory({
|
|
6205
|
+
detectModeler: detectModelerRemoval
|
|
6206
|
+
});
|
|
6153
6207
|
const preview = setupRemovalPreview(inventory, stopCluster);
|
|
6154
6208
|
const jsonMode = logger.mode === "json";
|
|
6155
6209
|
if (ctx.dryRun || jsonMode) {
|
|
@@ -6161,7 +6215,7 @@ async function runSetupRemoval(ctx, stopCluster) {
|
|
|
6161
6215
|
}
|
|
6162
6216
|
logger.output(preview.text);
|
|
6163
6217
|
if (preview.payload.items.length === 0) {
|
|
6164
|
-
if (inventory.mcpPlanningFailures.length > 0 || inventory.skillDiscoveryFailures.length > 0 || inventory.blueprintPlanningFailures.length > 0) {
|
|
6218
|
+
if (inventory.mcpPlanningFailures.length > 0 || inventory.skillDiscoveryFailures.length > 0 || inventory.blueprintPlanningFailures.length > 0 || inventory.modelerInspectionFailure) {
|
|
6165
6219
|
process.exitCode = 1;
|
|
6166
6220
|
}
|
|
6167
6221
|
return;
|
|
@@ -6353,7 +6407,7 @@ A run without a selection (piped output, CI) installs nothing unless you pass --
|
|
|
6353
6407
|
|
|
6354
6408
|
Exit code 0: every selected setup step succeeded, or nothing was installed for lack of a go-ahead (wizard cancelled with Escape; a piped, --quiet or JSON-mode run without --yes; --json or --dry-run printing the plan). Ctrl+C ends the wizard by signal (130 on POSIX shells). A re-run reuses finished work where possible; the deploy, process start and skills install repeat by design. Exit code 1: arguments failed validation, or a step failed \u2014 other eligible steps still ran, while dependents (and the deploy finale after any failure) were skipped.
|
|
6355
6409
|
|
|
6356
|
-
--remove shows setup-managed MCP entries, Camunda skills, and marker-listed blueprint files before removing them. Confirm in the interactive prompt or pass --yes in non-interactive use. --json and --dry-run print only the removal preview. Local edits in skill folders and listed blueprint files are removed; untracked blueprint files are kept.
|
|
6410
|
+
--remove shows setup-managed MCP entries, Camunda skills, a c8ctl-managed Desktop Modeler installation, and marker-listed blueprint files before removing them. Confirm in the interactive prompt or pass --yes in non-interactive use. --json and --dry-run print only the removal preview. Removal runs the owning commands: mcp uninstall, skills remove, and modeler remove. Local edits in skill folders and listed blueprint files are removed; untracked blueprint files are kept. --remove cannot be combined with --modeler, --no-modeler, or --docs-mcp.
|
|
6357
6411
|
|
|
6358
6412
|
--stop-cluster is available only with --remove. It stops the local cluster without purging runtime data or deleting downloaded binaries.
|
|
6359
6413
|
|
|
@@ -6407,7 +6461,7 @@ var commands = {
|
|
|
6407
6461
|
},
|
|
6408
6462
|
remove: {
|
|
6409
6463
|
type: "boolean",
|
|
6410
|
-
description: "Preview and remove setup-managed MCP entries, skills, and blueprint files"
|
|
6464
|
+
description: "Preview and remove setup-managed MCP entries, skills, Modeler, and blueprint files"
|
|
6411
6465
|
},
|
|
6412
6466
|
"stop-cluster": {
|
|
6413
6467
|
type: "boolean",
|
|
@@ -12,8 +12,13 @@ harnesses.
|
|
|
12
12
|
GitHub CLI agent ID.
|
|
13
13
|
- `c8ctl skills list [--harness <agent-id>]` — list installed Camunda skills
|
|
14
14
|
and their harnesses and paths.
|
|
15
|
-
- `c8ctl skills remove [--harness <agent-id>]`
|
|
16
|
-
Camunda skills from the detected harnesses
|
|
15
|
+
- `c8ctl skills remove [name...] [--skill-path <path>...] [--harness <agent-id>]`
|
|
16
|
+
— preview and remove installed Camunda skills from the detected harnesses
|
|
17
|
+
or one selected harness. Naming skills removes matching installations; an
|
|
18
|
+
unknown name fails before anything is deleted. To select one installation
|
|
19
|
+
when a name exists at multiple paths, pair each positional name with one
|
|
20
|
+
`--skill-path` value in the same order. Unknown name/path pairs fail before
|
|
21
|
+
anything is deleted.
|
|
17
22
|
|
|
18
23
|
Requires GitHub CLI 2.90 or later; its skill commands are in preview.
|
|
19
24
|
Re-run to update the same skill directories without duplicates when upstream
|
|
@@ -23,5 +28,7 @@ Without `--harness`, c8ctl detects Claude Code and GitHub Copilot CLI. Pass
|
|
|
23
28
|
`--yes` to confirm removal in non-interactive use. `--dry-run` prints a removal
|
|
24
29
|
preview without deleting files. Removal deletes the full Camunda skill
|
|
25
30
|
directories, including local edits, and leaves other skills untouched.
|
|
31
|
+
Without `--skill-path`, a name selects every matching installation. When
|
|
32
|
+
`--skill-path` is provided, each name is limited to its matching listed path.
|
|
26
33
|
|
|
27
34
|
Supports the global `--dry-run`, `--json`, `--quiet`, and `--verbose` flags.
|