remcode
Version:
Turn your AI assistant into a codebase expert. Intelligent code analysis, semantic search, and software engineering guidance through MCP integration.
75 lines (74 loc) • 2.1 kB
TypeScript
/**
* One-Shot Permission Validator
* Validates ALL required permissions upfront - GitHub, HuggingFace, Pinecone
*
* Core Principle: "All or Nothing" - Either user has ALL permissions or setup fails with clear guidance
*/
export interface ValidationResult {
isValid: boolean;
service: string;
issue?: string;
fixUrl?: string;
details?: string;
}
export interface ComprehensiveValidation {
allValid: boolean;
github: ValidationResult;
huggingface: ValidationResult;
pinecone: ValidationResult;
repositoryAccess?: ValidationResult;
setupUrls: {
github: string;
huggingface: string;
pinecone: string;
};
message: string;
}
export interface RepositoryPermissions {
owner: string;
repo: string;
hasAdmin: boolean;
hasPush: boolean;
hasPull: boolean;
isOwner: boolean;
}
/**
* Comprehensive Permission Validator
* Validates all services in one shot
*/
export declare class PermissionValidator {
private static readonly REQUIRED_GITHUB_SCOPES;
private static readonly SETUP_URLS;
private static readonly TEST_MODELS;
/**
* Validate all required permissions across all services
*/
static validateAllPermissions(): Promise<ComprehensiveValidation>;
/**
* Validate specific repository access (called after general validation)
*/
static validateRepositoryAccess(owner: string, repo: string): Promise<RepositoryPermissions>;
/**
* Validate GitHub token and repository permissions
*/
private static validateGitHubToken;
/**
* Validate HuggingFace token and model access
*/
private static validateHuggingFaceToken;
/**
* Validate Pinecone API access and operations
*/
private static validatePineconeToken;
/**
* Get GitHub token scopes from API response
*/
private static getTokenScopes;
/**
* Generate comprehensive setup guidance
*/
static generateSetupGuidance(validation: ComprehensiveValidation): {
markdown: string;
actionItems: string[];
};
}