agents-inc 0.170.2 → 0.172.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 +38 -0
- package/dist/{chunk-PSUTNOQ2.js → chunk-255DGUCH.js} +2 -2
- package/dist/chunk-33JICQD5.js +196 -0
- package/dist/chunk-33JICQD5.js.map +1 -0
- package/dist/{chunk-3ED3KHHD.js → chunk-3R3LHA4Q.js} +2 -2
- package/dist/{chunk-YXKTY5WM.js → chunk-5MGRHS2G.js} +94 -58
- package/dist/chunk-5MGRHS2G.js.map +1 -0
- package/dist/{chunk-PLFANHRZ.js → chunk-5PPB6HT6.js} +2 -2
- package/dist/{chunk-66AEVERM.js → chunk-6CRA46YO.js} +14 -14
- package/dist/{chunk-ELV5WDS3.js → chunk-6LUTY35Q.js} +25 -14
- package/dist/chunk-6LUTY35Q.js.map +1 -0
- package/dist/{chunk-AUNRHWH4.js → chunk-7OG635DK.js} +26 -4
- package/dist/chunk-7OG635DK.js.map +1 -0
- package/dist/{chunk-GEMW5RQ2.js → chunk-7ZOWSCAO.js} +29 -102
- package/dist/chunk-7ZOWSCAO.js.map +1 -0
- package/dist/{chunk-YGDWHDOY.js → chunk-A3ZAXL5T.js} +4 -5
- package/dist/{chunk-YGDWHDOY.js.map → chunk-A3ZAXL5T.js.map} +1 -1
- package/dist/chunk-G7NUK3BF.js +253 -0
- package/dist/chunk-G7NUK3BF.js.map +1 -0
- package/dist/{chunk-THO7LO5B.js → chunk-KCLBLK3F.js} +3 -3
- package/dist/{chunk-2YA4DDRM.js → chunk-LUKDDHSI.js} +8 -6
- package/dist/{chunk-2YA4DDRM.js.map → chunk-LUKDDHSI.js.map} +1 -1
- package/dist/{chunk-OCAVW6N5.js → chunk-MBIOZ5LW.js} +12 -3
- package/dist/{chunk-OCAVW6N5.js.map → chunk-MBIOZ5LW.js.map} +1 -1
- package/dist/{chunk-7C3PFRBU.js → chunk-MHAQWMNJ.js} +35 -5
- package/dist/{chunk-7C3PFRBU.js.map → chunk-MHAQWMNJ.js.map} +1 -1
- package/dist/{chunk-HACRR422.js → chunk-MOL2J5HS.js} +2 -2
- package/dist/{chunk-BBDGYJHX.js → chunk-N33AKFLR.js} +2 -2
- package/dist/{chunk-5BNX73OU.js → chunk-NISWBQNS.js} +52 -31
- package/dist/chunk-NISWBQNS.js.map +1 -0
- package/dist/{chunk-GAKVZNTX.js → chunk-VILFCMRN.js} +420 -316
- package/dist/chunk-VILFCMRN.js.map +1 -0
- package/dist/{chunk-IWY5IR4F.js → chunk-Y23MP2OC.js} +8 -8
- package/dist/commands/build/marketplace.js +16 -14
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +6 -6
- package/dist/commands/compile.js +12 -12
- package/dist/commands/doctor.js +64 -81
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +150 -152
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +10 -10
- package/dist/commands/init.js +19 -16
- package/dist/commands/list.js +14 -17
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +4 -4
- package/dist/commands/search.js +15 -13
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +11 -11
- package/dist/commands/uninstall.js +109 -98
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +6 -6
- package/dist/components/common/scroll-affordance.js +2 -2
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/common/skill-agent-summary.js +3 -4
- package/dist/components/common/summary-panel.js +11 -146
- package/dist/components/common/summary-panel.js.map +1 -1
- package/dist/hooks/init.js +22 -19
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-54VIKN4T.js +14 -0
- package/dist/{recompile-project-agents-I33KQJFB.js → recompile-project-agents-5A44NJRD.js} +8 -8
- package/dist/{source-loader-TTJVW2ER.js → source-loader-LQNRI5UZ.js} +4 -4
- package/dist/src/agents/tester/web-tester/playbook.md +1 -1
- package/package.json +1 -1
- package/src/agents/tester/web-tester/playbook.md +1 -1
- package/dist/chunk-5BNX73OU.js.map +0 -1
- package/dist/chunk-AUNRHWH4.js.map +0 -1
- package/dist/chunk-ELV5WDS3.js.map +0 -1
- package/dist/chunk-GAKVZNTX.js.map +0 -1
- package/dist/chunk-GEMW5RQ2.js.map +0 -1
- package/dist/chunk-O4LN3HFI.js +0 -69
- package/dist/chunk-O4LN3HFI.js.map +0 -1
- package/dist/chunk-PMUZR4XO.js +0 -108
- package/dist/chunk-PMUZR4XO.js.map +0 -1
- package/dist/chunk-RIK45Q4I.js +0 -103
- package/dist/chunk-RIK45Q4I.js.map +0 -1
- package/dist/chunk-YXKTY5WM.js.map +0 -1
- package/dist/components/common/removal-plan-confirm.js +0 -10
- package/dist/load-agent-defs-6QUUMGHK.js +0 -14
- package/dist/source-loader-TTJVW2ER.js.map +0 -1
- /package/dist/{chunk-PSUTNOQ2.js.map → chunk-255DGUCH.js.map} +0 -0
- /package/dist/{chunk-3ED3KHHD.js.map → chunk-3R3LHA4Q.js.map} +0 -0
- /package/dist/{chunk-PLFANHRZ.js.map → chunk-5PPB6HT6.js.map} +0 -0
- /package/dist/{chunk-66AEVERM.js.map → chunk-6CRA46YO.js.map} +0 -0
- /package/dist/{chunk-THO7LO5B.js.map → chunk-KCLBLK3F.js.map} +0 -0
- /package/dist/{chunk-HACRR422.js.map → chunk-MOL2J5HS.js.map} +0 -0
- /package/dist/{chunk-BBDGYJHX.js.map → chunk-N33AKFLR.js.map} +0 -0
- /package/dist/{chunk-IWY5IR4F.js.map → chunk-Y23MP2OC.js.map} +0 -0
- /package/dist/{components/common/removal-plan-confirm.js.map → load-agent-defs-54VIKN4T.js.map} +0 -0
- /package/dist/{recompile-project-agents-I33KQJFB.js.map → recompile-project-agents-5A44NJRD.js.map} +0 -0
- /package/dist/{load-agent-defs-6QUUMGHK.js.map → source-loader-LQNRI5UZ.js.map} +0 -0
package/dist/commands/edit.js
CHANGED
|
@@ -3,29 +3,32 @@ import {
|
|
|
3
3
|
awaitUnderSpinner
|
|
4
4
|
} from "../chunk-ZEGM3MVR.js";
|
|
5
5
|
import {
|
|
6
|
+
editorPayloadForInstallation,
|
|
6
7
|
publishSeedConfig,
|
|
7
|
-
seedPayloadForInstallation,
|
|
8
8
|
skillsAuthoredHere
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import {
|
|
11
|
-
RemovalPlanConfirm
|
|
12
|
-
} from "../chunk-O4LN3HFI.js";
|
|
9
|
+
} from "../chunk-6LUTY35Q.js";
|
|
13
10
|
import {
|
|
14
11
|
unofferablePlacementsFound
|
|
15
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-MOL2J5HS.js";
|
|
16
13
|
import {
|
|
17
14
|
openUrl
|
|
18
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-5PPB6HT6.js";
|
|
19
16
|
import {
|
|
20
17
|
fetchSeedConfig
|
|
21
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-A3ZAXL5T.js";
|
|
19
|
+
import {
|
|
20
|
+
Confirm
|
|
21
|
+
} from "../chunk-OZXAJNLA.js";
|
|
22
22
|
import {
|
|
23
23
|
promptConfirm
|
|
24
24
|
} from "../chunk-P6CYS4JK.js";
|
|
25
|
-
import
|
|
25
|
+
import {
|
|
26
|
+
summaryPanelBlock
|
|
27
|
+
} from "../chunk-33JICQD5.js";
|
|
28
|
+
import "../chunk-N33AKFLR.js";
|
|
26
29
|
import {
|
|
27
30
|
hostCompileNotices
|
|
28
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-255DGUCH.js";
|
|
29
32
|
import {
|
|
30
33
|
compileAgentsAllScopes,
|
|
31
34
|
compileProjectScope,
|
|
@@ -35,32 +38,32 @@ import {
|
|
|
35
38
|
projectsAFanOutReaches,
|
|
36
39
|
sayCapturedWarnings,
|
|
37
40
|
writeProjectConfig
|
|
38
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-6CRA46YO.js";
|
|
39
42
|
import {
|
|
40
43
|
copyLocalSkills,
|
|
41
44
|
discoverInstalledSkills,
|
|
42
45
|
removeCompiledAgents,
|
|
43
46
|
uninstallPluginSkills
|
|
44
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-Y23MP2OC.js";
|
|
45
48
|
import {
|
|
46
49
|
loadAgentDefs
|
|
47
|
-
} from "../chunk-
|
|
48
|
-
import "../chunk-
|
|
49
|
-
import "../chunk-
|
|
50
|
+
} from "../chunk-KCLBLK3F.js";
|
|
51
|
+
import "../chunk-NISWBQNS.js";
|
|
52
|
+
import "../chunk-LUKDDHSI.js";
|
|
53
|
+
import "../chunk-KIK5EZYD.js";
|
|
50
54
|
import {
|
|
55
|
+
agentChangesAmong,
|
|
51
56
|
formatScopeTag
|
|
52
|
-
} from "../chunk-
|
|
53
|
-
import "../chunk-KIK5EZYD.js";
|
|
57
|
+
} from "../chunk-G7NUK3BF.js";
|
|
54
58
|
import {
|
|
59
|
+
installationToName,
|
|
55
60
|
providerFlag,
|
|
56
61
|
providerNamedBy,
|
|
57
62
|
refuseAnAmbiguousInstallation
|
|
58
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-MBIOZ5LW.js";
|
|
59
64
|
import {
|
|
60
65
|
BaseCommand,
|
|
61
66
|
EXIT_CODES,
|
|
62
|
-
arrivalLines,
|
|
63
|
-
arrivalsByScope,
|
|
64
67
|
carriedSkillsThatDiffer,
|
|
65
68
|
installsAtHome,
|
|
66
69
|
joinedStatement,
|
|
@@ -70,10 +73,8 @@ import {
|
|
|
70
73
|
registerExternalSkills,
|
|
71
74
|
restoreInstalledGlobal,
|
|
72
75
|
sameAssignments,
|
|
73
|
-
skillLabel,
|
|
74
|
-
withUnplaceableAssignees,
|
|
75
76
|
writeExternalSkills
|
|
76
|
-
} from "../chunk-
|
|
77
|
+
} from "../chunk-7ZOWSCAO.js";
|
|
77
78
|
import {
|
|
78
79
|
ERROR_MESSAGES,
|
|
79
80
|
INCOMPLETE_WORK_RECOVERY,
|
|
@@ -86,6 +87,7 @@ import {
|
|
|
86
87
|
authoredHereKept,
|
|
87
88
|
buildMarketplacePluginRef,
|
|
88
89
|
carriedSkillsWritten,
|
|
90
|
+
chooseProviderForThisRun,
|
|
89
91
|
copyingBesideGlobalPlugins,
|
|
90
92
|
deleteLocalSkill,
|
|
91
93
|
detectMigrations,
|
|
@@ -95,6 +97,7 @@ import {
|
|
|
95
97
|
getErrorMessage,
|
|
96
98
|
holdsItsOwnInstallation,
|
|
97
99
|
hostAt,
|
|
100
|
+
initProviderToNameAt,
|
|
98
101
|
installingBesideGlobalCopies,
|
|
99
102
|
isHomeDirectory,
|
|
100
103
|
keepsGlobalInstall,
|
|
@@ -104,35 +107,37 @@ import {
|
|
|
104
107
|
localSkillsCopied,
|
|
105
108
|
migrateLocalSkillScope,
|
|
106
109
|
nothingInstalledToApplyTo,
|
|
107
|
-
projectCopyMovedToGlobal,
|
|
108
|
-
projectCopyRemoved,
|
|
109
110
|
providerInUse,
|
|
111
|
+
providerToNameAt,
|
|
110
112
|
recompileSummary,
|
|
111
|
-
|
|
113
|
+
registeredProjectsRecompiled,
|
|
112
114
|
resolveInstallPaths,
|
|
113
115
|
seedToInstallSelection,
|
|
114
116
|
sharedConfigDestinations,
|
|
115
117
|
sharedConfigNeedsTerminal,
|
|
118
|
+
subAgentChanged,
|
|
116
119
|
unplaceableKept
|
|
117
|
-
} from "../chunk-
|
|
120
|
+
} from "../chunk-VILFCMRN.js";
|
|
118
121
|
import {
|
|
119
122
|
getSkillById,
|
|
120
123
|
getSkillDisplayName,
|
|
121
|
-
|
|
122
|
-
} from "../chunk-
|
|
124
|
+
inertLine
|
|
125
|
+
} from "../chunk-7OG635DK.js";
|
|
123
126
|
import {
|
|
124
127
|
CLI_COLORS,
|
|
125
128
|
CLI_INVOKE_COMMAND,
|
|
129
|
+
EDITOR_ADDRESS,
|
|
126
130
|
EJECT_SOURCE,
|
|
127
131
|
activeAgentScopeMap,
|
|
128
132
|
editorConfigUrl,
|
|
129
133
|
formatSourceDisplayName,
|
|
130
134
|
isActiveAt,
|
|
131
135
|
isGlobalTombstone
|
|
132
|
-
} from "../chunk-
|
|
136
|
+
} from "../chunk-MHAQWMNJ.js";
|
|
133
137
|
import "../chunk-GHHJYNAN.js";
|
|
134
138
|
|
|
135
139
|
// src/cli/commands/edit.tsx
|
|
140
|
+
import os from "os";
|
|
136
141
|
import path from "path";
|
|
137
142
|
import chalk from "chalk";
|
|
138
143
|
import { Flags } from "@oclif/core";
|
|
@@ -182,10 +187,7 @@ function scopeLabelOf(skillId, skills) {
|
|
|
182
187
|
return skill === void 0 ? "" : ` ${formatScopeTag(skill.scope)}`;
|
|
183
188
|
}
|
|
184
189
|
function changeSummaryLines(changes, newSkills, oldSkills) {
|
|
185
|
-
const addedSkill = (id) => changeLine(
|
|
186
|
-
"+",
|
|
187
|
-
`${stripTerminalControls(getSkillById(id).displayName)}${scopeLabelOf(id, newSkills)}`
|
|
188
|
-
);
|
|
190
|
+
const addedSkill = (id) => changeLine("+", `${inertLine(getSkillById(id).displayName)}${scopeLabelOf(id, newSkills)}`);
|
|
189
191
|
const removedSkill = (id) => changeLine("-", `${getSkillDisplayName(id)}${scopeLabelOf(id, oldSkills)}`);
|
|
190
192
|
const joinedGlobalDetail = ` ${formatScopeTag("global")} (agent: skills added)`;
|
|
191
193
|
return [
|
|
@@ -214,41 +216,6 @@ function resolveEditRoot(installation) {
|
|
|
214
216
|
const dir = installation.projectDir;
|
|
215
217
|
return { dir, isGlobal: isHomeDirectory(dir) };
|
|
216
218
|
}
|
|
217
|
-
function sharedConfigPlan(changes, overwrittenSkillIds2, statements) {
|
|
218
|
-
const dropped = droppedProjectHalves(changes);
|
|
219
|
-
const moved = movedToGlobal(changes);
|
|
220
|
-
const skillLines = [
|
|
221
|
-
...changes.removedSkills.map(skillLabel),
|
|
222
|
-
...dropped.skillIds.map((id) => projectCopyRemoved(skillLabel(id))),
|
|
223
|
-
...moved.skillIds.map((id) => projectCopyMovedToGlobal(skillLabel(id)))
|
|
224
|
-
];
|
|
225
|
-
const agentLines = [
|
|
226
|
-
...changes.removedAgents,
|
|
227
|
-
...dropped.agentNames.map(projectCopyRemoved),
|
|
228
|
-
...moved.agentNames.map(projectCopyMovedToGlobal)
|
|
229
|
-
];
|
|
230
|
-
const sections = removalSections(skillLines, agentLines);
|
|
231
|
-
const overwritten = {
|
|
232
|
-
label: SHARED_CONFIG_APPLY.OVERWRITTEN_HEADING,
|
|
233
|
-
items: overwrittenSkillIds2.map(skillLabel)
|
|
234
|
-
};
|
|
235
|
-
return { ...planHeading(sections, overwritten), sections, overwritten, statements };
|
|
236
|
-
}
|
|
237
|
-
function removalSections(skills, agents) {
|
|
238
|
-
return [
|
|
239
|
-
{ label: SHARED_CONFIG_APPLY.SKILLS_HEADING, items: skills },
|
|
240
|
-
{ label: SHARED_CONFIG_APPLY.AGENTS_HEADING, items: agents }
|
|
241
|
-
].filter((section) => section.items.length > 0);
|
|
242
|
-
}
|
|
243
|
-
function droppedProjectHalves(changes) {
|
|
244
|
-
const droppedAgents = [...changes.agentScopeChanges].filter(
|
|
245
|
-
([name, change]) => change.to === "global" && changes.dualScopeAgentTransitions.has(name)
|
|
246
|
-
);
|
|
247
|
-
return {
|
|
248
|
-
skillIds: changes.collapsedPairs.map(({ projectHalf }) => projectHalf.id),
|
|
249
|
-
agentNames: droppedAgents.map(([name]) => name)
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
219
|
function movedToGlobal(changes) {
|
|
253
220
|
const skillMoves = [...scopeMovesOf(changes)].filter(([, change]) => change.to === "global");
|
|
254
221
|
const agentMoves = [...changes.agentScopeChanges].filter(
|
|
@@ -259,10 +226,31 @@ function movedToGlobal(changes) {
|
|
|
259
226
|
agentNames: agentMoves.map(([name]) => name)
|
|
260
227
|
};
|
|
261
228
|
}
|
|
262
|
-
function
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
|
|
229
|
+
function changedSubAgents(changes, { result, installedGlobal }, projectConfig) {
|
|
230
|
+
if (projectConfig === null) return [];
|
|
231
|
+
const arrivingOrLeaving = /* @__PURE__ */ new Set([
|
|
232
|
+
...changes.addedAgents,
|
|
233
|
+
...changes.removedAgents,
|
|
234
|
+
...changes.agentScopeChanges.keys()
|
|
235
|
+
]);
|
|
236
|
+
const changed = unique([
|
|
237
|
+
...changes.reassignedAgents,
|
|
238
|
+
...changes.tuningChanges.keys(),
|
|
239
|
+
...changes.joinedGlobalAgents
|
|
240
|
+
]).filter((name) => !arrivingOrLeaving.has(name));
|
|
241
|
+
const after = { agents: result.agentConfigs, stack: result.assignedStack };
|
|
242
|
+
if (installedGlobal === null) return agentChangesAmong(changed, projectConfig, after);
|
|
243
|
+
const [heldGlobal, ownedHere] = partition(changed, (name) => isHeldGlobally(name, result));
|
|
244
|
+
return [
|
|
245
|
+
...agentChangesAmong(ownedHere, projectConfig, after),
|
|
246
|
+
...agentChangesAmong(heldGlobal, installedGlobal, after).filter(changesAnything)
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
function isHeldGlobally(name, result) {
|
|
250
|
+
return result.agentConfigs.some((agent) => agent.name === name && isActiveAt(agent, "global"));
|
|
251
|
+
}
|
|
252
|
+
function changesAnything({ gains, loses, settings }) {
|
|
253
|
+
return gains.length > 0 || loses.length > 0 || settings.length > 0;
|
|
266
254
|
}
|
|
267
255
|
function overwrittenSkillIds(changes, active) {
|
|
268
256
|
const leaving = new Set(movedToGlobal(changes).skillIds);
|
|
@@ -303,26 +291,6 @@ function withReassignments(changes, result, installedStack, editRoot) {
|
|
|
303
291
|
);
|
|
304
292
|
return { ...changes, reassignedAgents: reassigned.map((agent) => agent.name) };
|
|
305
293
|
}
|
|
306
|
-
function applyArrivals(changes, result) {
|
|
307
|
-
const changedSkills = /* @__PURE__ */ new Set([
|
|
308
|
-
...changes.addedSkills,
|
|
309
|
-
...changes.sourceChanges.keys(),
|
|
310
|
-
...changes.scopeChanges.keys()
|
|
311
|
-
]);
|
|
312
|
-
const changedAgents = /* @__PURE__ */ new Set([
|
|
313
|
-
...changes.addedAgents,
|
|
314
|
-
...changes.agentScopeChanges.keys(),
|
|
315
|
-
...changes.tuningChanges.keys(),
|
|
316
|
-
...changes.reassignedAgents
|
|
317
|
-
]);
|
|
318
|
-
const dropped = droppedProjectHalves(changes);
|
|
319
|
-
const skillArrives = (skill) => changedSkills.has(skill.id) && !dropped.skillIds.includes(skill.id);
|
|
320
|
-
const agentArrives = (agent) => changedAgents.has(agent.name) && !dropped.agentNames.includes(agent.name);
|
|
321
|
-
return arrivalsByScope(
|
|
322
|
-
result.skills.filter(skillArrives),
|
|
323
|
-
result.agentConfigs.filter(agentArrives)
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
294
|
function keptStatements(kept) {
|
|
327
295
|
return [...authorshipStatement(kept), ...catalogueStatement(kept)];
|
|
328
296
|
}
|
|
@@ -340,25 +308,29 @@ function unassignedStatement(unassigned) {
|
|
|
340
308
|
unassigned.map(({ skillId, agentName, category }) => keptUnassigned(skillId, agentName, category)).join("\n")
|
|
341
309
|
];
|
|
342
310
|
}
|
|
343
|
-
function keptOnApply(reconciled, held, revisedCarried,
|
|
311
|
+
function keptOnApply(reconciled, held, revisedCarried, runFromHome) {
|
|
344
312
|
return [
|
|
345
313
|
...keptStatements(reconciled.kept),
|
|
346
314
|
...unassignedStatement(reconciled.unassigned),
|
|
347
315
|
...joinedStatement(held),
|
|
348
|
-
...keptAsInstalledStatement(held, revisedCarried,
|
|
316
|
+
...keptAsInstalledStatement(held, revisedCarried, runFromHome)
|
|
349
317
|
];
|
|
350
318
|
}
|
|
351
|
-
function keptAsInstalledStatement(held, revisedCarried,
|
|
319
|
+
function keptAsInstalledStatement(held, revisedCarried, runFromHome) {
|
|
352
320
|
const skillIds = [...held.keptAsInstalled.skillIds, ...revisedCarried];
|
|
353
321
|
const { agentNames } = held.keptAsInstalled;
|
|
354
322
|
if (skillIds.length === 0 && agentNames.length === 0) return [];
|
|
355
|
-
return [keptAsInstalledGlobally(skillIds, agentNames,
|
|
323
|
+
return [keptAsInstalledGlobally(skillIds, agentNames, runFromHome.id, runFromHome.provider)];
|
|
356
324
|
}
|
|
357
325
|
function applyAuthority(editRoot) {
|
|
358
326
|
return editRoot.isGlobal ? "all" : "owned";
|
|
359
327
|
}
|
|
360
|
-
function activeEntriesOf(result, projectConfig) {
|
|
361
|
-
const
|
|
328
|
+
function activeEntriesOf(result, projectConfig, installedGlobal) {
|
|
329
|
+
const installedSkills = projectConfig?.skills ?? [];
|
|
330
|
+
const oldSkills = [
|
|
331
|
+
...installedSkills.filter((s) => !s.excluded),
|
|
332
|
+
...globalInstallsHiddenHere(installedSkills, installedGlobal)
|
|
333
|
+
];
|
|
362
334
|
const oldAgents = (projectConfig?.agents ?? []).filter((a) => !a.excluded);
|
|
363
335
|
return {
|
|
364
336
|
selection: {
|
|
@@ -371,6 +343,14 @@ function activeEntriesOf(result, projectConfig) {
|
|
|
371
343
|
oldAgents
|
|
372
344
|
};
|
|
373
345
|
}
|
|
346
|
+
function globalInstallsHiddenHere(installedSkills, installedGlobal) {
|
|
347
|
+
if (installedGlobal === null) return [];
|
|
348
|
+
const activeIds = new Set(installedSkills.filter((s) => !s.excluded).map((s) => s.id));
|
|
349
|
+
const hiddenIds = new Set(
|
|
350
|
+
installedSkills.filter((s) => isGlobalTombstone(s) && !activeIds.has(s.id)).map((s) => s.id)
|
|
351
|
+
);
|
|
352
|
+
return installedGlobal.skills.filter((s) => hiddenIds.has(s.id) && isActiveAt(s, "global"));
|
|
353
|
+
}
|
|
374
354
|
function planChanges(selection, active, projectConfig, editRoot) {
|
|
375
355
|
const keptInstalled = globalHalvesKeptInstalled(selection.installedGlobal);
|
|
376
356
|
const changes = detectConfigChanges(active.oldConfig, active.selection, {
|
|
@@ -386,7 +366,7 @@ function planChanges(selection, active, projectConfig, editRoot) {
|
|
|
386
366
|
}
|
|
387
367
|
var Edit = class _Edit extends BaseCommand {
|
|
388
368
|
static summary = "Open this installation in the editor, or apply a configuration with --from";
|
|
389
|
-
static description =
|
|
369
|
+
static description = `Open this installation in ${EDITOR_ADDRESS}, or apply a configuration built there with --from`;
|
|
390
370
|
static examples = [
|
|
391
371
|
{
|
|
392
372
|
description: "Open this installation in the editor",
|
|
@@ -403,7 +383,7 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
403
383
|
];
|
|
404
384
|
static flags = {
|
|
405
385
|
ui: Flags.boolean({
|
|
406
|
-
description:
|
|
386
|
+
description: `Open ${EDITOR_ADDRESS} on this installation, or on the id --from names without applying it \u2014 what a bare edit does`,
|
|
407
387
|
default: false
|
|
408
388
|
}),
|
|
409
389
|
from: Flags.string({
|
|
@@ -446,13 +426,18 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
446
426
|
);
|
|
447
427
|
const selection = await this.selectionFromSharedConfig(id, payload, context, editRoot);
|
|
448
428
|
this.reportValidationErrors(selection.result.validation);
|
|
449
|
-
const active = activeEntriesOf(
|
|
429
|
+
const active = activeEntriesOf(
|
|
430
|
+
selection.result,
|
|
431
|
+
context.projectConfig,
|
|
432
|
+
selection.installedGlobal
|
|
433
|
+
);
|
|
450
434
|
const planned = planChanges(selection, active, context.projectConfig, editRoot);
|
|
451
435
|
const carriedToWrite = await carriedThatChange(selection.carried);
|
|
452
436
|
const changes = withRewrittenCarried(planned, carriedToWrite);
|
|
453
437
|
if (!hasAnyChanges(changes)) return this.sayNothingChanged(selection.kept);
|
|
454
|
-
|
|
455
|
-
await this.
|
|
438
|
+
this.refuseWithoutATerminal(id, namedProvider, editRoot);
|
|
439
|
+
const plan = await this.planToConfirm(changes, active, selection, context, editRoot);
|
|
440
|
+
await this.confirmSharedConfigOrCancel(plan);
|
|
456
441
|
await this.writeCarriedSkills(carriedToWrite);
|
|
457
442
|
await this.applyApprovedChanges(changes, active, selection.result, context, editRoot);
|
|
458
443
|
}
|
|
@@ -480,8 +465,8 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
480
465
|
const carried = this.registerExternalSkillsOrFail(payload, sourceMatrix, editRoot.dir);
|
|
481
466
|
const mapping = this.decodeSeedOrFail(payload, sourceMatrix);
|
|
482
467
|
const { result } = mapping;
|
|
483
|
-
this.refuseProjectScopedContentAtHome(result, editRoot.dir);
|
|
484
|
-
const reconciled = await this.reconcileWithInstallation(mapping,
|
|
468
|
+
this.refuseProjectScopedContentAtHome(result, editRoot.dir, true);
|
|
469
|
+
const reconciled = await this.reconcileWithInstallation(mapping, context, editRoot);
|
|
485
470
|
const installedGlobal = editRoot.isGlobal ? null : await readInstalledGlobal(editRoot.dir);
|
|
486
471
|
const held = restoreInstalledGlobal(reconciled.result, installedGlobal);
|
|
487
472
|
const arrivingCarried = notInstalledGlobally(carried, held);
|
|
@@ -493,26 +478,26 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
493
478
|
);
|
|
494
479
|
const revisedGlobally = await carriedSkillsThatDiffer(difference(carried, arrivingCarried));
|
|
495
480
|
sayCapturedWarnings(context.startupMessages);
|
|
496
|
-
this.warnOfSkippedEntries(mapping
|
|
481
|
+
this.warnOfSkippedEntries(mapping);
|
|
482
|
+
const runFromHome = {
|
|
483
|
+
id: installsAtHome(result) ? id : void 0,
|
|
484
|
+
provider: providerToNameAt(os.homedir(), providerInUse(editRoot.dir))
|
|
485
|
+
};
|
|
497
486
|
return {
|
|
498
487
|
result: held.result,
|
|
499
|
-
kept: keptOnApply(reconciled, held, revisedGlobally,
|
|
488
|
+
kept: keptOnApply(reconciled, held, revisedGlobally, runFromHome),
|
|
500
489
|
carried: arrivingCarried,
|
|
501
490
|
joinedGlobalAgents: held.joined.map(({ agentName }) => agentName),
|
|
502
491
|
installedGlobal
|
|
503
492
|
};
|
|
504
493
|
}
|
|
505
|
-
/**
|
|
506
|
-
|
|
507
|
-
* limit is not an instruction to delete.
|
|
508
|
-
*/
|
|
509
|
-
async reconcileWithInstallation({ result, skippedSkillIds }, payload, { projectConfig }, editRoot) {
|
|
510
|
-
const unplaceable = new Set(skippedSkillIds);
|
|
494
|
+
/** Ids the decode could not place stay: a catalogue limit is not an instruction to delete. */
|
|
495
|
+
async reconcileWithInstallation({ result, skippedSkillIds }, { projectConfig }, editRoot) {
|
|
511
496
|
return reconcileSharedConfig({
|
|
512
|
-
decoded:
|
|
497
|
+
decoded: result,
|
|
513
498
|
installed: projectConfig,
|
|
514
499
|
authoredHere: await this.readAuthoredHere(projectConfig, editRoot.dir),
|
|
515
|
-
unplaceable
|
|
500
|
+
unplaceable: new Set(skippedSkillIds)
|
|
516
501
|
});
|
|
517
502
|
}
|
|
518
503
|
/** Best-effort: an unreadable directory protects nothing and must not fail an apply. */
|
|
@@ -525,17 +510,11 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
525
510
|
return /* @__PURE__ */ new Set();
|
|
526
511
|
}
|
|
527
512
|
}
|
|
528
|
-
/**
|
|
529
|
-
* Refuses an empty directory, or a missing terminal, before spending a round trip: a destructive
|
|
530
|
-
* apply nobody can confirm must never become a yes.
|
|
531
|
-
*/
|
|
513
|
+
/** Refuses an empty directory before spending a round trip. */
|
|
532
514
|
async fetchSharedConfigOrFail(id, namedProvider) {
|
|
533
515
|
if (!await detectProject()) {
|
|
534
516
|
this.error(nothingInstalledToApplyTo(id, namedProvider), { exit: EXIT_CODES.ERROR });
|
|
535
517
|
}
|
|
536
|
-
if (!process.stdin.isTTY) {
|
|
537
|
-
this.error(sharedConfigNeedsTerminal(id, namedProvider), { exit: EXIT_CODES.ERROR });
|
|
538
|
-
}
|
|
539
518
|
this.log(`Fetching configuration ${id}...`);
|
|
540
519
|
const fetched = await fetchSeedConfig(id);
|
|
541
520
|
if (!fetched.ok) {
|
|
@@ -562,13 +541,36 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
562
541
|
await writeExternalSkills(carried);
|
|
563
542
|
this.log(carriedSkillsWritten(carried.map((skill) => skill.id)));
|
|
564
543
|
}
|
|
565
|
-
/**
|
|
566
|
-
|
|
544
|
+
/**
|
|
545
|
+
* A destructive apply nobody can confirm must never become a yes. Asked only of a run that changes
|
|
546
|
+
* something: one that changes nothing needs no one to confirm it.
|
|
547
|
+
*/
|
|
548
|
+
refuseWithoutATerminal(id, namedProvider, editRoot) {
|
|
549
|
+
if (process.stdin.isTTY) return;
|
|
550
|
+
const initProvider = namedProvider ?? initProviderToNameAt(editRoot.dir, providerInUse(editRoot.dir));
|
|
551
|
+
this.error(sharedConfigNeedsTerminal(id, namedProvider, initProvider), {
|
|
552
|
+
exit: EXIT_CODES.ERROR
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
/** The panel of what the run changes, then what it keeps and what else it recompiles. */
|
|
556
|
+
async planToConfirm(changes, active, selection, context, editRoot) {
|
|
557
|
+
const { projectConfig } = context;
|
|
558
|
+
const changedAgents = changedSubAgents(changes, selection, projectConfig);
|
|
567
559
|
const reachedProjects = await this.registeredProjectsStatement(changes, context, editRoot);
|
|
568
|
-
return
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
560
|
+
return {
|
|
561
|
+
panel: {
|
|
562
|
+
skillConfigs: selection.result.skills,
|
|
563
|
+
agentConfigs: selection.result.agentConfigs,
|
|
564
|
+
installedSkillConfigs: projectConfig?.skills ?? null,
|
|
565
|
+
installedAgentConfigs: projectConfig?.agents ?? null,
|
|
566
|
+
isInitMode: false,
|
|
567
|
+
overwrittenSkillIds: new Set(overwrittenSkillIds(changes, active)),
|
|
568
|
+
changedAgentNames: new Set(changedAgents.map(({ name }) => name)),
|
|
569
|
+
stackName: await this.stackNameOf(selection.result.selectedStackId, context.sourceResult)
|
|
570
|
+
},
|
|
571
|
+
changedAgents,
|
|
572
|
+
statements: [...selection.kept, ...reachedProjects]
|
|
573
|
+
};
|
|
572
574
|
}
|
|
573
575
|
/** Nothing to confirm; what the run keeps still says why nothing changed. */
|
|
574
576
|
sayNothingChanged(kept) {
|
|
@@ -587,25 +589,18 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
587
589
|
context.projectConfig?.projects ?? [],
|
|
588
590
|
providerInUse(editRoot.dir)
|
|
589
591
|
);
|
|
590
|
-
return reached.length === 0 ? [] : [
|
|
592
|
+
return reached.length === 0 ? [] : [registeredProjectsRecompiled(reached)];
|
|
591
593
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
594
|
+
async confirmSharedConfigOrCancel(plan) {
|
|
595
|
+
const lines = summaryPanelBlock(
|
|
596
|
+
plan.panel,
|
|
597
|
+
plan.changedAgents.map(subAgentChanged),
|
|
598
|
+
plan.statements
|
|
599
|
+
);
|
|
600
|
+
for (const line of lines) {
|
|
598
601
|
this.log(line);
|
|
599
602
|
}
|
|
600
|
-
const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx(
|
|
601
|
-
RemovalPlanConfirm,
|
|
602
|
-
{
|
|
603
|
-
...plan,
|
|
604
|
-
message: SHARED_CONFIG_APPLY.CONFIRM,
|
|
605
|
-
onConfirm,
|
|
606
|
-
onCancel
|
|
607
|
-
}
|
|
608
|
-
));
|
|
603
|
+
const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx(Confirm, { message: SHARED_CONFIG_APPLY.CONFIRM, onConfirm, onCancel }));
|
|
609
604
|
if (outcome === "confirmed") return;
|
|
610
605
|
this.log("\nEdit cancelled");
|
|
611
606
|
this.error("Cancelled", { exit: EXIT_CODES.CANCELLED });
|
|
@@ -615,13 +610,10 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
615
610
|
const [finding] = await unofferablePlacementsFound(cwd);
|
|
616
611
|
if (finding !== void 0) this.error(finding, { exit: EXIT_CODES.ERROR });
|
|
617
612
|
}
|
|
618
|
-
/**
|
|
619
|
-
* Mints through `seedPayloadForInstallation`, as `share` does, so one project has one id. Touches
|
|
620
|
-
* nothing on disk.
|
|
621
|
-
*/
|
|
613
|
+
/** Mints what `share` mints, marked when made in a project. Touches nothing on disk. */
|
|
622
614
|
async openInEditor(projectDir) {
|
|
623
615
|
await this.ensureInstalledSkillsReadable(projectDir);
|
|
624
|
-
const prepared = await
|
|
616
|
+
const prepared = await editorPayloadForInstallation(projectDir);
|
|
625
617
|
if (!prepared.ok) {
|
|
626
618
|
this.error(prepared.error, { exit: EXIT_CODES.ERROR });
|
|
627
619
|
}
|
|
@@ -646,11 +638,17 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
646
638
|
editorSkillMetadataUnusableError
|
|
647
639
|
);
|
|
648
640
|
}
|
|
649
|
-
/**
|
|
641
|
+
/**
|
|
642
|
+
* Opens an id rather than applying it; `--from` without `--ui` is the destructive apply. A named
|
|
643
|
+
* provider is committed first, as `init` does, so "installed here" means that installation.
|
|
644
|
+
*/
|
|
650
645
|
async openSharedInEditor(id, cwd, namedProvider) {
|
|
646
|
+
if (namedProvider !== void 0) chooseProviderForThisRun(namedProvider);
|
|
651
647
|
const url = editorConfigUrl(id);
|
|
648
|
+
const installedHere = await holdsItsOwnInstallation(cwd);
|
|
649
|
+
const provider = installedHere ? await installationToName(cwd, namedProvider) : namedProvider;
|
|
652
650
|
this.log(`Open it at ${url}`);
|
|
653
|
-
this.log(applySharedConfigHere(id,
|
|
651
|
+
this.log(applySharedConfigHere(id, installedHere, provider));
|
|
654
652
|
if (!process.stdin.isTTY) return;
|
|
655
653
|
const opened = await openUrl(url);
|
|
656
654
|
if (!opened.ok) this.warn(opened.error);
|