remcode
Version:
Turn your AI assistant into a codebase expert. Intelligent code analysis, semantic search, and software engineering guidance through MCP integration.
56 lines (55 loc) • 1.39 kB
TypeScript
/**
* Token Management Utilities
*
* Handles collection, validation, and storage of API tokens for remcode MCP server
*/
export interface TokenConfig {
GITHUB_TOKEN?: string;
PINECONE_API_KEY?: string;
HUGGINGFACE_TOKEN?: string;
[key: string]: string | undefined;
}
export interface TokenValidationResult {
valid: boolean;
error?: string;
}
/**
* Token Manager class for handling API tokens
*/
export declare class TokenManager {
private envFilePath;
private gitignorePath;
constructor(projectRoot?: string);
/**
* Load existing tokens from .env file
*/
loadExistingTokens(): TokenConfig;
/**
* Collect missing tokens interactively from user
*/
collectMissingTokens(existingTokens: TokenConfig, cliTokens: TokenConfig): Promise<TokenConfig>;
/**
* Prompt user for a specific token
*/
private promptForToken;
/**
* Get the URL where users can obtain each token
*/
private getTokenUrl;
/**
* Save tokens to .env file
*/
saveTokensToEnv(tokens: TokenConfig): Promise<void>;
/**
* Ensure .env is added to .gitignore
*/
private ensureEnvInGitignore;
/**
* Check if a key is a token key
*/
private isTokenKey;
/**
* Convert CLI options to token config
*/
static cliOptionsToTokens(options: any): TokenConfig;
}