@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.
@@ -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';
@@ -9,6 +10,7 @@ import { searchMultiselect } from './prompts/search-multiselect.ts';
9
10
 
10
11
  // Helper to check if a value is a cancel symbol (works with both clack and our custom prompts)
11
12
  const isCancelled = (value: unknown): value is symbol => typeof value === 'symbol';
13
+ const EVE_AGENT_LABEL = 'eve agent';
12
14
 
13
15
  /**
14
16
  * Check if a source identifier (owner/repo format) represents a private GitHub repo.
@@ -48,6 +50,7 @@ import {
48
50
  getVisibleUniversalAgents,
49
51
  getNonUniversalAgents,
50
52
  isUniversalAgent,
53
+ getEveSubagents,
51
54
  } from './agents.ts';
52
55
  import {
53
56
  track,
@@ -178,6 +181,13 @@ function shortenPath(fullPath: string, cwd: string): string {
178
181
  return fullPath;
179
182
  }
180
183
 
184
+ function computeSingleFileSkillHash(contents: string): string {
185
+ const hash = createHash('sha256');
186
+ hash.update('SKILL.md');
187
+ hash.update(contents);
188
+ return hash.digest('hex');
189
+ }
190
+
181
191
  /**
182
192
  * Formats a list of items, truncating if too many
183
193
  */
@@ -190,6 +200,18 @@ function formatList(items: string[], maxShow: number = 5): string {
190
200
  return `${shown.join(', ')} +${remaining} more`;
191
201
  }
192
202
 
203
+ function formatSkillPromptSubject(skills: Skill[]): string {
204
+ const names = skills.map((skill) => pc.cyan(getSkillDisplayName(skill)));
205
+ const namedSubject = formatList(names, 3);
206
+ return stripTerminalEscapes(namedSubject).length <= 80
207
+ ? namedSubject
208
+ : `${skills.length} selected skills`;
209
+ }
210
+
211
+ export function formatEveInstallPromptMessage(skills: Skill[]): string {
212
+ return `Detected an eve project. Install ${formatSkillPromptSubject(skills)} for your ${EVE_AGENT_LABEL} to use?`;
213
+ }
214
+
193
215
  /**
194
216
  * Splits agents into universal and non-universal (symlinked) groups.
195
217
  * Returns display names for each group.
@@ -235,6 +257,76 @@ function buildAgentSummaryLines(targetAgents: AgentType[], installMode: InstallM
235
257
  return lines;
236
258
  }
237
259
 
260
+ /**
261
+ * A concrete install destination. For Eve, `subagent` optionally targets a
262
+ * subagent's skills directory (`agent/subagents/<name>/skills`); when omitted
263
+ * the skill installs to the root agent (`agent/skills`). Other agents never set
264
+ * `subagent`.
265
+ */
266
+ interface InstallTarget {
267
+ agent: AgentType;
268
+ subagent?: string;
269
+ }
270
+
271
+ /** Human-readable label for an install target, e.g. "Eve (research)". */
272
+ function targetDisplayName(target: InstallTarget): string {
273
+ const base = agents[target.agent].displayName;
274
+ return target.subagent ? `${base} (${target.subagent})` : base;
275
+ }
276
+
277
+ /** Stable key used to deduplicate / index per-target state. */
278
+ function targetKey(target: InstallTarget): string {
279
+ return target.subagent ? `${target.agent}:${target.subagent}` : target.agent;
280
+ }
281
+
282
+ /**
283
+ * Expand the selected agents into concrete install targets, fanning Eve out
284
+ * across the chosen subagents (root and/or named subagents).
285
+ */
286
+ function buildInstallTargets(
287
+ targetAgents: AgentType[],
288
+ eveSubagentTargets: Array<string | undefined>
289
+ ): InstallTarget[] {
290
+ const targets: InstallTarget[] = [];
291
+ for (const agent of targetAgents) {
292
+ if (agent === 'eve') {
293
+ for (const subagent of eveSubagentTargets) {
294
+ targets.push({ agent, subagent });
295
+ }
296
+ } else {
297
+ targets.push({ agent });
298
+ }
299
+ }
300
+ return targets;
301
+ }
302
+
303
+ /**
304
+ * Builds summary lines showing universal vs symlinked agents and Eve subagents.
305
+ */
306
+ function buildTargetSummaryLines(targets: InstallTarget[], installMode: InstallMode): string[] {
307
+ const lines: string[] = [];
308
+ const rootAgents = targets.filter((t) => !t.subagent).map((t) => t.agent);
309
+ const subagentNames = targets.filter((t) => t.subagent).map(targetDisplayName);
310
+ const { universal, symlinked } = splitAgentsByType(rootAgents);
311
+
312
+ if (installMode === 'symlink') {
313
+ if (universal.length > 0) {
314
+ lines.push(` ${pc.green('universal:')} ${formatList(universal)}`);
315
+ }
316
+ if (symlinked.length > 0) {
317
+ lines.push(` ${pc.dim('symlink →')} ${formatList(symlinked)}`);
318
+ }
319
+ if (subagentNames.length > 0) {
320
+ lines.push(` ${pc.dim('copy →')} ${formatList(subagentNames)}`);
321
+ }
322
+ } else {
323
+ const allNames = targets.map(targetDisplayName);
324
+ lines.push(` ${pc.dim('copy →')} ${formatList(allNames)}`);
325
+ }
326
+
327
+ return lines;
328
+ }
329
+
238
330
  /**
239
331
  * Ensures universal agents are always included in the target agents list.
240
332
  * Used when -y flag is passed or when auto-selecting agents.
@@ -372,7 +464,9 @@ async function selectAgentsInteractive(options: {
372
464
 
373
465
  const universalAgents = getUniversalAgents().filter(supportsGlobalFilter);
374
466
  const visibleUniversalAgents = getVisibleUniversalAgents().filter(supportsGlobalFilter);
375
- const otherAgents = getNonUniversalAgents().filter(supportsGlobalFilter);
467
+ const otherAgents = getNonUniversalAgents().filter(
468
+ (agent) => agent !== 'eve' && supportsGlobalFilter(agent)
469
+ );
376
470
 
377
471
  // Universal agents shown as locked section
378
472
  const universalSection = {
@@ -433,6 +527,11 @@ export interface AddOptions {
433
527
  all?: boolean;
434
528
  fullDepth?: boolean;
435
529
  copy?: boolean;
530
+ /**
531
+ * Eve subagent targets. Each value is a subagent name; `root` (or `.`)
532
+ * selects the root agent. Implies installing for Eve.
533
+ */
534
+ subagent?: string[];
436
535
  dangerouslyAcceptOpenclawRisks?: boolean;
437
536
  }
438
537
 
@@ -1306,17 +1405,47 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1306
1405
  const totalAgents = Object.keys(agents).length;
1307
1406
  spinner.stop(`${totalAgents} agents`);
1308
1407
 
1309
- if (installedAgents.length === 0) {
1408
+ if (installedAgents.includes('eve') && (options.yes || !agentResult.isAgent)) {
1409
+ const useEve = options.yes
1410
+ ? true
1411
+ : await p.confirm({
1412
+ message: formatEveInstallPromptMessage(selectedSkills),
1413
+ initialValue: true,
1414
+ });
1415
+
1416
+ if (p.isCancel(useEve)) {
1417
+ p.cancel('Installation cancelled');
1418
+ await cleanup(tempDir);
1419
+ process.exit(0);
1420
+ }
1421
+
1422
+ if (useEve) {
1423
+ targetAgents = ['eve'];
1424
+ p.log.info(`Installing to: ${pc.cyan(EVE_AGENT_LABEL)}`);
1425
+ } else {
1426
+ const selected = await selectAgentsInteractive({ global: options.global });
1427
+
1428
+ if (p.isCancel(selected)) {
1429
+ p.cancel('Installation cancelled');
1430
+ await cleanup(tempDir);
1431
+ process.exit(0);
1432
+ }
1433
+
1434
+ targetAgents = selected as AgentType[];
1435
+ }
1436
+ } else if (installedAgents.length === 0) {
1310
1437
  if (options.yes) {
1311
1438
  targetAgents = validAgents as AgentType[];
1312
1439
  p.log.info('Installing to all agents');
1313
1440
  } else {
1314
1441
  p.log.info('Select agents to install skills to');
1315
1442
 
1316
- const allAgentChoices = Object.entries(agents).map(([key, config]) => ({
1317
- value: key as AgentType,
1318
- label: config.displayName,
1319
- }));
1443
+ const allAgentChoices = Object.entries(agents)
1444
+ .filter(([key]) => key !== 'eve')
1445
+ .map(([key, config]) => ({
1446
+ value: key as AgentType,
1447
+ label: config.displayName,
1448
+ }));
1320
1449
 
1321
1450
  // Use helper to prompt with search
1322
1451
  const selected = await promptForAgents(
@@ -1356,6 +1485,52 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1356
1485
  }
1357
1486
  }
1358
1487
 
1488
+ // An explicit --subagent flag implies the user wants to target Eve.
1489
+ if (options.subagent && options.subagent.length > 0 && !targetAgents.includes('eve')) {
1490
+ targetAgents = [...targetAgents, 'eve'];
1491
+ }
1492
+
1493
+ // Eve supports subagents, each with their own skills directory at
1494
+ // agent/subagents/<name>/skills in addition to the root agent/skills.
1495
+ // When Eve is a target, choose which of those to install into.
1496
+ let eveSubagentTargets: Array<string | undefined> = [undefined];
1497
+ if (targetAgents.includes('eve')) {
1498
+ const availableSubagents = getEveSubagents(process.cwd());
1499
+
1500
+ if (options.subagent && options.subagent.length > 0) {
1501
+ // Non-interactive: 'root' or '.' selects the root agent.
1502
+ eveSubagentTargets = options.subagent.map((s) =>
1503
+ s === 'root' || s === '.' ? undefined : s
1504
+ );
1505
+ } else if (availableSubagents.length > 0 && !options.yes) {
1506
+ const subagentChoices = [
1507
+ { value: '', label: 'Root agent', hint: 'agent/skills' },
1508
+ ...availableSubagents.map((name) => ({
1509
+ value: name,
1510
+ label: name,
1511
+ hint: `agent/subagents/${name}/skills`,
1512
+ })),
1513
+ ];
1514
+
1515
+ const selectedSubagents = await p.multiselect({
1516
+ message: 'Where should Eve skills be installed?',
1517
+ options: subagentChoices,
1518
+ initialValues: [''],
1519
+ required: true,
1520
+ });
1521
+
1522
+ if (p.isCancel(selectedSubagents)) {
1523
+ p.cancel('Installation cancelled');
1524
+ await cleanup(tempDir);
1525
+ process.exit(0);
1526
+ }
1527
+
1528
+ eveSubagentTargets = (selectedSubagents as string[]).map((s) => (s === '' ? undefined : s));
1529
+ }
1530
+ }
1531
+
1532
+ const installTargets = buildInstallTargets(targetAgents, eveSubagentTargets);
1533
+
1359
1534
  let installGlobally = options.global ?? false;
1360
1535
 
1361
1536
  // Check if any selected agents support global installation
@@ -1391,10 +1566,17 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1391
1566
  let installMode: InstallMode = options.copy ? 'copy' : 'symlink';
1392
1567
 
1393
1568
  // Only prompt for install mode when there are multiple unique target directories.
1394
- // When all selected agents share the same skillsDir, symlink vs copy is meaningless.
1395
- const uniqueDirs = new Set(targetAgents.map((a) => agents[a].skillsDir));
1569
+ // When all selected targets share the same skillsDir, symlink vs copy is meaningless.
1570
+ // Eve writes skill files directly into each (sub)agent dir, so a symlink prompt is
1571
+ // never meaningful when every target is Eve.
1572
+ const allEve = installTargets.every((t) => t.agent === 'eve');
1573
+ const uniqueDirs = new Set(
1574
+ installTargets.map((t) =>
1575
+ t.subagent ? `eve:subagent:${t.subagent}` : agents[t.agent].skillsDir
1576
+ )
1577
+ );
1396
1578
 
1397
- if (!options.copy && !options.yes && uniqueDirs.size > 1) {
1579
+ if (!options.copy && !options.yes && uniqueDirs.size > 1 && !allEve) {
1398
1580
  const modeChoice = await p.select({
1399
1581
  message: 'Installation method',
1400
1582
  options: [
@@ -1414,8 +1596,8 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1414
1596
  }
1415
1597
 
1416
1598
  installMode = modeChoice as InstallMode;
1417
- } else if (uniqueDirs.size <= 1) {
1418
- // Single target directory — default to copy (no symlink needed)
1599
+ } else if (uniqueDirs.size <= 1 || allEve) {
1600
+ // Single target directory (or all-Eve) — default to copy (no symlink needed)
1419
1601
  installMode = 'copy';
1420
1602
  }
1421
1603
 
@@ -1423,24 +1605,27 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1423
1605
 
1424
1606
  // Build installation summary
1425
1607
  const summaryLines: string[] = [];
1426
- const agentNames = targetAgents.map((a) => agents[a].displayName);
1427
1608
 
1428
1609
  // Check if any skill will be overwritten (parallel)
1429
1610
  const overwriteChecks = await Promise.all(
1430
1611
  selectedSkills.flatMap((skill) =>
1431
- targetAgents.map(async (agent) => ({
1612
+ installTargets.map(async (target) => ({
1432
1613
  skillName: skill.name,
1433
- agent,
1434
- installed: await isSkillInstalled(skill.name, agent, { global: installGlobally }),
1614
+ target,
1615
+ installed: await isSkillInstalled(skill.name, target.agent, {
1616
+ global: installGlobally,
1617
+ eveSubagent: target.subagent,
1618
+ }),
1435
1619
  }))
1436
1620
  )
1437
1621
  );
1622
+ // Keyed by skill name → target key → installed?
1438
1623
  const overwriteStatus = new Map<string, Map<string, boolean>>();
1439
- for (const { skillName, agent, installed } of overwriteChecks) {
1624
+ for (const { skillName, target, installed } of overwriteChecks) {
1440
1625
  if (!overwriteStatus.has(skillName)) {
1441
1626
  overwriteStatus.set(skillName, new Map());
1442
1627
  }
1443
- overwriteStatus.get(skillName)!.set(agent, installed);
1628
+ overwriteStatus.get(skillName)!.set(targetKey(target), installed);
1444
1629
  }
1445
1630
 
1446
1631
  // Group selected skills for summary
@@ -1462,15 +1647,22 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1462
1647
  for (const skill of skills) {
1463
1648
  if (summaryLines.length > 0) summaryLines.push('');
1464
1649
 
1465
- const canonicalPath = getCanonicalPath(skill.name, { global: installGlobally });
1650
+ const canonicalPath =
1651
+ installTargets.length === 1
1652
+ ? getCanonicalPath(skill.name, {
1653
+ global: installGlobally,
1654
+ agent: installTargets[0]!.agent,
1655
+ eveSubagent: installTargets[0]!.subagent,
1656
+ })
1657
+ : getCanonicalPath(skill.name, { global: installGlobally });
1466
1658
  const shortCanonical = shortenPath(canonicalPath, cwd);
1467
1659
  summaryLines.push(`${pc.cyan(shortCanonical)}`);
1468
- summaryLines.push(...buildAgentSummaryLines(targetAgents, installMode));
1660
+ summaryLines.push(...buildTargetSummaryLines(installTargets, installMode));
1469
1661
 
1470
1662
  const skillOverwrites = overwriteStatus.get(skill.name);
1471
- const overwriteAgents = targetAgents
1472
- .filter((a) => skillOverwrites?.get(a))
1473
- .map((a) => agents[a].displayName);
1663
+ const overwriteAgents = installTargets
1664
+ .filter((t) => skillOverwrites?.get(targetKey(t)))
1665
+ .map(targetDisplayName);
1474
1666
 
1475
1667
  if (overwriteAgents.length > 0) {
1476
1668
  summaryLines.push(` ${pc.yellow('overwrites:')} ${formatList(overwriteAgents)}`);
@@ -1549,7 +1741,8 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1549
1741
  }[] = [];
1550
1742
 
1551
1743
  for (const skill of selectedSkills) {
1552
- for (const agent of targetAgents) {
1744
+ for (const target of installTargets) {
1745
+ const { agent, subagent } = target;
1553
1746
  let result;
1554
1747
  if (blobResult && 'files' in skill) {
1555
1748
  // Blob-based install: write files from snapshot
@@ -1557,6 +1750,13 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1557
1750
  result = await installBlobSkillForAgent(
1558
1751
  { installName: blobSkill.name, files: blobSkill.files },
1559
1752
  agent,
1753
+ { global: installGlobally, mode: installMode, eveSubagent: subagent }
1754
+ );
1755
+ } else if (tempDir && skill.path === tempDir && skill.rawContent) {
1756
+ // Remote root-level SKILL.md: install the skill file, not the whole repository.
1757
+ result = await installBlobSkillForAgent(
1758
+ { installName: skill.name, files: [{ path: 'SKILL.md', contents: skill.rawContent }] },
1759
+ agent,
1560
1760
  { global: installGlobally, mode: installMode }
1561
1761
  );
1562
1762
  } else {
@@ -1564,11 +1764,12 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1564
1764
  result = await installSkillForAgent(skill, agent, {
1565
1765
  global: installGlobally,
1566
1766
  mode: installMode,
1767
+ eveSubagent: subagent,
1567
1768
  });
1568
1769
  }
1569
1770
  results.push({
1570
1771
  skill: getSkillDisplayName(skill),
1571
- agent: agents[agent].displayName,
1772
+ agent: targetDisplayName(target),
1572
1773
  pluginName: skill.pluginName,
1573
1774
  ...result,
1574
1775
  });
@@ -1701,6 +1902,14 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1701
1902
  // Add to local lock file for project-scoped installs
1702
1903
  if (successful.length > 0 && !installGlobally) {
1703
1904
  const successfulSkillNames = new Set(successful.map((r) => r.skill));
1905
+ // Record Eve subagent placement (root = '') so `update` can restore it.
1906
+ // Only meaningful when Eve is among the targets and a non-root subagent
1907
+ // was selected; otherwise omit for a clean, minimal lock entry.
1908
+ const eveSubagents = targetAgents.includes('eve')
1909
+ ? eveSubagentTargets.map((s) => s ?? '')
1910
+ : undefined;
1911
+ const recordSubagents =
1912
+ eveSubagents && (eveSubagents.length > 1 || eveSubagents.some((s) => s !== ''));
1704
1913
  for (const skill of selectedSkills) {
1705
1914
  const skillDisplayName = getSkillDisplayName(skill);
1706
1915
  if (successfulSkillNames.has(skillDisplayName)) {
@@ -1709,7 +1918,9 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1709
1918
  const computedHash =
1710
1919
  blobResult && 'snapshotHash' in skill
1711
1920
  ? (skill as BlobSkill).snapshotHash
1712
- : await computeSkillFolderHash(skill.path);
1921
+ : tempDir && skill.path === tempDir && skill.rawContent
1922
+ ? computeSingleFileSkillHash(skill.rawContent)
1923
+ : await computeSkillFolderHash(skill.path);
1713
1924
  const skillPathValue = skillFiles[skill.name];
1714
1925
  await addSkillToLocalLock(
1715
1926
  skill.name,
@@ -1719,6 +1930,7 @@ export async function runAdd(args: string[], options: AddOptions = {}): Promise<
1719
1930
  sourceType: parsed.type,
1720
1931
  ...(skillPathValue && { skillPath: skillPathValue }),
1721
1932
  computedHash,
1933
+ ...(recordSubagents && { subagents: eveSubagents }),
1722
1934
  },
1723
1935
  cwd
1724
1936
  );
@@ -1982,6 +2194,16 @@ export function parseAddOptions(args: string[]): { source: string[]; options: Ad
1982
2194
  options.copy = true;
1983
2195
  } else if (arg === '--dangerously-accept-openclaw-risks') {
1984
2196
  options.dangerouslyAcceptOpenclawRisks = true;
2197
+ } else if (arg === '--subagent') {
2198
+ options.subagent = options.subagent || [];
2199
+ i++;
2200
+ let nextArg = args[i];
2201
+ while (i < args.length && nextArg && !nextArg.startsWith('-')) {
2202
+ options.subagent.push(nextArg);
2203
+ i++;
2204
+ nextArg = args[i];
2205
+ }
2206
+ i--; // Back up one since the loop will increment
1985
2207
  } else if (arg && !arg.startsWith('-')) {
1986
2208
  source.push(arg);
1987
2209
  }
@@ -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
  import type { AgentConfig, AgentType } from './types.ts';
6
6
 
@@ -21,6 +21,20 @@ const autohandHome = process.env.AUTOHAND_HOME?.trim() || join(home, '.autohand'
21
21
  const zedAppDataHome = process.env.APPDATA?.trim();
22
22
  const zedFlatpakConfigHome = process.env.FLATPAK_XDG_CONFIG_HOME?.trim();
23
23
 
24
+ function packageJsonHasDependency(packageJsonPath: string, dependencyName: string): boolean {
25
+ try {
26
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {
27
+ dependencies?: Record<string, unknown>;
28
+ devDependencies?: Record<string, unknown>;
29
+ };
30
+ return !!(
31
+ packageJson.dependencies?.[dependencyName] || packageJson.devDependencies?.[dependencyName]
32
+ );
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+
24
38
  export function getOpenClawGlobalSkillsDir(
25
39
  homeDir = home,
26
40
  pathExists: (path: string) => boolean = existsSync
@@ -268,6 +282,18 @@ export const agents: Record<AgentType, AgentConfig> = {
268
282
  return existsSync(join(home, '.factory'));
269
283
  },
270
284
  },
285
+ eve: {
286
+ name: 'eve',
287
+ displayName: 'Eve',
288
+ skillsDir: 'agent/skills',
289
+ globalSkillsDir: undefined,
290
+ detectInstalled: async () => {
291
+ const cwd = process.cwd();
292
+ return (
293
+ existsSync(join(cwd, 'agent')) && packageJsonHasDependency(join(cwd, 'package.json'), 'eve')
294
+ );
295
+ },
296
+ },
271
297
  firebender: {
272
298
  name: 'firebender',
273
299
  displayName: 'Firebender',
@@ -709,6 +735,36 @@ export function getAgentConfig(type: AgentType): AgentConfig {
709
735
  return agents[type];
710
736
  }
711
737
 
738
+ /**
739
+ * Directory (relative to an Eve project root) that holds subagents.
740
+ * Each subagent owns its own skills at `agent/subagents/<name>/skills`,
741
+ * mirroring the root agent's `agent/skills`.
742
+ */
743
+ export const EVE_SUBAGENTS_DIR = join('agent', 'subagents');
744
+
745
+ /**
746
+ * Discover the names of Eve subagents in a project.
747
+ *
748
+ * Eve supports subagents that each have their own skills directory at
749
+ * `agent/subagents/<name>/skills`. This returns the `<name>` of every
750
+ * subagent directory found under `agent/subagents/`, sorted alphabetically.
751
+ * Returns an empty list when the directory doesn't exist or can't be read.
752
+ */
753
+ export function getEveSubagents(cwd: string = process.cwd()): string[] {
754
+ const dir = join(cwd, EVE_SUBAGENTS_DIR);
755
+ if (!existsSync(dir)) {
756
+ return [];
757
+ }
758
+ try {
759
+ return readdirSync(dir, { withFileTypes: true })
760
+ .filter((entry) => entry.isDirectory())
761
+ .map((entry) => entry.name)
762
+ .sort();
763
+ } catch {
764
+ return [];
765
+ }
766
+ }
767
+
712
768
  /**
713
769
  * Returns agents that use the universal .agents/skills directory.
714
770
  * These agents share a common skill location and don't need symlinks.
@@ -10,6 +10,7 @@
10
10
  * 3. skills.sh/api/download → fetch full file contents from cached blob
11
11
  */
12
12
 
13
+ import { createHash } from 'node:crypto';
13
14
  import { parseFrontmatter } from './frontmatter.ts';
14
15
  import { sanitizeMetadata } from './sanitize.ts';
15
16
  import type { Skill } from './types.ts';
@@ -420,6 +421,15 @@ export interface BlobInstallResult {
420
421
  tree: RepoTree;
421
422
  }
422
423
 
424
+ function computeSnapshotHash(files: SkillSnapshotFile[]): string {
425
+ const hash = createHash('sha256');
426
+ for (const file of [...files].sort((a, b) => a.path.localeCompare(b.path))) {
427
+ hash.update(file.path);
428
+ hash.update(file.contents);
429
+ }
430
+ return hash.digest('hex');
431
+ }
432
+
423
433
  /**
424
434
  * Attempt to resolve skills from blob storage instead of cloning.
425
435
  *
@@ -549,6 +559,16 @@ export async function tryBlobInstall(
549
559
  ? ''
550
560
  : skill.mdPath.slice(0, -(1 + 'SKILL.md'.length));
551
561
 
562
+ // A root-level SKILL.md means the repository root is a skill entrypoint,
563
+ // not that the entire repository is installable skill payload. Some cached
564
+ // snapshots for root skills contain every repo file; installing those can
565
+ // dump thousands of unrelated files into .agents/skills/<name>. Keep root
566
+ // skills to their SKILL.md unless/until the skill spec gains an explicit
567
+ // include list for supporting files.
568
+ const files = folderPath
569
+ ? download!.files
570
+ : download!.files.filter((file) => file.path.toLowerCase() === 'skill.md');
571
+
552
572
  return {
553
573
  name: skill.name,
554
574
  description: skill.description,
@@ -557,8 +577,9 @@ export async function tryBlobInstall(
557
577
  path: '',
558
578
  rawContent: skill.content,
559
579
  metadata: skill.metadata,
560
- files: download!.files,
561
- snapshotHash: download!.hash,
580
+ files,
581
+ snapshotHash:
582
+ files.length === download!.files.length ? download!.hash : computeSnapshotHash(files),
562
583
  repoPath: skill.mdPath,
563
584
  };
564
585
  });
@@ -115,6 +115,9 @@ ${BOLD}Manage Skills:${RESET}
115
115
  list, ls List installed skills
116
116
  find [query] Search for skills interactively
117
117
 
118
+ ${BOLD}Find Options:${RESET}
119
+ --owner <owner> Search only repositories from a GitHub owner
120
+
118
121
  ${BOLD}Updates:${RESET}
119
122
  update [skills...] Update skills to latest versions (alias: upgrade)
120
123
 
@@ -135,6 +138,7 @@ ${BOLD}Add Options:${RESET}
135
138
  -l, --list List available skills in the repository without installing
136
139
  -y, --yes Skip confirmation prompts
137
140
  --copy Copy files instead of symlinking to agent directories
141
+ --subagent <names> Install to Eve subagents (use 'root' for the root agent)
138
142
  --all Shorthand for --skill '*' --agent '*' -y
139
143
  --full-depth Search all subdirectories even when a root SKILL.md exists
140
144
 
@@ -181,6 +185,7 @@ ${BOLD}Examples:${RESET}
181
185
  ${DIM}$${RESET} skills ls --json ${DIM}# JSON output${RESET}
182
186
  ${DIM}$${RESET} skills find ${DIM}# interactive search${RESET}
183
187
  ${DIM}$${RESET} skills find typescript ${DIM}# search by keyword${RESET}
188
+ ${DIM}$${RESET} skills find react --owner vercel ${DIM}# search within an owner${RESET}
184
189
  ${DIM}$${RESET} skills update
185
190
  ${DIM}$${RESET} skills update my-skill ${DIM}# update a single skill${RESET}
186
191
  ${DIM}$${RESET} skills update -g ${DIM}# update global skills only${RESET}