@rbbtsn0w/adg 0.10.1 → 0.11.0-beta.1

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.
Files changed (45) hide show
  1. package/README.md +9 -0
  2. package/dist/src/adapters/antigravity-hooks.js +4 -2
  3. package/dist/src/commands/adapt.js +2 -2
  4. package/dist/src/commands/install/install-one.js +76 -5
  5. package/dist/src/commands/install.js +10 -2
  6. package/dist/src/commands/marketplace.js +6 -1
  7. package/dist/src/commands/update.js +4 -1
  8. package/dist/src/materialize.js +1 -1
  9. package/dist/src/plugin-changes.js +22 -0
  10. package/dist/src/render/plugins.js +21 -3
  11. package/dist/src/sources.js +3 -1
  12. package/dist/vendor/skills/src/add.js +597 -281
  13. package/dist/vendor/skills/src/agents.js +42 -7
  14. package/dist/vendor/skills/src/blob.js +96 -42
  15. package/dist/vendor/skills/src/cli.js +64 -36
  16. package/dist/vendor/skills/src/detect-agent.js +1 -1
  17. package/dist/vendor/skills/src/download-source.js +11 -8
  18. package/dist/vendor/skills/src/find.js +5 -5
  19. package/dist/vendor/skills/src/frontmatter.js +1 -1
  20. package/dist/vendor/skills/src/git-tree.js +1 -1
  21. package/dist/vendor/skills/src/git.js +84 -3
  22. package/dist/vendor/skills/src/install.js +27 -16
  23. package/dist/vendor/skills/src/installer.js +68 -42
  24. package/dist/vendor/skills/src/list.js +5 -5
  25. package/dist/vendor/skills/src/local-lock.js +18 -7
  26. package/dist/vendor/skills/src/notion-test.js +440 -0
  27. package/dist/vendor/skills/src/prompts/search-multiselect.js +22 -0
  28. package/dist/vendor/skills/src/providers/index.js +2 -2
  29. package/dist/vendor/skills/src/providers/wellknown.js +4 -4
  30. package/dist/vendor/skills/src/remove.js +37 -16
  31. package/dist/vendor/skills/src/skill-lock.js +2 -2
  32. package/dist/vendor/skills/src/skill-relocation.js +56 -0
  33. package/dist/vendor/skills/src/skills-field.js +50 -0
  34. package/dist/vendor/skills/src/skills.js +78 -58
  35. package/dist/vendor/skills/src/source-parser.js +76 -2
  36. package/dist/vendor/skills/src/sync.js +610 -190
  37. package/dist/vendor/skills/src/telemetry.js +1 -1
  38. package/dist/vendor/skills/src/test-utils.js +6 -9
  39. package/dist/vendor/skills/src/update.js +147 -62
  40. package/dist/vendor/skills/src/use.js +13 -12
  41. package/docs/agents-spec.md +5 -0
  42. package/docs/plugin-update-semantics.md +152 -0
  43. package/package.json +7 -7
  44. package/vendor/skills/PROVENANCE.md +130 -10
  45. package/vendor/skills/ThirdPartyNoticeText.txt +4 -4
@@ -7,7 +7,7 @@ import { mkdtemp, mkdir, rm } from 'fs/promises';
7
7
  import { tmpdir } from 'os';
8
8
  import { execFile } from 'child_process';
9
9
  import { promisify } from 'util';
10
- import { isGitHubHost } from "./github-host.js";
10
+ import { isGitHubHost } from './github-host.js';
11
11
  const DEFAULT_CLONE_TIMEOUT_MS = 300_000; // 5 minutes
12
12
  const ALLOWED_GIT_PROTOCOLS = 'https:http:ssh:git:file';
13
13
  const CLONE_TIMEOUT_MS = (() => {
@@ -40,6 +40,56 @@ const UNSAFE_INHERITED_GIT_ENV_KEYS = [
40
40
  'SSH_ASKPASS',
41
41
  ];
42
42
  const UNSAFE_INHERITED_GIT_ENV_KEY_SET = new Set(UNSAFE_INHERITED_GIT_ENV_KEYS.map((key) => key.toUpperCase()));
43
+ /**
44
+ * Whether a ref is a full 40-character Git commit SHA.
45
+ *
46
+ * Used only to decide whether the commit-SHA fetch fallback is worth attempting
47
+ * after a `--branch` clone fails. The fetch-by-SHA protocol requires the full
48
+ * 40-char SHA; abbreviated SHAs are rejected by the server, so they are not
49
+ * matched here. Branch and tag detection is never inferred from the string:
50
+ * `--branch` is always tried first, so any real branch or tag (including a
51
+ * hex-looking name like "deadbeef" or a 40-char-hex name) resolves correctly
52
+ * before the SHA fallback is ever considered.
53
+ */
54
+ export function isCommitSha(ref) {
55
+ return /^[0-9a-f]{40}$/i.test(ref);
56
+ }
57
+ /**
58
+ * Whether a clone or fetch error means the requested ref does not exist as a
59
+ * branch or tag. `git clone --branch <sha>` fails this way because `--branch`
60
+ * only accepts branch or tag names, never a bare commit SHA.
61
+ *
62
+ * These messages come from the git client and the server `upload-pack`, not from
63
+ * the host, so they are identical across GitHub, GitLab, self-hosted git, and
64
+ * `gh` (which wraps git). Verified on git 2.53. The variants cover the different
65
+ * code paths a missing ref can surface through:
66
+ * - `clone --branch <ref>` -> "Remote branch <ref> not found in upstream origin"
67
+ * - GitHub shorthand fetch path -> "couldn't find remote ref <ref>"
68
+ * - server-side fetch by SHA rejected -> "upload-pack: not our ref <ref>"
69
+ */
70
+ export function isMissingRefError(message) {
71
+ return (/Remote branch .* not found in upstream origin/i.test(message) ||
72
+ /couldn't find remote ref/i.test(message) ||
73
+ /upload-pack: not our ref/i.test(message));
74
+ }
75
+ /**
76
+ * Clone a repository pinned to a specific commit SHA.
77
+ *
78
+ * `git clone --branch` cannot target a bare SHA, and a `--depth 1` clone does
79
+ * not contain arbitrary commits. Instead, init an empty repo and fetch only the
80
+ * requested commit, then check it out. This requires the server to allow
81
+ * fetching reachable commits by SHA (`uploadpack.allowReachableSHA1InWant`),
82
+ * which GitHub and GitLab.com both enable. If the server rejects it, the caller
83
+ * falls back to the standard error handling.
84
+ */
85
+ async function cloneAtSha(url, sha, tempDir, extraEnv) {
86
+ const git = createGitClient(extraEnv);
87
+ await git.cwd(tempDir);
88
+ await git.init();
89
+ await git.addRemote('origin', url);
90
+ await git.fetch(['--depth', '1', 'origin', sha]);
91
+ await git.checkout('FETCH_HEAD');
92
+ }
43
93
  export class GitCloneError extends Error {
44
94
  url;
45
95
  isTimeout;
@@ -250,8 +300,12 @@ export async function getGitTreeHash(repoDir, skillPath) {
250
300
  }
251
301
  }
252
302
  export async function cloneRepo(url, ref) {
303
+ if (/^ext::/i.test(url)) {
304
+ throw new GitCloneError('Unsupported Git transport: ext', url);
305
+ }
253
306
  const tempDir = await mkdtemp(join(tmpdir(), 'skills-'));
254
307
  const cloneOptions = ref ? ['--depth', '1', '--branch', ref] : ['--depth', '1'];
308
+ const refCanBeSha = !!ref && isCommitSha(ref);
255
309
  const repo = parseGitHubRepoUrl(url);
256
310
  try {
257
311
  await createGitClient().clone(url, tempDir, cloneOptions);
@@ -259,6 +313,20 @@ export async function cloneRepo(url, ref) {
259
313
  }
260
314
  catch (error) {
261
315
  const errorMessage = error instanceof Error ? error.message : String(error);
316
+ // `--branch` cannot target a bare commit SHA. If the ref is a full SHA and
317
+ // the clone failed because the ref was not a branch or tag, retry by
318
+ // fetching the commit directly. This runs only after `--branch` fails, so a
319
+ // real branch or tag (any name) is always resolved first.
320
+ if (refCanBeSha && isMissingRefError(errorMessage)) {
321
+ try {
322
+ await resetTempDir(tempDir);
323
+ await cloneAtSha(url, ref, tempDir);
324
+ return tempDir;
325
+ }
326
+ catch {
327
+ // Fall through to the standard error handling below.
328
+ }
329
+ }
262
330
  const isTimeout = errorMessage.includes('block timeout') || errorMessage.includes('timed out');
263
331
  const isAuthError = isAuthFailure(errorMessage);
264
332
  if (isTimeout) {
@@ -283,9 +351,22 @@ export async function cloneRepo(url, ref) {
283
351
  }
284
352
  try {
285
353
  await resetTempDir(tempDir);
286
- await createGitClient({
354
+ const sshEnv = {
287
355
  GIT_SSH_COMMAND: 'ssh -o BatchMode=yes',
288
- }).clone(repo.sshUrl, tempDir, cloneOptions);
356
+ };
357
+ try {
358
+ await createGitClient(sshEnv).clone(repo.sshUrl, tempDir, cloneOptions);
359
+ }
360
+ catch (sshError) {
361
+ const sshMessage = sshError instanceof Error ? sshError.message : String(sshError);
362
+ if (refCanBeSha && isMissingRefError(sshMessage)) {
363
+ await resetTempDir(tempDir);
364
+ await cloneAtSha(repo.sshUrl, ref, tempDir, sshEnv);
365
+ }
366
+ else {
367
+ throw sshError;
368
+ }
369
+ }
289
370
  return tempDir;
290
371
  }
291
372
  catch {
@@ -1,18 +1,20 @@
1
1
  import * as p from '@clack/prompts';
2
2
  import pc from 'picocolors';
3
- import { readLocalLock } from "./local-lock.js";
4
- import { runAdd } from "./add.js";
5
- import { runSync, parseSyncOptions } from "./sync.js";
6
- import { getUniversalAgents } from "./agents.js";
7
- import { buildLocalUpdateSource } from "./update-source.js";
3
+ import { readLocalLock } from './local-lock.js';
4
+ import { installFromSource, runAdd } from './add.js';
5
+ import { runSync, parseSyncOptions } from './sync.js';
6
+ import { getUniversalAgents } from './agents.js';
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 calls `runAdd` for each group.
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 experimental_sync.
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
- try {
59
- await runAdd([source], {
60
- skill: skills,
61
- agent: universalAgentNames,
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
- catch (error) {
66
- p.log.error(`Failed to install from ${pc.cyan(source)}: ${error instanceof Error ? error.message : 'Unknown error'}`);
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) {
@@ -2,10 +2,11 @@ import { mkdir, cp, access, readdir, symlink, lstat, rm, readlink, readFile, wri
2
2
  import { existsSync } from 'fs';
3
3
  import { join, basename, normalize, resolve, sep, relative, dirname, extname } from 'path';
4
4
  import { homedir, platform } from 'os';
5
- import { agents, detectInstalledAgents, isUniversalAgent, getEveSubagents, EVE_SUBAGENTS_DIR, } from "./agents.js";
6
- import { AGENTS_DIR, SKILLS_SUBDIR } from "./constants.js";
7
- import { parseFrontmatter } from "./frontmatter.js";
8
- import { parseSkillMd } from "./skills.js";
5
+ import { agents, detectInstalledAgents, isUniversalAgent, getEveSubagents, EVE_SUBAGENTS_DIR, } from './agents.js';
6
+ import { AGENTS_DIR, SKILLS_SUBDIR } from './constants.js';
7
+ import { parseFrontmatter } from './frontmatter.js';
8
+ import { stringify } from 'yaml';
9
+ import { parseSkillMd } from './skills.js';
9
10
  /**
10
11
  * Sanitizes a filename/directory name to prevent path traversal attacks
11
12
  * and ensures it follows kebab-case convention
@@ -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
- if (pathsOverlap(skill.path, canonicalDir)) {
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: 'symlink',
290
+ mode: installMode,
279
291
  skipped: true,
280
292
  };
281
293
  }
282
- // Symlink mode: copy to canonical location and symlink to agent location
283
- await cleanAndCreateDirectory(canonicalDir);
284
- await copyDirectory(skill.path, canonicalDir, agentType);
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: 'symlink',
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 (!isGlobal && !isUniversalAgent(agentType)) {
301
- const agentRootDir = join(cwd, agents[agentType].skillsDir.split('/')[0]);
302
- if (!existsSync(agentRootDir) && agentType !== 'claude-code') {
303
- return {
304
- success: true,
305
- path: canonicalDir,
306
- canonicalPath: canonicalDir,
307
- mode: 'symlink',
308
- skipped: true,
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: 'symlink',
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: 'symlink',
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
- const metadata = Object.fromEntries(Object.entries(data.metadata).filter((entry) => typeof entry[1] === 'string'));
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
- const frontmatter = keys.map((key) => `${key}: ${JSON.stringify(eveData[key])}`).join('\n');
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. Claude Code is
808
- // exempted since it can be explicitly selected as the install target even when
809
- // .claude/ doesn't exist yet (see installSkillForAgent for the same exemption).
810
- if (!isGlobal && !isUniversalAgent(agentType)) {
811
- const agentRootDir = join(cwd, agents[agentType].skillsDir.split('/')[0]);
812
- if (!existsSync(agentRootDir) && agentType !== 'claude-code') {
813
- return {
814
- success: true,
815
- path: canonicalDir,
816
- canonicalPath: canonicalDir,
817
- mode: 'symlink',
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) {
@@ -1,9 +1,9 @@
1
1
  import { homedir } from 'os';
2
- import { agents } from "./agents.js";
3
- import { listInstalledSkills, sanitizeName } from "./installer.js";
4
- import { sanitizeMetadata } from "./sanitize.js";
5
- import { getAllLockedSkills } from "./skill-lock.js";
6
- import { readLocalLock } from "./local-lock.js";
2
+ import { agents } from './agents.js';
3
+ import { listInstalledSkills, sanitizeName } from './installer.js';
4
+ import { sanitizeMetadata } from './sanitize.js';
5
+ import { getAllLockedSkills } from './skill-lock.js';
6
+ import { readLocalLock } from './local-lock.js';
7
7
  const RESET = '\x1b[0m';
8
8
  const BOLD = '\x1b[1m';
9
9
  const DIM = '\x1b[38;5;102m';
@@ -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
- for (const key of Object.keys(lock.skills).sort()) {
48
+ const sortedSkills = Object.fromEntries(Object.keys(lock.skills)
49
+ .sort()
50
+ .map((key) => {
50
51
  const entry = lock.skills[key];
51
- sortedSkills[key] =
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] = entry;
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 (!(skillName in lock.skills)) {
133
+ if (!Object.hasOwn(lock.skills, skillName)) {
123
134
  return false;
124
135
  }
125
136
  delete lock.skills[skillName];