agents-inc 0.173.0 → 0.175.0

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 (88) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/dist/{chunk-LJQXQTFC.js → chunk-37QFHJUW.js} +142 -13
  3. package/dist/chunk-37QFHJUW.js.map +1 -0
  4. package/dist/chunk-6HJVH27C.js +114 -0
  5. package/dist/chunk-6HJVH27C.js.map +1 -0
  6. package/dist/{chunk-ITQF35UQ.js → chunk-DQB3E2SX.js} +3 -3
  7. package/dist/{chunk-AARQBW5L.js → chunk-EGC7PNDI.js} +46 -32
  8. package/dist/chunk-EGC7PNDI.js.map +1 -0
  9. package/dist/{chunk-3N4FSTVX.js → chunk-EHEBN4NB.js} +2 -2
  10. package/dist/{chunk-EHJIQDXR.js → chunk-GNMRXXRY.js} +39 -40
  11. package/dist/chunk-GNMRXXRY.js.map +1 -0
  12. package/dist/{chunk-G7NUK3BF.js → chunk-ICHWAFAC.js} +29 -19
  13. package/dist/chunk-ICHWAFAC.js.map +1 -0
  14. package/dist/{chunk-Q4UNHVPX.js → chunk-MFCZARV2.js} +9 -9
  15. package/dist/chunk-MFCZARV2.js.map +1 -0
  16. package/dist/{chunk-SPQSNZMM.js → chunk-P5XEK7HC.js} +2 -2
  17. package/dist/{chunk-VR6QTK5Z.js → chunk-Q4NWATGH.js} +31 -27
  18. package/dist/chunk-Q4NWATGH.js.map +1 -0
  19. package/dist/{chunk-BRZA7ZCX.js → chunk-SI2LLEIR.js} +5 -5
  20. package/dist/{chunk-VSPC74SS.js → chunk-SNXEYAFP.js} +45 -30
  21. package/dist/chunk-SNXEYAFP.js.map +1 -0
  22. package/dist/{chunk-A3ZAXL5T.js → chunk-SRII2GMF.js} +3 -3
  23. package/dist/{chunk-7OG635DK.js → chunk-TG3SPPZY.js} +6 -2
  24. package/dist/{chunk-7OG635DK.js.map → chunk-TG3SPPZY.js.map} +1 -1
  25. package/dist/{chunk-MHAQWMNJ.js → chunk-U46LYYRA.js} +3 -6
  26. package/dist/{chunk-MHAQWMNJ.js.map → chunk-U46LYYRA.js.map} +1 -1
  27. package/dist/{chunk-3R3LHA4Q.js → chunk-XYBHH3M5.js} +2 -2
  28. package/dist/{chunk-F437ICEG.js → chunk-YLFKFVQP.js} +11 -11
  29. package/dist/chunk-YLFKFVQP.js.map +1 -0
  30. package/dist/{chunk-WVFBBZEP.js → chunk-YM3VEDAP.js} +698 -325
  31. package/dist/chunk-YM3VEDAP.js.map +1 -0
  32. package/dist/commands/build/marketplace.js +4 -4
  33. package/dist/commands/build/plugins.js +6 -6
  34. package/dist/commands/compile.js +16 -16
  35. package/dist/commands/compile.js.map +1 -1
  36. package/dist/commands/doctor.js +73 -78
  37. package/dist/commands/doctor.js.map +1 -1
  38. package/dist/commands/edit.js +84 -80
  39. package/dist/commands/edit.js.map +1 -1
  40. package/dist/commands/eject.js +27 -18
  41. package/dist/commands/eject.js.map +1 -1
  42. package/dist/commands/init.js +16 -18
  43. package/dist/commands/list.js +42 -18
  44. package/dist/commands/list.js.map +1 -1
  45. package/dist/commands/new/marketplace.js +4 -4
  46. package/dist/commands/search.js +9 -9
  47. package/dist/commands/share.js +13 -13
  48. package/dist/commands/share.js.map +1 -1
  49. package/dist/commands/uninstall.js +29 -27
  50. package/dist/commands/uninstall.js.map +1 -1
  51. package/dist/commands/update.js +17 -18
  52. package/dist/commands/update.js.map +1 -1
  53. package/dist/components/common/select-list.js +2 -2
  54. package/dist/components/common/skill-agent-summary.js +3 -3
  55. package/dist/components/common/summary-panel.js +4 -7
  56. package/dist/hooks/init.js +39 -26
  57. package/dist/hooks/init.js.map +1 -1
  58. package/dist/load-agent-defs-BJ4KBKBA.js +14 -0
  59. package/dist/{recompile-project-agents-6G6M2RS6.js → recompile-project-agents-2QTFMYDC.js} +8 -8
  60. package/dist/{source-loader-W7XCNKNA.js → source-loader-I6SWWDUF.js} +4 -4
  61. package/package.json +1 -1
  62. package/dist/chunk-2RTBSLSR.js +0 -82
  63. package/dist/chunk-2RTBSLSR.js.map +0 -1
  64. package/dist/chunk-AARQBW5L.js.map +0 -1
  65. package/dist/chunk-EHJIQDXR.js.map +0 -1
  66. package/dist/chunk-F437ICEG.js.map +0 -1
  67. package/dist/chunk-G7NUK3BF.js.map +0 -1
  68. package/dist/chunk-LJQXQTFC.js.map +0 -1
  69. package/dist/chunk-N33AKFLR.js +0 -24
  70. package/dist/chunk-N33AKFLR.js.map +0 -1
  71. package/dist/chunk-Q4UNHVPX.js.map +0 -1
  72. package/dist/chunk-Q6WRR4BN.js +0 -195
  73. package/dist/chunk-Q6WRR4BN.js.map +0 -1
  74. package/dist/chunk-VR6QTK5Z.js.map +0 -1
  75. package/dist/chunk-VSPC74SS.js.map +0 -1
  76. package/dist/chunk-WVFBBZEP.js.map +0 -1
  77. package/dist/components/common/scroll-affordance.js +0 -9
  78. package/dist/load-agent-defs-E67DSYTN.js +0 -14
  79. package/dist/source-loader-W7XCNKNA.js.map +0 -1
  80. /package/dist/{chunk-ITQF35UQ.js.map → chunk-DQB3E2SX.js.map} +0 -0
  81. /package/dist/{chunk-3N4FSTVX.js.map → chunk-EHEBN4NB.js.map} +0 -0
  82. /package/dist/{chunk-SPQSNZMM.js.map → chunk-P5XEK7HC.js.map} +0 -0
  83. /package/dist/{chunk-BRZA7ZCX.js.map → chunk-SI2LLEIR.js.map} +0 -0
  84. /package/dist/{chunk-A3ZAXL5T.js.map → chunk-SRII2GMF.js.map} +0 -0
  85. /package/dist/{chunk-3R3LHA4Q.js.map → chunk-XYBHH3M5.js.map} +0 -0
  86. /package/dist/{components/common/scroll-affordance.js.map → load-agent-defs-BJ4KBKBA.js.map} +0 -0
  87. /package/dist/{recompile-project-agents-6G6M2RS6.js.map → recompile-project-agents-2QTFMYDC.js.map} +0 -0
  88. /package/dist/{load-agent-defs-E67DSYTN.js.map → source-loader-I6SWWDUF.js.map} +0 -0
@@ -6,16 +6,16 @@ import {
6
6
  editorPayloadForInstallation,
7
7
  publishSeedConfig,
8
8
  skillsAuthoredHere
9
- } from "../chunk-Q4UNHVPX.js";
9
+ } from "../chunk-MFCZARV2.js";
10
10
  import {
11
11
  unofferablePlacementsFound
12
- } from "../chunk-F437ICEG.js";
12
+ } from "../chunk-YLFKFVQP.js";
13
13
  import {
14
14
  openUrl
15
- } from "../chunk-SPQSNZMM.js";
15
+ } from "../chunk-P5XEK7HC.js";
16
16
  import {
17
17
  fetchSeedConfig
18
- } from "../chunk-A3ZAXL5T.js";
18
+ } from "../chunk-SRII2GMF.js";
19
19
  import {
20
20
  Confirm
21
21
  } from "../chunk-OZXAJNLA.js";
@@ -24,11 +24,10 @@ import {
24
24
  } from "../chunk-P6CYS4JK.js";
25
25
  import {
26
26
  summaryPanelBlock
27
- } from "../chunk-Q6WRR4BN.js";
28
- import "../chunk-N33AKFLR.js";
27
+ } from "../chunk-6HJVH27C.js";
29
28
  import {
30
29
  hostCompileNotices
31
- } from "../chunk-3N4FSTVX.js";
30
+ } from "../chunk-EHEBN4NB.js";
32
31
  import {
33
32
  compileAgentsAllScopes,
34
33
  compileProjectScope,
@@ -38,43 +37,42 @@ import {
38
37
  projectsAFanOutReaches,
39
38
  sayCapturedWarnings,
40
39
  writeProjectConfig
41
- } from "../chunk-VSPC74SS.js";
40
+ } from "../chunk-SNXEYAFP.js";
42
41
  import {
43
42
  copyLocalSkills,
44
43
  discoverInstalledSkills,
45
44
  removeCompiledAgents,
46
45
  uninstallPluginSkills
47
- } from "../chunk-VR6QTK5Z.js";
46
+ } from "../chunk-Q4NWATGH.js";
48
47
  import {
49
48
  loadAgentDefs
50
- } from "../chunk-ITQF35UQ.js";
51
- import "../chunk-BRZA7ZCX.js";
52
- import "../chunk-EHJIQDXR.js";
49
+ } from "../chunk-DQB3E2SX.js";
50
+ import "../chunk-SI2LLEIR.js";
51
+ import "../chunk-GNMRXXRY.js";
53
52
  import "../chunk-KIK5EZYD.js";
54
53
  import {
55
54
  agentChangesAmong,
56
55
  formatScopeTag
57
- } from "../chunk-G7NUK3BF.js";
58
- import {
59
- installationToName,
60
- providerFlag,
61
- providerNamedBy,
62
- refuseAnAmbiguousInstallation
63
- } from "../chunk-2RTBSLSR.js";
56
+ } from "../chunk-ICHWAFAC.js";
64
57
  import {
65
58
  BaseCommand,
66
59
  EXIT_CODES,
67
60
  carriedSkillsThatDiffer,
61
+ installationToName,
68
62
  installsAtHome,
69
63
  joinedStatement,
70
64
  notInstalledGlobally,
65
+ panelRowEntries,
66
+ providerFlag,
67
+ providerNamedBy,
71
68
  readInstalledGlobal,
72
69
  reconcileSharedConfig,
70
+ refuseAnAmbiguousInstallation,
73
71
  registerExternalSkills,
74
72
  restoreInstalledGlobal,
75
73
  sameAssignments,
76
74
  writeExternalSkills
77
- } from "../chunk-LJQXQTFC.js";
75
+ } from "../chunk-37QFHJUW.js";
78
76
  import {
79
77
  ERROR_MESSAGES,
80
78
  INCOMPLETE_WORK_RECOVERY,
@@ -103,7 +101,7 @@ import {
103
101
  keepsGlobalInstall,
104
102
  keptAsInstalledGlobally,
105
103
  keptUnassigned,
106
- loadProjectConfig,
104
+ loadConfigInPlay,
107
105
  localSkillsCopied,
108
106
  migrateLocalSkillScope,
109
107
  nothingInstalledToApplyTo,
@@ -115,14 +113,16 @@ import {
115
113
  seedToInstallSelection,
116
114
  sharedConfigDestinations,
117
115
  sharedConfigNeedsTerminal,
116
+ stoppingOnARefusal,
118
117
  subAgentChanged,
119
118
  unplaceableKept
120
- } from "../chunk-WVFBBZEP.js";
119
+ } from "../chunk-YM3VEDAP.js";
121
120
  import {
122
121
  getSkillById,
123
122
  getSkillDisplayName,
123
+ getSkillEntryDisplayName,
124
124
  inertLine
125
- } from "../chunk-7OG635DK.js";
125
+ } from "../chunk-TG3SPPZY.js";
126
126
  import {
127
127
  CLI_COLORS,
128
128
  CLI_INVOKE_COMMAND,
@@ -133,7 +133,7 @@ import {
133
133
  formatSourceDisplayName,
134
134
  isActiveAt,
135
135
  isGlobalTombstone
136
- } from "../chunk-MHAQWMNJ.js";
136
+ } from "../chunk-U46LYYRA.js";
137
137
  import "../chunk-GHHJYNAN.js";
138
138
 
139
139
  // src/cli/commands/edit.tsx
@@ -182,17 +182,25 @@ function sourceChangeLine(skillId, change) {
182
182
  const to = formatSourceDisplayName(change.to);
183
183
  return changeLine("~", getSkillDisplayName(skillId), ` (${from} \u2192 ${to})`);
184
184
  }
185
+ function removedSkillLine(skillId, oldSkills) {
186
+ const removed = installedEntryOf(skillId, oldSkills);
187
+ return changeLine("-", `${getSkillEntryDisplayName(removed)} ${formatScopeTag(removed.scope)}`);
188
+ }
189
+ function installedEntryOf(skillId, oldSkills) {
190
+ const entry = oldSkills.find((s) => s.id === skillId);
191
+ if (entry === void 0) throw new Error(`Removed skill '${skillId}' has no installed entry`);
192
+ return entry;
193
+ }
185
194
  function scopeLabelOf(skillId, skills) {
186
195
  const skill = skills.find((s) => s.id === skillId);
187
196
  return skill === void 0 ? "" : ` ${formatScopeTag(skill.scope)}`;
188
197
  }
189
198
  function changeSummaryLines(changes, newSkills, oldSkills) {
190
199
  const addedSkill = (id) => changeLine("+", `${inertLine(getSkillById(id).displayName)}${scopeLabelOf(id, newSkills)}`);
191
- const removedSkill = (id) => changeLine("-", `${getSkillDisplayName(id)}${scopeLabelOf(id, oldSkills)}`);
192
200
  const joinedGlobalDetail = ` ${formatScopeTag("global")} (agent: skills added)`;
193
201
  return [
194
202
  ...changes.addedSkills.map(addedSkill),
195
- ...changes.removedSkills.map(removedSkill),
203
+ ...changes.removedSkills.map((id) => removedSkillLine(id, oldSkills)),
196
204
  ...changes.addedAgents.map((name) => changeLine("+", name, AGENT_DETAIL)),
197
205
  ...changes.removedAgents.map((name) => changeLine("-", name, AGENT_DETAIL)),
198
206
  ...[...changes.sourceChanges].map(([id, change]) => sourceChangeLine(id, change)),
@@ -238,7 +246,7 @@ function changedSubAgents(changes, { result, installedGlobal }, projectConfig) {
238
246
  ...changes.tuningChanges.keys(),
239
247
  ...changes.joinedGlobalAgents
240
248
  ]).filter((name) => !arrivingOrLeaving.has(name));
241
- const after = { agents: result.agentConfigs, stack: result.assignedStack };
249
+ const after = { agents: result.agentConfigs, skills: result.skills, stack: result.assignedStack };
242
250
  if (installedGlobal === null) return agentChangesAmong(changed, projectConfig, after);
243
251
  const [heldGlobal, ownedHere] = partition(changed, (name) => isHeldGlobally(name, result));
244
252
  return [
@@ -291,27 +299,26 @@ function withReassignments(changes, result, installedStack, editRoot) {
291
299
  );
292
300
  return { ...changes, reassignedAgents: reassigned.map((agent) => agent.name) };
293
301
  }
294
- function keptStatements(kept) {
295
- return [...authorshipStatement(kept), ...catalogueStatement(kept)];
302
+ function keptStatements(kept, namedBy) {
303
+ return [...authorshipStatement(kept, namedBy), ...catalogueStatement(kept, namedBy)];
296
304
  }
297
- function authorshipStatement(kept) {
305
+ function authorshipStatement(kept, namedBy) {
298
306
  if (kept.authoredSkillIds.length === 0) return [];
299
- return [authoredHereKept(kept.authoredSkillIds)];
307
+ return [authoredHereKept(kept.authoredSkillIds, namedBy)];
300
308
  }
301
- function catalogueStatement(kept) {
309
+ function catalogueStatement(kept, namedBy) {
302
310
  if (kept.unplaceableSkillIds.length === 0) return [];
303
- return [unplaceableKept(kept.unplaceableSkillIds)];
311
+ return [unplaceableKept(kept.unplaceableSkillIds, namedBy)];
304
312
  }
305
- function unassignedStatement(unassigned) {
313
+ function unassignedStatement(unassigned, namedBy) {
306
314
  if (unassigned.length === 0) return [];
307
- return [
308
- unassigned.map(({ skillId, agentName, category }) => keptUnassigned(skillId, agentName, category)).join("\n")
309
- ];
315
+ return [unassigned.map((row) => keptUnassigned(row, namedBy)).join("\n")];
310
316
  }
311
317
  function keptOnApply(reconciled, held, revisedCarried, runFromHome) {
318
+ const namedBy = panelRowEntries(held);
312
319
  return [
313
- ...keptStatements(reconciled.kept),
314
- ...unassignedStatement(reconciled.unassigned),
320
+ ...keptStatements(reconciled.kept, namedBy),
321
+ ...unassignedStatement(reconciled.unassigned, namedBy),
315
322
  ...joinedStatement(held),
316
323
  ...keptAsInstalledStatement(held, revisedCarried, runFromHome)
317
324
  ];
@@ -320,7 +327,15 @@ function keptAsInstalledStatement(held, revisedCarried, runFromHome) {
320
327
  const skillIds = [...held.keptAsInstalled.skillIds, ...revisedCarried];
321
328
  const { agentNames } = held.keptAsInstalled;
322
329
  if (skillIds.length === 0 && agentNames.length === 0) return [];
323
- return [keptAsInstalledGlobally(skillIds, agentNames, runFromHome.id, runFromHome.provider)];
330
+ return [
331
+ keptAsInstalledGlobally(
332
+ skillIds,
333
+ agentNames,
334
+ runFromHome.id,
335
+ runFromHome.provider,
336
+ panelRowEntries(held)
337
+ )
338
+ ];
324
339
  }
325
340
  function applyAuthority(editRoot) {
326
341
  return editRoot.isGlobal ? "all" : "owned";
@@ -404,6 +419,7 @@ var Edit = class _Edit extends BaseCommand {
404
419
  if (flags.ui && flags.from !== void 0) {
405
420
  return this.openSharedInEditor(flags.from, cwd, namedProvider);
406
421
  }
422
+ await this.sayWhenTheGlobalInstallationStandsIn(namedProvider);
407
423
  await refuseAnAmbiguousInstallation(
408
424
  cwd,
409
425
  "edit",
@@ -444,8 +460,9 @@ var Edit = class _Edit extends BaseCommand {
444
460
  async applyApprovedChanges(changes, active, result, context, editRoot) {
445
461
  const { selection: activeSelection, oldSkills, oldAgents } = active;
446
462
  this.logChangeSummary(changes, activeSelection.skills, oldSkills);
447
- await this.applyMigrations(changes, active, context, editRoot);
448
- await this.applyScopeChanges(changes, activeSelection, context, editRoot);
463
+ const migrationPlan = migrationPlanOf(changes, active);
464
+ await this.applyMigrations(migrationPlan, context, editRoot);
465
+ await this.applyScopeChanges(migrationPlan.scopeChanges, context, editRoot);
449
466
  await this.applyCollapsedPairs(changes, context, editRoot);
450
467
  await this.applyPluginChanges(changes, activeSelection, oldSkills, context, editRoot);
451
468
  await this.copyNewLocalSkills(changes, activeSelection, context, editRoot);
@@ -478,7 +495,7 @@ var Edit = class _Edit extends BaseCommand {
478
495
  );
479
496
  const revisedGlobally = await carriedSkillsThatDiffer(difference(carried, arrivingCarried));
480
497
  sayCapturedWarnings(context.startupMessages);
481
- this.warnOfSkippedEntries(mapping);
498
+ this.warnOfSkippedEntries(mapping, context.sourceResult.unloadedSkillIds);
482
499
  const runFromHome = {
483
500
  id: installsAtHome(result) ? id : void 0,
484
501
  provider: providerToNameAt(os.homedir(), providerInUse(editRoot.dir))
@@ -630,7 +647,7 @@ var Edit = class _Edit extends BaseCommand {
630
647
  * those a catalogue lacks, as `edit --from` asks. The config read is the one the payload reads.
631
648
  */
632
649
  async ensureInstalledSkillsReadable(projectDir) {
633
- const loaded = await loadProjectConfig(projectDir);
650
+ const loaded = await loadConfigInPlay(projectDir);
634
651
  if (!loaded) return;
635
652
  await this.refuseUnusableSavedSkillMetadata(
636
653
  loaded.config.skills,
@@ -675,10 +692,9 @@ var Edit = class _Edit extends BaseCommand {
675
692
  }
676
693
  const { installation, config: projectConfig } = detected;
677
694
  try {
678
- const { sourceResult, startupMessages } = await loadSource({
679
- projectDir: installation.projectDir,
680
- captureStartupMessages: true
681
- });
695
+ const { sourceResult, startupMessages } = await stoppingOnARefusal(
696
+ () => loadSource({ projectDir: installation.projectDir, captureStartupMessages: true })
697
+ );
682
698
  return { installation, projectConfig, sourceResult, startupMessages };
683
699
  } catch (error) {
684
700
  this.handleError(error);
@@ -692,8 +708,7 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
692
708
  }
693
709
  this.log("");
694
710
  }
695
- async applyMigrations(changes, active, context, editRoot) {
696
- const migrationPlan = migrationPlanOf(changes, active);
711
+ async applyMigrations(migrationPlan, context, editRoot) {
697
712
  if (migrationPlan.toEject.length === 0 && migrationPlan.toPlugin.length === 0) return;
698
713
  this.announceMigrations(migrationPlan);
699
714
  if (migrationPlan.toPlugin.length > 0) {
@@ -765,21 +780,23 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
765
780
  this.log(chalk.hex(CLI_COLORS.NEUTRAL)(installingBesideGlobalCopies(count)));
766
781
  }
767
782
  /**
768
- * A collapsed `[P][G]` pair is not a move: its project half is dropped
769
- * ({@link applyCollapsedPairs}).
783
+ * Only moves that keep their mode: a switch lands at its new scope ({@link applyMigrations}). A
784
+ * collapsed `[P][G]` pair is not a move: its project half is dropped ({@link applyCollapsedPairs}).
770
785
  */
771
- async applyScopeChanges(changes, filteredResult, context, editRoot) {
772
- const scopeChanges = scopeMovesOf(changes);
773
- await moveEjectedSkillCopies(scopeChanges, filteredResult.skills, editRoot.dir);
774
- if (!movesAPluginSkill(scopeChanges, filteredResult.skills)) return;
786
+ async applyScopeChanges(scopeMoves, context, editRoot) {
787
+ const [copyMoves, pluginMoves] = partition(
788
+ scopeMoves,
789
+ (move) => move.newSource === EJECT_SOURCE
790
+ );
791
+ await moveEjectedSkillCopies(copyMoves, editRoot.dir);
792
+ if (pluginMoves.length === 0) return;
775
793
  const marketplace = await this.requireMarketplaceOrExit(
776
794
  context.sourceResult,
777
795
  "migrate plugin skill scopes",
778
796
  hostAt(editRoot.dir)
779
797
  );
780
798
  const pluginScopeResult = await migratePluginSkillScopes(
781
- scopeChanges,
782
- filteredResult.skills,
799
+ pluginMoves,
783
800
  marketplace,
784
801
  editRoot.dir
785
802
  );
@@ -1135,20 +1152,11 @@ function scopeMovesOf(changes) {
1135
1152
  const collapsed = new Set(changes.collapsedPairs.map(({ projectHalf }) => projectHalf.id));
1136
1153
  return new Map([...changes.scopeChanges].filter(([id]) => !collapsed.has(id)));
1137
1154
  }
1138
- async function moveEjectedSkillCopies(scopeMoves, skills, projectDir) {
1139
- for (const [skillId, change] of scopeMoves) {
1140
- const skillConfig = skills.find((s) => s.id === skillId);
1141
- if (skillConfig?.origin === EJECT_SOURCE) {
1142
- await migrateLocalSkillScope(skillId, change.from, projectDir);
1143
- }
1155
+ async function moveEjectedSkillCopies(copyMoves, projectDir) {
1156
+ for (const move of copyMoves) {
1157
+ await migrateLocalSkillScope(move.id, move.oldScope, projectDir);
1144
1158
  }
1145
1159
  }
1146
- function movesAPluginSkill(scopeMoves, skills) {
1147
- return [...scopeMoves.keys()].some((skillId) => {
1148
- const skill = skills.find((s) => s.id === skillId);
1149
- return skill !== void 0 && skill.origin !== EJECT_SOURCE;
1150
- });
1151
- }
1152
1160
  var STALE_AGENT_SCOPES = ["project", "global"];
1153
1161
  var UNRECORDED_AGENT_SCOPE = "project";
1154
1162
  function installedScope(name, oldAgents) {
@@ -1173,22 +1181,18 @@ function hasAnyChanges(changes) {
1173
1181
  function changesTheConfig(changes) {
1174
1182
  return changes.reassignedAgents.length > 0 || changes.joinedGlobalAgents.length > 0 || changes.addedSkills.length > 0 || changes.removedSkills.length > 0 || changes.addedAgents.length > 0 || changes.removedAgents.length > 0 || changes.sourceChanges.size > 0 || changes.scopeChanges.size > 0 || changes.agentScopeChanges.size > 0 || changes.tuningChanges.size > 0;
1175
1183
  }
1176
- async function migratePluginSkillScopes(scopeChanges, skills, marketplace, projectDir) {
1184
+ async function migratePluginSkillScopes(pluginMoves, marketplace, projectDir) {
1177
1185
  const host = hostAt(projectDir);
1178
1186
  const failed = [];
1179
- for (const [skillId, change] of scopeChanges) {
1180
- const skillConfig = skills.find((s) => s.id === skillId);
1181
- if (!skillConfig || skillConfig.origin === EJECT_SOURCE) {
1182
- continue;
1183
- }
1184
- const pluginRef = buildMarketplacePluginRef(skillId, marketplace);
1187
+ for (const move of pluginMoves) {
1188
+ const pluginRef = buildMarketplacePluginRef(move.id, marketplace);
1185
1189
  try {
1186
- if (change.from === "project") {
1190
+ if (move.oldScope === "project") {
1187
1191
  await host.uninstallPlugin(pluginRef, "project", projectDir);
1188
1192
  }
1189
- await host.installPlugin(pluginRef, change.to, projectDir);
1193
+ await host.installPlugin(pluginRef, move.newScope, projectDir);
1190
1194
  } catch (error) {
1191
- failed.push({ id: skillId, error: getErrorMessage(error) });
1195
+ failed.push({ id: move.id, error: getErrorMessage(error) });
1192
1196
  }
1193
1197
  }
1194
1198
  return { failed };