agents-inc 0.164.0 → 0.165.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 +48 -0
- package/README.md +8 -9
- package/dist/{chunk-B6FSLXYN.js → chunk-42TNV2TK.js} +3 -3
- package/dist/chunk-4AAOOAIN.js +49 -0
- package/dist/chunk-4AAOOAIN.js.map +1 -0
- package/dist/{chunk-NQXO4LR3.js → chunk-4C7GL4F7.js} +16 -11
- package/dist/chunk-4C7GL4F7.js.map +1 -0
- package/dist/{chunk-Q4IRRVXK.js → chunk-57KU6SPH.js} +3 -3
- package/dist/{chunk-S63LXWMC.js → chunk-5M3PQNXI.js} +2 -2
- package/dist/{chunk-3WVH2CTK.js → chunk-5P26XBZO.js} +15 -8
- package/dist/chunk-5P26XBZO.js.map +1 -0
- package/dist/{chunk-G2JJ5BO5.js → chunk-6AIZPSEI.js} +337 -140
- package/dist/chunk-6AIZPSEI.js.map +1 -0
- package/dist/{chunk-NKGYKOB7.js → chunk-6CY6PW5X.js} +7 -8
- package/dist/chunk-6CY6PW5X.js.map +1 -0
- package/dist/{chunk-XHPWTL4I.js → chunk-6SW6SB7H.js} +3 -3
- package/dist/chunk-AAWZED5M.js +980 -0
- package/dist/chunk-AAWZED5M.js.map +1 -0
- package/dist/{chunk-UITEKY2R.js → chunk-AQXKAPCD.js} +30 -4
- package/dist/chunk-AQXKAPCD.js.map +1 -0
- package/dist/{chunk-X4SSJZLY.js → chunk-B5UUHBAM.js} +12 -261
- package/dist/chunk-B5UUHBAM.js.map +1 -0
- package/dist/{chunk-ARYNOWKF.js → chunk-BGU25XAY.js} +8 -8
- package/dist/{chunk-QGUP3QJF.js → chunk-CBMAO6OP.js} +22 -18
- package/dist/{chunk-QGUP3QJF.js.map → chunk-CBMAO6OP.js.map} +1 -1
- package/dist/{chunk-YRS3QZP2.js → chunk-CEBDGZID.js} +3 -3
- package/dist/{chunk-ABAZMMG4.js → chunk-CK5RM3DJ.js} +2 -2
- package/dist/{chunk-PHCPUQVR.js → chunk-CTUJO23Z.js} +2 -2
- package/dist/{chunk-QZX7SYKU.js → chunk-E6CHHXGY.js} +2 -2
- package/dist/{chunk-ZVXGW2IC.js → chunk-F2ZWFWTP.js} +4 -6
- package/dist/chunk-F2ZWFWTP.js.map +1 -0
- package/dist/{chunk-AVK2HEKB.js → chunk-GKPW33FP.js} +2 -6
- package/dist/{chunk-AVK2HEKB.js.map → chunk-GKPW33FP.js.map} +1 -1
- package/dist/{chunk-ECURHW3T.js → chunk-HR4YDSJK.js} +13 -12
- package/dist/chunk-HR4YDSJK.js.map +1 -0
- package/dist/{chunk-XPDVAJDH.js → chunk-IM45LLQX.js} +3599 -1558
- package/dist/chunk-IM45LLQX.js.map +1 -0
- package/dist/chunk-IVNKU4DM.js +39 -0
- package/dist/chunk-IVNKU4DM.js.map +1 -0
- package/dist/{chunk-XVAQG2CV.js → chunk-JOEA52NR.js} +10 -8
- package/dist/chunk-JOEA52NR.js.map +1 -0
- package/dist/{chunk-RGYDFBCT.js → chunk-JV4TKXEN.js} +5 -5
- package/dist/{chunk-4VL3CEOS.js → chunk-LXXGZAD3.js} +3 -3
- package/dist/chunk-MBUGQI2M.js +73 -0
- package/dist/chunk-MBUGQI2M.js.map +1 -0
- package/dist/{chunk-URXIQE7I.js → chunk-MWDY76MT.js} +2 -2
- package/dist/{chunk-V5GLL2JB.js → chunk-P3KJCYSR.js} +7 -7
- package/dist/{chunk-6MV4JOCL.js → chunk-PSX7CT6V.js} +2 -2
- package/dist/{chunk-B3Y3QMWI.js → chunk-TRTVOVHR.js} +4 -4
- package/dist/{chunk-AOTCIUGX.js → chunk-TV5Y53R2.js} +2 -2
- package/dist/{chunk-K5ITEA3I.js → chunk-UBSSIIWD.js} +34 -17
- package/dist/chunk-UBSSIIWD.js.map +1 -0
- package/dist/chunk-UCORXS4D.js +250 -0
- package/dist/chunk-UCORXS4D.js.map +1 -0
- package/dist/chunk-UR3RRTPO.js +159 -0
- package/dist/chunk-UR3RRTPO.js.map +1 -0
- package/dist/chunk-V5CWACR5.js +375 -0
- package/dist/chunk-V5CWACR5.js.map +1 -0
- package/dist/{chunk-LT5GXEB2.js → chunk-VPJUCVU7.js} +8 -7
- package/dist/chunk-VPJUCVU7.js.map +1 -0
- package/dist/chunk-VRXX4D6K.js +31 -0
- package/dist/chunk-VRXX4D6K.js.map +1 -0
- package/dist/{chunk-2CQNPLVF.js → chunk-WIFIAQZU.js} +63 -42
- package/dist/chunk-WIFIAQZU.js.map +1 -0
- package/dist/chunk-WSGX4IWC.js +356 -0
- package/dist/chunk-WSGX4IWC.js.map +1 -0
- package/dist/{chunk-X37UYIE3.js → chunk-WTANOSXK.js} +436 -739
- package/dist/chunk-WTANOSXK.js.map +1 -0
- package/dist/{chunk-XATLUKXK.js → chunk-X2KUI7V3.js} +6 -6
- package/dist/{chunk-NTF4UXGK.js → chunk-XATIKM3P.js} +73 -30
- package/dist/chunk-XATIKM3P.js.map +1 -0
- package/dist/{chunk-J27W6TXS.js → chunk-XQHZPINL.js} +8 -4
- package/dist/chunk-XQHZPINL.js.map +1 -0
- package/dist/{chunk-DSL66I4N.js → chunk-Y5SNGMB7.js} +6 -6
- package/dist/{chunk-7REKOTKG.js → chunk-YNOOZFIB.js} +3 -3
- package/dist/commands/build/marketplace.js +17 -17
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +11 -9
- package/dist/commands/build/plugins.js.map +1 -1
- package/dist/commands/compile.js +106 -27
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +427 -192
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +504 -314
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +41 -23
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +44 -40
- package/dist/commands/list.js +44 -10
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +13 -10
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/search.js +12 -10
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +103 -15
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +264 -106
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +50 -20
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/prompt-confirm.js +1 -1
- package/dist/components/common/removal-plan-confirm.js +2 -2
- package/dist/components/common/select-list.js +3 -3
- package/dist/components/common/spinner.js +6 -3
- package/dist/components/wizard/category-grid.js +5 -5
- package/dist/components/wizard/checkbox-grid.js +4 -4
- package/dist/components/wizard/domain-selection.js +9 -9
- package/dist/components/wizard/run-wizard-session.js +29 -29
- package/dist/components/wizard/scroll-affordance.js +2 -2
- package/dist/components/wizard/skill-agent-summary.js +5 -5
- package/dist/components/wizard/source-grid.js +6 -6
- package/dist/components/wizard/stack-selection.js +8 -8
- package/dist/components/wizard/step-agents.js +8 -8
- package/dist/components/wizard/step-build.js +8 -8
- package/dist/components/wizard/step-confirm.js +9 -9
- package/dist/components/wizard/step-sources.js +9 -9
- package/dist/components/wizard/step-stack.js +9 -9
- package/dist/components/wizard/summary-panel.js +8 -8
- package/dist/components/wizard/toast.js +2 -2
- package/dist/components/wizard/wizard-layout.js +12 -12
- package/dist/components/wizard/wizard-tabs.js +2 -2
- package/dist/components/wizard/wizard.js +27 -27
- package/dist/hooks/init.js +59 -43
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-JHLE6MAE.js +14 -0
- package/dist/recompile-project-agents-ZPP5NOLZ.js +18 -0
- package/dist/{source-loader-GRBVNRAW.js → source-loader-RWZAYJ7E.js} +6 -4
- package/dist/src/agents/_templates/agent-body.liquid +55 -0
- package/dist/src/agents/_templates/agent.liquid +1 -55
- package/dist/src/agents/meta/agent-summoner/output.md +1 -1
- package/dist/src/agents/meta/agent-summoner/playbook.md +15 -7
- package/dist/stores/wizard-store.js +4 -4
- package/package.json +10 -9
- package/src/agents/_templates/agent-body.liquid +55 -0
- package/src/agents/_templates/agent.liquid +1 -55
- package/src/agents/meta/agent-summoner/output.md +1 -1
- package/src/agents/meta/agent-summoner/playbook.md +15 -7
- package/src/schemas/project-config.schema.json +1 -1
- package/src/schemas/project-source-config.schema.json +1 -1
- package/dist/chunk-2CQNPLVF.js.map +0 -1
- package/dist/chunk-3WVH2CTK.js.map +0 -1
- package/dist/chunk-7ANJQLPJ.js +0 -35
- package/dist/chunk-7ANJQLPJ.js.map +0 -1
- package/dist/chunk-ECURHW3T.js.map +0 -1
- package/dist/chunk-FLW25ORT.js +0 -130
- package/dist/chunk-FLW25ORT.js.map +0 -1
- package/dist/chunk-G2JJ5BO5.js.map +0 -1
- package/dist/chunk-J27W6TXS.js.map +0 -1
- package/dist/chunk-JCPANDNR.js +0 -35
- package/dist/chunk-JCPANDNR.js.map +0 -1
- package/dist/chunk-JIERYE6B.js +0 -480
- package/dist/chunk-JIERYE6B.js.map +0 -1
- package/dist/chunk-JU4ZGJ7A.js +0 -668
- package/dist/chunk-JU4ZGJ7A.js.map +0 -1
- package/dist/chunk-K5ITEA3I.js.map +0 -1
- package/dist/chunk-LT5GXEB2.js.map +0 -1
- package/dist/chunk-NKGYKOB7.js.map +0 -1
- package/dist/chunk-NQXO4LR3.js.map +0 -1
- package/dist/chunk-NTF4UXGK.js.map +0 -1
- package/dist/chunk-UITEKY2R.js.map +0 -1
- package/dist/chunk-X37UYIE3.js.map +0 -1
- package/dist/chunk-X4SSJZLY.js.map +0 -1
- package/dist/chunk-XPDVAJDH.js.map +0 -1
- package/dist/chunk-XVAQG2CV.js.map +0 -1
- package/dist/chunk-ZBPEFQ4G.js +0 -12
- package/dist/chunk-ZBPEFQ4G.js.map +0 -1
- package/dist/chunk-ZVXGW2IC.js.map +0 -1
- package/dist/load-agent-defs-7IM3GBEQ.js +0 -13
- package/dist/recompile-project-agents-VR4NLGOU.js +0 -17
- /package/dist/{chunk-B6FSLXYN.js.map → chunk-42TNV2TK.js.map} +0 -0
- /package/dist/{chunk-Q4IRRVXK.js.map → chunk-57KU6SPH.js.map} +0 -0
- /package/dist/{chunk-S63LXWMC.js.map → chunk-5M3PQNXI.js.map} +0 -0
- /package/dist/{chunk-XHPWTL4I.js.map → chunk-6SW6SB7H.js.map} +0 -0
- /package/dist/{chunk-ARYNOWKF.js.map → chunk-BGU25XAY.js.map} +0 -0
- /package/dist/{chunk-YRS3QZP2.js.map → chunk-CEBDGZID.js.map} +0 -0
- /package/dist/{chunk-ABAZMMG4.js.map → chunk-CK5RM3DJ.js.map} +0 -0
- /package/dist/{chunk-PHCPUQVR.js.map → chunk-CTUJO23Z.js.map} +0 -0
- /package/dist/{chunk-QZX7SYKU.js.map → chunk-E6CHHXGY.js.map} +0 -0
- /package/dist/{chunk-RGYDFBCT.js.map → chunk-JV4TKXEN.js.map} +0 -0
- /package/dist/{chunk-4VL3CEOS.js.map → chunk-LXXGZAD3.js.map} +0 -0
- /package/dist/{chunk-URXIQE7I.js.map → chunk-MWDY76MT.js.map} +0 -0
- /package/dist/{chunk-V5GLL2JB.js.map → chunk-P3KJCYSR.js.map} +0 -0
- /package/dist/{chunk-6MV4JOCL.js.map → chunk-PSX7CT6V.js.map} +0 -0
- /package/dist/{chunk-B3Y3QMWI.js.map → chunk-TRTVOVHR.js.map} +0 -0
- /package/dist/{chunk-AOTCIUGX.js.map → chunk-TV5Y53R2.js.map} +0 -0
- /package/dist/{chunk-XATLUKXK.js.map → chunk-X2KUI7V3.js.map} +0 -0
- /package/dist/{chunk-DSL66I4N.js.map → chunk-Y5SNGMB7.js.map} +0 -0
- /package/dist/{chunk-7REKOTKG.js.map → chunk-YNOOZFIB.js.map} +0 -0
- /package/dist/{load-agent-defs-7IM3GBEQ.js.map → load-agent-defs-JHLE6MAE.js.map} +0 -0
- /package/dist/{recompile-project-agents-VR4NLGOU.js.map → recompile-project-agents-ZPP5NOLZ.js.map} +0 -0
- /package/dist/{source-loader-GRBVNRAW.js.map → source-loader-RWZAYJ7E.js.map} +0 -0
|
@@ -1,93 +1,126 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
SelectList
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YNOOZFIB.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
holdInstalledGlobal,
|
|
7
|
+
installPlanLines,
|
|
8
|
+
notInstalledGlobally,
|
|
9
|
+
openUrl,
|
|
10
|
+
readInstalledGlobal
|
|
11
|
+
} from "./chunk-WSGX4IWC.js";
|
|
8
12
|
import {
|
|
9
13
|
runWizardSession
|
|
10
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JV4TKXEN.js";
|
|
11
15
|
import {
|
|
12
16
|
useTerminalDimensions
|
|
13
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BGU25XAY.js";
|
|
14
18
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
awaitUnderSpinner
|
|
20
|
+
} from "./chunk-VRXX4D6K.js";
|
|
17
21
|
import {
|
|
18
|
-
fetchSeedConfig
|
|
19
|
-
|
|
20
|
-
writeExternalSkills
|
|
21
|
-
} from "./chunk-X4SSJZLY.js";
|
|
22
|
+
fetchSeedConfig
|
|
23
|
+
} from "./chunk-B5UUHBAM.js";
|
|
22
24
|
import {
|
|
25
|
+
promptConfirm,
|
|
23
26
|
promptValue
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4AAOOAIN.js";
|
|
28
|
+
import {
|
|
29
|
+
Confirm
|
|
30
|
+
} from "./chunk-OZXAJNLA.js";
|
|
31
|
+
import {
|
|
32
|
+
hostCompileNotices
|
|
33
|
+
} from "./chunk-UCORXS4D.js";
|
|
25
34
|
import {
|
|
26
35
|
compileAgentsAllScopes,
|
|
36
|
+
compileProjectScope,
|
|
27
37
|
loadSource,
|
|
38
|
+
movedGlobalAgentInputs,
|
|
39
|
+
sayCapturedWarnings,
|
|
28
40
|
writeProjectConfig
|
|
29
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-WTANOSXK.js";
|
|
30
42
|
import {
|
|
31
43
|
copyLocalSkills,
|
|
32
44
|
discoverInstalledSkills
|
|
33
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-WIFIAQZU.js";
|
|
34
46
|
import {
|
|
35
47
|
loadAgentDefs
|
|
36
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-42TNV2TK.js";
|
|
37
49
|
import {
|
|
38
50
|
render
|
|
39
51
|
} from "./chunk-JFLVEFFP.js";
|
|
52
|
+
import {
|
|
53
|
+
providerFlag,
|
|
54
|
+
providerNamedBy,
|
|
55
|
+
providerNeedsAConfigurationToInstall
|
|
56
|
+
} from "./chunk-MBUGQI2M.js";
|
|
40
57
|
import {
|
|
41
58
|
BaseCommand,
|
|
42
|
-
EXIT_CODES
|
|
43
|
-
|
|
59
|
+
EXIT_CODES,
|
|
60
|
+
registerExternalSkills,
|
|
61
|
+
writeExternalSkills
|
|
62
|
+
} from "./chunk-AAWZED5M.js";
|
|
44
63
|
import {
|
|
45
64
|
clearTerminalScreen
|
|
46
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-CTUJO23Z.js";
|
|
47
66
|
import {
|
|
48
67
|
INCOMPLETE_WORK_RECOVERY,
|
|
49
68
|
INSTALL_MODE_DESCRIPTIONS,
|
|
50
69
|
INSTALL_MODE_LABELS,
|
|
70
|
+
SHARED_CONFIG_ARRIVALS,
|
|
51
71
|
STATUS_MESSAGES,
|
|
72
|
+
advisesOnPermissions,
|
|
73
|
+
agentCodec,
|
|
52
74
|
agentsNotCompiled,
|
|
75
|
+
applySharedConfigHere,
|
|
53
76
|
buildAgentScopeMap,
|
|
54
77
|
carriedSkillsWritten,
|
|
78
|
+
chooseProviderForThisRun,
|
|
55
79
|
deriveInstallMode,
|
|
56
|
-
detectGlobalInstallation,
|
|
57
80
|
detectInstallation,
|
|
58
81
|
detectProjectInstallation,
|
|
82
|
+
editorLoadsItsOwnMarketplace,
|
|
59
83
|
fileExists,
|
|
60
84
|
getErrorMessage,
|
|
61
85
|
getInstallationInfo,
|
|
62
86
|
globalScopedAgentsHint,
|
|
87
|
+
holdsItsOwnInstallation,
|
|
88
|
+
hostAt,
|
|
63
89
|
initSucceeded,
|
|
90
|
+
installBaseDir,
|
|
64
91
|
isHomeDirectory,
|
|
92
|
+
isSameMarketplace,
|
|
93
|
+
keptAsInstalledGlobally,
|
|
65
94
|
loadProjectConfig,
|
|
95
|
+
marketplaceFixedAtInstall,
|
|
96
|
+
permissionFiles,
|
|
97
|
+
plural,
|
|
98
|
+
providerInUse,
|
|
66
99
|
readFileSafe,
|
|
100
|
+
relativeConfigPath,
|
|
67
101
|
resolveBranding,
|
|
68
102
|
resolveInstallPaths,
|
|
103
|
+
resolveSource,
|
|
69
104
|
seedToWizardResult,
|
|
70
105
|
settingsFileSchema,
|
|
71
106
|
sharedConfigExistingInstall,
|
|
72
|
-
sharedConfigGlobalInstall,
|
|
73
107
|
skippedUnknownAgents,
|
|
74
108
|
skippedUnknownSkills,
|
|
75
|
-
warn
|
|
76
|
-
|
|
109
|
+
warn,
|
|
110
|
+
wizardNeedsTerminal
|
|
111
|
+
} from "./chunk-IM45LLQX.js";
|
|
77
112
|
import {
|
|
78
113
|
ASCII_LOGO,
|
|
79
|
-
CLAUDE_DIR,
|
|
80
|
-
CLAUDE_SRC_DIR,
|
|
81
114
|
CLI_COLORS,
|
|
82
115
|
CLI_INVOKE_COMMAND,
|
|
83
116
|
DEFAULT_BRANDING,
|
|
84
117
|
EDITOR_URL,
|
|
85
118
|
EDIT_PROJECT_SETUP_FLAG,
|
|
119
|
+
EDIT_PROJECT_SETUP_MARKETPLACE_FLAG,
|
|
86
120
|
EJECT_SOURCE,
|
|
87
121
|
MAX_CONFIG_FILE_SIZE,
|
|
88
|
-
STANDARD_FILES,
|
|
89
122
|
editorConfigUrl
|
|
90
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-AQXKAPCD.js";
|
|
91
124
|
|
|
92
125
|
// src/cli/commands/init.tsx
|
|
93
126
|
import "react";
|
|
@@ -113,24 +146,40 @@ async function readSettingsPermissions(filePath) {
|
|
|
113
146
|
return void 0;
|
|
114
147
|
}
|
|
115
148
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
149
|
+
function settingsFilesFor(projectRoot) {
|
|
150
|
+
return permissionFiles(providerInUse(projectRoot), "project", projectRoot);
|
|
151
|
+
}
|
|
152
|
+
async function loadPermissions(files) {
|
|
153
|
+
for (const filePath of [...files].reverse()) {
|
|
120
154
|
const permissions = await readSettingsPermissions(filePath);
|
|
121
155
|
if (permissions) return permissions;
|
|
122
156
|
}
|
|
123
157
|
return void 0;
|
|
124
158
|
}
|
|
159
|
+
function asUserWritesIt(projectRoot, file) {
|
|
160
|
+
return path.relative(projectRoot, file).split(path.sep).join("/");
|
|
161
|
+
}
|
|
125
162
|
async function checkPermissions(projectRoot) {
|
|
126
|
-
|
|
163
|
+
if (!advisesOnPermissions(providerInUse(projectRoot))) return null;
|
|
164
|
+
const files = settingsFilesFor(projectRoot);
|
|
165
|
+
const [base] = files;
|
|
166
|
+
if (base === void 0) return null;
|
|
167
|
+
const permissions = await loadPermissions(files);
|
|
168
|
+
const settingsFile = asUserWritesIt(projectRoot, base);
|
|
127
169
|
if (!permissions) {
|
|
128
170
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: CLI_COLORS.WARNING, padding: 1, children: [
|
|
129
171
|
/* @__PURE__ */ jsx(Text, { bold: true, color: CLI_COLORS.WARNING, children: "Permission Notice" }),
|
|
130
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
173
|
+
"No permissions configured in ",
|
|
174
|
+
settingsFile
|
|
175
|
+
] }),
|
|
131
176
|
/* @__PURE__ */ jsx(Text, { children: "Agents will prompt for approval on each tool use." }),
|
|
132
177
|
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
133
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
179
|
+
"For autonomous operation, add to ",
|
|
180
|
+
settingsFile,
|
|
181
|
+
":"
|
|
182
|
+
] }),
|
|
134
183
|
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
135
184
|
/* @__PURE__ */ jsx(Text, { color: CLI_COLORS.DIM, children: "{" }),
|
|
136
185
|
/* @__PURE__ */ jsx(Text, { color: CLI_COLORS.DIM, children: ' "permissions": {' }),
|
|
@@ -208,6 +257,7 @@ function formatDashboardText(data) {
|
|
|
208
257
|
` [Edit] [Compile] [Doctor] [List]`
|
|
209
258
|
].join("\n");
|
|
210
259
|
}
|
|
260
|
+
var DASHBOARD_INTERRUPTED = "interrupted";
|
|
211
261
|
async function showDashboard(projectDir, log) {
|
|
212
262
|
const data = await getDashboardData(projectDir);
|
|
213
263
|
if (!process.stdin.isTTY) {
|
|
@@ -224,26 +274,28 @@ async function showDashboard(projectDir, log) {
|
|
|
224
274
|
onCancel: () => resolve(null)
|
|
225
275
|
}
|
|
226
276
|
),
|
|
227
|
-
{ onExit:
|
|
277
|
+
{ onExit: DASHBOARD_INTERRUPTED, clearOnResolve: true }
|
|
228
278
|
);
|
|
229
279
|
clearTerminalScreen();
|
|
230
280
|
return selectedCommand;
|
|
231
281
|
}
|
|
232
|
-
function dashboardCommandArgv(command, origin) {
|
|
282
|
+
function dashboardCommandArgv(command, origin, setupMarketplace) {
|
|
233
283
|
if (command !== "edit" || origin !== "init") return [];
|
|
234
|
-
|
|
284
|
+
const marketplaceArgv = setupMarketplace === void 0 ? [] : [`--${EDIT_PROJECT_SETUP_MARKETPLACE_FLAG}`, setupMarketplace];
|
|
285
|
+
return [`--${EDIT_PROJECT_SETUP_FLAG}`, ...marketplaceArgv];
|
|
235
286
|
}
|
|
236
|
-
async function runDashboardFlow(projectDir, config, origin, log) {
|
|
287
|
+
async function runDashboardFlow(projectDir, config, origin, log, setupMarketplace) {
|
|
237
288
|
const installation = await detectInstallation(projectDir);
|
|
238
|
-
if (!installation) return
|
|
289
|
+
if (!installation) return "not-installed";
|
|
239
290
|
const selectedCommand = await showDashboard(projectDir, log);
|
|
291
|
+
if (selectedCommand === DASHBOARD_INTERRUPTED) return "cancelled";
|
|
240
292
|
if (selectedCommand) {
|
|
241
|
-
await config.runCommand(
|
|
293
|
+
await config.runCommand(
|
|
294
|
+
selectedCommand,
|
|
295
|
+
dashboardCommandArgv(selectedCommand, origin, setupMarketplace)
|
|
296
|
+
);
|
|
242
297
|
}
|
|
243
|
-
return
|
|
244
|
-
}
|
|
245
|
-
function writesGlobalContent(result) {
|
|
246
|
-
return result.skills.some((skill) => skill.scope === "global") || result.agentConfigs.some((agent) => agent.scope === "global");
|
|
298
|
+
return "shown";
|
|
247
299
|
}
|
|
248
300
|
function sharedConfigSourceFlags(flags, payload) {
|
|
249
301
|
return { marketplace: flags.marketplace ?? payload.marketplace };
|
|
@@ -281,7 +333,8 @@ var Init = class _Init extends BaseCommand {
|
|
|
281
333
|
ui: Flags.boolean({
|
|
282
334
|
description: "Open agentsinc.sh/editor instead of the terminal \u2014 the id --from names, or the catalogue",
|
|
283
335
|
default: false
|
|
284
|
-
})
|
|
336
|
+
}),
|
|
337
|
+
provider: providerFlag()
|
|
285
338
|
};
|
|
286
339
|
/**
|
|
287
340
|
* The command in two statements: do the work, then answer for it.
|
|
@@ -314,97 +367,124 @@ var Init = class _Init extends BaseCommand {
|
|
|
314
367
|
* loss, so opening one is the convenience on top and a failure to open is a warning beside a
|
|
315
368
|
* link that still works.
|
|
316
369
|
*/
|
|
317
|
-
async openEditor(id) {
|
|
370
|
+
async openEditor(id, projectDir) {
|
|
318
371
|
const url = id === void 0 ? EDITOR_URL : editorConfigUrl(id);
|
|
319
372
|
this.log(id === void 0 ? `Build it at ${url}` : `Open it at ${url}`);
|
|
320
|
-
|
|
321
|
-
this.log(`Then install what it gives you with '${CLI_INVOKE_COMMAND} init --from <id>'.`);
|
|
322
|
-
} else {
|
|
323
|
-
this.log(`To install it here instead, run '${CLI_INVOKE_COMMAND} init --from ${id}'.`);
|
|
324
|
-
}
|
|
373
|
+
this.log(applySharedConfigHere(id, await holdsItsOwnInstallation(projectDir)));
|
|
325
374
|
if (!process.stdin.isTTY) return;
|
|
326
375
|
const opened = await openUrl(url);
|
|
327
376
|
if (!opened.ok) this.warn(opened.error);
|
|
328
377
|
}
|
|
329
378
|
/**
|
|
330
379
|
* One spine, two producers. The wizard and a shared id differ only in *where the selection
|
|
331
|
-
* comes from* — everything after it (the
|
|
332
|
-
*
|
|
380
|
+
* comes from* — everything after it (the install pipeline) is identical, so it lives here once
|
|
381
|
+
* rather than being written twice and drifting. What each producer refuses, it refuses itself:
|
|
382
|
+
* `--from` asks a question the wizard does not, and every refusal it makes comes before it.
|
|
333
383
|
*/
|
|
334
384
|
async install() {
|
|
335
385
|
const { flags } = await this.parse(_Init);
|
|
336
386
|
const projectDir = process.cwd();
|
|
337
|
-
|
|
387
|
+
this.settleTheProviderForThisRun(flags);
|
|
388
|
+
if (flags.ui) {
|
|
389
|
+
this.refuseMarketplaceForTheEditor(flags.marketplace);
|
|
390
|
+
return this.openEditor(flags.from, projectDir);
|
|
391
|
+
}
|
|
338
392
|
await this.ensureConfigReadable(projectDir);
|
|
393
|
+
await this.settleSourceLayoutBeforeWriting(projectDir);
|
|
339
394
|
this.brandingName = await this.resolveBrandingName(projectDir);
|
|
340
|
-
if (!flags.from
|
|
395
|
+
if (!flags.from) {
|
|
396
|
+
await this.refuseMarketplaceOtherThanTheInstalledOne(projectDir, flags.marketplace);
|
|
397
|
+
const dashboard = await this.showDashboardIfInitialized(projectDir, flags.marketplace);
|
|
398
|
+
if (dashboard === "cancelled") this.error("Cancelled", { exit: EXIT_CODES.CANCELLED });
|
|
399
|
+
if (dashboard === "shown") return;
|
|
400
|
+
}
|
|
341
401
|
const selection = flags.from ? await this.selectionFromSharedConfig(flags.from, flags, projectDir) : await this.selectionFromWizard(flags, projectDir);
|
|
342
402
|
if (!selection) this.exit(EXIT_CODES.CANCELLED);
|
|
343
403
|
this.reportValidationErrors(selection.result.validation);
|
|
344
|
-
if (selection.result.skills.length === 0 && selection.result.selectedAgents.length === 0) {
|
|
345
|
-
this.error(selection.emptyMessage, { exit: EXIT_CODES.ERROR });
|
|
346
|
-
}
|
|
347
404
|
await this.handleInstallation(
|
|
348
405
|
selection.result,
|
|
349
406
|
selection.sourceResult,
|
|
350
407
|
selection.sourceFlags,
|
|
351
|
-
selection.interactive
|
|
408
|
+
selection.interactive,
|
|
409
|
+
selection.installedAlready
|
|
352
410
|
);
|
|
353
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* Commits this run to the provider `--provider` named, or refuses a flag with nothing to name.
|
|
414
|
+
*
|
|
415
|
+
* **`--provider` is a LOCATION parameter, not a feature switch**, and the control that proves it
|
|
416
|
+
* is `--provider claude`: naming the default out loud installs byte-for-byte what no flag
|
|
417
|
+
* installs, because all the flag decides is which folder this run creates. Without that half
|
|
418
|
+
* "the flag selects an installation" would be indistinguishable from "the flag means Codex".
|
|
419
|
+
*
|
|
420
|
+
* **And it is meaningless without `--from` (D15).** The provider is chosen in the web app, so
|
|
421
|
+
* the only run that can be told one is the run that installs what the app produced. There is no
|
|
422
|
+
* wizard step to choose a provider in and none is planned — which is what makes "the interactive
|
|
423
|
+
* flow is Claude-only" provable rather than conventional. It also gives the placement refusal
|
|
424
|
+
* something to refuse BEFORE anything is written: with `--from` required, a provider always
|
|
425
|
+
* arrives beside a payload the pre-flight can read.
|
|
426
|
+
*/
|
|
427
|
+
settleTheProviderForThisRun(flags) {
|
|
428
|
+
const named = providerNamedBy(flags.provider);
|
|
429
|
+
if (named === void 0) return;
|
|
430
|
+
if (flags.from === void 0) {
|
|
431
|
+
this.error(providerNeedsAConfigurationToInstall(), { exit: EXIT_CODES.INVALID_ARGS });
|
|
432
|
+
}
|
|
433
|
+
chooseProviderForThisRun(named);
|
|
434
|
+
}
|
|
354
435
|
/** The interactive producer: load the source, run the wizard, return what was chosen. */
|
|
355
436
|
async selectionFromWizard(flags, projectDir) {
|
|
356
437
|
const isGlobalRoot = isHomeDirectory(projectDir);
|
|
357
438
|
const { sourceResult, startupMessages } = await this.loadWizardInputsUnderSpinner(flags);
|
|
439
|
+
if (!process.stdin.isTTY) {
|
|
440
|
+
this.error(wizardNeedsTerminal("init"), { exit: EXIT_CODES.ERROR });
|
|
441
|
+
}
|
|
358
442
|
const result = await this.runWizard(startupMessages, isGlobalRoot);
|
|
359
443
|
if (!result) return null;
|
|
444
|
+
if (selectsNothing(result)) this.error("No skills selected", { exit: EXIT_CODES.ERROR });
|
|
360
445
|
return {
|
|
361
446
|
result,
|
|
362
447
|
sourceResult,
|
|
363
448
|
sourceFlags: flags,
|
|
364
449
|
// A person is already at the terminal, so the permission notice can wait for them.
|
|
365
450
|
interactive: true,
|
|
366
|
-
|
|
451
|
+
// The wizard opens only where nothing is installed at all — see `runWizard`.
|
|
452
|
+
installedAlready: /* @__PURE__ */ new Set()
|
|
367
453
|
};
|
|
368
454
|
}
|
|
369
455
|
/**
|
|
370
456
|
* Everything the wizard needs, loaded behind a spinner that comes down whichever way the
|
|
371
|
-
* await ends.
|
|
372
|
-
*
|
|
373
|
-
* The cleanup is a `finally` because a source that cannot be loaded refuses the run from
|
|
374
|
-
* inside this await, and oclif would otherwise paint its error under an Ink tree still
|
|
375
|
-
* repainting over it. Never a `catch`: the throw reaches oclif untouched, or both the
|
|
376
|
-
* error rendering and the exit code change with it.
|
|
457
|
+
* await ends — a source that cannot be loaded refuses the run from inside it.
|
|
377
458
|
*/
|
|
378
459
|
async loadWizardInputsUnderSpinner(flags) {
|
|
379
|
-
|
|
380
|
-
/* @__PURE__ */ jsx2(Spinner, { label: STATUS_MESSAGES.LOADING_SKILLS })
|
|
381
|
-
);
|
|
382
|
-
try {
|
|
383
|
-
return await this.loadSourceOrFail(flags);
|
|
384
|
-
} finally {
|
|
385
|
-
clearSpinner();
|
|
386
|
-
unmount();
|
|
387
|
-
}
|
|
460
|
+
return awaitUnderSpinner(STATUS_MESSAGES.LOADING_SKILLS, () => this.loadSourceOrFail(flags));
|
|
388
461
|
}
|
|
389
462
|
/**
|
|
390
|
-
* The `--from <id>` producer: fetch and map, no wizard
|
|
391
|
-
*
|
|
463
|
+
* The `--from <id>` producer: fetch and map, no wizard — and, at a terminal, one question.
|
|
464
|
+
*
|
|
465
|
+
* It installs into a clean directory, which is what the first refusal is: a shared
|
|
466
|
+
* configuration is installed whole, so a directory already holding one has it applied with
|
|
467
|
+
* `edit --from` instead, or is uninstalled first. The second is about the LOCATION rather than what is already in it — a global
|
|
468
|
+
* installation holds only global-scoped content. Both fire before anything is written.
|
|
469
|
+
*
|
|
470
|
+
* A global installation ABOVE a project is not in the way. It is not this project's, so the run
|
|
471
|
+
* adds to it what it lacks and states every entry it already holds as installed (see
|
|
472
|
+
* `holdInstalledGlobal`).
|
|
392
473
|
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* asked. All three fire before anything is written.
|
|
474
|
+
* Before writing anything the run lists what goes into the project and what into the global
|
|
475
|
+
* install. At a terminal it then asks, and a no writes nothing. With no terminal — a CI job or a
|
|
476
|
+
* script — it prints the same lists and carries on: running headless is most of why the flag
|
|
477
|
+
* exists.
|
|
398
478
|
*/
|
|
399
479
|
async selectionFromSharedConfig(id, flags, projectDir) {
|
|
400
|
-
await this.refuseInstalledProject(projectDir);
|
|
480
|
+
await this.refuseInstalledProject(projectDir, id);
|
|
401
481
|
this.log(`Fetching configuration ${id}...`);
|
|
402
482
|
const fetched = await fetchSeedConfig(id);
|
|
403
483
|
if (!fetched.ok) {
|
|
404
484
|
this.error(fetched.error, { exit: EXIT_CODES.ERROR });
|
|
405
485
|
}
|
|
406
486
|
const sourceFlags = sharedConfigSourceFlags(flags, fetched.payload);
|
|
407
|
-
const { sourceResult } = await this.loadSourceOrFail(sourceFlags);
|
|
487
|
+
const { sourceResult, startupMessages } = await this.loadSourceOrFail(sourceFlags);
|
|
408
488
|
const carriedSkills = this.registerExternalSkillsOrFail(
|
|
409
489
|
fetched.payload,
|
|
410
490
|
sourceResult.matrix,
|
|
@@ -415,50 +495,87 @@ var Init = class _Init extends BaseCommand {
|
|
|
415
495
|
sourceResult.matrix
|
|
416
496
|
);
|
|
417
497
|
this.refuseProjectScopedContentAtHome(result, projectDir);
|
|
418
|
-
|
|
419
|
-
|
|
498
|
+
const held = holdInstalledGlobal(
|
|
499
|
+
result,
|
|
500
|
+
isHomeDirectory(projectDir) ? null : await readInstalledGlobal(projectDir)
|
|
501
|
+
);
|
|
502
|
+
const arrivingCarried = notInstalledGlobally(carriedSkills, held);
|
|
503
|
+
await this.refuseSharedConfigBeforeAsking(
|
|
504
|
+
held.result,
|
|
505
|
+
arrivingCarried,
|
|
506
|
+
projectDir,
|
|
507
|
+
sourceResult
|
|
508
|
+
);
|
|
509
|
+
sayCapturedWarnings(startupMessages);
|
|
420
510
|
if (skippedSkillIds.length > 0) this.warn(skippedUnknownSkills(skippedSkillIds));
|
|
421
511
|
if (skippedAgentNames.length > 0) this.warn(skippedUnknownAgents(skippedAgentNames));
|
|
422
|
-
if (result
|
|
512
|
+
if (selectsNothing(held.result)) {
|
|
513
|
+
this.error(`Configuration '${id}' contains no skills this catalog can install.`, {
|
|
514
|
+
exit: EXIT_CODES.ERROR
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
this.logWhatGoesWhere(held);
|
|
518
|
+
if (process.stdin.isTTY && !await this.confirmInstall()) {
|
|
519
|
+
this.log("Setup cancelled");
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
await this.writeCarriedSkills(arrivingCarried);
|
|
523
|
+
const arriving = notInstalledGlobally(held.result.skills, held);
|
|
524
|
+
if (arriving.length > 0) {
|
|
423
525
|
this.log(
|
|
424
|
-
`Installing ${
|
|
526
|
+
`Installing ${arriving.length} skill(s) across ${result.selectedAgents.length} sub-agent(s)
|
|
425
527
|
`
|
|
426
528
|
);
|
|
427
529
|
}
|
|
428
530
|
return {
|
|
429
|
-
result,
|
|
531
|
+
result: held.result,
|
|
430
532
|
sourceResult,
|
|
431
533
|
sourceFlags,
|
|
432
534
|
interactive: false,
|
|
433
|
-
|
|
535
|
+
installedAlready: new Set(held.installed.skillIds)
|
|
434
536
|
};
|
|
435
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* The two lists — what goes into this project, and what into the global install — then the
|
|
540
|
+
* global skills skipped as already installed, and the global entries the configuration states
|
|
541
|
+
* otherwise than they are installed, which stay.
|
|
542
|
+
*/
|
|
543
|
+
logWhatGoesWhere(held) {
|
|
544
|
+
for (const line of installPlanLines(held)) {
|
|
545
|
+
this.log(line);
|
|
546
|
+
}
|
|
547
|
+
const { skillIds, agentNames } = held.keptAsInstalled;
|
|
548
|
+
if (skillIds.length > 0 || agentNames.length > 0) {
|
|
549
|
+
this.log(keptAsInstalledGlobally(skillIds, agentNames));
|
|
550
|
+
}
|
|
551
|
+
this.log("");
|
|
552
|
+
}
|
|
553
|
+
/** The question under the lists, defaulting to no: nothing has been written yet. */
|
|
554
|
+
async confirmInstall() {
|
|
555
|
+
const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx2(
|
|
556
|
+
Confirm,
|
|
557
|
+
{
|
|
558
|
+
message: SHARED_CONFIG_ARRIVALS.INSTALL_CONFIRM,
|
|
559
|
+
onConfirm,
|
|
560
|
+
onCancel
|
|
561
|
+
}
|
|
562
|
+
));
|
|
563
|
+
return outcome === "confirmed";
|
|
564
|
+
}
|
|
436
565
|
/**
|
|
437
566
|
* Refuses to install a shared configuration into a directory that already has one.
|
|
438
567
|
*
|
|
439
568
|
* Project-scoped detection rather than `detectInstallation`, whose global fallback would refuse
|
|
440
|
-
* every clean project on a machine with a global install
|
|
441
|
-
*
|
|
442
|
-
* {@link refuseBlockingGlobalInstall} is where it is asked.
|
|
569
|
+
* every clean project on a machine with a global install. A global install above the project is
|
|
570
|
+
* added to rather than refused over — see {@link selectionFromSharedConfig}.
|
|
443
571
|
*
|
|
444
572
|
* This runs before the fetch: there is nothing to learn from the network about a directory that
|
|
445
573
|
* is already spoken for.
|
|
446
574
|
*/
|
|
447
|
-
async refuseInstalledProject(projectDir) {
|
|
575
|
+
async refuseInstalledProject(projectDir, id) {
|
|
448
576
|
const installation = await detectProjectInstallation(projectDir);
|
|
449
577
|
if (!installation) return;
|
|
450
|
-
this.error(sharedConfigExistingInstall(installation.configPath), {
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* The other half of the same rule. A payload carrying global-scoped skills or sub-agents writes
|
|
454
|
-
* into the user's own ~/.claude, so an installation there is in its way even when this project
|
|
455
|
-
* is spotless. A payload with nothing global cannot reach that far and is never refused for it.
|
|
456
|
-
*/
|
|
457
|
-
async refuseBlockingGlobalInstall(result) {
|
|
458
|
-
if (!writesGlobalContent(result)) return;
|
|
459
|
-
const globalInstallation = await detectGlobalInstallation();
|
|
460
|
-
if (!globalInstallation) return;
|
|
461
|
-
this.error(sharedConfigGlobalInstall(globalInstallation.configPath), {
|
|
578
|
+
this.error(sharedConfigExistingInstall(installation.configPath, id), {
|
|
462
579
|
exit: EXIT_CODES.ERROR
|
|
463
580
|
});
|
|
464
581
|
}
|
|
@@ -495,8 +612,45 @@ var Init = class _Init extends BaseCommand {
|
|
|
495
612
|
await writeExternalSkills(carried);
|
|
496
613
|
this.log(carriedSkillsWritten(carried.map((skill) => skill.id)));
|
|
497
614
|
}
|
|
498
|
-
async showDashboardIfInitialized(projectDir) {
|
|
499
|
-
return runDashboardFlow(
|
|
615
|
+
async showDashboardIfInitialized(projectDir, setupMarketplace) {
|
|
616
|
+
return runDashboardFlow(
|
|
617
|
+
projectDir,
|
|
618
|
+
this.config,
|
|
619
|
+
"init",
|
|
620
|
+
(msg) => this.log(msg),
|
|
621
|
+
setupMarketplace
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Refuses `--marketplace` beside `--ui`. The editor's address carries a configuration id and
|
|
626
|
+
* nothing else, so the marketplace would be dropped on the way — and the editor loads
|
|
627
|
+
* marketplaces itself.
|
|
628
|
+
*/
|
|
629
|
+
refuseMarketplaceForTheEditor(named) {
|
|
630
|
+
if (named === void 0) return;
|
|
631
|
+
this.error(editorLoadsItsOwnMarketplace(named), { exit: EXIT_CODES.INVALID_ARGS });
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Refuses a marketplace other than the one this folder's OWN installation was made from.
|
|
635
|
+
*
|
|
636
|
+
* An installation's marketplace is chosen once, when it is made, and the dashboard every route
|
|
637
|
+
* here ends on reads the one it stored — so naming another would be dropped, and a flag dropped
|
|
638
|
+
* reads as honoured. Project-scoped detection, because a project with no installation of its
|
|
639
|
+
* own is not refused for the global one above it: that is two installations, and the setup the
|
|
640
|
+
* dashboard's Edit runs there takes the named marketplace. At the home directory the folder's
|
|
641
|
+
* own installation IS the global one, and the same detection finds it.
|
|
642
|
+
*
|
|
643
|
+
* The stored marketplace is resolved the way every later command resolves it — this folder's
|
|
644
|
+
* config, then the global one, then the default — so an installation that recorded none is
|
|
645
|
+
* held to the one it has actually been reading. A folder named back by another spelling of its
|
|
646
|
+
* path is that same marketplace.
|
|
647
|
+
*/
|
|
648
|
+
async refuseMarketplaceOtherThanTheInstalledOne(projectDir, named) {
|
|
649
|
+
if (named === void 0) return;
|
|
650
|
+
if (!await detectProjectInstallation(projectDir)) return;
|
|
651
|
+
const { source: stored } = await resolveSource({ caller: "stored", projectDir });
|
|
652
|
+
if (isSameMarketplace(named, stored, projectDir)) return;
|
|
653
|
+
this.error(marketplaceFixedAtInstall(stored, named), { exit: EXIT_CODES.INVALID_ARGS });
|
|
500
654
|
}
|
|
501
655
|
async loadSourceOrFail(flags) {
|
|
502
656
|
try {
|
|
@@ -533,19 +687,22 @@ var Init = class _Init extends BaseCommand {
|
|
|
533
687
|
clearTerminal: () => this.clearTerminal()
|
|
534
688
|
});
|
|
535
689
|
}
|
|
536
|
-
async handleInstallation(result, sourceResult, flags, interactive
|
|
690
|
+
async handleInstallation(result, sourceResult, flags, interactive, installedAlready) {
|
|
537
691
|
const projectDir = process.cwd();
|
|
538
692
|
const activeSkills = result.skills.filter((s) => !s.excluded);
|
|
539
|
-
const
|
|
540
|
-
const
|
|
541
|
-
const
|
|
693
|
+
const toInstall = activeSkills.filter((s) => !installedAlready.has(s.id));
|
|
694
|
+
const installMode = deriveInstallMode(toInstall);
|
|
695
|
+
const ejectedSkills = toInstall.filter((s) => s.origin === EJECT_SOURCE);
|
|
696
|
+
const pluginSkills = toInstall.filter((s) => s.origin !== EJECT_SOURCE);
|
|
697
|
+
this.refuseUnofferablePlacementsBeforeWriting(activeSkills, projectDir);
|
|
542
698
|
this.logInstallPlan(installMode, ejectedSkills, pluginSkills);
|
|
543
699
|
const resolvedMarketplace = pluginSkills.length > 0 ? await this.requireMarketplaceOrExit(
|
|
544
700
|
sourceResult,
|
|
545
701
|
"install plugin skills",
|
|
702
|
+
hostAt(projectDir),
|
|
546
703
|
(marketplace) => this.log(`Registering marketplace "${marketplace}"...`)
|
|
547
704
|
) : null;
|
|
548
|
-
const copyResult =
|
|
705
|
+
const copyResult = ejectedSkills.length > 0 ? await this.copyEjectSkillsStep(ejectedSkills, projectDir, sourceResult, installMode) : null;
|
|
549
706
|
if (resolvedMarketplace !== null) {
|
|
550
707
|
await this.installPluginSkillsReported(
|
|
551
708
|
pluginSkills,
|
|
@@ -594,28 +751,19 @@ var Init = class _Init extends BaseCommand {
|
|
|
594
751
|
}
|
|
595
752
|
logInstallPlan(installMode, ejectedSkills, pluginSkills) {
|
|
596
753
|
this.log("\n");
|
|
597
|
-
this.log(`Selected ${ejectedSkills.length + pluginSkills.length}
|
|
754
|
+
this.log(`Selected ${plural(ejectedSkills.length + pluginSkills.length, "skill")}`);
|
|
598
755
|
this.log(
|
|
599
756
|
`Install mode: ${installMode === "mixed" ? `${INSTALL_MODE_LABELS.mixed} (${ejectedSkills.length} eject, ${pluginSkills.length} plugin)` : INSTALL_MODE_DESCRIPTIONS[installMode]}`
|
|
600
757
|
);
|
|
601
758
|
}
|
|
759
|
+
/**
|
|
760
|
+
* Copies the ejected skills and says how many landed at each scope, in the words
|
|
761
|
+
* {@link skillsCopiedLine} chooses.
|
|
762
|
+
*/
|
|
602
763
|
async copyEjectSkillsStep(localSkills, projectDir, sourceResult, installMode) {
|
|
603
764
|
this.log("Copying skills to local directory...");
|
|
604
765
|
const copyResult = await copyLocalSkills(localSkills, projectDir, sourceResult);
|
|
605
|
-
|
|
606
|
-
if (copyResult.projectCopied.length > 0 && copyResult.globalCopied.length > 0) {
|
|
607
|
-
this.log(
|
|
608
|
-
`Copied ${copyResult.totalCopied} local skills (${copyResult.projectCopied.length} project, ${copyResult.globalCopied.length} global)`
|
|
609
|
-
);
|
|
610
|
-
} else if (copyResult.globalCopied.length > 0) {
|
|
611
|
-
this.log(`Copied ${copyResult.globalCopied.length} local skills to ~/.claude/skills/`);
|
|
612
|
-
} else {
|
|
613
|
-
this.log(`Copied ${copyResult.projectCopied.length} local skills to .claude/skills/`);
|
|
614
|
-
}
|
|
615
|
-
} else {
|
|
616
|
-
this.log(`Copied ${copyResult.totalCopied} skills to .claude/skills/
|
|
617
|
-
`);
|
|
618
|
-
}
|
|
766
|
+
this.log(skillsCopiedLine(copyResult, installMode, projectDir));
|
|
619
767
|
return copyResult;
|
|
620
768
|
}
|
|
621
769
|
async writeConfigAndCompile(result, sourceResult, flags) {
|
|
@@ -629,24 +777,43 @@ var Init = class _Init extends BaseCommand {
|
|
|
629
777
|
if (configResult.wasMerged) {
|
|
630
778
|
this.log(`Merged with existing config at ${configResult.existingConfigPath}`);
|
|
631
779
|
}
|
|
632
|
-
this.log(`Configuration saved (${configResult.config.agents.length
|
|
780
|
+
this.log(`Configuration saved (${plural(configResult.config.agents.length, "agent")})
|
|
633
781
|
`);
|
|
634
|
-
this.reportUnassignedSkills(configResult.config);
|
|
782
|
+
this.reportUnassignedSkills(configResult.config, result.skills);
|
|
635
783
|
this.log(STATUS_MESSAGES.COMPILING_AGENTS);
|
|
636
784
|
const cwd = process.cwd();
|
|
637
785
|
const agentDefs = await loadAgentDefs();
|
|
638
786
|
const { allSkills } = await discoverInstalledSkills(cwd);
|
|
639
787
|
const agentScopeMap = buildAgentScopeMap(configResult.config);
|
|
640
|
-
const
|
|
788
|
+
const compile = compilesGlobalScope(cwd, configResult.propagation) ? compileAgentsAllScopes : compileProjectScope;
|
|
789
|
+
const compileResult = await compile({
|
|
641
790
|
projectDir: cwd,
|
|
642
791
|
sourcePath: agentDefs.sourcePath,
|
|
643
792
|
skills: allSkills,
|
|
644
793
|
agentScopeMap
|
|
645
794
|
});
|
|
646
795
|
this.reportCompilation(compileResult);
|
|
647
|
-
this.
|
|
796
|
+
await this.reportWhatThisHostCannotCarry(cwd);
|
|
797
|
+
this.reportFanOut(configResult.propagation);
|
|
648
798
|
return { configResult, compileResult, agentScopeMap };
|
|
649
799
|
}
|
|
800
|
+
/**
|
|
801
|
+
* What this host could not carry, after the compile summary and once per run.
|
|
802
|
+
*
|
|
803
|
+
* `init --from` is the door a configuration somebody ELSE wrote arrives through, so it is
|
|
804
|
+
* precisely the run that must not be silent about the parts of it that did not survive the
|
|
805
|
+
* translation. `compile` prints the same lines in the same order — see
|
|
806
|
+
* {@link hostCompileNotices}, which is the one place either of them gets them from.
|
|
807
|
+
*
|
|
808
|
+
* A Claude install expresses every setting and carries every sub-agent, so it gets one line at
|
|
809
|
+
* most: the trust dialog, while its project sub-agents' completion gate cannot run in this
|
|
810
|
+
* folder.
|
|
811
|
+
*/
|
|
812
|
+
async reportWhatThisHostCannotCarry(cwd) {
|
|
813
|
+
for (const notice of await hostCompileNotices(providerInUse(cwd), cwd)) {
|
|
814
|
+
this.log(notice);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
650
817
|
/**
|
|
651
818
|
* What the compile pass did, including the half this command used to drop.
|
|
652
819
|
*
|
|
@@ -661,7 +828,7 @@ var Init = class _Init extends BaseCommand {
|
|
|
661
828
|
*/
|
|
662
829
|
reportCompilation(compileResult) {
|
|
663
830
|
const { compiled, failed, warnings } = compileResult;
|
|
664
|
-
const summary = `Compiled ${compiled.length}
|
|
831
|
+
const summary = `Compiled ${plural(compiled.length, "agent")}`;
|
|
665
832
|
if (failed.length === 0) {
|
|
666
833
|
this.log(`${summary}
|
|
667
834
|
`);
|
|
@@ -709,7 +876,7 @@ var Init = class _Init extends BaseCommand {
|
|
|
709
876
|
}
|
|
710
877
|
this.log("");
|
|
711
878
|
this.log("To customize agent-skill assignments:");
|
|
712
|
-
for (const [index, step] of customizationSteps(split, paths.global).entries()) {
|
|
879
|
+
for (const [index, step] of customizationSteps(split, paths.global, cwd).entries()) {
|
|
713
880
|
this.log(` ${index + 1}. ${step}`);
|
|
714
881
|
}
|
|
715
882
|
this.log("");
|
|
@@ -749,16 +916,21 @@ var Init = class _Init extends BaseCommand {
|
|
|
749
916
|
* Reports where the agents actually landed, mirroring the scope split
|
|
750
917
|
* `compileAgentsAllScopes` performs: one pass at the home root, otherwise a
|
|
751
918
|
* global pass under HOME and a project pass under the project directory.
|
|
919
|
+
*
|
|
920
|
+
* **The EXTENSION is the host's, per scope, and was Claude's literal `.md` until C5.** This
|
|
921
|
+
* block describes the filesystem, so every line under a path header has to be a name a user can
|
|
922
|
+
* copy out and open — and a Codex install printed `web-developer.md` above a directory holding
|
|
923
|
+
* `web-developer.toml`. The two scopes are read separately because they can be on two hosts.
|
|
752
924
|
*/
|
|
753
925
|
reportAgentsCompiled(compiled, agentScopeMap) {
|
|
754
926
|
const cwd = process.cwd();
|
|
755
|
-
const groups = isHomeDirectory(cwd) ? [{
|
|
927
|
+
const groups = isHomeDirectory(cwd) ? [{ ...compiledInto(cwd, "project"), agents: compiled }] : [
|
|
756
928
|
{
|
|
757
|
-
|
|
929
|
+
...compiledInto(cwd, "global"),
|
|
758
930
|
agents: compiled.filter((name) => agentScopeMap.get(name) === "global")
|
|
759
931
|
},
|
|
760
932
|
{
|
|
761
|
-
|
|
933
|
+
...compiledInto(cwd, "project"),
|
|
762
934
|
agents: compiled.filter((name) => agentScopeMap.get(name) !== "global")
|
|
763
935
|
}
|
|
764
936
|
].filter((group) => group.agents.length > 0);
|
|
@@ -766,12 +938,37 @@ var Init = class _Init extends BaseCommand {
|
|
|
766
938
|
this.log("Agents compiled to:");
|
|
767
939
|
this.log(` ${group.dir}`);
|
|
768
940
|
for (const agentName of group.agents) {
|
|
769
|
-
this.log(` ${agentName}.
|
|
941
|
+
this.log(` ${agentName}${group.extension}`);
|
|
770
942
|
}
|
|
771
943
|
this.log("");
|
|
772
944
|
}
|
|
773
945
|
}
|
|
774
946
|
};
|
|
947
|
+
function selectsNothing(result) {
|
|
948
|
+
return result.skills.length === 0 && result.selectedAgents.length === 0;
|
|
949
|
+
}
|
|
950
|
+
function compilesGlobalScope(cwd, written) {
|
|
951
|
+
return isHomeDirectory(cwd) || movedGlobalAgentInputs(written);
|
|
952
|
+
}
|
|
953
|
+
function skillsCopiedLine(copyResult, installMode, projectDir) {
|
|
954
|
+
const isMixed = installMode === "mixed";
|
|
955
|
+
const copied = plural(copyResult.totalCopied, isMixed ? "local skill" : "skill");
|
|
956
|
+
const lineEnd = isMixed ? "" : "\n";
|
|
957
|
+
const projectCount = copyResult.projectCopied.length;
|
|
958
|
+
const globalCount = copyResult.globalCopied.length;
|
|
959
|
+
const landedAtBothScopes = projectCount > 0 && globalCount > 0;
|
|
960
|
+
if (landedAtBothScopes) {
|
|
961
|
+
return `Copied ${copied} (${projectCount} project, ${globalCount} global)${lineEnd}`;
|
|
962
|
+
}
|
|
963
|
+
const landedAt = globalCount > 0 ? "global" : "project";
|
|
964
|
+
return `Copied ${copied} to ${resolveInstallPaths(projectDir, landedAt).skillsDir}/${lineEnd}`;
|
|
965
|
+
}
|
|
966
|
+
function compiledInto(cwd, scope) {
|
|
967
|
+
return {
|
|
968
|
+
dir: resolveInstallPaths(cwd, scope).agentsDir,
|
|
969
|
+
extension: agentCodec(providerInUse(installBaseDir(cwd, scope))).extension
|
|
970
|
+
};
|
|
971
|
+
}
|
|
775
972
|
function splitAgentScopes(cwd, agentScopeMap) {
|
|
776
973
|
if (isHomeDirectory(cwd)) return { globalAgentCount: 0, isGlobalOnly: false };
|
|
777
974
|
const scopes = [...agentScopeMap.values()];
|
|
@@ -786,12 +983,12 @@ function configsHoldingAssignments(split, paths) {
|
|
|
786
983
|
if (split.globalAgentCount > 0) return [paths.global, paths.project];
|
|
787
984
|
return [paths.project];
|
|
788
985
|
}
|
|
789
|
-
function customizationSteps(split, globalConfigPath) {
|
|
986
|
+
function customizationSteps(split, globalConfigPath, projectDir) {
|
|
790
987
|
if (split.isGlobalOnly) {
|
|
791
988
|
return [`Edit ${globalConfigPath}`, globalScopedAgentsHint(split.globalAgentCount)];
|
|
792
989
|
}
|
|
793
990
|
return [
|
|
794
|
-
`Edit ${
|
|
991
|
+
`Edit ${relativeConfigPath(projectDir, providerInUse(projectDir))}`,
|
|
795
992
|
`Run '${CLI_INVOKE_COMMAND} compile' to regenerate agents`,
|
|
796
993
|
...split.globalAgentCount > 0 ? [globalScopedAgentsHint(split.globalAgentCount)] : []
|
|
797
994
|
];
|
|
@@ -825,4 +1022,4 @@ export {
|
|
|
825
1022
|
Init,
|
|
826
1023
|
getDashboardData
|
|
827
1024
|
};
|
|
828
|
-
//# sourceMappingURL=chunk-
|
|
1025
|
+
//# sourceMappingURL=chunk-6AIZPSEI.js.map
|