/** * PR Guardian Agent - SLOP Native * * Real-time PR protection. Watches pull requests, blocks merging if * critical issues are found, and adds security comments. * * Tools: * - check-pr: Analyze a PR for security issues * - block-pr: Block a PR from merging * - approve-pr: Approve a PR after security review * - add-comment: Add security findings as PR comment * - create-check: Create GitHub/GitLab check run * - get-pr-status: Get security status of a PR */ import { SLOPAgent } from './base.js'; import { SLOPAgentConfig, SLOPToolCall, SLOPToolResult, Finding } from './types.js'; export interface PRCheckResult { prId: string; repo: string; status: 'passed' | 'failed' | 'warning' | 'pending'; blocked: boolean; blockReason?: string; findings: Finding[]; summary: { critical: number; high: number; medium: number; low: number; secretsFound: number; newVulnerabilities: number; }; recommendation: 'approve' | 'request-changes' | 'block'; comment: string; checksCreated: string[]; reviewedAt: string; } export interface PRPolicy { blockOnCritical: boolean; blockOnHigh: boolean; blockOnSecrets: boolean; requireApproval: boolean; autoComment: boolean; autoCreateChecks: boolean; exemptPaths: string[]; exemptAuthors: string[]; } export interface CheckRun { id: string; name: string; status: 'queued' | 'in_progress' | 'completed'; conclusion?: 'success' | 'failure' | 'neutral' | 'cancelled' | 'skipped' | 'timed_out' | 'action_required'; output: { title: string; summary: string; annotations: CheckAnnotation[]; }; url?: string; } export interface CheckAnnotation { path: string; start_line: number; end_line: number; annotation_level: 'notice' | 'warning' | 'failure'; message: string; title: string; } export declare class GuardianAgent extends SLOPAgent { private prResults; private policies; private watchedRepos; private githubToken?; private scannerUrl?; private graderUrl?; constructor(config: SLOPAgentConfig); handleToolCall(call: SLOPToolCall): Promise; /** * Check a PR for security issues */ private checkPR; /** * Block a PR from merging */ private blockPR; /** * Approve a PR after security review */ private approvePR; /** * Add security findings as PR comment */ private addComment; /** * Create a GitHub check run */ private createCheck; /** * Get PR security status */ private getPRStatus; /** * Set security policy for a repo */ private setPolicy; /** * Start watching PRs for a repo */ private watchPRs; private fetchPRDetails; private basicDiffAnalysis; private createPassedResult; private generateComment; } export declare function createGuardianAgent(port?: number, coordinatorUrl?: string): GuardianAgent;