UNPKG

gitset

Version:

Enhanced git init with user configuration management

163 lines 5.49 kB
/** * Application configuration constants */ export const APP_CONFIG = { name: 'gitset', version: '1.0.0', description: 'Enhanced git init with user configuration management', }; /** * CLI behavior configuration */ export const CLI_CONFIG = { maxValidationAttempts: 3, defaultDirectory: process.cwd(), defaultDirectoryPlaceholder: './my-project', exitCodes: { success: 0, error: 1, }, }; /** * Validation configuration */ export const VALIDATION_CONFIG = { username: { minLength: 2, maxLength: 100, }, email: { required: true, }, directory: { requireWritable: true, requireExists: false, // Can create if doesn't exist }, }; /** * Git configuration */ export const GIT_CONFIG = { commands: { version: ['--version'], init: ['init'], configUserName: ['config', 'user.name'], configUserEmail: ['config', 'user.email'], revParse: ['rev-parse', '--git-dir'], }, timeout: 30000, // 30 seconds }; /** * UI Messages */ export const MESSAGES = { success: { gitInit: '✅ Successfully initialized git repository in', gitConfigUpdated: '✅ Successfully updated git configuration in', configured: '📝 Configured with:', gitInstalled: '✔ Git installed successfully!', gitVerified: '✔ Git installation verified!', }, error: { gitInitFailed: '❌ Failed to initialize git repository', validationFailed: '❌ Directory validation failed:', gitRequired: 'Git is required to proceed. Exiting...', maxAttemptsExceeded: 'Maximum validation attempts exceeded', gitInstallFailed: '✖ Git installation failed:', gitVerificationFailed: '✖ Git installation verification failed', fatalError: 'Fatal error:', unexpectedError: '❌ An error occurred:', }, info: { gitNotImplemented: 'Git installation not yet implemented', processing: 'Processing...', }, validation: { usernameRequired: 'Username is required', usernameMinLength: 'Username must be at least 2 characters long', usernameMaxLength: 'Username cannot exceed 100 characters', usernameSpecialChars: 'Username contains special characters that might cause issues', pathNotDirectory: 'Path exists but is not a directory', directoryNotWritable: 'Directory is not writable', directoryNotEmpty: 'Directory is not empty - existing files may be affected', cannotReadDirectory: 'Unable to read directory contents', directoryWillBeCreated: 'Directory will be created', parentDirectoryNotExists: 'Parent directory does not exist and cannot be created', directoryNotExists: 'Directory does not exist', invalidPath: 'Invalid path:', }, prompts: { gitInstall: '🔧 Git is not installed. Would you like to install it automatically?', directory: '📁 Enter the directory path for git initialization:', userInfo: '👤 Configure Git user information:', name: '📝 Enter your name:', email: '📧 Enter your email:', confirm: '✅ Proceed with this configuration?', retry: '❌ {action} failed. Would you like to try again?', selectMethod: '🔧 Select Git installation method:', directoryRequired: 'Directory path is required', configSummary: '📋 Configuration Summary:', gitRepoExists: '📁 Git repository already exists in this directory. Do you want to update the user configuration?', exitMessage: '👋 Goodbye! Git repository initialization cancelled.', }, welcome: { fallbackTitle: '🚀 GITSET CLI 🚀', description: 'Enhanced git init with user configuration management', helpTitle: '📋 This tool will help you:', features: [ '✅ Initialize a new Git repository', '✅ Configure your user information correctly', '✅ Avoid commits with wrong account details', '✅ Install Git automatically if needed', ], nextSteps: [ '• Add your files: git add .', '• Create initial commit: git commit -m "Initial commit"', '• Add remote origin: git remote add origin <url>', '• Push to remote: git push -u origin main', ], }, }; /** * Platform-specific configuration */ export const PLATFORM_CONFIG = { supported: ['darwin', 'linux', 'win32'], packageManagers: { darwin: ['brew', 'xcode-select'], linux: ['apt', 'apt-get', 'yum', 'dnf', 'pacman', 'zypper', 'apk'], win32: ['winget', 'choco', 'scoop'], }, gitVersionPatterns: { default: /git version (\d+\.\d+\.\d+)/, }, git: { nonRetryableErrors: [ 'command not found', 'permission denied', 'no such file or directory', 'not a git repository', ], }, }; /** * ASCII Art and styling */ export const UI_CONFIG = { figlet: { font: 'Standard', horizontalLayout: 'default', verticalLayout: 'default', width: 80, whitespaceBreak: true, }, colors: { primary: 'cyan', success: 'green', error: 'red', warning: 'yellow', info: 'blue', muted: 'gray', }, }; //# sourceMappingURL=constants.js.map