@rbbtsn0w/adg 0.5.0-beta.1 → 0.5.0-beta.3
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/bin/adg.js +1 -0
- package/dist/src/adapters/antigravity-hooks.js +24 -9
- package/dist/vendor/skills/src/add.js +205 -36
- package/dist/vendor/skills/src/agents.js +49 -1
- package/dist/vendor/skills/src/blob.js +20 -2
- package/dist/vendor/skills/src/cli.js +6 -2
- package/dist/vendor/skills/src/find.js +62 -12
- package/dist/vendor/skills/src/install.js +1 -1
- package/dist/vendor/skills/src/installer.js +173 -30
- package/dist/vendor/skills/src/remove.js +12 -2
- package/dist/vendor/skills/src/telemetry.js +25 -14
- package/dist/vendor/skills/src/update.js +10 -5
- package/package.json +1 -1
- package/vendor/skills/PROVENANCE.md +25 -3
- package/vendor/skills/package.json +2 -1
- package/vendor/skills/src/add.ts +252 -38
- package/vendor/skills/src/agents.ts +57 -1
- package/vendor/skills/src/blob.ts +23 -2
- package/vendor/skills/src/cli.ts +6 -2
- package/vendor/skills/src/find.ts +74 -12
- package/vendor/skills/src/install.ts +1 -1
- package/vendor/skills/src/installer.ts +247 -37
- package/vendor/skills/src/local-lock.ts +7 -0
- package/vendor/skills/src/remove.ts +12 -1
- package/vendor/skills/src/telemetry.ts +76 -25
- package/vendor/skills/src/types.ts +1 -0
- package/vendor/skills/src/update.ts +12 -7
- package/dist/vendor/skills/package.json +0 -143
package/dist/bin/adg.js
CHANGED
|
@@ -96,6 +96,7 @@ async function main(argv) {
|
|
|
96
96
|
// network refresh when the cache is stale — the refresh uses an unreffed
|
|
97
97
|
// socket so it cannot delay process exit).
|
|
98
98
|
const currentVersion = getVersion();
|
|
99
|
+
span.setAttribute("cli.version", currentVersion);
|
|
99
100
|
const latestVersion = checkForUpdate(currentVersion);
|
|
100
101
|
if (latestVersion) {
|
|
101
102
|
process.stderr.write(formatUpdateNotice(currentVersion, latestVersion));
|
|
@@ -174,17 +174,32 @@ function translateToolMatcher(matcher) {
|
|
|
174
174
|
if (typeof matcher !== "string")
|
|
175
175
|
return undefined;
|
|
176
176
|
const tokens = matcher.split("|");
|
|
177
|
-
if (tokens.some((token) => !/^[A-Za-z0-9_]+$/.test(token)))
|
|
178
|
-
return undefined;
|
|
179
177
|
const translated = [];
|
|
180
178
|
for (const token of tokens) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
if (token.startsWith("mcp__")) {
|
|
180
|
+
const mapped = "mcp_" + token.slice(5).replaceAll("__", "_");
|
|
181
|
+
try {
|
|
182
|
+
new RegExp(mapped);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
translated.push(mapped);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
if (!/^[A-Za-z0-9_]+$/.test(token))
|
|
191
|
+
return undefined;
|
|
192
|
+
const alias = TOOL_ALIASES[token];
|
|
193
|
+
if (alias) {
|
|
194
|
+
translated.push(alias);
|
|
195
|
+
}
|
|
196
|
+
else if (ANTIGRAVITY_TOOL_NAMES.has(token)) {
|
|
197
|
+
translated.push(token);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
188
203
|
}
|
|
189
204
|
return translated.join("|");
|
|
190
205
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import * as p from '@clack/prompts';
|
|
2
3
|
import pc from 'picocolors';
|
|
3
4
|
import { existsSync } from 'fs';
|
|
@@ -8,6 +9,7 @@ import { stripTerminalEscapes } from "./sanitize.js";
|
|
|
8
9
|
import { searchMultiselect } from "./prompts/search-multiselect.js";
|
|
9
10
|
// Helper to check if a value is a cancel symbol (works with both clack and our custom prompts)
|
|
10
11
|
const isCancelled = (value) => typeof value === 'symbol';
|
|
12
|
+
const EVE_AGENT_LABEL = 'eve agent';
|
|
11
13
|
/**
|
|
12
14
|
* Check if a source identifier (owner/repo format) represents a private GitHub repo.
|
|
13
15
|
* Returns true if private, false if public, null if unable to determine or not a GitHub repo.
|
|
@@ -31,17 +33,13 @@ import { cloneRepo, cleanupTempDir, GitCloneError } from "./git.js";
|
|
|
31
33
|
import { gitTreeShaForFolder } from "./git-tree.js";
|
|
32
34
|
import { discoverSkills, getSkillDisplayName, filterSkills } from "./skills.js";
|
|
33
35
|
import { installSkillForAgent, installBlobSkillForAgent, isSkillInstalled, getCanonicalPath, installWellKnownSkillForAgent, } from "./installer.js";
|
|
34
|
-
import { detectInstalledAgents, agents, getUniversalAgents, getVisibleUniversalAgents, getNonUniversalAgents, isUniversalAgent, } from "./agents.js";
|
|
35
|
-
import { track,
|
|
36
|
+
import { detectInstalledAgents, agents, getUniversalAgents, getVisibleUniversalAgents, getNonUniversalAgents, isUniversalAgent, getEveSubagents, } from "./agents.js";
|
|
37
|
+
import { track, fetchAuditData, } from "./telemetry.js";
|
|
36
38
|
import { detectAgent, getAgentType } from "./detect-agent.js";
|
|
37
39
|
import { wellKnownProvider } from "./providers/index.js";
|
|
38
40
|
import { addSkillToLock, fetchSkillFolderHash, getGitHubToken, isPromptDismissed, dismissPrompt, getLastSelectedAgents, saveSelectedAgents, } from "./skill-lock.js";
|
|
39
41
|
import { addSkillToLocalLock, computeSkillFolderHash } from "./local-lock.js";
|
|
40
42
|
import { tryBlobInstall, BLOB_ALLOWED_REPOS, getSkillFolderHashFromTree, fetchRepoTree, } from "./blob.js";
|
|
41
|
-
import packageJson from '../package.json' with { type: 'json' };
|
|
42
|
-
export function initTelemetry(version) {
|
|
43
|
-
setVersion(version);
|
|
44
|
-
}
|
|
45
43
|
// ─── Security Advisory ───
|
|
46
44
|
function riskLabel(risk) {
|
|
47
45
|
switch (risk) {
|
|
@@ -126,6 +124,12 @@ function shortenPath(fullPath, cwd) {
|
|
|
126
124
|
}
|
|
127
125
|
return fullPath;
|
|
128
126
|
}
|
|
127
|
+
function computeSingleFileSkillHash(contents) {
|
|
128
|
+
const hash = createHash('sha256');
|
|
129
|
+
hash.update('SKILL.md');
|
|
130
|
+
hash.update(contents);
|
|
131
|
+
return hash.digest('hex');
|
|
132
|
+
}
|
|
129
133
|
/**
|
|
130
134
|
* Formats a list of items, truncating if too many
|
|
131
135
|
*/
|
|
@@ -137,6 +141,16 @@ function formatList(items, maxShow = 5) {
|
|
|
137
141
|
const remaining = items.length - maxShow;
|
|
138
142
|
return `${shown.join(', ')} +${remaining} more`;
|
|
139
143
|
}
|
|
144
|
+
function formatSkillPromptSubject(skills) {
|
|
145
|
+
const names = skills.map((skill) => pc.cyan(getSkillDisplayName(skill)));
|
|
146
|
+
const namedSubject = formatList(names, 3);
|
|
147
|
+
return stripTerminalEscapes(namedSubject).length <= 80
|
|
148
|
+
? namedSubject
|
|
149
|
+
: `${skills.length} selected skills`;
|
|
150
|
+
}
|
|
151
|
+
export function formatEveInstallPromptMessage(skills) {
|
|
152
|
+
return `Detected an eve project. Install ${formatSkillPromptSubject(skills)} for your ${EVE_AGENT_LABEL} to use?`;
|
|
153
|
+
}
|
|
140
154
|
/**
|
|
141
155
|
* Splits agents into universal and non-universal (symlinked) groups.
|
|
142
156
|
* Returns display names for each group.
|
|
@@ -175,6 +189,58 @@ function buildAgentSummaryLines(targetAgents, installMode) {
|
|
|
175
189
|
}
|
|
176
190
|
return lines;
|
|
177
191
|
}
|
|
192
|
+
/** Human-readable label for an install target, e.g. "Eve (research)". */
|
|
193
|
+
function targetDisplayName(target) {
|
|
194
|
+
const base = agents[target.agent].displayName;
|
|
195
|
+
return target.subagent ? `${base} (${target.subagent})` : base;
|
|
196
|
+
}
|
|
197
|
+
/** Stable key used to deduplicate / index per-target state. */
|
|
198
|
+
function targetKey(target) {
|
|
199
|
+
return target.subagent ? `${target.agent}:${target.subagent}` : target.agent;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Expand the selected agents into concrete install targets, fanning Eve out
|
|
203
|
+
* across the chosen subagents (root and/or named subagents).
|
|
204
|
+
*/
|
|
205
|
+
function buildInstallTargets(targetAgents, eveSubagentTargets) {
|
|
206
|
+
const targets = [];
|
|
207
|
+
for (const agent of targetAgents) {
|
|
208
|
+
if (agent === 'eve') {
|
|
209
|
+
for (const subagent of eveSubagentTargets) {
|
|
210
|
+
targets.push({ agent, subagent });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
targets.push({ agent });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return targets;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Builds summary lines showing universal vs symlinked agents and Eve subagents.
|
|
221
|
+
*/
|
|
222
|
+
function buildTargetSummaryLines(targets, installMode) {
|
|
223
|
+
const lines = [];
|
|
224
|
+
const rootAgents = targets.filter((t) => !t.subagent).map((t) => t.agent);
|
|
225
|
+
const subagentNames = targets.filter((t) => t.subagent).map(targetDisplayName);
|
|
226
|
+
const { universal, symlinked } = splitAgentsByType(rootAgents);
|
|
227
|
+
if (installMode === 'symlink') {
|
|
228
|
+
if (universal.length > 0) {
|
|
229
|
+
lines.push(` ${pc.green('universal:')} ${formatList(universal)}`);
|
|
230
|
+
}
|
|
231
|
+
if (symlinked.length > 0) {
|
|
232
|
+
lines.push(` ${pc.dim('symlink →')} ${formatList(symlinked)}`);
|
|
233
|
+
}
|
|
234
|
+
if (subagentNames.length > 0) {
|
|
235
|
+
lines.push(` ${pc.dim('copy →')} ${formatList(subagentNames)}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
const allNames = targets.map(targetDisplayName);
|
|
240
|
+
lines.push(` ${pc.dim('copy →')} ${formatList(allNames)}`);
|
|
241
|
+
}
|
|
242
|
+
return lines;
|
|
243
|
+
}
|
|
178
244
|
/**
|
|
179
245
|
* Ensures universal agents are always included in the target agents list.
|
|
180
246
|
* Used when -y flag is passed or when auto-selecting agents.
|
|
@@ -278,7 +344,7 @@ async function selectAgentsInteractive(options) {
|
|
|
278
344
|
const supportsGlobalFilter = (a) => !options.global || agents[a].globalSkillsDir;
|
|
279
345
|
const universalAgents = getUniversalAgents().filter(supportsGlobalFilter);
|
|
280
346
|
const visibleUniversalAgents = getVisibleUniversalAgents().filter(supportsGlobalFilter);
|
|
281
|
-
const otherAgents = getNonUniversalAgents().filter(supportsGlobalFilter);
|
|
347
|
+
const otherAgents = getNonUniversalAgents().filter((agent) => agent !== 'eve' && supportsGlobalFilter(agent));
|
|
282
348
|
// Universal agents shown as locked section
|
|
283
349
|
const universalSection = {
|
|
284
350
|
title: 'Universal (.agents/skills)',
|
|
@@ -322,8 +388,6 @@ async function selectAgentsInteractive(options) {
|
|
|
322
388
|
}
|
|
323
389
|
return selected;
|
|
324
390
|
}
|
|
325
|
-
const version = packageJson.version;
|
|
326
|
-
setVersion(version);
|
|
327
391
|
/**
|
|
328
392
|
* Handle skills from a well-known endpoint (RFC 8615).
|
|
329
393
|
* Discovers skills from /.well-known/agent-skills/index.json (preferred)
|
|
@@ -714,10 +778,10 @@ export async function runAdd(args, options = {}) {
|
|
|
714
778
|
console.log(pc.bgRed(pc.white(pc.bold(' ERROR '))) + ' ' + pc.red('Missing required argument: source'));
|
|
715
779
|
console.log();
|
|
716
780
|
console.log(pc.dim(' Usage:'));
|
|
717
|
-
console.log(` ${pc.cyan('
|
|
781
|
+
console.log(` ${pc.cyan('adg skills add')} ${pc.yellow('<source>')} ${pc.dim('[options]')}`);
|
|
718
782
|
console.log();
|
|
719
783
|
console.log(pc.dim(' Example:'));
|
|
720
|
-
console.log(` ${pc.cyan('
|
|
784
|
+
console.log(` ${pc.cyan('adg skills add')} ${pc.yellow('vercel-labs/agent-skills')}`);
|
|
721
785
|
console.log();
|
|
722
786
|
process.exit(1);
|
|
723
787
|
}
|
|
@@ -777,7 +841,7 @@ export async function runAdd(args, options = {}) {
|
|
|
777
841
|
p.log.message(pc.yellow('This source contains user-submitted skills that have not been reviewed for safety or quality.'));
|
|
778
842
|
p.log.message(pc.yellow('Skills run with full agent permissions and could be malicious.'));
|
|
779
843
|
console.log();
|
|
780
|
-
p.log.message(`If you understand the risks, re-run with:\n\n ${pc.cyan(`
|
|
844
|
+
p.log.message(`If you understand the risks, re-run with:\n\n ${pc.cyan(`adg skills add ${source} --dangerously-accept-openclaw-risks`)}\n`);
|
|
781
845
|
p.outro(pc.red('Installation blocked'));
|
|
782
846
|
process.exit(1);
|
|
783
847
|
}
|
|
@@ -1053,14 +1117,42 @@ export async function runAdd(args, options = {}) {
|
|
|
1053
1117
|
const installedAgents = await detectInstalledAgents();
|
|
1054
1118
|
const totalAgents = Object.keys(agents).length;
|
|
1055
1119
|
spinner.stop(`${totalAgents} agents`);
|
|
1056
|
-
if (installedAgents.
|
|
1120
|
+
if (installedAgents.includes('eve') && (options.yes || !agentResult.isAgent)) {
|
|
1121
|
+
const useEve = options.yes
|
|
1122
|
+
? true
|
|
1123
|
+
: await p.confirm({
|
|
1124
|
+
message: formatEveInstallPromptMessage(selectedSkills),
|
|
1125
|
+
initialValue: true,
|
|
1126
|
+
});
|
|
1127
|
+
if (p.isCancel(useEve)) {
|
|
1128
|
+
p.cancel('Installation cancelled');
|
|
1129
|
+
await cleanup(tempDir);
|
|
1130
|
+
process.exit(0);
|
|
1131
|
+
}
|
|
1132
|
+
if (useEve) {
|
|
1133
|
+
targetAgents = ['eve'];
|
|
1134
|
+
p.log.info(`Installing to: ${pc.cyan(EVE_AGENT_LABEL)}`);
|
|
1135
|
+
}
|
|
1136
|
+
else {
|
|
1137
|
+
const selected = await selectAgentsInteractive({ global: options.global });
|
|
1138
|
+
if (p.isCancel(selected)) {
|
|
1139
|
+
p.cancel('Installation cancelled');
|
|
1140
|
+
await cleanup(tempDir);
|
|
1141
|
+
process.exit(0);
|
|
1142
|
+
}
|
|
1143
|
+
targetAgents = selected;
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
else if (installedAgents.length === 0) {
|
|
1057
1147
|
if (options.yes) {
|
|
1058
1148
|
targetAgents = validAgents;
|
|
1059
1149
|
p.log.info('Installing to all agents');
|
|
1060
1150
|
}
|
|
1061
1151
|
else {
|
|
1062
1152
|
p.log.info('Select agents to install skills to');
|
|
1063
|
-
const allAgentChoices = Object.entries(agents)
|
|
1153
|
+
const allAgentChoices = Object.entries(agents)
|
|
1154
|
+
.filter(([key]) => key !== 'eve')
|
|
1155
|
+
.map(([key, config]) => ({
|
|
1064
1156
|
value: key,
|
|
1065
1157
|
label: config.displayName,
|
|
1066
1158
|
}));
|
|
@@ -1095,6 +1187,44 @@ export async function runAdd(args, options = {}) {
|
|
|
1095
1187
|
targetAgents = selected;
|
|
1096
1188
|
}
|
|
1097
1189
|
}
|
|
1190
|
+
// An explicit --subagent flag implies the user wants to target Eve.
|
|
1191
|
+
if (options.subagent && options.subagent.length > 0 && !targetAgents.includes('eve')) {
|
|
1192
|
+
targetAgents = [...targetAgents, 'eve'];
|
|
1193
|
+
}
|
|
1194
|
+
// Eve supports subagents, each with their own skills directory at
|
|
1195
|
+
// agent/subagents/<name>/skills in addition to the root agent/skills.
|
|
1196
|
+
// When Eve is a target, choose which of those to install into.
|
|
1197
|
+
let eveSubagentTargets = [undefined];
|
|
1198
|
+
if (targetAgents.includes('eve')) {
|
|
1199
|
+
const availableSubagents = getEveSubagents(process.cwd());
|
|
1200
|
+
if (options.subagent && options.subagent.length > 0) {
|
|
1201
|
+
// Non-interactive: 'root' or '.' selects the root agent.
|
|
1202
|
+
eveSubagentTargets = options.subagent.map((s) => s === 'root' || s === '.' ? undefined : s);
|
|
1203
|
+
}
|
|
1204
|
+
else if (availableSubagents.length > 0 && !options.yes) {
|
|
1205
|
+
const subagentChoices = [
|
|
1206
|
+
{ value: '', label: 'Root agent', hint: 'agent/skills' },
|
|
1207
|
+
...availableSubagents.map((name) => ({
|
|
1208
|
+
value: name,
|
|
1209
|
+
label: name,
|
|
1210
|
+
hint: `agent/subagents/${name}/skills`,
|
|
1211
|
+
})),
|
|
1212
|
+
];
|
|
1213
|
+
const selectedSubagents = await p.multiselect({
|
|
1214
|
+
message: 'Where should Eve skills be installed?',
|
|
1215
|
+
options: subagentChoices,
|
|
1216
|
+
initialValues: [''],
|
|
1217
|
+
required: true,
|
|
1218
|
+
});
|
|
1219
|
+
if (p.isCancel(selectedSubagents)) {
|
|
1220
|
+
p.cancel('Installation cancelled');
|
|
1221
|
+
await cleanup(tempDir);
|
|
1222
|
+
process.exit(0);
|
|
1223
|
+
}
|
|
1224
|
+
eveSubagentTargets = selectedSubagents.map((s) => (s === '' ? undefined : s));
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
const installTargets = buildInstallTargets(targetAgents, eveSubagentTargets);
|
|
1098
1228
|
let installGlobally = options.global ?? false;
|
|
1099
1229
|
// Check if any selected agents support global installation
|
|
1100
1230
|
const supportsGlobal = targetAgents.some((a) => agents[a].globalSkillsDir !== undefined);
|
|
@@ -1124,9 +1254,12 @@ export async function runAdd(args, options = {}) {
|
|
|
1124
1254
|
// Determine install mode (symlink vs copy)
|
|
1125
1255
|
let installMode = options.copy ? 'copy' : 'symlink';
|
|
1126
1256
|
// Only prompt for install mode when there are multiple unique target directories.
|
|
1127
|
-
// When all selected
|
|
1128
|
-
|
|
1129
|
-
|
|
1257
|
+
// When all selected targets share the same skillsDir, symlink vs copy is meaningless.
|
|
1258
|
+
// Eve writes skill files directly into each (sub)agent dir, so a symlink prompt is
|
|
1259
|
+
// never meaningful when every target is Eve.
|
|
1260
|
+
const allEve = installTargets.every((t) => t.agent === 'eve');
|
|
1261
|
+
const uniqueDirs = new Set(installTargets.map((t) => t.subagent ? `eve:subagent:${t.subagent}` : agents[t.agent].skillsDir));
|
|
1262
|
+
if (!options.copy && !options.yes && uniqueDirs.size > 1 && !allEve) {
|
|
1130
1263
|
const modeChoice = await p.select({
|
|
1131
1264
|
message: 'Installation method',
|
|
1132
1265
|
options: [
|
|
@@ -1145,26 +1278,29 @@ export async function runAdd(args, options = {}) {
|
|
|
1145
1278
|
}
|
|
1146
1279
|
installMode = modeChoice;
|
|
1147
1280
|
}
|
|
1148
|
-
else if (uniqueDirs.size <= 1) {
|
|
1149
|
-
// Single target directory — default to copy (no symlink needed)
|
|
1281
|
+
else if (uniqueDirs.size <= 1 || allEve) {
|
|
1282
|
+
// Single target directory (or all-Eve) — default to copy (no symlink needed)
|
|
1150
1283
|
installMode = 'copy';
|
|
1151
1284
|
}
|
|
1152
1285
|
const cwd = process.cwd();
|
|
1153
1286
|
// Build installation summary
|
|
1154
1287
|
const summaryLines = [];
|
|
1155
|
-
const agentNames = targetAgents.map((a) => agents[a].displayName);
|
|
1156
1288
|
// Check if any skill will be overwritten (parallel)
|
|
1157
|
-
const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) =>
|
|
1289
|
+
const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) => installTargets.map(async (target) => ({
|
|
1158
1290
|
skillName: skill.name,
|
|
1159
|
-
|
|
1160
|
-
installed: await isSkillInstalled(skill.name, agent, {
|
|
1291
|
+
target,
|
|
1292
|
+
installed: await isSkillInstalled(skill.name, target.agent, {
|
|
1293
|
+
global: installGlobally,
|
|
1294
|
+
eveSubagent: target.subagent,
|
|
1295
|
+
}),
|
|
1161
1296
|
}))));
|
|
1297
|
+
// Keyed by skill name → target key → installed?
|
|
1162
1298
|
const overwriteStatus = new Map();
|
|
1163
|
-
for (const { skillName,
|
|
1299
|
+
for (const { skillName, target, installed } of overwriteChecks) {
|
|
1164
1300
|
if (!overwriteStatus.has(skillName)) {
|
|
1165
1301
|
overwriteStatus.set(skillName, new Map());
|
|
1166
1302
|
}
|
|
1167
|
-
overwriteStatus.get(skillName).set(
|
|
1303
|
+
overwriteStatus.get(skillName).set(targetKey(target), installed);
|
|
1168
1304
|
}
|
|
1169
1305
|
// Group selected skills for summary
|
|
1170
1306
|
const groupedSummary = {};
|
|
@@ -1185,14 +1321,20 @@ export async function runAdd(args, options = {}) {
|
|
|
1185
1321
|
for (const skill of skills) {
|
|
1186
1322
|
if (summaryLines.length > 0)
|
|
1187
1323
|
summaryLines.push('');
|
|
1188
|
-
const canonicalPath =
|
|
1324
|
+
const canonicalPath = installTargets.length === 1
|
|
1325
|
+
? getCanonicalPath(skill.name, {
|
|
1326
|
+
global: installGlobally,
|
|
1327
|
+
agent: installTargets[0].agent,
|
|
1328
|
+
eveSubagent: installTargets[0].subagent,
|
|
1329
|
+
})
|
|
1330
|
+
: getCanonicalPath(skill.name, { global: installGlobally });
|
|
1189
1331
|
const shortCanonical = shortenPath(canonicalPath, cwd);
|
|
1190
1332
|
summaryLines.push(`${pc.cyan(shortCanonical)}`);
|
|
1191
|
-
summaryLines.push(...
|
|
1333
|
+
summaryLines.push(...buildTargetSummaryLines(installTargets, installMode));
|
|
1192
1334
|
const skillOverwrites = overwriteStatus.get(skill.name);
|
|
1193
|
-
const overwriteAgents =
|
|
1194
|
-
.filter((
|
|
1195
|
-
.map(
|
|
1335
|
+
const overwriteAgents = installTargets
|
|
1336
|
+
.filter((t) => skillOverwrites?.get(targetKey(t)))
|
|
1337
|
+
.map(targetDisplayName);
|
|
1196
1338
|
if (overwriteAgents.length > 0) {
|
|
1197
1339
|
summaryLines.push(` ${pc.yellow('overwrites:')} ${formatList(overwriteAgents)}`);
|
|
1198
1340
|
}
|
|
@@ -1246,23 +1388,29 @@ export async function runAdd(args, options = {}) {
|
|
|
1246
1388
|
spinner.start('Installing skills...');
|
|
1247
1389
|
const results = [];
|
|
1248
1390
|
for (const skill of selectedSkills) {
|
|
1249
|
-
for (const
|
|
1391
|
+
for (const target of installTargets) {
|
|
1392
|
+
const { agent, subagent } = target;
|
|
1250
1393
|
let result;
|
|
1251
1394
|
if (blobResult && 'files' in skill) {
|
|
1252
1395
|
// Blob-based install: write files from snapshot
|
|
1253
1396
|
const blobSkill = skill;
|
|
1254
|
-
result = await installBlobSkillForAgent({ installName: blobSkill.name, files: blobSkill.files }, agent, { global: installGlobally, mode: installMode });
|
|
1397
|
+
result = await installBlobSkillForAgent({ installName: blobSkill.name, files: blobSkill.files }, agent, { global: installGlobally, mode: installMode, eveSubagent: subagent });
|
|
1398
|
+
}
|
|
1399
|
+
else if (tempDir && skill.path === tempDir && skill.rawContent) {
|
|
1400
|
+
// Remote root-level SKILL.md: install the skill file, not the whole repository.
|
|
1401
|
+
result = await installBlobSkillForAgent({ installName: skill.name, files: [{ path: 'SKILL.md', contents: skill.rawContent }] }, agent, { global: installGlobally, mode: installMode });
|
|
1255
1402
|
}
|
|
1256
1403
|
else {
|
|
1257
1404
|
// Disk-based install: copy from cloned/local directory
|
|
1258
1405
|
result = await installSkillForAgent(skill, agent, {
|
|
1259
1406
|
global: installGlobally,
|
|
1260
1407
|
mode: installMode,
|
|
1408
|
+
eveSubagent: subagent,
|
|
1261
1409
|
});
|
|
1262
1410
|
}
|
|
1263
1411
|
results.push({
|
|
1264
1412
|
skill: getSkillDisplayName(skill),
|
|
1265
|
-
agent:
|
|
1413
|
+
agent: targetDisplayName(target),
|
|
1266
1414
|
pluginName: skill.pluginName,
|
|
1267
1415
|
...result,
|
|
1268
1416
|
});
|
|
@@ -1396,6 +1544,13 @@ export async function runAdd(args, options = {}) {
|
|
|
1396
1544
|
// Add to local lock file for project-scoped installs
|
|
1397
1545
|
if (successful.length > 0 && !installGlobally) {
|
|
1398
1546
|
const successfulSkillNames = new Set(successful.map((r) => r.skill));
|
|
1547
|
+
// Record Eve subagent placement (root = '') so `update` can restore it.
|
|
1548
|
+
// Only meaningful when Eve is among the targets and a non-root subagent
|
|
1549
|
+
// was selected; otherwise omit for a clean, minimal lock entry.
|
|
1550
|
+
const eveSubagents = targetAgents.includes('eve')
|
|
1551
|
+
? eveSubagentTargets.map((s) => s ?? '')
|
|
1552
|
+
: undefined;
|
|
1553
|
+
const recordSubagents = eveSubagents && (eveSubagents.length > 1 || eveSubagents.some((s) => s !== ''));
|
|
1399
1554
|
for (const skill of selectedSkills) {
|
|
1400
1555
|
const skillDisplayName = getSkillDisplayName(skill);
|
|
1401
1556
|
if (successfulSkillNames.has(skillDisplayName)) {
|
|
@@ -1403,7 +1558,9 @@ export async function runAdd(args, options = {}) {
|
|
|
1403
1558
|
// For blob skills, use the snapshot hash; for disk skills, compute from files
|
|
1404
1559
|
const computedHash = blobResult && 'snapshotHash' in skill
|
|
1405
1560
|
? skill.snapshotHash
|
|
1406
|
-
:
|
|
1561
|
+
: tempDir && skill.path === tempDir && skill.rawContent
|
|
1562
|
+
? computeSingleFileSkillHash(skill.rawContent)
|
|
1563
|
+
: await computeSkillFolderHash(skill.path);
|
|
1407
1564
|
const skillPathValue = skillFiles[skill.name];
|
|
1408
1565
|
await addSkillToLocalLock(skill.name, {
|
|
1409
1566
|
source: lockSource || parsed.url,
|
|
@@ -1411,6 +1568,7 @@ export async function runAdd(args, options = {}) {
|
|
|
1411
1568
|
sourceType: parsed.type,
|
|
1412
1569
|
...(skillPathValue && { skillPath: skillPathValue }),
|
|
1413
1570
|
computedHash,
|
|
1571
|
+
...(recordSubagents && { subagents: eveSubagents }),
|
|
1414
1572
|
}, cwd);
|
|
1415
1573
|
}
|
|
1416
1574
|
catch {
|
|
@@ -1593,13 +1751,13 @@ async function promptForFindSkills(options, targetAgents) {
|
|
|
1593
1751
|
}
|
|
1594
1752
|
catch {
|
|
1595
1753
|
p.log.warn('Failed to install find-skills. You can try again with:');
|
|
1596
|
-
p.log.message(pc.dim('
|
|
1754
|
+
p.log.message(pc.dim(' adg skills add vercel-labs/skills@find-skills -g -y --all'));
|
|
1597
1755
|
}
|
|
1598
1756
|
}
|
|
1599
1757
|
else {
|
|
1600
1758
|
// User declined - dismiss the prompt
|
|
1601
1759
|
await dismissPrompt('findSkillsPrompt');
|
|
1602
|
-
p.log.message(pc.dim('You can install it later with:
|
|
1760
|
+
p.log.message(pc.dim('You can install it later with: adg skills add vercel-labs/skills@find-skills'));
|
|
1603
1761
|
}
|
|
1604
1762
|
}
|
|
1605
1763
|
catch {
|
|
@@ -1655,6 +1813,17 @@ export function parseAddOptions(args) {
|
|
|
1655
1813
|
else if (arg === '--dangerously-accept-openclaw-risks') {
|
|
1656
1814
|
options.dangerouslyAcceptOpenclawRisks = true;
|
|
1657
1815
|
}
|
|
1816
|
+
else if (arg === '--subagent') {
|
|
1817
|
+
options.subagent = options.subagent || [];
|
|
1818
|
+
i++;
|
|
1819
|
+
let nextArg = args[i];
|
|
1820
|
+
while (i < args.length && nextArg && !nextArg.startsWith('-')) {
|
|
1821
|
+
options.subagent.push(nextArg);
|
|
1822
|
+
i++;
|
|
1823
|
+
nextArg = args[i];
|
|
1824
|
+
}
|
|
1825
|
+
i--; // Back up one since the loop will increment
|
|
1826
|
+
}
|
|
1658
1827
|
else if (arg && !arg.startsWith('-')) {
|
|
1659
1828
|
source.push(arg);
|
|
1660
1829
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { homedir } from 'os';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
3
|
+
import { existsSync, readFileSync, readdirSync } from 'fs';
|
|
4
4
|
import { xdgConfig } from 'xdg-basedir';
|
|
5
5
|
const home = homedir();
|
|
6
6
|
// Use xdg-basedir (not env-paths) to match OpenCode/Amp/Goose behavior on all platforms.
|
|
@@ -18,6 +18,15 @@ const hermesHome = process.env.HERMES_HOME?.trim() || join(home, '.hermes');
|
|
|
18
18
|
const autohandHome = process.env.AUTOHAND_HOME?.trim() || join(home, '.autohand');
|
|
19
19
|
const zedAppDataHome = process.env.APPDATA?.trim();
|
|
20
20
|
const zedFlatpakConfigHome = process.env.FLATPAK_XDG_CONFIG_HOME?.trim();
|
|
21
|
+
function packageJsonHasDependency(packageJsonPath, dependencyName) {
|
|
22
|
+
try {
|
|
23
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
24
|
+
return !!(packageJson.dependencies?.[dependencyName] || packageJson.devDependencies?.[dependencyName]);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
21
30
|
export function getOpenClawGlobalSkillsDir(homeDir = home, pathExists = existsSync) {
|
|
22
31
|
if (pathExists(join(homeDir, '.openclaw'))) {
|
|
23
32
|
return join(homeDir, '.openclaw/skills');
|
|
@@ -259,6 +268,16 @@ export const agents = {
|
|
|
259
268
|
return existsSync(join(home, '.factory'));
|
|
260
269
|
},
|
|
261
270
|
},
|
|
271
|
+
eve: {
|
|
272
|
+
name: 'eve',
|
|
273
|
+
displayName: 'Eve',
|
|
274
|
+
skillsDir: 'agent/skills',
|
|
275
|
+
globalSkillsDir: undefined,
|
|
276
|
+
detectInstalled: async () => {
|
|
277
|
+
const cwd = process.cwd();
|
|
278
|
+
return (existsSync(join(cwd, 'agent')) && packageJsonHasDependency(join(cwd, 'package.json'), 'eve'));
|
|
279
|
+
},
|
|
280
|
+
},
|
|
262
281
|
firebender: {
|
|
263
282
|
name: 'firebender',
|
|
264
283
|
displayName: 'Firebender',
|
|
@@ -691,6 +710,35 @@ export async function detectInstalledAgents() {
|
|
|
691
710
|
export function getAgentConfig(type) {
|
|
692
711
|
return agents[type];
|
|
693
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* Directory (relative to an Eve project root) that holds subagents.
|
|
715
|
+
* Each subagent owns its own skills at `agent/subagents/<name>/skills`,
|
|
716
|
+
* mirroring the root agent's `agent/skills`.
|
|
717
|
+
*/
|
|
718
|
+
export const EVE_SUBAGENTS_DIR = join('agent', 'subagents');
|
|
719
|
+
/**
|
|
720
|
+
* Discover the names of Eve subagents in a project.
|
|
721
|
+
*
|
|
722
|
+
* Eve supports subagents that each have their own skills directory at
|
|
723
|
+
* `agent/subagents/<name>/skills`. This returns the `<name>` of every
|
|
724
|
+
* subagent directory found under `agent/subagents/`, sorted alphabetically.
|
|
725
|
+
* Returns an empty list when the directory doesn't exist or can't be read.
|
|
726
|
+
*/
|
|
727
|
+
export function getEveSubagents(cwd = process.cwd()) {
|
|
728
|
+
const dir = join(cwd, EVE_SUBAGENTS_DIR);
|
|
729
|
+
if (!existsSync(dir)) {
|
|
730
|
+
return [];
|
|
731
|
+
}
|
|
732
|
+
try {
|
|
733
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
734
|
+
.filter((entry) => entry.isDirectory())
|
|
735
|
+
.map((entry) => entry.name)
|
|
736
|
+
.sort();
|
|
737
|
+
}
|
|
738
|
+
catch {
|
|
739
|
+
return [];
|
|
740
|
+
}
|
|
741
|
+
}
|
|
694
742
|
/**
|
|
695
743
|
* Returns agents that use the universal .agents/skills directory.
|
|
696
744
|
* These agents share a common skill location and don't need symlinks.
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* 2. raw.githubusercontent.com → fetch frontmatter to get skill names
|
|
10
10
|
* 3. skills.sh/api/download → fetch full file contents from cached blob
|
|
11
11
|
*/
|
|
12
|
+
import { createHash } from 'node:crypto';
|
|
12
13
|
import { parseFrontmatter } from "./frontmatter.js";
|
|
13
14
|
import { sanitizeMetadata } from "./sanitize.js";
|
|
14
15
|
// ─── Constants ───
|
|
@@ -315,6 +316,14 @@ async function fetchSkillDownload(source, slug) {
|
|
|
315
316
|
return null;
|
|
316
317
|
}
|
|
317
318
|
}
|
|
319
|
+
function computeSnapshotHash(files) {
|
|
320
|
+
const hash = createHash('sha256');
|
|
321
|
+
for (const file of [...files].sort((a, b) => a.path.localeCompare(b.path))) {
|
|
322
|
+
hash.update(file.path);
|
|
323
|
+
hash.update(file.contents);
|
|
324
|
+
}
|
|
325
|
+
return hash.digest('hex');
|
|
326
|
+
}
|
|
318
327
|
/**
|
|
319
328
|
* Attempt to resolve skills from blob storage instead of cloning.
|
|
320
329
|
*
|
|
@@ -419,6 +428,15 @@ export async function tryBlobInstall(ownerRepo, options = {}) {
|
|
|
419
428
|
: mdPathLower === 'skill.md'
|
|
420
429
|
? ''
|
|
421
430
|
: skill.mdPath.slice(0, -(1 + 'SKILL.md'.length));
|
|
431
|
+
// A root-level SKILL.md means the repository root is a skill entrypoint,
|
|
432
|
+
// not that the entire repository is installable skill payload. Some cached
|
|
433
|
+
// snapshots for root skills contain every repo file; installing those can
|
|
434
|
+
// dump thousands of unrelated files into .agents/skills/<name>. Keep root
|
|
435
|
+
// skills to their SKILL.md unless/until the skill spec gains an explicit
|
|
436
|
+
// include list for supporting files.
|
|
437
|
+
const files = folderPath
|
|
438
|
+
? download.files
|
|
439
|
+
: download.files.filter((file) => file.path.toLowerCase() === 'skill.md');
|
|
422
440
|
return {
|
|
423
441
|
name: skill.name,
|
|
424
442
|
description: skill.description,
|
|
@@ -427,8 +445,8 @@ export async function tryBlobInstall(ownerRepo, options = {}) {
|
|
|
427
445
|
path: '',
|
|
428
446
|
rawContent: skill.content,
|
|
429
447
|
metadata: skill.metadata,
|
|
430
|
-
files
|
|
431
|
-
snapshotHash: download.hash,
|
|
448
|
+
files,
|
|
449
|
+
snapshotHash: files.length === download.files.length ? download.hash : computeSnapshotHash(files),
|
|
432
450
|
repoPath: skill.mdPath,
|
|
433
451
|
};
|
|
434
452
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { writeFileSync, readFileSync, existsSync, mkdirSync } from 'fs';
|
|
3
3
|
import { basename, join, dirname } from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
|
-
import { runAdd, parseAddOptions
|
|
5
|
+
import { runAdd, parseAddOptions } from "./add.js";
|
|
6
6
|
import { runFind } from "./find.js";
|
|
7
7
|
import { runInstallFromLock } from "./install.js";
|
|
8
8
|
import { runList } from "./list.js";
|
|
@@ -24,7 +24,6 @@ function getVersion() {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
const VERSION = getVersion();
|
|
27
|
-
initTelemetry(VERSION);
|
|
28
27
|
const RESET = '\x1b[0m';
|
|
29
28
|
const BOLD = '\x1b[1m';
|
|
30
29
|
// 256-color grays - visible on both light and dark backgrounds
|
|
@@ -89,6 +88,9 @@ ${BOLD}Manage Skills:${RESET}
|
|
|
89
88
|
list, ls List installed skills
|
|
90
89
|
find [query] Search for skills interactively
|
|
91
90
|
|
|
91
|
+
${BOLD}Find Options:${RESET}
|
|
92
|
+
--owner <owner> Search only repositories from a GitHub owner
|
|
93
|
+
|
|
92
94
|
${BOLD}Updates:${RESET}
|
|
93
95
|
update [skills...] Update skills to latest versions (alias: upgrade)
|
|
94
96
|
|
|
@@ -109,6 +111,7 @@ ${BOLD}Add Options:${RESET}
|
|
|
109
111
|
-l, --list List available skills in the repository without installing
|
|
110
112
|
-y, --yes Skip confirmation prompts
|
|
111
113
|
--copy Copy files instead of symlinking to agent directories
|
|
114
|
+
--subagent <names> Install to Eve subagents (use 'root' for the root agent)
|
|
112
115
|
--all Shorthand for --skill '*' --agent '*' -y
|
|
113
116
|
--full-depth Search all subdirectories even when a root SKILL.md exists
|
|
114
117
|
|
|
@@ -155,6 +158,7 @@ ${BOLD}Examples:${RESET}
|
|
|
155
158
|
${DIM}$${RESET} skills ls --json ${DIM}# JSON output${RESET}
|
|
156
159
|
${DIM}$${RESET} skills find ${DIM}# interactive search${RESET}
|
|
157
160
|
${DIM}$${RESET} skills find typescript ${DIM}# search by keyword${RESET}
|
|
161
|
+
${DIM}$${RESET} skills find react --owner vercel ${DIM}# search within an owner${RESET}
|
|
158
162
|
${DIM}$${RESET} skills update
|
|
159
163
|
${DIM}$${RESET} skills update my-skill ${DIM}# update a single skill${RESET}
|
|
160
164
|
${DIM}$${RESET} skills update -g ${DIM}# update global skills only${RESET}
|