agents-inc 0.156.0 → 0.158.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 +51 -0
- package/dist/{chunk-4A4L3YIW.js → chunk-2PN4QXON.js} +6 -7
- package/dist/chunk-2PN4QXON.js.map +1 -0
- package/dist/{chunk-QWVXOCXO.js → chunk-3NBXQSW2.js} +7 -9
- package/dist/{chunk-QWVXOCXO.js.map → chunk-3NBXQSW2.js.map} +1 -1
- package/dist/{chunk-WCAUUBHO.js → chunk-3PJLLBUS.js} +14597 -14536
- package/dist/chunk-3PJLLBUS.js.map +1 -0
- package/dist/{chunk-6RLV45HN.js → chunk-3Q2N7CSY.js} +6 -6
- package/dist/chunk-3Q2N7CSY.js.map +1 -0
- package/dist/{chunk-LJCNUP6M.js → chunk-4ABNXKAR.js} +2 -2
- package/dist/{chunk-D2CAV7MG.js → chunk-4DMFK67G.js} +2 -2
- package/dist/{chunk-MO5FGLVS.js → chunk-54QLV3OH.js} +11 -12
- package/dist/chunk-54QLV3OH.js.map +1 -0
- package/dist/{chunk-5F2YR5XV.js → chunk-6DBE562W.js} +15 -5
- package/dist/chunk-6DBE562W.js.map +1 -0
- package/dist/{chunk-RWOYPOMR.js → chunk-7Z4N4JWQ.js} +19 -245
- package/dist/chunk-7Z4N4JWQ.js.map +1 -0
- package/dist/{chunk-H6UTKTLK.js → chunk-DAUY2SB3.js} +98 -34
- package/dist/chunk-DAUY2SB3.js.map +1 -0
- package/dist/{chunk-2H7UWE2G.js → chunk-DP6YQFVO.js} +13 -12
- package/dist/chunk-DP6YQFVO.js.map +1 -0
- package/dist/{chunk-ILUVL7WM.js → chunk-DZD25NHW.js} +2 -2
- package/dist/{chunk-PCC4LBKB.js → chunk-EEAX7E2X.js} +2 -2
- package/dist/{chunk-IO5YBKHV.js → chunk-G6G2FT2G.js} +10 -8
- package/dist/chunk-G6G2FT2G.js.map +1 -0
- package/dist/{chunk-5QZAK6J7.js → chunk-H25VRR2T.js} +50 -18
- package/dist/chunk-H25VRR2T.js.map +1 -0
- package/dist/chunk-H2DHTJKW.js +1352 -0
- package/dist/chunk-H2DHTJKW.js.map +1 -0
- package/dist/{chunk-MHRC3KRX.js → chunk-H4CL23HG.js} +3 -3
- package/dist/chunk-H4CL23HG.js.map +1 -0
- package/dist/{chunk-F5T6TV4Z.js → chunk-IK6YOXZH.js} +40 -14
- package/dist/chunk-IK6YOXZH.js.map +1 -0
- package/dist/{chunk-HG4JPXJT.js → chunk-JG3B47P3.js} +23 -10
- package/dist/chunk-JG3B47P3.js.map +1 -0
- package/dist/{chunk-SY4X2LND.js → chunk-KUZBMEWR.js} +3 -3
- package/dist/{chunk-5OKLCVM4.js → chunk-KVVXINCJ.js} +3 -3
- package/dist/{chunk-PNMM5HNX.js → chunk-L4FHSOL5.js} +9 -10
- package/dist/chunk-L4FHSOL5.js.map +1 -0
- package/dist/{chunk-PMUABBPG.js → chunk-LKI3ENGQ.js} +9 -13
- package/dist/chunk-LKI3ENGQ.js.map +1 -0
- package/dist/{chunk-CLFHC2DK.js → chunk-OQB2CKBT.js} +17 -18
- package/dist/chunk-OQB2CKBT.js.map +1 -0
- package/dist/{chunk-HXKOIWLU.js → chunk-P6OKOH62.js} +2 -6
- package/dist/chunk-P6OKOH62.js.map +1 -0
- package/dist/{chunk-TNGMF4UX.js → chunk-PNRLBPGS.js} +12 -12
- package/dist/chunk-PNRLBPGS.js.map +1 -0
- package/dist/{chunk-Y5Y7XHVU.js → chunk-PZNXBORZ.js} +4 -4
- package/dist/{chunk-HTYH7CKN.js → chunk-Q7CAE5NN.js} +3 -3
- package/dist/{chunk-G47TDUK3.js → chunk-QNAMXQKF.js} +2 -2
- package/dist/{chunk-GS2NZ3GD.js → chunk-SJ4T5YLG.js} +5 -5
- package/dist/chunk-SJ4T5YLG.js.map +1 -0
- package/dist/{chunk-UMH2YZKG.js → chunk-TPQ5M3BW.js} +4 -6
- package/dist/{chunk-UMH2YZKG.js.map → chunk-TPQ5M3BW.js.map} +1 -1
- package/dist/{chunk-4G2YHZIM.js → chunk-TUXXBEBB.js} +4 -6
- package/dist/{chunk-4G2YHZIM.js.map → chunk-TUXXBEBB.js.map} +1 -1
- package/dist/{chunk-WFRTHH3A.js → chunk-TZRXWFF5.js} +3 -3
- package/dist/{chunk-TBOVYLQJ.js → chunk-VTIDLRNA.js} +2 -2
- package/dist/{chunk-OKH64JZE.js → chunk-WCZNQECQ.js} +2 -2
- package/dist/{chunk-ZUAZHDKP.js → chunk-WMVOJY6V.js} +277 -40
- package/dist/chunk-WMVOJY6V.js.map +1 -0
- package/dist/{chunk-YO2LTXB4.js → chunk-X52QUV4U.js} +115 -10
- package/dist/chunk-X52QUV4U.js.map +1 -0
- package/dist/{chunk-IXRZAHZF.js → chunk-XNYHMRVJ.js} +4 -4
- package/dist/{chunk-VPASBA7P.js → chunk-YXI3BTQQ.js} +2 -2
- package/dist/commands/build/marketplace.js +9 -12
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +9 -12
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/compile.js +15 -19
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +75 -54
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +154 -109
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +68 -38
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +36 -39
- package/dist/commands/list.js +8 -10
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +8 -11
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/search.js +10 -13
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +8 -10
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +39 -28
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +7 -10
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/removal-plan-confirm.js +2 -2
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/wizard/category-grid.js +4 -5
- package/dist/components/wizard/checkbox-grid.js +4 -4
- package/dist/components/wizard/domain-selection.js +9 -11
- package/dist/components/wizard/run-wizard-session.js +26 -28
- package/dist/components/wizard/scroll-affordance.js +2 -2
- package/dist/components/wizard/skill-agent-summary.js +5 -7
- package/dist/components/wizard/source-grid.js +5 -6
- package/dist/components/wizard/stack-selection.js +7 -9
- package/dist/components/wizard/step-agents.js +8 -10
- package/dist/components/wizard/step-build.js +7 -9
- package/dist/components/wizard/step-confirm.js +9 -11
- package/dist/components/wizard/step-sources.js +8 -10
- package/dist/components/wizard/step-stack.js +8 -10
- package/dist/components/wizard/summary-panel.js +8 -10
- package/dist/components/wizard/toast.js +2 -2
- package/dist/components/wizard/wizard-layout.js +12 -14
- package/dist/components/wizard/wizard-tabs.js +2 -4
- package/dist/components/wizard/wizard.js +25 -27
- package/dist/hooks/init.js +36 -39
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-2VYAV5GL.js +13 -0
- package/dist/recompile-project-agents-NG5DCPHJ.js +17 -0
- package/dist/{source-loader-3DL3NYUX.js → source-loader-CO2FZ3OO.js} +4 -8
- package/dist/src/agents/_templates/agent.liquid +2 -2
- package/dist/stores/wizard-store.js +6 -6
- package/package.json +2 -4
- package/src/agents/_templates/agent.liquid +2 -2
- package/src/schemas/custom-metadata.schema.json +1 -1
- package/src/schemas/marketplace.schema.json +2 -1
- package/dist/chunk-2H7UWE2G.js.map +0 -1
- package/dist/chunk-4A4L3YIW.js.map +0 -1
- package/dist/chunk-5F2YR5XV.js.map +0 -1
- package/dist/chunk-5QZAK6J7.js.map +0 -1
- package/dist/chunk-6RLV45HN.js.map +0 -1
- package/dist/chunk-CLFHC2DK.js.map +0 -1
- package/dist/chunk-F2AMBBIA.js +0 -64
- package/dist/chunk-F2AMBBIA.js.map +0 -1
- package/dist/chunk-F5T6TV4Z.js.map +0 -1
- package/dist/chunk-GS2NZ3GD.js.map +0 -1
- package/dist/chunk-H6UTKTLK.js.map +0 -1
- package/dist/chunk-HG4JPXJT.js.map +0 -1
- package/dist/chunk-HXKOIWLU.js.map +0 -1
- package/dist/chunk-IO5YBKHV.js.map +0 -1
- package/dist/chunk-MHRC3KRX.js.map +0 -1
- package/dist/chunk-MO5FGLVS.js.map +0 -1
- package/dist/chunk-PMUABBPG.js.map +0 -1
- package/dist/chunk-PNMM5HNX.js.map +0 -1
- package/dist/chunk-RWOYPOMR.js.map +0 -1
- package/dist/chunk-TNGMF4UX.js.map +0 -1
- package/dist/chunk-VASLW636.js +0 -23
- package/dist/chunk-VASLW636.js.map +0 -1
- package/dist/chunk-WCAUUBHO.js.map +0 -1
- package/dist/chunk-WUQ3MTPF.js +0 -173
- package/dist/chunk-WUQ3MTPF.js.map +0 -1
- package/dist/chunk-XAXJWXI4.js +0 -1667
- package/dist/chunk-XAXJWXI4.js.map +0 -1
- package/dist/chunk-YO2LTXB4.js.map +0 -1
- package/dist/chunk-ZUAZHDKP.js.map +0 -1
- package/dist/copy-local-skills-NSUTBVLJ.js +0 -14
- package/dist/load-agent-defs-X4E57I2U.js +0 -15
- package/dist/loader-G6BFG2VA.js +0 -24
- package/dist/recompile-project-agents-JE4MM72I.js +0 -20
- package/dist/recompile-project-agents-JE4MM72I.js.map +0 -1
- package/dist/source-loader-3DL3NYUX.js.map +0 -1
- /package/dist/{chunk-LJCNUP6M.js.map → chunk-4ABNXKAR.js.map} +0 -0
- /package/dist/{chunk-D2CAV7MG.js.map → chunk-4DMFK67G.js.map} +0 -0
- /package/dist/{chunk-ILUVL7WM.js.map → chunk-DZD25NHW.js.map} +0 -0
- /package/dist/{chunk-PCC4LBKB.js.map → chunk-EEAX7E2X.js.map} +0 -0
- /package/dist/{chunk-SY4X2LND.js.map → chunk-KUZBMEWR.js.map} +0 -0
- /package/dist/{chunk-5OKLCVM4.js.map → chunk-KVVXINCJ.js.map} +0 -0
- /package/dist/{chunk-Y5Y7XHVU.js.map → chunk-PZNXBORZ.js.map} +0 -0
- /package/dist/{chunk-HTYH7CKN.js.map → chunk-Q7CAE5NN.js.map} +0 -0
- /package/dist/{chunk-G47TDUK3.js.map → chunk-QNAMXQKF.js.map} +0 -0
- /package/dist/{chunk-WFRTHH3A.js.map → chunk-TZRXWFF5.js.map} +0 -0
- /package/dist/{chunk-TBOVYLQJ.js.map → chunk-VTIDLRNA.js.map} +0 -0
- /package/dist/{chunk-OKH64JZE.js.map → chunk-WCZNQECQ.js.map} +0 -0
- /package/dist/{chunk-IXRZAHZF.js.map → chunk-XNYHMRVJ.js.map} +0 -0
- /package/dist/{chunk-VPASBA7P.js.map → chunk-YXI3BTQQ.js.map} +0 -0
- /package/dist/{copy-local-skills-NSUTBVLJ.js.map → load-agent-defs-2VYAV5GL.js.map} +0 -0
- /package/dist/{load-agent-defs-X4E57I2U.js.map → recompile-project-agents-NG5DCPHJ.js.map} +0 -0
- /package/dist/{loader-G6BFG2VA.js.map → source-loader-CO2FZ3OO.js.map} +0 -0
package/dist/commands/edit.js
CHANGED
|
@@ -3,85 +3,87 @@ import {
|
|
|
3
3
|
publishSeedConfig,
|
|
4
4
|
seedPayloadForInstallation,
|
|
5
5
|
skillsAuthoredHere
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-DP6YQFVO.js";
|
|
7
7
|
import {
|
|
8
8
|
RemovalPlanConfirm
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-4DMFK67G.js";
|
|
10
10
|
import "../chunk-OZXAJNLA.js";
|
|
11
11
|
import {
|
|
12
12
|
seedToWizardResult
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-54QLV3OH.js";
|
|
14
14
|
import {
|
|
15
15
|
runWizardSession
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-
|
|
16
|
+
} from "../chunk-XNYHMRVJ.js";
|
|
17
|
+
import "../chunk-PNRLBPGS.js";
|
|
18
|
+
import "../chunk-4ABNXKAR.js";
|
|
19
|
+
import "../chunk-Q7CAE5NN.js";
|
|
20
|
+
import "../chunk-EEAX7E2X.js";
|
|
21
|
+
import "../chunk-JG3B47P3.js";
|
|
22
|
+
import "../chunk-3Q2N7CSY.js";
|
|
23
|
+
import "../chunk-DZD25NHW.js";
|
|
24
|
+
import "../chunk-P6OKOH62.js";
|
|
25
|
+
import "../chunk-3NBXQSW2.js";
|
|
26
|
+
import "../chunk-SJ4T5YLG.js";
|
|
27
|
+
import "../chunk-YXI3BTQQ.js";
|
|
28
|
+
import "../chunk-L4FHSOL5.js";
|
|
29
|
+
import "../chunk-OQB2CKBT.js";
|
|
30
|
+
import "../chunk-KVVXINCJ.js";
|
|
31
|
+
import "../chunk-6DBE562W.js";
|
|
32
32
|
import "../chunk-TSIU7DME.js";
|
|
33
33
|
import "../chunk-XVAQG2CV.js";
|
|
34
34
|
import {
|
|
35
35
|
Spinner
|
|
36
36
|
} from "../chunk-ZBPEFQ4G.js";
|
|
37
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-2PN4QXON.js";
|
|
38
38
|
import "../chunk-J27W6TXS.js";
|
|
39
|
-
import "../chunk-
|
|
40
|
-
import "../chunk-
|
|
39
|
+
import "../chunk-KUZBMEWR.js";
|
|
40
|
+
import "../chunk-TZRXWFF5.js";
|
|
41
41
|
import "../chunk-WTJ3AY33.js";
|
|
42
|
-
import "../chunk-
|
|
42
|
+
import "../chunk-WCZNQECQ.js";
|
|
43
43
|
import {
|
|
44
44
|
fetchSeedConfig,
|
|
45
45
|
registerExternalSkills,
|
|
46
46
|
writeExternalSkills
|
|
47
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-LKI3ENGQ.js";
|
|
48
48
|
import {
|
|
49
49
|
promptConfirm
|
|
50
50
|
} from "../chunk-JCPANDNR.js";
|
|
51
51
|
import {
|
|
52
|
+
applyMigratedGlobalSources,
|
|
52
53
|
compileAgentsAllScopes,
|
|
53
54
|
detectProject,
|
|
54
55
|
loadSource,
|
|
56
|
+
mutateGlobal,
|
|
57
|
+
normalizeProjectPath,
|
|
55
58
|
writeProjectConfig
|
|
56
|
-
} from "../chunk-
|
|
59
|
+
} from "../chunk-H2DHTJKW.js";
|
|
57
60
|
import {
|
|
61
|
+
copyLocalSkills,
|
|
58
62
|
discoverInstalledSkills,
|
|
59
63
|
removeCompiledAgents,
|
|
60
64
|
uninstallPluginSkills
|
|
61
|
-
} from "../chunk-
|
|
65
|
+
} from "../chunk-H25VRR2T.js";
|
|
62
66
|
import {
|
|
63
67
|
loadAgentDefs
|
|
64
|
-
} from "../chunk-
|
|
65
|
-
import
|
|
66
|
-
|
|
67
|
-
} from "../chunk-F2AMBBIA.js";
|
|
68
|
-
import "../chunk-ZUAZHDKP.js";
|
|
69
|
-
import "../chunk-Y5Y7XHVU.js";
|
|
68
|
+
} from "../chunk-H4CL23HG.js";
|
|
69
|
+
import "../chunk-WMVOJY6V.js";
|
|
70
|
+
import "../chunk-PZNXBORZ.js";
|
|
70
71
|
import {
|
|
71
72
|
render
|
|
72
73
|
} from "../chunk-JFLVEFFP.js";
|
|
73
74
|
import {
|
|
74
75
|
formatScopeTag,
|
|
75
76
|
orderDomains
|
|
76
|
-
} from "../chunk-
|
|
77
|
+
} from "../chunk-IK6YOXZH.js";
|
|
77
78
|
import {
|
|
78
79
|
BaseCommand,
|
|
79
80
|
EXIT_CODES
|
|
80
|
-
} from "../chunk-
|
|
81
|
-
import "../chunk-
|
|
82
|
-
import "../chunk-
|
|
81
|
+
} from "../chunk-X52QUV4U.js";
|
|
82
|
+
import "../chunk-TPQ5M3BW.js";
|
|
83
|
+
import "../chunk-QNAMXQKF.js";
|
|
83
84
|
import {
|
|
84
85
|
ERROR_MESSAGES,
|
|
86
|
+
INCOMPLETE_WORK_RECOVERY,
|
|
85
87
|
INFO_MESSAGES,
|
|
86
88
|
INSTALL_MODE_DESCRIPTIONS,
|
|
87
89
|
SHARED_CONFIG_APPLY,
|
|
@@ -89,7 +91,7 @@ import {
|
|
|
89
91
|
STATUS_MESSAGES,
|
|
90
92
|
activeAgentNames,
|
|
91
93
|
activeAgentScopeMap,
|
|
92
|
-
|
|
94
|
+
agentsNotCompiled,
|
|
93
95
|
authoredHereKept,
|
|
94
96
|
buildMarketplacePluginRef,
|
|
95
97
|
carriedSkillsWritten,
|
|
@@ -101,6 +103,7 @@ import {
|
|
|
101
103
|
ejectCopyFailureError,
|
|
102
104
|
execCommand,
|
|
103
105
|
executeMigration,
|
|
106
|
+
getErrorMessage,
|
|
104
107
|
globallyInstalledRemoved,
|
|
105
108
|
installBaseDir,
|
|
106
109
|
isActiveAt,
|
|
@@ -108,8 +111,6 @@ import {
|
|
|
108
111
|
loadProjectConfigFromDir,
|
|
109
112
|
localSkillsCopied,
|
|
110
113
|
migrateLocalSkillScope,
|
|
111
|
-
mutateGlobal,
|
|
112
|
-
normalizeProjectPath,
|
|
113
114
|
recompileSummary,
|
|
114
115
|
resolveInstallPaths,
|
|
115
116
|
sharedConfigDestinations,
|
|
@@ -119,20 +120,15 @@ import {
|
|
|
119
120
|
toClaudePluginScope,
|
|
120
121
|
unplaceableKept,
|
|
121
122
|
unresolvedSkillRemovalReasons
|
|
122
|
-
} from "../chunk-
|
|
123
|
-
import {
|
|
124
|
-
getErrorMessage
|
|
125
|
-
} from "../chunk-XAXJWXI4.js";
|
|
123
|
+
} from "../chunk-3PJLLBUS.js";
|
|
126
124
|
import {
|
|
127
125
|
getCategoryDomain,
|
|
128
126
|
getSkillById,
|
|
129
127
|
getSkillDisplayName,
|
|
130
|
-
matrix
|
|
131
|
-
} from "../chunk-RWOYPOMR.js";
|
|
132
|
-
import {
|
|
128
|
+
matrix,
|
|
133
129
|
typedEntries,
|
|
134
130
|
typedKeys
|
|
135
|
-
} from "../chunk-
|
|
131
|
+
} from "../chunk-7Z4N4JWQ.js";
|
|
136
132
|
import {
|
|
137
133
|
CLI_COLORS,
|
|
138
134
|
CLI_INVOKE_COMMAND,
|
|
@@ -140,7 +136,7 @@ import {
|
|
|
140
136
|
EJECT_SOURCE,
|
|
141
137
|
editorConfigUrl,
|
|
142
138
|
formatSourceDisplayName
|
|
143
|
-
} from "../chunk-
|
|
139
|
+
} from "../chunk-G6G2FT2G.js";
|
|
144
140
|
import "../chunk-VZRO7RYT.js";
|
|
145
141
|
|
|
146
142
|
// src/cli/commands/edit.tsx
|
|
@@ -284,6 +280,11 @@ function scopeArrow(change) {
|
|
|
284
280
|
function loadedSourceLabel(sourceResult) {
|
|
285
281
|
return sourceResult.marketplace ?? sourceResult.sourceConfig.source;
|
|
286
282
|
}
|
|
283
|
+
function resolveEditRoot(installation, cwd, setupRequested) {
|
|
284
|
+
const dir = setupRequested ? cwd : installation.projectDir;
|
|
285
|
+
const isGlobal = isHomeDirectory(dir);
|
|
286
|
+
return { dir, isGlobal, isProjectSetup: setupRequested && !isGlobal };
|
|
287
|
+
}
|
|
287
288
|
function globalScopePlan(changes, kept) {
|
|
288
289
|
const sections = removalSections(changes.removedSkills, changes.removedAgents);
|
|
289
290
|
return { heading: planHeading(sections), sections, statements: kept };
|
|
@@ -345,8 +346,8 @@ function catalogueStatement(kept) {
|
|
|
345
346
|
if (kept.unplaceableSkillIds.length === 0) return [];
|
|
346
347
|
return [unplaceableKept(kept.unplaceableSkillIds)];
|
|
347
348
|
}
|
|
348
|
-
function applyAuthority(producer,
|
|
349
|
-
if (
|
|
349
|
+
function applyAuthority(producer, editRoot) {
|
|
350
|
+
if (editRoot.isGlobal) return "all";
|
|
350
351
|
return producer === "shared" ? "all" : "owned";
|
|
351
352
|
}
|
|
352
353
|
var Edit = class _Edit extends BaseCommand {
|
|
@@ -381,7 +382,19 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
381
382
|
hidden: true
|
|
382
383
|
})
|
|
383
384
|
};
|
|
385
|
+
/**
|
|
386
|
+
* The command in two statements: do the work, then answer for it.
|
|
387
|
+
*
|
|
388
|
+
* `applyEdit` owns every path through the edit and returns however it likes; the exit code is
|
|
389
|
+
* decided once, here, after the last of them. Deciding it inside `applyEdit` would mean
|
|
390
|
+
* deciding it at each of that method's three endings, and an ending added later would inherit
|
|
391
|
+
* the exit-0 default silently — which is the defect this pair exists to close.
|
|
392
|
+
*/
|
|
384
393
|
async run() {
|
|
394
|
+
await this.applyEdit();
|
|
395
|
+
this.exitIfWorkIncomplete();
|
|
396
|
+
}
|
|
397
|
+
async applyEdit() {
|
|
385
398
|
const { flags } = await this.parse(_Edit);
|
|
386
399
|
const cwd = process.cwd();
|
|
387
400
|
await this.ensureConfigReadable(cwd);
|
|
@@ -391,12 +404,13 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
391
404
|
if (flags.ui) return this.openInEditor(cwd);
|
|
392
405
|
const payload = flags.from === void 0 ? null : await this.fetchSharedConfigOrFail(flags.from);
|
|
393
406
|
const context = await this.loadContextUnderSpinner();
|
|
407
|
+
const editRoot = resolveEditRoot(context.installation, cwd, flags[EDIT_PROJECT_SETUP_FLAG]);
|
|
394
408
|
await this.ensureSavedSkillsReadable(
|
|
395
409
|
context.projectConfig?.skills ?? [],
|
|
396
410
|
context.sourceResult.matrix,
|
|
397
411
|
context.projectDir
|
|
398
412
|
);
|
|
399
|
-
const selection = payload ? await this.selectionFromSharedConfig(payload, context,
|
|
413
|
+
const selection = payload ? await this.selectionFromSharedConfig(payload, context, editRoot) : await this.selectionFromWizard(context, editRoot);
|
|
400
414
|
if (!selection) this.error("Cancelled", { exit: EXIT_CODES.CANCELLED });
|
|
401
415
|
const { result } = selection;
|
|
402
416
|
this.reportValidationErrors(result.validation);
|
|
@@ -416,21 +430,20 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
416
430
|
newAgents: result.agentConfigs,
|
|
417
431
|
oldAgents: context.projectConfig?.agents ?? []
|
|
418
432
|
});
|
|
419
|
-
const isProjectSetup = flags[EDIT_PROJECT_SETUP_FLAG] && !isHomeDirectory(cwd);
|
|
420
433
|
if (selection.producer === "shared") {
|
|
421
434
|
await this.confirmSharedConfigOrCancel(
|
|
422
435
|
changes,
|
|
423
436
|
selection.kept,
|
|
424
437
|
{ skills: activeOldSkills, agents: activeOldAgents },
|
|
425
|
-
|
|
438
|
+
editRoot
|
|
426
439
|
);
|
|
427
440
|
await this.writeCarriedSkills(selection.carried);
|
|
428
441
|
}
|
|
429
|
-
const authority = applyAuthority(selection.producer,
|
|
442
|
+
const authority = applyAuthority(selection.producer, editRoot);
|
|
430
443
|
if (!hasAnyChanges(changes)) {
|
|
431
444
|
this.log(chalk.hex(CLI_COLORS.NEUTRAL)("No changes made."));
|
|
432
|
-
if (!isProjectSetup) return;
|
|
433
|
-
await this.writeConfigAndCompile(result, context,
|
|
445
|
+
if (!editRoot.isProjectSetup) return;
|
|
446
|
+
await this.writeConfigAndCompile(result, context, editRoot, authority);
|
|
434
447
|
this.logCompletionSummary(changes);
|
|
435
448
|
return;
|
|
436
449
|
}
|
|
@@ -451,21 +464,26 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
451
464
|
filteredResult,
|
|
452
465
|
activeOldSkills,
|
|
453
466
|
context,
|
|
454
|
-
|
|
467
|
+
editRoot
|
|
468
|
+
);
|
|
469
|
+
await this.recordGlobalSourceMigrations(
|
|
470
|
+
migratedSkillIds,
|
|
471
|
+
filteredResult.skills,
|
|
472
|
+
editRoot,
|
|
473
|
+
context
|
|
455
474
|
);
|
|
456
|
-
await this.
|
|
457
|
-
await this.
|
|
458
|
-
await this.
|
|
459
|
-
await this.
|
|
460
|
-
await this.
|
|
461
|
-
await this.
|
|
462
|
-
await this.
|
|
463
|
-
await this.cleanupStaleAgentFiles(changes, activeOldAgents, cwd);
|
|
475
|
+
await this.applyScopeChanges(changes, filteredResult, context, editRoot);
|
|
476
|
+
await this.applySourceChanges(changes, activeOldSkills, editRoot, migratedSkillIds);
|
|
477
|
+
await this.applyPluginChanges(changes, filteredResult, activeOldSkills, context, editRoot);
|
|
478
|
+
await this.copyNewLocalSkills(changes, filteredResult, context, editRoot);
|
|
479
|
+
await this.removeDeletedLocalSkills(changes, activeOldSkills, editRoot);
|
|
480
|
+
await this.writeConfigAndCompile(result, context, editRoot, authority);
|
|
481
|
+
await this.cleanupStaleAgentFiles(changes, activeOldAgents, editRoot);
|
|
464
482
|
this.logCompletionSummary(changes);
|
|
465
483
|
}
|
|
466
484
|
/** The interactive producer: open the wizard on what is installed, return what was chosen. */
|
|
467
|
-
async selectionFromWizard(context,
|
|
468
|
-
const result = await this.runEditWizard(context,
|
|
485
|
+
async selectionFromWizard(context, editRoot) {
|
|
486
|
+
const result = await this.runEditWizard(context, editRoot);
|
|
469
487
|
if (!result) return null;
|
|
470
488
|
return { producer: "wizard", result };
|
|
471
489
|
}
|
|
@@ -484,20 +502,20 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
484
502
|
* changes is who the removal reaches — which the confirm names, rather than this putting the
|
|
485
503
|
* entry back and calling the reach impossible.
|
|
486
504
|
*/
|
|
487
|
-
async selectionFromSharedConfig(payload, context,
|
|
505
|
+
async selectionFromSharedConfig(payload, context, editRoot) {
|
|
488
506
|
const { matrix: sourceMatrix } = context.sourceResult;
|
|
489
|
-
const carried = this.registerExternalSkillsOrFail(payload, sourceMatrix,
|
|
507
|
+
const carried = this.registerExternalSkillsOrFail(payload, sourceMatrix, editRoot.dir);
|
|
490
508
|
const { result, skippedSkillIds, skippedAgentNames } = this.decodeSeedOrFail(
|
|
491
509
|
payload,
|
|
492
510
|
sourceMatrix
|
|
493
511
|
);
|
|
494
|
-
this.refuseProjectScopedContentAtHome(result,
|
|
512
|
+
this.refuseProjectScopedContentAtHome(result, editRoot.dir);
|
|
495
513
|
if (skippedSkillIds.length > 0) this.warn(skippedUnknownSkills(skippedSkillIds));
|
|
496
514
|
if (skippedAgentNames.length > 0) this.warn(skippedUnknownAgents(skippedAgentNames));
|
|
497
515
|
const reconciled = reconcileSharedConfig({
|
|
498
516
|
decoded: result,
|
|
499
517
|
installed: context.projectConfig,
|
|
500
|
-
authoredHere: await this.readAuthoredHere(context.projectConfig,
|
|
518
|
+
authoredHere: await this.readAuthoredHere(context.projectConfig, editRoot.dir),
|
|
501
519
|
// The ids the decode above could not place. They are the skips just reported, read as
|
|
502
520
|
// what STAYS rather than as what did not arrive: the payload named them, so their absence
|
|
503
521
|
// from the decode is this catalogue's limit and not an instruction to delete anything.
|
|
@@ -519,10 +537,10 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
519
537
|
* consequence of an unanswered question is that the entry is treated as the CLI's own, which
|
|
520
538
|
* is what every other command already assumes about it.
|
|
521
539
|
*/
|
|
522
|
-
async readAuthoredHere(projectConfig,
|
|
540
|
+
async readAuthoredHere(projectConfig, editRoot) {
|
|
523
541
|
if (!projectConfig) return /* @__PURE__ */ new Set();
|
|
524
542
|
try {
|
|
525
|
-
return await skillsAuthoredHere(projectConfig,
|
|
543
|
+
return await skillsAuthoredHere(projectConfig, editRoot);
|
|
526
544
|
} catch (error) {
|
|
527
545
|
this.warn(`Could not tell which skills were written here: ${getErrorMessage(error)}`);
|
|
528
546
|
return /* @__PURE__ */ new Set();
|
|
@@ -590,8 +608,13 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
590
608
|
* is the whole of the gate; inside a project a global removal reaches projects nobody here is
|
|
591
609
|
* looking at, so it is shown apart and the reach is named.
|
|
592
610
|
*/
|
|
593
|
-
async confirmSharedConfigOrCancel(changes, kept, installed,
|
|
594
|
-
const plan =
|
|
611
|
+
async confirmSharedConfigOrCancel(changes, kept, installed, editRoot) {
|
|
612
|
+
const plan = editRoot.isGlobal ? globalScopePlan(changes, kept) : projectScopePlan(
|
|
613
|
+
changes,
|
|
614
|
+
kept,
|
|
615
|
+
installed,
|
|
616
|
+
await this.otherRegisteredProjects(editRoot.dir)
|
|
617
|
+
);
|
|
595
618
|
const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx(
|
|
596
619
|
RemovalPlanConfirm,
|
|
597
620
|
{
|
|
@@ -618,10 +641,10 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
618
641
|
* read leaves the disclosure counting nobody rather than failing an apply — and the statement
|
|
619
642
|
* it produces then is the one that says no other project is registered.
|
|
620
643
|
*/
|
|
621
|
-
async otherRegisteredProjects(
|
|
644
|
+
async otherRegisteredProjects(editRoot) {
|
|
622
645
|
try {
|
|
623
646
|
const global = await loadProjectConfigFromDir(os.homedir());
|
|
624
|
-
const here = normalizeProjectPath(
|
|
647
|
+
const here = normalizeProjectPath(editRoot);
|
|
625
648
|
return (global?.config.projects ?? []).filter((projectDir) => projectDir !== here);
|
|
626
649
|
} catch (error) {
|
|
627
650
|
this.warn(`Could not tell which projects share this install: ${getErrorMessage(error)}`);
|
|
@@ -742,7 +765,7 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
742
765
|
currentSkillIds
|
|
743
766
|
};
|
|
744
767
|
}
|
|
745
|
-
async runEditWizard(context,
|
|
768
|
+
async runEditWizard(context, editRoot) {
|
|
746
769
|
const { projectConfig, currentSkillIds } = context;
|
|
747
770
|
const selectedAgents = projectConfig?.agents && activeAgentNames(projectConfig.agents);
|
|
748
771
|
return runWizardSession({
|
|
@@ -755,7 +778,7 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
755
778
|
installedSkillIds: currentSkillIds,
|
|
756
779
|
...projectConfig?.skills !== void 0 && { installedSkillConfigs: projectConfig.skills },
|
|
757
780
|
...projectConfig?.agents !== void 0 && { installedAgentConfigs: projectConfig.agents },
|
|
758
|
-
isEditingFromGlobalScope:
|
|
781
|
+
isEditingFromGlobalScope: editRoot.isGlobal
|
|
759
782
|
},
|
|
760
783
|
props: {
|
|
761
784
|
version: this.config.version,
|
|
@@ -806,8 +829,8 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
806
829
|
* OTHER registered project's config and agents are stale until this write fans out —
|
|
807
830
|
* which is why it goes through the gate rather than straight to the file.
|
|
808
831
|
*/
|
|
809
|
-
async recordGlobalSourceMigrations(migratedSkillIds, newSkills,
|
|
810
|
-
if (
|
|
832
|
+
async recordGlobalSourceMigrations(migratedSkillIds, newSkills, editRoot, context) {
|
|
833
|
+
if (editRoot.isGlobal) return;
|
|
811
834
|
const migratedSources = new Map(
|
|
812
835
|
newSkills.filter((s) => migratedSkillIds.has(s.id) && isActiveAt(s, "global")).map((s) => [s.id, s.origin])
|
|
813
836
|
);
|
|
@@ -826,7 +849,10 @@ var Edit = class _Edit extends BaseCommand {
|
|
|
826
849
|
);
|
|
827
850
|
this.reportPropagatedRecompile(report);
|
|
828
851
|
} catch (error) {
|
|
829
|
-
this.
|
|
852
|
+
this.reportIncompleteWork(
|
|
853
|
+
`Could not record global origin change: ${getErrorMessage(error)}`,
|
|
854
|
+
INCOMPLETE_WORK_RECOVERY.INSPECT_INSTALLATION
|
|
855
|
+
);
|
|
830
856
|
}
|
|
831
857
|
}
|
|
832
858
|
logChangeSummary(changes, newSkills, oldSkills, removalReasons) {
|
|
@@ -884,7 +910,7 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
884
910
|
}
|
|
885
911
|
this.log("");
|
|
886
912
|
}
|
|
887
|
-
async applyMigrations(_changes, filteredResult, activeOldSkills, context,
|
|
913
|
+
async applyMigrations(_changes, filteredResult, activeOldSkills, context, editRoot) {
|
|
888
914
|
const migrationPlan = detectMigrations(activeOldSkills, filteredResult.skills);
|
|
889
915
|
const migratedSkillIds = /* @__PURE__ */ new Set([
|
|
890
916
|
...migrationPlan.toEject.map((m) => m.id),
|
|
@@ -899,7 +925,11 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
899
925
|
await this.requireMarketplaceOrExit(context.sourceResult, "migrate skills to plugin mode");
|
|
900
926
|
this.announcePluginInstall();
|
|
901
927
|
}
|
|
902
|
-
const migrationResult = await executeMigration(
|
|
928
|
+
const migrationResult = await executeMigration(
|
|
929
|
+
migrationPlan,
|
|
930
|
+
editRoot.dir,
|
|
931
|
+
context.sourceResult
|
|
932
|
+
);
|
|
903
933
|
for (const warning of migrationResult.warnings) {
|
|
904
934
|
this.warn(warning);
|
|
905
935
|
}
|
|
@@ -938,12 +968,12 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
938
968
|
logModeSwitch(count, modeDescription) {
|
|
939
969
|
this.log(chalk.hex(CLI_COLORS.NEUTRAL)(`Switching ${count} skill(s) to ${modeDescription}`));
|
|
940
970
|
}
|
|
941
|
-
async applyScopeChanges(changes, filteredResult, context,
|
|
971
|
+
async applyScopeChanges(changes, filteredResult, context, editRoot) {
|
|
942
972
|
const { scopeChanges } = changes;
|
|
943
973
|
for (const [skillId, change] of scopeChanges) {
|
|
944
974
|
const skillConfig = filteredResult.skills.find((s) => s.id === skillId);
|
|
945
975
|
if (skillConfig?.origin === EJECT_SOURCE) {
|
|
946
|
-
await migrateLocalSkillScope(skillId, change.from,
|
|
976
|
+
await migrateLocalSkillScope(skillId, change.from, editRoot.dir);
|
|
947
977
|
}
|
|
948
978
|
}
|
|
949
979
|
const hasPluginScopeChanges = [...scopeChanges.keys()].some((skillId) => {
|
|
@@ -959,13 +989,16 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
959
989
|
scopeChanges,
|
|
960
990
|
filteredResult.skills,
|
|
961
991
|
marketplace,
|
|
962
|
-
|
|
992
|
+
editRoot.dir
|
|
963
993
|
);
|
|
964
994
|
for (const item of pluginScopeResult.failed) {
|
|
965
|
-
this.
|
|
995
|
+
this.reportIncompleteWork(
|
|
996
|
+
`Failed to migrate plugin scope for ${item.id}: ${item.error}`,
|
|
997
|
+
INCOMPLETE_WORK_RECOVERY.INSPECT_INSTALLATION
|
|
998
|
+
);
|
|
966
999
|
}
|
|
967
1000
|
}
|
|
968
|
-
async applySourceChanges(changes, activeOldSkills,
|
|
1001
|
+
async applySourceChanges(changes, activeOldSkills, editRoot, migratedSkillIds) {
|
|
969
1002
|
const { sourceChanges } = changes;
|
|
970
1003
|
for (const [skillId, change] of sourceChanges) {
|
|
971
1004
|
if (migratedSkillIds.has(skillId)) {
|
|
@@ -973,12 +1006,12 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
973
1006
|
}
|
|
974
1007
|
if (change.from === EJECT_SOURCE) {
|
|
975
1008
|
const oldSkill = activeOldSkills.find((s) => s.id === skillId);
|
|
976
|
-
const deleteDir = installBaseDir(
|
|
1009
|
+
const deleteDir = installBaseDir(editRoot.dir, oldSkill?.scope);
|
|
977
1010
|
await deleteLocalSkill(deleteDir, skillId);
|
|
978
1011
|
}
|
|
979
1012
|
}
|
|
980
1013
|
}
|
|
981
|
-
async applyPluginChanges(changes, filteredResult, activeOldSkills, context,
|
|
1014
|
+
async applyPluginChanges(changes, filteredResult, activeOldSkills, context, editRoot) {
|
|
982
1015
|
const { addedSkills, removedSkills } = changes;
|
|
983
1016
|
const addedPluginSkills = filteredResult.skills.filter(
|
|
984
1017
|
(s) => addedSkills.includes(s.id) && s.origin !== EJECT_SOURCE
|
|
@@ -995,7 +1028,7 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
995
1028
|
await this.installPluginSkillsReported(
|
|
996
1029
|
addedPluginSkills,
|
|
997
1030
|
marketplace,
|
|
998
|
-
|
|
1031
|
+
editRoot.dir,
|
|
999
1032
|
context.sourceResult.matrix
|
|
1000
1033
|
);
|
|
1001
1034
|
}
|
|
@@ -1004,7 +1037,7 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
1004
1037
|
removedPluginSkills,
|
|
1005
1038
|
activeOldSkills,
|
|
1006
1039
|
marketplace,
|
|
1007
|
-
|
|
1040
|
+
editRoot.dir
|
|
1008
1041
|
);
|
|
1009
1042
|
if (uninstallResult.uninstalled.length > 0) {
|
|
1010
1043
|
this.log(
|
|
@@ -1016,26 +1049,30 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
1016
1049
|
}
|
|
1017
1050
|
}
|
|
1018
1051
|
}
|
|
1019
|
-
async copyNewLocalSkills(changes, filteredResult, context,
|
|
1052
|
+
async copyNewLocalSkills(changes, filteredResult, context, editRoot) {
|
|
1020
1053
|
const { addedSkills } = changes;
|
|
1021
1054
|
const addedLocalSkills = filteredResult.skills.filter(
|
|
1022
1055
|
(s) => addedSkills.includes(s.id) && s.origin === EJECT_SOURCE
|
|
1023
1056
|
);
|
|
1024
1057
|
if (addedLocalSkills.length > 0) {
|
|
1025
|
-
const copyResult = await copyLocalSkills(
|
|
1058
|
+
const copyResult = await copyLocalSkills(
|
|
1059
|
+
addedLocalSkills,
|
|
1060
|
+
editRoot.dir,
|
|
1061
|
+
context.sourceResult
|
|
1062
|
+
);
|
|
1026
1063
|
this.log(chalk.hex(CLI_COLORS.NEUTRAL)(localSkillsCopied(copyResult.totalCopied)));
|
|
1027
1064
|
}
|
|
1028
1065
|
}
|
|
1029
|
-
async removeDeletedLocalSkills(changes, activeOldSkills,
|
|
1066
|
+
async removeDeletedLocalSkills(changes, activeOldSkills, editRoot) {
|
|
1030
1067
|
const { removedSkills } = changes;
|
|
1031
1068
|
for (const skillId of removedSkills) {
|
|
1032
1069
|
const oldSkill = activeOldSkills.find((s) => s.id === skillId);
|
|
1033
1070
|
if (oldSkill?.origin !== EJECT_SOURCE) continue;
|
|
1034
|
-
const deleteDir = installBaseDir(
|
|
1071
|
+
const deleteDir = installBaseDir(editRoot.dir, oldSkill.scope);
|
|
1035
1072
|
await deleteLocalSkill(deleteDir, skillId);
|
|
1036
1073
|
}
|
|
1037
1074
|
}
|
|
1038
|
-
async writeConfigAndCompile(result, context,
|
|
1075
|
+
async writeConfigAndCompile(result, context, editRoot, authority) {
|
|
1039
1076
|
let agentDefsResult;
|
|
1040
1077
|
try {
|
|
1041
1078
|
agentDefsResult = await loadAgentDefs();
|
|
@@ -1047,10 +1084,10 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
1047
1084
|
configResult = await writeProjectConfig({
|
|
1048
1085
|
wizardResult: result,
|
|
1049
1086
|
sourceResult: context.sourceResult,
|
|
1050
|
-
projectDir:
|
|
1051
|
-
|
|
1087
|
+
projectDir: editRoot.dir,
|
|
1088
|
+
agentDefs: agentDefsResult,
|
|
1052
1089
|
// A full `cc edit` pass is authoritative over the roster it owns, so deselected entries
|
|
1053
|
-
// are removed rather than union-preserved
|
|
1090
|
+
// are removed rather than union-preserved. `applyAuthority` decides
|
|
1054
1091
|
// how much that is from the producer and the directory, and hands the same word to the
|
|
1055
1092
|
// merger and to the global config the project branch of the gate commits.
|
|
1056
1093
|
authoritativeScope: authority
|
|
@@ -1063,9 +1100,9 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
1063
1100
|
this.reportUnassignedSkills(configResult.config);
|
|
1064
1101
|
try {
|
|
1065
1102
|
const agentScopeMap = activeAgentScopeMap(result.agentConfigs);
|
|
1066
|
-
const { allSkills } = await discoverInstalledSkills(
|
|
1103
|
+
const { allSkills } = await discoverInstalledSkills(editRoot.dir);
|
|
1067
1104
|
const compilationResult = await compileAgentsAllScopes({
|
|
1068
|
-
projectDir:
|
|
1105
|
+
projectDir: editRoot.dir,
|
|
1069
1106
|
sourcePath: agentDefsResult.sourcePath,
|
|
1070
1107
|
skills: allSkills,
|
|
1071
1108
|
agentScopeMap
|
|
@@ -1083,27 +1120,35 @@ ${chalk.hex(CLI_COLORS.WHITE).bold("Changes:")}`);
|
|
|
1083
1120
|
for (const warning of warnings) {
|
|
1084
1121
|
this.warn(warning);
|
|
1085
1122
|
}
|
|
1123
|
+
this.recordIncompleteWork(agentsNotCompiled(failed), INCOMPLETE_WORK_RECOVERY.RECOMPILE);
|
|
1086
1124
|
} else if (compiled.length > 0) {
|
|
1087
1125
|
this.log(chalk.hex(CLI_COLORS.NEUTRAL)(summary));
|
|
1088
1126
|
} else {
|
|
1089
1127
|
this.log(chalk.hex(CLI_COLORS.NEUTRAL)(INFO_MESSAGES.NO_AGENTS_TO_RECOMPILE));
|
|
1090
1128
|
}
|
|
1091
1129
|
} catch (error) {
|
|
1092
|
-
this.
|
|
1130
|
+
this.reportIncompleteWork(
|
|
1131
|
+
`Agent recompilation failed: ${getErrorMessage(error)}`,
|
|
1132
|
+
INCOMPLETE_WORK_RECOVERY.RECOMPILE
|
|
1133
|
+
);
|
|
1093
1134
|
this.log(`You can manually recompile with '${CLI_INVOKE_COMMAND} compile'.`);
|
|
1094
1135
|
}
|
|
1095
1136
|
this.reportPropagatedRecompile(configResult.propagation);
|
|
1096
1137
|
}
|
|
1097
|
-
async cleanupStaleAgentFiles(changes, oldAgents,
|
|
1098
|
-
for (const removal of planStaleAgentRemovals(changes, oldAgents,
|
|
1138
|
+
async cleanupStaleAgentFiles(changes, oldAgents, editRoot) {
|
|
1139
|
+
for (const removal of planStaleAgentRemovals(changes, oldAgents, editRoot.dir)) {
|
|
1099
1140
|
const { failed } = await removeCompiledAgents(removal);
|
|
1100
1141
|
for (const { name, error } of failed) {
|
|
1101
1142
|
const agentPath = path.join(removal.agentsDir, `${name}.md`);
|
|
1102
|
-
this.
|
|
1143
|
+
this.reportIncompleteWork(
|
|
1144
|
+
`Could not remove agent file ${agentPath}: ${error}`,
|
|
1145
|
+
INCOMPLETE_WORK_RECOVERY.DELETE_AGENT_FILE
|
|
1146
|
+
);
|
|
1103
1147
|
}
|
|
1104
1148
|
}
|
|
1105
1149
|
}
|
|
1106
1150
|
logCompletionSummary(_changes) {
|
|
1151
|
+
if (this.hasIncompleteWork) return;
|
|
1107
1152
|
this.log(`
|
|
1108
1153
|
${chalk.hex(CLI_COLORS.SUCCESS)("\u2713 Done")}
|
|
1109
1154
|
`);
|
|
@@ -1183,7 +1228,7 @@ var UNRECORDED_AGENT_SCOPE = "project";
|
|
|
1183
1228
|
function installedScope(name, oldAgents) {
|
|
1184
1229
|
return oldAgents.find((agent) => agent.name === name)?.scope ?? UNRECORDED_AGENT_SCOPE;
|
|
1185
1230
|
}
|
|
1186
|
-
function planStaleAgentRemovals(changes, oldAgents,
|
|
1231
|
+
function planStaleAgentRemovals(changes, oldAgents, editRoot) {
|
|
1187
1232
|
const supersededByGlobal = [...changes.agentScopeChanges].filter(([, change]) => change.from !== "global").map(([name]) => ({ name, scope: "project" }));
|
|
1188
1233
|
const deselected = changes.removedAgents.map((name) => ({
|
|
1189
1234
|
name,
|
|
@@ -1191,7 +1236,7 @@ function planStaleAgentRemovals(changes, oldAgents, cwd) {
|
|
|
1191
1236
|
}));
|
|
1192
1237
|
const stale = [...supersededByGlobal, ...deselected];
|
|
1193
1238
|
const removalAtScope = (scope) => ({
|
|
1194
|
-
agentsDir: resolveInstallPaths(
|
|
1239
|
+
agentsDir: resolveInstallPaths(editRoot, scope).agentsDir,
|
|
1195
1240
|
agents: stale.filter((agent) => agent.scope === scope).map((agent) => agent.name)
|
|
1196
1241
|
});
|
|
1197
1242
|
return STALE_AGENT_SCOPES.map(removalAtScope).filter((removal) => removal.agents.length > 0);
|