@camunda8/cli 4.7.0-alpha.2 → 4.7.0-alpha.21
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/CONTEXT.md +11 -0
- package/README.md +11 -2
- package/dist/command-dispatch.d.ts.map +1 -1
- package/dist/command-dispatch.js +3 -0
- package/dist/command-dispatch.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +48 -9
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/helpers/deploy-helpers.d.ts +96 -2
- package/dist/commands/helpers/deploy-helpers.d.ts.map +1 -1
- package/dist/commands/helpers/deploy-helpers.js +213 -70
- package/dist/commands/helpers/deploy-helpers.js.map +1 -1
- package/dist/commands/mcp-proxy.d.ts.map +1 -1
- package/dist/commands/mcp-proxy.js +13 -8
- package/dist/commands/mcp-proxy.js.map +1 -1
- package/dist/commands/mcp.d.ts +9 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +109 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/profiles.d.ts.map +1 -1
- package/dist/commands/profiles.js +13 -7
- package/dist/commands/profiles.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +1 -8
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +309 -16
- package/dist/commands/watch.js.map +1 -1
- package/dist/core/client.d.ts +13 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +48 -21
- package/dist/core/client.js.map +1 -1
- package/dist/core/config.d.ts +34 -3
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +91 -9
- package/dist/core/config.js.map +1 -1
- package/dist/core/env-address.d.ts +22 -0
- package/dist/core/env-address.d.ts.map +1 -0
- package/dist/core/env-address.js +30 -0
- package/dist/core/env-address.js.map +1 -0
- package/dist/core/errors.d.ts +17 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +32 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +2 -1
- package/dist/core/logger.js.map +1 -1
- package/dist/default-plugins/cluster/README.md +3 -1
- package/dist/default-plugins/cluster/c8ctl-plugin.js +54 -3
- package/dist/default-plugins/modeler/README.md +12 -0
- package/dist/default-plugins/modeler/c8ctl-plugin.js +3042 -0
- package/dist/default-plugins/modeler/package.json +8 -0
- package/dist/default-plugins/setup/README.md +36 -0
- package/dist/default-plugins/setup/c8ctl-plugin.js +6336 -0
- package/dist/default-plugins/setup/package.json +8 -0
- package/dist/default-plugins/skills/README.md +18 -0
- package/dist/default-plugins/skills/c8ctl-plugin.js +572 -0
- package/dist/default-plugins/skills/package.json +8 -0
- package/dist/framework/command-registry.d.ts +56 -0
- package/dist/framework/command-registry.d.ts.map +1 -1
- package/dist/framework/command-registry.js +99 -0
- package/dist/framework/command-registry.js.map +1 -1
- package/dist/framework/plugins/plugin-loader.d.ts +5 -2
- package/dist/framework/plugins/plugin-loader.d.ts.map +1 -1
- package/dist/framework/plugins/plugin-loader.js.map +1 -1
- package/dist/framework/ui/help.d.ts.map +1 -1
- package/dist/framework/ui/help.js +57 -14
- package/dist/framework/ui/help.js.map +1 -1
- package/dist/framework/ui/prompt.d.ts +80 -0
- package/dist/framework/ui/prompt.d.ts.map +1 -1
- package/dist/framework/ui/prompt.js +311 -0
- package/dist/framework/ui/prompt.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/command-local/mcp-install-helpers.d.ts +49 -0
- package/dist/utils/command-local/mcp-install-helpers.d.ts.map +1 -0
- package/dist/utils/command-local/mcp-install-helpers.js +394 -0
- package/dist/utils/command-local/mcp-install-helpers.js.map +1 -0
- package/dist/utils/command-local/process-instance-helpers.d.ts +6 -0
- package/dist/utils/command-local/process-instance-helpers.d.ts.map +1 -1
- package/dist/utils/command-local/process-instance-helpers.js +9 -0
- package/dist/utils/command-local/process-instance-helpers.js.map +1 -1
- package/dist/utils/command-local/skills-install-helpers.d.ts +45 -0
- package/dist/utils/command-local/skills-install-helpers.d.ts.map +1 -0
- package/dist/utils/command-local/skills-install-helpers.js +322 -0
- package/dist/utils/command-local/skills-install-helpers.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/shared/camunda-json.d.ts +24 -3
- package/dist/utils/shared/camunda-json.d.ts.map +1 -1
- package/dist/utils/shared/camunda-json.js +23 -5
- package/dist/utils/shared/camunda-json.js.map +1 -1
- package/dist/utils/shared/deploy-resource-selection.d.ts +165 -0
- package/dist/utils/shared/deploy-resource-selection.d.ts.map +1 -0
- package/dist/utils/shared/deploy-resource-selection.js +466 -0
- package/dist/utils/shared/deploy-resource-selection.js.map +1 -0
- package/dist/utils/shared/ignore.d.ts +26 -0
- package/dist/utils/shared/ignore.d.ts.map +1 -1
- package/dist/utils/shared/ignore.js +6 -2
- package/dist/utils/shared/ignore.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "c8ctl-plugin-setup",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "c8ctl default plugin providing guided first-run setup for local Camunda 8 development",
|
|
6
|
+
"keywords": ["c8ctl", "c8ctl-plugin", "setup", "camunda"],
|
|
7
|
+
"main": "c8ctl-plugin.js"
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# c8ctl-plugin-skills
|
|
2
|
+
|
|
3
|
+
Default c8ctl plugin that installs Camunda AI coding skills into AI coding
|
|
4
|
+
harnesses.
|
|
5
|
+
|
|
6
|
+
## Commands
|
|
7
|
+
|
|
8
|
+
- `c8ctl skills install [--harness <agent-id>]` — install or update the
|
|
9
|
+
Camunda skills from
|
|
10
|
+
[`camunda/skills`](https://github.com/camunda/skills) for the detected
|
|
11
|
+
harnesses (Claude Code, GitHub Copilot CLI), or for one harness named by
|
|
12
|
+
GitHub CLI agent ID.
|
|
13
|
+
|
|
14
|
+
Requires GitHub CLI 2.90 or later; its skill commands are in preview.
|
|
15
|
+
Re-run to update the same skill directories without duplicates when upstream
|
|
16
|
+
changes.
|
|
17
|
+
|
|
18
|
+
Supports the global `--dry-run`, `--json`, `--quiet`, and `--verbose` flags.
|
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
// src/core/config.ts
|
|
2
|
+
import { homedir, platform } from "node:os";
|
|
3
|
+
|
|
4
|
+
// src/core/runtime.ts
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
var __dirname = dirname(__filename);
|
|
10
|
+
var UNVERSIONED_DEV_BUILD = "0.0.0-semantically-released";
|
|
11
|
+
function getVersion() {
|
|
12
|
+
try {
|
|
13
|
+
const packageJsonPath = join(__dirname, "..", "..", "package.json");
|
|
14
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
15
|
+
return packageJson.version || UNVERSIONED_DEV_BUILD;
|
|
16
|
+
} catch {
|
|
17
|
+
return UNVERSIONED_DEV_BUILD;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
var C8ctl = class {
|
|
21
|
+
_activeProfile;
|
|
22
|
+
_activeTenant;
|
|
23
|
+
_outputMode = "text";
|
|
24
|
+
_fields;
|
|
25
|
+
_dryRun;
|
|
26
|
+
_verbose;
|
|
27
|
+
_quiet;
|
|
28
|
+
_resolvedBaseUrl;
|
|
29
|
+
_deps;
|
|
30
|
+
env = {
|
|
31
|
+
version: getVersion(),
|
|
32
|
+
nodeVersion: process.version,
|
|
33
|
+
platform: process.platform,
|
|
34
|
+
arch: process.arch,
|
|
35
|
+
cwd: process.cwd(),
|
|
36
|
+
rootDir: join(__dirname, "..", "..")
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Inject dependencies that cannot be imported at module level
|
|
40
|
+
* due to circular imports. Must be called once during startup,
|
|
41
|
+
* before any plugin or command accesses createClient/resolveTenantId/getLogger.
|
|
42
|
+
*/
|
|
43
|
+
init(deps) {
|
|
44
|
+
if (this._deps) {
|
|
45
|
+
throw new Error("c8ctl.init() must only be called once");
|
|
46
|
+
}
|
|
47
|
+
this._deps = deps;
|
|
48
|
+
}
|
|
49
|
+
createClient(profileFlag, additionalSdkConfig) {
|
|
50
|
+
if (!this._deps) {
|
|
51
|
+
throw new Error("c8ctl.init() must be called before createClient()");
|
|
52
|
+
}
|
|
53
|
+
return this._deps.createClient(profileFlag, additionalSdkConfig);
|
|
54
|
+
}
|
|
55
|
+
resolveTenantId(profileFlag) {
|
|
56
|
+
if (!this._deps) {
|
|
57
|
+
throw new Error("c8ctl.init() must be called before resolveTenantId()");
|
|
58
|
+
}
|
|
59
|
+
return this._deps.resolveTenantId(profileFlag);
|
|
60
|
+
}
|
|
61
|
+
getLogger(mode) {
|
|
62
|
+
if (!this._deps) {
|
|
63
|
+
throw new Error("c8ctl.init() must be called before getLogger()");
|
|
64
|
+
}
|
|
65
|
+
return this._deps.getLogger(mode);
|
|
66
|
+
}
|
|
67
|
+
getUserDataDir() {
|
|
68
|
+
if (!this._deps) {
|
|
69
|
+
throw new Error("c8ctl.init() must be called before getUserDataDir()");
|
|
70
|
+
}
|
|
71
|
+
return this._deps.getUserDataDir();
|
|
72
|
+
}
|
|
73
|
+
getModelerDataDir() {
|
|
74
|
+
if (!this._deps) {
|
|
75
|
+
throw new Error("c8ctl.init() must be called before getModelerDataDir()");
|
|
76
|
+
}
|
|
77
|
+
return this._deps.getModelerDataDir();
|
|
78
|
+
}
|
|
79
|
+
npm(options) {
|
|
80
|
+
if (!this._deps) {
|
|
81
|
+
throw new Error("c8ctl.init() must be called before npm()");
|
|
82
|
+
}
|
|
83
|
+
return options.stdout === true ? this._deps.npm(options) : this._deps.npm(options);
|
|
84
|
+
}
|
|
85
|
+
// Expose env properties directly for plugin compatibility
|
|
86
|
+
get version() {
|
|
87
|
+
return this.env.version;
|
|
88
|
+
}
|
|
89
|
+
get nodeVersion() {
|
|
90
|
+
return this.env.nodeVersion;
|
|
91
|
+
}
|
|
92
|
+
get platform() {
|
|
93
|
+
return this.env.platform;
|
|
94
|
+
}
|
|
95
|
+
get arch() {
|
|
96
|
+
return this.env.arch;
|
|
97
|
+
}
|
|
98
|
+
get cwd() {
|
|
99
|
+
return this.env.cwd;
|
|
100
|
+
}
|
|
101
|
+
get activeProfile() {
|
|
102
|
+
return this._activeProfile;
|
|
103
|
+
}
|
|
104
|
+
set activeProfile(value) {
|
|
105
|
+
this._activeProfile = value;
|
|
106
|
+
}
|
|
107
|
+
get activeTenant() {
|
|
108
|
+
return this._activeTenant;
|
|
109
|
+
}
|
|
110
|
+
set activeTenant(value) {
|
|
111
|
+
this._activeTenant = value;
|
|
112
|
+
}
|
|
113
|
+
get outputMode() {
|
|
114
|
+
return this._outputMode;
|
|
115
|
+
}
|
|
116
|
+
set outputMode(value) {
|
|
117
|
+
this._outputMode = value;
|
|
118
|
+
}
|
|
119
|
+
get fields() {
|
|
120
|
+
return this._fields;
|
|
121
|
+
}
|
|
122
|
+
set fields(value) {
|
|
123
|
+
this._fields = value;
|
|
124
|
+
}
|
|
125
|
+
get dryRun() {
|
|
126
|
+
return this._dryRun;
|
|
127
|
+
}
|
|
128
|
+
set dryRun(value) {
|
|
129
|
+
this._dryRun = value;
|
|
130
|
+
}
|
|
131
|
+
get verbose() {
|
|
132
|
+
return this._verbose;
|
|
133
|
+
}
|
|
134
|
+
set verbose(value) {
|
|
135
|
+
this._verbose = value;
|
|
136
|
+
}
|
|
137
|
+
get quiet() {
|
|
138
|
+
return this._quiet;
|
|
139
|
+
}
|
|
140
|
+
set quiet(value) {
|
|
141
|
+
this._quiet = value;
|
|
142
|
+
}
|
|
143
|
+
get resolvedBaseUrl() {
|
|
144
|
+
return this._resolvedBaseUrl;
|
|
145
|
+
}
|
|
146
|
+
set resolvedBaseUrl(value) {
|
|
147
|
+
this._resolvedBaseUrl = value;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var c8ctl = new C8ctl();
|
|
151
|
+
|
|
152
|
+
// src/core/logger.ts
|
|
153
|
+
function isRecord(value) {
|
|
154
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/core/config.ts
|
|
158
|
+
var VALIDATION_PATTERNS = {
|
|
159
|
+
URL: /^https?:\/\//,
|
|
160
|
+
CAMUNDA_CLOUD_REST_URL: /^https:\/\/[a-z]+-\d+\.zeebe\.camunda\.io(:443|)\/[a-z\d-]+\/?$/
|
|
161
|
+
};
|
|
162
|
+
var CAMUNDA_CLOUD_URL_PATTERN = VALIDATION_PATTERNS.CAMUNDA_CLOUD_REST_URL;
|
|
163
|
+
var isWindows = platform() === "win32";
|
|
164
|
+
|
|
165
|
+
// src/core/errors.ts
|
|
166
|
+
var SilentError = class extends Error {
|
|
167
|
+
constructor(message) {
|
|
168
|
+
super(message);
|
|
169
|
+
this.name = "SilentError";
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
function normalizeToError(error, fallbackMessage = "Operation failed") {
|
|
173
|
+
if (error instanceof Error) {
|
|
174
|
+
return error;
|
|
175
|
+
}
|
|
176
|
+
const raw = isRecord(error) ? error : {};
|
|
177
|
+
const title = typeof raw.title === "string" ? raw.title : void 0;
|
|
178
|
+
const detail = typeof raw.detail === "string" ? raw.detail : void 0;
|
|
179
|
+
const status = typeof raw.status === "number" ? raw.status : void 0;
|
|
180
|
+
const head = [title ?? fallbackMessage, detail].filter((p) => Boolean(p)).join(": ");
|
|
181
|
+
const message = status !== void 0 ? `${head} (status ${status})` : head;
|
|
182
|
+
return new Error(message, { cause: error });
|
|
183
|
+
}
|
|
184
|
+
function renderCommandFailure(logger, message, error, { verbose = false } = {}) {
|
|
185
|
+
const normalizedError = normalizeToError(error, message);
|
|
186
|
+
if (verbose) {
|
|
187
|
+
throw normalizedError;
|
|
188
|
+
}
|
|
189
|
+
if (error instanceof SilentError) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (normalizedError.message === message) {
|
|
193
|
+
logger.error(message);
|
|
194
|
+
} else {
|
|
195
|
+
logger.error(message, normalizedError);
|
|
196
|
+
}
|
|
197
|
+
logger.info("For more details on the error, run with the --verbose flag", {
|
|
198
|
+
essential: true
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// src/core/update-check.ts
|
|
203
|
+
var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
|
|
204
|
+
|
|
205
|
+
// src/utils/command-local/skills-install-helpers.ts
|
|
206
|
+
import { spawn } from "node:child_process";
|
|
207
|
+
import {
|
|
208
|
+
existsSync,
|
|
209
|
+
lstatSync,
|
|
210
|
+
realpathSync,
|
|
211
|
+
rmSync,
|
|
212
|
+
statSync,
|
|
213
|
+
unlinkSync
|
|
214
|
+
} from "node:fs";
|
|
215
|
+
import { homedir as homedir2 } from "node:os";
|
|
216
|
+
import {
|
|
217
|
+
basename,
|
|
218
|
+
dirname as dirname2,
|
|
219
|
+
isAbsolute,
|
|
220
|
+
posix,
|
|
221
|
+
relative,
|
|
222
|
+
resolve,
|
|
223
|
+
sep,
|
|
224
|
+
win32
|
|
225
|
+
} from "node:path";
|
|
226
|
+
var HARNESS_DETECTORS = [
|
|
227
|
+
{ id: "claude-code", executable: "claude" },
|
|
228
|
+
{ id: "github-copilot", executable: "copilot" }
|
|
229
|
+
];
|
|
230
|
+
var HARNESS_ALIASES = {
|
|
231
|
+
claude: "claude-code",
|
|
232
|
+
copilot: "github-copilot"
|
|
233
|
+
};
|
|
234
|
+
var CAMUNDA_SKILLS_REPOSITORY = "camunda/skills";
|
|
235
|
+
var CAMUNDA_SKILLS_URL = `https://github.com/${CAMUNDA_SKILLS_REPOSITORY}`;
|
|
236
|
+
function normalizeSkillHarness(value) {
|
|
237
|
+
const normalized = value.trim().toLowerCase();
|
|
238
|
+
if (!/^[a-z0-9][a-z0-9.-]*$/.test(normalized)) {
|
|
239
|
+
throw new Error(
|
|
240
|
+
"Invalid harness ID. Use a non-empty GitHub CLI skill agent ID, such as claude-code, github-copilot, or cursor."
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
return Object.hasOwn(HARNESS_ALIASES, normalized) ? HARNESS_ALIASES[normalized] : normalized;
|
|
244
|
+
}
|
|
245
|
+
function buildSkillInstallArgs(harness) {
|
|
246
|
+
return [
|
|
247
|
+
"skill",
|
|
248
|
+
"install",
|
|
249
|
+
CAMUNDA_SKILLS_REPOSITORY,
|
|
250
|
+
"--all",
|
|
251
|
+
"--agent",
|
|
252
|
+
harness,
|
|
253
|
+
"--scope",
|
|
254
|
+
"user"
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
function buildSkillListArgs(harness) {
|
|
258
|
+
return [
|
|
259
|
+
"skill",
|
|
260
|
+
"list",
|
|
261
|
+
"--agent",
|
|
262
|
+
harness,
|
|
263
|
+
"--scope",
|
|
264
|
+
"user",
|
|
265
|
+
"--json",
|
|
266
|
+
"skillName,sourceURL,path"
|
|
267
|
+
];
|
|
268
|
+
}
|
|
269
|
+
function buildSkillDiscoveryArgs() {
|
|
270
|
+
return ["skill", "install", CAMUNDA_SKILLS_REPOSITORY];
|
|
271
|
+
}
|
|
272
|
+
function buildSkillInstallSpecificArgs({
|
|
273
|
+
harness,
|
|
274
|
+
skill
|
|
275
|
+
}) {
|
|
276
|
+
return [
|
|
277
|
+
"skill",
|
|
278
|
+
"install",
|
|
279
|
+
CAMUNDA_SKILLS_REPOSITORY,
|
|
280
|
+
skill,
|
|
281
|
+
"--agent",
|
|
282
|
+
harness,
|
|
283
|
+
"--scope",
|
|
284
|
+
"user"
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
function buildSkillUpdateArgs(skills, directory) {
|
|
288
|
+
return ["skill", "update", "--all", "--dir", directory, ...skills];
|
|
289
|
+
}
|
|
290
|
+
function installedCamundaSkills(stdout) {
|
|
291
|
+
let parsed;
|
|
292
|
+
try {
|
|
293
|
+
parsed = JSON.parse(stdout);
|
|
294
|
+
} catch {
|
|
295
|
+
throw new Error("GitHub CLI returned invalid JSON while listing skills.");
|
|
296
|
+
}
|
|
297
|
+
if (!Array.isArray(parsed)) {
|
|
298
|
+
throw new Error("GitHub CLI returned an invalid installed-skills list.");
|
|
299
|
+
}
|
|
300
|
+
const skills = [];
|
|
301
|
+
for (const entry of parsed) {
|
|
302
|
+
if (!isRecord(entry) || typeof entry.sourceURL !== "string") continue;
|
|
303
|
+
if (entry.sourceURL.replace(/\/+$/, "").toLowerCase() !== CAMUNDA_SKILLS_URL)
|
|
304
|
+
continue;
|
|
305
|
+
if (typeof entry.skillName !== "string" || entry.skillName.length === 0 || typeof entry.path !== "string" || entry.path.length === 0) {
|
|
306
|
+
throw new Error("GitHub CLI returned incomplete Camunda skill metadata.");
|
|
307
|
+
}
|
|
308
|
+
skills.push({
|
|
309
|
+
name: entry.skillName,
|
|
310
|
+
directory: dirname2(entry.path),
|
|
311
|
+
path: entry.path
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return skills;
|
|
315
|
+
}
|
|
316
|
+
function availableCamundaSkills(stdout) {
|
|
317
|
+
const names = stdout.split(/\r?\n/).filter((line) => line.includes(" ")).map((line) => line.split(" ", 1)[0].trim()).filter((name) => name.length > 0);
|
|
318
|
+
if (names.length === 0) {
|
|
319
|
+
throw new Error("GitHub CLI returned no available Camunda skills.");
|
|
320
|
+
}
|
|
321
|
+
if (names.some((name) => !/^[a-z0-9][a-z0-9._/-]*$/i.test(name))) {
|
|
322
|
+
throw new Error(
|
|
323
|
+
"GitHub CLI returned an invalid available Camunda skills list."
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
return [...new Set(names)];
|
|
327
|
+
}
|
|
328
|
+
function joinForPlatform(platform2, ...paths) {
|
|
329
|
+
return platform2 === "win32" ? win32.join(...paths) : posix.join(...paths);
|
|
330
|
+
}
|
|
331
|
+
function harnessConfigDirectories({
|
|
332
|
+
harness,
|
|
333
|
+
env,
|
|
334
|
+
home,
|
|
335
|
+
platform: platform2
|
|
336
|
+
}) {
|
|
337
|
+
if (harness === "claude-code") {
|
|
338
|
+
return [
|
|
339
|
+
...env.CLAUDE_CONFIG_DIR ? [env.CLAUDE_CONFIG_DIR] : [],
|
|
340
|
+
joinForPlatform(platform2, home, ".claude")
|
|
341
|
+
];
|
|
342
|
+
}
|
|
343
|
+
if (harness === "github-copilot") {
|
|
344
|
+
return [joinForPlatform(platform2, home, ".copilot")];
|
|
345
|
+
}
|
|
346
|
+
return [];
|
|
347
|
+
}
|
|
348
|
+
function executableIsOnPath({
|
|
349
|
+
name,
|
|
350
|
+
env,
|
|
351
|
+
platform: platform2
|
|
352
|
+
}) {
|
|
353
|
+
const pathSeparator = platform2 === "win32" ? ";" : ":";
|
|
354
|
+
const directories = (env.PATH ?? "").split(pathSeparator).filter((directory) => directory.length > 0);
|
|
355
|
+
const extensions = platform2 === "win32" ? (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((extension) => extension.length > 0) : [""];
|
|
356
|
+
return directories.some(
|
|
357
|
+
(directory) => extensions.some(
|
|
358
|
+
(extension) => existsSync(joinForPlatform(platform2, directory, `${name}${extension}`))
|
|
359
|
+
)
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
function detectInstalledHarnesses({
|
|
363
|
+
env = process.env,
|
|
364
|
+
home,
|
|
365
|
+
platform: platform2 = process.platform
|
|
366
|
+
} = {}) {
|
|
367
|
+
const userHome = home ?? (platform2 === "win32" ? env.USERPROFILE || env.HOME || homedir2() : env.HOME || homedir2());
|
|
368
|
+
return HARNESS_DETECTORS.filter(
|
|
369
|
+
({ id, executable }) => harnessConfigDirectories({
|
|
370
|
+
harness: id,
|
|
371
|
+
env,
|
|
372
|
+
home: userHome,
|
|
373
|
+
platform: platform2
|
|
374
|
+
}).some((directory) => existsSync(directory)) || executableIsOnPath({ name: executable, env, platform: platform2 })
|
|
375
|
+
).map(({ id }) => id);
|
|
376
|
+
}
|
|
377
|
+
function runCommand(command, args) {
|
|
378
|
+
return new Promise((resolveRun) => {
|
|
379
|
+
const child = spawn(command, args);
|
|
380
|
+
let stdout = "";
|
|
381
|
+
let stderr = "";
|
|
382
|
+
child.stdout?.setEncoding("utf8");
|
|
383
|
+
child.stderr?.setEncoding("utf8");
|
|
384
|
+
child.stdout?.on("data", (chunk) => {
|
|
385
|
+
stdout += chunk;
|
|
386
|
+
});
|
|
387
|
+
child.stderr?.on("data", (chunk) => {
|
|
388
|
+
stderr += chunk;
|
|
389
|
+
});
|
|
390
|
+
let settled = false;
|
|
391
|
+
const done = (result) => {
|
|
392
|
+
if (settled) return;
|
|
393
|
+
settled = true;
|
|
394
|
+
resolveRun(result);
|
|
395
|
+
};
|
|
396
|
+
child.on("error", (error) => done({ status: null, stdout, stderr, error }));
|
|
397
|
+
child.on("close", (status) => done({ status, stdout, stderr }));
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
async function listCamundaSkills(harness, runner = runCommand) {
|
|
401
|
+
const listed = await runner("gh", buildSkillListArgs(harness));
|
|
402
|
+
requireSuccessfulSkillCommand(listed, "check for installed");
|
|
403
|
+
return installedCamundaSkills(listed.stdout).map((skill) => ({
|
|
404
|
+
...skill,
|
|
405
|
+
harness
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
async function runSkillInstall(harness, runner = runCommand) {
|
|
409
|
+
const installed = await listCamundaSkills(harness, runner);
|
|
410
|
+
if (installed.length === 0) {
|
|
411
|
+
requireSuccessfulSkillCommand(
|
|
412
|
+
await runner("gh", buildSkillInstallArgs(harness)),
|
|
413
|
+
"install"
|
|
414
|
+
);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
const availableResult = await runner("gh", buildSkillDiscoveryArgs());
|
|
418
|
+
requireSuccessfulSkillCommand(availableResult, "list available");
|
|
419
|
+
const available = availableCamundaSkills(availableResult.stdout);
|
|
420
|
+
const installedNames = new Set(installed.map(({ name }) => name));
|
|
421
|
+
const missing = available.filter((skill) => !installedNames.has(skill));
|
|
422
|
+
const byDirectory = /* @__PURE__ */ new Map();
|
|
423
|
+
for (const skill of installed) {
|
|
424
|
+
const skills = byDirectory.get(skill.directory) ?? [];
|
|
425
|
+
if (!skills.includes(skill.name)) skills.push(skill.name);
|
|
426
|
+
byDirectory.set(skill.directory, skills);
|
|
427
|
+
}
|
|
428
|
+
for (const [directory, skills] of byDirectory) {
|
|
429
|
+
requireSuccessfulSkillCommand(
|
|
430
|
+
await runner("gh", buildSkillUpdateArgs(skills, directory)),
|
|
431
|
+
"update"
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
for (const skill of missing) {
|
|
435
|
+
requireSuccessfulSkillCommand(
|
|
436
|
+
await runner("gh", buildSkillInstallSpecificArgs({ harness, skill })),
|
|
437
|
+
"install"
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function requireSuccessfulSkillCommand(result, action) {
|
|
442
|
+
if (result.error) {
|
|
443
|
+
const errorCode = "code" in result.error && typeof result.error.code === "string" ? result.error.code : void 0;
|
|
444
|
+
if (errorCode === "ENOENT") {
|
|
445
|
+
throw new Error(
|
|
446
|
+
"GitHub CLI was not found. Install GitHub CLI 2.90 or later from https://cli.github.com/."
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
throw new Error(`Could not run GitHub CLI: ${result.error.message}`);
|
|
450
|
+
}
|
|
451
|
+
if (result.status === 0) return;
|
|
452
|
+
const details = [result.stderr.trim(), result.stdout.trim()].filter((output) => output.length > 0).join("\n");
|
|
453
|
+
if (/unknown command\s+["']?skill\b/i.test(details)) {
|
|
454
|
+
throw new Error(
|
|
455
|
+
"`gh skill` requires GitHub CLI 2.90 or later. Upgrade GitHub CLI from https://cli.github.com/."
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
throw new Error(
|
|
459
|
+
`GitHub CLI failed to ${action} Camunda skills${result.status === null ? "" : ` (exit code ${result.status})`}: ${details || "No details were reported."}`
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// default-plugins/skills/c8ctl-plugin.ts
|
|
464
|
+
var HARNESS_LABELS = {
|
|
465
|
+
"claude-code": "Claude Code",
|
|
466
|
+
"github-copilot": "GitHub Copilot CLI",
|
|
467
|
+
cursor: "Cursor"
|
|
468
|
+
};
|
|
469
|
+
var metadata = {
|
|
470
|
+
name: "skills",
|
|
471
|
+
description: "Install Camunda AI coding skills",
|
|
472
|
+
commands: {
|
|
473
|
+
skills: {
|
|
474
|
+
description: "Install Camunda AI coding skills",
|
|
475
|
+
helpDescription: `Install Camunda skills into AI coding harnesses.
|
|
476
|
+
|
|
477
|
+
Requires GitHub CLI 2.90 or later; its skill commands are in preview.
|
|
478
|
+
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
|
+
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.`,
|
|
481
|
+
subcommands: [
|
|
482
|
+
{
|
|
483
|
+
name: "install",
|
|
484
|
+
description: "Install or update skills for detected harnesses"
|
|
485
|
+
}
|
|
486
|
+
],
|
|
487
|
+
examples: [
|
|
488
|
+
{
|
|
489
|
+
command: "c8ctl skills install",
|
|
490
|
+
description: "Install or update skills for detected harnesses"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
command: "c8ctl skills install --harness claude-code",
|
|
494
|
+
description: "Install or update skills for Claude Code"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
command: "c8ctl skills install --harness github-copilot",
|
|
498
|
+
description: "Install or update skills for GitHub Copilot CLI"
|
|
499
|
+
}
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
async function skillsHandler(args, flags, ctx) {
|
|
505
|
+
if (!ctx) throw new Error("skills requires the plugin host context");
|
|
506
|
+
const { logger } = ctx;
|
|
507
|
+
if (args[0] !== "install") {
|
|
508
|
+
if (args[0] === void 0) {
|
|
509
|
+
logger.info(
|
|
510
|
+
"\nUsage: c8ctl skills install\n\nAvailable resources:\n install",
|
|
511
|
+
{
|
|
512
|
+
essential: true
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
} else {
|
|
516
|
+
logger.error(`Unknown command: skills ${args.join(" ")}`);
|
|
517
|
+
logger.info('Run "c8 help" for usage information', { essential: true });
|
|
518
|
+
}
|
|
519
|
+
process.exitCode = 1;
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
try {
|
|
523
|
+
const rawHarness = flags?.harness;
|
|
524
|
+
if (rawHarness !== void 0 && (typeof rawHarness !== "string" || rawHarness === "")) {
|
|
525
|
+
logger.error("Invalid --harness: value must not be empty");
|
|
526
|
+
process.exitCode = 1;
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const requestedHarness = typeof rawHarness === "string" ? normalizeSkillHarness(rawHarness) : void 0;
|
|
530
|
+
const harnesses = requestedHarness ? [requestedHarness] : detectInstalledHarnesses();
|
|
531
|
+
if (harnesses.length === 0) {
|
|
532
|
+
throw new Error(
|
|
533
|
+
"No supported AI coding harness was detected. Install Claude Code or GitHub Copilot CLI, or pass --harness <agent-id>."
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
if (ctx.dryRun) {
|
|
537
|
+
logger.json({
|
|
538
|
+
dryRun: true,
|
|
539
|
+
command: "skills install",
|
|
540
|
+
source: CAMUNDA_SKILLS_REPOSITORY,
|
|
541
|
+
harnesses
|
|
542
|
+
});
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
for (const harness of harnesses) {
|
|
546
|
+
await runSkillInstall(harness);
|
|
547
|
+
}
|
|
548
|
+
const labels = harnesses.map((harness) => HARNESS_LABELS[harness] ?? harness).join(", ");
|
|
549
|
+
logger.success(`Installed or updated Camunda skills for ${labels}.`);
|
|
550
|
+
} catch (error) {
|
|
551
|
+
renderCommandFailure(logger, "Failed to skills install", error, {
|
|
552
|
+
verbose: ctx.verbose
|
|
553
|
+
});
|
|
554
|
+
process.exitCode = 1;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
var commands = {
|
|
558
|
+
skills: {
|
|
559
|
+
flags: {
|
|
560
|
+
harness: {
|
|
561
|
+
type: "string",
|
|
562
|
+
rejectEmpty: true,
|
|
563
|
+
description: "GitHub CLI agent ID to target (auto-detects Claude Code and GitHub Copilot CLI when omitted)"
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
handler: skillsHandler
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
export {
|
|
570
|
+
commands,
|
|
571
|
+
metadata
|
|
572
|
+
};
|
|
@@ -136,12 +136,37 @@ export interface CommandDef {
|
|
|
136
136
|
command: string;
|
|
137
137
|
description: string;
|
|
138
138
|
}[];
|
|
139
|
+
/**
|
|
140
|
+
* Extra lines appended to `c8ctl help <verb>` after the flags — for
|
|
141
|
+
* usage notes that don't fit the flag schema (e.g. mcp-proxy's
|
|
142
|
+
* [mcp-path] values and connection precedence).
|
|
143
|
+
*/
|
|
144
|
+
helpNotes?: readonly string[];
|
|
145
|
+
/**
|
|
146
|
+
* Extra Markdown lines rendered only on the generated docs page
|
|
147
|
+
* (docs/command-reference.md), after the examples — for content that
|
|
148
|
+
* has no place in terminal help (e.g. an exit-code table).
|
|
149
|
+
*/
|
|
150
|
+
docsNotes?: readonly string[];
|
|
139
151
|
}
|
|
140
152
|
/**
|
|
141
153
|
* Maps short/plural resource names to their canonical singular form.
|
|
142
154
|
* Used by the dispatch layer to normalize user input before lookup.
|
|
143
155
|
*/
|
|
144
156
|
export declare const RESOURCE_ALIASES: Record<string, string>;
|
|
157
|
+
/**
|
|
158
|
+
* The CAMUNDA_* environment variables c8ctl resolves when no `--profile` or
|
|
159
|
+
* session profile is selected, rendered as a dedicated "Environment
|
|
160
|
+
* Variables" section in the top-level `c8ctl help` output and in
|
|
161
|
+
* `c8ctl help mcp-proxy`. Kept out of the Flags section on purpose — that
|
|
162
|
+
* section is scoped to GLOBAL_FLAGS (see the class-scoped guard in
|
|
163
|
+
* tests/unit/help.test.ts), and an env var listed as a flag would imply it
|
|
164
|
+
* is a CLI option.
|
|
165
|
+
*/
|
|
166
|
+
export declare const ENVIRONMENT_VARIABLES_HELP: readonly {
|
|
167
|
+
name: string;
|
|
168
|
+
description: string;
|
|
169
|
+
}[];
|
|
145
170
|
/**
|
|
146
171
|
* Flags accepted by every command (infrastructure/agent flags).
|
|
147
172
|
*/
|
|
@@ -2144,6 +2169,36 @@ export declare const COMMAND_REGISTRY: {
|
|
|
2144
2169
|
};
|
|
2145
2170
|
};
|
|
2146
2171
|
};
|
|
2172
|
+
mcp: {
|
|
2173
|
+
description: string;
|
|
2174
|
+
helpResource: string;
|
|
2175
|
+
helpDescription: string;
|
|
2176
|
+
helpFooterLabel: string;
|
|
2177
|
+
hasDetailedHelp: true;
|
|
2178
|
+
mutating: true;
|
|
2179
|
+
requiresResource: true;
|
|
2180
|
+
resources: string[];
|
|
2181
|
+
flags: {
|
|
2182
|
+
orchestration: {
|
|
2183
|
+
type: "boolean";
|
|
2184
|
+
description: string;
|
|
2185
|
+
};
|
|
2186
|
+
docs: {
|
|
2187
|
+
type: "boolean";
|
|
2188
|
+
description: string;
|
|
2189
|
+
};
|
|
2190
|
+
alias: {
|
|
2191
|
+
type: "string";
|
|
2192
|
+
rejectEmpty: true;
|
|
2193
|
+
description: string;
|
|
2194
|
+
};
|
|
2195
|
+
};
|
|
2196
|
+
helpNotes: string[];
|
|
2197
|
+
helpExamples: {
|
|
2198
|
+
command: string;
|
|
2199
|
+
description: string;
|
|
2200
|
+
}[];
|
|
2201
|
+
};
|
|
2147
2202
|
"mcp-proxy": {
|
|
2148
2203
|
description: string;
|
|
2149
2204
|
helpDescription: string;
|
|
@@ -2154,6 +2209,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
2154
2209
|
requiresResource: false;
|
|
2155
2210
|
resources: never[];
|
|
2156
2211
|
flags: {};
|
|
2212
|
+
helpNotes: string[];
|
|
2157
2213
|
};
|
|
2158
2214
|
feedback: {
|
|
2159
2215
|
description: string;
|