@entro314labs/ai-changelog-generator
Version:
AI-powered changelog generator with MCP server support - works with most providers, online and local models
100 lines (99 loc) • 4.15 kB
TypeScript
/**
* CLI Entry Point Utilities
* Provides process error handlers, startup tips, and common CLI patterns
* Provides CLI error handling, validation, and user interface utilities
*/
interface ProcessErrorHandlerOptions {
gracefulShutdown?: boolean;
logErrors?: boolean;
showStack?: boolean;
onShutdown?: (signal: NodeJS.Signals) => Promise<void> | void;
}
interface GitRepositoryValidationResult {
valid: boolean;
path?: string;
reason?: string;
error?: string;
hasCommits?: boolean;
}
interface CLIPreconditionResult {
valid: boolean;
errors: string[];
warnings: string[];
}
/**
* Enhanced error handling for CLI applications with context-aware tips
* @param {Error} error - The error that occurred
* @param {string} context - Context where the error occurred
* @param {Object} options - Error handling options
*/
export declare function handleCLIError(error: any, context?: string, options?: Record<string, any>): void;
/**
* Comprehensive process error handlers for CLI applications
* @param {string} appName - Name of the application for error messages
* @param {Object} options - Handler options
*/
export declare function setupProcessErrorHandlers(appName?: string, options?: ProcessErrorHandlerOptions): void;
/**
* Enhanced CLI application wrapper with comprehensive startup handling
* @param {string} appName - Name of the application
* @param {string} version - Version string
* @param {Function} initFn - Initialization function to run
* @param {Object} options - Application options
*/
export declare function runCLIApplication(appName: any, version: any, initFn: any, options?: Record<string, any>): Promise<void>;
/**
* Enhanced MCP Server startup wrapper
* @param {string} serverName - Name of the MCP server
* @param {string} version - Version string
* @param {Function} serverClass - MCP Server class constructor
* @param {Object} options - Server options
*/
export declare function runMCPServer(serverName: any, version: any, serverClass: any, options?: Record<string, any>): Promise<void>;
/**
* Enhanced CLI argument validation with detailed feedback
* @param {Array} requiredArgs - Required argument names
* @param {Object} argv - Parsed arguments object
* @param {Object} options - Validation options
* @returns {boolean} Whether all required arguments are present
*/
export declare function validateRequiredArgs(requiredArgs: any, argv: any, options?: Record<string, any>): boolean;
/**
* Enhanced environment validation with helpful guidance
* @param {Array} requiredEnvVars - Required environment variable names
* @param {Object} options - Validation options
* @returns {boolean} Whether all required environment variables are set
*/
export declare function validateEnvironment(requiredEnvVars?: any[], options?: Record<string, any>): boolean;
/**
* Enhanced git repository validation
* @param {string} pathToCheck - Path to check (defaults to current directory)
* @param {Object} options - Validation options
* @returns {Object} Validation result with details
*/
export declare function validateGitRepository(pathToCheck?: string, options?: Record<string, any>): GitRepositoryValidationResult;
/**
* Display helpful startup tips
* @param {string} appName - Name of the application
* @param {Array} tips - Array of tip strings to display
*/
export declare function showStartupTips(appName: any, tips?: any[]): void;
/**
* Enhanced version information display
* @param {string} name - Application name
* @param {string} version - Version string
* @param {Object} additional - Additional version info
*/
export declare function displayVersionInfo(name: any, version: any, additional?: Record<string, any>): void;
/**
* Create startup tips for AI changelog generator
* @returns {Array} Array of helpful tips
*/
export declare function getDefaultStartupTips(): string[];
/**
* Validate common CLI preconditions
* @param {Object} requirements - Requirements to validate
* @returns {Object} Validation result
*/
export declare function validateCLIPreconditions(requirements?: Record<string, any>): CLIPreconditionResult;
export {};