agents-inc 0.175.0 → 0.176.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.
- package/CHANGELOG.md +67 -0
- package/dist/{chunk-EGC7PNDI.js → chunk-3F5LT433.js} +138 -41
- package/dist/chunk-3F5LT433.js.map +1 -0
- package/dist/chunk-5CFHP6Z5.js +109 -0
- package/dist/chunk-5CFHP6Z5.js.map +1 -0
- package/dist/{chunk-MFCZARV2.js → chunk-B7AVWSK2.js} +18 -8
- package/dist/chunk-B7AVWSK2.js.map +1 -0
- package/dist/{chunk-6HJVH27C.js → chunk-C2BSCEDN.js} +2 -2
- package/dist/{chunk-SNXEYAFP.js → chunk-CKBWEWHZ.js} +60 -30
- package/dist/chunk-CKBWEWHZ.js.map +1 -0
- package/dist/{chunk-SI2LLEIR.js → chunk-EC3JXT23.js} +4 -4
- package/dist/{chunk-YM3VEDAP.js → chunk-ENET4IF6.js} +440 -192
- package/dist/chunk-ENET4IF6.js.map +1 -0
- package/dist/{chunk-ICHWAFAC.js → chunk-FACDJH6O.js} +11 -104
- package/dist/chunk-FACDJH6O.js.map +1 -0
- package/dist/{chunk-P5XEK7HC.js → chunk-H6WUOW5F.js} +2 -2
- package/dist/{chunk-DQB3E2SX.js → chunk-JNRACLNS.js} +3 -3
- package/dist/{chunk-37QFHJUW.js → chunk-JTMSFBCA.js} +106 -28
- package/dist/chunk-JTMSFBCA.js.map +1 -0
- package/dist/{chunk-GNMRXXRY.js → chunk-MQZNDK5F.js} +3 -3
- package/dist/chunk-MQZNDK5F.js.map +1 -0
- package/dist/{chunk-SRII2GMF.js → chunk-SN64WNWE.js} +2 -2
- package/dist/{chunk-EHEBN4NB.js → chunk-U672FZVC.js} +2 -2
- package/dist/{chunk-TG3SPPZY.js → chunk-UE4Z3YMB.js} +1 -1
- package/dist/chunk-UE4Z3YMB.js.map +1 -0
- package/dist/{chunk-Q4NWATGH.js → chunk-XMQIWPIR.js} +58 -10
- package/dist/chunk-XMQIWPIR.js.map +1 -0
- package/dist/{chunk-YLFKFVQP.js → chunk-ZBI6GFJD.js} +2 -2
- package/dist/commands/build/marketplace.js +4 -3
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +6 -5
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/compile.js +15 -11
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +38 -14
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +46 -25
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +12 -8
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +15 -14
- package/dist/commands/list.js +8 -6
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +4 -3
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/search.js +13 -8
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +14 -16
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +18 -14
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +97 -17
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/skill-agent-summary.js +3 -2
- package/dist/components/common/summary-panel.js +4 -3
- package/dist/hooks/init.js +15 -14
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-5BSECHE6.js +14 -0
- package/dist/{recompile-project-agents-2QTFMYDC.js → recompile-project-agents-U3UGHPWG.js} +7 -7
- package/dist/{source-loader-I6SWWDUF.js → source-loader-E2Y5MMN5.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-37QFHJUW.js.map +0 -1
- package/dist/chunk-EGC7PNDI.js.map +0 -1
- package/dist/chunk-GNMRXXRY.js.map +0 -1
- package/dist/chunk-ICHWAFAC.js.map +0 -1
- package/dist/chunk-MFCZARV2.js.map +0 -1
- package/dist/chunk-Q4NWATGH.js.map +0 -1
- package/dist/chunk-SNXEYAFP.js.map +0 -1
- package/dist/chunk-TG3SPPZY.js.map +0 -1
- package/dist/chunk-YM3VEDAP.js.map +0 -1
- package/dist/load-agent-defs-BJ4KBKBA.js +0 -14
- /package/dist/{chunk-6HJVH27C.js.map → chunk-C2BSCEDN.js.map} +0 -0
- /package/dist/{chunk-SI2LLEIR.js.map → chunk-EC3JXT23.js.map} +0 -0
- /package/dist/{chunk-P5XEK7HC.js.map → chunk-H6WUOW5F.js.map} +0 -0
- /package/dist/{chunk-DQB3E2SX.js.map → chunk-JNRACLNS.js.map} +0 -0
- /package/dist/{chunk-SRII2GMF.js.map → chunk-SN64WNWE.js.map} +0 -0
- /package/dist/{chunk-EHEBN4NB.js.map → chunk-U672FZVC.js.map} +0 -0
- /package/dist/{chunk-YLFKFVQP.js.map → chunk-ZBI6GFJD.js.map} +0 -0
- /package/dist/{load-agent-defs-BJ4KBKBA.js.map → load-agent-defs-5BSECHE6.js.map} +0 -0
- /package/dist/{recompile-project-agents-2QTFMYDC.js.map → recompile-project-agents-U3UGHPWG.js.map} +0 -0
- /package/dist/{source-loader-I6SWWDUF.js.map → source-loader-E2Y5MMN5.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/commands/edit.tsx"],"sourcesContent":["import os from \"os\";\nimport path from \"path\";\n\nimport chalk from \"chalk\";\nimport { Flags } from \"@oclif/core\";\n\nimport { difference, indexBy, partition, unique } from \"remeda\";\n\nimport { BaseCommand } from \"../base-command.js\";\nimport type { InstallSelection } from \"@workspace/compile/seed-to-config\";\nimport {\n CLI_INVOKE_COMMAND,\n CLI_COLORS,\n EDITOR_ADDRESS,\n EJECT_SOURCE,\n editorConfigUrl,\n formatSourceDisplayName,\n type Provider,\n} from \"../consts.js\";\nimport {\n detectProject,\n loadSource,\n sayCapturedWarnings,\n copyLocalSkills,\n uninstallPluginSkills,\n loadAgentDefs,\n type AgentDefs,\n writeProjectConfig,\n type ConfigWriteResult,\n compileAgentsAllScopes,\n compileProjectScope,\n type CompilationResult,\n discoverInstalledSkills,\n removeCompiledAgents,\n type RemoveCompiledAgentsOptions,\n} from \"../lib/operations/index.js\";\nimport { awaitUnderSpinner } from \"../components/common/spinner.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport {\n type EjectCopyResult,\n type Installation,\n type MigrationPlan,\n detectMigrations,\n ejectCopyFailureError,\n executeMigration,\n holdsItsOwnInstallation,\n isHomeDirectory,\n resolveInstallPaths,\n INSTALL_MODE_DESCRIPTIONS,\n} from \"../lib/installation/index.js\";\nimport {\n movedGlobalAgentInputs,\n projectsAFanOutReaches,\n type GateReport,\n} from \"../lib/config-gate/index.js\";\nimport {\n copyingBesideGlobalPlugins,\n installingBesideGlobalCopies,\n keepsGlobalInstall,\n type SkillMigration,\n} from \"../lib/installation/mode-migrator.js\";\nimport {\n getSkillById,\n getSkillDisplayName,\n getSkillEntryDisplayName,\n} from \"../lib/matrix/matrix-provider\";\nimport { type AuthoritativeScope, loadConfigInPlay } from \"../lib/configuration/index.js\";\nimport {\n activeAgentScopeMap,\n isActiveAt,\n isGlobalTombstone,\n} from \"../lib/configuration/scope-predicates.js\";\nimport { stoppingOnARefusal, type SourceLoadResult } from \"../lib/loading/index.js\";\nimport { buildMarketplacePluginRef } from \"../lib/plugins/index.js\";\nimport { deleteLocalSkill, migrateLocalSkillScope } from \"../lib/skills/index.js\";\nimport type {\n SkillId,\n SkillConfig,\n AgentName,\n AgentScopeConfig,\n MergedSkillsMatrix,\n ProjectConfig,\n SkillScope,\n} from \"../types/index.js\";\nimport {\n editorPayloadForInstallation,\n skillsAuthoredHere,\n} from \"../lib/seed/installation-payload.js\";\nimport { publishSeedConfig } from \"../lib/seed/publish-seed.js\";\nimport { fetchSeedConfig } from \"../lib/seed/fetch-seed.js\";\nimport {\n carriedSkillsThatDiffer,\n registerExternalSkills,\n writeExternalSkills,\n type ExternalSkillInstall,\n} from \"../lib/seed/external-skills.js\";\nimport { seedToInstallSelection, type SeedMapping } from \"../lib/seed/seed-to-selection.js\";\nimport {\n installsAtHome,\n joinedStatement,\n notInstalledGlobally,\n panelRowEntries,\n readInstalledGlobal,\n reconcileSharedConfig,\n restoreInstalledGlobal,\n sameAssignments,\n type HeldGlobal,\n type InstalledGlobal,\n type KeptFromRoundTrip,\n type ReconciledSharedConfig,\n type UnassignedRow,\n} from \"../lib/seed/seed-apply.js\";\nimport { Confirm } from \"../components/common/confirm.js\";\nimport { promptConfirm } from \"../components/common/prompt-confirm.js\";\nimport { summaryPanelBlock, type SummaryPanelProps } from \"../components/common/summary-panel.js\";\nimport { hostAt } from \"../lib/hosts/host-for.js\";\nimport { hostCompileNotices } from \"../lib/hosts/host-compile-notices.js\";\nimport { unofferablePlacementsFound } from \"../lib/hosts/configured-placements.js\";\nimport { chooseProviderForThisRun, providerInUse } from \"../lib/installation/install-layout.js\";\nimport {\n installationToName,\n providerFlag,\n providerNamedBy,\n refuseAnAmbiguousInstallation,\n} from \"../lib/installation/provider-flag.js\";\nimport { initProviderToNameAt, providerToNameAt } from \"../lib/installation/provider-to-name.js\";\nimport { openUrl } from \"../utils/open-url.js\";\nimport { getErrorMessage } from \"../utils/errors.js\";\nimport { inertLine } from \"../utils/string.js\";\nimport { type StartupMessage } from \"../utils/logger.js\";\nimport {\n INCOMPLETE_WORK_RECOVERY,\n ERROR_MESSAGES,\n INFO_MESSAGES,\n SHARED_CONFIG_APPLY,\n STATUS_MESSAGES,\n agentsNotCompiled,\n applySharedConfigHere,\n authoredHereKept,\n carriedSkillsWritten,\n editorSkillMetadataUnusableError,\n keptAsInstalledGlobally,\n keptUnassigned,\n localSkillsCopied,\n nothingInstalledToApplyTo,\n recompileSummary,\n registeredProjectsRecompiled,\n sharedConfigDestinations,\n sharedConfigNeedsTerminal,\n subAgentChanged,\n unplaceableKept,\n} from \"../utils/messages.js\";\nimport {\n agentChangesAmong,\n formatScopeTag,\n type AgentChange,\n type NamedBy,\n} from \"../lib/configuration/scope-diff.js\";\nimport type { SeedPayload } from \"@workspace/matrix/seed\";\n\ntype ScopeChange = { from: SkillScope; to: SkillScope };\n\n/** `edit` recompiles every scope it owns in one pass, so its summary has no scope word. */\nconst RECOMPILE_SUBJECT = \"agent\";\n\nconst CHANGE_MARKER_COLORS = {\n \"+\": CLI_COLORS.SUCCESS,\n \"-\": CLI_COLORS.ERROR,\n \"~\": CLI_COLORS.WARNING,\n} as const;\n\ntype ChangeMarker = keyof typeof CHANGE_MARKER_COLORS;\n\nconst AGENT_DETAIL = \" (agent)\";\n\n/** The marker and subject take the marker's colour; the detail after them is neutral. */\nfunction changeLine(marker: ChangeMarker, subject: string, detail?: string): string {\n const head = chalk.hex(CHANGE_MARKER_COLORS[marker])(` ${marker} ${subject}`);\n return detail === undefined ? head : head + chalk.hex(CLI_COLORS.NEUTRAL)(detail);\n}\n\n/** A `[P][G]` pair's project half toggled: an arrow line would claim the global install moved. */\nfunction dualScopeTransitionLine(subject: string, to: SkillScope, detail?: string): string {\n return changeLine(to === \"project\" ? \"+\" : \"-\", `${subject} [P]`, detail);\n}\n\n/** A genuine `[G] → [P]` reads as an addition: the skill arrives in this project. */\nfunction formatSkillScopeChangeLine(\n skillId: SkillId,\n change: ScopeChange,\n dualScopeSkillTransitions: ReadonlySet<SkillId>,\n): string {\n const displayName = getSkillDisplayName(skillId);\n if (dualScopeSkillTransitions.has(skillId)) {\n return dualScopeTransitionLine(displayName, change.to);\n }\n\n const isGlobalToProject = change.from === \"global\" && change.to === \"project\";\n return changeLine(isGlobalToProject ? \"+\" : \"~\", displayName, scopeArrow(change));\n}\n\n/** Unlike a skill, a moved agent is always a move, and only the dual-scope arm says `(agent)`. */\nfunction formatAgentScopeChangeLine(\n agentName: AgentName,\n change: ScopeChange,\n dualScopeAgentTransitions: ReadonlySet<AgentName>,\n): string {\n if (dualScopeAgentTransitions.has(agentName)) {\n return dualScopeTransitionLine(agentName, change.to, AGENT_DETAIL);\n }\n\n return changeLine(\"~\", agentName, scopeArrow(change));\n}\n\nfunction scopeArrow(change: ScopeChange): string {\n return ` (${formatScopeTag(change.from)} \\u2192 ${formatScopeTag(change.to)})`;\n}\n\n/** Prints both values: a retune leaves nothing on disk to compare against. */\nfunction formatValueChangeLine(subject: string, change: ValueChange, kind: string): string {\n return changeLine(\"~\", subject, ` (${kind}: ${change.from} \\u2192 ${change.to})`);\n}\n\nfunction sourceChangeLine(skillId: SkillId, change: ValueChange): string {\n const from = formatSourceDisplayName(change.from);\n const to = formatSourceDisplayName(change.to);\n return changeLine(\"~\", getSkillDisplayName(skillId), ` (${from} \\u2192 ${to})`);\n}\n\n/** Named by the entry it removes: its marketplace may no longer offer the skill. */\nfunction removedSkillLine(skillId: SkillId, oldSkills: SkillConfig[]): string {\n const removed = installedEntryOf(skillId, oldSkills);\n return changeLine(\"-\", `${getSkillEntryDisplayName(removed)} ${formatScopeTag(removed.scope)}`);\n}\n\n/** A removed id is drawn from these very entries, so a miss is a bug, never a skill to skip. */\nfunction installedEntryOf(skillId: SkillId, oldSkills: SkillConfig[]): SkillConfig {\n const entry = oldSkills.find((s) => s.id === skillId);\n if (entry === undefined) throw new Error(`Removed skill '${skillId}' has no installed entry`);\n return entry;\n}\n\n/** Empty for an id the list does not hold. */\nfunction scopeLabelOf(skillId: SkillId, skills: SkillConfig[]): string {\n const skill = skills.find((s) => s.id === skillId);\n return skill === undefined ? \"\" : ` ${formatScopeTag(skill.scope)}`;\n}\n\n/**\n * A retune, a re-assignment, rows joining a held global sub-agent and rewritten files move no\n * entry, so each needs its own line or the run reads as a no-op.\n */\nfunction changeSummaryLines(\n changes: AppliedChanges,\n newSkills: SkillConfig[],\n oldSkills: SkillConfig[],\n): string[] {\n const addedSkill = (id: SkillId): string =>\n changeLine(\"+\", `${inertLine(getSkillById(id).displayName)}${scopeLabelOf(id, newSkills)}`);\n const joinedGlobalDetail = ` ${formatScopeTag(\"global\")} (agent: skills added)`;\n\n return [\n ...changes.addedSkills.map(addedSkill),\n ...changes.removedSkills.map((id) => removedSkillLine(id, oldSkills)),\n ...changes.addedAgents.map((name) => changeLine(\"+\", name, AGENT_DETAIL)),\n ...changes.removedAgents.map((name) => changeLine(\"-\", name, AGENT_DETAIL)),\n ...[...changes.sourceChanges].map(([id, change]) => sourceChangeLine(id, change)),\n ...[...changes.scopeChanges].map(([id, change]) =>\n formatSkillScopeChangeLine(id, change, changes.dualScopeSkillTransitions),\n ),\n ...[...changes.agentScopeChanges].map(([name, change]) =>\n formatAgentScopeChangeLine(name, change, changes.dualScopeAgentTransitions),\n ),\n ...[...changes.tuningChanges].map(([name, change]) =>\n formatValueChangeLine(name, change, \"agent\"),\n ),\n ...changes.reassignedAgents.map((name) => changeLine(\"~\", name, \" (agent: skills reassigned)\")),\n ...changes.joinedGlobalAgents.map((name) => changeLine(\"~\", name, joinedGlobalDetail)),\n ...changes.rewrittenSkills.map((id) =>\n changeLine(\"~\", getSkillDisplayName(id), \" (skill: files rewritten)\"),\n ),\n ];\n}\n\ntype EditContext = {\n installation: Installation;\n projectConfig: ProjectConfig | null;\n sourceResult: SourceLoadResult;\n startupMessages: StartupMessage[];\n};\n\n/** The one directory an `edit` run acts on, decided once and handed to every layer. */\ntype EditRoot = {\n dir: string;\n isGlobal: boolean;\n};\n\n/**\n * The installation `detectProject` found is the only root with a config, so the only one this run\n * may write to.\n */\nfunction resolveEditRoot(installation: Installation): EditRoot {\n const dir = installation.projectDir;\n return { dir, isGlobal: isHomeDirectory(dir) };\n}\n\ntype EditSelection = {\n result: InstallSelection;\n /**\n * Statements naming what this run may not remove, and the held global sub-agents it adds to —\n * rendered in the confirm.\n */\n kept: string[];\n /** Skills the configuration carries rather than names, written once it is approved. */\n carried: ExternalSkillInstall[];\n /** From a project, the held global sub-agents an arriving skill's row joins. */\n joinedGlobalAgents: AgentName[];\n /** The global config itself, read from a project; `null` at home or with no global install. */\n installedGlobal: InstalledGlobal | null;\n};\n\n/**\n * What the question shows: the panel, a line for each sub-agent it marks `~`, and what the run\n * keeps or reaches beyond the panel.\n */\ntype SharedConfigPlan = {\n panel: SummaryPanelProps;\n changedAgents: AgentChange[];\n statements: string[];\n};\n\n/** Entries whose project copy an apply deletes. */\ntype ProjectCopies = { skillIds: SkillId[]; agentNames: AgentName[] };\n\n/** A genuine move, not a collapsed pair: the copy goes from the project, the entry lives on. */\nfunction movedToGlobal(changes: ConfigChanges): ProjectCopies {\n const skillMoves = [...scopeMovesOf(changes)].filter(([, change]) => change.to === \"global\");\n const agentMoves = [...changes.agentScopeChanges].filter(\n ([name, change]) => change.to === \"global\" && !changes.dualScopeAgentTransitions.has(name),\n );\n\n return {\n skillIds: skillMoves.map(([id]) => id),\n agentNames: agentMoves.map(([name]) => name),\n };\n}\n\n/**\n * Sub-agents that keep their slot and still change: retuned, their rows moved, or a held global one\n * a row joins. One that arrives or leaves is the panel's `+` or `-` already. From a project a\n * global one is measured against the global config: the project's holds none of its rows, and its\n * copy of the entry can be out of date.\n */\nfunction changedSubAgents(\n changes: PlannedChanges,\n { result, installedGlobal }: EditSelection,\n projectConfig: ProjectConfig | null,\n): AgentChange[] {\n if (projectConfig === null) return [];\n\n const arrivingOrLeaving = new Set<AgentName>([\n ...changes.addedAgents,\n ...changes.removedAgents,\n ...changes.agentScopeChanges.keys(),\n ]);\n const changed = unique([\n ...changes.reassignedAgents,\n ...changes.tuningChanges.keys(),\n ...changes.joinedGlobalAgents,\n ]).filter((name) => !arrivingOrLeaving.has(name));\n const after = { agents: result.agentConfigs, skills: result.skills, stack: result.assignedStack };\n if (installedGlobal === null) return agentChangesAmong(changed, projectConfig, after);\n\n const [heldGlobal, ownedHere] = partition(changed, (name) => isHeldGlobally(name, result));\n return [\n ...agentChangesAmong(ownedHere, projectConfig, after),\n ...agentChangesAmong(heldGlobal, installedGlobal, after).filter(changesAnything),\n ];\n}\n\nfunction isHeldGlobally(name: AgentName, result: InstallSelection): boolean {\n return result.agentConfigs.some((agent) => agent.name === name && isActiveAt(agent, \"global\"));\n}\n\n/** A held global sub-agent only gains: one the global config finds unchanged is as installed. */\nfunction changesAnything({ gains, loses, settings }: AgentChange): boolean {\n return gains.length > 0 || loses.length > 0 || settings.length > 0;\n}\n\n/**\n * Written over in place, the user's own edits with them: carried skills whose files change, and\n * the ejected copies a switch to plugins deletes. One already named as moving is not named again.\n */\nfunction overwrittenSkillIds(changes: AppliedChanges, active: ActiveEntries): SkillId[] {\n const leaving = new Set(movedToGlobal(changes).skillIds);\n const switched = ejectedCopiesSwitchedToPlugins(migrationPlanOf(changes, active));\n return unique([...changes.rewrittenSkills, ...switched]).filter((id) => !leaving.has(id));\n}\n\n/** A copy beside a global install it keeps is not deleted (`keepsGlobalInstall`). */\nfunction ejectedCopiesSwitchedToPlugins(plan: MigrationPlan): SkillId[] {\n return plan.toPlugin.filter((migration) => !keepsGlobalInstall(migration)).map(({ id }) => id);\n}\n\n/** Measured against each collapsed pair's global install: the only one a collapse can switch. */\nfunction migrationPlanOf(changes: ConfigChanges, active: ActiveEntries): MigrationPlan {\n return detectMigrations(\n withMaskedGlobalsRestored(active.oldSkills, changes.collapsedPairs),\n active.selection.skills,\n );\n}\n\n/** Only carried skills whose files would change: identical bytes written again change nothing. */\nasync function carriedThatChange(carried: ExternalSkillInstall[]): Promise<ExternalSkillInstall[]> {\n const changing = new Set(await carriedSkillsThatDiffer(carried));\n return carried.filter((skill) => changing.has(skill.id));\n}\n\n/** A carried skill new here is an addition, already counted; the rest are rewritten in place. */\nfunction withRewrittenCarried(\n planned: PlannedChanges,\n carriedToWrite: ExternalSkillInstall[],\n): AppliedChanges {\n const writtenIds = carriedToWrite.map((skill) => skill.id);\n return { ...planned, rewrittenSkills: difference(writtenIds, skillsNewHere(planned)) };\n}\n\n/**\n * From a project a shared configuration holds the global install as installed, so the global pass\n * runs only when the write added something global sub-agents derive from.\n */\nfunction compilesGlobalScope(editRoot: EditRoot, written: GateReport): boolean {\n return editRoot.isGlobal || movedGlobalAgentInputs(written);\n}\n\n/**\n * Adds sub-agents whose skill rows change while the roster does not, which\n * {@link detectConfigChanges} cannot see.\n */\ntype ReassignedChanges = ConfigChanges & { reassignedAgents: AgentName[] };\n\n/** Adds the held global sub-agents a project run adds rows to (`HeldGlobal.joined`). */\ntype PlannedChanges = ReassignedChanges & { joinedGlobalAgents: AgentName[] };\n\n/** Adds carried skills already installed here whose files the apply rewrites. */\ntype AppliedChanges = PlannedChanges & { rewrittenSkills: SkillId[] };\n\n/**\n * In a project only the project's own sub-agents count; a global one keeps its installed rows and\n * gains only an arriving skill's (`restoreInstalledGlobal`), which `HeldGlobal.joined` names. A\n * sub-agent already counted as added, or whose project copy arrives beside the global one, is not\n * counted twice.\n */\nfunction withReassignments(\n changes: ConfigChanges,\n result: InstallSelection,\n installedStack: ProjectConfig[\"stack\"],\n editRoot: EditRoot,\n): ReassignedChanges {\n const { assignedStack } = result;\n const arrivingCopies = arrivingProjectHalves(\n changes.agentScopeChanges,\n changes.dualScopeAgentTransitions,\n );\n\n const ownedHere = (agent: AgentScopeConfig): boolean =>\n editRoot.isGlobal || isActiveAt(agent, \"project\");\n const countedAsAdded = (agent: AgentScopeConfig): boolean =>\n changes.addedAgents.includes(agent.name) || arrivingCopies.has(agent.name);\n const rowsMoved = (agent: AgentScopeConfig): boolean =>\n !sameAssignments(assignedStack[agent.name], installedStack?.[agent.name]);\n\n const reassigned = result.agentConfigs.filter(\n (agent) => ownedHere(agent) && !countedAsAdded(agent) && rowsMoved(agent),\n );\n return { ...changes, reassignedAgents: reassigned.map((agent) => agent.name) };\n}\n\n/** Disclosed rather than acted on, so nobody is left wondering why an agent kept a skill. */\nfunction keptStatements(kept: KeptFromRoundTrip, namedBy: NamedBy): string[] {\n return [...authorshipStatement(kept, namedBy), ...catalogueStatement(kept, namedBy)];\n}\n\nfunction authorshipStatement(kept: KeptFromRoundTrip, namedBy: NamedBy): string[] {\n if (kept.authoredSkillIds.length === 0) return [];\n return [authoredHereKept(kept.authoredSkillIds, namedBy)];\n}\n\nfunction catalogueStatement(kept: KeptFromRoundTrip, namedBy: NamedBy): string[] {\n if (kept.unplaceableSkillIds.length === 0) return [];\n return [unplaceableKept(kept.unplaceableSkillIds, namedBy)];\n}\n\nfunction unassignedStatement(unassigned: UnassignedRow[], namedBy: NamedBy): string[] {\n if (unassigned.length === 0) return [];\n return [unassigned.map((row) => keptUnassigned(row, namedBy)).join(\"\\n\")];\n}\n\n/** The run from home that changes what a project run keeps, where home would take it. */\ntype RunFromHome = { id: string | undefined; provider: Provider | undefined };\n\n/** What the confirm says the run keeps, and the held global sub-agents it adds to. */\nfunction keptOnApply(\n reconciled: ReconciledSharedConfig,\n held: HeldGlobal,\n revisedCarried: SkillId[],\n runFromHome: RunFromHome,\n): string[] {\n const namedBy = panelRowEntries(held);\n return [\n ...keptStatements(reconciled.kept, namedBy),\n ...unassignedStatement(reconciled.unassigned, namedBy),\n ...joinedStatement(held),\n ...keptAsInstalledStatement(held, revisedCarried, runFromHome),\n ];\n}\n\n/** A revised carried skill is held whole, so the global install's entry names it. */\nfunction keptAsInstalledStatement(\n held: HeldGlobal,\n revisedCarried: SkillId[],\n runFromHome: RunFromHome,\n): string[] {\n const skillIds = [...held.keptAsInstalled.skillIds, ...revisedCarried];\n const { agentNames } = held.keptAsInstalled;\n if (skillIds.length === 0 && agentNames.length === 0) return [];\n return [\n keptAsInstalledGlobally(\n skillIds,\n agentNames,\n runFromHome.id,\n runFromHome.provider,\n panelRowEntries(held),\n ),\n ];\n}\n\n/** From a project, a shared configuration only adds to the global install. */\nfunction applyAuthority(editRoot: EditRoot): AuthoritativeScope {\n return editRoot.isGlobal ? \"all\" : \"owned\";\n}\n\n/** Both sides of the diff as installed: no excluded entry, and no global install left out. */\ntype ActiveEntries = {\n selection: InstallSelection;\n oldConfig: ProjectConfig | null;\n oldSkills: SkillConfig[];\n oldAgents: AgentScopeConfig[];\n};\n\nfunction activeEntriesOf(\n result: InstallSelection,\n projectConfig: ProjectConfig | null,\n installedGlobal: InstalledGlobal | null,\n): ActiveEntries {\n const installedSkills = projectConfig?.skills ?? [];\n const oldSkills = [\n ...installedSkills.filter((s) => !s.excluded),\n ...globalInstallsHiddenHere(installedSkills, installedGlobal),\n ];\n const oldAgents = (projectConfig?.agents ?? []).filter((a) => !a.excluded);\n\n return {\n selection: {\n ...result,\n skills: result.skills.filter((s) => !s.excluded),\n agentConfigs: result.agentConfigs.filter((a) => !a.excluded),\n },\n oldConfig: projectConfig ? { ...projectConfig, skills: oldSkills, agents: oldAgents } : null,\n oldSkills,\n oldAgents,\n };\n}\n\n/**\n * Masked here by the project's own skill in a one-pick category, yet still installed, and held as\n * installed by the selection (`restoreInstalledGlobal`): left off the old side, it reads as added\n * on every run. A mask beside the project's own copy of the skill is a `[P][G]` pair instead.\n */\nfunction globalInstallsHiddenHere(\n installedSkills: SkillConfig[],\n installedGlobal: InstalledGlobal | null,\n): SkillConfig[] {\n if (installedGlobal === null) return [];\n\n const activeIds = new Set(installedSkills.filter((s) => !s.excluded).map((s) => s.id));\n const hiddenIds = new Set(\n installedSkills.filter((s) => isGlobalTombstone(s) && !activeIds.has(s.id)).map((s) => s.id),\n );\n return installedGlobal.skills.filter((s) => hiddenIds.has(s.id) && isActiveAt(s, \"global\"));\n}\n\nfunction planChanges(\n selection: EditSelection,\n active: ActiveEntries,\n projectConfig: ProjectConfig | null,\n editRoot: EditRoot,\n): PlannedChanges {\n const keptInstalled = globalHalvesKeptInstalled(selection.installedGlobal);\n const changes = detectConfigChanges(active.oldConfig, active.selection, {\n newSkills: [...selection.result.skills, ...keptInstalled.skills],\n oldSkills: projectConfig?.skills ?? [],\n newAgents: [...selection.result.agentConfigs, ...keptInstalled.agents],\n oldAgents: projectConfig?.agents ?? [],\n });\n\n return {\n ...withReassignments(changes, active.selection, projectConfig?.stack, editRoot),\n joinedGlobalAgents: selection.joinedGlobalAgents,\n };\n}\n\nexport default class Edit extends BaseCommand {\n static summary = \"Open this installation in the editor, or apply a configuration with --from\";\n static description = `Open this installation in ${EDITOR_ADDRESS}, or apply a configuration built there with --from`;\n\n static examples = [\n {\n description: \"Open this installation in the editor\",\n command: \"<%= config.bin %> <%= command.id %>\",\n },\n {\n description: \"Apply a configuration built in the editor, by its id\",\n command: \"<%= config.bin %> <%= command.id %> --from <id>\",\n },\n {\n description: \"Look at a shared configuration without applying it\",\n command: \"<%= config.bin %> <%= command.id %> --ui --from <id>\",\n },\n ];\n\n static flags = {\n ui: Flags.boolean({\n description: `Open ${EDITOR_ADDRESS} on this installation, or on the id --from names without applying it — what a bare edit does`,\n default: false,\n }),\n from: Flags.string({\n description:\n \"Apply a configuration shared from agentsinc.sh by its id, removing whatever it leaves out — from a project, only the project's own entries\",\n helpValue: \"<id>\",\n }),\n provider: providerFlag(),\n };\n\n /** The exit code is decided once, after every path through `applyEdit`. */\n async run(): Promise<void> {\n await this.applyEdit();\n this.exitIfWorkIncomplete();\n }\n\n private async applyEdit(): Promise<void> {\n const { flags } = await this.parse(Edit);\n const cwd = process.cwd();\n const namedProvider = providerNamedBy(flags.provider);\n\n // Above every installation check: opening a shared id needs no local state.\n if (flags.ui && flags.from !== undefined) {\n return this.openSharedInEditor(flags.from, cwd, namedProvider);\n }\n\n await this.sayWhenTheGlobalInstallationStandsIn(namedProvider);\n // Before anything is copied or installed.\n await refuseAnAmbiguousInstallation(cwd, \"edit\", namedProvider, (message) =>\n this.error(message, { exit: EXIT_CODES.INVALID_ARGS }),\n );\n\n // Before anything renders: an unreadable config is recreated, not edited.\n await this.ensureConfigReadable(cwd);\n await this.refuseUnofferablePlacements(cwd);\n\n // A bare `edit` is `edit --ui`, and needs no source load.\n if (flags.from === undefined) return this.openInEditor(cwd);\n\n return this.applySharedConfig(flags.from, namedProvider);\n }\n\n private async applySharedConfig(id: string, namedProvider: Provider | undefined): Promise<void> {\n const payload = await this.fetchSharedConfigOrFail(id, namedProvider);\n const context = await this.loadContextUnderSpinner();\n const editRoot = resolveEditRoot(context.installation);\n\n // A skill whose metadata.yaml no longer describes it would be dropped from config.ts.\n await this.ensureSavedSkillsReadable(\n context.projectConfig?.skills ?? [],\n context.sourceResult.matrix,\n editRoot.dir,\n );\n\n const selection = await this.selectionFromSharedConfig(id, payload, context, editRoot);\n this.reportValidationErrors(selection.result.validation);\n\n const active = activeEntriesOf(\n selection.result,\n context.projectConfig,\n selection.installedGlobal,\n );\n const planned = planChanges(selection, active, context.projectConfig, editRoot);\n // Before asking: a rewrite is named in the plan, and a run that changes nothing asks nothing.\n const carriedToWrite = await carriedThatChange(selection.carried);\n const changes = withRewrittenCarried(planned, carriedToWrite);\n\n if (!hasAnyChanges(changes)) return this.sayNothingChanged(selection.kept);\n\n this.refuseWithoutATerminal(id, namedProvider, editRoot);\n const plan = await this.planToConfirm(changes, active, selection, context, editRoot);\n await this.confirmSharedConfigOrCancel(plan);\n await this.writeCarriedSkills(carriedToWrite);\n await this.applyApprovedChanges(changes, active, selection.result, context, editRoot);\n }\n\n private async applyApprovedChanges(\n changes: AppliedChanges,\n active: ActiveEntries,\n result: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const { selection: activeSelection, oldSkills, oldAgents } = active;\n this.logChangeSummary(changes, activeSelection.skills, oldSkills);\n const migrationPlan = migrationPlanOf(changes, active);\n await this.applyMigrations(migrationPlan, context, editRoot);\n await this.applyScopeChanges(migrationPlan.scopeChanges, context, editRoot);\n await this.applyCollapsedPairs(changes, context, editRoot);\n await this.applyPluginChanges(changes, activeSelection, oldSkills, context, editRoot);\n await this.copyNewLocalSkills(changes, activeSelection, context, editRoot);\n await this.removeDeletedLocalSkills(changes, oldSkills, editRoot);\n // Unfiltered: the config records the excluded entries too.\n await this.writeConfigAndCompile(result, context, editRoot);\n await this.cleanupStaleAgentFiles(changes, oldAgents, editRoot);\n await this.reportWhatThisHostCannotCarry(editRoot);\n this.logCompletionSummary();\n }\n\n /**\n * A shared configuration applies destructively, except for a skill written here (`forkedFrom`)\n * and an id this catalogue cannot place — both disclosed in the confirm. From a project the\n * global install is only added to.\n */\n private async selectionFromSharedConfig(\n id: string,\n payload: SeedPayload,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<EditSelection> {\n const { matrix: sourceMatrix } = context.sourceResult;\n // Before the decode: a carried skill answers to no catalogue until it is seated.\n const carried = this.registerExternalSkillsOrFail(payload, sourceMatrix, editRoot.dir);\n const mapping = this.decodeSeedOrFail(payload, sourceMatrix);\n const { result } = mapping;\n\n // Before any skip is narrated; `init --from` asks the same at the same point.\n this.refuseProjectScopedContentAtHome(result, editRoot.dir, true);\n\n const reconciled = await this.reconcileWithInstallation(mapping, context, editRoot);\n const installedGlobal = editRoot.isGlobal ? null : await readInstalledGlobal(editRoot.dir);\n const held = restoreInstalledGlobal(reconciled.result, installedGlobal);\n const arrivingCarried = notInstalledGlobally(carried, held);\n\n await this.refuseSharedConfigBeforeAsking(\n held.result,\n arrivingCarried,\n editRoot.dir,\n context.sourceResult,\n );\n\n // Held globally, so not written from a project; named in the plan instead.\n const revisedGlobally = await carriedSkillsThatDiffer(difference(carried, arrivingCarried));\n\n sayCapturedWarnings(context.startupMessages);\n this.warnOfSkippedEntries(mapping, context.sourceResult.unloadedSkillIds);\n\n const runFromHome = {\n id: installsAtHome(result) ? id : undefined,\n provider: providerToNameAt(os.homedir(), providerInUse(editRoot.dir)),\n };\n\n return {\n result: held.result,\n kept: keptOnApply(reconciled, held, revisedGlobally, runFromHome),\n carried: arrivingCarried,\n joinedGlobalAgents: held.joined.map(({ agentName }) => agentName),\n installedGlobal,\n };\n }\n\n /** Ids the decode could not place stay: a catalogue limit is not an instruction to delete. */\n private async reconcileWithInstallation(\n { result, skippedSkillIds }: SeedMapping,\n { projectConfig }: EditContext,\n editRoot: EditRoot,\n ): Promise<ReconciledSharedConfig> {\n return reconcileSharedConfig({\n decoded: result,\n installed: projectConfig,\n authoredHere: await this.readAuthoredHere(projectConfig, editRoot.dir),\n unplaceable: new Set(skippedSkillIds),\n });\n }\n\n /** Best-effort: an unreadable directory protects nothing and must not fail an apply. */\n private async readAuthoredHere(\n projectConfig: ProjectConfig | null,\n editRoot: string,\n ): Promise<Set<SkillId>> {\n if (!projectConfig) return new Set();\n\n try {\n return await skillsAuthoredHere(projectConfig, editRoot);\n } catch (error) {\n this.warn(`Could not tell which skills were written here: ${getErrorMessage(error)}`);\n return new Set();\n }\n }\n\n /** Refuses an empty directory before spending a round trip. */\n private async fetchSharedConfigOrFail(\n id: string,\n namedProvider: Provider | undefined,\n ): Promise<SeedPayload> {\n if (!(await detectProject())) {\n this.error(nothingInstalledToApplyTo(id, namedProvider), { exit: EXIT_CODES.ERROR });\n }\n\n this.log(`Fetching configuration ${id}...`);\n const fetched = await fetchSeedConfig(id);\n if (!fetched.ok) {\n this.error(fetched.error, { exit: EXIT_CODES.ERROR });\n }\n\n return fetched.payload;\n }\n\n private decodeSeedOrFail(payload: SeedPayload, sourceMatrix: MergedSkillsMatrix): SeedMapping {\n try {\n return seedToInstallSelection(payload, sourceMatrix);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n private registerExternalSkillsOrFail(\n payload: SeedPayload,\n sourceMatrix: MergedSkillsMatrix,\n projectDir: string,\n ): ExternalSkillInstall[] {\n try {\n return registerExternalSkills(payload, sourceMatrix, projectDir);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n private async writeCarriedSkills(carried: ExternalSkillInstall[]): Promise<void> {\n if (carried.length === 0) return;\n\n await writeExternalSkills(carried);\n this.log(carriedSkillsWritten(carried.map((skill) => skill.id)));\n }\n\n /**\n * A destructive apply nobody can confirm must never become a yes. Asked only of a run that changes\n * something: one that changes nothing needs no one to confirm it.\n */\n private refuseWithoutATerminal(\n id: string,\n namedProvider: Provider | undefined,\n editRoot: EditRoot,\n ): void {\n if (process.stdin.isTTY) return;\n\n const initProvider =\n namedProvider ?? initProviderToNameAt(editRoot.dir, providerInUse(editRoot.dir));\n this.error(sharedConfigNeedsTerminal(id, namedProvider, initProvider), {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n /** The panel of what the run changes, then what it keeps and what else it recompiles. */\n private async planToConfirm(\n changes: AppliedChanges,\n active: ActiveEntries,\n selection: EditSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<SharedConfigPlan> {\n const { projectConfig } = context;\n const changedAgents = changedSubAgents(changes, selection, projectConfig);\n const reachedProjects = await this.registeredProjectsStatement(changes, context, editRoot);\n\n return {\n panel: {\n skillConfigs: selection.result.skills,\n agentConfigs: selection.result.agentConfigs,\n installedSkillConfigs: projectConfig?.skills ?? null,\n installedAgentConfigs: projectConfig?.agents ?? null,\n isInitMode: false,\n overwrittenSkillIds: new Set(overwrittenSkillIds(changes, active)),\n changedAgentNames: new Set(changedAgents.map(({ name }) => name)),\n stackName: await this.stackNameOf(selection.result.selectedStackId, context.sourceResult),\n },\n changedAgents,\n statements: [...selection.kept, ...reachedProjects],\n };\n }\n\n /** Nothing to confirm; what the run keeps still says why nothing changed. */\n private sayNothingChanged(kept: string[]): void {\n for (const statement of kept) {\n this.log(statement);\n }\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(INFO_MESSAGES.NO_CHANGES_MADE));\n }\n\n /**\n * At home every registered project inlines the global config, so a change to it rewrites each\n * one the fan-out reaches. Rewritten carried files alone leave the config as it was.\n */\n private async registeredProjectsStatement(\n changes: AppliedChanges,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<string[]> {\n if (!editRoot.isGlobal || !changesTheConfig(changes)) return [];\n\n const reached = await projectsAFanOutReaches(\n context.projectConfig?.projects ?? [],\n providerInUse(editRoot.dir),\n );\n return reached.length === 0 ? [] : [registeredProjectsRecompiled(reached)];\n }\n\n private async confirmSharedConfigOrCancel(plan: SharedConfigPlan): Promise<void> {\n const lines = summaryPanelBlock(\n plan.panel,\n plan.changedAgents.map(subAgentChanged),\n plan.statements,\n );\n for (const line of lines) {\n this.log(line);\n }\n\n const outcome = await promptConfirm(({ onConfirm, onCancel }) => (\n <Confirm message={SHARED_CONFIG_APPLY.CONFIRM} onConfirm={onConfirm} onCancel={onCancel} />\n ));\n if (outcome === \"confirmed\") return;\n\n this.log(\"\\nEdit cancelled\");\n this.error(\"Cancelled\", { exit: EXIT_CODES.CANCELLED });\n }\n\n /** `edit` rewrites the file, so it must not let a user curate a roster no command acts on. */\n private async refuseUnofferablePlacements(cwd: string): Promise<void> {\n const [finding] = await unofferablePlacementsFound(cwd);\n if (finding !== undefined) this.error(finding, { exit: EXIT_CODES.ERROR });\n }\n\n /** Mints what `share` mints, marked when made in a project. Touches nothing on disk. */\n private async openInEditor(projectDir: string): Promise<void> {\n await this.ensureInstalledSkillsReadable(projectDir);\n\n const prepared = await editorPayloadForInstallation(projectDir);\n if (!prepared.ok) {\n this.error(prepared.error, { exit: EXIT_CODES.ERROR });\n }\n\n this.log(`Opening ${prepared.skills} skill(s) across ${prepared.agents} sub-agent(s)...`);\n\n const published = await publishSeedConfig(prepared.payload);\n if (!published.ok) {\n this.error(published.error, { exit: EXIT_CODES.ERROR });\n }\n\n await this.handToBrowser(published.id);\n }\n\n /**\n * The payload reads every ejected skill's metadata.yaml for its provenance, and no catalogue is\n * loaded here to resolve a skill around it, so every installed entry is asked about — not only\n * those a catalogue lacks, as `edit --from` asks. The config read is the one the payload reads.\n */\n private async ensureInstalledSkillsReadable(projectDir: string): Promise<void> {\n const loaded = await loadConfigInPlay(projectDir);\n // Nothing installed is `editorPayloadForInstallation`'s to report.\n if (!loaded) return;\n\n await this.refuseUnusableSavedSkillMetadata(\n loaded.config.skills,\n projectDir,\n editorSkillMetadataUnusableError,\n );\n }\n\n /**\n * Opens an id rather than applying it; `--from` without `--ui` is the destructive apply. A named\n * provider is committed first, as `init` does, so \"installed here\" means that installation.\n */\n private async openSharedInEditor(\n id: string,\n cwd: string,\n namedProvider: Provider | undefined,\n ): Promise<void> {\n if (namedProvider !== undefined) chooseProviderForThisRun(namedProvider);\n const url = editorConfigUrl(id);\n const installedHere = await holdsItsOwnInstallation(cwd);\n const provider = installedHere ? await installationToName(cwd, namedProvider) : namedProvider;\n\n this.log(`Open it at ${url}`);\n this.log(applySharedConfigHere(id, installedHere, provider));\n\n if (!process.stdin.isTTY) return;\n\n const opened = await openUrl(url);\n if (!opened.ok) this.warn(opened.error);\n }\n\n /** The link prints first: it works over a pipe, in CI and with no desktop. Opening is extra. */\n private async handToBrowser(id: string): Promise<void> {\n this.logSuccess(`Shared as ${id}`);\n for (const destination of sharedConfigDestinations(id)) {\n this.log(destination);\n }\n\n if (!process.stdin.isTTY) return;\n\n const opened = await openUrl(editorConfigUrl(id));\n if (!opened.ok) this.warn(opened.error);\n }\n\n private async loadContextUnderSpinner(): Promise<EditContext> {\n return awaitUnderSpinner(STATUS_MESSAGES.LOADING_SKILLS, () => this.loadContext());\n }\n\n private async loadContext(): Promise<EditContext> {\n const detected = await detectProject();\n if (!detected) {\n this.error(ERROR_MESSAGES.NO_INSTALLATION, {\n exit: EXIT_CODES.ERROR,\n });\n }\n const { installation, config: projectConfig } = detected;\n\n try {\n const { sourceResult, startupMessages } = await stoppingOnARefusal(() =>\n loadSource({ projectDir: installation.projectDir, captureStartupMessages: true }),\n );\n return { installation, projectConfig, sourceResult, startupMessages };\n } catch (error) {\n this.handleError(error);\n }\n }\n\n private logChangeSummary(\n changes: AppliedChanges,\n newSkills: SkillConfig[],\n oldSkills: SkillConfig[],\n ): void {\n this.log(`\\n${chalk.hex(CLI_COLORS.WHITE).bold(\"Changes:\")}`);\n for (const line of changeSummaryLines(changes, newSkills, oldSkills)) {\n this.log(line);\n }\n this.log(\"\");\n }\n\n private async applyMigrations(\n migrationPlan: MigrationPlan,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n if (migrationPlan.toEject.length === 0 && migrationPlan.toPlugin.length === 0) return;\n\n this.announceMigrations(migrationPlan);\n if (migrationPlan.toPlugin.length > 0) {\n // `claude plugin install` needs the marketplace registered and current. Before\n // `executeMigration`, so an unresolvable marketplace exits with the ejected copies intact.\n await this.requireMarketplaceOrExit(\n context.sourceResult,\n \"migrate skills to plugin mode\",\n hostAt(editRoot.dir),\n );\n // `executeMigration` installs, deleting each working copy as its plugin registers, so the\n // banner is announced here.\n this.announcePluginInstall();\n }\n\n const migrationResult = await executeMigration(\n migrationPlan,\n editRoot.dir,\n context.sourceResult,\n );\n\n for (const warning of migrationResult.warnings) {\n this.warn(warning);\n }\n\n // Hard-errors before anything records `origin: \"eject\"` for a skill with no copy on disk.\n if (migrationPlan.toEject.length > 0) {\n this.reportEjectCopies(migrationResult.ejectCopies);\n }\n\n // Hard-errors before anything records a marketplace `origin` for an unregistered skill.\n if (migrationPlan.toPlugin.length > 0) {\n this.reportPluginInstalls(migrationResult.pluginInstalls);\n }\n }\n\n /**\n * Mirrors `BaseCommand.reportPluginInstalls` for the plugin→eject half. The count line names no\n * destination: copies split between the project and $HOME by each skill's scope.\n */\n private reportEjectCopies(result: EjectCopyResult): void {\n for (const item of result.failed) {\n this.warn(`Failed to copy ${item.id} for eject: ${item.error}`);\n }\n if (result.failed.length > 0) {\n this.error(ejectCopyFailureError(result.failed.length), { exit: EXIT_CODES.ERROR });\n }\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(localSkillsCopied(result.copied.length)));\n }\n\n /**\n * One line per kind, each counting its own: a mode switch, then a skill added in the project\n * beside the global install it keeps (`keepsGlobalInstall` decides both the keep and the line).\n */\n private announceMigrations(plan: MigrationPlan): void {\n const [copiesBesideGlobalPlugin, switchesToEject] = partition(plan.toEject, keepsGlobalInstall);\n const [installsBesideGlobalCopy, switchesToPlugin] = partition(\n plan.toPlugin,\n keepsGlobalInstall,\n );\n\n if (switchesToEject.length > 0) {\n this.logModeSwitch(switchesToEject.length, INSTALL_MODE_DESCRIPTIONS.eject);\n }\n if (copiesBesideGlobalPlugin.length > 0) {\n this.logCopiesBesideGlobalPlugins(copiesBesideGlobalPlugin.length);\n }\n if (switchesToPlugin.length > 0) {\n this.logModeSwitch(switchesToPlugin.length, INSTALL_MODE_DESCRIPTIONS.plugin);\n }\n if (installsBesideGlobalCopy.length > 0) {\n this.logInstallsBesideGlobalCopies(installsBesideGlobalCopy.length);\n }\n }\n\n private logModeSwitch(count: number, modeDescription: string): void {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Switching ${count} skill(s) to ${modeDescription}`));\n }\n\n private logCopiesBesideGlobalPlugins(count: number): void {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(copyingBesideGlobalPlugins(count)));\n }\n\n private logInstallsBesideGlobalCopies(count: number): void {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(installingBesideGlobalCopies(count)));\n }\n\n /**\n * Only moves that keep their mode: a switch lands at its new scope ({@link applyMigrations}). A\n * collapsed `[P][G]` pair is not a move: its project half is dropped ({@link applyCollapsedPairs}).\n */\n private async applyScopeChanges(\n scopeMoves: SkillMigration[],\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const [copyMoves, pluginMoves] = partition(\n scopeMoves,\n (move) => move.newSource === EJECT_SOURCE,\n );\n await moveEjectedSkillCopies(copyMoves, editRoot.dir);\n\n if (pluginMoves.length === 0) return;\n\n const marketplace = await this.requireMarketplaceOrExit(\n context.sourceResult,\n \"migrate plugin skill scopes\",\n hostAt(editRoot.dir),\n );\n\n const pluginScopeResult = await migratePluginSkillScopes(\n pluginMoves,\n marketplace,\n editRoot.dir,\n );\n // A migration installs at the new scope, so unlike an uninstall a failure is not diagnostic:\n // the skill is registered at neither scope.\n for (const item of pluginScopeResult.failed) {\n this.reportIncompleteWork(\n `Failed to migrate plugin scope for ${item.id}: ${item.error}`,\n INCOMPLETE_WORK_RECOVERY.INSPECT_INSTALLATION,\n );\n }\n }\n\n /**\n * Each project half is removed at project scope only. The global install's mode is\n * {@link applyMigrations}' to change. The uninstall is diagnostic, as every one here is.\n */\n private async applyCollapsedPairs(\n changes: ConfigChanges,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const [ejectedHalves, pluginHalves] = partition(\n changes.collapsedPairs.map(({ projectHalf }) => projectHalf),\n (half) => half.origin === EJECT_SOURCE,\n );\n\n for (const half of ejectedHalves) {\n await deleteLocalSkill(editRoot.dir, half.id, half.scope);\n }\n await this.uninstallProjectPluginHalves(\n pluginHalves,\n context.sourceResult.marketplace,\n editRoot,\n );\n }\n\n private async uninstallProjectPluginHalves(\n pluginHalves: SkillConfig[],\n marketplace: string | undefined,\n editRoot: EditRoot,\n ): Promise<void> {\n if (pluginHalves.length === 0) return;\n if (marketplace === undefined) {\n for (const half of pluginHalves) {\n this.warn(`Could not uninstall this project's plugin for ${half.id}: no marketplace`);\n }\n return;\n }\n\n await this.uninstallPluginSkillsReported(\n pluginHalves.map((half) => half.id),\n pluginHalves,\n marketplace,\n editRoot.dir,\n );\n }\n\n private async uninstallPluginSkillsReported(\n skillIds: SkillId[],\n oldSkills: SkillConfig[],\n marketplace: string,\n projectDir: string,\n ): Promise<void> {\n const { uninstalled, failed } = await uninstallPluginSkills(\n skillIds,\n oldSkills,\n marketplace,\n projectDir,\n );\n if (uninstalled.length > 0) {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Removed ${uninstalled.length} plugin(s)`));\n }\n for (const item of failed) {\n this.warn(`Failed to uninstall plugin ${item.id}: ${item.error}`);\n }\n }\n\n private async applyPluginChanges(\n changes: ConfigChanges,\n filteredResult: InstallSelection,\n activeOldSkills: SkillConfig[],\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const { addedSkills, removedSkills } = changes;\n\n const addedPluginSkills = filteredResult.skills.filter(\n (s) => addedSkills.includes(s.id) && s.origin !== EJECT_SOURCE,\n );\n const removedPluginSkills = removedSkills.filter(\n (id) => activeOldSkills.find((s) => s.id === id)?.origin !== EJECT_SOURCE,\n );\n\n if (addedPluginSkills.length === 0 && removedPluginSkills.length === 0) return;\n\n const marketplace = await this.requireMarketplaceOrExit(\n context.sourceResult,\n \"install or uninstall plugin skills\",\n hostAt(editRoot.dir),\n );\n\n if (addedPluginSkills.length > 0) {\n await this.installPluginSkillsReported(\n addedPluginSkills,\n marketplace,\n editRoot.dir,\n context.sourceResult.matrix,\n );\n }\n\n if (removedPluginSkills.length > 0) {\n await this.uninstallPluginSkillsReported(\n removedPluginSkills,\n activeOldSkills,\n marketplace,\n editRoot.dir,\n );\n }\n }\n\n private async copyNewLocalSkills(\n changes: ConfigChanges,\n filteredResult: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const { addedSkills } = changes;\n\n const addedLocalSkills = filteredResult.skills.filter(\n (s) => addedSkills.includes(s.id) && s.origin === EJECT_SOURCE,\n );\n\n if (addedLocalSkills.length > 0) {\n const copyResult = await copyLocalSkills(\n addedLocalSkills,\n editRoot.dir,\n context.sourceResult,\n );\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(localSkillsCopied(copyResult.totalCopied)));\n }\n }\n\n private async removeDeletedLocalSkills(\n changes: ConfigChanges,\n activeOldSkills: SkillConfig[],\n editRoot: EditRoot,\n ): Promise<void> {\n const { removedSkills } = changes;\n\n // A deselected eject skill is uninstalled at its scope; plugin removals belong to\n // applyPluginChanges.\n for (const skillId of removedSkills) {\n const oldSkill = activeOldSkills.find((s) => s.id === skillId);\n if (oldSkill?.origin !== EJECT_SOURCE) continue;\n\n await deleteLocalSkill(editRoot.dir, skillId, oldSkill.scope);\n }\n }\n\n private async writeConfigAndCompile(\n result: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const agentDefs = await this.loadAgentDefsOrFail();\n const configResult = await this.writeConfigOrFail(result, context, editRoot, agentDefs);\n this.reportUnassignedSkills(configResult.config, result.skills);\n await this.recompileAgents(result, editRoot, configResult.propagation, agentDefs.sourcePath);\n this.reportFanOut(configResult.propagation);\n }\n\n private async loadAgentDefsOrFail(): Promise<AgentDefs> {\n try {\n return await loadAgentDefs();\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /** Fatal: every mutation has landed and config.ts is their only record. */\n private async writeConfigOrFail(\n result: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n agentDefs: AgentDefs,\n ): Promise<ConfigWriteResult> {\n try {\n return await writeProjectConfig({\n selection: result,\n sourceResult: context.sourceResult,\n projectDir: editRoot.dir,\n agentDefs,\n authoritativeScope: applyAuthority(editRoot),\n });\n } catch (error) {\n this.error(`Could not update config: ${getErrorMessage(error)}`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n }\n\n private async recompileAgents(\n result: InstallSelection,\n editRoot: EditRoot,\n propagation: GateReport,\n sourcePath: string,\n ): Promise<void> {\n try {\n const agentScopeMap = activeAgentScopeMap(result.agentConfigs);\n const { allSkills } = await discoverInstalledSkills(editRoot.dir);\n const compile = compilesGlobalScope(editRoot, propagation)\n ? compileAgentsAllScopes\n : compileProjectScope;\n const compilation = await compile({\n projectDir: editRoot.dir,\n sourcePath,\n skills: allSkills,\n agentScopeMap,\n });\n this.reportRecompile(compilation);\n } catch (error) {\n // The config already landed; a failed recompile must not end in silence.\n this.reportIncompleteWork(\n `Agent recompilation failed: ${getErrorMessage(error)}`,\n INCOMPLETE_WORK_RECOVERY.RECOMPILE,\n );\n this.log(`You can manually recompile with '${CLI_INVOKE_COMMAND} compile'.`);\n }\n }\n\n private reportRecompile({ compiled, rewritten, failed, warnings }: CompilationResult): void {\n const summary = recompileSummary(\n rewritten.length,\n compiled.length - rewritten.length,\n RECOMPILE_SUBJECT,\n );\n\n if (failed.length > 0) {\n this.log(\n chalk.hex(CLI_COLORS.NEUTRAL)(summary) +\n chalk.hex(CLI_COLORS.WARNING)(` (${failed.length} failed)`),\n );\n for (const warning of warnings) {\n this.warn(warning);\n }\n // Off `failed`: `warnings` also carries non-failures.\n this.recordIncompleteWork(agentsNotCompiled(failed), INCOMPLETE_WORK_RECOVERY.RECOMPILE);\n } else if (compiled.length > 0) {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(summary));\n } else {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(INFO_MESSAGES.NO_AGENTS_TO_RECOMPILE));\n }\n }\n\n private async cleanupStaleAgentFiles(\n changes: ConfigChanges,\n oldAgents: AgentScopeConfig[],\n editRoot: EditRoot,\n ): Promise<void> {\n for (const removal of planStaleAgentRemovals(changes, oldAgents, editRoot.dir)) {\n const { failed } = await removeCompiledAgents(removal);\n\n // A compiled sub-agent left behind is still loaded by Claude Code.\n for (const { name, error } of failed) {\n const agentPath = path.join(removal.agentsDir, `${name}.md`);\n this.reportIncompleteWork(\n `Could not remove agent file ${agentPath}: ${error}`,\n INCOMPLETE_WORK_RECOVERY.DELETE_AGENT_FILE,\n );\n }\n }\n }\n\n /**\n * The host notices `init` and `compile` print ({@link hostCompileNotices}), after\n * {@link cleanupStaleAgentFiles} so a deleted file is not counted. Skipped on a run that owes\n * work, whose tree may not be readable.\n */\n private async reportWhatThisHostCannotCarry(editRoot: EditRoot): Promise<void> {\n if (this.hasIncompleteWork) return;\n\n for (const notice of await hostCompileNotices(providerInUse(editRoot.dir), editRoot.dir)) {\n this.log(notice);\n }\n }\n\n private logCompletionSummary(): void {\n if (this.hasIncompleteWork) return;\n\n this.log(`\\n${chalk.hex(CLI_COLORS.SUCCESS)(\"\\u2713 Done\")}\\n`);\n }\n}\n\ntype ConfigChanges = {\n addedSkills: SkillId[];\n removedSkills: SkillId[];\n addedAgents: AgentName[];\n removedAgents: AgentName[];\n sourceChanges: Map<SkillId, { from: string; to: string }>;\n scopeChanges: Map<SkillId, ScopeChange>;\n agentScopeChanges: Map<AgentName, ScopeChange>;\n /** Dual-scope add/removes in `scopeChanges`, which the summary must not report as migrations. */\n dualScopeSkillTransitions: Set<SkillId>;\n /**\n * The `[P][G]` pairs this edit collapsed, as they stood before it. The project's own install is\n * dropped, so `sourceChanges` and the mode migrations measure a collapsed skill against\n * `maskedGlobal`.\n */\n collapsedPairs: CollapsedPair[];\n /** Agent equivalent of `dualScopeSkillTransitions`. */\n dualScopeAgentTransitions: Set<AgentName>;\n /** Retuned sub-agents (model, effort) with an unchanged roster: nothing moves, yet it changed. */\n tuningChanges: Map<AgentName, ValueChange>;\n};\n\ntype ValueChange = { from: string; to: string };\n\n/** A collapsed `[P][G]` pair, as the config held it before the edit. */\ntype CollapsedPair = {\n /** The project's own install: the half the collapse drops. */\n projectHalf: SkillConfig;\n /** The global install the project half masked, as its tombstone recorded it. */\n maskedGlobal: SkillConfig;\n};\n\n/** Full (tombstone-inclusive) entry lists used to classify dual-scope transitions. */\ntype FullScopeEntries = {\n newSkills: SkillConfig[];\n oldSkills: SkillConfig[];\n newAgents: AgentScopeConfig[];\n oldAgents: AgentScopeConfig[];\n};\n\n/**\n * `fullEntries` carries the tombstone-inclusive lists, used only to tell a scope migration from a\n * dual-scope add/remove.\n */\nfunction detectConfigChanges(\n oldConfig: ProjectConfig | null,\n selection: InstallSelection,\n fullEntries: FullScopeEntries,\n): ConfigChanges {\n const oldSkillIds = oldConfig?.skills.map((s) => s.id) ?? [];\n const newSkillIds = selection.skills.map((s) => s.id);\n const oldAgentNames = oldConfig?.agents.map((a) => a.name) ?? [];\n const newAgentNames = selection.agentConfigs.map((a) => a.name);\n\n const oldSkillsById = indexBy(oldConfig?.skills ?? [], (s) => s.id);\n const oldAgentsByName = indexBy(oldConfig?.agents ?? [], (a) => a.name);\n\n const scopeChanges = detectPropertyChanges(\n selection.skills,\n oldSkillsById,\n (s) => s.id,\n (s) => s.scope,\n );\n const agentScopeChanges = detectPropertyChanges(\n selection.agentConfigs,\n oldAgentsByName,\n (a) => a.name,\n (a) => a.scope,\n );\n const dualScopeSkillTransitions = detectDualScopeTransitions(\n scopeChanges,\n fullEntries.newSkills,\n fullEntries.oldSkills,\n (s) => s.id,\n );\n const collapsedPairs = collapsedPairsOf(\n scopeChanges,\n dualScopeSkillTransitions,\n fullEntries.oldSkills,\n );\n const dualScopeAgentTransitions = detectDualScopeTransitions(\n agentScopeChanges,\n fullEntries.newAgents,\n fullEntries.oldAgents,\n (a) => a.name,\n );\n const arrivingSkills = arrivingProjectHalves(scopeChanges, dualScopeSkillTransitions);\n\n return {\n addedSkills: difference(newSkillIds, oldSkillIds),\n removedSkills: difference(oldSkillIds, newSkillIds),\n addedAgents: difference(newAgentNames, oldAgentNames),\n removedAgents: difference(oldAgentNames, newAgentNames),\n sourceChanges: withoutKeys(\n detectPropertyChanges(\n selection.skills,\n indexBy(withMaskedGlobalsRestored(oldConfig?.skills ?? [], collapsedPairs), (s) => s.id),\n (s) => s.id,\n (s) => s.origin,\n ),\n arrivingSkills,\n ),\n scopeChanges,\n agentScopeChanges,\n dualScopeSkillTransitions,\n collapsedPairs,\n dualScopeAgentTransitions,\n // Either half of a pair is measured against the other install, which this edit never retunes.\n tuningChanges: withoutKeys(\n detectPropertyChanges(selection.agentConfigs, oldAgentsByName, (a) => a.name, describeTuning),\n dualScopeAgentTransitions,\n ),\n };\n}\n\n/** Added, or a project copy arriving beside the global install: files written, not rewritten. */\nfunction skillsNewHere(changes: ConfigChanges): SkillId[] {\n return [\n ...changes.addedSkills,\n ...arrivingProjectHalves(changes.scopeChanges, changes.dualScopeSkillTransitions),\n ];\n}\n\n/**\n * The `[P][G]` pairs this edit opens: the project's own copy arrives beside the global install,\n * so the diff, which measures it against that install, records a change nothing made.\n */\nfunction arrivingProjectHalves<K extends string>(\n scopeChanges: ReadonlyMap<K, ScopeChange>,\n dualScopeTransitions: ReadonlySet<K>,\n): Set<K> {\n const arriving = [...scopeChanges].filter(\n ([key, change]) => change.to === \"project\" && dualScopeTransitions.has(key),\n );\n return new Set(arriving.map(([key]) => key));\n}\n\nfunction withoutKeys<K, V>(changes: ReadonlyMap<K, V>, keys: ReadonlySet<K>): Map<K, V> {\n return new Map([...changes].filter(([key]) => !keys.has(key)));\n}\n\nconst RESTING_TUNING = \"defaults\";\n\n/** Compared as a sentence, so the diff sees no change the summary has no words for. */\nfunction describeTuning(agent: AgentScopeConfig): string {\n const settings = [\n agent.model === undefined ? undefined : `model ${agent.model}`,\n agent.codexModel === undefined ? undefined : `codex model ${agent.codexModel}`,\n agent.effort === undefined ? undefined : `effort ${agent.effort}`,\n ].filter((setting) => setting !== undefined);\n\n return settings.length === 0 ? RESTING_TUNING : settings.join(\", \");\n}\n\nfunction detectPropertyChanges<T, K extends string, V>(\n newItems: T[],\n oldByKey: Record<string, T>,\n getKey: (item: T) => K,\n getValue: (item: T) => V,\n): Map<K, { from: V; to: V }> {\n const changes = new Map<K, { from: V; to: V }>();\n for (const item of newItems) {\n const key = getKey(item);\n const old = oldByKey[key];\n if (old && getValue(old) !== getValue(item)) {\n changes.set(key, { from: getValue(old), to: getValue(item) });\n }\n }\n return changes;\n}\n\n/**\n * The global install's entries as the tombstones a project half arriving beside one leaves: the\n * write masks the global entry rather than moving it (`reconcileProjectSplitAgainstGlobal`). No\n * decoded selection carries these, so without them a project add over a global install reads as\n * the global install moving. Only a key that moves from global to project is looked up in them.\n */\nfunction globalHalvesKeptInstalled(installedGlobal: InstalledGlobal | null): {\n skills: SkillConfig[];\n agents: AgentScopeConfig[];\n} {\n if (installedGlobal === null) return { skills: [], agents: [] };\n\n return {\n skills: installedGlobal.skills.map(asTombstone),\n agents: installedGlobal.agents.map(asTombstone),\n };\n}\n\nfunction asTombstone<T extends { excluded?: boolean }>(entry: T): T {\n return { ...entry, excluded: true };\n}\n\n/**\n * A dual-scope transition, not a migration, when a global tombstone sits beside the change: G→P\n * keeps one in the new state, P→G had one in the old.\n */\nfunction detectDualScopeTransitions<\n K extends string,\n T extends { scope: SkillScope; excluded?: boolean },\n>(scopeChanges: Map<K, ScopeChange>, fullNew: T[], fullOld: T[], getKey: (item: T) => K): Set<K> {\n const hasGlobalTombstone = (items: T[], key: K): boolean =>\n items.some((item) => getKey(item) === key && isGlobalTombstone(item));\n const isDualScope = ([key, { from, to }]: [K, ScopeChange]): boolean =>\n (from === \"global\" && to === \"project\" && hasGlobalTombstone(fullNew, key)) ||\n (from === \"project\" && to === \"global\" && hasGlobalTombstone(fullOld, key));\n\n return new Set([...scopeChanges].filter(isDualScope).map(([key]) => key));\n}\n\n/** P→G dual-scope transitions as the pairs they collapsed, read from the old state. */\nfunction collapsedPairsOf(\n scopeChanges: Map<SkillId, ScopeChange>,\n dualScopeSkillTransitions: ReadonlySet<SkillId>,\n fullOldSkills: SkillConfig[],\n): CollapsedPair[] {\n return [...scopeChanges]\n .filter(([id, change]) => change.to === \"global\" && dualScopeSkillTransitions.has(id))\n .map(([id]) => ({\n projectHalf: oldHalfOf(fullOldSkills, id, (skill) => isActiveAt(skill, \"project\")),\n maskedGlobal: oldHalfOf(fullOldSkills, id, isGlobalTombstone),\n }));\n}\n\n/** Present by construction, so a miss is a defect. */\nfunction oldHalfOf(\n fullOldSkills: SkillConfig[],\n id: SkillId,\n isHalf: (skill: SkillConfig) => boolean,\n): SkillConfig {\n const half = fullOldSkills.find((skill) => skill.id === id && isHalf(skill));\n if (half === undefined) {\n throw new Error(`The config before this edit holds no such half of the pair for '${id}'`);\n }\n return half;\n}\n\n/**\n * The pre-edit roster with each collapsed pair's project half replaced by the global install it\n * masked: the only install whose mode a collapse can change.\n */\nfunction withMaskedGlobalsRestored(\n oldSkills: SkillConfig[],\n collapsedPairs: CollapsedPair[],\n): SkillConfig[] {\n const maskedById = indexBy(\n collapsedPairs.map(({ maskedGlobal }) => maskedGlobal),\n (skill) => skill.id,\n );\n return oldSkills.map((skill) => {\n const masked = maskedById[skill.id];\n if (masked === undefined || skill.scope !== \"project\") return skill;\n return installRecordedBy(masked);\n });\n}\n\nfunction installRecordedBy(tombstone: SkillConfig): SkillConfig {\n const { excluded: _masked, ...install } = tombstone;\n return install;\n}\n\n/** Excludes collapsed pairs, whose global install stays where it is. */\nfunction scopeMovesOf(changes: ConfigChanges): Map<SkillId, ScopeChange> {\n const collapsed = new Set(changes.collapsedPairs.map(({ projectHalf }) => projectHalf.id));\n return new Map([...changes.scopeChanges].filter(([id]) => !collapsed.has(id)));\n}\n\nasync function moveEjectedSkillCopies(\n copyMoves: SkillMigration[],\n projectDir: string,\n): Promise<void> {\n for (const move of copyMoves) {\n await migrateLocalSkillScope(move.id, move.oldScope, projectDir);\n }\n}\n\ntype StaleAgent = { name: AgentName; scope: SkillScope };\n\nconst STALE_AGENT_SCOPES = [\"project\", \"global\"] as const satisfies readonly SkillScope[];\n\n/** For a deselected agent absent from the old roster. */\nconst UNRECORDED_AGENT_SCOPE: SkillScope = \"project\";\n\nfunction installedScope(name: AgentName, oldAgents: AgentScopeConfig[]): SkillScope {\n return oldAgents.find((agent) => agent.name === name)?.scope ?? UNRECORDED_AGENT_SCOPE;\n}\n\n/**\n * The project copy a P→G move superseded, plus every deselected agent at its installed scope. G→P\n * is an override, so the global install stays. Only scopes this edit removed from are tidied.\n */\nfunction planStaleAgentRemovals(\n changes: ConfigChanges,\n oldAgents: AgentScopeConfig[],\n editRoot: string,\n): RemoveCompiledAgentsOptions[] {\n const supersededByGlobal = [...changes.agentScopeChanges]\n .filter(([, change]) => change.from !== \"global\")\n .map(([name]): StaleAgent => ({ name, scope: \"project\" }));\n\n const deselected = changes.removedAgents.map((name): StaleAgent => ({\n name,\n scope: installedScope(name, oldAgents),\n }));\n\n const stale = [...supersededByGlobal, ...deselected];\n const removalAtScope = (scope: SkillScope): RemoveCompiledAgentsOptions => ({\n agentsDir: resolveInstallPaths(editRoot, scope).agentsDir,\n agents: stale.filter((agent) => agent.scope === scope).map((agent) => agent.name),\n });\n\n return STALE_AGENT_SCOPES.map(removalAtScope).filter((removal) => removal.agents.length > 0);\n}\n\nfunction hasAnyChanges(changes: AppliedChanges): boolean {\n return changes.rewrittenSkills.length > 0 || changesTheConfig(changes);\n}\n\n/** Every change but rewritten carried files, which leave config.ts as it was. */\nfunction changesTheConfig(changes: PlannedChanges): boolean {\n return (\n changes.reassignedAgents.length > 0 ||\n changes.joinedGlobalAgents.length > 0 ||\n changes.addedSkills.length > 0 ||\n changes.removedSkills.length > 0 ||\n changes.addedAgents.length > 0 ||\n changes.removedAgents.length > 0 ||\n changes.sourceChanges.size > 0 ||\n changes.scopeChanges.size > 0 ||\n changes.agentScopeChanges.size > 0 ||\n changes.tuningChanges.size > 0\n );\n}\n\ntype PluginScopeMigrationResult = {\n failed: Array<{ id: SkillId; error: string }>;\n};\n\nasync function migratePluginSkillScopes(\n pluginMoves: SkillMigration[],\n marketplace: string,\n projectDir: string,\n): Promise<PluginScopeMigrationResult> {\n const host = hostAt(projectDir);\n const failed: PluginScopeMigrationResult[\"failed\"] = [];\n\n for (const move of pluginMoves) {\n const pluginRef = buildMarketplacePluginRef(move.id, marketplace);\n\n try {\n // global→project keeps the global registration, which other projects still use.\n if (move.oldScope === \"project\") {\n await host.uninstallPlugin(pluginRef, \"project\", projectDir);\n }\n await host.installPlugin(pluginRef, move.newScope, projectDir);\n } catch (error) {\n failed.push({ id: move.id, error: getErrorMessage(error) });\n }\n }\n\n return { failed };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,OAAO,WAAW;AAClB,SAAS,aAAa;AAEtB,SAAS,YAAY,SAAS,WAAW,cAAc;AAw6BjD;AA3wBN,IAAM,oBAAoB;AAE1B,IAAM,uBAAuB;AAAA,EAC3B,KAAK,WAAW;AAAA,EAChB,KAAK,WAAW;AAAA,EAChB,KAAK,WAAW;AAClB;AAIA,IAAM,eAAe;AAGrB,SAAS,WAAW,QAAsB,SAAiB,QAAyB;AAClF,QAAM,OAAO,MAAM,IAAI,qBAAqB,MAAM,CAAC,EAAE,KAAK,MAAM,IAAI,OAAO,EAAE;AAC7E,SAAO,WAAW,SAAY,OAAO,OAAO,MAAM,IAAI,WAAW,OAAO,EAAE,MAAM;AAClF;AAGA,SAAS,wBAAwB,SAAiB,IAAgB,QAAyB;AACzF,SAAO,WAAW,OAAO,YAAY,MAAM,KAAK,GAAG,OAAO,QAAQ,MAAM;AAC1E;AAGA,SAAS,2BACP,SACA,QACA,2BACQ;AACR,QAAM,cAAc,oBAAoB,OAAO;AAC/C,MAAI,0BAA0B,IAAI,OAAO,GAAG;AAC1C,WAAO,wBAAwB,aAAa,OAAO,EAAE;AAAA,EACvD;AAEA,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,gBAAgB,WAAW,WAAW,UAAU;AAAA,MAC7D;AACA,YAAM,KAAK,cAAc,WAAW,KAAK,UAAU,UAAU;AAAA,IAC/D,SAAS,OAAO;AACd,aAAO,KAAK,EAAE,IAAI,KAAK,IAAI,OAAO,gBAAgB,KAAK,EAAE,CAAC;AAAA,IAC5D;AAAA,EACF;AAEA,SAAO,EAAE,OAAO;AAClB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/commands/edit.tsx"],"sourcesContent":["import os from \"os\";\nimport path from \"path\";\n\nimport chalk from \"chalk\";\nimport { Flags } from \"@oclif/core\";\n\nimport { difference, indexBy, partition, unique } from \"remeda\";\n\nimport { BaseCommand } from \"../base-command.js\";\nimport type { InstallSelection } from \"@workspace/compile/seed-to-config\";\nimport {\n CLI_INVOKE_COMMAND,\n CLI_COLORS,\n EDITOR_ADDRESS,\n EJECT_SOURCE,\n editorConfigUrl,\n formatSourceDisplayName,\n type Provider,\n} from \"../consts.js\";\nimport {\n detectProject,\n loadSource,\n sayCapturedWarnings,\n copyLocalSkills,\n uninstallPluginSkills,\n loadAgentDefs,\n type AgentDefs,\n writeProjectConfig,\n type ConfigWriteResult,\n compileAgentsAllScopes,\n compileProjectScope,\n type CompilationResult,\n discoverInstalledSkills,\n removeCompiledAgents,\n type RemoveCompiledAgentsOptions,\n} from \"../lib/operations/index.js\";\nimport { awaitUnderSpinner } from \"../components/common/spinner.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport {\n type EjectCopyResult,\n type Installation,\n type MigrationPlan,\n detectMigrations,\n ejectCopyFailureError,\n executeMigration,\n holdsItsOwnInstallation,\n isHomeDirectory,\n resolveInstallPaths,\n INSTALL_MODE_DESCRIPTIONS,\n} from \"../lib/installation/index.js\";\nimport {\n movedGlobalAgentInputs,\n projectsAFanOutReaches,\n type GateReport,\n} from \"../lib/config-gate/index.js\";\nimport {\n copyingBesideGlobalPlugins,\n installingBesideGlobalCopies,\n keepsGlobalInstall,\n type SkillMigration,\n} from \"../lib/installation/mode-migrator.js\";\nimport {\n getSkillById,\n getSkillDisplayName,\n getSkillEntryDisplayName,\n} from \"../lib/matrix/matrix-provider\";\nimport { type AuthoritativeScope, loadConfigInPlay } from \"../lib/configuration/index.js\";\nimport {\n activeAgentScopeMap,\n isActiveAt,\n isGlobalTombstone,\n} from \"../lib/configuration/scope-predicates.js\";\nimport { stoppingOnARefusal, type SourceLoadResult } from \"../lib/loading/index.js\";\nimport { buildMarketplacePluginRef } from \"../lib/plugins/index.js\";\nimport { deleteLocalSkill, migrateLocalSkillScope } from \"../lib/skills/index.js\";\nimport type {\n SkillId,\n SkillConfig,\n AgentName,\n AgentScopeConfig,\n MergedSkillsMatrix,\n ProjectConfig,\n SkillScope,\n} from \"../types/index.js\";\nimport {\n editorPayloadForInstallation,\n skillsAuthoredHere,\n} from \"../lib/seed/installation-payload.js\";\nimport { publishSeedConfig } from \"../lib/seed/publish-seed.js\";\nimport { fetchSeedConfig } from \"../lib/seed/fetch-seed.js\";\nimport {\n carriedSkillsThatDiffer,\n registerExternalSkills,\n writeExternalSkills,\n type ExternalSkillInstall,\n} from \"../lib/seed/external-skills.js\";\nimport { seedToInstallSelection, type SeedMapping } from \"../lib/seed/seed-to-selection.js\";\nimport {\n installsAtHome,\n joinedStatement,\n notInstalledGlobally,\n panelRowEntries,\n readInstalledGlobal,\n reconcileSharedConfig,\n restoreInstalledGlobal,\n sameAssignments,\n type HeldGlobal,\n type InstalledGlobal,\n type KeptFromRoundTrip,\n type ReconciledSharedConfig,\n type UnassignedRow,\n} from \"../lib/seed/seed-apply.js\";\nimport { Confirm } from \"../components/common/confirm.js\";\nimport { promptConfirm } from \"../components/common/prompt-confirm.js\";\nimport { summaryPanelBlock, type SummaryPanelProps } from \"../components/common/summary-panel.js\";\nimport { hostAt } from \"../lib/hosts/host-for.js\";\nimport type { PluginHost } from \"../lib/hosts/plugin-host.js\";\nimport {\n pluginRefsOf,\n removeUnderFirstNameHeld,\n} from \"../lib/operations/skills/uninstall-plugin-skills.js\";\nimport { hostCompileNotices } from \"../lib/hosts/host-compile-notices.js\";\nimport { unofferablePlacementsFound } from \"../lib/hosts/configured-placements.js\";\nimport { chooseProviderForThisRun, providerInUse } from \"../lib/installation/install-layout.js\";\nimport {\n installationToName,\n providerFlag,\n providerNamedBy,\n refuseAnAmbiguousInstallation,\n} from \"../lib/installation/provider-flag.js\";\nimport { initProviderToNameAt, providerToNameAt } from \"../lib/installation/provider-to-name.js\";\nimport { openUrl } from \"../utils/open-url.js\";\nimport { getErrorMessage } from \"../utils/errors.js\";\nimport { inertLine } from \"../utils/string.js\";\nimport { type StartupMessage } from \"../utils/logger.js\";\nimport {\n INCOMPLETE_WORK_RECOVERY,\n ERROR_MESSAGES,\n INFO_MESSAGES,\n SHARED_CONFIG_APPLY,\n STATUS_MESSAGES,\n agentsNotCompiled,\n applySharedConfigHere,\n authoredHereKept,\n carriedSkillsWritten,\n editorSkillMetadataUnusableError,\n idNamesAnotherMarketplace,\n keptAsInstalledGlobally,\n keptUnassigned,\n localSkillsCopied,\n nothingInstalledToApplyTo,\n recompileSummary,\n registeredProjectsRecompiled,\n sharedConfigDestinations,\n sharedConfigNeedsTerminal,\n subAgentChanged,\n unplaceableKept,\n} from \"../utils/messages.js\";\nimport {\n agentChangesAmong,\n formatScopeTag,\n namedByActiveEntries,\n type AgentChange,\n type NamedBy,\n} from \"../lib/configuration/scope-diff.js\";\nimport type { SeedPayload } from \"@workspace/matrix/seed\";\n\ntype ScopeChange = { from: SkillScope; to: SkillScope };\n\n/** `edit` recompiles every scope it owns in one pass, so its summary has no scope word. */\nconst RECOMPILE_SUBJECT = \"agent\";\n\nconst CHANGE_MARKER_COLORS = {\n \"+\": CLI_COLORS.SUCCESS,\n \"-\": CLI_COLORS.ERROR,\n \"~\": CLI_COLORS.WARNING,\n} as const;\n\ntype ChangeMarker = keyof typeof CHANGE_MARKER_COLORS;\n\nconst AGENT_DETAIL = \" (agent)\";\n\n/** The marker and subject take the marker's colour; the detail after them is neutral. */\nfunction changeLine(marker: ChangeMarker, subject: string, detail?: string): string {\n const head = chalk.hex(CHANGE_MARKER_COLORS[marker])(` ${marker} ${subject}`);\n return detail === undefined ? head : head + chalk.hex(CLI_COLORS.NEUTRAL)(detail);\n}\n\n/** A `[P][G]` pair's project half toggled: an arrow line would claim the global install moved. */\nfunction dualScopeTransitionLine(subject: string, to: SkillScope, detail?: string): string {\n return changeLine(to === \"project\" ? \"+\" : \"-\", `${subject} [P]`, detail);\n}\n\n/** A genuine `[G] → [P]` reads as an addition: the skill arrives in this project. */\nfunction formatSkillScopeChangeLine(\n skillId: SkillId,\n change: ScopeChange,\n dualScopeSkillTransitions: ReadonlySet<SkillId>,\n): string {\n const displayName = getSkillDisplayName(skillId);\n if (dualScopeSkillTransitions.has(skillId)) {\n return dualScopeTransitionLine(displayName, change.to);\n }\n\n const isGlobalToProject = change.from === \"global\" && change.to === \"project\";\n return changeLine(isGlobalToProject ? \"+\" : \"~\", displayName, scopeArrow(change));\n}\n\n/** Unlike a skill, a moved agent is always a move, and only the dual-scope arm says `(agent)`. */\nfunction formatAgentScopeChangeLine(\n agentName: AgentName,\n change: ScopeChange,\n dualScopeAgentTransitions: ReadonlySet<AgentName>,\n): string {\n if (dualScopeAgentTransitions.has(agentName)) {\n return dualScopeTransitionLine(agentName, change.to, AGENT_DETAIL);\n }\n\n return changeLine(\"~\", agentName, scopeArrow(change));\n}\n\nfunction scopeArrow(change: ScopeChange): string {\n return ` (${formatScopeTag(change.from)} \\u2192 ${formatScopeTag(change.to)})`;\n}\n\n/** Prints both values: a retune leaves nothing on disk to compare against. */\nfunction formatValueChangeLine(subject: string, change: ValueChange, kind: string): string {\n return changeLine(\"~\", subject, ` (${kind}: ${change.from} \\u2192 ${change.to})`);\n}\n\nfunction sourceChangeLine(skillId: SkillId, change: ValueChange): string {\n const from = formatSourceDisplayName(change.from);\n const to = formatSourceDisplayName(change.to);\n return changeLine(\"~\", getSkillDisplayName(skillId), ` (${from} \\u2192 ${to})`);\n}\n\n/** Named by the entry it removes: its marketplace may no longer offer the skill. */\nfunction removedSkillLine(skillId: SkillId, oldSkills: SkillConfig[]): string {\n const removed = installedEntryOf(skillId, oldSkills);\n return changeLine(\"-\", `${getSkillEntryDisplayName(removed)} ${formatScopeTag(removed.scope)}`);\n}\n\n/** A removed id is drawn from these very entries, so a miss is a bug, never a skill to skip. */\nfunction installedEntryOf(skillId: SkillId, oldSkills: SkillConfig[]): SkillConfig {\n const entry = oldSkills.find((s) => s.id === skillId);\n if (entry === undefined) throw new Error(`Removed skill '${skillId}' has no installed entry`);\n return entry;\n}\n\n/** Empty for an id the list does not hold. */\nfunction scopeLabelOf(skillId: SkillId, skills: SkillConfig[]): string {\n const skill = skills.find((s) => s.id === skillId);\n return skill === undefined ? \"\" : ` ${formatScopeTag(skill.scope)}`;\n}\n\n/**\n * A retune, a re-assignment, rows joining a held global sub-agent and rewritten files move no\n * entry, so each needs its own line or the run reads as a no-op.\n */\nfunction changeSummaryLines(\n changes: AppliedChanges,\n newSkills: SkillConfig[],\n oldSkills: SkillConfig[],\n): string[] {\n const addedSkill = (id: SkillId): string =>\n changeLine(\"+\", `${inertLine(getSkillById(id).displayName)}${scopeLabelOf(id, newSkills)}`);\n const joinedGlobalDetail = ` ${formatScopeTag(\"global\")} (agent: skills added)`;\n\n return [\n ...changes.addedSkills.map(addedSkill),\n ...changes.removedSkills.map((id) => removedSkillLine(id, oldSkills)),\n ...changes.addedAgents.map((name) => changeLine(\"+\", name, AGENT_DETAIL)),\n ...changes.removedAgents.map((name) => changeLine(\"-\", name, AGENT_DETAIL)),\n ...[...changes.sourceChanges].map(([id, change]) => sourceChangeLine(id, change)),\n ...[...changes.scopeChanges].map(([id, change]) =>\n formatSkillScopeChangeLine(id, change, changes.dualScopeSkillTransitions),\n ),\n ...[...changes.agentScopeChanges].map(([name, change]) =>\n formatAgentScopeChangeLine(name, change, changes.dualScopeAgentTransitions),\n ),\n ...[...changes.tuningChanges].map(([name, change]) =>\n formatValueChangeLine(name, change, \"agent\"),\n ),\n ...changes.reassignedAgents.map((name) => changeLine(\"~\", name, \" (agent: skills reassigned)\")),\n ...changes.joinedGlobalAgents.map((name) => changeLine(\"~\", name, joinedGlobalDetail)),\n ...changes.rewrittenSkills.map((id) =>\n changeLine(\"~\", getSkillDisplayName(id), \" (skill: files rewritten)\"),\n ),\n ];\n}\n\ntype EditContext = {\n installation: Installation;\n projectConfig: ProjectConfig | null;\n sourceResult: SourceLoadResult;\n startupMessages: StartupMessage[];\n};\n\n/** The one directory an `edit` run acts on, decided once and handed to every layer. */\ntype EditRoot = {\n dir: string;\n isGlobal: boolean;\n};\n\n/**\n * The installation `detectProject` found is the only root with a config, so the only one this run\n * may write to.\n */\nfunction resolveEditRoot(installation: Installation): EditRoot {\n const dir = installation.projectDir;\n return { dir, isGlobal: isHomeDirectory(dir) };\n}\n\ntype EditSelection = {\n result: InstallSelection;\n /**\n * Statements naming what this run may not remove, and the held global sub-agents it adds to —\n * rendered in the confirm.\n */\n kept: string[];\n /** Skills the configuration carries rather than names, written once it is approved. */\n carried: ExternalSkillInstall[];\n /** From a project, the held global sub-agents an arriving skill's row joins. */\n joinedGlobalAgents: AgentName[];\n /** The global config itself, read from a project; `null` at home or with no global install. */\n installedGlobal: InstalledGlobal | null;\n};\n\n/**\n * What the question shows: the panel, a line for each sub-agent it marks `~`, and what the run\n * keeps or reaches beyond the panel.\n */\ntype SharedConfigPlan = {\n panel: SummaryPanelProps;\n changedAgents: AgentChange[];\n statements: string[];\n};\n\n/** Entries whose project copy an apply deletes. */\ntype ProjectCopies = { skillIds: SkillId[]; agentNames: AgentName[] };\n\n/** A genuine move, not a collapsed pair: the copy goes from the project, the entry lives on. */\nfunction movedToGlobal(changes: ConfigChanges): ProjectCopies {\n const skillMoves = [...scopeMovesOf(changes)].filter(([, change]) => change.to === \"global\");\n const agentMoves = [...changes.agentScopeChanges].filter(\n ([name, change]) => change.to === \"global\" && !changes.dualScopeAgentTransitions.has(name),\n );\n\n return {\n skillIds: skillMoves.map(([id]) => id),\n agentNames: agentMoves.map(([name]) => name),\n };\n}\n\n/**\n * Sub-agents that keep their slot and still change: retuned, their rows moved, or a held global one\n * a row joins. One that arrives or leaves is the panel's `+` or `-` already. From a project a\n * global one is measured against the global config: the project's holds none of its rows, and its\n * copy of the entry can be out of date.\n */\nfunction changedSubAgents(\n changes: PlannedChanges,\n { result, installedGlobal }: EditSelection,\n projectConfig: ProjectConfig | null,\n): AgentChange[] {\n if (projectConfig === null) return [];\n\n const arrivingOrLeaving = new Set<AgentName>([\n ...changes.addedAgents,\n ...changes.removedAgents,\n ...changes.agentScopeChanges.keys(),\n ]);\n const changed = unique([\n ...changes.reassignedAgents,\n ...changes.tuningChanges.keys(),\n ...changes.joinedGlobalAgents,\n ]).filter((name) => !arrivingOrLeaving.has(name));\n const after = { agents: result.agentConfigs, skills: result.skills, stack: result.assignedStack };\n if (installedGlobal === null) return agentChangesAmong(changed, projectConfig, after);\n\n const [heldGlobal, ownedHere] = partition(changed, (name) => isHeldGlobally(name, result));\n return [\n ...agentChangesAmong(ownedHere, projectConfig, after),\n ...agentChangesAmong(heldGlobal, installedGlobal, after).filter(changesAnything),\n ];\n}\n\nfunction isHeldGlobally(name: AgentName, result: InstallSelection): boolean {\n return result.agentConfigs.some((agent) => agent.name === name && isActiveAt(agent, \"global\"));\n}\n\n/** A held global sub-agent only gains: one the global config finds unchanged is as installed. */\nfunction changesAnything({ gains, loses, settings }: AgentChange): boolean {\n return gains.length > 0 || loses.length > 0 || settings.length > 0;\n}\n\n/**\n * Written over in place, the user's own edits with them: carried skills whose files change, and\n * the ejected copies a switch to plugins deletes. One already named as moving is not named again.\n */\nfunction overwrittenSkillIds(changes: AppliedChanges, active: ActiveEntries): SkillId[] {\n const leaving = new Set(movedToGlobal(changes).skillIds);\n const switched = ejectedCopiesSwitchedToPlugins(migrationPlanOf(changes, active));\n return unique([...changes.rewrittenSkills, ...switched]).filter((id) => !leaving.has(id));\n}\n\n/** A copy beside a global install it keeps is not deleted (`keepsGlobalInstall`). */\nfunction ejectedCopiesSwitchedToPlugins(plan: MigrationPlan): SkillId[] {\n return plan.toPlugin.filter((migration) => !keepsGlobalInstall(migration)).map(({ id }) => id);\n}\n\n/** Measured against each collapsed pair's global install: the only one a collapse can switch. */\nfunction migrationPlanOf(changes: ConfigChanges, active: ActiveEntries): MigrationPlan {\n return detectMigrations(\n withMaskedGlobalsRestored(active.oldSkills, changes.collapsedPairs),\n active.selection.skills,\n );\n}\n\n/** Only carried skills whose files would change: identical bytes written again change nothing. */\nasync function carriedThatChange(carried: ExternalSkillInstall[]): Promise<ExternalSkillInstall[]> {\n const changing = new Set(await carriedSkillsThatDiffer(carried));\n return carried.filter((skill) => changing.has(skill.id));\n}\n\n/** A carried skill new here is an addition, already counted; the rest are rewritten in place. */\nfunction withRewrittenCarried(\n planned: PlannedChanges,\n carriedToWrite: ExternalSkillInstall[],\n): AppliedChanges {\n const writtenIds = carriedToWrite.map((skill) => skill.id);\n return { ...planned, rewrittenSkills: difference(writtenIds, skillsNewHere(planned)) };\n}\n\n/**\n * From a project a shared configuration holds the global install as installed, so the global pass\n * runs only when the write added something global sub-agents derive from.\n */\nfunction compilesGlobalScope(editRoot: EditRoot, written: GateReport): boolean {\n return editRoot.isGlobal || movedGlobalAgentInputs(written);\n}\n\n/**\n * Adds sub-agents whose skill rows change while the roster does not, which\n * {@link detectConfigChanges} cannot see.\n */\ntype ReassignedChanges = ConfigChanges & { reassignedAgents: AgentName[] };\n\n/** Adds the held global sub-agents a project run adds rows to (`HeldGlobal.joined`). */\ntype PlannedChanges = ReassignedChanges & { joinedGlobalAgents: AgentName[] };\n\n/** Adds carried skills already installed here whose files the apply rewrites. */\ntype AppliedChanges = PlannedChanges & { rewrittenSkills: SkillId[] };\n\n/**\n * In a project only the project's own sub-agents count; a global one keeps its installed rows and\n * gains only an arriving skill's (`restoreInstalledGlobal`), which `HeldGlobal.joined` names. A\n * sub-agent already counted as added, or whose project copy arrives beside the global one, is not\n * counted twice.\n */\nfunction withReassignments(\n changes: ConfigChanges,\n result: InstallSelection,\n installedStack: ProjectConfig[\"stack\"],\n editRoot: EditRoot,\n): ReassignedChanges {\n const { assignedStack } = result;\n const arrivingCopies = arrivingProjectHalves(\n changes.agentScopeChanges,\n changes.dualScopeAgentTransitions,\n );\n\n const ownedHere = (agent: AgentScopeConfig): boolean =>\n editRoot.isGlobal || isActiveAt(agent, \"project\");\n const countedAsAdded = (agent: AgentScopeConfig): boolean =>\n changes.addedAgents.includes(agent.name) || arrivingCopies.has(agent.name);\n const rowsMoved = (agent: AgentScopeConfig): boolean =>\n !sameAssignments(assignedStack[agent.name], installedStack?.[agent.name]);\n\n const reassigned = result.agentConfigs.filter(\n (agent) => ownedHere(agent) && !countedAsAdded(agent) && rowsMoved(agent),\n );\n return { ...changes, reassignedAgents: reassigned.map((agent) => agent.name) };\n}\n\n/** Disclosed rather than acted on, so nobody is left wondering why an agent kept a skill. */\nfunction keptStatements(kept: KeptFromRoundTrip, namedBy: NamedBy): string[] {\n return [...authorshipStatement(kept, namedBy), ...catalogueStatement(kept, namedBy)];\n}\n\nfunction authorshipStatement(kept: KeptFromRoundTrip, namedBy: NamedBy): string[] {\n if (kept.authoredSkillIds.length === 0) return [];\n return [authoredHereKept(kept.authoredSkillIds, namedBy)];\n}\n\nfunction catalogueStatement(kept: KeptFromRoundTrip, namedBy: NamedBy): string[] {\n if (kept.unplaceableSkillIds.length === 0) return [];\n return [unplaceableKept(kept.unplaceableSkillIds, namedBy)];\n}\n\nfunction unassignedStatement(unassigned: UnassignedRow[], namedBy: NamedBy): string[] {\n if (unassigned.length === 0) return [];\n return [unassigned.map((row) => keptUnassigned(row, namedBy)).join(\"\\n\")];\n}\n\n/** The run from home that changes what a project run keeps, where home would take it. */\ntype RunFromHome = { id: string | undefined; provider: Provider | undefined };\n\n/** What the confirm says the run keeps, and the held global sub-agents it adds to. */\nfunction keptOnApply(\n reconciled: ReconciledSharedConfig,\n held: HeldGlobal,\n revisedCarried: SkillId[],\n runFromHome: RunFromHome,\n): string[] {\n const namedBy = panelRowEntries(held);\n return [\n ...keptStatements(reconciled.kept, namedBy),\n ...unassignedStatement(reconciled.unassigned, namedBy),\n ...joinedStatement(held),\n ...keptAsInstalledStatement(held, revisedCarried, runFromHome),\n ];\n}\n\n/** A revised carried skill is held whole, so the global install's entry names it. */\nfunction keptAsInstalledStatement(\n held: HeldGlobal,\n revisedCarried: SkillId[],\n runFromHome: RunFromHome,\n): string[] {\n const skillIds = [...held.keptAsInstalled.skillIds, ...revisedCarried];\n const { agentNames } = held.keptAsInstalled;\n if (skillIds.length === 0 && agentNames.length === 0) return [];\n return [\n keptAsInstalledGlobally(\n skillIds,\n agentNames,\n runFromHome.id,\n runFromHome.provider,\n panelRowEntries(held),\n ),\n ];\n}\n\n/** From a project, a shared configuration only adds to the global install. */\nfunction applyAuthority(editRoot: EditRoot): AuthoritativeScope {\n return editRoot.isGlobal ? \"all\" : \"owned\";\n}\n\n/** Both sides of the diff as installed: no excluded entry, and no global install left out. */\ntype ActiveEntries = {\n selection: InstallSelection;\n oldConfig: ProjectConfig | null;\n oldSkills: SkillConfig[];\n oldAgents: AgentScopeConfig[];\n};\n\nfunction activeEntriesOf(\n result: InstallSelection,\n projectConfig: ProjectConfig | null,\n installedGlobal: InstalledGlobal | null,\n): ActiveEntries {\n const installedSkills = projectConfig?.skills ?? [];\n const oldSkills = [\n ...installedSkills.filter((s) => !s.excluded),\n ...globalInstallsHiddenHere(installedSkills, installedGlobal),\n ];\n const oldAgents = (projectConfig?.agents ?? []).filter((a) => !a.excluded);\n\n return {\n selection: {\n ...result,\n skills: result.skills.filter((s) => !s.excluded),\n agentConfigs: result.agentConfigs.filter((a) => !a.excluded),\n },\n oldConfig: projectConfig ? { ...projectConfig, skills: oldSkills, agents: oldAgents } : null,\n oldSkills,\n oldAgents,\n };\n}\n\n/**\n * Masked here by the project's own skill in a one-pick category, yet still installed, and held as\n * installed by the selection (`restoreInstalledGlobal`): left off the old side, it reads as added\n * on every run. A mask beside the project's own copy of the skill is a `[P][G]` pair instead.\n */\nfunction globalInstallsHiddenHere(\n installedSkills: SkillConfig[],\n installedGlobal: InstalledGlobal | null,\n): SkillConfig[] {\n if (installedGlobal === null) return [];\n\n const activeIds = new Set(installedSkills.filter((s) => !s.excluded).map((s) => s.id));\n const hiddenIds = new Set(\n installedSkills.filter((s) => isGlobalTombstone(s) && !activeIds.has(s.id)).map((s) => s.id),\n );\n return installedGlobal.skills.filter((s) => hiddenIds.has(s.id) && isActiveAt(s, \"global\"));\n}\n\nfunction planChanges(\n selection: EditSelection,\n active: ActiveEntries,\n projectConfig: ProjectConfig | null,\n editRoot: EditRoot,\n): PlannedChanges {\n const keptInstalled = globalHalvesKeptInstalled(selection.installedGlobal);\n const changes = detectConfigChanges(active.oldConfig, active.selection, {\n newSkills: [...selection.result.skills, ...keptInstalled.skills],\n oldSkills: projectConfig?.skills ?? [],\n newAgents: [...selection.result.agentConfigs, ...keptInstalled.agents],\n oldAgents: projectConfig?.agents ?? [],\n });\n\n return {\n ...withReassignments(changes, active.selection, projectConfig?.stack, editRoot),\n joinedGlobalAgents: selection.joinedGlobalAgents,\n };\n}\n\nexport default class Edit extends BaseCommand {\n static summary = \"Open this installation in the editor, or apply a configuration with --from\";\n static description = `Open this installation in ${EDITOR_ADDRESS}, or apply a configuration built there with --from`;\n\n static examples = [\n {\n description: \"Open this installation in the editor\",\n command: \"<%= config.bin %> <%= command.id %>\",\n },\n {\n description: \"Apply a configuration built in the editor, by its id\",\n command: \"<%= config.bin %> <%= command.id %> --from <id>\",\n },\n {\n description: \"Look at a shared configuration without applying it\",\n command: \"<%= config.bin %> <%= command.id %> --ui --from <id>\",\n },\n ];\n\n static flags = {\n ui: Flags.boolean({\n description: `Open ${EDITOR_ADDRESS} on this installation, or on the id --from names without applying it — what a bare edit does`,\n default: false,\n }),\n from: Flags.string({\n description:\n \"Apply a configuration shared from agentsinc.sh by its id, removing whatever it leaves out — from a project, only the project's own entries\",\n helpValue: \"<id>\",\n }),\n provider: providerFlag(),\n };\n\n /** The exit code is decided once, after every path through `applyEdit`. */\n async run(): Promise<void> {\n await this.applyEdit();\n this.exitIfWorkIncomplete();\n }\n\n private async applyEdit(): Promise<void> {\n const { flags } = await this.parse(Edit);\n const cwd = process.cwd();\n const namedProvider = providerNamedBy(flags.provider);\n\n // Above every installation check: opening a shared id needs no local state.\n if (flags.ui && flags.from !== undefined) {\n return this.openSharedInEditor(flags.from, cwd, namedProvider);\n }\n\n await this.sayWhenTheGlobalInstallationStandsIn(namedProvider);\n // Before anything is copied or installed.\n await refuseAnAmbiguousInstallation(cwd, \"edit\", namedProvider, (message) =>\n this.error(message, { exit: EXIT_CODES.INVALID_ARGS }),\n );\n\n // Before anything renders: an unreadable config is recreated, not edited.\n await this.ensureConfigReadable(cwd);\n await this.refuseUnofferablePlacements(cwd);\n\n // A bare `edit` is `edit --ui`, and needs no source load.\n if (flags.from === undefined) return this.openInEditor(cwd);\n\n return this.applySharedConfig(flags.from, namedProvider);\n }\n\n private async applySharedConfig(id: string, namedProvider: Provider | undefined): Promise<void> {\n const payload = await this.fetchSharedConfigOrFail(id, namedProvider);\n const context = await this.loadContextUnderSpinner();\n this.sayWhenItNamesAnotherMarketplace(payload, context.sourceResult);\n const editRoot = resolveEditRoot(context.installation);\n\n // A skill whose metadata.yaml no longer describes it would be dropped from config.ts.\n await this.ensureSavedSkillsReadable(\n context.projectConfig?.skills ?? [],\n context.sourceResult.matrix,\n editRoot.dir,\n );\n\n const selection = await this.selectionFromSharedConfig(id, payload, context, editRoot);\n this.reportValidationErrors(selection.result.validation);\n\n const active = activeEntriesOf(\n selection.result,\n context.projectConfig,\n selection.installedGlobal,\n );\n const planned = planChanges(selection, active, context.projectConfig, editRoot);\n // Before asking: a rewrite is named in the plan, and a run that changes nothing asks nothing.\n const carriedToWrite = await carriedThatChange(selection.carried);\n const changes = withRewrittenCarried(planned, carriedToWrite);\n\n if (!hasAnyChanges(changes)) return this.sayNothingChanged(selection.kept);\n\n this.refuseWithoutATerminal(id, namedProvider, editRoot);\n const plan = await this.planToConfirm(changes, active, selection, context, editRoot);\n await this.confirmSharedConfigOrCancel(plan);\n await this.writeCarriedSkills(carriedToWrite);\n await this.applyApprovedChanges(changes, active, selection.result, context, editRoot);\n }\n\n private async applyApprovedChanges(\n changes: AppliedChanges,\n active: ActiveEntries,\n result: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const { selection: activeSelection, oldSkills, oldAgents } = active;\n this.logChangeSummary(changes, activeSelection.skills, oldSkills);\n const migrationPlan = migrationPlanOf(changes, active);\n await this.applyMigrations(migrationPlan, context, editRoot);\n await this.applyScopeChanges(migrationPlan.scopeChanges, context, editRoot);\n await this.applyCollapsedPairs(changes, context, editRoot);\n await this.applyPluginChanges(changes, activeSelection, oldSkills, context, editRoot);\n await this.copyNewLocalSkills(changes, activeSelection, context, editRoot);\n await this.removeDeletedLocalSkills(changes, oldSkills, editRoot);\n // Unfiltered: the config records the excluded entries too.\n await this.writeConfigAndCompile(result, context, editRoot);\n await this.cleanupStaleAgentFiles(changes, oldAgents, editRoot);\n await this.reportWhatThisHostCannotCarry(editRoot);\n this.logCompletionSummary();\n }\n\n /**\n * A shared configuration applies destructively, except for a skill written here (`forkedFrom`)\n * and an id this catalogue cannot place — both disclosed in the confirm. From a project the\n * global install is only added to.\n */\n private async selectionFromSharedConfig(\n id: string,\n payload: SeedPayload,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<EditSelection> {\n const { matrix: sourceMatrix } = context.sourceResult;\n // Before the decode: a carried skill answers to no catalogue until it is seated.\n const carried = this.registerExternalSkillsOrFail(payload, sourceMatrix, editRoot.dir);\n const mapping = this.decodeSeedOrFail(payload, sourceMatrix);\n const { result } = mapping;\n\n // Before any skip is narrated; `init --from` asks the same at the same point.\n this.refuseProjectScopedContentAtHome(result, editRoot.dir, true);\n\n const reconciled = await this.reconcileWithInstallation(mapping, context, editRoot);\n const installedGlobal = editRoot.isGlobal ? null : await readInstalledGlobal(editRoot.dir);\n const held = restoreInstalledGlobal(reconciled.result, installedGlobal);\n const arrivingCarried = notInstalledGlobally(carried, held);\n\n await this.refuseSharedConfigBeforeAsking(\n held.result,\n arrivingCarried,\n editRoot.dir,\n context.sourceResult,\n );\n\n // Held globally, so not written from a project; named in the plan instead.\n const revisedGlobally = await carriedSkillsThatDiffer(difference(carried, arrivingCarried));\n\n sayCapturedWarnings(context.startupMessages);\n this.warnOfSkippedEntries(mapping, context.sourceResult.unloadedSkillIds);\n\n const runFromHome = {\n id: installsAtHome(result) ? id : undefined,\n provider: providerToNameAt(os.homedir(), providerInUse(editRoot.dir)),\n };\n\n return {\n result: held.result,\n kept: keptOnApply(reconciled, held, revisedGlobally, runFromHome),\n carried: arrivingCarried,\n joinedGlobalAgents: held.joined.map(({ agentName }) => agentName),\n installedGlobal,\n };\n }\n\n /** Ids the decode could not place stay: a catalogue limit is not an instruction to delete. */\n private async reconcileWithInstallation(\n { result, skippedSkillIds }: SeedMapping,\n { projectConfig }: EditContext,\n editRoot: EditRoot,\n ): Promise<ReconciledSharedConfig> {\n return reconcileSharedConfig({\n decoded: result,\n installed: projectConfig,\n authoredHere: await this.readAuthoredHere(projectConfig, editRoot.dir),\n unplaceable: new Set(skippedSkillIds),\n });\n }\n\n /** Best-effort: an unreadable directory protects nothing and must not fail an apply. */\n private async readAuthoredHere(\n projectConfig: ProjectConfig | null,\n editRoot: string,\n ): Promise<Set<SkillId>> {\n if (!projectConfig) return new Set();\n\n try {\n return await skillsAuthoredHere(projectConfig, editRoot);\n } catch (error) {\n this.warn(`Could not tell which skills were written here: ${getErrorMessage(error)}`);\n return new Set();\n }\n }\n\n /** Refuses an empty directory before spending a round trip. */\n private async fetchSharedConfigOrFail(\n id: string,\n namedProvider: Provider | undefined,\n ): Promise<SeedPayload> {\n if (!(await detectProject())) {\n this.error(nothingInstalledToApplyTo(id, namedProvider), { exit: EXIT_CODES.ERROR });\n }\n\n this.log(`Fetching configuration ${id}...`);\n const fetched = await fetchSeedConfig(id);\n if (!fetched.ok) {\n this.error(fetched.error, { exit: EXIT_CODES.ERROR });\n }\n\n return fetched.payload;\n }\n\n /** An apply always reads the installation's own marketplace; one an id names is never fetched. */\n private sayWhenItNamesAnotherMarketplace(\n { marketplace: named }: SeedPayload,\n { sourceConfig: { source: used } }: SourceLoadResult,\n ): void {\n if (named === undefined || named === used) return;\n this.log(idNamesAnotherMarketplace(named, used));\n }\n\n private decodeSeedOrFail(payload: SeedPayload, sourceMatrix: MergedSkillsMatrix): SeedMapping {\n try {\n return seedToInstallSelection(payload, sourceMatrix);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n private registerExternalSkillsOrFail(\n payload: SeedPayload,\n sourceMatrix: MergedSkillsMatrix,\n projectDir: string,\n ): ExternalSkillInstall[] {\n try {\n return registerExternalSkills(payload, sourceMatrix, projectDir);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n private async writeCarriedSkills(carried: ExternalSkillInstall[]): Promise<void> {\n if (carried.length === 0) return;\n\n await writeExternalSkills(carried);\n const recorded = carried.map(({ id, skill }) => ({ id, displayName: skill.displayName }));\n this.log(\n carriedSkillsWritten(\n carried.map(({ id }) => id),\n namedByActiveEntries(recorded),\n ),\n );\n }\n\n /**\n * A destructive apply nobody can confirm must never become a yes. Asked only of a run that changes\n * something: one that changes nothing needs no one to confirm it.\n */\n private refuseWithoutATerminal(\n id: string,\n namedProvider: Provider | undefined,\n editRoot: EditRoot,\n ): void {\n if (process.stdin.isTTY) return;\n\n const initProvider =\n namedProvider ?? initProviderToNameAt(editRoot.dir, providerInUse(editRoot.dir));\n this.error(sharedConfigNeedsTerminal(id, namedProvider, initProvider), {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n /** The panel of what the run changes, then what it keeps and what else it recompiles. */\n private async planToConfirm(\n changes: AppliedChanges,\n active: ActiveEntries,\n selection: EditSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<SharedConfigPlan> {\n const { projectConfig } = context;\n const changedAgents = changedSubAgents(changes, selection, projectConfig);\n const reachedProjects = await this.registeredProjectsStatement(changes, context, editRoot);\n\n return {\n panel: {\n skillConfigs: selection.result.skills,\n agentConfigs: selection.result.agentConfigs,\n installedSkillConfigs: projectConfig?.skills ?? null,\n installedAgentConfigs: projectConfig?.agents ?? null,\n isInitMode: false,\n overwrittenSkillIds: new Set(overwrittenSkillIds(changes, active)),\n changedAgentNames: new Set(changedAgents.map(({ name }) => name)),\n stackName: await this.stackNameOf(selection.result.selectedStackId, context.sourceResult),\n },\n changedAgents,\n statements: [...selection.kept, ...reachedProjects],\n };\n }\n\n /** Nothing to confirm; what the run keeps still says why nothing changed. */\n private sayNothingChanged(kept: string[]): void {\n for (const statement of kept) {\n this.log(statement);\n }\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(INFO_MESSAGES.NO_CHANGES_MADE));\n }\n\n /**\n * At home every registered project inlines the global config, so a change to it rewrites each\n * one the fan-out reaches. Rewritten carried files alone leave the config as it was.\n */\n private async registeredProjectsStatement(\n changes: AppliedChanges,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<string[]> {\n if (!editRoot.isGlobal || !changesTheConfig(changes)) return [];\n\n const reached = await projectsAFanOutReaches(\n context.projectConfig?.projects ?? [],\n providerInUse(editRoot.dir),\n );\n return reached.length === 0 ? [] : [registeredProjectsRecompiled(reached)];\n }\n\n private async confirmSharedConfigOrCancel(plan: SharedConfigPlan): Promise<void> {\n const lines = summaryPanelBlock(\n plan.panel,\n plan.changedAgents.map(subAgentChanged),\n plan.statements,\n );\n for (const line of lines) {\n this.log(line);\n }\n\n const outcome = await promptConfirm(({ onConfirm, onCancel }) => (\n <Confirm message={SHARED_CONFIG_APPLY.CONFIRM} onConfirm={onConfirm} onCancel={onCancel} />\n ));\n if (outcome === \"confirmed\") return;\n\n this.log(\"\\nEdit cancelled\");\n this.exit(EXIT_CODES.CANCELLED);\n }\n\n /** `edit` rewrites the file, so it must not let a user curate a roster no command acts on. */\n private async refuseUnofferablePlacements(cwd: string): Promise<void> {\n const [finding] = await unofferablePlacementsFound(cwd);\n if (finding !== undefined) this.error(finding, { exit: EXIT_CODES.ERROR });\n }\n\n /** Mints what `share` mints, marked when made in a project. Touches nothing on disk. */\n private async openInEditor(projectDir: string): Promise<void> {\n await this.ensureInstalledSkillsReadable(projectDir);\n\n const prepared = await editorPayloadForInstallation(projectDir);\n if (!prepared.ok) {\n this.error(prepared.error, { exit: EXIT_CODES.ERROR });\n }\n\n this.log(`Opening ${prepared.skills} skill(s) across ${prepared.agents} sub-agent(s)...`);\n\n const published = await publishSeedConfig(prepared.payload);\n if (!published.ok) {\n this.error(published.error, { exit: EXIT_CODES.ERROR });\n }\n\n await this.handToBrowser(published.id);\n }\n\n /**\n * The payload reads every ejected skill's metadata.yaml for its provenance, and no catalogue is\n * loaded here to resolve a skill around it, so every installed entry is asked about — not only\n * those a catalogue lacks, as `edit --from` asks. The config read is the one the payload reads.\n */\n private async ensureInstalledSkillsReadable(projectDir: string): Promise<void> {\n const loaded = await loadConfigInPlay(projectDir);\n // Nothing installed is `editorPayloadForInstallation`'s to report.\n if (!loaded) return;\n\n await this.refuseUnusableSavedSkillMetadata(\n loaded.config.skills,\n projectDir,\n editorSkillMetadataUnusableError,\n );\n }\n\n /**\n * Opens an id rather than applying it; `--from` without `--ui` is the destructive apply. A named\n * provider is committed first, as `init` does, so \"installed here\" means that installation.\n */\n private async openSharedInEditor(\n id: string,\n cwd: string,\n namedProvider: Provider | undefined,\n ): Promise<void> {\n if (namedProvider !== undefined) chooseProviderForThisRun(namedProvider);\n const url = editorConfigUrl(id);\n const installedHere = await holdsItsOwnInstallation(cwd);\n const provider = installedHere ? await installationToName(cwd, namedProvider) : namedProvider;\n\n this.log(`Open it at ${url}`);\n this.log(applySharedConfigHere(id, installedHere, provider));\n\n if (!process.stdin.isTTY) return;\n\n const opened = await openUrl(url);\n if (!opened.ok) this.warn(opened.error);\n }\n\n /** The link prints first: it works over a pipe, in CI and with no desktop. Opening is extra. */\n private async handToBrowser(id: string): Promise<void> {\n this.logSuccess(`Shared as ${id}`);\n for (const destination of sharedConfigDestinations(id)) {\n this.log(destination);\n }\n\n if (!process.stdin.isTTY) return;\n\n const opened = await openUrl(editorConfigUrl(id));\n if (!opened.ok) this.warn(opened.error);\n }\n\n private async loadContextUnderSpinner(): Promise<EditContext> {\n return awaitUnderSpinner(STATUS_MESSAGES.LOADING_SKILLS, () => this.loadContext());\n }\n\n private async loadContext(): Promise<EditContext> {\n const detected = await detectProject();\n if (!detected) {\n this.error(ERROR_MESSAGES.NO_INSTALLATION, {\n exit: EXIT_CODES.ERROR,\n });\n }\n const { installation, config: projectConfig } = detected;\n\n try {\n const { sourceResult, startupMessages } = await stoppingOnARefusal(() =>\n loadSource({ projectDir: installation.projectDir, captureStartupMessages: true }),\n );\n return { installation, projectConfig, sourceResult, startupMessages };\n } catch (error) {\n this.handleError(error);\n }\n }\n\n private logChangeSummary(\n changes: AppliedChanges,\n newSkills: SkillConfig[],\n oldSkills: SkillConfig[],\n ): void {\n this.log(`\\n${chalk.hex(CLI_COLORS.WHITE).bold(\"Changes:\")}`);\n for (const line of changeSummaryLines(changes, newSkills, oldSkills)) {\n this.log(line);\n }\n this.log(\"\");\n }\n\n private async applyMigrations(\n migrationPlan: MigrationPlan,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n if (migrationPlan.toEject.length === 0 && migrationPlan.toPlugin.length === 0) return;\n\n this.announceMigrations(migrationPlan);\n if (migrationPlan.toPlugin.length > 0) {\n // `claude plugin install` needs the marketplace registered and current. Before\n // `executeMigration`, so an unresolvable marketplace exits with the ejected copies intact.\n await this.requireMarketplaceOrExit(\n context.sourceResult,\n \"migrate skills to plugin mode\",\n hostAt(editRoot.dir),\n );\n // `executeMigration` installs, deleting each working copy as its plugin registers, so the\n // banner is announced here.\n this.announcePluginInstall();\n }\n\n const migrationResult = await executeMigration(\n migrationPlan,\n editRoot.dir,\n context.sourceResult,\n );\n\n for (const warning of migrationResult.warnings) {\n this.warn(warning);\n }\n\n // Hard-errors before anything records `origin: \"eject\"` for a skill with no copy on disk.\n if (migrationPlan.toEject.length > 0) {\n this.reportEjectCopies(migrationResult.ejectCopies);\n }\n\n // Hard-errors before anything records a marketplace `origin` for an unregistered skill.\n if (migrationPlan.toPlugin.length > 0) {\n this.reportPluginInstalls(migrationResult.pluginInstalls);\n }\n }\n\n /**\n * Mirrors `BaseCommand.reportPluginInstalls` for the plugin→eject half. The count line names no\n * destination: copies split between the project and $HOME by each skill's scope.\n */\n private reportEjectCopies(result: EjectCopyResult): void {\n for (const item of result.failed) {\n this.warn(`Failed to copy ${item.id} for eject: ${item.error}`);\n }\n if (result.failed.length > 0) {\n this.error(ejectCopyFailureError(result.failed.length), { exit: EXIT_CODES.ERROR });\n }\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(localSkillsCopied(result.copied.length)));\n }\n\n /**\n * One line per kind, each counting its own: a mode switch, then a skill added in the project\n * beside the global install it keeps (`keepsGlobalInstall` decides both the keep and the line).\n */\n private announceMigrations(plan: MigrationPlan): void {\n const [copiesBesideGlobalPlugin, switchesToEject] = partition(plan.toEject, keepsGlobalInstall);\n const [installsBesideGlobalCopy, switchesToPlugin] = partition(\n plan.toPlugin,\n keepsGlobalInstall,\n );\n\n if (switchesToEject.length > 0) {\n this.logModeSwitch(switchesToEject.length, INSTALL_MODE_DESCRIPTIONS.eject);\n }\n if (copiesBesideGlobalPlugin.length > 0) {\n this.logCopiesBesideGlobalPlugins(copiesBesideGlobalPlugin.length);\n }\n if (switchesToPlugin.length > 0) {\n this.logModeSwitch(switchesToPlugin.length, INSTALL_MODE_DESCRIPTIONS.plugin);\n }\n if (installsBesideGlobalCopy.length > 0) {\n this.logInstallsBesideGlobalCopies(installsBesideGlobalCopy.length);\n }\n }\n\n private logModeSwitch(count: number, modeDescription: string): void {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Switching ${count} skill(s) to ${modeDescription}`));\n }\n\n private logCopiesBesideGlobalPlugins(count: number): void {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(copyingBesideGlobalPlugins(count)));\n }\n\n private logInstallsBesideGlobalCopies(count: number): void {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(installingBesideGlobalCopies(count)));\n }\n\n /**\n * Only moves that keep their mode: a switch lands at its new scope ({@link applyMigrations}). A\n * collapsed `[P][G]` pair is not a move: its project half is dropped ({@link applyCollapsedPairs}).\n */\n private async applyScopeChanges(\n scopeMoves: SkillMigration[],\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const [copyMoves, pluginMoves] = partition(\n scopeMoves,\n (move) => move.newSource === EJECT_SOURCE,\n );\n await moveEjectedSkillCopies(copyMoves, editRoot.dir);\n\n if (pluginMoves.length === 0) return;\n\n const marketplace = await this.requireMarketplaceOrExit(\n context.sourceResult,\n \"migrate plugin skill scopes\",\n hostAt(editRoot.dir),\n );\n\n const pluginScopeResult = await migratePluginSkillScopes(\n pluginMoves,\n marketplace,\n editRoot.dir,\n );\n // A migration installs at the new scope, so unlike an uninstall a failure is not diagnostic:\n // the skill is registered at neither scope.\n for (const item of pluginScopeResult.failed) {\n this.reportIncompleteWork(\n `Failed to migrate plugin scope for ${item.id}: ${item.error}`,\n INCOMPLETE_WORK_RECOVERY.INSPECT_INSTALLATION,\n );\n }\n }\n\n /**\n * Each project half is removed at project scope only. The global install's mode is\n * {@link applyMigrations}' to change. The uninstall is diagnostic, as every one here is.\n */\n private async applyCollapsedPairs(\n changes: ConfigChanges,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const [ejectedHalves, pluginHalves] = partition(\n changes.collapsedPairs.map(({ projectHalf }) => projectHalf),\n (half) => half.origin === EJECT_SOURCE,\n );\n\n for (const half of ejectedHalves) {\n await deleteLocalSkill(editRoot.dir, half.id, half.scope);\n }\n await this.uninstallProjectPluginHalves(\n pluginHalves,\n context.sourceResult.marketplace,\n editRoot,\n );\n }\n\n private async uninstallProjectPluginHalves(\n pluginHalves: SkillConfig[],\n marketplace: string | undefined,\n editRoot: EditRoot,\n ): Promise<void> {\n if (pluginHalves.length === 0) return;\n if (marketplace === undefined) {\n for (const half of pluginHalves) {\n this.warn(`Could not uninstall this project's plugin for ${half.id}: no marketplace`);\n }\n return;\n }\n\n await this.uninstallPluginSkillsReported(\n pluginHalves.map((half) => half.id),\n pluginHalves,\n marketplace,\n editRoot.dir,\n );\n }\n\n private async uninstallPluginSkillsReported(\n skillIds: SkillId[],\n oldSkills: SkillConfig[],\n marketplace: string,\n projectDir: string,\n ): Promise<void> {\n const { uninstalled, failed } = await uninstallPluginSkills(\n skillIds,\n oldSkills,\n marketplace,\n projectDir,\n );\n if (uninstalled.length > 0) {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Removed ${uninstalled.length} plugin(s)`));\n }\n for (const item of failed) {\n this.warn(`Failed to uninstall plugin ${item.id}: ${item.error}`);\n }\n }\n\n private async applyPluginChanges(\n changes: ConfigChanges,\n filteredResult: InstallSelection,\n activeOldSkills: SkillConfig[],\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const { addedSkills, removedSkills } = changes;\n\n const addedPluginSkills = filteredResult.skills.filter(\n (s) => addedSkills.includes(s.id) && s.origin !== EJECT_SOURCE,\n );\n const removedPluginSkills = removedSkills.filter(\n (id) => activeOldSkills.find((s) => s.id === id)?.origin !== EJECT_SOURCE,\n );\n\n if (addedPluginSkills.length === 0 && removedPluginSkills.length === 0) return;\n\n const marketplace = await this.requireMarketplaceOrExit(\n context.sourceResult,\n \"install or uninstall plugin skills\",\n hostAt(editRoot.dir),\n );\n\n if (addedPluginSkills.length > 0) {\n await this.installPluginSkillsReported(\n addedPluginSkills,\n marketplace,\n editRoot.dir,\n context.sourceResult.matrix,\n );\n }\n\n if (removedPluginSkills.length > 0) {\n await this.uninstallPluginSkillsReported(\n removedPluginSkills,\n activeOldSkills,\n marketplace,\n editRoot.dir,\n );\n }\n }\n\n private async copyNewLocalSkills(\n changes: ConfigChanges,\n filteredResult: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const { addedSkills } = changes;\n\n const addedLocalSkills = filteredResult.skills.filter(\n (s) => addedSkills.includes(s.id) && s.origin === EJECT_SOURCE,\n );\n\n if (addedLocalSkills.length > 0) {\n const copyResult = await copyLocalSkills(\n addedLocalSkills,\n editRoot.dir,\n context.sourceResult,\n );\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(localSkillsCopied(copyResult.totalCopied)));\n }\n }\n\n private async removeDeletedLocalSkills(\n changes: ConfigChanges,\n activeOldSkills: SkillConfig[],\n editRoot: EditRoot,\n ): Promise<void> {\n const { removedSkills } = changes;\n\n // A deselected eject skill is uninstalled at its scope; plugin removals belong to\n // applyPluginChanges.\n for (const skillId of removedSkills) {\n const oldSkill = activeOldSkills.find((s) => s.id === skillId);\n if (oldSkill?.origin !== EJECT_SOURCE) continue;\n\n await deleteLocalSkill(editRoot.dir, skillId, oldSkill.scope);\n }\n }\n\n private async writeConfigAndCompile(\n result: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n ): Promise<void> {\n const agentDefs = await this.loadAgentDefsOrFail();\n const configResult = await this.writeConfigOrFail(result, context, editRoot, agentDefs);\n this.reportUnassignedSkills(configResult.config, result.skills);\n await this.recompileAgents(result, editRoot, configResult.propagation, agentDefs.sourcePath);\n this.reportFanOut(configResult.propagation);\n }\n\n private async loadAgentDefsOrFail(): Promise<AgentDefs> {\n try {\n return await loadAgentDefs();\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /** Fatal: every mutation has landed and config.ts is their only record. */\n private async writeConfigOrFail(\n result: InstallSelection,\n context: EditContext,\n editRoot: EditRoot,\n agentDefs: AgentDefs,\n ): Promise<ConfigWriteResult> {\n try {\n return await writeProjectConfig({\n selection: result,\n sourceResult: context.sourceResult,\n projectDir: editRoot.dir,\n agentDefs,\n authoritativeScope: applyAuthority(editRoot),\n });\n } catch (error) {\n this.error(`Could not update config: ${getErrorMessage(error)}`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n }\n\n private async recompileAgents(\n result: InstallSelection,\n editRoot: EditRoot,\n propagation: GateReport,\n sourcePath: string,\n ): Promise<void> {\n try {\n const agentScopeMap = activeAgentScopeMap(result.agentConfigs);\n const { allSkills } = await discoverInstalledSkills(editRoot.dir);\n const compile = compilesGlobalScope(editRoot, propagation)\n ? compileAgentsAllScopes\n : compileProjectScope;\n const compilation = await compile({\n projectDir: editRoot.dir,\n sourcePath,\n skills: allSkills,\n agentScopeMap,\n });\n this.reportRecompile(compilation);\n } catch (error) {\n // The config already landed; a failed recompile must not end in silence.\n this.reportIncompleteWork(\n `Agent recompilation failed: ${getErrorMessage(error)}`,\n INCOMPLETE_WORK_RECOVERY.RECOMPILE,\n );\n this.log(`You can manually recompile with '${CLI_INVOKE_COMMAND} compile'.`);\n }\n }\n\n private reportRecompile({ compiled, rewritten, failed, warnings }: CompilationResult): void {\n const summary = recompileSummary(\n rewritten.length,\n compiled.length - rewritten.length,\n RECOMPILE_SUBJECT,\n );\n\n if (failed.length > 0) {\n this.log(\n chalk.hex(CLI_COLORS.NEUTRAL)(summary) +\n chalk.hex(CLI_COLORS.WARNING)(` (${failed.length} failed)`),\n );\n for (const warning of warnings) {\n this.warn(warning);\n }\n // Off `failed`: `warnings` also carries non-failures.\n this.recordIncompleteWork(agentsNotCompiled(failed), INCOMPLETE_WORK_RECOVERY.RECOMPILE);\n } else if (compiled.length > 0) {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(summary));\n } else {\n this.log(chalk.hex(CLI_COLORS.NEUTRAL)(INFO_MESSAGES.NO_AGENTS_TO_RECOMPILE));\n }\n }\n\n private async cleanupStaleAgentFiles(\n changes: ConfigChanges,\n oldAgents: AgentScopeConfig[],\n editRoot: EditRoot,\n ): Promise<void> {\n for (const removal of planStaleAgentRemovals(changes, oldAgents, editRoot.dir)) {\n const { failed } = await removeCompiledAgents(removal);\n\n // A compiled sub-agent left behind is still loaded by Claude Code.\n for (const { name, error } of failed) {\n const agentPath = path.join(removal.agentsDir, `${name}.md`);\n this.reportIncompleteWork(\n `Could not remove agent file ${agentPath}: ${error}`,\n INCOMPLETE_WORK_RECOVERY.DELETE_AGENT_FILE,\n );\n }\n }\n }\n\n /**\n * The host notices `init` and `compile` print ({@link hostCompileNotices}), after\n * {@link cleanupStaleAgentFiles} so a deleted file is not counted. Skipped on a run that owes\n * work, whose tree may not be readable.\n */\n private async reportWhatThisHostCannotCarry(editRoot: EditRoot): Promise<void> {\n if (this.hasIncompleteWork) return;\n\n for (const notice of await hostCompileNotices(providerInUse(editRoot.dir), editRoot.dir)) {\n this.log(notice);\n }\n }\n\n private logCompletionSummary(): void {\n if (this.hasIncompleteWork) return;\n\n this.log(`\\n${chalk.hex(CLI_COLORS.SUCCESS)(\"\\u2713 Done\")}\\n`);\n }\n}\n\ntype ConfigChanges = {\n addedSkills: SkillId[];\n removedSkills: SkillId[];\n addedAgents: AgentName[];\n removedAgents: AgentName[];\n sourceChanges: Map<SkillId, { from: string; to: string }>;\n scopeChanges: Map<SkillId, ScopeChange>;\n agentScopeChanges: Map<AgentName, ScopeChange>;\n /** Dual-scope add/removes in `scopeChanges`, which the summary must not report as migrations. */\n dualScopeSkillTransitions: Set<SkillId>;\n /**\n * The `[P][G]` pairs this edit collapsed, as they stood before it. The project's own install is\n * dropped, so `sourceChanges` and the mode migrations measure a collapsed skill against\n * `maskedGlobal`.\n */\n collapsedPairs: CollapsedPair[];\n /** Agent equivalent of `dualScopeSkillTransitions`. */\n dualScopeAgentTransitions: Set<AgentName>;\n /** Retuned sub-agents (model, effort) with an unchanged roster: nothing moves, yet it changed. */\n tuningChanges: Map<AgentName, ValueChange>;\n};\n\ntype ValueChange = { from: string; to: string };\n\n/** A collapsed `[P][G]` pair, as the config held it before the edit. */\ntype CollapsedPair = {\n /** The project's own install: the half the collapse drops. */\n projectHalf: SkillConfig;\n /** The global install the project half masked, as its tombstone recorded it. */\n maskedGlobal: SkillConfig;\n};\n\n/** Full (tombstone-inclusive) entry lists used to classify dual-scope transitions. */\ntype FullScopeEntries = {\n newSkills: SkillConfig[];\n oldSkills: SkillConfig[];\n newAgents: AgentScopeConfig[];\n oldAgents: AgentScopeConfig[];\n};\n\n/**\n * `fullEntries` carries the tombstone-inclusive lists, used only to tell a scope migration from a\n * dual-scope add/remove.\n */\nfunction detectConfigChanges(\n oldConfig: ProjectConfig | null,\n selection: InstallSelection,\n fullEntries: FullScopeEntries,\n): ConfigChanges {\n const oldSkillIds = oldConfig?.skills.map((s) => s.id) ?? [];\n const newSkillIds = selection.skills.map((s) => s.id);\n const oldAgentNames = oldConfig?.agents.map((a) => a.name) ?? [];\n const newAgentNames = selection.agentConfigs.map((a) => a.name);\n\n const oldSkillsById = indexBy(oldConfig?.skills ?? [], (s) => s.id);\n const oldAgentsByName = indexBy(oldConfig?.agents ?? [], (a) => a.name);\n\n const scopeChanges = detectPropertyChanges(\n selection.skills,\n oldSkillsById,\n (s) => s.id,\n (s) => s.scope,\n );\n const agentScopeChanges = detectPropertyChanges(\n selection.agentConfigs,\n oldAgentsByName,\n (a) => a.name,\n (a) => a.scope,\n );\n const dualScopeSkillTransitions = detectDualScopeTransitions(\n scopeChanges,\n fullEntries.newSkills,\n fullEntries.oldSkills,\n (s) => s.id,\n );\n const collapsedPairs = collapsedPairsOf(\n scopeChanges,\n dualScopeSkillTransitions,\n fullEntries.oldSkills,\n );\n const dualScopeAgentTransitions = detectDualScopeTransitions(\n agentScopeChanges,\n fullEntries.newAgents,\n fullEntries.oldAgents,\n (a) => a.name,\n );\n const arrivingSkills = arrivingProjectHalves(scopeChanges, dualScopeSkillTransitions);\n\n return {\n addedSkills: difference(newSkillIds, oldSkillIds),\n removedSkills: difference(oldSkillIds, newSkillIds),\n addedAgents: difference(newAgentNames, oldAgentNames),\n removedAgents: difference(oldAgentNames, newAgentNames),\n sourceChanges: withoutKeys(\n detectPropertyChanges(\n selection.skills,\n indexBy(withMaskedGlobalsRestored(oldConfig?.skills ?? [], collapsedPairs), (s) => s.id),\n (s) => s.id,\n (s) => s.origin,\n ),\n arrivingSkills,\n ),\n scopeChanges,\n agentScopeChanges,\n dualScopeSkillTransitions,\n collapsedPairs,\n dualScopeAgentTransitions,\n // Either half of a pair is measured against the other install, which this edit never retunes.\n tuningChanges: withoutKeys(\n detectPropertyChanges(selection.agentConfigs, oldAgentsByName, (a) => a.name, describeTuning),\n dualScopeAgentTransitions,\n ),\n };\n}\n\n/** Added, or a project copy arriving beside the global install: files written, not rewritten. */\nfunction skillsNewHere(changes: ConfigChanges): SkillId[] {\n return [\n ...changes.addedSkills,\n ...arrivingProjectHalves(changes.scopeChanges, changes.dualScopeSkillTransitions),\n ];\n}\n\n/**\n * The `[P][G]` pairs this edit opens: the project's own copy arrives beside the global install,\n * so the diff, which measures it against that install, records a change nothing made.\n */\nfunction arrivingProjectHalves<K extends string>(\n scopeChanges: ReadonlyMap<K, ScopeChange>,\n dualScopeTransitions: ReadonlySet<K>,\n): Set<K> {\n const arriving = [...scopeChanges].filter(\n ([key, change]) => change.to === \"project\" && dualScopeTransitions.has(key),\n );\n return new Set(arriving.map(([key]) => key));\n}\n\nfunction withoutKeys<K, V>(changes: ReadonlyMap<K, V>, keys: ReadonlySet<K>): Map<K, V> {\n return new Map([...changes].filter(([key]) => !keys.has(key)));\n}\n\nconst RESTING_TUNING = \"defaults\";\n\n/** Compared as a sentence, so the diff sees no change the summary has no words for. */\nfunction describeTuning(agent: AgentScopeConfig): string {\n const settings = [\n agent.model === undefined ? undefined : `model ${agent.model}`,\n agent.codexModel === undefined ? undefined : `codex model ${agent.codexModel}`,\n agent.effort === undefined ? undefined : `effort ${agent.effort}`,\n ].filter((setting) => setting !== undefined);\n\n return settings.length === 0 ? RESTING_TUNING : settings.join(\", \");\n}\n\nfunction detectPropertyChanges<T, K extends string, V>(\n newItems: T[],\n oldByKey: Record<string, T>,\n getKey: (item: T) => K,\n getValue: (item: T) => V,\n): Map<K, { from: V; to: V }> {\n const changes = new Map<K, { from: V; to: V }>();\n for (const item of newItems) {\n const key = getKey(item);\n const old = oldByKey[key];\n if (old && getValue(old) !== getValue(item)) {\n changes.set(key, { from: getValue(old), to: getValue(item) });\n }\n }\n return changes;\n}\n\n/**\n * The global install's entries as the tombstones a project half arriving beside one leaves: the\n * write masks the global entry rather than moving it (`reconcileProjectSplitAgainstGlobal`). No\n * decoded selection carries these, so without them a project add over a global install reads as\n * the global install moving. Only a key that moves from global to project is looked up in them.\n */\nfunction globalHalvesKeptInstalled(installedGlobal: InstalledGlobal | null): {\n skills: SkillConfig[];\n agents: AgentScopeConfig[];\n} {\n if (installedGlobal === null) return { skills: [], agents: [] };\n\n return {\n skills: installedGlobal.skills.map(asTombstone),\n agents: installedGlobal.agents.map(asTombstone),\n };\n}\n\nfunction asTombstone<T extends { excluded?: boolean }>(entry: T): T {\n return { ...entry, excluded: true };\n}\n\n/**\n * A dual-scope transition, not a migration, when a global tombstone sits beside the change: G→P\n * keeps one in the new state, P→G had one in the old.\n */\nfunction detectDualScopeTransitions<\n K extends string,\n T extends { scope: SkillScope; excluded?: boolean },\n>(scopeChanges: Map<K, ScopeChange>, fullNew: T[], fullOld: T[], getKey: (item: T) => K): Set<K> {\n const hasGlobalTombstone = (items: T[], key: K): boolean =>\n items.some((item) => getKey(item) === key && isGlobalTombstone(item));\n const isDualScope = ([key, { from, to }]: [K, ScopeChange]): boolean =>\n (from === \"global\" && to === \"project\" && hasGlobalTombstone(fullNew, key)) ||\n (from === \"project\" && to === \"global\" && hasGlobalTombstone(fullOld, key));\n\n return new Set([...scopeChanges].filter(isDualScope).map(([key]) => key));\n}\n\n/** P→G dual-scope transitions as the pairs they collapsed, read from the old state. */\nfunction collapsedPairsOf(\n scopeChanges: Map<SkillId, ScopeChange>,\n dualScopeSkillTransitions: ReadonlySet<SkillId>,\n fullOldSkills: SkillConfig[],\n): CollapsedPair[] {\n return [...scopeChanges]\n .filter(([id, change]) => change.to === \"global\" && dualScopeSkillTransitions.has(id))\n .map(([id]) => ({\n projectHalf: oldHalfOf(fullOldSkills, id, (skill) => isActiveAt(skill, \"project\")),\n maskedGlobal: oldHalfOf(fullOldSkills, id, isGlobalTombstone),\n }));\n}\n\n/** Present by construction, so a miss is a defect. */\nfunction oldHalfOf(\n fullOldSkills: SkillConfig[],\n id: SkillId,\n isHalf: (skill: SkillConfig) => boolean,\n): SkillConfig {\n const half = fullOldSkills.find((skill) => skill.id === id && isHalf(skill));\n if (half === undefined) {\n throw new Error(`The config before this edit holds no such half of the pair for '${id}'`);\n }\n return half;\n}\n\n/**\n * The pre-edit roster with each collapsed pair's project half replaced by the global install it\n * masked: the only install whose mode a collapse can change.\n */\nfunction withMaskedGlobalsRestored(\n oldSkills: SkillConfig[],\n collapsedPairs: CollapsedPair[],\n): SkillConfig[] {\n const maskedById = indexBy(\n collapsedPairs.map(({ maskedGlobal }) => maskedGlobal),\n (skill) => skill.id,\n );\n return oldSkills.map((skill) => {\n const masked = maskedById[skill.id];\n if (masked === undefined || skill.scope !== \"project\") return skill;\n return installRecordedBy(masked);\n });\n}\n\nfunction installRecordedBy(tombstone: SkillConfig): SkillConfig {\n const { excluded: _masked, ...install } = tombstone;\n return install;\n}\n\n/** Excludes collapsed pairs, whose global install stays where it is. */\nfunction scopeMovesOf(changes: ConfigChanges): Map<SkillId, ScopeChange> {\n const collapsed = new Set(changes.collapsedPairs.map(({ projectHalf }) => projectHalf.id));\n return new Map([...changes.scopeChanges].filter(([id]) => !collapsed.has(id)));\n}\n\nasync function moveEjectedSkillCopies(\n copyMoves: SkillMigration[],\n projectDir: string,\n): Promise<void> {\n for (const move of copyMoves) {\n await migrateLocalSkillScope(move.id, move.oldScope, projectDir);\n }\n}\n\ntype StaleAgent = { name: AgentName; scope: SkillScope };\n\nconst STALE_AGENT_SCOPES = [\"project\", \"global\"] as const satisfies readonly SkillScope[];\n\n/** For a deselected agent absent from the old roster. */\nconst UNRECORDED_AGENT_SCOPE: SkillScope = \"project\";\n\nfunction installedScope(name: AgentName, oldAgents: AgentScopeConfig[]): SkillScope {\n return oldAgents.find((agent) => agent.name === name)?.scope ?? UNRECORDED_AGENT_SCOPE;\n}\n\n/**\n * The project copy a P→G move superseded, plus every deselected agent at its installed scope. G→P\n * is an override, so the global install stays. Only scopes this edit removed from are tidied.\n */\nfunction planStaleAgentRemovals(\n changes: ConfigChanges,\n oldAgents: AgentScopeConfig[],\n editRoot: string,\n): RemoveCompiledAgentsOptions[] {\n const supersededByGlobal = [...changes.agentScopeChanges]\n .filter(([, change]) => change.from !== \"global\")\n .map(([name]): StaleAgent => ({ name, scope: \"project\" }));\n\n const deselected = changes.removedAgents.map((name): StaleAgent => ({\n name,\n scope: installedScope(name, oldAgents),\n }));\n\n const stale = [...supersededByGlobal, ...deselected];\n const removalAtScope = (scope: SkillScope): RemoveCompiledAgentsOptions => ({\n agentsDir: resolveInstallPaths(editRoot, scope).agentsDir,\n agents: stale.filter((agent) => agent.scope === scope).map((agent) => agent.name),\n });\n\n return STALE_AGENT_SCOPES.map(removalAtScope).filter((removal) => removal.agents.length > 0);\n}\n\nfunction hasAnyChanges(changes: AppliedChanges): boolean {\n return changes.rewrittenSkills.length > 0 || changesTheConfig(changes);\n}\n\n/** Every change but rewritten carried files, which leave config.ts as it was. */\nfunction changesTheConfig(changes: PlannedChanges): boolean {\n return (\n changes.reassignedAgents.length > 0 ||\n changes.joinedGlobalAgents.length > 0 ||\n changes.addedSkills.length > 0 ||\n changes.removedSkills.length > 0 ||\n changes.addedAgents.length > 0 ||\n changes.removedAgents.length > 0 ||\n changes.sourceChanges.size > 0 ||\n changes.scopeChanges.size > 0 ||\n changes.agentScopeChanges.size > 0 ||\n changes.tuningChanges.size > 0\n );\n}\n\ntype PluginScopeMigrationResult = {\n failed: Array<{ id: SkillId; error: string }>;\n};\n\nasync function migratePluginSkillScopes(\n pluginMoves: SkillMigration[],\n marketplace: string,\n projectDir: string,\n): Promise<PluginScopeMigrationResult> {\n const host = hostAt(projectDir);\n const failed: PluginScopeMigrationResult[\"failed\"] = [];\n\n for (const move of pluginMoves) {\n try {\n await movePluginScope(host, move, marketplace, projectDir);\n } catch (error) {\n failed.push({ id: move.id, error: getErrorMessage(error) });\n }\n }\n\n return { failed };\n}\n\n/** A plugin can come from another marketplace than the installation's; its entry names which. */\nasync function movePluginScope(\n host: PluginHost,\n move: SkillMigration,\n marketplace: string,\n projectDir: string,\n): Promise<void> {\n // global→project keeps the global registration, which other projects still use.\n if (move.oldScope === \"project\") {\n const oldRefs = pluginRefsOf(move.id, move.oldSource, marketplace);\n await removeUnderFirstNameHeld(host, oldRefs, \"project\", projectDir);\n }\n const newRef = buildMarketplacePluginRef(move.id, move.newSource);\n await host.installPlugin(newRef, move.newScope, projectDir);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,OAAO,WAAW;AAClB,SAAS,aAAa;AAEtB,SAAS,YAAY,SAAS,WAAW,cAAc;AA+7BjD;AA3xBN,IAAM,oBAAoB;AAE1B,IAAM,uBAAuB;AAAA,EAC3B,KAAK,WAAW;AAAA,EAChB,KAAK,WAAW;AAAA,EAChB,KAAK,WAAW;AAClB;AAIA,IAAM,eAAe;AAGrB,SAAS,WAAW,QAAsB,SAAiB,QAAyB;AAClF,QAAM,OAAO,MAAM,IAAI,qBAAqB,MAAM,CAAC,EAAE,KAAK,MAAM,IAAI,OAAO,EAAE;AAC7E,SAAO,WAAW,SAAY,OAAO,OAAO,MAAM,IAAI,WAAW,OAAO,EAAE,MAAM;AAClF;AAGA,SAAS,wBAAwB,SAAiB,IAAgB,QAAyB;AACzF,SAAO,WAAW,OAAO,YAAY,MAAM,KAAK,GAAG,OAAO,QAAQ,MAAM;AAC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iBAAiB,SAAkC;AAC1D,SACE,QAAQ,iBAAiB,SAAS,KAClC,QAAQ,mBAAmB,SAAS,KACpC,QAAQ,YAAY,SAAS,KAC7B,QAAQ,cAAc,SAAS,KAC/B,QAAQ,YAAY,SAAS,KAC7B,QAAQ,cAAc,SAAS,KAC/B,QAAQ,cAAc,OAAO,KAC7B,QAAQ,aAAa,OAAO,KAC5B,QAAQ,kBAAkB,OAAO,KACjC,QAAQ,cAAc,OAAO;AAEjC;AAMA,eAAe,yBACb,aACA,aACA,YACqC;AACrC,QAAM,OAAO,OAAO,UAAU;AAC9B,QAAM,SAA+C,CAAC;AAEtD,aAAW,QAAQ,aAAa;AAC9B,QAAI;AACF,YAAM,gBAAgB,MAAM,MAAM,aAAa,UAAU;AAAA,IAC3D,SAAS,OAAO;AACd,aAAO,KAAK,EAAE,IAAI,KAAK,IAAI,OAAO,gBAAgB,KAAK,EAAE,CAAC;AAAA,IAC5D;AAAA,EACF;AAEA,SAAO,EAAE,OAAO;AAClB;AAGA,eAAe,gBACb,MACA,MACA,aACA,YACe;AAEf,MAAI,KAAK,aAAa,WAAW;AAC/B,UAAM,UAAU,aAAa,KAAK,IAAI,KAAK,WAAW,WAAW;AACjE,UAAM,yBAAyB,MAAM,SAAS,WAAW,UAAU;AAAA,EACrE;AACA,QAAM,SAAS,0BAA0B,KAAK,IAAI,KAAK,SAAS;AAChE,QAAM,KAAK,cAAc,QAAQ,KAAK,UAAU,UAAU;AAC5D;","names":[]}
|
package/dist/commands/eject.js
CHANGED
|
@@ -5,18 +5,19 @@ import {
|
|
|
5
5
|
loadSource,
|
|
6
6
|
mutateGlobal,
|
|
7
7
|
writeProjectPartial
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-CKBWEWHZ.js";
|
|
9
|
+
import "../chunk-XMQIWPIR.js";
|
|
10
|
+
import "../chunk-JNRACLNS.js";
|
|
11
|
+
import "../chunk-EC3JXT23.js";
|
|
12
|
+
import "../chunk-MQZNDK5F.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseCommand,
|
|
15
15
|
EXIT_CODES,
|
|
16
16
|
providerFlag,
|
|
17
17
|
providerNamedBy,
|
|
18
18
|
refuseAnAmbiguousInstallation
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-JTMSFBCA.js";
|
|
20
|
+
import "../chunk-FACDJH6O.js";
|
|
20
21
|
import {
|
|
21
22
|
INCOMPLETE_WORK_RECOVERY,
|
|
22
23
|
INFO_MESSAGES,
|
|
@@ -35,11 +36,11 @@ import {
|
|
|
35
36
|
resolveInstallPaths,
|
|
36
37
|
resolveSource,
|
|
37
38
|
sourceFolderInUse
|
|
38
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-ENET4IF6.js";
|
|
39
40
|
import {
|
|
40
41
|
matrix,
|
|
41
42
|
plural
|
|
42
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-UE4Z3YMB.js";
|
|
43
44
|
import {
|
|
44
45
|
DIRS,
|
|
45
46
|
PROJECT_ROOT,
|
|
@@ -112,6 +113,9 @@ var Eject = class _Eject extends BaseCommand {
|
|
|
112
113
|
providerNamedBy(flags.provider),
|
|
113
114
|
(message) => this.error(message, { exit: EXIT_CODES.INVALID_ARGS })
|
|
114
115
|
);
|
|
116
|
+
await this.sayWhenTheProjectsConfigDeclaresNothing(
|
|
117
|
+
INFO_MESSAGES.DECLARES_NOTHING_TO_EJECT_FROM
|
|
118
|
+
);
|
|
115
119
|
await this.ensureConfigReadable(projectDir);
|
|
116
120
|
const ejectType = this.validateEjectType(args.type);
|
|
117
121
|
const outputBase = await this.resolveOutputBase(flags, projectDir);
|