fix(setup): install the skill for Claude Code

This commit is contained in:
morluto
2026-10-10 02:49:46 +08:00
parent ed8fcae94b
commit b4a19193fe
15 changed files with 484 additions and 148 deletions
+25 -6
View File
@@ -67,20 +67,31 @@ export const runSetup = async (
: (options.clientIds ??
options.readinessScope?.clients ??
discovery.defaultClientIds);
let skillNeedsInstall = await host.skillNeedsInstall(selectedClientIds);
let skillSelected =
options.installSkill === true ||
(options.installSkill !== false && selectedClientIds.length > 0);
let installSkill = skillSelected && discovery.skillNeedsInstall;
let installSkill = skillSelected && skillNeedsInstall;
let planDiscovery = discovery;
if (interactiveSelection) {
const selectionSkillClientIds = [
...new Set([
...discovery.defaultClientIds,
...discovery.detectedClientIds,
]),
];
const selectionSkillNeedsInstall = await host.skillNeedsInstall(
selectionSkillClientIds,
);
const offerSkillAction =
options.installSkill !== false && discovery.skillNeedsInstall;
options.installSkill !== false && selectionSkillNeedsInstall;
const selectionActions = await planSetupActions({
discovery,
host,
providerEnvironment,
command: host.registrationCommand,
clientIds: [],
skillClientIds: selectionSkillClientIds,
installSkill: offerSkillAction,
});
const decision = await confirm(selectionActions.plannedActions, {
@@ -111,6 +122,7 @@ export const runSetup = async (
selectedClientIds = [...selectedActionIds]
.filter((id) => id.startsWith("configure_client:"))
.map((id) => id.slice("configure_client:".length));
skillNeedsInstall = await host.skillNeedsInstall(selectedClientIds);
const proposedInstallAction = selectionActions.plannedActions.some(
({ id }) => id === "install_hopper",
);
@@ -125,7 +137,7 @@ export const runSetup = async (
(selectedActionIds.has("install_skill") &&
selectedClientIds.length === 0) ||
(options.installSkill !== false && selectedClientIds.length > 0);
installSkill = skillSelected && discovery.skillNeedsInstall;
installSkill = skillSelected && skillNeedsInstall;
}
const planned = await planSetupActions({
discovery: planDiscovery,
@@ -133,6 +145,7 @@ export const runSetup = async (
providerEnvironment,
command: host.registrationCommand,
clientIds: selectedClientIds,
skillClientIds: selectedClientIds,
installSkill,
});
plannedActions = planned.plannedActions;
@@ -239,10 +252,15 @@ export const runSetup = async (
if (clientFailure !== undefined) return fail(clientFailure);
if (
planSelection.installSkill &&
!(await installSkillAction(host, options, appliedActions))
!(await installSkillAction(
host,
options,
appliedActions,
selectedClientIds,
))
)
return fail(
"REA analysis skill could not be installed or verified. Check permissions for `~/.agents/skills`, then rerun setup.",
"REA analysis skill could not be installed or verified. Check permissions for its planned skill directories, then rerun setup.",
);
const doctor = summarizeDoctor(await host.doctor(readinessScope));
const remediation = combineRemediation(
@@ -330,6 +348,7 @@ const installSkillAction = async (
host: SetupHost,
options: SetupOptions,
appliedActions: string[],
skillClientIds: readonly string[],
): Promise<boolean> => {
const label = "REA reverse-engineering skill";
emitProgress(options, {
@@ -337,7 +356,7 @@ const installSkillAction = async (
label,
state: "started",
});
const skill = await host.installSkill();
const skill = await host.installSkill(skillClientIds);
if (skill === "failed") {
emitProgress(options, {
actionId: "install_skill",