UNPKG

autosnippet

Version:

Extract code patterns into a knowledge base for AI coding assistants

125 lines (124 loc) 3.12 kB
/** * guard.js Guard 安全类工具 (4) * * 7b. list_guard_rules 列出 Guard 规则 * 8b. get_recommendations 获取推荐 Recipe * 13. guard_check_code Guard 检查代码 * 14. query_violations 查询违规历史 */ import type { ToolHandlerContext } from './_shared.js'; export interface ListGuardRulesParams { language?: string; includeBuiltIn?: boolean; limit?: number; } export interface GetRecommendationsParams { limit?: number; } export interface GuardCheckCodeParams { code: string; language?: string; scope?: string; } export interface QueryViolationsParams { file?: string; limit?: number; statsOnly?: boolean; } /** Guard 规则记录 */ export interface GuardRule { source?: string; [key: string]: unknown; } export declare const listGuardRules: { name: string; description: string; parameters: { type: string; properties: { language: { type: string; description: string; }; includeBuiltIn: { type: string; description: string; }; limit: { type: string; description: string; }; }; }; handler: (params: ListGuardRulesParams, ctx: ToolHandlerContext) => Promise<{ total: number; rules: GuardRule[]; }>; }; export declare const getRecommendations: { name: string; description: string; parameters: { type: string; properties: { limit: { type: string; description: string; }; }; }; handler: (params: GetRecommendationsParams, ctx: ToolHandlerContext) => Promise<any>; }; export declare const guardCheckCode: { name: string; description: string; parameters: { type: string; properties: { code: { type: string; description: string; }; language: { type: string; description: string; }; scope: { type: string; description: string; }; }; required: string[]; }; handler: (params: GuardCheckCodeParams, ctx: ToolHandlerContext) => Promise<{ violationCount: any; violations: any; error?: undefined; } | { error: string; violationCount?: undefined; violations?: undefined; }>; }; export declare const queryViolations: { name: string; description: string; parameters: { type: string; properties: { file: { type: string; description: string; }; limit: { type: string; description: string; }; statsOnly: { type: string; description: string; }; }; }; handler: (params: QueryViolationsParams, ctx: ToolHandlerContext) => Promise<any>; };