agents-inc 0.164.0 → 0.166.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 +63 -0
- package/README.md +8 -9
- package/dist/{chunk-X4SSJZLY.js → chunk-25MPBIK3.js} +12 -261
- package/dist/chunk-25MPBIK3.js.map +1 -0
- package/dist/{chunk-LT5GXEB2.js → chunk-2VUYFTUB.js} +8 -7
- package/dist/chunk-2VUYFTUB.js.map +1 -0
- package/dist/chunk-4AAOOAIN.js +49 -0
- package/dist/chunk-4AAOOAIN.js.map +1 -0
- package/dist/{chunk-ARYNOWKF.js → chunk-4NDBUJHK.js} +8 -8
- package/dist/{chunk-S63LXWMC.js → chunk-6L75SQZU.js} +2 -2
- package/dist/{chunk-7REKOTKG.js → chunk-6LF4CQBY.js} +3 -3
- package/dist/{chunk-K5ITEA3I.js → chunk-7JNJ52CD.js} +34 -17
- package/dist/chunk-7JNJ52CD.js.map +1 -0
- package/dist/{chunk-XPDVAJDH.js → chunk-A4KDXNOT.js} +3519 -1568
- package/dist/chunk-A4KDXNOT.js.map +1 -0
- package/dist/{chunk-XHPWTL4I.js → chunk-DAIEQJIF.js} +3 -3
- package/dist/{chunk-UITEKY2R.js → chunk-ENGYJCTF.js} +28 -4
- package/dist/chunk-ENGYJCTF.js.map +1 -0
- package/dist/{chunk-G2JJ5BO5.js → chunk-G4JK7WVO.js} +336 -140
- package/dist/chunk-G4JK7WVO.js.map +1 -0
- package/dist/{chunk-X37UYIE3.js → chunk-G6UREQ4V.js} +436 -739
- package/dist/chunk-G6UREQ4V.js.map +1 -0
- package/dist/chunk-GE3WKJ6Q.js +375 -0
- package/dist/chunk-GE3WKJ6Q.js.map +1 -0
- package/dist/{chunk-RGYDFBCT.js → chunk-HHIYT3PI.js} +5 -5
- package/dist/{chunk-2CQNPLVF.js → chunk-HWEKHVLE.js} +63 -42
- package/dist/chunk-HWEKHVLE.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-3WVH2CTK.js → chunk-JQRJQ4SS.js} +15 -8
- package/dist/chunk-JQRJQ4SS.js.map +1 -0
- package/dist/{chunk-DSL66I4N.js → chunk-LFWLEDUG.js} +6 -6
- package/dist/{chunk-B3Y3QMWI.js → chunk-MAWNVT2C.js} +4 -4
- package/dist/{chunk-Q4IRRVXK.js → chunk-MPTNC32T.js} +3 -3
- package/dist/chunk-NBXXFIIW.js +73 -0
- package/dist/chunk-NBXXFIIW.js.map +1 -0
- package/dist/{chunk-B6FSLXYN.js → chunk-PMJWD27C.js} +3 -3
- package/dist/{chunk-XATLUKXK.js → chunk-PNB3524H.js} +6 -6
- package/dist/chunk-PXWG7KFO.js +39 -0
- package/dist/chunk-PXWG7KFO.js.map +1 -0
- package/dist/{chunk-4VL3CEOS.js → chunk-QHDPLLK6.js} +3 -3
- package/dist/{chunk-AOTCIUGX.js → chunk-RAHSOJQ2.js} +2 -2
- package/dist/{chunk-PHCPUQVR.js → chunk-RZDXDMT6.js} +2 -2
- package/dist/{chunk-6MV4JOCL.js → chunk-SAYZWCH6.js} +2 -2
- package/dist/{chunk-URXIQE7I.js → chunk-SCOQ34YM.js} +2 -2
- package/dist/{chunk-NQXO4LR3.js → chunk-SXVHSOTH.js} +16 -11
- package/dist/chunk-SXVHSOTH.js.map +1 -0
- package/dist/{chunk-QZX7SYKU.js → chunk-T6UWJAB3.js} +2 -2
- package/dist/{chunk-ZVXGW2IC.js → chunk-TODCQFRB.js} +4 -6
- package/dist/chunk-TODCQFRB.js.map +1 -0
- package/dist/{chunk-YRS3QZP2.js → chunk-TTY6DPJN.js} +3 -3
- package/dist/{chunk-QGUP3QJF.js → chunk-TZ2YJJKK.js} +22 -18
- package/dist/{chunk-QGUP3QJF.js.map → chunk-TZ2YJJKK.js.map} +1 -1
- package/dist/chunk-V3I7VQ7N.js +356 -0
- package/dist/chunk-V3I7VQ7N.js.map +1 -0
- package/dist/{chunk-AVK2HEKB.js → chunk-V5WXIM2F.js} +2 -6
- package/dist/{chunk-AVK2HEKB.js.map → chunk-V5WXIM2F.js.map} +1 -1
- package/dist/{chunk-NKGYKOB7.js → chunk-VAPTVR3J.js} +7 -8
- package/dist/chunk-VAPTVR3J.js.map +1 -0
- package/dist/chunk-VRXX4D6K.js +31 -0
- package/dist/chunk-VRXX4D6K.js.map +1 -0
- package/dist/{chunk-ABAZMMG4.js → chunk-WVUDLKIO.js} +2 -2
- package/dist/{chunk-ECURHW3T.js → chunk-WWIFNPJG.js} +13 -12
- package/dist/chunk-WWIFNPJG.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-V5GLL2JB.js → chunk-XZEVWPX6.js} +7 -7
- package/dist/chunk-Y3VIRVVE.js +932 -0
- package/dist/chunk-Y3VIRVVE.js.map +1 -0
- package/dist/{chunk-NTF4UXGK.js → chunk-Y47EV74W.js} +73 -30
- package/dist/chunk-Y47EV74W.js.map +1 -0
- package/dist/chunk-ZR4YPKXQ.js +159 -0
- package/dist/chunk-ZR4YPKXQ.js.map +1 -0
- package/dist/chunk-ZXKBERQU.js +250 -0
- package/dist/chunk-ZXKBERQU.js.map +1 -0
- 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 +105 -27
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +309 -171
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +503 -314
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +40 -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 +102 -15
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +231 -103
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +49 -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 +69 -43
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-3C27ENC7.js +14 -0
- package/dist/recompile-project-agents-DGNBCU3N.js +18 -0
- package/dist/{source-loader-GRBVNRAW.js → source-loader-7KZ3MD5O.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-ARYNOWKF.js.map → chunk-4NDBUJHK.js.map} +0 -0
- /package/dist/{chunk-S63LXWMC.js.map → chunk-6L75SQZU.js.map} +0 -0
- /package/dist/{chunk-7REKOTKG.js.map → chunk-6LF4CQBY.js.map} +0 -0
- /package/dist/{chunk-XHPWTL4I.js.map → chunk-DAIEQJIF.js.map} +0 -0
- /package/dist/{chunk-RGYDFBCT.js.map → chunk-HHIYT3PI.js.map} +0 -0
- /package/dist/{chunk-DSL66I4N.js.map → chunk-LFWLEDUG.js.map} +0 -0
- /package/dist/{chunk-B3Y3QMWI.js.map → chunk-MAWNVT2C.js.map} +0 -0
- /package/dist/{chunk-Q4IRRVXK.js.map → chunk-MPTNC32T.js.map} +0 -0
- /package/dist/{chunk-B6FSLXYN.js.map → chunk-PMJWD27C.js.map} +0 -0
- /package/dist/{chunk-XATLUKXK.js.map → chunk-PNB3524H.js.map} +0 -0
- /package/dist/{chunk-4VL3CEOS.js.map → chunk-QHDPLLK6.js.map} +0 -0
- /package/dist/{chunk-AOTCIUGX.js.map → chunk-RAHSOJQ2.js.map} +0 -0
- /package/dist/{chunk-PHCPUQVR.js.map → chunk-RZDXDMT6.js.map} +0 -0
- /package/dist/{chunk-6MV4JOCL.js.map → chunk-SAYZWCH6.js.map} +0 -0
- /package/dist/{chunk-URXIQE7I.js.map → chunk-SCOQ34YM.js.map} +0 -0
- /package/dist/{chunk-QZX7SYKU.js.map → chunk-T6UWJAB3.js.map} +0 -0
- /package/dist/{chunk-YRS3QZP2.js.map → chunk-TTY6DPJN.js.map} +0 -0
- /package/dist/{chunk-ABAZMMG4.js.map → chunk-WVUDLKIO.js.map} +0 -0
- /package/dist/{chunk-V5GLL2JB.js.map → chunk-XZEVWPX6.js.map} +0 -0
- /package/dist/{load-agent-defs-7IM3GBEQ.js.map → load-agent-defs-3C27ENC7.js.map} +0 -0
- /package/dist/{recompile-project-agents-VR4NLGOU.js.map → recompile-project-agents-DGNBCU3N.js.map} +0 -0
- /package/dist/{source-loader-GRBVNRAW.js.map → source-loader-7KZ3MD5O.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-6LF4CQBY.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
holdInstalledGlobal,
|
|
7
|
+
installPlanLines,
|
|
8
|
+
notInstalledGlobally,
|
|
9
|
+
openUrl,
|
|
10
|
+
readInstalledGlobal
|
|
11
|
+
} from "./chunk-V3I7VQ7N.js";
|
|
8
12
|
import {
|
|
9
13
|
runWizardSession
|
|
10
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HHIYT3PI.js";
|
|
11
15
|
import {
|
|
12
16
|
useTerminalDimensions
|
|
13
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4NDBUJHK.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-25MPBIK3.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-ZXKBERQU.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-G6UREQ4V.js";
|
|
30
42
|
import {
|
|
31
43
|
copyLocalSkills,
|
|
32
44
|
discoverInstalledSkills
|
|
33
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-HWEKHVLE.js";
|
|
34
46
|
import {
|
|
35
47
|
loadAgentDefs
|
|
36
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-PMJWD27C.js";
|
|
37
49
|
import {
|
|
38
50
|
render
|
|
39
51
|
} from "./chunk-JFLVEFFP.js";
|
|
52
|
+
import {
|
|
53
|
+
providerFlag,
|
|
54
|
+
providerNamedBy,
|
|
55
|
+
providerNeedsAConfigurationToInstall
|
|
56
|
+
} from "./chunk-NBXXFIIW.js";
|
|
40
57
|
import {
|
|
41
58
|
BaseCommand,
|
|
42
|
-
EXIT_CODES
|
|
43
|
-
|
|
59
|
+
EXIT_CODES,
|
|
60
|
+
registerExternalSkills,
|
|
61
|
+
writeExternalSkills
|
|
62
|
+
} from "./chunk-Y3VIRVVE.js";
|
|
44
63
|
import {
|
|
45
64
|
clearTerminalScreen
|
|
46
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-RZDXDMT6.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-A4KDXNOT.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-ENGYJCTF.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,123 @@ 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);
|
|
339
393
|
this.brandingName = await this.resolveBrandingName(projectDir);
|
|
340
|
-
if (!flags.from
|
|
394
|
+
if (!flags.from) {
|
|
395
|
+
await this.refuseMarketplaceOtherThanTheInstalledOne(projectDir, flags.marketplace);
|
|
396
|
+
const dashboard = await this.showDashboardIfInitialized(projectDir, flags.marketplace);
|
|
397
|
+
if (dashboard === "cancelled") this.error("Cancelled", { exit: EXIT_CODES.CANCELLED });
|
|
398
|
+
if (dashboard === "shown") return;
|
|
399
|
+
}
|
|
341
400
|
const selection = flags.from ? await this.selectionFromSharedConfig(flags.from, flags, projectDir) : await this.selectionFromWizard(flags, projectDir);
|
|
342
401
|
if (!selection) this.exit(EXIT_CODES.CANCELLED);
|
|
343
402
|
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
403
|
await this.handleInstallation(
|
|
348
404
|
selection.result,
|
|
349
405
|
selection.sourceResult,
|
|
350
406
|
selection.sourceFlags,
|
|
351
|
-
selection.interactive
|
|
407
|
+
selection.interactive,
|
|
408
|
+
selection.installedAlready
|
|
352
409
|
);
|
|
353
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* Commits this run to the provider `--provider` named, or refuses a flag with nothing to name.
|
|
413
|
+
*
|
|
414
|
+
* **`--provider` is a LOCATION parameter, not a feature switch**, and the control that proves it
|
|
415
|
+
* is `--provider claude`: naming the default out loud installs byte-for-byte what no flag
|
|
416
|
+
* installs, because all the flag decides is which folder this run creates. Without that half
|
|
417
|
+
* "the flag selects an installation" would be indistinguishable from "the flag means Codex".
|
|
418
|
+
*
|
|
419
|
+
* **And it is meaningless without `--from` (D15).** The provider is chosen in the web app, so
|
|
420
|
+
* the only run that can be told one is the run that installs what the app produced. There is no
|
|
421
|
+
* wizard step to choose a provider in and none is planned — which is what makes "the interactive
|
|
422
|
+
* flow is Claude-only" provable rather than conventional. It also gives the placement refusal
|
|
423
|
+
* something to refuse BEFORE anything is written: with `--from` required, a provider always
|
|
424
|
+
* arrives beside a payload the pre-flight can read.
|
|
425
|
+
*/
|
|
426
|
+
settleTheProviderForThisRun(flags) {
|
|
427
|
+
const named = providerNamedBy(flags.provider);
|
|
428
|
+
if (named === void 0) return;
|
|
429
|
+
if (flags.from === void 0) {
|
|
430
|
+
this.error(providerNeedsAConfigurationToInstall(), { exit: EXIT_CODES.INVALID_ARGS });
|
|
431
|
+
}
|
|
432
|
+
chooseProviderForThisRun(named);
|
|
433
|
+
}
|
|
354
434
|
/** The interactive producer: load the source, run the wizard, return what was chosen. */
|
|
355
435
|
async selectionFromWizard(flags, projectDir) {
|
|
356
436
|
const isGlobalRoot = isHomeDirectory(projectDir);
|
|
357
437
|
const { sourceResult, startupMessages } = await this.loadWizardInputsUnderSpinner(flags);
|
|
438
|
+
if (!process.stdin.isTTY) {
|
|
439
|
+
this.error(wizardNeedsTerminal("init"), { exit: EXIT_CODES.ERROR });
|
|
440
|
+
}
|
|
358
441
|
const result = await this.runWizard(startupMessages, isGlobalRoot);
|
|
359
442
|
if (!result) return null;
|
|
443
|
+
if (selectsNothing(result)) this.error("No skills selected", { exit: EXIT_CODES.ERROR });
|
|
360
444
|
return {
|
|
361
445
|
result,
|
|
362
446
|
sourceResult,
|
|
363
447
|
sourceFlags: flags,
|
|
364
448
|
// A person is already at the terminal, so the permission notice can wait for them.
|
|
365
449
|
interactive: true,
|
|
366
|
-
|
|
450
|
+
// The wizard opens only where nothing is installed at all — see `runWizard`.
|
|
451
|
+
installedAlready: /* @__PURE__ */ new Set()
|
|
367
452
|
};
|
|
368
453
|
}
|
|
369
454
|
/**
|
|
370
455
|
* 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.
|
|
456
|
+
* await ends — a source that cannot be loaded refuses the run from inside it.
|
|
377
457
|
*/
|
|
378
458
|
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
|
-
}
|
|
459
|
+
return awaitUnderSpinner(STATUS_MESSAGES.LOADING_SKILLS, () => this.loadSourceOrFail(flags));
|
|
388
460
|
}
|
|
389
461
|
/**
|
|
390
|
-
* The `--from <id>` producer: fetch and map, no wizard
|
|
391
|
-
*
|
|
462
|
+
* The `--from <id>` producer: fetch and map, no wizard — and, at a terminal, one question.
|
|
463
|
+
*
|
|
464
|
+
* It installs into a clean directory, which is what the first refusal is: a shared
|
|
465
|
+
* configuration is installed whole, so a directory already holding one has it applied with
|
|
466
|
+
* `edit --from` instead, or is uninstalled first. The second is about the LOCATION rather than what is already in it — a global
|
|
467
|
+
* installation holds only global-scoped content. Both fire before anything is written.
|
|
468
|
+
*
|
|
469
|
+
* A global installation ABOVE a project is not in the way. It is not this project's, so the run
|
|
470
|
+
* adds to it what it lacks and states every entry it already holds as installed (see
|
|
471
|
+
* `holdInstalledGlobal`).
|
|
392
472
|
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* asked. All three fire before anything is written.
|
|
473
|
+
* Before writing anything the run lists what goes into the project and what into the global
|
|
474
|
+
* install. At a terminal it then asks, and a no writes nothing. With no terminal — a CI job or a
|
|
475
|
+
* script — it prints the same lists and carries on: running headless is most of why the flag
|
|
476
|
+
* exists.
|
|
398
477
|
*/
|
|
399
478
|
async selectionFromSharedConfig(id, flags, projectDir) {
|
|
400
|
-
await this.refuseInstalledProject(projectDir);
|
|
479
|
+
await this.refuseInstalledProject(projectDir, id);
|
|
401
480
|
this.log(`Fetching configuration ${id}...`);
|
|
402
481
|
const fetched = await fetchSeedConfig(id);
|
|
403
482
|
if (!fetched.ok) {
|
|
404
483
|
this.error(fetched.error, { exit: EXIT_CODES.ERROR });
|
|
405
484
|
}
|
|
406
485
|
const sourceFlags = sharedConfigSourceFlags(flags, fetched.payload);
|
|
407
|
-
const { sourceResult } = await this.loadSourceOrFail(sourceFlags);
|
|
486
|
+
const { sourceResult, startupMessages } = await this.loadSourceOrFail(sourceFlags);
|
|
408
487
|
const carriedSkills = this.registerExternalSkillsOrFail(
|
|
409
488
|
fetched.payload,
|
|
410
489
|
sourceResult.matrix,
|
|
@@ -415,50 +494,87 @@ var Init = class _Init extends BaseCommand {
|
|
|
415
494
|
sourceResult.matrix
|
|
416
495
|
);
|
|
417
496
|
this.refuseProjectScopedContentAtHome(result, projectDir);
|
|
418
|
-
|
|
419
|
-
|
|
497
|
+
const held = holdInstalledGlobal(
|
|
498
|
+
result,
|
|
499
|
+
isHomeDirectory(projectDir) ? null : await readInstalledGlobal(projectDir)
|
|
500
|
+
);
|
|
501
|
+
const arrivingCarried = notInstalledGlobally(carriedSkills, held);
|
|
502
|
+
await this.refuseSharedConfigBeforeAsking(
|
|
503
|
+
held.result,
|
|
504
|
+
arrivingCarried,
|
|
505
|
+
projectDir,
|
|
506
|
+
sourceResult
|
|
507
|
+
);
|
|
508
|
+
sayCapturedWarnings(startupMessages);
|
|
420
509
|
if (skippedSkillIds.length > 0) this.warn(skippedUnknownSkills(skippedSkillIds));
|
|
421
510
|
if (skippedAgentNames.length > 0) this.warn(skippedUnknownAgents(skippedAgentNames));
|
|
422
|
-
if (result
|
|
511
|
+
if (selectsNothing(held.result)) {
|
|
512
|
+
this.error(`Configuration '${id}' contains no skills this catalog can install.`, {
|
|
513
|
+
exit: EXIT_CODES.ERROR
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
this.logWhatGoesWhere(held);
|
|
517
|
+
if (process.stdin.isTTY && !await this.confirmInstall()) {
|
|
518
|
+
this.log("Setup cancelled");
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
await this.writeCarriedSkills(arrivingCarried);
|
|
522
|
+
const arriving = notInstalledGlobally(held.result.skills, held);
|
|
523
|
+
if (arriving.length > 0) {
|
|
423
524
|
this.log(
|
|
424
|
-
`Installing ${
|
|
525
|
+
`Installing ${arriving.length} skill(s) across ${result.selectedAgents.length} sub-agent(s)
|
|
425
526
|
`
|
|
426
527
|
);
|
|
427
528
|
}
|
|
428
529
|
return {
|
|
429
|
-
result,
|
|
530
|
+
result: held.result,
|
|
430
531
|
sourceResult,
|
|
431
532
|
sourceFlags,
|
|
432
533
|
interactive: false,
|
|
433
|
-
|
|
534
|
+
installedAlready: new Set(held.installed.skillIds)
|
|
434
535
|
};
|
|
435
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* The two lists — what goes into this project, and what into the global install — then the
|
|
539
|
+
* global skills skipped as already installed, and the global entries the configuration states
|
|
540
|
+
* otherwise than they are installed, which stay.
|
|
541
|
+
*/
|
|
542
|
+
logWhatGoesWhere(held) {
|
|
543
|
+
for (const line of installPlanLines(held)) {
|
|
544
|
+
this.log(line);
|
|
545
|
+
}
|
|
546
|
+
const { skillIds, agentNames } = held.keptAsInstalled;
|
|
547
|
+
if (skillIds.length > 0 || agentNames.length > 0) {
|
|
548
|
+
this.log(keptAsInstalledGlobally(skillIds, agentNames));
|
|
549
|
+
}
|
|
550
|
+
this.log("");
|
|
551
|
+
}
|
|
552
|
+
/** The question under the lists, defaulting to no: nothing has been written yet. */
|
|
553
|
+
async confirmInstall() {
|
|
554
|
+
const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx2(
|
|
555
|
+
Confirm,
|
|
556
|
+
{
|
|
557
|
+
message: SHARED_CONFIG_ARRIVALS.INSTALL_CONFIRM,
|
|
558
|
+
onConfirm,
|
|
559
|
+
onCancel
|
|
560
|
+
}
|
|
561
|
+
));
|
|
562
|
+
return outcome === "confirmed";
|
|
563
|
+
}
|
|
436
564
|
/**
|
|
437
565
|
* Refuses to install a shared configuration into a directory that already has one.
|
|
438
566
|
*
|
|
439
567
|
* 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.
|
|
568
|
+
* every clean project on a machine with a global install. A global install above the project is
|
|
569
|
+
* added to rather than refused over — see {@link selectionFromSharedConfig}.
|
|
443
570
|
*
|
|
444
571
|
* This runs before the fetch: there is nothing to learn from the network about a directory that
|
|
445
572
|
* is already spoken for.
|
|
446
573
|
*/
|
|
447
|
-
async refuseInstalledProject(projectDir) {
|
|
574
|
+
async refuseInstalledProject(projectDir, id) {
|
|
448
575
|
const installation = await detectProjectInstallation(projectDir);
|
|
449
576
|
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), {
|
|
577
|
+
this.error(sharedConfigExistingInstall(installation.configPath, id), {
|
|
462
578
|
exit: EXIT_CODES.ERROR
|
|
463
579
|
});
|
|
464
580
|
}
|
|
@@ -495,8 +611,45 @@ var Init = class _Init extends BaseCommand {
|
|
|
495
611
|
await writeExternalSkills(carried);
|
|
496
612
|
this.log(carriedSkillsWritten(carried.map((skill) => skill.id)));
|
|
497
613
|
}
|
|
498
|
-
async showDashboardIfInitialized(projectDir) {
|
|
499
|
-
return runDashboardFlow(
|
|
614
|
+
async showDashboardIfInitialized(projectDir, setupMarketplace) {
|
|
615
|
+
return runDashboardFlow(
|
|
616
|
+
projectDir,
|
|
617
|
+
this.config,
|
|
618
|
+
"init",
|
|
619
|
+
(msg) => this.log(msg),
|
|
620
|
+
setupMarketplace
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Refuses `--marketplace` beside `--ui`. The editor's address carries a configuration id and
|
|
625
|
+
* nothing else, so the marketplace would be dropped on the way — and the editor loads
|
|
626
|
+
* marketplaces itself.
|
|
627
|
+
*/
|
|
628
|
+
refuseMarketplaceForTheEditor(named) {
|
|
629
|
+
if (named === void 0) return;
|
|
630
|
+
this.error(editorLoadsItsOwnMarketplace(named), { exit: EXIT_CODES.INVALID_ARGS });
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Refuses a marketplace other than the one this folder's OWN installation was made from.
|
|
634
|
+
*
|
|
635
|
+
* An installation's marketplace is chosen once, when it is made, and the dashboard every route
|
|
636
|
+
* here ends on reads the one it stored — so naming another would be dropped, and a flag dropped
|
|
637
|
+
* reads as honoured. Project-scoped detection, because a project with no installation of its
|
|
638
|
+
* own is not refused for the global one above it: that is two installations, and the setup the
|
|
639
|
+
* dashboard's Edit runs there takes the named marketplace. At the home directory the folder's
|
|
640
|
+
* own installation IS the global one, and the same detection finds it.
|
|
641
|
+
*
|
|
642
|
+
* The stored marketplace is resolved the way every later command resolves it — this folder's
|
|
643
|
+
* config, then the global one, then the default — so an installation that recorded none is
|
|
644
|
+
* held to the one it has actually been reading. A folder named back by another spelling of its
|
|
645
|
+
* path is that same marketplace.
|
|
646
|
+
*/
|
|
647
|
+
async refuseMarketplaceOtherThanTheInstalledOne(projectDir, named) {
|
|
648
|
+
if (named === void 0) return;
|
|
649
|
+
if (!await detectProjectInstallation(projectDir)) return;
|
|
650
|
+
const { source: stored } = await resolveSource({ caller: "stored", projectDir });
|
|
651
|
+
if (isSameMarketplace(named, stored, projectDir)) return;
|
|
652
|
+
this.error(marketplaceFixedAtInstall(stored, named), { exit: EXIT_CODES.INVALID_ARGS });
|
|
500
653
|
}
|
|
501
654
|
async loadSourceOrFail(flags) {
|
|
502
655
|
try {
|
|
@@ -533,19 +686,22 @@ var Init = class _Init extends BaseCommand {
|
|
|
533
686
|
clearTerminal: () => this.clearTerminal()
|
|
534
687
|
});
|
|
535
688
|
}
|
|
536
|
-
async handleInstallation(result, sourceResult, flags, interactive
|
|
689
|
+
async handleInstallation(result, sourceResult, flags, interactive, installedAlready) {
|
|
537
690
|
const projectDir = process.cwd();
|
|
538
691
|
const activeSkills = result.skills.filter((s) => !s.excluded);
|
|
539
|
-
const
|
|
540
|
-
const
|
|
541
|
-
const
|
|
692
|
+
const toInstall = activeSkills.filter((s) => !installedAlready.has(s.id));
|
|
693
|
+
const installMode = deriveInstallMode(toInstall);
|
|
694
|
+
const ejectedSkills = toInstall.filter((s) => s.origin === EJECT_SOURCE);
|
|
695
|
+
const pluginSkills = toInstall.filter((s) => s.origin !== EJECT_SOURCE);
|
|
696
|
+
this.refuseUnofferablePlacementsBeforeWriting(activeSkills, projectDir);
|
|
542
697
|
this.logInstallPlan(installMode, ejectedSkills, pluginSkills);
|
|
543
698
|
const resolvedMarketplace = pluginSkills.length > 0 ? await this.requireMarketplaceOrExit(
|
|
544
699
|
sourceResult,
|
|
545
700
|
"install plugin skills",
|
|
701
|
+
hostAt(projectDir),
|
|
546
702
|
(marketplace) => this.log(`Registering marketplace "${marketplace}"...`)
|
|
547
703
|
) : null;
|
|
548
|
-
const copyResult =
|
|
704
|
+
const copyResult = ejectedSkills.length > 0 ? await this.copyEjectSkillsStep(ejectedSkills, projectDir, sourceResult, installMode) : null;
|
|
549
705
|
if (resolvedMarketplace !== null) {
|
|
550
706
|
await this.installPluginSkillsReported(
|
|
551
707
|
pluginSkills,
|
|
@@ -594,28 +750,19 @@ var Init = class _Init extends BaseCommand {
|
|
|
594
750
|
}
|
|
595
751
|
logInstallPlan(installMode, ejectedSkills, pluginSkills) {
|
|
596
752
|
this.log("\n");
|
|
597
|
-
this.log(`Selected ${ejectedSkills.length + pluginSkills.length}
|
|
753
|
+
this.log(`Selected ${plural(ejectedSkills.length + pluginSkills.length, "skill")}`);
|
|
598
754
|
this.log(
|
|
599
755
|
`Install mode: ${installMode === "mixed" ? `${INSTALL_MODE_LABELS.mixed} (${ejectedSkills.length} eject, ${pluginSkills.length} plugin)` : INSTALL_MODE_DESCRIPTIONS[installMode]}`
|
|
600
756
|
);
|
|
601
757
|
}
|
|
758
|
+
/**
|
|
759
|
+
* Copies the ejected skills and says how many landed at each scope, in the words
|
|
760
|
+
* {@link skillsCopiedLine} chooses.
|
|
761
|
+
*/
|
|
602
762
|
async copyEjectSkillsStep(localSkills, projectDir, sourceResult, installMode) {
|
|
603
763
|
this.log("Copying skills to local directory...");
|
|
604
764
|
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
|
-
}
|
|
765
|
+
this.log(skillsCopiedLine(copyResult, installMode, projectDir));
|
|
619
766
|
return copyResult;
|
|
620
767
|
}
|
|
621
768
|
async writeConfigAndCompile(result, sourceResult, flags) {
|
|
@@ -629,24 +776,43 @@ var Init = class _Init extends BaseCommand {
|
|
|
629
776
|
if (configResult.wasMerged) {
|
|
630
777
|
this.log(`Merged with existing config at ${configResult.existingConfigPath}`);
|
|
631
778
|
}
|
|
632
|
-
this.log(`Configuration saved (${configResult.config.agents.length
|
|
779
|
+
this.log(`Configuration saved (${plural(configResult.config.agents.length, "agent")})
|
|
633
780
|
`);
|
|
634
|
-
this.reportUnassignedSkills(configResult.config);
|
|
781
|
+
this.reportUnassignedSkills(configResult.config, result.skills);
|
|
635
782
|
this.log(STATUS_MESSAGES.COMPILING_AGENTS);
|
|
636
783
|
const cwd = process.cwd();
|
|
637
784
|
const agentDefs = await loadAgentDefs();
|
|
638
785
|
const { allSkills } = await discoverInstalledSkills(cwd);
|
|
639
786
|
const agentScopeMap = buildAgentScopeMap(configResult.config);
|
|
640
|
-
const
|
|
787
|
+
const compile = compilesGlobalScope(cwd, configResult.propagation) ? compileAgentsAllScopes : compileProjectScope;
|
|
788
|
+
const compileResult = await compile({
|
|
641
789
|
projectDir: cwd,
|
|
642
790
|
sourcePath: agentDefs.sourcePath,
|
|
643
791
|
skills: allSkills,
|
|
644
792
|
agentScopeMap
|
|
645
793
|
});
|
|
646
794
|
this.reportCompilation(compileResult);
|
|
647
|
-
this.
|
|
795
|
+
await this.reportWhatThisHostCannotCarry(cwd);
|
|
796
|
+
this.reportFanOut(configResult.propagation);
|
|
648
797
|
return { configResult, compileResult, agentScopeMap };
|
|
649
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
* What this host could not carry, after the compile summary and once per run.
|
|
801
|
+
*
|
|
802
|
+
* `init --from` is the door a configuration somebody ELSE wrote arrives through, so it is
|
|
803
|
+
* precisely the run that must not be silent about the parts of it that did not survive the
|
|
804
|
+
* translation. `compile` prints the same lines in the same order — see
|
|
805
|
+
* {@link hostCompileNotices}, which is the one place either of them gets them from.
|
|
806
|
+
*
|
|
807
|
+
* A Claude install expresses every setting and carries every sub-agent, so it gets one line at
|
|
808
|
+
* most: the trust dialog, while its project sub-agents' completion gate cannot run in this
|
|
809
|
+
* folder.
|
|
810
|
+
*/
|
|
811
|
+
async reportWhatThisHostCannotCarry(cwd) {
|
|
812
|
+
for (const notice of await hostCompileNotices(providerInUse(cwd), cwd)) {
|
|
813
|
+
this.log(notice);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
650
816
|
/**
|
|
651
817
|
* What the compile pass did, including the half this command used to drop.
|
|
652
818
|
*
|
|
@@ -661,7 +827,7 @@ var Init = class _Init extends BaseCommand {
|
|
|
661
827
|
*/
|
|
662
828
|
reportCompilation(compileResult) {
|
|
663
829
|
const { compiled, failed, warnings } = compileResult;
|
|
664
|
-
const summary = `Compiled ${compiled.length}
|
|
830
|
+
const summary = `Compiled ${plural(compiled.length, "agent")}`;
|
|
665
831
|
if (failed.length === 0) {
|
|
666
832
|
this.log(`${summary}
|
|
667
833
|
`);
|
|
@@ -709,7 +875,7 @@ var Init = class _Init extends BaseCommand {
|
|
|
709
875
|
}
|
|
710
876
|
this.log("");
|
|
711
877
|
this.log("To customize agent-skill assignments:");
|
|
712
|
-
for (const [index, step] of customizationSteps(split, paths.global).entries()) {
|
|
878
|
+
for (const [index, step] of customizationSteps(split, paths.global, cwd).entries()) {
|
|
713
879
|
this.log(` ${index + 1}. ${step}`);
|
|
714
880
|
}
|
|
715
881
|
this.log("");
|
|
@@ -749,16 +915,21 @@ var Init = class _Init extends BaseCommand {
|
|
|
749
915
|
* Reports where the agents actually landed, mirroring the scope split
|
|
750
916
|
* `compileAgentsAllScopes` performs: one pass at the home root, otherwise a
|
|
751
917
|
* global pass under HOME and a project pass under the project directory.
|
|
918
|
+
*
|
|
919
|
+
* **The EXTENSION is the host's, per scope, and was Claude's literal `.md` until C5.** This
|
|
920
|
+
* block describes the filesystem, so every line under a path header has to be a name a user can
|
|
921
|
+
* copy out and open — and a Codex install printed `web-developer.md` above a directory holding
|
|
922
|
+
* `web-developer.toml`. The two scopes are read separately because they can be on two hosts.
|
|
752
923
|
*/
|
|
753
924
|
reportAgentsCompiled(compiled, agentScopeMap) {
|
|
754
925
|
const cwd = process.cwd();
|
|
755
|
-
const groups = isHomeDirectory(cwd) ? [{
|
|
926
|
+
const groups = isHomeDirectory(cwd) ? [{ ...compiledInto(cwd, "project"), agents: compiled }] : [
|
|
756
927
|
{
|
|
757
|
-
|
|
928
|
+
...compiledInto(cwd, "global"),
|
|
758
929
|
agents: compiled.filter((name) => agentScopeMap.get(name) === "global")
|
|
759
930
|
},
|
|
760
931
|
{
|
|
761
|
-
|
|
932
|
+
...compiledInto(cwd, "project"),
|
|
762
933
|
agents: compiled.filter((name) => agentScopeMap.get(name) !== "global")
|
|
763
934
|
}
|
|
764
935
|
].filter((group) => group.agents.length > 0);
|
|
@@ -766,12 +937,37 @@ var Init = class _Init extends BaseCommand {
|
|
|
766
937
|
this.log("Agents compiled to:");
|
|
767
938
|
this.log(` ${group.dir}`);
|
|
768
939
|
for (const agentName of group.agents) {
|
|
769
|
-
this.log(` ${agentName}.
|
|
940
|
+
this.log(` ${agentName}${group.extension}`);
|
|
770
941
|
}
|
|
771
942
|
this.log("");
|
|
772
943
|
}
|
|
773
944
|
}
|
|
774
945
|
};
|
|
946
|
+
function selectsNothing(result) {
|
|
947
|
+
return result.skills.length === 0 && result.selectedAgents.length === 0;
|
|
948
|
+
}
|
|
949
|
+
function compilesGlobalScope(cwd, written) {
|
|
950
|
+
return isHomeDirectory(cwd) || movedGlobalAgentInputs(written);
|
|
951
|
+
}
|
|
952
|
+
function skillsCopiedLine(copyResult, installMode, projectDir) {
|
|
953
|
+
const isMixed = installMode === "mixed";
|
|
954
|
+
const copied = plural(copyResult.totalCopied, isMixed ? "local skill" : "skill");
|
|
955
|
+
const lineEnd = isMixed ? "" : "\n";
|
|
956
|
+
const projectCount = copyResult.projectCopied.length;
|
|
957
|
+
const globalCount = copyResult.globalCopied.length;
|
|
958
|
+
const landedAtBothScopes = projectCount > 0 && globalCount > 0;
|
|
959
|
+
if (landedAtBothScopes) {
|
|
960
|
+
return `Copied ${copied} (${projectCount} project, ${globalCount} global)${lineEnd}`;
|
|
961
|
+
}
|
|
962
|
+
const landedAt = globalCount > 0 ? "global" : "project";
|
|
963
|
+
return `Copied ${copied} to ${resolveInstallPaths(projectDir, landedAt).skillsDir}/${lineEnd}`;
|
|
964
|
+
}
|
|
965
|
+
function compiledInto(cwd, scope) {
|
|
966
|
+
return {
|
|
967
|
+
dir: resolveInstallPaths(cwd, scope).agentsDir,
|
|
968
|
+
extension: agentCodec(providerInUse(installBaseDir(cwd, scope))).extension
|
|
969
|
+
};
|
|
970
|
+
}
|
|
775
971
|
function splitAgentScopes(cwd, agentScopeMap) {
|
|
776
972
|
if (isHomeDirectory(cwd)) return { globalAgentCount: 0, isGlobalOnly: false };
|
|
777
973
|
const scopes = [...agentScopeMap.values()];
|
|
@@ -786,12 +982,12 @@ function configsHoldingAssignments(split, paths) {
|
|
|
786
982
|
if (split.globalAgentCount > 0) return [paths.global, paths.project];
|
|
787
983
|
return [paths.project];
|
|
788
984
|
}
|
|
789
|
-
function customizationSteps(split, globalConfigPath) {
|
|
985
|
+
function customizationSteps(split, globalConfigPath, projectDir) {
|
|
790
986
|
if (split.isGlobalOnly) {
|
|
791
987
|
return [`Edit ${globalConfigPath}`, globalScopedAgentsHint(split.globalAgentCount)];
|
|
792
988
|
}
|
|
793
989
|
return [
|
|
794
|
-
`Edit ${
|
|
990
|
+
`Edit ${relativeConfigPath(projectDir, providerInUse(projectDir))}`,
|
|
795
991
|
`Run '${CLI_INVOKE_COMMAND} compile' to regenerate agents`,
|
|
796
992
|
...split.globalAgentCount > 0 ? [globalScopedAgentsHint(split.globalAgentCount)] : []
|
|
797
993
|
];
|
|
@@ -825,4 +1021,4 @@ export {
|
|
|
825
1021
|
Init,
|
|
826
1022
|
getDashboardData
|
|
827
1023
|
};
|
|
828
|
-
//# sourceMappingURL=chunk-
|
|
1024
|
+
//# sourceMappingURL=chunk-G4JK7WVO.js.map
|