Skip to content

Commit adb49d9

Browse files
committed
fix: replace silent catch blocks with warn messages
5 silent catch {} blocks across skill-loader, skill-discovery, and gemini adapter now log the actual error. This matches the CONTRIBUTING.md standard: 'Error messages should help the user fix the problem.' Also improved the OpenAI tool stub comment to identify which tool needs implementation. Changed: - skill-loader.ts: parseSkillMd/loadSkillMetadata failures now warn - skill-discovery.ts: skill discovery/load failures now warn - gemini.ts: hook config parse failure now warns via console.warn - openai.ts: tool stub comment names the specific tool
1 parent b3a057a commit adb49d9

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

src/adapters/gemini.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ function buildHooksConfig(agentDir: string): Record<string, any> | null {
373373
}
374374

375375
return Object.keys(geminiHooks).length > 0 ? geminiHooks : null;
376-
} catch {
376+
} catch (err) {
377+
console.warn(`Hook config parse failed: ${(err as Error).message}`);
377378
return null;
378379
}
379380
}

src/adapters/openai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function exportToOpenAI(dir: string): string {
3131
const funcName = tool.name.replace(/-/g, '_');
3232
lines.push(`def ${funcName}(${tool.params}):`);
3333
lines.push(` """${tool.description}"""`);
34-
lines.push(` # TODO: Implement tool logic`);
34+
lines.push(` # Tool stub — replace with actual ${tool.name} implementation`);
3535
lines.push(` pass\n`);
3636
}
3737
}

src/utils/skill-discovery.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { existsSync, readdirSync } from 'node:fs';
22
import { join, resolve } from 'node:path';
33
import { homedir } from 'node:os';
44
import { loadSkillMetadata, loadSkillFull, type SkillMetadata, type ParsedSkill } from './skill-loader.js';
5+
import { warn } from './format.js';
56

67
export interface DiscoveredSkill {
78
name: string;
@@ -76,8 +77,8 @@ export function discoverSkills(options: DiscoveryOptions): DiscoveredSkill[] {
7677
directory: meta.directory,
7778
source,
7879
});
79-
} catch {
80-
// Skip unparseable skills
80+
} catch (err) {
81+
warn(`Skill discovery failed: ${skillMdPath}${(err as Error).message}`);
8182
}
8283
}
8384
}
@@ -96,8 +97,8 @@ export function discoverAndLoadSkills(options: DiscoveryOptions): ParsedSkill[]
9697
const skillMdPath = join(disc.directory, 'SKILL.md');
9798
try {
9899
skills.push(loadSkillFull(skillMdPath));
99-
} catch {
100-
// Skip skills that fail to load
100+
} catch (err) {
101+
warn(`Skill load failed: ${skillMdPath}${(err as Error).message}`);
101102
}
102103
}
103104

src/utils/skill-loader.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { readFileSync, existsSync, readdirSync } from 'node:fs';
22
import { join } from 'node:path';
33
import yaml from 'js-yaml';
4+
import { warn } from './format.js';
45

56
/**
67
* Agent Skills standard frontmatter — matches agentskills.io spec exactly.
@@ -125,8 +126,8 @@ export function loadAllSkills(skillsDir: string): ParsedSkill[] {
125126

126127
try {
127128
skills.push(parseSkillMd(skillMdPath));
128-
} catch {
129-
// Skip skills that fail to parse
129+
} catch (err) {
130+
warn(`Skill parse failed: ${skillMdPath}${(err as Error).message}`);
130131
}
131132
}
132133

@@ -150,8 +151,8 @@ export function loadAllSkillMetadata(skillsDir: string): SkillMetadata[] {
150151

151152
try {
152153
skills.push(loadSkillMetadata(skillMdPath));
153-
} catch {
154-
// Skip skills that fail to parse
154+
} catch (err) {
155+
warn(`Skill metadata load failed: ${skillMdPath}${(err as Error).message}`);
155156
}
156157
}
157158

0 commit comments

Comments
 (0)