agents-inc 0.175.0 → 0.177.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 (104) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +2 -2
  3. package/dist/chunk-2FE4AJNC.js +164 -0
  4. package/dist/chunk-2FE4AJNC.js.map +1 -0
  5. package/dist/{chunk-U46LYYRA.js → chunk-4SIBDIIO.js} +49 -13
  6. package/dist/chunk-4SIBDIIO.js.map +1 -0
  7. package/dist/chunk-5ZK4IND4.js +30 -0
  8. package/dist/chunk-5ZK4IND4.js.map +1 -0
  9. package/dist/{chunk-GNMRXXRY.js → chunk-77SHXTDD.js} +137 -56
  10. package/dist/chunk-77SHXTDD.js.map +1 -0
  11. package/dist/{chunk-EHEBN4NB.js → chunk-7OJ2SS4E.js} +10 -86
  12. package/dist/chunk-7OJ2SS4E.js.map +1 -0
  13. package/dist/{chunk-6HJVH27C.js → chunk-7WN6TUZP.js} +7 -8
  14. package/dist/chunk-7WN6TUZP.js.map +1 -0
  15. package/dist/chunk-AVKX3IXF.js +117 -0
  16. package/dist/chunk-AVKX3IXF.js.map +1 -0
  17. package/dist/{chunk-YM3VEDAP.js → chunk-D2PC7NIR.js} +2042 -1875
  18. package/dist/chunk-D2PC7NIR.js.map +1 -0
  19. package/dist/{chunk-37QFHJUW.js → chunk-E6W3PYGF.js} +909 -80
  20. package/dist/chunk-E6W3PYGF.js.map +1 -0
  21. package/dist/chunk-H33ZAEKH.js +147 -0
  22. package/dist/chunk-H33ZAEKH.js.map +1 -0
  23. package/dist/{chunk-MFCZARV2.js → chunk-JEFVFZAR.js} +50 -152
  24. package/dist/chunk-JEFVFZAR.js.map +1 -0
  25. package/dist/{chunk-TG3SPPZY.js → chunk-KKGJH46C.js} +3 -21
  26. package/dist/chunk-KKGJH46C.js.map +1 -0
  27. package/dist/chunk-OIQKRXHH.js +142 -0
  28. package/dist/chunk-OIQKRXHH.js.map +1 -0
  29. package/dist/{chunk-SNXEYAFP.js → chunk-TNN72UL6.js} +294 -247
  30. package/dist/chunk-TNN72UL6.js.map +1 -0
  31. package/dist/{chunk-Q4NWATGH.js → chunk-V3WJMNBF.js} +98 -23
  32. package/dist/chunk-V3WJMNBF.js.map +1 -0
  33. package/dist/chunk-VFD2XYM7.js +14 -0
  34. package/dist/chunk-VFD2XYM7.js.map +1 -0
  35. package/dist/{chunk-XYBHH3M5.js → chunk-WH7JXGDA.js} +2 -2
  36. package/dist/{chunk-DQB3E2SX.js → chunk-XSR4WRXJ.js} +3 -3
  37. package/dist/{chunk-EGC7PNDI.js → chunk-Y5VMB73R.js} +302 -119
  38. package/dist/chunk-Y5VMB73R.js.map +1 -0
  39. package/dist/chunk-ZIBWVTLN.js +18 -0
  40. package/dist/chunk-ZIBWVTLN.js.map +1 -0
  41. package/dist/commands/build/marketplace.js +6 -9
  42. package/dist/commands/build/marketplace.js.map +1 -1
  43. package/dist/commands/build/plugins.js +10 -38
  44. package/dist/commands/build/plugins.js.map +1 -1
  45. package/dist/commands/compile.js +64 -81
  46. package/dist/commands/compile.js.map +1 -1
  47. package/dist/commands/doctor.js +266 -153
  48. package/dist/commands/doctor.js.map +1 -1
  49. package/dist/commands/edit.js +84 -158
  50. package/dist/commands/edit.js.map +1 -1
  51. package/dist/commands/eject.js +66 -52
  52. package/dist/commands/eject.js.map +1 -1
  53. package/dist/commands/init.js +19 -16
  54. package/dist/commands/list.js +13 -13
  55. package/dist/commands/list.js.map +1 -1
  56. package/dist/commands/new/marketplace.js +5 -4
  57. package/dist/commands/new/marketplace.js.map +1 -1
  58. package/dist/commands/search.js +18 -12
  59. package/dist/commands/search.js.map +1 -1
  60. package/dist/commands/share.js +27 -52
  61. package/dist/commands/share.js.map +1 -1
  62. package/dist/commands/uninstall.js +145 -58
  63. package/dist/commands/uninstall.js.map +1 -1
  64. package/dist/commands/update.js +101 -36
  65. package/dist/commands/update.js.map +1 -1
  66. package/dist/components/common/header-row.js +9 -0
  67. package/dist/components/common/select-list.js +2 -2
  68. package/dist/components/common/skill-agent-summary.js +4 -3
  69. package/dist/components/common/summary-panel.js +6 -4
  70. package/dist/hooks/init.js +35 -21
  71. package/dist/hooks/init.js.map +1 -1
  72. package/dist/load-agent-defs-OCFWOZD2.js +14 -0
  73. package/dist/{recompile-project-agents-2QTFMYDC.js → recompile-project-agents-CXZBPIUS.js} +9 -9
  74. package/dist/{recompile-project-agents-2QTFMYDC.js.map → recompile-project-agents-CXZBPIUS.js.map} +1 -1
  75. package/dist/{source-loader-I6SWWDUF.js → source-loader-GGDQDMN4.js} +6 -4
  76. package/dist/source-loader-GGDQDMN4.js.map +1 -0
  77. package/package.json +1 -1
  78. package/src/schemas/stacks.schema.json +105 -1
  79. package/dist/chunk-37QFHJUW.js.map +0 -1
  80. package/dist/chunk-6HJVH27C.js.map +0 -1
  81. package/dist/chunk-EGC7PNDI.js.map +0 -1
  82. package/dist/chunk-EHEBN4NB.js.map +0 -1
  83. package/dist/chunk-GNMRXXRY.js.map +0 -1
  84. package/dist/chunk-ICHWAFAC.js +0 -263
  85. package/dist/chunk-ICHWAFAC.js.map +0 -1
  86. package/dist/chunk-MFCZARV2.js.map +0 -1
  87. package/dist/chunk-P5XEK7HC.js +0 -35
  88. package/dist/chunk-P5XEK7HC.js.map +0 -1
  89. package/dist/chunk-Q4NWATGH.js.map +0 -1
  90. package/dist/chunk-SI2LLEIR.js +0 -160
  91. package/dist/chunk-SI2LLEIR.js.map +0 -1
  92. package/dist/chunk-SNXEYAFP.js.map +0 -1
  93. package/dist/chunk-SRII2GMF.js +0 -428
  94. package/dist/chunk-SRII2GMF.js.map +0 -1
  95. package/dist/chunk-TG3SPPZY.js.map +0 -1
  96. package/dist/chunk-U46LYYRA.js.map +0 -1
  97. package/dist/chunk-YLFKFVQP.js +0 -39
  98. package/dist/chunk-YLFKFVQP.js.map +0 -1
  99. package/dist/chunk-YM3VEDAP.js.map +0 -1
  100. package/dist/load-agent-defs-BJ4KBKBA.js +0 -14
  101. /package/dist/{chunk-XYBHH3M5.js.map → chunk-WH7JXGDA.js.map} +0 -0
  102. /package/dist/{chunk-DQB3E2SX.js.map → chunk-XSR4WRXJ.js.map} +0 -0
  103. /package/dist/{load-agent-defs-BJ4KBKBA.js.map → components/common/header-row.js.map} +0 -0
  104. /package/dist/{source-loader-I6SWWDUF.js.map → load-agent-defs-OCFWOZD2.js.map} +0 -0
@@ -4,18 +4,8 @@ import {
4
4
  } from "../chunk-ZEGM3MVR.js";
5
5
  import {
6
6
  editorPayloadForInstallation,
7
- publishSeedConfig,
8
7
  skillsAuthoredHere
9
- } from "../chunk-MFCZARV2.js";
10
- import {
11
- unofferablePlacementsFound
12
- } from "../chunk-YLFKFVQP.js";
13
- import {
14
- openUrl
15
- } from "../chunk-P5XEK7HC.js";
16
- import {
17
- fetchSeedConfig
18
- } from "../chunk-SRII2GMF.js";
8
+ } from "../chunk-JEFVFZAR.js";
19
9
  import {
20
10
  Confirm
21
11
  } from "../chunk-OZXAJNLA.js";
@@ -24,10 +14,11 @@ import {
24
14
  } from "../chunk-P6CYS4JK.js";
25
15
  import {
26
16
  summaryPanelBlock
27
- } from "../chunk-6HJVH27C.js";
17
+ } from "../chunk-7WN6TUZP.js";
28
18
  import {
29
19
  hostCompileNotices
30
- } from "../chunk-EHEBN4NB.js";
20
+ } from "../chunk-7OJ2SS4E.js";
21
+ import "../chunk-H33ZAEKH.js";
31
22
  import {
32
23
  compileAgentsAllScopes,
33
24
  compileProjectScope,
@@ -37,42 +28,44 @@ import {
37
28
  projectsAFanOutReaches,
38
29
  sayCapturedWarnings,
39
30
  writeProjectConfig
40
- } from "../chunk-SNXEYAFP.js";
31
+ } from "../chunk-TNN72UL6.js";
41
32
  import {
42
33
  copyLocalSkills,
43
34
  discoverInstalledSkills,
35
+ pluginRefsOf,
44
36
  removeCompiledAgents,
37
+ removeUnderFirstNameHeld,
45
38
  uninstallPluginSkills
46
- } from "../chunk-Q4NWATGH.js";
39
+ } from "../chunk-V3WJMNBF.js";
47
40
  import {
48
41
  loadAgentDefs
49
- } from "../chunk-DQB3E2SX.js";
50
- import "../chunk-SI2LLEIR.js";
51
- import "../chunk-GNMRXXRY.js";
42
+ } from "../chunk-XSR4WRXJ.js";
43
+ import "../chunk-VFD2XYM7.js";
44
+ import "../chunk-5ZK4IND4.js";
45
+ import "../chunk-77SHXTDD.js";
52
46
  import "../chunk-KIK5EZYD.js";
53
- import {
54
- agentChangesAmong,
55
- formatScopeTag
56
- } from "../chunk-ICHWAFAC.js";
47
+ import "../chunk-ZIBWVTLN.js";
48
+ import "../chunk-OIQKRXHH.js";
57
49
  import {
58
50
  BaseCommand,
59
51
  EXIT_CODES,
60
52
  carriedSkillsThatDiffer,
61
- installationToName,
62
- installsAtHome,
63
53
  joinedStatement,
54
+ keptAsInstalledStatement,
64
55
  notInstalledGlobally,
65
56
  panelRowEntries,
66
57
  providerFlag,
67
58
  providerNamedBy,
68
59
  readInstalledGlobal,
69
60
  reconcileSharedConfig,
70
- refuseAnAmbiguousInstallation,
71
- registerExternalSkills,
72
61
  restoreInstalledGlobal,
73
- sameAssignments,
74
- writeExternalSkills
75
- } from "../chunk-37QFHJUW.js";
62
+ runFromHomeFor,
63
+ sameAssignments
64
+ } from "../chunk-E6W3PYGF.js";
65
+ import {
66
+ agentChangesAmong,
67
+ formatScopeTag
68
+ } from "../chunk-2FE4AJNC.js";
76
69
  import {
77
70
  ERROR_MESSAGES,
78
71
  INCOMPLETE_WORK_RECOVERY,
@@ -81,10 +74,8 @@ import {
81
74
  SHARED_CONFIG_APPLY,
82
75
  STATUS_MESSAGES,
83
76
  agentsNotCompiled,
84
- applySharedConfigHere,
85
77
  authoredHereKept,
86
78
  buildMarketplacePluginRef,
87
- carriedSkillsWritten,
88
79
  chooseProviderForThisRun,
89
80
  copyingBesideGlobalPlugins,
90
81
  deleteLocalSkill,
@@ -93,36 +84,33 @@ import {
93
84
  ejectCopyFailureError,
94
85
  executeMigration,
95
86
  getErrorMessage,
96
- holdsItsOwnInstallation,
97
87
  hostAt,
88
+ idNamesAnotherMarketplace,
98
89
  initProviderToNameAt,
99
90
  installingBesideGlobalCopies,
100
91
  isHomeDirectory,
101
92
  keepsGlobalInstall,
102
- keptAsInstalledGlobally,
103
93
  keptUnassigned,
104
94
  loadConfigInPlay,
105
95
  localSkillsCopied,
106
96
  migrateLocalSkillScope,
107
97
  nothingInstalledToApplyTo,
108
98
  providerInUse,
109
- providerToNameAt,
110
99
  recompileSummary,
111
100
  registeredProjectsRecompiled,
112
101
  resolveInstallPaths,
113
- seedToInstallSelection,
114
- sharedConfigDestinations,
115
102
  sharedConfigNeedsTerminal,
116
103
  stoppingOnARefusal,
117
104
  subAgentChanged,
118
105
  unplaceableKept
119
- } from "../chunk-YM3VEDAP.js";
106
+ } from "../chunk-D2PC7NIR.js";
120
107
  import {
121
108
  getSkillById,
122
109
  getSkillDisplayName,
123
110
  getSkillEntryDisplayName,
124
- inertLine
125
- } from "../chunk-TG3SPPZY.js";
111
+ inertLine,
112
+ plural
113
+ } from "../chunk-KKGJH46C.js";
126
114
  import {
127
115
  CLI_COLORS,
128
116
  CLI_INVOKE_COMMAND,
@@ -133,11 +121,10 @@ import {
133
121
  formatSourceDisplayName,
134
122
  isActiveAt,
135
123
  isGlobalTombstone
136
- } from "../chunk-U46LYYRA.js";
124
+ } from "../chunk-4SIBDIIO.js";
137
125
  import "../chunk-GHHJYNAN.js";
138
126
 
139
127
  // src/cli/commands/edit.tsx
140
- import os from "os";
141
128
  import path from "path";
142
129
  import chalk from "chalk";
143
130
  import { Flags } from "@oclif/core";
@@ -191,6 +178,9 @@ function installedEntryOf(skillId, oldSkills) {
191
178
  if (entry === void 0) throw new Error(`Removed skill '${skillId}' has no installed entry`);
192
179
  return entry;
193
180
  }
181
+ function addedSkillsOf(changes, selection) {
182
+ return selection.skills.filter((skill) => changes.addedSkills.includes(skill.id));
183
+ }
194
184
  function scopeLabelOf(skillId, skills) {
195
185
  const skill = skills.find((s) => s.id === skillId);
196
186
  return skill === void 0 ? "" : ` ${formatScopeTag(skill.scope)}`;
@@ -323,20 +313,6 @@ function keptOnApply(reconciled, held, revisedCarried, runFromHome) {
323
313
  ...keptAsInstalledStatement(held, revisedCarried, runFromHome)
324
314
  ];
325
315
  }
326
- function keptAsInstalledStatement(held, revisedCarried, runFromHome) {
327
- const skillIds = [...held.keptAsInstalled.skillIds, ...revisedCarried];
328
- const { agentNames } = held.keptAsInstalled;
329
- if (skillIds.length === 0 && agentNames.length === 0) return [];
330
- return [
331
- keptAsInstalledGlobally(
332
- skillIds,
333
- agentNames,
334
- runFromHome.id,
335
- runFromHome.provider,
336
- panelRowEntries(held)
337
- )
338
- ];
339
- }
340
316
  function applyAuthority(editRoot) {
341
317
  return editRoot.isGlobal ? "all" : "owned";
342
318
  }
@@ -419,21 +395,15 @@ var Edit = class _Edit extends BaseCommand {
419
395
  if (flags.ui && flags.from !== void 0) {
420
396
  return this.openSharedInEditor(flags.from, cwd, namedProvider);
421
397
  }
422
- await this.sayWhenTheGlobalInstallationStandsIn(namedProvider);
423
- await refuseAnAmbiguousInstallation(
424
- cwd,
425
- "edit",
426
- namedProvider,
427
- (message) => this.error(message, { exit: EXIT_CODES.INVALID_ARGS })
428
- );
429
- await this.ensureConfigReadable(cwd);
430
- await this.refuseUnofferablePlacements(cwd);
431
- if (flags.from === void 0) return this.openInEditor(cwd);
398
+ await this.checkTheInstallationBeforeActing(cwd, "edit", namedProvider);
399
+ if (flags.from === void 0) return this.openInEditor(cwd, namedProvider);
432
400
  return this.applySharedConfig(flags.from, namedProvider);
433
401
  }
434
402
  async applySharedConfig(id, namedProvider) {
435
- const payload = await this.fetchSharedConfigOrFail(id, namedProvider);
403
+ await this.refuseWhenNothingIsInstalled(id, namedProvider);
404
+ const payload = await this.fetchSharedConfigOrFail(id);
436
405
  const context = await this.loadContextUnderSpinner();
406
+ this.sayWhenItNamesAnotherMarketplace(payload, context.sourceResult);
437
407
  const editRoot = resolveEditRoot(context.installation);
438
408
  await this.ensureSavedSkillsReadable(
439
409
  context.projectConfig?.skills ?? [],
@@ -496,10 +466,7 @@ var Edit = class _Edit extends BaseCommand {
496
466
  const revisedGlobally = await carriedSkillsThatDiffer(difference(carried, arrivingCarried));
497
467
  sayCapturedWarnings(context.startupMessages);
498
468
  this.warnOfSkippedEntries(mapping, context.sourceResult.unloadedSkillIds);
499
- const runFromHome = {
500
- id: installsAtHome(result) ? id : void 0,
501
- provider: providerToNameAt(os.homedir(), providerInUse(editRoot.dir))
502
- };
469
+ const runFromHome = runFromHomeFor(result, id, editRoot.dir);
503
470
  return {
504
471
  result: held.result,
505
472
  kept: keptOnApply(reconciled, held, revisedGlobally, runFromHome),
@@ -527,36 +494,15 @@ var Edit = class _Edit extends BaseCommand {
527
494
  return /* @__PURE__ */ new Set();
528
495
  }
529
496
  }
530
- /** Refuses an empty directory before spending a round trip. */
531
- async fetchSharedConfigOrFail(id, namedProvider) {
532
- if (!await detectProject()) {
533
- this.error(nothingInstalledToApplyTo(id, namedProvider), { exit: EXIT_CODES.ERROR });
534
- }
535
- this.log(`Fetching configuration ${id}...`);
536
- const fetched = await fetchSeedConfig(id);
537
- if (!fetched.ok) {
538
- this.error(fetched.error, { exit: EXIT_CODES.ERROR });
539
- }
540
- return fetched.payload;
541
- }
542
- decodeSeedOrFail(payload, sourceMatrix) {
543
- try {
544
- return seedToInstallSelection(payload, sourceMatrix);
545
- } catch (error) {
546
- this.handleError(error);
547
- }
548
- }
549
- registerExternalSkillsOrFail(payload, sourceMatrix, projectDir) {
550
- try {
551
- return registerExternalSkills(payload, sourceMatrix, projectDir);
552
- } catch (error) {
553
- this.handleError(error);
554
- }
497
+ /** Before the fetch, so an empty directory spends no round trip. */
498
+ async refuseWhenNothingIsInstalled(id, namedProvider) {
499
+ if (await detectProject()) return;
500
+ this.error(nothingInstalledToApplyTo(id, namedProvider), { exit: EXIT_CODES.ERROR });
555
501
  }
556
- async writeCarriedSkills(carried) {
557
- if (carried.length === 0) return;
558
- await writeExternalSkills(carried);
559
- this.log(carriedSkillsWritten(carried.map((skill) => skill.id)));
502
+ /** An apply always reads the installation's own marketplace; one an id names is never fetched. */
503
+ sayWhenItNamesAnotherMarketplace({ marketplace: named }, { sourceConfig: { source: used } }) {
504
+ if (named === void 0 || named === used) return;
505
+ this.log(idNamesAnotherMarketplace(named, used));
560
506
  }
561
507
  /**
562
508
  * A destructive apply nobody can confirm must never become a yes. Asked only of a run that changes
@@ -620,26 +566,20 @@ var Edit = class _Edit extends BaseCommand {
620
566
  const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx(Confirm, { message: SHARED_CONFIG_APPLY.CONFIRM, onConfirm, onCancel }));
621
567
  if (outcome === "confirmed") return;
622
568
  this.log("\nEdit cancelled");
623
- this.error("Cancelled", { exit: EXIT_CODES.CANCELLED });
624
- }
625
- /** `edit` rewrites the file, so it must not let a user curate a roster no command acts on. */
626
- async refuseUnofferablePlacements(cwd) {
627
- const [finding] = await unofferablePlacementsFound(cwd);
628
- if (finding !== void 0) this.error(finding, { exit: EXIT_CODES.ERROR });
569
+ this.exit(EXIT_CODES.CANCELLED);
629
570
  }
630
- /** Mints what `share` mints, marked when made in a project. Touches nothing on disk. */
631
- async openInEditor(projectDir) {
571
+ /** Mints what `share` mints, marked with where it was made. Touches nothing on disk. */
572
+ async openInEditor(projectDir, namedProvider) {
632
573
  await this.ensureInstalledSkillsReadable(projectDir);
633
574
  const prepared = await editorPayloadForInstallation(projectDir);
634
575
  if (!prepared.ok) {
635
576
  this.error(prepared.error, { exit: EXIT_CODES.ERROR });
636
577
  }
637
- this.log(`Opening ${prepared.skills} skill(s) across ${prepared.agents} sub-agent(s)...`);
638
- const published = await publishSeedConfig(prepared.payload);
639
- if (!published.ok) {
640
- this.error(published.error, { exit: EXIT_CODES.ERROR });
641
- }
642
- await this.handToBrowser(published.id);
578
+ this.log(
579
+ `Opening ${plural(prepared.skills, "skill")} across ${plural(prepared.agents, "sub-agent")}...`
580
+ );
581
+ const id = await this.publishToApplyBackOrFail(prepared.payload, projectDir, namedProvider);
582
+ await this.openInBrowserAtATerminal(editorConfigUrl(id));
643
583
  }
644
584
  /**
645
585
  * The payload reads every ejected skill's metadata.yaml for its provenance, and no catalogue is
@@ -662,23 +602,10 @@ var Edit = class _Edit extends BaseCommand {
662
602
  async openSharedInEditor(id, cwd, namedProvider) {
663
603
  if (namedProvider !== void 0) chooseProviderForThisRun(namedProvider);
664
604
  const url = editorConfigUrl(id);
665
- const installedHere = await holdsItsOwnInstallation(cwd);
666
- const provider = installedHere ? await installationToName(cwd, namedProvider) : namedProvider;
605
+ const applyHere = await this.howToApplyItHere(id, cwd, namedProvider);
667
606
  this.log(`Open it at ${url}`);
668
- this.log(applySharedConfigHere(id, installedHere, provider));
669
- if (!process.stdin.isTTY) return;
670
- const opened = await openUrl(url);
671
- if (!opened.ok) this.warn(opened.error);
672
- }
673
- /** The link prints first: it works over a pipe, in CI and with no desktop. Opening is extra. */
674
- async handToBrowser(id) {
675
- this.logSuccess(`Shared as ${id}`);
676
- for (const destination of sharedConfigDestinations(id)) {
677
- this.log(destination);
678
- }
679
- if (!process.stdin.isTTY) return;
680
- const opened = await openUrl(editorConfigUrl(id));
681
- if (!opened.ok) this.warn(opened.error);
607
+ this.log(applyHere);
608
+ await this.openInBrowserAtATerminal(url);
682
609
  }
683
610
  async loadContextUnderSpinner() {
684
611
  return awaitUnderSpinner(STATUS_MESSAGES.LOADING_SKILLS, () => this.loadContext());
@@ -771,7 +698,9 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
771
698
  }
772
699
  }
773
700
  logModeSwitch(count, modeDescription) {
774
- this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Switching ${count} skill(s) to ${modeDescription}`));
701
+ this.log(
702
+ chalk.hex(CLI_COLORS.NEUTRAL)(`Switching ${plural(count, "skill")} to ${modeDescription}`)
703
+ );
775
704
  }
776
705
  logCopiesBesideGlobalPlugins(count) {
777
706
  this.log(chalk.hex(CLI_COLORS.NEUTRAL)(copyingBesideGlobalPlugins(count)));
@@ -848,19 +777,18 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
848
777
  projectDir
849
778
  );
850
779
  if (uninstalled.length > 0) {
851
- this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Removed ${uninstalled.length} plugin(s)`));
780
+ this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Removed ${plural(uninstalled.length, "plugin")}`));
852
781
  }
853
782
  for (const item of failed) {
854
783
  this.warn(`Failed to uninstall plugin ${item.id}: ${item.error}`);
855
784
  }
856
785
  }
857
786
  async applyPluginChanges(changes, filteredResult, activeOldSkills, context, editRoot) {
858
- const { addedSkills, removedSkills } = changes;
859
- const addedPluginSkills = filteredResult.skills.filter(
860
- (s) => addedSkills.includes(s.id) && s.origin !== EJECT_SOURCE
787
+ const addedPluginSkills = addedSkillsOf(changes, filteredResult).filter(
788
+ (skill) => skill.origin !== EJECT_SOURCE
861
789
  );
862
- const removedPluginSkills = removedSkills.filter(
863
- (id) => activeOldSkills.find((s) => s.id === id)?.origin !== EJECT_SOURCE
790
+ const removedPluginSkills = changes.removedSkills.filter(
791
+ (id) => installedEntryOf(id, activeOldSkills).origin !== EJECT_SOURCE
864
792
  );
865
793
  if (addedPluginSkills.length === 0 && removedPluginSkills.length === 0) return;
866
794
  const marketplace = await this.requireMarketplaceOrExit(
@@ -886,9 +814,8 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
886
814
  }
887
815
  }
888
816
  async copyNewLocalSkills(changes, filteredResult, context, editRoot) {
889
- const { addedSkills } = changes;
890
- const addedLocalSkills = filteredResult.skills.filter(
891
- (s) => addedSkills.includes(s.id) && s.origin === EJECT_SOURCE
817
+ const addedLocalSkills = addedSkillsOf(changes, filteredResult).filter(
818
+ (skill) => skill.origin === EJECT_SOURCE
892
819
  );
893
820
  if (addedLocalSkills.length > 0) {
894
821
  const copyResult = await copyLocalSkills(
@@ -900,10 +827,9 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
900
827
  }
901
828
  }
902
829
  async removeDeletedLocalSkills(changes, activeOldSkills, editRoot) {
903
- const { removedSkills } = changes;
904
- for (const skillId of removedSkills) {
905
- const oldSkill = activeOldSkills.find((s) => s.id === skillId);
906
- if (oldSkill?.origin !== EJECT_SOURCE) continue;
830
+ for (const skillId of changes.removedSkills) {
831
+ const oldSkill = installedEntryOf(skillId, activeOldSkills);
832
+ if (oldSkill.origin !== EJECT_SOURCE) continue;
907
833
  await deleteLocalSkill(editRoot.dir, skillId, oldSkill.scope);
908
834
  }
909
835
  }
@@ -957,12 +883,9 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
957
883
  this.log(`You can manually recompile with '${CLI_INVOKE_COMMAND} compile'.`);
958
884
  }
959
885
  }
960
- reportRecompile({ compiled, rewritten, failed, warnings }) {
961
- const summary = recompileSummary(
962
- rewritten.length,
963
- compiled.length - rewritten.length,
964
- RECOMPILE_SUBJECT
965
- );
886
+ reportRecompile(result) {
887
+ const { compiled, failed, warnings } = result;
888
+ const summary = recompileSummary(result, RECOMPILE_SUBJECT);
966
889
  if (failed.length > 0) {
967
890
  this.log(
968
891
  chalk.hex(CLI_COLORS.NEUTRAL)(summary) + chalk.hex(CLI_COLORS.WARNING)(` (${failed.length} failed)`)
@@ -990,12 +913,11 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
990
913
  }
991
914
  }
992
915
  /**
993
- * The host notices `init` and `compile` print ({@link hostCompileNotices}), after
994
- * {@link cleanupStaleAgentFiles} so a deleted file is not counted. Skipped on a run that owes
995
- * work, whose tree may not be readable.
916
+ * After {@link cleanupStaleAgentFiles}, so a deleted file is not counted. Skipped on a run owing
917
+ * work besides a plugin's switch, whose tree may not be readable.
996
918
  */
997
919
  async reportWhatThisHostCannotCarry(editRoot) {
998
- if (this.hasIncompleteWork) return;
920
+ if (this.owesWorkBesidesPluginSwitches) return;
999
921
  for (const notice of await hostCompileNotices(providerInUse(editRoot.dir), editRoot.dir)) {
1000
922
  this.log(notice);
1001
923
  }
@@ -1185,18 +1107,22 @@ async function migratePluginSkillScopes(pluginMoves, marketplace, projectDir) {
1185
1107
  const host = hostAt(projectDir);
1186
1108
  const failed = [];
1187
1109
  for (const move of pluginMoves) {
1188
- const pluginRef = buildMarketplacePluginRef(move.id, marketplace);
1189
1110
  try {
1190
- if (move.oldScope === "project") {
1191
- await host.uninstallPlugin(pluginRef, "project", projectDir);
1192
- }
1193
- await host.installPlugin(pluginRef, move.newScope, projectDir);
1111
+ await movePluginScope(host, move, marketplace, projectDir);
1194
1112
  } catch (error) {
1195
1113
  failed.push({ id: move.id, error: getErrorMessage(error) });
1196
1114
  }
1197
1115
  }
1198
1116
  return { failed };
1199
1117
  }
1118
+ async function movePluginScope(host, move, marketplace, projectDir) {
1119
+ if (move.oldScope === "project") {
1120
+ const oldRefs = pluginRefsOf(move.id, move.oldSource, marketplace);
1121
+ await removeUnderFirstNameHeld(host, oldRefs, "project", projectDir);
1122
+ }
1123
+ const newRef = buildMarketplacePluginRef(move.id, move.newSource);
1124
+ await host.installPlugin(newRef, move.newScope, projectDir);
1125
+ }
1200
1126
  export {
1201
1127
  Edit as default
1202
1128
  };