@camunda8/cli 4.7.0-alpha.20 → 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/README.md +0 -3
- package/dist/command-dispatch.d.ts.map +1 -1
- package/dist/command-dispatch.js +0 -8
- package/dist/command-dispatch.js.map +1 -1
- package/dist/commands/run.d.ts +0 -5
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +1 -9
- package/dist/commands/run.js.map +1 -1
- 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/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 +0 -76
- package/dist/framework/command-registry.d.ts.map +1 -1
- package/dist/framework/command-registry.js +0 -161
- 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 +26 -13
- package/dist/framework/ui/help.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 +17 -0
- package/dist/utils/command-local/mcp-install-helpers.d.ts.map +1 -1
- package/dist/utils/command-local/mcp-install-helpers.js +23 -9
- package/dist/utils/command-local/mcp-install-helpers.js.map +1 -1
- 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/index.d.ts +0 -6
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -6
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/modeler.d.ts +0 -10
- package/dist/commands/modeler.d.ts.map +0 -1
- package/dist/commands/modeler.js +0 -604
- package/dist/commands/modeler.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -39
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -856
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/skills.d.ts +0 -2
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js +0 -38
- package/dist/commands/skills.js.map +0 -1
- package/dist/utils/command-local/blueprint-scaffold.d.ts +0 -151
- package/dist/utils/command-local/blueprint-scaffold.d.ts.map +0 -1
- package/dist/utils/command-local/blueprint-scaffold.js +0 -547
- package/dist/utils/command-local/blueprint-scaffold.js.map +0 -1
- package/dist/utils/command-local/modeler-helpers.d.ts +0 -15
- package/dist/utils/command-local/modeler-helpers.d.ts.map +0 -1
- package/dist/utils/command-local/modeler-helpers.js +0 -67
- package/dist/utils/command-local/modeler-helpers.js.map +0 -1
- package/dist/utils/command-local/setup-detectors.d.ts +0 -51
- package/dist/utils/command-local/setup-detectors.d.ts.map +0 -1
- package/dist/utils/command-local/setup-detectors.js +0 -115
- package/dist/utils/command-local/setup-detectors.js.map +0 -1
- package/dist/utils/command-local/setup-helpers.d.ts +0 -179
- package/dist/utils/command-local/setup-helpers.d.ts.map +0 -1
- package/dist/utils/command-local/setup-helpers.js +0 -374
- package/dist/utils/command-local/setup-helpers.js.map +0 -1
- package/dist/utils/command-local/setup-prerequisites.d.ts +0 -67
- package/dist/utils/command-local/setup-prerequisites.d.ts.map +0 -1
- package/dist/utils/command-local/setup-prerequisites.js +0 -238
- package/dist/utils/command-local/setup-prerequisites.js.map +0 -1
- package/dist/utils/command-local/setup-removal.d.ts +0 -37
- package/dist/utils/command-local/setup-removal.d.ts.map +0 -1
- package/dist/utils/command-local/setup-removal.js +0 -82
- package/dist/utils/command-local/setup-removal.js.map +0 -1
|
@@ -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
|
+
};
|
|
@@ -1339,21 +1339,6 @@ export declare const COMMAND_REGISTRY: {
|
|
|
1339
1339
|
}];
|
|
1340
1340
|
};
|
|
1341
1341
|
};
|
|
1342
|
-
modeler: {
|
|
1343
|
-
description: string;
|
|
1344
|
-
helpDescription: string;
|
|
1345
|
-
helpResource: string;
|
|
1346
|
-
hasDetailedHelp: true;
|
|
1347
|
-
helpFooterLabel: string;
|
|
1348
|
-
mutating: true;
|
|
1349
|
-
requiresResource: true;
|
|
1350
|
-
helpExamples: {
|
|
1351
|
-
command: string;
|
|
1352
|
-
description: string;
|
|
1353
|
-
}[];
|
|
1354
|
-
resources: string[];
|
|
1355
|
-
flags: {};
|
|
1356
|
-
};
|
|
1357
1342
|
modify: {
|
|
1358
1343
|
description: string;
|
|
1359
1344
|
helpDescription: string;
|
|
@@ -1852,43 +1837,6 @@ export declare const COMMAND_REGISTRY: {
|
|
|
1852
1837
|
}];
|
|
1853
1838
|
};
|
|
1854
1839
|
};
|
|
1855
|
-
setup: {
|
|
1856
|
-
description: string;
|
|
1857
|
-
helpDescription: string;
|
|
1858
|
-
hasDetailedHelp: true;
|
|
1859
|
-
helpFooterLabel: string;
|
|
1860
|
-
mutating: true;
|
|
1861
|
-
requiresResource: false;
|
|
1862
|
-
helpExamples: {
|
|
1863
|
-
command: string;
|
|
1864
|
-
description: string;
|
|
1865
|
-
}[];
|
|
1866
|
-
helpNotes: string[];
|
|
1867
|
-
docsNotes: string[];
|
|
1868
|
-
resources: never[];
|
|
1869
|
-
flags: {
|
|
1870
|
-
modeler: {
|
|
1871
|
-
type: "boolean";
|
|
1872
|
-
description: string;
|
|
1873
|
-
};
|
|
1874
|
-
"no-modeler": {
|
|
1875
|
-
type: "boolean";
|
|
1876
|
-
description: string;
|
|
1877
|
-
};
|
|
1878
|
-
"docs-mcp": {
|
|
1879
|
-
type: "boolean";
|
|
1880
|
-
description: string;
|
|
1881
|
-
};
|
|
1882
|
-
remove: {
|
|
1883
|
-
type: "boolean";
|
|
1884
|
-
description: string;
|
|
1885
|
-
};
|
|
1886
|
-
"stop-cluster": {
|
|
1887
|
-
type: "boolean";
|
|
1888
|
-
description: string;
|
|
1889
|
-
};
|
|
1890
|
-
};
|
|
1891
|
-
};
|
|
1892
1840
|
watch: {
|
|
1893
1841
|
description: string;
|
|
1894
1842
|
helpDescription: string;
|
|
@@ -2037,30 +1985,6 @@ export declare const COMMAND_REGISTRY: {
|
|
|
2037
1985
|
}];
|
|
2038
1986
|
};
|
|
2039
1987
|
};
|
|
2040
|
-
skills: {
|
|
2041
|
-
description: string;
|
|
2042
|
-
helpDescription: string;
|
|
2043
|
-
helpFooterLabel: string;
|
|
2044
|
-
helpNotes: string[];
|
|
2045
|
-
hasDetailedHelp: true;
|
|
2046
|
-
helpExamples: {
|
|
2047
|
-
command: string;
|
|
2048
|
-
description: string;
|
|
2049
|
-
}[];
|
|
2050
|
-
mutating: true;
|
|
2051
|
-
requiresResource: true;
|
|
2052
|
-
resources: string[];
|
|
2053
|
-
flags: {};
|
|
2054
|
-
resourceFlags: {
|
|
2055
|
-
install: {
|
|
2056
|
-
harness: {
|
|
2057
|
-
type: "string";
|
|
2058
|
-
rejectEmpty: true;
|
|
2059
|
-
description: string;
|
|
2060
|
-
};
|
|
2061
|
-
};
|
|
2062
|
-
};
|
|
2063
|
-
};
|
|
2064
1988
|
load: {
|
|
2065
1989
|
description: string;
|
|
2066
1990
|
helpResource: string;
|