feat(skills): add registry doctor diagnostics and docs
This commit is contained in:
@@ -422,6 +422,61 @@ const checkSkills: Check = async (ctx) => {
|
||||
}
|
||||
};
|
||||
|
||||
function toRegistrySource(value: string): { type: 'file'; path: string } | { type: 'url'; url: string } | null {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed) {
|
||||
return null;
|
||||
}
|
||||
if (trimmed.startsWith('https://')) {
|
||||
return { type: 'url', url: trimmed };
|
||||
}
|
||||
if (trimmed.startsWith('http://')) {
|
||||
return null;
|
||||
}
|
||||
return { type: 'file', path: trimmed };
|
||||
}
|
||||
|
||||
const checkSkillsRegistry: Check = async (ctx) => {
|
||||
if (!ctx.config) {
|
||||
return { status: 'skip', label: 'Skills registry', detail: '(config invalid)' };
|
||||
}
|
||||
|
||||
const configured = ctx.config.skills.registry_source?.trim() || process.env.FLYNN_SKILLS_REGISTRY_SOURCE?.trim() || '';
|
||||
if (!configured) {
|
||||
return {
|
||||
status: 'warn',
|
||||
label: 'Skills registry',
|
||||
detail: 'registry discovery unconfigured (set skills.registry_source or FLYNN_SKILLS_REGISTRY_SOURCE)',
|
||||
};
|
||||
}
|
||||
|
||||
const source = toRegistrySource(configured);
|
||||
if (!source) {
|
||||
return {
|
||||
status: 'fail',
|
||||
label: 'Skills registry',
|
||||
detail: `invalid registry source '${configured}' (use local path or https:// URL)`,
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const { loadSkillRegistryCatalog } = await import('../skills/index.js');
|
||||
const catalog = await loadSkillRegistryCatalog(source);
|
||||
const sourceLabel = source.type === 'file' ? source.path : source.url;
|
||||
return {
|
||||
status: 'pass',
|
||||
label: 'Skills registry',
|
||||
detail: `loaded ${catalog.skills.length} entr${catalog.skills.length === 1 ? 'y' : 'ies'} from ${sourceLabel}`,
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
status: 'fail',
|
||||
label: 'Skills registry',
|
||||
detail: err instanceof Error ? err.message : String(err),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const checkTailscale: Check = async (ctx) => {
|
||||
if (!ctx.config?.server?.tailscale?.serve) {
|
||||
return { status: 'skip', label: 'Tailscale Serve', detail: '(not enabled)' };
|
||||
@@ -533,6 +588,7 @@ const allChecks: Check[] = [
|
||||
checkGmail,
|
||||
checkMcpServers,
|
||||
checkSkills,
|
||||
checkSkillsRegistry,
|
||||
checkTailscale,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user