@ezenv/cli
v1.0.1
Published
EzEnv CLI - Secure environment variable management from your terminal
Maintainers
Readme
EzEnv CLI
Command-line interface for EzEnv - Secure environment variable management for development teams.
Table of Contents
- Installation
- Quick Start
- Prerequisites
- Commands
- Authentication
- Configuration
- Troubleshooting
- Development
- Contributing
- Support
- License
Installation
Global Installation (Recommended)
npm install -g @ezenv/cliUsing npx (No Installation Required)
npx @ezenv/cli [command]Using Yarn
yarn global add @ezenv/cliUsing pnpm
pnpm add -g @ezenv/cliQuick Start
Authenticate with EzEnv:
ezenv auth loginInitialize a project in your current directory:
ezenv initPull environment variables:
ezenv pull
That's it! Your .env file now contains your team's shared environment variables.
Prerequisites
- Node.js: Version 18.0.0 or higher
- Operating System: macOS, Linux, or Windows
- Network: Internet connection for API access
Commands
Authentication
# Login to EzEnv
ezenv auth login
# Check authentication status
ezenv auth status
# Logout from EzEnv
ezenv auth logoutProject Management
# List all available projects
ezenv projects list
# Select a project to work with
ezenv projects select <project-id>
# or interactively:
ezenv projects selectEnvironment Management
# List environments for current project
ezenv env list
# Select an environment
ezenv env select <environment-name>
# or interactively:
ezenv env selectSecret Management
# Initialize EzEnv in current directory
ezenv init
# Pull secrets from selected environment
ezenv pull
# Compare local .env with remote secrets
ezenv diff
# Sync local changes to remote (coming soon)
ezenv sync
# Show current configuration status
ezenv statusCommand Options
Most commands support these global options:
--help, -h Show help for a command
--version, -v Show CLI version
--verbose Enable verbose logging
--json Output in JSON format (where applicable)Authentication
EzEnv CLI uses device authentication flow for secure, browser-based login:
- Run
ezenv auth login - Visit the provided URL in your browser
- Enter the device code shown in your terminal
- Authenticate with your EzEnv credentials
- Return to the terminal - you're now logged in!
Token Storage
Authentication tokens are stored securely in your system's credential store:
- macOS: Keychain
- Linux: Secret Service API/libsecret
- Windows: Windows Credential Manager
Token Refresh
The CLI automatically refreshes expired tokens. If you encounter authentication issues, try logging out and back in:
ezenv auth logout
ezenv auth loginConfiguration
Project Configuration
After running ezenv init, a .ezenv configuration file is created:
{
"projectId": "your-project-id",
"environment": "development"
}Environment Variables
The CLI respects these environment variables:
EZENV_API_URL: Override the default API endpointEZENV_ENVIRONMENT: Default environment to useEZENV_PROJECT_ID: Default project IDDEBUG: Enable debug logging (DEBUG=ezenv:*)
Git Integration
The CLI automatically adds .env to your .gitignore file when running ezenv init to prevent accidental commits of secrets.
Troubleshooting
Common Issues
Authentication Failed
Error: Authentication failedSolutions:
- Verify your email and password are correct
- Check your internet connection
- Ensure you have an active EzEnv account
- Try logging out and back in
Network Connection Issues
Error: Network request failedSolutions:
- Check your internet connection
- Verify firewall settings allow HTTPS traffic
- If behind a proxy, configure proxy settings
Permission Denied
Error: Permission denied writing to .envSolutions:
- Check file permissions in your project directory
- Ensure you have write access to the current directory
- On Unix systems, you may need to use
sudofor global installation
Project Not Found
Error: Project not foundSolutions:
- Run
ezenv projects listto see available projects - Ensure you have access to the project
- Check if you're authenticated:
ezenv auth status
Debug Mode
Enable verbose logging for troubleshooting:
DEBUG=ezenv:* ezenv pullGetting Help
# Show general help
ezenv --help
# Show help for a specific command
ezenv auth --help
ezenv pull --helpDevelopment
Setup Development Environment
# Clone the repository
git clone https://github.com/longmaba/ezenv-cliezenv.git
cd ezenv/packages/cli
# Install dependencies
pnpm install
# Run in development mode
pnpm devAvailable Scripts
# Development
pnpm dev # Run CLI in development mode
pnpm dev:watch # Run with auto-reload
# Building
pnpm build # Build for production
pnpm build:prod # Clean build for production
# Testing
pnpm test # Run tests
pnpm test:watch # Run tests in watch mode
pnpm test:coverage # Generate coverage report
# Code Quality
pnpm lint # Lint code
pnpm lint:fix # Fix linting issues
pnpm typecheck # Run TypeScript type checkingProject Structure
packages/cli/
├── src/
│ ├── commands/ # Command implementations
│ ├── services/ # Business logic
│ ├── utils/ # Utility functions
│ └── index.ts # CLI entry point
├── tests/ # Test files
├── dist/ # Compiled output
└── package.json # Package configurationContributing
We welcome contributions! Please see our Contributing Guide for details.
Reporting Issues
Found a bug or have a feature request? Open an issue on GitHub.
Support
- Documentation: https://ezenv.dev/docs
- Issues: GitHub Issues
- Discord: Join our community
- Email: [email protected]
License
MIT License - see LICENSE file for details.
Made with ❤️ by the EzEnv Team
