@rbbtsn0w/adg 0.10.1-dev.pr151.b79dccc → 0.10.1-dev.pr152.b8c43a6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/vendor/skills/src/add.js +594 -278
- package/dist/vendor/skills/src/agents.js +42 -7
- package/dist/vendor/skills/src/blob.js +92 -38
- package/dist/vendor/skills/src/cli.js +54 -26
- package/dist/vendor/skills/src/download-source.js +9 -6
- package/dist/vendor/skills/src/frontmatter.js +1 -1
- package/dist/vendor/skills/src/git.js +83 -2
- package/dist/vendor/skills/src/install.js +23 -12
- package/dist/vendor/skills/src/installer.js +64 -38
- package/dist/vendor/skills/src/local-lock.js +18 -7
- package/dist/vendor/skills/src/notion-test.js +440 -0
- package/dist/vendor/skills/src/prompts/search-multiselect.js +22 -0
- package/dist/vendor/skills/src/remove.js +31 -10
- package/dist/vendor/skills/src/skill-relocation.js +56 -0
- package/dist/vendor/skills/src/skills-field.js +50 -0
- package/dist/vendor/skills/src/skills.js +73 -53
- package/dist/vendor/skills/src/source-parser.js +75 -1
- package/dist/vendor/skills/src/sync.js +606 -186
- package/dist/vendor/skills/src/telemetry.js +1 -1
- package/dist/vendor/skills/src/test-utils.js +5 -8
- package/dist/vendor/skills/src/update.js +135 -50
- package/dist/vendor/skills/src/use.js +2 -1
- package/package.json +1 -1
- package/vendor/skills/PROVENANCE.md +130 -10
- package/vendor/skills/ThirdPartyNoticeText.txt +4 -4
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import * as p from '@clack/prompts';
|
|
2
2
|
import pc from 'picocolors';
|
|
3
3
|
import { readLocalLock } from './local-lock.js';
|
|
4
|
-
import { runAdd } from './add.js';
|
|
4
|
+
import { installFromSource, runAdd } from './add.js';
|
|
5
5
|
import { runSync, parseSyncOptions } from './sync.js';
|
|
6
6
|
import { getUniversalAgents } from './agents.js';
|
|
7
7
|
import { buildLocalUpdateSource } from './update-source.js';
|
|
8
|
+
import { parseSource } from './source-parser.js';
|
|
8
9
|
/**
|
|
9
10
|
* Install all skills from the local skills-lock.json.
|
|
10
|
-
* Groups skills by source and
|
|
11
|
+
* Groups skills by source and installs each group; a failing source does not
|
|
12
|
+
* stop the others.
|
|
11
13
|
*
|
|
12
14
|
* Only installs to .agents/skills/ (universal agents) -- the canonical
|
|
13
15
|
* project-level location. Does not install to agent-specific directories.
|
|
14
16
|
*
|
|
15
|
-
* node_modules skills are handled via
|
|
17
|
+
* node_modules skills are handled via sync.
|
|
16
18
|
*/
|
|
17
19
|
export async function runInstallFromLock(args) {
|
|
18
20
|
const cwd = process.cwd();
|
|
@@ -54,17 +56,26 @@ export async function runInstallFromLock(args) {
|
|
|
54
56
|
p.log.info(`Restoring ${pc.cyan(String(remoteCount))} skill${remoteCount !== 1 ? 's' : ''} from skills-lock.json into ${pc.dim('.agents/skills/')}`);
|
|
55
57
|
}
|
|
56
58
|
// Install remote skills grouped by source
|
|
57
|
-
for (const [source, { skills }] of bySource) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
yes: true,
|
|
63
|
-
});
|
|
59
|
+
for (const [source, { sourceType, skills }] of bySource) {
|
|
60
|
+
// well-known sources go through their provider flow, which installs on its own
|
|
61
|
+
if (sourceType === 'well-known') {
|
|
62
|
+
await runAdd([source], { skill: skills, agent: universalAgentNames, yes: true });
|
|
63
|
+
continue;
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const result = await installFromSource(parseSource(source), {
|
|
66
|
+
skills,
|
|
67
|
+
agents: universalAgentNames,
|
|
68
|
+
});
|
|
69
|
+
if (result.error) {
|
|
70
|
+
p.log.error(`Failed to install from ${pc.cyan(source)}: ${result.error}`);
|
|
71
|
+
process.exitCode = 1;
|
|
72
|
+
continue;
|
|
67
73
|
}
|
|
74
|
+
p.log.success(`Restored ${result.installed.map((name) => pc.cyan(name)).join(', ')}`);
|
|
75
|
+
for (const failure of result.failed)
|
|
76
|
+
p.log.error(failure);
|
|
77
|
+
if (result.failed.length > 0)
|
|
78
|
+
process.exitCode = 1;
|
|
68
79
|
}
|
|
69
80
|
// Handle node_modules skills via sync
|
|
70
81
|
if (nodeModuleSkills.length > 0) {
|
|
@@ -5,6 +5,7 @@ import { homedir, platform } from 'os';
|
|
|
5
5
|
import { agents, detectInstalledAgents, isUniversalAgent, getEveSubagents, EVE_SUBAGENTS_DIR, } from './agents.js';
|
|
6
6
|
import { AGENTS_DIR, SKILLS_SUBDIR } from './constants.js';
|
|
7
7
|
import { parseFrontmatter } from './frontmatter.js';
|
|
8
|
+
import { stringify } from 'yaml';
|
|
8
9
|
import { parseSkillMd } from './skills.js';
|
|
9
10
|
/**
|
|
10
11
|
* Sanitizes a filename/directory name to prevent path traversal attacks
|
|
@@ -41,6 +42,16 @@ function isPathSafe(basePath, targetPath) {
|
|
|
41
42
|
function pathsOverlap(pathA, pathB) {
|
|
42
43
|
return isPathSafe(pathA, pathB) || isPathSafe(pathB, pathA);
|
|
43
44
|
}
|
|
45
|
+
function shouldSkipProjectAgentSymlink(agentType, isGlobal, cwd, createMissingAgentRoot) {
|
|
46
|
+
if (isGlobal ||
|
|
47
|
+
isUniversalAgent(agentType) ||
|
|
48
|
+
createMissingAgentRoot ||
|
|
49
|
+
agents[agentType].createProjectSkillsDirByDefault) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const agentRoot = agents[agentType].skillsDir.split('/')[0];
|
|
53
|
+
return !existsSync(join(cwd, agentRoot));
|
|
54
|
+
}
|
|
44
55
|
// Dirent.isDirectory() is false for symlinks; follow and verify the target is a directory.
|
|
45
56
|
async function isDirEntryOrSymlinkToDir(entry, entryPath) {
|
|
46
57
|
if (entry.isDirectory())
|
|
@@ -270,18 +281,31 @@ export async function installSkillForAgent(skill, agentType, options = {}) {
|
|
|
270
281
|
mode: 'copy',
|
|
271
282
|
};
|
|
272
283
|
}
|
|
273
|
-
|
|
284
|
+
const sourceIsCanonical = resolve(skill.path) === resolve(canonicalDir);
|
|
285
|
+
if (!sourceIsCanonical && pathsOverlap(skill.path, canonicalDir)) {
|
|
274
286
|
return {
|
|
275
287
|
success: true,
|
|
276
288
|
path: canonicalDir,
|
|
277
289
|
canonicalPath: canonicalDir,
|
|
278
|
-
mode:
|
|
290
|
+
mode: installMode,
|
|
279
291
|
skipped: true,
|
|
280
292
|
};
|
|
281
293
|
}
|
|
282
|
-
//
|
|
283
|
-
|
|
284
|
-
|
|
294
|
+
// Reuse an existing canonical copy when only adding another agent's link.
|
|
295
|
+
if (!sourceIsCanonical) {
|
|
296
|
+
if (installMode === 'link') {
|
|
297
|
+
// Link mode: the canonical dir itself points at the source, nothing is copied.
|
|
298
|
+
if (!(await createSymlink(skill.path, canonicalDir))) {
|
|
299
|
+
await cleanAndCreateDirectory(canonicalDir);
|
|
300
|
+
await copyDirectory(skill.path, canonicalDir, agentType);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
// Symlink mode: copy to canonical location and symlink to agent location
|
|
305
|
+
await cleanAndCreateDirectory(canonicalDir);
|
|
306
|
+
await copyDirectory(skill.path, canonicalDir, agentType);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
285
309
|
// For universal agents with global install, the skill is already in the canonical
|
|
286
310
|
// ~/.agents/skills directory. Skip creating a symlink to the agent-specific global dir
|
|
287
311
|
// (e.g. ~/.copilot/skills) to avoid duplicates.
|
|
@@ -290,24 +314,22 @@ export async function installSkillForAgent(skill, agentType, options = {}) {
|
|
|
290
314
|
success: true,
|
|
291
315
|
path: canonicalDir,
|
|
292
316
|
canonicalPath: canonicalDir,
|
|
293
|
-
mode:
|
|
317
|
+
mode: installMode,
|
|
294
318
|
};
|
|
295
319
|
}
|
|
296
320
|
// For project-level installs, skip creating symlinks for non-universal agents
|
|
297
321
|
// whose config directory doesn't already exist in the project. This prevents
|
|
298
322
|
// creating directories like .windsurf/, .kiro/, etc. when those agents aren't
|
|
299
323
|
// actually used in this project. The skill is already available in .agents/skills/.
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
310
|
-
}
|
|
324
|
+
if (shouldSkipProjectAgentSymlink(agentType, isGlobal, cwd, options.createMissingAgentRoot ?? false)) {
|
|
325
|
+
return {
|
|
326
|
+
success: true,
|
|
327
|
+
path: canonicalDir,
|
|
328
|
+
canonicalPath: canonicalDir,
|
|
329
|
+
mode: installMode,
|
|
330
|
+
skipped: true,
|
|
331
|
+
skipReason: 'missing-agent-project-directory',
|
|
332
|
+
};
|
|
311
333
|
}
|
|
312
334
|
const symlinkCreated = await createSymlink(canonicalDir, agentDir);
|
|
313
335
|
if (!symlinkCreated) {
|
|
@@ -318,7 +340,7 @@ export async function installSkillForAgent(skill, agentType, options = {}) {
|
|
|
318
340
|
success: true,
|
|
319
341
|
path: agentDir,
|
|
320
342
|
canonicalPath: canonicalDir,
|
|
321
|
-
mode:
|
|
343
|
+
mode: installMode,
|
|
322
344
|
symlinkFailed: true,
|
|
323
345
|
};
|
|
324
346
|
}
|
|
@@ -326,7 +348,7 @@ export async function installSkillForAgent(skill, agentType, options = {}) {
|
|
|
326
348
|
success: true,
|
|
327
349
|
path: agentDir,
|
|
328
350
|
canonicalPath: canonicalDir,
|
|
329
|
-
mode:
|
|
351
|
+
mode: installMode,
|
|
330
352
|
};
|
|
331
353
|
}
|
|
332
354
|
catch (error) {
|
|
@@ -350,23 +372,30 @@ const isExcluded = (name, isDirectory = false) => {
|
|
|
350
372
|
function stripIgnoredEveFrontmatter(raw) {
|
|
351
373
|
const { data, content } = parseFrontmatter(raw);
|
|
352
374
|
const eveData = {};
|
|
375
|
+
if (typeof data.name === 'string') {
|
|
376
|
+
eveData.name = data.name;
|
|
377
|
+
}
|
|
353
378
|
if (typeof data.description === 'string') {
|
|
354
379
|
eveData.description = data.description;
|
|
355
380
|
}
|
|
356
381
|
if (typeof data.license === 'string') {
|
|
357
382
|
eveData.license = data.license;
|
|
358
383
|
}
|
|
384
|
+
if (data.compatibility !== undefined) {
|
|
385
|
+
eveData.compatibility = data.compatibility;
|
|
386
|
+
}
|
|
387
|
+
if (typeof data.version === 'string' || typeof data.version === 'number') {
|
|
388
|
+
eveData.version = data.version;
|
|
389
|
+
}
|
|
359
390
|
if (data.metadata && typeof data.metadata === 'object' && !Array.isArray(data.metadata)) {
|
|
360
|
-
|
|
361
|
-
if (Object.keys(metadata).length > 0) {
|
|
362
|
-
eveData.metadata = metadata;
|
|
363
|
-
}
|
|
391
|
+
eveData.metadata = data.metadata;
|
|
364
392
|
}
|
|
365
393
|
const keys = Object.keys(eveData);
|
|
366
394
|
if (keys.length === 0) {
|
|
367
395
|
return content.replace(/^\r?\n/u, '');
|
|
368
396
|
}
|
|
369
|
-
|
|
397
|
+
// Real nested YAML, not inline JSON
|
|
398
|
+
const frontmatter = stringify(eveData).trimEnd();
|
|
370
399
|
return `---\n${frontmatter}\n---\n${content.replace(/^\r?\n/u, '')}`;
|
|
371
400
|
}
|
|
372
401
|
async function copyDirectory(src, dest, agentType) {
|
|
@@ -804,20 +833,17 @@ export async function installBlobSkillForAgent(skill, agentType, options = {}) {
|
|
|
804
833
|
};
|
|
805
834
|
}
|
|
806
835
|
// For project-level installs, skip creating symlinks for non-universal agents
|
|
807
|
-
// whose config directory doesn't already exist in the project.
|
|
808
|
-
//
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
skipped: true,
|
|
819
|
-
};
|
|
820
|
-
}
|
|
836
|
+
// whose config directory doesn't already exist in the project. Explicitly
|
|
837
|
+
// selected agents and agents with a compatibility policy are exempt.
|
|
838
|
+
if (shouldSkipProjectAgentSymlink(agentType, isGlobal, cwd, options.createMissingAgentRoot ?? false)) {
|
|
839
|
+
return {
|
|
840
|
+
success: true,
|
|
841
|
+
path: canonicalDir,
|
|
842
|
+
canonicalPath: canonicalDir,
|
|
843
|
+
mode: 'symlink',
|
|
844
|
+
skipped: true,
|
|
845
|
+
skipReason: 'missing-agent-project-directory',
|
|
846
|
+
};
|
|
821
847
|
}
|
|
822
848
|
const symlinkCreated = await createSymlink(canonicalDir, agentDir);
|
|
823
849
|
if (!symlinkCreated) {
|
|
@@ -45,14 +45,17 @@ export async function writeLocalLock(lock, cwd) {
|
|
|
45
45
|
const lockDir = cwd || process.cwd();
|
|
46
46
|
const lockPath = getLocalLockPath(lockDir);
|
|
47
47
|
// Sort skills alphabetically for deterministic output / clean diffs
|
|
48
|
-
const sortedSkills =
|
|
49
|
-
|
|
48
|
+
const sortedSkills = Object.fromEntries(Object.keys(lock.skills)
|
|
49
|
+
.sort()
|
|
50
|
+
.map((key) => {
|
|
50
51
|
const entry = lock.skills[key];
|
|
51
|
-
|
|
52
|
+
return [
|
|
53
|
+
key,
|
|
52
54
|
entry.sourceType === 'local'
|
|
53
55
|
? { ...entry, source: getPortableLocalSource(entry.source, lockDir) }
|
|
54
|
-
: entry
|
|
55
|
-
|
|
56
|
+
: entry,
|
|
57
|
+
];
|
|
58
|
+
}));
|
|
56
59
|
const sorted = { version: lock.version, skills: sortedSkills };
|
|
57
60
|
const content = JSON.stringify(sorted, null, 2) + '\n';
|
|
58
61
|
await writeFile(lockPath, content, 'utf-8');
|
|
@@ -71,6 +74,14 @@ function getPortableLocalSource(source, lockDir) {
|
|
|
71
74
|
return portableSource;
|
|
72
75
|
return `./${portableSource}`;
|
|
73
76
|
}
|
|
77
|
+
// ADG patch: remote root skills install only SKILL.md. Install and update must
|
|
78
|
+
// compare the same content boundary rather than hash unrelated repository files.
|
|
79
|
+
export function computeSingleFileSkillHash(contents) {
|
|
80
|
+
const hash = createHash('sha256');
|
|
81
|
+
hash.update('SKILL.md');
|
|
82
|
+
hash.update(contents);
|
|
83
|
+
return hash.digest('hex');
|
|
84
|
+
}
|
|
74
85
|
/**
|
|
75
86
|
* Compute a SHA-256 hash from all files in a skill directory.
|
|
76
87
|
* Reads all files recursively, sorts them by relative path for determinism,
|
|
@@ -111,7 +122,7 @@ async function collectFiles(baseDir, currentDir, results) {
|
|
|
111
122
|
*/
|
|
112
123
|
export async function addSkillToLocalLock(skillName, entry, cwd) {
|
|
113
124
|
const lock = await readLocalLock(cwd);
|
|
114
|
-
lock.skills[skillName]
|
|
125
|
+
lock.skills = { ...lock.skills, [skillName]: entry };
|
|
115
126
|
await writeLocalLock(lock, cwd);
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
@@ -119,7 +130,7 @@ export async function addSkillToLocalLock(skillName, entry, cwd) {
|
|
|
119
130
|
*/
|
|
120
131
|
export async function removeSkillFromLocalLock(skillName, cwd) {
|
|
121
132
|
const lock = await readLocalLock(cwd);
|
|
122
|
-
if (!(
|
|
133
|
+
if (!Object.hasOwn(lock.skills, skillName)) {
|
|
123
134
|
return false;
|
|
124
135
|
}
|
|
125
136
|
delete lock.skills[skillName];
|