feat(skills): add registry doctor diagnostics and docs

This commit is contained in:
William Valentin
2026-02-16 00:53:25 -08:00
parent 23609a03a4
commit ae36248da8
11 changed files with 298 additions and 23 deletions
+66
View File
@@ -315,6 +315,72 @@ skills:
expect(skillsCheck?.detail).toContain('1 skill(s), 1 available, 0 unavailable');
});
it('reports WARN for skills registry when unconfigured', async () => {
mkdirSync(testDir, { recursive: true });
const configPath = join(testDir, 'registry-unconfigured.yaml');
writeFileSync(configPath, `
telegram:
bot_token: "test-token"
allowed_chat_ids: [123]
models:
default:
provider: anthropic
model: claude-sonnet
`);
const ctx: DoctorContext = { configPath, dataDir: testDir };
const results = await runChecks(ctx);
const registryCheck = results.find(r => r.label === 'Skills registry');
expect(registryCheck?.status).toBe('warn');
expect(registryCheck?.detail).toContain('unconfigured');
});
it('reports PASS for skills registry when source is parsable', async () => {
mkdirSync(testDir, { recursive: true });
const registryPath = join(testDir, 'registry.json');
writeFileSync(registryPath, JSON.stringify({ skills: [] }), 'utf-8');
const configPath = join(testDir, 'registry-pass.yaml');
writeFileSync(configPath, `
telegram:
bot_token: "test-token"
allowed_chat_ids: [123]
models:
default:
provider: anthropic
model: claude-sonnet
skills:
registry_source: "${registryPath}"
`);
const ctx: DoctorContext = { configPath, dataDir: testDir };
const results = await runChecks(ctx);
const registryCheck = results.find(r => r.label === 'Skills registry');
expect(registryCheck?.status).toBe('pass');
expect(registryCheck?.detail).toContain('loaded 0 entries');
});
it('reports FAIL for skills registry when source cannot be loaded', async () => {
mkdirSync(testDir, { recursive: true });
const configPath = join(testDir, 'registry-fail.yaml');
writeFileSync(configPath, `
telegram:
bot_token: "test-token"
allowed_chat_ids: [123]
models:
default:
provider: anthropic
model: claude-sonnet
skills:
registry_source: "${join(testDir, 'missing-registry.json')}"
`);
const ctx: DoctorContext = { configPath, dataDir: testDir };
const results = await runChecks(ctx);
const registryCheck = results.find(r => r.label === 'Skills registry');
expect(registryCheck?.status).toBe('fail');
});
it('reports FAIL when OpenAI auth_mode=api_key has no available key sources', async () => {
const originalHome = process.env.HOME;
const originalKey = process.env.OPENAI_API_KEY;