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

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.
@@ -1,109 +0,0 @@
1
- import { realpathSync } from "node:fs";
2
- import { extname, resolve } from "node:path";
3
- import { c8ctl, DEFAULT_PROFILE, getModelerDataDir, getProfileOrModeler, getUserDataDir, resolveEnvBaseUrl, } from "../core/index.js";
4
- import { defineCommand, } from "../framework/index.js";
5
- import { planMcpConfigs, writeMcpConfig, } from "../utils/index.js";
6
- function targets(flags) {
7
- const docs = flags.docs === true;
8
- const orchestration = flags.orchestration === true || !docs;
9
- const alias = flags.alias ?? "camunda";
10
- if (flags.alias !== undefined && !orchestration) {
11
- throw new Error("--alias applies to orchestration. Add --orchestration or omit --alias.");
12
- }
13
- if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(alias) || alias === "camunda-docs") {
14
- throw new Error("Use an orchestration alias containing letters, digits, underscores or hyphens, starting with a letter or digit. 'camunda-docs' is reserved.");
15
- }
16
- return { docs, orchestration, alias };
17
- }
18
- /**
19
- * The harness connection entry pointing at `c8ctl mcp-proxy` for a
20
- * profile. Exported so `c8ctl setup` can wire the cluster MCP server to
21
- * the local profile without going through the command wrapper.
22
- */
23
- export function buildMcpConnection(profileFlag) {
24
- const selected = profileFlag ?? c8ctl.activeProfile;
25
- if (selected === undefined && resolveEnvBaseUrl()) {
26
- throw new Error("MCP installation requires a saved profile. Save your environment with 'c8ctl add profile <name> --from-env', then pass --profile <name>.");
27
- }
28
- const name = selected ?? DEFAULT_PROFILE;
29
- const profile = getProfileOrModeler(name);
30
- if (!profile) {
31
- throw new Error(`Profile '${name}' not found. Run 'c8ctl list profiles' and select one with --profile.`);
32
- }
33
- const entry = {
34
- command: process.execPath,
35
- args: [
36
- realpathSync(resolve(import.meta.dirname, `../index${extname(import.meta.filename)}`)),
37
- "mcp-proxy",
38
- "--profile",
39
- profile.name,
40
- ],
41
- env: {
42
- C8CTL_DATA_DIR: resolve(getUserDataDir()),
43
- ...(profile.name.startsWith("modeler:")
44
- ? { C8CTL_MODELER_DIR: resolve(getModelerDataDir()) }
45
- : {}),
46
- },
47
- };
48
- if ([entry.command, ...entry.args, ...Object.values(entry.env)].some((value) => value.includes("${"))) {
49
- throw new Error(`MCP harnesses expand \${...} placeholders. Use a profile name and Node.js, c8ctl, and data-directory paths without that syntax.`);
50
- }
51
- return entry;
52
- }
53
- function applyPlans({ ctx, plans, operation, }) {
54
- if (ctx.isDryRun) {
55
- return {
56
- kind: "dryRun",
57
- info: {
58
- dryRun: true,
59
- command: `mcp ${operation}`,
60
- changes: plans.flatMap((plan) => plan.changes.map((change) => ({
61
- harness: plan.harness,
62
- path: plan.path,
63
- ...change,
64
- }))),
65
- },
66
- };
67
- }
68
- for (const plan of plans) {
69
- writeMcpConfig(plan);
70
- ctx.logger.info(`MCP configuration: ${plan.harness} (${plan.path})`);
71
- }
72
- if (operation === "install") {
73
- ctx.logger.info("Restart or reload the selected harnesses to activate MCP.");
74
- if (plans.some((plan) => plan.changes.some((change) => change.server === "camunda-docs"))) {
75
- ctx.logger.info("The docs server requires sign-in on first use.");
76
- }
77
- }
78
- return {
79
- kind: "list",
80
- items: plans.flatMap((plan) => plan.changes.map(({ server, status }) => ({
81
- harness: plan.harness,
82
- server,
83
- status,
84
- path: plan.path,
85
- }))),
86
- emptyMessage: "No MCP entries selected.",
87
- };
88
- }
89
- export const installMcpCommand = defineCommand("mcp", "install", async (ctx, flags) => {
90
- const selected = targets(flags);
91
- const plans = planMcpConfigs({
92
- requested: ctx.positionals,
93
- operation: "install",
94
- ...selected,
95
- connection: selected.orchestration
96
- ? buildMcpConnection(ctx.profile)
97
- : undefined,
98
- });
99
- return applyPlans({ ctx, plans, operation: "install" });
100
- });
101
- export const uninstallMcpCommand = defineCommand("mcp", "uninstall", async (ctx, flags) => {
102
- const plans = planMcpConfigs({
103
- requested: ctx.positionals,
104
- operation: "uninstall",
105
- ...targets(flags),
106
- });
107
- return applyPlans({ ctx, plans, operation: "uninstall" });
108
- });
109
- //# sourceMappingURL=mcp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACN,KAAK,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGN,aAAa,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEN,cAAc,EACd,cAAc,GACd,MAAM,mBAAmB,CAAC;AAE3B,SAAS,OAAO,CAAC,KAIhB;IACA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;IACjC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC;IAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC;IACvC,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,aAAa,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CACd,wEAAwE,CACxE,CAAC;IACH,CAAC;IACD,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CACd,6IAA6I,CAC7I,CAAC;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CACjC,WAAoB;IAEpB,MAAM,QAAQ,GAAG,WAAW,IAAI,KAAK,CAAC,aAAa,CAAC;IACpD,IAAI,QAAQ,KA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