agents-inc 0.176.0 → 0.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/README.md +2 -2
- package/dist/{chunk-FACDJH6O.js → chunk-2FE4AJNC.js} +20 -26
- package/dist/chunk-2FE4AJNC.js.map +1 -0
- package/dist/{chunk-U46LYYRA.js → chunk-4SIBDIIO.js} +49 -13
- package/dist/chunk-4SIBDIIO.js.map +1 -0
- package/dist/chunk-5ZK4IND4.js +30 -0
- package/dist/chunk-5ZK4IND4.js.map +1 -0
- package/dist/{chunk-MQZNDK5F.js → chunk-77SHXTDD.js} +137 -56
- package/dist/chunk-77SHXTDD.js.map +1 -0
- package/dist/{chunk-U672FZVC.js → chunk-7OJ2SS4E.js} +10 -86
- package/dist/chunk-7OJ2SS4E.js.map +1 -0
- package/dist/{chunk-C2BSCEDN.js → chunk-7WN6TUZP.js} +7 -8
- package/dist/chunk-7WN6TUZP.js.map +1 -0
- package/dist/chunk-AVKX3IXF.js +117 -0
- package/dist/chunk-AVKX3IXF.js.map +1 -0
- package/dist/{chunk-ENET4IF6.js → chunk-D2PC7NIR.js} +1653 -1734
- package/dist/chunk-D2PC7NIR.js.map +1 -0
- package/dist/{chunk-JTMSFBCA.js → chunk-E6W3PYGF.js} +823 -72
- package/dist/chunk-E6W3PYGF.js.map +1 -0
- package/dist/chunk-H33ZAEKH.js +147 -0
- package/dist/chunk-H33ZAEKH.js.map +1 -0
- package/dist/{chunk-B7AVWSK2.js → chunk-JEFVFZAR.js} +39 -151
- package/dist/chunk-JEFVFZAR.js.map +1 -0
- package/dist/{chunk-UE4Z3YMB.js → chunk-KKGJH46C.js} +3 -21
- package/dist/chunk-KKGJH46C.js.map +1 -0
- package/dist/chunk-OIQKRXHH.js +142 -0
- package/dist/chunk-OIQKRXHH.js.map +1 -0
- package/dist/{chunk-CKBWEWHZ.js → chunk-TNN72UL6.js} +264 -247
- package/dist/chunk-TNN72UL6.js.map +1 -0
- package/dist/{chunk-XMQIWPIR.js → chunk-V3WJMNBF.js} +45 -18
- package/dist/chunk-V3WJMNBF.js.map +1 -0
- package/dist/chunk-VFD2XYM7.js +14 -0
- package/dist/chunk-VFD2XYM7.js.map +1 -0
- package/dist/{chunk-XYBHH3M5.js → chunk-WH7JXGDA.js} +2 -2
- package/dist/{chunk-JNRACLNS.js → chunk-XSR4WRXJ.js} +3 -3
- package/dist/{chunk-3F5LT433.js → chunk-Y5VMB73R.js} +202 -116
- package/dist/chunk-Y5VMB73R.js.map +1 -0
- package/dist/chunk-ZIBWVTLN.js +18 -0
- package/dist/chunk-ZIBWVTLN.js.map +1 -0
- package/dist/commands/build/marketplace.js +6 -10
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +10 -39
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/compile.js +60 -81
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +234 -145
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +64 -159
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +64 -54
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +19 -17
- package/dist/commands/list.js +10 -12
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +5 -5
- package/dist/commands/search.js +14 -13
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +21 -44
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +139 -56
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +22 -37
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/header-row.js +9 -0
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/common/skill-agent-summary.js +4 -4
- package/dist/components/common/summary-panel.js +6 -5
- package/dist/hooks/init.js +35 -22
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-OCFWOZD2.js +14 -0
- package/dist/{recompile-project-agents-U3UGHPWG.js → recompile-project-agents-CXZBPIUS.js} +9 -9
- package/dist/{recompile-project-agents-U3UGHPWG.js.map → recompile-project-agents-CXZBPIUS.js.map} +1 -1
- package/dist/{source-loader-E2Y5MMN5.js → source-loader-GGDQDMN4.js} +6 -4
- package/dist/source-loader-GGDQDMN4.js.map +1 -0
- package/package.json +1 -1
- package/src/schemas/stacks.schema.json +105 -1
- package/dist/chunk-3F5LT433.js.map +0 -1
- package/dist/chunk-5CFHP6Z5.js +0 -109
- package/dist/chunk-5CFHP6Z5.js.map +0 -1
- package/dist/chunk-B7AVWSK2.js.map +0 -1
- package/dist/chunk-C2BSCEDN.js.map +0 -1
- package/dist/chunk-CKBWEWHZ.js.map +0 -1
- package/dist/chunk-EC3JXT23.js +0 -160
- package/dist/chunk-EC3JXT23.js.map +0 -1
- package/dist/chunk-ENET4IF6.js.map +0 -1
- package/dist/chunk-FACDJH6O.js.map +0 -1
- package/dist/chunk-H6WUOW5F.js +0 -35
- package/dist/chunk-H6WUOW5F.js.map +0 -1
- package/dist/chunk-JTMSFBCA.js.map +0 -1
- package/dist/chunk-MQZNDK5F.js.map +0 -1
- package/dist/chunk-SN64WNWE.js +0 -428
- package/dist/chunk-SN64WNWE.js.map +0 -1
- package/dist/chunk-U46LYYRA.js.map +0 -1
- package/dist/chunk-U672FZVC.js.map +0 -1
- package/dist/chunk-UE4Z3YMB.js.map +0 -1
- package/dist/chunk-XMQIWPIR.js.map +0 -1
- package/dist/chunk-ZBI6GFJD.js +0 -39
- package/dist/chunk-ZBI6GFJD.js.map +0 -1
- package/dist/load-agent-defs-5BSECHE6.js +0 -14
- /package/dist/{chunk-XYBHH3M5.js.map → chunk-WH7JXGDA.js.map} +0 -0
- /package/dist/{chunk-JNRACLNS.js.map → chunk-XSR4WRXJ.js.map} +0 -0
- /package/dist/{load-agent-defs-5BSECHE6.js.map → components/common/header-row.js.map} +0 -0
- /package/dist/{source-loader-E2Y5MMN5.js.map → load-agent-defs-OCFWOZD2.js.map} +0 -0
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
compileAgents,
|
|
4
4
|
withCatalogueSeatedFor
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-V3WJMNBF.js";
|
|
6
6
|
import {
|
|
7
7
|
loadAgentDefs
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XSR4WRXJ.js";
|
|
9
|
+
import {
|
|
10
|
+
mapInTurn
|
|
11
|
+
} from "./chunk-VFD2XYM7.js";
|
|
9
12
|
import {
|
|
10
13
|
ConfigLoadError,
|
|
11
14
|
EXTRACTED_FIELDS,
|
|
@@ -20,6 +23,7 @@ import {
|
|
|
20
23
|
detectInstallation,
|
|
21
24
|
detectInstallations,
|
|
22
25
|
detectProjectInstallation,
|
|
26
|
+
directoryExists,
|
|
23
27
|
disableBuffering,
|
|
24
28
|
drainBuffer,
|
|
25
29
|
enableBuffering,
|
|
@@ -44,6 +48,7 @@ import {
|
|
|
44
48
|
quoteText,
|
|
45
49
|
readFile,
|
|
46
50
|
remove,
|
|
51
|
+
removeDirIfEmpty,
|
|
47
52
|
renderKey,
|
|
48
53
|
renderTypeImportLine,
|
|
49
54
|
renderUnionBody,
|
|
@@ -51,19 +56,17 @@ import {
|
|
|
51
56
|
sourceFolderInUse,
|
|
52
57
|
spaces,
|
|
53
58
|
splitConfigByScope,
|
|
54
|
-
|
|
55
|
-
typedKeys as typedKeys2,
|
|
59
|
+
toPosixPath,
|
|
56
60
|
unionLayout,
|
|
57
61
|
verbose,
|
|
58
62
|
warn,
|
|
59
63
|
withGateToken,
|
|
60
64
|
writeFile
|
|
61
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-D2PC7NIR.js";
|
|
62
66
|
import {
|
|
63
67
|
matrix,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} from "./chunk-UE4Z3YMB.js";
|
|
68
|
+
plural
|
|
69
|
+
} from "./chunk-KKGJH46C.js";
|
|
67
70
|
import {
|
|
68
71
|
CLI_INVOKE_COMMAND,
|
|
69
72
|
CODEX_MODEL_NAMES,
|
|
@@ -79,8 +82,11 @@ import {
|
|
|
79
82
|
isActiveAt,
|
|
80
83
|
isExclusiveCategory,
|
|
81
84
|
isGlobalTombstone,
|
|
82
|
-
skillDomain
|
|
83
|
-
|
|
85
|
+
skillDomain,
|
|
86
|
+
skillIdsByCategory,
|
|
87
|
+
typedEntries,
|
|
88
|
+
typedKeys
|
|
89
|
+
} from "./chunk-4SIBDIIO.js";
|
|
84
90
|
|
|
85
91
|
// src/cli/lib/operations/source/load-source.ts
|
|
86
92
|
async function loadSource(options) {
|
|
@@ -134,12 +140,151 @@ async function detectBothInstallations(projectDir) {
|
|
|
134
140
|
return { global, project, hasBoth: !!global && !!project };
|
|
135
141
|
}
|
|
136
142
|
|
|
143
|
+
// ../compile/src/global-config.ts
|
|
144
|
+
import { isDeepEqual } from "remeda";
|
|
145
|
+
function blankGlobalConfig() {
|
|
146
|
+
return {
|
|
147
|
+
name: GLOBAL_CONFIG_NAME,
|
|
148
|
+
skills: [],
|
|
149
|
+
agents: [],
|
|
150
|
+
selectedDomains: []
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function additiveMergeStack(existing, incoming) {
|
|
154
|
+
const merged = existing ? structuredClone(existing) : {};
|
|
155
|
+
if (!incoming) return { stack: merged, changed: false };
|
|
156
|
+
let changed = false;
|
|
157
|
+
for (const [agentName, incomingAgentStack] of typedEntries(incoming)) {
|
|
158
|
+
if (!incomingAgentStack) continue;
|
|
159
|
+
const existingAgentStack = merged[agentName];
|
|
160
|
+
if (!existingAgentStack) {
|
|
161
|
+
merged[agentName] = structuredClone(incomingAgentStack);
|
|
162
|
+
changed = true;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (mergeAgentCategories(existingAgentStack, incomingAgentStack)) {
|
|
166
|
+
changed = true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return { stack: merged, changed };
|
|
170
|
+
}
|
|
171
|
+
function mergeAgentCategories(existingAgentStack, incomingAgentStack) {
|
|
172
|
+
let changed = false;
|
|
173
|
+
for (const [category, incomingAssignments] of typedEntries(incomingAgentStack)) {
|
|
174
|
+
if (!incomingAssignments) continue;
|
|
175
|
+
const existingAssignments = existingAgentStack[category];
|
|
176
|
+
if (!existingAssignments) {
|
|
177
|
+
existingAgentStack[category] = incomingAssignments.map((a) => ({ ...a }));
|
|
178
|
+
changed = true;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (appendMissingAssignments(existingAssignments, incomingAssignments)) {
|
|
182
|
+
changed = true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return changed;
|
|
186
|
+
}
|
|
187
|
+
function appendMissingAssignments(existingAssignments, incomingAssignments) {
|
|
188
|
+
const existingIds = new Set(existingAssignments.map((a) => a.id));
|
|
189
|
+
let changed = false;
|
|
190
|
+
for (const assignment of incomingAssignments) {
|
|
191
|
+
if (existingIds.has(assignment.id)) continue;
|
|
192
|
+
existingAssignments.push({ ...assignment });
|
|
193
|
+
existingIds.add(assignment.id);
|
|
194
|
+
changed = true;
|
|
195
|
+
}
|
|
196
|
+
return changed;
|
|
197
|
+
}
|
|
198
|
+
function mergeGlobalConfigs(existing, incoming) {
|
|
199
|
+
const newSkills = activeEntriesNotIn(
|
|
200
|
+
incoming.skills,
|
|
201
|
+
existing.skills,
|
|
202
|
+
(s) => s.id
|
|
203
|
+
);
|
|
204
|
+
const newAgents = activeEntriesNotIn(
|
|
205
|
+
incoming.agents,
|
|
206
|
+
existing.agents,
|
|
207
|
+
(a) => a.name
|
|
208
|
+
);
|
|
209
|
+
const mergedSkills = [...existing.skills, ...newSkills];
|
|
210
|
+
const mergedAgents = [...existing.agents, ...newAgents];
|
|
211
|
+
const { stack: mergedStack, changed: stackChanged } = additiveMergeStack(
|
|
212
|
+
existing.stack,
|
|
213
|
+
incoming.stack
|
|
214
|
+
);
|
|
215
|
+
const mergedSelectedDomains = [
|
|
216
|
+
.../* @__PURE__ */ new Set([
|
|
217
|
+
...existing.selectedDomains ?? [],
|
|
218
|
+
...incoming.selectedDomains ?? []
|
|
219
|
+
])
|
|
220
|
+
];
|
|
221
|
+
const addsEntries = newSkills.length > 0 || newAgents.length > 0;
|
|
222
|
+
const changed = addsEntries || stackChanged || !isDeepEqual(existing.selectedDomains ?? [], mergedSelectedDomains);
|
|
223
|
+
return {
|
|
224
|
+
config: {
|
|
225
|
+
...existing,
|
|
226
|
+
skills: mergedSkills,
|
|
227
|
+
agents: mergedAgents,
|
|
228
|
+
stack: mergedStack,
|
|
229
|
+
selectedDomains: mergedSelectedDomains,
|
|
230
|
+
...marketplaceIdentityFilledFrom(existing, addsEntries ? incoming : null)
|
|
231
|
+
},
|
|
232
|
+
changed
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function activeEntriesNotIn(incoming, existing, keyOf) {
|
|
236
|
+
const held = new Set(existing.map(keyOf));
|
|
237
|
+
return incoming.filter((entry) => !entry.excluded && !held.has(keyOf(entry)));
|
|
238
|
+
}
|
|
239
|
+
function marketplaceIdentityFilledFrom(existing, arriving) {
|
|
240
|
+
const fillsFromArriving = arriving !== null && existing.marketplace === void 0;
|
|
241
|
+
const { marketplace, marketplaceName } = fillsFromArriving ? arriving : existing;
|
|
242
|
+
return {
|
|
243
|
+
...marketplaceName !== void 0 && { marketplaceName },
|
|
244
|
+
...marketplace !== void 0 && { marketplace }
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function addSessionToGlobal(globalSplit, existingGlobalConfig, catalog) {
|
|
248
|
+
const hasGlobalItems = globalSplit.skills.length > 0 || globalSplit.agents.length > 0;
|
|
249
|
+
if (!hasGlobalItems) {
|
|
250
|
+
return {
|
|
251
|
+
config: existingGlobalConfig ?? {
|
|
252
|
+
name: GLOBAL_CONFIG_NAME,
|
|
253
|
+
skills: [],
|
|
254
|
+
agents: []
|
|
255
|
+
},
|
|
256
|
+
changed: false
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const arriving = withTheDomainsItAdds(
|
|
260
|
+
globalSplit,
|
|
261
|
+
existingGlobalConfig,
|
|
262
|
+
catalog
|
|
263
|
+
);
|
|
264
|
+
if (!existingGlobalConfig) return { config: arriving, changed: true };
|
|
265
|
+
return mergeGlobalConfigs(existingGlobalConfig, arriving);
|
|
266
|
+
}
|
|
267
|
+
function withTheDomainsItAdds(globalSplit, existingGlobalConfig, catalog) {
|
|
268
|
+
const installed = new Set(
|
|
269
|
+
existingGlobalConfig?.skills.map((skill) => skill.id)
|
|
270
|
+
);
|
|
271
|
+
const arrivingDomains = new Set(
|
|
272
|
+
globalSplit.skills.filter((skill) => !skill.excluded && !installed.has(skill.id)).map((skill) => skillDomain(catalog, skill.id))
|
|
273
|
+
);
|
|
274
|
+
return {
|
|
275
|
+
...globalSplit,
|
|
276
|
+
selectedDomains: (globalSplit.selectedDomains ?? []).filter(
|
|
277
|
+
(domain) => arrivingDomains.has(domain)
|
|
278
|
+
)
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
137
282
|
// src/cli/lib/config-gate/propagate.ts
|
|
138
283
|
import fs from "fs";
|
|
139
284
|
import { isDeepEqual as isDeepEqual2, unique as unique2 } from "remeda";
|
|
140
285
|
|
|
141
286
|
// ../compile/src/config-types-source.ts
|
|
142
|
-
import {
|
|
287
|
+
import { unique } from "remeda";
|
|
143
288
|
var EMPTY_UNION_TYPE = "never";
|
|
144
289
|
function formatLiteralUnion(members) {
|
|
145
290
|
return flatUnion(members.map(quoteText));
|
|
@@ -312,15 +457,14 @@ function renderStackProperty(category, skills, catalog) {
|
|
|
312
457
|
}
|
|
313
458
|
function buildSkillsByCategory(skillIds, categories, catalog) {
|
|
314
459
|
const categorySet = new Set(categories);
|
|
315
|
-
const eligible = [...new Set(skillIds)].map((
|
|
460
|
+
const eligible = [...new Set(skillIds)].map((skillId) => ({
|
|
461
|
+
skillId,
|
|
462
|
+
category: catalog.skills[skillId]?.category
|
|
463
|
+
})).filter(
|
|
316
464
|
(entry) => entry.category !== void 0 && entry.category !== LOCAL_PSEUDO_CATEGORY && // Boundary cast: `string` on the narrow catalogue shape; `has` is the runtime check.
|
|
317
465
|
categorySet.has(entry.category)
|
|
318
466
|
);
|
|
319
|
-
return
|
|
320
|
-
typedEntries2(groupBy(eligible, (entry) => entry.category)).map(
|
|
321
|
-
([category, entries]) => [category, entries.map((entry) => entry.id)]
|
|
322
|
-
)
|
|
323
|
-
);
|
|
467
|
+
return skillIdsByCategory(eligible);
|
|
324
468
|
}
|
|
325
469
|
function isUndeclaredCategory(category, catalog) {
|
|
326
470
|
return catalog.categories[category] === void 0;
|
|
@@ -332,9 +476,6 @@ function isCustomSkill(skillId, catalog) {
|
|
|
332
476
|
function isCustomAgent(agentName, declared, flaggedCustom) {
|
|
333
477
|
return !declared.has(agentName) || flaggedCustom.has(agentName);
|
|
334
478
|
}
|
|
335
|
-
function isCustomDomain(domain, declared) {
|
|
336
|
-
return !declared.has(domain);
|
|
337
|
-
}
|
|
338
479
|
function generateConfigTypesSource(catalog, agentNames, customAgentNames = [], extras, config) {
|
|
339
480
|
const extra = extraMembers(extras);
|
|
340
481
|
const { skillIds, agents, domains, categories } = config ? configMembers(config, extra, catalog) : catalogueMembers(agentNames, extra, catalog);
|
|
@@ -351,7 +492,7 @@ function generateConfigTypesSource(catalog, agentNames, customAgentNames = [], e
|
|
|
351
492
|
);
|
|
352
493
|
const domainLine = formatMaybeSectionedUnion(
|
|
353
494
|
domains,
|
|
354
|
-
(domain) =>
|
|
495
|
+
(domain) => !declaredDomains.has(domain)
|
|
355
496
|
);
|
|
356
497
|
const categoryLine = formatMaybeSectionedUnion(
|
|
357
498
|
categories,
|
|
@@ -412,11 +553,11 @@ function configMembers(config, extra, catalog) {
|
|
|
412
553
|
}
|
|
413
554
|
function catalogueMembers(agentNames, extra, catalog) {
|
|
414
555
|
return {
|
|
415
|
-
skillIds: sortedUnion(
|
|
556
|
+
skillIds: sortedUnion(typedKeys(catalog.skills), extra.skillIds),
|
|
416
557
|
agents: sortedUnion(agentNames, extra.agents),
|
|
417
558
|
domains: sortedUnion(extractDomains(catalog), extra.domains),
|
|
418
559
|
categories: sortedUnion(
|
|
419
|
-
|
|
560
|
+
typedKeys(catalog.categories),
|
|
420
561
|
extra.categories
|
|
421
562
|
)
|
|
422
563
|
};
|
|
@@ -428,7 +569,7 @@ function narrowedUnion(members, fallback) {
|
|
|
428
569
|
return members.length > 0 ? literalUnion(members) : typeReference(fallback);
|
|
429
570
|
}
|
|
430
571
|
function extractDomains(catalog) {
|
|
431
|
-
return deriveDomains(
|
|
572
|
+
return deriveDomains(typedKeys(catalog.categories), catalog).sort();
|
|
432
573
|
}
|
|
433
574
|
var isNonLocalCategory = (category) => Boolean(category) && category !== LOCAL_PSEUDO_CATEGORY;
|
|
434
575
|
function deriveCategories(skillIds, catalog) {
|
|
@@ -538,8 +679,7 @@ async function getGlobalConfigTypesPath(provider) {
|
|
|
538
679
|
function computeGlobalTypesImportPath(projectDir, provider) {
|
|
539
680
|
const projectSourceDir = sourceFolderInUse(projectDir, provider).dir;
|
|
540
681
|
const globalSourceDir = sourceFolderInUse(globalInstallRoot(), provider).dir;
|
|
541
|
-
|
|
542
|
-
return relativePath.split(path.sep).join("/");
|
|
682
|
+
return toPosixPath(path.relative(projectSourceDir, globalSourceDir));
|
|
543
683
|
}
|
|
544
684
|
function buildConfigTypesBackgroundData(matrix2, agents) {
|
|
545
685
|
const agentNames = typedKeys(agents);
|
|
@@ -587,137 +727,6 @@ function renderTypesExtendingGlobal(projectDir, provider, agents, extras) {
|
|
|
587
727
|
return source;
|
|
588
728
|
}
|
|
589
729
|
|
|
590
|
-
// ../compile/src/global-config.ts
|
|
591
|
-
import { isDeepEqual } from "remeda";
|
|
592
|
-
function additiveMergeStack(existing, incoming) {
|
|
593
|
-
const merged = existing ? structuredClone(existing) : {};
|
|
594
|
-
if (!incoming) return { stack: merged, changed: false };
|
|
595
|
-
let changed = false;
|
|
596
|
-
for (const [agentName, incomingAgentStack] of typedEntries2(incoming)) {
|
|
597
|
-
if (!incomingAgentStack) continue;
|
|
598
|
-
const existingAgentStack = merged[agentName];
|
|
599
|
-
if (!existingAgentStack) {
|
|
600
|
-
merged[agentName] = structuredClone(incomingAgentStack);
|
|
601
|
-
changed = true;
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
if (mergeAgentCategories(existingAgentStack, incomingAgentStack)) {
|
|
605
|
-
changed = true;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
return { stack: merged, changed };
|
|
609
|
-
}
|
|
610
|
-
function mergeAgentCategories(existingAgentStack, incomingAgentStack) {
|
|
611
|
-
let changed = false;
|
|
612
|
-
for (const [category, incomingAssignments] of typedEntries2(incomingAgentStack)) {
|
|
613
|
-
if (!incomingAssignments) continue;
|
|
614
|
-
const existingAssignments = existingAgentStack[category];
|
|
615
|
-
if (!existingAssignments) {
|
|
616
|
-
existingAgentStack[category] = incomingAssignments.map((a) => ({ ...a }));
|
|
617
|
-
changed = true;
|
|
618
|
-
continue;
|
|
619
|
-
}
|
|
620
|
-
if (appendMissingAssignments(existingAssignments, incomingAssignments)) {
|
|
621
|
-
changed = true;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
return changed;
|
|
625
|
-
}
|
|
626
|
-
function appendMissingAssignments(existingAssignments, incomingAssignments) {
|
|
627
|
-
const existingIds = new Set(existingAssignments.map((a) => a.id));
|
|
628
|
-
let changed = false;
|
|
629
|
-
for (const assignment of incomingAssignments) {
|
|
630
|
-
if (existingIds.has(assignment.id)) continue;
|
|
631
|
-
existingAssignments.push({ ...assignment });
|
|
632
|
-
existingIds.add(assignment.id);
|
|
633
|
-
changed = true;
|
|
634
|
-
}
|
|
635
|
-
return changed;
|
|
636
|
-
}
|
|
637
|
-
function mergeGlobalConfigs(existing, incoming) {
|
|
638
|
-
const newSkills = activeEntriesNotIn(
|
|
639
|
-
incoming.skills,
|
|
640
|
-
existing.skills,
|
|
641
|
-
(s) => s.id
|
|
642
|
-
);
|
|
643
|
-
const newAgents = activeEntriesNotIn(
|
|
644
|
-
incoming.agents,
|
|
645
|
-
existing.agents,
|
|
646
|
-
(a) => a.name
|
|
647
|
-
);
|
|
648
|
-
const mergedSkills = [...existing.skills, ...newSkills];
|
|
649
|
-
const mergedAgents = [...existing.agents, ...newAgents];
|
|
650
|
-
const { stack: mergedStack, changed: stackChanged } = additiveMergeStack(
|
|
651
|
-
existing.stack,
|
|
652
|
-
incoming.stack
|
|
653
|
-
);
|
|
654
|
-
const mergedSelectedDomains = [
|
|
655
|
-
.../* @__PURE__ */ new Set([
|
|
656
|
-
...existing.selectedDomains ?? [],
|
|
657
|
-
...incoming.selectedDomains ?? []
|
|
658
|
-
])
|
|
659
|
-
];
|
|
660
|
-
const addsEntries = newSkills.length > 0 || newAgents.length > 0;
|
|
661
|
-
const changed = addsEntries || stackChanged || !isDeepEqual(existing.selectedDomains ?? [], mergedSelectedDomains);
|
|
662
|
-
return {
|
|
663
|
-
config: {
|
|
664
|
-
...existing,
|
|
665
|
-
skills: mergedSkills,
|
|
666
|
-
agents: mergedAgents,
|
|
667
|
-
stack: mergedStack,
|
|
668
|
-
selectedDomains: mergedSelectedDomains,
|
|
669
|
-
...marketplaceIdentityFilledFrom(existing, addsEntries ? incoming : null)
|
|
670
|
-
},
|
|
671
|
-
changed
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
function activeEntriesNotIn(incoming, existing, keyOf) {
|
|
675
|
-
const held = new Set(existing.map(keyOf));
|
|
676
|
-
return incoming.filter((entry) => !entry.excluded && !held.has(keyOf(entry)));
|
|
677
|
-
}
|
|
678
|
-
function marketplaceIdentityFilledFrom(existing, arriving) {
|
|
679
|
-
const fillsFromArriving = arriving !== null && existing.marketplace === void 0;
|
|
680
|
-
const { marketplace, marketplaceName } = fillsFromArriving ? arriving : existing;
|
|
681
|
-
return {
|
|
682
|
-
...marketplaceName !== void 0 && { marketplaceName },
|
|
683
|
-
...marketplace !== void 0 && { marketplace }
|
|
684
|
-
};
|
|
685
|
-
}
|
|
686
|
-
function addSessionToGlobal(globalSplit, existingGlobalConfig, catalog) {
|
|
687
|
-
const hasGlobalItems = globalSplit.skills.length > 0 || globalSplit.agents.length > 0;
|
|
688
|
-
if (!hasGlobalItems) {
|
|
689
|
-
return {
|
|
690
|
-
config: existingGlobalConfig ?? {
|
|
691
|
-
name: GLOBAL_CONFIG_NAME,
|
|
692
|
-
skills: [],
|
|
693
|
-
agents: []
|
|
694
|
-
},
|
|
695
|
-
changed: false
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
const arriving = withTheDomainsItAdds(
|
|
699
|
-
globalSplit,
|
|
700
|
-
existingGlobalConfig,
|
|
701
|
-
catalog
|
|
702
|
-
);
|
|
703
|
-
if (!existingGlobalConfig) return { config: arriving, changed: true };
|
|
704
|
-
return mergeGlobalConfigs(existingGlobalConfig, arriving);
|
|
705
|
-
}
|
|
706
|
-
function withTheDomainsItAdds(globalSplit, existingGlobalConfig, catalog) {
|
|
707
|
-
const installed = new Set(
|
|
708
|
-
existingGlobalConfig?.skills.map((skill) => skill.id)
|
|
709
|
-
);
|
|
710
|
-
const arrivingDomains = new Set(
|
|
711
|
-
globalSplit.skills.filter((skill) => !skill.excluded && !installed.has(skill.id)).map((skill) => skillDomain(catalog, skill.id))
|
|
712
|
-
);
|
|
713
|
-
return {
|
|
714
|
-
...globalSplit,
|
|
715
|
-
selectedDomains: (globalSplit.selectedDomains ?? []).filter(
|
|
716
|
-
(domain) => arrivingDomains.has(domain)
|
|
717
|
-
)
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
|
|
721
730
|
// src/cli/lib/config-gate/propagate.ts
|
|
722
731
|
async function writeConfigFile(config, configPath, options) {
|
|
723
732
|
const source = generateConfigSource(config, matrix, options);
|
|
@@ -763,9 +772,6 @@ function categoryOfSkill(id, matrix2) {
|
|
|
763
772
|
if (category === void 0 || category === LOCAL_PSEUDO_CATEGORY) return void 0;
|
|
764
773
|
return category;
|
|
765
774
|
}
|
|
766
|
-
function isExclusiveCategory2(category, matrix2) {
|
|
767
|
-
return matrix2.categories[category]?.exclusive === true;
|
|
768
|
-
}
|
|
769
775
|
function activeProjectCategories(projectOwnedSkills, matrix2) {
|
|
770
776
|
return new Set(
|
|
771
777
|
projectOwnedSkills.filter((s) => isActiveAt(s, "project")).map((s) => categoryOfSkill(s.id, matrix2)).filter((category) => category !== void 0)
|
|
@@ -777,7 +783,7 @@ function buildProjectCollisionTest(projectOwnedSkills, matrix2) {
|
|
|
777
783
|
);
|
|
778
784
|
const occupiedExclusiveCategories = new Set(
|
|
779
785
|
[...activeProjectCategories(projectOwnedSkills, matrix2)].filter(
|
|
780
|
-
(category) =>
|
|
786
|
+
(category) => isExclusiveCategory(matrix2, category)
|
|
781
787
|
)
|
|
782
788
|
);
|
|
783
789
|
return (id) => {
|
|
@@ -928,17 +934,9 @@ async function propagateToProject(projectPath, provider, globalConfig, agents, o
|
|
|
928
934
|
}
|
|
929
935
|
async function propagateGlobalChangesToProjects(globalConfig, agents, provider, currentProjectDir, options = {}) {
|
|
930
936
|
const projects = globalConfig.projects ?? [];
|
|
931
|
-
const result =
|
|
932
|
-
updated: [],
|
|
933
|
-
unreadable: [],
|
|
934
|
-
gone: [],
|
|
935
|
-
notOurs: [],
|
|
936
|
-
failed: []
|
|
937
|
-
};
|
|
937
|
+
const result = nothingPropagated();
|
|
938
938
|
if (projects.length === 0) return result;
|
|
939
|
-
const
|
|
940
|
-
for (const projectPath of projects) {
|
|
941
|
-
if (currentNormalized && projectPath === currentNormalized) continue;
|
|
939
|
+
for (const projectPath of projectsBesides(projects, currentProjectDir)) {
|
|
942
940
|
const outcome = await propagateToRegisteredProject(
|
|
943
941
|
projectPath,
|
|
944
942
|
provider,
|
|
@@ -950,6 +948,14 @@ async function propagateGlobalChangesToProjects(globalConfig, agents, provider,
|
|
|
950
948
|
}
|
|
951
949
|
return result;
|
|
952
950
|
}
|
|
951
|
+
function nothingPropagated() {
|
|
952
|
+
return { updated: [], unreadable: [], gone: [], notOurs: [], failed: [] };
|
|
953
|
+
}
|
|
954
|
+
function projectsBesides(projects, currentProjectDir) {
|
|
955
|
+
if (!currentProjectDir) return projects;
|
|
956
|
+
const current = normalizeProjectPath(currentProjectDir);
|
|
957
|
+
return projects.filter((projectPath) => projectPath !== current);
|
|
958
|
+
}
|
|
953
959
|
async function propagateToRegisteredProject(projectPath, provider, globalConfig, agents, options) {
|
|
954
960
|
const installed = await providersInstalledAt(projectPath);
|
|
955
961
|
if (installed.length === 0) {
|
|
@@ -1048,15 +1054,17 @@ import os2 from "os";
|
|
|
1048
1054
|
import path3 from "path";
|
|
1049
1055
|
|
|
1050
1056
|
// src/cli/lib/config-gate/classify.ts
|
|
1051
|
-
import { isDeepEqual as isDeepEqual3 } from "remeda";
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1057
|
+
import { isDeepEqual as isDeepEqual3, partition } from "remeda";
|
|
1058
|
+
function noChanges() {
|
|
1059
|
+
return {
|
|
1060
|
+
skills: { added: [], removed: [], sourceChanged: [], otherChanged: [] },
|
|
1061
|
+
agents: { added: [], removed: [], changed: [] },
|
|
1062
|
+
stackChanged: false,
|
|
1063
|
+
selectedDomainsChanged: false,
|
|
1064
|
+
scalarsChanged: [],
|
|
1065
|
+
projectsChanged: false
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1060
1068
|
var extractedFields = new Set(EXTRACTED_FIELDS);
|
|
1061
1069
|
var REGISTRATION_FIELD = "projects";
|
|
1062
1070
|
var EMPTY_MEANS_ABSENT = /* @__PURE__ */ new Set([
|
|
@@ -1093,17 +1101,16 @@ function scalarKeys(prev, next) {
|
|
|
1093
1101
|
function diffSkills(prev, next) {
|
|
1094
1102
|
const before = skillsById(prev);
|
|
1095
1103
|
const after = skillsById(next);
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
return { added, removed, sourceChanged, otherChanged };
|
|
1104
|
+
const [originMoved, otherwiseChanged] = partition(changedEntries(before, after), movedOrigin);
|
|
1105
|
+
return {
|
|
1106
|
+
added: [...after.keys()].filter((id) => !before.has(id)),
|
|
1107
|
+
removed: [...before.keys()].filter((id) => !after.has(id)),
|
|
1108
|
+
sourceChanged: originMoved.map(({ key }) => key),
|
|
1109
|
+
otherChanged: otherwiseChanged.map(({ key }) => key)
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
function movedOrigin({ before, after }) {
|
|
1113
|
+
return before.origin !== after.origin;
|
|
1107
1114
|
}
|
|
1108
1115
|
function diffAgents(prev, next) {
|
|
1109
1116
|
const before = agentsByName(prev);
|
|
@@ -1111,12 +1118,16 @@ function diffAgents(prev, next) {
|
|
|
1111
1118
|
return {
|
|
1112
1119
|
added: [...after.keys()].filter((name) => !before.has(name)),
|
|
1113
1120
|
removed: [...before.keys()].filter((name) => !after.has(name)),
|
|
1114
|
-
changed:
|
|
1115
|
-
const beforeEntry = before.get(name);
|
|
1116
|
-
return beforeEntry !== void 0 && !isDeepEqual3(beforeEntry, after.get(name));
|
|
1117
|
-
})
|
|
1121
|
+
changed: changedEntries(before, after).map(({ key }) => key)
|
|
1118
1122
|
};
|
|
1119
1123
|
}
|
|
1124
|
+
function changedEntries(before, after) {
|
|
1125
|
+
return [...after].flatMap(([key, afterEntry]) => {
|
|
1126
|
+
const beforeEntry = before.get(key);
|
|
1127
|
+
if (beforeEntry === void 0 || isDeepEqual3(beforeEntry, afterEntry)) return [];
|
|
1128
|
+
return [{ key, before: beforeEntry, after: afterEntry }];
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1120
1131
|
function classifyGlobalChange(prev, next) {
|
|
1121
1132
|
const before = prev ? normalize(prev) : {};
|
|
1122
1133
|
const after = normalize(next);
|
|
@@ -1231,15 +1242,12 @@ async function ensureBlankPair(provider) {
|
|
|
1231
1242
|
}
|
|
1232
1243
|
|
|
1233
1244
|
// src/cli/lib/config-gate/recompile.ts
|
|
1234
|
-
|
|
1235
|
-
rewrittenCount: 0,
|
|
1236
|
-
|
|
1237
|
-
failedCount: 0,
|
|
1238
|
-
warnings: []
|
|
1239
|
-
};
|
|
1245
|
+
function nothingRecompiled() {
|
|
1246
|
+
return { rewrittenCount: 0, unchangedCount: 0, failedCount: 0, warnings: [] };
|
|
1247
|
+
}
|
|
1240
1248
|
async function recompilePropagated(projectDirs, pairsRewritten) {
|
|
1241
|
-
if (projectDirs.length === 0) return
|
|
1242
|
-
const { recompilePropagatedProjectAgents } = await import("./recompile-project-agents-
|
|
1249
|
+
if (projectDirs.length === 0) return nothingRecompiled();
|
|
1250
|
+
const { recompilePropagatedProjectAgents } = await import("./recompile-project-agents-CXZBPIUS.js");
|
|
1243
1251
|
return recompilePropagatedProjectAgents(projectDirs, pairsRewritten);
|
|
1244
1252
|
}
|
|
1245
1253
|
function pairRewriteSummary(projectDirs, pairsRewritten) {
|
|
@@ -1304,17 +1312,10 @@ function samePair([config, types], [configNow, typesNow]) {
|
|
|
1304
1312
|
}
|
|
1305
1313
|
|
|
1306
1314
|
// src/cli/lib/config-gate/index.ts
|
|
1307
|
-
var NOTHING_PROPAGATED = {
|
|
1308
|
-
updated: [],
|
|
1309
|
-
unreadable: [],
|
|
1310
|
-
gone: [],
|
|
1311
|
-
notOurs: [],
|
|
1312
|
-
failed: []
|
|
1313
|
-
};
|
|
1314
1315
|
function movedGlobalAgentInputs(written) {
|
|
1315
1316
|
return tierRegeneratesTypes(consequenceTier(written.changes));
|
|
1316
1317
|
}
|
|
1317
|
-
function report(globalWritten, changes, propagated =
|
|
1318
|
+
function report(globalWritten, changes, propagated = nothingPropagated(), recompile = nothingRecompiled()) {
|
|
1318
1319
|
return { globalWritten, changes, propagated, recompile };
|
|
1319
1320
|
}
|
|
1320
1321
|
async function fanOut(projects, provider, propagate, recompiles) {
|
|
@@ -1326,14 +1327,14 @@ async function fanOut(projects, provider, propagate, recompiles) {
|
|
|
1326
1327
|
}
|
|
1327
1328
|
function sayPropagated(propagated) {
|
|
1328
1329
|
if (propagated.updated.length > 0) {
|
|
1329
|
-
verbose(`Propagated global changes to ${propagated.updated.length
|
|
1330
|
+
verbose(`Propagated global changes to ${plural(propagated.updated.length, "project")}`);
|
|
1330
1331
|
}
|
|
1331
1332
|
}
|
|
1332
1333
|
async function applyConsequences(globalConfig, changes, deps, provider, currentProjectDir) {
|
|
1333
1334
|
const tier = consequenceTier(changes);
|
|
1334
1335
|
const projects = globalConfig.projects ?? [];
|
|
1335
1336
|
if (!tierPropagates(tier) || projects.length === 0) {
|
|
1336
|
-
return { propagated:
|
|
1337
|
+
return { propagated: nothingPropagated(), recompile: nothingRecompiled() };
|
|
1337
1338
|
}
|
|
1338
1339
|
const regenerateTypes = tierRegeneratesTypes(tier);
|
|
1339
1340
|
const reached = await fanOut(
|
|
@@ -1350,7 +1351,7 @@ async function applyConsequences(globalConfig, changes, deps, provider, currentP
|
|
|
1350
1351
|
function lazyGateDeps(projectDir) {
|
|
1351
1352
|
return {
|
|
1352
1353
|
loadMatrix: async () => {
|
|
1353
|
-
const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-
|
|
1354
|
+
const { loadSkillsMatrixFromSource: loadSkillsMatrixFromSource2 } = await import("./source-loader-GGDQDMN4.js");
|
|
1354
1355
|
const { matrix: matrix2 } = await loadSkillsMatrixFromSource2({
|
|
1355
1356
|
projectDir,
|
|
1356
1357
|
skipExtraSources: true,
|
|
@@ -1359,7 +1360,7 @@ function lazyGateDeps(projectDir) {
|
|
|
1359
1360
|
return matrix2;
|
|
1360
1361
|
},
|
|
1361
1362
|
loadAgents: async () => {
|
|
1362
|
-
const { loadAgentDefs: loadAgentDefs2 } = await import("./load-agent-defs-
|
|
1363
|
+
const { loadAgentDefs: loadAgentDefs2 } = await import("./load-agent-defs-OCFWOZD2.js");
|
|
1363
1364
|
return (await loadAgentDefs2()).agents;
|
|
1364
1365
|
}
|
|
1365
1366
|
};
|
|
@@ -1386,59 +1387,73 @@ async function writeFromHome(args, homeDir, deps) {
|
|
|
1386
1387
|
return report(globalWritten, changes, propagated, recompile);
|
|
1387
1388
|
}
|
|
1388
1389
|
async function writeFromProjectContext(args, homeDir, deps) {
|
|
1389
|
-
const {
|
|
1390
|
-
const { global: globalConfig, project: projectSplitConfig } = splitConfigByScope(finalConfig);
|
|
1390
|
+
const { projectDir } = args;
|
|
1391
1391
|
const provider = providerInUse(projectDir);
|
|
1392
|
-
const
|
|
1392
|
+
const written = await restoringThePairsOnFailure(
|
|
1393
|
+
[projectDir, homeDir],
|
|
1394
|
+
provider,
|
|
1395
|
+
() => writeBothPairs(args, homeDir, provider, deps)
|
|
1396
|
+
);
|
|
1397
|
+
const { propagated, recompile } = await applyConsequences(
|
|
1398
|
+
written.effectiveGlobalConfig,
|
|
1399
|
+
written.changes,
|
|
1400
|
+
deps,
|
|
1401
|
+
provider,
|
|
1402
|
+
projectDir
|
|
1403
|
+
);
|
|
1404
|
+
return report(written.globalWritten, written.changes, propagated, recompile);
|
|
1405
|
+
}
|
|
1406
|
+
async function writeBothPairs(args, homeDir, provider, deps) {
|
|
1407
|
+
const { global: globalConfig, project: projectSplitConfig } = splitConfigByScope(
|
|
1408
|
+
args.finalConfig
|
|
1409
|
+
);
|
|
1393
1410
|
await ensureBlankPair(provider);
|
|
1394
1411
|
const existingGlobal = await loadProjectConfigFromDir(homeDir, provider);
|
|
1395
1412
|
const effective = await resolveEffectiveGlobalConfig(
|
|
1396
1413
|
globalConfig,
|
|
1397
1414
|
existingGlobal?.config,
|
|
1398
|
-
projectDir,
|
|
1415
|
+
args.projectDir,
|
|
1399
1416
|
args.authoritativeScope
|
|
1400
1417
|
);
|
|
1401
|
-
const
|
|
1402
|
-
const changes = classifyGlobalChange(existingGlobal?.config, effectiveGlobalConfig);
|
|
1418
|
+
const changes = classifyGlobalChange(existingGlobal?.config, effective.config);
|
|
1403
1419
|
const reconciledProjectConfig = reconcileProjectSplitAgainstGlobal(
|
|
1404
1420
|
projectSplitConfig,
|
|
1405
|
-
|
|
1421
|
+
effective.config,
|
|
1406
1422
|
deps.matrix
|
|
1407
1423
|
);
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
args,
|
|
1414
|
-
provider,
|
|
1415
|
-
reconciledProjectConfig,
|
|
1416
|
-
effectiveGlobalConfig,
|
|
1417
|
-
deps
|
|
1418
|
-
);
|
|
1419
|
-
return writeGlobalPairWhenChanged(effective, globalConfigPath, deps);
|
|
1420
|
-
}
|
|
1424
|
+
await writeProjectPairWhenOwed(args, provider, reconciledProjectConfig, effective.config, deps);
|
|
1425
|
+
const globalWritten = await writeGlobalPairWhenChanged(
|
|
1426
|
+
effective,
|
|
1427
|
+
getProjectConfigPath(homeDir, provider),
|
|
1428
|
+
deps
|
|
1421
1429
|
);
|
|
1422
|
-
|
|
1423
|
-
effectiveGlobalConfig,
|
|
1424
|
-
changes,
|
|
1425
|
-
deps,
|
|
1426
|
-
provider,
|
|
1427
|
-
projectDir
|
|
1428
|
-
);
|
|
1429
|
-
return report(globalWritten, changes, propagated, recompile);
|
|
1430
|
+
return { globalWritten, changes, effectiveGlobalConfig: effective.config };
|
|
1430
1431
|
}
|
|
1431
1432
|
async function restoringThePairsOnFailure(dirs, provider, write) {
|
|
1432
1433
|
const before = await snapshotProjectPairs(dirs, provider);
|
|
1434
|
+
const foldersMissing = await foldersMissingOnTheWayToEach(
|
|
1435
|
+
dirs.map((dir) => sourceFolderInUse(dir, provider).dir)
|
|
1436
|
+
);
|
|
1433
1437
|
try {
|
|
1434
1438
|
return await write();
|
|
1435
1439
|
} catch (error) {
|
|
1436
|
-
await restoreProjectPairs(before, provider).catch((restoreError) => {
|
|
1440
|
+
await restoreProjectPairs(before, provider).then(() => removeFoldersLeftEmpty(foldersMissing)).catch((restoreError) => {
|
|
1437
1441
|
verbose(`Could not restore a config pair: ${getErrorMessage(restoreError)}`);
|
|
1438
1442
|
});
|
|
1439
1443
|
throw error;
|
|
1440
1444
|
}
|
|
1441
1445
|
}
|
|
1446
|
+
async function foldersMissingOnTheWayToEach(dirs) {
|
|
1447
|
+
return (await Promise.all(dirs.map(foldersMissingOnTheWayTo))).flat();
|
|
1448
|
+
}
|
|
1449
|
+
async function foldersMissingOnTheWayTo(dir) {
|
|
1450
|
+
if (await directoryExists(dir)) return [];
|
|
1451
|
+
return [dir, ...await foldersMissingOnTheWayTo(path3.dirname(dir))];
|
|
1452
|
+
}
|
|
1453
|
+
async function removeFoldersLeftEmpty(folders) {
|
|
1454
|
+
const deepestFirst = folders.toSorted((a, b) => b.length - a.length);
|
|
1455
|
+
await mapInTurn(deepestFirst, removeDirIfEmpty);
|
|
1456
|
+
}
|
|
1442
1457
|
async function writeGlobalPairWhenChanged(effective, globalConfigPath, deps) {
|
|
1443
1458
|
if (!effective.changed) {
|
|
1444
1459
|
verbose("Global config unchanged, skipping write");
|
|
@@ -1548,10 +1563,10 @@ async function mutateGlobal(mutation, deps) {
|
|
|
1548
1563
|
const homeDir = os2.homedir();
|
|
1549
1564
|
const provider = globalProviderFor(mutation, homeDir);
|
|
1550
1565
|
const loadedGlobal = await loadProjectConfigFromDir(homeDir, provider);
|
|
1551
|
-
if (!loadedGlobal) return report(false,
|
|
1566
|
+
if (!loadedGlobal) return report(false, noChanges());
|
|
1552
1567
|
const current = loadedGlobal.config;
|
|
1553
1568
|
const mutated = applyMutation(mutation, current);
|
|
1554
|
-
if (!mutated) return report(false,
|
|
1569
|
+
if (!mutated) return report(false, noChanges());
|
|
1555
1570
|
const prior = fillRequiredFields(current, fallbackNameFor(mutation));
|
|
1556
1571
|
const next = fillRequiredFields(mutated, fallbackNameFor(mutation));
|
|
1557
1572
|
const changes = classifyGlobalChange(prior, next);
|
|
@@ -1687,6 +1702,7 @@ function mergeCompilationResults(...results) {
|
|
|
1687
1702
|
return {
|
|
1688
1703
|
compiled: results.flatMap((r) => r.compiled),
|
|
1689
1704
|
rewritten: results.flatMap((r) => r.rewritten),
|
|
1705
|
+
created: results.flatMap((r) => r.created),
|
|
1690
1706
|
failed: results.flatMap((r) => r.failed),
|
|
1691
1707
|
warnings: results.flatMap((r) => r.warnings)
|
|
1692
1708
|
};
|
|
@@ -1697,6 +1713,7 @@ export {
|
|
|
1697
1713
|
sayCapturedWarnings,
|
|
1698
1714
|
detectProject,
|
|
1699
1715
|
detectBothInstallations,
|
|
1716
|
+
blankGlobalConfig,
|
|
1700
1717
|
projectsAFanOutReaches,
|
|
1701
1718
|
movedGlobalAgentInputs,
|
|
1702
1719
|
lazyGateDeps,
|
|
@@ -1709,4 +1726,4 @@ export {
|
|
|
1709
1726
|
compileAgentsAllScopes,
|
|
1710
1727
|
compileProjectScope
|
|
1711
1728
|
};
|
|
1712
|
-
//# sourceMappingURL=chunk-
|
|
1729
|
+
//# sourceMappingURL=chunk-TNN72UL6.js.map
|