@rbbtsn0w/adg 0.5.0-beta.2 → 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/src/adapters/antigravity-hooks.js +6 -0
- package/dist/vendor/skills/src/add.js +199 -24
- 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 +5 -0
- package/dist/vendor/skills/src/find.js +62 -12
- package/dist/vendor/skills/src/installer.js +173 -30
- package/dist/vendor/skills/src/remove.js +12 -2
- package/dist/vendor/skills/src/update.js +6 -1
- 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 +247 -25
- package/vendor/skills/src/agents.ts +57 -1
- package/vendor/skills/src/blob.ts +23 -2
- package/vendor/skills/src/cli.ts +5 -0
- package/vendor/skills/src/find.ts +74 -12
- 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/types.ts +1 -0
- package/vendor/skills/src/update.ts +6 -1
|
@@ -178,6 +178,12 @@ function translateToolMatcher(matcher) {
|
|
|
178
178
|
for (const token of tokens) {
|
|
179
179
|
if (token.startsWith("mcp__")) {
|
|
180
180
|
const mapped = "mcp_" + token.slice(5).replaceAll("__", "_");
|
|
181
|
+
try {
|
|
182
|
+
new RegExp(mapped);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
181
187
|
translated.push(mapped);
|
|
182
188
|
}
|
|
183
189
|
else {
|
|
@@ -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,7 +33,7 @@ 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";
|
|
36
|
+
import { detectInstalledAgents, agents, getUniversalAgents, getVisibleUniversalAgents, getNonUniversalAgents, isUniversalAgent, getEveSubagents, } from "./agents.js";
|
|
35
37
|
import { track, fetchAuditData, } from "./telemetry.js";
|
|
36
38
|
import { detectAgent, getAgentType } from "./detect-agent.js";
|
|
37
39
|
import { wellKnownProvider } from "./providers/index.js";
|
|
@@ -122,6 +124,12 @@ function shortenPath(fullPath, cwd) {
|
|
|
122
124
|
}
|
|
123
125
|
return fullPath;
|
|
124
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
|
+
}
|
|
125
133
|
/**
|
|
126
134
|
* Formats a list of items, truncating if too many
|
|
127
135
|
*/
|
|
@@ -133,6 +141,16 @@ function formatList(items, maxShow = 5) {
|
|
|
133
141
|
const remaining = items.length - maxShow;
|
|
134
142
|
return `${shown.join(', ')} +${remaining} more`;
|
|
135
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
|
+
}
|
|
136
154
|
/**
|
|
137
155
|
* Splits agents into universal and non-universal (symlinked) groups.
|
|
138
156
|
* Returns display names for each group.
|
|
@@ -171,6 +189,58 @@ function buildAgentSummaryLines(targetAgents, installMode) {
|
|
|
171
189
|
}
|
|
172
190
|
return lines;
|
|
173
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
|
+
}
|
|
174
244
|
/**
|
|
175
245
|
* Ensures universal agents are always included in the target agents list.
|
|
176
246
|
* Used when -y flag is passed or when auto-selecting agents.
|
|
@@ -274,7 +344,7 @@ async function selectAgentsInteractive(options) {
|
|
|
274
344
|
const supportsGlobalFilter = (a) => !options.global || agents[a].globalSkillsDir;
|
|
275
345
|
const universalAgents = getUniversalAgents().filter(supportsGlobalFilter);
|
|
276
346
|
const visibleUniversalAgents = getVisibleUniversalAgents().filter(supportsGlobalFilter);
|
|
277
|
-
const otherAgents = getNonUniversalAgents().filter(supportsGlobalFilter);
|
|
347
|
+
const otherAgents = getNonUniversalAgents().filter((agent) => agent !== 'eve' && supportsGlobalFilter(agent));
|
|
278
348
|
// Universal agents shown as locked section
|
|
279
349
|
const universalSection = {
|
|
280
350
|
title: 'Universal (.agents/skills)',
|
|
@@ -1047,14 +1117,42 @@ export async function runAdd(args, options = {}) {
|
|
|
1047
1117
|
const installedAgents = await detectInstalledAgents();
|
|
1048
1118
|
const totalAgents = Object.keys(agents).length;
|
|
1049
1119
|
spinner.stop(`${totalAgents} agents`);
|
|
1050
|
-
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) {
|
|
1051
1147
|
if (options.yes) {
|
|
1052
1148
|
targetAgents = validAgents;
|
|
1053
1149
|
p.log.info('Installing to all agents');
|
|
1054
1150
|
}
|
|
1055
1151
|
else {
|
|
1056
1152
|
p.log.info('Select agents to install skills to');
|
|
1057
|
-
const allAgentChoices = Object.entries(agents)
|
|
1153
|
+
const allAgentChoices = Object.entries(agents)
|
|
1154
|
+
.filter(([key]) => key !== 'eve')
|
|
1155
|
+
.map(([key, config]) => ({
|
|
1058
1156
|
value: key,
|
|
1059
1157
|
label: config.displayName,
|
|
1060
1158
|
}));
|
|
@@ -1089,6 +1187,44 @@ export async function runAdd(args, options = {}) {
|
|
|
1089
1187
|
targetAgents = selected;
|
|
1090
1188
|
}
|
|
1091
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);
|
|
1092
1228
|
let installGlobally = options.global ?? false;
|
|
1093
1229
|
// Check if any selected agents support global installation
|
|
1094
1230
|
const supportsGlobal = targetAgents.some((a) => agents[a].globalSkillsDir !== undefined);
|
|
@@ -1118,9 +1254,12 @@ export async function runAdd(args, options = {}) {
|
|
|
1118
1254
|
// Determine install mode (symlink vs copy)
|
|
1119
1255
|
let installMode = options.copy ? 'copy' : 'symlink';
|
|
1120
1256
|
// Only prompt for install mode when there are multiple unique target directories.
|
|
1121
|
-
// When all selected
|
|
1122
|
-
|
|
1123
|
-
|
|
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) {
|
|
1124
1263
|
const modeChoice = await p.select({
|
|
1125
1264
|
message: 'Installation method',
|
|
1126
1265
|
options: [
|
|
@@ -1139,26 +1278,29 @@ export async function runAdd(args, options = {}) {
|
|
|
1139
1278
|
}
|
|
1140
1279
|
installMode = modeChoice;
|
|
1141
1280
|
}
|
|
1142
|
-
else if (uniqueDirs.size <= 1) {
|
|
1143
|
-
// 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)
|
|
1144
1283
|
installMode = 'copy';
|
|
1145
1284
|
}
|
|
1146
1285
|
const cwd = process.cwd();
|
|
1147
1286
|
// Build installation summary
|
|
1148
1287
|
const summaryLines = [];
|
|
1149
|
-
const agentNames = targetAgents.map((a) => agents[a].displayName);
|
|
1150
1288
|
// Check if any skill will be overwritten (parallel)
|
|
1151
|
-
const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) =>
|
|
1289
|
+
const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) => installTargets.map(async (target) => ({
|
|
1152
1290
|
skillName: skill.name,
|
|
1153
|
-
|
|
1154
|
-
installed: await isSkillInstalled(skill.name, agent, {
|
|
1291
|
+
target,
|
|
1292
|
+
installed: await isSkillInstalled(skill.name, target.agent, {
|
|
1293
|
+
global: installGlobally,
|
|
1294
|
+
eveSubagent: target.subagent,
|
|
1295
|
+
}),
|
|
1155
1296
|
}))));
|
|
1297
|
+
// Keyed by skill name → target key → installed?
|
|
1156
1298
|
const overwriteStatus = new Map();
|
|
1157
|
-
for (const { skillName,
|
|
1299
|
+
for (const { skillName, target, installed } of overwriteChecks) {
|
|
1158
1300
|
if (!overwriteStatus.has(skillName)) {
|
|
1159
1301
|
overwriteStatus.set(skillName, new Map());
|
|
1160
1302
|
}
|
|
1161
|
-
overwriteStatus.get(skillName).set(
|
|
1303
|
+
overwriteStatus.get(skillName).set(targetKey(target), installed);
|
|
1162
1304
|
}
|
|
1163
1305
|
// Group selected skills for summary
|
|
1164
1306
|
const groupedSummary = {};
|
|
@@ -1179,14 +1321,20 @@ export async function runAdd(args, options = {}) {
|
|
|
1179
1321
|
for (const skill of skills) {
|
|
1180
1322
|
if (summaryLines.length > 0)
|
|
1181
1323
|
summaryLines.push('');
|
|
1182
|
-
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 });
|
|
1183
1331
|
const shortCanonical = shortenPath(canonicalPath, cwd);
|
|
1184
1332
|
summaryLines.push(`${pc.cyan(shortCanonical)}`);
|
|
1185
|
-
summaryLines.push(...
|
|
1333
|
+
summaryLines.push(...buildTargetSummaryLines(installTargets, installMode));
|
|
1186
1334
|
const skillOverwrites = overwriteStatus.get(skill.name);
|
|
1187
|
-
const overwriteAgents =
|
|
1188
|
-
.filter((
|
|
1189
|
-
.map(
|
|
1335
|
+
const overwriteAgents = installTargets
|
|
1336
|
+
.filter((t) => skillOverwrites?.get(targetKey(t)))
|
|
1337
|
+
.map(targetDisplayName);
|
|
1190
1338
|
if (overwriteAgents.length > 0) {
|
|
1191
1339
|
summaryLines.push(` ${pc.yellow('overwrites:')} ${formatList(overwriteAgents)}`);
|
|
1192
1340
|
}
|
|
@@ -1240,23 +1388,29 @@ export async function runAdd(args, options = {}) {
|
|
|
1240
1388
|
spinner.start('Installing skills...');
|
|
1241
1389
|
const results = [];
|
|
1242
1390
|
for (const skill of selectedSkills) {
|
|
1243
|
-
for (const
|
|
1391
|
+
for (const target of installTargets) {
|
|
1392
|
+
const { agent, subagent } = target;
|
|
1244
1393
|
let result;
|
|
1245
1394
|
if (blobResult && 'files' in skill) {
|
|
1246
1395
|
// Blob-based install: write files from snapshot
|
|
1247
1396
|
const blobSkill = skill;
|
|
1248
|
-
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 });
|
|
1249
1402
|
}
|
|
1250
1403
|
else {
|
|
1251
1404
|
// Disk-based install: copy from cloned/local directory
|
|
1252
1405
|
result = await installSkillForAgent(skill, agent, {
|
|
1253
1406
|
global: installGlobally,
|
|
1254
1407
|
mode: installMode,
|
|
1408
|
+
eveSubagent: subagent,
|
|
1255
1409
|
});
|
|
1256
1410
|
}
|
|
1257
1411
|
results.push({
|
|
1258
1412
|
skill: getSkillDisplayName(skill),
|
|
1259
|
-
agent:
|
|
1413
|
+
agent: targetDisplayName(target),
|
|
1260
1414
|
pluginName: skill.pluginName,
|
|
1261
1415
|
...result,
|
|
1262
1416
|
});
|
|
@@ -1390,6 +1544,13 @@ export async function runAdd(args, options = {}) {
|
|
|
1390
1544
|
// Add to local lock file for project-scoped installs
|
|
1391
1545
|
if (successful.length > 0 && !installGlobally) {
|
|
1392
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 !== ''));
|
|
1393
1554
|
for (const skill of selectedSkills) {
|
|
1394
1555
|
const skillDisplayName = getSkillDisplayName(skill);
|
|
1395
1556
|
if (successfulSkillNames.has(skillDisplayName)) {
|
|
@@ -1397,7 +1558,9 @@ export async function runAdd(args, options = {}) {
|
|
|
1397
1558
|
// For blob skills, use the snapshot hash; for disk skills, compute from files
|
|
1398
1559
|
const computedHash = blobResult && 'snapshotHash' in skill
|
|
1399
1560
|
? skill.snapshotHash
|
|
1400
|
-
:
|
|
1561
|
+
: tempDir && skill.path === tempDir && skill.rawContent
|
|
1562
|
+
? computeSingleFileSkillHash(skill.rawContent)
|
|
1563
|
+
: await computeSkillFolderHash(skill.path);
|
|
1401
1564
|
const skillPathValue = skillFiles[skill.name];
|
|
1402
1565
|
await addSkillToLocalLock(skill.name, {
|
|
1403
1566
|
source: lockSource || parsed.url,
|
|
@@ -1405,6 +1568,7 @@ export async function runAdd(args, options = {}) {
|
|
|
1405
1568
|
sourceType: parsed.type,
|
|
1406
1569
|
...(skillPathValue && { skillPath: skillPathValue }),
|
|
1407
1570
|
computedHash,
|
|
1571
|
+
...(recordSubagents && { subagents: eveSubagents }),
|
|
1408
1572
|
}, cwd);
|
|
1409
1573
|
}
|
|
1410
1574
|
catch {
|
|
@@ -1649,6 +1813,17 @@ export function parseAddOptions(args) {
|
|
|
1649
1813
|
else if (arg === '--dangerously-accept-openclaw-risks') {
|
|
1650
1814
|
options.dangerouslyAcceptOpenclawRisks = true;
|
|
1651
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
|
+
}
|
|
1652
1827
|
else if (arg && !arg.startsWith('-')) {
|
|
1653
1828
|
source.push(arg);
|
|
1654
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
|
});
|
|
@@ -88,6 +88,9 @@ ${BOLD}Manage Skills:${RESET}
|
|
|
88
88
|
list, ls List installed skills
|
|
89
89
|
find [query] Search for skills interactively
|
|
90
90
|
|
|
91
|
+
${BOLD}Find Options:${RESET}
|
|
92
|
+
--owner <owner> Search only repositories from a GitHub owner
|
|
93
|
+
|
|
91
94
|
${BOLD}Updates:${RESET}
|
|
92
95
|
update [skills...] Update skills to latest versions (alias: upgrade)
|
|
93
96
|
|
|
@@ -108,6 +111,7 @@ ${BOLD}Add Options:${RESET}
|
|
|
108
111
|
-l, --list List available skills in the repository without installing
|
|
109
112
|
-y, --yes Skip confirmation prompts
|
|
110
113
|
--copy Copy files instead of symlinking to agent directories
|
|
114
|
+
--subagent <names> Install to Eve subagents (use 'root' for the root agent)
|
|
111
115
|
--all Shorthand for --skill '*' --agent '*' -y
|
|
112
116
|
--full-depth Search all subdirectories even when a root SKILL.md exists
|
|
113
117
|
|
|
@@ -154,6 +158,7 @@ ${BOLD}Examples:${RESET}
|
|
|
154
158
|
${DIM}$${RESET} skills ls --json ${DIM}# JSON output${RESET}
|
|
155
159
|
${DIM}$${RESET} skills find ${DIM}# interactive search${RESET}
|
|
156
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}
|
|
157
162
|
${DIM}$${RESET} skills update
|
|
158
163
|
${DIM}$${RESET} skills update my-skill ${DIM}# update a single skill${RESET}
|
|
159
164
|
${DIM}$${RESET} skills update -g ${DIM}# update global skills only${RESET}
|
|
@@ -22,10 +22,52 @@ function formatInstalls(count) {
|
|
|
22
22
|
return `${(count / 1_000).toFixed(1).replace(/\.0$/, '')}K installs`;
|
|
23
23
|
return `${count} install${count === 1 ? '' : 's'}`;
|
|
24
24
|
}
|
|
25
|
+
const GITHUB_OWNER_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,38})$/i;
|
|
26
|
+
export function parseFindOptions(args) {
|
|
27
|
+
const queryParts = [];
|
|
28
|
+
const options = {};
|
|
29
|
+
const errors = [];
|
|
30
|
+
for (let i = 0; i < args.length; i++) {
|
|
31
|
+
const arg = args[i];
|
|
32
|
+
if (!arg)
|
|
33
|
+
continue;
|
|
34
|
+
let ownerValue;
|
|
35
|
+
if (arg === '--owner') {
|
|
36
|
+
const value = args[i + 1];
|
|
37
|
+
if (!value || value.startsWith('-')) {
|
|
38
|
+
errors.push('--owner requires a GitHub owner');
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
ownerValue = value;
|
|
42
|
+
i++;
|
|
43
|
+
}
|
|
44
|
+
else if (arg.startsWith('--owner=')) {
|
|
45
|
+
ownerValue = arg.slice('--owner='.length);
|
|
46
|
+
if (!ownerValue) {
|
|
47
|
+
errors.push('--owner requires a GitHub owner');
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
queryParts.push(arg);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const owner = ownerValue.trim().toLowerCase();
|
|
56
|
+
if (!GITHUB_OWNER_PATTERN.test(owner)) {
|
|
57
|
+
errors.push('--owner must be a valid GitHub owner');
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
options.owner = owner;
|
|
61
|
+
}
|
|
62
|
+
return { query: queryParts.join(' '), options, errors };
|
|
63
|
+
}
|
|
25
64
|
// Search via API
|
|
26
|
-
export async function searchSkillsAPI(query) {
|
|
65
|
+
export async function searchSkillsAPI(query, owner) {
|
|
27
66
|
try {
|
|
28
|
-
const
|
|
67
|
+
const params = new URLSearchParams({ q: query, limit: '10' });
|
|
68
|
+
if (owner)
|
|
69
|
+
params.set('owner', owner);
|
|
70
|
+
const url = `${SEARCH_API_BASE}/api/search?${params.toString()}`;
|
|
29
71
|
const res = await fetch(url);
|
|
30
72
|
if (!res.ok)
|
|
31
73
|
return [];
|
|
@@ -50,7 +92,7 @@ const CLEAR_DOWN = '\x1b[J';
|
|
|
50
92
|
const MOVE_UP = (n) => `\x1b[${n}A`;
|
|
51
93
|
const MOVE_TO_COL = (n) => `\x1b[${n}G`;
|
|
52
94
|
// Custom fzf-style search prompt using raw readline
|
|
53
|
-
async function runSearchPrompt(initialQuery = '') {
|
|
95
|
+
async function runSearchPrompt(initialQuery = '', owner) {
|
|
54
96
|
let results = [];
|
|
55
97
|
let selectedIndex = 0;
|
|
56
98
|
let query = initialQuery;
|
|
@@ -134,7 +176,7 @@ async function runSearchPrompt(initialQuery = '') {
|
|
|
134
176
|
const debounceMs = Math.max(150, 350 - q.length * 50);
|
|
135
177
|
debounceTimer = setTimeout(async () => {
|
|
136
178
|
try {
|
|
137
|
-
results = await searchSkillsAPI(q);
|
|
179
|
+
results = await searchSkillsAPI(q, owner);
|
|
138
180
|
selectedIndex = 0;
|
|
139
181
|
}
|
|
140
182
|
catch {
|
|
@@ -224,14 +266,21 @@ async function isRepoPublic(owner, repo) {
|
|
|
224
266
|
return isPrivate === false;
|
|
225
267
|
}
|
|
226
268
|
export async function runFind(args) {
|
|
227
|
-
const query = args
|
|
269
|
+
const { query, options: findOptions, errors } = parseFindOptions(args);
|
|
270
|
+
const owner = findOptions.owner;
|
|
228
271
|
const isNonInteractive = !process.stdin.isTTY;
|
|
229
272
|
const agentTip = `${DIM}Tip: if running in a coding agent, follow these steps:${RESET}
|
|
230
|
-
${DIM} 1) npx skills find [query]${RESET}
|
|
273
|
+
${DIM} 1) npx skills find [query] [--owner <owner>]${RESET}
|
|
231
274
|
${DIM} 2) npx skills add <owner/repo@skill>${RESET}`;
|
|
275
|
+
if (errors.length > 0) {
|
|
276
|
+
for (const error of errors)
|
|
277
|
+
console.error(error);
|
|
278
|
+
console.error('Usage: npx skills find <query> [--owner <owner>]');
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
232
281
|
// Non-interactive mode: just print results and exit
|
|
233
282
|
if (query) {
|
|
234
|
-
const results = await searchSkillsAPI(query);
|
|
283
|
+
const results = await searchSkillsAPI(query, owner);
|
|
235
284
|
// Track telemetry for non-interactive search
|
|
236
285
|
track({
|
|
237
286
|
event: 'find',
|
|
@@ -239,7 +288,8 @@ ${DIM} 2) npx skills add <owner/repo@skill>${RESET}`;
|
|
|
239
288
|
resultCount: String(results.length),
|
|
240
289
|
});
|
|
241
290
|
if (results.length === 0) {
|
|
242
|
-
|
|
291
|
+
const ownerSuffix = owner ? ` from owner "${owner}"` : '';
|
|
292
|
+
console.log(`${DIM}No skills found for "${query}"${ownerSuffix}${RESET}`);
|
|
243
293
|
return;
|
|
244
294
|
}
|
|
245
295
|
console.log(`${DIM}Install with${RESET} npx skills add <owner/repo@skill>`);
|
|
@@ -257,10 +307,10 @@ ${DIM} 2) npx skills add <owner/repo@skill>${RESET}`;
|
|
|
257
307
|
if (isNonInteractive || (await isRunningInAgent())) {
|
|
258
308
|
console.log(agentTip);
|
|
259
309
|
console.log();
|
|
260
|
-
console.log(`${DIM}Usage: npx skills find <query
|
|
310
|
+
console.log(`${DIM}Usage: npx skills find <query> [--owner <owner>]${RESET}`);
|
|
261
311
|
return;
|
|
262
312
|
}
|
|
263
|
-
const selected = await runSearchPrompt();
|
|
313
|
+
const selected = await runSearchPrompt('', owner);
|
|
264
314
|
// Track telemetry for interactive search
|
|
265
315
|
track({
|
|
266
316
|
event: 'find',
|
|
@@ -280,8 +330,8 @@ ${DIM} 2) npx skills add <owner/repo@skill>${RESET}`;
|
|
|
280
330
|
console.log(`${TEXT}Installing ${BOLD}${skillName}${RESET} from ${DIM}${pkg}${RESET}...`);
|
|
281
331
|
console.log();
|
|
282
332
|
// Run add directly since we're in the same CLI
|
|
283
|
-
const { source, options } = parseAddOptions([pkg, '--skill', skillName]);
|
|
284
|
-
await runAdd(source,
|
|
333
|
+
const { source, options: addOptions } = parseAddOptions([pkg, '--skill', skillName]);
|
|
334
|
+
await runAdd(source, addOptions);
|
|
285
335
|
console.log();
|
|
286
336
|
const info = getOwnerRepoFromString(pkg);
|
|
287
337
|
if (info && (await isRepoPublic(info.owner, info.repo))) {
|