mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(doctor): dedupe missing skill summaries
This commit is contained in:
@@ -17,6 +17,26 @@ export function collectUnavailableAgentSkills(report: SkillStatusReport): SkillS
|
||||
);
|
||||
}
|
||||
|
||||
export function formatMissingSkillSummary(skill: SkillStatusEntry): string {
|
||||
const missing: string[] = [];
|
||||
if (skill.missing.bins.length > 0) {
|
||||
missing.push(`bins: ${skill.missing.bins.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.anyBins.length > 0) {
|
||||
missing.push(`any bins: ${skill.missing.anyBins.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.env.length > 0) {
|
||||
missing.push(`env: ${skill.missing.env.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.config.length > 0) {
|
||||
missing.push(`config: ${skill.missing.config.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.os.length > 0) {
|
||||
missing.push(`os: ${skill.missing.os.join(", ")}`);
|
||||
}
|
||||
return missing.join("; ") || "unknown requirement";
|
||||
}
|
||||
|
||||
/** Disables unavailable skills in config while preserving existing skill entries. */
|
||||
export function disableUnavailableSkillsInConfig(
|
||||
config: OpenClawConfig,
|
||||
|
||||
@@ -16,6 +16,7 @@ import type { DoctorPrompter } from "./doctor-prompter.js";
|
||||
import {
|
||||
collectUnavailableAgentSkills,
|
||||
disableUnavailableSkillsInConfig,
|
||||
formatMissingSkillSummary,
|
||||
} from "./doctor-skills-core.js";
|
||||
|
||||
export {
|
||||
@@ -23,26 +24,6 @@ export {
|
||||
disableUnavailableSkillsInConfig,
|
||||
} from "./doctor-skills-core.js";
|
||||
|
||||
function formatMissingSummary(skill: SkillStatusEntry): string {
|
||||
const missing: string[] = [];
|
||||
if (skill.missing.bins.length > 0) {
|
||||
missing.push(`bins: ${skill.missing.bins.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.anyBins.length > 0) {
|
||||
missing.push(`any bins: ${skill.missing.anyBins.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.env.length > 0) {
|
||||
missing.push(`env: ${skill.missing.env.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.config.length > 0) {
|
||||
missing.push(`config: ${skill.missing.config.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.os.length > 0) {
|
||||
missing.push(`os: ${skill.missing.os.join(", ")}`);
|
||||
}
|
||||
return missing.join("; ") || "unknown requirement";
|
||||
}
|
||||
|
||||
function formatInstallHints(skill: SkillStatusEntry): string[] {
|
||||
if (skill.install.length === 0) {
|
||||
return [];
|
||||
@@ -93,7 +74,7 @@ export function formatUnavailableSkillDoctorLines(skills: SkillStatusEntry[]): s
|
||||
"Some skills are allowed for this agent but are not usable in the current runtime environment.",
|
||||
];
|
||||
for (const skill of skills) {
|
||||
lines.push(`- ${skill.name}: ${formatMissingSummary(skill)}`);
|
||||
lines.push(`- ${skill.name}: ${formatMissingSkillSummary(skill)}`);
|
||||
lines.push(...formatInstallHints(skill));
|
||||
}
|
||||
lines.push(`Disable unused skills: ${formatCliCommand("openclaw doctor --fix")}`);
|
||||
|
||||
@@ -13,7 +13,10 @@ import {
|
||||
shellCompletionStatusToHealthFindings,
|
||||
shellCompletionStatusToRepairEffects,
|
||||
} from "../commands/doctor-completion.js";
|
||||
import { disableUnavailableSkillsInConfig } from "../commands/doctor-skills-core.js";
|
||||
import {
|
||||
disableUnavailableSkillsInConfig,
|
||||
formatMissingSkillSummary,
|
||||
} from "../commands/doctor-skills-core.js";
|
||||
import {
|
||||
detectUiProtocolFreshnessIssues,
|
||||
uiProtocolFreshnessIssueToHealthFinding,
|
||||
@@ -993,23 +996,3 @@ export function createCoreHealthChecks(
|
||||
}
|
||||
|
||||
export const CORE_HEALTH_CHECKS: readonly HealthCheck[] = createCoreHealthChecks();
|
||||
|
||||
function formatMissingSkillSummary(skill: SkillStatusEntry): string {
|
||||
const missing: string[] = [];
|
||||
if (skill.missing.bins.length > 0) {
|
||||
missing.push(`bins: ${skill.missing.bins.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.anyBins.length > 0) {
|
||||
missing.push(`any bins: ${skill.missing.anyBins.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.env.length > 0) {
|
||||
missing.push(`env: ${skill.missing.env.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.config.length > 0) {
|
||||
missing.push(`config: ${skill.missing.config.join(", ")}`);
|
||||
}
|
||||
if (skill.missing.os.length > 0) {
|
||||
missing.push(`os: ${skill.missing.os.join(", ")}`);
|
||||
}
|
||||
return missing.join("; ") || "unknown requirement";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user