@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
@@ -3,7 +3,7 @@ import { readFileSync, existsSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { getTracer as getAdgTracer, shutdownTelemetry } from "../../../src/telemetry.js";
6
- const AUDIT_URL = "https://add-skill.vercel.sh/audit";
6
+ const AUDIT_URL = "https://www.skills.sh/tele/audit";
7
7
  let detectedAgentName = null;
8
8
  export function setDetectedAgent(agentName) {
9
9
  detectedAgentName = agentName;
@@ -1,8 +1,8 @@
1
- import { execFileSync } from 'child_process';
1
+ import { execFileSync, spawnSync } from 'child_process';
2
2
  import { mkdtempSync, rmSync } from 'fs';
3
3
  import { tmpdir } from 'os';
4
4
  import { join } from 'path';
5
- import { stripTerminalEscapes } from "./sanitize.js";
5
+ import { stripTerminalEscapes } from './sanitize.js';
6
6
  // const PROJECT_ROOT = join(import.meta.dirname, '..');
7
7
  const CLI_PATH = join(import.meta.dirname, 'cli.ts');
8
8
  // Keep synchronized with the environment checks in @vercel/detect-agent@1.2.3
@@ -79,20 +79,17 @@ function createIsolatedTestEnvironment(overrides) {
79
79
  export function runCli(args, cwd, env, timeout) {
80
80
  const { env: testEnv, temporaryHome } = createIsolatedTestEnvironment(env);
81
81
  try {
82
- const output = execFileSync(process.execPath, [CLI_PATH, ...args], {
82
+ const result = spawnSync(process.execPath, [CLI_PATH, ...args], {
83
83
  encoding: 'utf-8',
84
84
  cwd,
85
85
  stdio: ['pipe', 'pipe', 'pipe'],
86
86
  env: testEnv,
87
87
  timeout: timeout ?? 30000,
88
88
  });
89
- return { stdout: stripAnsi(output), stderr: '', exitCode: 0 };
90
- }
91
- catch (error) {
92
89
  return {
93
- stdout: stripAnsi(error.stdout || ''),
94
- stderr: stripAnsi(error.stderr || ''),
95
- exitCode: error.status || 1,
90
+ stdout: stripAnsi(result.stdout || ''),
91
+ stderr: stripAnsi(result.stderr || ''),
92
+ exitCode: result.status ?? 1,
96
93
  };
97
94
  }
98
95
  finally {
@@ -1,23 +1,24 @@
1
- import { existsSync, readdirSync } from 'fs';
1
+ import { existsSync, readFileSync, readdirSync } from 'fs';
2
2
  import { spawnSync } from 'child_process';
3
3
  import { join, dirname, relative, sep } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import * as p from '@clack/prompts';
6
6
  import pc from 'picocolors';
7
- import { readSkillLock, writeSkillLock, getGitHubToken } from "./skill-lock.js";
8
- import { computeSkillFolderHash, readLocalLock } from "./local-lock.js";
9
- import { formatSourceInput, buildUpdateInstallSource, buildLocalUpdateSource, buildLocalCloneSource, shouldUseFullDepthForUpdate, } from "./update-source.js";
10
- import { cloneRepo, cleanupTempDir, getGitTreeHash } from "./git.js";
11
- import { discoverSkills } from "./skills.js";
12
- import { fetchRepoTree, getSkillFolderHashFromTree } from "./blob.js";
13
- import { wellKnownProvider, computeWellKnownSkillDigest } from "./providers/index.js";
14
- import { removeCommand } from "./remove.js";
15
- import { sanitizeMetadata } from "./sanitize.js";
16
- import { track, getTracer } from "./telemetry.js";
17
- import { agents, isUniversalAgent } from "./agents.js";
7
+ import { readSkillLock, writeSkillLock, getGitHubToken } from './skill-lock.js';
8
+ import { computeSkillFolderHash, computeSingleFileSkillHash, readLocalLock } from './local-lock.js';
9
+ import { formatSourceInput, buildUpdateInstallSource, buildLocalUpdateSource, buildLocalCloneSource, shouldUseFullDepthForUpdate, } from './update-source.js';
10
+ import { cloneRepo, cleanupTempDir, getGitTreeHash } from './git.js';
11
+ import { discoverSkills } from './skills.js';
12
+ import { fetchRepoTree, getSkillFolderHashFromTree } from './blob.js';
13
+ import { resolveSkillLocations, } from './skill-relocation.js';
14
+ import { wellKnownProvider, computeWellKnownSkillDigest } from './providers/index.js';
15
+ import { removeCommand } from './remove.js';
16
+ import { sanitizeMetadata } from './sanitize.js';
17
+ import { track, getTracer } from './telemetry.js';
18
+ import { agents, isUniversalAgent } from './agents.js';
18
19
  import { SpanKind, SpanStatusCode } from '@opentelemetry/api';
19
- import { annotateSubprocess } from "../../../src/subprocess.js";
20
- import { selfCliArgv } from "./self-cli.js";
20
+ import { annotateSubprocess } from '../../../src/subprocess.js';
21
+ import { selfCliArgv } from './self-cli.js';
21
22
  const __dirname = dirname(fileURLToPath(import.meta.url));
22
23
  export function resolveSelfCliEntry(moduleDir = __dirname, exists = existsSync) {
23
24
  const sourceEntry = join(moduleDir, '../../../bin/adg.ts');
@@ -58,6 +59,19 @@ const RESET = '\x1b[0m';
58
59
  const BOLD = '\x1b[1m';
59
60
  const DIM = '\x1b[38;5;102m';
60
61
  const TEXT = '\x1b[38;5;145m';
62
+ // ADG patch: source progress overwrites one line on a TTY and stays plain in logs.
63
+ function writeSourceStatus(source) {
64
+ if (process.stdout.isTTY) {
65
+ process.stdout.write(`\r${DIM}Checking skills from source: ${source}${RESET}\x1b[K`);
66
+ }
67
+ else {
68
+ process.stdout.write(`Checking skills from source: ${source}\n`);
69
+ }
70
+ }
71
+ function clearSourceStatus() {
72
+ if (process.stdout.isTTY)
73
+ process.stdout.write('\r\x1b[K');
74
+ }
61
75
  /**
62
76
  * Public GitHub lock entries use owner/repo shorthand to preserve the exact
63
77
  * skill subpath. Pin that shorthand to github.com so an ambient GH_HOST for a
@@ -244,6 +258,7 @@ export async function getProjectSkillsForUpdate(skillFilter) {
244
258
  return skills;
245
259
  }
246
260
  export async function promptDeletions(source, deletedSkills, isGlobal, options) {
261
+ clearSourceStatus();
247
262
  if (deletedSkills.length === 0)
248
263
  return;
249
264
  console.log();
@@ -266,15 +281,18 @@ export async function promptDeletions(source, deletedSkills, isGlobal, options)
266
281
  }
267
282
  }
268
283
  }
269
- export async function checkAndPromptForDeletions(source, allLockedForSource, lockSkills, isGlobal, options, discoveredPaths) {
270
- const deletedSkills = allLockedForSource.filter((name) => {
271
- const entry = lockSkills[name];
272
- if (!entry?.skillPath)
273
- return false;
274
- return !discoveredPaths.includes(entry.skillPath);
275
- });
276
- await promptDeletions(source, deletedSkills, isGlobal, options);
277
- return deletedSkills;
284
+ export async function checkAndPromptForDeletions(source, allLockedForSource, lockSkills, isGlobal, options, discovered, locationOptions = {}) {
285
+ const resolution = resolveSkillLocations(allLockedForSource, lockSkills, discovered, locationOptions);
286
+ if (resolution.ambiguousSkills.length > 0) {
287
+ clearSourceStatus();
288
+ console.log();
289
+ console.log(`${DIM}Warning:${RESET} Multiple current paths match these skills from ${DIM}${source}${RESET}; skipping them rather than deleting or migrating the wrong skill:`);
290
+ for (const name of resolution.ambiguousSkills) {
291
+ console.log(` ${DIM}•${RESET} ${sanitizeMetadata(name)}`);
292
+ }
293
+ }
294
+ await promptDeletions(source, resolution.deletedSkills, isGlobal, options);
295
+ return resolution;
278
296
  }
279
297
  export async function checkWellKnownForUpdates(baseUrl, items) {
280
298
  let indexResult;
@@ -339,8 +357,9 @@ export async function processWellKnownUpdates(groups, isGlobal, options) {
339
357
  let failCount = 0;
340
358
  let changed = false;
341
359
  for (const [baseUrl, items] of groups) {
342
- process.stdout.write(`\r${DIM}Checking skills from source: ${baseUrl}${RESET}\x1b[K\n`);
360
+ writeSourceStatus(baseUrl);
343
361
  const result = await checkWellKnownForUpdates(baseUrl, items);
362
+ clearSourceStatus();
344
363
  if (result.status === 'error') {
345
364
  console.log(` ${DIM}✗ Failed to check skills from ${baseUrl}${RESET}`);
346
365
  failCount += items.length;
@@ -358,6 +377,7 @@ export async function processWellKnownUpdates(groups, isGlobal, options) {
358
377
  const cliEntry = SELF_CLI_ENTRY;
359
378
  if (!existsSync(cliEntry)) {
360
379
  failCount += result.changedSkills.length;
380
+ recordSelfCliEntrypointMissing();
361
381
  console.log(` ${DIM}✗ CLI entrypoint not found at ${cliEntry}${RESET}`);
362
382
  continue;
363
383
  }
@@ -458,7 +478,7 @@ export async function updateGlobalSkills(options = {}) {
458
478
  const source = firstEntry.source;
459
479
  const sourceUrl = firstEntry.sourceUrl || firstEntry.source;
460
480
  let tempDir = null;
461
- process.stdout.write(`\r${DIM}Checking skills from source: ${source}${RESET}\x1b[K\n`);
481
+ writeSourceStatus(source);
462
482
  try {
463
483
  const isGitHubSource = firstEntry.sourceType === 'github';
464
484
  if (isGitHubSource) {
@@ -470,52 +490,67 @@ export async function updateGlobalSkills(options = {}) {
470
490
  const allLockedForSource = Object.entries(lock.skills)
471
491
  .filter(([_, entry]) => entry.source === source && entry.ref === firstEntry.ref)
472
492
  .map(([name, _]) => name);
473
- const deletedSkills = await checkAndPromptForDeletions(source, allLockedForSource, lock.skills, true, options, discoveredPaths);
474
- const deletedSkillSet = new Set(deletedSkills);
475
- for (const { name: skillName, entry } of itemsForSource) {
476
- if (deletedSkillSet.has(skillName))
477
- continue;
478
- const latestHash = getSkillFolderHashFromTree(tree, entry.skillPath);
479
- // Older lockfiles stored a SHA-256 content hash. Only normalize that
480
- // legacy shape; arbitrary values must still be compared and updated.
481
- if (latestHash && /^[0-9a-f]{64}$/i.test(entry.skillFolderHash)) {
482
- entry.skillFolderHash = latestHash;
483
- healed = true;
484
- continue;
485
- }
486
- if (latestHash && latestHash !== entry.skillFolderHash) {
487
- updates.push({ name: skillName, source, entry });
493
+ const hasMissingLockedPath = allLockedForSource.some((name) => lock.skills[name]?.skillPath &&
494
+ !discoveredPaths.includes(lock.skills[name].skillPath));
495
+ if (!hasMissingLockedPath) {
496
+ for (const { name: skillName, entry } of itemsForSource) {
497
+ const latestHash = getSkillFolderHashFromTree(tree, entry.skillPath);
498
+ // ADG patch: heal legacy SHA-256 locks without reporting a false update.
499
+ if (latestHash && /^[0-9a-f]{64}$/i.test(entry.skillFolderHash)) {
500
+ entry.skillFolderHash = latestHash;
501
+ healed = true;
502
+ continue;
503
+ }
504
+ if (latestHash && latestHash !== entry.skillFolderHash) {
505
+ updates.push({ name: skillName, source, entry });
506
+ }
488
507
  }
508
+ continue;
489
509
  }
490
- continue;
510
+ clearSourceStatus();
511
+ console.log(` ${DIM}Skill paths changed; resolving via Git clone${RESET}`);
512
+ }
513
+ else {
514
+ clearSourceStatus();
515
+ console.log(` ${DIM}GitHub API unavailable; checking via Git clone${RESET}`);
491
516
  }
492
- console.log(` ${DIM}GitHub API unavailable; checking via Git clone${RESET}`);
493
517
  }
494
518
  tempDir = await cloneRepo(sourceUrl, firstEntry.ref);
495
- const discoveredPaths = (await discoverSkills(tempDir, undefined, { fullDepth: true })).map((skill) => {
496
- return join(relative(tempDir, skill.path), 'SKILL.md').split(sep).join('/');
519
+ const discovered = await discoverSkills(tempDir, undefined, {
520
+ fullDepth: true,
521
+ includeDuplicateNames: true,
497
522
  });
523
+ const discoveredLocations = discovered.map((skill) => ({
524
+ name: skill.name,
525
+ skillPath: join(relative(tempDir, skill.path), 'SKILL.md').split(sep).join('/'),
526
+ }));
498
527
  const allLockedForSource = Object.entries(lock.skills)
499
528
  .filter(([_, entry]) => entry.source === source && entry.ref === firstEntry.ref)
500
529
  .map(([name, _]) => name);
501
- const deletedSkills = await checkAndPromptForDeletions(source, allLockedForSource, lock.skills, true, options, discoveredPaths);
502
- const deletedSkillSet = new Set(deletedSkills);
530
+ const resolution = await checkAndPromptForDeletions(source, allLockedForSource, lock.skills, true, options, discoveredLocations,
531
+ // Path-addressable sources reinstall only the locked directory, so a
532
+ // same-name mirror elsewhere in the repo is not ambiguous. Generic Git
533
+ // sources reinstall from the whole repo and remain fail-closed.
534
+ { exactPathDisambiguates: !shouldUseFullDepthForUpdate(firstEntry) });
535
+ const deletedSkillSet = new Set(resolution.deletedSkills);
503
536
  for (const { name: skillName, entry } of itemsForSource) {
504
537
  if (deletedSkillSet.has(skillName))
505
538
  continue;
506
- const skillPath = entry.skillPath;
507
- if (!discoveredPaths.includes(skillPath))
539
+ const skillPath = resolution.resolvedPaths.get(skillName);
540
+ if (!skillPath)
508
541
  continue;
509
542
  const usesGitTreeHash = isGitHubSource && /^[0-9a-f]{40}$/i.test(entry.skillFolderHash);
510
543
  const latestHash = usesGitTreeHash
511
544
  ? await getGitTreeHash(tempDir, skillPath)
512
545
  : await computeSkillFolderHash(join(tempDir, dirname(skillPath)));
513
- if (latestHash && latestHash !== entry.skillFolderHash) {
514
- updates.push({ name: skillName, source, entry });
546
+ const relocated = skillPath !== entry.skillPath;
547
+ if (relocated || (latestHash && latestHash !== entry.skillFolderHash)) {
548
+ updates.push({ name: skillName, source, entry: { ...entry, skillPath } });
515
549
  }
516
550
  }
517
551
  }
518
552
  catch (error) {
553
+ clearSourceStatus();
519
554
  console.log(` ${DIM}✗ Failed to check skills from ${source}${RESET}`);
520
555
  failedSources.push(source);
521
556
  }
@@ -525,7 +560,7 @@ export async function updateGlobalSkills(options = {}) {
525
560
  }
526
561
  }
527
562
  if (checkable.length > 0) {
528
- process.stdout.write('\r\x1b[K');
563
+ clearSourceStatus();
529
564
  }
530
565
  if (healed) {
531
566
  try {
@@ -536,6 +571,8 @@ export async function updateGlobalSkills(options = {}) {
536
571
  }
537
572
  }
538
573
  const checkedCount = checkable.length + skipped.length + wellKnownCount;
574
+ // ADG patch: a successful update must not hide another source's check failure.
575
+ failCount += failedSources.length;
539
576
  if (checkable.length === 0 && skipped.length === 0 && wellKnownCount === 0) {
540
577
  if (!options.skills) {
541
578
  console.log(`${DIM}No global skills to check.${RESET}`);
@@ -545,7 +582,7 @@ export async function updateGlobalSkills(options = {}) {
545
582
  if (checkable.length === 0 && skipped.length === 0) {
546
583
  if (failedSources.length > 0) {
547
584
  console.log(`${DIM}Some skill sources could not be verified.${RESET}`);
548
- return { successCount, failCount: failCount + failedSources.length, checkedCount };
585
+ return { successCount, failCount, checkedCount };
549
586
  }
550
587
  if (!wkChanged) {
551
588
  console.log(`${TEXT}✓ All global skills are up to date${RESET}`);
@@ -559,7 +596,7 @@ export async function updateGlobalSkills(options = {}) {
559
596
  if (updates.length === 0) {
560
597
  if (failedSources.length > 0) {
561
598
  console.log(`${DIM}Some skill sources could not be verified.${RESET}`);
562
- return { successCount, failCount: failCount + failedSources.length, checkedCount };
599
+ return { successCount, failCount, checkedCount };
563
600
  }
564
601
  if (!wkChanged) {
565
602
  console.log(`${TEXT}✓ All global skills are up to date${RESET}`);
@@ -580,6 +617,7 @@ export async function updateGlobalSkills(options = {}) {
580
617
  const cliEntry = SELF_CLI_ENTRY;
581
618
  if (!existsSync(cliEntry)) {
582
619
  failCount++;
620
+ recordSelfCliEntrypointMissing();
583
621
  console.log(` ${DIM}✗ Failed to update ${safeName}: CLI entrypoint not found at ${cliEntry}${RESET}`);
584
622
  continue;
585
623
  }
@@ -675,7 +713,7 @@ export async function updateProjectSkills(options = {}) {
675
713
  if (targetParts.length > 0) {
676
714
  console.log(`${TEXT}Updating for: ${targetParts.join(', ')}${RESET}`);
677
715
  }
678
- console.log(`${TEXT}Refreshing ${updatable.length + wellKnownCount} skill(s)…${RESET}`);
716
+ console.log(`${TEXT}Checking ${updatable.length + wellKnownCount} skill(s)…${RESET}`);
679
717
  console.log();
680
718
  const { successCount: wkSuccessCount, failCount: wkFailCount } = await processWellKnownUpdates(wellKnownGroups, false, options);
681
719
  successCount += wkSuccessCount;
@@ -692,7 +730,9 @@ export async function updateProjectSkills(options = {}) {
692
730
  }
693
731
  const localLock = await readLocalLock();
694
732
  const cliEntry = SELF_CLI_ENTRY;
733
+ let upToDateCount = 0;
695
734
  if (updatable.length > 0 && !existsSync(cliEntry)) {
735
+ recordSelfCliEntrypointMissing();
696
736
  console.log(`${DIM}✗ CLI entrypoint not found at ${cliEntry}${RESET}`);
697
737
  return {
698
738
  successCount,
@@ -710,6 +750,8 @@ export async function updateProjectSkills(options = {}) {
710
750
  .map(([name, _]) => name);
711
751
  let tempDir = null;
712
752
  let deletedSkills = [];
753
+ let resolvedPaths = null;
754
+ const latestHashes = new Map();
713
755
  if (cloneSource === null) {
714
756
  failCount += skillsForSource.length;
715
757
  console.log(`${DIM}✗ Cannot update ${source}: skills-lock.json is missing sourceUrl for this generic Git source${RESET}`);
@@ -717,12 +759,32 @@ export async function updateProjectSkills(options = {}) {
717
759
  }
718
760
  try {
719
761
  tempDir = await cloneRepo(cloneSource, ref);
720
- const discovered = await discoverSkills(tempDir, undefined, { fullDepth: true });
721
- const discoveredPaths = discovered.map((s) => {
722
- const relPath = relative(tempDir, s.path);
723
- return join(relPath, 'SKILL.md').split(sep).join('/');
762
+ const discovered = await discoverSkills(tempDir, undefined, {
763
+ fullDepth: true,
764
+ includeDuplicateNames: true,
724
765
  });
725
- deletedSkills = await checkAndPromptForDeletions(source, allLockedForSource, localLock.skills, false, options, discoveredPaths);
766
+ const discoveredLocations = discovered.map((skill) => ({
767
+ name: skill.name,
768
+ skillPath: join(relative(tempDir, skill.path), 'SKILL.md').split(sep).join('/'),
769
+ }));
770
+ const resolution = await checkAndPromptForDeletions(source, allLockedForSource, localLock.skills, false, options, discoveredLocations, { exactPathDisambiguates: !shouldUseFullDepthForUpdate(firstEntry) });
771
+ deletedSkills = resolution.deletedSkills;
772
+ resolvedPaths = resolution.resolvedPaths;
773
+ // Hash each remaining skill in the clone the same way `add` records
774
+ // computedHash, so unchanged skills are not reinstalled.
775
+ for (const [name, skillPath] of resolution.resolvedPaths) {
776
+ try {
777
+ // ADG patch: root skills install only SKILL.md, so use that same hash boundary.
778
+ const hash = skillPath === 'SKILL.md'
779
+ ? computeSingleFileSkillHash(readFileSync(join(tempDir, skillPath), 'utf8'))
780
+ : await computeSkillFolderHash(join(tempDir, dirname(skillPath)));
781
+ if (hash)
782
+ latestHashes.set(name, hash);
783
+ }
784
+ catch {
785
+ // Unknown hash: fall through to reinstalling the skill.
786
+ }
787
+ }
726
788
  }
727
789
  catch (error) {
728
790
  console.log(`${DIM}✗ Failed to check for deleted skills from ${source}${RESET}`);
@@ -732,11 +794,26 @@ export async function updateProjectSkills(options = {}) {
732
794
  await cleanupTempDir(tempDir);
733
795
  }
734
796
  }
797
+ if (resolvedPaths === null) {
798
+ failCount += skillsForSource.length;
799
+ continue;
800
+ }
735
801
  const remainingSkills = skillsForSource.filter((s) => !deletedSkills.includes(s.name));
736
802
  for (const skill of remainingSkills) {
737
803
  const safeName = sanitizeMetadata(skill.name);
804
+ const resolvedPath = resolvedPaths?.get(skill.name);
805
+ if (resolvedPaths && !resolvedPath) {
806
+ continue;
807
+ }
808
+ const entry = resolvedPath ? { ...skill.entry, skillPath: resolvedPath } : skill.entry;
809
+ const relocated = entry.skillPath !== skill.entry.skillPath;
810
+ const latestHash = latestHashes.get(skill.name);
811
+ if (!relocated && latestHash && latestHash === skill.entry.computedHash) {
812
+ upToDateCount++;
813
+ continue;
814
+ }
738
815
  console.log(`${TEXT}Updating ${safeName}…${RESET}`);
739
- const installUrl = buildLocalUpdateSource(skill.entry);
816
+ const installUrl = buildLocalUpdateSource(entry);
740
817
  if (!installUrl) {
741
818
  failCount++;
742
819
  console.log(` ${DIM}✗ Cannot update ${safeName}: skills-lock.json is missing sourceUrl for this generic Git source${RESET}`);
@@ -747,7 +824,7 @@ export async function updateProjectSkills(options = {}) {
747
824
  const subagentArgs = skill.entry.subagents?.length
748
825
  ? ['--subagent', ...skill.entry.subagents.map((s) => (s === '' ? 'root' : s))]
749
826
  : [];
750
- const fullDepthArgs = shouldUseFullDepthForUpdate(skill.entry) ? ['--full-depth'] : [];
827
+ const fullDepthArgs = shouldUseFullDepthForUpdate(entry) ? ['--full-depth'] : [];
751
828
  const result = runUpdateChild(selfCliArgv(cliEntry, [
752
829
  'skills',
753
830
  'add',
@@ -760,7 +837,7 @@ export async function updateProjectSkills(options = {}) {
760
837
  ]), {
761
838
  stdio: ['inherit', 'pipe', 'pipe'],
762
839
  encoding: 'utf-8',
763
- env: getUpdateChildEnv(skill.entry.sourceType),
840
+ env: getUpdateChildEnv(entry.sourceType),
764
841
  // Never spawn through a shell — same reasoning as updateGlobalSkills:
765
842
  // execPath is absolute (no shell resolution needed) and installUrl/ref
766
843
  // come from the lock file, so a shell would allow command injection on
@@ -777,6 +854,14 @@ export async function updateProjectSkills(options = {}) {
777
854
  }
778
855
  }
779
856
  }
857
+ if (upToDateCount > 0) {
858
+ if (upToDateCount === updatable.length && wkSuccessCount === 0 && wkFailCount === 0) {
859
+ console.log(`${TEXT}✓ All project skills are up to date${RESET}`);
860
+ }
861
+ else {
862
+ console.log(`${DIM}${upToDateCount} project skill(s) already up to date${RESET}`);
863
+ }
864
+ }
780
865
  printLegacyProjectSkills(legacy);
781
866
  return { successCount, failCount, foundCount: projectSkills.length };
782
867
  }
@@ -4,17 +4,17 @@ import { cp, mkdir, mkdtemp, readdir, readFile, realpath, stat, writeFile } from
4
4
  import { dirname, join, normalize, relative, resolve, sep } from 'path';
5
5
  import { tmpdir } from 'os';
6
6
  import { SpanKind } from '@opentelemetry/api';
7
- import { annotateSubprocess } from "../../../src/subprocess.js";
8
- import { getTracer } from "../../../src/telemetry.js";
9
- import { agents } from "./agents.js";
10
- import { tryBlobInstall } from "./blob.js";
11
- import { cloneRepo, cleanupTempDir, GitCloneError } from "./git.js";
12
- import { sanitizeName } from "./installer.js";
13
- import { getGitHubToken } from "./skill-lock.js";
14
- import { discoverSkills, filterSkills, getSkillDisplayName } from "./skills.js";
15
- import { getOwnerRepo, parseSource } from "./source-parser.js";
16
- import { downloadSource } from "./download-source.js";
17
- import { wellKnownProvider, WellKnownScopeNotFoundError, } from "./providers/wellknown.js";
7
+ import { annotateSubprocess } from '../../../src/subprocess.js';
8
+ import { getTracer } from '../../../src/telemetry.js';
9
+ import { agents } from './agents.js';
10
+ import { tryBlobInstall } from './blob.js';
11
+ import { cloneRepo, cleanupTempDir, GitCloneError } from './git.js';
12
+ import { sanitizeName } from './installer.js';
13
+ import { getGitHubToken } from './skill-lock.js';
14
+ import { discoverSkills, filterSkills, getSkillDisplayName } from './skills.js';
15
+ import { getOwnerRepo, parseSource } from './source-parser.js';
16
+ import { downloadSource } from './download-source.js';
17
+ import { wellKnownProvider, WellKnownScopeNotFoundError, } from './providers/wellknown.js';
18
18
  export function agentCloseResult(code, signal) {
19
19
  return {
20
20
  status: code ?? (signal ? null : 1),
@@ -22,12 +22,13 @@ export function agentCloseResult(code, signal) {
22
22
  exitCode: code ?? 1,
23
23
  };
24
24
  }
25
- const BLOB_ALLOWED_OWNERS = ['vercel', 'vercel-labs', 'heygen-com'];
25
+ const BLOB_ALLOWED_OWNERS = ['vercel', 'vercel-labs', 'heygen-com', 'remotion-dev'];
26
26
  const EXCLUDE_FILES = new Set(['metadata.json']);
27
27
  const EXCLUDE_DIRS = new Set(['.git', '__pycache__', '__pypackages__']);
28
28
  const USE_AGENT_CONFIGS = {
29
29
  'claude-code': { command: 'claude', args: [] },
30
30
  codex: { command: 'codex', args: [] },
31
+ 'sarvam-code': { command: 'sarvam-code', args: [] },
31
32
  };
32
33
  const SUPPORTED_USE_AGENTS = Object.keys(USE_AGENT_CONFIGS);
33
34
  export function parseUseOptions(args) {
@@ -123,6 +123,11 @@ The lock records two hashes: `sourceHash` covers the complete cached payload and
123
123
  `installedHash` covers the effective selection. Runtime projections are excluded
124
124
  from both hashes so re-adapting does not churn content identity.
125
125
 
126
+ The approved consumer-side update work separates publisher versions, packaged
127
+ content changes, verified repository checkpoints, and native synchronization.
128
+ See [Plugin Update Semantics and Delivery Tracking](plugin-update-semantics.md)
129
+ for its acceptance matrix and implementation/validation status.
130
+
126
131
  The cache is scoped by a stable store id under the OS-managed
127
132
  system cache tree (`~/Library/Caches/adg/plugins/` on macOS,
128
133
  `$XDG_CACHE_HOME/adg/plugins/` on Linux). `adg plugins cache status` reports
@@ -0,0 +1,152 @@
1
+ # Plugin Update Semantics and Delivery Tracking
2
+
3
+ **Status:** Local implementation verified; native runtime validation tracked separately
4
+
5
+ **Decision date:** 2026-10-30
6
+
7
+ **Delivery owner:** ADG lead; project-management tracking in this document
8
+
9
+ **Tracking issue:** [ADG #161](https://github.com/RbBtSn0w/adg/issues/161)
10
+
11
+ ## Problem and approved direction
12
+
13
+ A repository can publish multiple plugins under one synchronized version or
14
+ version each plugin independently. Both are valid publisher policies. ADG must
15
+ explain whether a release changed plugin content, only its version, or the
16
+ effective installation, without requiring publishers to change their release
17
+ automation.
18
+
19
+ Previously, one `changed` flag combined source, version, lock-record, and runtime
20
+ refresh concerns. A synchronized version bump therefore appeared indistinguishable
21
+ from a skill update. An unchanged plugin could also retain an older checked
22
+ revision, preventing subsequent checks from taking the repository fast path.
23
+
24
+ The approved solution belongs in ADG. The apple-skills selective-version proposal
25
+ in [PR #90](https://github.com/RbBtSn0w/apple-skills/pull/90) is superseded as the
26
+ general fix. The lead's live check found that PR already merged at
27
+ 2026-10-30 10:17:31 UTC (commit `580ee607`) and release `v1.32.1` followed at
28
+ 10:18:21 UTC. It cannot now be closed as an open proposal. Reverting published
29
+ producer behavior is a separate decision; this ADG delivery supports both
30
+ publisher policies without depending on such a revert.
31
+
32
+ ## Required boundaries
33
+
34
+ | Boundary | Contract |
35
+ | --- | --- |
36
+ | Publisher version | Preserve the publisher's version. Accept synchronized and independent version policies without new author configuration. |
37
+ | Source integrity | Preserve exact source and installed digests; a comparison that excludes only the version field must not replace integrity validation. |
38
+ | Change classification | Distinguish version-only changes from other packaged files or normalized manifest changes. Unknown or unavailable comparison input is handled conservatively. |
39
+ | Repository checkpoint | Advance a checked revision only after the relevant source has been successfully examined. A checkpoint-only update must not imply a content update or native refresh. |
40
+ | Effective selection | Keep unselected payload separate from the selected installation. Changes to dependency closure and selected configuration remain significant. |
41
+ | Runtime synchronization | Plan native work separately from human-readable change reasons. A version-only release may still need native refresh to preserve native manifest/cache correctness. |
42
+ | Runtime outcome | A successful source update does not prove native registration, cache replacement, or loading in an existing session. Report unavailable, failed, and unverified outcomes accurately. |
43
+ | Desired state | Preserve disabled plugins and stored selections throughout update and recovery. |
44
+
45
+ Classification must cover canonical manifests, imported native manifests, and
46
+ Default DSL sources. Removing an entire manifest from comparison would hide
47
+ dependency, hook, MCP, component-pointer, and other configuration changes and is
48
+ not an acceptable version-only optimization.
49
+
50
+ ## Scope and ownership
51
+
52
+ | Workstream | Owner | Deliverable | Completion evidence |
53
+ | --- | --- | --- | --- |
54
+ | Core comparison | Core implementation worker | Classification and exact-source comparison with backward-compatible install outcomes | Focused regression tests and implementation diff |
55
+ | Checkpoint and reporting | Update/reporting worker | Repeat-check behavior, classified output, and runtime work selection | Isolated update tests, renderer tests, and clone-count assertions |
56
+ | Runtime boundary | Core/update workers; lead integrates | Conservative native refresh and explicit failure/unavailable results | Lifecycle test doubles; native evidence recorded separately |
57
+ | Project tracking | Project-management worker | Scope, acceptance matrix, risks, and remaining validation | This document and linked ADG issue |
58
+ | Integration | Lead | Combined checks, review, and final acceptance | Commands/results from the integrated working tree |
59
+
60
+ The first delivery retains conservative native behavior where the runtime's
61
+ capabilities have not been demonstrated. Skipping native refresh for version-only
62
+ changes is not a requirement. Content-addressed native caches, synthetic semantic
63
+ versions, a new producer release protocol, and a universal plugin versioning
64
+ strategy are outside this delivery.
65
+
66
+ ## Acceptance matrix
67
+
68
+ Every implementation row requires an automated regression or an explicit existing
69
+ test reference. Native validation rows require their own runtime evidence and must
70
+ not be marked complete using test doubles alone.
71
+
72
+ | ID | Scenario | Expected outcome | Evidence status |
73
+ | --- | --- | --- | --- |
74
+ | A1 | Synchronized repository release changes one skill and all plugin versions | Changed plugin is a content update; peers are version-only updates; all versions remain truthful | Passed: `plugins-update.test.ts` — `updatePlugins distinguishes lockstep release versions from component changes` |
75
+ | A2 | Independently versioned release changes one plugin | Only the affected plugin is reported as changed; peers remain untouched | Passed: `plugins-update.test.ts` — `updatePlugins reports updated when upstream content changed` and activation filtering test |
76
+ | A3 | Payload changes without a version bump | Detect content change and perform required synchronization | Passed: `plugins-update.test.ts` — `updatePlugins refreshes remaining skills after a skill is deleted upstream` |
77
+ | A4 | Manifest metadata, dependencies, component pointers, or selection dependencies change | Classify as more than version-only; preserve existing dependency and authorization checks | Passed: `plugin-changes.test.ts` — `same-version manifest configuration changes remain content updates` and `dependency metadata remains a content change and is persisted`. Existing dependency-closure coverage: `install.test.ts` — `component selection materializes its declared skill dependencies`; complete suite passed (661/661) |
78
+ | A5 | Source changes only outside the current selection | Source update and effective-selection change are not conflated; skip native work only if the effective input is proven unchanged | Passed: `plugins-update.test.ts` — `updatePlugins retains unselected source changes without unnecessary runtime refresh` |
79
+ | A6 | Disabled plugin receives content or version update | Refresh stored source while keeping it disabled; no activation | Passed: `plugins-update.test.ts` — disabled remote payload and disabled local source regression tests |
80
+ | A7 | Repository advances but one plugin's exact bytes remain equal | Record the verified revision without a content update or timestamp/native-refresh churn | Passed: monorepo checkpoint regression and `plugin-changes.test.ts` — `verified identical bytes advance source revision without installation timestamp churn` |
81
+ | A8 | Repeat update against the same verified repository revision | Avoid another clone caused by an unchanged peer's stale checkpoint | Passed: `plugins-update.test.ts` — `updatePlugins checkpoints unchanged monorepo members to avoid a second clone` |
82
+ | A9 | Source or classification fails partway through checking | Do not record an unchecked revision as a successful checkpoint or report a failed source as synchronized | Fetch-failure path passed: `plugins-update.test.ts` — `updatePlugins surfaces a source that cannot be fetched`; checkpoint persistence is confined to each successfully verified plugin; a failed peer cannot receive an unchecked checkpoint (integration code review) |
83
+ | A10 | Native synchronization fails or the runtime is unavailable | Preserve source facts, expose failure/skipped state, and avoid claiming the runtime has loaded the new version | Passed: source-version/runtime-failure test plus three failure/unverified renderer regressions in `render.test.ts`. Real unavailable-runtime behavior remains N1–N3 validation scope |
84
+ | A11 | Previous cache/comparison data is missing or a retained lock format is read | Recover or conservatively refresh; no false unchanged result or publisher burden | Passed: `plugin-changes.test.ts` — `missing comparison cache conservatively avoids a version-only claim`. Existing legacy/native/Default DSL recovery in `source-cache.test.ts` and compatibility-read v3 persistence in `telemetry.test.ts` passed in the complete suite (661/661) |
85
+ | A12 | Canonical, native, and Default DSL manifests are used | Classify normalized metadata correctly without losing exact integrity checks | Passed: canonical lockstep and Default DSL identity regressions in `plugins-update.test.ts`, plus `plugin-changes.test.ts` — `native manifest releases use normalized metadata for version-only classification` |
86
+ | N1 | Native version-only refresh | Observe actual native manifest/version registration and retained enabled/disabled state for each supported runtime | Not run |
87
+ | N2 | Native same-version content refresh | Observe actual replacement/loading behavior; do not infer it from the ADG lock alone | Not run |
88
+ | N3 | Existing session versus a new session | Record whether a reload or new session is needed separately from registration success | Not run |
89
+
90
+ ## Verification and rollout
91
+
92
+ The lead records focused regression results first, then type checking, build, and
93
+ the repository test suite appropriate to the integrated change. New telemetry
94
+ must use bounded change/outcome attributes and must not include paths, user data,
95
+ raw arguments, or secrets. Regression fixtures use temporary caches and explicit
96
+ revision resolvers to avoid touching user installations or making incidental
97
+ network calls.
98
+
99
+ Existing `updated`/`unchanged` consumers must retain a compatible interpretation;
100
+ new detail may refine their meaning but must not silently reverse it. Runtime
101
+ refresh failures continue to follow the command's established exit-code contract.
102
+
103
+ This work changes update decisions and provenance persistence. Before delivery,
104
+ review partial failure, explicit recovery, cache recovery, timestamps, and
105
+ disabled state together. This delivery adds no durable runtime retry queue and
106
+ no lock-schema migration.
107
+
108
+ ### Explicit synchronization recovery
109
+
110
+ A verified source checkpoint remains valid when a subsequent native refresh
111
+ fails. Preserve that source outcome and report the native failure or unverified
112
+ result separately, using the established nonzero failure outcome where
113
+ applicable. The report must provide an actionable pending-sync message.
114
+
115
+ Ordinary `plugins update` may take the already-checked source fast path on the
116
+ next invocation; it is not an automatic retry mechanism for the failed native
117
+ operation. Retry through `adg plugins sync` with the same scope and the intended
118
+ runtime target, for example
119
+ `adg plugins sync --global --target codex <plugin-name>` for one plugin in the
120
+ global Codex store. This is an explicit recovery contract, not a persistent work
121
+ queue. Neither a source checkpoint nor successful command dispatch proves that
122
+ an existing session has loaded the new plugin.
123
+
124
+ ## Delivery record
125
+
126
+ - Architecture decision: consumer-side separation approved by the user.
127
+ - Historical isolated investigation: unchanged peers can retain an older revision
128
+ and cause repeated clone-path execution. This is a decision-path reproduction,
129
+ not a network performance benchmark.
130
+ - Lead-reported focused result: 55/55 tests passed across
131
+ `test/plugins-update.test.ts` and `test/render.test.ts`; type checking passed.
132
+ - Lead-reported core result: 12/12 focused regressions passed, including missing
133
+ comparison cache, dependency metadata, imported native metadata, explicit
134
+ selection policy across future additions, and auxiliary Antigravity MCP repair.
135
+ - Independent review found and verified fixes for selection-policy persistence,
136
+ auxiliary projection integrity, and staging-path leakage in translated hooks.
137
+ The hook regression verifies the final installed runner path and an unchanged
138
+ update that does not request runtime refresh.
139
+ - Lead-reported type checking, build, documentation links, CLI test isolation,
140
+ and diff checks passed.
141
+ - Complete repository suite: `npm test` passed 661/661, zero failures and skips.
142
+ Type checking and build passed on the final implementation. The suite ran
143
+ with permission for the OTLP test to open its localhost listener.
144
+ - Live native runtime validation: not run as part of project-document authoring.
145
+ - Tracking issue: [ADG #161](https://github.com/RbBtSn0w/adg/issues/161).
146
+ - apple-skills PR closure request: blocked by its already-merged and released
147
+ state, confirmed by the lead. No producer revert is included in this delivery.
148
+ - ADG implementation stays local until a separate commit/push/PR instruction.
149
+
150
+ The tracking issue should remain open until its required implementation evidence
151
+ is recorded. Deferred native optimizations must be identified explicitly; a
152
+ conservative, tested refresh path can ship without claiming those optimizations.