Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 1x 1x 46x 46x 46x 46x 46x 46x 8x 8x | import type { Skill } from '@shared/types/data';
export interface SkillValidationResult {
isReady: boolean;
missingRequirements: string[];
}
/**
* Validates whether a skill is ready for use.
* A skill is considered ready if:
* - It has at least one model configured
* - If optimization is enabled, it must have at least one evaluation
*
* @param _skill - The skill to validate (reserved for future validation rules)
* @param modelsCount - The number of models configured for this skill
* @param evaluationsCount - The number of evaluations configured for this skill
* @param optimize - Whether optimization is enabled for this skill
* @returns Validation result with readiness status and missing requirements
*/
export function validateSkill(
_skill: Skill,
modelsCount: number,
evaluationsCount: number,
optimize: boolean,
): SkillValidationResult {
const missingRequirements: string[] = [];
if (modelsCount === 0) {
missingRequirements.push('At least one model must be configured');
}
if (optimize && evaluationsCount === 0) {
missingRequirements.push('At least one evaluation must be configured');
}
return {
isReady: missingRequirements.length === 0,
missingRequirements,
};
}
/**
* Checks if a skill is ready based on models and evaluations count.
*
* @param modelsCount - The number of models configured for the skill
* @param evaluationsCount - The number of evaluations configured for the skill
* @param optimize - Whether optimization is enabled for the skill
* @returns True if the skill meets all requirements
*/
export function isSkillReady(
modelsCount: number,
evaluationsCount: number,
optimize: boolean,
): boolean {
if (modelsCount === 0) return false;
if (optimize && evaluationsCount === 0) return false;
return true;
}
|