@uipath/cli 1.205.0-preview.277 → 1.206.0-preview.279
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/dist/{applicationinsights-s28k1t0d.js → applicationinsights-pwe8sf3y.js} +1269 -1269
- package/dist/{browser-strategy-6atc7v8s.js → browser-strategy-p5fhwxqj.js} +6 -7
- package/dist/cli-q6fp9ccp.js +23 -0
- package/dist/contentStore-c51xqdn2.js +41 -0
- package/dist/environmentInfo-fn0za9jw.js +71 -0
- package/dist/feedbackPrompts-t1enxv1x.js +144 -0
- package/dist/handlers-93z27zrr.js +805 -0
- package/dist/index-16d4evd1.js +1051 -0
- package/dist/index-1vyte4ma.js +14 -0
- package/dist/index-21kns9qg.js +10 -0
- package/dist/{index-j2tzs5k6.js → index-2j7ss97f.js} +331 -2595
- package/dist/index-2k8rhmad.js +274 -0
- package/dist/{index-30618bjs.js → index-2mm750yx.js} +174 -234
- package/dist/{index-622x1qb5.js → index-3fvbddpw.js} +7092 -7092
- package/dist/{index-d3w0wn6k.js → index-5gce5wfd.js} +16 -16
- package/dist/index-5j0bfd3e.js +4744 -0
- package/dist/index-68xmrb9x.js +237 -0
- package/dist/index-6wj58qka.js +59 -0
- package/dist/index-898c4tfz.js +668 -0
- package/dist/index-8gr7ny79.js +365 -0
- package/dist/index-99emfvtm.js +13 -0
- package/dist/{index-pj3g8ftz.js → index-9db5vwx9.js} +2429 -1693
- package/dist/index-ayg25v46.js +151 -0
- package/dist/index-bf0e4evz.js +6180 -0
- package/dist/index-bpqx6f8h.js +92 -0
- package/dist/index-bpxh3fqv.js +392 -0
- package/dist/index-cc653qc1.js +1327 -0
- package/dist/{index-m5nwse9v.js → index-cj4v0jct.js} +21 -69
- package/dist/{index-469jgr1w.js → index-dsj3jrm0.js} +105 -106
- package/dist/{index-1yh8g550.js → index-epsr41wx.js} +8 -12
- package/dist/{index-yb4er9vd.js → index-jjejkkg4.js} +474 -528
- package/dist/index-kg1xrq51.js +171 -0
- package/dist/index-m8vqyv3g.js +72 -0
- package/dist/index-mzqm6xfh.js +45 -0
- package/dist/index-nsrrst23.js +44 -0
- package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
- package/dist/index-p9s0gyrw.js +72 -0
- package/dist/index-qadhm1gn.js +271 -0
- package/dist/index-qwbyt2q5.js +95 -0
- package/dist/index-rbna3w6k.js +200 -0
- package/dist/index-rr5hdtcy.js +95 -0
- package/dist/{index-qa9gftnj.js → index-xd2w5pct.js} +3 -3
- package/dist/index-xpdtagqw.js +30 -0
- package/dist/{index-925304r7.js → index-y085rpen.js} +29 -25
- package/dist/index-y5ncb93a.js +240 -0
- package/dist/index-y7d0cth0.js +93 -0
- package/dist/{index-hdxtgckw.js → index-z070caqq.js} +56 -12
- package/dist/index-zdqbp34f.js +14 -0
- package/dist/index.js +38 -36
- package/dist/install-3gw33jcf.js +558 -0
- package/dist/{jmespath-e4a59c8w.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/js-yaml-0c4svjwq.js +36 -0
- package/dist/{mcp-jssaz3wr.js → mcp-s50h6d56.js} +236 -472
- package/dist/{node-strategy-ggx3nmyj.js → node-strategy-p1n8wr5s.js} +16 -19
- package/dist/project-context-285hydnd.js +94 -0
- package/dist/prompt-hxbzt92e.js +13 -0
- package/dist/{server-9k50dfg6.js → server-gkr3c7hv.js} +28 -43
- package/dist/skillCatalog-fvw4wgw1.js +22 -0
- package/dist/skillsService-20es18vs.js +29 -0
- package/dist/{stdio-tmngemcz.js → stdio-kpsab5bz.js} +2 -4
- package/dist/{telemetry-drain-r92f0e4r.js → telemetry-drain-bw59e8f5.js} +8 -9
- package/dist/tree-j4w7p0pg.js +17 -0
- package/dist/updateService-pq7pkd42.js +522 -0
- package/dist/updateService.skills-4t1s7z45.js +22 -0
- package/dist/updateService.tools-f7tr6kc6.js +16 -0
- package/package.json +2 -2
- package/dist/cli-yw4s6t8k.js +0 -19
- package/dist/index-0gctz400.js +0 -17
- package/dist/index-4cq44eth.js +0 -19427
- package/dist/index-7tshyfxx.js +0 -157
- package/dist/index-e3bean3d.js +0 -9867
- package/dist/index-g8ck9tv6.js +0 -2
- package/dist/index-ngs0a2he.js +0 -15
- package/dist/index-yc4kw997.js +0 -13
- package/dist/js-yaml-69tsdrrf.js +0 -37
- package/dist/updateService-22p6d8dm.js +0 -14
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFileSystem2
|
|
3
|
+
} from "./index-z070caqq.js";
|
|
4
|
+
import {
|
|
5
|
+
catchError,
|
|
6
|
+
RESULTS,
|
|
7
|
+
logger,
|
|
8
|
+
OutputFormatter,
|
|
9
|
+
processContext
|
|
10
|
+
} from "./index-9db5vwx9.js";
|
|
11
|
+
import {
|
|
12
|
+
verifiedCommandOnPath,
|
|
13
|
+
homePathExists,
|
|
14
|
+
homeAppDirInstalled
|
|
15
|
+
} from "./index-bpqx6f8h.js";
|
|
16
|
+
|
|
17
|
+
// src/commands/skills/agentNames.ts
|
|
18
|
+
var ALL_AGENTS = [
|
|
19
|
+
"claude",
|
|
20
|
+
"cursor",
|
|
21
|
+
"copilot",
|
|
22
|
+
"codex",
|
|
23
|
+
"opencode",
|
|
24
|
+
"autopilot",
|
|
25
|
+
"kiro",
|
|
26
|
+
"windsurf",
|
|
27
|
+
"antigravity",
|
|
28
|
+
"devin"
|
|
29
|
+
];
|
|
30
|
+
var AGENT_DISPLAY_NAMES = {
|
|
31
|
+
claude: "Claude Code (Plugin)",
|
|
32
|
+
cursor: "Cursor",
|
|
33
|
+
copilot: "GitHub Copilot",
|
|
34
|
+
codex: "Codex",
|
|
35
|
+
opencode: "OpenCode",
|
|
36
|
+
autopilot: "UiPath Autopilot",
|
|
37
|
+
kiro: "Kiro (Amazon Q)",
|
|
38
|
+
windsurf: "Windsurf",
|
|
39
|
+
antigravity: "Antigravity CLI",
|
|
40
|
+
devin: "Devin"
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/commands/skills/agents/antigravity.ts
|
|
44
|
+
var def = {
|
|
45
|
+
localSubdir: [".agents", "skills"],
|
|
46
|
+
globalSubdir: [".gemini", "antigravity-cli", "skills"],
|
|
47
|
+
detect: () => homePathExists(".gemini", "antigravity-cli")
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// src/commands/skills/agents/autopilot.ts
|
|
51
|
+
var def2 = {
|
|
52
|
+
localSubdir: [".autopilot", "skills"],
|
|
53
|
+
extraFolders: ["agents", "hooks"],
|
|
54
|
+
detect: () => homeAppDirInstalled(".autopilot")
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/commands/skills/agents/claude.ts
|
|
58
|
+
import { spawn } from "node:child_process";
|
|
59
|
+
var MARKETPLACE_NAME = "uipath-marketplace";
|
|
60
|
+
var PLUGIN_NAME = "uipath";
|
|
61
|
+
var PLUGIN_REF = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
|
|
62
|
+
var PLUGIN_RESET_INSTRUCTIONS = `Run \`claude plugin marketplace remove ${MARKETPLACE_NAME}\`, then re-run \`uip skills install --agent claude\` — this re-registers the marketplace and reinstalls the plugin from a clean state.`;
|
|
63
|
+
function samePath(a, b) {
|
|
64
|
+
const norm = (p) => {
|
|
65
|
+
const forward = p.replaceAll("\\", "/").replace(/\/+$/, "");
|
|
66
|
+
return process.platform === "win32" ? forward.toLowerCase() : forward;
|
|
67
|
+
};
|
|
68
|
+
return norm(a) === norm(b);
|
|
69
|
+
}
|
|
70
|
+
function claudeConfigDir() {
|
|
71
|
+
const fs = getFileSystem2();
|
|
72
|
+
const override = fs.env.getenv("CLAUDE_CONFIG_DIR");
|
|
73
|
+
return override?.trim() ? override : fs.path.join(fs.env.homedir(), ".claude");
|
|
74
|
+
}
|
|
75
|
+
function quoteForWinShell(arg) {
|
|
76
|
+
return /\s/.test(arg) ? `"${arg}"` : arg;
|
|
77
|
+
}
|
|
78
|
+
function runClaude(args, opts = {}) {
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
const proc = process.platform === "win32" ? spawn(["claude", ...args.map(quoteForWinShell)].join(" "), [], {
|
|
81
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
82
|
+
shell: true
|
|
83
|
+
}) : spawn("claude", [...args], {
|
|
84
|
+
stdio: ["inherit", "pipe", "pipe"]
|
|
85
|
+
});
|
|
86
|
+
let stdout = "";
|
|
87
|
+
let stderr = "";
|
|
88
|
+
proc.stdout?.on("data", (d) => {
|
|
89
|
+
if (opts.captureStdout) {
|
|
90
|
+
stdout += d.toString();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const text = d.toString().trimEnd();
|
|
94
|
+
if (text)
|
|
95
|
+
logger.info(text);
|
|
96
|
+
});
|
|
97
|
+
proc.stderr?.on("data", (d) => {
|
|
98
|
+
stderr += d.toString();
|
|
99
|
+
});
|
|
100
|
+
proc.on("error", (err) => {
|
|
101
|
+
const isMissing = err.code === "ENOENT";
|
|
102
|
+
reject(isMissing ? new Error("claude CLI not found on PATH. Install Claude Code first: https://docs.claude.com/en/docs/claude-code") : err);
|
|
103
|
+
});
|
|
104
|
+
proc.on("close", (code) => {
|
|
105
|
+
if (code === 0) {
|
|
106
|
+
resolve(stdout);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
reject(new Error(stderr.trim() || `claude ${args.join(" ")} failed with exit ${code}`));
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async function removeLegacySkillCopies(storePath, rootDir) {
|
|
114
|
+
const fs = getFileSystem2();
|
|
115
|
+
const { readManifest } = await import("./contentStore-c51xqdn2.js");
|
|
116
|
+
const manifest = await readManifest(storePath);
|
|
117
|
+
const legacyNames = Object.entries(manifest.skills).filter(([, entry]) => entry.agents.includes("claude")).map(([name]) => name);
|
|
118
|
+
if (legacyNames.length === 0)
|
|
119
|
+
return;
|
|
120
|
+
const locations = Array.from(new Set([
|
|
121
|
+
fs.path.join(rootDir, ".claude", "skills"),
|
|
122
|
+
fs.path.join(fs.env.cwd(), ".claude", "skills")
|
|
123
|
+
]));
|
|
124
|
+
for (const dir of locations) {
|
|
125
|
+
for (const name of legacyNames) {
|
|
126
|
+
const target = fs.path.join(dir, name);
|
|
127
|
+
if (!await fs.exists(target))
|
|
128
|
+
continue;
|
|
129
|
+
if (await fs.exists(fs.path.join(target, SKILL_OWNER_MARKER))) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const [rmErr] = await catchError(fs.rm(target));
|
|
133
|
+
if (rmErr) {
|
|
134
|
+
logger.warn(` claude: could not remove legacy skill copy ${target}: ${rmErr.message}`);
|
|
135
|
+
} else {
|
|
136
|
+
logger.info(` claude: removed legacy skill copy ${target}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function isDirectoryMarketplaceRegistered(storePath) {
|
|
142
|
+
const fs = getFileSystem2();
|
|
143
|
+
const registryPath = fs.path.join(claudeConfigDir(), "plugins", "known_marketplaces.json");
|
|
144
|
+
if (!await fs.exists(registryPath))
|
|
145
|
+
return false;
|
|
146
|
+
const [readErr, raw] = await catchError(fs.readFile(registryPath, { encoding: "utf-8" }));
|
|
147
|
+
if (readErr || !raw)
|
|
148
|
+
return false;
|
|
149
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(raw));
|
|
150
|
+
if (parseErr || !parsed)
|
|
151
|
+
return false;
|
|
152
|
+
const source = parsed[MARKETPLACE_NAME]?.source;
|
|
153
|
+
return source?.source === "directory" && !!source.path && samePath(source.path, storePath);
|
|
154
|
+
}
|
|
155
|
+
var FINALIZE_CACHE_ERROR = /Failed to finalize marketplace cache/i;
|
|
156
|
+
function marketplacesCacheDir() {
|
|
157
|
+
const fs = getFileSystem2();
|
|
158
|
+
return fs.path.join(claudeConfigDir(), "plugins", "marketplaces");
|
|
159
|
+
}
|
|
160
|
+
async function removeStaleMarketplaceCache() {
|
|
161
|
+
const fs = getFileSystem2();
|
|
162
|
+
const cacheDir = marketplacesCacheDir();
|
|
163
|
+
const [readErr, entries] = await catchError(fs.readdir(cacheDir));
|
|
164
|
+
if (readErr || !entries)
|
|
165
|
+
return;
|
|
166
|
+
const stale = entries.filter((name) => name === MARKETPLACE_NAME || name.startsWith("temp_"));
|
|
167
|
+
for (const name of stale) {
|
|
168
|
+
const target = fs.path.join(cacheDir, name);
|
|
169
|
+
const [rmErr] = await catchError(fs.rm(target));
|
|
170
|
+
if (rmErr) {
|
|
171
|
+
logger.warn(` claude: could not remove stale marketplace cache ${target}: ${rmErr.message}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function ensureDirectoryMarketplace(storePath) {
|
|
176
|
+
if (await isDirectoryMarketplaceRegistered(storePath))
|
|
177
|
+
return;
|
|
178
|
+
const addArgs = ["plugin", "marketplace", "add", storePath];
|
|
179
|
+
const [addErr] = await catchError(runClaude(addArgs));
|
|
180
|
+
if (!addErr)
|
|
181
|
+
return;
|
|
182
|
+
if (!FINALIZE_CACHE_ERROR.test(addErr.message))
|
|
183
|
+
throw addErr;
|
|
184
|
+
logger.warn(" claude: marketplace add hit a stale cache — clearing it and retrying once");
|
|
185
|
+
await removeStaleMarketplaceCache();
|
|
186
|
+
const [retryErr] = await catchError(runClaude(addArgs));
|
|
187
|
+
if (!retryErr)
|
|
188
|
+
return;
|
|
189
|
+
throw Object.assign(retryErr, {
|
|
190
|
+
instructions: `Close all running Claude Code sessions, delete ${getFileSystem2().path.join(marketplacesCacheDir(), MARKETPLACE_NAME)} if it still exists, then re-run this command. If it keeps failing, an antivirus or another process is locking the directory.`
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
async function readStorePluginVersion(storePath) {
|
|
194
|
+
const fs = getFileSystem2();
|
|
195
|
+
const pluginJsonPath = fs.path.join(storePath, ".claude-plugin", "plugin.json");
|
|
196
|
+
const [readErr, raw] = await catchError(fs.readFile(pluginJsonPath, { encoding: "utf-8" }));
|
|
197
|
+
if (readErr || !raw) {
|
|
198
|
+
logger.warn(` claude: could not read ${pluginJsonPath} to verify the plugin version — skipping the version check`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(raw));
|
|
202
|
+
if (parseErr || typeof parsed?.version !== "string" || !parsed.version) {
|
|
203
|
+
logger.warn(` claude: ${pluginJsonPath} carries no readable version — skipping the version check`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
return parsed.version;
|
|
207
|
+
}
|
|
208
|
+
async function verifyPluginLoaded(op, storePath) {
|
|
209
|
+
const [listErr, raw] = await catchError(runClaude(["plugin", "list", "--json"], { captureStdout: true }));
|
|
210
|
+
if (listErr) {
|
|
211
|
+
logger.warn(` claude: could not verify plugin load state (\`claude plugin list --json\` failed): ${listErr.message}`);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const start = raw.indexOf("[");
|
|
215
|
+
const end = raw.lastIndexOf("]");
|
|
216
|
+
const jsonText = start !== -1 && end > start ? raw.slice(start, end + 1) : raw;
|
|
217
|
+
const [parseErr, plugins] = catchError(() => JSON.parse(jsonText));
|
|
218
|
+
if (parseErr || !Array.isArray(plugins)) {
|
|
219
|
+
const snippet = raw.trim().replace(/\s+/g, " ").slice(0, 200);
|
|
220
|
+
logger.warn(` claude: could not verify plugin load state (unexpected \`claude plugin list --json\` output${snippet ? `: ${snippet}` : ""})`);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const entry = plugins.find((p) => p?.id === PLUGIN_REF);
|
|
224
|
+
if (!entry) {
|
|
225
|
+
throw Object.assign(new Error(`claude reports plugin ${PLUGIN_REF} is not installed even though \`claude plugin ${op}\` succeeded`), { instructions: PLUGIN_RESET_INSTRUCTIONS });
|
|
226
|
+
}
|
|
227
|
+
const rawErrors = entry.errors;
|
|
228
|
+
let errors = [];
|
|
229
|
+
if (Array.isArray(rawErrors)) {
|
|
230
|
+
errors = rawErrors;
|
|
231
|
+
} else if (rawErrors) {
|
|
232
|
+
errors = [JSON.stringify(rawErrors)];
|
|
233
|
+
}
|
|
234
|
+
if (errors.length > 0) {
|
|
235
|
+
throw Object.assign(new Error(`plugin ${PLUGIN_REF} is installed but Claude Code reports it failed to load: ${errors.join("; ")}`), { instructions: PLUGIN_RESET_INSTRUCTIONS });
|
|
236
|
+
}
|
|
237
|
+
const installedVersion = typeof entry.version === "string" && entry.version ? entry.version : undefined;
|
|
238
|
+
if (!installedVersion)
|
|
239
|
+
return;
|
|
240
|
+
const storeVersion = await readStorePluginVersion(storePath);
|
|
241
|
+
if (!storeVersion)
|
|
242
|
+
return;
|
|
243
|
+
if (installedVersion !== storeVersion) {
|
|
244
|
+
throw Object.assign(new Error(`plugin ${PLUGIN_REF} is installed at version ${installedVersion}, but the content store ships ${storeVersion} — a stale plugin cache is shadowing the refreshed skills`), { instructions: PLUGIN_RESET_INSTRUCTIONS });
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
async function resetPlugin(storePath) {
|
|
248
|
+
const [removeErr] = await catchError(runClaude(["plugin", "marketplace", "remove", MARKETPLACE_NAME]));
|
|
249
|
+
if (removeErr) {
|
|
250
|
+
logger.debug(` claude: marketplace remove (tolerated): ${removeErr.message}`);
|
|
251
|
+
}
|
|
252
|
+
await removeStaleMarketplaceCache();
|
|
253
|
+
await ensureDirectoryMarketplace(storePath);
|
|
254
|
+
await runClaude(["plugin", "install", PLUGIN_REF]);
|
|
255
|
+
}
|
|
256
|
+
async function runWithVerify(op, storePath, force, sequence) {
|
|
257
|
+
if (force) {
|
|
258
|
+
logger.info(" claude: --force — reinstalling the plugin from a clean state");
|
|
259
|
+
await runReset(storePath);
|
|
260
|
+
} else {
|
|
261
|
+
await sequence();
|
|
262
|
+
}
|
|
263
|
+
const [verifyErr] = await catchError(verifyPluginLoaded(op, storePath));
|
|
264
|
+
if (!verifyErr)
|
|
265
|
+
return;
|
|
266
|
+
if (force) {
|
|
267
|
+
throw withCloseSessionsHint(verifyErr);
|
|
268
|
+
}
|
|
269
|
+
logger.warn(` claude: ${verifyErr.message} — resetting the marketplace and reinstalling`);
|
|
270
|
+
await runReset(storePath);
|
|
271
|
+
const [retryErr] = await catchError(verifyPluginLoaded(op, storePath));
|
|
272
|
+
if (retryErr) {
|
|
273
|
+
throw withCloseSessionsHint(retryErr);
|
|
274
|
+
}
|
|
275
|
+
logger.info(" claude: plugin state repaired");
|
|
276
|
+
}
|
|
277
|
+
async function runReset(storePath) {
|
|
278
|
+
const [resetErr] = await catchError(resetPlugin(storePath));
|
|
279
|
+
if (!resetErr)
|
|
280
|
+
return;
|
|
281
|
+
if (resetErr.instructions)
|
|
282
|
+
throw resetErr;
|
|
283
|
+
throw withCloseSessionsHint(resetErr);
|
|
284
|
+
}
|
|
285
|
+
function withCloseSessionsHint(err) {
|
|
286
|
+
return Object.assign(err, {
|
|
287
|
+
instructions: `Close all running Claude Code sessions (a live session can hold the plugin cache), then re-run this command. If it keeps failing: ${PLUGIN_RESET_INSTRUCTIONS}`
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
var def3 = {
|
|
291
|
+
localSubdir: [".claude", "skills"],
|
|
292
|
+
globalOnly: true,
|
|
293
|
+
destinationHint: () => "installed via `claude plugin install`",
|
|
294
|
+
detect: () => verifiedCommandOnPath(["claude"], /Claude Code/i),
|
|
295
|
+
install: async ({ storePath, rootDir, force }) => {
|
|
296
|
+
await removeLegacySkillCopies(storePath, rootDir);
|
|
297
|
+
await runWithVerify("install", storePath, force, async () => {
|
|
298
|
+
await ensureDirectoryMarketplace(storePath);
|
|
299
|
+
await runClaude(["plugin", "install", PLUGIN_REF]);
|
|
300
|
+
});
|
|
301
|
+
logger.info(` claude: installed plugin ${PLUGIN_REF}`);
|
|
302
|
+
},
|
|
303
|
+
update: async ({ storePath, rootDir, force }) => {
|
|
304
|
+
await removeLegacySkillCopies(storePath, rootDir);
|
|
305
|
+
await runWithVerify("update", storePath, force, async () => {
|
|
306
|
+
await ensureDirectoryMarketplace(storePath);
|
|
307
|
+
await runClaude([
|
|
308
|
+
"plugin",
|
|
309
|
+
"marketplace",
|
|
310
|
+
"update",
|
|
311
|
+
MARKETPLACE_NAME
|
|
312
|
+
]);
|
|
313
|
+
await runClaude(["plugin", "update", PLUGIN_REF]);
|
|
314
|
+
});
|
|
315
|
+
logger.info(` claude: updated plugin ${PLUGIN_REF}`);
|
|
316
|
+
},
|
|
317
|
+
uninstall: async ({ storePath, rootDir }) => {
|
|
318
|
+
await removeLegacySkillCopies(storePath, rootDir);
|
|
319
|
+
await runClaude(["plugin", "uninstall", PLUGIN_REF]);
|
|
320
|
+
logger.info(` claude: uninstalled plugin ${PLUGIN_REF}`);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// src/commands/skills/agents/codex.ts
|
|
325
|
+
var def4 = {
|
|
326
|
+
localSubdir: [".agents", "skills"],
|
|
327
|
+
detect: () => verifiedCommandOnPath(["codex"], /codex[- ]?cli/i)
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// src/commands/skills/agents/copilot.ts
|
|
331
|
+
var def5 = {
|
|
332
|
+
localSubdir: [".github", "skills"],
|
|
333
|
+
globalSubdir: [".copilot", "skills"],
|
|
334
|
+
detect: () => verifiedCommandOnPath(["copilot"], /GitHub Copilot/i)
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// src/commands/skills/agents/cursor.ts
|
|
338
|
+
var def6 = {
|
|
339
|
+
localSubdir: [".cursor", "skills"],
|
|
340
|
+
detect: () => verifiedCommandOnPath(["cursor-agent", "agent"], /cursor/i, ["--help"])
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
// src/commands/skills/agents/devin.ts
|
|
344
|
+
var def7 = {
|
|
345
|
+
localSubdir: [".agents", "skills"],
|
|
346
|
+
detect: () => homeAppDirInstalled(".devin")
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
// src/commands/skills/agents/kiro.ts
|
|
350
|
+
var def8 = {
|
|
351
|
+
localSubdir: [".kiro", "skills"],
|
|
352
|
+
detect: () => homeAppDirInstalled(".kiro")
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
// src/commands/skills/agents/opencode.ts
|
|
356
|
+
var def9 = {
|
|
357
|
+
localSubdir: [".opencode", "skills"],
|
|
358
|
+
globalSubdir: [".config", "opencode", "skills"],
|
|
359
|
+
commandsFolder: "commands",
|
|
360
|
+
detect: () => verifiedCommandOnPath(["opencode"], /opencode/i, ["--help"])
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// src/commands/skills/agents/windsurf.ts
|
|
364
|
+
var def10 = {
|
|
365
|
+
localSubdir: [".windsurf", "skills"],
|
|
366
|
+
detect: () => homeAppDirInstalled(".windsurf")
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// src/commands/skills/agents/index.ts
|
|
370
|
+
var AGENT_DEFS = {
|
|
371
|
+
claude: def3,
|
|
372
|
+
cursor: def6,
|
|
373
|
+
copilot: def5,
|
|
374
|
+
codex: def4,
|
|
375
|
+
opencode: def9,
|
|
376
|
+
autopilot: def2,
|
|
377
|
+
kiro: def8,
|
|
378
|
+
windsurf: def10,
|
|
379
|
+
antigravity: def,
|
|
380
|
+
devin: def7
|
|
381
|
+
};
|
|
382
|
+
function subdirFor(agent, isLocal) {
|
|
383
|
+
const def = AGENT_DEFS[agent];
|
|
384
|
+
return isLocal ? def.localSubdir : def.globalSubdir ?? def.localSubdir;
|
|
385
|
+
}
|
|
386
|
+
function getSkillsDir(agent, rootDir, isLocal) {
|
|
387
|
+
const fs = getFileSystem2();
|
|
388
|
+
return fs.path.join(rootDir, ...subdirFor(agent, isLocal));
|
|
389
|
+
}
|
|
390
|
+
function getSkillsDestinationHint(agent, isLocal) {
|
|
391
|
+
const override = AGENT_DEFS[agent].destinationHint;
|
|
392
|
+
if (override)
|
|
393
|
+
return override(isLocal);
|
|
394
|
+
const path = subdirFor(agent, isLocal).join("/");
|
|
395
|
+
return isLocal ? `${path}/<skill>/` : `~/${path}/<skill>/`;
|
|
396
|
+
}
|
|
397
|
+
function hasDistinctGlobalPath(agent) {
|
|
398
|
+
return AGENT_DEFS[agent].globalSubdir !== undefined;
|
|
399
|
+
}
|
|
400
|
+
var SKILL_OWNER_MARKER = ".uipath-skill-source.json";
|
|
401
|
+
function skillOwnerOf(source) {
|
|
402
|
+
return { id: source.storeName, isDefault: source.isDefault };
|
|
403
|
+
}
|
|
404
|
+
async function readSkillOwnerId(fs, skillDir) {
|
|
405
|
+
const [, content] = await catchError(fs.readFile(fs.path.join(skillDir, SKILL_OWNER_MARKER), {
|
|
406
|
+
encoding: "utf-8"
|
|
407
|
+
}));
|
|
408
|
+
if (!content)
|
|
409
|
+
return null;
|
|
410
|
+
const [, parsed] = catchError(() => JSON.parse(content));
|
|
411
|
+
return typeof parsed?.source === "string" ? parsed.source : null;
|
|
412
|
+
}
|
|
413
|
+
function ownerIdentity(storeName) {
|
|
414
|
+
return /-([0-9a-f]{10})$/.exec(storeName)?.[1] ?? storeName;
|
|
415
|
+
}
|
|
416
|
+
async function isOwnedBy(fs, skillDir, owner) {
|
|
417
|
+
const id = await readSkillOwnerId(fs, skillDir);
|
|
418
|
+
return id === null ? owner.isDefault : ownerIdentity(id) === ownerIdentity(owner.id);
|
|
419
|
+
}
|
|
420
|
+
async function installSkill(agent, skill, skillsDir, owner) {
|
|
421
|
+
const fs = getFileSystem2();
|
|
422
|
+
const target = fs.path.join(skillsDir, skill.name);
|
|
423
|
+
if (await fs.exists(target)) {
|
|
424
|
+
if (!await isOwnedBy(fs, target, owner)) {
|
|
425
|
+
const conflictOwner = await readSkillOwnerId(fs, target) ?? "uipath";
|
|
426
|
+
logger.info(` ${agent}: skipped ${skill.name} (already installed from ${conflictOwner})`);
|
|
427
|
+
return { installed: false, conflictOwner };
|
|
428
|
+
}
|
|
429
|
+
await fs.rm(target);
|
|
430
|
+
}
|
|
431
|
+
await fs.mkdir(target);
|
|
432
|
+
await fs.copyDirectory(skill.skillDir, target);
|
|
433
|
+
await fs.writeFile(fs.path.join(target, SKILL_OWNER_MARKER), `${JSON.stringify({ source: owner.id, installedAt: new Date().toISOString() }, null, 2)}
|
|
434
|
+
`);
|
|
435
|
+
logger.info(` ${agent}: installed ${skill.name}`);
|
|
436
|
+
return { installed: true };
|
|
437
|
+
}
|
|
438
|
+
async function listFilesRelative(fs, dir) {
|
|
439
|
+
const out = [];
|
|
440
|
+
const walk = async (rel) => {
|
|
441
|
+
const abs = rel ? fs.path.join(dir, ...rel.split("/")) : dir;
|
|
442
|
+
const [, entries] = await catchError(fs.readdir(abs));
|
|
443
|
+
for (const name of entries ?? []) {
|
|
444
|
+
const childRel = rel ? `${rel}/${name}` : name;
|
|
445
|
+
const stats = await fs.stat(fs.path.join(dir, ...childRel.split("/")));
|
|
446
|
+
if (stats?.isDirectory()) {
|
|
447
|
+
await walk(childRel);
|
|
448
|
+
} else if (stats?.isFile()) {
|
|
449
|
+
out.push(childRel);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
await walk("");
|
|
454
|
+
return out;
|
|
455
|
+
}
|
|
456
|
+
async function isSymlink(fs, path) {
|
|
457
|
+
const [, real] = await catchError(fs.realpath(path));
|
|
458
|
+
const [, realParent] = await catchError(fs.realpath(fs.path.dirname(path)));
|
|
459
|
+
if (!real || !realParent)
|
|
460
|
+
return false;
|
|
461
|
+
return real !== fs.path.join(realParent, fs.path.basename(path));
|
|
462
|
+
}
|
|
463
|
+
async function entryPresent(fs, target) {
|
|
464
|
+
if (await fs.exists(target))
|
|
465
|
+
return true;
|
|
466
|
+
const [, names] = await catchError(fs.readdir(fs.path.dirname(target)));
|
|
467
|
+
return (names ?? []).includes(fs.path.basename(target));
|
|
468
|
+
}
|
|
469
|
+
async function mayOverwriteOwned(fs, agentRoot, rel, target, owned) {
|
|
470
|
+
if (!owned.has(rel))
|
|
471
|
+
return false;
|
|
472
|
+
if (!await fs.exists(target))
|
|
473
|
+
return false;
|
|
474
|
+
return await resolveOwnedPath(fs, agentRoot, rel) !== null;
|
|
475
|
+
}
|
|
476
|
+
async function removeEmptyDirs(fs, dir) {
|
|
477
|
+
const stats = await fs.stat(dir);
|
|
478
|
+
if (!stats?.isDirectory())
|
|
479
|
+
return;
|
|
480
|
+
if (await isSymlink(fs, dir))
|
|
481
|
+
return;
|
|
482
|
+
for (const name of await fs.readdir(dir)) {
|
|
483
|
+
const child = fs.path.join(dir, name);
|
|
484
|
+
const childStats = await fs.stat(child);
|
|
485
|
+
if (childStats?.isDirectory())
|
|
486
|
+
await removeEmptyDirs(fs, child);
|
|
487
|
+
}
|
|
488
|
+
if ((await fs.readdir(dir)).length === 0)
|
|
489
|
+
await fs.rm(dir);
|
|
490
|
+
}
|
|
491
|
+
function isSafeOwnedRel(rel) {
|
|
492
|
+
const segments = rel.split("/");
|
|
493
|
+
return segments.length >= 2 && segments.every((seg) => seg !== "" && seg !== "." && seg !== ".." && !seg.includes("\\") && !seg.includes(":"));
|
|
494
|
+
}
|
|
495
|
+
async function resolveOwnedPath(fs, agentRoot, rel) {
|
|
496
|
+
if (!isSafeOwnedRel(rel)) {
|
|
497
|
+
logger.debug(`Ignoring unsafe owned path in manifest: ${rel}`);
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
const segments = rel.split("/");
|
|
501
|
+
const target = fs.path.join(agentRoot, ...segments);
|
|
502
|
+
const [, realFolder] = await catchError(fs.realpath(fs.path.join(agentRoot, segments[0])));
|
|
503
|
+
const [, realParent] = await catchError(fs.realpath(fs.path.dirname(target)));
|
|
504
|
+
if (!realFolder || !realParent)
|
|
505
|
+
return null;
|
|
506
|
+
const fromFolder = fs.path.relative(realFolder, realParent);
|
|
507
|
+
if (fromFolder.split(/[\\/]/)[0] === ".." || fs.path.isAbsolute(fromFolder)) {
|
|
508
|
+
logger.debug(`Ignoring owned path that leaves its folder: ${rel}`);
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
511
|
+
if (await isSymlink(fs, target)) {
|
|
512
|
+
logger.debug(`Ignoring owned path that is now a symlink: ${rel}`);
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
const stats = await fs.stat(target);
|
|
516
|
+
if (!stats?.isFile()) {
|
|
517
|
+
logger.debug(`Ignoring owned path that is no longer a file: ${rel}`);
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
return target;
|
|
521
|
+
}
|
|
522
|
+
async function installExtraFolders(agent, storePath, skillsDir, owned = []) {
|
|
523
|
+
const extraFolders = AGENT_DEFS[agent].extraFolders ?? [];
|
|
524
|
+
if (extraFolders.length === 0)
|
|
525
|
+
return [];
|
|
526
|
+
const fs = getFileSystem2();
|
|
527
|
+
const agentRoot = fs.path.dirname(skillsDir);
|
|
528
|
+
const ownedSet = new Set(owned);
|
|
529
|
+
const copied = [];
|
|
530
|
+
const kept = new Set;
|
|
531
|
+
for (const folder of extraFolders) {
|
|
532
|
+
const source = fs.path.join(storePath, folder);
|
|
533
|
+
if (!await fs.exists(source))
|
|
534
|
+
continue;
|
|
535
|
+
for (const rel of await listFilesRelative(fs, source)) {
|
|
536
|
+
const relFromRoot = `${folder}/${rel}`;
|
|
537
|
+
const target = fs.path.join(agentRoot, folder, ...rel.split("/"));
|
|
538
|
+
if (await entryPresent(fs, target) && !await mayOverwriteOwned(fs, agentRoot, relFromRoot, target, ownedSet)) {
|
|
539
|
+
logger.info(` ${agent}: kept existing ${relFromRoot} (not overwritten)`);
|
|
540
|
+
kept.add(relFromRoot);
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
const data = await fs.readFile(fs.path.join(source, ...rel.split("/")));
|
|
544
|
+
if (data === null)
|
|
545
|
+
continue;
|
|
546
|
+
await fs.writeFile(target, data);
|
|
547
|
+
copied.push(relFromRoot);
|
|
548
|
+
}
|
|
549
|
+
logger.info(` ${agent}: installed ${folder}/`);
|
|
550
|
+
}
|
|
551
|
+
const copiedSet = new Set(copied);
|
|
552
|
+
for (const stale of ownedSet) {
|
|
553
|
+
if (copiedSet.has(stale) || kept.has(stale))
|
|
554
|
+
continue;
|
|
555
|
+
const target = await resolveOwnedPath(fs, agentRoot, stale);
|
|
556
|
+
if (target && await fs.exists(target))
|
|
557
|
+
await fs.rm(target);
|
|
558
|
+
}
|
|
559
|
+
for (const folder of extraFolders) {
|
|
560
|
+
await removeEmptyDirs(fs, fs.path.join(agentRoot, folder));
|
|
561
|
+
}
|
|
562
|
+
return copied;
|
|
563
|
+
}
|
|
564
|
+
function isCommandFile(agent, rel) {
|
|
565
|
+
const folder = AGENT_DEFS[agent].commandsFolder;
|
|
566
|
+
return folder !== undefined && rel.startsWith(`${folder}/`);
|
|
567
|
+
}
|
|
568
|
+
var SAFE_COMMAND_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
569
|
+
function renderSkillCommand(skill) {
|
|
570
|
+
const description = skill.description ?? `Run the ${skill.name} skill.`;
|
|
571
|
+
return [
|
|
572
|
+
"---",
|
|
573
|
+
`description: ${JSON.stringify(description)}`,
|
|
574
|
+
"---",
|
|
575
|
+
"",
|
|
576
|
+
`Load the \`${skill.name}\` skill with the skill tool, then follow its instructions.`,
|
|
577
|
+
"",
|
|
578
|
+
"$ARGUMENTS",
|
|
579
|
+
""
|
|
580
|
+
].join(`
|
|
581
|
+
`);
|
|
582
|
+
}
|
|
583
|
+
async function installSkillCommands(agent, skills, skillsDir, owned = []) {
|
|
584
|
+
const folder = AGENT_DEFS[agent].commandsFolder;
|
|
585
|
+
if (folder === undefined)
|
|
586
|
+
return [];
|
|
587
|
+
const fs = getFileSystem2();
|
|
588
|
+
const agentRoot = fs.path.dirname(skillsDir);
|
|
589
|
+
const ownedSet = new Set(owned);
|
|
590
|
+
const written = [];
|
|
591
|
+
const kept = new Set;
|
|
592
|
+
for (const skill of skills) {
|
|
593
|
+
if (!skill.userInvocable)
|
|
594
|
+
continue;
|
|
595
|
+
if (!SAFE_COMMAND_NAME.test(skill.name)) {
|
|
596
|
+
logger.info(` ${agent}: no slash command for ${skill.name} (unsupported characters in name)`);
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
const rel = `${folder}/${skill.name}.md`;
|
|
600
|
+
const target = fs.path.join(agentRoot, folder, `${skill.name}.md`);
|
|
601
|
+
if (await entryPresent(fs, target) && !await mayOverwriteOwned(fs, agentRoot, rel, target, ownedSet)) {
|
|
602
|
+
logger.info(` ${agent}: kept existing ${rel} (not overwritten)`);
|
|
603
|
+
kept.add(rel);
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
await fs.writeFile(target, renderSkillCommand(skill));
|
|
607
|
+
written.push(rel);
|
|
608
|
+
}
|
|
609
|
+
if (written.length > 0) {
|
|
610
|
+
logger.info(` ${agent}: installed ${folder}/`);
|
|
611
|
+
}
|
|
612
|
+
const writtenSet = new Set(written);
|
|
613
|
+
for (const stale of ownedSet) {
|
|
614
|
+
if (writtenSet.has(stale) || kept.has(stale))
|
|
615
|
+
continue;
|
|
616
|
+
const target = await resolveOwnedPath(fs, agentRoot, stale);
|
|
617
|
+
if (target && await fs.exists(target))
|
|
618
|
+
await fs.rm(target);
|
|
619
|
+
}
|
|
620
|
+
if (ownedSet.size > 0) {
|
|
621
|
+
await removeEmptyDirs(fs, fs.path.join(agentRoot, folder));
|
|
622
|
+
}
|
|
623
|
+
return written;
|
|
624
|
+
}
|
|
625
|
+
async function uninstallExtraFolders(skillsDir, owned) {
|
|
626
|
+
if (owned.length === 0)
|
|
627
|
+
return;
|
|
628
|
+
const fs = getFileSystem2();
|
|
629
|
+
const agentRoot = fs.path.dirname(skillsDir);
|
|
630
|
+
const topFolders = new Set;
|
|
631
|
+
for (const rel of owned) {
|
|
632
|
+
if (!isSafeOwnedRel(rel))
|
|
633
|
+
continue;
|
|
634
|
+
topFolders.add(rel.split("/")[0]);
|
|
635
|
+
const target = await resolveOwnedPath(fs, agentRoot, rel);
|
|
636
|
+
if (target && await fs.exists(target))
|
|
637
|
+
await fs.rm(target);
|
|
638
|
+
}
|
|
639
|
+
for (const folder of topFolders) {
|
|
640
|
+
await removeEmptyDirs(fs, fs.path.join(agentRoot, folder));
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
async function uninstallSkill(skillName, skillsDir, owner) {
|
|
644
|
+
const fs = getFileSystem2();
|
|
645
|
+
const target = fs.path.join(skillsDir, skillName);
|
|
646
|
+
if (!await fs.exists(target))
|
|
647
|
+
return false;
|
|
648
|
+
if (!await isOwnedBy(fs, target, owner))
|
|
649
|
+
return false;
|
|
650
|
+
await fs.rm(target);
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
function rejectIfGlobalOnly(agent, isLocal, operation, isDefaultSource = true) {
|
|
654
|
+
if (!isLocal || !isDefaultSource || !AGENT_DEFS[agent].globalOnly) {
|
|
655
|
+
return false;
|
|
656
|
+
}
|
|
657
|
+
OutputFormatter.error({
|
|
658
|
+
Result: RESULTS.ValidationError,
|
|
659
|
+
Message: `${agent} does not support --local installs.`,
|
|
660
|
+
Instructions: `Re-run 'uip skills ${operation} --agent ${agent}' without --local.`
|
|
661
|
+
});
|
|
662
|
+
processContext.exit(1);
|
|
663
|
+
return true;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export { ALL_AGENTS, AGENT_DISPLAY_NAMES, AGENT_DEFS, getSkillsDir, getSkillsDestinationHint, hasDistinctGlobalPath, skillOwnerOf, installSkill, installExtraFolders, isCommandFile, installSkillCommands, uninstallExtraFolders, uninstallSkill, rejectIfGlobalOnly };
|
|
667
|
+
|
|
668
|
+
//# debugId=76FC43F63397017864756E2164756E21
|