@camunda8/cli 4.7.0-alpha.21 → 4.7.0-alpha.23

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.
@@ -2,7 +2,7 @@
2
2
  "name": "c8ctl-plugin-modeler",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
- "description": "c8ctl default plugin to install Camunda Desktop Modeler",
5
+ "description": "c8ctl default plugin to manage Camunda Desktop Modeler",
6
6
  "keywords": ["c8ctl", "c8ctl-plugin", "modeler", "camunda"],
7
7
  "main": "c8ctl-plugin.js"
8
8
  }
@@ -3702,6 +3702,56 @@ var HARNESS_DETECTORS = [
3702
3702
  { id: "claude-code", executable: "claude" },
3703
3703
  { id: "github-copilot", executable: "copilot" }
3704
3704
  ];
3705
+ var HARNESS_USER_SKILL_DIRS = {
3706
+ "github-copilot": ".copilot/skills",
3707
+ "claude-code": ".claude/skills",
3708
+ cursor: ".cursor/skills",
3709
+ codex: ".agents/skills",
3710
+ "gemini-cli": ".gemini/skills",
3711
+ antigravity: ".gemini/antigravity/skills",
3712
+ "antigravity-cli": ".gemini/antigravity-cli/skills",
3713
+ "antigravity2.0": ".gemini/config/skills",
3714
+ adal: ".adal/skills",
3715
+ amp: ".config/agents/skills",
3716
+ augment: ".augment/skills",
3717
+ bob: ".bob/skills",
3718
+ cline: ".agents/skills",
3719
+ codebuddy: ".codebuddy/skills",
3720
+ "command-code": ".commandcode/skills",
3721
+ continue: ".continue/skills",
3722
+ cortex: ".snowflake/cortex/skills",
3723
+ crush: ".config/crush/skills",
3724
+ deepagents: ".deepagents/agent/skills",
3725
+ devin: ".devin/skills",
3726
+ droid: ".factory/skills",
3727
+ firebender: ".firebender/skills",
3728
+ goose: ".config/goose/skills",
3729
+ grok: ".grok/skills",
3730
+ "iflow-cli": ".iflow/skills",
3731
+ junie: ".junie/skills",
3732
+ kilo: ".kilocode/skills",
3733
+ "kimi-cli": ".config/agents/skills",
3734
+ "kiro-cli": ".kiro/skills",
3735
+ kode: ".kode/skills",
3736
+ mcpjam: ".mcpjam/skills",
3737
+ "mistral-vibe": ".vibe/skills",
3738
+ mux: ".mux/skills",
3739
+ neovate: ".neovate/skills",
3740
+ openclaw: ".openclaw/skills",
3741
+ opencode: ".config/opencode/skills",
3742
+ openhands: ".openhands/skills",
3743
+ pi: ".pi/agent/skills",
3744
+ pochi: ".pochi/skills",
3745
+ qoder: ".qoder/skills",
3746
+ "qwen-code": ".qwen/skills",
3747
+ replit: ".config/agents/skills",
3748
+ roo: ".roo/skills",
3749
+ trae: ".trae/skills",
3750
+ "trae-cn": ".trae-cn/skills",
3751
+ universal: ".agents/skills",
3752
+ warp: ".agents/skills",
3753
+ zencoder: ".zencoder/skills"
3754
+ };
3705
3755
  var CAMUNDA_SKILLS_REPOSITORY = "camunda/skills";
3706
3756
  var CAMUNDA_SKILLS_URL = `https://github.com/${CAMUNDA_SKILLS_REPOSITORY}`;
3707
3757
  function buildSkillListArgs(harness) {
@@ -3832,9 +3882,22 @@ function harnessSkillDirectories({
3832
3882
  home,
3833
3883
  platform: platform2
3834
3884
  }) {
3835
- return harnessConfigDirectories({ harness, env, home, platform: platform2 }).map(
3836
- (directory) => resolve(joinForPlatform(platform2, directory, "skills"))
3837
- );
3885
+ const directories = [];
3886
+ if (harness === "claude-code" && env.CLAUDE_CONFIG_DIR) {
3887
+ directories.push(
3888
+ joinForPlatform(platform2, env.CLAUDE_CONFIG_DIR, "skills")
3889
+ );
3890
+ }
3891
+ if (harness === "pi" && env.PI_CODING_AGENT_DIR) {
3892
+ directories.push(
3893
+ joinForPlatform(platform2, env.PI_CODING_AGENT_DIR, "skills")
3894
+ );
3895
+ }
3896
+ const userDir = HARNESS_USER_SKILL_DIRS[harness];
3897
+ if (userDir) {
3898
+ directories.push(joinForPlatform(platform2, home, userDir));
3899
+ }
3900
+ return directories.map((directory) => resolve(directory));
3838
3901
  }
3839
3902
  function hasCamundaUserSkillsDirectory(harness, {
3840
3903
  env = process.env,
@@ -3879,6 +3942,30 @@ function skillRemovalLocation(skill, { env = process.env, home, platform: platfo
3879
3942
  `Cannot safely remove Camunda skill "${skill.name}" from ${skill.path}: the path is outside the ${skill.harness} user skills directory.`
3880
3943
  );
3881
3944
  }
3945
+ if (statSync(root, { throwIfNoEntry: false })?.isDirectory()) {
3946
+ const rootRealPath = realpathSync(root);
3947
+ const envRoots = [
3948
+ ...skill.harness === "claude-code" && env.CLAUDE_CONFIG_DIR ? [env.CLAUDE_CONFIG_DIR] : [],
3949
+ ...skill.harness === "pi" && env.PI_CODING_AGENT_DIR ? [env.PI_CODING_AGENT_DIR] : []
3950
+ ];
3951
+ const isEnvRoot = envRoots.some(
3952
+ (envRoot) => resolve(envRoot) === resolve(dirname2(root))
3953
+ );
3954
+ if (!isEnvRoot && (!statSync(userHome, { throwIfNoEntry: false })?.isDirectory() || !isWithinPath(realpathSync(resolve(userHome)), rootRealPath))) {
3955
+ throw new Error(
3956
+ `Cannot safely remove Camunda skill "${skill.name}": the ${skill.harness} user skills directory resolves outside the home directory.`
3957
+ );
3958
+ }
3959
+ const directoryInfo = lstatSync(directory, { throwIfNoEntry: false });
3960
+ if (directoryInfo && !directoryInfo.isSymbolicLink()) {
3961
+ const directoryRealPath = realpathSync(directory);
3962
+ if (!isWithinPath(rootRealPath, directoryRealPath) || directoryRealPath === rootRealPath) {
3963
+ throw new Error(
3964
+ `Cannot safely remove Camunda skill "${skill.name}": its directory resolves outside the ${skill.harness} user skills directory.`
3965
+ );
3966
+ }
3967
+ }
3968
+ }
3882
3969
  return { directory, root };
3883
3970
  }
3884
3971
  function camundaSkillRemovalPath(skill, options = {}) {
@@ -1,6 +1,6 @@
1
1
  # c8ctl-plugin-skills
2
2
 
3
- Default c8ctl plugin that installs Camunda AI coding skills into AI coding
3
+ Default c8ctl plugin that manages Camunda AI coding skills in AI coding
4
4
  harnesses.
5
5
 
6
6
  ## Commands
@@ -10,9 +10,18 @@ harnesses.
10
10
  [`camunda/skills`](https://github.com/camunda/skills) for the detected
11
11
  harnesses (Claude Code, GitHub Copilot CLI), or for one harness named by
12
12
  GitHub CLI agent ID.
13
+ - `c8ctl skills list [--harness <agent-id>]` — list installed Camunda skills
14
+ and their harnesses and paths.
15
+ - `c8ctl skills remove [--harness <agent-id>]` — preview and remove installed
16
+ Camunda skills from the detected harnesses or one selected harness.
13
17
 
14
18
  Requires GitHub CLI 2.90 or later; its skill commands are in preview.
15
19
  Re-run to update the same skill directories without duplicates when upstream
16
20
  changes.
17
21
 
22
+ Without `--harness`, c8ctl detects Claude Code and GitHub Copilot CLI. Pass
23
+ `--yes` to confirm removal in non-interactive use. `--dry-run` prints a removal
24
+ preview without deleting files. Removal deletes the full Camunda skill
25
+ directories, including local edits, and leaves other skills untouched.
26
+
18
27
  Supports the global `--dry-run`, `--json`, `--quiet`, and `--verbose` flags.
@@ -231,6 +231,56 @@ var HARNESS_ALIASES = {
231
231
  claude: "claude-code",
232
232
  copilot: "github-copilot"
233
233
  };
234
+ var HARNESS_USER_SKILL_DIRS = {
235
+ "github-copilot": ".copilot/skills",
236
+ "claude-code": ".claude/skills",
237
+ cursor: ".cursor/skills",
238
+ codex: ".agents/skills",
239
+ "gemini-cli": ".gemini/skills",
240
+ antigravity: ".gemini/antigravity/skills",
241
+ "antigravity-cli": ".gemini/antigravity-cli/skills",
242
+ "antigravity2.0": ".gemini/config/skills",
243
+ adal: ".adal/skills",
244
+ amp: ".config/agents/skills",
245
+ augment: ".augment/skills",
246
+ bob: ".bob/skills",
247
+ cline: ".agents/skills",
248
+ codebuddy: ".codebuddy/skills",
249
+ "command-code": ".commandcode/skills",
250
+ continue: ".continue/skills",
251
+ cortex: ".snowflake/cortex/skills",
252
+ crush: ".config/crush/skills",
253
+ deepagents: ".deepagents/agent/skills",
254
+ devin: ".devin/skills",
255
+ droid: ".factory/skills",
256
+ firebender: ".firebender/skills",
257
+ goose: ".config/goose/skills",
258
+ grok: ".grok/skills",
259
+ "iflow-cli": ".iflow/skills",
260
+ junie: ".junie/skills",
261
+ kilo: ".kilocode/skills",
262
+ "kimi-cli": ".config/agents/skills",
263
+ "kiro-cli": ".kiro/skills",
264
+ kode: ".kode/skills",
265
+ mcpjam: ".mcpjam/skills",
266
+ "mistral-vibe": ".vibe/skills",
267
+ mux: ".mux/skills",
268
+ neovate: ".neovate/skills",
269
+ openclaw: ".openclaw/skills",
270
+ opencode: ".config/opencode/skills",
271
+ openhands: ".openhands/skills",
272
+ pi: ".pi/agent/skills",
273
+ pochi: ".pochi/skills",
274
+ qoder: ".qoder/skills",
275
+ "qwen-code": ".qwen/skills",
276
+ replit: ".config/agents/skills",
277
+ roo: ".roo/skills",
278
+ trae: ".trae/skills",
279
+ "trae-cn": ".trae-cn/skills",
280
+ universal: ".agents/skills",
281
+ warp: ".agents/skills",
282
+ zencoder: ".zencoder/skills"
283
+ };
234
284
  var CAMUNDA_SKILLS_REPOSITORY = "camunda/skills";
235
285
  var CAMUNDA_SKILLS_URL = `https://github.com/${CAMUNDA_SKILLS_REPOSITORY}`;
236
286
  function normalizeSkillHarness(value) {
@@ -405,6 +455,131 @@ async function listCamundaSkills(harness, runner = runCommand) {
405
455
  harness
406
456
  }));
407
457
  }
458
+ function isWithinPath(root, candidate) {
459
+ const relativePath = relative(root, candidate);
460
+ return relativePath === "" || relativePath !== ".." && !relativePath.startsWith(`..${sep}`) && !isAbsolute(relativePath);
461
+ }
462
+ function harnessSkillDirectories({
463
+ harness,
464
+ env,
465
+ home,
466
+ platform: platform2
467
+ }) {
468
+ const directories = [];
469
+ if (harness === "claude-code" && env.CLAUDE_CONFIG_DIR) {
470
+ directories.push(
471
+ joinForPlatform(platform2, env.CLAUDE_CONFIG_DIR, "skills")
472
+ );
473
+ }
474
+ if (harness === "pi" && env.PI_CODING_AGENT_DIR) {
475
+ directories.push(
476
+ joinForPlatform(platform2, env.PI_CODING_AGENT_DIR, "skills")
477
+ );
478
+ }
479
+ const userDir = HARNESS_USER_SKILL_DIRS[harness];
480
+ if (userDir) {
481
+ directories.push(joinForPlatform(platform2, home, userDir));
482
+ }
483
+ return directories.map((directory) => resolve(directory));
484
+ }
485
+ function skillRemovalLocation(skill, { env = process.env, home, platform: platform2 = process.platform }) {
486
+ const userHome = home ?? (platform2 === "win32" ? env.USERPROFILE || env.HOME || homedir2() : env.HOME || homedir2());
487
+ if (!isAbsolute(skill.path)) {
488
+ throw new Error(
489
+ `Cannot safely remove Camunda skill "${skill.name}": GitHub CLI returned a non-absolute path.`
490
+ );
491
+ }
492
+ const directory = resolve(skill.path);
493
+ const skillName = skill.name.split(/[\\/]/).at(-1);
494
+ if (!skillName || basename(directory) !== skillName) {
495
+ throw new Error(
496
+ `Cannot safely remove Camunda skill "${skill.name}": its listed path does not match the skill name.`
497
+ );
498
+ }
499
+ const roots = harnessSkillDirectories({
500
+ harness: skill.harness,
501
+ env,
502
+ home: userHome,
503
+ platform: platform2
504
+ });
505
+ const root = roots.find(
506
+ (candidate) => candidate !== directory && isWithinPath(candidate, directory)
507
+ );
508
+ if (!root) {
509
+ throw new Error(
510
+ `Cannot safely remove Camunda skill "${skill.name}" from ${skill.path}: the path is outside the ${skill.harness} user skills directory.`
511
+ );
512
+ }
513
+ if (statSync(root, { throwIfNoEntry: false })?.isDirectory()) {
514
+ const rootRealPath = realpathSync(root);
515
+ const envRoots = [
516
+ ...skill.harness === "claude-code" && env.CLAUDE_CONFIG_DIR ? [env.CLAUDE_CONFIG_DIR] : [],
517
+ ...skill.harness === "pi" && env.PI_CODING_AGENT_DIR ? [env.PI_CODING_AGENT_DIR] : []
518
+ ];
519
+ const isEnvRoot = envRoots.some(
520
+ (envRoot) => resolve(envRoot) === resolve(dirname2(root))
521
+ );
522
+ if (!isEnvRoot && (!statSync(userHome, { throwIfNoEntry: false })?.isDirectory() || !isWithinPath(realpathSync(resolve(userHome)), rootRealPath))) {
523
+ throw new Error(
524
+ `Cannot safely remove Camunda skill "${skill.name}": the ${skill.harness} user skills directory resolves outside the home directory.`
525
+ );
526
+ }
527
+ const directoryInfo = lstatSync(directory, { throwIfNoEntry: false });
528
+ if (directoryInfo && !directoryInfo.isSymbolicLink()) {
529
+ const directoryRealPath = realpathSync(directory);
530
+ if (!isWithinPath(rootRealPath, directoryRealPath) || directoryRealPath === rootRealPath) {
531
+ throw new Error(
532
+ `Cannot safely remove Camunda skill "${skill.name}": its directory resolves outside the ${skill.harness} user skills directory.`
533
+ );
534
+ }
535
+ }
536
+ }
537
+ return { directory, root };
538
+ }
539
+ function camundaSkillRemovalPath(skill, options = {}) {
540
+ return skillRemovalLocation(skill, options).directory;
541
+ }
542
+ function removeCamundaSkill(skill, options = {}) {
543
+ const { directory, root } = skillRemovalLocation(skill, options);
544
+ const directoryInfo = lstatSync(directory, { throwIfNoEntry: false });
545
+ if (!directoryInfo) return;
546
+ if (directoryInfo.isSymbolicLink()) {
547
+ const rootInfo2 = statSync(root, { throwIfNoEntry: false });
548
+ if (!rootInfo2?.isDirectory()) {
549
+ throw new Error(
550
+ `Cannot safely remove Camunda skill "${skill.name}": its user skills directory is unavailable.`
551
+ );
552
+ }
553
+ const rootRealPath2 = realpathSync(root);
554
+ const parentRealPath = realpathSync(dirname2(directory));
555
+ if (!isWithinPath(rootRealPath2, parentRealPath)) {
556
+ throw new Error(
557
+ `Cannot safely remove Camunda skill "${skill.name}": its parent directory resolves outside the user skills directory.`
558
+ );
559
+ }
560
+ unlinkSync(directory);
561
+ return;
562
+ }
563
+ if (!directoryInfo.isDirectory()) {
564
+ throw new Error(
565
+ `Cannot safely remove Camunda skill "${skill.name}": its listed path is not a directory.`
566
+ );
567
+ }
568
+ const rootInfo = statSync(root, { throwIfNoEntry: false });
569
+ if (!rootInfo?.isDirectory()) {
570
+ throw new Error(
571
+ `Cannot safely remove Camunda skill "${skill.name}": its user skills directory is unavailable.`
572
+ );
573
+ }
574
+ const rootRealPath = realpathSync(root);
575
+ const directoryRealPath = realpathSync(directory);
576
+ if (!isWithinPath(rootRealPath, directoryRealPath) || directoryRealPath === rootRealPath) {
577
+ throw new Error(
578
+ `Cannot safely remove Camunda skill "${skill.name}": its directory resolves outside the user skills directory.`
579
+ );
580
+ }
581
+ rmSync(directory, { recursive: true });
582
+ }
408
583
  async function runSkillInstall(harness, runner = runCommand) {
409
584
  const installed = await listCamundaSkills(harness, runner);
410
585
  if (installed.length === 0) {
@@ -468,20 +643,28 @@ var HARNESS_LABELS = {
468
643
  };
469
644
  var metadata = {
470
645
  name: "skills",
471
- description: "Install Camunda AI coding skills",
646
+ description: "Manage Camunda AI coding skills",
472
647
  commands: {
473
648
  skills: {
474
- description: "Install Camunda AI coding skills",
475
- helpDescription: `Install Camunda skills into AI coding harnesses.
649
+ description: "Manage Camunda AI coding skills",
650
+ helpDescription: `Manage Camunda skills installed in AI coding harnesses.
476
651
 
477
652
  Requires GitHub CLI 2.90 or later; its skill commands are in preview.
478
653
  Re-run to update the same skill directories without duplicates when upstream changes. Local edits to up-to-date skills are preserved; upstream updates may replace edited files.
479
654
  To restore one skill's upstream files, use \`gh skill update --force --dir <skills-root> <skill-name>\`; pass the parent skills directory (for example \`~/.claude/skills\`), not the listed skill directory. Find names with \`gh skill list --scope user --agent <agent-id>\`. Extra local files are retained.
480
- Use a GitHub CLI agent ID for --harness. See \`gh skill install --help\` for supported IDs.`,
655
+ Use \`skills list\` to inspect installed skills and \`skills remove\` to remove them. Removal deletes the full skill directories, including local edits. Use a GitHub CLI agent ID for --harness; see \`gh skill install --help\` for supported IDs. Pass \`--yes\` for non-interactive removal; \`--dry-run\` previews without deleting.`,
481
656
  subcommands: [
482
657
  {
483
658
  name: "install",
484
659
  description: "Install or update skills for detected harnesses"
660
+ },
661
+ {
662
+ name: "list",
663
+ description: "List installed Camunda skills by harness"
664
+ },
665
+ {
666
+ name: "remove",
667
+ description: "Remove installed Camunda skills"
485
668
  }
486
669
  ],
487
670
  examples: [
@@ -496,18 +679,248 @@ Use a GitHub CLI agent ID for --harness. See \`gh skill install --help\` for sup
496
679
  {
497
680
  command: "c8ctl skills install --harness github-copilot",
498
681
  description: "Install or update skills for GitHub Copilot CLI"
682
+ },
683
+ {
684
+ command: "c8ctl skills list",
685
+ description: "List installed Camunda skills by harness"
686
+ },
687
+ {
688
+ command: "c8ctl skills remove --dry-run",
689
+ description: "Preview Camunda skills removal"
690
+ },
691
+ {
692
+ command: "c8ctl skills remove --harness claude-code --yes",
693
+ description: "Remove Camunda skills from Claude Code"
499
694
  }
500
695
  ]
501
696
  }
502
697
  }
503
698
  };
699
+ function resolveHarnesses(rawHarness) {
700
+ if (rawHarness !== void 0 && (typeof rawHarness !== "string" || rawHarness === "")) {
701
+ throw new Error("Invalid --harness: value must not be empty");
702
+ }
703
+ const requestedHarness = typeof rawHarness === "string" ? normalizeSkillHarness(rawHarness) : void 0;
704
+ const harnesses = requestedHarness ? [requestedHarness] : detectInstalledHarnesses();
705
+ if (harnesses.length === 0) {
706
+ throw new Error(
707
+ "No supported AI coding harness was detected. Install Claude Code or GitHub Copilot CLI, or pass --harness <agent-id>."
708
+ );
709
+ }
710
+ return { harnesses, requestedHarness };
711
+ }
712
+ async function inspectSkills(harnesses) {
713
+ const skills = [];
714
+ for (const harness of harnesses) {
715
+ skills.push(...await listCamundaSkills(harness));
716
+ }
717
+ return skills;
718
+ }
719
+ function skillRows(skills) {
720
+ return skills.map(({ name, harness, path }) => ({ name, harness, path }));
721
+ }
722
+ function emitRowsJson(ctx, envelope, rows) {
723
+ if (ctx.fields && ctx.fields.length > 0) {
724
+ ctx.logger.json(rows);
725
+ } else {
726
+ ctx.logger.json(envelope);
727
+ }
728
+ }
729
+ async function listSkills(rawHarness, ctx) {
730
+ const { logger } = ctx;
731
+ try {
732
+ const { harnesses } = resolveHarnesses(rawHarness);
733
+ const skills = await inspectSkills(harnesses);
734
+ const rows = skillRows(skills);
735
+ if (ctx.outputMode === "json") {
736
+ emitRowsJson(
737
+ ctx,
738
+ { command: "skills list", harnesses, skills: rows },
739
+ rows
740
+ );
741
+ } else if (rows.length === 0) {
742
+ const labels = harnesses.map((harness) => HARNESS_LABELS[harness] ?? harness).join(", ");
743
+ logger.info(`No Camunda skills are installed for ${labels}.`, {
744
+ essential: true
745
+ });
746
+ } else {
747
+ logger.table(rows);
748
+ }
749
+ } catch (error) {
750
+ renderCommandFailure(logger, "Failed to skills list", error, {
751
+ verbose: ctx.verbose
752
+ });
753
+ process.exitCode = 1;
754
+ }
755
+ }
756
+ async function removeSkills(rawHarness, extraArgs, ctx) {
757
+ const { logger } = ctx;
758
+ try {
759
+ if (ctx.unrecognizedFlags && ctx.unrecognizedFlags.length > 0) {
760
+ throw new Error(
761
+ `Unknown flag${ctx.unrecognizedFlags.length === 1 ? "" : "s"} ${ctx.unrecognizedFlags.join(", ")} for 'skills remove'. Only --harness selects the removal scope; fix or remove the flag before deleting skills.`
762
+ );
763
+ }
764
+ const swallowed = ctx.suspiciousFlagValues?.[0];
765
+ if (swallowed) {
766
+ throw new Error(
767
+ `"${swallowed}" looks like a flag but was passed as a value. Only --harness selects the removal scope; fix the invocation before deleting skills.`
768
+ );
769
+ }
770
+ if (extraArgs.length > 0) {
771
+ throw new Error(
772
+ `skills remove does not accept positional arguments ("${extraArgs.join(" ")}"). Use --harness <agent-id> to select a harness; removal otherwise covers all detected harnesses.`
773
+ );
774
+ }
775
+ const { harnesses, requestedHarness } = resolveHarnesses(rawHarness);
776
+ const skills = await inspectSkills(harnesses);
777
+ for (const skill of skills) camundaSkillRemovalPath(skill);
778
+ const items = skills.map(({ name, harness, path }) => ({
779
+ type: "skill",
780
+ harness,
781
+ name,
782
+ path
783
+ }));
784
+ const preview = {
785
+ command: "skills remove",
786
+ action: "remove",
787
+ preview: true,
788
+ items
789
+ };
790
+ if (ctx.dryRun) {
791
+ emitRowsJson(ctx, { dryRun: true, ...preview }, items);
792
+ return;
793
+ }
794
+ if (skills.length === 0) {
795
+ if (ctx.outputMode === "json") {
796
+ emitRowsJson(
797
+ ctx,
798
+ { command: "skills remove", harnesses, removed: [] },
799
+ []
800
+ );
801
+ } else {
802
+ const labels = harnesses.map((harness) => HARNESS_LABELS[harness] ?? harness).join(", ");
803
+ logger.info(`No Camunda skills are installed for ${labels}.`, {
804
+ essential: true
805
+ });
806
+ }
807
+ return;
808
+ }
809
+ if (ctx.outputMode === "text") {
810
+ logger.output(
811
+ [
812
+ "Skills removal preview:",
813
+ ...skills.map(
814
+ ({ name, harness, path }) => ` Remove Camunda skill "${name}" for ${HARNESS_LABELS[harness] ?? harness} (${path}; all contents will be removed)`
815
+ )
816
+ ].join("\n")
817
+ );
818
+ } else if (!ctx.yes) {
819
+ emitRowsJson(ctx, preview, items);
820
+ return;
821
+ }
822
+ if (!ctx.yes) {
823
+ if (!ctx.quiet && ctx.prompt.isInteractive()) {
824
+ const confirmation = await ctx.prompt.select({
825
+ message: "Remove the listed Camunda skills?",
826
+ options: [
827
+ { label: "Keep these skills", value: false },
828
+ { label: "Remove the listed skills", value: true }
829
+ ]
830
+ });
831
+ if (confirmation.cancelled || !confirmation.value) {
832
+ logger.info("Cancelled \u2014 nothing was removed.", {
833
+ essential: true
834
+ });
835
+ return;
836
+ }
837
+ } else {
838
+ const command = [
839
+ "c8ctl",
840
+ "skills",
841
+ "remove",
842
+ ...requestedHarness ? ["--harness", requestedHarness] : [],
843
+ "--yes"
844
+ ].join(" ");
845
+ logger.info(`Nothing was removed. Run "${command}" to confirm.`, {
846
+ essential: true
847
+ });
848
+ return;
849
+ }
850
+ }
851
+ const revalidated = await inspectSkills(harnesses);
852
+ const listedKeys = new Set(
853
+ revalidated.map((skill) => `${skill.harness} ${skill.path}`)
854
+ );
855
+ const stale = skills.filter(
856
+ (skill) => !listedKeys.has(`${skill.harness} ${skill.path}`)
857
+ );
858
+ if (stale.length > 0) {
859
+ throw new Error(
860
+ `The installed-skills inventory changed after the preview: ${stale.map((skill) => `"${skill.name}" (${skill.path})`).join(
861
+ ", "
862
+ )}. Run "c8ctl skills remove" again for a fresh preview before deleting.`
863
+ );
864
+ }
865
+ const removed = [];
866
+ const failures = [];
867
+ for (const skill of skills) {
868
+ try {
869
+ removeCamundaSkill(skill);
870
+ removed.push(skill);
871
+ } catch (error) {
872
+ failures.push({ skill, error });
873
+ }
874
+ }
875
+ if (ctx.outputMode === "json") {
876
+ emitRowsJson(
877
+ ctx,
878
+ { command: "skills remove", removed: skillRows(removed) },
879
+ skillRows(removed)
880
+ );
881
+ } else {
882
+ for (const skill of removed) {
883
+ logger.info(
884
+ `Removed Camunda skill "${skill.name}" for ${HARNESS_LABELS[skill.harness] ?? skill.harness} (${skill.path}).`,
885
+ { essential: true }
886
+ );
887
+ }
888
+ logger.info(
889
+ failures.length === 0 ? "Skills removal finished." : `Skills removal finished with ${failures.length} failed action(s).`,
890
+ { essential: true }
891
+ );
892
+ }
893
+ for (const { skill, error } of failures) {
894
+ renderCommandFailure(
895
+ logger,
896
+ `Could not remove Camunda skill "${skill.name}" for ${skill.harness}`,
897
+ error,
898
+ { verbose: ctx.verbose }
899
+ );
900
+ }
901
+ if (failures.length > 0) process.exitCode = 1;
902
+ } catch (error) {
903
+ renderCommandFailure(logger, "Failed to skills remove", error, {
904
+ verbose: ctx.verbose
905
+ });
906
+ process.exitCode = 1;
907
+ }
908
+ }
504
909
  async function skillsHandler(args, flags, ctx) {
505
910
  if (!ctx) throw new Error("skills requires the plugin host context");
506
911
  const { logger } = ctx;
912
+ if (args[0] === "list") {
913
+ await listSkills(flags?.harness, ctx);
914
+ return;
915
+ }
916
+ if (args[0] === "remove") {
917
+ await removeSkills(flags?.harness, args.slice(1), ctx);
918
+ return;
919
+ }
507
920
  if (args[0] !== "install") {
508
921
  if (args[0] === void 0) {
509
922
  logger.info(
510
- "\nUsage: c8ctl skills install\n\nAvailable resources:\n install",
923
+ "\nUsage: c8ctl skills <install|list|remove> [--harness <agent-id>]\n\nAvailable commands:\n install\n list\n remove",
511
924
  {
512
925
  essential: true
513
926
  }
@@ -41,6 +41,20 @@ export type ParsedValues = Record<string, string | boolean | (string | boolean)[
41
41
  export type ArgToken = NonNullable<ReturnType<typeof parseArgs>["tokens"]>[number];
42
42
  /** `GLOBAL_FLAGS` exactly as declared (`--version` is a string: the post-verb definition-version filter). */
43
43
  export declare function globalOptions(): ParseOptions;
44
+ /**
45
+ * Find option-like tokens (`--…`) that a string flag swallowed as its
46
+ * value. Known flags in that position are rewritten by
47
+ * `protectFlagLikeValues`, so a surviving `--…` value is an undeclared
48
+ * flag the user mistyped — for example `--fields --harnes=cursor`, where
49
+ * the typo vanishes from the parsed values. Every occurrence is reported,
50
+ * including repeated and pre-verb ones, so a later `--fields name` cannot
51
+ * hide an earlier swallowed selector.
52
+ */
53
+ export declare function swallowedOptionLikeValues({ args, options, tokens, }: {
54
+ args: readonly string[];
55
+ options: ParseOptions;
56
+ tokens: readonly ArgToken[];
57
+ }): string[];
44
58
  /**
45
59
  * The one place `parseArgs` is called for command-line parsing. Lenient
46
60
  * (`strict: false`): unknown flags never throw — they are reported later as
@@ -1 +1 @@
1
- {"version":3,"file":"argv-parser.d.ts","sourceRoot":"","sources":["../../src/framework/argv-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAatC,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,4FAA4F;AAC5F,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAEvD,2DAA2D;AAC3D,MAAM,MAAM,YAAY,GAAG,MAAM,CAChC,MAAM,EACN,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CACnD,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,QAAQ,GAAG,WAAW,CACjC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,QAAQ,CAAC,CACtC,CAAC,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